@dropins/storefront-cart 1.3.1-alpha1 → 1.4.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fetch-graphql/fetch-graphql.d.ts +2 -2
- package/api/initialize/initialize.d.ts +3 -3
- package/chunks/CartSummaryGrid.js +1 -1
- package/chunks/CartSummaryList.js +1 -1
- package/chunks/CartSummaryTable2.js +3 -0
- package/chunks/Coupons.js +1 -1
- package/chunks/EmptyCart.js +1 -1
- package/chunks/OrderSummary.js +1 -1
- package/chunks/OrderSummaryLine.js +1 -1
- package/chunks/WarningWithCircle.js +3 -0
- package/chunks/refreshCart.js +13 -13
- package/components/CartSummaryTable/CartSummaryTable.d.ts +42 -0
- package/components/CartSummaryTable/Elements/Item/Item.d.ts +13 -0
- package/components/CartSummaryTable/Elements/Item/index.d.ts +11 -0
- package/components/CartSummaryTable/Elements/index.d.ts +2 -0
- package/components/CartSummaryTable/index.d.ts +11 -0
- package/components/GiftOptions/Elements/GiftOptionModal.d.ts +1 -1
- package/components/GiftOptions/GiftOptions.d.ts +1 -1
- package/components/index.d.ts +1 -0
- package/containers/CartSummaryGrid/CartSummaryGrid.d.ts +2 -2
- package/containers/CartSummaryGrid.js +1 -1
- package/containers/CartSummaryList/CartSummaryList.d.ts +2 -2
- package/containers/CartSummaryList.js +1 -1
- package/containers/CartSummaryTable/CartSummaryTable.d.ts +86 -0
- package/containers/CartSummaryTable/index.d.ts +11 -0
- package/containers/CartSummaryTable.d.ts +3 -0
- package/containers/CartSummaryTable.js +3 -0
- package/containers/Coupons/Coupons.d.ts +1 -1
- package/containers/Coupons.js +1 -1
- package/containers/EmptyCart/EmptyCart.d.ts +1 -1
- package/containers/EmptyCart.js +1 -1
- package/containers/EstimateShipping/EstimateShipping.d.ts +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/GiftCards/GiftCards.d.ts +1 -1
- package/containers/GiftCards.js +1 -1
- package/containers/GiftOptions/GiftOptions.d.ts +2 -2
- package/containers/GiftOptions.js +1 -1
- package/containers/MiniCart/MiniCart.d.ts +2 -2
- package/containers/MiniCart.js +1 -1
- package/containers/OrderSummary/OrderSummary.d.ts +1 -1
- package/containers/OrderSummary.js +1 -1
- package/containers/OrderSummaryLine/OrderSummaryLine.d.ts +1 -1
- package/containers/OrderSummaryLine.js +1 -1
- package/containers/index.d.ts +1 -0
- package/data/models/cart-model.d.ts +3 -0
- package/data/transforms/__fixtures__/productTypesData.d.ts +2 -0
- package/fragments.js +3 -2
- package/hooks/useCartItems.d.ts +85 -0
- package/hooks/useGiftOptions.d.ts +1 -2
- package/i18n/en_US.json.d.ts +16 -5
- package/package.json +1 -1
- package/render/render.d.ts +1 -1
- package/render.js +3 -2
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe-commerce/fetch-graphql').Header) => void, fetchGraphQl: <T = any>(query: string, options?: import('@adobe-commerce/fetch-graphql').FetchOptions | undefined) => Promise<{
|
|
17
|
+
export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe-commerce/fetch-graphql').Header | ((prev: import('@adobe-commerce/fetch-graphql').Header) => import('@adobe-commerce/fetch-graphql').Header)) => void, fetchGraphQl: <T = any>(query: string, options?: import('@adobe-commerce/fetch-graphql').FetchOptions | undefined) => Promise<{
|
|
18
18
|
errors?: import('@adobe-commerce/fetch-graphql').FetchQueryError | undefined;
|
|
19
19
|
data: T;
|
|
20
20
|
}>, getConfig: () => {
|
|
21
21
|
endpoint: string | undefined;
|
|
22
|
-
fetchGraphQlHeaders: import('@adobe-commerce/fetch-graphql').Header
|
|
22
|
+
fetchGraphQlHeaders: import('@adobe-commerce/fetch-graphql').Header;
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=fetch-graphql.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Initializer, Model } from '
|
|
2
|
-
import { Lang } from '
|
|
1
|
+
import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
|
|
2
|
+
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
3
|
import { CartModel } from '../../data/models';
|
|
4
4
|
|
|
5
5
|
type ConfigProps = {
|
|
@@ -10,6 +10,6 @@ type ConfigProps = {
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
export declare const initialize: Initializer<ConfigProps>;
|
|
13
|
-
export declare const config: import('
|
|
13
|
+
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
|
14
14
|
export {};
|
|
15
15
|
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as a,Fragment as g}from"@dropins/tools/preact-jsx-runtime.js";import{useState as _,useEffect as C}from"@dropins/tools/preact-compat.js";import{E as b}from"./EmptyCart.js";import{classes as l,VComponent as v,Slot as I}from"@dropins/tools/lib.js";/* empty css
|
|
3
|
+
import{jsx as a,Fragment as g}from"@dropins/tools/preact-jsx-runtime.js";import{useState as _,useEffect as C}from"@dropins/tools/preact-compat.js";import{E as b}from"./EmptyCart.js";import{classes as l,VComponent as v,Slot as I}from"@dropins/tools/lib.js";/* empty css */import{Image as N}from"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import{events as S}from"@dropins/tools/event-bus.js";import{g as j}from"./persisted-data.js";const D=({className:c,children:i,emptyCart:m,products:e,...n})=>a("div",{...n,className:l(["cart-cart-summary-grid",c]),children:a(g,{children:a("div",{className:l(["cart-cart-summary-grid__content",["cart-cart-summary-grid__content--empty",!e]]),children:e||a(v,{node:m,className:"cart-cart-summary-grid__empty-cart"})})})}),L=({children:c,initialData:i=null,routeProduct:m,routeEmptyCartCTA:e,slots:n,...p})=>{const[o,u]=_(i);C(()=>{const r=S.on("cart/data",t=>{u(t)},{eager:!0});return()=>{r==null||r.off()}},[]);const f=(r,t)=>{const y=r.selectedOptions?`${r.name}: ${Object.entries(r.selectedOptions).join("; ")}`:r.name,s={loading:t<4?"eager":"lazy",src:r.image.src,alt:r.image.alt},d=a(N,{"data-testid":"cart-grid-item-image","aria-label":y,width:"100%",...s});return a("div",{className:"cart-cart-summary-grid__item-container",children:a(I,{name:"Thumbnail",slot:n==null?void 0:n.Thumbnail,context:{item:r,defaultImageProps:s},children:m?a("a",{href:m(r),children:d}):d})},t)},h=o&&a(g,{children:o.items.map((r,t)=>f(r,t))});return a(D,{...p,emptyCart:a(b,{ctaLinkURL:e?e():void 0}),products:h})};L.getInitialData=async function(){return j()};export{L as C};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as n,jsxs as y,Fragment as M}from"@dropins/tools/preact-jsx-runtime.js";import*as o from"@dropins/tools/preact-compat.js";import{useState as N,useCallback as Bt,useEffect as It}from"@dropins/tools/preact-compat.js";import{classes as I,VComponent as b,Slot as C}from"@dropins/tools/lib.js";import{E as Ft}from"./EmptyCart.js";/* empty css */import{Divider as Et,Skeleton as zt,SkeletonRow as Wt,InLineAlert as qt,CartList as St,Icon as W,Button as q,Accordion as Ut,AccordionSection as Tt,CartItem as Jt,Price as A,Image as Kt}from"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import{g as Yt}from"./persisted-data.js";import{events as Rt}from"@dropins/tools/event-bus.js";import{s as Ht}from"./resetCart.js";import{u as Pt}from"./updateProductsFromCart.js";import{S as Dt}from"./ChevronDown.js";import{useText as te}from"@dropins/tools/i18n.js";const ee=g=>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",...g},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"})))),xt=g=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...g},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=g=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...g},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"})),Nt=({className:g,children:U,heading:w,footer:v,emptyCart:E,products:d,outOfStockMessage:m,variant:S="primary",loading:h=!0,...c})=>n("div",{...c,className:I(["cart-cart-summary-list",g,`cart-cart-summary-list__background--${S}`]),children:h?n(re,{}):y(M,{children:[(w||m)&&y("div",{"data-testid":"cart-summary-list-heading-wrapper",className:I(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!d]]),children:[w&&y(M,{children:[n(b,{node:w,className:"cart-cart-summary-list__heading-text"}),n(Et,{variant:"primary",className:I(["cart-cart-summary-list__heading-divider"])})]}),m&&n(b,{node:m,className:"cart-cart-summary-list__out-of-stock-message"})]}),n("div",{className:I(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!d]]),children:d||n(b,{node:E,className:"cart-cart-summary-list__empty-cart"})}),v&&y(M,{children:[n(Et,{variant:"primary",className:I(["cart-cart-summary-list__footer-divider"])}),n(b,{node:v,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(Wt,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),ae=({initialData:g=null,hideHeading:U,hideFooter:w,routeProduct:v,routeEmptyCartCTA:E,routeCart:d,onItemUpdate:m,onItemRemove:S,maxItems:h,slots:c,attributesToHide:l=[],enableRemoveItem:O,enableUpdateItemQuantity:Z,onItemsErrorsChange:B,accordion:At=!1,variant:F="primary",isLoading:Ot,showMaxItems:T,showDiscount:J,showSavings:K,quantityType:Y,dropdownOptions:R,...H})=>{var Ct;const[Q,Qt]=N(!g),[a,Gt]=N(g),[L,Vt]=N(new Set),[G,D]=N(new Map),s=(Ct=Ht.config)==null?void 0:Ct.shoppingCartDisplaySetting,[V,Xt]=N(T?!0:!h&&!T),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"}),X=(t,e)=>{Vt(r=>(e?r.add(t):r.delete(t),new Set(r)))},tt=(t,e)=>{D(r=>(e?r.set(t,e):r.delete(t),new Map(r)))},z=(t,e)=>{X(t.uid,!0),D(new Map),O&&e===0?Pt([{uid:t.uid,quantity:e}]).then(()=>{S==null||S({item:t})}).finally(()=>{X(t.uid,!1)}).catch(r=>{console.warn(r)}):Z&&Pt([{uid:t.uid,quantity:e}]).then(()=>{m==null||m({item:t})}).finally(()=>{X(t.uid,!1)}).catch(r=>{tt(t.uid,r.message)})},jt=Bt(()=>{Xt(t=>!t)},[]);It(()=>{const t=Rt.on("cart/data",e=>{Gt(e),Qt(!!Ot)},{eager:!0});return()=>{t==null||t.off()}},[]),It(()=>{B&&B(G)},[G,B]);const et=(t,e)=>{if(l.includes("image"))return;const r={loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}},u=n(Kt,{"data-testid":"cart-list-item-image",...r});return n(C,{name:"Thumbnail",slot:c==null?void 0:c.Thumbnail,context:{item:t,defaultImageProps:r},children:v?n("a",{href:v(t),children:u}):u})},nt=t=>{if(!l.includes("name"))return n("span",{"data-testid":"cart-list-item-title",children:v?n("a",{href:v(t),children:t.name}):t.name})},rt=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},at=t=>{var e,r,u,f;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:(u=t.regularPrice)==null?void 0:u.value,currency:(f=t.regularPrice)==null?void 0:f.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},it=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"}},ct=t=>(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX"?n(A,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,ot=t=>{var u,f,_,p,k,P,x,wt,Lt,_t;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=(u=t.rowTotalIncludingTax)==null?void 0:u.value,e.currency=(f=t.rowTotalIncludingTax)==null?void 0:f.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",r&&(e.amount=(_=t.total)==null?void 0:_.value,e.currency=(p=t.total)==null?void 0:p.currency,r.amount=(k=t.rowTotalIncludingTax)==null?void 0:k.value,r.currency=(P=t.rowTotalIncludingTax)==null?void 0:P.currency,r.sale=!0,r["aria-label"]=i.discountedPrice,r["data-testid"]="discount-total")):(e.amount=(x=t.total)==null?void 0:x.value,e.currency=(wt=t.total)==null?void 0:wt.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",r&&(r.amount=(Lt=t.discountedTotal)==null?void 0:Lt.value,r.currency=(_t=t.discountedTotal)==null?void 0:_t.currency,r.sale=!0,r["aria-label"]=i.regularPrice,r["data-testid"]="discount-total")),{totalProps:e,discountProps:r}},st=t=>{var k,P,x;if(l.includes("warning"))return;const e=G.get(t.uid),r=(k=G.get(t.uid))==null?void 0:k.includes("The requested qty is not available"),u=L.has(t.uid),f=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(P=t.stockLevel)==null?void 0:P.toString()).replace("{count}",t.quantity.toString()):"",_=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(x=t.onlyXLeftInStock)==null?void 0:x.toString()),p=!t.outOfStock&&e&&r?i.notAvailableMessage:e;return!u&&(e||t.insufficientQuantity||t.lowInventory)?y("span",{"data-testid":"item-warning",children:[n(W,{source:ne,size:"16"}),p||f||_]}):void 0},lt=t=>l!=null&&l.includes("alert")?void 0:!L.has(t.uid)&&t.outOfStock?y("span",{"data-testid":"item-alert",children:[n(W,{source:xt,size:"16"}),i.outOfStockAlert]}):void 0,ut=t=>n(C,{name:"ProductAttributes",slot:c==null?void 0:c.ProductAttributes,context:{item:t}}),dt=t=>{if(!l.includes("sku"))return n("span",{"data-testid":"cart-list-item-sku",children:t.sku})},gt=t=>n(C,{name:"Footer",slot:c==null?void 0:c.Footer,context:{item:t,handleItemsLoading:X,handleItemsError:tt,onItemUpdate:m}}),ft=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,r)=>{var p;const{totalProps:u,discountProps:f}=ot(e),_=n(Jt,{updating:L==null?void 0:L.has(e.uid),loading:Q,"data-testid":`cart-list-item-entry-${e.uid}`,image:et(e,r),title:nt(e),sku:dt(e),price:l.includes("price")?void 0:n(A,{...at(e)}),quantity:l.includes("quantity")?void 0:e.quantity,total:y(M,{children:[l.includes("total")?void 0:n(A,{...u}),l.includes("totalDiscount")?void 0:f&&n(A,{...f})]}),attributes:ut(e),configurations:rt(e),totalExcludingTax:l.includes("totalExcludingTax")?void 0:ct(e),taxIncluded:(s==null?void 0:s.price)==="INCLUDING_TAX",taxExcluded:!l.includes("totalExcludingTax")&&(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX",warning:st(e),alert:lt(e),quantityType:Y,dropdownOptions:R,onQuantity:Z?k=>{z(e,k)}:void 0,onRemove:O?()=>z(e,0):void 0,discount:J&&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:K&&e.discounted&&e.savingsAmount?y("div",{children:[n("span",{children:n(A,{...it(e)})})," ",i.savingsAmount]}):void 0,footer:gt(e)},e.uid);return n(C,{name:"CartItem",slot:c==null?void 0:c.CartItem,context:{item:e,index:r,enableUpdateItemQuantity:Z,enableRemoveItem:O,itemsLoading:L,loading:Q,attributesToHide:l,cartTaxesConfig:s,quantityType:Y,dropdownOptions:R,showDiscount:J,showSavings:K,dictionary:i,getImage:et,getTitle:nt,getSku:dt,getPriceProps:at,getTotalPriceProps:ot,getProductAttributes:ut,getConfiguration:rt,getTotalExcludingTax:ct,getWarning:st,getAlert:lt,getFooter:gt,getSavingsAmount:it},children:_},e.uid)}):null,mt=n(C,{name:"EmptyCart",slot:c==null?void 0:c.EmptyCart,context:{},children:n(Ft,{"data-testid":"empty-cart",ctaLinkURL:E==null?void 0:E()})}),ht=n(C,{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()})`:"")})}),$t=ht.props.children.props.children,bt=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{z(e,0)})},Mt=ft(t=>t.outOfStock||t.insufficientQuantity||!1),yt=a!=null&&a.hasOutOfStockItems?n(qt,{"data-testid":"cart-out-of-stock-message",icon:n(W,{source:xt,size:"16"}),itemList:n(St,{"data-testid":"out-of-stock-cart-items",children:Mt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&O?[{label:i.removeAction,onClick:bt}]:void 0}):void 0,j=ft(t=>!t.outOfStock&&!t.insufficientQuantity),vt=V?Math.max(h||5,5):Math.min((a==null?void 0:a.totalQuantity)||5,5),pt=(a==null?void 0:a.totalQuantity)>vt,Zt=pt&&!V&&vt!=h,$=a!=null&&a.totalQuantity&&j?n(C,{name:"Footer",slot:c==null?void 0:c.CartSummaryFooter,context:{displayMaxItems:V,routeCart:d},"data-testid":"cart-cart-summary-footer-slot",children:n("div",{"data-testid":"cart-cart-summary-footer",children:pt?Zt?n(q,{className:"cart-cart-summary-list-footer__action",onClick:jt,"data-testid":"view-more-items-button",variant:"tertiary",children:i.viewMore}):d&&n(q,{className:"cart-cart-summary-list-footer__action",href:d(),variant:"tertiary","data-testid":"view-cart-or-less-items-button",children:i.viewAll}):d&&n(q,{className:"cart-cart-summary-list-footer__action",href:d(),variant:"tertiary","data-testid":"view-cart-button",children:i.viewAll})})}):null,kt=a!=null&&a.totalQuantity?n(St,{"data-testid":"cart-list",children:j==null?void 0:j.slice(0,V?Math.max(h||(a==null?void 0:a.totalQuantity),5):Math.min(h??5,5))}):null;return At?n(Ut,{"data-testid":"cart-summary-list-accordion",className:I(["cart-cart-summary-list-accordion",`cart-cart-summary-list__background--${F}`]),iconOpen:ee,iconClose:Dt,children:n(Tt,{title:$t,"data-testid":"cart-summary-list-accordion__section",open:!0,renderContentWhenClosed:!0,children:n(Nt,{...H,"aria-expanded":!0,"aria-label":"TEST",className:"cart-cart-summary-list-accordion__list",loading:Q,footer:w?void 0:$||(d?$:void 0),emptyCart:mt,products:kt,outOfStockMessage:yt,variant:F})})}):n(Nt,{...H,heading:U?void 0:ht,footer:w?void 0:$||(d?$:void 0),loading:Q,emptyCart:mt,products:kt,outOfStockMessage:yt,variant:F})};ae.getInitialData=async function(){return Yt()};export{ae as C};
|
|
3
|
+
import{jsx as r,jsxs as m,Fragment as B}from"@dropins/tools/preact-jsx-runtime.js";import*as A from"@dropins/tools/preact-compat.js";import{useState as O,useCallback as qt,useEffect as wt}from"@dropins/tools/preact-compat.js";import{classes as S,VComponent as z,Slot as p}from"@dropins/tools/lib.js";import{E as Ut}from"./EmptyCart.js";/* empty css */import{Divider as Pt,Skeleton as jt,SkeletonRow as Tt,InLineAlert as Vt,CartList as Nt,Icon as T,Button as V,Accordion as Jt,AccordionSection as Kt,CartItem as Yt,Price as L,Image as Zt}from"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import{g as Rt}from"./persisted-data.js";import{events as Mt}from"@dropins/tools/event-bus.js";import{s as Dt}from"./resetCart.js";import{u as xt}from"./updateProductsFromCart.js";import{S as At,a as Ht}from"./WarningWithCircle.js";import{S as tn}from"./ChevronDown.js";import{useText as nn}from"@dropins/tools/i18n.js";const rn=C=>A.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",...C},A.createElement("g",{id:"Large"},A.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),A.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},A.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"})))),Ot=({className:C,children:J,heading:k,footer:y,emptyCart:w,products:u,outOfStockMessage:g,variant:P="primary",loading:f=!0,...c})=>r("div",{...c,className:S(["cart-cart-summary-list",C,`cart-cart-summary-list__background--${P}`]),children:f?r(en,{}):m(B,{children:[(k||g)&&m("div",{"data-testid":"cart-summary-list-heading-wrapper",className:S(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!u]]),children:[k&&m(B,{children:[r(z,{node:k,className:"cart-cart-summary-list__heading-text"}),r(Pt,{variant:"primary",className:S(["cart-cart-summary-list__heading-divider"])})]}),g&&r(z,{node:g,className:"cart-cart-summary-list__out-of-stock-message"})]}),r("div",{className:S(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!u]]),children:u||r(z,{node:w,className:"cart-cart-summary-list__empty-cart"})}),y&&m(B,{children:[r(Pt,{variant:"primary",className:S(["cart-cart-summary-list__footer-divider"])}),r(z,{node:y,className:"cart-cart-summary-list__footer-text"})]})]})}),en=()=>r(jt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:r(Tt,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),an=({initialData:C=null,hideHeading:J,hideFooter:k,routeProduct:y,routeEmptyCartCTA:w,routeCart:u,onItemUpdate:g,onItemRemove:P,maxItems:f,slots:c,attributesToHide:s=[],enableRemoveItem:E,enableUpdateItemQuantity:W,onItemsErrorsChange:q,accordion:Lt=!1,variant:U="primary",isLoading:Et,showMaxItems:K,showDiscount:Y,showSavings:Z,quantityType:R,dropdownOptions:M,...D})=>{var kt;const[Q,Qt]=O(!C),[a,Gt]=O(C),[_,Xt]=O(new Set),[G,H]=O(new Map),o=(kt=Dt.config)==null?void 0:kt.shoppingCartDisplaySetting,[X,$t]=O(K?!0:!f&&!K),i=nn({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"}),$=(t,n)=>{Xt(e=>(n?e.add(t):e.delete(t),new Set(e)))},tt=(t,n)=>{H(e=>(n?e.set(t,n):e.delete(t),new Map(e)))},j=(t,n)=>{$(t.uid,!0),H(new Map),E&&n===0?xt([{uid:t.uid,quantity:n}]).then(()=>{P==null||P({item:t})}).finally(()=>{$(t.uid,!1)}).catch(e=>{console.warn(e)}):W&&xt([{uid:t.uid,quantity:n}]).then(()=>{g==null||g({item:t})}).finally(()=>{$(t.uid,!1)}).catch(e=>{tt(t.uid,e.message)})},bt=qt(()=>{$t(t=>!t)},[]);wt(()=>{const t=Mt.on("cart/data",n=>{Gt(n),Qt(!!Et)},{eager:!0});return()=>{t==null||t.off()}},[]),wt(()=>{q&&q(G)},[G,q]);const nt=(t,n)=>{if(s.includes("image"))return;const e={loading:n<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}},l=r(Zt,{"data-testid":"cart-list-item-image",...e});return r(p,{name:"Thumbnail",slot:c==null?void 0:c.Thumbnail,context:{item:t,defaultImageProps:e},children:y?r("a",{href:y(t),children:l}):l})},rt=t=>{if(!s.includes("name"))return r("span",{"data-testid":"cart-list-item-title",children:y?r("a",{href:y(t),children:t.name}):t.name})},et=t=>{if(s.includes("configurations"))return;const n={...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(n).length!==0)return n},at=t=>{var n,e,l,d;return(o==null?void 0:o.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(n=t.taxedPrice)==null?void 0:n.value,currency:(e=t.taxedPrice)==null?void 0:e.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(l=t.regularPrice)==null?void 0:l.value,currency:(d=t.regularPrice)==null?void 0:d.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},it=t=>{var n,e;return{amount:(n=t.savingsAmount)==null?void 0:n.value,currency:(e=t.savingsAmount)==null?void 0:e.currency,style:{font:"inherit"},"data-testid":"item-savings-amount"}},ct=t=>(o==null?void 0:o.price)==="INCLUDING_EXCLUDING_TAX"?r(L,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,ot=t=>{var l,d,I,h,v,N,x,_t,It,St;const n={"aria-label":i.regularPrice},e=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(o==null?void 0:o.price)?(n.amount=(l=t.rowTotalIncludingTax)==null?void 0:l.value,n.currency=(d=t.rowTotalIncludingTax)==null?void 0:d.currency,n.variant=t.discounted?"strikethrough":"default",n["data-testid"]="including-tax-item-total",e&&(n.amount=(I=t.total)==null?void 0:I.value,n.currency=(h=t.total)==null?void 0:h.currency,e.amount=(v=t.rowTotalIncludingTax)==null?void 0:v.value,e.currency=(N=t.rowTotalIncludingTax)==null?void 0:N.currency,e.sale=!0,e["aria-label"]=i.discountedPrice,e["data-testid"]="discount-total")):(n.amount=(x=t.total)==null?void 0:x.value,n.currency=(_t=t.total)==null?void 0:_t.currency,n.variant=t.discounted?"strikethrough":"default",n["data-testid"]="regular-item-total",e&&(e.amount=(It=t.discountedTotal)==null?void 0:It.value,e.currency=(St=t.discountedTotal)==null?void 0:St.currency,e.sale=!0,e["aria-label"]=i.regularPrice,e["data-testid"]="discount-total")),{totalProps:n,discountProps:e}},st=t=>{var v,N,x;if(s.includes("warning"))return;const n=G.get(t.uid),e=(v=G.get(t.uid))==null?void 0:v.includes("The requested qty is not available"),l=_.has(t.uid),d=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(N=t.stockLevel)==null?void 0:N.toString()).replace("{count}",t.quantity.toString()):"",I=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(x=t.onlyXLeftInStock)==null?void 0:x.toString()),h=!t.outOfStock&&n&&e?i.notAvailableMessage:n;return!l&&(n||t.insufficientQuantity||t.lowInventory)?m("span",{"data-testid":"item-warning",children:[r(T,{source:Ht,size:"16"}),h||d||I]}):void 0},lt=t=>s!=null&&s.includes("alert")?void 0:!_.has(t.uid)&&t.outOfStock?m("span",{"data-testid":"item-alert",children:[r(T,{source:At,size:"16"}),i.outOfStockAlert]}):void 0,ut=t=>r(p,{name:"ProductAttributes",slot:c==null?void 0:c.ProductAttributes,context:{item:t}}),dt=t=>{if(!s.includes("sku"))return r("span",{"data-testid":"cart-list-item-sku",children:t.sku})},gt=t=>r(p,{name:"Footer",slot:c==null?void 0:c.Footer,context:{item:t,handleItemsLoading:$,handleItemsError:tt,onItemUpdate:g}}),ft=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((n,e)=>{var h;const{totalProps:l,discountProps:d}=ot(n),I=r(Yt,{updating:_==null?void 0:_.has(n.uid),loading:Q,"data-testid":`cart-list-item-entry-${n.uid}`,image:nt(n,e),title:rt(n),sku:dt(n),price:s.includes("price")?void 0:r(L,{...at(n)}),quantity:s.includes("quantity")?void 0:n.quantity,total:m(B,{children:[s.includes("total")?void 0:r(L,{...l}),s.includes("totalDiscount")?void 0:d&&r(L,{...d})]}),attributes:ut(n),configurations:et(n),totalExcludingTax:s.includes("totalExcludingTax")?void 0:ct(n),taxIncluded:(o==null?void 0:o.price)==="INCLUDING_TAX",taxExcluded:!s.includes("totalExcludingTax")&&(o==null?void 0:o.price)==="INCLUDING_EXCLUDING_TAX",warning:st(n),alert:lt(n),quantityType:R,dropdownOptions:M,onQuantity:W?v=>{j(n,v)}:void 0,onRemove:E?()=>j(n,0):void 0,discount:Y&&n.discounted&&n.discountPercentage?r("div",{"data-testid":"item-discount-percent",children:i.discountPercent.replace("{discount}",((h=n.discountPercentage)==null?void 0:h.toString())??"")}):void 0,savings:Z&&n.discounted&&n.savingsAmount?m("div",{children:[r("span",{children:r(L,{...it(n)})})," ",i.savingsAmount]}):void 0,footer:gt(n)},n.uid);return r(p,{name:"CartItem",slot:c==null?void 0:c.CartItem,context:{item:n,index:e,enableUpdateItemQuantity:W,enableRemoveItem:E,itemsLoading:_,loading:Q,attributesToHide:s,cartTaxesConfig:o,quantityType:R,dropdownOptions:M,showDiscount:Y,showSavings:Z,dictionary:i,getImage:nt,getTitle:rt,getSku:dt,getPriceProps:at,getTotalPriceProps:ot,getProductAttributes:ut,getConfiguration:et,getTotalExcludingTax:ct,getWarning:st,getAlert:lt,getFooter:gt,getSavingsAmount:it},children:I},n.uid)}):null,mt=r(p,{name:"EmptyCart",slot:c==null?void 0:c.EmptyCart,context:{},children:r(Ut,{"data-testid":"empty-cart",ctaLinkURL:w==null?void 0:w()})}),yt=r(p,{name:"Heading",slot:c==null?void 0:c.Heading,context:{count:a==null?void 0:a.totalQuantity},children:r("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),Ft=yt.props.children.props.children,zt=()=>{const t=a==null?void 0:a.items.filter(n=>n.outOfStock);t==null||t.forEach(n=>{j(n,0)})},Bt=ft(t=>t.outOfStock||t.insufficientQuantity||!1),ht=a!=null&&a.hasOutOfStockItems?r(Vt,{"data-testid":"cart-out-of-stock-message",icon:r(T,{source:At,size:"16"}),itemList:r(Nt,{"data-testid":"out-of-stock-cart-items",children:Bt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&E?[{label:i.removeAction,onClick:zt}]:void 0}):void 0,b=ft(t=>!t.outOfStock&&!t.insufficientQuantity),vt=X?Math.max(f||5,5):Math.min((a==null?void 0:a.totalQuantity)||5,5),pt=(a==null?void 0:a.totalQuantity)>vt,Wt=pt&&!X&&vt!=f,F=a!=null&&a.totalQuantity&&b?r(p,{name:"Footer",slot:c==null?void 0:c.CartSummaryFooter,context:{displayMaxItems:X,routeCart:u},"data-testid":"cart-cart-summary-footer-slot",className:"cart-cart-summary-footer",children:pt?Wt?r(V,{className:"cart-cart-summary-list-footer__action",onClick:bt,"data-testid":"view-more-items-button",variant:"tertiary",children:i.viewMore}):u&&r(V,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-or-less-items-button",children:i.viewAll}):u&&r(V,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-button",children:i.viewAll})}):null,Ct=a!=null&&a.totalQuantity?r(Nt,{"data-testid":"cart-list",children:b==null?void 0:b.slice(0,X?Math.max(f||(a==null?void 0:a.totalQuantity),5):Math.min(f??5,5))}):null;return Lt?r(Jt,{"data-testid":"cart-summary-list-accordion",className:S(["cart-cart-summary-list-accordion",`cart-cart-summary-list__background--${U}`]),iconOpen:rn,iconClose:tn,children:r(Kt,{title:Ft,"data-testid":"cart-summary-list-accordion__section",open:!0,renderContentWhenClosed:!0,children:r(Ot,{...D,"aria-expanded":!0,"aria-label":"TEST",className:"cart-cart-summary-list-accordion__list",loading:Q,footer:k?void 0:F||(u?F:void 0),emptyCart:mt,products:Ct,outOfStockMessage:ht,variant:U})})}):r(Ot,{...D,heading:J?void 0:yt,footer:k?void 0:F||(u?F:void 0),loading:Q,emptyCart:mt,products:Ct,outOfStockMessage:ht,variant:U})};an.getInitialData=async function(){return Rt()};export{an as C};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsxs as o,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as W,VComponent as _,debounce as fa,Slot as h}from"@dropins/tools/lib.js";import{Image as Ca,Icon as H,Button as Ia,Price as k,Skeleton as va,SkeletonRow as xa}from"@dropins/tools/components.js";/* empty css */import*as S from"@dropins/tools/preact-compat.js";import{useState as la,useCallback as Na,useMemo as ka}from"@dropins/tools/preact-compat.js";import{useState as ua,useEffect as wa,useMemo as Ta}from"@dropins/tools/preact-hooks.js";import{useText as oa}from"@dropins/tools/i18n.js";import{events as Sa}from"@dropins/tools/event-bus.js";import{s as Pa}from"./resetCart.js";import{u as sa}from"./updateProductsFromCart.js";import{g as Ma}from"./persisted-data.js";import{S as qa,a as La}from"./WarningWithCircle.js";const Oa=l=>S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...l},S.createElement("path",{d:"M1 5H23",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:10}),S.createElement("path",{d:"M17.3674 22H6.63446C5.67952 22 4.88992 21.2688 4.8379 20.3338L4 5H20L19.1621 20.3338C19.1119 21.2688 18.3223 22 17.3655 22H17.3674Z",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:10}),S.createElement("path",{d:"M9.87189 2H14.1281C14.6085 2 15 2.39766 15 2.88889V5H9V2.88889C9 2.39912 9.39006 2 9.87189 2Z",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:10}),S.createElement("path",{d:"M8.87402 8.58057L9.39348 17.682",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:10}),S.createElement("path",{d:"M14.6673 8.58057L14.146 17.682",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:10})),Ea=({entries:l,className:d,...e})=>{const m=oa({itemLabel:"Cart.CartSummaryTable.item",priceLabel:"Cart.CartSummaryTable.price",qtyLabel:"Cart.CartSummaryTable.qty",subtotalLabel:"Cart.CartSummaryTable.subtotal",mobilePriceLabel:"Cart.CartSummaryTable.mobilePrice",mobileQtyLabel:"Cart.CartSummaryTable.mobileQty",mobileSubtotalLabel:"Cart.CartSummaryTable.mobileSubtotal"});return o("div",{...e,className:W(["cart-cart-summary-table",d]),children:[o("div",{className:"cart-cart-summary-table__header",children:[r("div",{className:"cart-cart-summary-table__header-item",children:m.itemLabel}),r("div",{className:"cart-cart-summary-table__header-price",children:m.priceLabel}),r("div",{className:"cart-cart-summary-table__header-qty",children:m.qtyLabel}),r("div",{className:"cart-cart-summary-table__header-subtotal",children:m.subtotalLabel})]}),r("div",{className:"cart-cart-summary-table__body",children:l.map(u=>o("div",{className:W(["cart-cart-summary-table__row",["cart-cart-summary-table__row--updating",u.updating],["cart-cart-summary-table__row--error",u.hasError]]),children:[r("div",{className:"cart-cart-summary-table__cell-item",children:r(_,{node:u.item})}),o("div",{className:"cart-cart-summary-table__cell-price",children:[r("span",{className:"cart-cart-summary-table__mobile-label",children:m.mobilePriceLabel}),r(_,{node:u.price})]}),o("div",{className:"cart-cart-summary-table__cell-qty",children:[r("span",{className:"cart-cart-summary-table__mobile-label",children:m.mobileQtyLabel}),r(_,{node:u.quantity})]}),o("div",{className:"cart-cart-summary-table__cell-subtotal",children:[r("span",{className:"cart-cart-summary-table__mobile-label",children:m.mobileSubtotalLabel}),r(_,{node:u.subtotal})]}),r("div",{className:"cart-cart-summary-table__item-footer",children:r(_,{className:"cart-cart-summary-table__item-actions",node:u.actions})})]},u.uid))})]})},Aa=({className:l,productTitle:d,sku:e,image:m,configurations:u,alert:I,warning:v,...g})=>o("div",{...g,className:W(["cart-cart-summary-table__item",l]),children:[m&&r(_,{className:"cart-cart-summary-table__item-image-wrapper",node:m}),o("div",{className:"cart-cart-summary-table__item-details",children:[d&&r(_,{className:"cart-cart-summary-table__item-name",node:d}),e&&r(_,{className:"cart-cart-summary-table__sku",node:e}),I&&r(_,{className:"cart-cart-summary-table__item-quantity-alert-text",node:I}),v&&r(_,{className:"cart-cart-summary-table__item-quantity-warning-text",node:v}),u&&r(_,{className:"cart-cart-summary-table__item-configurations",node:u})]})]}),Ua=({dictionary:l,onQuantityUpdate:d,onItemRemove:e})=>{var L,O;const[m,u]=la(new Map),[I,v]=la(new Map),g=(O=(L=Pa)==null?void 0:L.config)==null?void 0:O.shoppingCartDisplaySetting,U=(g==null?void 0:g.price)==="INCLUDING_TAX",G=(g==null?void 0:g.price)==="INCLUDING_EXCLUDING_TAX",P=({item:a})=>{const n={...a.bundleOptions,...a.selectedOptions,...a.customizableOptions,...a.recipient?{[l.recipient]:a.recipient}:null,...a.recipientEmail&&a.recipient?{[l.recipient]:`${a.recipient} (${a.recipientEmail})`}:null,...a.sender?{[l.sender]:a.sender}:null,...a.senderEmail&&a.sender?{[l.sender]:`${a.sender} (${a.senderEmail})`}:{},...a.message?{[l.message]:a.message}:null,...a.links&&a.links.count?a.links.count>1?{[l.files.replace("{count}",a.links.count.toString())]:a.links.result}:{[l.file.replace("{count}",a.links.count.toString())]:a.links.result}:null};if(Object.keys(n).length!==0)return n},w=a=>{var n,c,i,s;return U?a.discounted?{amount:a.regularPrice.value,currency:a.regularPrice.currency,"data-testid":"discounted-regular-item-price"}:{amount:(n=a.taxedPrice)==null?void 0:n.value,currency:(c=a.taxedPrice)==null?void 0:c.currency,"data-testid":"taxed-item-price"}:{amount:(i=a.regularPrice)==null?void 0:i.value,currency:(s=a.regularPrice)==null?void 0:s.currency,"data-testid":"regular-item-price"}},D=a=>{var i,s,b,C,t,y,x,T,$,E;const n={"aria-label":l.regularPrice},c=a.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(g==null?void 0:g.price)?(n.amount=(i=a.rowTotalIncludingTax)==null?void 0:i.value,n.currency=(s=a.rowTotalIncludingTax)==null?void 0:s.currency,n.variant=a.discounted?"strikethrough":"default",n["data-testid"]="including-tax-item-total",c&&(n.amount=(b=a.total)==null?void 0:b.value,n.currency=(C=a.total)==null?void 0:C.currency,c.amount=(t=a.rowTotalIncludingTax)==null?void 0:t.value,c.currency=(y=a.rowTotalIncludingTax)==null?void 0:y.currency,c.sale=!0,c["aria-label"]=l.discountedPrice,c["data-testid"]="discount-total")):(n.amount=(x=a.total)==null?void 0:x.value,n.currency=(T=a.total)==null?void 0:T.currency,n.variant=a.discounted?"strikethrough":"default",n["data-testid"]="regular-item-total",c&&(c.amount=($=a.discountedTotal)==null?void 0:$.value,c.currency=(E=a.discountedTotal)==null?void 0:E.currency,c.sale=!0,c["aria-label"]=l.regularPrice,c["data-testid"]="discount-total")),{subtotalProps:n,subtotalDiscountProps:c}},p=a=>{var s,b;const n=I.get(a.uid),c=a.insufficientQuantity&&a.stockLevel?a.stockLevel==="noNumber"?l.insufficientQuantityGeneral:l.insufficientQuantity.replace("{inventory}",(s=a.stockLevel)==null?void 0:s.toString()).replace("{count}",a.quantity.toString()):void 0,i=a.lowInventory&&a.onlyXLeftInStock&&l.lowInventory.replace("{count}",(b=a.onlyXLeftInStock)==null?void 0:b.toString());return n||c||i||void 0},N=Na(async(a,n)=>{const c=(i,s)=>sa([{uid:i.uid,quantity:s}]);if(!(isNaN(n)||a.quantity===n)){v(new Map);try{u(i=>{const s=new Map(i);return s.set(a.uid,{isUpdating:!0,updatedValue:n}),s}),await c(a,n),n===0?e==null||e(a):d==null||d(a,n)}catch(i){u(s=>{const b=new Map(s);return b.delete(a.uid),b}),v(s=>{const b=new Map(s);return b.set(a.uid,i.message),b})}}},[e,d]),M=ka(()=>fa(N,500),[N]);return{showIncludedTaxPrice:U,showExcludingTaxPrice:G,itemsUpdating:m,itemUpdateErrors:I,getConfiguration:P,getPriceProps:w,getSubtotalProps:D,processQuantityChange:N,debouncedQuantityChange:M,setItemsUpdating:u,getWarningMessage:p,setItemUpdateError:(a,n)=>{v(c=>{const i=new Map(c);return n?i.set(a,n):i.delete(a),i})},handleRemoveItem:a=>(u(n=>{const c=new Map(n);return c.set(a.uid,{isUpdating:!0,updatedValue:0}),c}),sa([{uid:a.uid,quantity:0}]).then(n=>(e==null||e(a),Promise.resolve(n)))),setItemUpdating:(a,n)=>{u(c=>{const i=new Map(c);return i.set(a,{isUpdating:n,updatedValue:n}),i})}}},Da=()=>r(va,{"data-testid":"cart-summary-table-skeleton",className:"cart-cart-summary-table__skeleton",rowGap:"medium",children:r(xa,{variant:"row",size:"xlarge",fullWidth:!0,lines:4,multilineGap:"small"})}),$a=({initialData:l=null,routeProduct:d,slots:e,className:m,allowQuantityUpdates:u=!0,allowRemoveItems:I=!0,onQuantityUpdate:v,onItemRemove:g,...U})=>{const[G,P]=ua(!l),[w,D]=ua(l),p=oa({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",includingTax:"Cart.CartItem.includingTax",excludingTax:"Cart.CartItem.excludingTax",remove:"Dropin.CartItem.remove.label",removeDefault:"Dropin.CartItem.removeDefault.label",quantity:"Dropin.CartItem.quantity.label"}),{showIncludedTaxPrice:N,showExcludingTaxPrice:M,itemsUpdating:q,itemUpdateErrors:f,getConfiguration:Q,getPriceProps:V,getSubtotalProps:L,debouncedQuantityChange:O,setItemsUpdating:a,getWarningMessage:n,handleRemoveItem:c,setItemUpdating:i,setItemUpdateError:s}=Ua({dictionary:p,onQuantityUpdate:v,onItemRemove:g});wa(()=>{const C=Sa.on("cart/data",t=>{P(!0),D(t),a(new Map),P(!1)},{eager:!0});return()=>{C==null||C.off()}},[P,D,a]);const b=Ta(()=>{var C;return((C=w==null?void 0:w.items)==null?void 0:C.sort((t,y)=>f.has(t.uid)&&!f.has(y.uid)?-1:!f.has(t.uid)&&f.has(y.uid)?1:t.outOfStock&&!y.outOfStock?-1:!t.outOfStock&&y.outOfStock?1:0).map((t,y)=>{var K,Y,R,aa,ta,ea,ra,na,ca,ia;const x=q.has(t.uid),T=n(t),$=r(h,{name:"ProductTitle",slot:e==null?void 0:e.ProductTitle,context:{item:t},children:d?r("a",{href:d(t),children:t.name}):t.name}),E={src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}},j=r(Ca,{"data-testid":`cart-table-item-image-${t.sku}`,loading:y<4?"eager":"lazy",...E}),da=r(h,{name:"Thumbnail",slot:e==null?void 0:e.Thumbnail,className:"cart-cart-summary-table__item-image-wrapper",context:{item:t,defaultImageProps:{...E,loading:y<4?"eager":"lazy"},index:y},children:d?r("a",{href:d(t),children:j}):j}),ma=r(h,{name:"Sku",slot:e==null?void 0:e.Sku,context:{item:t},children:t.sku}),ga=t.outOfStock||e!=null&&e.ItemAlert?r(h,{name:"ItemAlert",slot:e==null?void 0:e.ItemAlert,context:{item:t},children:t.outOfStock&&o("div",{className:"cart-cart-summary-table__item-quantity-alert-wrapper","data-testid":`cart-table-item-quantity-alert-${t.uid}`,children:[r(H,{className:"cart-cart-summary-table__item-quantity-alert-icon",source:qa,size:"16"}),r("span",{className:"cart-cart-summary-table__item-quantity-alert-text",children:p.outOfStockAlert})]})}):void 0,ba=T||e!=null&&e.ItemWarning?r(h,{name:"ItemWarning",slot:e==null?void 0:e.ItemWarning,context:{item:t},children:T&&o("div",{className:"cart-cart-summary-table__item-quantity-warning-wrapper","data-testid":`cart-table-item-quantity-warning-${t.uid}`,children:[r(H,{className:"cart-cart-summary-table__item-quantity-warning-icon",source:La,size:"16"}),r("span",{className:"cart-cart-summary-table__item-quantity-warning-text",children:T})]})}):void 0,z=Q({item:t}),pa=z||e!=null&&e.Configurations?r(h,{name:"Configurations",slot:e==null?void 0:e.Configurations,context:{item:t},children:z&&r("ul",{className:"cart-cart-summary-table__item-configurations","data-testid":`cart-table-item-configurations-${t.sku}`,children:Object.entries(z).map(([A,X])=>o("li",{className:"cart-cart-summary-table__item-configuration","data-testid":`cart-table-item-configuration-${A}`,children:[o("span",{className:"cart-cart-summary-table__item-configuration-label",children:[A,":"]}),r("span",{className:"cart-cart-summary-table__item-configuration-value",children:X})]},A))})}):void 0,{subtotalProps:ya,subtotalDiscountProps:B}=L(t),Z=(K=q.get(t.uid))==null?void 0:K.updatedValue,F=x&&!isNaN(Z)?Z:t.quantity,J=A=>{const X=A.target,_a=parseInt(X.value,10);O(t,_a)},ha=r(h,{name:"Actions",slot:e==null?void 0:e.Actions,context:{item:t,itemsUpdating:q,setItemUpdating:i,setItemUpdateError:s},children:I&&r(Ia,{variant:"tertiary",size:"medium",className:"cart-cart-summary-table__item-remove-button","data-testid":`cart-table-item-remove-${t.uid}`,icon:r(H,{source:Oa,size:"32"}),onClick:()=>c(t),"aria-label":((Y=p.remove)==null?void 0:Y.replace("{product}",t.name))||p.removeDefault})});return{key:t.uid,uid:t.uid,updating:x,hasError:t.outOfStock||f.has(t.uid),item:r(h,{name:"Item",slot:e==null?void 0:e.Item,context:{item:t},children:r(Aa,{productTitle:$,image:da,sku:ma,configurations:pa,alert:ga,warning:ba})}),price:o(h,{name:"Price",className:"cart-cart-summary-table__item-price",slot:e==null?void 0:e.Price,context:{item:t},children:[r(k,{...V(t)}),N&&o("span",{className:"cart-cart-summary-table__item-price-tax-label",children:[p.includingTax,": ",r(k,{amount:(R=t.taxedPrice)==null?void 0:R.value,currency:(aa=t.taxedPrice)==null?void 0:aa.currency})]}),M&&o("span",{className:"cart-cart-summary-table__item-price-tax-label",children:[p.excludingTax,": ",r(k,{amount:(ta=t.regularPrice)==null?void 0:ta.value,currency:(ea=t.regularPrice)==null?void 0:ea.currency})]})]}),quantity:r(h,{name:"Quantity",className:"cart-cart-summary-table__item-qty",slot:e==null?void 0:e.Quantity,context:{item:t,isUpdating:x,quantityInputValue:F,handleInputChange:J,itemUpdateErrors:f},children:u?r("input",{id:`cart-table-item-quantity-${t.uid}`,"data-testid":`cart-table-item-quantity-${t.uid}`,type:"number",min:"1",value:F,disabled:x,"aria-label":p.quantity,className:W(["cart-cart-summary-table__cell-qty-input","cart-cart-summary-table__cell-qty-updater",["cart-cart-summary-table__cell-qty-updater--disabled",x],["cart-cart-summary-table__cell-qty-updater--error",f.has(t.uid)]]),onChange:J}):r("span",{children:t.quantity})}),subtotal:o(h,{name:"Subtotal",className:"cart-cart-summary-table__item-subtotal",slot:e==null?void 0:e.Subtotal,context:{item:t},children:[r(k,{...ya}),B&&r(k,{...B}),N&&o("span",{className:"cart-cart-summary-table__item-subtotal-tax-label",children:[p.includingTax,": ",r(k,{amount:(ra=t.rowTotalIncludingTax)==null?void 0:ra.value,currency:(na=t.rowTotalIncludingTax)==null?void 0:na.currency})]}),M&&o("span",{className:"cart-cart-summary-table__item-subtotal-tax-label",children:[p.excludingTax,": ",r(k,{amount:(ca=t.rowTotal)==null?void 0:ca.value,currency:(ia=t.rowTotal)==null?void 0:ia.currency})]})]}),actions:ha}}))||[]},[w,q,u,d,e,f,p,Q,I,O,n,V,L,c,i,s,N,M]);return G?r(Da,{}):r(Ea,{entries:b,className:m,...U})};$a.getInitialData=async function(){return Ma()};export{$a as C};
|
package/chunks/Coupons.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import*as e from"@dropins/tools/preact-compat.js";import{useRef as k}from"@dropins/tools/preact-compat.js";import{jsx as n,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as t,VComponent as r,getFormValues as x}from"@dropins/tools/lib.js";import{Accordion as L,AccordionSection as S}from"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import*as e from"@dropins/tools/preact-compat.js";import{useRef as k}from"@dropins/tools/preact-compat.js";import{jsx as n,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as t,VComponent as r,getFormValues as x}from"@dropins/tools/lib.js";import{Accordion as L,AccordionSection as S}from"@dropins/tools/components.js";/* empty css */import{S as C}from"./Coupon.js";import{useText as N}from"@dropins/tools/i18n.js";const B=o=>e.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",...o},e.createElement("g",{id:"Large"},e.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),e.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},e.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"}),e.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"})))),V=o=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),I=o=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},e.createElement("path",{d:"M17.3332 11.75H6.6665",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",fill:"none",stroke:"currentColor"})),W=({accordionSectionTitle:o,accordionSectionIcon:h,className:g,children:M,couponCodeField:s,applyCouponsButton:i,appliedCoupons:l,error:d,onApplyCoupon:a,...p})=>{const c=k(null),v=N({couponTitle:"Cart.PriceSummary.coupon.title"}),w=_=>{var f;_.preventDefault();const E=x(c.current);a==null||a(E);const m=(f=c==null?void 0:c.current)==null?void 0:f.querySelector("input");m&&(m.value="")};return n("div",{...p,"data-testid":"cart-coupons",className:t(["cart-coupons",g]),children:n(L,{"data-testid":"coupon-code",className:t(["cart-coupons__accordion"]),actionIconPosition:"right",iconOpen:B,iconClose:I,children:u(S,{title:o??v.couponTitle,iconLeft:h??C,showIconLeft:!0,renderContentWhenClosed:!1,"data-testid":"coupon-code-accordion-section",className:t(["cart-coupons__accordion-section"]),children:[n("form",{"data-testid":"coupon-code-form",className:t(["coupon-code-form--edit"]),ref:c,children:u("div",{className:t(["coupon-code-form__action"]),children:[s&&n(r,{node:s,className:t(["coupon-code-form__codes"])}),i&&n(r,{node:i,className:t(["coupon-code-form--button"]),onClick:w,type:"submit"})]})}),d&&n(r,{node:d,className:t(["coupon-code-form__error"])}),l&&n(r,{node:l,className:t(["coupon-code-form__applied"])})]})})})};export{W as C,V as S};
|
package/chunks/EmptyCart.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as o}from"@dropins/tools/lib.js";import{IllustratedMessage as i,Button as s,Icon as m}from"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as o}from"@dropins/tools/lib.js";import{IllustratedMessage as i,Button as s,Icon as m}from"@dropins/tools/components.js";/* empty css */import*as t from"@dropins/tools/preact-compat.js";import{useText as l}from"@dropins/tools/i18n.js";const p=e=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("g",{clipPath:"url(#clip0_102_196)"},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3601 18.16H6.5601L4.8801 3H2.3501M19.6701 19.59C19.6701 20.3687 19.0388 21 18.2601 21C17.4814 21 16.8501 20.3687 16.8501 19.59C16.8501 18.8113 17.4814 18.18 18.2601 18.18C19.0388 18.18 19.6701 18.8113 19.6701 19.59ZM7.42986 19.59C7.42986 20.3687 6.79858 21 6.01986 21C5.24114 21 4.60986 20.3687 4.60986 19.59C4.60986 18.8113 5.24114 18.18 6.01986 18.18C6.79858 18.18 7.42986 18.8113 7.42986 19.59Z",stroke:"currentColor",strokeLinejoin:"round"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.25 6.37L20.89 8.06L20.14 14.8H6.19",stroke:"currentColor",strokeLinejoin:"round"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_102_196"},t.createElement("rect",{vectorEffect:"non-scaling-stroke",width:19.29,height:19.5,fill:"white",transform:"translate(2.3501 2.25)"})))),g=({className:e,children:d,ctaLinkURL:a,...n})=>{const c=l({emptyCart:"Cart.EmptyCart.heading",cta:"Cart.EmptyCart.cta"});return r("div",{...n,className:o(["cart-empty-cart",e]),children:r(i,{className:o(["cart-empty-cart__wrapper",e]),"data-testid":"cart-empty-cart",heading:c.emptyCart,icon:r(m,{className:"cart-empty-cart__icon",source:p}),action:a?r(s,{"data-testid":"cart-empty-cart-button",size:"medium",variant:"primary",type:"submit",href:a,children:c.cta},"routeHome"):void 0})})};export{g as E};
|
package/chunks/OrderSummary.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as r,jsxs as p,Fragment as xr}from"@dropins/tools/preact-jsx-runtime.js";import{useState as G,useEffect as ne,useCallback as pr,Fragment as gr}from"@dropins/tools/preact-compat.js";import{VComponent as L,classes as nr,Slot as ce}from"@dropins/tools/lib.js";import{events as cr}from"@dropins/tools/event-bus.js";import{g as Tr}from"./persisted-data.js";import{s as re}from"./resetCart.js";import{g as yr}from"./getEstimatedTotals.js";import{p as hr}from"./acdl.js";import"@dropins/tools/preact-hooks.js";import{Accordion as ir,AccordionSection as lr,ProgressSpinner as Cr,Divider as Sr,Price as u,Button as Ir,Icon as ur}from"@dropins/tools/components.js";/* empty css */import{O as C}from"./OrderSummaryLine.js";import{S as or}from"./ChevronUp.js";import{S as sr}from"./ChevronDown.js";import{useText as dr,Text as mr}from"@dropins/tools/i18n.js";import{S as br}from"./Coupon.js";import{S as fr}from"./GiftCard.js";const vr=({className:ee,children:V,variant:k="primary",heading:d,loading:B=!0,subTotal:b,shipping:T,discounts:f,taxTotal:S,taxesApplied:w,total:e,primaryAction:F,coupons:o,giftCards:W,totalSaved:v,appliedGiftCards:m,printedCard:t,itemsGiftWrapping:x,orderGiftWrapping:g,updateLineItems:s=_=>_,...A})=>{const[_,P]=G(!1),l=dr({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",printedCardTitle:"Cart.PriceSummary.giftOptionsTax.printedCard.title",printedCardInclTax:"Cart.PriceSummary.giftOptionsTax.printedCard.inclTax",printedCardExclTax:"Cart.PriceSummary.giftOptionsTax.printedCard.exclTax",itemGiftWrappingTitle:"Cart.PriceSummary.giftOptionsTax.itemGiftWrapping.title",itemGiftWrappingInclTax:"Cart.PriceSummary.giftOptionsTax.itemGiftWrapping.inclTax",itemGiftWrappingExclTax:"Cart.PriceSummary.giftOptionsTax.itemGiftWrapping.exclTax",orderGiftWrappingTitle:"Cart.PriceSummary.giftOptionsTax.orderGiftWrapping.title",orderGiftWrappingInclTax:"Cart.PriceSummary.giftOptionsTax.orderGiftWrapping.inclTax",orderGiftWrappingExclTax:"Cart.PriceSummary.giftOptionsTax.orderGiftWrapping.exclTax"}),O=m?r(C,{label:m==null?void 0:m.label,price:m==null?void 0:m.price,classSuffixes:["applied-gift-cards"],children:m==null?void 0:m.content},m==null?void 0:m.label):null,E=b&&p(C,{label:l.subtotalLabel,price:b.price,classSuffixes:["subTotal"],children:[b.taxIncluded&&r("div",{"data-testid":"sub-total-tax-caption",className:"cart-order-summary__caption",children:r("span",{children:l.subtotalWithTaxes})}),b.taxExcluded?r("div",{"data-testid":"sub-total-tax-caption-excluded",className:"cart-order-summary__caption",children:p("span",{children:[b.priceExcludingTax," ",l.subtotalWithoutTaxes]})}):void 0]},l.subtotalLabel),D=f&&f.length>0&&r(xr,{children:f.map(n=>p(C,{label:n.label,price:n.price,classSuffixes:["discount"],children:[n.coupon&&r(L,{node:n.coupon,className:"cart-order-summary__coupon__code"}),n.caption&&r(L,{node:n.caption,className:"cart-order-summary__caption"})]},n.label))}),a=w&&w.length>0?r(ir,{"data-testid":"tax-breakdown",className:"cart-order-summary__taxes",iconOpen:sr,iconClose:or,children:p(lr,{title:l.taxesBreakdownTitle,secondaryText:!_&&S?r(L,{node:S.price,className:"cart-order-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:P,children:[r("div",{className:"cart-order-summary__appliedTaxes",children:w.map(n=>r(C,{label:n.label,price:n.price,classSuffixes:["taxEntry"],labelClassSuffix:"muted"},n.label))}),S&&r(C,{label:l.taxTotal,price:S.price,classSuffixes:["taxTotal"],labelClassSuffix:"muted"})]})}):S&&r(C,{label:S.estimated?l.taxEstimated:l.taxTotalOnly,price:S.price,classSuffixes:["taxTotal"],testId:"tax-total-only"}),y=t!=null&&t.renderContent?p(C,{label:l.printedCardTitle,price:t.taxInclAndExcl||t.taxIncluded?t.priceInclTax:t.priceExclTax,classSuffixes:["printedCardContent"],children:[t.taxIncluded&&r("div",{"data-testid":"printed-card-incl",className:"cart-order-summary__caption",children:r("span",{children:l.printedCardInclTax})}),t.taxInclAndExcl?r("div",{"data-testid":"printed-card-incl-excl",className:"cart-order-summary__caption",children:p("span",{children:[t.priceExclTax," ",l.printedCardExclTax]})}):void 0]},l.printedCardTitle):null,I=x!=null&&x.renderContent?p(C,{label:l.itemGiftWrappingTitle,price:x.taxInclAndExcl||x.taxIncluded?x.priceInclTax:x.priceExclTax,classSuffixes:["itemsGiftWrappingContent"],children:[x.taxIncluded?r("div",{"data-testid":"item-gift-wrapping-incl",className:"cart-order-summary__caption",children:r("span",{children:l.itemGiftWrappingInclTax})}):null,x.taxInclAndExcl?r("div",{"data-testid":"item-gift-wrapping-incl-excl",className:"cart-order-summary__caption",children:p("span",{children:[x.priceExclTax," ",l.itemGiftWrappingExclTax]})}):null]},l.itemGiftWrappingTitle):null,U=g!=null&&g.renderContent?p(C,{label:l.orderGiftWrappingTitle,price:g.taxInclAndExcl||g.taxIncluded?g.priceInclTax:g.priceExclTax,classSuffixes:["orderGiftWrappingContent"],children:[g.taxIncluded&&r("div",{"data-testid":"order-gift-wrapping-incl",className:"cart-order-summary__caption",children:r("span",{children:l.orderGiftWrappingInclTax})}),g.taxInclAndExcl?r("div",{"data-testid":"order-gift-wrapping-incl-excl",className:"cart-order-summary__caption",children:p("span",{children:[g.priceExclTax," ",l.orderGiftWrappingExclTax]})}):void 0]},l.orderGiftWrappingTitle):null,X=[{key:"subTotalContent",sortOrder:100,content:E},...T?[{key:"shippingContent",sortOrder:200,content:r(L,{node:T,className:"cart-order-summary__shipping"})}]:[],{key:"printedCard",sortOrder:300,content:y},{key:"itemsGiftWrappingContent",sortOrder:400,content:I},{key:"orderGiftWrappingContent",sortOrder:500,content:U},{key:"discountsContent",sortOrder:600,content:D},{key:"appliedGiftCardsContent",sortOrder:700,content:O},{key:"taxContent",sortOrder:800,content:a},...e?[{key:"taxContent",sortOrder:900,content:r(C,{label:e.estimated?l.totalEstimated:l.totalLabel,price:e.price,classSuffixes:["total","total--padded"],testId:"total-content",labelClassSuffix:"bold"})}]:[],...e!=null&&e.priceWithoutTax?[{key:"totalWithoutTaxContent",sortOrder:1e3,content:r(C,{label:l.totalWithoutTax,price:e.priceWithoutTax,classSuffixes:["totalWithoutTax"],testId:"total-without-tax",labelClassSuffix:"muted"})}]:[],...v?[{key:"totalSavedContent",sortOrder:1100,content:r(C,{label:l.totalSaved,price:v,classSuffixes:["saved"],testId:"total-saved",labelClassSuffix:"muted"})}]:[],...F?[{key:"primaryActionContent",sortOrder:1200,content:r("div",{className:nr(["cart-order-summary__entry","cart-order-summary__primaryAction"]),children:F})}]:[],...o?[{key:"couponsContent",sortOrder:1300,content:r(L,{node:o,className:"cart-order-summary__coupons"})}]:[],...W?[{key:"giftCardsContent",sortOrder:1400,content:r(L,{node:W,className:"cart-order-summary__gift-cards"})}]:[]],z=s(X).sort((n,h)=>n.sortOrder-h.sortOrder);return p("div",{...A,className:nr(["cart-order-summary",["cart-order-summary--loading",B],[`cart-order-summary__${k}`,k],ee]),children:[B&&r(Cr,{className:"cart-order-summary__spinner"}),p("div",{className:"cart-order-summary__heading",children:[d&&r(L,{node:d,className:"cart-order-summary__heading-text"}),r(Sr,{variant:"primary",className:"cart-order-summary__divider-primary"})]}),r("div",{className:"cart-order-summary__content",children:z.map(n=>Array.isArray(n.content)?r(ir,{className:n.className,actionIconPosition:"right",iconOpen:sr,iconClose:or,children:r(lr,{defaultOpen:!1,title:n.title,renderContentWhenClosed:!1,children:n.content.map(h=>h.content)})},n.key):n.content)})]})},_r=()=>{const[ee,V]=G(!1),[k,d]=G();return{handleEstimateTotals:(b,T)=>{V(!0);const{shippingCountry:f,shippingState:S="",shippingStateId:w,shippingZip:e=""}=b,F={countryCode:f,postcode:e,region:{region:S,id:w},shipping_method:{carrier_code:(T==null?void 0:T.carrier_code)||"",method_code:(T==null?void 0:T.method_code)||""}};yr(F).then(o=>{var W,v,m,t,x,g,s,A,_,P,l,O,E,D,a,y,I,U,X,z;o&&d({estimatedTaxTotal:{amount:(W=o.totalTax)==null?void 0:W.value,currency:(v=o.totalTax)==null?void 0:v.currency},estimatedSubTotal:{excludingTax:{amount:(t=(m=o.subtotal)==null?void 0:m.excludingTax)==null?void 0:t.value,currency:(g=(x=o.subtotal)==null?void 0:x.excludingTax)==null?void 0:g.currency},includingTax:{amount:(A=(s=o.subtotal)==null?void 0:s.includingTax)==null?void 0:A.value,currency:(P=(_=o.subtotal)==null?void 0:_.includingTax)==null?void 0:P.currency},includingDiscountOnly:{amount:(O=(l=o.subtotal)==null?void 0:l.includingDiscountOnly)==null?void 0:O.value,currency:(D=(E=o.subtotal)==null?void 0:E.includingDiscountOnly)==null?void 0:D.currency}},estimatedGrandTotalPrice:{includingTax:{amount:(a=o.total)==null?void 0:a.includingTax.value,currency:(y=o.total)==null?void 0:y.includingTax.currency},excludingTax:{amount:(I=o.total)==null?void 0:I.excludingTax.value,currency:(U=o.total)==null?void 0:U.excludingTax.currency}},estimatedAppliedTaxes:{taxes:(X=o.appliedTaxes)==null?void 0:X.map(n=>{var h,N;return{label:n.label,amount:{value:(h=n.amount)==null?void 0:h.value,currency:(N=n.amount)==null?void 0:N.currency}}})},estimatedItems:{items:(z=o.items)==null?void 0:z.map(n=>{var h,N,Z,j,Q,$,H,q,J,K;return{uid:n.uid,price:{amount:(h=n.price)==null?void 0:h.value,currency:(N=n.price)==null?void 0:N.currency},taxedPrice:{amount:(Z=n.taxedPrice)==null?void 0:Z.value,currency:(j=n.taxedPrice)==null?void 0:j.currency},rowTotal:{amount:(Q=n.rowTotal)==null?void 0:Q.value,currency:($=n.rowTotal)==null?void 0:$.currency},rowTotalIncludingTax:{amount:(H=n.rowTotalIncludingTax)==null?void 0:H.value,currency:(q=n.rowTotalIncludingTax)==null?void 0:q.currency},regularPrice:{amount:(J=n.regularPrice)==null?void 0:J.value,currency:(K=n.regularPrice)==null?void 0:K.currency}}})}})}).finally(()=>{V(!1)})},estimatedTotals:k,setEstimatedTotals:d,loading:ee}},Pr=({children:ee,initialData:V=null,routeCheckout:k,slots:d,errors:B,showTotalSaved:b,enableCoupons:T,enableGiftCards:f,updateLineItems:S=e=>e,...w})=>{var h,N,Z,j,Q,$,H,q,J,K,ie,le,ue,oe,se,me,de,xe,pe,ge,Te,ye,he,Ce,Se,Ie,be,fe,ve,_e,Pe,Ee,Ne,ke,we,We,Ae,De,Le,Be,Fe,Oe,Ue,Xe,ze,Ve,Ze,je,Qe,$e,He,qe,Je,Ke,Re,Ye,Me,Ge,er;const[e,F]=G(V),[o,W]=G(!1),v=e==null?void 0:e.isVirtual;T=T??!0,f=f??!0;const{handleEstimateTotals:m,estimatedTotals:t,setEstimatedTotals:x,loading:g}=_r(),s=(h=re.config)==null?void 0:h.shoppingCartDisplaySetting,A=(s==null?void 0:s.subtotal)==="INCLUDING_TAX",_=(s==null?void 0:s.subtotal)==="INCLUDING_EXCLUDING_TAX",P=s==null?void 0:s.zeroTax,l=()=>(e==null?void 0:e.appliedGiftCards.reduce((i,c)=>i+c.appliedBalance.value,0))??0,O=i=>i!=null&&i.code?p(gr,{children:[p("span",{className:"cart-order-summary__coupon__code",children:[r(ur,{source:fr,size:"16"}),r("span",{children:i==null?void 0:i.code})]}),p("span",{className:"cart-order-summary__caption",children:[r(mr,{id:"Cart.PriceSummary.giftCard.appliedGiftCards.remainingBalance"}),r(u,{className:"cart-order-summary__caption",weight:"normal",size:"small",amount:i.giftCardBalance.value,currency:i.giftCardBalance.currency})]})]},i.code):null,E=(N=re.config)==null?void 0:N.cartGiftWrapping,D=(Z=re.config)==null?void 0:Z.cartPrintedCard,a=e==null?void 0:e.totalGiftOptions;ne(()=>{const i=cr.on("cart/data",c=>{var R,Y,M;F(c);const te=(R=c==null?void 0:c.addresses)==null?void 0:R.shipping,ae=c==null?void 0:c.isVirtual;(te||ae)&&x(null),t==null&&x({estimatedTaxTotal:{amount:(Y=c==null?void 0:c.totalTax)==null?void 0:Y.value,currency:(M=c==null?void 0:c.totalTax)==null?void 0:M.currency}})},{eager:!0});return()=>{i==null||i.off()}},[]),ne(()=>{W(B)},[B]),ne(()=>{const i=cr.on("shipping/estimate",c=>{var R,Y,M,rr,tr,ar;const te={shippingCountry:(R=c==null?void 0:c.address)==null?void 0:R.countryCode,shippingState:(Y=c==null?void 0:c.address)==null?void 0:Y.region,shippingStateId:(M=c==null?void 0:c.address)==null?void 0:M.regionId,shippingZip:(rr=c==null?void 0:c.address)==null?void 0:rr.postCode},ae={carrier_code:((tr=c==null?void 0:c.shippingMethod)==null?void 0:tr.carrierCode)||"",method_code:((ar=c==null?void 0:c.shippingMethod)==null?void 0:ar.methodCode)||""};m(te,ae)});return()=>{i==null||i.off()}},[m]);const y=dr({checkout:"Cart.PriceSummary.checkout",free:"Cart.PriceSummary.total.free",orderSummary:"Cart.PriceSummary.orderSummary",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined"}),I=(e==null?void 0:e.hasOutOfStockItems)||o,U=pr(()=>{!I&&e&&hr(e,re.locale)},[I,e]),X=!v&&(d!=null&&d.EstimateShipping)?r(ce,{name:"EstimateShipping",slot:d.EstimateShipping},"estimateShippingId"):void 0;if(!Object.keys(e??{}).length||(e==null?void 0:e.totalQuantity)===0)return null;const z=T&&(d!=null&&d.Coupons)?r(ce,{name:"Coupons",slot:d.Coupons},"couponsId"):void 0,n=f&&(d!=null&&d.GiftCards)?r(ce,{name:"GiftCards",slot:d.GiftCards},"giftCardId"):void 0;return r(vr,{...w,"data-testid":"cart-order-summary",heading:r("div",{children:y.orderSummary}),shipping:X,coupons:z,giftCards:n,loading:g,updateLineItems:S,appliedGiftCards:(j=e==null?void 0:e.appliedGiftCards)!=null&&j.length?{label:r(mr,{id:"Cart.PriceSummary.giftCard.appliedGiftCards.label",plural:(Q=e==null?void 0:e.appliedGiftCards)==null?void 0:Q.length,fields:{count:($=e==null?void 0:e.appliedGiftCards)==null?void 0:$.length}}),price:r(u,{className:"cart-order-summary__price",amount:-l(),currency:(q=(H=e==null?void 0:e.appliedGiftCards)==null?void 0:H[0])==null?void 0:q.appliedBalance.currency}),content:(J=e==null?void 0:e.appliedGiftCards)==null?void 0:J.map(O).filter(Boolean)}:void 0,printedCard:{renderContent:!!((K=a==null?void 0:a.printedCard)!=null&&K.value),taxIncluded:D==="INCLUDING_TAX",taxInclAndExcl:D==="INCLUDING_EXCLUDING_TAX",priceExclTax:r(u,{"data-testid":"printed-card",amount:(ie=a==null?void 0:a.printedCard)==null?void 0:ie.value,currency:(le=a==null?void 0:a.printedCard)==null?void 0:le.currency}),priceInclTax:r(u,{amount:(ue=a==null?void 0:a.printedCardInclTax)==null?void 0:ue.value,currency:(oe=a==null?void 0:a.printedCardInclTax)==null?void 0:oe.currency})},itemsGiftWrapping:{renderContent:!!((se=a==null?void 0:a.giftWrappingForItems)!=null&&se.value),taxIncluded:E==="INCLUDING_TAX",taxInclAndExcl:E==="INCLUDING_EXCLUDING_TAX",priceExclTax:r(u,{amount:(me=a==null?void 0:a.giftWrappingForItems)==null?void 0:me.value,currency:(de=a==null?void 0:a.giftWrappingForItems)==null?void 0:de.currency}),priceInclTax:r(u,{amount:(xe=a==null?void 0:a.giftWrappingForItemsInclTax)==null?void 0:xe.value,currency:(pe=a==null?void 0:a.giftWrappingForItemsInclTax)==null?void 0:pe.currency})},orderGiftWrapping:{renderContent:!!((ge=a==null?void 0:a.giftWrappingForOrder)!=null&&ge.value),taxIncluded:E==="INCLUDING_TAX",taxInclAndExcl:E==="INCLUDING_EXCLUDING_TAX",priceExclTax:r(u,{amount:(Te=a==null?void 0:a.giftWrappingForOrder)==null?void 0:Te.value,currency:(ye=a==null?void 0:a.giftWrappingForOrder)==null?void 0:ye.currency}),priceInclTax:r(u,{amount:(he=a==null?void 0:a.giftWrappingForOrderInclTax)==null?void 0:he.value,currency:(Ce=a==null?void 0:a.giftWrappingForOrderInclTax)==null?void 0:Ce.currency})},subTotal:{taxIncluded:A&&!P,taxExcluded:_,zeroTaxSubtotal:P,priceExcludingTax:(Se=t==null?void 0:t.estimatedSubTotal)!=null&&Se.excludingTax?r(u,{"data-testid":"subtotal",...(Ie=t==null?void 0:t.estimatedSubTotal)==null?void 0:Ie.excludingTax}):r(u,{"data-testid":"subtotal",amount:(fe=(be=e==null?void 0:e.subtotal)==null?void 0:be.excludingTax)==null?void 0:fe.value,currency:(_e=(ve=e==null?void 0:e.subtotal)==null?void 0:ve.excludingTax)==null?void 0:_e.currency}),price:!P&&A||!P&&_?(Pe=t==null?void 0:t.estimatedSubTotal)!=null&&Pe.includingTax?r(u,{"data-testid":"subtotal",...(Ee=t==null?void 0:t.estimatedSubTotal)==null?void 0:Ee.includingTax}):r(u,{"data-testid":"subtotal",amount:(Ne=e==null?void 0:e.subtotal.includingTax)==null?void 0:Ne.value,currency:(ke=e==null?void 0:e.subtotal.includingTax)==null?void 0:ke.currency}):r(u,{"data-testid":"subtotal",amount:(We=(we=e==null?void 0:e.subtotal)==null?void 0:we.excludingTax)==null?void 0:We.value,currency:(De=(Ae=e==null?void 0:e.subtotal)==null?void 0:Ae.excludingTax)==null?void 0:De.currency})},discounts:(Le=e==null?void 0:e.appliedDiscounts)==null?void 0:Le.map(i=>{var c;return{label:i.label,price:r(u,{"data-testid":"summary-discount-total",amount:-i.amount.value,currency:i.amount.currency,sale:!0}),coupon:i!=null&&i.coupon?p("span",{children:[r(ur,{source:br,size:"16"}),(c=i==null?void 0:i.coupon)==null?void 0:c.code]}):void 0}}),taxTotal:v||t&&t.estimatedTaxTotal==null?{price:r("span",{"data-testid":"tax-total-tbd",children:y.taxToBeDetermined})}:{price:t!=null&&t.estimatedTaxTotal?r(u,{"data-testid":"tax-total-estimated",...t==null?void 0:t.estimatedTaxTotal}):r(u,{"data-testid":"tax-total-actual",amount:(Be=e==null?void 0:e.totalTax)==null?void 0:Be.value,currency:(Fe=e==null?void 0:e.totalTax)==null?void 0:Fe.currency}),estimated:(!t||!t.estimatedTaxTotal)&&!((Oe=e==null?void 0:e.addresses)!=null&&Oe.shipping)},taxesApplied:v?void 0:s!=null&&s.fullSummary?(Xe=((Ue=t==null?void 0:t.estimatedAppliedTaxes)==null?void 0:Ue.taxes)||(e==null?void 0:e.appliedTaxes))==null?void 0:Xe.map(i=>({label:i.label,price:r(u,{"data-testid":"applied-taxes",amount:i.amount.value,currency:i.amount.currency})})):void 0,total:{price:t!=null&&t.estimatedGrandTotalPrice?((Ve=(ze=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:ze.includingTax)==null?void 0:Ve.amount)===0?r("span",{"data-testid":"total-including-tax",children:y.free}):r(u,{"data-testid":"total-including-tax-estimated",...(Ze=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:Ze.includingTax}):((je=e==null?void 0:e.total)==null?void 0:je.includingTax.value)===0?r("span",{"data-testid":"total-including-tax",children:y.free}):r(u,{"data-testid":"total-including-tax-actual",amount:(Qe=e==null?void 0:e.total)==null?void 0:Qe.includingTax.value,currency:($e=e==null?void 0:e.total)==null?void 0:$e.includingTax.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((He=e==null?void 0:e.addresses)!=null&&He.shipping),priceWithoutTax:s!=null&&s.grandTotal?t!=null&&t.estimatedAppliedTaxes?((Je=(qe=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:qe.excludingTax)==null?void 0:Je.amount)===0?r("span",{"data-testid":"total-excluding-tax",children:y.free}):r(u,{"data-testid":"total-excluding-tax",...(Ke=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:Ke.excludingTax}):((Re=e==null?void 0:e.total)==null?void 0:Re.excludingTax.value)===0?r("span",{"data-testid":"total-excluding-tax",children:y.free}):r(u,{"data-testid":"total-excluding-tax",amount:(Ye=e==null?void 0:e.total)==null?void 0:Ye.excludingTax.value,currency:(Me=e==null?void 0:e.total)==null?void 0:Me.excludingTax.currency}):void 0},primaryAction:k&&r(Ir,{"data-testid":"checkout-button",variant:"primary",disabled:I,"aria-disabled":I,href:I?void 0:k({cartId:e.id}),onClick:U,children:y.checkout}),totalSaved:b?r(u,{amount:(Ge=e==null?void 0:e.discount)==null?void 0:Ge.value,currency:(er=e==null?void 0:e.total)==null?void 0:er.includingTax.currency}):void 0})};Pr.getInitialData=async function(){return Tr()};export{Pr as O};
|
|
3
|
+
import{jsx as r,jsxs as p,Fragment as xr}from"@dropins/tools/preact-jsx-runtime.js";import{useState as G,useEffect as ne,useCallback as pr,Fragment as gr}from"@dropins/tools/preact-compat.js";import{VComponent as L,classes as nr,Slot as ce}from"@dropins/tools/lib.js";import{events as cr}from"@dropins/tools/event-bus.js";import{g as Tr}from"./persisted-data.js";import{s as re}from"./resetCart.js";import{g as yr}from"./getEstimatedTotals.js";import{p as hr}from"./acdl.js";import"@dropins/tools/preact-hooks.js";import{Accordion as ir,AccordionSection as lr,ProgressSpinner as Cr,Divider as Sr,Price as u,Button as Ir,Icon as ur}from"@dropins/tools/components.js";/* empty css */import{O as C}from"./OrderSummaryLine.js";import{S as or}from"./ChevronUp.js";import{S as sr}from"./ChevronDown.js";import{useText as dr,Text as mr}from"@dropins/tools/i18n.js";import{S as br}from"./Coupon.js";import{S as fr}from"./GiftCard.js";const vr=({className:ee,children:V,variant:k="primary",heading:d,loading:B=!0,subTotal:b,shipping:T,discounts:f,taxTotal:S,taxesApplied:w,total:e,primaryAction:F,coupons:o,giftCards:W,totalSaved:v,appliedGiftCards:m,printedCard:t,itemsGiftWrapping:x,orderGiftWrapping:g,updateLineItems:s=_=>_,...A})=>{const[_,P]=G(!1),l=dr({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",printedCardTitle:"Cart.PriceSummary.giftOptionsTax.printedCard.title",printedCardInclTax:"Cart.PriceSummary.giftOptionsTax.printedCard.inclTax",printedCardExclTax:"Cart.PriceSummary.giftOptionsTax.printedCard.exclTax",itemGiftWrappingTitle:"Cart.PriceSummary.giftOptionsTax.itemGiftWrapping.title",itemGiftWrappingInclTax:"Cart.PriceSummary.giftOptionsTax.itemGiftWrapping.inclTax",itemGiftWrappingExclTax:"Cart.PriceSummary.giftOptionsTax.itemGiftWrapping.exclTax",orderGiftWrappingTitle:"Cart.PriceSummary.giftOptionsTax.orderGiftWrapping.title",orderGiftWrappingInclTax:"Cart.PriceSummary.giftOptionsTax.orderGiftWrapping.inclTax",orderGiftWrappingExclTax:"Cart.PriceSummary.giftOptionsTax.orderGiftWrapping.exclTax"}),O=m?r(C,{label:m==null?void 0:m.label,price:m==null?void 0:m.price,classSuffixes:["applied-gift-cards"],children:m==null?void 0:m.content},m==null?void 0:m.label):null,E=b&&p(C,{label:l.subtotalLabel,price:b.price,classSuffixes:["subTotal"],children:[b.taxIncluded&&r("div",{"data-testid":"sub-total-tax-caption",className:"cart-order-summary__caption",children:r("span",{children:l.subtotalWithTaxes})}),b.taxExcluded?r("div",{"data-testid":"sub-total-tax-caption-excluded",className:"cart-order-summary__caption",children:p("span",{children:[b.priceExcludingTax," ",l.subtotalWithoutTaxes]})}):void 0]},l.subtotalLabel),D=f&&f.length>0&&r(xr,{children:f.map(n=>p(C,{label:n.label,price:n.price,classSuffixes:["discount"],children:[n.coupon&&r(L,{node:n.coupon,className:"cart-order-summary__coupon__code"}),n.caption&&r(L,{node:n.caption,className:"cart-order-summary__caption"})]},n.label))}),a=w&&w.length>0?r(ir,{"data-testid":"tax-breakdown",className:"cart-order-summary__taxes",iconOpen:sr,iconClose:or,children:p(lr,{title:l.taxesBreakdownTitle,secondaryText:!_&&S?r(L,{node:S.price,className:"cart-order-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:P,children:[r("div",{className:"cart-order-summary__appliedTaxes",children:w.map(n=>r(C,{label:n.label,price:n.price,classSuffixes:["taxEntry"],labelClassSuffix:"muted"},n.label))}),S&&r(C,{label:l.taxTotal,price:S.price,classSuffixes:["taxTotal"],labelClassSuffix:"muted"})]})}):S&&r(C,{label:S.estimated?l.taxEstimated:l.taxTotalOnly,price:S.price,classSuffixes:["taxTotal"],testId:"tax-total-only"}),y=t!=null&&t.renderContent?p(C,{label:l.printedCardTitle,price:t.taxInclAndExcl||t.taxIncluded?t.priceInclTax:t.priceExclTax,classSuffixes:["printedCardContent"],children:[t.taxIncluded&&r("div",{"data-testid":"printed-card-incl",className:"cart-order-summary__caption",children:r("span",{children:l.printedCardInclTax})}),t.taxInclAndExcl?r("div",{"data-testid":"printed-card-incl-excl",className:"cart-order-summary__caption",children:p("span",{children:[t.priceExclTax," ",l.printedCardExclTax]})}):void 0]},l.printedCardTitle):null,I=x!=null&&x.renderContent?p(C,{label:l.itemGiftWrappingTitle,price:x.taxInclAndExcl||x.taxIncluded?x.priceInclTax:x.priceExclTax,classSuffixes:["itemsGiftWrappingContent"],children:[x.taxIncluded?r("div",{"data-testid":"item-gift-wrapping-incl",className:"cart-order-summary__caption",children:r("span",{children:l.itemGiftWrappingInclTax})}):null,x.taxInclAndExcl?r("div",{"data-testid":"item-gift-wrapping-incl-excl",className:"cart-order-summary__caption",children:p("span",{children:[x.priceExclTax," ",l.itemGiftWrappingExclTax]})}):null]},l.itemGiftWrappingTitle):null,U=g!=null&&g.renderContent?p(C,{label:l.orderGiftWrappingTitle,price:g.taxInclAndExcl||g.taxIncluded?g.priceInclTax:g.priceExclTax,classSuffixes:["orderGiftWrappingContent"],children:[g.taxIncluded&&r("div",{"data-testid":"order-gift-wrapping-incl",className:"cart-order-summary__caption",children:r("span",{children:l.orderGiftWrappingInclTax})}),g.taxInclAndExcl?r("div",{"data-testid":"order-gift-wrapping-incl-excl",className:"cart-order-summary__caption",children:p("span",{children:[g.priceExclTax," ",l.orderGiftWrappingExclTax]})}):void 0]},l.orderGiftWrappingTitle):null,X=[{key:"subTotalContent",sortOrder:100,content:E},...T?[{key:"shippingContent",sortOrder:200,content:r(L,{node:T,className:"cart-order-summary__shipping"})}]:[],{key:"printedCard",sortOrder:300,content:y},{key:"itemsGiftWrappingContent",sortOrder:400,content:I},{key:"orderGiftWrappingContent",sortOrder:500,content:U},{key:"discountsContent",sortOrder:600,content:D},{key:"appliedGiftCardsContent",sortOrder:700,content:O},{key:"taxContent",sortOrder:800,content:a},...e?[{key:"taxContent",sortOrder:900,content:r(C,{label:e.estimated?l.totalEstimated:l.totalLabel,price:e.price,classSuffixes:["total","total--padded"],testId:"total-content",labelClassSuffix:"bold"})}]:[],...e!=null&&e.priceWithoutTax?[{key:"totalWithoutTaxContent",sortOrder:1e3,content:r(C,{label:l.totalWithoutTax,price:e.priceWithoutTax,classSuffixes:["totalWithoutTax"],testId:"total-without-tax",labelClassSuffix:"muted"})}]:[],...v?[{key:"totalSavedContent",sortOrder:1100,content:r(C,{label:l.totalSaved,price:v,classSuffixes:["saved"],testId:"total-saved",labelClassSuffix:"muted"})}]:[],...F?[{key:"primaryActionContent",sortOrder:1200,content:r("div",{className:nr(["cart-order-summary__entry","cart-order-summary__primaryAction"]),children:F})}]:[],...o?[{key:"couponsContent",sortOrder:1300,content:r(L,{node:o,className:"cart-order-summary__coupons"})}]:[],...W?[{key:"giftCardsContent",sortOrder:1400,content:r(L,{node:W,className:"cart-order-summary__gift-cards"})}]:[]],z=s(X).sort((n,h)=>n.sortOrder-h.sortOrder);return p("div",{...A,className:nr(["cart-order-summary",["cart-order-summary--loading",B],[`cart-order-summary__${k}`,k],ee]),children:[B&&r(Cr,{className:"cart-order-summary__spinner"}),p("div",{className:"cart-order-summary__heading",children:[d&&r(L,{node:d,className:"cart-order-summary__heading-text"}),r(Sr,{variant:"primary",className:"cart-order-summary__divider-primary"})]}),r("div",{className:"cart-order-summary__content",children:z.map(n=>Array.isArray(n.content)?r(ir,{className:n.className,actionIconPosition:"right",iconOpen:sr,iconClose:or,children:r(lr,{defaultOpen:!1,title:n.title,renderContentWhenClosed:!1,children:n.content.map(h=>h.content)})},n.key):n.content)})]})},_r=()=>{const[ee,V]=G(!1),[k,d]=G();return{handleEstimateTotals:(b,T)=>{V(!0);const{shippingCountry:f,shippingState:S="",shippingStateId:w,shippingZip:e=""}=b,F={countryCode:f,postcode:e,region:{region:S,id:w},shipping_method:{carrier_code:(T==null?void 0:T.carrier_code)||"",method_code:(T==null?void 0:T.method_code)||""}};yr(F).then(o=>{var W,v,m,t,x,g,s,A,_,P,l,O,E,D,a,y,I,U,X,z;o&&d({estimatedTaxTotal:{amount:(W=o.totalTax)==null?void 0:W.value,currency:(v=o.totalTax)==null?void 0:v.currency},estimatedSubTotal:{excludingTax:{amount:(t=(m=o.subtotal)==null?void 0:m.excludingTax)==null?void 0:t.value,currency:(g=(x=o.subtotal)==null?void 0:x.excludingTax)==null?void 0:g.currency},includingTax:{amount:(A=(s=o.subtotal)==null?void 0:s.includingTax)==null?void 0:A.value,currency:(P=(_=o.subtotal)==null?void 0:_.includingTax)==null?void 0:P.currency},includingDiscountOnly:{amount:(O=(l=o.subtotal)==null?void 0:l.includingDiscountOnly)==null?void 0:O.value,currency:(D=(E=o.subtotal)==null?void 0:E.includingDiscountOnly)==null?void 0:D.currency}},estimatedGrandTotalPrice:{includingTax:{amount:(a=o.total)==null?void 0:a.includingTax.value,currency:(y=o.total)==null?void 0:y.includingTax.currency},excludingTax:{amount:(I=o.total)==null?void 0:I.excludingTax.value,currency:(U=o.total)==null?void 0:U.excludingTax.currency}},estimatedAppliedTaxes:{taxes:(X=o.appliedTaxes)==null?void 0:X.map(n=>{var h,N;return{label:n.label,amount:{value:(h=n.amount)==null?void 0:h.value,currency:(N=n.amount)==null?void 0:N.currency}}})},estimatedItems:{items:(z=o.items)==null?void 0:z.map(n=>{var h,N,Z,j,Q,$,H,q,J,K;return{uid:n.uid,price:{amount:(h=n.price)==null?void 0:h.value,currency:(N=n.price)==null?void 0:N.currency},taxedPrice:{amount:(Z=n.taxedPrice)==null?void 0:Z.value,currency:(j=n.taxedPrice)==null?void 0:j.currency},rowTotal:{amount:(Q=n.rowTotal)==null?void 0:Q.value,currency:($=n.rowTotal)==null?void 0:$.currency},rowTotalIncludingTax:{amount:(H=n.rowTotalIncludingTax)==null?void 0:H.value,currency:(q=n.rowTotalIncludingTax)==null?void 0:q.currency},regularPrice:{amount:(J=n.regularPrice)==null?void 0:J.value,currency:(K=n.regularPrice)==null?void 0:K.currency}}})}})}).finally(()=>{V(!1)})},estimatedTotals:k,setEstimatedTotals:d,loading:ee}},Pr=({children:ee,initialData:V=null,routeCheckout:k,slots:d,errors:B,showTotalSaved:b,enableCoupons:T,enableGiftCards:f,updateLineItems:S=e=>e,...w})=>{var h,N,Z,j,Q,$,H,q,J,K,ie,le,ue,oe,se,me,de,xe,pe,ge,Te,ye,he,Ce,Se,Ie,be,fe,ve,_e,Pe,Ee,Ne,ke,we,We,Ae,De,Le,Be,Fe,Oe,Ue,Xe,ze,Ve,Ze,je,Qe,$e,He,qe,Je,Ke,Re,Ye,Me,Ge,er;const[e,F]=G(V),[o,W]=G(!1),v=e==null?void 0:e.isVirtual;T=T??!0,f=f??!0;const{handleEstimateTotals:m,estimatedTotals:t,setEstimatedTotals:x,loading:g}=_r(),s=(h=re.config)==null?void 0:h.shoppingCartDisplaySetting,A=(s==null?void 0:s.subtotal)==="INCLUDING_TAX",_=(s==null?void 0:s.subtotal)==="INCLUDING_EXCLUDING_TAX",P=s==null?void 0:s.zeroTax,l=()=>(e==null?void 0:e.appliedGiftCards.reduce((i,c)=>i+c.appliedBalance.value,0))??0,O=i=>i!=null&&i.code?p(gr,{children:[p("span",{className:"cart-order-summary__coupon__code",children:[r(ur,{source:fr,size:"16"}),r("span",{children:i==null?void 0:i.code})]}),p("span",{className:"cart-order-summary__caption",children:[r(mr,{id:"Cart.PriceSummary.giftCard.appliedGiftCards.remainingBalance"}),r(u,{className:"cart-order-summary__caption",weight:"normal",size:"small",amount:i.giftCardBalance.value,currency:i.giftCardBalance.currency})]})]},i.code):null,E=(N=re.config)==null?void 0:N.cartGiftWrapping,D=(Z=re.config)==null?void 0:Z.cartPrintedCard,a=e==null?void 0:e.totalGiftOptions;ne(()=>{const i=cr.on("cart/data",c=>{var R,Y,M;F(c);const te=(R=c==null?void 0:c.addresses)==null?void 0:R.shipping,ae=c==null?void 0:c.isVirtual;(te||ae)&&x(null),t==null&&x({estimatedTaxTotal:{amount:(Y=c==null?void 0:c.totalTax)==null?void 0:Y.value,currency:(M=c==null?void 0:c.totalTax)==null?void 0:M.currency}})},{eager:!0});return()=>{i==null||i.off()}},[]),ne(()=>{W(B)},[B]),ne(()=>{const i=cr.on("shipping/estimate",c=>{var R,Y,M,rr,tr,ar;const te={shippingCountry:(R=c==null?void 0:c.address)==null?void 0:R.countryCode,shippingState:(Y=c==null?void 0:c.address)==null?void 0:Y.region,shippingStateId:(M=c==null?void 0:c.address)==null?void 0:M.regionId,shippingZip:(rr=c==null?void 0:c.address)==null?void 0:rr.postCode},ae={carrier_code:((tr=c==null?void 0:c.shippingMethod)==null?void 0:tr.carrierCode)||"",method_code:((ar=c==null?void 0:c.shippingMethod)==null?void 0:ar.methodCode)||""};m(te,ae)});return()=>{i==null||i.off()}},[m]);const y=dr({checkout:"Cart.PriceSummary.checkout",free:"Cart.PriceSummary.total.free",orderSummary:"Cart.PriceSummary.orderSummary",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined"}),I=(e==null?void 0:e.hasOutOfStockItems)||o,U=pr(()=>{!I&&e&&hr(e,re.locale)},[I,e]),X=!v&&(d!=null&&d.EstimateShipping)?r(ce,{name:"EstimateShipping",slot:d.EstimateShipping},"estimateShippingId"):void 0;if(!Object.keys(e??{}).length||(e==null?void 0:e.totalQuantity)===0)return null;const z=T&&(d!=null&&d.Coupons)?r(ce,{name:"Coupons",slot:d.Coupons},"couponsId"):void 0,n=f&&(d!=null&&d.GiftCards)?r(ce,{name:"GiftCards",slot:d.GiftCards},"giftCardId"):void 0;return r(vr,{...w,"data-testid":"cart-order-summary",heading:r("div",{children:y.orderSummary}),shipping:X,coupons:z,giftCards:n,loading:g,updateLineItems:S,appliedGiftCards:(j=e==null?void 0:e.appliedGiftCards)!=null&&j.length?{label:r(mr,{id:"Cart.PriceSummary.giftCard.appliedGiftCards.label",plural:(Q=e==null?void 0:e.appliedGiftCards)==null?void 0:Q.length,fields:{count:($=e==null?void 0:e.appliedGiftCards)==null?void 0:$.length}}),price:r(u,{className:"cart-order-summary__price",amount:-l(),currency:(q=(H=e==null?void 0:e.appliedGiftCards)==null?void 0:H[0])==null?void 0:q.appliedBalance.currency}),content:(J=e==null?void 0:e.appliedGiftCards)==null?void 0:J.map(O).filter(Boolean)}:void 0,printedCard:{renderContent:!!((K=a==null?void 0:a.printedCard)!=null&&K.value),taxIncluded:D==="INCLUDING_TAX",taxInclAndExcl:D==="INCLUDING_EXCLUDING_TAX",priceExclTax:r(u,{"data-testid":"printed-card",amount:(ie=a==null?void 0:a.printedCard)==null?void 0:ie.value,currency:(le=a==null?void 0:a.printedCard)==null?void 0:le.currency}),priceInclTax:r(u,{amount:(ue=a==null?void 0:a.printedCardInclTax)==null?void 0:ue.value,currency:(oe=a==null?void 0:a.printedCardInclTax)==null?void 0:oe.currency})},itemsGiftWrapping:{renderContent:!!((se=a==null?void 0:a.giftWrappingForItems)!=null&&se.value),taxIncluded:E==="INCLUDING_TAX",taxInclAndExcl:E==="INCLUDING_EXCLUDING_TAX",priceExclTax:r(u,{amount:(me=a==null?void 0:a.giftWrappingForItems)==null?void 0:me.value,currency:(de=a==null?void 0:a.giftWrappingForItems)==null?void 0:de.currency}),priceInclTax:r(u,{amount:(xe=a==null?void 0:a.giftWrappingForItemsInclTax)==null?void 0:xe.value,currency:(pe=a==null?void 0:a.giftWrappingForItemsInclTax)==null?void 0:pe.currency})},orderGiftWrapping:{renderContent:!!((ge=a==null?void 0:a.giftWrappingForOrder)!=null&&ge.value),taxIncluded:E==="INCLUDING_TAX",taxInclAndExcl:E==="INCLUDING_EXCLUDING_TAX",priceExclTax:r(u,{amount:(Te=a==null?void 0:a.giftWrappingForOrder)==null?void 0:Te.value,currency:(ye=a==null?void 0:a.giftWrappingForOrder)==null?void 0:ye.currency}),priceInclTax:r(u,{amount:(he=a==null?void 0:a.giftWrappingForOrderInclTax)==null?void 0:he.value,currency:(Ce=a==null?void 0:a.giftWrappingForOrderInclTax)==null?void 0:Ce.currency})},subTotal:{taxIncluded:A&&!P,taxExcluded:_,zeroTaxSubtotal:P,priceExcludingTax:(Se=t==null?void 0:t.estimatedSubTotal)!=null&&Se.excludingTax?r(u,{"data-testid":"subtotal",...(Ie=t==null?void 0:t.estimatedSubTotal)==null?void 0:Ie.excludingTax}):r(u,{"data-testid":"subtotal",amount:(fe=(be=e==null?void 0:e.subtotal)==null?void 0:be.excludingTax)==null?void 0:fe.value,currency:(_e=(ve=e==null?void 0:e.subtotal)==null?void 0:ve.excludingTax)==null?void 0:_e.currency}),price:!P&&A||!P&&_?(Pe=t==null?void 0:t.estimatedSubTotal)!=null&&Pe.includingTax?r(u,{"data-testid":"subtotal",...(Ee=t==null?void 0:t.estimatedSubTotal)==null?void 0:Ee.includingTax}):r(u,{"data-testid":"subtotal",amount:(Ne=e==null?void 0:e.subtotal.includingTax)==null?void 0:Ne.value,currency:(ke=e==null?void 0:e.subtotal.includingTax)==null?void 0:ke.currency}):r(u,{"data-testid":"subtotal",amount:(We=(we=e==null?void 0:e.subtotal)==null?void 0:we.excludingTax)==null?void 0:We.value,currency:(De=(Ae=e==null?void 0:e.subtotal)==null?void 0:Ae.excludingTax)==null?void 0:De.currency})},discounts:(Le=e==null?void 0:e.appliedDiscounts)==null?void 0:Le.map(i=>{var c;return{label:i.label,price:r(u,{"data-testid":"summary-discount-total",amount:-i.amount.value,currency:i.amount.currency,sale:!0}),coupon:i!=null&&i.coupon?p("span",{children:[r(ur,{source:br,size:"16"}),(c=i==null?void 0:i.coupon)==null?void 0:c.code]}):void 0}}),taxTotal:v||t&&t.estimatedTaxTotal==null?{price:r("span",{"data-testid":"tax-total-tbd",children:y.taxToBeDetermined})}:{price:t!=null&&t.estimatedTaxTotal?r(u,{"data-testid":"tax-total-estimated",...t==null?void 0:t.estimatedTaxTotal}):r(u,{"data-testid":"tax-total-actual",amount:(Be=e==null?void 0:e.totalTax)==null?void 0:Be.value,currency:(Fe=e==null?void 0:e.totalTax)==null?void 0:Fe.currency}),estimated:(!t||!t.estimatedTaxTotal)&&!((Oe=e==null?void 0:e.addresses)!=null&&Oe.shipping)},taxesApplied:v?void 0:s!=null&&s.fullSummary?(Xe=((Ue=t==null?void 0:t.estimatedAppliedTaxes)==null?void 0:Ue.taxes)||(e==null?void 0:e.appliedTaxes))==null?void 0:Xe.map(i=>({label:i.label,price:r(u,{"data-testid":"applied-taxes",amount:i.amount.value,currency:i.amount.currency})})):void 0,total:{price:t!=null&&t.estimatedGrandTotalPrice?((Ve=(ze=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:ze.includingTax)==null?void 0:Ve.amount)===0?r("span",{"data-testid":"total-including-tax",children:y.free}):r(u,{"data-testid":"total-including-tax-estimated",...(Ze=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:Ze.includingTax}):((je=e==null?void 0:e.total)==null?void 0:je.includingTax.value)===0?r("span",{"data-testid":"total-including-tax",children:y.free}):r(u,{"data-testid":"total-including-tax-actual",amount:(Qe=e==null?void 0:e.total)==null?void 0:Qe.includingTax.value,currency:($e=e==null?void 0:e.total)==null?void 0:$e.includingTax.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((He=e==null?void 0:e.addresses)!=null&&He.shipping),priceWithoutTax:s!=null&&s.grandTotal?t!=null&&t.estimatedAppliedTaxes?((Je=(qe=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:qe.excludingTax)==null?void 0:Je.amount)===0?r("span",{"data-testid":"total-excluding-tax",children:y.free}):r(u,{"data-testid":"total-excluding-tax",...(Ke=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:Ke.excludingTax}):((Re=e==null?void 0:e.total)==null?void 0:Re.excludingTax.value)===0?r("span",{"data-testid":"total-excluding-tax",children:y.free}):r(u,{"data-testid":"total-excluding-tax",amount:(Ye=e==null?void 0:e.total)==null?void 0:Ye.excludingTax.value,currency:(Me=e==null?void 0:e.total)==null?void 0:Me.excludingTax.currency}):void 0},primaryAction:k&&r(Ir,{"data-testid":"checkout-button",variant:"primary",disabled:I,"aria-disabled":I,href:I?void 0:k({cartId:e.id}),onClick:U,children:y.checkout}),totalSaved:b?r(u,{amount:(Ge=e==null?void 0:e.discount)==null?void 0:Ge.value,currency:(er=e==null?void 0:e.total)==null?void 0:er.includingTax.currency}):void 0})};Pr.getInitialData=async function(){return Tr()};export{Pr as O};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
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
|
|
3
|
+
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";import"@dropins/tools/preact-hooks.js";const $=({label:e,price:a,classSuffixes:o=[],labelClassSuffix:r,testId:m,children:s,...t})=>{const p="cart-order-summary__label",d="cart-order-summary__price";return _("div",{...t,...m?{"data-testid":m}:{},className:c(["cart-order-summary__entry",...o.map(i=>`cart-order-summary__${i}`)]),children:[n("span",{className:c([p,...r?[`${p}--${r}`]:[]]),children:e}),n(y,{node:a,className:c([d,...r?[`${d}--${r}`]:[]])}),s]})},L=({label:e,price:a,classSuffixes:o=[],labelClassSuffix:r,testId:m,children:s,...t})=>n($,{...t,label:e,price:a,classSuffixes:o,labelClassSuffix:r,testId:m,children:s});export{L as O};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import*as e from"@dropins/tools/preact-compat.js";const r=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("g",{clipPath:"url(#clip0_4797_15331)"},e.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"}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),e.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"}),e.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"}),e.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"}),e.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"})),e.createElement("defs",null,e.createElement("clipPath",{id:"clip0_4797_15331"},e.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),o=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.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"}),e.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"}));export{r as S,o as a};
|
package/chunks/refreshCart.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as o,d as Q,f as S,h as D}from"./resetCart.js";import{events as f}from"@dropins/tools/event-bus.js";import{Initializer as L,merge as X}from"@dropins/tools/lib.js";import{a as K}from"./persisted-data.js";import{CART_FRAGMENT as U}from"../fragments.js";const $=new L({init:async r=>{const n={disableGuestCart:!1,...r};$.config.setConfig(n),E().catch(console.error)},listeners:()=>[f.on("authenticated",r=>{o.authenticated&&!r?f.emit("cart/reset",void 0):r&&!o.authenticated&&(o.authenticated=r,E().catch(console.error))},{eager:!0}),f.on("locale",async r=>{r!==o.locale&&(o.locale=r,E().catch(console.error))}),f.on("cart/reset",()=>{Q().catch(console.error),f.emit("cart/data",null)}),f.on("cart/data",r=>{K(r)}),f.on("checkout/updated",r=>{r&&xr().catch(console.error)})]}),V=$.config;function k(r){var c,e,u,l,i,a,_,g,y,s,m,v,C,h,d,R;if(!r)return null;const n={appliedGiftCards:((c=r==null?void 0:r.applied_gift_cards)==null?void 0:c.map(t=>{var w,M,N;const p={code:t.code??"",appliedBalance:{value:t.applied_balance.value??0,currency:t.applied_balance.currency??"USD"},currentBalance:{value:t.current_balance.value??0,currency:t.current_balance.currency??"USD"},expirationDate:t.expiration_date??""},b=(w=p==null?void 0:p.currentBalance)==null?void 0:w.value,x=(M=p==null?void 0:p.appliedBalance)==null?void 0:M.value,T=(N=p==null?void 0:p.currentBalance)==null?void 0:N.currency,q=b-x>0?b-x:0;return{...p,giftCardBalance:{value:q,currency:T}}}))??[],id:r.id,totalQuantity:lr(r),totalUniqueItems:r.itemsV2.items.length,totalGiftOptions:Y((e=r==null?void 0:r.prices)==null?void 0:e.gift_options),giftReceiptIncluded:(r==null?void 0:r.gift_receipt_included)??!1,printedCardIncluded:(r==null?void 0:r.printed_card_included)??!1,cartGiftWrapping:((u=r==null?void 0:r.available_gift_wrappings)==null?void 0:u.map(t=>{var p,b,x,T,G;return{design:t.design??"",uid:t.uid,selected:((p=r==null?void 0:r.gift_wrapping)==null?void 0:p.uid)===t.uid,image:{url:((b=t==null?void 0:t.image)==null?void 0:b.url)??"",label:((x=t.image)==null?void 0:x.label)??""},price:{currency:((T=t==null?void 0:t.price)==null?void 0:T.currency)??"USD",value:((G=t==null?void 0:t.price)==null?void 0:G.value)??0}}}))??[],giftMessage:{senderName:((l=r==null?void 0:r.gift_message)==null?void 0:l.from)??"",recipientName:((i=r==null?void 0:r.gift_message)==null?void 0:i.to)??"",message:((a=r==null?void 0:r.gift_message)==null?void 0:a.message)??""},errors:er(r==null?void 0:r.itemsV2),items:F(r==null?void 0:r.itemsV2),miniCartMaxItems:F(r==null?void 0:r.itemsV2).slice(0,((_=o.config)==null?void 0:_.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:P(r.prices.discounts,r.prices.grand_total.currency),subtotal:{excludingTax:{value:(g=r.prices.subtotal_excluding_tax)==null?void 0:g.value,currency:(y=r.prices.subtotal_excluding_tax)==null?void 0:y.currency},includingTax:{value:(s=r.prices.subtotal_including_tax)==null?void 0:s.value,currency:(m=r.prices.subtotal_including_tax)==null?void 0:m.currency},includingDiscountOnly:{value:(v=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:v.value,currency:(C=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:C.currency}},appliedTaxes:z(r.prices.applied_taxes),totalTax:P(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:z(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&sr(r)},isGuestCart:!o.authenticated,hasOutOfStockItems:or(r),hasFullyOutOfStockItems:_r(r),appliedCoupons:r.applied_coupons};return X(n,(R=(d=(h=V.getConfig().models)==null?void 0:h.CartModel)==null?void 0:d.transformer)==null?void 0:R.call(d,r))}function Y(r){var n,c,e,u,l,i,a,_,g,y,s,m;return{giftWrappingForItems:{value:((n=r==null?void 0:r.gift_wrapping_for_items)==null?void 0:n.value)??0,currency:((c=r==null?void 0:r.gift_wrapping_for_items)==null?void 0:c.currency)??"USD"},giftWrappingForItemsInclTax:{value:((e=r==null?void 0:r.gift_wrapping_for_items_incl_tax)==null?void 0:e.value)??0,currency:((u=r==null?void 0:r.gift_wrapping_for_items_incl_tax)==null?void 0:u.currency)??"USD"},giftWrappingForOrder:{value:((l=r==null?void 0:r.gift_wrapping_for_order)==null?void 0:l.value)??0,currency:((i=r==null?void 0:r.gift_wrapping_for_order)==null?void 0:i.currency)??"USD"},giftWrappingForOrderInclTax:{value:((a=r==null?void 0:r.gift_wrapping_for_order_incl_tax)==null?void 0:a.value)??0,currency:((_=r==null?void 0:r.gift_wrapping_for_order_incl_tax)==null?void 0:_.currency)??"USD"},printedCard:{value:((g=r==null?void 0:r.printed_card)==null?void 0:g.value)??0,currency:((y=r==null?void 0:r.printed_card)==null?void 0:y.currency)??"USD"},printedCardInclTax:{value:((s=r==null?void 0:r.printed_card_incl_tax)==null?void 0:s.value)??0,currency:((m=r==null?void 0:r.printed_card_incl_tax)==null?void 0:m.currency)??"USD"}}}function P(r,n){return r!=null&&r.length?r.reduce((c,e)=>({value:c.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:n}):{value:0,currency:n}}function j(r,n){var c,e,u,l;return{src:r!=null&&r.useConfigurableParentThumbnail?n.product.thumbnail.url:((e=(c=n.configured_variant)==null?void 0:c.thumbnail)==null?void 0:e.url)||n.product.thumbnail.url,alt:r!=null&&r.useConfigurableParentThumbnail?n.product.thumbnail.label:((l=(u=n.configured_variant)==null?void 0:u.thumbnail)==null?void 0:l.label)||n.product.thumbnail.label}}function H(r){var n,c,e,u;return r.__typename==="ConfigurableCartItem"?{value:(c=(n=r.configured_variant)==null?void 0:n.price_range)==null?void 0:c.maximum_price.regular_price.value,currency:(u=(e=r.configured_variant)==null?void 0:e.price_range)==null?void 0:u.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 O(r){var n,c,e;return r.__typename==="ConfigurableCartItem"?((c=(n=r.configured_variant)==null?void 0:n.price_range)==null?void 0:c.maximum_price.discount.amount_off)>0:((e=r.product.price_range)==null?void 0:e.maximum_price.discount.amount_off)>0}function J(r){var n,c,e;return{senderName:((n=r==null?void 0:r.gift_message)==null?void 0:n.from)??"",recipientName:((c=r==null?void 0:r.gift_message)==null?void 0:c.to)??"",message:((e=r==null?void 0:r.gift_message)==null?void 0:e.message)??""}}function Z(r){return{currency:(r==null?void 0:r.currency)??"USD",value:(r==null?void 0:r.value)??0}}function F(r){var c;if(!((c=r==null?void 0:r.items)!=null&&c.length))return[];const n=o.config;return r.items.map(e=>{var u,l,i,a,_,g,y;return{giftWrappingAvailable:((u=e==null?void 0:e.product)==null?void 0:u.gift_wrapping_available)??!1,giftWrappingPrice:Z((l=e==null?void 0:e.product)==null?void 0:l.gift_wrapping_price),giftMessage:J(e),productGiftWrapping:((i=e==null?void 0:e.available_gift_wrapping)==null?void 0:i.map(s=>{var m,v,C,h,d;return{design:s.design??"",uid:s.uid,selected:((m=e.gift_wrapping)==null?void 0:m.uid)===s.uid,image:{url:((v=s==null?void 0:s.image)==null?void 0:v.url)??"",label:((C=s.image)==null?void 0:C.label)??""},price:{currency:((h=s==null?void 0:s.price)==null?void 0:h.currency)??"USD",value:((d=s==null?void 0:s.price)==null?void 0:d.value)??0}}}))??[],itemType:e.__typename,uid:e.uid,giftMessageAvailable:rr(e.product.gift_message_available),url:{urlKey:e.product.url_key,categories:e.product.categories.map(s=>s.url_key)},canonicalUrl:e.product.canonical_url,categories:e.product.categories.map(s=>s.name),quantity:e.quantity,sku:pr(e),topLevelSku:e.product.sku,name:e.product.name,image:j(n,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:ir(e.links),total:{value:(a=e.prices.original_row_total)==null?void 0:a.value,currency:(_=e.prices.original_row_total)==null?void 0:_.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency,label:(g=e.prices.discounts)==null?void 0:g.map(s=>s.label)},regularPrice:H(e),discounted:O(e),bundleOptions:e.__typename==="BundleCartItem"?nr(e.bundle_options):null,selectedOptions:cr(e.configurable_options),customizableOptions:ur(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"?(y=e.configured_variant)==null?void 0:y.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:tr(e),discountPercentage:ar(e),savingsAmount:gr(e),productAttributes:fr(e)}})}function rr(r){switch(+r){case 0:return!1;case 1:return!0;case 2:return null;default:return!1}}function er(r){var c;const n=(c=r==null?void 0:r.items)==null?void 0:c.reduce((e,u)=>{var l;return(l=u.errors)==null||l.forEach(i=>{e.push({uid:u.uid,text:i.message})}),e},[]);return n!=null&&n.length?n:null}function z(r){return r!=null&&r.length?r.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label,coupon:n.coupon})):[]}function nr(r){const n=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(u=>u.label).join(", ")})),c={};return n==null||n.forEach(e=>{c[e.label]=e.value}),Object.keys(c).length>0?c:null}function cr(r){const n=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),c={};return n==null||n.forEach(e=>{c[e.label]=e.value}),Object.keys(c).length>0?c:null}function ur(r){const n=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(u=>({uid:u.customizable_option_value_uid,label:u.label,value:u.value}))})),c={};return n==null||n.forEach(e=>{var u;switch(e.type){case"field":case"area":case"date_time":c[e.label]=e.values[0].value;break;case"radio":case"drop_down":c[e.label]=e.values[0].label;break;case"multiple":case"checkbox":c[e.label]=e.values.reduce((l,i)=>l?`${l}, ${i.label}`:i.label,"");break;case"file":{const l=new DOMParser,i=e.values[0].value,_=((u=l.parseFromString(i,"text/html").querySelector("a"))==null?void 0:u.textContent)||"";c[e.label]=_;break}}}),c}function lr(r){var n,c;return((n=o.config)==null?void 0:n.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((c=o.config)==null?void 0:c.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function ir(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(n=>n.title).join(", ")}:null}function sr(r){var n,c,e,u;return(n=r.shipping_addresses)!=null&&n.length?(c=r.shipping_addresses)==null?void 0:c.map(l=>({countryCode:l.country.code,zipCode:l.postcode,regionCode:l.region.code})):(e=r.addresses)!=null&&e.length?(u=r.addresses)==null?void 0:u.filter(l=>l.default_shipping).map(l=>{var i;return l.default_shipping&&{countryCode:l.country_code,zipCode:l.postcode,regionCode:(i=l.region)==null?void 0:i.region_code}}):null}function or(r){var n,c;return(c=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:c.some(e=>{var u;return((u=e==null?void 0:e.product)==null?void 0:u.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function tr(r){return r.not_available_message?r.product.quantity!=null?r.product.quantity:"noNumber":null}function _r(r){var n,c;return(c=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:c.some(e=>{var u;return((u=e==null?void 0:e.product)==null?void 0:u.stock_status)==="OUT_OF_STOCK"})}function ar(r){var c,e,u,l,i,a,_,g;let n;if(r.__typename==="ConfigurableCartItem")n=(l=(u=(e=(c=r==null?void 0:r.configured_variant)==null?void 0:c.price_range)==null?void 0:e.maximum_price)==null?void 0:u.discount)==null?void 0:l.percent_off;else{if(r.__typename==="BundleCartItem")return;n=(g=(_=(a=(i=r==null?void 0:r.product)==null?void 0:i.price_range)==null?void 0:a.maximum_price)==null?void 0:_.discount)==null?void 0:g.percent_off}if(n!==0)return Math.round(n)}function pr(r){var n;return r.__typename==="ConfigurableCartItem"?r.configured_variant.sku:((n=r.product)==null?void 0:n.variantSku)||r.product.sku}function gr(r){var e,u,l,i,a,_;let n,c;if(n=((u=(e=r==null?void 0:r.prices)==null?void 0:e.original_row_total)==null?void 0:u.value)-((i=(l=r==null?void 0:r.prices)==null?void 0:l.row_total)==null?void 0:i.value),c=(_=(a=r==null?void 0:r.prices)==null?void 0:a.row_total)==null?void 0:_.currency,n!==0)return{value:n,currency:c}}function fr(r){var n,c,e;return(e=(c=(n=r==null?void 0:r.product)==null?void 0:n.custom_attributesV2)==null?void 0:c.items)==null?void 0:e.map(u=>{const l=u.code.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ");return{...u,code:l}})}function yr(r){var e,u;if(!r)return null;const n=l=>{switch(l){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}},c=l=>{switch(+l){case 0:return!1;case 1:return!0;case 2:return null;default:return!1}};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:n(r.shopping_cart_display_subtotal),price:n(r.shopping_cart_display_price),shipping:n(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",allowGiftWrappingOnOrder:c(r==null?void 0:r.allow_gift_wrapping_on_order),allowGiftWrappingOnOrderItems:c(r==null?void 0:r.allow_gift_wrapping_on_order_items),allowGiftMessageOnOrder:c(r==null?void 0:r.allow_order),allowGiftMessageOnOrderItems:c(r==null?void 0:r.allow_items),allowGiftReceipt:!!+(r==null?void 0:r.allow_gift_receipt),allowPrintedCard:!!+(r==null?void 0:r.allow_printed_card),printedCardPrice:{currency:((e=r==null?void 0:r.printed_card_priceV2)==null?void 0:e.currency)??"",value:((u=r==null?void 0:r.printed_card_priceV2)==null?void 0:u.value)!=null?+r.printed_card_priceV2.value:0},cartGiftWrapping:n(+r.cart_gift_wrapping),cartPrintedCard:n(+r.cart_printed_card)}}const A=`
|
|
3
|
+
import{s as t,d as L,f as G,h as D}from"./resetCart.js";import{events as f}from"@dropins/tools/event-bus.js";import{Initializer as X,merge as K}from"@dropins/tools/lib.js";import{a as j}from"./persisted-data.js";import{CART_FRAGMENT as A}from"../fragments.js";const V=new X({init:async r=>{const n={disableGuestCart:!1,...r};V.config.setConfig(n),U().catch(console.error)},listeners:()=>[f.on("authenticated",r=>{t.authenticated&&!r?f.emit("cart/reset",void 0):r&&!t.authenticated&&(t.authenticated=r,U().catch(console.error))},{eager:!0}),f.on("locale",async r=>{r!==t.locale&&(t.locale=r,U().catch(console.error))}),f.on("cart/reset",()=>{L().catch(console.error),f.emit("cart/data",null)}),f.on("cart/data",r=>{j(r)}),f.on("checkout/updated",r=>{r&&xr().catch(console.error)})]}),B=V.config;function N(r){var c,e,u,l,i,a,_,g,y,d,m,o,C,h,v,b;if(!r)return null;const n={appliedGiftCards:((c=r==null?void 0:r.applied_gift_cards)==null?void 0:c.map(s=>{var w,M,k;const p={code:s.code??"",appliedBalance:{value:s.applied_balance.value??0,currency:s.applied_balance.currency??"USD"},currentBalance:{value:s.current_balance.value??0,currency:s.current_balance.currency??"USD"},expirationDate:s.expiration_date??""},x=(w=p==null?void 0:p.currentBalance)==null?void 0:w.value,T=(M=p==null?void 0:p.appliedBalance)==null?void 0:M.value,S=(k=p==null?void 0:p.currentBalance)==null?void 0:k.currency,Q=x-T>0?x-T:0;return{...p,giftCardBalance:{value:Q,currency:S}}}))??[],id:r.id,totalQuantity:lr(r),totalUniqueItems:r.itemsV2.items.length,totalGiftOptions:Y((e=r==null?void 0:r.prices)==null?void 0:e.gift_options),giftReceiptIncluded:(r==null?void 0:r.gift_receipt_included)??!1,printedCardIncluded:(r==null?void 0:r.printed_card_included)??!1,cartGiftWrapping:((u=r==null?void 0:r.available_gift_wrappings)==null?void 0:u.map(s=>{var p,x,T,S,E;return{design:s.design??"",uid:s.uid,selected:((p=r==null?void 0:r.gift_wrapping)==null?void 0:p.uid)===s.uid,image:{url:((x=s==null?void 0:s.image)==null?void 0:x.url)??"",label:((T=s.image)==null?void 0:T.label)??""},price:{currency:((S=s==null?void 0:s.price)==null?void 0:S.currency)??"USD",value:((E=s==null?void 0:s.price)==null?void 0:E.value)??0}}}))??[],giftMessage:{senderName:((l=r==null?void 0:r.gift_message)==null?void 0:l.from)??"",recipientName:((i=r==null?void 0:r.gift_message)==null?void 0:i.to)??"",message:((a=r==null?void 0:r.gift_message)==null?void 0:a.message)??""},errors:nr(r==null?void 0:r.itemsV2),items:F(r==null?void 0:r.itemsV2),miniCartMaxItems:F(r==null?void 0:r.itemsV2).slice(0,((_=t.config)==null?void 0:_.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:P(r.prices.discounts,r.prices.grand_total.currency),subtotal:{excludingTax:{value:(g=r.prices.subtotal_excluding_tax)==null?void 0:g.value,currency:(y=r.prices.subtotal_excluding_tax)==null?void 0:y.currency},includingTax:{value:(d=r.prices.subtotal_including_tax)==null?void 0:d.value,currency:(m=r.prices.subtotal_including_tax)==null?void 0:m.currency},includingDiscountOnly:{value:(o=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:o.value,currency:(C=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:C.currency}},appliedTaxes:z(r.prices.applied_taxes),totalTax:P(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:z(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&sr(r)},isGuestCart:!t.authenticated,hasOutOfStockItems:or(r),hasFullyOutOfStockItems:_r(r),appliedCoupons:r.applied_coupons};return K(n,(b=(v=(h=B.getConfig().models)==null?void 0:h.CartModel)==null?void 0:v.transformer)==null?void 0:b.call(v,r))}function Y(r){var n,c,e,u,l,i,a,_,g,y,d,m;return{giftWrappingForItems:{value:((n=r==null?void 0:r.gift_wrapping_for_items)==null?void 0:n.value)??0,currency:((c=r==null?void 0:r.gift_wrapping_for_items)==null?void 0:c.currency)??"USD"},giftWrappingForItemsInclTax:{value:((e=r==null?void 0:r.gift_wrapping_for_items_incl_tax)==null?void 0:e.value)??0,currency:((u=r==null?void 0:r.gift_wrapping_for_items_incl_tax)==null?void 0:u.currency)??"USD"},giftWrappingForOrder:{value:((l=r==null?void 0:r.gift_wrapping_for_order)==null?void 0:l.value)??0,currency:((i=r==null?void 0:r.gift_wrapping_for_order)==null?void 0:i.currency)??"USD"},giftWrappingForOrderInclTax:{value:((a=r==null?void 0:r.gift_wrapping_for_order_incl_tax)==null?void 0:a.value)??0,currency:((_=r==null?void 0:r.gift_wrapping_for_order_incl_tax)==null?void 0:_.currency)??"USD"},printedCard:{value:((g=r==null?void 0:r.printed_card)==null?void 0:g.value)??0,currency:((y=r==null?void 0:r.printed_card)==null?void 0:y.currency)??"USD"},printedCardInclTax:{value:((d=r==null?void 0:r.printed_card_incl_tax)==null?void 0:d.value)??0,currency:((m=r==null?void 0:r.printed_card_incl_tax)==null?void 0:m.currency)??"USD"}}}function P(r,n){return r!=null&&r.length?r.reduce((c,e)=>({value:c.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:n}):{value:0,currency:n}}function O(r,n){var c,e,u,l;return{src:r!=null&&r.useConfigurableParentThumbnail?n.product.thumbnail.url:((e=(c=n.configured_variant)==null?void 0:c.thumbnail)==null?void 0:e.url)||n.product.thumbnail.url,alt:r!=null&&r.useConfigurableParentThumbnail?n.product.thumbnail.label:((l=(u=n.configured_variant)==null?void 0:u.thumbnail)==null?void 0:l.label)||n.product.thumbnail.label}}function H(r){var n,c,e,u;return r.__typename==="ConfigurableCartItem"?{value:(c=(n=r.configured_variant)==null?void 0:n.price_range)==null?void 0:c.maximum_price.regular_price.value,currency:(u=(e=r.configured_variant)==null?void 0:e.price_range)==null?void 0:u.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 J(r){var n,c,e;return r.__typename==="ConfigurableCartItem"?((c=(n=r.configured_variant)==null?void 0:n.price_range)==null?void 0:c.maximum_price.discount.amount_off)>0:((e=r.product.price_range)==null?void 0:e.maximum_price.discount.amount_off)>0}function Z(r){var n,c,e;return{senderName:((n=r==null?void 0:r.gift_message)==null?void 0:n.from)??"",recipientName:((c=r==null?void 0:r.gift_message)==null?void 0:c.to)??"",message:((e=r==null?void 0:r.gift_message)==null?void 0:e.message)??""}}function rr(r){return{currency:(r==null?void 0:r.currency)??"USD",value:(r==null?void 0:r.value)??0}}function F(r){var c;if(!((c=r==null?void 0:r.items)!=null&&c.length))return[];const n=t.config;return r.items.map(e=>{var u,l,i,a,_,g,y,d,m;return{giftWrappingAvailable:((u=e==null?void 0:e.product)==null?void 0:u.gift_wrapping_available)??!1,giftWrappingPrice:rr((l=e==null?void 0:e.product)==null?void 0:l.gift_wrapping_price),giftMessage:Z(e),productGiftWrapping:((i=e==null?void 0:e.available_gift_wrapping)==null?void 0:i.map(o=>{var C,h,v,b,s;return{design:o.design??"",uid:o.uid,selected:((C=e.gift_wrapping)==null?void 0:C.uid)===o.uid,image:{url:((h=o==null?void 0:o.image)==null?void 0:h.url)??"",label:((v=o.image)==null?void 0:v.label)??""},price:{currency:((b=o==null?void 0:o.price)==null?void 0:b.currency)??"USD",value:((s=o==null?void 0:o.price)==null?void 0:s.value)??0}}}))??[],itemType:e.__typename,uid:e.uid,giftMessageAvailable:er(e.product.gift_message_available),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:pr(e),topLevelSku:e.product.sku,name:e.product.name,image:O(n,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:ir(e.links),total:{value:(a=e.prices.original_row_total)==null?void 0:a.value,currency:(_=e.prices.original_row_total)==null?void 0:_.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency,label:(g=e.prices.discounts)==null?void 0:g.map(o=>o.label)},regularPrice:H(e),discounted:J(e),bundleOptions:e.__typename==="BundleCartItem"?cr(e.bundle_options):null,selectedOptions:(y=$(e.configurable_options))==null?void 0:y.options,selectedOptionsUIDs:(d=$(e.configurable_options))==null?void 0:d.uids,customizableOptions:ur(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"?(m=e.configured_variant)==null?void 0:m.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:tr(e),discountPercentage:ar(e),savingsAmount:gr(e),productAttributes:fr(e)}})}function er(r){switch(+r){case 0:return!1;case 1:return!0;case 2:return null;default:return!1}}function nr(r){var c;const n=(c=r==null?void 0:r.items)==null?void 0:c.reduce((e,u)=>{var l;return(l=u.errors)==null||l.forEach(i=>{e.push({uid:u.uid,text:i.message})}),e},[]);return n!=null&&n.length?n:null}function z(r){return r!=null&&r.length?r.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label,coupon:n.coupon})):[]}function cr(r){const n=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(u=>u.label).join(", ")})),c={};return n==null||n.forEach(e=>{c[e.label]=e.value}),Object.keys(c).length>0?c:null}function $(r){const n=r==null?void 0:r.map(u=>({uid:u.configurable_product_option_uid,label:u.option_label,value:u.value_label,valueUid:u.configurable_product_option_value_uid})),c={},e={};return n==null||n.forEach(u=>{c[u.label]=u.value,e[u.label]=u.valueUid}),{options:Object.keys(c).length>0?c:null,uids:Object.keys(e).length>0?e:null}}function ur(r){const n=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(u=>({uid:u.customizable_option_value_uid,label:u.label,value:u.value}))})),c={};return n==null||n.forEach(e=>{var u;switch(e.type){case"field":case"area":case"date_time":c[e.label]=e.values[0].value;break;case"radio":case"drop_down":c[e.label]=e.values[0].label;break;case"multiple":case"checkbox":c[e.label]=e.values.reduce((l,i)=>l?`${l}, ${i.label}`:i.label,"");break;case"file":{const l=new DOMParser,i=e.values[0].value,_=((u=l.parseFromString(i,"text/html").querySelector("a"))==null?void 0:u.textContent)||"";c[e.label]=_;break}}}),c}function lr(r){var n,c;return((n=t.config)==null?void 0:n.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((c=t.config)==null?void 0:c.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function ir(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(n=>n.title).join(", ")}:null}function sr(r){var n,c,e,u;return(n=r.shipping_addresses)!=null&&n.length?(c=r.shipping_addresses)==null?void 0:c.map(l=>({countryCode:l.country.code,zipCode:l.postcode,regionCode:l.region.code})):(e=r.addresses)!=null&&e.length?(u=r.addresses)==null?void 0:u.filter(l=>l.default_shipping).map(l=>{var i;return l.default_shipping&&{countryCode:l.country_code,zipCode:l.postcode,regionCode:(i=l.region)==null?void 0:i.region_code}}):null}function or(r){var n,c;return(c=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:c.some(e=>{var u;return((u=e==null?void 0:e.product)==null?void 0:u.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function tr(r){return r.not_available_message?r.product.quantity!=null?r.product.quantity:"noNumber":null}function _r(r){var n,c;return(c=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:c.some(e=>{var u;return((u=e==null?void 0:e.product)==null?void 0:u.stock_status)==="OUT_OF_STOCK"})}function ar(r){var c,e,u,l,i,a,_,g;let n;if(r.__typename==="ConfigurableCartItem")n=(l=(u=(e=(c=r==null?void 0:r.configured_variant)==null?void 0:c.price_range)==null?void 0:e.maximum_price)==null?void 0:u.discount)==null?void 0:l.percent_off;else{if(r.__typename==="BundleCartItem")return;n=(g=(_=(a=(i=r==null?void 0:r.product)==null?void 0:i.price_range)==null?void 0:a.maximum_price)==null?void 0:_.discount)==null?void 0:g.percent_off}if(n!==0)return Math.round(n)}function pr(r){var n;return r.__typename==="ConfigurableCartItem"?r.configured_variant.sku:((n=r.product)==null?void 0:n.variantSku)||r.product.sku}function gr(r){var e,u,l,i,a,_;let n,c;if(n=((u=(e=r==null?void 0:r.prices)==null?void 0:e.original_row_total)==null?void 0:u.value)-((i=(l=r==null?void 0:r.prices)==null?void 0:l.row_total)==null?void 0:i.value),c=(_=(a=r==null?void 0:r.prices)==null?void 0:a.row_total)==null?void 0:_.currency,n!==0)return{value:n,currency:c}}function fr(r){var n,c,e;return(e=(c=(n=r==null?void 0:r.product)==null?void 0:n.custom_attributesV2)==null?void 0:c.items)==null?void 0:e.map(u=>{const l=u.code.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ");return{...u,code:l}})}function yr(r){var e,u;if(!r)return null;const n=l=>{switch(l){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}},c=l=>{switch(+l){case 0:return!1;case 1:return!0;case 2:return null;default:return!1}};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:n(r.shopping_cart_display_subtotal),price:n(r.shopping_cart_display_price),shipping:n(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",allowGiftWrappingOnOrder:c(r==null?void 0:r.allow_gift_wrapping_on_order),allowGiftWrappingOnOrderItems:c(r==null?void 0:r.allow_gift_wrapping_on_order_items),allowGiftMessageOnOrder:c(r==null?void 0:r.allow_order),allowGiftMessageOnOrderItems:c(r==null?void 0:r.allow_items),allowGiftReceipt:!!+(r==null?void 0:r.allow_gift_receipt),allowPrintedCard:!!+(r==null?void 0:r.allow_printed_card),printedCardPrice:{currency:((e=r==null?void 0:r.printed_card_priceV2)==null?void 0:e.currency)??"",value:((u=r==null?void 0:r.printed_card_priceV2)==null?void 0:u.value)!=null?+r.printed_card_priceV2.value:0},cartGiftWrapping:n(+r.cart_gift_wrapping),cartPrintedCard:n(+r.cart_printed_card)}}const R=`
|
|
4
4
|
$pageSize: Int! = 100,
|
|
5
5
|
$currentPage: Int! = 1,
|
|
6
6
|
$itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
|
|
7
|
-
`,
|
|
7
|
+
`,dr=`
|
|
8
8
|
fragment CUSTOMER_FRAGMENT on Customer {
|
|
9
9
|
addresses {
|
|
10
10
|
default_shipping
|
|
@@ -17,10 +17,10 @@ import{s as o,d as Q,f as S,h as D}from"./resetCart.js";import{events as f}from"
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,mr=`
|
|
21
21
|
query GUEST_CART_QUERY(
|
|
22
22
|
$cartId: String!,
|
|
23
|
-
${
|
|
23
|
+
${R}
|
|
24
24
|
) {
|
|
25
25
|
|
|
26
26
|
cart(cart_id: $cartId){
|
|
@@ -28,10 +28,10 @@ import{s as o,d as Q,f as S,h as D}from"./resetCart.js";import{events as f}from"
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
${
|
|
31
|
+
${A}
|
|
32
32
|
`,vr=`
|
|
33
33
|
query CUSTOMER_CART_QUERY(
|
|
34
|
-
${
|
|
34
|
+
${R}
|
|
35
35
|
) {
|
|
36
36
|
|
|
37
37
|
customer {
|
|
@@ -43,13 +43,13 @@ import{s as o,d as Q,f as S,h as D}from"./resetCart.js";import{events as f}from"
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
${
|
|
47
|
-
${
|
|
48
|
-
`,I=async()=>{const r=
|
|
46
|
+
${dr}
|
|
47
|
+
${A}
|
|
48
|
+
`,I=async()=>{const r=t.authenticated,n=t.cartId;if(r)return G(vr,{method:"POST"}).then(({errors:c,data:e})=>{if(c)return D(c);const u={...e.cart,...e.customer};return N(u)});if(!n)throw new Error("No cart ID found");return G(mr,{method:"POST",cache:"no-cache",variables:{cartId:n}}).then(({errors:c,data:e})=>c?D(c):N(e.cart))},Cr=`
|
|
49
49
|
mutation MERGE_CARTS_MUTATION(
|
|
50
50
|
$guestCartId: String!,
|
|
51
51
|
$customerCartId: String!,
|
|
52
|
-
${
|
|
52
|
+
${R}
|
|
53
53
|
) {
|
|
54
54
|
mergeCarts(
|
|
55
55
|
source_cart_id: $guestCartId,
|
|
@@ -59,8 +59,8 @@ import{s as o,d as Q,f as S,h as D}from"./resetCart.js";import{events as f}from"
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
${
|
|
63
|
-
`,
|
|
62
|
+
${A}
|
|
63
|
+
`,U=async()=>{if(t.initializing)return null;t.initializing=!0,t.config||(t.config=await br());const r=t.authenticated?await W():await q();return f.emit("cart/initialized",r),f.emit("cart/data",r),t.initializing=!1,r};async function W(){const r=t.cartId,n=await I();return n?(t.cartId=n.id,!r||n.id===r?n:await G(Cr,{variables:{guestCartId:r,customerCartId:n.id}}).then(()=>I()).then(c=>{const e={oldCartItems:n.items,newCart:c};return f.emit("cart/merged",e),c}).catch(()=>(console.error("Could not merge carts"),n))):null}async function q(){if(B.getConfig().disableGuestCart===!0||!t.cartId)return null;try{return await I()}catch(r){return console.error(r),null}}const hr=`
|
|
64
64
|
query STORE_CONFIG_QUERY {
|
|
65
65
|
storeConfig {
|
|
66
66
|
minicart_display
|
|
@@ -94,4 +94,4 @@ query STORE_CONFIG_QUERY {
|
|
|
94
94
|
cart_printed_card
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
`,br=async()=>
|
|
97
|
+
`,br=async()=>G(hr,{method:"GET",cache:"force-cache"}).then(({errors:r,data:n})=>r?D(r):yr(n.storeConfig)),xr=async()=>{const r=t.authenticated?await W():await q();return f.emit("cart/data",r),r};export{R as C,U as a,W as b,B as c,q as d,br as e,I as g,V as i,xr as r,N as t};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a single row entry in the cart summary table
|
|
6
|
+
* Each field accepts a VNode to allow for flexible content rendering
|
|
7
|
+
*/
|
|
8
|
+
export interface CartTableEntry {
|
|
9
|
+
/** The item UID */
|
|
10
|
+
uid: string;
|
|
11
|
+
/** Whether the item is updating */
|
|
12
|
+
updating: boolean;
|
|
13
|
+
/** Whether the item has an update error */
|
|
14
|
+
hasError: boolean;
|
|
15
|
+
/** The product details section (typically includes image, name, and options) */
|
|
16
|
+
item: VNode;
|
|
17
|
+
/** The unit price of the product */
|
|
18
|
+
price: VNode;
|
|
19
|
+
/** The quantity selector/display */
|
|
20
|
+
quantity: VNode;
|
|
21
|
+
/** The total price for this line item */
|
|
22
|
+
subtotal: VNode;
|
|
23
|
+
/** Actions bar on the bottom of the row */
|
|
24
|
+
actions: VNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Props for the CartSummaryTable component
|
|
28
|
+
*/
|
|
29
|
+
export interface CartSummaryTableProps extends HTMLAttributes<HTMLDivElement> {
|
|
30
|
+
/** Array of cart entries to display in the table */
|
|
31
|
+
entries: CartTableEntry[];
|
|
32
|
+
/** Optional CSS class name for custom styling */
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* CartSummaryTable component displays cart items in a responsive grid layout
|
|
37
|
+
* - Uses CSS Grid for layout with 4 columns on desktop
|
|
38
|
+
* - Switches to a stacked single-column layout on mobile with labeled sections
|
|
39
|
+
* - Renders each entry's content using VComponent for proper component handling
|
|
40
|
+
*/
|
|
41
|
+
export declare const CartSummaryTable: FunctionComponent<CartSummaryTableProps>;
|
|
42
|
+
//# sourceMappingURL=CartSummaryTable.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface ItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
productTitle: VNode;
|
|
6
|
+
sku?: VNode;
|
|
7
|
+
image?: VNode;
|
|
8
|
+
configurations?: VNode;
|
|
9
|
+
alert?: VNode;
|
|
10
|
+
warning?: VNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const Item: FunctionComponent<ItemProps>;
|
|
13
|
+
//# sourceMappingURL=Item.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './Item';
|
|
10
|
+
export { Item as default } from './Item';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './CartSummaryTable';
|
|
10
|
+
export { CartSummaryTable as default } from './CartSummaryTable';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionComponent, JSX, VNode } from 'preact';
|
|
2
|
-
import { ImageNodeRenderProps } from '
|
|
2
|
+
import { ImageNodeRenderProps } from '@dropins/tools/types/elsie/src/components';
|
|
3
3
|
import { GiftWrappingConfigProps, GiftOptionsViewProps } from '../../../types';
|
|
4
4
|
|
|
5
5
|
interface GiftOptionModalProps {
|