Skip to content

Commit

Permalink
MWPW-161871 [MEP] useblockcode action fails if page is on milo site (#…
Browse files Browse the repository at this point in the history
…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 <vgoodric@adobe.com>
Co-authored-by: Vivian A Goodrich <101133187+vgoodric@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent e95bd5c commit 9435d4e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/features/personalization/personalization.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ 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}`;
const blockSelector = val?.split('/').pop();

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}`;
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9435d4e

Please sign in to comment.