|
1 |
| -import { render as provider } from '@dropins/storefront-cart/render.js'; |
2 |
| -import MiniCart from '@dropins/storefront-cart/containers/MiniCart.js'; |
| 1 | +import { render as provider } from "@dropins/storefront-cart/render.js"; |
| 2 | +import MiniCart from "@dropins/storefront-cart/containers/MiniCart.js"; |
3 | 3 |
|
4 | 4 | // Initializers
|
5 |
| -import '../../scripts/initializers/cart.js'; |
| 5 | +import "../../scripts/initializers/cart.js"; |
6 | 6 |
|
7 |
| -import { readBlockConfig } from '../../scripts/aem.js'; |
| 7 | +import { readBlockConfig } from "../../scripts/aem.js"; |
8 | 8 |
|
9 | 9 | export default async function decorate(block) {
|
10 | 10 | const {
|
11 |
| - 'start-shopping-url': startShoppingURL = '', |
12 |
| - 'cart-url': cartURL = '', |
13 |
| - 'checkout-url': checkoutURL = '', |
| 11 | + "start-shopping-url": startShoppingURL = "", |
| 12 | + "cart-url": cartURL = "", |
| 13 | + "checkout-url": checkoutURL = "", |
14 | 14 | } = readBlockConfig(block);
|
15 | 15 |
|
16 |
| - block.innerHTML = ''; |
| 16 | + block.innerHTML = ""; |
17 | 17 |
|
18 | 18 | return provider.render(MiniCart, {
|
19 | 19 | routeEmptyCartCTA: startShoppingURL ? () => startShoppingURL : undefined,
|
20 | 20 | routeCart: cartURL ? () => cartURL : undefined,
|
21 | 21 | routeCheckout: checkoutURL ? () => checkoutURL : undefined,
|
22 |
| - routeProduct: (product) => `/products/${product.url.urlKey}/${product.topLevelSku}`, |
| 22 | + routeProduct: (product) => |
| 23 | + `/products/${product.url.urlKey}/${product.topLevelSku}`, |
| 24 | + slots: { |
| 25 | + ProductListFooter: (ctx) => { |
| 26 | + const productListFooter = document.createElement("div"); |
| 27 | + |
| 28 | + // Create a wrapper div for the shadow background |
| 29 | + const shadowWrapper = document.createElement("div"); |
| 30 | + shadowWrapper.style.backgroundColor = "#EFF5EF"; |
| 31 | + shadowWrapper.style.borderRadius = "5px"; |
| 32 | + |
| 33 | + // Create the content div |
| 34 | + const contentDiv = document.createElement("div"); |
| 35 | + contentDiv.innerHTML = |
| 36 | + "<p style='line-height: 1.5;'>Enjoy hassle-free shopping with our 30-day return policy!</p>"; |
| 37 | + contentDiv.style.display = "flex"; |
| 38 | + contentDiv.style.flexDirection = "column"; |
| 39 | + contentDiv.style.padding = "12px"; |
| 40 | + |
| 41 | + // Append the content div to the shadow wrapper |
| 42 | + shadowWrapper.appendChild(contentDiv); |
| 43 | + |
| 44 | + // Append the shadow wrapper to the productListFooter div |
| 45 | + productListFooter.appendChild(shadowWrapper); |
| 46 | + |
| 47 | + ctx.appendChild(productListFooter); |
| 48 | + }, |
| 49 | + PreCheckoutSection: (ctx) => { |
| 50 | + const productListFooter = document.createElement("div"); |
| 51 | + |
| 52 | + // Create a wrapper div for the shadow background |
| 53 | + const shadowWrapper = document.createElement("div"); |
| 54 | + shadowWrapper.style.backgroundColor = "#EEEFFB"; |
| 55 | + shadowWrapper.style.borderRadius = "5px"; |
| 56 | + |
| 57 | + // Create the content div |
| 58 | + const contentDiv = document.createElement("div"); |
| 59 | + contentDiv.innerHTML = |
| 60 | + "<p style='line-height: 1.5;'>Earn rewards every time you shop! Sign up for our free loyalty program today and start earning points on this purchase.</p>"; |
| 61 | + contentDiv.style.display = "flex"; |
| 62 | + contentDiv.style.flexDirection = "column"; |
| 63 | + contentDiv.style.padding = "12px"; |
| 64 | + |
| 65 | + // Append the content div to the shadow wrapper |
| 66 | + shadowWrapper.appendChild(contentDiv); |
| 67 | + |
| 68 | + // Append the shadow wrapper to the productListFooter div |
| 69 | + productListFooter.appendChild(shadowWrapper); |
| 70 | + |
| 71 | + ctx.appendChild(productListFooter); |
| 72 | + }, |
| 73 | + }, |
23 | 74 | })(block);
|
24 | 75 | }
|
0 commit comments