Skip to content

Commit 6e8c0ea

Browse files
authored
Merge branch 'main' into aem-experimentation
2 parents b3e77d1 + 2a2462c commit 6e8c0ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+8228
-21978
lines changed

.eslintignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
helix-importer-ui
22
scripts/preact.js
33
scripts/htm.js
4+
scripts/acdl
45
tools/picker
5-
plugins/
6+
scripts/commerce-events-collector.js
7+
scripts/commerce-events-sdk.js
8+
scripts/widgets
9+
plugins/

.github/workflows/cleanup-on-create.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,26 @@ on:
66
create:
77
branches:
88
- main
9+
workflow_dispatch:
910
jobs:
1011
cleanup:
1112
runs-on: ubuntu-latest
1213
permissions:
1314
contents: write
1415
actions: write
1516
# only run if commit message is "Initial commit" on main branch
16-
if: ${{ github.ref == 'refs/heads/main' && github.event.head_commit.message == 'Initial commit' }}
17+
if: ${{ github.event_name == 'workflow_dispatch' || ( github.ref == 'refs/heads/main' && !(contains(github.event, 'head_commit') || github.event.head_commit.message == 'Initial commit' )) }}
1718
steps:
1819
- name: Checkout
1920
uses: actions/checkout@v4
20-
- name: Use Node.js 18
21+
- name: Use Node.js 20
2122
uses: actions/setup-node@v4
2223
with:
23-
node-version: 18
24-
- name: Uninstall dependencies
25-
run: |
26-
npm uninstall --save-dev semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/exec
24+
node-version: 20
2725
- name: Remove Helper Files
2826
run: |
2927
rm -rf \
3028
.github/workflows/cleanup-on-create.yaml \
31-
.github/workflows/semantic-release.yaml \
32-
.releaserc.cjs \
3329
CHANGELOG.md
3430
3531
- name: Initialize README
@@ -47,7 +43,7 @@ jobs:
4743
- name: Commit changes
4844
run: |
4945
git config --local user.email "[email protected]"
50-
git config --local user.name "Helix Bot"
46+
git config --local user.name "AEM Bot"
5147
git add .
5248
git commit -m "chore: cleanup repository template"
5349
git push

.github/workflows/main.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Build
2+
on: [push]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Use Node.js 20
10+
uses: actions/setup-node@v4
11+
with:
12+
node-version: 20
13+
- run: npm ci
14+
- run: npm run lint

.github/workflows/run-tests.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/semantic-release.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.hlxignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ LICENSE
55
package.json
66
package-lock.json
77
test/*
8+
postinstall.js
9+
tools/picker/src/*

.releaserc.cjs

Lines changed: 0 additions & 18 deletions
This file was deleted.

404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
btnContainer.append(backBtn);
2727
}
2828
}
29-
sampleRUM('404', { source: document.referrer, target: window.location.href });
29+
sampleRUM('404', { source: document.referrer });
3030
});
3131
</script>
3232
<link rel="stylesheet" href="/styles/styles.css">

CHANGELOG.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,3 @@ One of the maintainers will look at the pull request within one week. Feedback o
7171
The project's committers will release to the [Adobe organization on npmjs.org](https://www.npmjs.com/org/adobe).
7272
Please contact the [Adobe Open Source Advisory Board](https://git.corp.adobe.com/OpenSourceAdvisoryBoard/discuss/issues) to get access to the npmjs organization.
7373

74-
The release process is fully automated using `semantic-release`, increasing the version numbers, etc. based on the contents of the commit messages found.

blocks/enrichment/enrichment.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ export default async function decorate(block) {
1313
}
1414

1515
if (type === 'category') {
16-
const categoryId = document.querySelector('.block.product-list-page')?.dataset?.category;
16+
const plpBlock = document.querySelector('.block.product-list-page');
17+
if (!plpBlock) return;
18+
19+
let categoryId = plpBlock.dataset?.category;
20+
if (!categoryId) {
21+
categoryId = readBlockConfig(plpBlock).category;
22+
}
1723
if (!categoryId) return;
1824
filters.categories = categoryId;
1925
}
@@ -33,10 +39,21 @@ export default async function decorate(block) {
3339
(await Promise.all(matchingFragments.map((path) => loadFragment(path))))
3440
.filter((fragment) => fragment)
3541
.forEach((fragment) => {
36-
const section = fragment.querySelector(':scope .section');
37-
if (section) {
38-
block.closest('.section').classList.add(...section.classList);
39-
block.closest('.section').append(...section.childNodes);
42+
const sections = fragment.querySelectorAll(':scope .section');
43+
44+
// If only single section, replace block with content of section
45+
if (sections.length === 1) {
46+
block.closest('.section').classList.add(...sections[0].classList);
47+
const wrapper = block.closest('.enrichment-wrapper');
48+
Array.from(sections[0].children)
49+
.forEach((child) => wrapper.parentNode.insertBefore(child, wrapper));
50+
} else if (sections.length > 1) {
51+
// If multiple sections, insert them after section of block
52+
const blockSection = block.closest('.section');
53+
Array.from(sections)
54+
.reverse()
55+
.forEach((section) => blockSection
56+
.parentNode.insertBefore(section, blockSection.nextSibling));
4057
}
4158
});
4259

blocks/footer/footer.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ import { loadFragment } from '../fragment/fragment.js';
66
* @param {Element} block The footer block element
77
*/
88
export default async function decorate(block) {
9+
// load footer as fragment
910
const footerMeta = getMetadata('footer');
10-
block.textContent = '';
11-
12-
// load footer fragment
13-
const footerPath = footerMeta.footer || '/footer';
11+
const footerPath = footerMeta ? new URL(footerMeta, window.location).pathname : '/footer';
1412
const fragment = await loadFragment(footerPath);
1513

1614
// decorate footer DOM
15+
block.textContent = '';
1716
const footer = document.createElement('div');
1817
while (fragment.firstElementChild) footer.append(fragment.firstElementChild);
1918

blocks/header/header.css

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* stylelint-disable selector-class-pattern */
2+
13
/* header and nav layout */
24
header .nav-wrapper {
35
background-color: var(--background-color);
@@ -273,7 +275,7 @@ header nav .nav-tools {
273275
gap: 10px;
274276
}
275277

276-
header nav .nav-tools button {
278+
header nav .nav-tools > button, header nav .nav-tools .minicart-wrapper > button {
277279
color: var(--color-brand-700);
278280
background: transparent;
279281
padding: 5px 10px;
@@ -296,12 +298,13 @@ header nav .nav-tools button.nav-search-button {
296298

297299
header .nav-search-input {
298300
position: absolute;
301+
z-index: 99;
299302
top: var(--nav-height);
303+
box-shadow: var(--shape-shadow-2);
300304
background: var(--color-neutral-50);
301305
left: 0;
302306
right: 0;
303-
padding: 10px;
304-
z-index: 1;
307+
padding: 20px;
305308
}
306309

307310
header .nav-search-input.hidden {
@@ -310,4 +313,20 @@ header .nav-search-input.hidden {
310313

311314
header .nav-search-input input {
312315
width: 100%;
316+
padding: 5px;
317+
}
318+
319+
header .nav-search-input .search_autocomplete .popover-container {
320+
width: 100%;
321+
}
322+
323+
@media (width >= 1024px) {
324+
header .nav-search-input {
325+
left: unset;
326+
right: 20px;
327+
}
328+
329+
header .nav-search-input input {
330+
min-width: 400px;
331+
}
313332
}

blocks/header/header.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,17 @@ function toggleMenu(nav, navSections, forceExpanded = null) {
8888
}
8989

9090
/**
91-
* decorates the header, mainly the nav
91+
* loads and decorates the header, mainly the nav
9292
* @param {Element} block The header block element
9393
*/
9494
export default async function decorate(block) {
9595
// load nav as fragment
9696
const navMeta = getMetadata('nav');
97-
const navPath = navMeta ? new URL(navMeta).pathname : '/nav';
97+
const navPath = navMeta ? new URL(navMeta, window.location).pathname : '/nav';
9898
const fragment = await loadFragment(navPath);
9999

100100
// decorate nav DOM
101+
block.textContent = '';
101102
const nav = document.createElement('nav');
102103
nav.id = 'nav';
103104
while (fragment.firstElementChild) nav.append(fragment.firstElementChild);
@@ -145,12 +146,18 @@ export default async function decorate(block) {
145146
});
146147

147148
// Search
148-
const searchInput = document.createRange().createContextualFragment('<div class="nav-search-input hidden"><form action="/search" method="GET"><input type="search" name="q" placeholder="Search" /></form></div>');
149+
const searchInput = document.createRange().createContextualFragment(`<div class="nav-search-input hidden">
150+
<form id="search_mini_form" action="/search" method="GET">
151+
<input id="search" type="search" name="q" placeholder="Search" />
152+
<div id="search_autocomplete" class="search-autocomplete"></div>
153+
</form>
154+
</div>`);
149155
document.body.querySelector('header').append(searchInput);
150156

151157
const searchButton = document.createRange().createContextualFragment('<button type="button" class="nav-search-button">Search</button>');
152158
navTools.append(searchButton);
153-
navTools.querySelector('.nav-search-button').addEventListener('click', () => {
159+
navTools.querySelector('.nav-search-button').addEventListener('click', async () => {
160+
await import('./searchbar.js');
154161
document.querySelector('header .nav-search-input').classList.toggle('hidden');
155162
});
156163

0 commit comments

Comments
 (0)