From 9435d4e312e84765ed0726e1f03513ff7f465549 Mon Sep 17 00:00:00 2001 From: Mark Perry <124626043+markpadbe@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:23:33 -0800 Subject: [PATCH] MWPW-161871 [MEP] useblockcode action fails if page is on milo site (#3161) * stash * ready to publish * interact call coming back but timing out * working on a fast connection * clean up ifs * working with promise * use camel case on let variable * unit tests * update unit tests * MWPW-149504 [MILO][MEP] Move entitlements object to the same JSON file used by the library (#3047) * create mepxlg branch * update library * require full hostname match * update reference for unit test * switch to use config instead of domain list and stub response in unit test * update fetch to 2 * updating another fetch to 2 * restore normalizePath to use preview domains on preview links * preload segment list json * use getFederatedUrl instead * import at top so we don't have to make normalizePath async * MWPW-148129 [MILO][MEP][GNAV] Able to use select by url feature with federated link (#3064) * add federated link function to registerInBlockActions * add to unit test * add unit test coverage * initial commit * Fix useblock code issue --------- Co-authored-by: vgoodric Co-authored-by: Vivian A Goodrich <101133187+vgoodric@users.noreply.github.com> --- libs/features/personalization/personalization.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/features/personalization/personalization.js b/libs/features/personalization/personalization.js index b108705c27..0dd02c89e9 100644 --- a/libs/features/personalization/personalization.js +++ b/libs/features/personalization/personalization.js @@ -244,7 +244,7 @@ const fetchData = async (url, type = DATA_TYPE.JSON) => { return null; }; -const getBlockProps = (fVal, miloLibs, origin) => { +const getBlockProps = (fVal, config, origin) => { let val = fVal; if (val?.includes('\\')) val = val?.split('\\').join('/'); if (!val?.startsWith('/')) val = `/${val}`; @@ -252,7 +252,7 @@ const getBlockProps = (fVal, miloLibs, origin) => { if (val.startsWith('/libs/')) { /* c8 ignore next 1 */ - val = `${miloLibs}${val.replace('/libs', '')}`; + val = `${config.miloLibs || config.codeRoot}${val.replace('/libs', '')}`; } else { val = `${origin}${val}`; } @@ -595,7 +595,7 @@ const getVariantInfo = (line, variantNames, variants, manifestPath, fTargetId) = variants[vn][action] = variants[vn][action] || []; if (action === 'useblockcode') { - const { blockSelector, blockTarget } = getBlockProps(line[vn], config.miloLibs, origin); + const { blockSelector, blockTarget } = getBlockProps(line[vn], config, origin); variants[vn][action].push({ selector: blockSelector, val: blockTarget,