Skip to content

Commit

Permalink
MWPW-156388 [MILO][MEP] fix for martech=off when page has manifest wi…
Browse files Browse the repository at this point in the history
…th enablements (#2720)

* initial fix

* Update libs/features/personalization/personalization.js

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* move where martech=off is used

* move logic to handleEntitlements function

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
vgoodric and github-actions[bot] committed Aug 12, 2024
1 parent 7b9c7cf commit 36051c6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions libs/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ export function getMetadata(name, doc = document) {
}

const handleEntitlements = (() => {
const { martech } = Object.fromEntries(PAGE_URL.searchParams);
if (martech === 'off') return () => {};
let entResolve;
const entPromise = new Promise((resolve) => {
entResolve = resolve;
Expand Down Expand Up @@ -924,16 +926,21 @@ export const getMepEnablement = (mdKey, paramKey = false) => {
};

async function checkForPageMods() {
const { mep: mepParam, mepHighlight, mepButton } = Object.fromEntries(PAGE_URL.searchParams);
const {
mep: mepParam,
mepHighlight,
mepButton,
martech,
} = Object.fromEntries(PAGE_URL.searchParams);
if (mepParam === 'off') return;
const pzn = getMepEnablement('personalization');
const promo = getMepEnablement('manifestnames', PROMO_PARAM);
const target = getMepEnablement('target');
const target = martech === 'off' ? false : getMepEnablement('target');
if (!(pzn || target || promo || mepParam
|| mepHighlight || mepButton || mepParam === '')) return;
if (target) {
loadMartech();
} else if (pzn) {
} else if (pzn && martech !== 'off') {
loadIms()
.then(() => {
/* c8 ignore next */
Expand Down

0 comments on commit 36051c6

Please sign in to comment.