From 36051c61b7aa7260f9101a036c9a8335967036b9 Mon Sep 17 00:00:00 2001 From: Vivian A Goodrich <101133187+vgoodric@users.noreply.github.com> Date: Mon, 12 Aug 2024 03:15:47 -0600 Subject: [PATCH] MWPW-156388 [MILO][MEP] fix for martech=off when page has manifest with 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> --- libs/utils/utils.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libs/utils/utils.js b/libs/utils/utils.js index 4402f394ae..f791165d38 100644 --- a/libs/utils/utils.js +++ b/libs/utils/utils.js @@ -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; @@ -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 */