Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-161273 Standalone Gnav needs a release cycle #3113

Closed
wants to merge 68 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
be90c7d
[Release] Stage to Main (#2359)
milo-pr-merge[bot] Jun 3, 2024
d9af238
[Release] Stage to Main (#2409)
milo-pr-merge[bot] Jun 4, 2024
b07f1a5
[Release] Stage to Main (#2414)
milo-pr-merge[bot] Jun 5, 2024
e5bff30
[Release] Stage to Main (#2423)
milo-pr-merge[bot] Jun 6, 2024
81d0085
[Release] Stage to Main (#2432)
milo-pr-merge[bot] Jun 10, 2024
e8300af
[Release] Stage to Main (#2447)
milo-pr-merge[bot] Jun 11, 2024
2350bd0
[Release] Stage to Main (#2462)
milo-pr-merge[bot] Jun 12, 2024
931fa67
[Release] Stage to Main (#2470)
milo-pr-merge[bot] Jun 13, 2024
ead382f
[Release] Stage to Main (#2472)
milo-pr-merge[bot] Jun 17, 2024
ddbdf7a
[Release] Stage to Main (#2479)
milo-pr-merge[bot] Jun 18, 2024
02bf1a6
[Release] Stage to Main (#2482)
milo-pr-merge[bot] Jun 19, 2024
f6fc4bf
[Release] Stage to Main (#2489)
milo-pr-merge[bot] Jun 20, 2024
47aaef0
[Release] Stage to Main (#2495)
milo-pr-merge[bot] Jun 24, 2024
03578fb
[Release] Stage to Main (#2503)
milo-pr-merge[bot] Jun 25, 2024
32f61f0
[Release] Stage to Main (#2515)
milo-pr-merge[bot] Jun 26, 2024
2217784
[Release] Stage to Main (#2520)
milo-pr-merge[bot] Jun 27, 2024
862fdab
[Release] Stage to Main (#2528)
milo-pr-merge[bot] Jul 8, 2024
88577c7
[Release] Stage to Main (#2540)
milo-pr-merge[bot] Jul 10, 2024
830f7e1
[Release] Stage to Main (#2556)
milo-pr-merge[bot] Jul 15, 2024
bc210e6
[Release] Stage to Main (#2568)
milo-pr-merge[bot] Jul 16, 2024
04e211c
[Release] Stage to Main (#2571)
milo-pr-merge[bot] Jul 17, 2024
4e99424
[Release] Stage to Main (#2580)
milo-pr-merge[bot] Jul 18, 2024
61f8c81
[Release] Stage to Main (#2592)
milo-pr-merge[bot] Jul 22, 2024
3365940
[Release] Stage to Main (#2602)
milo-pr-merge[bot] Jul 23, 2024
e89908c
[Release] Stage to Main (#2609)
milo-pr-merge[bot] Jul 24, 2024
f551e5b
[Release] Stage to Main (#2617)
milo-pr-merge[bot] Jul 25, 2024
5028ef5
[Release] Stage to Main (#2629)
milo-pr-merge[bot] Jul 29, 2024
0073337
[Release] Stage to Main (#2641)
milo-pr-merge[bot] Jul 30, 2024
c3371ce
[Release] Stage to Main (#2648)
milo-pr-merge[bot] Jul 31, 2024
8f6bc8f
[Release] Stage to Main (#2666)
milo-pr-merge[bot] Aug 5, 2024
498b7c8
[Release] Stage to Main (#2688)
milo-pr-merge[bot] Aug 6, 2024
5401829
[Release] Stage to Main (#2697)
milo-pr-merge[bot] Aug 7, 2024
833abd4
[Release] Stage to Main (#2701)
milo-pr-merge[bot] Aug 8, 2024
3abbe4d
[Release] Stage to Main (#2716)
milo-pr-merge[bot] Aug 12, 2024
0b80fa1
[Release] Stage to Main (#2722)
milo-pr-merge[bot] Aug 13, 2024
baef0d5
[Release] Stage to Main (#2734)
milo-pr-merge[bot] Aug 14, 2024
53f37de
[Release] Stage to Main (#2742)
milo-pr-merge[bot] Aug 19, 2024
7dbef3a
[Release] Stage to Main (#2756)
milo-pr-merge[bot] Aug 20, 2024
c06c15d
[Release] Stage to Main (#2766)
milo-pr-merge[bot] Aug 21, 2024
eeddca4
[Release] Stage to Main (#2775)
milo-pr-merge[bot] Sep 2, 2024
91afbee
[Release] Stage to Main (#2811)
milo-pr-merge[bot] Sep 3, 2024
95fb526
[Release] Stage to Main (#2821)
milo-pr-merge[bot] Sep 5, 2024
c8d526f
[Release] Stage to Main (#2842)
milo-pr-merge[bot] Sep 9, 2024
28a75e5
[Release] Stage to Main (#2852)
milo-pr-merge[bot] Sep 10, 2024
c7a5d14
[Release] Stage to Main (#2859)
milo-pr-merge[bot] Sep 11, 2024
a35fcb3
[Release] Stage to Main (#2868)
milo-pr-merge[bot] Sep 12, 2024
b60741a
[Release] Stage to Main (#2874)
milo-pr-merge[bot] Sep 16, 2024
d4cb64b
[Release] Stage to Main (#2879)
milo-pr-merge[bot] Sep 17, 2024
cc08e6e
[Release] Stage to Main (#2893)
milo-pr-merge[bot] Sep 18, 2024
fb228f1
Revert "MWPW-156749: Fix video CLS " (#2899) (#2900)
mokimo Sep 18, 2024
132d69f
[Release] Stage to Main (#2898)
Blainegunn Sep 18, 2024
7c2d611
[Release] Stage to Main (#2910)
milo-pr-merge[bot] Sep 24, 2024
3d3a739
[Release] Stage to Main (#2943)
milo-pr-merge[bot] Sep 25, 2024
4e0704d
[Release] Stage to Main (#2951)
milo-pr-merge[bot] Sep 26, 2024
23e81de
[Release] Stage to Main (#2965)
milo-pr-merge[bot] Sep 30, 2024
668448b
[Release] Stage to Main (#2980)
milo-pr-merge[bot] Oct 1, 2024
ee9d4a1
[Release] Stage to Main (#2990)
milo-pr-merge[bot] Oct 3, 2024
490b2b6
[MWPW-159903] Fix quiz video marquees (#3009) (#3013)
mokimo Oct 4, 2024
8cf856d
[MWPW-159328] handle a case where there are not placeholders availabl…
mokimo Oct 4, 2024
0afc1ce
MWPW-146211 [MILO][MEP] Option to select all elements (#2976) (#3023)
overmyheadandbody Oct 8, 2024
482c220
MWPW-158455: Promobar overlays with localnav elements in devices (#2991)
akanshaa-18 Oct 11, 2024
9c82c3a
MWPW-158455: Promobar overlays with localnav elements in devices (#29…
overmyheadandbody Oct 11, 2024
c3175bc
[Release] Stage to Main (#3004)
milo-pr-merge[bot] Oct 21, 2024
f18df4f
[Release] Stage to Main (#3069)
milo-pr-merge[bot] Oct 22, 2024
b6e139d
[Release] Stage to Main (#3072)
milo-pr-merge[bot] Oct 23, 2024
6314173
[Release] Stage to Main (#3085)
milo-pr-merge[bot] Oct 28, 2024
5926b3b
Standalone gnav now points to /feds-gnav/* instead of /libs/*
sharmrj Oct 30, 2024
c631a1f
unit tests
sharmrj Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions libs/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function getParamsConfigs(configs) {
}, {});
}

export default async function loadBlock(configs, customLib) {
export default async function loadBlock(configs, customLib, path = 'feds-gnav') {
const {
header,
footer,
Expand All @@ -57,24 +57,24 @@ export default async function loadBlock(configs, customLib) {
theme,
} = configs || {};
const branch = new URLSearchParams(window.location.search).get('navbranch');
const miloLibs = branch ? `https://${branch}--milo--adobecom.hlx.page` : customLib || envMap[env];
const miloLibs = branch ? `https://${branch}--milo--adobecom.hlx.page/${path}` : customLib || `${envMap[env]}/${path}`;
if (!header && !footer) {
// eslint-disable-next-line no-console
console.error('Global navigation Error: header and footer configurations are missing.');
return;
}
// Relative path can't be used, as the script will run on consumer's app
const [{ default: bootstrapBlock }, { default: locales }, { setConfig }] = await Promise.all([
import(`${miloLibs}/libs/navigation/bootstrapper.js`),
import(`${miloLibs}/libs/utils/locales.js`),
import(`${miloLibs}/libs/utils/utils.js`),
import(`${miloLibs}/navigation/bootstrapper.js`),
import(`${miloLibs}/utils/locales.js`),
import(`${miloLibs}//utils/utils.js`),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import(`${miloLibs}//utils/utils.js`),
import(`${miloLibs}/utils/utils.js`),

]);

const paramConfigs = getParamsConfigs(configs, miloLibs);
const clientConfig = {
clientEnv: env,
origin: `https://main--federal--adobecom.hlx.${env === 'prod' ? 'live' : 'page'}`,
miloLibs: `${miloLibs}/libs`,
miloLibs,
pathname: `/${locale}`,
locales: configs.locales || locales,
contentRoot: authoringPath || footer.authoringPath,
Expand All @@ -87,7 +87,7 @@ export default async function loadBlock(configs, customLib) {
const configBlock = configs[block.key];
try {
if (configBlock) {
await bootstrapBlock(`${miloLibs}/libs`, {
await bootstrapBlock(miloLibs, {
...block,
...(block.key === 'header' && {
unavComponents: configBlock.unav?.unavComponents,
Expand Down
10 changes: 5 additions & 5 deletions test/navigation/navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ describe('Navigation component', async () => {
});

it('Renders the footer block', async () => {
await loadBlock({ authoringPath: '/federal/dev', footer: { privacyId: '12343' }, env: 'qa' }, 'http://localhost:2000');
await loadBlock({ authoringPath: '/federal/dev', footer: { privacyId: '12343' }, env: 'qa' }, miloLibs);
const el = document.getElementsByTagName('footer');
expect(el).to.exist;
});

it('Renders the footer block should not load when config is not passed', async () => {
try {
const onError = stub();
await loadBlock({ authoringPath: '/federal/dev-new', env: 'qa', footer: { privacyId: '12343' }, header: { onError } }, 'http://localhost:2000');
await loadBlock({ authoringPath: '/federal/dev-new', env: 'qa', footer: { privacyId: '12343' }, header: { onError } }, miloLibs);
const el = document.getElementsByTagName('footer');
expect(el).to.not.exist;
expect(onError.called).to.be.true;
Expand All @@ -44,15 +44,15 @@ describe('Navigation component', async () => {

it('Renders the header block', async () => {
const onReady = stub();
await loadBlock({ authoringPath: '/federal/dev', header: { imsClientId: 'fedsmilo', onReady }, env: 'prod' }, 'http://localhost:2000');
await loadBlock({ authoringPath: '/federal/dev', header: { imsClientId: 'fedsmilo', onReady }, env: 'prod' }, miloLibs);
const el = document.getElementsByTagName('header');
expect(el).to.exist;
expect(onReady.called).to.be.true;
});

it('Does not render either header or footer if not found in configs', async () => {
document.body.innerHTML = await readFile({ path: './mocks/body.html' });
await loadBlock({ authoringPath: '/federal/dev', env: 'qa' }, 'http://localhost:2000');
await loadBlock({ authoringPath: '/federal/dev', env: 'qa' }, miloLibs);
const header = document.getElementsByTagName('header');
const footer = document.getElementsByTagName('footer');
expect(header).to.be.empty;
Expand All @@ -69,7 +69,7 @@ describe('Navigation component', async () => {
});

it('Renders the footer block with authoringpath passed in footer', async () => {
await loadBlock({ footer: { privacyId: '12343', authoringPath: '/federal/dev' }, env: 'qa' }, 'http://localhost:2000');
await loadBlock({ footer: { privacyId: '12343', authoringPath: '/federal/dev' }, env: 'qa' }, miloLibs);
const el = document.getElementsByTagName('footer');
expect(el).to.exist;
});
Expand Down
Loading