Skip to content

Commit

Permalink
MWPW-155099 - resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
draganalilly021 committed Aug 7, 2024
1 parent 8e6a563 commit 1de849d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions edsdme/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ const miloLibs = setLibs(LIBS);
(async function loadPage() {
redirectLoggedinPartner();
updateIMSConfig();
const { loadArea, setConfig } = await import(`${miloLibs}/utils/utils.js`);
const { loadArea, setConfig, getConfig, loadBlock } = await import(`${miloLibs}/utils/utils.js`);

setConfig({ ...CONFIG, miloLibs });
await getRenewBanner();
await getRenewBanner(getConfig, loadBlock);
await loadArea();
}());
12 changes: 6 additions & 6 deletions edsdme/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function useMiloSample() {

const miloLibs = setLibs('/libs');

const { createTag, localizeLink, getConfig, loadBlock } = await import(`${miloLibs}/utils/utils.js`);
const { createTag, localizeLink, getConfig } = await import(`${miloLibs}/utils/utils.js`);
export { createTag, localizeLink, getConfig };

const { replaceText } = await import(`${miloLibs}/features/placeholders.js`);
Expand Down Expand Up @@ -150,9 +150,9 @@ export function redirectLoggedinPartner() {
window.location.assign(target);
}

export async function getRenewBanner() {
export async function getRenewBanner(getConfig, loadBlock) {
const programType = getCurrentProgramType();
const accountExpiration = getPartnerDataCookieValue(programType, 'accountexpiration');
const accountExpiration = getPartnerDataCookieValue(programType, 'accountanniversary');
if (!accountExpiration) return;

const expirationDate = new Date(accountExpiration);
Expand Down Expand Up @@ -184,9 +184,9 @@ export async function getRenewBanner() {
}

const config = getConfig();
const [, locale] = config.locale.ietf.toLowerCase().split('-');
const defaultPath = locale === 'us' ? `/edsdme/partners-shared/fragments/${metadataKey}` : `/${locale}/edsdme/partners-shared/fragments/${metadataKey}`;
const path = getMetadataContent(metadataKey) ? getMetadataContent(metadataKey) : defaultPath;
const { prefix } = config.locale;
const defaultPath = `${prefix}/edsdme/partners-shared/fragments/${metadataKey}`;
const path = getMetadataContent(metadataKey) ?? defaultPath;
const url = new URL(path, window.location.origin);

try {
Expand Down

0 comments on commit 1de849d

Please sign in to comment.