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.
Update order and account dropins integration (#161)
* Update order and account dropins integration * Fix lint issues * Adjust TODO comments * Integrate placeholders approach for static text * Logout redirect fix * Bump storefront-order version * Return details (#163) Implement return-details page * Bump storefront-order version * Update placeholders, remove debug code * Adjust placeholders approach * Adjust placeholders approach (once again)
- Loading branch information
Showing
149 changed files
with
1,112 additions
and
124 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
4 changes: 4 additions & 0 deletions
4
blocks/commerce-customer-details/commerce-customer-details.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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
/* .commerce-customer-details { | ||
} */ | ||
|
||
.commerce-customer-details { | ||
margin-bottom: var(--spacing-small); | ||
} |
1 change: 1 addition & 0 deletions
1
blocks/commerce-customer-information/commerce-customer-information.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 @@ | ||
/* stylelint-disable no-empty-source */ |
17 changes: 17 additions & 0 deletions
17
blocks/commerce-customer-information/commerce-customer-information.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,17 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import CustomerInformation from '@dropins/storefront-account/containers/CustomerInformation.js'; | ||
import { render as accountRenderer } from '@dropins/storefront-account/render.js'; | ||
import { checkIsAuthenticated } from '../../scripts/configs.js'; | ||
import { CUSTOMER_LOGIN_PATH } from '../../scripts/constants.js'; | ||
|
||
// Initialize | ||
import '../../scripts/initializers/account.js'; | ||
|
||
export default async function decorate(block) { | ||
if (!checkIsAuthenticated()) { | ||
window.location.href = CUSTOMER_LOGIN_PATH; | ||
} else { | ||
await accountRenderer.render(CustomerInformation, {})(block); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
blocks/commerce-order-cost-summary/commerce-order-cost-summary.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,6 @@ | ||
/* .commerce-customer-details { | ||
} */ | ||
|
||
.commerce-order-cost-summary { | ||
margin-bottom: var(--spacing-small); | ||
} |
11 changes: 11 additions & 0 deletions
11
blocks/commerce-order-cost-summary/commerce-order-cost-summary.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,11 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { render as orderRenderer } from '@dropins/storefront-order/render.js'; | ||
import { OrderCostSummary } from '@dropins/storefront-order/containers/OrderCostSummary.js'; | ||
|
||
// Initialize | ||
import '../../scripts/initializers/order.js'; | ||
|
||
export default async function decorate(block) { | ||
await orderRenderer.render(OrderCostSummary, {})(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
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
10 changes: 10 additions & 0 deletions
10
blocks/commerce-order-product-list/commerce-order-product-list.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,10 @@ | ||
/* .commerce-customer-details { | ||
} */ | ||
|
||
.commerce-order-product-list { | ||
margin-bottom: var(--spacing-small); | ||
} | ||
|
||
.commerce-order-product-list .dropin-cart-item a:hover { | ||
text-decoration: none; | ||
} |
13 changes: 13 additions & 0 deletions
13
blocks/commerce-order-product-list/commerce-order-product-list.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,13 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { render as orderRenderer } from '@dropins/storefront-order/render.js'; | ||
import { OrderProductList } from '@dropins/storefront-order/containers/OrderProductList.js'; | ||
|
||
// Initialize | ||
import '../../scripts/initializers/order.js'; | ||
|
||
export default async function decorate(block) { | ||
await orderRenderer.render(OrderProductList, { | ||
routeProductDetails: (product) => `/products/${product.productUrlKey}/${product.product.sku}`, | ||
})(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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* .commerce-customer-details { | ||
} */ | ||
|
||
.commerce-order-returns { | ||
margin-bottom: var(--spacing-small); | ||
} |
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,32 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { render as orderRenderer } from '@dropins/storefront-order/render.js'; | ||
import { OrderReturns } from '@dropins/storefront-order/containers/OrderReturns.js'; | ||
import { checkIsAuthenticated } from '../../scripts/configs.js'; | ||
import { | ||
CUSTOMER_RETURN_DETAILS_PATH, | ||
RETURN_DETAILS_PATH, | ||
} from '../../scripts/constants.js'; | ||
|
||
// Initialize | ||
import '../../scripts/initializers/order.js'; | ||
|
||
export default async function decorate(block) { | ||
const isAuthenticated = checkIsAuthenticated(); | ||
const returnDetailsPath = isAuthenticated | ||
? CUSTOMER_RETURN_DETAILS_PATH | ||
: RETURN_DETAILS_PATH; | ||
|
||
await orderRenderer.render(OrderReturns, { | ||
routeReturnDetails: ({ orderNumber, returnNumber, token }) => { | ||
const { searchParams } = new URL(window.location.href); | ||
const orderRefFromUrl = searchParams.get('orderRef'); | ||
const newOrderRef = isAuthenticated ? orderNumber : token; | ||
|
||
const encodedOrderRef = encodeURIComponent(orderRefFromUrl || newOrderRef); | ||
|
||
return `${returnDetailsPath}?orderRef=${encodedOrderRef}&returnRef=${returnNumber}`; | ||
}, | ||
routeProductDetails: (productData) => (productData ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), | ||
})(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,5 @@ | ||
/* stylelint-disable no-empty-source */ | ||
|
||
.commerce-order-status { | ||
margin-bottom: var(--spacing-small); | ||
} |
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,12 @@ | ||
body:not(.columns) main div.commerce-return-header { | ||
margin-top: var(--spacing-large); | ||
} | ||
|
||
body.columns main > .section > div.commerce-return-header { | ||
margin-bottom: 0; | ||
} | ||
|
||
.returns-list-header { | ||
display: inline-block; | ||
margin-bottom: var(--spacing-medium); | ||
} |
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,34 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { events } from '@dropins/tools/event-bus.js'; | ||
import { Header, provider as uiProvider } from '@dropins/tools/components.js'; | ||
import { CUSTOMER_RETURN_DETAILS_PATH, CUSTOMER_RETURNS_PATH } from '../../scripts/constants.js'; | ||
import { fetchPlaceholders } from '../../scripts/aem.js'; | ||
|
||
export default async function decorate(block) { | ||
block.innerHTML = ''; | ||
|
||
const headerContainer = document.createElement('div'); | ||
await uiProvider.render(Header, { title: 'Return' })(headerContainer); | ||
|
||
if (window.location.href.includes(CUSTOMER_RETURN_DETAILS_PATH)) { | ||
const placeholders = await fetchPlaceholders(); | ||
|
||
const link = document.createElement('a'); | ||
|
||
link.innerText = placeholders?.Custom?.CommerceReturnHeader?.backToAllReturns; | ||
link.href = CUSTOMER_RETURNS_PATH; | ||
link.classList.add('returns-list-header'); | ||
|
||
block.appendChild(link); | ||
} | ||
|
||
block.appendChild(headerContainer); | ||
|
||
events.on('order/data', (orderData) => { | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const returnNumber = urlParams.get('returnRef'); | ||
const returnData = orderData.returns.find((item) => item.returnNumber === returnNumber); | ||
uiProvider.render(Header, { title: `Return ${returnData.returnNumber}` })(headerContainer); | ||
}, { eager: true }); | ||
} |
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,33 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { render as orderRenderer } from '@dropins/storefront-order/render.js'; | ||
import ReturnsList from '@dropins/storefront-order/containers/ReturnsList.js'; | ||
import { readBlockConfig } from '../../scripts/aem.js'; | ||
import { checkIsAuthenticated } from '../../scripts/configs.js'; | ||
import { | ||
CUSTOMER_LOGIN_PATH, | ||
CUSTOMER_RETURN_DETAILS_PATH, | ||
CUSTOMER_ORDER_DETAILS_PATH, | ||
CUSTOMER_RETURNS_PATH, | ||
} from '../../scripts/constants.js'; | ||
|
||
// Initialize | ||
import '../../scripts/initializers/order.js'; | ||
|
||
export default async function decorate(block) { | ||
const { | ||
'minified-view': minifiedViewConfig = 'false', | ||
} = readBlockConfig(block); | ||
|
||
if (!checkIsAuthenticated()) { | ||
window.location.href = CUSTOMER_LOGIN_PATH; | ||
} else { | ||
await orderRenderer.render(ReturnsList, { | ||
minifiedView: minifiedViewConfig === 'true', | ||
routeReturnDetails: ({ orderNumber, returnNumber }) => `${CUSTOMER_RETURN_DETAILS_PATH}?orderRef=${orderNumber}&returnRef=${returnNumber}`, | ||
routeOrderDetails: ({ orderNumber }) => `${CUSTOMER_ORDER_DETAILS_PATH}?orderRef=${orderNumber}`, | ||
routeReturnsList: () => CUSTOMER_RETURNS_PATH, | ||
routeProductDetails: (productData) => (productData ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), | ||
})(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
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,9 @@ | ||
/* stylelint-disable no-empty-source */ | ||
|
||
.commerce-shipping-status { | ||
margin-bottom: var(--spacing-small); | ||
} | ||
|
||
.commerce-shipping-status .order-shipping-status-card { | ||
margin-bottom: var(--spacing-small); | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Oops, something went wrong.