Skip to content

Commit 896a44f

Browse files
[Release] Stage to Main (#4515)
2 parents f64a90b + b3c4bc6 commit 896a44f

File tree

27 files changed

+321
-105
lines changed

27 files changed

+321
-105
lines changed

libs/blocks/caas-config/caas-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import {
1414
getConfig,
1515
parseEncodedConfig,
1616
loadStyle,
17+
isValidHtmlUrl,
1718
} from '../../utils/utils.js';
1819
import Accordion from '../../ui/controls/Accordion.js';
1920
import {
2021
decodeCompressedString,
2122
defaultState,
2223
initCaas,
23-
isValidHtmlUrl,
2424
isValidUuid,
2525
loadCaasFiles,
2626
loadCaasTags,

libs/blocks/caas/utils.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,6 @@ export function getPageLocale(currentPath, locales = pageLocales) {
189189
return '';
190190
}
191191

192-
export const isValidHtmlUrl = (url) => {
193-
const regex = /^https:\/\/[^\s]+$/;
194-
return regex.test(url);
195-
};
196192
export const isValidUuid = (id) => /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(id);
197193

198194
export const loadStrings = async (

libs/blocks/global-navigation/global-navigation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,7 @@ class Gnav {
11931193
header.style.top = 0;
11941194
localNav.style.top = promoHeight;
11951195
}
1196+
if (!isDesktop.matches) this.updatePopupPosition();
11961197
};
11971198

11981199
if (this.elements.aside.clientHeight > fedsPromoWrapper.clientHeight) {
@@ -1547,7 +1548,7 @@ class Gnav {
15471548
return !this.customLinks.includes(linkHash);
15481549
};
15491550
[...customLinksSection.classList].splice(1).forEach((className) => {
1550-
customLinkModifier = ` feds-navItem--${className}`;
1551+
customLinkModifier += ` feds-navItem--${className}`;
15511552
});
15521553
removeCustomLink = removeLink();
15531554
} else if (itemHasActiveLink) {

libs/blocks/merch-card-collection-autoblock/merch-card-collection-autoblock.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,56 @@ function getSidenav(collection) {
105105
return sidenav;
106106
}
107107

108+
function handleCustomAnalyticsEvent(eventName, element) {
109+
let daaLhValue = '';
110+
let daaLhElement = element.closest('[daa-lh]');
111+
while (daaLhElement) {
112+
if (daaLhValue) {
113+
daaLhValue = `|${daaLhValue}`;
114+
}
115+
const daaLhAttrValue = daaLhElement.getAttribute('daa-lh');
116+
daaLhValue = `${daaLhAttrValue}${daaLhValue}`;
117+
daaLhElement = daaLhElement.parentElement.closest('[daa-lh]');
118+
}
119+
if (daaLhValue) {
120+
// eslint-disable-next-line no-underscore-dangle
121+
window._satellite?.track('event', {
122+
xdm: {},
123+
data: { web: { webInteraction: { name: `${eventName}|${daaLhValue}` } } },
124+
});
125+
}
126+
}
127+
128+
function enableAnalytics(el) {
129+
const tabs = el.closest('.tabs');
130+
if (!tabs || tabs.analyticsInitiated) return;
131+
tabs.analyticsInitiated = true;
132+
133+
window.addEventListener('merch-sidenav:select', ({ target }) => {
134+
if (!target || target.oldValue === target.selectedValue) return;
135+
handleCustomAnalyticsEvent(`${target.selectedValue}--cat`, target);
136+
target.oldValue = target.selectedValue;
137+
});
138+
139+
window.addEventListener('mas:ready', ({ target }) => {
140+
target.querySelectorAll('merch-addon').forEach((ao) => {
141+
ao.addEventListener('change', (aoe) => {
142+
handleCustomAnalyticsEvent(`addon-${aoe.detail.checked ? 'checked' : 'unchecked'}`, aoe.target);
143+
});
144+
});
145+
target.querySelectorAll('merch-quantity-select').forEach((qs) => {
146+
qs.addEventListener('merch-quantity-selector:change', (qse) => {
147+
handleCustomAnalyticsEvent(`quantity-${qse.detail.option}`, qse.target);
148+
});
149+
});
150+
});
151+
152+
window.addEventListener('milo:tab:changed', () => {
153+
const tab = tabs.querySelector('button[role="tab"][aria-selected="true"]');
154+
if (tab) handleCustomAnalyticsEvent(`tab-change--${tab.getAttribute('daa-ll')}`, tab);
155+
});
156+
}
157+
108158
export async function checkReady(masElement) {
109159
const readyPromise = masElement.checkReady();
110160
const success = await Promise.race([readyPromise, getTimeoutPromise()]);
@@ -152,11 +202,13 @@ export async function createCollection(el, options) {
152202
if (sidenav) {
153203
container.insertBefore(sidenav, collection);
154204
collection.sidenav = sidenav;
205+
sidenav.setAttribute('daa-lh', 'b3|filters');
155206
}
156207
}
157208

158209
postProcessAutoblock(collection);
159210
collection.requestUpdate();
211+
enableAnalytics(collection);
160212
}
161213

162214
export default async function init(el) {

libs/blocks/merch/merch.css

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,6 @@ a[is='checkout-link'].con-button > span {
4444
visibility: hidden;
4545
}
4646

47-
.three-in-one sp-theme {
48-
height: 100%;
49-
width: 100%;
50-
align-content: center;
51-
}
52-
53-
.three-in-one sp-theme sp-progress-circle {
54-
inset-inline-start: 50%;
55-
transform: translate(-50%);
56-
}
57-
5847
.error-wrapper {
5948
display: flex;
6049
justify-content: space-between;

libs/blocks/merch/three-in-one.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const handleTimeoutError = () => {
133133

134134
export function createContent(iframeUrl) {
135135
const content = createTag('div', { class: 'milo-iframe' });
136-
content.innerHTML = `<sp-theme system="light" color="light" scale="medium" dir="ltr">
136+
content.innerHTML = `<sp-theme system="light" color="light" scale="medium" dir="ltr" style="display: flex; justify-content: center; align-items: center; height: 100%;">
137137
<sp-progress-circle label="progress circle" indeterminate="" size="l" dir="ltr" role="progressbar" aria-label="progress circle"></sp-progress-circle>
138138
</sp-theme>
139139
<iframe src="${iframeUrl}" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen="true" loading="lazy" class="loading" style="height: 100%;"></iframe>`;

libs/blocks/reading-time/reading-time.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import '../../styles/inline.css';
22

33
.reading-time > span {
4-
color: #adadad;
4+
color: rgb(80 80 80);
55
font-style: italic;
66
font-weight: 700;
77
font-size: var(--type-body-s-size);
@@ -40,7 +40,7 @@ main > .section > .inline-wrapper > .inline.reading-time + .inline.share {
4040
border-left: none;
4141
padding-left: 0;
4242
}
43-
43+
4444
main > .section > .inline-wrapper > .inline + .inline.reading-time {
4545
border-top: 1px solid #adadad;
4646
}

libs/blocks/table/table.css

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -149,24 +149,6 @@
149149
border-radius: 0 !important;
150150
}
151151

152-
.table .col-heading:first-child {
153-
border-top-left-radius: var(--border-radius);
154-
}
155-
156-
[dir="rtl"] .table .col-heading:first-child {
157-
border-top-left-radius: 0;
158-
border-top-right-radius: var(--border-radius);
159-
}
160-
161-
.table .col-heading:last-child {
162-
border-top-right-radius: var(--border-radius);
163-
}
164-
165-
[dir="rtl"] .table .col-heading:last-child {
166-
border-top-right-radius: 0;
167-
border-top-left-radius: var(--border-radius);
168-
}
169-
170152
.table .row-heading .col-heading.col.no-rounded,
171153
[dir="rtl"] .table .row-heading .col-heading.col.no-rounded {
172154
border-radius: 0;
@@ -396,7 +378,7 @@
396378
/* rtl */
397379
[dir="rtl"] .table .col {
398380
border-right: 1px var(--border-color) solid;
399-
border-left: 1px solid transparent;
381+
border-left: 1px var(--border-color) solid;
400382
}
401383

402384
[dir="rtl"] .table.merch .col {
@@ -435,6 +417,16 @@
435417
border-right: 1px solid var(--hover-border-color);
436418
}
437419

420+
[dir="rtl"] .table .col-heading:first-child {
421+
border-top-left-radius: 0;
422+
border-top-right-radius: var(--border-radius);
423+
}
424+
425+
[dir="rtl"] .table .col-heading:last-child {
426+
border-top-right-radius: 0;
427+
border-top-left-radius: var(--border-radius);
428+
}
429+
438430
.table .row-heading .col-heading.hover {
439431
border-top: 1px solid var(--hover-border-color);
440432
}
@@ -587,6 +579,14 @@
587579
}
588580

589581
@media (min-width: 769px) {
582+
.table .col-heading:first-child {
583+
border-top-left-radius: var(--border-radius);
584+
}
585+
586+
.table .col-heading:last-child {
587+
border-top-right-radius: var(--border-radius);
588+
}
589+
590590
.table-section .filters {
591591
display: none;
592592
}
@@ -657,12 +657,27 @@
657657
margin-right: 16px;
658658
}
659659

660+
.table .col-heading:only-child {
661+
border-top-right-radius: var(--border-radius);
662+
border-top-left-radius: var(--border-radius);
663+
}
664+
660665
/* Start tablet styles */
661666
@media (max-width: 899px) {
662667
.table,
663668
.table.merch {
664669
margin: 0 30px;
665670
}
671+
672+
.table .right-round, [dir="rtl"] .table .left-round {
673+
border-top-right-radius: var(--border-radius);
674+
border-top-left-radius: 0;
675+
}
676+
677+
.table .left-round, [dir="rtl"] .table .right-round {
678+
border-top-left-radius: var(--border-radius);
679+
border-top-right-radius: 0;
680+
}
666681

667682
.section[class *= "grid-width-"] .table {
668683
margin: 0;

libs/blocks/table/table.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,17 @@ function applyStylesBasedOnScreenSize(table, originTable) {
542542
}
543543

544544
rows.forEach((row) => {
545+
const firstFilterCol = row.querySelector(`.col-${filters[0] + 1}`);
545546
const secondFilterCol = row.querySelector(`.col-${filters[1] + 1}`);
547+
548+
if (firstFilterCol?.classList.contains('col-heading')) {
549+
firstFilterCol.classList.remove('right-round');
550+
firstFilterCol.classList.add('left-round');
551+
}
552+
if (secondFilterCol?.classList.contains('col-heading')) {
553+
secondFilterCol.classList.remove('left-round');
554+
secondFilterCol.classList.add('right-round');
555+
}
546556
if (secondFilterCol) secondFilterCol.classList.add('force-last');
547557
});
548558

@@ -552,11 +562,17 @@ function applyStylesBasedOnScreenSize(table, originTable) {
552562
const selectedColumn = row.querySelector(`.col-${selectedCol}`);
553563
if (!selectedColumn) return;
554564

555-
selectedColumn.classList.remove('force-last');
556-
selectedColumn.classList.remove('rounded-left', 'rounded-right');
557565
const clone = selectedColumn.cloneNode(true);
558566
clone.setAttribute('data-cloned', 'true');
559-
clone.classList.remove('rounded-left', 'rounded-right');
567+
selectedColumn.classList.remove('force-last');
568+
569+
if (selectedColumn.classList.contains('col-heading')) {
570+
selectedColumn.classList.remove('right-round');
571+
selectedColumn.classList.add('left-round');
572+
clone.classList.remove('left-round');
573+
clone.classList.add('right-round');
574+
}
575+
560576
row.appendChild(clone);
561577
});
562578
}
@@ -616,7 +632,7 @@ function applyStylesBasedOnScreenSize(table, originTable) {
616632
if (deviceBySize === 'MOBILE' || (isMerch && deviceBySize === 'TABLET')) {
617633
mobileRenderer();
618634
} else {
619-
table.querySelectorAll('.hide-mobile').forEach((col) => { col.classList.remove('hide-mobile'); });
635+
table.querySelectorAll('.hide-mobile, .left-round, .right-round').forEach((col) => { col.classList.remove('hide-mobile', 'left-round', 'right-round'); });
620636
[...(table.querySelector('.row-heading')?.children || [])]
621637
.forEach((column) => [...column.children].forEach((row) => row.style.removeProperty('height')));
622638
table.parentElement.querySelectorAll('.filters select').forEach((select, index) => {

0 commit comments

Comments
 (0)