diff --git a/libs/features/personalization/add-preview-to-config.js b/libs/features/personalization/add-preview-to-config.js index 409c7b78c1..f19a7d41bc 100644 --- a/libs/features/personalization/add-preview-to-config.js +++ b/libs/features/personalization/add-preview-to-config.js @@ -4,14 +4,13 @@ export default async function addPreviewToConfig({ pageUrl, persEnabled, persManifests, - previewPage, targetEnabled, }) { const { mep: mepOverride, mepHighlight, mepButton } = Object.fromEntries(pageUrl.searchParams); const config = updateConfig({ ...getConfig(), mep: { - preview: (mepButton !== 'off' && (mepOverride !== undefined || (previewPage && (persEnabled || targetEnabled)))), + preview: (mepButton !== 'off' && (mepOverride !== undefined || persEnabled || targetEnabled)), override: mepOverride ? decodeURIComponent(mepOverride) : '', highlight: (mepHighlight !== undefined && mepHighlight !== 'false'), }, diff --git a/libs/utils/utils.js b/libs/utils/utils.js index 6a03e70738..f3b582edea 100644 --- a/libs/utils/utils.js +++ b/libs/utils/utils.js @@ -739,16 +739,14 @@ async function checkForPageMods() { .filter((path) => path?.trim()); } - const { mep: mepOverride } = Object.fromEntries(PAGE_URL.searchParams); const { env } = getConfig(); - const previewPage = env?.name === 'stage' || env?.name === 'local'; - if (mepOverride || mepOverride === '' || previewPage) { + const mep = PAGE_URL.searchParams.get('mep'); + if (mep !== null || (env.name !== 'prod' && (persEnabled || targetEnabled))) { const { default: addPreviewToConfig } = await import('../features/personalization/add-preview-to-config.js'); persManifests = await addPreviewToConfig({ pageUrl: PAGE_URL, persEnabled, persManifests, - previewPage, targetEnabled, }); }