From 1c46518df870a388dc8290a66a8b9490c3af5187 Mon Sep 17 00:00:00 2001 From: Vivian A Goodrich <101133187+vgoodric@users.noreply.github.com> Date: Wed, 9 Aug 2023 13:36:04 -0600 Subject: [PATCH] Mep button on target only (#1066) * add mep button if only target is on, not pzn * just removing if clause instead * if back in and adding mep override to other if * add else if empty * move to personalization * move similar code to function --------- Co-authored-by: vivgoodrich --- .../personalization/personalization.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/libs/features/personalization/personalization.js b/libs/features/personalization/personalization.js index c0077bf792..6b39247141 100644 --- a/libs/features/personalization/personalization.js +++ b/libs/features/personalization/personalization.js @@ -474,12 +474,22 @@ function cleanManifestList(manifests) { return cleanedList; } -export async function applyPers(manifests) { - if (!manifests?.length) return; - const cleanedManifests = cleanManifestList(manifests); +const decoratePreviewCheck = async (config, experiments) => { + if (config.mep?.preview) { + const { default: decoratePreviewMode } = await import('./preview.js'); + decoratePreviewMode(experiments); + } +}; +export async function applyPers(manifests) { const config = getConfig(); + if (!manifests?.length) { + decoratePreviewCheck(config, []); + return; + } + const cleanedManifests = cleanManifestList(manifests); + let results = []; for (const manifest of cleanedManifests) { results.push(await runPersonalization(manifest, config)); @@ -495,8 +505,5 @@ export async function applyPers(manifests) { expFragments: consolidateObjects(results, 'fragments'), }); - if (config.mep?.preview) { - const { default: decoratePreviewMode } = await import('./preview.js'); - decoratePreviewMode(experiments); - } + decoratePreviewCheck(config, experiments); }