Skip to content

Commit

Permalink
calculate preview in utils
Browse files Browse the repository at this point in the history
  • Loading branch information
vgoodric committed Jun 7, 2024
1 parent ca8ba03 commit 5813c8a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ export const combineMepSources = async (persEnabled, promoEnabled, mepParam) =>
};

async function checkForPageMods() {
const { mep: mepParam } = Object.fromEntries(PAGE_URL.searchParams);
const { mep: mepParam, mepButton } = Object.fromEntries(PAGE_URL.searchParams);
if (mepParam === 'off') return;
const persEnabled = getMepEnablement('personalization');
const promoEnabled = getMepEnablement('manifestnames', 'promo');
Expand All @@ -928,7 +928,11 @@ async function checkForPageMods() {
if (!mepEnabled) return;

const config = getConfig();
config.mep = { targetEnabled };
config.mep = {
targetEnabled,
preview: (mepButton !== 'off'
&& (config.env?.name !== 'prod' || mepParam || mepParam === '' || mepButton)),
};
loadLink(
`${config.base}/features/personalization/personalization.js`,
{ as: 'script', rel: 'modulepreload' },
Expand Down

0 comments on commit 5813c8a

Please sign in to comment.