Skip to main content

Campaign Weekly Working Minutes Support Added

HAPI Backend Campaign Ordering Endpoint now also supports passing weeklyWorkingMinutes.


info

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.


note

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 contain weeklyWorkingMinutes inside postingDetails when the app loads
  • window.hapi.campaign.service.getEditCampaignRequestBody.run() will contain weeklyWorkingMinutes inside postingDetails
  • window.hapi.campaign.service.getCopyCampaignRequestBody.run() will contain weeklyWorkingMinutes inside postingDetails
  • window.hapi.campaign.utils.getEditCampaignRequestBody() will contain weeklyWorkingMinutes inside postingDetails
  • window.hapi.campaign.utils.getCopyCampaignRequestBody() will contain weeklyWorkingMinutes inside postingDetails
  • window.hapi.campaign.utils.getInitialCampaignForm() will contain weeklyWorkingMinutes inside postingDetails
  • window.hapi.campaign.utils.getCampaignEditForm() will contain weeklyWorkingMinutes inside postingDetails
  • window.hapi.orderJourney.state.postingDetailsStep.value will contain weeklyWorkingMinutes inside errorMessagesIntlDescriptors
  • window.hapi.orderJourney.state.postingDetailsStepValidators.value will contain weeklyWorkingMinutes
  • window.hapiQA.campaign.useMockCampaignForm() will prefill window.hapi.campaign.state.campaignForm.value with postingDetails.weeklyWorkingMinutes
  • window.hapi.orderJourney.service.restartJourney.run() will reset window.hapi.campaign.state.campaignForm.value back to the initial value (quite simply the returned object by window.hapi.campaign.utils.getInitialCampaignForm()) with weeklyWorkingMinutes inside postingDetails

Changes & Additions

HTML IDs added

  • campaign-create-form-posting-details-weekly-working-minutes-from-input for the from fields minutes input
  • campaign-create-form-posting-details-weekly-working-minutes-to-input for the to fields minutes input

i18n translations added

Key"en" value"de" value"nl" value"fr" value
campaign.posting-details.weekly-working-minutes.from-placeholderEnter a value for the minutesGeben Sie einen Wert für die Minuten einVul een waarde in voor de minutenEntrez une valeur pour les minutes
campaign.posting-details.weekly-working-minutes.to-placeholderEnter a value for the minutesGeben Sie einen Wert für die Minuten einVul een waarde in voor de minutenEntrez une valeur pour les minutes
common.range.seconds.shortsecsSek.secs
common.range.minutes.shortminsMin.minmin
common.range.hours.shorthrsStd.uurh
common.range.days.shortdaysTg.dagj
common.range.days.shortdaysTg.dagj
common.range.weeks.shortwksWo.wksem
common.range.months.shortmosMo.mndmois
common.range.secondssecondsSekundensecondensecondes
common.range.minutesminutesMinutenminutenminutes

Typescript types

Added

Changed

  • CampaignPostingDetails changed to allow weeklyWorkingMinutes in campaign types
  • CampaignCreateFormPostingDetails changed to allow weeklyWorkingMinutes in campaign types
  • OrderJourneyOrderErrorsPostingDetailsBase changed to allow weeklyWorkingMinutes in orderJourney types

Validations

Added

  • window.hapi.campaign.validation.postingDetailsWeeklyWorkingMinutes added in campaign validation

Changed

  • window.hapi.campaign.validation.postingDetails changed to allow weeklyWorkingMinutes in campaign validation
  • window.hapi.campaign.validation.postingDetails changed to allow weeklyWorkingMinutes in campaign validation
  • window.hapi.campaign.validation.campaignFormPostingDetails changed to allow weeklyWorkingMinutes in campaign validation