Skip to content

Commit

Permalink
account for no stageDomainsMap
Browse files Browse the repository at this point in the history
  • Loading branch information
vgoodric committed Jan 2, 2025
1 parent 29d77a6 commit fa66ca1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libs/features/personalization/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,18 @@ function addPillEventListeners(div) {
export function parsePageAndUrl(config, windowLocation, prefix) {
const { stageDomainsMap, env } = config;
const { pathname, origin } = windowLocation;
if (env?.name === 'prod' || !stageDomainsMap) {
return { page: pathname.replace(`/${prefix}/`, '/'), url: `${origin}${pathname}` };
}
let path = pathname;
let domain = origin;
const allowedHosts = [
'business.stage.adobe.com',
'www.stage.adobe.com',
'milo.stage.adobe.com',
];
if (env?.name === 'prod' || !stageDomainsMap) {
const domain = allowedHosts.includes(origin.replace('https://', ''))
? origin.replace('stage.adobe.com', 'adobe.com') : origin;
return { page: pathname.replace(`/${prefix}/`, '/'), url: `${domain}${pathname}` };
}
let path = pathname;
let domain = origin;
const domainCheck = Object.keys(stageDomainsMap)
.find((key) => {
try {
Expand Down

0 comments on commit fa66ca1

Please sign in to comment.