Skip to content

Commit

Permalink
Merge pull request #38 from adobecom/MWPW-155391-public-footer
Browse files Browse the repository at this point in the history
MWPW-155391: Swap footer logic
  • Loading branch information
Ben-Zahler authored Aug 12, 2024
2 parents fd29022 + c8d7471 commit 65f0abb
Show file tree
Hide file tree
Showing 7 changed files with 8,122 additions and 2,530 deletions.
3 changes: 3 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', {targets: {node: 'current'}}]],
};
7 changes: 6 additions & 1 deletion edsdme/scripts/scripts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setLibs, redirectLoggedinPartner, updateIMSConfig, preloadResources, getRenewBanner } from './utils.js';
import { setLibs, redirectLoggedinPartner, updateIMSConfig, preloadResources, getRenewBanner, updateFooter } from './utils.js';

// Add project-wide style path here.
const STYLES = '/edsdme/styles/styles.css';
Expand Down Expand Up @@ -71,7 +71,12 @@ const miloLibs = setLibs(LIBS);
});
}());

function setUpPage() {
updateFooter(CONFIG.locales);
}

(async function loadPage() {
setUpPage();
redirectLoggedinPartner();
updateIMSConfig();
await preloadResources(CONFIG.locales, miloLibs);
Expand Down
13 changes: 13 additions & 0 deletions edsdme/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export function getMetadataContent(name) {
return document.querySelector(`meta[name="${name}"]`)?.content;
}

export function getMetadata(name) {
return document.querySelector(`meta[name="${name}"]`);
}

export function redirectLoggedinPartner() {
if (!isMember()) return;
const target = getMetadataContent('adobe-target-after-login');
Expand Down Expand Up @@ -352,3 +356,12 @@ export async function preloadResources(locales, miloLibs) {
preload(caasUrl);
});
}

export function updateFooter(locales) {
const { prefix } = getLocale(locales);
const footerMeta = getMetadata('footer-source');
if (!footerMeta || !isMember()) return;

const footerLoggedIn = getMetadataContent('footer-loggedin-source');
footerMeta.content = footerLoggedIn ?? `${prefix}/edsdme/partners-shared/loggedin-footer`;
}
Loading

0 comments on commit 65f0abb

Please sign in to comment.