diff --git a/.github/workflows/fg-sync-repos.yml b/.github/workflows/fg-sync-repos.yml index 2ef53894c7..bbac6e3432 100644 --- a/.github/workflows/fg-sync-repos.yml +++ b/.github/workflows/fg-sync-repos.yml @@ -2,6 +2,15 @@ name: Floodgate Repo Sync on: workflow_dispatch: + inputs: + syncBranch: + description: 'Branch to sync' + required: true + default: 'stage' + type: choice + options: + - 'stage' + - 'main' jobs: build: @@ -20,18 +29,30 @@ jobs: uses: actions/checkout@v2 with: persist-credentials: false + ref: ${{ inputs.syncBranch }} - - name: Clone Floodgate Repository + - name: Clone Floodgate Repository and Checkout Selected Branch run: | git clone https://github.com/adobecom/milo-pink.git ../milo-pink + cd ../milo-pink + git checkout $FG_SYNC_BRANCH + echo "milo-pink branch" + git branch + cd ../milo + echo "milo branch" + git branch + env: + FG_SYNC_BRANCH: ${{ inputs.syncBranch }} - name: Overwrite floodgate repo files with latest from source repo run: | - rsync -av --exclude='fstab.yaml' --exclude='.github' --exclude='.git' --exclude='.idea' ./ ../milo-pink/ + rsync -av --exclude='fstab.yaml' --exclude='.github' --exclude='.kodiak' --exclude='.git' --exclude='.idea' --exclude='.husky' --exclude='.vscode' --exclude='tools/sidekick/config.json' ./ ../milo-pink/ - name: Commit and Push Changes to Floodgate Repository run: | cd ../milo-pink + echo "milo-pink branch" + git branch git config user.email "$FG_SYNC_BOT_EMAIL" git config user.name "$FG_SYNC_BOT_NAME" git status @@ -39,8 +60,9 @@ jobs: git remote -v git add . git commit -m "Syncing milo to milo-pink" - git push origin main --force + git push origin $FG_SYNC_BRANCH --force env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} FG_SYNC_BOT_EMAIL: ${{ secrets.FG_SYNC_BOT_EMAIL }} FG_SYNC_BOT_NAME: ${{ secrets.FG_SYNC_BOT_NAME }} + FG_SYNC_BRANCH: ${{ inputs.syncBranch }} diff --git a/libs/blocks/global-footer/global-footer.js b/libs/blocks/global-footer/global-footer.js index 32dafa537f..5ce3853d03 100644 --- a/libs/blocks/global-footer/global-footer.js +++ b/libs/blocks/global-footer/global-footer.js @@ -226,7 +226,20 @@ class Footer { if (url.hash !== '') { // Hash -> region selector opens a modal decorateAutoBlock(regionPickerElem); // add modal-specific attributes + // TODO remove logs after finding the root cause for the region picker 404s -> MWPW-143627 + if (regionPickerElem.classList[0] !== 'modal') { + lanaLog({ + message: `Modal block class missing from region picker pre loading the block; locale: ${locale}; regionPickerElem: ${regionPickerElem.outerHTML}`, + tags: 'errorType=warn,module=global-footer', + }); + } await loadBlock(regionPickerElem); // load modal logic and styles + if (regionPickerElem.classList[0] !== 'modal') { + lanaLog({ + message: `Modal block class missing from region picker post loading the block; locale: ${locale}; regionPickerElem: ${regionPickerElem.outerHTML}`, + tags: 'errorType=warn,module=global-footer', + }); + } // 'decorateAutoBlock' logic replaces class name entirely, need to add it back regionPickerElem.classList.add(regionPickerClass); regionPickerElem.addEventListener('click', () => { diff --git a/libs/blocks/global-navigation/base.css b/libs/blocks/global-navigation/base.css index 7dc56fd290..b03731f174 100644 --- a/libs/blocks/global-navigation/base.css +++ b/libs/blocks/global-navigation/base.css @@ -222,6 +222,7 @@ .feds-navLink[class *= '-gradient'] { display: flex; border-radius: 4px; + font-weight: 600; } .feds-menu-column--group .feds-navLink[class *= '-gradient'] { @@ -281,4 +282,8 @@ .feds-navLink--ai-gradient { background: linear-gradient(90deg, #bce3ff, #ffe9d3, #f8d5e4); } + + .feds-navLink--gray-gradient { + background: #eaeaea; + } } diff --git a/libs/blocks/mobile-app-banner/mobile-app-banner.js b/libs/blocks/mobile-app-banner/mobile-app-banner.js index 0460d5f8d0..4f72eb1ff0 100644 --- a/libs/blocks/mobile-app-banner/mobile-app-banner.js +++ b/libs/blocks/mobile-app-banner/mobile-app-banner.js @@ -62,8 +62,8 @@ function branchInit(header, key) { export default async function init(el) { const header = document.querySelector('.global-navigation'); if (!header) return; - const row = el.querySelector(':scope > div'); - const product = row.textContent.trim().toLowerCase(); + const classListArray = Array.from(el.classList); + const product = classListArray.find((token) => token.startsWith('product-')).split('-')[1]; const key = await getKey(product); if (key) branchInit(header, key); } diff --git a/libs/blocks/modal/modal.js b/libs/blocks/modal/modal.js index bb4949feb0..076199f53b 100644 --- a/libs/blocks/modal/modal.js +++ b/libs/blocks/modal/modal.js @@ -1,7 +1,7 @@ /* eslint-disable import/no-cycle */ import { createTag, getMetadata, localizeLink, loadStyle, getConfig } from '../../utils/utils.js'; -const FOCUSABLES = 'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]'; +const FOCUSABLES = 'a:not(.hide-video), button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]'; const CLOSE_ICON = ` diff --git a/libs/blocks/tabs/tabs.css b/libs/blocks/tabs/tabs.css index 3c8d20c2ed..19b8037be0 100644 --- a/libs/blocks/tabs/tabs.css +++ b/libs/blocks/tabs/tabs.css @@ -182,10 +182,6 @@ margin-inline-start: 24px; } -.tabs[class*='pill'] { - background: unset; -} - .tabs[class*='pill'] .tab-content { border-bottom: none; } diff --git a/libs/utils/utils.js b/libs/utils/utils.js index fc6d95f1ad..5c802a6740 100644 --- a/libs/utils/utils.js +++ b/libs/utils/utils.js @@ -1055,6 +1055,8 @@ async function documentPostSectionLoading(config) { import('../martech/attributes.js').then((analytics) => { document.querySelectorAll('main > div').forEach((section, idx) => analytics.decorateSectionAnalytics(section, idx, config)); }); + + document.body.appendChild(createTag('div', { id: 'page-load-ok-milo', style: 'display: none;' })); } async function processSection(section, config, isDoc) { diff --git a/test/blocks/mobile-app-banner/mobile-app-banner.test.js b/test/blocks/mobile-app-banner/mobile-app-banner.test.js new file mode 100644 index 0000000000..b8656f95f1 --- /dev/null +++ b/test/blocks/mobile-app-banner/mobile-app-banner.test.js @@ -0,0 +1,67 @@ +import { readFile } from '@web/test-runner-commands'; +import { expect } from '@esm-bundle/chai'; +import sinon from 'sinon'; +import { delay } from '../../helpers/waitfor.js'; + +const { setConfig } = await import('../../../libs/utils/utils.js'); + +const mockConfig = { contentRoot: '/test/blocks/mobile-app-banner/mocks' }; +setConfig(mockConfig); + +describe('mobile-app-banner', () => { + beforeEach(async () => { + document.body.innerHTML = await readFile({ path: './mocks/body.html' }); + }); + afterEach(() => { + sinon.restore(); + }); + + it('should not call branch init if no branch-io-key.json', async () => { + sinon.stub(window, 'fetch'); + const res = new window.Response('Not found', { status: 404 }); + window.fetch.returns(Promise.resolve(res)); + + const module = await import('../../../libs/blocks/mobile-app-banner/mobile-app-banner.js'); + const banner = document.body.querySelector('.mobile-app-banner.product-test'); + await module.default(banner); + window.dispatchEvent(new CustomEvent('adobePrivacy:PrivacyConsent')); + await delay(0); + + const scriptTags = document.querySelectorAll('head > script'); + const scriptSrcs = []; + scriptTags.forEach((scriptTag) => { + scriptSrcs.push(scriptTag.getAttribute('src')); + }); + expect(scriptSrcs).to.not.include('https://cdn.branch.io/branch-latest.min.js'); + }); + + it('should not call branch init if product not found in branch-io-key file', async () => { + const module = await import('../../../libs/blocks/mobile-app-banner/mobile-app-banner.js'); + const banner = document.body.querySelector('.mobile-app-banner.product-test1'); + await module.default(banner); + window.dispatchEvent(new CustomEvent('adobePrivacy:PrivacyConsent')); + await delay(0); + + const scriptTags = document.querySelectorAll('head > script'); + const scriptSrcs = []; + scriptTags.forEach((scriptTag) => { + if (scriptTag.getAttribute('src') !== null) scriptSrcs.push(scriptTag.getAttribute('src')); + }); + expect(scriptSrcs).to.not.include('https://cdn.branch.io/branch-latest.min.js'); + }); + + it('should init by adding branchio script', async () => { + window.adobePrivacy = { hasUserProvidedConsent: () => true }; + const module = await import('../../../libs/blocks/mobile-app-banner/mobile-app-banner.js'); + const banner = document.body.querySelector('.mobile-app-banner.product-test'); + await module.default(banner); + window.dispatchEvent(new CustomEvent('adobePrivacy:PrivacyConsent')); + await delay(0); + const scriptTags = document.querySelectorAll('head > script'); + const scriptSrcs = []; + scriptTags.forEach((scriptTag) => { + if (scriptTag.getAttribute('src') !== null) scriptSrcs.push(scriptTag.getAttribute('src')); + }); + expect(scriptSrcs).to.include('https://cdn.branch.io/branch-latest.min.js'); + }); +}); diff --git a/test/blocks/mobile-app-banner/mocks/body.html b/test/blocks/mobile-app-banner/mocks/body.html new file mode 100644 index 0000000000..c80e263252 --- /dev/null +++ b/test/blocks/mobile-app-banner/mocks/body.html @@ -0,0 +1,10 @@ +
+ +
Hello World
+
+
+
+
+
+
+
diff --git a/test/blocks/mobile-app-banner/mocks/branch-io-key.json b/test/blocks/mobile-app-banner/mocks/branch-io-key.json new file mode 100644 index 0000000000..f3ec9ebe72 --- /dev/null +++ b/test/blocks/mobile-app-banner/mocks/branch-io-key.json @@ -0,0 +1,8 @@ +{ + "data": [ + { + "product": "test", + "key": "key_test_eaNdoH8nTxeZXfOsgkELrjgpFrhm4q2m" + } + ] +}