From eeab8f4f34a0dcd62542dd422975f745da81a76c Mon Sep 17 00:00:00 2001 From: chutingy Date: Fri, 6 Dec 2024 16:06:44 -0600 Subject: [PATCH] update cart to one beta --- package-lock.json | 12 +- package.json | 4 +- scripts/__dropins__/storefront-cart/api.js | 16 +- .../createGuestCart.d.ts} | 4 +- .../graphql/CreateCartMutation.d.ts | 2 +- .../index.d.ts | 2 +- .../api/graphql/CustomerAccountFragment.d.ts | 2 +- .../storefront-cart/api/index.d.ts | 3 +- .../publishShoppingCartViewEvent/index.d.ts | 2 + .../publishShoppingCartViewEvent.d.ts | 2 + .../storefront-cart/chunks/CartSummaryGrid.js | 2 +- .../storefront-cart/chunks/CartSummaryList.js | 2 +- .../storefront-cart/chunks/MiniCart.js | 3 - .../storefront-cart/chunks/OrderSummary.js | 2 +- .../chunks/OrderSummaryLine.js | 2 +- .../storefront-cart/chunks/acdl.js | 2 +- .../chunks/applyCouponsToCart.js | 2 +- .../chunks/getEstimatedTotals.js | 2 +- .../storefront-cart/chunks/getStoreConfig.js | 84 ------ .../storefront-cart/chunks/refreshCart.js | 84 ++++++ .../chunks/updateProductsFromCart.js | 6 +- .../storefront-cart/components/Cart/Cart.d.ts | 10 - .../components/Cart/index.d.ts | 19 -- .../storefront-cart/components/index.d.ts | 1 - .../storefront-cart/containers/Cart.d.ts | 3 - .../storefront-cart/containers/Cart.js | 3 - .../storefront-cart/containers/Cart/Cart.d.ts | 26 -- .../containers/Cart/index.d.ts | 19 -- .../containers/CartSummaryGrid.js | 2 +- .../containers/CartSummaryList.js | 2 +- .../storefront-cart/containers/Coupons.js | 2 +- .../storefront-cart/containers/EmptyCart.js | 2 +- .../containers/EstimateShipping.js | 2 +- .../storefront-cart/containers/MiniCart.js | 2 +- .../containers/OrderSummary.js | 2 +- .../containers/OrderSummaryLine.js | 2 +- .../storefront-cart/containers/index.d.ts | 1 - .../data/models/cart-model.d.ts | 4 + .../__fixtures__/estimatedShippingData.d.ts | 7 + .../__fixtures__/productTypesData.d.ts | 60 ++++ .../__dropins__/storefront-cart/fragments.js | 8 +- .../storefront-cart/fragments.original.js | 270 ------------------ scripts/__dropins__/storefront-cart/render.js | 4 +- scripts/__dropins__/tools/components.js | 2 +- scripts/__dropins__/tools/event-bus.js | 2 +- .../types/elsie/src/i18n/en_US.json.d.ts | 3 +- .../tools/types/elsie/src/i18n/index.d.ts | 9 +- .../tools/types/event-bus/src/index.d.ts | 7 + 48 files changed, 230 insertions(+), 484 deletions(-) rename scripts/__dropins__/storefront-cart/api/{createEmptyCart/createEmptyCart.d.ts => createGuestCart/createGuestCart.d.ts} (87%) rename scripts/__dropins__/storefront-cart/api/{createEmptyCart => createGuestCart}/graphql/CreateCartMutation.d.ts (80%) rename scripts/__dropins__/storefront-cart/api/{createEmptyCart => createGuestCart}/index.d.ts (95%) create mode 100644 scripts/__dropins__/storefront-cart/api/publishShoppingCartViewEvent/index.d.ts create mode 100644 scripts/__dropins__/storefront-cart/api/publishShoppingCartViewEvent/publishShoppingCartViewEvent.d.ts delete mode 100644 scripts/__dropins__/storefront-cart/chunks/MiniCart.js delete mode 100644 scripts/__dropins__/storefront-cart/chunks/getStoreConfig.js create mode 100644 scripts/__dropins__/storefront-cart/chunks/refreshCart.js delete mode 100644 scripts/__dropins__/storefront-cart/components/Cart/Cart.d.ts delete mode 100644 scripts/__dropins__/storefront-cart/components/Cart/index.d.ts delete mode 100644 scripts/__dropins__/storefront-cart/containers/Cart.d.ts delete mode 100644 scripts/__dropins__/storefront-cart/containers/Cart.js delete mode 100644 scripts/__dropins__/storefront-cart/containers/Cart/Cart.d.ts delete mode 100644 scripts/__dropins__/storefront-cart/containers/Cart/index.d.ts create mode 100644 scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/estimatedShippingData.d.ts delete mode 100644 scripts/__dropins__/storefront-cart/fragments.original.js diff --git a/package-lock.json b/package-lock.json index e115c0f02f..21892626d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,11 +14,11 @@ "@adobe/magento-storefront-events-sdk": "^1.8.0", "@dropins/storefront-account": "0.1.0-alpha20", "@dropins/storefront-auth": "0.0.1-alpha25", - "@dropins/storefront-cart": "0.10.0", + "@dropins/storefront-cart": "1.0.0-beta1", "@dropins/storefront-checkout": "0.1.0-alpha61", "@dropins/storefront-order": "0.1.0-alpha26", "@dropins/storefront-pdp": "1.0.0-beta3", - "@dropins/tools": "^0.36.0" + "@dropins/tools": "^0.37.0" }, "devDependencies": { "@adobe/aem-cli": "^16.5.8", @@ -771,7 +771,9 @@ "version": "0.0.1-alpha25" }, "node_modules/@dropins/storefront-cart": { - "version": "0.10.0" + "version": "1.0.0-beta1", + "resolved": "https://registry.npmjs.org/@dropins/storefront-cart/-/storefront-cart-1.0.0-beta1.tgz", + "integrity": "sha512-KyCj73e006QI36on/2p2lUpv1WD33dq5odu6OhdQJ1fOrrcTCQ7naYKd4ZBh2DZQS1dcbjwM+zUA9/MpXWwZXw==" }, "node_modules/@dropins/storefront-checkout": { "version": "0.1.0-alpha61", @@ -789,7 +791,9 @@ "integrity": "sha512-+FrqwWudn1zoOUeEsPNA7OApiUt5tcMSpLP7aJega8UNF1YzLyVyDNFG/PbZ0EmZunB/oJESG5ZxThnqitNurA==" }, "node_modules/@dropins/tools": { - "version": "0.36.0" + "version": "0.37.0", + "resolved": "https://registry.npmjs.org/@dropins/tools/-/tools-0.37.0.tgz", + "integrity": "sha512-0vtk6vS+WgsXDsIRw1M+BQxJh1t23kGluv2ncaDR16KKCWo/5yBchk/zY9V1IV9PK5uWibQV61MYFoHzNVWQgA==" }, "node_modules/@dual-bundle/import-meta-resolve": { "version": "4.1.0", diff --git a/package.json b/package.json index a5f0eae6b4..4c93f4e0be 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,10 @@ "@adobe/magento-storefront-events-sdk": "^1.8.0", "@dropins/storefront-account": "0.1.0-alpha20", "@dropins/storefront-auth": "0.0.1-alpha25", - "@dropins/storefront-cart": "0.10.0", + "@dropins/storefront-cart": "1.0.0-beta1", "@dropins/storefront-checkout": "0.1.0-alpha61", "@dropins/storefront-order": "0.1.0-alpha26", "@dropins/storefront-pdp": "1.0.0-beta3", - "@dropins/tools": "^0.36.0" + "@dropins/tools": "^0.37.0" } } diff --git a/scripts/__dropins__/storefront-cart/api.js b/scripts/__dropins__/storefront-cart/api.js index 29bb53c347..35ea04996c 100644 --- a/scripts/__dropins__/storefront-cart/api.js +++ b/scripts/__dropins__/storefront-cart/api.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{s,f as d,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a as H,b as k,c as z}from"./chunks/resetCart.js";import{C as l,t as f,c as g,g as h,a as A}from"./chunks/getStoreConfig.js";import{b as j,e as q,i as B,d as J}from"./chunks/getStoreConfig.js";import{events as p}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as I}from"./fragments.js";import{c as _,p as E}from"./chunks/acdl.js";import{u as L}from"./chunks/updateProductsFromCart.js";import{g as W,b as X,a as Z}from"./chunks/getEstimateShipping.js";import{g as at}from"./chunks/getEstimatedTotals.js";import{g as et}from"./chunks/persisted-data.js";import{A as ot,a as nt}from"./chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const R=` +import{s as o,f as d,h as T}from"./chunks/resetCart.js";import{g as $,r as Q,d as H,a as k,b as z,c as V}from"./chunks/resetCart.js";import{C as l,t as g,c as f}from"./chunks/refreshCart.js";import{g as q,b as B,d as J,e as K,i as L,a as W,r as X}from"./chunks/refreshCart.js";import{events as C}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as h}from"./fragments.js";import{b as A,a as I,c as _}from"./chunks/acdl.js";import{u as Z}from"./chunks/updateProductsFromCart.js";import{g as rt,b as at,a as et}from"./chunks/getEstimateShipping.js";import{g as ot}from"./chunks/getEstimatedTotals.js";import{g as E}from"./chunks/persisted-data.js";import{A as it,a as ct}from"./chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const G=` mutation ADD_PRODUCTS_TO_CART_MUTATION( $cartId: String!, $cartItems: [CartItemInput!]!, @@ -20,9 +20,13 @@ import{s,f as d,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a } } - ${I} -`,b=async a=>{let o=!1;const n=s.cartId||await P().then(e=>(o=!0,e));return d(R,{variables:{cartId:n,cartItems:a.map(({sku:e,parentSku:r,quantity:c,optionsUIDs:t,enteredOptions:i})=>({sku:e,parent_sku:r,quantity:c,selected_options:t,entered_options:i}))}}).then(({errors:e,data:r})=>{var i;const c=[...((i=r==null?void 0:r.addProductsToCart)==null?void 0:i.user_errors)??[],...e??[]];if(c.length>0)return T(c);const t=f(r.addProductsToCart.cart);if(p.emit("cart/updated",t),p.emit("cart/data",t),t){const m=t.items.filter(C=>a.some(({sku:u})=>u===C.sku));o?_(t,m,s.locale??"en-US"):E(t,m,s.locale??"en-US")}return t})},y=` - mutation CREATE_EMPTY_CART_MUTATION { - createEmptyCart + ${h} +`,M=async a=>{let r=!1;const n=o.cartId||await R().then(s=>(r=!0,s));return d(G,{variables:{cartId:n,cartItems:a.map(({sku:s,parentSku:e,quantity:i,optionsUIDs:t,enteredOptions:c})=>({sku:s,parent_sku:e,quantity:i,selected_options:t,entered_options:c}))}}).then(({errors:s,data:e})=>{var c;const i=[...((c=e==null?void 0:e.addProductsToCart)==null?void 0:c.user_errors)??[],...s??[]];if(i.length>0)return T(i);const t=g(e.addProductsToCart.cart);if(C.emit("cart/updated",t),C.emit("cart/data",t),t){const p=t.items.filter(m=>a.some(({sku:u})=>u===m.sku));r?A(t,p,o.locale??"en-US"):I(t,p,o.locale??"en-US")}return t})},S=` + mutation CREATE_GUEST_CART_MUTATION { + createGuestCart { + cart { + id + } + } } -`,P=async()=>{const{disableGuestCart:a}=g.getConfig();if(a)throw new Error("Guest cart is disabled");return await d(y).then(({data:o})=>{const n=o.createEmptyCart;return s.cartId=n,n})},x=async()=>{const a=s.authenticated?await h():await A();return p.emit("cart/updated",a),p.emit("cart/data",a),a};export{ot as ApplyCouponsStrategy,b as addProductsToCart,nt as applyCouponsToCart,g as config,P as createEmptyCart,d as fetchGraphQl,j as getCartData,et as getCartDataFromCache,$ as getConfig,W as getCountries,h as getCustomerCartPayload,X as getEstimateShipping,at as getEstimatedTotals,A as getGuestCartPayload,Z as getRegions,q as getStoreConfig,B as initialize,J as initializeCart,x as refreshCart,v as removeFetchGraphQlHeader,Q as resetCart,H as setEndpoint,k as setFetchGraphQlHeader,z as setFetchGraphQlHeaders,L as updateProductsFromCart}; +`,R=async()=>{const{disableGuestCart:a}=f.getConfig();if(a)throw new Error("Guest cart is disabled");return await d(S).then(({data:r})=>{const n=r.createGuestCart.cart.id;return o.cartId=n,n})},v=()=>{const a=o.locale??"en-US",r=E();r&&_(r,a)};export{it as ApplyCouponsStrategy,M as addProductsToCart,ct as applyCouponsToCart,f as config,R as createGuestCart,d as fetchGraphQl,q as getCartData,E as getCartDataFromCache,$ as getConfig,rt as getCountries,B as getCustomerCartPayload,at as getEstimateShipping,ot as getEstimatedTotals,J as getGuestCartPayload,et as getRegions,K as getStoreConfig,L as initialize,W as initializeCart,v as publishShoppingCartViewEvent,X as refreshCart,Q as removeFetchGraphQlHeader,H as resetCart,k as setEndpoint,z as setFetchGraphQlHeader,V as setFetchGraphQlHeaders,Z as updateProductsFromCart}; diff --git a/scripts/__dropins__/storefront-cart/api/createEmptyCart/createEmptyCart.d.ts b/scripts/__dropins__/storefront-cart/api/createGuestCart/createGuestCart.d.ts similarity index 87% rename from scripts/__dropins__/storefront-cart/api/createEmptyCart/createEmptyCart.d.ts rename to scripts/__dropins__/storefront-cart/api/createGuestCart/createGuestCart.d.ts index 26fbc90f2a..509191b10c 100644 --- a/scripts/__dropins__/storefront-cart/api/createEmptyCart/createEmptyCart.d.ts +++ b/scripts/__dropins__/storefront-cart/api/createGuestCart/createGuestCart.d.ts @@ -14,5 +14,5 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ -export declare const createEmptyCart: () => Promise; -//# sourceMappingURL=createEmptyCart.d.ts.map \ No newline at end of file +export declare const createGuestCart: () => Promise; +//# sourceMappingURL=createGuestCart.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/api/createEmptyCart/graphql/CreateCartMutation.d.ts b/scripts/__dropins__/storefront-cart/api/createGuestCart/graphql/CreateCartMutation.d.ts similarity index 80% rename from scripts/__dropins__/storefront-cart/api/createEmptyCart/graphql/CreateCartMutation.d.ts rename to scripts/__dropins__/storefront-cart/api/createGuestCart/graphql/CreateCartMutation.d.ts index e326a9c9d7..6704527a56 100644 --- a/scripts/__dropins__/storefront-cart/api/createEmptyCart/graphql/CreateCartMutation.d.ts +++ b/scripts/__dropins__/storefront-cart/api/createGuestCart/graphql/CreateCartMutation.d.ts @@ -14,5 +14,5 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ -export declare const CREATE_EMPTY_CART_MUTATION = "\n mutation CREATE_EMPTY_CART_MUTATION {\n createEmptyCart\n }\n"; +export declare const CREATE_GUEST_CART_MUTATION = "\n mutation CREATE_GUEST_CART_MUTATION {\n createGuestCart {\n cart {\n id\n }\n }\n }\n"; //# sourceMappingURL=CreateCartMutation.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/api/createEmptyCart/index.d.ts b/scripts/__dropins__/storefront-cart/api/createGuestCart/index.d.ts similarity index 95% rename from scripts/__dropins__/storefront-cart/api/createEmptyCart/index.d.ts rename to scripts/__dropins__/storefront-cart/api/createGuestCart/index.d.ts index c7439331d7..1d28227266 100644 --- a/scripts/__dropins__/storefront-cart/api/createEmptyCart/index.d.ts +++ b/scripts/__dropins__/storefront-cart/api/createGuestCart/index.d.ts @@ -14,5 +14,5 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ -export * from './createEmptyCart'; +export * from './createGuestCart'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/api/graphql/CustomerAccountFragment.d.ts b/scripts/__dropins__/storefront-cart/api/graphql/CustomerAccountFragment.d.ts index ae2b616e23..389c56b261 100644 --- a/scripts/__dropins__/storefront-cart/api/graphql/CustomerAccountFragment.d.ts +++ b/scripts/__dropins__/storefront-cart/api/graphql/CustomerAccountFragment.d.ts @@ -1,2 +1,2 @@ -export declare const CUSTOMER_ACCOUNT_FRAGMENT = "\nfragment CUSTOMER_FRAGMENT on Customer {\n addresses {\n default_shipping\n country_id\n postcode\n region {\n region\n region_code\n region_id\n }\n }\n}"; +export declare const CUSTOMER_ACCOUNT_FRAGMENT = "\nfragment CUSTOMER_FRAGMENT on Customer {\n addresses {\n default_shipping\n country_code\n postcode\n region {\n region\n region_code\n region_id\n }\n }\n}"; //# sourceMappingURL=CustomerAccountFragment.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/api/index.d.ts b/scripts/__dropins__/storefront-cart/api/index.d.ts index 410d06d380..e325a87351 100644 --- a/scripts/__dropins__/storefront-cart/api/index.d.ts +++ b/scripts/__dropins__/storefront-cart/api/index.d.ts @@ -21,11 +21,12 @@ export * from './getCartData'; export * from './initializeCart'; export * from './updateProductsFromCart'; export * from './resetCart'; -export * from './createEmptyCart'; +export * from './createGuestCart'; export * from './getStoreConfig'; export * from './getEstimateShipping'; export * from './getEstimatedTotals'; export * from './refreshCart'; export { getPersistedCartData as getCartDataFromCache } from '../lib/persisted-data'; export * from './applyCouponsToCart'; +export * from './publishShoppingCartViewEvent'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/api/publishShoppingCartViewEvent/index.d.ts b/scripts/__dropins__/storefront-cart/api/publishShoppingCartViewEvent/index.d.ts new file mode 100644 index 0000000000..94787d0a08 --- /dev/null +++ b/scripts/__dropins__/storefront-cart/api/publishShoppingCartViewEvent/index.d.ts @@ -0,0 +1,2 @@ +export * from './publishShoppingCartViewEvent'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/api/publishShoppingCartViewEvent/publishShoppingCartViewEvent.d.ts b/scripts/__dropins__/storefront-cart/api/publishShoppingCartViewEvent/publishShoppingCartViewEvent.d.ts new file mode 100644 index 0000000000..18f00b0dc7 --- /dev/null +++ b/scripts/__dropins__/storefront-cart/api/publishShoppingCartViewEvent/publishShoppingCartViewEvent.d.ts @@ -0,0 +1,2 @@ +export declare const publishShoppingCartViewEvent: () => void; +//# sourceMappingURL=publishShoppingCartViewEvent.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js b/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js index 730a50ad81..d9ee755c3e 100644 --- a/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js +++ b/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as a,Fragment as l}from"@dropins/tools/preact-jsx-runtime.js";import{useState as y,useEffect as h}from"@dropins/tools/preact-compat.js";import{classes as d,VComponent as _}from"@dropins/tools/lib.js";/* empty css */import{E as C}from"./EmptyCart.js";import{Image as v}from"@dropins/tools/components.js";import{events as N}from"@dropins/tools/event-bus.js";import{g as b}from"./persisted-data.js";const j=({className:m,children:i,emptyCart:n,products:e,...c})=>a("div",{...c,className:d(["cart-cart-summary-grid",m]),children:a(l,{children:a("div",{className:d(["cart-cart-summary-grid__content",["cart-cart-summary-grid__content--empty",!e]]),children:e||a(_,{node:n,className:"cart-cart-summary-grid__empty-cart"})})})}),D=({children:m,initialData:i=null,routeProduct:n,routeEmptyCartCTA:e,...c})=>{const[s,g]=y(i);h(()=>{const r=N.on("cart/data",t=>{g(t)},{eager:!0});return()=>{r==null||r.off()}},[]);const p=(r,t)=>{const f=r.selectedOptions?`${r.name}: ${Object.entries(r.selectedOptions).join("; ")}`:r.name,o=a(v,{"data-testid":"cart-grid-item-image",loading:t<4?"eager":"lazy",src:r.image.src,alt:r.image.alt,"aria-label":f,width:"100%"});return n?a("div",{className:"cart-cart-summary-grid__item-container",children:a("a",{href:n(r),children:o})},t):o},u=s&&a(l,{children:s.items.map((r,t)=>p(r,t))});return a(j,{...c,emptyCart:a(C,{ctaLinkURL:e?e():void 0}),products:u})};D.getInitialData=async function(){return b()};export{D as C}; +import{jsx as a,Fragment as l}from"@dropins/tools/preact-jsx-runtime.js";import{useState as y,useEffect as h}from"@dropins/tools/preact-compat.js";import{E as _}from"./EmptyCart.js";import{classes as d,VComponent as C}from"@dropins/tools/lib.js";/* empty css */import{Image as v}from"@dropins/tools/components.js";import{events as N}from"@dropins/tools/event-bus.js";import{g as b}from"./persisted-data.js";const j=({className:m,children:i,emptyCart:n,products:e,...c})=>a("div",{...c,className:d(["cart-cart-summary-grid",m]),children:a(l,{children:a("div",{className:d(["cart-cart-summary-grid__content",["cart-cart-summary-grid__content--empty",!e]]),children:e||a(C,{node:n,className:"cart-cart-summary-grid__empty-cart"})})})}),D=({children:m,initialData:i=null,routeProduct:n,routeEmptyCartCTA:e,...c})=>{const[s,g]=y(i);h(()=>{const r=N.on("cart/data",t=>{g(t)},{eager:!0});return()=>{r==null||r.off()}},[]);const p=(r,t)=>{const f=r.selectedOptions?`${r.name}: ${Object.entries(r.selectedOptions).join("; ")}`:r.name,o=a(v,{"data-testid":"cart-grid-item-image",loading:t<4?"eager":"lazy",src:r.image.src,alt:r.image.alt,"aria-label":f,width:"100%"});return n?a("div",{className:"cart-cart-summary-grid__item-container",children:a("a",{href:n(r),children:o})},t):o},u=s&&a(l,{children:s.items.map((r,t)=>p(r,t))});return a(j,{...c,emptyCart:a(_,{ctaLinkURL:e?e():void 0}),products:u})};D.getInitialData=async function(){return b()};export{D as C}; diff --git a/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js b/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js index f75487b6fb..b0b7e88cf7 100644 --- a/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js +++ b/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as n,jsxs as h,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import*as o from"@dropins/tools/preact-compat.js";import{useState as N,useCallback as Ft,useEffect as ot}from"@dropins/tools/preact-compat.js";import{classes as L,VComponent as b,Slot as w}from"@dropins/tools/lib.js";/* empty css */import{E as Mt}from"./EmptyCart.js";import{Divider as st,Skeleton as zt,SkeletonRow as Ut,InLineAlert as qt,Icon as z,CartList as lt,Button as U,Accordion as Tt,AccordionSection as Wt,CartItem as Jt,Price as O,Image as Kt}from"@dropins/tools/components.js";import{g as Rt}from"./persisted-data.js";import{events as Yt}from"@dropins/tools/event-bus.js";import{s as Ht}from"./resetCart.js";import{u as ut}from"./updateProductsFromCart.js";import{S as Dt}from"./ChevronDown.js";import{useText as te}from"@dropins/tools/i18n.js";const ee=d=>o.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...d},o.createElement("g",{id:"Large"},o.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),o.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},o.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),dt=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("g",{clipPath:"url(#clip0_4797_15331)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19 13.31L15.5 19.37H22.5L19 13.31Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15331"},o.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),ne=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),gt=({className:d,children:q,heading:k,footer:y,emptyCart:_,products:u,outOfStockMessage:v,variant:S="primary",loading:m=!0,...c})=>n("div",{...c,className:L(["cart-cart-summary-list",d,`cart-cart-summary-list__background--${S}`]),children:m?n(re,{}):h(X,{children:[(k||v)&&h("div",{"data-testid":"cart-summary-list-heading-wrapper",className:L(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!u]]),children:[k&&h(X,{children:[n(b,{node:k,className:"cart-cart-summary-list__heading-text"}),n(st,{variant:"primary",className:L(["cart-cart-summary-list__heading-divider"])})]}),v&&n(b,{node:v,className:"cart-cart-summary-list__out-of-stock-message"})]}),n("div",{className:L(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!u]]),children:u||n(b,{node:_,className:"cart-cart-summary-list__empty-cart"})}),y&&h(X,{children:[n(st,{variant:"primary",className:L(["cart-cart-summary-list__footer-divider"])}),n(b,{node:y,className:"cart-cart-summary-list__footer-text"})]})]})}),re=()=>n(zt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:n(Ut,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),ae=({initialData:d=null,hideHeading:q,hideFooter:k,routeProduct:y,routeEmptyCartCTA:_,routeCart:u,onItemUpdate:v,onItemRemove:S,maxItems:m,slots:c,attributesToHide:l=[],enableRemoveItem:j,enableUpdateItemQuantity:T,onItemsErrorsChange:$,accordion:ft=!1,variant:Z="primary",isLoading:mt,showMaxItems:W,showDiscount:ht,showSavings:yt,quantityType:vt,dropdownOptions:pt,...J})=>{var rt;const[B,kt]=N(!d),[a,Ct]=N(d),[E,wt]=N(new Set),[A,Lt]=N(new Map),s=(rt=Ht.config)==null?void 0:rt.shoppingCartDisplaySetting,[Q,_t]=N(W?!0:!m&&!W),i=te({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage",viewMore:"Cart.Cart.viewMore",viewAll:"Cart.Cart.viewAll",discountPercent:"Cart.CartItem.discountPercentage",savingsAmount:"Cart.CartItem.savingsAmount"}),F=(t,e)=>{wt(r=>(e?r.add(t):r.delete(t),new Set(r)))},K=(t,e)=>{Lt(r=>(e?r.set(t,e):r.delete(t),new Map(r)))},M=(t,e)=>{F(t.uid,!0),K(t.uid),j&&e===0?ut([{uid:t.uid,quantity:e}]).then(()=>{S==null||S({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r)}):T&&ut([{uid:t.uid,quantity:e}]).then(()=>{v==null||v({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r),K(t.uid,r.message)})},St=Ft(()=>{_t(t=>!t)},[]);ot(()=>{const t=Yt.on("cart/data",e=>{Ct(e),kt(!!mt)},{eager:!0});return()=>{t==null||t.off()}},[]),ot(()=>{$&&$(A)},[A,$]);const Et=(t,e)=>{if(l.includes("image"))return;const r=n(Kt,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return n(w,{name:"Thumbnail",slot:c==null?void 0:c.Thumbnail,context:{item:t},children:y?n("a",{href:y(t),children:r}):r})},It=t=>{if(!l.includes("name"))return n("span",{"data-testid":"cart-list-item-title",children:y?n("a",{href:y(t),children:t.name}):t.name})},xt=t=>{if(l.includes("configurations"))return;const e={...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null};if(Object.keys(e).length!==0)return e},Pt=t=>{var e,r,f,g;return(s==null?void 0:s.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(r=t.taxedPrice)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(f=t.regularPrice)==null?void 0:f.value,currency:(g=t.regularPrice)==null?void 0:g.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},Nt=t=>{var e,r;return{amount:(e=t.savingsAmount)==null?void 0:e.value,currency:(r=t.savingsAmount)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"item-savings-amount"}},Ot=t=>(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX"?n(O,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,At=t=>{var f,g,p,C,I,x,P,at,it,ct;const e={"aria-label":i.regularPrice},r=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(s==null?void 0:s.price)?(e.amount=(f=t.rowTotalIncludingTax)==null?void 0:f.value,e.currency=(g=t.rowTotalIncludingTax)==null?void 0:g.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",r&&(e.amount=(p=t.total)==null?void 0:p.value,e.currency=(C=t.total)==null?void 0:C.currency,r.amount=(I=t.rowTotalIncludingTax)==null?void 0:I.value,r.currency=(x=t.rowTotalIncludingTax)==null?void 0:x.currency,r.sale=!0,r["aria-label"]=i.discountedPrice,r["data-testid"]="discount-total")):(e.amount=(P=t.total)==null?void 0:P.value,e.currency=(at=t.total)==null?void 0:at.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",r&&(r.amount=(it=t.discountedTotal)==null?void 0:it.value,r.currency=(ct=t.discountedTotal)==null?void 0:ct.currency,r.sale=!0,r["aria-label"]=i.regularPrice,r["data-testid"]="discount-total")),{totalProps:e,discountProps:r}},Qt=t=>{var I,x,P;if(l.includes("warning"))return;const e=A.get(t.uid),r=(I=A.get(t.uid))==null?void 0:I.includes("The requested qty is not available"),f=E.has(t.uid),g=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(x=t.stockLevel)==null?void 0:x.toString()).replace("{count}",t.quantity.toString()):"",p=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(P=t.onlyXLeftInStock)==null?void 0:P.toString()),C=!t.outOfStock&&e&&r?i.notAvailableMessage:e;return!f&&(e||t.insufficientQuantity||t.lowInventory)?h("span",{"data-testid":"item-warning",children:[n(z,{source:ne,size:"16"}),C||g||p]}):void 0},Gt=t=>l!=null&&l.includes("alert")?void 0:!E.has(t.uid)&&t.outOfStock?h("span",{"data-testid":"item-alert",children:[n(z,{source:dt,size:"16"}),i.outOfStockAlert]}):void 0,Vt=t=>n(w,{name:"ProductAttributes",slot:c==null?void 0:c.ProductAttributes,context:{item:t}}),bt=t=>{if(!l.includes("sku"))return n("span",{"data-testid":"cart-list-item-sku",children:t.sku})},Xt=t=>n(w,{name:"Footer",slot:c==null?void 0:c.Footer,context:{item:t}}),R=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,r)=>{var p;const{totalProps:f,discountProps:g}=At(e);return n(Jt,{updating:E==null?void 0:E.has(e.uid),loading:B,"data-testid":`cart-list-item-entry-${e.uid}`,image:Et(e,r),title:It(e),sku:bt(e),price:l.includes("price")?void 0:n(O,{...Pt(e)}),quantity:l.includes("quantity")?void 0:e.quantity,total:h(X,{children:[l.includes("total")?void 0:n(O,{...f}),l.includes("totalDiscount")?void 0:g&&n(O,{...g})]}),attributes:Vt(e),configurations:xt(e),totalExcludingTax:l.includes("totalExcludingTax")?void 0:Ot(e),taxIncluded:(s==null?void 0:s.price)==="INCLUDING_TAX",taxExcluded:!l.includes("totalExcludingTax")&&(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX",warning:Qt(e),alert:Gt(e),quantityType:vt,dropdownOptions:pt,onQuantity:T?C=>{M(e,C)}:void 0,onRemove:j?()=>M(e,0):void 0,discount:ht&&e.discounted&&e.discountPercentage?n("div",{"data-testid":"item-discount-percent",children:i.discountPercent.replace("{discount}",((p=e.discountPercentage)==null?void 0:p.toString())??"")}):void 0,savings:yt&&e.discounted&&e.savingsAmount?h("div",{children:[n("span",{children:n(O,{...Nt(e)})})," ",i.savingsAmount]}):void 0,footer:Xt(e)},e.uid)}):null,Y=n(w,{name:"EmptyCart",slot:c==null?void 0:c.EmptyCart,context:{},children:n(Mt,{"data-testid":"empty-cart",ctaLinkURL:_==null?void 0:_()})}),H=n(w,{name:"Heading",slot:c==null?void 0:c.Heading,context:{count:a==null?void 0:a.totalQuantity},children:n("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),jt=H.props.children.props.children,$t=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{M(e,0)})},Zt=R(t=>t.outOfStock||t.insufficientQuantity||!1),D=a!=null&&a.hasOutOfStockItems?n(qt,{"data-testid":"cart-out-of-stock-message",icon:n(z,{source:dt,size:"16"}),itemList:n(lt,{"data-testid":"out-of-stock-cart-items",children:Zt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&j?[{label:i.removeAction,onClick:$t}]:void 0}):void 0,G=R(t=>!t.outOfStock&&!t.insufficientQuantity),tt=Q?Math.max(m||5,5):Math.min((a==null?void 0:a.totalQuantity)||5,5),et=(a==null?void 0:a.totalQuantity)>tt,Bt=et&&!Q&&tt!=m,V=a!=null&&a.totalQuantity&&G?n(w,{name:"Footer",slot:c==null?void 0:c.CartSummaryFooter,context:{displayMaxItems:Q,routeCart:u},"data-testid":"cart-cart-summary-footer-slot",children:n("div",{"data-testid":"cart-cart-summary-footer",children:et?Bt?n(U,{className:"cart-cart-summary-list-footer__action",onClick:St,"data-testid":"view-more-items-button",variant:"tertiary",children:i.viewMore}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-or-less-items-button",children:i.viewAll}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-button",children:i.viewAll})})}):null,nt=a!=null&&a.totalQuantity?n(lt,{"data-testid":"cart-list",children:G==null?void 0:G.slice(0,Q?Math.max(m||(a==null?void 0:a.totalQuantity),5):Math.min(m??5,5))}):null;return ft?n(Tt,{"data-testid":"cart-summary-list-accordion",className:L(["cart-cart-summary-list-accordion",`cart-cart-summary-list__background--${Z}`]),iconOpen:ee,iconClose:Dt,children:n(Wt,{title:jt,"data-testid":"cart-summary-list-accordion__section",open:!0,renderContentWhenClosed:!0,children:n(gt,{...J,"aria-expanded":!0,"aria-label":"TEST",className:"cart-cart-summary-list-accordion__list",loading:B,footer:k?void 0:V||(u?V:void 0),emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})})}):n(gt,{...J,heading:q?void 0:H,footer:k?void 0:V||(u?V:void 0),loading:B,emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})};ae.getInitialData=async function(){return Rt()};export{ae as C}; +import{jsx as n,jsxs as h,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import*as o from"@dropins/tools/preact-compat.js";import{useState as N,useCallback as Ft,useEffect as ot}from"@dropins/tools/preact-compat.js";import{classes as L,VComponent as b,Slot as w}from"@dropins/tools/lib.js";import{E as Mt}from"./EmptyCart.js";/* empty css */import{Divider as st,Skeleton as zt,SkeletonRow as Ut,InLineAlert as qt,Icon as z,CartList as lt,Button as U,Accordion as Tt,AccordionSection as Wt,CartItem as Jt,Price as O,Image as Kt}from"@dropins/tools/components.js";import{g as Rt}from"./persisted-data.js";import{events as Yt}from"@dropins/tools/event-bus.js";import{s as Ht}from"./resetCart.js";import{u as ut}from"./updateProductsFromCart.js";import{S as Dt}from"./ChevronDown.js";import{useText as te}from"@dropins/tools/i18n.js";const ee=d=>o.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...d},o.createElement("g",{id:"Large"},o.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),o.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},o.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),dt=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("g",{clipPath:"url(#clip0_4797_15331)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19 13.31L15.5 19.37H22.5L19 13.31Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15331"},o.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),ne=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),gt=({className:d,children:q,heading:k,footer:y,emptyCart:_,products:u,outOfStockMessage:v,variant:S="primary",loading:m=!0,...c})=>n("div",{...c,className:L(["cart-cart-summary-list",d,`cart-cart-summary-list__background--${S}`]),children:m?n(re,{}):h(X,{children:[(k||v)&&h("div",{"data-testid":"cart-summary-list-heading-wrapper",className:L(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!u]]),children:[k&&h(X,{children:[n(b,{node:k,className:"cart-cart-summary-list__heading-text"}),n(st,{variant:"primary",className:L(["cart-cart-summary-list__heading-divider"])})]}),v&&n(b,{node:v,className:"cart-cart-summary-list__out-of-stock-message"})]}),n("div",{className:L(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!u]]),children:u||n(b,{node:_,className:"cart-cart-summary-list__empty-cart"})}),y&&h(X,{children:[n(st,{variant:"primary",className:L(["cart-cart-summary-list__footer-divider"])}),n(b,{node:y,className:"cart-cart-summary-list__footer-text"})]})]})}),re=()=>n(zt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:n(Ut,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),ae=({initialData:d=null,hideHeading:q,hideFooter:k,routeProduct:y,routeEmptyCartCTA:_,routeCart:u,onItemUpdate:v,onItemRemove:S,maxItems:m,slots:c,attributesToHide:l=[],enableRemoveItem:j,enableUpdateItemQuantity:T,onItemsErrorsChange:$,accordion:ft=!1,variant:Z="primary",isLoading:mt,showMaxItems:W,showDiscount:ht,showSavings:yt,quantityType:vt,dropdownOptions:pt,...J})=>{var rt;const[B,kt]=N(!d),[a,Ct]=N(d),[E,wt]=N(new Set),[A,Lt]=N(new Map),s=(rt=Ht.config)==null?void 0:rt.shoppingCartDisplaySetting,[Q,_t]=N(W?!0:!m&&!W),i=te({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage",viewMore:"Cart.Cart.viewMore",viewAll:"Cart.Cart.viewAll",discountPercent:"Cart.CartItem.discountPercentage",savingsAmount:"Cart.CartItem.savingsAmount"}),F=(t,e)=>{wt(r=>(e?r.add(t):r.delete(t),new Set(r)))},K=(t,e)=>{Lt(r=>(e?r.set(t,e):r.delete(t),new Map(r)))},M=(t,e)=>{F(t.uid,!0),K(t.uid),j&&e===0?ut([{uid:t.uid,quantity:e}]).then(()=>{S==null||S({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r)}):T&&ut([{uid:t.uid,quantity:e}]).then(()=>{v==null||v({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r),K(t.uid,r.message)})},St=Ft(()=>{_t(t=>!t)},[]);ot(()=>{const t=Yt.on("cart/data",e=>{Ct(e),kt(!!mt)},{eager:!0});return()=>{t==null||t.off()}},[]),ot(()=>{$&&$(A)},[A,$]);const Et=(t,e)=>{if(l.includes("image"))return;const r=n(Kt,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return n(w,{name:"Thumbnail",slot:c==null?void 0:c.Thumbnail,context:{item:t},children:y?n("a",{href:y(t),children:r}):r})},It=t=>{if(!l.includes("name"))return n("span",{"data-testid":"cart-list-item-title",children:y?n("a",{href:y(t),children:t.name}):t.name})},xt=t=>{if(l.includes("configurations"))return;const e={...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null};if(Object.keys(e).length!==0)return e},Pt=t=>{var e,r,f,g;return(s==null?void 0:s.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(r=t.taxedPrice)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(f=t.regularPrice)==null?void 0:f.value,currency:(g=t.regularPrice)==null?void 0:g.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},Nt=t=>{var e,r;return{amount:(e=t.savingsAmount)==null?void 0:e.value,currency:(r=t.savingsAmount)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"item-savings-amount"}},Ot=t=>(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX"?n(O,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,At=t=>{var f,g,p,C,I,x,P,at,it,ct;const e={"aria-label":i.regularPrice},r=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(s==null?void 0:s.price)?(e.amount=(f=t.rowTotalIncludingTax)==null?void 0:f.value,e.currency=(g=t.rowTotalIncludingTax)==null?void 0:g.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",r&&(e.amount=(p=t.total)==null?void 0:p.value,e.currency=(C=t.total)==null?void 0:C.currency,r.amount=(I=t.rowTotalIncludingTax)==null?void 0:I.value,r.currency=(x=t.rowTotalIncludingTax)==null?void 0:x.currency,r.sale=!0,r["aria-label"]=i.discountedPrice,r["data-testid"]="discount-total")):(e.amount=(P=t.total)==null?void 0:P.value,e.currency=(at=t.total)==null?void 0:at.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",r&&(r.amount=(it=t.discountedTotal)==null?void 0:it.value,r.currency=(ct=t.discountedTotal)==null?void 0:ct.currency,r.sale=!0,r["aria-label"]=i.regularPrice,r["data-testid"]="discount-total")),{totalProps:e,discountProps:r}},Qt=t=>{var I,x,P;if(l.includes("warning"))return;const e=A.get(t.uid),r=(I=A.get(t.uid))==null?void 0:I.includes("The requested qty is not available"),f=E.has(t.uid),g=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(x=t.stockLevel)==null?void 0:x.toString()).replace("{count}",t.quantity.toString()):"",p=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(P=t.onlyXLeftInStock)==null?void 0:P.toString()),C=!t.outOfStock&&e&&r?i.notAvailableMessage:e;return!f&&(e||t.insufficientQuantity||t.lowInventory)?h("span",{"data-testid":"item-warning",children:[n(z,{source:ne,size:"16"}),C||g||p]}):void 0},Gt=t=>l!=null&&l.includes("alert")?void 0:!E.has(t.uid)&&t.outOfStock?h("span",{"data-testid":"item-alert",children:[n(z,{source:dt,size:"16"}),i.outOfStockAlert]}):void 0,Vt=t=>n(w,{name:"ProductAttributes",slot:c==null?void 0:c.ProductAttributes,context:{item:t}}),bt=t=>{if(!l.includes("sku"))return n("span",{"data-testid":"cart-list-item-sku",children:t.sku})},Xt=t=>n(w,{name:"Footer",slot:c==null?void 0:c.Footer,context:{item:t}}),R=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,r)=>{var p;const{totalProps:f,discountProps:g}=At(e);return n(Jt,{updating:E==null?void 0:E.has(e.uid),loading:B,"data-testid":`cart-list-item-entry-${e.uid}`,image:Et(e,r),title:It(e),sku:bt(e),price:l.includes("price")?void 0:n(O,{...Pt(e)}),quantity:l.includes("quantity")?void 0:e.quantity,total:h(X,{children:[l.includes("total")?void 0:n(O,{...f}),l.includes("totalDiscount")?void 0:g&&n(O,{...g})]}),attributes:Vt(e),configurations:xt(e),totalExcludingTax:l.includes("totalExcludingTax")?void 0:Ot(e),taxIncluded:(s==null?void 0:s.price)==="INCLUDING_TAX",taxExcluded:!l.includes("totalExcludingTax")&&(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX",warning:Qt(e),alert:Gt(e),quantityType:vt,dropdownOptions:pt,onQuantity:T?C=>{M(e,C)}:void 0,onRemove:j?()=>M(e,0):void 0,discount:ht&&e.discounted&&e.discountPercentage?n("div",{"data-testid":"item-discount-percent",children:i.discountPercent.replace("{discount}",((p=e.discountPercentage)==null?void 0:p.toString())??"")}):void 0,savings:yt&&e.discounted&&e.savingsAmount?h("div",{children:[n("span",{children:n(O,{...Nt(e)})})," ",i.savingsAmount]}):void 0,footer:Xt(e)},e.uid)}):null,Y=n(w,{name:"EmptyCart",slot:c==null?void 0:c.EmptyCart,context:{},children:n(Mt,{"data-testid":"empty-cart",ctaLinkURL:_==null?void 0:_()})}),H=n(w,{name:"Heading",slot:c==null?void 0:c.Heading,context:{count:a==null?void 0:a.totalQuantity},children:n("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),jt=H.props.children.props.children,$t=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{M(e,0)})},Zt=R(t=>t.outOfStock||t.insufficientQuantity||!1),D=a!=null&&a.hasOutOfStockItems?n(qt,{"data-testid":"cart-out-of-stock-message",icon:n(z,{source:dt,size:"16"}),itemList:n(lt,{"data-testid":"out-of-stock-cart-items",children:Zt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&j?[{label:i.removeAction,onClick:$t}]:void 0}):void 0,G=R(t=>!t.outOfStock&&!t.insufficientQuantity),tt=Q?Math.max(m||5,5):Math.min((a==null?void 0:a.totalQuantity)||5,5),et=(a==null?void 0:a.totalQuantity)>tt,Bt=et&&!Q&&tt!=m,V=a!=null&&a.totalQuantity&&G?n(w,{name:"Footer",slot:c==null?void 0:c.CartSummaryFooter,context:{displayMaxItems:Q,routeCart:u},"data-testid":"cart-cart-summary-footer-slot",children:n("div",{"data-testid":"cart-cart-summary-footer",children:et?Bt?n(U,{className:"cart-cart-summary-list-footer__action",onClick:St,"data-testid":"view-more-items-button",variant:"tertiary",children:i.viewMore}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-or-less-items-button",children:i.viewAll}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-button",children:i.viewAll})})}):null,nt=a!=null&&a.totalQuantity?n(lt,{"data-testid":"cart-list",children:G==null?void 0:G.slice(0,Q?Math.max(m||(a==null?void 0:a.totalQuantity),5):Math.min(m??5,5))}):null;return ft?n(Tt,{"data-testid":"cart-summary-list-accordion",className:L(["cart-cart-summary-list-accordion",`cart-cart-summary-list__background--${Z}`]),iconOpen:ee,iconClose:Dt,children:n(Wt,{title:jt,"data-testid":"cart-summary-list-accordion__section",open:!0,renderContentWhenClosed:!0,children:n(gt,{...J,"aria-expanded":!0,"aria-label":"TEST",className:"cart-cart-summary-list-accordion__list",loading:B,footer:k?void 0:V||(u?V:void 0),emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})})}):n(gt,{...J,heading:q?void 0:H,footer:k?void 0:V||(u?V:void 0),loading:B,emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})};ae.getInitialData=async function(){return Rt()};export{ae as C}; diff --git a/scripts/__dropins__/storefront-cart/chunks/MiniCart.js b/scripts/__dropins__/storefront-cart/chunks/MiniCart.js deleted file mode 100644 index a9bd7acde4..0000000000 --- a/scripts/__dropins__/storefront-cart/chunks/MiniCart.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{jsx as e,jsxs as y,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import{useState as E,useEffect as I,useCallback as F}from"@dropins/tools/preact-compat.js";import{classes as b,VComponent as g,Slot as Q}from"@dropins/tools/lib.js";import{g as O}from"./persisted-data.js";import{events as R}from"@dropins/tools/event-bus.js";/* empty css */import{Price as T,Button as w}from"@dropins/tools/components.js";import{useText as G}from"@dropins/tools/i18n.js";import{s as h}from"./resetCart.js";import{a as H,b as V}from"./acdl.js";import{u as X}from"./updateProductsFromCart.js";import"./CartSummaryGrid.js";import{C as j}from"./CartSummaryList.js";import"./OrderSummary.js";const $=({className:_,products:n,orderSummary:i,empty:r,...o})=>e("div",{...o,className:b(["cart-cart",_]),children:y("div",{className:b(["cart-cart__wrapper"]),children:[e("div",{"data-testid":"cart-content",className:b(["cart-cart__content",["cart-cart__content--empty",r||i==null],["cart-cart__content--full-width",r||i==null]]),children:n&&e(g,{node:n})}),n&&i&&e(g,{node:i,className:b(["cart-cart__order-summary"])})]})}),z=({className:_,products:n,subtotal:i,subtotalExcludingTaxes:r,ctas:o,...p})=>{const u=G({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return e("div",{...p,className:b(["cart-mini-cart",_]),children:n&&y(A,{children:[e("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:n}),y("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[i&&y("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[u.subtotal,e(g,{node:i})]}),r&&y("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[u.subtotalExcludingTaxes,e(g,{node:r,className:b(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),o&&e(g,{node:o,className:"cart-mini-cart__footer__ctas"})]})]})})},B=({children:_,routeProduct:n,routeEmptyCartCTA:i,slots:r,showDiscount:o,showSavings:p,quantityType:u,dropdownOptions:C,initialData:l=null,...L})=>{const[s,t]=E(l),[N,a]=E(new Map),v={hasErrors:N.size>0,data:s},f=(c,x)=>X([{uid:c,quantity:x}]);I(()=>{const c=R.on("cart/data",x=>{t(x)},{eager:!0});return()=>{c==null||c.off()}},[]),I(()=>{l&&Object.keys(l).length>0&&H(l,h.locale??"en-US")},[l]);const k=r!=null&&r.OrderSummary?e(Q,{name:"OrderSummary",slot:r.OrderSummary,context:{...v}}):void 0,m=c=>f(c,0),M=e(Q,{name:"ProductList",slot:r==null?void 0:r.ProductList,context:{itemQuantityUpdateHandler:f,itemRemoveHandler:m},children:e(j,{"data-testid":"default-cart-summary-list",routeProduct:n,routeEmptyCartCTA:i,initialData:s,enableRemoveItem:!0,enableUpdateItemQuantity:!0,onItemsErrorsChange:a,showMaxItems:!0,showDiscount:o,showSavings:p,quantityType:u,dropdownOptions:C})});return e($,{...L,empty:((s==null?void 0:s.items)&&s.items.length===0)??!0,orderSummary:k,products:M})};B.getInitialData=async function(){return O()};const q=({children:_,initialData:n=null,hideFooter:i=!0,slots:r,routeProduct:o,routeCart:p,routeCheckout:u,routeEmptyCartCTA:C,showDiscount:l,showSavings:L,...s})=>{var S,P,D;const[t,N]=E(n),a=(S=h.config)==null?void 0:S.shoppingCartDisplaySetting;I(()=>{const d=R.on("cart/data",U=>{N(U)},{eager:!0});return()=>{d==null||d.off()}},[]);const v=G({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),f=(d,U)=>X([{uid:d,quantity:U}]),k=d=>f(d,0),m=t==null?void 0:t.hasOutOfStockItems,M=F(()=>{t&&!m&&V(t,h.locale)},[t,m]);I(()=>{n&&Object.keys(n).length>0&&H(n,h.locale||"en-US")},[n]);const c=e(Q,{name:"ProductList",slot:r==null?void 0:r.ProductList,context:{itemQuantityUpdateHandler:f,itemRemoveHandler:k,totalQuantity:t==null?void 0:t.totalQuantity},children:e(j,{"data-testid":"default-cart-summary-list",routeProduct:o,routeEmptyCartCTA:C,initialData:t,maxItems:(P=h.config)==null?void 0:P.miniCartMaxItemsDisplay,showMaxItems:!!((D=h.config)!=null&&D.miniCartMaxItemsDisplay),hideHeading:!(t!=null&&t.totalQuantity),hideFooter:i,enableRemoveItem:!0,showDiscount:l,showSavings:L})}),x=()=>(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return e(z,{...s,subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&e(T,{...x()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?e(T,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,ctas:t!=null&&t.totalQuantity?y("div",{children:[u&&e(w,{"data-testid":"route-checkout-button",variant:"primary",href:m?void 0:u(),disabled:m,"aria-disabled":m,onClick:M,children:v.checkoutLink}),p&&e(w,{"data-testid":"route-cart-button",variant:"tertiary",href:p(),children:v.cartLink})]}):void 0,products:c})};q.getInitialData=async function(){return O()};export{B as C,q as M}; diff --git a/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js b/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js index e8805cabb5..3a4bda91b6 100644 --- a/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js +++ b/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as E,jsx as r,Fragment as We}from"@dropins/tools/preact-jsx-runtime.js";import*as Ie from"@dropins/tools/preact-compat.js";import{useState as ee,useEffect as ie,useCallback as Fe}from"@dropins/tools/preact-compat.js";import{VComponent as D,classes as ke,Slot as we}from"@dropins/tools/lib.js";import{events as Ee}from"@dropins/tools/event-bus.js";import{g as Ge}from"./persisted-data.js";import{s as Oe}from"./resetCart.js";import{g as ze}from"./getEstimatedTotals.js";import{b as Ve}from"./acdl.js";import{Accordion as Ne,AccordionSection as Be,ProgressSpinner as Ze,Divider as je,Price as l,Icon as Ue,Button as Qe}from"@dropins/tools/components.js";/* empty css */import{O as v}from"./OrderSummaryLine.js";import{S as Le}from"./ChevronDown.js";import{useText as Ae}from"@dropins/tools/i18n.js";import{S as Xe}from"./Coupon.js";const De=O=>Ie.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...O},Ie.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$e=({className:O,children:A,variant:P="primary",heading:s,loading:N=!0,subTotal:g,shipping:m,discounts:_,taxTotal:x,taxesApplied:e,total:p,primaryAction:B,coupons:o,totalSaved:y,updateLineItems:I=S=>S,...t})=>{const[S,L]=ee(!1),i=Ae({checkout:"Cart.PriceSummary.checkout",discountedPrice:"Cart.CartItem.discountedPrice",download:"Cart.CartItem.download",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",regularPrice:"Cart.CartItem.regularPrice",recipient:"Cart.CartItem.recipient",sender:"Cart.CartItem.sender",file:"Cart.CartItem.file",files:"Cart.CartItem.files",orderSummary:"Cart.PriceSummary.orderSummary",taxesBreakdownTitle:"Cart.PriceSummary.taxes.breakdown",taxTotal:"Cart.PriceSummary.taxes.total",taxEstimated:"Cart.PriceSummary.taxes.estimated",taxTotalOnly:"Cart.PriceSummary.taxes.totalOnly",showTaxBreakdown:"Cart.PriceSummary.taxes.showBreakdown",hideTaxBreakdown:"Cart.PriceSummary.taxes.hideBreakdown",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",subtotalLabel:"Cart.PriceSummary.subTotal.label",subtotalWithTaxes:"Cart.PriceSummary.subTotal.withTaxes",subtotalWithoutTaxes:"Cart.PriceSummary.subTotal.withoutTaxes",totalEstimated:"Cart.PriceSummary.total.estimated",totalLabel:"Cart.PriceSummary.total.label",totalWithoutTax:"Cart.PriceSummary.total.withoutTax",totalSaved:"Cart.PriceSummary.total.saved",shippingLabel:"Cart.PriceSummary.shipping.label",zipPlaceholder:"Cart.PriceSummary.shipping.zipPlaceholder",editZipAction:"Cart.PriceSummary.shipping.editZipAction",shippingWithTaxes:"Cart.PriceSummary.shipping.withTaxes",shippingWithoutTaxes:"Cart.PriceSummary.shipping.withoutTaxes",shippingEstimated:"Cart.PriceSummary.shipping.estimated",shippingEstimatedByState:"Cart.PriceSummary.shipping.alternateField.state",shippingEstimatedByZip:"Cart.PriceSummary.shipping.alternateField.zip",destinationLinkAriaLabel:"Cart.PriceSummary.shipping.destinationLinkAriaLabel",applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"}),k=g&&E(v,{label:i.subtotalLabel,price:g.price,classSuffixes:["subTotal"],children:[g.taxIncluded&&r("div",{"data-testid":"sub-total-tax-caption",className:"cart-order-summary__caption",children:r("span",{children:i.subtotalWithTaxes})}),g.taxExcluded?r("div",{"data-testid":"sub-total-tax-caption-excluded",className:"cart-order-summary__caption",children:E("span",{children:[g.priceExcludingTax," ",i.subtotalWithoutTaxes]})}):void 0]}),w=_&&_.length>0&&r(We,{children:_.map(n=>E(v,{label:n.label,price:n.price,classSuffixes:["discount"],children:[n.coupon&&r(D,{node:n.coupon,className:"cart-order-summary__coupon__code"}),n.caption&&r(D,{node:n.caption,className:"cart-order-summary__caption"})]}))}),T=e&&e.length>0?r(Ne,{"data-testid":"tax-breakdown",className:"cart-order-summary__taxes",iconOpen:Le,iconClose:De,children:E(Be,{title:i.taxesBreakdownTitle,secondaryText:!S&&x?r(D,{node:x.price,className:"cart-order-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:L,children:[r("div",{className:"cart-order-summary__appliedTaxes",children:e.map(n=>r(v,{label:n.label,price:n.price,classSuffixes:["taxEntry"],labelClassSuffix:"muted"}))}),x&&r(v,{label:i.taxTotal,price:x.price,classSuffixes:["taxTotal"],labelClassSuffix:"muted"})]})}):x&&r(v,{label:x.estimated?i.taxEstimated:i.taxTotalOnly,price:x.price,classSuffixes:["taxTotal"],testId:"tax-total-only"}),d=[{key:"subTotalContent",sortOrder:100,content:k},...m?[{key:"shippingContent",sortOrder:200,content:r(D,{node:m,className:"cart-order-summary__shipping"})}]:[],{key:"discountsContent",sortOrder:300,content:w},{key:"taxContent",sortOrder:400,content:T},...p?[{key:"taxContent",sortOrder:500,content:r(v,{label:p.estimated?i.totalEstimated:i.totalLabel,price:p.price,classSuffixes:["total","total--padded"],testId:"total-content",labelClassSuffix:"bold"})}]:[],...p&&p.priceWithoutTax?[{key:"totalWithoutTaxContent",sortOrder:600,content:r(v,{label:i.totalWithoutTax,price:p.priceWithoutTax,classSuffixes:["totalWithoutTax"],testId:"total-without-tax",labelClassSuffix:"muted"})}]:[],...y?[{key:"totalSavedContent",sortOrder:700,content:r(v,{label:i.totalSaved,price:y,classSuffixes:["saved"],testId:"total-saved",labelClassSuffix:"muted"})}]:[],...B?[{key:"primaryActionContent",sortOrder:800,content:r("div",{className:ke(["cart-order-summary__entry","cart-order-summary__primaryAction"]),children:B})}]:[],...o?[{key:"couponsContent",sortOrder:900,content:r(D,{node:o,className:"cart-order-summary__coupons"})}]:[]],h=I(d).sort((n,C)=>n.sortOrder-C.sortOrder);return E("div",{...t,className:ke(["cart-order-summary",["cart-order-summary--loading",N],[`cart-order-summary__${P}`,P],O]),children:[N&&r(Ze,{className:"cart-order-summary__spinner"}),E("div",{className:"cart-order-summary__heading",children:[s&&r(D,{node:s,className:"cart-order-summary__heading-text"}),r(je,{variant:"primary",className:"cart-order-summary__divider-primary"})]}),r("div",{className:"cart-order-summary__content",children:h.map(n=>Array.isArray(n.content)?r(Ne,{className:n.className,actionIconPosition:"right",iconOpen:Le,iconClose:De,children:r(Be,{defaultOpen:!1,title:n.title,renderContentWhenClosed:!1,children:n.content.map(C=>C.content)})}):n.content)})]})},qe=()=>{const[O,A]=ee(!1),[P,s]=ee();return{handleEstimateTotals:(g,m)=>{A(!0);const{shippingCountry:_,shippingState:x="",shippingStateId:e,shippingZip:p=""}=g,B={countryCode:_,postcode:p,region:{region:x,id:e},shipping_method:{carrier_code:(m==null?void 0:m.carrier_code)||"",method_code:(m==null?void 0:m.method_code)||""}};ze(B).then(o=>{var y,I,t,S,L,i,k,w,T,d,h,n,C,te,W,F,G,z,V,Z;o&&s({estimatedTaxTotal:{amount:(y=o.totalTax)==null?void 0:y.value,currency:(I=o.totalTax)==null?void 0:I.currency},estimatedSubTotal:{excludingTax:{amount:(S=(t=o.subtotal)==null?void 0:t.excludingTax)==null?void 0:S.value,currency:(i=(L=o.subtotal)==null?void 0:L.excludingTax)==null?void 0:i.currency},includingTax:{amount:(w=(k=o.subtotal)==null?void 0:k.includingTax)==null?void 0:w.value,currency:(d=(T=o.subtotal)==null?void 0:T.includingTax)==null?void 0:d.currency},includingDiscountOnly:{amount:(n=(h=o.subtotal)==null?void 0:h.includingDiscountOnly)==null?void 0:n.value,currency:(te=(C=o.subtotal)==null?void 0:C.includingDiscountOnly)==null?void 0:te.currency}},estimatedGrandTotalPrice:{includingTax:{amount:(W=o.total)==null?void 0:W.includingTax.value,currency:(F=o.total)==null?void 0:F.includingTax.currency},excludingTax:{amount:(G=o.total)==null?void 0:G.excludingTax.value,currency:(z=o.total)==null?void 0:z.excludingTax.currency}},estimatedAppliedTaxes:{taxes:(V=o.appliedTaxes)==null?void 0:V.map(u=>{var b,f;return{label:u.label,amount:{value:(b=u.amount)==null?void 0:b.value,currency:(f=u.amount)==null?void 0:f.currency}}})},estimatedItems:{items:(Z=o.items)==null?void 0:Z.map(u=>{var b,f,j,U,Q,X,$,q,H,R;return{uid:u.uid,price:{amount:(b=u.price)==null?void 0:b.value,currency:(f=u.price)==null?void 0:f.currency},taxedPrice:{amount:(j=u.taxedPrice)==null?void 0:j.value,currency:(U=u.taxedPrice)==null?void 0:U.currency},rowTotal:{amount:(Q=u.rowTotal)==null?void 0:Q.value,currency:(X=u.rowTotal)==null?void 0:X.currency},rowTotalIncludingTax:{amount:($=u.rowTotalIncludingTax)==null?void 0:$.value,currency:(q=u.rowTotalIncludingTax)==null?void 0:q.currency},regularPrice:{amount:(H=u.regularPrice)==null?void 0:H.value,currency:(R=u.regularPrice)==null?void 0:R.currency}}})}})}).finally(()=>{A(!1)})},estimatedTotals:P,setEstimatedTotals:s,loading:O}},He=({children:O,initialData:A=null,routeCheckout:P,slots:s,errors:N,showTotalSaved:g,enableCoupons:m,updateLineItems:_=e=>e,...x})=>{var W,F,G,z,V,Z,u,b,f,j,U,Q,X,$,q,H,R,ne,ce,oe,ue,se,le,me,de,xe,pe,he,ge,ye,Se,Te,Ce,be,fe,ve;const[e,p]=ee(A),[B,o]=ee(!1),y=e==null?void 0:e.isVirtual;m=m??!0;const{handleEstimateTotals:I,estimatedTotals:t,setEstimatedTotals:S,loading:L}=qe(),i=(W=Oe.config)==null?void 0:W.shoppingCartDisplaySetting,k=(i==null?void 0:i.subtotal)==="INCLUDING_TAX",w=(i==null?void 0:i.subtotal)==="INCLUDING_EXCLUDING_TAX",T=i==null?void 0:i.zeroTax;ie(()=>{const c=Ee.on("cart/data",a=>{var J,K,Y,M;p(a);const re=(J=a==null?void 0:a.addresses)==null?void 0:J.shipping,ae=a==null?void 0:a.isVirtual;(re||ae)&&S(null),((K=a==null?void 0:a.totalTax)==null?void 0:K.value)>0&&t===void 0&&S({estimatedTaxTotal:{amount:(Y=a==null?void 0:a.totalTax)==null?void 0:Y.value,currency:(M=a==null?void 0:a.totalTax)==null?void 0:M.currency}})},{eager:!0});return()=>{c==null||c.off()}},[]),ie(()=>{o(N)},[N]),ie(()=>{const c=Ee.on("shipping/estimate",a=>{var J,K,Y,M,Pe,_e;const re={shippingCountry:(J=a==null?void 0:a.address)==null?void 0:J.countryCode,shippingState:(K=a==null?void 0:a.address)==null?void 0:K.region,shippingStateId:(Y=a==null?void 0:a.address)==null?void 0:Y.regionId,shippingZip:(M=a==null?void 0:a.address)==null?void 0:M.postCode},ae={carrier_code:((Pe=a==null?void 0:a.shippingMethod)==null?void 0:Pe.carrierCode)||"",method_code:((_e=a==null?void 0:a.shippingMethod)==null?void 0:_e.methodCode)||""};I(re,ae)});return()=>{c==null||c.off()}},[I]);const d=Ae({checkout:"Cart.PriceSummary.checkout",free:"Cart.PriceSummary.total.free",orderSummary:"Cart.PriceSummary.orderSummary",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined"}),h=(e==null?void 0:e.hasOutOfStockItems)||B,n=Fe(()=>{!h&&e&&Ve(e,Oe.locale)},[h,e]),C=!y&&(s!=null&&s.EstimateShipping)?r(we,{name:"EstimateShipping",slot:s.EstimateShipping},"estimateShippingId"):void 0;if(!Object.keys(e??{}).length||(e==null?void 0:e.totalQuantity)===0)return null;const te=m&&(s!=null&&s.Coupons)?r(we,{name:"Coupons",slot:s.Coupons},"couponsId"):void 0;return r($e,{...x,"data-testid":"cart-order-summary",heading:r("div",{children:d.orderSummary}),shipping:C,coupons:te,loading:L,updateLineItems:_,subTotal:{taxIncluded:k&&!T,taxExcluded:w,zeroTaxSubtotal:T,priceExcludingTax:(F=t==null?void 0:t.estimatedSubTotal)!=null&&F.excludingTax?r(l,{"data-testid":"subtotal",...(G=t==null?void 0:t.estimatedSubTotal)==null?void 0:G.excludingTax}):r(l,{"data-testid":"subtotal",amount:(V=(z=e==null?void 0:e.subtotal)==null?void 0:z.excludingTax)==null?void 0:V.value,currency:(u=(Z=e==null?void 0:e.subtotal)==null?void 0:Z.excludingTax)==null?void 0:u.currency}),price:!T&&k||!T&&w?(b=t==null?void 0:t.estimatedSubTotal)!=null&&b.includingTax?r(l,{"data-testid":"subtotal",...(f=t==null?void 0:t.estimatedSubTotal)==null?void 0:f.includingTax}):r(l,{"data-testid":"subtotal",amount:(j=e==null?void 0:e.subtotal.includingTax)==null?void 0:j.value,currency:(U=e==null?void 0:e.subtotal.includingTax)==null?void 0:U.currency}):r(l,{"data-testid":"subtotal",amount:(X=(Q=e==null?void 0:e.subtotal)==null?void 0:Q.excludingTax)==null?void 0:X.value,currency:(q=($=e==null?void 0:e.subtotal)==null?void 0:$.excludingTax)==null?void 0:q.currency})},discounts:(H=e==null?void 0:e.appliedDiscounts)==null?void 0:H.map(c=>{var a;return{label:c.label,price:r(l,{"data-testid":"summary-discount-total",amount:-c.amount.value,currency:c.amount.currency,sale:!0}),coupon:c!=null&&c.coupon?E("span",{children:[r(Ue,{source:Xe,size:"16"}),(a=c==null?void 0:c.coupon)==null?void 0:a.code]}):void 0}}),taxTotal:y||(t==null?void 0:t.estimatedTaxTotal)===void 0?{price:r("span",{"data-testid":"tax-total",children:d.taxToBeDetermined})}:{price:t!=null&&t.estimatedTaxTotal?r(l,{"data-testid":"tax-total",...t==null?void 0:t.estimatedTaxTotal}):r(l,{"data-testid":"tax-total",amount:(R=e==null?void 0:e.totalTax)==null?void 0:R.value,currency:(ne=e==null?void 0:e.totalTax)==null?void 0:ne.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((ce=e==null?void 0:e.addresses)!=null&&ce.shipping)},taxesApplied:y?void 0:i!=null&&i.fullSummary?(ue=((oe=t==null?void 0:t.estimatedAppliedTaxes)==null?void 0:oe.taxes)||(e==null?void 0:e.appliedTaxes))==null?void 0:ue.map(c=>({label:c.label,price:r(l,{"data-testid":"applied-taxes",amount:c.amount.value,currency:c.amount.currency})})):void 0,total:{price:t!=null&&t.estimatedGrandTotalPrice?((le=(se=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:se.includingTax)==null?void 0:le.amount)===0?r("span",{"data-testid":"total-including-tax",children:d.free}):r(l,{"data-testid":"total-including-tax",...(me=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:me.includingTax}):((de=e==null?void 0:e.total)==null?void 0:de.includingTax.value)===0?r("span",{"data-testid":"total-including-tax",children:d.free}):r(l,{"data-testid":"total-including-tax",amount:(xe=e==null?void 0:e.total)==null?void 0:xe.includingTax.value,currency:(pe=e==null?void 0:e.total)==null?void 0:pe.includingTax.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((he=e==null?void 0:e.addresses)!=null&&he.shipping),priceWithoutTax:i!=null&&i.grandTotal?t!=null&&t.estimatedAppliedTaxes?((ye=(ge=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:ge.excludingTax)==null?void 0:ye.amount)===0?r("span",{"data-testid":"total-excluding-tax",children:d.free}):r(l,{"data-testid":"total-excluding-tax",...(Se=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:Se.excludingTax}):((Te=e==null?void 0:e.total)==null?void 0:Te.excludingTax.value)===0?r("span",{"data-testid":"total-excluding-tax",children:d.free}):r(l,{"data-testid":"total-excluding-tax",amount:(Ce=e==null?void 0:e.total)==null?void 0:Ce.excludingTax.value,currency:(be=e==null?void 0:e.total)==null?void 0:be.excludingTax.currency}):void 0},primaryAction:P&&r(Qe,{"data-testid":"checkout-button",variant:"primary",disabled:h,"aria-disabled":h,href:h?void 0:P({cartId:e.id}),onClick:n,children:d.checkout}),totalSaved:g?r(l,{amount:(fe=e==null?void 0:e.discount)==null?void 0:fe.value,currency:(ve=e==null?void 0:e.total)==null?void 0:ve.includingTax.currency}):void 0})};He.getInitialData=async function(){return Ge()};export{He as O}; +import{jsxs as E,jsx as r,Fragment as We}from"@dropins/tools/preact-jsx-runtime.js";import*as Ie from"@dropins/tools/preact-compat.js";import{useState as ee,useEffect as ie,useCallback as Fe}from"@dropins/tools/preact-compat.js";import{VComponent as D,classes as ke,Slot as we}from"@dropins/tools/lib.js";import{events as Ee}from"@dropins/tools/event-bus.js";import{g as Ge}from"./persisted-data.js";import{s as Oe}from"./resetCart.js";import{g as ze}from"./getEstimatedTotals.js";import{p as Ve}from"./acdl.js";import{Accordion as Ne,AccordionSection as Be,ProgressSpinner as Ze,Divider as je,Price as l,Icon as Ue,Button as Qe}from"@dropins/tools/components.js";/* empty css */import{O as v}from"./OrderSummaryLine.js";import{S as Le}from"./ChevronDown.js";import{useText as Ae}from"@dropins/tools/i18n.js";import{S as Xe}from"./Coupon.js";const De=O=>Ie.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...O},Ie.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$e=({className:O,children:A,variant:P="primary",heading:s,loading:N=!0,subTotal:g,shipping:m,discounts:_,taxTotal:x,taxesApplied:e,total:p,primaryAction:B,coupons:o,totalSaved:y,updateLineItems:I=S=>S,...t})=>{const[S,L]=ee(!1),i=Ae({checkout:"Cart.PriceSummary.checkout",discountedPrice:"Cart.CartItem.discountedPrice",download:"Cart.CartItem.download",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",regularPrice:"Cart.CartItem.regularPrice",recipient:"Cart.CartItem.recipient",sender:"Cart.CartItem.sender",file:"Cart.CartItem.file",files:"Cart.CartItem.files",orderSummary:"Cart.PriceSummary.orderSummary",taxesBreakdownTitle:"Cart.PriceSummary.taxes.breakdown",taxTotal:"Cart.PriceSummary.taxes.total",taxEstimated:"Cart.PriceSummary.taxes.estimated",taxTotalOnly:"Cart.PriceSummary.taxes.totalOnly",showTaxBreakdown:"Cart.PriceSummary.taxes.showBreakdown",hideTaxBreakdown:"Cart.PriceSummary.taxes.hideBreakdown",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",subtotalLabel:"Cart.PriceSummary.subTotal.label",subtotalWithTaxes:"Cart.PriceSummary.subTotal.withTaxes",subtotalWithoutTaxes:"Cart.PriceSummary.subTotal.withoutTaxes",totalEstimated:"Cart.PriceSummary.total.estimated",totalLabel:"Cart.PriceSummary.total.label",totalWithoutTax:"Cart.PriceSummary.total.withoutTax",totalSaved:"Cart.PriceSummary.total.saved",shippingLabel:"Cart.PriceSummary.shipping.label",zipPlaceholder:"Cart.PriceSummary.shipping.zipPlaceholder",editZipAction:"Cart.PriceSummary.shipping.editZipAction",shippingWithTaxes:"Cart.PriceSummary.shipping.withTaxes",shippingWithoutTaxes:"Cart.PriceSummary.shipping.withoutTaxes",shippingEstimated:"Cart.PriceSummary.shipping.estimated",shippingEstimatedByState:"Cart.PriceSummary.shipping.alternateField.state",shippingEstimatedByZip:"Cart.PriceSummary.shipping.alternateField.zip",destinationLinkAriaLabel:"Cart.PriceSummary.shipping.destinationLinkAriaLabel",applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"}),k=g&&E(v,{label:i.subtotalLabel,price:g.price,classSuffixes:["subTotal"],children:[g.taxIncluded&&r("div",{"data-testid":"sub-total-tax-caption",className:"cart-order-summary__caption",children:r("span",{children:i.subtotalWithTaxes})}),g.taxExcluded?r("div",{"data-testid":"sub-total-tax-caption-excluded",className:"cart-order-summary__caption",children:E("span",{children:[g.priceExcludingTax," ",i.subtotalWithoutTaxes]})}):void 0]}),w=_&&_.length>0&&r(We,{children:_.map(n=>E(v,{label:n.label,price:n.price,classSuffixes:["discount"],children:[n.coupon&&r(D,{node:n.coupon,className:"cart-order-summary__coupon__code"}),n.caption&&r(D,{node:n.caption,className:"cart-order-summary__caption"})]}))}),T=e&&e.length>0?r(Ne,{"data-testid":"tax-breakdown",className:"cart-order-summary__taxes",iconOpen:Le,iconClose:De,children:E(Be,{title:i.taxesBreakdownTitle,secondaryText:!S&&x?r(D,{node:x.price,className:"cart-order-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:L,children:[r("div",{className:"cart-order-summary__appliedTaxes",children:e.map(n=>r(v,{label:n.label,price:n.price,classSuffixes:["taxEntry"],labelClassSuffix:"muted"}))}),x&&r(v,{label:i.taxTotal,price:x.price,classSuffixes:["taxTotal"],labelClassSuffix:"muted"})]})}):x&&r(v,{label:x.estimated?i.taxEstimated:i.taxTotalOnly,price:x.price,classSuffixes:["taxTotal"],testId:"tax-total-only"}),d=[{key:"subTotalContent",sortOrder:100,content:k},...m?[{key:"shippingContent",sortOrder:200,content:r(D,{node:m,className:"cart-order-summary__shipping"})}]:[],{key:"discountsContent",sortOrder:300,content:w},{key:"taxContent",sortOrder:400,content:T},...p?[{key:"taxContent",sortOrder:500,content:r(v,{label:p.estimated?i.totalEstimated:i.totalLabel,price:p.price,classSuffixes:["total","total--padded"],testId:"total-content",labelClassSuffix:"bold"})}]:[],...p&&p.priceWithoutTax?[{key:"totalWithoutTaxContent",sortOrder:600,content:r(v,{label:i.totalWithoutTax,price:p.priceWithoutTax,classSuffixes:["totalWithoutTax"],testId:"total-without-tax",labelClassSuffix:"muted"})}]:[],...y?[{key:"totalSavedContent",sortOrder:700,content:r(v,{label:i.totalSaved,price:y,classSuffixes:["saved"],testId:"total-saved",labelClassSuffix:"muted"})}]:[],...B?[{key:"primaryActionContent",sortOrder:800,content:r("div",{className:ke(["cart-order-summary__entry","cart-order-summary__primaryAction"]),children:B})}]:[],...o?[{key:"couponsContent",sortOrder:900,content:r(D,{node:o,className:"cart-order-summary__coupons"})}]:[]],h=I(d).sort((n,C)=>n.sortOrder-C.sortOrder);return E("div",{...t,className:ke(["cart-order-summary",["cart-order-summary--loading",N],[`cart-order-summary__${P}`,P],O]),children:[N&&r(Ze,{className:"cart-order-summary__spinner"}),E("div",{className:"cart-order-summary__heading",children:[s&&r(D,{node:s,className:"cart-order-summary__heading-text"}),r(je,{variant:"primary",className:"cart-order-summary__divider-primary"})]}),r("div",{className:"cart-order-summary__content",children:h.map(n=>Array.isArray(n.content)?r(Ne,{className:n.className,actionIconPosition:"right",iconOpen:Le,iconClose:De,children:r(Be,{defaultOpen:!1,title:n.title,renderContentWhenClosed:!1,children:n.content.map(C=>C.content)})}):n.content)})]})},qe=()=>{const[O,A]=ee(!1),[P,s]=ee();return{handleEstimateTotals:(g,m)=>{A(!0);const{shippingCountry:_,shippingState:x="",shippingStateId:e,shippingZip:p=""}=g,B={countryCode:_,postcode:p,region:{region:x,id:e},shipping_method:{carrier_code:(m==null?void 0:m.carrier_code)||"",method_code:(m==null?void 0:m.method_code)||""}};ze(B).then(o=>{var y,I,t,S,L,i,k,w,T,d,h,n,C,te,W,F,G,z,V,Z;o&&s({estimatedTaxTotal:{amount:(y=o.totalTax)==null?void 0:y.value,currency:(I=o.totalTax)==null?void 0:I.currency},estimatedSubTotal:{excludingTax:{amount:(S=(t=o.subtotal)==null?void 0:t.excludingTax)==null?void 0:S.value,currency:(i=(L=o.subtotal)==null?void 0:L.excludingTax)==null?void 0:i.currency},includingTax:{amount:(w=(k=o.subtotal)==null?void 0:k.includingTax)==null?void 0:w.value,currency:(d=(T=o.subtotal)==null?void 0:T.includingTax)==null?void 0:d.currency},includingDiscountOnly:{amount:(n=(h=o.subtotal)==null?void 0:h.includingDiscountOnly)==null?void 0:n.value,currency:(te=(C=o.subtotal)==null?void 0:C.includingDiscountOnly)==null?void 0:te.currency}},estimatedGrandTotalPrice:{includingTax:{amount:(W=o.total)==null?void 0:W.includingTax.value,currency:(F=o.total)==null?void 0:F.includingTax.currency},excludingTax:{amount:(G=o.total)==null?void 0:G.excludingTax.value,currency:(z=o.total)==null?void 0:z.excludingTax.currency}},estimatedAppliedTaxes:{taxes:(V=o.appliedTaxes)==null?void 0:V.map(u=>{var b,f;return{label:u.label,amount:{value:(b=u.amount)==null?void 0:b.value,currency:(f=u.amount)==null?void 0:f.currency}}})},estimatedItems:{items:(Z=o.items)==null?void 0:Z.map(u=>{var b,f,j,U,Q,X,$,q,H,R;return{uid:u.uid,price:{amount:(b=u.price)==null?void 0:b.value,currency:(f=u.price)==null?void 0:f.currency},taxedPrice:{amount:(j=u.taxedPrice)==null?void 0:j.value,currency:(U=u.taxedPrice)==null?void 0:U.currency},rowTotal:{amount:(Q=u.rowTotal)==null?void 0:Q.value,currency:(X=u.rowTotal)==null?void 0:X.currency},rowTotalIncludingTax:{amount:($=u.rowTotalIncludingTax)==null?void 0:$.value,currency:(q=u.rowTotalIncludingTax)==null?void 0:q.currency},regularPrice:{amount:(H=u.regularPrice)==null?void 0:H.value,currency:(R=u.regularPrice)==null?void 0:R.currency}}})}})}).finally(()=>{A(!1)})},estimatedTotals:P,setEstimatedTotals:s,loading:O}},He=({children:O,initialData:A=null,routeCheckout:P,slots:s,errors:N,showTotalSaved:g,enableCoupons:m,updateLineItems:_=e=>e,...x})=>{var W,F,G,z,V,Z,u,b,f,j,U,Q,X,$,q,H,R,ne,ce,oe,ue,se,le,me,de,xe,pe,he,ge,ye,Se,Te,Ce,be,fe,ve;const[e,p]=ee(A),[B,o]=ee(!1),y=e==null?void 0:e.isVirtual;m=m??!0;const{handleEstimateTotals:I,estimatedTotals:t,setEstimatedTotals:S,loading:L}=qe(),i=(W=Oe.config)==null?void 0:W.shoppingCartDisplaySetting,k=(i==null?void 0:i.subtotal)==="INCLUDING_TAX",w=(i==null?void 0:i.subtotal)==="INCLUDING_EXCLUDING_TAX",T=i==null?void 0:i.zeroTax;ie(()=>{const c=Ee.on("cart/data",a=>{var J,K,Y,M;p(a);const re=(J=a==null?void 0:a.addresses)==null?void 0:J.shipping,ae=a==null?void 0:a.isVirtual;(re||ae)&&S(null),((K=a==null?void 0:a.totalTax)==null?void 0:K.value)>0&&t===void 0&&S({estimatedTaxTotal:{amount:(Y=a==null?void 0:a.totalTax)==null?void 0:Y.value,currency:(M=a==null?void 0:a.totalTax)==null?void 0:M.currency}})},{eager:!0});return()=>{c==null||c.off()}},[]),ie(()=>{o(N)},[N]),ie(()=>{const c=Ee.on("shipping/estimate",a=>{var J,K,Y,M,Pe,_e;const re={shippingCountry:(J=a==null?void 0:a.address)==null?void 0:J.countryCode,shippingState:(K=a==null?void 0:a.address)==null?void 0:K.region,shippingStateId:(Y=a==null?void 0:a.address)==null?void 0:Y.regionId,shippingZip:(M=a==null?void 0:a.address)==null?void 0:M.postCode},ae={carrier_code:((Pe=a==null?void 0:a.shippingMethod)==null?void 0:Pe.carrierCode)||"",method_code:((_e=a==null?void 0:a.shippingMethod)==null?void 0:_e.methodCode)||""};I(re,ae)});return()=>{c==null||c.off()}},[I]);const d=Ae({checkout:"Cart.PriceSummary.checkout",free:"Cart.PriceSummary.total.free",orderSummary:"Cart.PriceSummary.orderSummary",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined"}),h=(e==null?void 0:e.hasOutOfStockItems)||B,n=Fe(()=>{!h&&e&&Ve(e,Oe.locale)},[h,e]),C=!y&&(s!=null&&s.EstimateShipping)?r(we,{name:"EstimateShipping",slot:s.EstimateShipping},"estimateShippingId"):void 0;if(!Object.keys(e??{}).length||(e==null?void 0:e.totalQuantity)===0)return null;const te=m&&(s!=null&&s.Coupons)?r(we,{name:"Coupons",slot:s.Coupons},"couponsId"):void 0;return r($e,{...x,"data-testid":"cart-order-summary",heading:r("div",{children:d.orderSummary}),shipping:C,coupons:te,loading:L,updateLineItems:_,subTotal:{taxIncluded:k&&!T,taxExcluded:w,zeroTaxSubtotal:T,priceExcludingTax:(F=t==null?void 0:t.estimatedSubTotal)!=null&&F.excludingTax?r(l,{"data-testid":"subtotal",...(G=t==null?void 0:t.estimatedSubTotal)==null?void 0:G.excludingTax}):r(l,{"data-testid":"subtotal",amount:(V=(z=e==null?void 0:e.subtotal)==null?void 0:z.excludingTax)==null?void 0:V.value,currency:(u=(Z=e==null?void 0:e.subtotal)==null?void 0:Z.excludingTax)==null?void 0:u.currency}),price:!T&&k||!T&&w?(b=t==null?void 0:t.estimatedSubTotal)!=null&&b.includingTax?r(l,{"data-testid":"subtotal",...(f=t==null?void 0:t.estimatedSubTotal)==null?void 0:f.includingTax}):r(l,{"data-testid":"subtotal",amount:(j=e==null?void 0:e.subtotal.includingTax)==null?void 0:j.value,currency:(U=e==null?void 0:e.subtotal.includingTax)==null?void 0:U.currency}):r(l,{"data-testid":"subtotal",amount:(X=(Q=e==null?void 0:e.subtotal)==null?void 0:Q.excludingTax)==null?void 0:X.value,currency:(q=($=e==null?void 0:e.subtotal)==null?void 0:$.excludingTax)==null?void 0:q.currency})},discounts:(H=e==null?void 0:e.appliedDiscounts)==null?void 0:H.map(c=>{var a;return{label:c.label,price:r(l,{"data-testid":"summary-discount-total",amount:-c.amount.value,currency:c.amount.currency,sale:!0}),coupon:c!=null&&c.coupon?E("span",{children:[r(Ue,{source:Xe,size:"16"}),(a=c==null?void 0:c.coupon)==null?void 0:a.code]}):void 0}}),taxTotal:y||(t==null?void 0:t.estimatedTaxTotal)===void 0?{price:r("span",{"data-testid":"tax-total",children:d.taxToBeDetermined})}:{price:t!=null&&t.estimatedTaxTotal?r(l,{"data-testid":"tax-total",...t==null?void 0:t.estimatedTaxTotal}):r(l,{"data-testid":"tax-total",amount:(R=e==null?void 0:e.totalTax)==null?void 0:R.value,currency:(ne=e==null?void 0:e.totalTax)==null?void 0:ne.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((ce=e==null?void 0:e.addresses)!=null&&ce.shipping)},taxesApplied:y?void 0:i!=null&&i.fullSummary?(ue=((oe=t==null?void 0:t.estimatedAppliedTaxes)==null?void 0:oe.taxes)||(e==null?void 0:e.appliedTaxes))==null?void 0:ue.map(c=>({label:c.label,price:r(l,{"data-testid":"applied-taxes",amount:c.amount.value,currency:c.amount.currency})})):void 0,total:{price:t!=null&&t.estimatedGrandTotalPrice?((le=(se=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:se.includingTax)==null?void 0:le.amount)===0?r("span",{"data-testid":"total-including-tax",children:d.free}):r(l,{"data-testid":"total-including-tax",...(me=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:me.includingTax}):((de=e==null?void 0:e.total)==null?void 0:de.includingTax.value)===0?r("span",{"data-testid":"total-including-tax",children:d.free}):r(l,{"data-testid":"total-including-tax",amount:(xe=e==null?void 0:e.total)==null?void 0:xe.includingTax.value,currency:(pe=e==null?void 0:e.total)==null?void 0:pe.includingTax.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((he=e==null?void 0:e.addresses)!=null&&he.shipping),priceWithoutTax:i!=null&&i.grandTotal?t!=null&&t.estimatedAppliedTaxes?((ye=(ge=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:ge.excludingTax)==null?void 0:ye.amount)===0?r("span",{"data-testid":"total-excluding-tax",children:d.free}):r(l,{"data-testid":"total-excluding-tax",...(Se=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:Se.excludingTax}):((Te=e==null?void 0:e.total)==null?void 0:Te.excludingTax.value)===0?r("span",{"data-testid":"total-excluding-tax",children:d.free}):r(l,{"data-testid":"total-excluding-tax",amount:(Ce=e==null?void 0:e.total)==null?void 0:Ce.excludingTax.value,currency:(be=e==null?void 0:e.total)==null?void 0:be.excludingTax.currency}):void 0},primaryAction:P&&r(Qe,{"data-testid":"checkout-button",variant:"primary",disabled:h,"aria-disabled":h,href:h?void 0:P({cartId:e.id}),onClick:n,children:d.checkout}),totalSaved:g?r(l,{amount:(fe=e==null?void 0:e.discount)==null?void 0:fe.value,currency:(ve=e==null?void 0:e.total)==null?void 0:ve.includingTax.currency}):void 0})};He.getInitialData=async function(){return Ge()};export{He as O}; diff --git a/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js b/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js index 1a232a3f14..0619a1d68e 100644 --- a/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js +++ b/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as _,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{classes as c,VComponent as y}from"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";const u=({label:e,price:a,classSuffixes:s=[],labelClassSuffix:r,testId:m,children:o,...t})=>{const d="cart-order-summary__label",p="cart-order-summary__price";return _("div",{...t,...m?{"data-testid":m}:{},className:c(["cart-order-summary__entry",...s.map(i=>"cart-order-summary__"+i)]),children:[n("span",{className:c([d,...r?[d+"--"+r]:[]]),children:e}),n(y,{node:a,className:c([p,...r?[p+"--"+r]:[]])}),o]})},L=({label:e,price:a,classSuffixes:s=[],labelClassSuffix:r,testId:m,children:o,...t})=>n(u,{...t,label:e,price:a,classSuffixes:s,labelClassSuffix:r,testId:m,children:o});export{L as O}; +import{jsxs as _,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{classes as c,VComponent as y}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";const u=({label:e,price:a,classSuffixes:s=[],labelClassSuffix:r,testId:m,children:o,...t})=>{const d="cart-order-summary__label",p="cart-order-summary__price";return _("div",{...t,...m?{"data-testid":m}:{},className:c(["cart-order-summary__entry",...s.map(i=>"cart-order-summary__"+i)]),children:[n("span",{className:c([d,...r?[d+"--"+r]:[]]),children:e}),n(y,{node:a,className:c([p,...r?[p+"--"+r]:[]])}),o]})},L=({label:e,price:a,classSuffixes:s=[],labelClassSuffix:r,testId:m,children:o,...t})=>n(u,{...t,label:e,price:a,classSuffixes:s,labelClassSuffix:r,testId:m,children:o});export{L as O}; diff --git a/scripts/__dropins__/storefront-cart/chunks/acdl.js b/scripts/__dropins__/storefront-cart/chunks/acdl.js index 215b335bed..1beee908b2 100644 --- a/scripts/__dropins__/storefront-cart/chunks/acdl.js +++ b/scripts/__dropins__/storefront-cart/chunks/acdl.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -function d(o){const{cart:e,locale:t="en-US"}=o;return{id:e.id,items:g(e.items,t),prices:{subtotalExcludingTax:e.subtotal.excludingTax,subtotalIncludingTax:e.subtotal.includingTax},totalQuantity:e.totalQuantity,possibleOnepageCheckout:void 0,giftMessageSelected:void 0,giftWrappingSelected:void 0,source:void 0}}function g(o,e){return o.map(t=>{var n;return{canApplyMsrp:!1,formattedPrice:v(e,t.price.currency,t.price.value),id:t.uid,prices:{price:t.price},product:{productId:t.uid,name:t.name,sku:t.sku,topLevelSku:void 0,specialToDate:void 0,specialFromDate:void 0,newToDate:void 0,newFromDate:void 0,createdAt:void 0,updatedAt:void 0,manufacturer:void 0,countryOfManufacture:void 0,categories:t.url.categories,productType:void 0,pricing:{regularPrice:t.regularPrice.value,minimalPrice:void 0,maximalPrice:void 0,specialPrice:(n=t.discount)==null?void 0:n.value,tierPricing:void 0,currencyCode:t.regularPrice.currency},canonicalUrl:t.url.urlKey,mainImageUrl:t.image.src,image:{src:t.image.src,alt:t.image.alt}},configurableOptions:void 0,quantity:t.quantity}})}function v(o,e,t){const n=o.replace("_","-");return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(t)}const r={SHOPPING_CART_CONTEXT:"shoppingCartContext",PRODUCT_CONTEXT:"productContext",CHANGED_PRODUCTS_CONTEXT:"changedProductsContext"},c={OPEN_CART:"open-cart",ADD_TO_CART:"add-to-cart",REMOVE_FROM_CART:"remove-from-cart",SHOPPING_CART_VIEW:"shopping-cart-view",INITIATE_CHECKOUT:"initiate-checkout"};function O(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function i(o,e){const t=O();t.push({[o]:null}),t.push({[o]:e})}function T(o,e){O().push(n=>{const C=n.getState?n.getState():{};n.push({event:o,eventInfo:{...C,...e}})})}function P(o,e,t){const n=d({cart:o,locale:t});i(r.SHOPPING_CART_CONTEXT,{...n}),T(c.OPEN_CART),g(e,t).forEach(u=>{i(r.PRODUCT_CONTEXT,u.product),p(n,[u],c.ADD_TO_CART)})}function D(o,e){const t=d({cart:o,locale:e});i(r.SHOPPING_CART_CONTEXT,{...t}),T(c.SHOPPING_CART_VIEW)}function p(o,e,t){const n={items:e};i(r.SHOPPING_CART_CONTEXT,{...o}),i(r.CHANGED_PRODUCTS_CONTEXT,{...n}),T(t)}function R(o,e,t){const n=d({cart:o,locale:t}),C=n.items,u=O(),E=u.getState?u.getState():{},{shoppingCartContext:{items:f=[]}={}}=E;e.forEach(_=>{const s=f.find(l=>l.id===_.uid),a=C.find(l=>l.id===_.uid);!a&&!s||(!s&&a?(i(r.PRODUCT_CONTEXT,a.product),p(n,[a],c.ADD_TO_CART)):s&&!a?(i(r.PRODUCT_CONTEXT,s.product),p(n,[s],c.REMOVE_FROM_CART)):a.quantity>s.quantity?(i(r.PRODUCT_CONTEXT,a.product),p(n,[a],c.ADD_TO_CART)):(i(r.PRODUCT_CONTEXT,a.product),p(n,[a],c.REMOVE_FROM_CART)))})}function h(o,e){const t=d({cart:o,locale:e});i(r.SHOPPING_CART_CONTEXT,{...t}),T(c.INITIATE_CHECKOUT)}export{D as a,h as b,P as c,R as p}; +function d(n){const{cart:e,locale:t="en-US"}=n;return{id:e.id,items:g(e.items,t),prices:{subtotalExcludingTax:e.subtotal.excludingTax,subtotalIncludingTax:e.subtotal.includingTax},totalQuantity:e.totalUniqueItems,possibleOnepageCheckout:void 0,giftMessageSelected:void 0,giftWrappingSelected:void 0,source:void 0}}function g(n,e){return n.map(t=>({canApplyMsrp:!1,formattedPrice:P(e,t.price.currency,t.price.value),id:t.uid,prices:{price:t.price},product:{productId:t.uid,name:t.name,sku:t.sku,topLevelSku:t.topLevelSku,specialToDate:void 0,specialFromDate:void 0,newToDate:void 0,newFromDate:void 0,createdAt:void 0,updatedAt:void 0,manufacturer:void 0,countryOfManufacture:void 0,categories:t.categories,productType:t.itemType,pricing:{regularPrice:t.regularPrice.value,minimalPrice:void 0,maximalPrice:void 0,specialPrice:v(t),tierPricing:void 0,currencyCode:t.regularPrice.currency},canonicalUrl:t.canonicalUrl,mainImageUrl:t.image.src,image:{src:t.image.src,alt:t.image.alt}},configurableOptions:void 0,quantity:t.quantity}))}function P(n,e,t){const o=n.replace("_","-");return new Intl.NumberFormat(o,{style:"currency",currency:e}).format(t)}function v(n){var e;if(n.discounted)return(e=n.price)==null?void 0:e.value}const r={SHOPPING_CART_CONTEXT:"shoppingCartContext",PRODUCT_CONTEXT:"productContext",CHANGED_PRODUCTS_CONTEXT:"changedProductsContext"},c={OPEN_CART:"open-cart",ADD_TO_CART:"add-to-cart",REMOVE_FROM_CART:"remove-from-cart",SHOPPING_CART_VIEW:"shopping-cart-view",INITIATE_CHECKOUT:"initiate-checkout"};function O(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function i(n,e){const t=O();t.push({[n]:null}),t.push({[n]:e})}function T(n,e){O().push(o=>{const C=o.getState?o.getState():{};o.push({event:n,eventInfo:{...C,...e}})})}function D(n,e,t){const o=d({cart:n,locale:t});i(r.SHOPPING_CART_CONTEXT,{...o}),T(c.OPEN_CART),g(e,t).forEach(u=>{i(r.PRODUCT_CONTEXT,u.product),p(o,[u],c.ADD_TO_CART)})}function R(n,e){const t=d({cart:n,locale:e});i(r.SHOPPING_CART_CONTEXT,{...t}),T(c.SHOPPING_CART_VIEW)}function p(n,e,t){const o={items:e};i(r.SHOPPING_CART_CONTEXT,{...n}),i(r.CHANGED_PRODUCTS_CONTEXT,{...o}),T(t)}function I(n,e,t){const o=d({cart:n,locale:t}),C=o.items,u=O(),E=u.getState?u.getState():{},{shoppingCartContext:{items:f=[]}={}}=E;e.forEach(_=>{const s=f.find(l=>l.id===_.uid),a=C.find(l=>l.id===_.uid);!a&&!s||(!s&&a?(i(r.PRODUCT_CONTEXT,a.product),p(o,[a],c.ADD_TO_CART)):s&&!a?(i(r.PRODUCT_CONTEXT,s.product),p(o,[s],c.REMOVE_FROM_CART)):a.quantity>s.quantity?(i(r.PRODUCT_CONTEXT,a.product),p(o,[a],c.ADD_TO_CART)):(i(r.PRODUCT_CONTEXT,a.product),p(o,[a],c.REMOVE_FROM_CART)))})}function h(n,e){const t=d({cart:n,locale:e});i(r.SHOPPING_CART_CONTEXT,{...t}),T(c.INITIATE_CHECKOUT)}export{I as a,D as b,R as c,h as p}; diff --git a/scripts/__dropins__/storefront-cart/chunks/applyCouponsToCart.js b/scripts/__dropins__/storefront-cart/chunks/applyCouponsToCart.js index 192c99cde3..c075999018 100644 --- a/scripts/__dropins__/storefront-cart/chunks/applyCouponsToCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/applyCouponsToCart.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{s as c,f as T,h as A}from"./resetCart.js";import{C as _,t as i}from"./getStoreConfig.js";import{events as n}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as u}from"../fragments.js";const P=` +import{s as c,f as T,h as A}from"./resetCart.js";import{C as _,t as i}from"./refreshCart.js";import{events as n}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as u}from"../fragments.js";const P=` mutation APPLY_COUPONS_TO_CART_MUTATION( $cartId: String!, $couponCodes: [String!]!, diff --git a/scripts/__dropins__/storefront-cart/chunks/getEstimatedTotals.js b/scripts/__dropins__/storefront-cart/chunks/getEstimatedTotals.js index 8013052868..253c784111 100644 --- a/scripts/__dropins__/storefront-cart/chunks/getEstimatedTotals.js +++ b/scripts/__dropins__/storefront-cart/chunks/getEstimatedTotals.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{s as h,f as T,h as m}from"./resetCart.js";import{C as A,t as E}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{CART_FRAGMENT as I}from"../fragments.js";const u=` +import{s as h,f as T,h as m}from"./resetCart.js";import{C as A,t as E}from"./refreshCart.js";import"@dropins/tools/event-bus.js";import{CART_FRAGMENT as I}from"../fragments.js";const u=` mutation GET_ESTIMATED_TOTALS_MUTATION( $cartId: String! $address: EstimateAddressInput!, diff --git a/scripts/__dropins__/storefront-cart/chunks/getStoreConfig.js b/scripts/__dropins__/storefront-cart/chunks/getStoreConfig.js deleted file mode 100644 index b56c384455..0000000000 --- a/scripts/__dropins__/storefront-cart/chunks/getStoreConfig.js +++ /dev/null @@ -1,84 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{events as p}from"@dropins/tools/event-bus.js";import{s,d as w,f,h as d}from"./resetCart.js";import{Initializer as G,merge as M}from"@dropins/tools/lib.js";import{CART_FRAGMENT as h}from"../fragments.js";import{a as N}from"./persisted-data.js";const A=new G({init:async r=>{const t={disableGuestCart:!1,...r};A.config.setConfig(t),m().catch(console.error)},listeners:()=>[p.on("authenticated",r=>{s.authenticated&&!r?p.emit("cart/reset",void 0):r&&!s.authenticated&&(s.authenticated=r,m().catch(console.error))},{eager:!0}),p.on("locale",async r=>{r!==s.locale&&(s.locale=r,m().catch(console.error))}),p.on("cart/reset",()=>{w().catch(console.error),p.emit("cart/data",null)}),p.on("cart/data",r=>{N(r)})]}),R=A.config;function I(r){var n,e,c,u,i,l,o,a,_,g;if(!r)return null;const t={id:r.id,totalQuantity:z(r),errors:U(r==null?void 0:r.itemsV2),items:E(r==null?void 0:r.itemsV2),miniCartMaxItems:E(r==null?void 0:r.itemsV2).slice(0,((n=s.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency},excludingTax:{value:r.prices.grand_total_excluding_tax.value,currency:r.prices.grand_total_excluding_tax.currency}},discount:S(r.prices.discounts,r.prices.grand_total.currency),subtotal:{excludingTax:{value:(e=r.prices.subtotal_excluding_tax)==null?void 0:e.value,currency:(c=r.prices.subtotal_excluding_tax)==null?void 0:c.currency},includingTax:{value:(u=r.prices.subtotal_including_tax)==null?void 0:u.value,currency:(i=r.prices.subtotal_including_tax)==null?void 0:i.currency},includingDiscountOnly:{value:(l=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:l.value,currency:(o=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:o.currency}},appliedTaxes:O(r.prices.applied_taxes),totalTax:S(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:O(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&$(r)},isGuestCart:!s.authenticated,hasOutOfStockItems:Q(r),hasFullyOutOfStockItems:L(r),appliedCoupons:r.applied_coupons};return M(t,(g=(_=(a=R.getConfig().models)==null?void 0:a.CartModel)==null?void 0:_.transformer)==null?void 0:g.call(_,r))}function S(r,t){return r!=null&&r.length?r.reduce((n,e)=>({value:n.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:t}):{value:0,currency:t}}function E(r){var n;if(!((n=r==null?void 0:r.items)!=null&&n.length))return[];const t=s.config;return r.items.map(e=>{var c,u,i,l,o,a,_,g,x,v,T;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(y=>y.url_key)},quantity:e.quantity,sku:e.product.sku,name:e.product.name,image:{src:t!=null&&t.useConfigurableParentThumbnail?e.product.thumbnail.url:((u=(c=e.configured_variant)==null?void 0:c.thumbnail)==null?void 0:u.url)||e.product.thumbnail.url,alt:t!=null&&t.useConfigurableParentThumbnail?e.product.thumbnail.label:((l=(i=e.configured_variant)==null?void 0:i.thumbnail)==null?void 0:l.label)||e.product.thumbnail.label},price:{value:e.prices.price.value,currency:e.prices.price.currency},taxedPrice:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},fixedProductTaxes:e.prices.fixed_product_taxes,rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency},links:F(e.links),total:e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.row_total.value,currency:e.prices.row_total.currency}:{value:(o=e.prices.original_row_total)==null?void 0:o.value,currency:(a=e.prices.original_row_total)==null?void 0:a.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency,label:(_=e.prices.discounts)==null?void 0:_.map(y=>y.label)},regularPrice:B(e),discounted:e.__typename==="BundleCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0?!1:e.__typename==="ConfigurableCartItem"?((x=(g=e.configured_variant)==null?void 0:g.price_range)==null?void 0:x.maximum_price.discount.amount_off)>0:((v=e.product.price_range)==null?void 0:v.maximum_price.discount.amount_off)>0,bundleOptions:e.__typename==="BundleCartItem"?D(e.bundle_options):null,selectedOptions:k(e.configurable_options),customizableOptions:P(e.customizable_options),sender:e.__typename==="GiftCardCartItem"?e.sender_name:null,senderEmail:e.__typename==="GiftCardCartItem"?e.sender_email:null,recipient:e.__typename==="GiftCardCartItem"?e.recipient_name:null,recipientEmail:e.__typename==="GiftCardCartItem"?e.recipient_email:null,message:e.__typename==="GiftCardCartItem"?e.message:null,discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},onlyXLeftInStock:e.__typename==="ConfigurableCartItem"?(T=e.configured_variant)==null?void 0:T.only_x_left_in_stock:e.product.only_x_left_in_stock,lowInventory:e.is_available&&e.product.only_x_left_in_stock!==null,insufficientQuantity:(e.__typename==="ConfigurableCartItem"?e.configured_variant:e.product).stock_status==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockLevel:q(e),discountPercentage:V(e),savingsAmount:X(e),productAttributes:K(e)}})}function U(r){var n;const t=(n=r==null?void 0:r.items)==null?void 0:n.reduce((e,c)=>{var u;return(u=c.errors)==null||u.forEach(i=>{e.push({uid:c.uid,text:i.message})}),e},[]);return t!=null&&t.length?t:null}function O(r){return r!=null&&r.length?r.map(t=>({amount:{value:t.amount.value,currency:t.amount.currency},label:t.label,coupon:t.coupon})):[]}function D(r){const t=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(c=>c.label).join(", ")})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function k(r){const t=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function P(r){const t=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(c=>({uid:c.customizable_option_value_uid,label:c.label,value:c.value}))})),n={};return t==null||t.forEach(e=>{var c;switch(e.type){case"field":case"area":case"date_time":n[e.label]=e.values[0].value;break;case"radio":case"drop_down":n[e.label]=e.values[0].label;break;case"multiple":case"checkbox":n[e.label]=e.values.reduce((a,_)=>a?`${a}, ${_.label}`:_.label,"");break;case"file":const u=new DOMParser,i=e.values[0].value,o=((c=u.parseFromString(i,"text/html").querySelector("a"))==null?void 0:c.textContent)||"";n[e.label]=o;break}}),n}function z(r){var t,n;return((t=s.config)==null?void 0:t.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((n=s.config)==null?void 0:n.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function F(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(t=>t.title).join(", ")}:null}function $(r){var t,n,e,c;return(t=r.shipping_addresses)!=null&&t.length?(n=r.shipping_addresses)==null?void 0:n.map(u=>({countryCode:u.country.code,zipCode:u.postcode,regionCode:u.region.code})):(e=r.addresses)!=null&&e.length?(c=r.addresses)==null?void 0:c.filter(u=>u.default_shipping).map(u=>{var i;return u.default_shipping&&{countryCode:u.country_id,zipCode:u.postcode,regionCode:(i=u.region)==null?void 0:i.region_code}}):null}function Q(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function q(r){if(!r.not_available_message)return null;const t=r.not_available_message.match(/-?\d+/);return t?parseInt(t[0]):"noNumber"}function L(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"})}function V(r){var n,e,c,u,i,l,o,a;let t;if(r.__typename==="ConfigurableCartItem")t=(u=(c=(e=(n=r==null?void 0:r.configured_variant)==null?void 0:n.price_range)==null?void 0:e.maximum_price)==null?void 0:c.discount)==null?void 0:u.percent_off;else{if(r.__typename==="BundleCartItem")return;t=(a=(o=(l=(i=r==null?void 0:r.product)==null?void 0:i.price_range)==null?void 0:l.maximum_price)==null?void 0:o.discount)==null?void 0:a.percent_off}if(t!==0)return Math.round(t)}function X(r){var e,c,u,i,l,o;let t,n;if(t=((c=(e=r==null?void 0:r.prices)==null?void 0:e.original_row_total)==null?void 0:c.value)-((i=(u=r==null?void 0:r.prices)==null?void 0:u.row_total)==null?void 0:i.value),n=(o=(l=r==null?void 0:r.prices)==null?void 0:l.row_total)==null?void 0:o.currency,t!==0)return{value:t,currency:n}}function B(r){var t,n,e,c,u,i;switch(r.__typename){case"ConfigurableCartItem":return{value:(n=(t=r.configured_variant)==null?void 0:t.price_range)==null?void 0:n.maximum_price.regular_price.value,currency:(c=(e=r.configured_variant)==null?void 0:e.price_range)==null?void 0:c.maximum_price.regular_price.currency};case"GiftCardCartItem":case"BundleCartItem":return{value:r.prices.price.value,currency:r.prices.price.currency};case"SimpleCartItem":if(r.customizable_options.length!==0)return{value:r.prices.price.value,currency:r.prices.price.currency};default:return{value:(u=r.product.price_range)==null?void 0:u.maximum_price.regular_price.value,currency:(i=r.product.price_range)==null?void 0:i.maximum_price.regular_price.currency}}}function K(r){var t,n,e;return(e=(n=(t=r==null?void 0:r.product)==null?void 0:t.custom_attributesV2)==null?void 0:n.items)==null?void 0:e.map(c=>{const u=c.code.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ");return{...c,code:u}})}function Y(r){if(!r)return null;const t=n=>{switch(n){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}};return{displayMiniCart:r.minicart_display,miniCartMaxItemsDisplay:r.minicart_max_items,cartExpiresInDays:r.cart_expires_in_days,cartSummaryDisplayTotal:r.cart_summary_display_quantity,cartSummaryMaxItems:r.max_items_in_order_summary,defaultCountry:r.default_country,categoryFixedProductTaxDisplaySetting:r.category_fixed_product_tax_display_setting,productFixedProductTaxDisplaySetting:r.product_fixed_product_tax_display_setting,salesFixedProductTaxDisplaySetting:r.sales_fixed_product_tax_display_setting,shoppingCartDisplaySetting:{zeroTax:r.shopping_cart_display_zero_tax,subtotal:t(r.shopping_cart_display_subtotal),price:t(r.shopping_cart_display_price),shipping:t(r.shopping_cart_display_shipping),fullSummary:r.shopping_cart_display_full_summary,grandTotal:r.shopping_cart_display_grand_total,taxGiftWrapping:r.shopping_cart_display_tax_gift_wrapping},useConfigurableParentThumbnail:r.configurable_thumbnail_source==="parent"}}const b=` - $pageSize: Int! = 100, - $currentPage: Int! = 1, - $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC} -`,j=` -fragment CUSTOMER_FRAGMENT on Customer { - addresses { - default_shipping - country_id - postcode - region { - region - region_code - region_id - } - } -}`,H=` - query GUEST_CART_QUERY( - $cartId: String!, - ${b} - ) { - - cart(cart_id: $cartId){ - ...CART_FRAGMENT - } - } - - ${h} -`,W=` - query CUSTOMER_CART_QUERY( - ${b} - ) { - - customer { - ...CUSTOMER_FRAGMENT - } - - cart: customerCart { - ...CART_FRAGMENT - } - } - - ${j} - ${h} -`,C=async()=>{const r=s.authenticated,t=s.cartId;if(r)return f(W,{method:"POST"}).then(({errors:n,data:e})=>{if(n)return d(n);const c={...e.cart,...e.customer};return I(c)});if(!t)throw new Error("No cart ID found");return f(H,{method:"POST",cache:"no-cache",variables:{cartId:t}}).then(({errors:n,data:e})=>n?d(n):I(e.cart))},J=` - mutation MERGE_CARTS_MUTATION( - $guestCartId: String!, - $customerCartId: String!, - ${b} - ) { - mergeCarts( - source_cart_id: $guestCartId, - destination_cart_id: $customerCartId - ) { - ...CART_FRAGMENT - } - } - - ${h} -`,m=async()=>{if(s.initializing)return null;s.initializing=!0,s.config||(s.config=await tr());const r=s.authenticated?await Z():await rr();return p.emit("cart/initialized",r),p.emit("cart/data",r),s.initializing=!1,r};async function Z(){const r=s.cartId,t=await C();return t?(s.cartId=t.id,!r||t.id===r?t:await f(J,{variables:{guestCartId:r,customerCartId:t.id}}).then(()=>C()).then(n=>{const e={oldCartItems:t.items,newCart:n};return p.emit("cart/merged",e),n}).catch(()=>(console.error("Could not merge carts"),t))):null}async function rr(){if(R.getConfig().disableGuestCart===!0||!s.cartId)return null;try{return await C()}catch(r){return console.error(r),null}}const er=` -query STORE_CONFIG_QUERY { - storeConfig { - minicart_display - minicart_max_items - cart_expires_in_days - cart_summary_display_quantity - max_items_in_order_summary - default_country - category_fixed_product_tax_display_setting - product_fixed_product_tax_display_setting - sales_fixed_product_tax_display_setting - shopping_cart_display_full_summary - shopping_cart_display_grand_total - shopping_cart_display_price - shopping_cart_display_shipping - shopping_cart_display_subtotal - shopping_cart_display_tax_gift_wrapping - shopping_cart_display_zero_tax - configurable_thumbnail_source - } -} -`,tr=async()=>f(er,{method:"GET",cache:"force-cache"}).then(({errors:r,data:t})=>r?d(r):Y(t.storeConfig));export{b as C,rr as a,C as b,R as c,m as d,tr as e,Z as g,A as i,I as t}; diff --git a/scripts/__dropins__/storefront-cart/chunks/refreshCart.js b/scripts/__dropins__/storefront-cart/chunks/refreshCart.js new file mode 100644 index 0000000000..55168d3d2a --- /dev/null +++ b/scripts/__dropins__/storefront-cart/chunks/refreshCart.js @@ -0,0 +1,84 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{s as i,d as A,f as g,h as y}from"./resetCart.js";import{events as l}from"@dropins/tools/event-bus.js";import{Initializer as R,merge as w}from"@dropins/tools/lib.js";import{a as G}from"./persisted-data.js";import{CART_FRAGMENT as d}from"../fragments.js";const I=new R({init:async r=>{const t={disableGuestCart:!1,...r};I.config.setConfig(t),f().catch(console.error)},listeners:()=>[l.on("authenticated",r=>{i.authenticated&&!r?l.emit("cart/reset",void 0):r&&!i.authenticated&&(i.authenticated=r,f().catch(console.error))},{eager:!0}),l.on("locale",async r=>{r!==i.locale&&(i.locale=r,f().catch(console.error))}),l.on("cart/reset",()=>{A().catch(console.error),l.emit("cart/data",null)}),l.on("cart/data",r=>{G(r)}),l.on("checkout/updated",r=>{r&&tr().catch(console.error)})]}),S=I.config;function b(r){var n,e,c,u,s,a,o,_,p,h;if(!r)return null;const t={id:r.id,totalQuantity:z(r),totalUniqueItems:r.itemsV2.items.length,errors:D(r==null?void 0:r.itemsV2),items:v(r==null?void 0:r.itemsV2),miniCartMaxItems:v(r==null?void 0:r.itemsV2).slice(0,((n=i.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency},excludingTax:{value:r.prices.grand_total_excluding_tax.value,currency:r.prices.grand_total_excluding_tax.currency}},discount:x(r.prices.discounts,r.prices.grand_total.currency),subtotal:{excludingTax:{value:(e=r.prices.subtotal_excluding_tax)==null?void 0:e.value,currency:(c=r.prices.subtotal_excluding_tax)==null?void 0:c.currency},includingTax:{value:(u=r.prices.subtotal_including_tax)==null?void 0:u.value,currency:(s=r.prices.subtotal_including_tax)==null?void 0:s.currency},includingDiscountOnly:{value:(a=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:a.value,currency:(o=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:o.currency}},appliedTaxes:T(r.prices.applied_taxes),totalTax:x(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:T(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&Q(r)},isGuestCart:!i.authenticated,hasOutOfStockItems:q(r),hasFullyOutOfStockItems:V(r),appliedCoupons:r.applied_coupons};return w(t,(h=(p=(_=S.getConfig().models)==null?void 0:_.CartModel)==null?void 0:p.transformer)==null?void 0:h.call(p,r))}function x(r,t){return r!=null&&r.length?r.reduce((n,e)=>({value:n.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:t}):{value:0,currency:t}}function k(r,t){var n,e,c,u;return{src:r!=null&&r.useConfigurableParentThumbnail?t.product.thumbnail.url:((e=(n=t.configured_variant)==null?void 0:n.thumbnail)==null?void 0:e.url)||t.product.thumbnail.url,alt:r!=null&&r.useConfigurableParentThumbnail?t.product.thumbnail.label:((u=(c=t.configured_variant)==null?void 0:c.thumbnail)==null?void 0:u.label)||t.product.thumbnail.label}}function U(r){var t,n,e,c;return r.__typename==="ConfigurableCartItem"?{value:(n=(t=r.configured_variant)==null?void 0:t.price_range)==null?void 0:n.maximum_price.regular_price.value,currency:(c=(e=r.configured_variant)==null?void 0:e.price_range)==null?void 0:c.maximum_price.regular_price.currency}:r.__typename==="GiftCardCartItem"?{value:r.prices.price.value,currency:r.prices.price.currency}:{value:r.prices.original_item_price.value,currency:r.prices.original_item_price.currency}}function M(r){var t,n,e;return r.__typename==="ConfigurableCartItem"?((n=(t=r.configured_variant)==null?void 0:t.price_range)==null?void 0:n.maximum_price.discount.amount_off)>0:((e=r.product.price_range)==null?void 0:e.maximum_price.discount.amount_off)>0}function v(r){var n;if(!((n=r==null?void 0:r.items)!=null&&n.length))return[];const t=i.config;return r.items.map(e=>{var c,u,s,a;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(o=>o.url_key)},canonicalUrl:e.product.canonical_url,categories:e.product.categories.map(o=>o.name),quantity:e.quantity,sku:K(e),topLevelSku:e.product.sku,name:e.product.name,image:k(t,e),price:{value:e.prices.price.value,currency:e.prices.price.currency},taxedPrice:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},fixedProductTaxes:e.prices.fixed_product_taxes,rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency},links:$(e.links),total:{value:(c=e.prices.original_row_total)==null?void 0:c.value,currency:(u=e.prices.original_row_total)==null?void 0:u.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency,label:(s=e.prices.discounts)==null?void 0:s.map(o=>o.label)},regularPrice:U(e),discounted:M(e),bundleOptions:e.__typename==="BundleCartItem"?N(e.bundle_options):null,selectedOptions:P(e.configurable_options),customizableOptions:F(e.customizable_options),sender:e.__typename==="GiftCardCartItem"?e.sender_name:null,senderEmail:e.__typename==="GiftCardCartItem"?e.sender_email:null,recipient:e.__typename==="GiftCardCartItem"?e.recipient_name:null,recipientEmail:e.__typename==="GiftCardCartItem"?e.recipient_email:null,message:e.__typename==="GiftCardCartItem"?e.message:null,discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},onlyXLeftInStock:e.__typename==="ConfigurableCartItem"?(a=e.configured_variant)==null?void 0:a.only_x_left_in_stock:e.product.only_x_left_in_stock,lowInventory:e.is_available&&e.product.only_x_left_in_stock!==null,insufficientQuantity:(e.__typename==="ConfigurableCartItem"?e.configured_variant:e.product).stock_status==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockLevel:L(e),discountPercentage:X(e),savingsAmount:Y(e),productAttributes:j(e)}})}function D(r){var n;const t=(n=r==null?void 0:r.items)==null?void 0:n.reduce((e,c)=>{var u;return(u=c.errors)==null||u.forEach(s=>{e.push({uid:c.uid,text:s.message})}),e},[]);return t!=null&&t.length?t:null}function T(r){return r!=null&&r.length?r.map(t=>({amount:{value:t.amount.value,currency:t.amount.currency},label:t.label,coupon:t.coupon})):[]}function N(r){const t=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(c=>c.label).join(", ")})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function P(r){const t=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function F(r){const t=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(c=>({uid:c.customizable_option_value_uid,label:c.label,value:c.value}))})),n={};return t==null||t.forEach(e=>{var c;switch(e.type){case"field":case"area":case"date_time":n[e.label]=e.values[0].value;break;case"radio":case"drop_down":n[e.label]=e.values[0].label;break;case"multiple":case"checkbox":n[e.label]=e.values.reduce((_,p)=>_?`${_}, ${p.label}`:p.label,"");break;case"file":const u=new DOMParser,s=e.values[0].value,o=((c=u.parseFromString(s,"text/html").querySelector("a"))==null?void 0:c.textContent)||"";n[e.label]=o;break}}),n}function z(r){var t,n;return((t=i.config)==null?void 0:t.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((n=i.config)==null?void 0:n.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function $(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(t=>t.title).join(", ")}:null}function Q(r){var t,n,e,c;return(t=r.shipping_addresses)!=null&&t.length?(n=r.shipping_addresses)==null?void 0:n.map(u=>({countryCode:u.country.code,zipCode:u.postcode,regionCode:u.region.code})):(e=r.addresses)!=null&&e.length?(c=r.addresses)==null?void 0:c.filter(u=>u.default_shipping).map(u=>{var s;return u.default_shipping&&{countryCode:u.country_code,zipCode:u.postcode,regionCode:(s=u.region)==null?void 0:s.region_code}}):null}function q(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function L(r){if(!r.not_available_message)return null;const t=r.not_available_message.match(/-?\d+/);return t?parseInt(t[0]):"noNumber"}function V(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"})}function X(r){var n,e,c,u,s,a,o,_;let t;if(r.__typename==="ConfigurableCartItem")t=(u=(c=(e=(n=r==null?void 0:r.configured_variant)==null?void 0:n.price_range)==null?void 0:e.maximum_price)==null?void 0:c.discount)==null?void 0:u.percent_off;else{if(r.__typename==="BundleCartItem")return;t=(_=(o=(a=(s=r==null?void 0:r.product)==null?void 0:s.price_range)==null?void 0:a.maximum_price)==null?void 0:o.discount)==null?void 0:_.percent_off}if(t!==0)return Math.round(t)}function K(r){var t;return r.__typename==="ConfigurableCartItem"?r.configured_variant.sku:((t=r.product)==null?void 0:t.variantSku)||r.product.sku}function Y(r){var e,c,u,s,a,o;let t,n;if(t=((c=(e=r==null?void 0:r.prices)==null?void 0:e.original_row_total)==null?void 0:c.value)-((s=(u=r==null?void 0:r.prices)==null?void 0:u.row_total)==null?void 0:s.value),n=(o=(a=r==null?void 0:r.prices)==null?void 0:a.row_total)==null?void 0:o.currency,t!==0)return{value:t,currency:n}}function j(r){var t,n,e;return(e=(n=(t=r==null?void 0:r.product)==null?void 0:t.custom_attributesV2)==null?void 0:n.items)==null?void 0:e.map(c=>{const u=c.code.split("_").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ");return{...c,code:u}})}function B(r){if(!r)return null;const t=n=>{switch(n){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}};return{displayMiniCart:r.minicart_display,miniCartMaxItemsDisplay:r.minicart_max_items,cartExpiresInDays:r.cart_expires_in_days,cartSummaryDisplayTotal:r.cart_summary_display_quantity,cartSummaryMaxItems:r.max_items_in_order_summary,defaultCountry:r.default_country,categoryFixedProductTaxDisplaySetting:r.category_fixed_product_tax_display_setting,productFixedProductTaxDisplaySetting:r.product_fixed_product_tax_display_setting,salesFixedProductTaxDisplaySetting:r.sales_fixed_product_tax_display_setting,shoppingCartDisplaySetting:{zeroTax:r.shopping_cart_display_zero_tax,subtotal:t(r.shopping_cart_display_subtotal),price:t(r.shopping_cart_display_price),shipping:t(r.shopping_cart_display_shipping),fullSummary:r.shopping_cart_display_full_summary,grandTotal:r.shopping_cart_display_grand_total,taxGiftWrapping:r.shopping_cart_display_tax_gift_wrapping},useConfigurableParentThumbnail:r.configurable_thumbnail_source==="parent"}}const C=` + $pageSize: Int! = 100, + $currentPage: Int! = 1, + $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC} +`,H=` +fragment CUSTOMER_FRAGMENT on Customer { + addresses { + default_shipping + country_code + postcode + region { + region + region_code + region_id + } + } +}`,W=` + query GUEST_CART_QUERY( + $cartId: String!, + ${C} + ) { + + cart(cart_id: $cartId){ + ...CART_FRAGMENT + } + } + + ${d} +`,J=` + query CUSTOMER_CART_QUERY( + ${C} + ) { + + customer { + ...CUSTOMER_FRAGMENT + } + + cart: customerCart { + ...CART_FRAGMENT + } + } + + ${H} + ${d} +`,m=async()=>{const r=i.authenticated,t=i.cartId;if(r)return g(J,{method:"POST"}).then(({errors:n,data:e})=>{if(n)return y(n);const c={...e.cart,...e.customer};return b(c)});if(!t)throw new Error("No cart ID found");return g(W,{method:"POST",cache:"no-cache",variables:{cartId:t}}).then(({errors:n,data:e})=>n?y(n):b(e.cart))},Z=` + mutation MERGE_CARTS_MUTATION( + $guestCartId: String!, + $customerCartId: String!, + ${C} + ) { + mergeCarts( + source_cart_id: $guestCartId, + destination_cart_id: $customerCartId + ) { + ...CART_FRAGMENT + } + } + + ${d} +`,f=async()=>{if(i.initializing)return null;i.initializing=!0,i.config||(i.config=await er());const r=i.authenticated?await E():await O();return l.emit("cart/initialized",r),l.emit("cart/data",r),i.initializing=!1,r};async function E(){const r=i.cartId,t=await m();return t?(i.cartId=t.id,!r||t.id===r?t:await g(Z,{variables:{guestCartId:r,customerCartId:t.id}}).then(()=>m()).then(n=>{const e={oldCartItems:t.items,newCart:n};return l.emit("cart/merged",e),n}).catch(()=>(console.error("Could not merge carts"),t))):null}async function O(){if(S.getConfig().disableGuestCart===!0||!i.cartId)return null;try{return await m()}catch(r){return console.error(r),null}}const rr=` +query STORE_CONFIG_QUERY { + storeConfig { + minicart_display + minicart_max_items + cart_expires_in_days + cart_summary_display_quantity + max_items_in_order_summary + default_country + category_fixed_product_tax_display_setting + product_fixed_product_tax_display_setting + sales_fixed_product_tax_display_setting + shopping_cart_display_full_summary + shopping_cart_display_grand_total + shopping_cart_display_price + shopping_cart_display_shipping + shopping_cart_display_subtotal + shopping_cart_display_tax_gift_wrapping + shopping_cart_display_zero_tax + configurable_thumbnail_source + } +} +`,er=async()=>g(rr,{method:"GET",cache:"force-cache"}).then(({errors:r,data:t})=>r?y(r):B(t.storeConfig)),tr=async()=>{const r=i.authenticated?await E():await O();return l.emit("cart/data",r),r};export{C,f as a,E as b,S as c,O as d,er as e,m as g,I as i,tr as r,b as t}; diff --git a/scripts/__dropins__/storefront-cart/chunks/updateProductsFromCart.js b/scripts/__dropins__/storefront-cart/chunks/updateProductsFromCart.js index 95ee2d89ad..d72fa88ae3 100644 --- a/scripts/__dropins__/storefront-cart/chunks/updateProductsFromCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/updateProductsFromCart.js @@ -1,10 +1,10 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{s as m,f as i,h as p}from"./resetCart.js";import{C as T,t as _}from"./getStoreConfig.js";import{events as n}from"@dropins/tools/event-bus.js";import{p as I}from"./acdl.js";import{CART_FRAGMENT as u}from"../fragments.js";const C=` +import{s as m,f as i,h as T}from"./resetCart.js";import{C as _,t as p}from"./refreshCart.js";import{events as n}from"@dropins/tools/event-bus.js";import{a as I}from"./acdl.js";import{CART_FRAGMENT as u}from"../fragments.js";const C=` mutation UPDATE_PRODUCTS_FROM_CART_MUTATION( $cartId: String!, $cartItems: [CartItemUpdateInput!]!, - ${T} + ${_} ) { updateCartItems( input: { @@ -20,4 +20,4 @@ import{s as m,f as i,h as p}from"./resetCart.js";import{C as T,t as _}from"./get } ${u} -`,h=async e=>{const s=m.cartId;if(!s)throw Error("Cart ID is not set");return i(C,{variables:{cartId:s,cartItems:e.map(({uid:a,quantity:t})=>({cart_item_uid:a,quantity:t}))}}).then(({errors:a,data:t})=>{var c;const o=[...((c=t==null?void 0:t.addProductsToCart)==null?void 0:c.user_errors)??[],...a??[]];if(o.length>0)return p(o);const r=_(t.updateCartItems.cart);return n.emit("cart/updated",r),n.emit("cart/data",r),r&&I(r,e,m.locale??"en-US"),r})};export{h as u}; +`,h=async e=>{const s=m.cartId;if(!s)throw Error("Cart ID is not set");return i(C,{variables:{cartId:s,cartItems:e.map(({uid:a,quantity:t})=>({cart_item_uid:a,quantity:t}))}}).then(({errors:a,data:t})=>{var c;const o=[...((c=t==null?void 0:t.addProductsToCart)==null?void 0:c.user_errors)??[],...a??[]];if(o.length>0)return T(o);const r=p(t.updateCartItems.cart);return n.emit("cart/updated",r),n.emit("cart/data",r),r&&I(r,e,m.locale??"en-US"),r})};export{h as u}; diff --git a/scripts/__dropins__/storefront-cart/components/Cart/Cart.d.ts b/scripts/__dropins__/storefront-cart/components/Cart/Cart.d.ts deleted file mode 100644 index ddd72b540d..0000000000 --- a/scripts/__dropins__/storefront-cart/components/Cart/Cart.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { FunctionComponent, VNode } from 'preact'; -import { HTMLAttributes } from 'preact/compat'; - -export interface CartProps extends HTMLAttributes { - empty?: boolean; - products?: VNode; - orderSummary?: VNode>; -} -export declare const Cart: FunctionComponent; -//# sourceMappingURL=Cart.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/components/Cart/index.d.ts b/scripts/__dropins__/storefront-cart/components/Cart/index.d.ts deleted file mode 100644 index 69ebaaa1bb..0000000000 --- a/scripts/__dropins__/storefront-cart/components/Cart/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************** - * ADOBE CONFIDENTIAL - * __________________ - * - * Copyright 2024 Adobe - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - *******************************************************************/ -export * from './Cart'; -export { Cart as default } from './Cart'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/components/index.d.ts b/scripts/__dropins__/storefront-cart/components/index.d.ts index c4284f2cc2..f7b8e06766 100644 --- a/scripts/__dropins__/storefront-cart/components/index.d.ts +++ b/scripts/__dropins__/storefront-cart/components/index.d.ts @@ -14,7 +14,6 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ -export * from './Cart'; export * from './EmptyCart'; export * from './EstimateShipping'; export * from './MiniCart'; diff --git a/scripts/__dropins__/storefront-cart/containers/Cart.d.ts b/scripts/__dropins__/storefront-cart/containers/Cart.d.ts deleted file mode 100644 index 57ec9f38a6..0000000000 --- a/scripts/__dropins__/storefront-cart/containers/Cart.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './Cart/index' -import _default from './Cart/index' -export default _default diff --git a/scripts/__dropins__/storefront-cart/containers/Cart.js b/scripts/__dropins__/storefront-cart/containers/Cart.js deleted file mode 100644 index 4e8f4cf509..0000000000 --- a/scripts/__dropins__/storefront-cart/containers/Cart.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{C as w,C as y}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/ChevronDown.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/Coupon.js";export{w as Cart,y as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/Cart/Cart.d.ts b/scripts/__dropins__/storefront-cart/containers/Cart/Cart.d.ts deleted file mode 100644 index b17426dfb0..0000000000 --- a/scripts/__dropins__/storefront-cart/containers/Cart/Cart.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { HTMLAttributes } from 'preact/compat'; -import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib'; -import { CartModel } from '../../data/models'; - -type DefaultSlotContext = { - hasErrors: boolean; - data: CartModel | null; -}; -export interface CartProps extends HTMLAttributes { - routeEmptyCartCTA?: () => string; - routeProduct?: (item: CartModel['items'][0]) => string; - slots?: { - OrderSummary?: SlotProps; - ProductList?: SlotProps; - }; - showDiscount?: boolean; - showSavings?: boolean; - quantityType?: 'stepper' | 'dropdown'; - dropdownOptions?: { - value: string; - text: string; - }[]; -} -export declare const Cart: Container; -export {}; -//# sourceMappingURL=Cart.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/containers/Cart/index.d.ts b/scripts/__dropins__/storefront-cart/containers/Cart/index.d.ts deleted file mode 100644 index 69ebaaa1bb..0000000000 --- a/scripts/__dropins__/storefront-cart/containers/Cart/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************** - * ADOBE CONFIDENTIAL - * __________________ - * - * Copyright 2024 Adobe - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - *******************************************************************/ -export * from './Cart'; -export { Cart as default } from './Cart'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js b/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js index 1b9b35546f..bf117fe486 100644 --- a/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js +++ b/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{C as s,C as u}from"../chunks/CartSummaryGrid.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";export{s as CartSummaryGrid,u as default}; +import{C as s,C as u}from"../chunks/CartSummaryGrid.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"../chunks/EmptyCart.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";export{s as CartSummaryGrid,u as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js b/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js index 93c416f0d0..42a9d3b180 100644 --- a/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js +++ b/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{C as b,C as c}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/ChevronDown.js";export{b as CartSummaryList,c as default}; +import{C as b,C as c}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/updateProductsFromCart.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/ChevronDown.js";export{b as CartSummaryList,c as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/Coupons.js b/scripts/__dropins__/storefront-cart/containers/Coupons.js index 0a286e5d71..ec3e78f737 100644 --- a/scripts/__dropins__/storefront-cart/containers/Coupons.js +++ b/scripts/__dropins__/storefront-cart/containers/Coupons.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as o,jsxs as _}from"@dropins/tools/preact-jsx-runtime.js";import*as n from"@dropins/tools/preact-compat.js";import{useRef as B,useState as E,useEffect as A}from"@dropins/tools/preact-compat.js";import{classes as c,VComponent as w,getFormValues as P}from"@dropins/tools/lib.js";/* empty css */import{Accordion as I,AccordionSection as M,Button as k,Icon as b,Input as R}from"@dropins/tools/components.js";import{S as T}from"../chunks/Coupon.js";import{useText as N}from"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import{events as j}from"@dropins/tools/event-bus.js";import{a as L,A as x}from"../chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/getStoreConfig.js";import"../fragments.js";const z=a=>n.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...a},n.createElement("g",{id:"Large"},n.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),n.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),q=a=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),D=a=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},n.createElement("path",{d:"M17.3332 11.75H6.6665",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",fill:"none",stroke:"currentColor"})),V=({className:a,children:y,couponCodeField:f,applyCouponsButton:d,appliedCoupons:p,error:h,onApplyCoupon:l,...u})=>{const r=B(null),g=N({couponTitle:"Cart.PriceSummary.coupon.title"}),C=v=>{var t;v.preventDefault();const S=P(r.current);l==null||l(S);const e=(t=r==null?void 0:r.current)==null?void 0:t.querySelector("input");e&&(e.value="")};return o("div",{...u,"data-testid":"cart-coupons",className:c(["cart-coupons",a]),children:o(I,{"data-testid":"coupon-code",className:c(["cart-coupons__accordion"]),actionIconPosition:"right",iconOpen:z,iconClose:D,children:_(M,{title:g.couponTitle,iconLeft:T,showIconLeft:!0,renderContentWhenClosed:!1,"data-testid":"coupon-code-accordion-section",className:c(["cart-coupons__accordion-section"]),children:[o("form",{"data-testid":"coupon-code-form",className:c(["coupon-code-form--edit"]),ref:r,children:_("div",{className:c(["coupon-code-form__action"]),children:[f&&o(w,{node:f,className:c(["coupon-code-form__codes"])}),d&&o(w,{node:d,className:c(["coupon-code-form--button"]),onClick:C,type:"submit"})]})}),h&&o(w,{node:h,className:c(["coupon-code-form__error"])}),p&&o(w,{node:p,className:c(["coupon-code-form__applied"])})]})})})},oe=({children:a,...y})=>{const[f,d]=E(new Set),[p,h]=E([]),[l,u]=E(new Set),r=N({applyButton:"Cart.PriceSummary.coupon.applyAction",placeholder:"Cart.PriceSummary.coupon.placeholder"}),g=async e=>{const t=e.coupon,s=new Set(f);s.add(t),u(new Set);const i=Array.from(s);L(i,x.REPLACE).then(m=>{if(m===null)throw new Error("Error adding coupon code");d(s)}).catch(m=>{console.warn(m),u(new Set([m.message]))})},C=e=>{const t=new Set(f);t.delete(e),u(new Set);const s=Array.from(t);L(s,x.REPLACE).then(i=>{if(i===null)throw new Error("Error removing coupon code");d(t)}).catch(i=>{console.warn(i),u(new Set([i.message]))})};A(()=>{const e=j.on("cart/data",t=>{const s=t==null?void 0:t.appliedCoupons;if(!s){h([]);return}const i=s.map(m=>m.code);h(i)},{eager:!0});return()=>{e==null||e.off()}},[]),A(()=>{d(new Set(p))},[p]);const v=p.map(e=>o(k,{variant:"tertiary",icon:o(b,{source:q,size:"24"}),onClick:()=>C(e),children:e},e)),S=l.size>0?o("div",{"data-testid":"coupon-code-error",children:Array.from(l)[0]}):void 0;return o(V,{...y,couponCodeField:o(R,{"aria-label":r.placeholder,type:"text",placeholder:r.placeholder,name:"coupon",variant:"primary",value:"","data-testid":"coupon-code-input",maxLength:50,error:l.size>0}),applyCouponsButton:o(k,{variant:"secondary",children:r.applyButton}),error:S,appliedCoupons:o("div",{children:v}),onApplyCoupon:g})};export{oe as Coupons,oe as default}; +import{jsx as o,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import*as n from"@dropins/tools/preact-compat.js";import{useRef as P,useState as E,useEffect as y}from"@dropins/tools/preact-compat.js";import{classes as a,VComponent as w,getFormValues as I}from"@dropins/tools/lib.js";import{Accordion as M,AccordionSection as b,Button as k,Icon as R,Input as T}from"@dropins/tools/components.js";/* empty css */import{S as j}from"../chunks/Coupon.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import{events as L}from"@dropins/tools/event-bus.js";import{a as x,A as N}from"../chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/refreshCart.js";import"../fragments.js";const z=s=>n.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...s},n.createElement("g",{id:"Large"},n.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),n.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),q=s=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),D=s=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},n.createElement("path",{d:"M17.3332 11.75H6.6665",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",fill:"none",stroke:"currentColor"})),V=({className:s,children:_,couponCodeField:f,applyCouponsButton:p,appliedCoupons:u,error:h,onApplyCoupon:d,...r})=>{const c=P(null),g=B({couponTitle:"Cart.PriceSummary.coupon.title"}),C=v=>{var t;v.preventDefault();const S=I(c.current);d==null||d(S);const e=(t=c==null?void 0:c.current)==null?void 0:t.querySelector("input");e&&(e.value="")};return o("div",{...r,"data-testid":"cart-coupons",className:a(["cart-coupons",s]),children:o(M,{"data-testid":"coupon-code",className:a(["cart-coupons__accordion"]),actionIconPosition:"right",iconOpen:z,iconClose:D,children:A(b,{title:g.couponTitle,iconLeft:j,showIconLeft:!0,renderContentWhenClosed:!1,"data-testid":"coupon-code-accordion-section",className:a(["cart-coupons__accordion-section"]),children:[o("form",{"data-testid":"coupon-code-form",className:a(["coupon-code-form--edit"]),ref:c,children:A("div",{className:a(["coupon-code-form__action"]),children:[f&&o(w,{node:f,className:a(["coupon-code-form__codes"])}),p&&o(w,{node:p,className:a(["coupon-code-form--button"]),onClick:C,type:"submit"})]})}),h&&o(w,{node:h,className:a(["coupon-code-form__error"])}),u&&o(w,{node:u,className:a(["coupon-code-form__applied"])})]})})})},oe=({children:s,..._})=>{const[f,p]=E(new Set),[u,h]=E([]),[d,r]=E(new Set),c=B({applyButton:"Cart.PriceSummary.coupon.applyAction",placeholder:"Cart.PriceSummary.coupon.placeholder"}),g=async e=>{const t=e.coupon,i=new Set(f);i.add(t),r(new Set);const l=Array.from(i);x(l,N.REPLACE).then(m=>{if(m===null)throw new Error("Error adding coupon code");p(i)}).catch(m=>{console.warn(m),r(new Set([m.message]))})},C=e=>{const t=new Set(f);t.delete(e),r(new Set);const i=Array.from(t);x(i,N.REPLACE).then(l=>{if(l===null)throw new Error("Error removing coupon code");p(t)}).catch(l=>{console.warn(l),r(new Set([l.message]))})};y(()=>{const e=L.on("cart/data",t=>{const i=t==null?void 0:t.appliedCoupons;if(!i){h([]),r(new Set);return}const l=i.map(m=>m.code);h(l),r(new Set)},{eager:!0});return()=>{e==null||e.off()}},[]),y(()=>{p(new Set(u))},[u]),y(()=>{const e=L.on("shipping/estimate",()=>{r(new Set)},{eager:!0});return()=>{e==null||e.off()}},[]);const v=u.map(e=>o(k,{variant:"tertiary",icon:o(R,{source:q,size:"24"}),onClick:()=>C(e),children:e},e)),S=d.size>0?o("div",{"data-testid":"coupon-code-error",children:Array.from(d)[0]}):void 0;return o(V,{..._,couponCodeField:o(T,{"aria-label":c.placeholder,type:"text",placeholder:c.placeholder,name:"coupon",variant:"primary",value:"","data-testid":"coupon-code-input",maxLength:50,error:d.size>0}),applyCouponsButton:o(k,{variant:"secondary",children:c.applyButton}),error:S,appliedCoupons:o("div",{children:v}),onApplyCoupon:g})};export{oe as Coupons,oe as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/EmptyCart.js b/scripts/__dropins__/storefront-cart/containers/EmptyCart.js index 81853340ed..8958c56215 100644 --- a/scripts/__dropins__/storefront-cart/containers/EmptyCart.js +++ b/scripts/__dropins__/storefront-cart/containers/EmptyCart.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";/* empty css */import{E as p}from"../chunks/EmptyCart.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";const E=({routeCTA:t})=>m(p,{ctaLinkURL:t==null?void 0:t()});export{E as EmptyCart,E as default}; +import{jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{E as p}from"../chunks/EmptyCart.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact-compat.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";const E=({routeCTA:t})=>m(p,{ctaLinkURL:t==null?void 0:t()});export{E as EmptyCart,E as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js b/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js index 3a1114ebaf..787650cb4e 100644 --- a/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js +++ b/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as A,jsx as e,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _,VComponent as Z,getFormValues as $}from"@dropins/tools/lib.js";/* empty css */import{Price as U,Picker as w,Input as G,Button as q}from"@dropins/tools/components.js";import{useRef as H,useState as r,useEffect as P,useCallback as J}from"@dropins/tools/preact-compat.js";import{useText as M,Text as N}from"@dropins/tools/i18n.js";import{s as X}from"../chunks/resetCart.js";import{events as B}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/persisted-data.js";import{g as O,a as Q,b as W}from"../chunks/getEstimateShipping.js";import"@dropins/tools/fetch-graphql.js";const Y=({countryField:v,destinationText:D,estimateButton:k,estimated:z,loading:L,onEstimate:l,price:f,priceExcludingTax:F,priceIncludingTax:n,stateField:S,taxExcluded:b,taxIncluded:I,zipField:m})=>{const d=H(null),[T,C]=r(!0),[y,i]=r("zip"),p=M({editZipAction:"Cart.EstimateShipping.editZipAction",destinationLinkAriaLabel:"Cart.EstimateShipping.destinationLinkAriaLabel",shippingLabel:"Cart.EstimateShipping.label",zipPlaceholder:"Cart.EstimateShipping.zipPlaceholder"}),x=a=>{a.preventDefault(),C(E=>!E)},t=a=>{a.preventDefault(),C(!0),i(E=>E==="zip"?"state":"zip")},h=a=>{a.preventDefault(),C(!1);const E=$(d.current);l==null||l(E)};return A("div",{"data-testid":"estimate-shipping",className:_(["cart-estimate-shipping",["cart-estimate-shipping--loading",L]]),children:[e("span",{className:"cart-estimate-shipping__label",children:z?D?A(V,{children:[e(N,{id:"Cart.EstimateShipping.estimatedDestination"}),e("a",{className:"cart-estimate-shippingLink",role:"button",href:"",onClick:x,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&x(a)},tabIndex:0,"aria-label":p.destinationLinkAriaLabel,"data-testid":"shipping-destination-link",children:D})]}):e(N,{id:"Cart.EstimateShipping.estimated"}):e(N,{id:"Cart.EstimateShipping.label"})}),e(Z,{node:f,className:"cart-estimate-shipping__price"}),z&&A(V,{children:[e("div",{className:_(["cart-estimate-shipping__caption"]),children:e("a",{href:"#",className:"cart-estimate-shipping__link",onClick:t,"data-testid":"shipping-alternate-field-link",children:y==="zip"?e(N,{id:"Cart.EstimateShipping.alternateField.state"}):e(N,{id:"Cart.EstimateShipping.alternateField.zip"})})}),A("form",{className:_(["cart-estimate-shipping--edit",["cart-estimate-shipping--hide",!T]]),ref:d,"data-testid":"shipping-estimate-form",children:[v&&e(Z,{node:v,className:_(["cart-estimate-shipping--country"])}),y==="state"?S&&e(Z,{node:S,className:_(["cart-estimate-shipping--state"])}):m&&e(Z,{node:m,className:_(["cart-estimate-shipping--zip"])}),k&&e(Z,{node:k,className:_(["cart-estimate-shipping--action"]),onClick:h,type:"submit"})]})]}),I&&e("div",{"data-testid":"shipping-tax-included",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[n," ",e(N,{id:"Cart.EstimateShipping.withTaxes"})]})}),b?e("div",{"data-testid":"shipping-tax-included-excluded",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[F," ",e(N,{id:"Cart.EstimateShipping.withoutTaxes"})]})}):void 0]})},ee=()=>{const[v,D]=r(!1),[k,z]=r([]),[L,l]=r("US"),[f,F]=r(""),[n,S]=r(""),[b,I]=r([]),[m,d]=r(!1),[T,C]=r(),[y,i]=r(),[p,x]=r(""),[t,h]=r(!1),a=()=>{l("US"),F(""),S(""),C(null),i(null),x(""),h(!1)},E=async u=>{const{shippingCountry:s,shippingState:o="",shippingZip:c=""}=u,K={countryCode:s,postcode:c,region:{region:o}};return D(!0),W(K).then(g=>(g&&(C({amount:g.amount.value,currency:g.amount.currency,priceIncludingtax:{amount:g.price_incl_tax.value,currency:g.price_incl_tax.currency},priceExcludingtax:{amount:g.price_excl_tax.value,currency:g.price_excl_tax.currency}}),i({carrier_code:g.carrier_code,method_code:g.method_code}),l(s),F(o),S(c),x(o||c||s),h(!0)),l(s),F(o),S(c),x(o||c||s),g)).finally(()=>{D(!1)})},R=u=>{u.preventDefault(),F(""),S("");const s=u.target.value;l(s)};return P(()=>{O().then(u=>{let s="US";const o=u.map(c=>(c.isDefaultCountry&&(s=c.id),{text:c.label,value:c.id}));z(o),l(s)})},[]),P(()=>{d(!0),Q(L).then(u=>{const s=u.map(o=>({text:o.name,value:o.code}));I(s)}).finally(()=>{d(!1)})},[L,d]),{loading:v,regionsLoading:m,estimatedDestinationText:p,countries:k,selectedCountry:L,selectedRegion:f,selectedZip:n,regions:b,estimatedShippingPrice:T,estimatedShippingMethod:y,shippingEstimated:t,handleEstimateShipping:E,handleCountrySelected:R,resetValues:a,setPriceSummaryLoading:D}},me=({showDefaultEstimatedShippingCost:v})=>{var x;const[D,k]=r(!1),{loading:z,countries:L,regions:l,selectedCountry:f,estimatedDestinationText:F,estimatedShippingPrice:n,handleCountrySelected:S,handleEstimateShipping:b,regionsLoading:I,selectedRegion:m,selectedZip:d,shippingEstimated:T,resetValues:C}=ee(),y=J(t=>{b(t).then(()=>{j(t)})},[b]);P(()=>{const t=B.on("cart/data",h=>{var s,o,c;k((h==null?void 0:h.isVirtual)||!1);const a=(o=(s=h==null?void 0:h.addresses)==null?void 0:s.shipping)==null?void 0:o[0];if(v&&!a&&b({shippingCountry:((c=X.config)==null?void 0:c.defaultCountry)??""}),!a)return;const{countryCode:E,regionCode:R,zipCode:u}=a;y({shippingCountry:E,shippingState:R,shippingZip:u})},{eager:!0});return()=>{t==null||t.off()}},[]),P(()=>{const t=B.on("cart/updated",()=>{b({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[f,m,d]),P(()=>{const t=B.on("cart/reset",()=>{C(),j(null)});return()=>{t==null||t.off()}},[C]),P(()=>{const t=B.on("cart/merged",()=>{T&&y({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[T,f,m,d,y]);const i=M({applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"});if(D)return null;const p=(x=X.config)==null?void 0:x.shoppingCartDisplaySetting;return e(Y,{loading:z,taxIncluded:(p==null?void 0:p.shipping)==="INCLUDING_TAX",taxExcluded:(p==null?void 0:p.shipping)==="INCLUDING_EXCLUDING_TAX",price:(n==null?void 0:n.amount)==0?e("span",{"data-testId":"free-shipping",children:i.freeShipping}):(p==null?void 0:p.shipping)==="INCLUDING_TAX"&&n?e(U,{"data-testid":"shipping",...n.priceIncludingtax}):n?e(U,{...n}):e("span",{children:i.taxToBeDetermined}),estimated:!0,priceExcludingTax:n!=null&&n.priceExcludingtax?e(U,{"data-testid":"shipping-excluding-tax",...n.priceExcludingtax}):e("span",{children:i.taxToBeDetermined}),countryField:e(w,{name:"shippingCountry",placeholder:i.countryField,value:f,variant:"primary",options:L,handleSelect:S,"data-testid":"estimate-shipping-country-selector"}),stateField:l.length>0?e(w,{name:"shippingState",placeholder:i.stateField,variant:"primary",options:l,value:m,"data-testid":"estimate-shipping-state-selector",disabled:I}):e(G,{"aria-label":i.stateField,name:"shippingState",placeholder:i.stateField,variant:"primary",value:m,disabled:I,"data-testid":"estimate-shipping-state-input",maxLength:50}),zipField:e(G,{"aria-label":i.zipField,name:"shippingZip",placeholder:i.zipField,variant:"primary","data-testid":"estimate-shipping-zip-input",value:d,maxLength:12}),estimateButton:e(q,{variant:"secondary","data-testid":"estimate-shipping-apply-button","aria-label":i.applyButton,children:i.applyButton}),destinationText:F||i.taxToBeDetermined,onEstimate:y})};export{me as EstimateShipping,me as default}; +import{jsxs as A,jsx as e,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _,VComponent as Z,getFormValues as $}from"@dropins/tools/lib.js";import{Price as U,Picker as w,Input as G,Button as q}from"@dropins/tools/components.js";/* empty css */import{useRef as H,useState as r,useEffect as P,useCallback as J}from"@dropins/tools/preact-compat.js";import{useText as M,Text as v}from"@dropins/tools/i18n.js";import{s as X}from"../chunks/resetCart.js";import{events as B}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/persisted-data.js";import{g as O,a as Q,b as W}from"../chunks/getEstimateShipping.js";import"@dropins/tools/fetch-graphql.js";const Y=({countryField:k,destinationText:D,estimateButton:z,estimated:I,loading:N,onEstimate:l,price:f,priceExcludingTax:F,priceIncludingTax:n,stateField:S,taxExcluded:b,taxIncluded:T,zipField:m})=>{const d=H(null),[L,C]=r(!0),[y,i]=r("zip"),p=M({editZipAction:"Cart.EstimateShipping.editZipAction",destinationLinkAriaLabel:"Cart.EstimateShipping.destinationLinkAriaLabel",shippingLabel:"Cart.EstimateShipping.label",zipPlaceholder:"Cart.EstimateShipping.zipPlaceholder"}),x=a=>{a.preventDefault(),C(E=>!E)},t=a=>{a.preventDefault(),C(!0),i(E=>E==="zip"?"state":"zip")},h=a=>{a.preventDefault(),C(!1);const E=$(d.current);l==null||l(E)};return A("div",{"data-testid":"estimate-shipping",className:_(["cart-estimate-shipping",["cart-estimate-shipping--loading",N]]),children:[e("span",{className:"cart-estimate-shipping__label",children:I?D?A(V,{children:[e(v,{id:"Cart.EstimateShipping.estimatedDestination"}),e("a",{className:"cart-estimate-shippingLink",role:"button",href:"",onClick:x,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&x(a)},tabIndex:0,"aria-label":p.destinationLinkAriaLabel,"data-testid":"shipping-destination-link",children:D})]}):e(v,{id:"Cart.EstimateShipping.estimated"}):e(v,{id:"Cart.EstimateShipping.label"})}),e(Z,{node:f,className:"cart-estimate-shipping__price"}),I&&A(V,{children:[e("div",{className:_(["cart-estimate-shipping__caption"]),children:e("a",{href:"#",className:"cart-estimate-shipping__link",onClick:t,"data-testid":"shipping-alternate-field-link",children:y==="zip"?e(v,{id:"Cart.EstimateShipping.alternateField.state"}):e(v,{id:"Cart.EstimateShipping.alternateField.zip"})})}),A("form",{className:_(["cart-estimate-shipping--edit",["cart-estimate-shipping--hide",!L]]),ref:d,"data-testid":"shipping-estimate-form",children:[k&&e(Z,{node:k,className:_(["cart-estimate-shipping--country"])}),y==="state"?S&&e(Z,{node:S,className:_(["cart-estimate-shipping--state"])}):m&&e(Z,{node:m,className:_(["cart-estimate-shipping--zip"])}),z&&e(Z,{node:z,className:_(["cart-estimate-shipping--action"]),onClick:h,type:"submit"})]})]}),T&&e("div",{"data-testid":"shipping-tax-included",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[n," ",e(v,{id:"Cart.EstimateShipping.withTaxes"})]})}),b?e("div",{"data-testid":"shipping-tax-included-excluded",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[F," ",e(v,{id:"Cart.EstimateShipping.withoutTaxes"})]})}):void 0]})},ee=()=>{const[k,D]=r(!1),[z,I]=r([]),[N,l]=r("US"),[f,F]=r(""),[n,S]=r(""),[b,T]=r([]),[m,d]=r(!1),[L,C]=r(),[y,i]=r(),[p,x]=r(""),[t,h]=r(!1),a=()=>{l("US"),F(""),S(""),C(null),i(null),x(""),h(!1)},E=async u=>{const{shippingCountry:s,shippingState:o="",shippingZip:c=""}=u,K={countryCode:s,postcode:c,region:{region:o}};return D(!0),W(K).then(g=>(g&&(C({amount:g.amount.value,currency:g.amount.currency,priceIncludingtax:{amount:g.price_incl_tax.value,currency:g.price_incl_tax.currency},priceExcludingtax:{amount:g.price_excl_tax.value,currency:g.price_excl_tax.currency}}),i({carrier_code:g.carrier_code,method_code:g.method_code}),l(s),F(o),S(c),x(o||c||s),h(!0)),l(s),F(o),S(c),x(o||c||s),g)).finally(()=>{D(!1)})},R=u=>{u.preventDefault(),F(""),S("");const s=u.target.value;l(s)};return P(()=>{O().then(u=>{let s="US";const o=u.map(c=>(c.isDefaultCountry&&(s=c.id),{text:c.label,value:c.id}));I(o),l(s)})},[]),P(()=>{d(!0),Q(N).then(u=>{const s=u.map(o=>({text:o.name,value:o.code}));T(s)}).finally(()=>{d(!1)})},[N,d]),{loading:k,regionsLoading:m,estimatedDestinationText:p,countries:z,selectedCountry:N,selectedRegion:f,selectedZip:n,regions:b,estimatedShippingPrice:L,estimatedShippingMethod:y,shippingEstimated:t,handleEstimateShipping:E,handleCountrySelected:R,resetValues:a,setPriceSummaryLoading:D}},me=({showDefaultEstimatedShippingCost:k})=>{var x;const[D,z]=r(!1),{loading:I,countries:N,regions:l,selectedCountry:f,estimatedDestinationText:F,estimatedShippingPrice:n,handleCountrySelected:S,handleEstimateShipping:b,regionsLoading:T,selectedRegion:m,selectedZip:d,shippingEstimated:L,resetValues:C}=ee(),y=J(t=>{b(t).then(()=>{j(t)})},[b]);P(()=>{const t=B.on("cart/data",h=>{var s,o,c;z((h==null?void 0:h.isVirtual)||!1);const a=(o=(s=h==null?void 0:h.addresses)==null?void 0:s.shipping)==null?void 0:o[0];if(k&&!a&&b({shippingCountry:((c=X.config)==null?void 0:c.defaultCountry)??""}),!a)return;const{countryCode:E,regionCode:R,zipCode:u}=a;y({shippingCountry:E,shippingState:R,shippingZip:u})},{eager:!0});return()=>{t==null||t.off()}},[]),P(()=>{const t=B.on("cart/updated",()=>{L&&b({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[L,f,m,d]),P(()=>{const t=B.on("cart/reset",()=>{C(),j(null)});return()=>{t==null||t.off()}},[C]),P(()=>{const t=B.on("cart/merged",()=>{L&&y({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[L,f,m,d,y]);const i=M({applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"});if(D)return null;const p=(x=X.config)==null?void 0:x.shoppingCartDisplaySetting;return e(Y,{loading:I,taxIncluded:(p==null?void 0:p.shipping)==="INCLUDING_TAX",taxExcluded:(p==null?void 0:p.shipping)==="INCLUDING_EXCLUDING_TAX",price:(n==null?void 0:n.amount)==0?e("span",{"data-testId":"free-shipping",children:i.freeShipping}):(p==null?void 0:p.shipping)==="INCLUDING_TAX"&&n?e(U,{"data-testid":"shipping",...n.priceIncludingtax}):n?e(U,{...n}):e("span",{children:i.taxToBeDetermined}),estimated:!0,priceExcludingTax:n!=null&&n.priceExcludingtax?e(U,{"data-testid":"shipping-excluding-tax",...n.priceExcludingtax}):e("span",{children:i.taxToBeDetermined}),countryField:e(w,{name:"shippingCountry",placeholder:i.countryField,value:f,variant:"primary",options:N,handleSelect:S,"data-testid":"estimate-shipping-country-selector"}),stateField:l.length>0?e(w,{name:"shippingState",placeholder:i.stateField,variant:"primary",options:l,value:m,"data-testid":"estimate-shipping-state-selector",disabled:T}):e(G,{"aria-label":i.stateField,name:"shippingState",placeholder:i.stateField,variant:"primary",value:m,disabled:T,"data-testid":"estimate-shipping-state-input",maxLength:50}),zipField:e(G,{"aria-label":i.zipField,name:"shippingZip",placeholder:i.zipField,variant:"primary","data-testid":"estimate-shipping-zip-input",value:d,maxLength:12}),estimateButton:e(q,{variant:"secondary","data-testid":"estimate-shipping-apply-button","aria-label":i.applyButton,children:i.applyButton}),destinationText:F||i.taxToBeDetermined,onEstimate:y})};export{me as EstimateShipping,me as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/MiniCart.js b/scripts/__dropins__/storefront-cart/containers/MiniCart.js index 44784837ed..7f14a8349a 100644 --- a/scripts/__dropins__/storefront-cart/containers/MiniCart.js +++ b/scripts/__dropins__/storefront-cart/containers/MiniCart.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{M as v,M as w}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/ChevronDown.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/Coupon.js";export{v as MiniCart,w as default}; +import{jsx as i,jsxs as c,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{useState as G,useEffect as X,useCallback as A}from"@dropins/tools/preact-compat.js";import{classes as v,VComponent as b,Slot as H}from"@dropins/tools/lib.js";import{g as R}from"../chunks/persisted-data.js";import{events as j}from"@dropins/tools/event-bus.js";import{Price as C,Button as I}from"@dropins/tools/components.js";/* empty css */import{useText as k}from"@dropins/tools/i18n.js";import{s as d}from"../chunks/resetCart.js";import{p as w}from"../chunks/acdl.js";import{u as F}from"../chunks/updateProductsFromCart.js";import"../chunks/CartSummaryGrid.js";import{C as O}from"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/EmptyCart.js";import"../chunks/ChevronDown.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/Coupon.js";const B=({className:h,products:s,subtotal:u,subtotalExcludingTaxes:a,ctas:l,...m})=>{const o=k({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return i("div",{...m,className:v(["cart-mini-cart",h]),children:s&&c(S,{children:[i("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:s}),c("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[u&&c("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[o.subtotal,i(b,{node:u})]}),a&&c("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[o.subtotalExcludingTaxes,i(b,{node:a,className:v(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),l&&i(b,{node:l,className:"cart-mini-cart__footer__ctas"})]})]})})},V=({children:h,initialData:s=null,hideFooter:u=!0,slots:a,routeProduct:l,routeCart:m,routeCheckout:o,routeEmptyCartCTA:L,showDiscount:N,showSavings:D,...M})=>{var f,_,g;const[t,Q]=G(s),e=(f=d.config)==null?void 0:f.shoppingCartDisplaySetting;X(()=>{const r=j.on("cart/data",p=>{Q(p)},{eager:!0});return()=>{r==null||r.off()}},[]);const x=k({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),y=(r,p)=>F([{uid:r,quantity:p}]),T=r=>y(r,0),n=t==null?void 0:t.hasOutOfStockItems,E=A(()=>{t&&!n&&w(t,d.locale)},[t,n]),P=i(H,{name:"ProductList",slot:a==null?void 0:a.ProductList,context:{itemQuantityUpdateHandler:y,itemRemoveHandler:T,totalQuantity:t==null?void 0:t.totalQuantity},children:i(O,{"data-testid":"default-cart-summary-list",routeProduct:l,routeEmptyCartCTA:L,initialData:t,maxItems:(_=d.config)==null?void 0:_.miniCartMaxItemsDisplay,showMaxItems:!!((g=d.config)!=null&&g.miniCartMaxItemsDisplay),hideHeading:!(t!=null&&t.totalQuantity),hideFooter:u,enableRemoveItem:!0,showDiscount:N,showSavings:D})}),U=()=>(e==null?void 0:e.subtotal)==="INCLUDING_TAX"||(e==null?void 0:e.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return i(B,{...M,subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&i(C,{...U()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((e==null?void 0:e.subtotal)==="INCLUDING_EXCLUDING_TAX"?i(C,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,ctas:t!=null&&t.totalQuantity?c("div",{children:[o&&i(I,{"data-testid":"route-checkout-button",variant:"primary",href:n?void 0:o(),disabled:n,"aria-disabled":n,onClick:E,children:x.checkoutLink}),m&&i(I,{"data-testid":"route-cart-button",variant:"tertiary",href:m(),children:x.cartLink})]}):void 0,products:P})};V.getInitialData=async function(){return R()};export{V as MiniCart,V as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummary.js b/scripts/__dropins__/storefront-cart/containers/OrderSummary.js index 8fdf225234..a4b26b2308 100644 --- a/scripts/__dropins__/storefront-cart/containers/OrderSummary.js +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummary.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{O as g,O as h}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/acdl.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronDown.js";import"@dropins/tools/i18n.js";import"../chunks/Coupon.js";export{g as OrderSummary,h as default}; +import{O as g,O as h}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronDown.js";import"@dropins/tools/i18n.js";import"../chunks/Coupon.js";export{g as OrderSummary,h as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js index d3dc615bc3..7f157619df 100644 --- a/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{O as e,O}from"../chunks/OrderSummaryLine.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";export{e as OrderSummaryLine,O as default}; +import{O as e,O}from"../chunks/OrderSummaryLine.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";export{e as OrderSummaryLine,O as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/index.d.ts b/scripts/__dropins__/storefront-cart/containers/index.d.ts index 9ab86042d8..d18c60a0c6 100644 --- a/scripts/__dropins__/storefront-cart/containers/index.d.ts +++ b/scripts/__dropins__/storefront-cart/containers/index.d.ts @@ -14,7 +14,6 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ -export * from './Cart'; export * from './EstimateShipping'; export * from './MiniCart'; export * from './CartSummaryGrid'; diff --git a/scripts/__dropins__/storefront-cart/data/models/cart-model.d.ts b/scripts/__dropins__/storefront-cart/data/models/cart-model.d.ts index 1429a66857..5a203b8b52 100644 --- a/scripts/__dropins__/storefront-cart/data/models/cart-model.d.ts +++ b/scripts/__dropins__/storefront-cart/data/models/cart-model.d.ts @@ -17,6 +17,7 @@ export interface CartModel { id: string; totalQuantity: number; + totalUniqueItems: number; errors?: ItemError[]; items: Item[]; miniCartMaxItems: Item[]; @@ -63,8 +64,11 @@ export interface Item { itemType: string; uid: string; url: ItemURL; + canonicalUrl: string; + categories: string[]; quantity: number; sku: string; + topLevelSku: string; name: string; image: ItemImage; links?: ItemLinks; diff --git a/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/estimatedShippingData.d.ts b/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/estimatedShippingData.d.ts new file mode 100644 index 0000000000..40d321ddfe --- /dev/null +++ b/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/estimatedShippingData.d.ts @@ -0,0 +1,7 @@ +import { PartialAddress, ShippingMethod } from '../../models/shipping-models'; + +export declare const mockEstimatedShippingData: { + address: PartialAddress; + shippingMethod: ShippingMethod; +}; +//# sourceMappingURL=estimatedShippingData.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/productTypesData.d.ts b/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/productTypesData.d.ts index 77382cce19..5680e99f83 100644 --- a/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/productTypesData.d.ts +++ b/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/productTypesData.d.ts @@ -53,6 +53,10 @@ declare const bundleOptions: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -115,6 +119,10 @@ declare const bundleOptionsEmpty: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -179,6 +187,10 @@ declare const giftCardPhysical: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -245,6 +257,10 @@ declare const giftCardVirtual: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -305,6 +321,10 @@ declare const simple: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -384,6 +404,10 @@ declare const simpleCustomizable: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -473,6 +497,10 @@ declare const configurable: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -580,6 +608,10 @@ declare const configurableCustomizable: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -641,6 +673,10 @@ declare const giftCard: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -706,6 +742,10 @@ declare const downloadbleWithMultipleLinks: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { name: string; @@ -800,6 +840,10 @@ declare const simpleLowInventory: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; }; declare const complexInsufficientQuantity: { @@ -869,6 +913,10 @@ declare const complexInsufficientQuantity: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; }; declare const complexInsufficientQuantityGeneralMessage: { @@ -938,6 +986,10 @@ declare const complexInsufficientQuantityGeneralMessage: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; }; declare const complexWithProductAttributes: { @@ -1017,6 +1069,10 @@ declare const complexWithProductAttributes: { value: number; currency: string; }; + original_item_price: { + value: number; + currency: string; + }; }; }; declare const simpleWithNoDiscount: { @@ -1044,6 +1100,10 @@ declare const simpleWithNoDiscount: { row_total_including_tax: { value: number; }; + original_item_price: { + value: number; + currency: string; + }; }; product: { price_range: { diff --git a/scripts/__dropins__/storefront-cart/fragments.js b/scripts/__dropins__/storefront-cart/fragments.js index bca1bec8ef..2a0a07c8cd 100644 --- a/scripts/__dropins__/storefront-cart/fragments.js +++ b/scripts/__dropins__/storefront-cart/fragments.js @@ -94,7 +94,11 @@ fragment CART_ITEM_FRAGMENT on CartItemInterface { } label } - original_row_total{ + original_item_price { + value + currency + } + original_row_total { value currency } @@ -109,9 +113,11 @@ fragment CART_ITEM_FRAGMENT on CartItemInterface { } url_key url_suffix + canonical_url categories { url_path url_key + name } custom_attributesV2(filters: {is_visible_on_front: true}){ items{ diff --git a/scripts/__dropins__/storefront-cart/fragments.original.js b/scripts/__dropins__/storefront-cart/fragments.original.js deleted file mode 100644 index bca1bec8ef..0000000000 --- a/scripts/__dropins__/storefront-cart/fragments.original.js +++ /dev/null @@ -1,270 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -const e=` - fragment PRICE_RANGE_FRAGMENT on PriceRange { - minimum_price { - regular_price { - value - currency - } - final_price { - value - currency - } - discount { - percent_off - amount_off - } - } - maximum_price { - regular_price { - value - currency - } - final_price { - value - currency - } - discount { - percent_off - amount_off - } - } - } -`,t=` - fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption { - type - customizable_option_uid - label - is_required - values { - label - value - price{ - type - units - value - } - } - } -`,a=` -fragment CART_ITEM_FRAGMENT on CartItemInterface { - __typename - uid - quantity - is_available - not_available_message - errors { - code - message - } - - prices { - price { - value - currency - } - discounts { - amount { - value - currency - } - label - } - total_item_discount { - value - currency - } - row_total { - value - currency - } - row_total_including_tax { - value - currency - } - price_including_tax { - value - currency - } - fixed_product_taxes { - amount { - value - currency - } - label - } - original_row_total{ - value - currency - } - } - - product { - name - sku - thumbnail { - url - label - } - url_key - url_suffix - categories { - url_path - url_key - } - custom_attributesV2(filters: {is_visible_on_front: true}){ - items{ - code - ...on AttributeValue{ - value - } - ...on AttributeSelectedOptions{ - selected_options { - value - label - } - - } - } - } - only_x_left_in_stock - stock_status - - price_range { - ...PRICE_RANGE_FRAGMENT - } - } - ...on SimpleCartItem { - customizable_options { - ...CUSTOMIZABLE_OPTIONS_FRAGMENT - } - } - ... on ConfigurableCartItem { - configurable_options { - configurable_product_option_uid - option_label - value_label - } - configured_variant { - uid - sku - only_x_left_in_stock - stock_status - thumbnail { - label - url - } - price_range { - ...PRICE_RANGE_FRAGMENT - } - } - customizable_options { - ...CUSTOMIZABLE_OPTIONS_FRAGMENT - } - } - ... on DownloadableCartItem { - links { - sort_order - title - } - customizable_options { - ...CUSTOMIZABLE_OPTIONS_FRAGMENT - } - } - ... on BundleCartItem { - bundle_options { - uid - label - values { - uid - label - } - } - } - ... on GiftCardCartItem { - message - recipient_email - recipient_name - sender_email - sender_name - amount{ - currency - value - } - is_available - } -} - -${e} -${t} -`,r=` -fragment CART_FRAGMENT on Cart { - id - total_quantity - is_virtual - prices { - subtotal_with_discount_excluding_tax { - currency - value - } - subtotal_including_tax { - currency - value - } - subtotal_excluding_tax { - currency - value - } - grand_total { - currency - value - } - grand_total_excluding_tax { - currency - value - } - applied_taxes { - label - amount { - value - currency - } - } - discounts { - amount { - value - currency - } - label - coupon { - code - } - applied_to - } - } - applied_coupons { - code - } - itemsV2 ( - pageSize:$pageSize, - currentPage:$currentPage, - sort: $itemsSortInput - ) { - items { - ...CART_ITEM_FRAGMENT - } - } - shipping_addresses { - country { - code - } - region { - code - } - postcode - } -} - -${a} -`;export{r as CART_FRAGMENT,a as CART_ITEM_FRAGMENT}; diff --git a/scripts/__dropins__/storefront-cart/render.js b/scripts/__dropins__/storefront-cart/render.js index b15d1b4360..cf023ded71 100644 --- a/scripts/__dropins__/storefront-cart/render.js +++ b/scripts/__dropins__/storefront-cart/render.js @@ -1,4 +1,4 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -(function(i,t){try{if(typeof document<"u"){const a=document.createElement("style"),n=t.styleId;for(const r in t.attributes)a.setAttribute(r,t.attributes[r]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(i));const e=document.querySelector('style[data-dropin="sdk"]');if(e)e.after(a);else{const r=document.querySelector('link[rel="stylesheet"], style');r?r.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})(".cart-cart{container-type:inline-size;container-name:cart}.cart-cart__wrapper{display:grid;grid-template-rows:auto 1fr}.cart-cart__heading{display:grid;row-gap:var(--spacing-small);padding:var(--spacing-medium);padding-bottom:0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart__heading-divider{width:100%;margin:0}.cart-cart__content{display:grid;grid-template-columns:1fr;padding:0 var(--spacing-medium) var(--spacing-medium)}.cart-cart__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.dropin-price-summary__shipping--zip,.dropin-price-summary__shipping--state{background-color:var(--color-neutral-50)}@container cart (width >= 1024px){.cart-cart__wrapper{grid-template-columns:repeat(var(--grid-3-columns),1fr);grid-column-gap:var(--grid-3-gutters);margin:0 var(--grid-3-margins)}.cart-cart__heading{padding:var(--spacing-small) 0 0 0}.cart-cart__content{padding:var(--spacing-medium) 0}.cart-cart__content .cart-cart-summary-list__heading{padding:0}.cart-cart__heading,.cart-cart__content{grid-column:1 / span 8}.cart-cart__order-summary{grid-row:1 / span 3;grid-column:9 / span 4;height:min-content}.cart-cart__heading--full-width,.cart-cart__content--empty,.cart-cart__content--full-width{grid-column:1 / span 12}}.cart-empty-cart{container-type:inline-size;container-name:cart}.cart-empty-cart__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center}@container cart (width < 737px){.cart-empty-cart__wrapper .dropin-card{border:unset;border-style:hidden}}.cart-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xsmall);align-items:flex-end;color:var(--color-neutral-800)}.cart-estimate-shipping__label,.cart-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-estimate-shipping__price{text-align:right}a.cart-estimate-shippingLink{text-decoration:underline}.cart-estimate-shipping__label--bold,.cart-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-estimate-shipping--zip,.cart-estimate-shipping--state{background-color:var(--color-neutral-50)}.cart-estimate-shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small)}a.cart-estimate-shipping__link{text-decoration:underline}.cart-estimate-shipping--hide{display:none!important}.cart-estimate-shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-estimate-shipping--loading{opacity:.4;pointer-events:none}.cart-mini-cart{display:flex;flex-direction:column;height:100%;padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium);box-sizing:border-box}.cart-mini-cart__empty-cart{width:100%;max-width:800px;height:100%;display:flex;flex-direction:column;justify-content:center;align-self:center}.cart-mini-cart__heading{display:grid;row-gap:var(--spacing-xsmall);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing)}.cart-mini-cart__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 0 0}.cart-mini-cart__products{flex:1;overflow-y:auto;max-height:100%;padding-bottom:var(--spacing-medium)}.cart-mini-cart__products .cart-cart-summary-list__heading{padding:0}.cart-mini-cart__products .dropin-cart-item__configurations li{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cart-mini-cart__footer{display:grid;grid-auto-flow:row;gap:var(--spacing-small);padding-top:var(--spacing-small);row-gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total-excluding-taxes{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall);color:var(--color-neutral-700)}.cart-mini-cart__footer__ctas{display:grid;grid-auto-flow:row;gap:var(--spacing-xsmall);padding-top:var(--spacing-small)}.cart-cart-summary-grid{container-type:inline-size;container-name:cart-summary-grid;max-width:inherit}.cart-cart-summary-grid__content{display:grid;flex-wrap:wrap;gap:var(--spacing-small);grid-template-columns:repeat(6,1fr);margin:auto}.cart-cart-summary-grid__item-container{aspect-ratio:auto 3/4;display:inline-block}.cart-cart-summary-grid__item-container img{height:auto;max-width:100%}.cart-cart-summary-grid__item-container a:focus{display:block}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}.cart-cart-summary-grid__empty-cart{align-self:center;justify-self:center;max-width:800px;width:100%}@container cart-summary-grid (width < 360px){.cart-cart-summary-grid__content{grid-template-columns:repeat(4,1fr);gap:var(--spacing-xsmall)}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}}.cart-cart-summary-list{container-type:inline-size;container-name:cart-summary-list}.cart-cart-summary-list__background--secondary{background-color:var(--color-neutral-200)}.cart-cart-summary-list__heading{display:grid;row-gap:var(--spacing-xsmall);padding:var(--spacing-medium) 0 0 0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart-summary-list__heading--full-width{width:100%}.cart-cart-summary-list__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 var(--spacing-medium) 0}.cart-cart-summary-list__content{display:grid;grid-template-columns:1fr;padding:0}.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-xsmall)) 0 var(--spacing-medium) 0}.cart-cart-summary-list__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.cart-cart-summary-list-footer__action,.cart-cart-summary-list-footer__action:focus .cart-cart-summary-list-footer__action:active,.cart-cart-summary-list-footer__action:link{font:var(--type-body-2-strong-font);margin:0 auto;width:auto;margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.cart-cart-summary-list-footer__action:hover{text-decoration:underline;text-underline-offset:var(--spacing-xxsmall);background:transparent;color:var(--color-brand-700)}.cart-cart-summary-list-footer__action:visited{background-color:none}.cart-cart-summary-list-accordion{border-left:var(--shape-border-width-2) solid var(--color-neutral-400);border-right:var(--shape-border-width-2) solid var(--color-neutral-400)}.cart-cart-summary-list-accordion__section{margin:var(--spacing-medium)}@container cart-summary-list (width >= 768px){.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-small)) 0 var(--spacing-xxbig) 0}}@container cart-summary-list (width >= 1024px){.cart-cart-summary-list__content,.cart-cart-summary-list__heading{grid-column:1 / span 8}.cart-cart-summary-list__heading--full-width,.cart-cart-summary-list__content--empty{grid-column:1 / span 12}.cart-cart-summary-list__content{padding:0}}.cart-order-summary{display:grid;position:relative;grid-auto-flow:row;padding:var(--spacing-medium)}.cart-order-summary__primary{background-color:var(--color-neutral-200)}.cart-order-summary__secondary{background-color:var(--color-neutral-50)}.cart-order-summary__content{display:grid;gap:var(--spacing-xsmall);margin-top:var(--spacing-small)}.cart-order-summary__heading{display:grid;font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);color:var(--color-neutral-800);gap:var(--spacing-small)}.cart-order-summary__discount .cart-order-summary__label,.cart-order-summary__discount .cart-order-summary__price{color:var(--color-warning-800)}.cart-order-summary__coupon__code{display:flex;align-items:center;font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);color:var(--color-neutral-700);gap:var(--spacing-xsmall);grid-column:span 2}.cart-order-summary__taxes .dropin-divider:last-child{margin-bottom:0}.cart-order-summary__total{margin-top:var(--spacing-medium)}.cart-order-summary__divider-primary,.cart-order-summary__divider-secondary{width:100%;margin:0}.cart-order-summary__divider-secondary{margin:0}.cart-order-summary__taxEntry.cart-order-summary__entry{margin-top:0}.cart-order-summary__entry,.cart-order-summary__taxEntry{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.cart-order-summary__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-order-summary__primaryAction{margin-top:var(--spacing-small);grid-template-columns:1fr}.cart-order-summary__shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small);padding-left:var(--spacing-small)}a.cart-order-summary__shippingLink{text-decoration:underline}.cart-order-summary__shipping--hide{display:none!important}.cart-order-summary__shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-order-summary__shipping--zip,.cart-order-summary__shipping--state{background-color:var(--color-neutral-50)}.cart-order-summary__taxes .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.cart-order-summary--loading{opacity:.4;pointer-events:none}.cart-order-summary__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.coupon-code-form__action{display:flex}.coupon-code-form__action .dropin-input-container{flex-grow:1;margin-right:var(--spacing-small)}.cart-coupons__accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small)}.coupon-code-form__codes{background-color:var(--color-neutral-50)}.coupon-code-form__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-500);margin-top:calc(var(--spacing-xsmall) * -1)}.coupon-code-form__applied{display:flex;flex-wrap:wrap;gap:var(--spacing-small)}div.coupon-code-form__applied button{background:var(--color-neutral-400);color:var(--color-neutral-800);display:flex;flex-direction:row-reverse}.cart-order-summary__label,.cart-order-summary__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-order-summary__price{text-align:right;text-transform:uppercase}.cart-order-summary__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-order-summary__label--bold,.cart-order-summary__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}",{styleId:"Cart"}); -import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./fragments.js";const f={Cart:{heading:"Shopping Cart ({count})",editCart:"Edit",viewAll:"View all in cart",viewMore:"View more"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",free:"Free",label:"Total",withoutTax:"Total excluding taxes",saved:"Total saved"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free",coupon:{applyAction:"Apply",placeholder:"Enter code",title:"Discount code"}},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available",discountPercentage:"{discount}% off",savingsAmount:"Savings"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},y={default:x},S=({children:o})=>{var i;const[t,s]=u(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(y,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},L=new d(n(S,{}));export{L as render}; +(function(i,t){try{if(typeof document<"u"){const a=document.createElement("style"),n=t.styleId;for(const r in t.attributes)a.setAttribute(r,t.attributes[r]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(i));const e=document.querySelector('style[data-dropin="sdk"]');if(e)e.after(a);else{const r=document.querySelector('link[rel="stylesheet"], style');r?r.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})(".cart-empty-cart{container-type:inline-size;container-name:cart}.cart-empty-cart__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center}@container cart (width < 737px){.cart-empty-cart__wrapper .dropin-card{border:unset;border-style:hidden}}.cart-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xsmall);align-items:flex-end;color:var(--color-neutral-800)}.cart-estimate-shipping__label,.cart-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-estimate-shipping__price{text-align:right}a.cart-estimate-shippingLink{text-decoration:underline}.cart-estimate-shipping__label--bold,.cart-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-estimate-shipping--zip,.cart-estimate-shipping--state{background-color:var(--color-neutral-50)}.cart-estimate-shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small)}a.cart-estimate-shipping__link{text-decoration:underline}.cart-estimate-shipping--hide{display:none!important}.cart-estimate-shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-estimate-shipping--loading{opacity:.4;pointer-events:none}.cart-mini-cart{display:flex;flex-direction:column;height:100%;padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium);box-sizing:border-box}.cart-mini-cart__empty-cart{width:100%;max-width:800px;height:100%;display:flex;flex-direction:column;justify-content:center;align-self:center}.cart-mini-cart__heading{display:grid;row-gap:var(--spacing-xsmall);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing)}.cart-mini-cart__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 0 0}.cart-mini-cart__products{flex:1;overflow-y:auto;max-height:100%;padding-bottom:var(--spacing-medium)}.cart-mini-cart__products .cart-cart-summary-list__heading{padding:0}.cart-mini-cart__products .dropin-cart-item__configurations li{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cart-mini-cart__footer{display:grid;grid-auto-flow:row;gap:var(--spacing-small);padding-top:var(--spacing-small);row-gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total-excluding-taxes{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall);color:var(--color-neutral-700)}.cart-mini-cart__footer__ctas{display:grid;grid-auto-flow:row;gap:var(--spacing-xsmall);padding-top:var(--spacing-small)}.cart-cart-summary-grid{container-type:inline-size;container-name:cart-summary-grid;max-width:inherit}.cart-cart-summary-grid__content{display:grid;flex-wrap:wrap;gap:var(--spacing-small);grid-template-columns:repeat(6,1fr);margin:auto}.cart-cart-summary-grid__item-container{aspect-ratio:auto 3/4;display:inline-block}.cart-cart-summary-grid__item-container img{height:auto;max-width:100%}.cart-cart-summary-grid__item-container a:focus{display:block}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}.cart-cart-summary-grid__empty-cart{align-self:center;justify-self:center;max-width:800px;width:100%}@container cart-summary-grid (width < 360px){.cart-cart-summary-grid__content{grid-template-columns:repeat(4,1fr);gap:var(--spacing-xsmall)}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}}.cart-cart-summary-list{container-type:inline-size;container-name:cart-summary-list}.cart-cart-summary-list__background--secondary{background-color:var(--color-neutral-200)}.cart-cart-summary-list__heading{display:grid;row-gap:var(--spacing-xsmall);padding:var(--spacing-medium) 0 0 0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart-summary-list__heading--full-width{width:100%}.cart-cart-summary-list__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 var(--spacing-medium) 0}.cart-cart-summary-list__content{display:grid;grid-template-columns:1fr;padding:0}.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-xsmall)) 0 var(--spacing-medium) 0}.cart-cart-summary-list__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.cart-cart-summary-list-footer__action,.cart-cart-summary-list-footer__action:focus .cart-cart-summary-list-footer__action:active,.cart-cart-summary-list-footer__action:link{font:var(--type-body-2-strong-font);margin:0 auto;width:auto;margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.cart-cart-summary-list-footer__action:hover{text-decoration:underline;text-underline-offset:var(--spacing-xxsmall);background:transparent;color:var(--color-brand-700)}.cart-cart-summary-list-footer__action:visited{background-color:none}.cart-cart-summary-list-accordion{border-left:var(--shape-border-width-2) solid var(--color-neutral-400);border-right:var(--shape-border-width-2) solid var(--color-neutral-400)}.cart-cart-summary-list-accordion__section{margin:var(--spacing-medium)}@container cart-summary-list (width >= 768px){.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-small)) 0 var(--spacing-xxbig) 0}}@container cart-summary-list (width >= 1024px){.cart-cart-summary-list__content,.cart-cart-summary-list__heading{grid-column:1 / span 8}.cart-cart-summary-list__heading--full-width,.cart-cart-summary-list__content--empty{grid-column:1 / span 12}.cart-cart-summary-list__content{padding:0}}.cart-order-summary{display:grid;position:relative;grid-auto-flow:row;padding:var(--spacing-medium)}.cart-order-summary__primary{background-color:var(--color-neutral-200)}.cart-order-summary__secondary{background-color:var(--color-neutral-50)}.cart-order-summary__content{display:grid;gap:var(--spacing-xsmall);margin-top:var(--spacing-small)}.cart-order-summary__heading{display:grid;font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);color:var(--color-neutral-800);gap:var(--spacing-small)}.cart-order-summary__discount .cart-order-summary__label,.cart-order-summary__discount .cart-order-summary__price{color:var(--color-warning-800)}.cart-order-summary__coupon__code{display:flex;align-items:center;font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);color:var(--color-neutral-700);gap:var(--spacing-xsmall);grid-column:span 2}.cart-order-summary__taxes .dropin-divider:last-child{margin-bottom:0}.cart-order-summary__total{margin-top:var(--spacing-medium)}.cart-order-summary__divider-primary,.cart-order-summary__divider-secondary{width:100%;margin:0}.cart-order-summary__divider-secondary{margin:0}.cart-order-summary__taxEntry.cart-order-summary__entry{margin-top:0}.cart-order-summary__entry,.cart-order-summary__taxEntry{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.cart-order-summary__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-order-summary__primaryAction{margin-top:var(--spacing-small);grid-template-columns:1fr}.cart-order-summary__shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small);padding-left:var(--spacing-small)}a.cart-order-summary__shippingLink{text-decoration:underline}.cart-order-summary__shipping--hide{display:none!important}.cart-order-summary__shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-order-summary__shipping--zip,.cart-order-summary__shipping--state{background-color:var(--color-neutral-50)}.cart-order-summary__taxes .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.cart-order-summary--loading{opacity:.4;pointer-events:none}.cart-order-summary__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.coupon-code-form__action{display:flex}.coupon-code-form__action .dropin-input-container{flex-grow:1;margin-right:var(--spacing-small)}.cart-coupons__accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small)}.coupon-code-form__codes{background-color:var(--color-neutral-50)}.coupon-code-form__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-500);margin-top:calc(var(--spacing-xsmall) * -1)}.coupon-code-form__applied{display:flex;flex-wrap:wrap;gap:var(--spacing-small)}div.coupon-code-form__applied button{background:var(--color-neutral-400);color:var(--color-neutral-800);display:flex;flex-direction:row-reverse}.cart-order-summary__label,.cart-order-summary__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-order-summary__price{text-align:right;text-transform:uppercase}.cart-order-summary__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-order-summary__label--bold,.cart-order-summary__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}",{styleId:"Cart"}); +import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/refreshCart.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./fragments.js";const f={Cart:{heading:"Shopping Cart ({count})",editCart:"Edit",viewAll:"View all in cart",viewMore:"View more"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",free:"Free",label:"Total",withoutTax:"Total excluding taxes",saved:"Total saved"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free",coupon:{applyAction:"Apply",placeholder:"Enter code",title:"Discount code"}},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available",discountPercentage:"{discount}% off",savingsAmount:"Savings"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},y={default:x},S=({children:o})=>{var i;const[t,s]=u(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(y,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},L=new d(n(S,{}));export{L as render}; diff --git a/scripts/__dropins__/tools/components.js b/scripts/__dropins__/tools/components.js index 6d412e4a42..80b53aa335 100644 --- a/scripts/__dropins__/tools/components.js +++ b/scripts/__dropins__/tools/components.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as e}from"./preact-jsx-runtime.js";import{d as Z,c as o,R as be,a as oe,V as y,g as fe,i as ve}from"./chunks/is-number.js";import{G as ge,T as M,k as R,F as g,L as Ne,h as B,q as C,S as K,y as W,_ as we,N as se,E as ke,A as le,x as ye}from"./chunks/icons/Add.js";import{IntlProvider as xe,Localizer as Q,Text as z,useText as I}from"./i18n.js";import U from"./chunks/icons/Minus.js";import De from"./chunks/icons/CheckWithCircle.js";import Ie from"./chunks/icons/WarningWithCircle.js";import Ee from"./chunks/icons/Date.js";import $e from"./chunks/icons/Locker.js";import Se from"./chunks/icons/Eye.js";import Te from"./chunks/icons/EyeClose.js";import de from"./chunks/icons/Check.js";import j from"./chunks/icons/Close.js";import J from"./chunks/icons/ChevronDown.js";import Le from"./chunks/icons/Trash.js";import"./chunks/image-params-keymap.js";import"./signals.js";const Pe={ExampleComponentName:{item:{label:"string"}},Pagination:{backwardButton:{ariaLabel:"Go to previous page"},forwardButton:{ariaLabel:"Go to next page"}},Incrementer:{decreaseLabel:"Decrease Quantity",increaseLabel:"Increase Quantity",label:"Quantity",errorMessage:"Enter a valid quantity",minQuantityMessage:"Enter at least {{minQuantity}}",maxQuantityMessage:"Maximum quantity is {{maxQuantity}}"},Modal:{Close:{label:"Close"}},InputPassword:{placeholder:"Password",floatingLabel:"Password",buttonTitle:"Click to show or hide password"},PasswordStatusIndicator:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long"},InlineAlert:{dismissLabel:"Dismiss Alert"},PriceSummary:{subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",label:"Total",withoutTax:"Total excluding taxes"}},ProgressSpinner:{updating:{label:"Item is updating"},updatingChildren:{label:"Items are updating"}},PriceRange:{from:{label:"From"},to:{label:"to"},asLowAs:{label:"As low as"}},Swatches:{outOfStock:{label:"out of stock swatch"},selected:{label:"swatch selected"},swatch:{label:"swatch"}},Accordion:{open:{label:"Open"},close:{label:"Close"}},CartItem:{each:{label:"each"},pricePerItem:{label:"price per item"},quantity:{label:"Quantity"},remove:{label:"Remove {product} from the cart"},removeDefault:{label:"Remove item from the cart"},taxIncluded:{label:"incl. VAT"},taxExcluded:{label:"excl. tax"},updating:{label:"{product} is updating"}},InputDate:{picker:"Select a date"}},ee={Dropin:Pe},te={default:ee,en_US:ee},Oe=a=>Z(te.default,te[a]||{}),re=1,q=({className:a,fullWidth:r=!1,lines:n=re,size:t="small",variant:s="row",children:i=null,multilineGap:l="medium",...d})=>{const _=[[`dropin-skeleton-row__${s}`,s],[`dropin-skeleton-row__${s}-${t}`,s&&t]];if(!i&&s==="empty")return e("div",{className:o(["dropin-skeleton-row dropin-skeleton-row__empty",a])});if(i){const h=i.trim();return e("div",{...d,class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],a]),dangerouslySetInnerHTML:{__html:h}})}return n>re===!1?e("div",{...d,class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],"dropin-skeleton--row__content",..._,a])}):e("div",{...d,style:{"--multiline-gap-spacing":`var(--spacing-${l})`},class:o(["dropin-skeleton-row--multiline",["dropin-skeleton-row--full",r],a]),children:Array.from({length:n}).map((h,p)=>e("div",{class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],"dropin-skeleton--row__content",..._])},p))})},Ce=({className:a,children:r,rowGap:n="medium",...t})=>e("div",{style:{"--row-gap-spacing":`var(--spacing-${n})`},...t,className:o(["dropin-skeleton",a]),role:"status","aria-label":"Loading...",children:r}),ce=ge({locale:"en-US"}),Ae=({lang:a="en_US",langDefinitions:r={},children:n})=>{const t=M(()=>{const i=Z(r.default,r[a]??{});return Z(Oe(a),i)},[a,r]),s=a.replace("_","-");return e(ce.Provider,{value:{locale:s},children:e(xe,{definition:t,children:e(R,{children:n})})})},ut=new be(e(Ae,{})),Ve=function(){const r=typeof document<"u"&&document.createElement("link").relList;return r&&r.supports&&r.supports("modulepreload")?"modulepreload":"preload"}(),Re=function(a){return"/"+a},ne={},N=function(r,n,t){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.all(n.map(d=>{if(d=Re(d),d in ne)return;ne[d]=!0;const _=d.endsWith(".css"),m=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=_?"stylesheet":Ve,_||(h.as="script",h.crossOrigin=""),h.href=d,l&&h.setAttribute("nonce",l),document.head.appendChild(h),_)return new Promise((p,c)=>{h.addEventListener("load",p),h.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${d}`)))})}))}return s.then(()=>r()).catch(i=>{const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i})},Be={Add:g(()=>N(()=>import("./chunks/icons/Add.js").then(a=>a.$),[])),Bulk:g(()=>N(()=>import("./chunks/icons/Bulk.js"),[])),Burger:g(()=>N(()=>import("./chunks/icons/Burger.js"),[])),Cart:g(()=>N(()=>import("./chunks/icons/Cart.js"),[])),Check:g(()=>N(()=>import("./chunks/icons/Check.js"),[])),ChevronDown:g(()=>N(()=>import("./chunks/icons/ChevronDown.js"),[])),ChevronUp:g(()=>N(()=>import("./chunks/icons/ChevronUp.js"),[])),ChevronRight:g(()=>N(()=>import("./chunks/icons/ChevronRight.js"),[])),Close:g(()=>N(()=>import("./chunks/icons/Close.js"),[])),Heart:g(()=>N(()=>import("./chunks/icons/Heart.js"),[])),Minus:g(()=>N(()=>import("./chunks/icons/Minus.js"),[])),Placeholder:g(()=>N(()=>import("./chunks/icons/Placeholder.js"),[])),PlaceholderFilled:g(()=>N(()=>import("./chunks/icons/PlaceholderFilled.js"),[])),Search:g(()=>N(()=>import("./chunks/icons/Search.js"),[])),SearchFilled:g(()=>N(()=>import("./chunks/icons/SearchFilled.js"),[])),Sort:g(()=>N(()=>import("./chunks/icons/Sort.js"),[])),Star:g(()=>N(()=>import("./chunks/icons/Star.js"),[])),View:g(()=>N(()=>import("./chunks/icons/View.js"),[])),User:g(()=>N(()=>import("./chunks/icons/User.js"),[])),Warning:g(()=>N(()=>import("./chunks/icons/Warning.js"),[])),Locker:g(()=>N(()=>import("./chunks/icons/Locker.js"),[])),Wallet:g(()=>N(()=>import("./chunks/icons/Wallet.js"),[])),Card:g(()=>N(()=>import("./chunks/icons/Card.js"),[])),Order:g(()=>N(()=>import("./chunks/icons/Order.js"),[])),Delivery:g(()=>N(()=>import("./chunks/icons/Delivery.js"),[])),OrderError:g(()=>N(()=>import("./chunks/icons/OrderError.js"),[])),OrderSuccess:g(()=>N(()=>import("./chunks/icons/OrderSuccess.js"),[])),PaymentError:g(()=>N(()=>import("./chunks/icons/PaymentError.js"),[])),CheckWithCircle:g(()=>N(()=>import("./chunks/icons/CheckWithCircle.js"),[])),WarningWithCircle:g(()=>N(()=>import("./chunks/icons/WarningWithCircle.js"),[])),WarningFilled:g(()=>N(()=>import("./chunks/icons/WarningFilled.js"),[])),InfoFilled:g(()=>N(()=>import("./chunks/icons/InfoFilled.js"),[])),HeartFilled:g(()=>N(()=>import("./chunks/icons/HeartFilled.js"),[])),Trash:g(()=>N(()=>import("./chunks/icons/Trash.js"),[])),Eye:g(()=>N(()=>import("./chunks/icons/Eye.js"),[])),EyeClose:g(()=>N(()=>import("./chunks/icons/EyeClose.js"),[])),Date:g(()=>N(()=>import("./chunks/icons/Date.js"),[])),AddressBook:g(()=>N(()=>import("./chunks/icons/AddressBook.js"),[])),EmptyBox:g(()=>N(()=>import("./chunks/icons/EmptyBox.js"),[])),Coupon:g(()=>N(()=>import("./chunks/icons/Coupon.js"),[]))};function T({source:a,size:r="24",stroke:n="2",viewBox:t="0 0 24 24",className:s,...i}){const l=typeof a=="string"?Be[a]:null,d={className:o(["dropin-icon",`dropin-icon--shape-stroke-${n}`,s]),width:r,height:r,viewBox:t};return e(Ne,{fallback:e("svg",{...i,...d}),children:l?e(l,{...i,...d}):e(a,{...i,...d})})}const Fe=({name:a,value:r="1",className:n,disabled:t,error:s,success:i,min:l,max:d,onValue:_,onUpdateError:m,size:h="medium",...p})=>{const[c,u]=B(Number(r)),b=Number(l),f=Number(d),v=s||cf,w=cf?"Dropin.Incrementer.maxQuantityMessage":"Dropin.Incrementer.errorMessage",x=C(oe(async $=>{if(_)try{_($)}catch(k){m&&m(k)}},200),[_,m]),E=$=>{let k=$;x(k),u(k)};return e("div",{className:o(["dropin-incrementer",`dropin-incrementer--${h}`,n]),children:[e("div",{className:o(["dropin-incrementer__content",`dropin-incrementer__content--${h}`,["dropin-incrementer__content--error",v],["dropin-incrementer__content--success",i],["dropin-incrementer__content--disabled",t]]),children:[e("div",{className:o(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",t]]),children:e(Q,{children:e("button",{type:"button",className:o(["dropin-incrementer__decrease-button",["dropin-incrementer__decrease-button--disabled",t]]),onClick:()=>E(c-1),disabled:t||c{E(Number(c))},onChange:$=>{const k=$.currentTarget.value;k!==""&&E(Number(k))},...p}),e("div",{className:o(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",t]]),children:e(Q,{children:e("button",{type:"button",className:o(["dropin-incrementer__increase-button",["dropin-incrementer__increase-button--disabled",t]]),onClick:()=>E(c+1),disabled:t||c>f-1,"aria-label":e(z,{id:"Dropin.Incrementer.increaseLabel"}),children:e(T,{source:K,size:"16",stroke:"1",viewBox:"4 2 20 20",className:"dropin-incrementer__add"})})})})]}),v&&e("p",{className:"dropin-incrementer__content--error-message",children:e(z,{id:w,fields:{minQuantity:l,maxQuantity:d}})})]})},pe=({name:a,value:r,variant:n="primary",className:t,disabled:s,error:i,floatingLabel:l,onValue:d,onUpdateError:_,size:m="medium",icon:h,maxLength:p,success:c,...u})=>{const b=(u==null?void 0:u.id)||a||`dropin-input-${Math.random().toString(36)}`,f=C(oe(async w=>{if(d)try{await d(w)}catch(x){_&&_(x)}},200),[d,_]),v=w=>{const x=w.target;f(x.value.trim())};return e("div",{className:o(["dropin-input-container",`dropin-input-container--${n}`,["dropin-input-container--floating",!!l],["dropin-input-container--disabled",s]]),children:[h&&e(y,{node:h,className:o(["dropin-input__field-icon--left",h.props.className])}),e("div",{className:"dropin-input-label-container",children:[e("input",{id:b,onChange:v,type:"text",maxLength:p,name:a,value:r,...u,className:o(["dropin-input",`dropin-input--${m}`,`dropin-input--${n}`,["dropin-input--error",!!i],["dropin-input--success",!!c],["dropin-input--disabled",s],["dropin-input--floating",!!l],["dropin-input--icon-left",!!h],t]),disabled:s}),l&&e("label",{htmlFor:b,className:o([["dropin-input__label--floating",!!l],["dropin-input__label--floating--icon-left",!!h],["dropin-input__label--floating--error",!!i]]),children:l})]}),i&&e("div",{className:o(["dropin-input__field-icon--right","dropin-input__field-icon--error"]),children:e(T,{source:Ie,size:"16",stroke:"2",className:"dropin-input--warning-icon",viewBox:"-1 -1 26 26"})}),c&&e("div",{className:o(["dropin-input__field-icon--right","dropin-input__field-icon--success"]),children:e(T,{source:De,size:"16",stroke:"2",className:"dropin-input--success-icon",viewBox:"-1 -1 26 26"})})]})},ht=({name:a="",error:r,value:n,label:t,onChange:s,onBlur:i,...l})=>{const d=I({picker:"Dropin.InputDate.picker"}),_=p=>{p.currentTarget.setAttribute("type","date")},m=p=>{var u;const c=(u=p.currentTarget.parentElement)==null?void 0:u.querySelector("input");c==null||c.focus(),c==null||c.showPicker()},h=p=>{p.currentTarget.setAttribute("type","text"),i==null||i(p)};return e("div",{className:o(["dropin-input-date"]),children:[e(me,{error:r,children:e(pe,{error:!!r,name:a,value:n==null?void 0:n.toString(),placeholder:t,floatingLabel:t,onFocus:_,onBlur:h,onChange:s,"aria-labelledby":t,className:"dropin-input-date__input",...l})}),e("button",{className:"dropin-input-date__icon","aria-label":d.picker,onClick:m,children:e(T,{source:Ee,size:"24"})})]})},ie={pending:e(U,{}),success:e(de,{}),error:e(j,{style:{fill:"red"}})},qe=({minLength:a=0,requiredCharacterClasses:r=0,uniqueSymbolsStatus:n="pending",validateLengthConfig:t={status:"",icon:"",message:""}})=>{const s=I({chartTwoSymbols:"Dropin.PasswordStatusIndicator.chartTwoSymbols",chartThreeSymbols:"Dropin.PasswordStatusIndicator.chartThreeSymbols",chartFourSymbols:"Dropin.PasswordStatusIndicator.chartFourSymbols"}),i=l=>{switch(l){case 2:return s.chartTwoSymbols;case 3:return s.chartThreeSymbols;case 4:return s.chartFourSymbols;default:return""}};return e("div",{className:o(["dropin-password-status-indicator"]),children:[a>0?e("div",{className:`dropin-password-status-indicator__item dropin-password-status-indicator__item--${t.status}`,"data-testid":`dropin-password-status-indicator__item--${t.icon}`,children:[ie[t.icon],e("span",{className:`${t.status}`,children:t.message})]}):null,r>=2?e("div",{className:`dropin-password-status-indicator__item dropin-password-status-indicator__item--${n}`,"data-testid":`dropin-password-status-indicator__item--${n}`,children:[ie[n],e("span",{className:"pending",children:i(r)})]}):null]})},bt=({placeholder:a,floatingLabel:r,children:n,name:t,required:s,className:i,minLength:l,autoComplete:d,defaultValue:_="",hideStatusIndicator:m=!1,uniqueSymbolsStatus:h,validateLengthConfig:p,requiredCharacterClasses:c,errorMessage:u,onValue:b,onBlur:f,...v})=>{const w=I({placeholder:"Dropin.InputPassword.placeholder",floatingLabel:"Dropin.InputPassword.floatingLabel",buttonTitle:"Dropin.InputPassword.buttonTitle"}),[x,E]=B(!1),$=C(()=>{E(k=>!k)},[]);return e("div",{"data-testid":"passwordFieldInput",className:o(["dropin-input-password",["dropin-input-password--error",u],i]),...v,children:[e(me,{error:u,children:e(pe,{autoComplete:d,name:t??"password",type:x?"text":"password",placeholder:a||w.placeholder,floatingLabel:r||w.floatingLabel,"aria-label":w.placeholder,"aria-required":!0,required:s||!1,value:_,onValue:b,icon:e($e,{}),onBlur:f,"data-testid":"passwordInput"})}),e(V,{"aria-label":w.buttonTitle,title:w.buttonTitle,type:"button","data-testid":"toggle-password-icon",variant:"tertiary",className:o(["dropin-input-password__eye-icon",`dropin-input-password__eye-icon--${x?"show":"hide"}`,i]),onClick:$,children:x?e(Se,{}):e(Te,{})}),m?null:e(qe,{minLength:l,requiredCharacterClasses:c,validateLengthConfig:p,uniqueSymbolsStatus:h}),n]})},ft=({disabled:a,name:r="",errorMessage:n,value:t,label:s,className:i,onChange:l,onBlur:d,..._})=>{const m=(_==null?void 0:_.id)||r||`dropin-textarea-${Math.random().toString(36)}`,h=!!(n!=null&&n.length),p=C(c=>{const u=c.target;u.style.height="auto",u.style.height=`${u.scrollHeight}px`,l==null||l(c)},[l]);return e("div",{className:o(["dropin-textarea-container",i]),"data-testid":"dropin-textarea-container",children:[e("textarea",{"data-testid":"dropin-textarea-field",className:o(["dropin-textarea",["dropin-textarea--error",h],["dropin-textarea--disabled",!!a]]),id:m,placeholder:s,name:r,value:t,disabled:a,onBlur:d,onChange:p,..._}),e("label",{htmlFor:m,className:o(["dropin-textarea__label--floating",["dropin-textarea__label--floating--error",h]]),children:s}),h?e("div",{className:o(["dropin-textarea__label--floating--text",["dropin-textarea__label--floating--error",h]]),children:n}):null]})},Me=({className:a,src:r,params:n,loading:t="lazy",srcSet:s,onLoad:i,...l})=>{const[d,_]=B(!1),m=M(()=>{if(s)return s;if(!(!r||!n))return fe(r,{...n})},[n,r,s]),h=p=>{_(!0),i==null||i(p)};return e("img",{...l,className:o(["dropin-image",["dropin-image--loaded",d],a]),loading:t,onLoad:h,src:r,srcSet:m})},_e=({variant:a="primary",className:r})=>e("hr",{role:"separator",className:o(["dropin-divider",`dropin-divider--${a}`,r])}),A=({amount:a=0,currency:r,locale:n=void 0,variant:t="default",weight:s="bold",className:i,children:l,sale:d=!1,formatOptions:_={},size:m="small",...h})=>{const p=M(()=>new Intl.NumberFormat(n,{style:"currency",currency:r||"USD",minimumFractionDigits:2,maximumFractionDigits:2,..._}),[n,r,_]),c=M(()=>p.format(a),[a,p]);return e("span",{...h,className:o(["dropin-price",`dropin-price--${t}`,`dropin-price--${m}`,`dropin-price--${s}`,["dropin-price--sale",d],i]),children:c})},He=({name:a,label:r,value:n,size:t="medium",checked:s=!1,disabled:i=!1,error:l=!1,description:d="",busy:_=!1,className:m,children:h,...p})=>e("label",{className:o([m,"dropin-radio-button",["dropin-radio-button--error",l],["dropin-radio-button--disabled",i]]),children:[e("input",{name:a,value:n,checked:s,disabled:i,type:"radio",className:o(["dropin-radio-button__input",["dropin-radio-button__input--error",l],["dropin-radio-button__input--disabled",i]]),"aria-busy":_,...p}),e("span",{className:o(["dropin-radio-button__label",`dropin-radio-button__label--${t}`,["dropin-radio-button__label--error",l],["dropin-radio-button__label--disabled",i]]),children:r}),e("span",{className:o(["dropin-radio-button__description",`dropin-radio-button__description--${t}`,["dropin-radio-button__description--disabled",i]]),children:d})]}),V=({value:a,variant:r="primary",size:n="medium",icon:t,className:s,children:i,disabled:l=!1,active:d=!1,activeChildren:_,activeIcon:m,href:h,...p})=>{let c="dropin-button";(t&&!i||t&&d&&!_||!t&&d&&m)&&(c="dropin-iconButton"),d&&_&&(c="dropin-button"),s=o([c,`${c}--${n}`,`${c}--${r}`,[`${c}--${r}--disabled`,l],i&&t&&`${c}--with-icon`,!i&&_&&t&&`${c}--with-icon`,d&&m&&`${c}--with-icon`,s]);const u=o(["dropin-button-icon",`dropin-button-icon--${r}`,[`dropin-button-icon--${r}--disabled`,l],t==null?void 0:t.props.className]),b=h?{node:e("a",{}),role:"link",href:h,...p,disabled:l,active:d,onKeyDown:f=>{l&&f.preventDefault()},tabIndex:l?-1:0}:{node:e("button",{}),role:"button",...p,value:a,disabled:l,active:d};return e(y,{...b,className:s,children:[t&&!d&&e(y,{node:t,className:u}),m&&d&&e(y,{node:m,className:u}),i&&!d&&(typeof i=="string"?e("span",{children:i}):i),d&&_&&(typeof _=="string"?e("span",{children:_}):_)]})};function ae(a,r,n,t,s){return a||(r?r.value:n||t?"":s?s.value:null)}const We=({name:a,value:r=null,options:n,variant:t="primary",floatingLabel:s,size:i="medium",handleSelect:l=()=>{},disabled:d=!1,error:_=!1,placeholder:m,defaultOption:h,icon:p,className:c,...u})=>{const b=(u==null?void 0:u.id)||a||`dropin-picker-${Math.random().toString(36)}`,f=!!(u!=null&&u.required),v=n==null?void 0:n.find(L=>!L.disabled),[w,x]=B(()=>ae(r,h,m,s,v));W(()=>{x(ae(r,h,m,s,v))},[r,h,m,s,v]);const E=L=>{const{options:D,value:S}=L.target;for(const H of D)H.selected&&(x(S),l(L))},$=n==null?void 0:n.map(L=>{const{value:D,text:S,disabled:H}=L;return e("option",{value:D,selected:D===w,disabled:H,className:o(["dropin-picker__option"]),children:S},D)}),k=!!w,O=()=>(!f||!k)&&(s||m);return e("div",{className:o([c,"dropin-picker",`dropin-picker__${i}`,["dropin-picker__floating",!!s],["dropin-picker__selected",k],["dropin-picker__error",_],["dropin-picker__disabled",d],["dropin-picker__icon",p]]),children:[p&&e(p.type,{...p.props,className:"dropin-picker__icon--placeholder"}),e("select",{id:b,className:o(["dropin-picker__select",`dropin-picker__select--${t}`,`dropin-picker__select--${i}`,["dropin-picker__select--floating",!!s]]),name:a,"aria-label":a,disabled:d,onChange:E,...u,children:[O()&&e("option",{selected:!k,value:"",className:o(["dropin-picker__option dropin-picker__placeholder"]),children:s??m},r),$]}),e(T,{source:J,size:"24",stroke:"2",className:"dropin-picker__chevronDown"}),s&&k&&e("label",{htmlFor:b,className:o(["dropin-picker__floatingLabel",!!s]),children:s})]})},me=({className:a,label:r,error:n,hint:t,success:s,size:i="medium",disabled:l=!1,children:d,..._})=>{var p;const m=((p=d==null?void 0:d.props)==null?void 0:p.id)??`dropin-field-${Math.random().toString(36)}`,h=d&&typeof d.type!="string"?d.type:null;return e("div",{..._,className:o(["dropin-field",a]),children:[r&&e("label",{className:o(["dropin-field__label",["dropin-field__label--disabled",l],`dropin-field__label--${i}`]),htmlFor:m,children:r}),e("div",{className:o(["dropin-field__content"]),children:h&&d&&we(h,{...d.props,id:m,key:d.key,disabled:l,size:i,error:!!n,success:!!s&&!n})}),e("div",{className:o(["dropin-field__hint",[`dropin-field__hint--${i}`,i],["dropin-field__hint--error",!!n],["dropin-field__hint--success",!!s&&!n],["dropin-field__hint--disabled",!!l]]),children:n||s||t})]})},vt=({icon:a,className:r,children:n,active:t=!1,disabled:s=!1,...i})=>e("button",{role:"button",disabled:s,...i,className:o(["dropin-action-button",["dropin-action-button--active",t],["dropin-action-button--disabled",s],r]),children:[a&&e(y,{node:a,className:o(["dropin-action-button-icon"])}),n&&(typeof n=="string"?e("span",{children:n}):n)]}),gt=({className:a,variant:r="primary",activeOption:n,disabled:t=!1,dividers:s=!0,children:i,handleSelect:l,...d})=>{const[_,m]=B(n),h=C(c=>{t||c.props.disabled||(m(c.props.value),l&&l(c.props.value))},[l,m,t]),p=se.map(i,c=>{const u=t||c.props.disabled,b=c.props.value===_;return ke(c,{disabled:u,active:b,onClick:()=>h(c),className:o(["dropin-action-button-group__option",`dropin-action-button-group__option--${r}`,["dropin-action-button-group__option--active",b],["dropin-action-button-group__option--with-dividers",s]])})});return e("div",{role:"group",...d,className:o(["dropin-action-button-group",`dropin-action-button-group--${r}`,a]),children:p})},Ge=({variant:a="primary",className:r,children:n,...t})=>e("div",{...t,className:o(["dropin-card",`dropin-card--${a}`,r]),children:e("div",{class:"dropin-card__content",children:n})}),Nt=({name:a,value:r,size:n="medium",disabled:t=!1,error:s=!1,label:i="",description:l="",className:d,checked:_,...m})=>{const[h,p]=B(_===void 0?!1:_),c=le(null),u=f=>{var v;(v=m.onChange)==null||v.call(m,f),p(f.currentTarget.checked)},b=f=>{var v;f.key===" "&&(f.preventDefault(),(v=c==null?void 0:c.current)==null||v.click())};return e("label",{className:o(["dropin-checkbox",["dropin-checkbox--disabled",t]]),children:[e("input",{ref:c,name:a,value:r,type:"checkbox",disabled:t,className:o(["dropin-checkbox__checkbox",["dropin-checkbox__checkbox--error",s],d]),...m,onChange:u,checked:h}),e("span",{"aria-checked":h?"true":"false","aria-labelledby":`${a}-label`,"aria-describedby":`${a}-description`,className:o(["dropin-checkbox__box",["dropin-checkbox__box--error",s],["dropin-checkbox__box--disabled",t]]),role:"checkbox",tabIndex:t?-1:0,onKeyDown:b,children:e(T,{className:o(["dropin-checkbox__checkmark"]),source:de,size:"16",stroke:"3"})}),e("div",{id:`${a}-label`,className:o(["dropin-checkbox__label",`dropin-checkbox__label--${n}`,["dropin-checkbox__label--disabled",t]]),children:i}),e("div",{}),e("div",{id:`${a}-description`,role:"note",className:o(["dropin-checkbox__description",`dropin-checkbox__description--${n}`,["dropin-checkbox__description--disabled",t]]),children:l})]})},wt=({className:a,name:r,value:n,id:t,label:s,groupAriaLabel:i,size:l="medium",color:d,disabled:_=!1,selected:m=!1,outOfStock:h=!1,multi:p=!1,onValue:c,onUpdateError:u,...b})=>{const f=I("Dropin.Swatches.outOfStock.label").label,v=I("Dropin.Swatches.selected.label").label,w=I("Dropin.Swatches.swatch.label").label,x=C(async D=>{if(c)try{await c(D)}catch(S){u&&u(S)}},[c,u]),E=D=>{const S=D.target;x(S.value)},O=d&&(D=>{const S=new Option().style;return S.color=D,S.color!==""})(d)?d:"var(--color-gray-300);",L=()=>h?`${i}: ${s} ${f}`:m?`${i}: ${s} ${v}`:`${i}: ${s} ${w}`;return e("label",{className:o(["dropin-color-swatch__container",`dropin-color-swatch__container--${l}`,a]),children:[e("input",{type:p?"checkbox":"radio",name:r,id:t,value:n,"aria-label":L(),checked:m,disabled:_,onChange:E,...b,className:o(["dropin-color-swatch",["dropin-color-swatch--selected",m],["dropin-color-swatch--disabled",_],a])}),e("span",{style:{"--bg-color":O},className:o(["dropin-color-swatch__span",["dropin-color-swatch__span--out-of-stock",h],a])})]})},kt=({className:a,name:r,value:n,label:t,groupAriaLabel:s,id:i,disabled:l=!1,selected:d=!1,outOfStock:_=!1,multi:m=!1,onValue:h,onUpdateError:p,...c})=>{const u=I("Dropin.Swatches.outOfStock.label").label,b=I("Dropin.Swatches.selected.label").label,f=I("Dropin.Swatches.swatch.label").label,[v,w]=B(!1),x=le(null),E=C(async O=>{if(h)try{await h(O)}catch(L){p&&p(L)}},[h,p]),$=O=>{const L=O.target;E(L.value)},k=()=>_?`${s}: ${t} ${u}`:d?`${s}: ${t} ${b}`:`${s}: ${t} ${f}`;return W(()=>{x.current&&x.current.scrollWidth>x.current.clientWidth&&w(!0)},[t]),e("div",{className:"dropin-text-swatch__container",...v?{"data-tooltip":t}:{},children:[e("input",{type:m?"checkbox":"radio",name:r,id:i,value:n,"aria-label":k(),checked:d,disabled:l,onChange:$,...c,className:o(["dropin-text-swatch",["dropin-text-swatch--selected",d],["dropin-text-swatch--disabled",l],a])}),e("label",{htmlFor:i,ref:x,className:o(["dropin-text-swatch__label",["dropin-text-swatch__label--out-of-stock",_],a]),children:t})]})},Ke=({ariaLabel:a,size:r="small",stroke:n="4",children:t,className:s,style:i,...l})=>{const d=["dropin-progress-spinner",`dropin-progress-spinner--shape-size-${r}`,`dropin-progress-spinner--shape-stroke-${n}`],_=I({updating:"Dropin.ProgressSpinner.updating.label",updatingChildren:"Dropin.ProgressSpinner.updatingChildren.label"}),m=()=>a||(t?_.updatingChildren:_.updating);return t?e("div",{...l,className:o(["dropin-progress-spinner-provider"]),"aria-live":"polite",role:"status",children:[e("div",{"aria-hidden":!0,children:t}),e("div",{"aria-label":m(),role:"status",className:o(["dropin-progress-spinner-background",s]),style:i}),e("div",{className:o(["dropin-progress-spinner-with-provider",...d]),"aria-hidden":!0})]}):e("div",{...l,className:o([s,...d]),"aria-live":"polite",role:"status","aria-label":m()})},yt=({className:a,name:r,value:n,id:t,label:s,groupAriaLabel:i,src:l,alt:d,disabled:_=!1,selected:m=!1,outOfStock:h=!1,multi:p=!1,onValue:c,onUpdateError:u,...b})=>{const f=I("Dropin.Swatches.outOfStock.label").label,v=I("Dropin.Swatches.selected.label").label,w=I("Dropin.Swatches.swatch.label").label,x=C(async k=>{if(c)try{await c(k)}catch(O){u&&u(O)}},[c,u]),E=k=>{const O=k.target;x(O.value)},$=()=>h?`${i}: ${s} ${f}`:m?`${i}: ${s} ${v}`:`${i}: ${s} ${w}`;return e("label",{className:o(["dropin-image-swatch__container",a]),children:[e("input",{type:p?"checkbox":"radio",name:r,id:t,value:n,"aria-label":$(),checked:m,disabled:_,onChange:E,...b,className:o(["dropin-image-swatch",["dropin-image-swatch--selected",m],["dropin-image-swatch--disabled",_],a])}),e("span",{className:o(["dropin-image-swatch__span",["dropin-image-swatch__span--out-of-stock",h],a]),children:e(Me,{src:l,className:o(["dropin-image-swatch__content"]),params:{width:100,fit:"bounds",crop:!0},alt:d,loading:"lazy",onError:k=>k.target.style.display="none"})})]})},Ue=({className:a,children:r,title:n,secondaryText:t,actionIconPosition:s="left",iconOpen:i=K,iconClose:l=U,iconLeft:d=K,showIconLeft:_=!1,renderContentWhenClosed:m=!0,defaultOpen:h=!1,onStateChange:p,...c})=>{const[u,b]=B(h),f=$=>{$.stopImmediatePropagation();const k=!u;b(k),p==null||p(k)},v=I(`Dropin.Accordion.${u?"close":"open"}.label`).label,w=e(T,{source:i,size:"24",onClick:f,onKeyPress:f,className:"dropin-accordion-section__open-icon"}),x=e(T,{source:l,size:"24",onClick:f,onKeyPress:f,className:"dropin-accordion-section__close-icon"}),E=e(T,{source:d,size:"24"});return e("div",{...c,className:o(["dropin-accordion-section",a]),children:[e("div",{className:"dropin-accordion-section__heading",children:[e("div",{className:"dropin-accordion-section__flex",onClick:f,onKeyPress:f,role:"button","aria-label":`${v} ${n}`,tabIndex:0,children:e("div",{className:"dropin-accordion-section__title-container",children:[s==="left"&&(u?x:w),_&&E,e("h3",{className:"dropin-accordion-section__title",children:n})]})}),e("div",{className:"dropin-accordion-section__secondary-text-container",children:[t&&e("h4",{className:"dropin-accordion-section__secondary-text",children:t}),s==="right"&&(u?x:w)]})]}),e("div",{className:"dropin-accordion-section__content-container",style:{display:u?"grid":"none"},children:(u||m&&!u)&&r})]})},xt=({className:a,children:r,actionIconPosition:n="left",iconOpen:t=K,iconClose:s=U,...i})=>{const l=e(_e,{variant:"secondary"}),d=_=>e(R,{children:[e(Ue,{..._.props,actionIconPosition:n,iconOpen:t,iconClose:s}),l]});return e("div",{...i,className:o(["dropin-accordion",a]),children:[l,...(Array.isArray(r)?r:[r]).map(d)]})},Dt=({variant:a="primary",className:r,type:n="warning",additionalActions:t,onDismiss:s,heading:i,description:l,icon:d,itemList:_,actionButtonPosition:m,...h})=>{var c,u,b;const p=I({dismiss:"Dropin.InlineAlert.dismissLabel"});return e("div",{...h,className:o(["dropin-in-line-alert",`dropin-in-line-alert--${n}`,`dropin-in-line-alert--${a}`,r]),children:[e("div",{className:"dropin-in-line-alert__heading",children:[e("div",{className:"dropin-in-line-alert__title-container",children:[d&&e(y,{node:d,className:"dropin-in-line-alert__icon"}),e("span",{className:"dropin-in-line-alert__title",children:i})]}),e("div",{className:"dropin-in-line-alert__actions-container",children:[t&&(m==="top"||!m&&t.length<=1)&&e(V,{variant:"tertiary",className:"dropin-in-line-alert__additional-action",onClick:t.length>0?(c=t[0])==null?void 0:c.onClick:void 0,"aria-label":(u=t[0])==null?void 0:u.label,children:(b=t[0])==null?void 0:b.label}),s&&e(V,{icon:e(T,{source:j,size:"24",stroke:"2"}),className:"dropin-in-line-alert__dismiss-button",variant:"tertiary",onClick:s,"aria-label":p.dismiss})]})]}),l&&e("p",{className:"dropin-in-line-alert__description",children:l}),e("div",{className:"dropin-in-line-alert__item-list-container",children:_&&e(y,{node:_,className:o(["dropin-in-line-alert__item-list"])})}),t&&(m==="bottom"||!m&&t.length>1)&&e("div",{className:"dropin-in-line-alert__additional-actions-container",children:t.map(f=>e(V,{variant:"tertiary",className:"dropin-in-line-alert__additional-action",onClick:f.onClick,children:f.label},f.label))})]})},It=({size:a="small",title:r=null,centered:n=!1,backgroundDim:t=!0,clickToDismiss:s=!0,escapeToDismiss:i=!0,onClose:l,showCloseButton:d=!0,className:_,children:m=null,...h})=>{const p=C(()=>{l==null||l()},[l]),c=I({modalCloseLabel:"Dropin.Modal.Close.label"});return W(()=>{const u=b=>{const f=document.querySelector(".dropin-modal"),v=document.querySelector(".dropin-modal__body");s&&f&&v&&!v.contains(b.target)&&p()};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[p,s]),W(()=>{const u=b=>{b.key==="Escape"&&i&&p()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[p,i]),W(()=>{const u=document.scrollingElement,b=u.style.overflow;return u.style.overflow="hidden",()=>{u.style.overflow=b}},[]),e("div",{className:o(["dropin-modal",["dropin-modal--dim",t]]),children:e("div",{...h,className:o(["dropin-modal__body",[`dropin-modal__body--${a}`,a],_]),children:[e("div",{className:o(["dropin-modal__header",["dropin-modal__header-title",!!r]]),children:[r&&e("div",{className:o(["dropin-modal__header-title-content"]),children:r}),d&&e(V,{"aria-label":c.modalCloseLabel,variant:"tertiary",className:"dropin-modal__header-close-button",onClick:p,icon:e(j,{})})]}),e("div",{className:o(["dropin-modal__content",["dropin-modal__body--centered",n]]),children:m})]})})},Et=({className:a,children:r,ariaLabel:n,image:t,title:s,price:i,taxIncluded:l=!1,taxExcluded:d=!1,total:_,totalExcludingTax:m,sku:h,configurations:p,warning:c,alert:u,discount:b,savings:f,quantity:v,description:w,attributes:x,footer:E,loading:$=!1,updating:k=!1,quantityType:O,dropdownOptions:L,onQuantity:D,onRemove:S,...H})=>{var X,Y;const{locale:G}=ye(ce),P=I({each:"Dropin.CartItem.each.label",pricePerItem:"Dropin.CartItem.pricePerItem.label",quantity:"Dropin.CartItem.quantity.label",remove:"Dropin.CartItem.remove.label",removeDefault:"Dropin.CartItem.removeDefault.label",taxIncluded:"Dropin.CartItem.taxIncluded.label",taxExcluded:"Dropin.CartItem.taxExcluded.label",updating:"Dropin.CartItem.updating.label",updatingDefault:"Dropin.ProgressSpinner.updating.label"});if($)return e(je,{});const ue=O==="dropdown"?e(We,{className:o(["dropin-cart-item__quantity__picker"]),value:String(v),name:"quantity","aria-label":P.quantity,disabled:k,variant:"primary",options:L,handleSelect:F=>D==null?void 0:D(Number(F.target.value))}):e(Fe,{className:o(["dropin-cart-item__quantity__incrementer"]),value:v,min:1,onValue:F=>D==null?void 0:D(Number(F)),name:"quantity","aria-label":P.quantity,disabled:k});return e("div",{...H,className:o(["dropin-cart-item",["dropin-cart-item--updating",k],a]),children:[k&&e(Ke,{className:o(["dropin-cart-item__spinner"]),ariaLabel:n?(X=P.updating)==null?void 0:X.replace("{product}",n):P.updatingDefault}),e("div",{className:"dropin-cart-item__wrapper",children:[t&&e(y,{node:t,className:o(["dropin-cart-item__image"])}),s&&e(y,{node:s,className:o(["dropin-cart-item__title",["dropin-cart-item__title--edit",!!D||!!S]])}),w&&e(y,{node:w,className:o(["dropin-cart-item__description"])}),h&&e(y,{node:h,className:o(["dropin-cart-item__sku"])}),e("div",{className:o(["dropin-cart-item__savings__wrapper"]),children:[b&&e(y,{node:b,className:o(["dropin-cart-item__discount","dropin-cart-item__discount__large-screen"])}),f&&e(y,{node:f,className:o(["dropin-cart-item__savings","dropin-cart-item__savings__large-screen"])})]}),x&&e("div",{className:o(["dropin-cart-item__attributes"]),children:e(y,{node:x})}),p&&e("ul",{className:o(["dropin-cart-item__configurations"]),children:Object.entries(p).map(([F,he])=>e("li",{className:o(["dropin-cart-item__configurations__item"]),children:[F,":"," ",e("strong",{className:o(["dropin-cart-item__configurations__item__value"]),children:he})]},F))}),i&&e("span",{className:o(["dropin-cart-item__price"]),"aria-label":P.pricePerItem,children:[v&&!D&&e(R,{children:[e("span",{className:"dropin-cart-item__price__quantity","aria-hidden":!0,children:[v.toLocaleString(G)," x"," "]}),e("div",{className:"dropin-cart-item__sr-only",children:[P.quantity,": ",v==null?void 0:v.toLocaleString(G),";"]})]}),e(y,{node:i,role:"text"}),v&&v>1&&e(R,{children:[" ",P.each]}),l&&e("span",{"data-testid":"tax-message",className:"dropin-cart-item__price-tax-message",children:[" ",P.taxIncluded]}),d&&e("span",{"data-testid":"tax-message",className:"dropin-cart-item__price-tax-message",children:[" ",P.taxExcluded]})]}),e("div",{className:o(["dropin-cart-item__quantity",["dropin-cart-item__quantity--edit",!!D]]),children:[D?ue:v&&e("span",{className:o(["dropin-cart-item__quantity__value"]),children:[P.quantity,":"," ",e("strong",{className:"dropin-cart-item__quantity__number",children:Number(v).toLocaleString(G)})]}),c&&e(y,{node:c,className:o(["dropin-cart-item__warning","dropin-cart-item__warning--quantity"])}),u&&e(y,{node:u,className:o(["dropin-cart-item__alert","dropin-cart-item__alert--quantity"])})]}),c&&e(y,{node:c,className:o(["dropin-cart-item__warning"])}),u&&e(y,{node:u,className:o(["dropin-cart-item__alert"])}),e("div",{className:o(["dropin-cart-item__total",["dropin-cart-item__total--edit",!!S]]),children:[e("div",{className:"dropin-cart-item__row-total__wrapper",children:[_&&e("div",{className:"dropin-cart-item__row-total",children:e(y,{node:_,role:"text"})}),l&&e("div",{className:"dropin-cart-item__total-tax-included",children:e("span",{"data-testid":"tax-message",className:o(["dropin-cart-item__total-tax-message"]),children:P.taxIncluded})})]}),d&&e("div",{className:"dropin-cart-item__total-tax-excluded",children:e("span",{"data-testid":"tax-message",className:o(["dropin-cart-item__total-tax-excluded-message"]),children:[m&&e(y,{node:m,role:"text"})," ",P.taxExcluded]})}),b&&e(y,{node:b,className:o(["dropin-cart-item__discount"])}),f&&e(y,{node:f,className:o(["dropin-cart-item__savings"])})]}),E&&e("div",{className:o(["dropin-cart-item__footer"]),children:e(y,{node:E})})]}),S&&e(V,{"data-testid":"cart-item-remove-button",className:o(["dropin-cart-item__remove"]),variant:"tertiary",onClick:()=>S==null?void 0:S(),icon:e(T,{"data-testid":"cart-item-remove-icon",source:Le,size:"24",stroke:"2",viewBox:"0 0 24 24","aria-label":n?(Y=P.remove)==null?void 0:Y.replace("{product}",n):P.removeDefault}),disabled:k})]})},je=()=>e("div",{className:"dropin-cart-item dropin-cart-item-skeleton",children:e(Ce,{className:"dropin-cart-item__skeleton dropin-cart-item__wrapper",children:[e("div",{className:"dropin-cart-item__image",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__title",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__sku",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__price",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__quantity",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__total",children:e(q,{className:"dropin-cart-item__skeleton__item"})})]})}),$t=({className:a,children:r,...n})=>e("div",{...n,className:o(["dropin-cart-list",a]),children:e("div",{className:"dropin-cart-list__wrapper","aria-live":"assertive","aria-relevant":"all",children:se.map(r,(t,s)=>e("div",{className:"dropin-cart-list__item",children:t},s))})}),St=({className:a,children:r,locale:n,currency:t,amount:s,variant:i="default",minimumAmount:l,maximumAmount:d,size:_="small",display:m="dash",specialPrice:h,sale:p=!1,...c})=>{const u=M(()=>s||l===d||l&&!d||d&&!l,[s,d,l]);return e("div",{children:u?e("div",{...c,className:o(["dropin-price-range",a]),children:e(A,{amount:s??l??d,currency:t,locale:n,size:_,variant:i,sale:p})}):e("div",{...c,className:o(["dropin-price-range",a]),children:[m==="dash"?e(ze,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null,m==="from to"?e(Ze,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null,m==="as low as"?e(Je,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null]})})};function ze({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){return e(R,{children:[e(A,{amount:a??r,currency:t,locale:s,size:i,sale:!!a&&l}),e("span",{className:"dropin-price-range__separator",children:"-"}),e(A,{amount:n,currency:t,locale:s,size:i})]})}function Ze({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){const d=I({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return e(R,{children:[e("span",{className:o(["dropin-price-range__from",`dropin-price-range__from--${i}`]),children:d.from}),e(A,{amount:a??r,currency:t,locale:s,size:i,sale:!!a&&l}),e("span",{className:o(["dropin-price-range__to",`dropin-price-range__to--${i}`]),children:d.to}),e(A,{amount:n,currency:t,locale:s,size:i})]})}function Je({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){const d=I({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return e(R,{children:[e("span",{className:o(["dropin-price-range__as-low-as",`dropin-price-range__as-low-as--${i}`]),children:d.asLowAs}),a?e("div",{children:[e(A,{amount:n,currency:t,locale:s,size:i,variant:"strikethrough"}),e(A,{amount:a,currency:t,locale:s,size:i,className:"dropin-price-range__special",sale:!!a&&l})]}):e(A,{amount:r,currency:t,locale:s,size:i})]})}const Tt=({className:a,categories:r,separator:n,...t})=>e(R,{children:(r==null?void 0:r.length)>1&&e("nav",{role:"navigation",...t,className:o(["dropin-breadcrumbs__container",a]),children:e("ul",{className:"dropin-breadcrumbs__items",children:r==null?void 0:r.map((s,i)=>e("li",{className:o(["dropin-breadcrumbs__item",["dropin-breadcrumbs__item--last",i===r.length-1]]),children:[e(y,{node:s,className:"dropin-breadcrumbs__link"}),!n&&i!==r.length-1&&e("span",{className:"dropin-breadcrumbs__separator--default",children:[" ","/"," "]}),n&&i!==r.length-1&&e(y,{node:n,className:"dropin-breadcrumbs__separator--icon"})]},i))})})}),Lt=({className:a,variant:r,icon:n,message:t,onDismiss:s,action:i,...l})=>{const d=I({dismiss:"Dropin.InlineAlert.dismissLabel"});return e("div",{...l,className:o([a,"dropin-alert-banner",`dropin-alert-banner--${r}`]),children:[e("div",{className:"dropin-alert-banner__content",children:[n&&e(y,{node:n,"aria-hidden":"true",className:"dropin-alert-banner__icon"}),e(y,{node:t,className:o(["dropin-alert-banner__message"])})]}),e("div",{className:"dropin-alert-banner__actions",children:[i&&e(V,{variant:"tertiary",className:"dropin-alert-banner__action",onClick:i.onClick,"aria-label":i.label,children:i.label}),e(V,{icon:e(T,{source:j,size:"24",stroke:"2"}),className:"dropin-alert-banner__dismiss-button",variant:"primary",onClick:s,"aria-label":d.dismiss})]})]})},Pt=({className:a,icon:r,heading:n,headingLevel:t=2,message:s,action:i,variant:l="secondary",...d})=>{const _=t>=1&&t<=6?`h${t}`:"h2";return e("div",{...d,className:o(["dropin-illustrated-message",a]),children:e(Ge,{variant:l,children:[r&&e(y,{node:r,"aria-hidden":"true",size:"80",className:"dropin-illustrated-message__icon"}),n&&e(_,{className:"dropin-illustrated-message__heading",children:n}),s&&e(y,{node:s,className:"dropin-illustrated-message__message"}),i&&e(y,{node:i,className:"dropin-illustrated-message__action"})]})})},Ot=({className:a,label:r,name:n,value:t,selected:s=!0,onChange:i,icon:l,busy:d=!1,children:_,...m})=>e("div",{...m,className:o(["dropin-toggle-button",a,["dropin-toggle-button__selected",s]]),children:e("label",{className:"dropin-toggle-button__actionButton",children:[e(He,{label:"",name:n,value:t,checked:s,onChange:()=>i&&i(t),"aria-label":r,busy:d,className:o([a,"dropin-toggle-button__radioButton"])}),e("span",{className:"dropin-toggle-button__content",children:[l&&e(l.type,{...l==null?void 0:l.props,className:"dropin-toggle-button__icon"}),r]})]})}),Ct=({title:a=null,size:r="medium",cta:n,divider:t=!0,className:s,...i})=>a?e("div",{...i,className:o(["dropin-header-container",s]),"data-testid":"dropin-header-container",children:[e("span",{className:o(["dropin-header-container__title",["dropin-header-container__title--medium",r==="medium"],["dropin-header-container__title--large",r==="large"]]),children:a}),n?e(y,{node:n,className:"dropin-header-container__actions"}):null,t?e(_e,{className:o(["dropin-header-container__divider",["dropin-header-container__divider--medium",r==="medium"],["dropin-header-container__divider--large",r==="large"]])}):null]}):null,At=({label:a,className:r,...n})=>a?e("div",{...n,className:o(["dropin-tag-container",r]),"data-testid":"dropin-tag-container",children:e("span",{className:"dropin-tag-container__label",children:a})}):null,Vt=({className:a,children:r,maxColumns:n,emptyGridContent:t,...s})=>{const i=!!r&&(Array.isArray(r)?r.length>0:!0),l=i?{gridTemplateColumns:`repeat(${n}, 1fr)`}:void 0;return e("div",{...s,className:o(["dropin-content-grid",a]),tabindex:0,children:e("div",{"data-testid":"content-grid-content",className:o(["dropin-content-grid__content",["dropin-content-grid__dynamic-columns-content",!n],["dropin-content-grid__content--empty",!i]]),style:l,children:i?r:t})})},Rt=({totalPages:a=10,currentPage:r=1,onChange:n,className:t,...s})=>{const i=I({backwardButton:"Dropin.Pagination.backwardButton.ariaLabel",forwardButton:"Dropin.Pagination.forwardButton.ariaLabel"}),l=C(()=>{const p=Math.min(r+1,a);n==null||n(p)},[r,n,a]),d=C(()=>{const p=Math.max(r-1,1);n==null||n(p)},[r,n]),_=C(p=>{ve(p)&&(n==null||n(p))},[n]),m=C((p,c)=>{let u=[];const b=(f,v)=>{for(let w=f;w<=v;w++)u.push({page:w,isActive:w===p,label:w})};return c<=5?b(1,c):p<=2?(b(1,2),u.push({page:"ellipsis",isActive:!1,label:"..."}),b(c-1,c)):p>=c-3?b(c-4,c):(b(p-1,p),u.push({page:"ellipsis",isActive:!1,label:"..."}),b(c-1,c)),u},[]),h=M(()=>m(r,a),[m,r,a]);return e("div",{...s,className:o(["dropin-pagination",t]),children:[e("button",{type:"button","data-testid":"prev-button","aria-label":i.backwardButton,disabled:r===1,onClick:d,className:o(["dropin-pagination-arrow","dropin-pagination-arrow--backward"]),children:e(T,{size:"24",source:J})}),e("ul",{className:"dropin-pagination_list",children:h.map((p,c)=>e("li",{"data-testid":`dropin-pagination_list-item--${p.page}`,className:o(["dropin-pagination_list-item",`dropin-pagination_list-item--${p.page}`,["dropin-pagination_list-item--active",p.isActive]]),children:e("button",{type:"button","data-testid":`set-page-button-${p.page}`,onClick:()=>_(p.page),children:p.label})},`${p.page}_${c}`))}),e("button",{type:"button","data-testid":"next-button","aria-label":i.forwardButton,disabled:r===a,onClick:l,className:o(["dropin-pagination-arrow","dropin-pagination-arrow--forward"]),children:e(T,{size:"24",source:J})})]})};export{xt as Accordion,Ue as AccordionSection,vt as ActionButton,gt as ActionButtonGroup,Lt as AlertBanner,Tt as Breadcrumbs,V as Button,Ge as Card,Et as CartItem,je as CartItemSkeleton,$t as CartList,Nt as Checkbox,wt as ColorSwatch,Vt as ContentGrid,_e as Divider,me as Field,Ct as Header,T as Icon,Pt as IllustratedMessage,Me as Image,yt as ImageSwatch,Dt as InLineAlert,Fe as Incrementer,pe as Input,ht as InputDate,bt as InputPassword,It as Modal,Rt as Pagination,We as Picker,A as Price,St as PriceRange,Ke as ProgressSpinner,He as RadioButton,Ce as Skeleton,q as SkeletonRow,At as Tag,ft as TextArea,kt as TextSwatch,Ot as ToggleButton,ce as UIContext,Ae as UIProvider,ut as provider}; +import{jsx as e}from"./preact-jsx-runtime.js";import{d as Z,c as o,R as be,a as oe,V as y,g as fe,i as ve}from"./chunks/is-number.js";import{G as ge,T as q,k as R,F as g,L as Ne,h as B,q as C,S as K,y as W,_ as we,N as se,E as ke,A as le,x as ye}from"./chunks/icons/Add.js";import{IntlProvider as xe,Localizer as Q,Text as z,useText as I}from"./i18n.js";import U from"./chunks/icons/Minus.js";import De from"./chunks/icons/CheckWithCircle.js";import Ie from"./chunks/icons/WarningWithCircle.js";import Ee from"./chunks/icons/Date.js";import $e from"./chunks/icons/Locker.js";import Se from"./chunks/icons/Eye.js";import Te from"./chunks/icons/EyeClose.js";import de from"./chunks/icons/Check.js";import j from"./chunks/icons/Close.js";import J from"./chunks/icons/ChevronDown.js";import Le from"./chunks/icons/Trash.js";import"./chunks/image-params-keymap.js";import"./signals.js";const Pe={ExampleComponentName:{item:{label:"string"}},Pagination:{backwardButton:{ariaLabel:"Go to previous page"},forwardButton:{ariaLabel:"Go to next page"}},Incrementer:{decreaseLabel:"Decrease Quantity",increaseLabel:"Increase Quantity",label:"Quantity",errorMessage:"Enter a valid quantity",minQuantityMessage:"Enter at least {{minQuantity}}",maxQuantityMessage:"Maximum quantity is {{maxQuantity}}"},Modal:{Close:{label:"Close"}},InputPassword:{placeholder:"Password",floatingLabel:"Password",buttonShowTitle:"Click to show password",buttonHideTitle:"Click to hide password"},PasswordStatusIndicator:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long"},InlineAlert:{dismissLabel:"Dismiss Alert"},PriceSummary:{subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",label:"Total",withoutTax:"Total excluding taxes"}},ProgressSpinner:{updating:{label:"Item is updating"},updatingChildren:{label:"Items are updating"}},PriceRange:{from:{label:"From"},to:{label:"to"},asLowAs:{label:"As low as"}},Swatches:{outOfStock:{label:"out of stock swatch"},selected:{label:"swatch selected"},swatch:{label:"swatch"}},Accordion:{open:{label:"Open"},close:{label:"Close"}},CartItem:{each:{label:"each"},pricePerItem:{label:"price per item"},quantity:{label:"Quantity"},remove:{label:"Remove {product} from the cart"},removeDefault:{label:"Remove item from the cart"},taxIncluded:{label:"incl. VAT"},taxExcluded:{label:"excl. tax"},updating:{label:"{product} is updating"}},InputDate:{picker:"Select a date"}},ee={Dropin:Pe},te={default:ee,en_US:ee},Oe=a=>Z(te.default,te[a]||{}),re=1,H=({className:a,fullWidth:r=!1,lines:n=re,size:t="small",variant:s="row",children:i=null,multilineGap:l="medium",...d})=>{const _=[[`dropin-skeleton-row__${s}`,s],[`dropin-skeleton-row__${s}-${t}`,s&&t]];if(!i&&s==="empty")return e("div",{className:o(["dropin-skeleton-row dropin-skeleton-row__empty",a])});if(i){const h=i.trim();return e("div",{...d,class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],a]),dangerouslySetInnerHTML:{__html:h}})}return n>re===!1?e("div",{...d,class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],"dropin-skeleton--row__content",..._,a])}):e("div",{...d,style:{"--multiline-gap-spacing":`var(--spacing-${l})`},class:o(["dropin-skeleton-row--multiline",["dropin-skeleton-row--full",r],a]),children:Array.from({length:n}).map((h,p)=>e("div",{class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],"dropin-skeleton--row__content",..._])},p))})},Ce=({className:a,children:r,rowGap:n="medium",...t})=>e("div",{style:{"--row-gap-spacing":`var(--spacing-${n})`},...t,className:o(["dropin-skeleton",a]),role:"status","aria-label":"Loading...",children:r}),ce=ge({locale:"en-US"}),Ae=({lang:a="en_US",langDefinitions:r={},children:n})=>{const t=q(()=>{const i=Z(r.default,r[a]??{});return Z(Oe(a),i)},[a,r]),s=a.replace("_","-");return e(ce.Provider,{value:{locale:s},children:e(xe,{definition:t,children:e(R,{children:n})})})},ut=new be(e(Ae,{})),Ve=function(){const r=typeof document<"u"&&document.createElement("link").relList;return r&&r.supports&&r.supports("modulepreload")?"modulepreload":"preload"}(),Re=function(a){return"/"+a},ne={},N=function(r,n,t){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.all(n.map(d=>{if(d=Re(d),d in ne)return;ne[d]=!0;const _=d.endsWith(".css"),m=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=_?"stylesheet":Ve,_||(h.as="script",h.crossOrigin=""),h.href=d,l&&h.setAttribute("nonce",l),document.head.appendChild(h),_)return new Promise((p,c)=>{h.addEventListener("load",p),h.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${d}`)))})}))}return s.then(()=>r()).catch(i=>{const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i})},Be={Add:g(()=>N(()=>import("./chunks/icons/Add.js").then(a=>a.$),[])),Bulk:g(()=>N(()=>import("./chunks/icons/Bulk.js"),[])),Burger:g(()=>N(()=>import("./chunks/icons/Burger.js"),[])),Cart:g(()=>N(()=>import("./chunks/icons/Cart.js"),[])),Check:g(()=>N(()=>import("./chunks/icons/Check.js"),[])),ChevronDown:g(()=>N(()=>import("./chunks/icons/ChevronDown.js"),[])),ChevronUp:g(()=>N(()=>import("./chunks/icons/ChevronUp.js"),[])),ChevronRight:g(()=>N(()=>import("./chunks/icons/ChevronRight.js"),[])),Close:g(()=>N(()=>import("./chunks/icons/Close.js"),[])),Heart:g(()=>N(()=>import("./chunks/icons/Heart.js"),[])),Minus:g(()=>N(()=>import("./chunks/icons/Minus.js"),[])),Placeholder:g(()=>N(()=>import("./chunks/icons/Placeholder.js"),[])),PlaceholderFilled:g(()=>N(()=>import("./chunks/icons/PlaceholderFilled.js"),[])),Search:g(()=>N(()=>import("./chunks/icons/Search.js"),[])),SearchFilled:g(()=>N(()=>import("./chunks/icons/SearchFilled.js"),[])),Sort:g(()=>N(()=>import("./chunks/icons/Sort.js"),[])),Star:g(()=>N(()=>import("./chunks/icons/Star.js"),[])),View:g(()=>N(()=>import("./chunks/icons/View.js"),[])),User:g(()=>N(()=>import("./chunks/icons/User.js"),[])),Warning:g(()=>N(()=>import("./chunks/icons/Warning.js"),[])),Locker:g(()=>N(()=>import("./chunks/icons/Locker.js"),[])),Wallet:g(()=>N(()=>import("./chunks/icons/Wallet.js"),[])),Card:g(()=>N(()=>import("./chunks/icons/Card.js"),[])),Order:g(()=>N(()=>import("./chunks/icons/Order.js"),[])),Delivery:g(()=>N(()=>import("./chunks/icons/Delivery.js"),[])),OrderError:g(()=>N(()=>import("./chunks/icons/OrderError.js"),[])),OrderSuccess:g(()=>N(()=>import("./chunks/icons/OrderSuccess.js"),[])),PaymentError:g(()=>N(()=>import("./chunks/icons/PaymentError.js"),[])),CheckWithCircle:g(()=>N(()=>import("./chunks/icons/CheckWithCircle.js"),[])),WarningWithCircle:g(()=>N(()=>import("./chunks/icons/WarningWithCircle.js"),[])),WarningFilled:g(()=>N(()=>import("./chunks/icons/WarningFilled.js"),[])),InfoFilled:g(()=>N(()=>import("./chunks/icons/InfoFilled.js"),[])),HeartFilled:g(()=>N(()=>import("./chunks/icons/HeartFilled.js"),[])),Trash:g(()=>N(()=>import("./chunks/icons/Trash.js"),[])),Eye:g(()=>N(()=>import("./chunks/icons/Eye.js"),[])),EyeClose:g(()=>N(()=>import("./chunks/icons/EyeClose.js"),[])),Date:g(()=>N(()=>import("./chunks/icons/Date.js"),[])),AddressBook:g(()=>N(()=>import("./chunks/icons/AddressBook.js"),[])),EmptyBox:g(()=>N(()=>import("./chunks/icons/EmptyBox.js"),[])),Coupon:g(()=>N(()=>import("./chunks/icons/Coupon.js"),[]))};function T({source:a,size:r="24",stroke:n="2",viewBox:t="0 0 24 24",className:s,...i}){const l=typeof a=="string"?Be[a]:null,d={className:o(["dropin-icon",`dropin-icon--shape-stroke-${n}`,s]),width:r,height:r,viewBox:t};return e(Ne,{fallback:e("svg",{...i,...d}),children:l?e(l,{...i,...d}):e(a,{...i,...d})})}const Fe=({name:a,value:r="1",className:n,disabled:t,error:s,success:i,min:l,max:d,onValue:_,onUpdateError:m,size:h="medium",...p})=>{const[c,u]=B(Number(r)),b=Number(l),f=Number(d),v=s||cf,k=cf?"Dropin.Incrementer.maxQuantityMessage":"Dropin.Incrementer.errorMessage",x=C(oe(async $=>{if(_)try{_($)}catch(w){m&&m(w)}},200),[_,m]),E=$=>{let w=$;x(w),u(w)};return e("div",{className:o(["dropin-incrementer",`dropin-incrementer--${h}`,n]),children:[e("div",{className:o(["dropin-incrementer__content",`dropin-incrementer__content--${h}`,["dropin-incrementer__content--error",v],["dropin-incrementer__content--success",i],["dropin-incrementer__content--disabled",t]]),children:[e("div",{className:o(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",t]]),children:e(Q,{children:e("button",{type:"button",className:o(["dropin-incrementer__decrease-button",["dropin-incrementer__decrease-button--disabled",t]]),onClick:()=>E(c-1),disabled:t||c{E(Number(c))},onChange:$=>{const w=$.currentTarget.value;w!==""&&E(Number(w))},...p}),e("div",{className:o(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",t]]),children:e(Q,{children:e("button",{type:"button",className:o(["dropin-incrementer__increase-button",["dropin-incrementer__increase-button--disabled",t]]),onClick:()=>E(c+1),disabled:t||c>f-1,"aria-label":e(z,{id:"Dropin.Incrementer.increaseLabel"}),children:e(T,{source:K,size:"16",stroke:"1",viewBox:"4 2 20 20",className:"dropin-incrementer__add"})})})})]}),v&&e("p",{className:"dropin-incrementer__content--error-message",children:e(z,{id:k,fields:{minQuantity:l,maxQuantity:d}})})]})},pe=({name:a,value:r,variant:n="primary",className:t,disabled:s,error:i,floatingLabel:l,onValue:d,onUpdateError:_,size:m="medium",icon:h,maxLength:p,success:c,...u})=>{const b=(u==null?void 0:u.id)||a||`dropin-input-${Math.random().toString(36)}`,f=C(oe(async k=>{if(d)try{await d(k)}catch(x){_&&_(x)}},200),[d,_]),v=k=>{const x=k.target;f(x.value.trim())};return e("div",{className:o(["dropin-input-container",`dropin-input-container--${n}`,["dropin-input-container--floating",!!l],["dropin-input-container--disabled",s]]),children:[h&&e(y,{node:h,className:o(["dropin-input__field-icon--left",h.props.className])}),e("div",{className:"dropin-input-label-container",children:[e("input",{id:b,onChange:v,type:"text",maxLength:p,name:a,value:r,...u,className:o(["dropin-input",`dropin-input--${m}`,`dropin-input--${n}`,["dropin-input--error",!!i],["dropin-input--success",!!c],["dropin-input--disabled",s],["dropin-input--floating",!!l],["dropin-input--icon-left",!!h],t]),disabled:s}),l&&e("label",{htmlFor:b,className:o([["dropin-input__label--floating",!!l],["dropin-input__label--floating--icon-left",!!h],["dropin-input__label--floating--error",!!i]]),children:l})]}),i&&e("div",{className:o(["dropin-input__field-icon--right","dropin-input__field-icon--error"]),children:e(T,{source:Ie,size:"16",stroke:"2",className:"dropin-input--warning-icon",viewBox:"-1 -1 26 26"})}),c&&e("div",{className:o(["dropin-input__field-icon--right","dropin-input__field-icon--success"]),children:e(T,{source:De,size:"16",stroke:"2",className:"dropin-input--success-icon",viewBox:"-1 -1 26 26"})})]})},ht=({name:a="",error:r,value:n,label:t,onChange:s,onBlur:i,...l})=>{const d=I({picker:"Dropin.InputDate.picker"}),_=p=>{p.currentTarget.setAttribute("type","date")},m=p=>{var u;const c=(u=p.currentTarget.parentElement)==null?void 0:u.querySelector("input");c==null||c.focus(),c==null||c.showPicker()},h=p=>{p.currentTarget.setAttribute("type","text"),i==null||i(p)};return e("div",{className:o(["dropin-input-date"]),children:[e(me,{error:r,children:e(pe,{error:!!r,name:a,value:n==null?void 0:n.toString(),placeholder:t,floatingLabel:t,onFocus:_,onBlur:h,onChange:s,"aria-labelledby":t,className:"dropin-input-date__input",...l})}),e("button",{className:"dropin-input-date__icon","aria-label":d.picker,onClick:m,children:e(T,{source:Ee,size:"24"})})]})},ie={pending:e(U,{}),success:e(de,{}),error:e(j,{style:{fill:"red"}})},He=({minLength:a=0,requiredCharacterClasses:r=0,uniqueSymbolsStatus:n="pending",validateLengthConfig:t={status:"",icon:"",message:""}})=>{const s=I({chartTwoSymbols:"Dropin.PasswordStatusIndicator.chartTwoSymbols",chartThreeSymbols:"Dropin.PasswordStatusIndicator.chartThreeSymbols",chartFourSymbols:"Dropin.PasswordStatusIndicator.chartFourSymbols"}),i=l=>{switch(l){case 2:return s.chartTwoSymbols;case 3:return s.chartThreeSymbols;case 4:return s.chartFourSymbols;default:return""}};return e("div",{className:o(["dropin-password-status-indicator"]),children:[a>0?e("div",{className:`dropin-password-status-indicator__item dropin-password-status-indicator__item--${t.status}`,"data-testid":`dropin-password-status-indicator__item--${t.icon}`,children:[ie[t.icon],e("span",{className:`${t.status}`,children:t.message})]}):null,r>=2?e("div",{className:`dropin-password-status-indicator__item dropin-password-status-indicator__item--${n}`,"data-testid":`dropin-password-status-indicator__item--${n}`,children:[ie[n],e("span",{className:"pending",children:i(r)})]}):null]})},bt=({placeholder:a,floatingLabel:r,children:n,name:t,required:s,className:i,minLength:l,autoComplete:d,defaultValue:_="",hideStatusIndicator:m=!1,uniqueSymbolsStatus:h,validateLengthConfig:p,requiredCharacterClasses:c,errorMessage:u,onValue:b,onBlur:f,...v})=>{const k=I({placeholder:"Dropin.InputPassword.placeholder",floatingLabel:"Dropin.InputPassword.floatingLabel",buttonShowTitle:"Dropin.InputPassword.buttonShowTitle",buttonHideTitle:"Dropin.InputPassword.buttonHideTitle"}),[x,E]=B(!1),$=C(()=>{E(L=>!L)},[]),w=x?k.buttonHideTitle:k.buttonShowTitle;return e("div",{"data-testid":"passwordFieldInput",className:o(["dropin-input-password",["dropin-input-password--error",u],i]),...v,children:[e(me,{error:u,children:e(pe,{autoComplete:d,name:t??"password",type:x?"text":"password",placeholder:a||k.placeholder,floatingLabel:r||k.floatingLabel,"aria-label":k.placeholder,"aria-required":s||!0,"aria-invalid":!!u,"aria-describedby":"password-feedback",required:s||!1,value:_,onValue:b,icon:e($e,{}),onBlur:f,"data-testid":"passwordInput"})}),e(V,{"aria-label":w,title:w,type:"button","data-testid":"toggle-password-icon",variant:"tertiary",className:o(["dropin-input-password__eye-icon",`dropin-input-password__eye-icon--${x?"show":"hide"}`,i]),onClick:$,children:e(T,{focusable:!1,"aria-hidden":x,source:x?Se:Te})}),m?null:e(He,{minLength:l,requiredCharacterClasses:c,validateLengthConfig:p,uniqueSymbolsStatus:h}),n]})},ft=({disabled:a,name:r="",errorMessage:n,value:t,label:s,className:i,onChange:l,onBlur:d,..._})=>{const m=(_==null?void 0:_.id)||r||`dropin-textarea-${Math.random().toString(36)}`,h=!!(n!=null&&n.length),p=C(c=>{const u=c.target;u.style.height="auto",u.style.height=`${u.scrollHeight}px`,l==null||l(c)},[l]);return e("div",{className:o(["dropin-textarea-container",i]),"data-testid":"dropin-textarea-container",children:[e("textarea",{"data-testid":"dropin-textarea-field",className:o(["dropin-textarea",["dropin-textarea--error",h],["dropin-textarea--disabled",!!a]]),id:m,placeholder:s,name:r,value:t,disabled:a,onBlur:d,onChange:p,..._}),e("label",{htmlFor:m,className:o(["dropin-textarea__label--floating",["dropin-textarea__label--floating--error",h]]),children:s}),h?e("div",{className:o(["dropin-textarea__label--floating--text",["dropin-textarea__label--floating--error",h]]),children:n}):null]})},qe=({className:a,src:r,params:n,loading:t="lazy",srcSet:s,onLoad:i,...l})=>{const[d,_]=B(!1),m=q(()=>{if(s)return s;if(!(!r||!n))return fe(r,{...n})},[n,r,s]),h=p=>{_(!0),i==null||i(p)};return e("img",{...l,className:o(["dropin-image",["dropin-image--loaded",d],a]),loading:t,onLoad:h,src:r,srcSet:m})},_e=({variant:a="primary",className:r})=>e("hr",{role:"separator",className:o(["dropin-divider",`dropin-divider--${a}`,r])}),A=({amount:a=0,currency:r,locale:n=void 0,variant:t="default",weight:s="bold",className:i,children:l,sale:d=!1,formatOptions:_={},size:m="small",...h})=>{const p=q(()=>new Intl.NumberFormat(n,{style:"currency",currency:r||"USD",minimumFractionDigits:2,maximumFractionDigits:2,..._}),[n,r,_]),c=q(()=>p.format(a),[a,p]);return e("span",{...h,className:o(["dropin-price",`dropin-price--${t}`,`dropin-price--${m}`,`dropin-price--${s}`,["dropin-price--sale",d],i]),children:c})},Me=({name:a,label:r,value:n,size:t="medium",checked:s=!1,disabled:i=!1,error:l=!1,description:d="",busy:_=!1,className:m,children:h,...p})=>e("label",{className:o([m,"dropin-radio-button",["dropin-radio-button--error",l],["dropin-radio-button--disabled",i]]),children:[e("input",{name:a,value:n,checked:s,disabled:i,type:"radio",className:o(["dropin-radio-button__input",["dropin-radio-button__input--error",l],["dropin-radio-button__input--disabled",i]]),"aria-busy":_,...p}),e("span",{className:o(["dropin-radio-button__label",`dropin-radio-button__label--${t}`,["dropin-radio-button__label--error",l],["dropin-radio-button__label--disabled",i]]),children:r}),e("span",{className:o(["dropin-radio-button__description",`dropin-radio-button__description--${t}`,["dropin-radio-button__description--disabled",i]]),children:d})]}),V=({value:a,variant:r="primary",size:n="medium",icon:t,className:s,children:i,disabled:l=!1,active:d=!1,activeChildren:_,activeIcon:m,href:h,...p})=>{let c="dropin-button";(t&&!i||t&&d&&!_||!t&&d&&m)&&(c="dropin-iconButton"),d&&_&&(c="dropin-button"),s=o([c,`${c}--${n}`,`${c}--${r}`,[`${c}--${r}--disabled`,l],i&&t&&`${c}--with-icon`,!i&&_&&t&&`${c}--with-icon`,d&&m&&`${c}--with-icon`,s]);const u=o(["dropin-button-icon",`dropin-button-icon--${r}`,[`dropin-button-icon--${r}--disabled`,l],t==null?void 0:t.props.className]),b=h?{node:e("a",{}),role:"link",href:h,...p,disabled:l,active:d,onKeyDown:f=>{l&&f.preventDefault()},tabIndex:l?-1:0}:{node:e("button",{}),role:"button",...p,value:a,disabled:l,active:d};return e(y,{...b,className:s,children:[t&&!d&&e(y,{node:t,className:u}),m&&d&&e(y,{node:m,className:u}),i&&!d&&(typeof i=="string"?e("span",{children:i}):i),d&&_&&(typeof _=="string"?e("span",{children:_}):_)]})};function ae(a,r,n,t,s){return a||(r?r.value:n||t?"":s?s.value:null)}const We=({name:a,value:r=null,options:n,variant:t="primary",floatingLabel:s,size:i="medium",handleSelect:l=()=>{},disabled:d=!1,error:_=!1,placeholder:m,defaultOption:h,icon:p,className:c,...u})=>{const b=(u==null?void 0:u.id)||a||`dropin-picker-${Math.random().toString(36)}`,f=!!(u!=null&&u.required),v=n==null?void 0:n.find(P=>!P.disabled),[k,x]=B(()=>ae(r,h,m,s,v));W(()=>{x(ae(r,h,m,s,v))},[r,h,m,s,v]);const E=P=>{const{options:D,value:S}=P.target;for(const M of D)M.selected&&(x(S),l(P))},$=n==null?void 0:n.map(P=>{const{value:D,text:S,disabled:M}=P;return e("option",{value:D,selected:D===k,disabled:M,className:o(["dropin-picker__option"]),children:S},D)}),w=!!k,L=()=>(!f||!w)&&(s||m);return e("div",{className:o([c,"dropin-picker",`dropin-picker__${i}`,["dropin-picker__floating",!!s],["dropin-picker__selected",w],["dropin-picker__error",_],["dropin-picker__disabled",d],["dropin-picker__icon",p]]),children:[p&&e(p.type,{...p.props,className:"dropin-picker__icon--placeholder"}),e("select",{id:b,className:o(["dropin-picker__select",`dropin-picker__select--${t}`,`dropin-picker__select--${i}`,["dropin-picker__select--floating",!!s]]),name:a,"aria-label":a,disabled:d,onChange:E,...u,children:[L()&&e("option",{selected:!w,value:"",className:o(["dropin-picker__option dropin-picker__placeholder"]),children:s??m},r),$]}),e(T,{source:J,size:"24",stroke:"2",className:"dropin-picker__chevronDown"}),s&&w&&e("label",{htmlFor:b,className:o(["dropin-picker__floatingLabel",!!s]),children:s})]})},me=({className:a,label:r,error:n,hint:t,success:s,size:i="medium",disabled:l=!1,children:d,..._})=>{var p;const m=((p=d==null?void 0:d.props)==null?void 0:p.id)??`dropin-field-${Math.random().toString(36)}`,h=d&&typeof d.type!="string"?d.type:null;return e("div",{..._,className:o(["dropin-field",a]),children:[r&&e("label",{className:o(["dropin-field__label",["dropin-field__label--disabled",l],`dropin-field__label--${i}`]),htmlFor:m,children:r}),e("div",{className:o(["dropin-field__content"]),children:h&&d&&we(h,{...d.props,id:m,key:d.key,disabled:l,size:i,error:!!n,success:!!s&&!n})}),e("div",{className:o(["dropin-field__hint",[`dropin-field__hint--${i}`,i],["dropin-field__hint--error",!!n],["dropin-field__hint--success",!!s&&!n],["dropin-field__hint--disabled",!!l]]),children:n||s||t})]})},vt=({icon:a,className:r,children:n,active:t=!1,disabled:s=!1,...i})=>e("button",{role:"button",disabled:s,...i,className:o(["dropin-action-button",["dropin-action-button--active",t],["dropin-action-button--disabled",s],r]),children:[a&&e(y,{node:a,className:o(["dropin-action-button-icon"])}),n&&(typeof n=="string"?e("span",{children:n}):n)]}),gt=({className:a,variant:r="primary",activeOption:n,disabled:t=!1,dividers:s=!0,children:i,handleSelect:l,...d})=>{const[_,m]=B(n),h=C(c=>{t||c.props.disabled||(m(c.props.value),l&&l(c.props.value))},[l,m,t]),p=se.map(i,c=>{const u=t||c.props.disabled,b=c.props.value===_;return ke(c,{disabled:u,active:b,onClick:()=>h(c),className:o(["dropin-action-button-group__option",`dropin-action-button-group__option--${r}`,["dropin-action-button-group__option--active",b],["dropin-action-button-group__option--with-dividers",s]])})});return e("div",{role:"group",...d,className:o(["dropin-action-button-group",`dropin-action-button-group--${r}`,a]),children:p})},Ge=({variant:a="primary",className:r,children:n,...t})=>e("div",{...t,className:o(["dropin-card",`dropin-card--${a}`,r]),children:e("div",{class:"dropin-card__content",children:n})}),Nt=({name:a,value:r,size:n="medium",disabled:t=!1,error:s=!1,label:i="",description:l="",className:d,checked:_,...m})=>{const[h,p]=B(_===void 0?!1:_),c=le(null),u=f=>{var v;(v=m.onChange)==null||v.call(m,f),p(f.currentTarget.checked)},b=f=>{var v;f.key===" "&&(f.preventDefault(),(v=c==null?void 0:c.current)==null||v.click())};return e("label",{className:o(["dropin-checkbox",["dropin-checkbox--disabled",t]]),children:[e("input",{ref:c,name:a,value:r,type:"checkbox",disabled:t,className:o(["dropin-checkbox__checkbox",["dropin-checkbox__checkbox--error",s],d]),...m,onChange:u,checked:h}),e("span",{"aria-checked":h?"true":"false","aria-labelledby":`${a}-label`,"aria-describedby":`${a}-description`,className:o(["dropin-checkbox__box",["dropin-checkbox__box--error",s],["dropin-checkbox__box--disabled",t]]),role:"checkbox",tabIndex:t?-1:0,onKeyDown:b,children:e(T,{className:o(["dropin-checkbox__checkmark"]),source:de,size:"16",stroke:"3"})}),e("div",{id:`${a}-label`,className:o(["dropin-checkbox__label",`dropin-checkbox__label--${n}`,["dropin-checkbox__label--disabled",t]]),children:i}),e("div",{}),e("div",{id:`${a}-description`,role:"note",className:o(["dropin-checkbox__description",`dropin-checkbox__description--${n}`,["dropin-checkbox__description--disabled",t]]),children:l})]})},wt=({className:a,name:r,value:n,id:t,label:s,groupAriaLabel:i,size:l="medium",color:d,disabled:_=!1,selected:m=!1,outOfStock:h=!1,multi:p=!1,onValue:c,onUpdateError:u,...b})=>{const f=I("Dropin.Swatches.outOfStock.label").label,v=I("Dropin.Swatches.selected.label").label,k=I("Dropin.Swatches.swatch.label").label,x=C(async D=>{if(c)try{await c(D)}catch(S){u&&u(S)}},[c,u]),E=D=>{const S=D.target;x(S.value)},L=d&&(D=>{const S=new Option().style;return S.color=D,S.color!==""})(d)?d:"var(--color-gray-300);",P=()=>h?`${i}: ${s} ${f}`:m?`${i}: ${s} ${v}`:`${i}: ${s} ${k}`;return e("label",{className:o(["dropin-color-swatch__container",`dropin-color-swatch__container--${l}`,a]),children:[e("input",{type:p?"checkbox":"radio",name:r,id:t,value:n,"aria-label":P(),checked:m,disabled:_,onChange:E,...b,className:o(["dropin-color-swatch",["dropin-color-swatch--selected",m],["dropin-color-swatch--disabled",_],a])}),e("span",{style:{"--bg-color":L},className:o(["dropin-color-swatch__span",["dropin-color-swatch__span--out-of-stock",h],a])})]})},kt=({className:a,name:r,value:n,label:t,groupAriaLabel:s,id:i,disabled:l=!1,selected:d=!1,outOfStock:_=!1,multi:m=!1,onValue:h,onUpdateError:p,...c})=>{const u=I("Dropin.Swatches.outOfStock.label").label,b=I("Dropin.Swatches.selected.label").label,f=I("Dropin.Swatches.swatch.label").label,[v,k]=B(!1),x=le(null),E=C(async L=>{if(h)try{await h(L)}catch(P){p&&p(P)}},[h,p]),$=L=>{const P=L.target;E(P.value)},w=()=>_?`${s}: ${t} ${u}`:d?`${s}: ${t} ${b}`:`${s}: ${t} ${f}`;return W(()=>{x.current&&x.current.scrollWidth>x.current.clientWidth&&k(!0)},[t]),e("div",{className:"dropin-text-swatch__container",...v?{"data-tooltip":t}:{},children:[e("input",{type:m?"checkbox":"radio",name:r,id:i,value:n,"aria-label":w(),checked:d,disabled:l,onChange:$,...c,className:o(["dropin-text-swatch",["dropin-text-swatch--selected",d],["dropin-text-swatch--disabled",l],a])}),e("label",{htmlFor:i,ref:x,className:o(["dropin-text-swatch__label",["dropin-text-swatch__label--out-of-stock",_],a]),children:t})]})},Ke=({ariaLabel:a,size:r="small",stroke:n="4",children:t,className:s,style:i,...l})=>{const d=["dropin-progress-spinner",`dropin-progress-spinner--shape-size-${r}`,`dropin-progress-spinner--shape-stroke-${n}`],_=I({updating:"Dropin.ProgressSpinner.updating.label",updatingChildren:"Dropin.ProgressSpinner.updatingChildren.label"}),m=()=>a||(t?_.updatingChildren:_.updating);return t?e("div",{...l,className:o(["dropin-progress-spinner-provider"]),"aria-live":"polite",role:"status",children:[e("div",{"aria-hidden":!0,children:t}),e("div",{"aria-label":m(),role:"status",className:o(["dropin-progress-spinner-background",s]),style:i}),e("div",{className:o(["dropin-progress-spinner-with-provider",...d]),"aria-hidden":!0})]}):e("div",{...l,className:o([s,...d]),"aria-live":"polite",role:"status","aria-label":m()})},yt=({className:a,name:r,value:n,id:t,label:s,groupAriaLabel:i,src:l,alt:d,disabled:_=!1,selected:m=!1,outOfStock:h=!1,multi:p=!1,onValue:c,onUpdateError:u,...b})=>{const f=I("Dropin.Swatches.outOfStock.label").label,v=I("Dropin.Swatches.selected.label").label,k=I("Dropin.Swatches.swatch.label").label,x=C(async w=>{if(c)try{await c(w)}catch(L){u&&u(L)}},[c,u]),E=w=>{const L=w.target;x(L.value)},$=()=>h?`${i}: ${s} ${f}`:m?`${i}: ${s} ${v}`:`${i}: ${s} ${k}`;return e("label",{className:o(["dropin-image-swatch__container",a]),children:[e("input",{type:p?"checkbox":"radio",name:r,id:t,value:n,"aria-label":$(),checked:m,disabled:_,onChange:E,...b,className:o(["dropin-image-swatch",["dropin-image-swatch--selected",m],["dropin-image-swatch--disabled",_],a])}),e("span",{className:o(["dropin-image-swatch__span",["dropin-image-swatch__span--out-of-stock",h],a]),children:e(qe,{src:l,className:o(["dropin-image-swatch__content"]),params:{width:100,fit:"bounds",crop:!0},alt:d,loading:"lazy",onError:w=>w.target.style.display="none"})})]})},Ue=({className:a,children:r,title:n,secondaryText:t,actionIconPosition:s="left",iconOpen:i=K,iconClose:l=U,iconLeft:d=K,showIconLeft:_=!1,renderContentWhenClosed:m=!0,defaultOpen:h=!1,onStateChange:p,...c})=>{const[u,b]=B(h),f=$=>{$.stopImmediatePropagation();const w=!u;b(w),p==null||p(w)},v=I(`Dropin.Accordion.${u?"close":"open"}.label`).label,k=e(T,{source:i,size:"24",onClick:f,onKeyPress:f,className:"dropin-accordion-section__open-icon"}),x=e(T,{source:l,size:"24",onClick:f,onKeyPress:f,className:"dropin-accordion-section__close-icon"}),E=e(T,{source:d,size:"24"});return e("div",{...c,className:o(["dropin-accordion-section",a]),children:[e("div",{className:"dropin-accordion-section__heading",children:[e("div",{className:"dropin-accordion-section__flex",onClick:f,onKeyPress:f,role:"button","aria-label":`${v} ${n}`,tabIndex:0,children:e("div",{className:"dropin-accordion-section__title-container",children:[s==="left"&&(u?x:k),_&&E,e("h3",{className:"dropin-accordion-section__title",children:n})]})}),e("div",{className:"dropin-accordion-section__secondary-text-container",children:[t&&e("h4",{className:"dropin-accordion-section__secondary-text",children:t}),s==="right"&&(u?x:k)]})]}),e("div",{className:"dropin-accordion-section__content-container",style:{display:u?"grid":"none"},children:(u||m&&!u)&&r})]})},xt=({className:a,children:r,actionIconPosition:n="left",iconOpen:t=K,iconClose:s=U,...i})=>{const l=e(_e,{variant:"secondary"}),d=_=>e(R,{children:[e(Ue,{..._.props,actionIconPosition:n,iconOpen:t,iconClose:s}),l]});return e("div",{...i,className:o(["dropin-accordion",a]),children:[l,...(Array.isArray(r)?r:[r]).map(d)]})},Dt=({variant:a="primary",className:r,type:n="warning",additionalActions:t,onDismiss:s,heading:i,description:l,icon:d,itemList:_,actionButtonPosition:m,...h})=>{var c,u,b;const p=I({dismiss:"Dropin.InlineAlert.dismissLabel"});return e("div",{...h,className:o(["dropin-in-line-alert",`dropin-in-line-alert--${n}`,`dropin-in-line-alert--${a}`,r]),children:[e("div",{className:"dropin-in-line-alert__heading",children:[e("div",{className:"dropin-in-line-alert__title-container",children:[d&&e(y,{node:d,className:"dropin-in-line-alert__icon"}),e("span",{className:"dropin-in-line-alert__title",children:i})]}),e("div",{className:"dropin-in-line-alert__actions-container",children:[t&&(m==="top"||!m&&t.length<=1)&&e(V,{variant:"tertiary",className:"dropin-in-line-alert__additional-action",onClick:t.length>0?(c=t[0])==null?void 0:c.onClick:void 0,"aria-label":(u=t[0])==null?void 0:u.label,children:(b=t[0])==null?void 0:b.label}),s&&e(V,{icon:e(T,{source:j,size:"24",stroke:"2"}),className:"dropin-in-line-alert__dismiss-button",variant:"tertiary",onClick:s,"aria-label":p.dismiss})]})]}),l&&e("p",{className:"dropin-in-line-alert__description",children:l}),e("div",{className:"dropin-in-line-alert__item-list-container",children:_&&e(y,{node:_,className:o(["dropin-in-line-alert__item-list"])})}),t&&(m==="bottom"||!m&&t.length>1)&&e("div",{className:"dropin-in-line-alert__additional-actions-container",children:t.map(f=>e(V,{variant:"tertiary",className:"dropin-in-line-alert__additional-action",onClick:f.onClick,children:f.label},f.label))})]})},It=({size:a="small",title:r=null,centered:n=!1,backgroundDim:t=!0,clickToDismiss:s=!0,escapeToDismiss:i=!0,onClose:l,showCloseButton:d=!0,className:_,children:m=null,...h})=>{const p=C(()=>{l==null||l()},[l]),c=I({modalCloseLabel:"Dropin.Modal.Close.label"});return W(()=>{const u=b=>{const f=document.querySelector(".dropin-modal"),v=document.querySelector(".dropin-modal__body");s&&f&&v&&!v.contains(b.target)&&p()};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[p,s]),W(()=>{const u=b=>{b.key==="Escape"&&i&&p()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[p,i]),W(()=>{const u=document.scrollingElement,b=u.style.overflow;return u.style.overflow="hidden",()=>{u.style.overflow=b}},[]),e("div",{className:o(["dropin-modal",["dropin-modal--dim",t]]),children:e("div",{...h,className:o(["dropin-modal__body",[`dropin-modal__body--${a}`,a],_]),children:[e("div",{className:o(["dropin-modal__header",["dropin-modal__header-title",!!r]]),children:[r&&e("div",{className:o(["dropin-modal__header-title-content"]),children:r}),d&&e(V,{"aria-label":c.modalCloseLabel,variant:"tertiary",className:"dropin-modal__header-close-button",onClick:p,icon:e(j,{})})]}),e("div",{className:o(["dropin-modal__content",["dropin-modal__body--centered",n]]),children:m})]})})},Et=({className:a,children:r,ariaLabel:n,image:t,title:s,price:i,taxIncluded:l=!1,taxExcluded:d=!1,total:_,totalExcludingTax:m,sku:h,configurations:p,warning:c,alert:u,discount:b,savings:f,quantity:v,description:k,attributes:x,footer:E,loading:$=!1,updating:w=!1,quantityType:L,dropdownOptions:P,onQuantity:D,onRemove:S,...M})=>{var X,Y;const{locale:G}=ye(ce),O=I({each:"Dropin.CartItem.each.label",pricePerItem:"Dropin.CartItem.pricePerItem.label",quantity:"Dropin.CartItem.quantity.label",remove:"Dropin.CartItem.remove.label",removeDefault:"Dropin.CartItem.removeDefault.label",taxIncluded:"Dropin.CartItem.taxIncluded.label",taxExcluded:"Dropin.CartItem.taxExcluded.label",updating:"Dropin.CartItem.updating.label",updatingDefault:"Dropin.ProgressSpinner.updating.label"});if($)return e(je,{});const ue=L==="dropdown"?e(We,{className:o(["dropin-cart-item__quantity__picker"]),value:String(v),name:"quantity","aria-label":O.quantity,disabled:w,variant:"primary",options:P,handleSelect:F=>D==null?void 0:D(Number(F.target.value))}):e(Fe,{className:o(["dropin-cart-item__quantity__incrementer"]),value:v,min:1,onValue:F=>D==null?void 0:D(Number(F)),name:"quantity","aria-label":O.quantity,disabled:w});return e("div",{...M,className:o(["dropin-cart-item",["dropin-cart-item--updating",w],a]),children:[w&&e(Ke,{className:o(["dropin-cart-item__spinner"]),ariaLabel:n?(X=O.updating)==null?void 0:X.replace("{product}",n):O.updatingDefault}),e("div",{className:"dropin-cart-item__wrapper",children:[t&&e(y,{node:t,className:o(["dropin-cart-item__image"])}),s&&e(y,{node:s,className:o(["dropin-cart-item__title",["dropin-cart-item__title--edit",!!D||!!S]])}),k&&e(y,{node:k,className:o(["dropin-cart-item__description"])}),h&&e(y,{node:h,className:o(["dropin-cart-item__sku"])}),e("div",{className:o(["dropin-cart-item__savings__wrapper"]),children:[b&&e(y,{node:b,className:o(["dropin-cart-item__discount","dropin-cart-item__discount__large-screen"])}),f&&e(y,{node:f,className:o(["dropin-cart-item__savings","dropin-cart-item__savings__large-screen"])})]}),x&&e("div",{className:o(["dropin-cart-item__attributes"]),children:e(y,{node:x})}),p&&e("ul",{className:o(["dropin-cart-item__configurations"]),children:Object.entries(p).map(([F,he])=>e("li",{className:o(["dropin-cart-item__configurations__item"]),children:[F,":"," ",e("strong",{className:o(["dropin-cart-item__configurations__item__value"]),children:he})]},F))}),i&&e("span",{className:o(["dropin-cart-item__price"]),"aria-label":O.pricePerItem,children:[v&&!D&&e(R,{children:[e("span",{className:"dropin-cart-item__price__quantity","aria-hidden":!0,children:[v.toLocaleString(G)," x"," "]}),e("div",{className:"dropin-cart-item__sr-only",children:[O.quantity,": ",v==null?void 0:v.toLocaleString(G),";"]})]}),e(y,{node:i,role:"text"}),v&&v>1&&e(R,{children:[" ",O.each]}),l&&e("span",{"data-testid":"tax-message",className:"dropin-cart-item__price-tax-message",children:[" ",O.taxIncluded]}),d&&e("span",{"data-testid":"tax-message",className:"dropin-cart-item__price-tax-message",children:[" ",O.taxExcluded]})]}),e("div",{className:o(["dropin-cart-item__quantity",["dropin-cart-item__quantity--edit",!!D]]),children:[D?ue:v&&e("span",{className:o(["dropin-cart-item__quantity__value"]),children:[O.quantity,":"," ",e("strong",{className:"dropin-cart-item__quantity__number",children:Number(v).toLocaleString(G)})]}),c&&e(y,{node:c,className:o(["dropin-cart-item__warning","dropin-cart-item__warning--quantity"])}),u&&e(y,{node:u,className:o(["dropin-cart-item__alert","dropin-cart-item__alert--quantity"])})]}),c&&e(y,{node:c,className:o(["dropin-cart-item__warning"])}),u&&e(y,{node:u,className:o(["dropin-cart-item__alert"])}),e("div",{className:o(["dropin-cart-item__total",["dropin-cart-item__total--edit",!!S]]),children:[e("div",{className:"dropin-cart-item__row-total__wrapper",children:[_&&e("div",{className:"dropin-cart-item__row-total",children:e(y,{node:_,role:"text"})}),l&&e("div",{className:"dropin-cart-item__total-tax-included",children:e("span",{"data-testid":"tax-message",className:o(["dropin-cart-item__total-tax-message"]),children:O.taxIncluded})})]}),d&&e("div",{className:"dropin-cart-item__total-tax-excluded",children:e("span",{"data-testid":"tax-message",className:o(["dropin-cart-item__total-tax-excluded-message"]),children:[m&&e(y,{node:m,role:"text"})," ",O.taxExcluded]})}),b&&e(y,{node:b,className:o(["dropin-cart-item__discount"])}),f&&e(y,{node:f,className:o(["dropin-cart-item__savings"])})]}),E&&e("div",{className:o(["dropin-cart-item__footer"]),children:e(y,{node:E})})]}),S&&e(V,{"data-testid":"cart-item-remove-button",className:o(["dropin-cart-item__remove"]),variant:"tertiary",onClick:()=>S==null?void 0:S(),icon:e(T,{"data-testid":"cart-item-remove-icon",source:Le,size:"24",stroke:"2",viewBox:"0 0 24 24","aria-label":n?(Y=O.remove)==null?void 0:Y.replace("{product}",n):O.removeDefault}),disabled:w})]})},je=()=>e("div",{className:"dropin-cart-item dropin-cart-item-skeleton",children:e(Ce,{className:"dropin-cart-item__skeleton dropin-cart-item__wrapper",children:[e("div",{className:"dropin-cart-item__image",children:e(H,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__title",children:e(H,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__sku",children:e(H,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__price",children:e(H,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__quantity",children:e(H,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__total",children:e(H,{className:"dropin-cart-item__skeleton__item"})})]})}),$t=({className:a,children:r,...n})=>e("div",{...n,className:o(["dropin-cart-list",a]),children:e("div",{className:"dropin-cart-list__wrapper","aria-live":"assertive","aria-relevant":"all",children:se.map(r,(t,s)=>e("div",{className:"dropin-cart-list__item",children:t},s))})}),St=({className:a,children:r,locale:n,currency:t,amount:s,variant:i="default",minimumAmount:l,maximumAmount:d,size:_="small",display:m="dash",specialPrice:h,sale:p=!1,...c})=>{const u=q(()=>s||l===d||l&&!d||d&&!l,[s,d,l]);return e("div",{children:u?e("div",{...c,className:o(["dropin-price-range",a]),children:e(A,{amount:s??l??d,currency:t,locale:n,size:_,variant:i,sale:p})}):e("div",{...c,className:o(["dropin-price-range",a]),children:[m==="dash"?e(ze,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null,m==="from to"?e(Ze,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null,m==="as low as"?e(Je,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null]})})};function ze({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){return e(R,{children:[e(A,{amount:a??r,currency:t,locale:s,size:i,sale:!!a&&l}),e("span",{className:"dropin-price-range__separator",children:"-"}),e(A,{amount:n,currency:t,locale:s,size:i})]})}function Ze({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){const d=I({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return e(R,{children:[e("span",{className:o(["dropin-price-range__from",`dropin-price-range__from--${i}`]),children:d.from}),e(A,{amount:a??r,currency:t,locale:s,size:i,sale:!!a&&l}),e("span",{className:o(["dropin-price-range__to",`dropin-price-range__to--${i}`]),children:d.to}),e(A,{amount:n,currency:t,locale:s,size:i})]})}function Je({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){const d=I({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return e(R,{children:[e("span",{className:o(["dropin-price-range__as-low-as",`dropin-price-range__as-low-as--${i}`]),children:d.asLowAs}),a?e("div",{children:[e(A,{amount:n,currency:t,locale:s,size:i,variant:"strikethrough"}),e(A,{amount:a,currency:t,locale:s,size:i,className:"dropin-price-range__special",sale:!!a&&l})]}):e(A,{amount:r,currency:t,locale:s,size:i})]})}const Tt=({className:a,categories:r,separator:n,...t})=>e(R,{children:(r==null?void 0:r.length)>1&&e("nav",{role:"navigation",...t,className:o(["dropin-breadcrumbs__container",a]),children:e("ul",{className:"dropin-breadcrumbs__items",children:r==null?void 0:r.map((s,i)=>e("li",{className:o(["dropin-breadcrumbs__item",["dropin-breadcrumbs__item--last",i===r.length-1]]),children:[e(y,{node:s,className:"dropin-breadcrumbs__link"}),!n&&i!==r.length-1&&e("span",{className:"dropin-breadcrumbs__separator--default",children:[" ","/"," "]}),n&&i!==r.length-1&&e(y,{node:n,className:"dropin-breadcrumbs__separator--icon"})]},i))})})}),Lt=({className:a,variant:r,icon:n,message:t,onDismiss:s,action:i,...l})=>{const d=I({dismiss:"Dropin.InlineAlert.dismissLabel"});return e("div",{...l,className:o([a,"dropin-alert-banner",`dropin-alert-banner--${r}`]),children:[e("div",{className:"dropin-alert-banner__content",children:[n&&e(y,{node:n,"aria-hidden":"true",className:"dropin-alert-banner__icon"}),e(y,{node:t,className:o(["dropin-alert-banner__message"])})]}),e("div",{className:"dropin-alert-banner__actions",children:[i&&e(V,{variant:"tertiary",className:"dropin-alert-banner__action",onClick:i.onClick,"aria-label":i.label,children:i.label}),e(V,{icon:e(T,{source:j,size:"24",stroke:"2"}),className:"dropin-alert-banner__dismiss-button",variant:"primary",onClick:s,"aria-label":d.dismiss})]})]})},Pt=({className:a,icon:r,heading:n,headingLevel:t=2,message:s,action:i,variant:l="secondary",...d})=>{const _=t>=1&&t<=6?`h${t}`:"h2";return e("div",{...d,className:o(["dropin-illustrated-message",a]),children:e(Ge,{variant:l,children:[r&&e(y,{node:r,"aria-hidden":"true",size:"80",className:"dropin-illustrated-message__icon"}),n&&e(_,{className:"dropin-illustrated-message__heading",children:n}),s&&e(y,{node:s,className:"dropin-illustrated-message__message"}),i&&e(y,{node:i,className:"dropin-illustrated-message__action"})]})})},Ot=({className:a,label:r,name:n,value:t,selected:s=!0,onChange:i,icon:l,busy:d=!1,children:_,...m})=>e("div",{...m,className:o(["dropin-toggle-button",a,["dropin-toggle-button__selected",s]]),children:e("label",{className:"dropin-toggle-button__actionButton",children:[e(Me,{label:"",name:n,value:t,checked:s,onChange:()=>i&&i(t),"aria-label":r,busy:d,className:o([a,"dropin-toggle-button__radioButton"])}),e("span",{className:"dropin-toggle-button__content",children:[l&&e(l.type,{...l==null?void 0:l.props,className:"dropin-toggle-button__icon"}),r]})]})}),Ct=({title:a=null,size:r="medium",cta:n,divider:t=!0,className:s,...i})=>a?e("div",{...i,className:o(["dropin-header-container",s]),"data-testid":"dropin-header-container",children:[e("span",{className:o(["dropin-header-container__title",["dropin-header-container__title--medium",r==="medium"],["dropin-header-container__title--large",r==="large"]]),children:a}),n?e(y,{node:n,className:"dropin-header-container__actions"}):null,t?e(_e,{className:o(["dropin-header-container__divider",["dropin-header-container__divider--medium",r==="medium"],["dropin-header-container__divider--large",r==="large"]])}):null]}):null,At=({label:a,className:r,...n})=>a?e("div",{...n,className:o(["dropin-tag-container",r]),"data-testid":"dropin-tag-container",children:e("span",{className:"dropin-tag-container__label",children:a})}):null,Vt=({className:a,children:r,maxColumns:n,emptyGridContent:t,...s})=>{const i=!!r&&(Array.isArray(r)?r.length>0:!0),l=i?{gridTemplateColumns:`repeat(${n}, 1fr)`}:void 0;return e("div",{...s,className:o(["dropin-content-grid",a]),tabindex:0,children:e("div",{"data-testid":"content-grid-content",className:o(["dropin-content-grid__content",["dropin-content-grid__dynamic-columns-content",!n],["dropin-content-grid__content--empty",!i]]),style:l,children:i?r:t})})},Rt=({totalPages:a=10,currentPage:r=1,onChange:n,className:t,...s})=>{const i=I({backwardButton:"Dropin.Pagination.backwardButton.ariaLabel",forwardButton:"Dropin.Pagination.forwardButton.ariaLabel"}),l=C(()=>{const p=Math.min(r+1,a);n==null||n(p)},[r,n,a]),d=C(()=>{const p=Math.max(r-1,1);n==null||n(p)},[r,n]),_=C(p=>{ve(p)&&(n==null||n(p))},[n]),m=C((p,c)=>{let u=[];const b=(f,v)=>{for(let k=f;k<=v;k++)u.push({page:k,isActive:k===p,label:k})};return c<=5?b(1,c):p<=2?(b(1,2),u.push({page:"ellipsis",isActive:!1,label:"..."}),b(c-1,c)):p>=c-3?b(c-4,c):(b(p-1,p),u.push({page:"ellipsis",isActive:!1,label:"..."}),b(c-1,c)),u},[]),h=q(()=>m(r,a),[m,r,a]);return e("div",{...s,className:o(["dropin-pagination",t]),children:[e("button",{type:"button","data-testid":"prev-button","aria-label":i.backwardButton,disabled:r===1,onClick:d,className:o(["dropin-pagination-arrow","dropin-pagination-arrow--backward"]),children:e(T,{size:"24",source:J})}),e("ul",{className:"dropin-pagination_list",children:h.map((p,c)=>e("li",{"data-testid":`dropin-pagination_list-item--${p.page}`,className:o(["dropin-pagination_list-item",`dropin-pagination_list-item--${p.page}`,["dropin-pagination_list-item--active",p.isActive]]),children:e("button",{type:"button","data-testid":`set-page-button-${p.page}`,onClick:()=>_(p.page),children:p.label})},`${p.page}_${c}`))}),e("button",{type:"button","data-testid":"next-button","aria-label":i.forwardButton,disabled:r===a,onClick:l,className:o(["dropin-pagination-arrow","dropin-pagination-arrow--forward"]),children:e(T,{size:"24",source:J})})]})};export{xt as Accordion,Ue as AccordionSection,vt as ActionButton,gt as ActionButtonGroup,Lt as AlertBanner,Tt as Breadcrumbs,V as Button,Ge as Card,Et as CartItem,je as CartItemSkeleton,$t as CartList,Nt as Checkbox,wt as ColorSwatch,Vt as ContentGrid,_e as Divider,me as Field,Ct as Header,T as Icon,Pt as IllustratedMessage,qe as Image,yt as ImageSwatch,Dt as InLineAlert,Fe as Incrementer,pe as Input,ht as InputDate,bt as InputPassword,It as Modal,Rt as Pagination,We as Picker,A as Price,St as PriceRange,Ke as ProgressSpinner,Me as RadioButton,Ce as Skeleton,H as SkeletonRow,At as Tag,ft as TextArea,kt as TextSwatch,Ot as ToggleButton,ce as UIContext,Ae as UIProvider,ut as provider}; diff --git a/scripts/__dropins__/tools/event-bus.js b/scripts/__dropins__/tools/event-bus.js index d5933661f4..eabd75fe7a 100644 --- a/scripts/__dropins__/tools/event-bus.js +++ b/scripts/__dropins__/tools/event-bus.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -var o=Object.defineProperty;var f=(n,e,i)=>e in n?o(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var r=(n,e,i)=>f(n,typeof e!="symbol"?e+"":e,i);const c=Date.now().toString(36).substring(2);class l{static on(e,i,t){if(typeof BroadcastChannel>"u")return;const a=new BroadcastChannel("ElsieSDK/EventBus");if(t!=null&&t.eager){const s=this._lastEvent[e];s&&i(s.payload)}return a.addEventListener("message",({data:s})=>{this._identifier&&this._identifier!==s.identifier||s.event===e&&i(s.payload)}),{off(){a.close()}}}static emit(e,i){if(typeof BroadcastChannel>"u")return;const t=new BroadcastChannel("ElsieSDK/EventBus");t.postMessage({event:e,identifier:this._identifier,payload:i}),this._lastEvent[e]={payload:i},t.close()}static enableLogger(e){var i;typeof BroadcastChannel>"u"||((i=this._logger)==null||i.close(),this._logger=null,e!==!1&&(this._logger=new BroadcastChannel("ElsieSDK/EventBus"),this._logger.addEventListener("message",({data:t})=>{this._identifier&&this._identifier!==t.identifier||(console.group(`📡 Event (${t.identifier}) ➡ ${t.event}`),console.log(t.payload),console.groupEnd())})))}}r(l,"_identifier",c),r(l,"_logger",null),r(l,"_lastEvent",{});export{l as events}; +var o=Object.defineProperty;var f=(n,e,t)=>e in n?o(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var r=(n,e,t)=>f(n,typeof e!="symbol"?e+"":e,t);const c=Date.now().toString(36).substring(2);class a{static lastPayload(e){var t;return(t=this._lastEvent[e])==null?void 0:t.payload}static on(e,t,i){if(typeof BroadcastChannel>"u")return;const l=new BroadcastChannel("ElsieSDK/EventBus");if(i!=null&&i.eager){const s=this._lastEvent[e];s&&t(s.payload)}return l.addEventListener("message",({data:s})=>{this._identifier&&this._identifier!==s.identifier||s.event===e&&t(s.payload)}),{off(){l.close()}}}static emit(e,t){if(typeof BroadcastChannel>"u")return;const i=new BroadcastChannel("ElsieSDK/EventBus");i.postMessage({event:e,identifier:this._identifier,payload:t}),this._lastEvent[e]={payload:t},i.close()}static enableLogger(e){var t;typeof BroadcastChannel>"u"||((t=this._logger)==null||t.close(),this._logger=null,e!==!1&&(this._logger=new BroadcastChannel("ElsieSDK/EventBus"),this._logger.addEventListener("message",({data:i})=>{this._identifier&&this._identifier!==i.identifier||(console.group(`📡 Event (${i.identifier}) ➡ ${i.event}`),console.log(i.payload),console.groupEnd())})))}}r(a,"_identifier",c),r(a,"_logger",null),r(a,"_lastEvent",{});export{a as events}; diff --git a/scripts/__dropins__/tools/types/elsie/src/i18n/en_US.json.d.ts b/scripts/__dropins__/tools/types/elsie/src/i18n/en_US.json.d.ts index 97d8b00995..018e019560 100644 --- a/scripts/__dropins__/tools/types/elsie/src/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/tools/types/elsie/src/i18n/en_US.json.d.ts @@ -29,7 +29,8 @@ declare const _default: { "InputPassword": { "placeholder": "Password", "floatingLabel": "Password", - "buttonTitle": "Click to show or hide password" + "buttonShowTitle": "Click to show password", + "buttonHideTitle": "Click to hide password" }, "PasswordStatusIndicator": { "chartTwoSymbols": "Use characters and numbers or symbols", diff --git a/scripts/__dropins__/tools/types/elsie/src/i18n/index.d.ts b/scripts/__dropins__/tools/types/elsie/src/i18n/index.d.ts index 7edde988be..9687e8fdb2 100644 --- a/scripts/__dropins__/tools/types/elsie/src/i18n/index.d.ts +++ b/scripts/__dropins__/tools/types/elsie/src/i18n/index.d.ts @@ -31,7 +31,8 @@ export declare const definition: { InputPassword: { placeholder: string; floatingLabel: string; - buttonTitle: string; + buttonShowTitle: string; + buttonHideTitle: string; }; PasswordStatusIndicator: { chartTwoSymbols: string; @@ -176,7 +177,8 @@ export declare const definition: { InputPassword: { placeholder: string; floatingLabel: string; - buttonTitle: string; + buttonShowTitle: string; + buttonHideTitle: string; }; PasswordStatusIndicator: { chartTwoSymbols: string; @@ -323,7 +325,8 @@ export declare const getDefinitionByLanguage: (lang: Lang) => { InputPassword: { placeholder: string; floatingLabel: string; - buttonTitle: string; + buttonShowTitle: string; + buttonHideTitle: string; }; PasswordStatusIndicator: { chartTwoSymbols: string; diff --git a/scripts/__dropins__/tools/types/event-bus/src/index.d.ts b/scripts/__dropins__/tools/types/event-bus/src/index.d.ts index 65c4855313..1aec1cf5a6 100644 --- a/scripts/__dropins__/tools/types/event-bus/src/index.d.ts +++ b/scripts/__dropins__/tools/types/event-bus/src/index.d.ts @@ -11,6 +11,7 @@ export * from './events-catalog'; * @property {Function} on - Subscribes to an event. * @property {Function} emit - Emits an event. * @property {Function} enableLogger - Enables or disables event logging. + * @property {Function} lastPayload - Returns the last payload of the event. */ export declare class events { static _identifier: string; @@ -20,6 +21,12 @@ export declare class events { payload: any; }; }; + /** + * Returns the last payload of the event. + * @param event – The event to get the last payload from. + * @returns – The last payload of the event. + */ + static lastPayload(event: string): any; /** * Subscribes to an event. * @param event - The event to subscribe to.