Skip to content

Commit

Permalink
Merge branch 'stage' into MWPW-152181
Browse files Browse the repository at this point in the history
* stage:
  [MWPW-153611] [Gray Box] environment aware links (adobecom#2622)
  MWPW-153580: Add Opt-In Feature for CaaS Badge Display (adobecom#2625)
  [MWPW-154335] [callout] Spacing issue encountered when the call-out section is added (adobecom#2628)
  MWPW-150557 - Split Marquee CLS issues on consuming sites (adobecom#2636)
  Mwpw 147034: Custom border color + badge/border color decoupling [merch card] (adobecom#2613)
  [MWPW-151517] - Remove condition for promobar hidden on mobile from gnav (adobecom#2538)
  MWPW-154998 [MEP][MILO] Manifests do not execute in the right order when there is a disabled manifest (adobecom#2632)
  mwpw-154965: Fetch federal stage content from hlx.page instead of stage.adobe.com (adobecom#2618)
  Correct error messages for duplicate files on the stage to main workflow (adobecom#2621)
  MWPW-153245 [merch][analytics] dispatch wcomp events, and let default lh (adobecom#2610)
  Revert "MWPW-146528[MILO][MEP][ANALYTICS] Add attribute to content changed by Target for analytics and MWPW-152274" (adobecom#2627)
  MWPW-128600 Locale Tool: Langstore points to langstore/en (adobecom#2615)
  Fix for errors in dynamically loaded scripts in test cases (adobecom#2619)
  MWPW-146528[MILO][MEP][ANALYTICS] Add attribute to content changed by Target for analytics and MWPW-152274 (adobecom#2593)
  Bootstrapper script for milo feds blocks (adobecom#2560)
  Revert "[MWPW-152968] mWeb - Passing ECID to Branch.io banner - Implementation" (adobecom#2612)

# Conflicts:
#	libs/deps/merch-card.js
  • Loading branch information
Rohit Sahu committed Jul 30, 2024
2 parents 9e4ab2d + c00c777 commit e8535fa
Show file tree
Hide file tree
Showing 40 changed files with 423 additions and 714 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/merge-to-stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ const merge = async ({ prs, type }) => {

for await (const { number, files, html_url, title } of prs) {
try {
if (files.some((file) => SEEN[file])) {
const fileOverlap = files.find((file) => SEEN[file]);
if (fileOverlap) {
commentOnPR(
`Skipped ${number}: ${title} due to file "${file}" overlap. Merging will be attempted in the next batch`,
`Skipped ${number}: "${title}" due to file "${fileOverlap}" overlap. Merging will be attempted in the next batch`,
number
);
continue;
Expand Down
1 change: 1 addition & 0 deletions libs/blocks/caas-config/caas-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ const UiPanel = () => html`
<${Input} label="Use Overlay Links" prop="useOverlayLinks" type="checkbox" />
<${Input} label="Show total card count at top" prop="showTotalResults" type="checkbox" />
<${Input} label="Hide date for on-demand content" prop="hideDateInterval" type="checkbox" />
<${Input} label="Enable showing card badges (by default hidden)" prop="showCardBadges" type="checkbox" />
<${Select} label="Card Style" prop="cardStyle" options=${defaultOptions.cardStyle} />
<${Select} options=${defaultOptions.cardTitleAccessibilityLevel} prop="cardTitleAccessibilityLevel" label="Card Accessibility Title Level" />
<${Select} label="Layout" prop="container" options=${defaultOptions.container} />
Expand Down
2 changes: 2 additions & 0 deletions libs/blocks/caas/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ export const getConfig = async (originalState, strs = {}) => {
}&size=${state.collectionSize || state.totalCardsToShow}${localesQueryParam}${debug}${flatFile}`,
fallbackEndpoint: state.fallbackEndpoint,
totalCardsToShow: state.totalCardsToShow,
showCardBadges: state.showCardBadges,
cardStyle: state.cardStyle,
showTotalResults: state.showTotalResults,
i18n: {
Expand Down Expand Up @@ -818,6 +819,7 @@ export const defaultState = {
secondaryTags: [],
secondarySource: [],
setCardBorders: false,
showCardBadges: false,
showFooterDivider: false,
showBookmarksFilter: false,
showBookmarksOnCards: false,
Expand Down
11 changes: 8 additions & 3 deletions libs/blocks/fragment/fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ export default async function init(a) {
}

const { customFetch } = await import('../../utils/helpers.js');
const resp = await customFetch({ resource: `${a.href}.plain.html`, withCacheRules: true })
let resourcePath = a.href;
if (a.href.includes('/federal/')) {
const { getFederatedUrl } = await import('../../utils/federated.js');
resourcePath = getFederatedUrl(a.href);
}
const resp = await customFetch({ resource: `${resourcePath}.plain.html`, withCacheRules: true })
.catch(() => ({}));

if (!resp?.ok) {
window.lana?.log(`Could not get fragment: ${a.href}.plain.html`);
window.lana?.log(`Could not get fragment: ${resourcePath}.plain.html`);
return;
}

Expand All @@ -106,7 +111,7 @@ export default async function init(a) {
const sections = doc.querySelectorAll('body > div');

if (!sections.length) {
window.lana?.log(`Could not make fragment: ${a.href}.plain.html`);
window.lana?.log(`Could not make fragment: ${resourcePath}.plain.html`);
return;
}

Expand Down
2 changes: 2 additions & 0 deletions libs/blocks/global-footer/global-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getMetadata,
getConfig,
loadBlock,
localizeLink,
} from '../../utils/utils.js';

import {
Expand Down Expand Up @@ -258,6 +259,7 @@ class Footer {
} else {
// No hash -> region selector expands a dropdown
regionPickerElem.href = '#'; // reset href value to not get treated as a fragment
regionSelector.href = localizeLink(regionSelector.href);
decorateAutoBlock(regionSelector); // add fragment-specific class(es)
this.elements.regionPicker.append(regionSelector); // add fragment after regionPickerElem
await loadBlock(regionSelector); // load fragment and replace original link
Expand Down
6 changes: 5 additions & 1 deletion libs/blocks/global-navigation/global-navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ header.global-navigation {

/* Promo */
.global-navigation .aside.promobar {
display: none; /* For when someone switches from desktop to mobile */
z-index: 1;
}

Expand Down Expand Up @@ -569,6 +568,11 @@ header.global-navigation {
padding: 40px 0 0;
max-height: calc(100vh - 100%);
overflow: auto;
box-sizing: border-box;
}

.global-navigation.has-promo .feds-navItem--megaMenu .feds-popup {
max-height: calc(100vh - 100% - var(--global-height-navPromo));
}

[dir = "rtl"] .feds-navItem--megaMenu .feds-popup {
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ class Gnav {
decorateAside = async () => {
this.elements.aside = '';
const promoPath = getMetadata('gnav-promo-source');
if (!isDesktop.matches || !promoPath) {
if (!promoPath) {
this.block.classList.remove('has-promo');
return this.elements.aside;
}
Expand Down
9 changes: 9 additions & 0 deletions libs/blocks/graybox/graybox.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,16 @@ const setupChangedEls = (globalNoClick) => {
}
};

const transformLinks = () => {
const grayboxHostname = window.location.hostname;
const consumerHostname = grayboxHostname.replace(/[^.]+\.(?:([^.]+)-)?graybox\./, (_, sub) => `${sub || 'www'}.`);
document.querySelectorAll(`a[href*="${consumerHostname}"]`).forEach((el) => {
el.href = el.href.replace(consumerHostname, grayboxHostname);
});
};

const grayboxThePage = (grayboxEl, grayboxMenuOff) => () => {
transformLinks();
document.body.classList.add(CLASS.GRAYBOX_BODY);
const globalNoClick = grayboxEl.classList.contains(CLASS.NO_CLICK)
|| grayboxEl.classList.contains(OPTION.NO_CLICK);
Expand Down
7 changes: 6 additions & 1 deletion libs/blocks/locale-nav/locale-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ const decorateLocales = (current) => {
delete locales[currLocale];
return Object.keys(locales).map((key) => {
const prefix = key === '' ? key : `/${key}`;
const localePath = currLocale === ''
let localePath = currLocale === ''
? `/${key}${current.pathname}`
: current.pathname.replace(current.locale.prefix, prefix);
if (localePath.startsWith('/langstore/')) {
// eslint-disable-next-line no-param-reassign
key = 'langstore/en';
localePath = localePath.replace('/langstore/', `/${key}/`);
}
const li = createTag('li', { class: 'detail' }, `<span>${key || 'us'}</span>`);
getStatus(li, localePath);
return li;
Expand Down
1 change: 0 additions & 1 deletion libs/blocks/marquee/marquee.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@
}

.marquee.split .icon-area img {
height: auto;
max-height: var(--icon-size-l);
max-width: 275px;
object-fit: contain;
Expand Down
13 changes: 9 additions & 4 deletions libs/blocks/merch-card/merch-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ const parseContent = async (el, merchCard) => {
const innerElements = [
...el.querySelectorAll(INNER_ELEMENTS_SELECTOR),
];
const calloutContainer = createTag('div');

innerElements.forEach((element) => {
let { tagName } = element;
if (isHeadingTag(tagName)) {
Expand Down Expand Up @@ -233,13 +235,10 @@ const parseContent = async (el, merchCard) => {
calloutContentWrapper.appendChild(calloutContent);

if (imgElement) {
calloutContentWrapper.classList.add('callout-content-wrapper-with-icon');
calloutContentWrapper.appendChild(imgElement);
}

const calloutSlot = createTag('div', { slot: 'callout-text' });
calloutSlot.appendChild(calloutContentWrapper);
merchCard.appendChild(calloutSlot);
calloutContainer.appendChild(calloutContentWrapper);
return;
}
if (isParagraphTag(tagName)) {
Expand All @@ -249,6 +248,12 @@ const parseContent = async (el, merchCard) => {
if (mnemonicList) bodySlot.append(mnemonicList);
});

if (calloutContainer.children.length > 0) {
const calloutSlot = createTag('div', { slot: 'callout-content' });
calloutSlot.appendChild(calloutContainer);
merchCard.appendChild(calloutSlot);
}

if (merchCard.variant === MINI_COMPARE_CHART && merchCard.childNodes[1]) {
merchCard.insertBefore(bodySlot, merchCard.childNodes[1]);
}
Expand Down
26 changes: 3 additions & 23 deletions libs/blocks/mobile-app-banner/mobile-app-banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,8 @@ async function getKey(product) {
return keyMatch[0]?.key;
}

async function getECID() {
let ecid = null;
if (window.alloy) {
await window.alloy('getIdentity').then((data) => {
ecid = data?.identity?.ECID;
}).catch((err) => window.lana.log(`Error fetching ECID: ${err}`, { tags: 'errorType=error,module=mobile-app-banner' }));
}
return ecid;
}

/* eslint-disable */
function branchInit(key, ecidVal) {
function branchInit(key) {
let initValue = false;
function initBranch() {
if (initValue) {
Expand Down Expand Up @@ -58,16 +48,8 @@ function branchInit(key, ecidVal) {
0
);
const privacyConsent = window.adobePrivacy?.hasUserProvidedConsent();
const isAndroid = navigator.userAgent.includes('Android');

const cookieGrp = window.adobePrivacy?.activeCookieGroups();
const performanceCookieConsent = cookieGrp.includes('C0002');
const advertisingCookieConsent = cookieGrp.includes('C0004');

if (performanceCookieConsent && advertisingCookieConsent && isAndroid) branch.setBranchViewData({ data: { ecid: ecidVal }});
branch.init(key, { tracking_disabled: !privacyConsent });
}

['adobePrivacy:PrivacyConsent', 'adobePrivacy:PrivacyReject', 'adobePrivacy:PrivacyCustom']
.forEach((event) => {
window.addEventListener(event, initBranch);
Expand All @@ -77,11 +59,9 @@ function branchInit(key, ecidVal) {
/* eslint-enable */
export default async function init(el) {
const header = document.querySelector('.global-navigation');
if (!header) return;
if (!header || header.classList.contains('has-promo')) return;
const classListArray = Array.from(el.classList);
const product = classListArray.find((token) => token.startsWith('product-')).split('-')[1];
const key = await getKey(product);
if (!key) return;
const ecid = await getECID();
branchInit(key, ecid);
if (key) branchInit(key);
}
Loading

0 comments on commit e8535fa

Please sign in to comment.