Campaign Weekly Working Minutes Support Added
HAPI Backend Campaign Ordering Endpoint now also supports passing weeklyWorkingMinutes.
To get this feature enabled, you need to consult with your Partner Account Manager as otherwise you will get an error from HAPI Backend if you try to pass weeklyWorkingMinutes while it is disabled on our end!
If you are prefilling weeklyWorkingHours and want to switch using weeklyWorkingMinutes instead, after getting the feature enabled, you can specify inside postingDetails as explained in How to migrate section in this page. If you are not prefilling then you don't need to do anything on your side, we simply need to enable the flag on our end.
HAPI Elements, when the flag is enabled, will show a different (albeit similar) UI to the end user:

To keep backwards compatability intact, the DOM is kept same as weekly working hours implementation in terms of ID and class selectors so your UI submodule functions still work (like in terms of hiding/styling the section) and the extra fields that show up (minutes input field as well as the badges next to the inputs to indicate hrs and mins) are documented at the bottom of this page.
We will first enable the feature on our sandbox environment, allowing you time to migrate to using weeklyWorkingMinutes, then later enable the feature on our production environment when your code is pushed to your own production environment.
Your code that prefills the campaign form with weeklyWorkingHours will still continue to work. Even after switching to weeklyWorkingMinutes, behind the scenes, HAPI Elements will handle the conversion of weeklyWorkingMinutes to weeklyWorkingHours and vice versa so there is no need to worry about the time we enable the feature on our side matching exactly the time you deploy your code to your own production environment.
For campaigns that are already created with weeklyWorkingHours & when feature is enabled on our side as per your request;
- when the user is editing the campaign OR
- when the user is trying to copy a campaign via "Create new from this" button
they will be presented with the new UI so that they can enter the minutes values if needed and HAPI Elements will also handle automatic conversion of existing weeklyWorkingHours of the campaign to weeklyWorkingMinutes.
If for some reason, later you decide to get the feature turned off on our side (after having it turned on for some time) and that you already have migrated your code to weeklyWorkingMinutes, HAPI Elements will also handle conversion back to weeklyWorkingHours by discarding the minutes values.
How to migrate to using weeklyWorkingMinutes
If you are prefilling the campaign form's postingDetails.weeklyWorkingHours then you need to do the following:
const yourMappedCampaignObject = {
// ...rest of the details you are prefilling
postingDetails: {
// ... rest of the posting details you are prefilling
weeklyWorkingHours: {} // remove this
weeklyWorkingMinutes: { // add this new object
from: 150, // your value in minutes. note that you need to do the math of the total minutes: hours * 60 + minutes is the formula
to: 345 // your value in minutes. note that you need to do the math of the total minutes: hours * 60 + minutes is the formula
}
}
}
window.hapi.campaign.state.campaignForm = window.hapiUtils.mergeDeepOverwriteArrays(
window.hapi.campaign.state.campaignForm.value,
yourMappedCampaignObject
)
If you are doing some initial load state checks then you need to do the following:
// weeklyWorkingHours will no longer be present when feature is turned on on our side
if (window.hapi.campaign.state.campaignForm.value.weeklyWorkingHours) {}
// weeklyWorkingMinutes will be present with default values
if (window.hapi.campaign.state.campaignForm.value.weeklyWorkingMinutes) {}
Service function to order campaign
window.hapi.campaign.service.orderCampaign will be sending inside postingDetails the weeklyWorkingMinutes and there will not be weeklyWorkingHours. If you are using Your own backend proxy and have some code relating to weeklyWorkingHours on your backend, then you also need to change to using weeklyWorkingMinutes.
Functions and variables will now report weeklyWorkingMinutes instead of weeklyWorkingHours
The following variables and functions will now include weeklyWorkingMinutes instead of weeklyWorkingHours when we have the feature turned on for you on HAPI Backend:
window.hapi.campaign.state.campaignForm.valueinitial state will containweeklyWorkingMinutesinsidepostingDetailswhen the app loadswindow.hapi.campaign.service.getEditCampaignRequestBody.run()will containweeklyWorkingMinutesinsidepostingDetailswindow.hapi.campaign.service.getCopyCampaignRequestBody.run()will containweeklyWorkingMinutesinsidepostingDetailswindow.hapi.campaign.utils.getEditCampaignRequestBody()will containweeklyWorkingMinutesinsidepostingDetailswindow.hapi.campaign.utils.getCopyCampaignRequestBody()will containweeklyWorkingMinutesinsidepostingDetailswindow.hapi.campaign.utils.getInitialCampaignForm()will containweeklyWorkingMinutesinsidepostingDetailswindow.hapi.campaign.utils.getCampaignEditForm()will containweeklyWorkingMinutesinsidepostingDetailswindow.hapi.orderJourney.state.postingDetailsStep.valuewill containweeklyWorkingMinutesinsideerrorMessagesIntlDescriptorswindow.hapi.orderJourney.state.postingDetailsStepValidators.valuewill containweeklyWorkingMinuteswindow.hapiQA.campaign.useMockCampaignForm()will prefillwindow.hapi.campaign.state.campaignForm.valuewithpostingDetails.weeklyWorkingMinuteswindow.hapi.orderJourney.service.restartJourney.run()will resetwindow.hapi.campaign.state.campaignForm.valueback to the initial value (quite simply the returned object bywindow.hapi.campaign.utils.getInitialCampaignForm()) withweeklyWorkingMinutesinsidepostingDetails
Changes & Additions
HTML IDs added
campaign-create-form-posting-details-weekly-working-minutes-from-inputfor thefromfieldsminutesinputcampaign-create-form-posting-details-weekly-working-minutes-to-inputfor thetofieldsminutesinput
i18n translations added
| Key | "en" value | "de" value | "nl" value | "fr" value |
|---|---|---|---|---|
| campaign.posting-details.weekly-working-minutes.from-placeholder | Enter a value for the minutes | Geben Sie einen Wert für die Minuten ein | Vul een waarde in voor de minuten | Entrez une valeur pour les minutes |
| campaign.posting-details.weekly-working-minutes.to-placeholder | Enter a value for the minutes | Geben Sie einen Wert für die Minuten ein | Vul een waarde in voor de minuten | Entrez une valeur pour les minutes |
| common.range.seconds.short | secs | Sek. | sec | s |
| common.range.minutes.short | mins | Min. | min | min |
| common.range.hours.short | hrs | Std. | uur | h |
| common.range.days.short | days | Tg. | dag | j |
| common.range.days.short | days | Tg. | dag | j |
| common.range.weeks.short | wks | Wo. | wk | sem |
| common.range.months.short | mos | Mo. | mnd | mois |
| common.range.seconds | seconds | Sekunden | seconden | secondes |
| common.range.minutes | minutes | Minuten | minuten | minutes |
Typescript types
Added
CampaignPostingDetailsWeeklyWorkingMinutesadded to campaign types
Changed
CampaignPostingDetailschanged to allowweeklyWorkingMinutesin campaign typesCampaignCreateFormPostingDetailschanged to allowweeklyWorkingMinutesin campaign typesOrderJourneyOrderErrorsPostingDetailsBasechanged to allowweeklyWorkingMinutesin orderJourney types
Validations
Added
window.hapi.campaign.validation.postingDetailsWeeklyWorkingMinutesadded in campaign validation
Changed
window.hapi.campaign.validation.postingDetailschanged to allowweeklyWorkingMinutesin campaign validationwindow.hapi.campaign.validation.postingDetailschanged to allowweeklyWorkingMinutesin campaign validationwindow.hapi.campaign.validation.campaignFormPostingDetailschanged to allowweeklyWorkingMinutesin campaign validation