forked from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into da-live-preview
- Loading branch information
Showing
1,315 changed files
with
41,227 additions
and
4,898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Cypress E2E Tests | ||
on: push | ||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install root dependencies | ||
run: npm ci | ||
- name: Start server in the background | ||
run: npm start & | ||
|
||
- name: Install Cypress and run tests | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
working-directory: cypress | ||
browser: chrome | ||
wait-on: 'http://localhost:3000' | ||
config: baseUrl=http://localhost:3000 | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: cypress-screenshots | ||
path: cypress/screenshots | ||
if-no-files-found: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
.* | ||
*.md | ||
*.d.ts | ||
karma.config.js | ||
LICENSE | ||
package.json | ||
package-lock.json | ||
test/* | ||
postinstall.js | ||
build.mjs | ||
tools/picker/src/* | ||
cypress/ | ||
tools/pdp-metadata/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
; force @adobe namespaced packages to be installed from npmjs.org | ||
@adobe:registry=https://registry.npmjs.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body.columns main > .section > div.commerce-account-header-wrapper { | ||
margin-bottom: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { Header, provider as uiProvider } from '@dropins/tools/components.js'; | ||
import { readBlockConfig } from '../../scripts/aem.js'; | ||
|
||
export default function decorate(block) { | ||
const { | ||
title = 'My account', | ||
} = readBlockConfig(block); | ||
|
||
block.innerHTML = ''; | ||
|
||
return uiProvider.render(Header, { title })(block); | ||
} |
59 changes: 59 additions & 0 deletions
59
blocks/commerce-account-sidebar/commerce-account-sidebar.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@media (width >= 900px) { | ||
body.columns main > .section.commerce-account-sidebar-container { | ||
max-width: var(--column-width); | ||
} | ||
} | ||
|
||
.commerce-account-sidebar-wrapper .commerce-account-sidebar .commerce-account-sidebar-item { | ||
display: flex; | ||
align-items: center; | ||
padding: var(--spacing-medium); | ||
margin-bottom: var(--spacing-small); | ||
border: var(--shape-border-width-2) solid var(--color-neutral-400); | ||
border-radius: var(--shape-border-radius-2); | ||
text-decoration: none; | ||
} | ||
|
||
.commerce-account-sidebar-wrapper .commerce-account-sidebar .commerce-account-sidebar-item-active { | ||
border-color: var(--color-neutral-800); | ||
background-color: var(--color-neutral-200); | ||
} | ||
|
||
.commerce-account-sidebar-item-icon { | ||
flex: 0 0 auto; | ||
margin-right: var(--spacing-small); | ||
} | ||
|
||
.commerce-account-sidebar-item-icon > div { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.commerce-account-sidebar-item-content { | ||
flex: 1 1 auto; | ||
} | ||
|
||
.commerce-account-sidebar-item-title { | ||
font: var(--type-button-1-font); | ||
margin: 0 0 var(--spacing-xxsmall); | ||
border: none; | ||
text-decoration: none; | ||
} | ||
|
||
.commerce-account-sidebar-item-subtitle { | ||
font: var(--type-button-2-font); | ||
margin: 0; | ||
text-decoration: none; | ||
} | ||
|
||
.commerce-account-sidebar-item-arrow { | ||
flex: 0 0 auto; | ||
margin-left: var(--spacing-small); | ||
} | ||
|
||
.commerce-account-sidebar-item-arrow > div { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} |
80 changes: 80 additions & 0 deletions
80
blocks/commerce-account-sidebar/commerce-account-sidebar.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { Icon, provider as uiProvider } from '@dropins/tools/components.js'; | ||
import { render as accountRenderer } from '@dropins/storefront-account/render.js'; | ||
import { loadFragment } from '../fragment/fragment.js'; | ||
import { CUSTOMER_ORDERS_PATH } from '../../scripts/constants.js'; | ||
|
||
export default async function decorate(block) { | ||
const fragment = await loadFragment('/customer/sidebar-fragment'); | ||
const sidebarItemsConfig = fragment.querySelectorAll('.default-content-wrapper > ol > li'); | ||
const sidebarItems = Array.from(sidebarItemsConfig).map((item) => { | ||
const itemParams = Array.from(item.querySelectorAll('ol > li')); | ||
const itemConfig = { | ||
itemTitle: item.childNodes[0]?.textContent.trim() || 'Default Title', | ||
itemSubtitle: itemParams[0]?.innerText || '', | ||
itemLink: itemParams[1]?.innerText || '#', | ||
itemIcon: itemParams[2]?.innerText || 'Placeholder', | ||
}; | ||
|
||
const menuItemEl = document.createElement('a'); | ||
menuItemEl.classList.add('commerce-account-sidebar-item'); | ||
menuItemEl.href = itemConfig.itemLink; | ||
|
||
const isItemActive = ( | ||
itemConfig.itemLink === CUSTOMER_ORDERS_PATH | ||
? window.location.href.includes(CUSTOMER_ORDERS_PATH) | ||
: window.location.href.includes(itemConfig.itemLink) | ||
); | ||
if (isItemActive) { | ||
menuItemEl.classList.add('commerce-account-sidebar-item-active'); | ||
} | ||
|
||
const iconEl = createMenuItemIcon(itemConfig.itemIcon); | ||
const contentEl = createMenuItemContent(itemConfig.itemTitle, itemConfig.itemSubtitle); | ||
const arrowEl = createMenuItemArrow(); | ||
|
||
menuItemEl.appendChild(iconEl); | ||
menuItemEl.appendChild(contentEl); | ||
menuItemEl.appendChild(arrowEl); | ||
|
||
return menuItemEl; | ||
}); | ||
|
||
block.innerHTML = ''; | ||
sidebarItems.forEach((el) => { | ||
block.appendChild(el); | ||
}); | ||
} | ||
|
||
function createMenuItemIcon(iconSource) { | ||
const iconEl = document.createElement('div'); | ||
iconEl.classList.add('commerce-account-sidebar-item-icon'); | ||
accountRenderer.render(Icon, { source: iconSource, size: 32 })(iconEl); | ||
return iconEl; | ||
} | ||
|
||
function createMenuItemContent(title, subtitle) { | ||
const contentEl = document.createElement('div'); | ||
contentEl.classList.add('commerce-account-sidebar-item-content'); | ||
|
||
const titleEl = document.createElement('p'); | ||
titleEl.classList.add('commerce-account-sidebar-item-title'); | ||
titleEl.innerText = title; | ||
|
||
const subtitleEl = document.createElement('p'); | ||
subtitleEl.classList.add('commerce-account-sidebar-item-subtitle'); | ||
subtitleEl.innerText = subtitle; | ||
|
||
contentEl.appendChild(titleEl); | ||
contentEl.appendChild(subtitleEl); | ||
return contentEl; | ||
} | ||
|
||
function createMenuItemArrow() { | ||
const arrowEl = document.createElement('div'); | ||
arrowEl.classList.add('commerce-account-sidebar-item-arrow'); | ||
uiProvider.render(Icon, { | ||
source: 'ChevronRight', | ||
size: 32, | ||
})(arrowEl); | ||
return arrowEl; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* stylelint-disable no-empty-source */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { Addresses } from '@dropins/storefront-account/containers/Addresses.js'; | ||
import { render as accountRenderer } from '@dropins/storefront-account/render.js'; | ||
import { readBlockConfig } from '../../scripts/aem.js'; | ||
import { checkIsAuthenticated } from '../../scripts/configs.js'; | ||
import { CUSTOMER_ADDRESS_PATH, CUSTOMER_LOGIN_PATH } from '../../scripts/constants.js'; | ||
|
||
// Initialize | ||
import '../../scripts/initializers/account.js'; | ||
|
||
export default async function decorate(block) { | ||
const { | ||
'minified-view': minifiedViewConfig = 'false', | ||
} = readBlockConfig(block); | ||
|
||
if (!checkIsAuthenticated()) { | ||
window.location.href = CUSTOMER_LOGIN_PATH; | ||
} else { | ||
await accountRenderer.render(Addresses, { | ||
minifiedView: minifiedViewConfig === 'true', | ||
withActionsInMinifiedView: false, | ||
withActionsInFullSizeView: true, | ||
routeAddressesPage: () => CUSTOMER_ADDRESS_PATH, | ||
})(block); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
/* stylelint-disable no-empty-source */ | ||
/* stylelint-disable selector-class-pattern */ | ||
|
||
.commerce-cart { | ||
padding: var(--spacing-large) 0; | ||
} | ||
|
||
.cart__wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--grid-4-gutters); | ||
} | ||
|
||
.cart__wrapper[hidden], | ||
.cart__empty-cart[hidden] { | ||
display: none; | ||
} | ||
|
||
@media (width >= 900px) { | ||
.cart__wrapper { | ||
flex-direction: row; | ||
} | ||
|
||
.cart__left-column { | ||
flex: 1; | ||
flex-basis: 70%; | ||
} | ||
|
||
.cart__right-column { | ||
flex: 1; | ||
flex-basis: auto; | ||
} | ||
} |
Oops, something went wrong.