Skip to content

Commit

Permalink
Merge branch 'mepmoreactions' into mepmanifestorder2
Browse files Browse the repository at this point in the history
  • Loading branch information
vgoodric committed Mar 11, 2024
2 parents ca185e5 + ecdf107 commit 2664595
Show file tree
Hide file tree
Showing 28 changed files with 239 additions and 234 deletions.
36 changes: 19 additions & 17 deletions libs/blocks/caas-marquee/caas-marquee.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,28 @@ const SEGMENTS_MAP = {
},
},
prod: {
'b446a9cf-a45c-40a7-ae67-33c2cf7f0bf7': 'acrobat',
'389deb08-1522-46e5-ba26-1df898934f4f': 'adobecom',
'079734f3-b593-4c58-8805-592d71f88d95': 'apro-cart-abandoner',
'295bea12-8443-41c9-9da1-8f75df77dd80': 'business',
'235a97a1-bf2e-4e92-bf18-13a9bfcf6ec9': 'cc-lapsed',
'f6553238-548f-4e39-bfa4-b299caaca62e': 'commerce',
'f569e4f9-f20a-4d6e-ba95-2abe4facdd1b': 'creative-cloud',
'5114ecd1-d1ac-4caa-869c-5652ab83afed': 'express',
'1d33382e-0c2c-4d24-8b1f-08be98cee22a': 'firefly',
'3f27d856-bbdd-431b-9e8f-44f6fe0cfbd0': 'helpx',
'5b88bec0-99f2-4736-b2d8-4809463b7fbd': 'illustrator',
'3822c05b-8074-4629-b493-59cc12a78650': 'lightroom',
'5b5c991e-2633-4390-8ee4-e58931da088e': 'photoshop',
'395264bb-b584-45fa-af53-a4396e64838b': 'premiere',
'c02e9190-cc42-47cd-85c0-421924c47f2b': 'sign',
'9aba8c9e-dce9-427e-8122-a6c796ee2d03': 'stock',
source: {
'b446a9cf-a45c-40a7-ae67-33c2cf7f0bf7': 'acrobat',
'389deb08-1522-46e5-ba26-1df898934f4f': 'adobecom',
'079734f3-b593-4c58-8805-592d71f88d95': 'apro-cart-abandoner',
'295bea12-8443-41c9-9da1-8f75df77dd80': 'business',
'235a97a1-bf2e-4e92-bf18-13a9bfcf6ec9': 'cc-lapsed',
'f6553238-548f-4e39-bfa4-b299caaca62e': 'commerce',
'f569e4f9-f20a-4d6e-ba95-2abe4facdd1b': 'creative-cloud',
'5114ecd1-d1ac-4caa-869c-5652ab83afed': 'express',
'1d33382e-0c2c-4d24-8b1f-08be98cee22a': 'firefly',
'3f27d856-bbdd-431b-9e8f-44f6fe0cfbd0': 'helpx',
'5b88bec0-99f2-4736-b2d8-4809463b7fbd': 'illustrator',
'3822c05b-8074-4629-b493-59cc12a78650': 'lightroom',
'5b5c991e-2633-4390-8ee4-e58931da088e': 'photoshop',
'395264bb-b584-45fa-af53-a4396e64838b': 'premiere',
'c02e9190-cc42-47cd-85c0-421924c47f2b': 'sign',
'9aba8c9e-dce9-427e-8122-a6c796ee2d03': 'stock',
},
},
};

const ALLOY_TIMEOUT = 500;
const ALLOY_TIMEOUT = 750;

const WIDTHS = {
split: 1199,
Expand Down
4 changes: 3 additions & 1 deletion libs/blocks/chart/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ export function processMarkData(series, xUnit) {
}

export async function fetchData(link) {
const resp = await fetch(link.href.toLowerCase());
const { customFetch } = await import('../../utils/helpers.js');
const resp = await customFetch({ resource: link.href.toLowerCase(), withCacheRules: true })
.catch(() => ({}));

if (!resp.ok) return {};

Expand Down
4 changes: 3 additions & 1 deletion libs/blocks/fragment/fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export default async function init(a) {
return;
}

const resp = await fetch(`${a.href}.plain.html`);
const { customFetch } = await import('../../utils/helpers.js');
const resp = await customFetch({ resource: `${a.href}.plain.html`, withCacheRules: true })
.catch(() => ({}));

if (!resp.ok) {
window.lana?.log(`Could not get fragment: ${a.href}.plain.html`);
Expand Down
5 changes: 4 additions & 1 deletion libs/blocks/global-navigation/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export const getFederatedContentRoot = () => {
: 'https://www.adobe.com';

if (origin.includes('localhost') || origin.includes('.hlx.')) {
federatedContentRoot = `https://main--federal--adobecom.hlx.${origin.includes('hlx.live') ? 'live' : 'page'}`;
// Akamai as proxy to avoid 401s, given AEM-EDS MS auth cross project limitations
federatedContentRoot = origin.includes('.hlx.live')
? 'https://main--federal--adobecom.hlx.live'
: 'https://www.stage.adobe.com';
}

return federatedContentRoot;
Expand Down
6 changes: 6 additions & 0 deletions libs/blocks/library-container-end/library-container-end.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

.library-container-end,
.section.masonry-layout .library-container-end[class*='grid-'] {
display: none;
}

.library-container-end::before {
display: block;
content: 'Library Container End';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.library-container-start,
.section.masonry-layout .library-container-start[class*='grid-'] {
display: none;
}

.library-container-start::before {
display: block;
content: 'Library Container Start';
Expand Down
9 changes: 4 additions & 5 deletions libs/blocks/library-metadata/library-metadata.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.library-metadata {
margin: 24px auto;
display: block;
}

.library-metadata::before {
Expand All @@ -10,18 +11,16 @@
border-radius: 6px;
text-transform: uppercase;
font-weight: 700;
font-size: smaller;
color: #293c51;
padding: 6px 12px;
}

.library-meta-row {
background-color: #EFEFEF;
display: grid;
grid-template-columns: 1fr 1fr;
margin-top: 4px;
border-radius: 6px;
}

.library-meta-row {
background-color: #EFEFEF;
padding: 6px 12px;
border-radius: 6px;
}
12 changes: 12 additions & 0 deletions libs/blocks/library-metadata/library-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@ export default function init(el) {
row.classList.add('library-meta-row');
row.firstElementChild.classList.add('library-meta-key');
});
// Fixes layout issue for groups of blocks using a grid layout
const section = el.closest('.section');
if (section.querySelector('.library-container-end')) {
const content = section.querySelector('.content');
section.insertAdjacentElement('afterend', el);

if (!content) return;
const reflowSection = document.createElement('div');
reflowSection.classList.add('section');
reflowSection.append(content);
section.insertAdjacentElement('beforebegin', reflowSection);
}
}
31 changes: 8 additions & 23 deletions libs/blocks/merch-card/merch-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,13 @@ const MULTI_OFFER_CARDS = ['plans', 'product', MINI_COMPARE_CHART];
// Force cards to refresh once they become visible so that the footer rows are properly aligned.
const intersectionObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
const container = entry.target.closest('main > div:not([data-status])');
const container = entry.target.closest('main > div');
if (!container) return;
[...container.querySelectorAll('merch-card')].forEach((card) => card.requestUpdate());
intersectionObserver.unobserve(entry.target);
});
});

const addTabClickListener = (container) => {
const buttons = document.querySelectorAll('button[role="tab"]');
buttons.forEach((button) => {
button.addEventListener('click', () => {
intersectionObserver.observe(container);
});
});
};

const textStyles = {
H5: 'detail-m',
H4: 'body-xxs',
Expand All @@ -140,7 +131,7 @@ const isHeadingTag = (tagName) => /^H[2-5]$/.test(tagName);
const isParagraphTag = (tagName) => tagName === 'P';

const appendSlot = (slotEls, slotName, merchCard) => {
if (slotEls.length === 0 && merchCard.variant !== MINI_COMPARE_CHART) return;
if (slotEls.length === 0) return;
const newEl = createTag(
'p',
{ slot: slotName, class: slotName },
Expand Down Expand Up @@ -295,7 +286,7 @@ const simplifyHrs = (el) => {
});
};

async function extractQuantitySelect(el) {
function extractQuantitySelect(el) {
const quantitySelectConfig = el.querySelector('ul');
if (!quantitySelectConfig) return null;
const configMarkup = quantitySelectConfig.querySelector('li');
Expand All @@ -307,7 +298,7 @@ async function extractQuantitySelect(el) {
const quantityValues = config[1].textContent.split(',').map((value) => value.trim())
.filter((value) => /^\d+$/.test(value));
if (quantityValues.length !== 3) return null;
await import('../../deps/merch-quantity-select.js');
import('../../deps/merch-quantity-select.js');
[attributes.min, attributes.max, attributes.step] = quantityValues.map(Number);
const quantitySelect = createTag('merch-quantity-select', attributes);
quantitySelectConfig.remove();
Expand Down Expand Up @@ -345,9 +336,8 @@ const decorateFooterRows = (merchCard, footerRows) => {

const setMiniCompareOfferSlot = (merchCard, offers) => {
if (merchCard.variant !== MINI_COMPARE_CHART) return;
const miniCompareOffers = merchCard.querySelector('div[slot="offers"]');
// eslint-disable-next-line chai-friendly/no-unused-expressions
offers ? miniCompareOffers.append(offers) : miniCompareOffers.appendChild(createTag('p'));
const miniCompareOffers = createTag('div', { slot: 'offers' }, offers);
if (offers === undefined) { miniCompareOffers.appendChild(createTag('p')); }
merchCard.appendChild(miniCompareOffers);
};

Expand Down Expand Up @@ -410,10 +400,9 @@ const init = async (el) => {
}
let footerRows;
if (cardType === MINI_COMPARE_CHART) {
intersectionObserver.observe(merchCard);
const container = el.closest('[data-status="decorated"]');
if (container) {
addTabClickListener(container);
intersectionObserver.observe(container);
}
footerRows = getMiniCompareChartFooterRows(el);
}
Expand Down Expand Up @@ -491,11 +480,7 @@ const init = async (el) => {
merchCard.appendChild(footer);

if (MULTI_OFFER_CARDS.includes(cardType)) {
if (merchCard.variant === MINI_COMPARE_CHART) {
const miniCompareOffers = createTag('div', { slot: 'offers' });
merchCard.append(miniCompareOffers);
}
const quantitySelect = await extractQuantitySelect(el, cardType);
const quantitySelect = extractQuantitySelect(el);
const offerSelection = el.querySelector('ul');
if (offerSelection) {
const { initOfferSelection } = await import('./merch-offer-select.js');
Expand Down
1 change: 0 additions & 1 deletion libs/blocks/merch-card/merch-offer-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function createDynamicSlots(el, bodySlot) {
const descriptionSlot = el.querySelector('p[slot="description"]');
if (descriptionSlot) {
descriptionSlot.innerHTML += description.innerHTML;
description.parentNode.removeChild(description);
}
}
}
Expand Down
Loading

0 comments on commit 2664595

Please sign in to comment.