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.value
initial state will containweeklyWorkingMinutes
insidepostingDetails
when the app loadswindow.hapi.campaign.service.getEditCampaignRequestBody.run()
will containweeklyWorkingMinutes
insidepostingDetails
window.hapi.campaign.service.getCopyCampaignRequestBody.run()
will containweeklyWorkingMinutes
insidepostingDetails
window.hapi.campaign.utils.getEditCampaignRequestBody()
will containweeklyWorkingMinutes
insidepostingDetails
window.hapi.campaign.utils.getCopyCampaignRequestBody()
will containweeklyWorkingMinutes
insidepostingDetails
window.hapi.campaign.utils.getInitialCampaignForm()
will containweeklyWorkingMinutes
insidepostingDetails
window.hapi.campaign.utils.getCampaignEditForm()
will containweeklyWorkingMinutes
insidepostingDetails
window.hapi.orderJourney.state.postingDetailsStep.value
will containweeklyWorkingMinutes
insideerrorMessagesIntlDescriptors
window.hapi.orderJourney.state.postingDetailsStepValidators.value
will containweeklyWorkingMinutes
window.hapiQA.campaign.useMockCampaignForm()
will prefillwindow.hapi.campaign.state.campaignForm.value
withpostingDetails.weeklyWorkingMinutes
window.hapi.orderJourney.service.restartJourney.run()
will resetwindow.hapi.campaign.state.campaignForm.value
back to the initial value (quite simply the returned object bywindow.hapi.campaign.utils.getInitialCampaignForm()
) withweeklyWorkingMinutes
insidepostingDetails
Changes & Additions
HTML IDs added
campaign-create-form-posting-details-weekly-working-minutes-from-input
for thefrom
fieldsminutes
inputcampaign-create-form-posting-details-weekly-working-minutes-to-input
for theto
fieldsminutes
input
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
CampaignPostingDetailsWeeklyWorkingMinutes
added to campaign types
Changed
CampaignPostingDetails
changed to allowweeklyWorkingMinutes
in campaign typesCampaignCreateFormPostingDetails
changed to allowweeklyWorkingMinutes
in campaign typesOrderJourneyOrderErrorsPostingDetailsBase
changed to allowweeklyWorkingMinutes
in orderJourney types
Validations
Added
window.hapi.campaign.validation.postingDetailsWeeklyWorkingMinutes
added in campaign validation
Changed
window.hapi.campaign.validation.postingDetails
changed to allowweeklyWorkingMinutes
in campaign validationwindow.hapi.campaign.validation.postingDetails
changed to allowweeklyWorkingMinutes
in campaign validationwindow.hapi.campaign.validation.campaignFormPostingDetails
changed to allowweeklyWorkingMinutes
in campaign validation