Skip to content

Commit

Permalink
Mep button on target only (#1066)
Browse files Browse the repository at this point in the history
* 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 <vivian.goodrich@gmail.com>
  • Loading branch information
vgoodric and vivgoodrich committed Aug 9, 2023
1 parent 7a99ceb commit 1c46518
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions libs/features/personalization/personalization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);
}

0 comments on commit 1c46518

Please sign in to comment.