diff --git a/package-lock.json b/package-lock.json index 9db831b4b1..607fa9dc9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@adobe/magento-storefront-events-sdk": "^1.8.0", "@dropins/storefront-account": "0.1.0-alpha19", "@dropins/storefront-auth": "0.0.1-alpha25", - "@dropins/storefront-cart": "0.9.0", + "@dropins/storefront-cart": "0.10.0", "@dropins/storefront-checkout": "0.1.0-alpha53", "@dropins/storefront-order": "0.1.0-alpha19", "@dropins/storefront-pdp": "0.4.0", @@ -806,9 +806,9 @@ "integrity": "sha512-/ulJyTHW5RLt1n5p5upNob1e0dicR24HSfxUHIooI4xwKj+rPgRRyF98ziSskY0TF6H6xJ6RPQwXcMkRh29aVw==" }, "node_modules/@dropins/storefront-cart": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@dropins/storefront-cart/-/storefront-cart-0.9.0.tgz", - "integrity": "sha512-uowQdB9TeGnoyLBxUCrl5qEYo7QLEiHciU0uHQ1QPaycgX3qaQejbjQcuCuHSxjAXMhCw6KY61IpEdSMkuZDtg==" + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@dropins/storefront-cart/-/storefront-cart-0.10.0.tgz", + "integrity": "sha512-1xbwAGHndT2zEJoCpANkTcq7gQP1QF97BEMMJ7fk0VFrpam1ZDVg9b96w2Z4BELQOz6wRBcnKWxnHcnd4ZNeGA==" }, "node_modules/@dropins/storefront-checkout": { "version": "0.1.0-alpha53", diff --git a/package.json b/package.json index 1b2cf7f1df..604c49fed4 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@adobe/magento-storefront-events-sdk": "^1.8.0", "@dropins/storefront-account": "0.1.0-alpha19", "@dropins/storefront-auth": "0.0.1-alpha25", - "@dropins/storefront-cart": "0.9.0", + "@dropins/storefront-cart": "0.10.0", "@dropins/storefront-checkout": "0.1.0-alpha53", "@dropins/storefront-order": "0.1.0-alpha19", "@dropins/storefront-pdp": "0.4.0", diff --git a/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js b/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js index f3114a246b..730a50ad81 100644 --- a/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js +++ b/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as a,Fragment as l}from"@dropins/tools/preact-jsx-runtime.js";import{useState as y,useEffect as h}from"@dropins/tools/preact-compat.js";import{classes as d,VComponent as _}from"@dropins/tools/lib.js";/* empty css */import{E as C}from"./EmptyCart.js";import{Image as v}from"@dropins/tools/components.js";import{events as N}from"@dropins/tools/event-bus.js";import{g as b}from"./persisted-data.js";const j=({className:m,children:i,emptyCart:n,products:e,...c})=>a("div",{...c,className:d(["cart-cart-summary-grid",m]),children:a(l,{children:a("div",{className:d(["cart-cart-summary-grid__content",["cart-cart-summary-grid__content--empty",!e]]),children:e||a(_,{node:n,className:"cart-cart-summary-grid__empty-cart"})})})}),D=({children:m,initialData:i=null,routeProduct:n,routeEmptyCartCTA:e,...c})=>{const[s,g]=y(i);h(()=>{const r=N.on("cart/data",t=>{g(t)},{eager:!0});return()=>{r==null||r.off()}},[]);const p=(r,t)=>{const f=r.selectedOptions?`${r.name}: ${Object.entries(r.selectedOptions).join("; ")}`:r.name,o=a(v,{"data-testid":"cart-grid-item-image",loading:t<4?"eager":"lazy",src:r.image.src,alt:r.image.alt,"aria-label":f,width:"100%"});return n?a("div",{className:"cart-cart-summary-grid__item-container",children:a("a",{href:n(r),children:o})},t):o},u=s&&a(l,{children:s.items.map((r,t)=>p(r,t))});return a(j,{...c,emptyCart:a(C,{ctaLinkURL:e?e():void 0}),products:u})};D.getInitialData=async function(){return b()};export{D as C}; +import{jsx as a,Fragment as l}from"@dropins/tools/preact-jsx-runtime.js";import{useState as y,useEffect as h}from"@dropins/tools/preact-compat.js";import{classes as d,VComponent as _}from"@dropins/tools/lib.js";/* empty css */import{E as C}from"./EmptyCart.js";import{Image as v}from"@dropins/tools/components.js";import{events as N}from"@dropins/tools/event-bus.js";import{g as b}from"./persisted-data.js";const j=({className:m,children:i,emptyCart:n,products:e,...c})=>a("div",{...c,className:d(["cart-cart-summary-grid",m]),children:a(l,{children:a("div",{className:d(["cart-cart-summary-grid__content",["cart-cart-summary-grid__content--empty",!e]]),children:e||a(_,{node:n,className:"cart-cart-summary-grid__empty-cart"})})})}),D=({children:m,initialData:i=null,routeProduct:n,routeEmptyCartCTA:e,...c})=>{const[s,g]=y(i);h(()=>{const r=N.on("cart/data",t=>{g(t)},{eager:!0});return()=>{r==null||r.off()}},[]);const p=(r,t)=>{const f=r.selectedOptions?`${r.name}: ${Object.entries(r.selectedOptions).join("; ")}`:r.name,o=a(v,{"data-testid":"cart-grid-item-image",loading:t<4?"eager":"lazy",src:r.image.src,alt:r.image.alt,"aria-label":f,width:"100%"});return n?a("div",{className:"cart-cart-summary-grid__item-container",children:a("a",{href:n(r),children:o})},t):o},u=s&&a(l,{children:s.items.map((r,t)=>p(r,t))});return a(j,{...c,emptyCart:a(C,{ctaLinkURL:e?e():void 0}),products:u})};D.getInitialData=async function(){return b()};export{D as C}; diff --git a/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js b/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js index dc99d7c4ba..f75487b6fb 100644 --- a/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js +++ b/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as n,jsxs as h,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import*as o from"@dropins/tools/preact-compat.js";import{useState as N,useCallback as Ft,useEffect as ot}from"@dropins/tools/preact-compat.js";import{classes as L,VComponent as b,Slot as w}from"@dropins/tools/lib.js";/* empty css */import{E as Mt}from"./EmptyCart.js";import{Divider as st,Skeleton as zt,SkeletonRow as Ut,InLineAlert as qt,Icon as z,CartList as lt,Button as U,Accordion as Tt,AccordionSection as Wt,CartItem as Jt,Price as O,Image as Kt}from"@dropins/tools/components.js";import{g as Rt}from"./persisted-data.js";import{events as Yt}from"@dropins/tools/event-bus.js";import{s as Ht}from"./resetCart.js";import{u as ut}from"./updateProductsFromCart.js";import{S as Dt}from"./ChevronDown.js";import{useText as te}from"@dropins/tools/i18n.js";const ee=d=>o.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...d},o.createElement("g",{id:"Large"},o.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),o.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},o.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),dt=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("g",{clipPath:"url(#clip0_4797_15331)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19 13.31L15.5 19.37H22.5L19 13.31Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15331"},o.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),ne=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),gt=({className:d,children:q,heading:k,footer:y,emptyCart:_,products:u,outOfStockMessage:v,variant:S="primary",loading:m=!0,...c})=>n("div",{...c,className:L(["cart-cart-summary-list",d,`cart-cart-summary-list__background--${S}`]),children:m?n(re,{}):h(X,{children:[(k||v)&&h("div",{"data-testid":"cart-summary-list-heading-wrapper",className:L(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!u]]),children:[k&&h(X,{children:[n(b,{node:k,className:"cart-cart-summary-list__heading-text"}),n(st,{variant:"primary",className:L(["cart-cart-summary-list__heading-divider"])})]}),v&&n(b,{node:v,className:"cart-cart-summary-list__out-of-stock-message"})]}),n("div",{className:L(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!u]]),children:u||n(b,{node:_,className:"cart-cart-summary-list__empty-cart"})}),y&&h(X,{children:[n(st,{variant:"primary",className:L(["cart-cart-summary-list__footer-divider"])}),n(b,{node:y,className:"cart-cart-summary-list__footer-text"})]})]})}),re=()=>n(zt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:n(Ut,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),ae=({initialData:d=null,hideHeading:q,hideFooter:k,routeProduct:y,routeEmptyCartCTA:_,routeCart:u,onItemUpdate:v,onItemRemove:S,maxItems:m,slots:c,attributesToHide:l=[],enableRemoveItem:j,enableUpdateItemQuantity:T,onItemsErrorsChange:$,accordion:ft=!1,variant:Z="primary",isLoading:mt,showMaxItems:W,showDiscount:ht,showSavings:yt,quantityType:vt,dropdownOptions:pt,...J})=>{var rt;const[B,kt]=N(!d),[a,Ct]=N(d),[E,wt]=N(new Set),[A,Lt]=N(new Map),s=(rt=Ht.config)==null?void 0:rt.shoppingCartDisplaySetting,[Q,_t]=N(W?!0:!m&&!W),i=te({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage",viewMore:"Cart.Cart.viewMore",viewAll:"Cart.Cart.viewAll",discountPercent:"Cart.CartItem.discountPercentage",savingsAmount:"Cart.CartItem.savingsAmount"}),F=(t,e)=>{wt(r=>(e?r.add(t):r.delete(t),new Set(r)))},K=(t,e)=>{Lt(r=>(e?r.set(t,e):r.delete(t),new Map(r)))},M=(t,e)=>{F(t.uid,!0),K(t.uid),j&&e===0?ut([{uid:t.uid,quantity:e}]).then(()=>{S==null||S({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r)}):T&&ut([{uid:t.uid,quantity:e}]).then(()=>{v==null||v({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r),K(t.uid,r.message)})},St=Ft(()=>{_t(t=>!t)},[]);ot(()=>{const t=Yt.on("cart/data",e=>{Ct(e),kt(!!mt)},{eager:!0});return()=>{t==null||t.off()}},[]),ot(()=>{$&&$(A)},[A,$]);const Et=(t,e)=>{if(l.includes("image"))return;const r=n(Kt,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return n(w,{name:"Thumbnail",slot:c==null?void 0:c.Thumbnail,context:{item:t},children:y?n("a",{href:y(t),children:r}):r})},It=t=>{if(!l.includes("name"))return n("span",{"data-testid":"cart-list-item-title",children:y?n("a",{href:y(t),children:t.name}):t.name})},xt=t=>{if(l.includes("configurations"))return;const e={...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null};if(Object.keys(e).length!==0)return e},Pt=t=>{var e,r,f,g;return(s==null?void 0:s.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(r=t.taxedPrice)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(f=t.regularPrice)==null?void 0:f.value,currency:(g=t.regularPrice)==null?void 0:g.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},Nt=t=>{var e,r;return{amount:(e=t.savingsAmount)==null?void 0:e.value,currency:(r=t.savingsAmount)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"item-savings-amount"}},Ot=t=>(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX"?n(O,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,At=t=>{var f,g,p,C,I,x,P,at,it,ct;const e={"aria-label":i.regularPrice},r=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(s==null?void 0:s.price)?(e.amount=(f=t.rowTotalIncludingTax)==null?void 0:f.value,e.currency=(g=t.rowTotalIncludingTax)==null?void 0:g.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",r&&(e.amount=(p=t.total)==null?void 0:p.value,e.currency=(C=t.total)==null?void 0:C.currency,r.amount=(I=t.rowTotalIncludingTax)==null?void 0:I.value,r.currency=(x=t.rowTotalIncludingTax)==null?void 0:x.currency,r.sale=!0,r["aria-label"]=i.discountedPrice,r["data-testid"]="discount-total")):(e.amount=(P=t.total)==null?void 0:P.value,e.currency=(at=t.total)==null?void 0:at.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",r&&(r.amount=(it=t.discountedTotal)==null?void 0:it.value,r.currency=(ct=t.discountedTotal)==null?void 0:ct.currency,r.sale=!0,r["aria-label"]=i.regularPrice,r["data-testid"]="discount-total")),{totalProps:e,discountProps:r}},Qt=t=>{var I,x,P;if(l.includes("warning"))return;const e=A.get(t.uid),r=(I=A.get(t.uid))==null?void 0:I.includes("The requested qty is not available"),f=E.has(t.uid),g=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(x=t.stockLevel)==null?void 0:x.toString()).replace("{count}",t.quantity.toString()):"",p=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(P=t.onlyXLeftInStock)==null?void 0:P.toString()),C=!t.outOfStock&&e&&r?i.notAvailableMessage:e;return!f&&(e||t.insufficientQuantity||t.lowInventory)?h("span",{"data-testid":"item-warning",children:[n(z,{source:ne,size:"16"}),C||g||p]}):void 0},Gt=t=>l!=null&&l.includes("alert")?void 0:!E.has(t.uid)&&t.outOfStock?h("span",{"data-testid":"item-alert",children:[n(z,{source:dt,size:"16"}),i.outOfStockAlert]}):void 0,Vt=t=>n(w,{name:"ProductAttributes",slot:c==null?void 0:c.ProductAttributes,context:{item:t}}),bt=t=>{if(!l.includes("sku"))return n("span",{"data-testid":"cart-list-item-sku",children:t.sku})},Xt=t=>n(w,{name:"Footer",slot:c==null?void 0:c.Footer,context:{item:t}}),R=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,r)=>{var p;const{totalProps:f,discountProps:g}=At(e);return n(Jt,{updating:E==null?void 0:E.has(e.uid),loading:B,"data-testid":`cart-list-item-entry-${e.uid}`,image:Et(e,r),title:It(e),sku:bt(e),price:l.includes("price")?void 0:n(O,{...Pt(e)}),quantity:l.includes("quantity")?void 0:e.quantity,total:h(X,{children:[l.includes("total")?void 0:n(O,{...f}),l.includes("totalDiscount")?void 0:g&&n(O,{...g})]}),attributes:Vt(e),configurations:xt(e),totalExcludingTax:l.includes("totalExcludingTax")?void 0:Ot(e),taxIncluded:(s==null?void 0:s.price)==="INCLUDING_TAX",taxExcluded:!l.includes("totalExcludingTax")&&(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX",warning:Qt(e),alert:Gt(e),quantityType:vt,dropdownOptions:pt,onQuantity:T?C=>{M(e,C)}:void 0,onRemove:j?()=>M(e,0):void 0,discount:ht&&e.discounted&&e.discountPercentage?n("div",{"data-testid":"item-discount-percent",children:i.discountPercent.replace("{discount}",((p=e.discountPercentage)==null?void 0:p.toString())??"")}):void 0,savings:yt&&e.discounted&&e.savingsAmount?h("div",{children:[n("span",{children:n(O,{...Nt(e)})})," ",i.savingsAmount]}):void 0,footer:Xt(e)},e.uid)}):null,Y=n(w,{name:"EmptyCart",slot:c==null?void 0:c.EmptyCart,context:{},children:n(Mt,{"data-testid":"empty-cart",ctaLinkURL:_==null?void 0:_()})}),H=n(w,{name:"Heading",slot:c==null?void 0:c.Heading,context:{count:a==null?void 0:a.totalQuantity},children:n("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),jt=H.props.children.props.children,$t=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{M(e,0)})},Zt=R(t=>t.outOfStock||t.insufficientQuantity||!1),D=a!=null&&a.hasOutOfStockItems?n(qt,{"data-testid":"cart-out-of-stock-message",icon:n(z,{source:dt,size:"16"}),itemList:n(lt,{"data-testid":"out-of-stock-cart-items",children:Zt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&j?[{label:i.removeAction,onClick:$t}]:void 0}):void 0,G=R(t=>!t.outOfStock&&!t.insufficientQuantity),tt=Q?Math.max(m||5,5):Math.min((a==null?void 0:a.totalQuantity)||5,5),et=(a==null?void 0:a.totalQuantity)>tt,Bt=et&&!Q&&tt!=m,V=a!=null&&a.totalQuantity&&G?n(w,{name:"Footer",slot:c==null?void 0:c.CartSummaryFooter,context:{displayMaxItems:Q,routeCart:u},"data-testid":"cart-cart-summary-footer-slot",children:n("div",{"data-testid":"cart-cart-summary-footer",children:et?Bt?n(U,{className:"cart-cart-summary-list-footer__action",onClick:St,"data-testid":"view-more-items-button",variant:"tertiary",children:i.viewMore}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-or-less-items-button",children:i.viewAll}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-button",children:i.viewAll})})}):null,nt=a!=null&&a.totalQuantity?n(lt,{"data-testid":"cart-list",children:G==null?void 0:G.slice(0,Q?Math.max(m||(a==null?void 0:a.totalQuantity),5):Math.min(m??5,5))}):null;return ft?n(Tt,{"data-testid":"cart-summary-list-accordion",className:L(["cart-cart-summary-list-accordion",`cart-cart-summary-list__background--${Z}`]),iconOpen:ee,iconClose:Dt,children:n(Wt,{title:jt,"data-testid":"cart-summary-list-accordion__section",open:!0,renderContentWhenClosed:!0,children:n(gt,{...J,"aria-expanded":!0,"aria-label":"TEST",className:"cart-cart-summary-list-accordion__list",loading:B,footer:k?void 0:V||(u?V:void 0),emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})})}):n(gt,{...J,heading:q?void 0:H,footer:k?void 0:V||(u?V:void 0),loading:B,emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})};ae.getInitialData=async function(){return Rt()};export{ae as C}; +import{jsx as n,jsxs as h,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import*as o from"@dropins/tools/preact-compat.js";import{useState as N,useCallback as Ft,useEffect as ot}from"@dropins/tools/preact-compat.js";import{classes as L,VComponent as b,Slot as w}from"@dropins/tools/lib.js";/* empty css */import{E as Mt}from"./EmptyCart.js";import{Divider as st,Skeleton as zt,SkeletonRow as Ut,InLineAlert as qt,Icon as z,CartList as lt,Button as U,Accordion as Tt,AccordionSection as Wt,CartItem as Jt,Price as O,Image as Kt}from"@dropins/tools/components.js";import{g as Rt}from"./persisted-data.js";import{events as Yt}from"@dropins/tools/event-bus.js";import{s as Ht}from"./resetCart.js";import{u as ut}from"./updateProductsFromCart.js";import{S as Dt}from"./ChevronDown.js";import{useText as te}from"@dropins/tools/i18n.js";const ee=d=>o.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...d},o.createElement("g",{id:"Large"},o.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),o.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},o.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),dt=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("g",{clipPath:"url(#clip0_4797_15331)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19 13.31L15.5 19.37H22.5L19 13.31Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15331"},o.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),ne=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),gt=({className:d,children:q,heading:k,footer:y,emptyCart:_,products:u,outOfStockMessage:v,variant:S="primary",loading:m=!0,...c})=>n("div",{...c,className:L(["cart-cart-summary-list",d,`cart-cart-summary-list__background--${S}`]),children:m?n(re,{}):h(X,{children:[(k||v)&&h("div",{"data-testid":"cart-summary-list-heading-wrapper",className:L(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!u]]),children:[k&&h(X,{children:[n(b,{node:k,className:"cart-cart-summary-list__heading-text"}),n(st,{variant:"primary",className:L(["cart-cart-summary-list__heading-divider"])})]}),v&&n(b,{node:v,className:"cart-cart-summary-list__out-of-stock-message"})]}),n("div",{className:L(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!u]]),children:u||n(b,{node:_,className:"cart-cart-summary-list__empty-cart"})}),y&&h(X,{children:[n(st,{variant:"primary",className:L(["cart-cart-summary-list__footer-divider"])}),n(b,{node:y,className:"cart-cart-summary-list__footer-text"})]})]})}),re=()=>n(zt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:n(Ut,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),ae=({initialData:d=null,hideHeading:q,hideFooter:k,routeProduct:y,routeEmptyCartCTA:_,routeCart:u,onItemUpdate:v,onItemRemove:S,maxItems:m,slots:c,attributesToHide:l=[],enableRemoveItem:j,enableUpdateItemQuantity:T,onItemsErrorsChange:$,accordion:ft=!1,variant:Z="primary",isLoading:mt,showMaxItems:W,showDiscount:ht,showSavings:yt,quantityType:vt,dropdownOptions:pt,...J})=>{var rt;const[B,kt]=N(!d),[a,Ct]=N(d),[E,wt]=N(new Set),[A,Lt]=N(new Map),s=(rt=Ht.config)==null?void 0:rt.shoppingCartDisplaySetting,[Q,_t]=N(W?!0:!m&&!W),i=te({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage",viewMore:"Cart.Cart.viewMore",viewAll:"Cart.Cart.viewAll",discountPercent:"Cart.CartItem.discountPercentage",savingsAmount:"Cart.CartItem.savingsAmount"}),F=(t,e)=>{wt(r=>(e?r.add(t):r.delete(t),new Set(r)))},K=(t,e)=>{Lt(r=>(e?r.set(t,e):r.delete(t),new Map(r)))},M=(t,e)=>{F(t.uid,!0),K(t.uid),j&&e===0?ut([{uid:t.uid,quantity:e}]).then(()=>{S==null||S({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r)}):T&&ut([{uid:t.uid,quantity:e}]).then(()=>{v==null||v({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r),K(t.uid,r.message)})},St=Ft(()=>{_t(t=>!t)},[]);ot(()=>{const t=Yt.on("cart/data",e=>{Ct(e),kt(!!mt)},{eager:!0});return()=>{t==null||t.off()}},[]),ot(()=>{$&&$(A)},[A,$]);const Et=(t,e)=>{if(l.includes("image"))return;const r=n(Kt,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return n(w,{name:"Thumbnail",slot:c==null?void 0:c.Thumbnail,context:{item:t},children:y?n("a",{href:y(t),children:r}):r})},It=t=>{if(!l.includes("name"))return n("span",{"data-testid":"cart-list-item-title",children:y?n("a",{href:y(t),children:t.name}):t.name})},xt=t=>{if(l.includes("configurations"))return;const e={...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null};if(Object.keys(e).length!==0)return e},Pt=t=>{var e,r,f,g;return(s==null?void 0:s.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(r=t.taxedPrice)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(f=t.regularPrice)==null?void 0:f.value,currency:(g=t.regularPrice)==null?void 0:g.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},Nt=t=>{var e,r;return{amount:(e=t.savingsAmount)==null?void 0:e.value,currency:(r=t.savingsAmount)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"item-savings-amount"}},Ot=t=>(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX"?n(O,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,At=t=>{var f,g,p,C,I,x,P,at,it,ct;const e={"aria-label":i.regularPrice},r=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(s==null?void 0:s.price)?(e.amount=(f=t.rowTotalIncludingTax)==null?void 0:f.value,e.currency=(g=t.rowTotalIncludingTax)==null?void 0:g.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",r&&(e.amount=(p=t.total)==null?void 0:p.value,e.currency=(C=t.total)==null?void 0:C.currency,r.amount=(I=t.rowTotalIncludingTax)==null?void 0:I.value,r.currency=(x=t.rowTotalIncludingTax)==null?void 0:x.currency,r.sale=!0,r["aria-label"]=i.discountedPrice,r["data-testid"]="discount-total")):(e.amount=(P=t.total)==null?void 0:P.value,e.currency=(at=t.total)==null?void 0:at.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",r&&(r.amount=(it=t.discountedTotal)==null?void 0:it.value,r.currency=(ct=t.discountedTotal)==null?void 0:ct.currency,r.sale=!0,r["aria-label"]=i.regularPrice,r["data-testid"]="discount-total")),{totalProps:e,discountProps:r}},Qt=t=>{var I,x,P;if(l.includes("warning"))return;const e=A.get(t.uid),r=(I=A.get(t.uid))==null?void 0:I.includes("The requested qty is not available"),f=E.has(t.uid),g=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(x=t.stockLevel)==null?void 0:x.toString()).replace("{count}",t.quantity.toString()):"",p=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(P=t.onlyXLeftInStock)==null?void 0:P.toString()),C=!t.outOfStock&&e&&r?i.notAvailableMessage:e;return!f&&(e||t.insufficientQuantity||t.lowInventory)?h("span",{"data-testid":"item-warning",children:[n(z,{source:ne,size:"16"}),C||g||p]}):void 0},Gt=t=>l!=null&&l.includes("alert")?void 0:!E.has(t.uid)&&t.outOfStock?h("span",{"data-testid":"item-alert",children:[n(z,{source:dt,size:"16"}),i.outOfStockAlert]}):void 0,Vt=t=>n(w,{name:"ProductAttributes",slot:c==null?void 0:c.ProductAttributes,context:{item:t}}),bt=t=>{if(!l.includes("sku"))return n("span",{"data-testid":"cart-list-item-sku",children:t.sku})},Xt=t=>n(w,{name:"Footer",slot:c==null?void 0:c.Footer,context:{item:t}}),R=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,r)=>{var p;const{totalProps:f,discountProps:g}=At(e);return n(Jt,{updating:E==null?void 0:E.has(e.uid),loading:B,"data-testid":`cart-list-item-entry-${e.uid}`,image:Et(e,r),title:It(e),sku:bt(e),price:l.includes("price")?void 0:n(O,{...Pt(e)}),quantity:l.includes("quantity")?void 0:e.quantity,total:h(X,{children:[l.includes("total")?void 0:n(O,{...f}),l.includes("totalDiscount")?void 0:g&&n(O,{...g})]}),attributes:Vt(e),configurations:xt(e),totalExcludingTax:l.includes("totalExcludingTax")?void 0:Ot(e),taxIncluded:(s==null?void 0:s.price)==="INCLUDING_TAX",taxExcluded:!l.includes("totalExcludingTax")&&(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX",warning:Qt(e),alert:Gt(e),quantityType:vt,dropdownOptions:pt,onQuantity:T?C=>{M(e,C)}:void 0,onRemove:j?()=>M(e,0):void 0,discount:ht&&e.discounted&&e.discountPercentage?n("div",{"data-testid":"item-discount-percent",children:i.discountPercent.replace("{discount}",((p=e.discountPercentage)==null?void 0:p.toString())??"")}):void 0,savings:yt&&e.discounted&&e.savingsAmount?h("div",{children:[n("span",{children:n(O,{...Nt(e)})})," ",i.savingsAmount]}):void 0,footer:Xt(e)},e.uid)}):null,Y=n(w,{name:"EmptyCart",slot:c==null?void 0:c.EmptyCart,context:{},children:n(Mt,{"data-testid":"empty-cart",ctaLinkURL:_==null?void 0:_()})}),H=n(w,{name:"Heading",slot:c==null?void 0:c.Heading,context:{count:a==null?void 0:a.totalQuantity},children:n("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),jt=H.props.children.props.children,$t=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{M(e,0)})},Zt=R(t=>t.outOfStock||t.insufficientQuantity||!1),D=a!=null&&a.hasOutOfStockItems?n(qt,{"data-testid":"cart-out-of-stock-message",icon:n(z,{source:dt,size:"16"}),itemList:n(lt,{"data-testid":"out-of-stock-cart-items",children:Zt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&j?[{label:i.removeAction,onClick:$t}]:void 0}):void 0,G=R(t=>!t.outOfStock&&!t.insufficientQuantity),tt=Q?Math.max(m||5,5):Math.min((a==null?void 0:a.totalQuantity)||5,5),et=(a==null?void 0:a.totalQuantity)>tt,Bt=et&&!Q&&tt!=m,V=a!=null&&a.totalQuantity&&G?n(w,{name:"Footer",slot:c==null?void 0:c.CartSummaryFooter,context:{displayMaxItems:Q,routeCart:u},"data-testid":"cart-cart-summary-footer-slot",children:n("div",{"data-testid":"cart-cart-summary-footer",children:et?Bt?n(U,{className:"cart-cart-summary-list-footer__action",onClick:St,"data-testid":"view-more-items-button",variant:"tertiary",children:i.viewMore}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-or-less-items-button",children:i.viewAll}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-button",children:i.viewAll})})}):null,nt=a!=null&&a.totalQuantity?n(lt,{"data-testid":"cart-list",children:G==null?void 0:G.slice(0,Q?Math.max(m||(a==null?void 0:a.totalQuantity),5):Math.min(m??5,5))}):null;return ft?n(Tt,{"data-testid":"cart-summary-list-accordion",className:L(["cart-cart-summary-list-accordion",`cart-cart-summary-list__background--${Z}`]),iconOpen:ee,iconClose:Dt,children:n(Wt,{title:jt,"data-testid":"cart-summary-list-accordion__section",open:!0,renderContentWhenClosed:!0,children:n(gt,{...J,"aria-expanded":!0,"aria-label":"TEST",className:"cart-cart-summary-list-accordion__list",loading:B,footer:k?void 0:V||(u?V:void 0),emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})})}):n(gt,{...J,heading:q?void 0:H,footer:k?void 0:V||(u?V:void 0),loading:B,emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})};ae.getInitialData=async function(){return Rt()};export{ae as C}; diff --git a/scripts/__dropins__/storefront-cart/chunks/EmptyCart.js b/scripts/__dropins__/storefront-cart/chunks/EmptyCart.js index 2b6aa2762d..81268320a0 100644 --- a/scripts/__dropins__/storefront-cart/chunks/EmptyCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/EmptyCart.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as o}from"@dropins/tools/lib.js";import{IllustratedMessage as i,Icon as s,Button 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(s,{className:"cart-empty-cart__icon",source:p}),action:a?r(m,{"data-testid":"cart-empty-cart-button",size:"medium",variant:"primary",type:"submit",href:a,children:c.cta},"routeHome"):void 0})})};export{g as E}; +import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as o}from"@dropins/tools/lib.js";import{IllustratedMessage as i,Icon as s,Button 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(s,{className:"cart-empty-cart__icon",source:p}),action:a?r(m,{"data-testid":"cart-empty-cart-button",size:"medium",variant:"primary",type:"submit",href:a,children:c.cta},"routeHome"):void 0})})};export{g as E}; diff --git a/scripts/__dropins__/storefront-cart/chunks/MiniCart.js b/scripts/__dropins__/storefront-cart/chunks/MiniCart.js index 8094722c84..a9bd7acde4 100644 --- a/scripts/__dropins__/storefront-cart/chunks/MiniCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/MiniCart.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as e,jsxs as y,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import{useState as E,useEffect as I,useCallback as F}from"@dropins/tools/preact-compat.js";import{classes as b,VComponent as g,Slot as Q}from"@dropins/tools/lib.js";import{g as O}from"./persisted-data.js";import{events as R}from"@dropins/tools/event-bus.js";/* empty css */import{Price as T,Button as w}from"@dropins/tools/components.js";import{useText as G}from"@dropins/tools/i18n.js";import{s as h}from"./resetCart.js";import{a as H,b as V}from"./acdl.js";import{u as X}from"./updateProductsFromCart.js";import"./CartSummaryGrid.js";import{C as j}from"./CartSummaryList.js";import"./OrderSummary.js";const $=({className:_,products:n,orderSummary:i,empty:r,...o})=>e("div",{...o,className:b(["cart-cart",_]),children:y("div",{className:b(["cart-cart__wrapper"]),children:[e("div",{"data-testid":"cart-content",className:b(["cart-cart__content",["cart-cart__content--empty",r||i==null],["cart-cart__content--full-width",r||i==null]]),children:n&&e(g,{node:n})}),n&&i&&e(g,{node:i,className:b(["cart-cart__order-summary"])})]})}),z=({className:_,products:n,subtotal:i,subtotalExcludingTaxes:r,ctas:o,...p})=>{const s=G({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return e("div",{...p,className:b(["cart-mini-cart",_]),children:n&&y(A,{children:[e("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:n}),y("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[i&&y("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[s.subtotal,e(g,{node:i})]}),r&&y("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[s.subtotalExcludingTaxes,e(g,{node:r,className:b(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),o&&e(g,{node:o,className:"cart-mini-cart__footer__ctas"})]})]})})},B=({children:_,routeProduct:n,routeEmptyCartCTA:i,slots:r,showDiscount:o,showSavings:p,quantityType:s,dropdownOptions:C,initialData:u=null,...L})=>{const[l,t]=E(u),[N,a]=E(new Map),v={hasErrors:N.size>0},f=(c,x)=>X([{uid:c,quantity:x}]);I(()=>{const c=R.on("cart/data",x=>{t(x)},{eager:!0});return()=>{c==null||c.off()}},[]),I(()=>{u&&Object.keys(u).length>0&&H(u,h.locale??"en-US")},[u]);const k=r!=null&&r.OrderSummary?e(Q,{name:"OrderSummary",slot:r.OrderSummary,context:{...v}}):void 0,m=c=>f(c,0),M=e(Q,{name:"ProductList",slot:r==null?void 0:r.ProductList,context:{itemQuantityUpdateHandler:f,itemRemoveHandler:m},children:e(j,{"data-testid":"default-cart-summary-list",routeProduct:n,routeEmptyCartCTA:i,initialData:l,enableRemoveItem:!0,enableUpdateItemQuantity:!0,onItemsErrorsChange:a,showMaxItems:!0,showDiscount:o,showSavings:p,quantityType:s,dropdownOptions:C})});return e($,{...L,empty:((l==null?void 0:l.items)&&l.items.length===0)??!0,orderSummary:k,products:M})};B.getInitialData=async function(){return O()};const q=({children:_,initialData:n=null,hideFooter:i=!0,slots:r,routeProduct:o,routeCart:p,routeCheckout:s,routeEmptyCartCTA:C,showDiscount:u,showSavings:L,...l})=>{var S,P,D;const[t,N]=E(n),a=(S=h.config)==null?void 0:S.shoppingCartDisplaySetting;I(()=>{const d=R.on("cart/data",U=>{N(U)},{eager:!0});return()=>{d==null||d.off()}},[]);const v=G({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),f=(d,U)=>X([{uid:d,quantity:U}]),k=d=>f(d,0),m=t==null?void 0:t.hasOutOfStockItems,M=F(()=>{t&&!m&&V(t,h.locale)},[t,m]);I(()=>{n&&Object.keys(n).length>0&&H(n,h.locale||"en-US")},[n]);const c=e(Q,{name:"ProductList",slot:r==null?void 0:r.ProductList,context:{itemQuantityUpdateHandler:f,itemRemoveHandler:k,totalQuantity:t==null?void 0:t.totalQuantity},children:e(j,{"data-testid":"default-cart-summary-list",routeProduct:o,routeEmptyCartCTA:C,initialData:t,maxItems:(P=h.config)==null?void 0:P.miniCartMaxItemsDisplay,showMaxItems:!!((D=h.config)!=null&&D.miniCartMaxItemsDisplay),hideHeading:!(t!=null&&t.totalQuantity),hideFooter:i,enableRemoveItem:!0,showDiscount:u,showSavings:L})}),x=()=>(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return e(z,{...l,subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&e(T,{...x()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?e(T,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,ctas:t!=null&&t.totalQuantity?y("div",{children:[s&&e(w,{"data-testid":"route-checkout-button",variant:"primary",href:m?void 0:s(),disabled:m,"aria-disabled":m,onClick:M,children:v.checkoutLink}),p&&e(w,{"data-testid":"route-cart-button",variant:"tertiary",href:p(),children:v.cartLink})]}):void 0,products:c})};q.getInitialData=async function(){return O()};export{B as C,q as M}; +import{jsx as e,jsxs as y,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import{useState as E,useEffect as I,useCallback as F}from"@dropins/tools/preact-compat.js";import{classes as b,VComponent as g,Slot as Q}from"@dropins/tools/lib.js";import{g as O}from"./persisted-data.js";import{events as R}from"@dropins/tools/event-bus.js";/* empty css */import{Price as T,Button as w}from"@dropins/tools/components.js";import{useText as G}from"@dropins/tools/i18n.js";import{s as h}from"./resetCart.js";import{a as H,b as V}from"./acdl.js";import{u as X}from"./updateProductsFromCart.js";import"./CartSummaryGrid.js";import{C as j}from"./CartSummaryList.js";import"./OrderSummary.js";const $=({className:_,products:n,orderSummary:i,empty:r,...o})=>e("div",{...o,className:b(["cart-cart",_]),children:y("div",{className:b(["cart-cart__wrapper"]),children:[e("div",{"data-testid":"cart-content",className:b(["cart-cart__content",["cart-cart__content--empty",r||i==null],["cart-cart__content--full-width",r||i==null]]),children:n&&e(g,{node:n})}),n&&i&&e(g,{node:i,className:b(["cart-cart__order-summary"])})]})}),z=({className:_,products:n,subtotal:i,subtotalExcludingTaxes:r,ctas:o,...p})=>{const u=G({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return e("div",{...p,className:b(["cart-mini-cart",_]),children:n&&y(A,{children:[e("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:n}),y("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[i&&y("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[u.subtotal,e(g,{node:i})]}),r&&y("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[u.subtotalExcludingTaxes,e(g,{node:r,className:b(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),o&&e(g,{node:o,className:"cart-mini-cart__footer__ctas"})]})]})})},B=({children:_,routeProduct:n,routeEmptyCartCTA:i,slots:r,showDiscount:o,showSavings:p,quantityType:u,dropdownOptions:C,initialData:l=null,...L})=>{const[s,t]=E(l),[N,a]=E(new Map),v={hasErrors:N.size>0,data:s},f=(c,x)=>X([{uid:c,quantity:x}]);I(()=>{const c=R.on("cart/data",x=>{t(x)},{eager:!0});return()=>{c==null||c.off()}},[]),I(()=>{l&&Object.keys(l).length>0&&H(l,h.locale??"en-US")},[l]);const k=r!=null&&r.OrderSummary?e(Q,{name:"OrderSummary",slot:r.OrderSummary,context:{...v}}):void 0,m=c=>f(c,0),M=e(Q,{name:"ProductList",slot:r==null?void 0:r.ProductList,context:{itemQuantityUpdateHandler:f,itemRemoveHandler:m},children:e(j,{"data-testid":"default-cart-summary-list",routeProduct:n,routeEmptyCartCTA:i,initialData:s,enableRemoveItem:!0,enableUpdateItemQuantity:!0,onItemsErrorsChange:a,showMaxItems:!0,showDiscount:o,showSavings:p,quantityType:u,dropdownOptions:C})});return e($,{...L,empty:((s==null?void 0:s.items)&&s.items.length===0)??!0,orderSummary:k,products:M})};B.getInitialData=async function(){return O()};const q=({children:_,initialData:n=null,hideFooter:i=!0,slots:r,routeProduct:o,routeCart:p,routeCheckout:u,routeEmptyCartCTA:C,showDiscount:l,showSavings:L,...s})=>{var S,P,D;const[t,N]=E(n),a=(S=h.config)==null?void 0:S.shoppingCartDisplaySetting;I(()=>{const d=R.on("cart/data",U=>{N(U)},{eager:!0});return()=>{d==null||d.off()}},[]);const v=G({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),f=(d,U)=>X([{uid:d,quantity:U}]),k=d=>f(d,0),m=t==null?void 0:t.hasOutOfStockItems,M=F(()=>{t&&!m&&V(t,h.locale)},[t,m]);I(()=>{n&&Object.keys(n).length>0&&H(n,h.locale||"en-US")},[n]);const c=e(Q,{name:"ProductList",slot:r==null?void 0:r.ProductList,context:{itemQuantityUpdateHandler:f,itemRemoveHandler:k,totalQuantity:t==null?void 0:t.totalQuantity},children:e(j,{"data-testid":"default-cart-summary-list",routeProduct:o,routeEmptyCartCTA:C,initialData:t,maxItems:(P=h.config)==null?void 0:P.miniCartMaxItemsDisplay,showMaxItems:!!((D=h.config)!=null&&D.miniCartMaxItemsDisplay),hideHeading:!(t!=null&&t.totalQuantity),hideFooter:i,enableRemoveItem:!0,showDiscount:l,showSavings:L})}),x=()=>(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return e(z,{...s,subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&e(T,{...x()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?e(T,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,ctas:t!=null&&t.totalQuantity?y("div",{children:[u&&e(w,{"data-testid":"route-checkout-button",variant:"primary",href:m?void 0:u(),disabled:m,"aria-disabled":m,onClick:M,children:v.checkoutLink}),p&&e(w,{"data-testid":"route-cart-button",variant:"tertiary",href:p(),children:v.cartLink})]}):void 0,products:c})};q.getInitialData=async function(){return O()};export{B as C,q as M}; diff --git a/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js b/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js index c39c383dab..e8805cabb5 100644 --- a/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js +++ b/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as p,jsx as e,Fragment as wr}from"@dropins/tools/preact-jsx-runtime.js";import*as Cr from"@dropins/tools/preact-compat.js";import{useState as Y,useEffect as er,useCallback as Ir}from"@dropins/tools/preact-compat.js";import{classes as u,VComponent as l,Slot as vr}from"@dropins/tools/lib.js";import{events as Pr}from"@dropins/tools/event-bus.js";import{g as kr}from"./persisted-data.js";import{s as Nr}from"./resetCart.js";import{g as Er}from"./getEstimatedTotals.js";import{b as Br}from"./acdl.js";import{Accordion as Dr,AccordionSection as Lr,ProgressSpinner as Wr,Divider as Ar,Price as d,Icon as Or,Button as Fr}from"@dropins/tools/components.js";/* empty css */import{S as Gr}from"./ChevronDown.js";import{useText as fr}from"@dropins/tools/i18n.js";import{S as zr}from"./Coupon.js";const Vr=()=>{const[I,A]=Y(!1),[P,m]=Y();return{handleEstimateTotals:(y,h)=>{A(!0);const{shippingCountry:r,shippingState:g="",shippingStateId:N,shippingZip:_=""}=y,S={countryCode:r,postcode:_,region:{region:g,id:N},shipping_method:{carrier_code:(h==null?void 0:h.carrier_code)||"",method_code:(h==null?void 0:h.method_code)||""}};Er(S).then(n=>{var t,E,B,a,f,w,b,x,T,D,L,W,s,O,F,G,z,V,Z,j;n&&m({estimatedTaxTotal:{amount:(t=n.totalTax)==null?void 0:t.value,currency:(E=n.totalTax)==null?void 0:E.currency},estimatedSubTotal:{excludingTax:{amount:(a=(B=n.subtotal)==null?void 0:B.excludingTax)==null?void 0:a.value,currency:(w=(f=n.subtotal)==null?void 0:f.excludingTax)==null?void 0:w.currency},includingTax:{amount:(x=(b=n.subtotal)==null?void 0:b.includingTax)==null?void 0:x.value,currency:(D=(T=n.subtotal)==null?void 0:T.includingTax)==null?void 0:D.currency},includingDiscountOnly:{amount:(W=(L=n.subtotal)==null?void 0:L.includingDiscountOnly)==null?void 0:W.value,currency:(O=(s=n.subtotal)==null?void 0:s.includingDiscountOnly)==null?void 0:O.currency}},estimatedGrandTotalPrice:{includingTax:{amount:(F=n.total)==null?void 0:F.includingTax.value,currency:(G=n.total)==null?void 0:G.includingTax.currency},excludingTax:{amount:(z=n.total)==null?void 0:z.excludingTax.value,currency:(V=n.total)==null?void 0:V.excludingTax.currency}},estimatedAppliedTaxes:{taxes:(Z=n.appliedTaxes)==null?void 0:Z.map(o=>{var C,v;return{label:o.label,amount:{value:(C=o.amount)==null?void 0:C.value,currency:(v=o.amount)==null?void 0:v.currency}}})},estimatedItems:{items:(j=n.items)==null?void 0:j.map(o=>{var C,v,U,Q,X,$,q,H,R,J;return{uid:o.uid,price:{amount:(C=o.price)==null?void 0:C.value,currency:(v=o.price)==null?void 0:v.currency},taxedPrice:{amount:(U=o.taxedPrice)==null?void 0:U.value,currency:(Q=o.taxedPrice)==null?void 0:Q.currency},rowTotal:{amount:(X=o.rowTotal)==null?void 0:X.value,currency:($=o.rowTotal)==null?void 0:$.currency},rowTotalIncludingTax:{amount:(q=o.rowTotalIncludingTax)==null?void 0:q.value,currency:(H=o.rowTotalIncludingTax)==null?void 0:H.currency},regularPrice:{amount:(R=o.regularPrice)==null?void 0:R.value,currency:(J=o.regularPrice)==null?void 0:J.currency}}})}})}).finally(()=>{A(!1)})},estimatedTotals:P,setEstimatedTotals:m,loading:I}},Zr=I=>Cr.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...I},Cr.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),jr=({className:I,children:A,variant:P="primary",heading:m,loading:k=!0,subTotal:y,shipping:h,discounts:r,taxTotal:g,taxesApplied:N,total:_,primaryAction:S,coupons:n,...t})=>{const[E,B]=Y(!1),a=fr({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",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"}),f=y&&p("div",{className:u(["cart-order-summary__entry","cart-order-summary__subTotal"]),children:[e("span",{className:"cart-order-summary__label",children:a.subtotalLabel}),e(l,{node:y.price,className:"cart-order-summary__price"}),y.taxIncluded&&e("div",{"data-testid":"sub-total-tax-caption",className:"cart-order-summary__caption",children:e("span",{children:a.subtotalWithTaxes})}),y.taxExcluded?e("div",{"data-testid":"sub-total-tax-caption-excluded",className:"cart-order-summary__caption",children:p("span",{children:[y.priceExcludingTax," ",a.subtotalWithoutTaxes]})}):void 0]}),w=h&&e(l,{node:h,className:"cart-order-summary__shipping"}),b=n&&e(l,{node:n,className:"cart-order-summary__coupons"}),x=r&&r.length>0&&e(wr,{children:r.map(s=>p("div",{className:u(["cart-order-summary__entry","cart-order-summary__discount"]),children:[e("span",{className:"cart-order-summary__label",children:s.label}),e(l,{node:s.price,className:"cart-order-summary__price"}),s.coupon&&e(l,{node:s.coupon,className:"cart-order-summary__coupon__code"}),s.caption&&e(l,{node:s.caption,className:"cart-order-summary__caption"})]},s.label))}),T=N&&N.length>0?e(Dr,{"data-testid":"tax-breakdown",className:"cart-order-summary__taxes",iconOpen:Gr,iconClose:Zr,children:p(Lr,{title:a.taxesBreakdownTitle,secondaryText:!E&&g?e(l,{node:g.price,className:"cart-order-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:B,children:[e("div",{className:"cart-order-summary__appliedTaxes",children:N.map(s=>p("div",{className:u(["cart-order-summary__entry","cart-order-summary__taxEntry"]),children:[e("span",{className:u(["cart-order-summary__label","cart-order-summary__label--muted"]),children:s.label}),e(l,{node:s.price,className:u(["cart-order-summary__price","cart-order-summary__price--muted"])})]},s.label))}),p("div",{className:u(["cart-order-summary__entry","cart-order-summary__taxTotal"]),children:[e("span",{className:"cart-order-summary__label",children:a.taxTotal}),g&&e(l,{node:g.price,className:"cart-order-summary__price"})]})]})}):g&&p("div",{"data-testid":"tax-total-only",className:u(["cart-order-summary__entry","cart-order-summary__taxTotal"]),children:[e("span",{className:"cart-order-summary__label",children:g.estimated?a.taxEstimated:a.taxTotalOnly}),e(l,{node:g.price,className:"cart-order-summary__price"})]}),D=_&&p("div",{"data-testid":"total-content",className:u(["cart-order-summary__entry","cart-order-summary__total",_.estimated&&"cart-order-summary__total--padded"]),children:[e("span",{className:u(["cart-order-summary__label","cart-order-summary__label--bold"]),children:_.estimated?a.totalEstimated:a.totalLabel}),e(l,{node:_.price,className:u(["cart-order-summary__price","cart-order-summary__price--bold"])})]}),L=_&&_.priceWithoutTax&&p("div",{"data-testid":"total-without-tax",className:u(["cart-order-summary__entry","cart-order-summary__totalWithoutTax"]),children:[e("span",{className:u(["cart-order-summary__label","cart-order-summary__label--muted"]),children:a.totalWithoutTax}),e(l,{node:_.priceWithoutTax,className:u(["cart-order-summary__price","cart-order-summary__price--muted"])})]}),W=S&&e("div",{className:u(["cart-order-summary__entry","cart-order-summary__primaryAction"]),children:S});return p("div",{...t,className:u(["cart-order-summary",["cart-order-summary--loading",k],[`cart-order-summary__${P}`,P],I]),children:[k&&e(Wr,{className:"cart-order-summary__spinner"}),p("div",{className:"cart-order-summary__heading",children:[m&&e(l,{node:m,className:"cart-order-summary__heading-text"}),e(Ar,{variant:"primary",className:"cart-order-summary__divider-primary"})]}),p("div",{className:"cart-order-summary__content",children:[f,w,x,T,D,L,W,b]})]})},Ur=({children:I,initialData:A=null,routeCheckout:P,slots:m,errors:k,enableCoupons:y,...h})=>{var s,O,F,G,z,V,Z,j,o,C,v,U,Q,X,$,q,H,R,J,tr,ar,ir,nr,cr,or,sr,ur,mr,lr,dr,pr,xr,yr,hr;const[r,g]=Y(A),[N,_]=Y(!1),S=r==null?void 0:r.isVirtual;y=y??!0;const{handleEstimateTotals:n,estimatedTotals:t,setEstimatedTotals:E,loading:B}=Vr(),a=(s=Nr.config)==null?void 0:s.shoppingCartDisplaySetting,f=(a==null?void 0:a.subtotal)==="INCLUDING_TAX",w=(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX",b=a==null?void 0:a.zeroTax;er(()=>{const c=Pr.on("cart/data",i=>{var K;g(i);const M=(K=i==null?void 0:i.addresses)==null?void 0:K.shipping,rr=i==null?void 0:i.isVirtual;(M||rr)&&E(null)},{eager:!0});return()=>{c==null||c.off()}},[]),er(()=>{_(k)},[k]),er(()=>{const c=Pr.on("shipping/estimate",i=>{var K,gr,_r,Tr,br,Sr;const M={shippingCountry:(K=i==null?void 0:i.address)==null?void 0:K.countryCode,shippingState:(gr=i==null?void 0:i.address)==null?void 0:gr.region,shippingStateId:(_r=i==null?void 0:i.address)==null?void 0:_r.regionId,shippingZip:(Tr=i==null?void 0:i.address)==null?void 0:Tr.postCode},rr={carrier_code:((br=i==null?void 0:i.shippingMethod)==null?void 0:br.carrierCode)||"",method_code:((Sr=i==null?void 0:i.shippingMethod)==null?void 0:Sr.methodCode)||""};n(M,rr)});return()=>{c==null||c.off()}},[n]);const x=fr({checkout:"Cart.PriceSummary.checkout",free:"Cart.PriceSummary.total.free",orderSummary:"Cart.PriceSummary.orderSummary",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined"}),T=(r==null?void 0:r.hasOutOfStockItems)||N,D=Ir(()=>{!T&&r&&Br(r,Nr.locale)},[T,r]),L=!S&&(m!=null&&m.EstimateShipping)?e(vr,{name:"EstimateShipping",slot:m.EstimateShipping},"estimateShippingId"):void 0;if(!Object.keys(r??{}).length||(r==null?void 0:r.totalQuantity)===0)return null;const W=y&&(m!=null&&m.Coupons)?e(vr,{name:"Coupons",slot:m.Coupons},"couponsId"):void 0;return e(jr,{...h,"data-testid":"cart-order-summary",heading:e("div",{children:x.orderSummary}),shipping:L,coupons:W,loading:B,subTotal:{taxIncluded:f&&!b,taxExcluded:w,zeroTaxSubtotal:b,priceExcludingTax:(O=t==null?void 0:t.estimatedSubTotal)!=null&&O.excludingTax?e(d,{"data-testid":"subtotal",...(F=t==null?void 0:t.estimatedSubTotal)==null?void 0:F.excludingTax}):e(d,{"data-testid":"subtotal",amount:(z=(G=r==null?void 0:r.subtotal)==null?void 0:G.excludingTax)==null?void 0:z.value,currency:(Z=(V=r==null?void 0:r.subtotal)==null?void 0:V.excludingTax)==null?void 0:Z.currency}),price:!b&&f||!b&&w?(j=t==null?void 0:t.estimatedSubTotal)!=null&&j.includingTax?e(d,{"data-testid":"subtotal",...(o=t==null?void 0:t.estimatedSubTotal)==null?void 0:o.includingTax}):e(d,{"data-testid":"subtotal",amount:(C=r==null?void 0:r.subtotal.includingTax)==null?void 0:C.value,currency:(v=r==null?void 0:r.subtotal.includingTax)==null?void 0:v.currency}):e(d,{"data-testid":"subtotal",amount:(Q=(U=r==null?void 0:r.subtotal)==null?void 0:U.excludingTax)==null?void 0:Q.value,currency:($=(X=r==null?void 0:r.subtotal)==null?void 0:X.excludingTax)==null?void 0:$.currency})},discounts:(q=r==null?void 0:r.appliedDiscounts)==null?void 0:q.map(c=>{var i;return{label:c.label,price:e(d,{"data-testid":"summary-discount-total",amount:-c.amount.value,currency:c.amount.currency,sale:!0}),coupon:c!=null&&c.coupon?p("span",{children:[e(Or,{source:zr,size:"16"}),(i=c==null?void 0:c.coupon)==null?void 0:i.code]}):void 0}}),taxTotal:S?{price:e("span",{"data-testid":"tax-total",children:x.taxToBeDetermined})}:{price:t!=null&&t.estimatedTaxTotal?e(d,{"data-testid":"tax-total",...t==null?void 0:t.estimatedTaxTotal}):e(d,{"data-testid":"tax-total",amount:(H=r==null?void 0:r.totalTax)==null?void 0:H.value,currency:(R=r==null?void 0:r.totalTax)==null?void 0:R.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((J=r==null?void 0:r.addresses)!=null&&J.shipping)},taxesApplied:S?void 0:a!=null&&a.fullSummary?(ar=((tr=t==null?void 0:t.estimatedAppliedTaxes)==null?void 0:tr.taxes)||(r==null?void 0:r.appliedTaxes))==null?void 0:ar.map(c=>({label:c.label,price:e(d,{"data-testid":"applied-taxes",amount:c.amount.value,currency:c.amount.currency})})):void 0,total:{price:t!=null&&t.estimatedGrandTotalPrice?((nr=(ir=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:ir.includingTax)==null?void 0:nr.amount)===0?e("span",{"data-testid":"total-including-tax",children:x.free}):e(d,{"data-testid":"total-including-tax",...(cr=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:cr.includingTax}):((or=r==null?void 0:r.total)==null?void 0:or.includingTax.value)===0?e("span",{"data-testid":"total-including-tax",children:x.free}):e(d,{"data-testid":"total-including-tax",amount:(sr=r==null?void 0:r.total)==null?void 0:sr.includingTax.value,currency:(ur=r==null?void 0:r.total)==null?void 0:ur.includingTax.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((mr=r==null?void 0:r.addresses)!=null&&mr.shipping),priceWithoutTax:a!=null&&a.grandTotal?t!=null&&t.estimatedAppliedTaxes?((dr=(lr=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:lr.excludingTax)==null?void 0:dr.amount)===0?e("span",{"data-testid":"total-excluding-tax",children:x.free}):e(d,{"data-testid":"total-excluding-tax",...(pr=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:pr.excludingTax}):((xr=r==null?void 0:r.total)==null?void 0:xr.excludingTax.value)===0?e("span",{"data-testid":"total-excluding-tax",children:x.free}):e(d,{"data-testid":"total-excluding-tax",amount:(yr=r==null?void 0:r.total)==null?void 0:yr.excludingTax.value,currency:(hr=r==null?void 0:r.total)==null?void 0:hr.excludingTax.currency}):void 0},primaryAction:P&&e(Fr,{"data-testid":"checkout-button",variant:"primary",disabled:T,"aria-disabled":T,href:T?void 0:P({cartId:r.id}),onClick:D,children:x.checkout})})};Ur.getInitialData=async function(){return kr()};export{Ur as O}; +import{jsxs as E,jsx as r,Fragment as We}from"@dropins/tools/preact-jsx-runtime.js";import*as Ie from"@dropins/tools/preact-compat.js";import{useState as ee,useEffect as ie,useCallback as Fe}from"@dropins/tools/preact-compat.js";import{VComponent as D,classes as ke,Slot as we}from"@dropins/tools/lib.js";import{events as Ee}from"@dropins/tools/event-bus.js";import{g as Ge}from"./persisted-data.js";import{s as Oe}from"./resetCart.js";import{g as ze}from"./getEstimatedTotals.js";import{b as Ve}from"./acdl.js";import{Accordion as Ne,AccordionSection as Be,ProgressSpinner as Ze,Divider as je,Price as l,Icon as Ue,Button as Qe}from"@dropins/tools/components.js";/* empty css */import{O as v}from"./OrderSummaryLine.js";import{S as Le}from"./ChevronDown.js";import{useText as Ae}from"@dropins/tools/i18n.js";import{S as Xe}from"./Coupon.js";const De=O=>Ie.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...O},Ie.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$e=({className:O,children:A,variant:P="primary",heading:s,loading:N=!0,subTotal:g,shipping:m,discounts:_,taxTotal:x,taxesApplied:e,total:p,primaryAction:B,coupons:o,totalSaved:y,updateLineItems:I=S=>S,...t})=>{const[S,L]=ee(!1),i=Ae({checkout:"Cart.PriceSummary.checkout",discountedPrice:"Cart.CartItem.discountedPrice",download:"Cart.CartItem.download",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",regularPrice:"Cart.CartItem.regularPrice",recipient:"Cart.CartItem.recipient",sender:"Cart.CartItem.sender",file:"Cart.CartItem.file",files:"Cart.CartItem.files",orderSummary:"Cart.PriceSummary.orderSummary",taxesBreakdownTitle:"Cart.PriceSummary.taxes.breakdown",taxTotal:"Cart.PriceSummary.taxes.total",taxEstimated:"Cart.PriceSummary.taxes.estimated",taxTotalOnly:"Cart.PriceSummary.taxes.totalOnly",showTaxBreakdown:"Cart.PriceSummary.taxes.showBreakdown",hideTaxBreakdown:"Cart.PriceSummary.taxes.hideBreakdown",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",subtotalLabel:"Cart.PriceSummary.subTotal.label",subtotalWithTaxes:"Cart.PriceSummary.subTotal.withTaxes",subtotalWithoutTaxes:"Cart.PriceSummary.subTotal.withoutTaxes",totalEstimated:"Cart.PriceSummary.total.estimated",totalLabel:"Cart.PriceSummary.total.label",totalWithoutTax:"Cart.PriceSummary.total.withoutTax",totalSaved:"Cart.PriceSummary.total.saved",shippingLabel:"Cart.PriceSummary.shipping.label",zipPlaceholder:"Cart.PriceSummary.shipping.zipPlaceholder",editZipAction:"Cart.PriceSummary.shipping.editZipAction",shippingWithTaxes:"Cart.PriceSummary.shipping.withTaxes",shippingWithoutTaxes:"Cart.PriceSummary.shipping.withoutTaxes",shippingEstimated:"Cart.PriceSummary.shipping.estimated",shippingEstimatedByState:"Cart.PriceSummary.shipping.alternateField.state",shippingEstimatedByZip:"Cart.PriceSummary.shipping.alternateField.zip",destinationLinkAriaLabel:"Cart.PriceSummary.shipping.destinationLinkAriaLabel",applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"}),k=g&&E(v,{label:i.subtotalLabel,price:g.price,classSuffixes:["subTotal"],children:[g.taxIncluded&&r("div",{"data-testid":"sub-total-tax-caption",className:"cart-order-summary__caption",children:r("span",{children:i.subtotalWithTaxes})}),g.taxExcluded?r("div",{"data-testid":"sub-total-tax-caption-excluded",className:"cart-order-summary__caption",children:E("span",{children:[g.priceExcludingTax," ",i.subtotalWithoutTaxes]})}):void 0]}),w=_&&_.length>0&&r(We,{children:_.map(n=>E(v,{label:n.label,price:n.price,classSuffixes:["discount"],children:[n.coupon&&r(D,{node:n.coupon,className:"cart-order-summary__coupon__code"}),n.caption&&r(D,{node:n.caption,className:"cart-order-summary__caption"})]}))}),T=e&&e.length>0?r(Ne,{"data-testid":"tax-breakdown",className:"cart-order-summary__taxes",iconOpen:Le,iconClose:De,children:E(Be,{title:i.taxesBreakdownTitle,secondaryText:!S&&x?r(D,{node:x.price,className:"cart-order-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:L,children:[r("div",{className:"cart-order-summary__appliedTaxes",children:e.map(n=>r(v,{label:n.label,price:n.price,classSuffixes:["taxEntry"],labelClassSuffix:"muted"}))}),x&&r(v,{label:i.taxTotal,price:x.price,classSuffixes:["taxTotal"],labelClassSuffix:"muted"})]})}):x&&r(v,{label:x.estimated?i.taxEstimated:i.taxTotalOnly,price:x.price,classSuffixes:["taxTotal"],testId:"tax-total-only"}),d=[{key:"subTotalContent",sortOrder:100,content:k},...m?[{key:"shippingContent",sortOrder:200,content:r(D,{node:m,className:"cart-order-summary__shipping"})}]:[],{key:"discountsContent",sortOrder:300,content:w},{key:"taxContent",sortOrder:400,content:T},...p?[{key:"taxContent",sortOrder:500,content:r(v,{label:p.estimated?i.totalEstimated:i.totalLabel,price:p.price,classSuffixes:["total","total--padded"],testId:"total-content",labelClassSuffix:"bold"})}]:[],...p&&p.priceWithoutTax?[{key:"totalWithoutTaxContent",sortOrder:600,content:r(v,{label:i.totalWithoutTax,price:p.priceWithoutTax,classSuffixes:["totalWithoutTax"],testId:"total-without-tax",labelClassSuffix:"muted"})}]:[],...y?[{key:"totalSavedContent",sortOrder:700,content:r(v,{label:i.totalSaved,price:y,classSuffixes:["saved"],testId:"total-saved",labelClassSuffix:"muted"})}]:[],...B?[{key:"primaryActionContent",sortOrder:800,content:r("div",{className:ke(["cart-order-summary__entry","cart-order-summary__primaryAction"]),children:B})}]:[],...o?[{key:"couponsContent",sortOrder:900,content:r(D,{node:o,className:"cart-order-summary__coupons"})}]:[]],h=I(d).sort((n,C)=>n.sortOrder-C.sortOrder);return E("div",{...t,className:ke(["cart-order-summary",["cart-order-summary--loading",N],[`cart-order-summary__${P}`,P],O]),children:[N&&r(Ze,{className:"cart-order-summary__spinner"}),E("div",{className:"cart-order-summary__heading",children:[s&&r(D,{node:s,className:"cart-order-summary__heading-text"}),r(je,{variant:"primary",className:"cart-order-summary__divider-primary"})]}),r("div",{className:"cart-order-summary__content",children:h.map(n=>Array.isArray(n.content)?r(Ne,{className:n.className,actionIconPosition:"right",iconOpen:Le,iconClose:De,children:r(Be,{defaultOpen:!1,title:n.title,renderContentWhenClosed:!1,children:n.content.map(C=>C.content)})}):n.content)})]})},qe=()=>{const[O,A]=ee(!1),[P,s]=ee();return{handleEstimateTotals:(g,m)=>{A(!0);const{shippingCountry:_,shippingState:x="",shippingStateId:e,shippingZip:p=""}=g,B={countryCode:_,postcode:p,region:{region:x,id:e},shipping_method:{carrier_code:(m==null?void 0:m.carrier_code)||"",method_code:(m==null?void 0:m.method_code)||""}};ze(B).then(o=>{var y,I,t,S,L,i,k,w,T,d,h,n,C,te,W,F,G,z,V,Z;o&&s({estimatedTaxTotal:{amount:(y=o.totalTax)==null?void 0:y.value,currency:(I=o.totalTax)==null?void 0:I.currency},estimatedSubTotal:{excludingTax:{amount:(S=(t=o.subtotal)==null?void 0:t.excludingTax)==null?void 0:S.value,currency:(i=(L=o.subtotal)==null?void 0:L.excludingTax)==null?void 0:i.currency},includingTax:{amount:(w=(k=o.subtotal)==null?void 0:k.includingTax)==null?void 0:w.value,currency:(d=(T=o.subtotal)==null?void 0:T.includingTax)==null?void 0:d.currency},includingDiscountOnly:{amount:(n=(h=o.subtotal)==null?void 0:h.includingDiscountOnly)==null?void 0:n.value,currency:(te=(C=o.subtotal)==null?void 0:C.includingDiscountOnly)==null?void 0:te.currency}},estimatedGrandTotalPrice:{includingTax:{amount:(W=o.total)==null?void 0:W.includingTax.value,currency:(F=o.total)==null?void 0:F.includingTax.currency},excludingTax:{amount:(G=o.total)==null?void 0:G.excludingTax.value,currency:(z=o.total)==null?void 0:z.excludingTax.currency}},estimatedAppliedTaxes:{taxes:(V=o.appliedTaxes)==null?void 0:V.map(u=>{var b,f;return{label:u.label,amount:{value:(b=u.amount)==null?void 0:b.value,currency:(f=u.amount)==null?void 0:f.currency}}})},estimatedItems:{items:(Z=o.items)==null?void 0:Z.map(u=>{var b,f,j,U,Q,X,$,q,H,R;return{uid:u.uid,price:{amount:(b=u.price)==null?void 0:b.value,currency:(f=u.price)==null?void 0:f.currency},taxedPrice:{amount:(j=u.taxedPrice)==null?void 0:j.value,currency:(U=u.taxedPrice)==null?void 0:U.currency},rowTotal:{amount:(Q=u.rowTotal)==null?void 0:Q.value,currency:(X=u.rowTotal)==null?void 0:X.currency},rowTotalIncludingTax:{amount:($=u.rowTotalIncludingTax)==null?void 0:$.value,currency:(q=u.rowTotalIncludingTax)==null?void 0:q.currency},regularPrice:{amount:(H=u.regularPrice)==null?void 0:H.value,currency:(R=u.regularPrice)==null?void 0:R.currency}}})}})}).finally(()=>{A(!1)})},estimatedTotals:P,setEstimatedTotals:s,loading:O}},He=({children:O,initialData:A=null,routeCheckout:P,slots:s,errors:N,showTotalSaved:g,enableCoupons:m,updateLineItems:_=e=>e,...x})=>{var W,F,G,z,V,Z,u,b,f,j,U,Q,X,$,q,H,R,ne,ce,oe,ue,se,le,me,de,xe,pe,he,ge,ye,Se,Te,Ce,be,fe,ve;const[e,p]=ee(A),[B,o]=ee(!1),y=e==null?void 0:e.isVirtual;m=m??!0;const{handleEstimateTotals:I,estimatedTotals:t,setEstimatedTotals:S,loading:L}=qe(),i=(W=Oe.config)==null?void 0:W.shoppingCartDisplaySetting,k=(i==null?void 0:i.subtotal)==="INCLUDING_TAX",w=(i==null?void 0:i.subtotal)==="INCLUDING_EXCLUDING_TAX",T=i==null?void 0:i.zeroTax;ie(()=>{const c=Ee.on("cart/data",a=>{var J,K,Y,M;p(a);const re=(J=a==null?void 0:a.addresses)==null?void 0:J.shipping,ae=a==null?void 0:a.isVirtual;(re||ae)&&S(null),((K=a==null?void 0:a.totalTax)==null?void 0:K.value)>0&&t===void 0&&S({estimatedTaxTotal:{amount:(Y=a==null?void 0:a.totalTax)==null?void 0:Y.value,currency:(M=a==null?void 0:a.totalTax)==null?void 0:M.currency}})},{eager:!0});return()=>{c==null||c.off()}},[]),ie(()=>{o(N)},[N]),ie(()=>{const c=Ee.on("shipping/estimate",a=>{var J,K,Y,M,Pe,_e;const re={shippingCountry:(J=a==null?void 0:a.address)==null?void 0:J.countryCode,shippingState:(K=a==null?void 0:a.address)==null?void 0:K.region,shippingStateId:(Y=a==null?void 0:a.address)==null?void 0:Y.regionId,shippingZip:(M=a==null?void 0:a.address)==null?void 0:M.postCode},ae={carrier_code:((Pe=a==null?void 0:a.shippingMethod)==null?void 0:Pe.carrierCode)||"",method_code:((_e=a==null?void 0:a.shippingMethod)==null?void 0:_e.methodCode)||""};I(re,ae)});return()=>{c==null||c.off()}},[I]);const d=Ae({checkout:"Cart.PriceSummary.checkout",free:"Cart.PriceSummary.total.free",orderSummary:"Cart.PriceSummary.orderSummary",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined"}),h=(e==null?void 0:e.hasOutOfStockItems)||B,n=Fe(()=>{!h&&e&&Ve(e,Oe.locale)},[h,e]),C=!y&&(s!=null&&s.EstimateShipping)?r(we,{name:"EstimateShipping",slot:s.EstimateShipping},"estimateShippingId"):void 0;if(!Object.keys(e??{}).length||(e==null?void 0:e.totalQuantity)===0)return null;const te=m&&(s!=null&&s.Coupons)?r(we,{name:"Coupons",slot:s.Coupons},"couponsId"):void 0;return r($e,{...x,"data-testid":"cart-order-summary",heading:r("div",{children:d.orderSummary}),shipping:C,coupons:te,loading:L,updateLineItems:_,subTotal:{taxIncluded:k&&!T,taxExcluded:w,zeroTaxSubtotal:T,priceExcludingTax:(F=t==null?void 0:t.estimatedSubTotal)!=null&&F.excludingTax?r(l,{"data-testid":"subtotal",...(G=t==null?void 0:t.estimatedSubTotal)==null?void 0:G.excludingTax}):r(l,{"data-testid":"subtotal",amount:(V=(z=e==null?void 0:e.subtotal)==null?void 0:z.excludingTax)==null?void 0:V.value,currency:(u=(Z=e==null?void 0:e.subtotal)==null?void 0:Z.excludingTax)==null?void 0:u.currency}),price:!T&&k||!T&&w?(b=t==null?void 0:t.estimatedSubTotal)!=null&&b.includingTax?r(l,{"data-testid":"subtotal",...(f=t==null?void 0:t.estimatedSubTotal)==null?void 0:f.includingTax}):r(l,{"data-testid":"subtotal",amount:(j=e==null?void 0:e.subtotal.includingTax)==null?void 0:j.value,currency:(U=e==null?void 0:e.subtotal.includingTax)==null?void 0:U.currency}):r(l,{"data-testid":"subtotal",amount:(X=(Q=e==null?void 0:e.subtotal)==null?void 0:Q.excludingTax)==null?void 0:X.value,currency:(q=($=e==null?void 0:e.subtotal)==null?void 0:$.excludingTax)==null?void 0:q.currency})},discounts:(H=e==null?void 0:e.appliedDiscounts)==null?void 0:H.map(c=>{var a;return{label:c.label,price:r(l,{"data-testid":"summary-discount-total",amount:-c.amount.value,currency:c.amount.currency,sale:!0}),coupon:c!=null&&c.coupon?E("span",{children:[r(Ue,{source:Xe,size:"16"}),(a=c==null?void 0:c.coupon)==null?void 0:a.code]}):void 0}}),taxTotal:y||(t==null?void 0:t.estimatedTaxTotal)===void 0?{price:r("span",{"data-testid":"tax-total",children:d.taxToBeDetermined})}:{price:t!=null&&t.estimatedTaxTotal?r(l,{"data-testid":"tax-total",...t==null?void 0:t.estimatedTaxTotal}):r(l,{"data-testid":"tax-total",amount:(R=e==null?void 0:e.totalTax)==null?void 0:R.value,currency:(ne=e==null?void 0:e.totalTax)==null?void 0:ne.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((ce=e==null?void 0:e.addresses)!=null&&ce.shipping)},taxesApplied:y?void 0:i!=null&&i.fullSummary?(ue=((oe=t==null?void 0:t.estimatedAppliedTaxes)==null?void 0:oe.taxes)||(e==null?void 0:e.appliedTaxes))==null?void 0:ue.map(c=>({label:c.label,price:r(l,{"data-testid":"applied-taxes",amount:c.amount.value,currency:c.amount.currency})})):void 0,total:{price:t!=null&&t.estimatedGrandTotalPrice?((le=(se=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:se.includingTax)==null?void 0:le.amount)===0?r("span",{"data-testid":"total-including-tax",children:d.free}):r(l,{"data-testid":"total-including-tax",...(me=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:me.includingTax}):((de=e==null?void 0:e.total)==null?void 0:de.includingTax.value)===0?r("span",{"data-testid":"total-including-tax",children:d.free}):r(l,{"data-testid":"total-including-tax",amount:(xe=e==null?void 0:e.total)==null?void 0:xe.includingTax.value,currency:(pe=e==null?void 0:e.total)==null?void 0:pe.includingTax.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((he=e==null?void 0:e.addresses)!=null&&he.shipping),priceWithoutTax:i!=null&&i.grandTotal?t!=null&&t.estimatedAppliedTaxes?((ye=(ge=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:ge.excludingTax)==null?void 0:ye.amount)===0?r("span",{"data-testid":"total-excluding-tax",children:d.free}):r(l,{"data-testid":"total-excluding-tax",...(Se=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:Se.excludingTax}):((Te=e==null?void 0:e.total)==null?void 0:Te.excludingTax.value)===0?r("span",{"data-testid":"total-excluding-tax",children:d.free}):r(l,{"data-testid":"total-excluding-tax",amount:(Ce=e==null?void 0:e.total)==null?void 0:Ce.excludingTax.value,currency:(be=e==null?void 0:e.total)==null?void 0:be.excludingTax.currency}):void 0},primaryAction:P&&r(Qe,{"data-testid":"checkout-button",variant:"primary",disabled:h,"aria-disabled":h,href:h?void 0:P({cartId:e.id}),onClick:n,children:d.checkout}),totalSaved:g?r(l,{amount:(fe=e==null?void 0:e.discount)==null?void 0:fe.value,currency:(ve=e==null?void 0:e.total)==null?void 0:ve.includingTax.currency}):void 0})};He.getInitialData=async function(){return Ge()};export{He as O}; diff --git a/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js b/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js new file mode 100644 index 0000000000..1a232a3f14 --- /dev/null +++ b/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{jsxs as _,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{classes as c,VComponent as y}from"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";const u=({label:e,price:a,classSuffixes:s=[],labelClassSuffix:r,testId:m,children:o,...t})=>{const d="cart-order-summary__label",p="cart-order-summary__price";return _("div",{...t,...m?{"data-testid":m}:{},className:c(["cart-order-summary__entry",...s.map(i=>"cart-order-summary__"+i)]),children:[n("span",{className:c([d,...r?[d+"--"+r]:[]]),children:e}),n(y,{node:a,className:c([p,...r?[p+"--"+r]:[]])}),o]})},L=({label:e,price:a,classSuffixes:s=[],labelClassSuffix:r,testId:m,children:o,...t})=>n(u,{...t,label:e,price:a,classSuffixes:s,labelClassSuffix:r,testId:m,children:o});export{L as O}; diff --git a/scripts/__dropins__/storefront-cart/chunks/getStoreConfig.js b/scripts/__dropins__/storefront-cart/chunks/getStoreConfig.js index 81f44422ad..b56c384455 100644 --- a/scripts/__dropins__/storefront-cart/chunks/getStoreConfig.js +++ b/scripts/__dropins__/storefront-cart/chunks/getStoreConfig.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{events as p}from"@dropins/tools/event-bus.js";import{s,d as R,f,h as d}from"./resetCart.js";import{Initializer as w,merge as G}from"@dropins/tools/lib.js";import{CART_FRAGMENT as h}from"../fragments.js";import{a as M}from"./persisted-data.js";const O=new w({init:async r=>{const t={disableGuestCart:!1,...r};O.config.setConfig(t),y().catch(console.error)},listeners:()=>[p.on("authenticated",r=>{s.authenticated&&!r?p.emit("cart/reset",void 0):r&&!s.authenticated&&(s.authenticated=r,y().catch(console.error))},{eager:!0}),p.on("locale",async r=>{r!==s.locale&&(s.locale=r,y().catch(console.error))}),p.on("cart/reset",()=>{R().catch(console.error),p.emit("cart/data",null)}),p.on("cart/data",r=>{M(r)})]}),A=O.config;function I(r){var n,e,c,u,i,l,o,a,_,g;if(!r)return null;const t={id:r.id,totalQuantity:P(r),errors:U(r==null?void 0:r.itemsV2),items:S(r==null?void 0:r.itemsV2),miniCartMaxItems:S(r==null?void 0:r.itemsV2).slice(0,((n=s.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency},excludingTax:{value:r.prices.grand_total_excluding_tax.value,currency:r.prices.grand_total_excluding_tax.currency}},subtotal:{excludingTax:{value:(e=r.prices.subtotal_excluding_tax)==null?void 0:e.value,currency:(c=r.prices.subtotal_excluding_tax)==null?void 0:c.currency},includingTax:{value:(u=r.prices.subtotal_including_tax)==null?void 0:u.value,currency:(i=r.prices.subtotal_including_tax)==null?void 0:i.currency},includingDiscountOnly:{value:(l=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:l.value,currency:(o=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:o.currency}},appliedTaxes:E(r.prices.applied_taxes),totalTax:N(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:E(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&$(r)},isGuestCart:!s.authenticated,hasOutOfStockItems:Q(r),hasFullyOutOfStockItems:L(r),appliedCoupons:r.applied_coupons};return G(t,(g=(_=(a=A.getConfig().models)==null?void 0:a.CartModel)==null?void 0:_.transformer)==null?void 0:g.call(_,r))}function N(r,t){return r!=null&&r.length?r.reduce((n,e)=>({value:n.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:t}):{value:0,currency:t}}function S(r){var n;if(!((n=r==null?void 0:r.items)!=null&&n.length))return[];const t=s.config;return r.items.map(e=>{var c,u,i,l,o,a,_,g,x,v,T;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(m=>m.url_key)},quantity:e.quantity,sku:e.product.sku,name:e.product.name,image:{src:t!=null&&t.useConfigurableParentThumbnail?e.product.thumbnail.url:((u=(c=e.configured_variant)==null?void 0:c.thumbnail)==null?void 0:u.url)||e.product.thumbnail.url,alt:t!=null&&t.useConfigurableParentThumbnail?e.product.thumbnail.label:((l=(i=e.configured_variant)==null?void 0:i.thumbnail)==null?void 0:l.label)||e.product.thumbnail.label},price:{value:e.prices.price.value,currency:e.prices.price.currency},taxedPrice:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency},links:F(e.links),total:e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.row_total.value,currency:e.prices.row_total.currency}:{value:(o=e.prices.original_row_total)==null?void 0:o.value,currency:(a=e.prices.original_row_total)==null?void 0:a.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency,label:(_=e.prices.discounts)==null?void 0:_.map(m=>m.label)},regularPrice:B(e),discounted:e.__typename==="BundleCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0?!1:e.__typename==="ConfigurableCartItem"?((x=(g=e.configured_variant)==null?void 0:g.price_range)==null?void 0:x.maximum_price.discount.amount_off)>0:((v=e.product.price_range)==null?void 0:v.maximum_price.discount.amount_off)>0,bundleOptions:e.__typename==="BundleCartItem"?D(e.bundle_options):null,selectedOptions:k(e.configurable_options),customizableOptions:z(e.customizable_options),sender:e.__typename==="GiftCardCartItem"?e.sender_name:null,senderEmail:e.__typename==="GiftCardCartItem"?e.sender_email:null,recipient:e.__typename==="GiftCardCartItem"?e.recipient_name:null,recipientEmail:e.__typename==="GiftCardCartItem"?e.recipient_email:null,message:e.__typename==="GiftCardCartItem"?e.message:null,discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},onlyXLeftInStock:e.__typename==="ConfigurableCartItem"?(T=e.configured_variant)==null?void 0:T.only_x_left_in_stock:e.product.only_x_left_in_stock,lowInventory:e.is_available&&e.product.only_x_left_in_stock!==null,insufficientQuantity:(e.__typename==="ConfigurableCartItem"?e.configured_variant:e.product).stock_status==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockLevel:q(e),discountPercentage:V(e),savingsAmount:X(e),productAttributes:K(e)}})}function U(r){var n;const t=(n=r==null?void 0:r.items)==null?void 0:n.reduce((e,c)=>{var u;return(u=c.errors)==null||u.forEach(i=>{e.push({uid:c.uid,text:i.message})}),e},[]);return t!=null&&t.length?t:null}function E(r){return r!=null&&r.length?r.map(t=>({amount:{value:t.amount.value,currency:t.amount.currency},label:t.label,coupon:t.coupon})):[]}function D(r){const t=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(c=>c.label).join(", ")})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function k(r){const t=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function z(r){const t=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(c=>({uid:c.customizable_option_value_uid,label:c.label,value:c.value}))})),n={};return t==null||t.forEach(e=>{var c;switch(e.type){case"field":case"area":case"date_time":n[e.label]=e.values[0].value;break;case"radio":case"drop_down":n[e.label]=e.values[0].label;break;case"multiple":case"checkbox":n[e.label]=e.values.reduce((a,_)=>a?`${a}, ${_.label}`:_.label,"");break;case"file":const u=new DOMParser,i=e.values[0].value,o=((c=u.parseFromString(i,"text/html").querySelector("a"))==null?void 0:c.textContent)||"";n[e.label]=o;break}}),n}function P(r){var t,n;return((t=s.config)==null?void 0:t.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((n=s.config)==null?void 0:n.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function F(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(t=>t.title).join(", ")}:null}function $(r){var t,n,e,c;return(t=r.shipping_addresses)!=null&&t.length?(n=r.shipping_addresses)==null?void 0:n.map(u=>({countryCode:u.country.code,zipCode:u.postcode,regionCode:u.region.code})):(e=r.addresses)!=null&&e.length?(c=r.addresses)==null?void 0:c.filter(u=>u.default_shipping).map(u=>{var i;return u.default_shipping&&{countryCode:u.country_id,zipCode:u.postcode,regionCode:(i=u.region)==null?void 0:i.region_code}}):null}function Q(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function q(r){if(!r.not_available_message)return null;const t=r.not_available_message.match(/-?\d+/);return t?parseInt(t[0]):"noNumber"}function L(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"})}function V(r){var n,e,c,u,i,l,o,a;let t;if(r.__typename==="ConfigurableCartItem")t=(u=(c=(e=(n=r==null?void 0:r.configured_variant)==null?void 0:n.price_range)==null?void 0:e.maximum_price)==null?void 0:c.discount)==null?void 0:u.percent_off;else{if(r.__typename==="BundleCartItem")return;t=(a=(o=(l=(i=r==null?void 0:r.product)==null?void 0:i.price_range)==null?void 0:l.maximum_price)==null?void 0:o.discount)==null?void 0:a.percent_off}if(t!==0)return Math.round(t)}function X(r){var e,c,u,i,l,o;let t,n;if(t=((c=(e=r==null?void 0:r.prices)==null?void 0:e.original_row_total)==null?void 0:c.value)-((i=(u=r==null?void 0:r.prices)==null?void 0:u.row_total)==null?void 0:i.value),n=(o=(l=r==null?void 0:r.prices)==null?void 0:l.row_total)==null?void 0:o.currency,t!==0)return{value:t,currency:n}}function B(r){var t,n,e,c,u,i;switch(r.__typename){case"ConfigurableCartItem":return{value:(n=(t=r.configured_variant)==null?void 0:t.price_range)==null?void 0:n.maximum_price.regular_price.value,currency:(c=(e=r.configured_variant)==null?void 0:e.price_range)==null?void 0:c.maximum_price.regular_price.currency};case"GiftCardCartItem":case"BundleCartItem":return{value:r.prices.price.value,currency:r.prices.price.currency};case"SimpleCartItem":if(r.customizable_options.length!==0)return{value:r.prices.price.value,currency:r.prices.price.currency};default:return{value:(u=r.product.price_range)==null?void 0:u.maximum_price.regular_price.value,currency:(i=r.product.price_range)==null?void 0:i.maximum_price.regular_price.currency}}}function K(r){var t,n,e;return(e=(n=(t=r==null?void 0:r.product)==null?void 0:t.custom_attributesV2)==null?void 0:n.items)==null?void 0:e.map(c=>{const u=c.code.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ");return{...c,code:u}})}function Y(r){if(!r)return null;const t=n=>{switch(n){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}};return{displayMiniCart:r.minicart_display,miniCartMaxItemsDisplay:r.minicart_max_items,cartExpiresInDays:r.cart_expires_in_days,cartSummaryDisplayTotal:r.cart_summary_display_quantity,cartSummaryMaxItems:r.max_items_in_order_summary,defaultCountry:r.default_country,categoryFixedProductTaxDisplaySetting:r.category_fixed_product_tax_display_setting,productFixedProductTaxDisplaySetting:r.product_fixed_product_tax_display_setting,salesFixedProductTaxDisplaySetting:r.sales_fixed_product_tax_display_setting,shoppingCartDisplaySetting:{zeroTax:r.shopping_cart_display_zero_tax,subtotal:t(r.shopping_cart_display_subtotal),price:t(r.shopping_cart_display_price),shipping:t(r.shopping_cart_display_shipping),fullSummary:r.shopping_cart_display_full_summary,grandTotal:r.shopping_cart_display_grand_total,taxGiftWrapping:r.shopping_cart_display_tax_gift_wrapping},useConfigurableParentThumbnail:r.configurable_thumbnail_source==="parent"}}const b=` +import{events as p}from"@dropins/tools/event-bus.js";import{s,d as w,f,h as d}from"./resetCart.js";import{Initializer as G,merge as M}from"@dropins/tools/lib.js";import{CART_FRAGMENT as h}from"../fragments.js";import{a as N}from"./persisted-data.js";const A=new G({init:async r=>{const t={disableGuestCart:!1,...r};A.config.setConfig(t),m().catch(console.error)},listeners:()=>[p.on("authenticated",r=>{s.authenticated&&!r?p.emit("cart/reset",void 0):r&&!s.authenticated&&(s.authenticated=r,m().catch(console.error))},{eager:!0}),p.on("locale",async r=>{r!==s.locale&&(s.locale=r,m().catch(console.error))}),p.on("cart/reset",()=>{w().catch(console.error),p.emit("cart/data",null)}),p.on("cart/data",r=>{N(r)})]}),R=A.config;function I(r){var n,e,c,u,i,l,o,a,_,g;if(!r)return null;const t={id:r.id,totalQuantity:z(r),errors:U(r==null?void 0:r.itemsV2),items:E(r==null?void 0:r.itemsV2),miniCartMaxItems:E(r==null?void 0:r.itemsV2).slice(0,((n=s.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency},excludingTax:{value:r.prices.grand_total_excluding_tax.value,currency:r.prices.grand_total_excluding_tax.currency}},discount:S(r.prices.discounts,r.prices.grand_total.currency),subtotal:{excludingTax:{value:(e=r.prices.subtotal_excluding_tax)==null?void 0:e.value,currency:(c=r.prices.subtotal_excluding_tax)==null?void 0:c.currency},includingTax:{value:(u=r.prices.subtotal_including_tax)==null?void 0:u.value,currency:(i=r.prices.subtotal_including_tax)==null?void 0:i.currency},includingDiscountOnly:{value:(l=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:l.value,currency:(o=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:o.currency}},appliedTaxes:O(r.prices.applied_taxes),totalTax:S(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:O(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&$(r)},isGuestCart:!s.authenticated,hasOutOfStockItems:Q(r),hasFullyOutOfStockItems:L(r),appliedCoupons:r.applied_coupons};return M(t,(g=(_=(a=R.getConfig().models)==null?void 0:a.CartModel)==null?void 0:_.transformer)==null?void 0:g.call(_,r))}function S(r,t){return r!=null&&r.length?r.reduce((n,e)=>({value:n.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:t}):{value:0,currency:t}}function E(r){var n;if(!((n=r==null?void 0:r.items)!=null&&n.length))return[];const t=s.config;return r.items.map(e=>{var c,u,i,l,o,a,_,g,x,v,T;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(y=>y.url_key)},quantity:e.quantity,sku:e.product.sku,name:e.product.name,image:{src:t!=null&&t.useConfigurableParentThumbnail?e.product.thumbnail.url:((u=(c=e.configured_variant)==null?void 0:c.thumbnail)==null?void 0:u.url)||e.product.thumbnail.url,alt:t!=null&&t.useConfigurableParentThumbnail?e.product.thumbnail.label:((l=(i=e.configured_variant)==null?void 0:i.thumbnail)==null?void 0:l.label)||e.product.thumbnail.label},price:{value:e.prices.price.value,currency:e.prices.price.currency},taxedPrice:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},fixedProductTaxes:e.prices.fixed_product_taxes,rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency},links:F(e.links),total:e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.row_total.value,currency:e.prices.row_total.currency}:{value:(o=e.prices.original_row_total)==null?void 0:o.value,currency:(a=e.prices.original_row_total)==null?void 0:a.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency,label:(_=e.prices.discounts)==null?void 0:_.map(y=>y.label)},regularPrice:B(e),discounted:e.__typename==="BundleCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0?!1:e.__typename==="ConfigurableCartItem"?((x=(g=e.configured_variant)==null?void 0:g.price_range)==null?void 0:x.maximum_price.discount.amount_off)>0:((v=e.product.price_range)==null?void 0:v.maximum_price.discount.amount_off)>0,bundleOptions:e.__typename==="BundleCartItem"?D(e.bundle_options):null,selectedOptions:k(e.configurable_options),customizableOptions:P(e.customizable_options),sender:e.__typename==="GiftCardCartItem"?e.sender_name:null,senderEmail:e.__typename==="GiftCardCartItem"?e.sender_email:null,recipient:e.__typename==="GiftCardCartItem"?e.recipient_name:null,recipientEmail:e.__typename==="GiftCardCartItem"?e.recipient_email:null,message:e.__typename==="GiftCardCartItem"?e.message:null,discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},onlyXLeftInStock:e.__typename==="ConfigurableCartItem"?(T=e.configured_variant)==null?void 0:T.only_x_left_in_stock:e.product.only_x_left_in_stock,lowInventory:e.is_available&&e.product.only_x_left_in_stock!==null,insufficientQuantity:(e.__typename==="ConfigurableCartItem"?e.configured_variant:e.product).stock_status==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockLevel:q(e),discountPercentage:V(e),savingsAmount:X(e),productAttributes:K(e)}})}function U(r){var n;const t=(n=r==null?void 0:r.items)==null?void 0:n.reduce((e,c)=>{var u;return(u=c.errors)==null||u.forEach(i=>{e.push({uid:c.uid,text:i.message})}),e},[]);return t!=null&&t.length?t:null}function O(r){return r!=null&&r.length?r.map(t=>({amount:{value:t.amount.value,currency:t.amount.currency},label:t.label,coupon:t.coupon})):[]}function D(r){const t=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(c=>c.label).join(", ")})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function k(r){const t=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function P(r){const t=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(c=>({uid:c.customizable_option_value_uid,label:c.label,value:c.value}))})),n={};return t==null||t.forEach(e=>{var c;switch(e.type){case"field":case"area":case"date_time":n[e.label]=e.values[0].value;break;case"radio":case"drop_down":n[e.label]=e.values[0].label;break;case"multiple":case"checkbox":n[e.label]=e.values.reduce((a,_)=>a?`${a}, ${_.label}`:_.label,"");break;case"file":const u=new DOMParser,i=e.values[0].value,o=((c=u.parseFromString(i,"text/html").querySelector("a"))==null?void 0:c.textContent)||"";n[e.label]=o;break}}),n}function z(r){var t,n;return((t=s.config)==null?void 0:t.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((n=s.config)==null?void 0:n.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function F(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(t=>t.title).join(", ")}:null}function $(r){var t,n,e,c;return(t=r.shipping_addresses)!=null&&t.length?(n=r.shipping_addresses)==null?void 0:n.map(u=>({countryCode:u.country.code,zipCode:u.postcode,regionCode:u.region.code})):(e=r.addresses)!=null&&e.length?(c=r.addresses)==null?void 0:c.filter(u=>u.default_shipping).map(u=>{var i;return u.default_shipping&&{countryCode:u.country_id,zipCode:u.postcode,regionCode:(i=u.region)==null?void 0:i.region_code}}):null}function Q(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function q(r){if(!r.not_available_message)return null;const t=r.not_available_message.match(/-?\d+/);return t?parseInt(t[0]):"noNumber"}function L(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"})}function V(r){var n,e,c,u,i,l,o,a;let t;if(r.__typename==="ConfigurableCartItem")t=(u=(c=(e=(n=r==null?void 0:r.configured_variant)==null?void 0:n.price_range)==null?void 0:e.maximum_price)==null?void 0:c.discount)==null?void 0:u.percent_off;else{if(r.__typename==="BundleCartItem")return;t=(a=(o=(l=(i=r==null?void 0:r.product)==null?void 0:i.price_range)==null?void 0:l.maximum_price)==null?void 0:o.discount)==null?void 0:a.percent_off}if(t!==0)return Math.round(t)}function X(r){var e,c,u,i,l,o;let t,n;if(t=((c=(e=r==null?void 0:r.prices)==null?void 0:e.original_row_total)==null?void 0:c.value)-((i=(u=r==null?void 0:r.prices)==null?void 0:u.row_total)==null?void 0:i.value),n=(o=(l=r==null?void 0:r.prices)==null?void 0:l.row_total)==null?void 0:o.currency,t!==0)return{value:t,currency:n}}function B(r){var t,n,e,c,u,i;switch(r.__typename){case"ConfigurableCartItem":return{value:(n=(t=r.configured_variant)==null?void 0:t.price_range)==null?void 0:n.maximum_price.regular_price.value,currency:(c=(e=r.configured_variant)==null?void 0:e.price_range)==null?void 0:c.maximum_price.regular_price.currency};case"GiftCardCartItem":case"BundleCartItem":return{value:r.prices.price.value,currency:r.prices.price.currency};case"SimpleCartItem":if(r.customizable_options.length!==0)return{value:r.prices.price.value,currency:r.prices.price.currency};default:return{value:(u=r.product.price_range)==null?void 0:u.maximum_price.regular_price.value,currency:(i=r.product.price_range)==null?void 0:i.maximum_price.regular_price.currency}}}function K(r){var t,n,e;return(e=(n=(t=r==null?void 0:r.product)==null?void 0:t.custom_attributesV2)==null?void 0:n.items)==null?void 0:e.map(c=>{const u=c.code.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ");return{...c,code:u}})}function Y(r){if(!r)return null;const t=n=>{switch(n){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}};return{displayMiniCart:r.minicart_display,miniCartMaxItemsDisplay:r.minicart_max_items,cartExpiresInDays:r.cart_expires_in_days,cartSummaryDisplayTotal:r.cart_summary_display_quantity,cartSummaryMaxItems:r.max_items_in_order_summary,defaultCountry:r.default_country,categoryFixedProductTaxDisplaySetting:r.category_fixed_product_tax_display_setting,productFixedProductTaxDisplaySetting:r.product_fixed_product_tax_display_setting,salesFixedProductTaxDisplaySetting:r.sales_fixed_product_tax_display_setting,shoppingCartDisplaySetting:{zeroTax:r.shopping_cart_display_zero_tax,subtotal:t(r.shopping_cart_display_subtotal),price:t(r.shopping_cart_display_price),shipping:t(r.shopping_cart_display_shipping),fullSummary:r.shopping_cart_display_full_summary,grandTotal:r.shopping_cart_display_grand_total,taxGiftWrapping:r.shopping_cart_display_tax_gift_wrapping},useConfigurableParentThumbnail:r.configurable_thumbnail_source==="parent"}}const b=` $pageSize: Int! = 100, $currentPage: Int! = 1, $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC} @@ -59,7 +59,7 @@ fragment CUSTOMER_FRAGMENT on Customer { } ${h} -`,y=async()=>{if(s.initializing)return null;s.initializing=!0,s.config||(s.config=await tr());const r=s.authenticated?await Z():await rr();return p.emit("cart/initialized",r),p.emit("cart/data",r),s.initializing=!1,r};async function Z(){const r=s.cartId,t=await C();return t?(s.cartId=t.id,!r||t.id===r?t:await f(J,{variables:{guestCartId:r,customerCartId:t.id}}).then(()=>C()).then(n=>{const e={oldCartItems:t.items,newCart:n};return p.emit("cart/merged",e),n}).catch(()=>(console.error("Could not merge carts"),t))):null}async function rr(){if(A.getConfig().disableGuestCart===!0||!s.cartId)return null;try{return await C()}catch(r){return console.error(r),null}}const er=` +`,m=async()=>{if(s.initializing)return null;s.initializing=!0,s.config||(s.config=await tr());const r=s.authenticated?await Z():await rr();return p.emit("cart/initialized",r),p.emit("cart/data",r),s.initializing=!1,r};async function Z(){const r=s.cartId,t=await C();return t?(s.cartId=t.id,!r||t.id===r?t:await f(J,{variables:{guestCartId:r,customerCartId:t.id}}).then(()=>C()).then(n=>{const e={oldCartItems:t.items,newCart:n};return p.emit("cart/merged",e),n}).catch(()=>(console.error("Could not merge carts"),t))):null}async function rr(){if(R.getConfig().disableGuestCart===!0||!s.cartId)return null;try{return await C()}catch(r){return console.error(r),null}}const er=` query STORE_CONFIG_QUERY { storeConfig { minicart_display @@ -81,4 +81,4 @@ query STORE_CONFIG_QUERY { configurable_thumbnail_source } } -`,tr=async()=>f(er,{method:"GET",cache:"force-cache"}).then(({errors:r,data:t})=>r?d(r):Y(t.storeConfig));export{b as C,rr as a,C as b,A as c,y as d,tr as e,Z as g,O as i,I as t}; +`,tr=async()=>f(er,{method:"GET",cache:"force-cache"}).then(({errors:r,data:t})=>r?d(r):Y(t.storeConfig));export{b as C,rr as a,C as b,R as c,m as d,tr as e,Z as g,A as i,I as t}; diff --git a/scripts/__dropins__/storefront-cart/components/OrderSummary/OrderSummary.d.ts b/scripts/__dropins__/storefront-cart/components/OrderSummary/OrderSummary.d.ts index 6fdd70e4ec..d2e5c81be4 100644 --- a/scripts/__dropins__/storefront-cart/components/OrderSummary/OrderSummary.d.ts +++ b/scripts/__dropins__/storefront-cart/components/OrderSummary/OrderSummary.d.ts @@ -1,6 +1,14 @@ import { FunctionComponent, VNode } from 'preact'; import { HTMLAttributes } from 'preact/compat'; +import { JSXInternal } from 'preact/src/jsx'; +export interface OrderSummaryLineItem { + key: string; + title?: string; + className?: string; + sortOrder: number; + content: string | JSXInternal.Element | VNode> | OrderSummaryLineItem[] | undefined; +} export interface OrderSummaryProps extends Omit, 'loading'> { variant?: 'primary' | 'secondary'; heading?: VNode>; @@ -34,6 +42,8 @@ export interface OrderSummaryProps extends Omit, }; primaryAction?: VNode>; coupons?: VNode>; + totalSaved?: VNode>; + updateLineItems?: (lineItems: Array) => Array; } export declare const OrderSummary: FunctionComponent; //# sourceMappingURL=OrderSummary.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/components/OrderSummaryLine/OrderSummaryLine.d.ts b/scripts/__dropins__/storefront-cart/components/OrderSummaryLine/OrderSummaryLine.d.ts new file mode 100644 index 0000000000..7fcd5f8b29 --- /dev/null +++ b/scripts/__dropins__/storefront-cart/components/OrderSummaryLine/OrderSummaryLine.d.ts @@ -0,0 +1,13 @@ +import { HTMLAttributes } from 'preact/compat'; +import { FunctionComponent, VNode } from 'preact'; + +export interface OrderSummaryLineComponentProps extends HTMLAttributes { + label: string; + price: VNode>; + classSuffixes?: Array; + labelClassSuffix?: string; + testId?: string; + children?: any; +} +export declare const OrderSummaryLine: FunctionComponent; +//# sourceMappingURL=OrderSummaryLine.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/components/OrderSummaryLine/index.d.ts b/scripts/__dropins__/storefront-cart/components/OrderSummaryLine/index.d.ts new file mode 100644 index 0000000000..fbd9e1c9fb --- /dev/null +++ b/scripts/__dropins__/storefront-cart/components/OrderSummaryLine/index.d.ts @@ -0,0 +1,19 @@ +/******************************************************************** + * ADOBE CONFIDENTIAL + * __________________ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + *******************************************************************/ +export * from './OrderSummaryLine'; +export { OrderSummaryLine as default } from './OrderSummaryLine'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/components/index.d.ts b/scripts/__dropins__/storefront-cart/components/index.d.ts index 8490c29437..c4284f2cc2 100644 --- a/scripts/__dropins__/storefront-cart/components/index.d.ts +++ b/scripts/__dropins__/storefront-cart/components/index.d.ts @@ -22,4 +22,5 @@ export * from './CartSummaryGrid'; export * from './CartSummaryList'; export * from './OrderSummary'; export * from './Coupons'; +export * from './OrderSummaryLine'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/containers/Cart.js b/scripts/__dropins__/storefront-cart/containers/Cart.js index fea8693254..4e8f4cf509 100644 --- a/scripts/__dropins__/storefront-cart/containers/Cart.js +++ b/scripts/__dropins__/storefront-cart/containers/Cart.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{C as v,C as w}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/ChevronDown.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";import"../chunks/Coupon.js";export{v as Cart,w as default}; +import{C as w,C as y}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/ChevronDown.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/Coupon.js";export{w as Cart,y as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/Cart/Cart.d.ts b/scripts/__dropins__/storefront-cart/containers/Cart/Cart.d.ts index d3050e7768..b17426dfb0 100644 --- a/scripts/__dropins__/storefront-cart/containers/Cart/Cart.d.ts +++ b/scripts/__dropins__/storefront-cart/containers/Cart/Cart.d.ts @@ -4,6 +4,7 @@ import { CartModel } from '../../data/models'; type DefaultSlotContext = { hasErrors: boolean; + data: CartModel | null; }; export interface CartProps extends HTMLAttributes { routeEmptyCartCTA?: () => string; diff --git a/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js b/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js index a9fc947a13..1b9b35546f 100644 --- a/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js +++ b/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{C as s,C as u}from"../chunks/CartSummaryGrid.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";export{s as CartSummaryGrid,u as default}; +import{C as s,C as u}from"../chunks/CartSummaryGrid.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";export{s as CartSummaryGrid,u as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js b/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js index 2b941d9526..93c416f0d0 100644 --- a/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js +++ b/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{C as b,C as c}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/ChevronDown.js";export{b as CartSummaryList,c as default}; +import{C as b,C as c}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/ChevronDown.js";export{b as CartSummaryList,c as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/Coupons.js b/scripts/__dropins__/storefront-cart/containers/Coupons.js index e549239069..0a286e5d71 100644 --- a/scripts/__dropins__/storefront-cart/containers/Coupons.js +++ b/scripts/__dropins__/storefront-cart/containers/Coupons.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as o,jsxs as _}from"@dropins/tools/preact-jsx-runtime.js";import*as n from"@dropins/tools/preact-compat.js";import{useRef as B,useState as E,useEffect as A}from"@dropins/tools/preact-compat.js";import{classes as c,VComponent as w,getFormValues as P}from"@dropins/tools/lib.js";/* empty css */import{Accordion as I,AccordionSection as M,Button as k,Icon as b,Input as R}from"@dropins/tools/components.js";import{S as T}from"../chunks/Coupon.js";import{useText as N}from"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import{events as j}from"@dropins/tools/event-bus.js";import{a as L,A as x}from"../chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/getStoreConfig.js";import"../fragments.js";const z=a=>n.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...a},n.createElement("g",{id:"Large"},n.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),n.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),q=a=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),D=a=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},n.createElement("path",{d:"M17.3332 11.75H6.6665",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",fill:"none",stroke:"currentColor"})),V=({className:a,children:y,couponCodeField:f,applyCouponsButton:d,appliedCoupons:p,error:h,onApplyCoupon:l,...u})=>{const r=B(null),g=N({couponTitle:"Cart.PriceSummary.coupon.title"}),C=v=>{var t;v.preventDefault();const S=P(r.current);l==null||l(S);const e=(t=r==null?void 0:r.current)==null?void 0:t.querySelector("input");e&&(e.value="")};return o("div",{...u,"data-testid":"cart-coupons",className:c(["cart-coupons",a]),children:o(I,{"data-testid":"coupon-code",className:c(["cart-coupons__accordion"]),actionIconPosition:"right",iconOpen:z,iconClose:D,children:_(M,{title:g.couponTitle,iconLeft:T,showIconLeft:!0,renderContentWhenClosed:!1,"data-testid":"coupon-code-accordion-section",className:c(["cart-coupons__accordion-section"]),children:[o("form",{"data-testid":"coupon-code-form",className:c(["coupon-code-form--edit"]),ref:r,children:_("div",{className:c(["coupon-code-form__action"]),children:[f&&o(w,{node:f,className:c(["coupon-code-form__codes"])}),d&&o(w,{node:d,className:c(["coupon-code-form--button"]),onClick:C,type:"submit"})]})}),h&&o(w,{node:h,className:c(["coupon-code-form__error"])}),p&&o(w,{node:p,className:c(["coupon-code-form__applied"])})]})})})},oe=({children:a,...y})=>{const[f,d]=E(new Set),[p,h]=E([]),[l,u]=E(new Set),r=N({applyButton:"Cart.PriceSummary.coupon.applyAction",placeholder:"Cart.PriceSummary.coupon.placeholder"}),g=async e=>{const t=e.coupon,s=new Set(f);s.add(t),u(new Set);const i=Array.from(s);L(i,x.REPLACE).then(m=>{if(m===null)throw new Error("Error adding coupon code");d(s)}).catch(m=>{console.warn(m),u(new Set([m.message]))})},C=e=>{const t=new Set(f);t.delete(e),u(new Set);const s=Array.from(t);L(s,x.REPLACE).then(i=>{if(i===null)throw new Error("Error removing coupon code");d(t)}).catch(i=>{console.warn(i),u(new Set([i.message]))})};A(()=>{const e=j.on("cart/data",t=>{const s=t==null?void 0:t.appliedCoupons;if(!s){h([]);return}const i=s.map(m=>m.code);h(i)},{eager:!0});return()=>{e==null||e.off()}},[]),A(()=>{d(new Set(p))},[p]);const v=p.map(e=>o(k,{variant:"tertiary",icon:o(b,{source:q,size:"24"}),onClick:()=>C(e),children:e},e)),S=l.size>0?o("div",{"data-testid":"coupon-code-error",children:Array.from(l)[0]}):void 0;return o(V,{...y,couponCodeField:o(R,{"aria-label":r.placeholder,type:"text",placeholder:r.placeholder,name:"coupon",variant:"primary",value:"","data-testid":"coupon-code-input",maxLength:50,error:l.size>0}),applyCouponsButton:o(k,{variant:"secondary",children:r.applyButton}),error:S,appliedCoupons:o("div",{children:v}),onApplyCoupon:g})};export{oe as Coupons,oe as default}; +import{jsx as o,jsxs as _}from"@dropins/tools/preact-jsx-runtime.js";import*as n from"@dropins/tools/preact-compat.js";import{useRef as B,useState as E,useEffect as A}from"@dropins/tools/preact-compat.js";import{classes as c,VComponent as w,getFormValues as P}from"@dropins/tools/lib.js";/* empty css */import{Accordion as I,AccordionSection as M,Button as k,Icon as b,Input as R}from"@dropins/tools/components.js";import{S as T}from"../chunks/Coupon.js";import{useText as N}from"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import{events as j}from"@dropins/tools/event-bus.js";import{a as L,A as x}from"../chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/getStoreConfig.js";import"../fragments.js";const z=a=>n.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...a},n.createElement("g",{id:"Large"},n.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),n.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),q=a=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),D=a=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},n.createElement("path",{d:"M17.3332 11.75H6.6665",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",fill:"none",stroke:"currentColor"})),V=({className:a,children:y,couponCodeField:f,applyCouponsButton:d,appliedCoupons:p,error:h,onApplyCoupon:l,...u})=>{const r=B(null),g=N({couponTitle:"Cart.PriceSummary.coupon.title"}),C=v=>{var t;v.preventDefault();const S=P(r.current);l==null||l(S);const e=(t=r==null?void 0:r.current)==null?void 0:t.querySelector("input");e&&(e.value="")};return o("div",{...u,"data-testid":"cart-coupons",className:c(["cart-coupons",a]),children:o(I,{"data-testid":"coupon-code",className:c(["cart-coupons__accordion"]),actionIconPosition:"right",iconOpen:z,iconClose:D,children:_(M,{title:g.couponTitle,iconLeft:T,showIconLeft:!0,renderContentWhenClosed:!1,"data-testid":"coupon-code-accordion-section",className:c(["cart-coupons__accordion-section"]),children:[o("form",{"data-testid":"coupon-code-form",className:c(["coupon-code-form--edit"]),ref:r,children:_("div",{className:c(["coupon-code-form__action"]),children:[f&&o(w,{node:f,className:c(["coupon-code-form__codes"])}),d&&o(w,{node:d,className:c(["coupon-code-form--button"]),onClick:C,type:"submit"})]})}),h&&o(w,{node:h,className:c(["coupon-code-form__error"])}),p&&o(w,{node:p,className:c(["coupon-code-form__applied"])})]})})})},oe=({children:a,...y})=>{const[f,d]=E(new Set),[p,h]=E([]),[l,u]=E(new Set),r=N({applyButton:"Cart.PriceSummary.coupon.applyAction",placeholder:"Cart.PriceSummary.coupon.placeholder"}),g=async e=>{const t=e.coupon,s=new Set(f);s.add(t),u(new Set);const i=Array.from(s);L(i,x.REPLACE).then(m=>{if(m===null)throw new Error("Error adding coupon code");d(s)}).catch(m=>{console.warn(m),u(new Set([m.message]))})},C=e=>{const t=new Set(f);t.delete(e),u(new Set);const s=Array.from(t);L(s,x.REPLACE).then(i=>{if(i===null)throw new Error("Error removing coupon code");d(t)}).catch(i=>{console.warn(i),u(new Set([i.message]))})};A(()=>{const e=j.on("cart/data",t=>{const s=t==null?void 0:t.appliedCoupons;if(!s){h([]);return}const i=s.map(m=>m.code);h(i)},{eager:!0});return()=>{e==null||e.off()}},[]),A(()=>{d(new Set(p))},[p]);const v=p.map(e=>o(k,{variant:"tertiary",icon:o(b,{source:q,size:"24"}),onClick:()=>C(e),children:e},e)),S=l.size>0?o("div",{"data-testid":"coupon-code-error",children:Array.from(l)[0]}):void 0;return o(V,{...y,couponCodeField:o(R,{"aria-label":r.placeholder,type:"text",placeholder:r.placeholder,name:"coupon",variant:"primary",value:"","data-testid":"coupon-code-input",maxLength:50,error:l.size>0}),applyCouponsButton:o(k,{variant:"secondary",children:r.applyButton}),error:S,appliedCoupons:o("div",{children:v}),onApplyCoupon:g})};export{oe as Coupons,oe as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/EmptyCart.js b/scripts/__dropins__/storefront-cart/containers/EmptyCart.js index b8e9123719..81853340ed 100644 --- a/scripts/__dropins__/storefront-cart/containers/EmptyCart.js +++ b/scripts/__dropins__/storefront-cart/containers/EmptyCart.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";/* empty css */import{E as p}from"../chunks/EmptyCart.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";const E=({routeCTA:t})=>m(p,{ctaLinkURL:t==null?void 0:t()});export{E as EmptyCart,E as default}; +import{jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";/* empty css */import{E as p}from"../chunks/EmptyCart.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";const E=({routeCTA:t})=>m(p,{ctaLinkURL:t==null?void 0:t()});export{E as EmptyCart,E as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js b/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js index 429dfc284b..3a1114ebaf 100644 --- a/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js +++ b/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as I,jsx as e,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as x,VComponent as Z,getFormValues as K}from"@dropins/tools/lib.js";/* empty css */import{Price as U,Picker as w,Input as G,Button as $}from"@dropins/tools/components.js";import{useState as p,useEffect as T,useRef as q,useCallback as H}from"@dropins/tools/preact-compat.js";import{useText as j,Text as F}from"@dropins/tools/i18n.js";import{s as J}from"../chunks/resetCart.js";import{events as B}from"@dropins/tools/event-bus.js";import{s as X}from"../chunks/persisted-data.js";import{g as O,a as Q,b as W}from"../chunks/getEstimateShipping.js";import"@dropins/tools/fetch-graphql.js";const Y=()=>{const[b,E]=p(!1),[L,N]=p([]),[_,a]=p("US"),[A,i]=p(""),[P,c]=p(""),[v,m]=p([]),[h,C]=p(!1),[k,l]=p(),[n,r]=p(),[z,t]=p(""),[u,D]=p(!1),o=()=>{a("US"),i(""),c(""),l(null),r(null),t(""),D(!1)},y=async d=>{const{shippingCountry:s,shippingState:g="",shippingZip:S=""}=d,M={countryCode:s,postcode:S,region:{region:g}};return E(!0),W(M).then(f=>(f&&(l({amount:f.amount.value,currency:f.amount.currency,priceIncludingtax:{amount:f.price_incl_tax.value,currency:f.price_incl_tax.currency},priceExcludingtax:{amount:f.price_excl_tax.value,currency:f.price_excl_tax.currency}}),r({carrier_code:f.carrier_code,method_code:f.method_code}),a(s),i(g),c(S),t(g||S||s),D(!0)),a(s),i(g),c(S),t(g||S||s),f)).finally(()=>{E(!1)})},R=d=>{d.preventDefault(),i(""),c("");const s=d.target.value;a(s)};return T(()=>{O().then(d=>{let s="US";const g=d.map(S=>(S.isDefaultCountry&&(s=S.id),{text:S.label,value:S.id}));N(g),a(s)})},[]),T(()=>{C(!0),Q(_).then(d=>{const s=d.map(g=>({text:g.name,value:g.code}));m(s)}).finally(()=>{C(!1)})},[_,C]),{loading:b,regionsLoading:h,estimatedDestinationText:z,countries:L,selectedCountry:_,selectedRegion:A,selectedZip:P,regions:v,estimatedShippingPrice:k,estimatedShippingMethod:n,shippingEstimated:u,handleEstimateShipping:y,handleCountrySelected:R,resetValues:o,setPriceSummaryLoading:E}},ee=({countryField:b,destinationText:E,estimateButton:L,estimated:N,loading:_,onEstimate:a,price:A,priceExcludingTax:i,priceIncludingTax:P,stateField:c,taxExcluded:v,taxIncluded:m,zipField:h})=>{const C=q(null),[k,l]=p(!0),[n,r]=p("zip"),z=j({editZipAction:"Cart.EstimateShipping.editZipAction",destinationLinkAriaLabel:"Cart.EstimateShipping.destinationLinkAriaLabel",shippingLabel:"Cart.EstimateShipping.label",zipPlaceholder:"Cart.EstimateShipping.zipPlaceholder"}),t=o=>{o.preventDefault(),l(y=>!y)},u=o=>{o.preventDefault(),l(!0),r(y=>y==="zip"?"state":"zip")},D=o=>{o.preventDefault(),l(!1);const y=K(C.current);a==null||a(y)};return I("div",{"data-testid":"estimate-shipping",className:x(["cart-estimate-shipping",["cart-estimate-shipping--loading",_]]),children:[e("span",{className:"cart-estimate-shipping__label",children:N?E?I(V,{children:[e(F,{id:"Cart.EstimateShipping.estimatedDestination"}),e("a",{className:"cart-estimate-shippingLink",role:"button",href:"",onClick:t,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&t(o)},tabIndex:0,"aria-label":z.destinationLinkAriaLabel,"data-testid":"shipping-destination-link",children:E})]}):e(F,{id:"Cart.EstimateShipping.estimated"}):e(F,{id:"Cart.EstimateShipping.label"})}),e(Z,{node:A,className:"cart-estimate-shipping__price"}),N&&I(V,{children:[e("div",{className:x(["cart-estimate-shipping__caption"]),children:e("a",{href:"#",className:"cart-estimate-shipping__link",onClick:u,"data-testid":"shipping-alternate-field-link",children:n==="zip"?e(F,{id:"Cart.EstimateShipping.alternateField.state"}):e(F,{id:"Cart.EstimateShipping.alternateField.zip"})})}),I("form",{className:x(["cart-estimate-shipping--edit",["cart-estimate-shipping--hide",!k]]),ref:C,"data-testid":"shipping-estimate-form",children:[b&&e(Z,{node:b,className:x(["cart-estimate-shipping--country"])}),n==="state"?c&&e(Z,{node:c,className:x(["cart-estimate-shipping--state"])}):h&&e(Z,{node:h,className:x(["cart-estimate-shipping--zip"])}),L&&e(Z,{node:L,className:x(["cart-estimate-shipping--action"]),onClick:D,type:"submit"})]})]}),m&&e("div",{"data-testid":"shipping-tax-included",className:x(["cart-estimate-shipping__caption"]),children:I("span",{children:[P," ",e(F,{id:"Cart.EstimateShipping.withTaxes"})]})}),v?e("div",{"data-testid":"shipping-tax-included-excluded",className:x(["cart-estimate-shipping__caption"]),children:I("span",{children:[i," ",e(F,{id:"Cart.EstimateShipping.withoutTaxes"})]})}):void 0]})},me=()=>{var z;const[b,E]=p(!1),{loading:L,countries:N,regions:_,selectedCountry:a,estimatedDestinationText:A,estimatedShippingPrice:i,handleCountrySelected:P,handleEstimateShipping:c,regionsLoading:v,selectedRegion:m,selectedZip:h,shippingEstimated:C,resetValues:k}=Y(),l=H(t=>{c(t).then(()=>{X(t)})},[c]);T(()=>{const t=B.on("cart/data",u=>{var d,s;E((u==null?void 0:u.isVirtual)||!1);const D=(s=(d=u==null?void 0:u.addresses)==null?void 0:d.shipping)==null?void 0:s[0];if(!D)return;const{countryCode:o,regionCode:y,zipCode:R}=D;l({shippingCountry:o,shippingState:y,shippingZip:R})},{eager:!0});return()=>{t==null||t.off()}},[]),T(()=>{const t=B.on("cart/updated",()=>{c({shippingCountry:a,shippingState:m,shippingZip:h})});return()=>{t==null||t.off()}},[a,m,h]),T(()=>{const t=B.on("cart/reset",()=>{k(),X(null)});return()=>{t==null||t.off()}},[k]),T(()=>{const t=B.on("cart/merged",()=>{C&&l({shippingCountry:a,shippingState:m,shippingZip:h})});return()=>{t==null||t.off()}},[C,a,m,h,l]);const n=j({applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"});if(b)return null;const r=(z=J.config)==null?void 0:z.shoppingCartDisplaySetting;return e(ee,{loading:L,taxIncluded:(r==null?void 0:r.shipping)==="INCLUDING_TAX",taxExcluded:(r==null?void 0:r.shipping)==="INCLUDING_EXCLUDING_TAX",price:(i==null?void 0:i.amount)==0?e("span",{"data-testId":"free-shipping",children:n.freeShipping}):(r==null?void 0:r.shipping)==="INCLUDING_TAX"&&i?e(U,{"data-testid":"shipping",...i.priceIncludingtax}):i?e(U,{...i}):e("span",{children:n.taxToBeDetermined}),estimated:!0,priceExcludingTax:i!=null&&i.priceExcludingtax?e(U,{"data-testid":"shipping-excluding-tax",...i.priceExcludingtax}):e("span",{children:n.taxToBeDetermined}),countryField:e(w,{name:"shippingCountry",placeholder:n.countryField,value:a,variant:"primary",options:N,handleSelect:P,"data-testid":"estimate-shipping-country-selector"}),stateField:_.length>0?e(w,{name:"shippingState",placeholder:n.stateField,variant:"primary",options:_,value:m,"data-testid":"estimate-shipping-state-selector",disabled:v}):e(G,{"aria-label":n.stateField,name:"shippingState",placeholder:n.stateField,variant:"primary",value:m,disabled:v,"data-testid":"estimate-shipping-state-input",maxLength:50}),zipField:e(G,{"aria-label":n.zipField,name:"shippingZip",placeholder:n.zipField,variant:"primary","data-testid":"estimate-shipping-zip-input",value:h,maxLength:12}),estimateButton:e($,{variant:"secondary","data-testid":"estimate-shipping-apply-button","aria-label":n.applyButton,children:n.applyButton}),destinationText:A||n.taxToBeDetermined,onEstimate:l})};export{me as EstimateShipping,me as default}; +import{jsxs as A,jsx as e,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _,VComponent as Z,getFormValues as $}from"@dropins/tools/lib.js";/* empty css */import{Price as U,Picker as w,Input as G,Button as q}from"@dropins/tools/components.js";import{useRef as H,useState as r,useEffect as P,useCallback as J}from"@dropins/tools/preact-compat.js";import{useText as M,Text as N}from"@dropins/tools/i18n.js";import{s as X}from"../chunks/resetCart.js";import{events as B}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/persisted-data.js";import{g as O,a as Q,b as W}from"../chunks/getEstimateShipping.js";import"@dropins/tools/fetch-graphql.js";const Y=({countryField:v,destinationText:D,estimateButton:k,estimated:z,loading:L,onEstimate:l,price:f,priceExcludingTax:F,priceIncludingTax:n,stateField:S,taxExcluded:b,taxIncluded:I,zipField:m})=>{const d=H(null),[T,C]=r(!0),[y,i]=r("zip"),p=M({editZipAction:"Cart.EstimateShipping.editZipAction",destinationLinkAriaLabel:"Cart.EstimateShipping.destinationLinkAriaLabel",shippingLabel:"Cart.EstimateShipping.label",zipPlaceholder:"Cart.EstimateShipping.zipPlaceholder"}),x=a=>{a.preventDefault(),C(E=>!E)},t=a=>{a.preventDefault(),C(!0),i(E=>E==="zip"?"state":"zip")},h=a=>{a.preventDefault(),C(!1);const E=$(d.current);l==null||l(E)};return A("div",{"data-testid":"estimate-shipping",className:_(["cart-estimate-shipping",["cart-estimate-shipping--loading",L]]),children:[e("span",{className:"cart-estimate-shipping__label",children:z?D?A(V,{children:[e(N,{id:"Cart.EstimateShipping.estimatedDestination"}),e("a",{className:"cart-estimate-shippingLink",role:"button",href:"",onClick:x,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&x(a)},tabIndex:0,"aria-label":p.destinationLinkAriaLabel,"data-testid":"shipping-destination-link",children:D})]}):e(N,{id:"Cart.EstimateShipping.estimated"}):e(N,{id:"Cart.EstimateShipping.label"})}),e(Z,{node:f,className:"cart-estimate-shipping__price"}),z&&A(V,{children:[e("div",{className:_(["cart-estimate-shipping__caption"]),children:e("a",{href:"#",className:"cart-estimate-shipping__link",onClick:t,"data-testid":"shipping-alternate-field-link",children:y==="zip"?e(N,{id:"Cart.EstimateShipping.alternateField.state"}):e(N,{id:"Cart.EstimateShipping.alternateField.zip"})})}),A("form",{className:_(["cart-estimate-shipping--edit",["cart-estimate-shipping--hide",!T]]),ref:d,"data-testid":"shipping-estimate-form",children:[v&&e(Z,{node:v,className:_(["cart-estimate-shipping--country"])}),y==="state"?S&&e(Z,{node:S,className:_(["cart-estimate-shipping--state"])}):m&&e(Z,{node:m,className:_(["cart-estimate-shipping--zip"])}),k&&e(Z,{node:k,className:_(["cart-estimate-shipping--action"]),onClick:h,type:"submit"})]})]}),I&&e("div",{"data-testid":"shipping-tax-included",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[n," ",e(N,{id:"Cart.EstimateShipping.withTaxes"})]})}),b?e("div",{"data-testid":"shipping-tax-included-excluded",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[F," ",e(N,{id:"Cart.EstimateShipping.withoutTaxes"})]})}):void 0]})},ee=()=>{const[v,D]=r(!1),[k,z]=r([]),[L,l]=r("US"),[f,F]=r(""),[n,S]=r(""),[b,I]=r([]),[m,d]=r(!1),[T,C]=r(),[y,i]=r(),[p,x]=r(""),[t,h]=r(!1),a=()=>{l("US"),F(""),S(""),C(null),i(null),x(""),h(!1)},E=async u=>{const{shippingCountry:s,shippingState:o="",shippingZip:c=""}=u,K={countryCode:s,postcode:c,region:{region:o}};return D(!0),W(K).then(g=>(g&&(C({amount:g.amount.value,currency:g.amount.currency,priceIncludingtax:{amount:g.price_incl_tax.value,currency:g.price_incl_tax.currency},priceExcludingtax:{amount:g.price_excl_tax.value,currency:g.price_excl_tax.currency}}),i({carrier_code:g.carrier_code,method_code:g.method_code}),l(s),F(o),S(c),x(o||c||s),h(!0)),l(s),F(o),S(c),x(o||c||s),g)).finally(()=>{D(!1)})},R=u=>{u.preventDefault(),F(""),S("");const s=u.target.value;l(s)};return P(()=>{O().then(u=>{let s="US";const o=u.map(c=>(c.isDefaultCountry&&(s=c.id),{text:c.label,value:c.id}));z(o),l(s)})},[]),P(()=>{d(!0),Q(L).then(u=>{const s=u.map(o=>({text:o.name,value:o.code}));I(s)}).finally(()=>{d(!1)})},[L,d]),{loading:v,regionsLoading:m,estimatedDestinationText:p,countries:k,selectedCountry:L,selectedRegion:f,selectedZip:n,regions:b,estimatedShippingPrice:T,estimatedShippingMethod:y,shippingEstimated:t,handleEstimateShipping:E,handleCountrySelected:R,resetValues:a,setPriceSummaryLoading:D}},me=({showDefaultEstimatedShippingCost:v})=>{var x;const[D,k]=r(!1),{loading:z,countries:L,regions:l,selectedCountry:f,estimatedDestinationText:F,estimatedShippingPrice:n,handleCountrySelected:S,handleEstimateShipping:b,regionsLoading:I,selectedRegion:m,selectedZip:d,shippingEstimated:T,resetValues:C}=ee(),y=J(t=>{b(t).then(()=>{j(t)})},[b]);P(()=>{const t=B.on("cart/data",h=>{var s,o,c;k((h==null?void 0:h.isVirtual)||!1);const a=(o=(s=h==null?void 0:h.addresses)==null?void 0:s.shipping)==null?void 0:o[0];if(v&&!a&&b({shippingCountry:((c=X.config)==null?void 0:c.defaultCountry)??""}),!a)return;const{countryCode:E,regionCode:R,zipCode:u}=a;y({shippingCountry:E,shippingState:R,shippingZip:u})},{eager:!0});return()=>{t==null||t.off()}},[]),P(()=>{const t=B.on("cart/updated",()=>{b({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[f,m,d]),P(()=>{const t=B.on("cart/reset",()=>{C(),j(null)});return()=>{t==null||t.off()}},[C]),P(()=>{const t=B.on("cart/merged",()=>{T&&y({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[T,f,m,d,y]);const i=M({applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"});if(D)return null;const p=(x=X.config)==null?void 0:x.shoppingCartDisplaySetting;return e(Y,{loading:z,taxIncluded:(p==null?void 0:p.shipping)==="INCLUDING_TAX",taxExcluded:(p==null?void 0:p.shipping)==="INCLUDING_EXCLUDING_TAX",price:(n==null?void 0:n.amount)==0?e("span",{"data-testId":"free-shipping",children:i.freeShipping}):(p==null?void 0:p.shipping)==="INCLUDING_TAX"&&n?e(U,{"data-testid":"shipping",...n.priceIncludingtax}):n?e(U,{...n}):e("span",{children:i.taxToBeDetermined}),estimated:!0,priceExcludingTax:n!=null&&n.priceExcludingtax?e(U,{"data-testid":"shipping-excluding-tax",...n.priceExcludingtax}):e("span",{children:i.taxToBeDetermined}),countryField:e(w,{name:"shippingCountry",placeholder:i.countryField,value:f,variant:"primary",options:L,handleSelect:S,"data-testid":"estimate-shipping-country-selector"}),stateField:l.length>0?e(w,{name:"shippingState",placeholder:i.stateField,variant:"primary",options:l,value:m,"data-testid":"estimate-shipping-state-selector",disabled:I}):e(G,{"aria-label":i.stateField,name:"shippingState",placeholder:i.stateField,variant:"primary",value:m,disabled:I,"data-testid":"estimate-shipping-state-input",maxLength:50}),zipField:e(G,{"aria-label":i.zipField,name:"shippingZip",placeholder:i.zipField,variant:"primary","data-testid":"estimate-shipping-zip-input",value:d,maxLength:12}),estimateButton:e(q,{variant:"secondary","data-testid":"estimate-shipping-apply-button","aria-label":i.applyButton,children:i.applyButton}),destinationText:F||i.taxToBeDetermined,onEstimate:y})};export{me as EstimateShipping,me as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/EstimateShipping/EstimateShipping.d.ts b/scripts/__dropins__/storefront-cart/containers/EstimateShipping/EstimateShipping.d.ts index 24c595d434..b022ee3a78 100644 --- a/scripts/__dropins__/storefront-cart/containers/EstimateShipping/EstimateShipping.d.ts +++ b/scripts/__dropins__/storefront-cart/containers/EstimateShipping/EstimateShipping.d.ts @@ -2,6 +2,7 @@ import { Container } from '@dropins/tools/types/elsie/src/lib'; import { HTMLAttributes } from 'preact/compat'; export interface EstimateShippingProps extends HTMLAttributes { + showDefaultEstimatedShippingCost: boolean; } export declare const EstimateShipping: Container; //# sourceMappingURL=EstimateShipping.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/containers/MiniCart.js b/scripts/__dropins__/storefront-cart/containers/MiniCart.js index 0b4f95ebc8..44784837ed 100644 --- a/scripts/__dropins__/storefront-cart/containers/MiniCart.js +++ b/scripts/__dropins__/storefront-cart/containers/MiniCart.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{M as q,M as v}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/ChevronDown.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";import"../chunks/Coupon.js";export{q as MiniCart,v as default}; +import{M as v,M as w}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/ChevronDown.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/Coupon.js";export{v as MiniCart,w as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummary.js b/scripts/__dropins__/storefront-cart/containers/OrderSummary.js index dacd74a859..8fdf225234 100644 --- a/scripts/__dropins__/storefront-cart/containers/OrderSummary.js +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummary.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{O as c,O as g}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/acdl.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/ChevronDown.js";import"@dropins/tools/i18n.js";import"../chunks/Coupon.js";export{c as OrderSummary,g as default}; +import{O as g,O as h}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/acdl.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronDown.js";import"@dropins/tools/i18n.js";import"../chunks/Coupon.js";export{g as OrderSummary,h as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummary/OrderSummary.d.ts b/scripts/__dropins__/storefront-cart/containers/OrderSummary/OrderSummary.d.ts index 1401b596e0..e0e3403fe0 100644 --- a/scripts/__dropins__/storefront-cart/containers/OrderSummary/OrderSummary.d.ts +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummary/OrderSummary.d.ts @@ -1,6 +1,7 @@ import { HTMLAttributes } from 'preact/compat'; import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib'; import { CartModel } from '../../data/models'; +import { OrderSummaryLineItem } from '../../components'; interface CheckoutRouteContext { cartId: string; @@ -13,6 +14,8 @@ export interface OrderSummaryProps extends HTMLAttributes { }; enableCoupons?: boolean; errors: boolean; + showTotalSaved?: boolean; + updateLineItems?: (lineItems: Array) => Array; } export declare const OrderSummary: Container; export {}; diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.d.ts b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.d.ts new file mode 100644 index 0000000000..c444e1d8b5 --- /dev/null +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.d.ts @@ -0,0 +1,3 @@ +export * from './OrderSummaryLine/index' +import _default from './OrderSummaryLine/index' +export default _default diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js new file mode 100644 index 0000000000..d3dc615bc3 --- /dev/null +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{O as e,O}from"../chunks/OrderSummaryLine.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";export{e as OrderSummaryLine,O as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine/OrderSummaryLine.d.ts b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine/OrderSummaryLine.d.ts new file mode 100644 index 0000000000..20539fa9d4 --- /dev/null +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine/OrderSummaryLine.d.ts @@ -0,0 +1,14 @@ +import { HTMLAttributes } from 'preact/compat'; +import { Container } from '@dropins/tools/types/elsie/src/lib'; +import { VNode } from 'preact'; + +export interface OrderSummaryLineProps extends HTMLAttributes { + label: string; + price: VNode>; + classSuffixes?: Array; + labelClassSuffix?: string; + testId?: string; + children?: any; +} +export declare const OrderSummaryLine: Container; +//# sourceMappingURL=OrderSummaryLine.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine/index.d.ts b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine/index.d.ts new file mode 100644 index 0000000000..fbd9e1c9fb --- /dev/null +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine/index.d.ts @@ -0,0 +1,19 @@ +/******************************************************************** + * ADOBE CONFIDENTIAL + * __________________ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + *******************************************************************/ +export * from './OrderSummaryLine'; +export { OrderSummaryLine as default } from './OrderSummaryLine'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/containers/index.d.ts b/scripts/__dropins__/storefront-cart/containers/index.d.ts index 6823c41a2e..9ab86042d8 100644 --- a/scripts/__dropins__/storefront-cart/containers/index.d.ts +++ b/scripts/__dropins__/storefront-cart/containers/index.d.ts @@ -22,4 +22,5 @@ export * from './CartSummaryList'; export * from './OrderSummary'; export * from './EmptyCart'; export * from './Coupons'; +export * from './OrderSummaryLine'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-cart/data/models/cart-model.d.ts b/scripts/__dropins__/storefront-cart/data/models/cart-model.d.ts index d44fc6603f..1429a66857 100644 --- a/scripts/__dropins__/storefront-cart/data/models/cart-model.d.ts +++ b/scripts/__dropins__/storefront-cart/data/models/cart-model.d.ts @@ -52,6 +52,10 @@ interface TotalPriceModifier { label: string; coupon?: Coupon; } +interface FixedProductTax { + amount: Price; + label: string; +} export interface Item { taxedPrice: Price; rowTotal: Price; @@ -93,6 +97,7 @@ export interface Item { discountPercentage?: number; savingsAmount?: Price; productAttributes?: Attribute[]; + fixedProductTaxes?: FixedProductTax[]; } interface ItemError { id: string; diff --git a/scripts/__dropins__/storefront-cart/i18n/en_US.json.d.ts b/scripts/__dropins__/storefront-cart/i18n/en_US.json.d.ts index b4b54e07f5..911a78d479 100644 --- a/scripts/__dropins__/storefront-cart/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/storefront-cart/i18n/en_US.json.d.ts @@ -52,7 +52,8 @@ declare const _default: { "estimated": "Estimated Total", "free": "Free", "label": "Total", - "withoutTax": "Total excluding taxes" + "withoutTax": "Total excluding taxes", + "saved": "Total saved" }, "estimatedShippingForm": { "country": { diff --git a/scripts/__dropins__/storefront-cart/lib/state.d.ts b/scripts/__dropins__/storefront-cart/lib/state.d.ts index a63071a3bc..265540b91a 100644 --- a/scripts/__dropins__/storefront-cart/lib/state.d.ts +++ b/scripts/__dropins__/storefront-cart/lib/state.d.ts @@ -1,6 +1,26 @@ import { StoreConfigModel } from '../data/models/store-models'; type State = { + state: { + displayMiniCart: boolean; + miniCartMaxItemsDisplay: number; + cartExpiresInDays: number; + cartSummaryDisplayTotal: number; + defaultCountry: string; + categoryFixedProductTaxDisplaySetting: string; + productFixedProductTaxDisplaySetting: string; + salesFixedProductTaxDisplaySetting: string; + useConfigurableParentThumbnail: boolean; + shoppingCartDisplaySetting: { + zeroTax: boolean; + subtotal: string; + price: string; + shipping: string; + fullSummary: boolean; + grandTotal: boolean; + taxGiftWrapping: string; + }; + }; cartId: string | null; authenticated: boolean; initializing?: boolean; diff --git a/scripts/__dropins__/storefront-cart/render.js b/scripts/__dropins__/storefront-cart/render.js index 69b248e62d..b15d1b4360 100644 --- a/scripts/__dropins__/storefront-cart/render.js +++ b/scripts/__dropins__/storefront-cart/render.js @@ -1,4 +1,4 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -(function(i,t){try{if(typeof document<"u"){const a=document.createElement("style"),n=t.styleId;for(const r in t.attributes)a.setAttribute(r,t.attributes[r]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(i));const e=document.querySelector('style[data-dropin="sdk"]');if(e)e.after(a);else{const r=document.querySelector('link[rel="stylesheet"], style');r?r.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})(".cart-cart{container-type:inline-size;container-name:cart}.cart-cart__wrapper{display:grid;grid-template-rows:auto 1fr}.cart-cart__heading{display:grid;row-gap:var(--spacing-small);padding:var(--spacing-medium);padding-bottom:0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart__heading-divider{width:100%;margin:0}.cart-cart__content{display:grid;grid-template-columns:1fr;padding:0 var(--spacing-medium) var(--spacing-medium)}.cart-cart__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.dropin-price-summary__shipping--zip,.dropin-price-summary__shipping--state{background-color:var(--color-neutral-50)}@container cart (width >= 1024px){.cart-cart__wrapper{grid-template-columns:repeat(var(--grid-3-columns),1fr);grid-column-gap:var(--grid-3-gutters);margin:0 var(--grid-3-margins)}.cart-cart__heading{padding:var(--spacing-small) 0 0 0}.cart-cart__content{padding:var(--spacing-medium) 0}.cart-cart__content .cart-cart-summary-list__heading{padding:0}.cart-cart__heading,.cart-cart__content{grid-column:1 / span 8}.cart-cart__order-summary{grid-row:1 / span 3;grid-column:9 / span 4;height:min-content}.cart-cart__heading--full-width,.cart-cart__content--empty,.cart-cart__content--full-width{grid-column:1 / span 12}}.cart-empty-cart{container-type:inline-size;container-name:cart}.cart-empty-cart__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center}@container cart (width < 737px){.cart-empty-cart__wrapper .dropin-card{border:unset;border-style:hidden}}.cart-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xsmall);align-items:flex-end;color:var(--color-neutral-800)}.cart-estimate-shipping__label,.cart-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-estimate-shipping__price{text-align:right}a.cart-estimate-shippingLink{text-decoration:underline}.cart-estimate-shipping__label--bold,.cart-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-estimate-shipping--zip,.cart-estimate-shipping--state{background-color:var(--color-neutral-50)}.cart-estimate-shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small)}a.cart-estimate-shipping__link{text-decoration:underline}.cart-estimate-shipping--hide{display:none!important}.cart-estimate-shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-estimate-shipping--loading{opacity:.4;pointer-events:none}.cart-mini-cart{display:flex;flex-direction:column;height:100%;padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium);box-sizing:border-box}.cart-mini-cart__empty-cart{width:100%;max-width:800px;height:100%;display:flex;flex-direction:column;justify-content:center;align-self:center}.cart-mini-cart__heading{display:grid;row-gap:var(--spacing-xsmall);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing)}.cart-mini-cart__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 0 0}.cart-mini-cart__products{flex:1;overflow-y:auto;max-height:100%;padding-bottom:var(--spacing-medium)}.cart-mini-cart__products .cart-cart-summary-list__heading{padding:0}.cart-mini-cart__products .dropin-cart-item__configurations li{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cart-mini-cart__footer{display:grid;grid-auto-flow:row;gap:var(--spacing-small);padding-top:var(--spacing-small);row-gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total-excluding-taxes{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall);color:var(--color-neutral-700)}.cart-mini-cart__footer__ctas{display:grid;grid-auto-flow:row;gap:var(--spacing-xsmall);padding-top:var(--spacing-small)}.cart-cart-summary-grid{container-type:inline-size;container-name:cart-summary-grid;max-width:inherit}.cart-cart-summary-grid__content{display:grid;flex-wrap:wrap;gap:var(--spacing-small);grid-template-columns:repeat(6,1fr);margin:auto}.cart-cart-summary-grid__item-container{aspect-ratio:auto 3/4;display:inline-block}.cart-cart-summary-grid__item-container img{height:auto;max-width:100%}.cart-cart-summary-grid__item-container a:focus{display:block}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}.cart-cart-summary-grid__empty-cart{align-self:center;justify-self:center;max-width:800px;width:100%}@container cart-summary-grid (width < 360px){.cart-cart-summary-grid__content{grid-template-columns:repeat(4,1fr);gap:var(--spacing-xsmall)}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}}.cart-cart-summary-list{container-type:inline-size;container-name:cart-summary-list}.cart-cart-summary-list__background--secondary{background-color:var(--color-neutral-200)}.cart-cart-summary-list__heading{display:grid;row-gap:var(--spacing-xsmall);padding:var(--spacing-medium) 0 0 0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart-summary-list__heading--full-width{width:100%}.cart-cart-summary-list__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 var(--spacing-medium) 0}.cart-cart-summary-list__content{display:grid;grid-template-columns:1fr;padding:0}.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-xsmall)) 0 var(--spacing-medium) 0}.cart-cart-summary-list__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.cart-cart-summary-list-footer__action,.cart-cart-summary-list-footer__action:focus .cart-cart-summary-list-footer__action:active,.cart-cart-summary-list-footer__action:link{font:var(--type-body-2-strong-font);margin:0 auto;width:auto;margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.cart-cart-summary-list-footer__action:hover{text-decoration:underline;text-underline-offset:var(--spacing-xxsmall);background:transparent;color:var(--color-brand-700)}.cart-cart-summary-list-footer__action:visited{background-color:none}.cart-cart-summary-list-accordion{border-left:var(--shape-border-width-2) solid var(--color-neutral-400);border-right:var(--shape-border-width-2) solid var(--color-neutral-400)}.cart-cart-summary-list-accordion__section{margin:var(--spacing-medium)}@container cart-summary-list (width >= 768px){.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-small)) 0 var(--spacing-xxbig) 0}}@container cart-summary-list (width >= 1024px){.cart-cart-summary-list__content,.cart-cart-summary-list__heading{grid-column:1 / span 8}.cart-cart-summary-list__heading--full-width,.cart-cart-summary-list__content--empty{grid-column:1 / span 12}.cart-cart-summary-list__content{padding:0}}.cart-order-summary{display:grid;position:relative;grid-auto-flow:row;padding:var(--spacing-medium)}.cart-order-summary__primary{background-color:var(--color-neutral-200)}.cart-order-summary__secondary{background-color:var(--color-neutral-50)}.cart-order-summary__content{display:grid;gap:var(--spacing-xsmall);margin-top:var(--spacing-small)}.cart-order-summary__heading{display:grid;font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);color:var(--color-neutral-800);gap:var(--spacing-small)}.cart-order-summary__label,.cart-order-summary__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-order-summary__discount .cart-order-summary__label,.cart-order-summary__discount .cart-order-summary__price{color:var(--color-warning-800)}.cart-order-summary__coupon__code{display:flex;align-items:center;font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);color:var(--color-neutral-700);gap:var(--spacing-xsmall);grid-column:span 2}.cart-order-summary__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-order-summary__price{text-align:right;text-transform:uppercase}.cart-order-summary__taxes .dropin-divider:last-child{margin-bottom:0}.cart-order-summary__total{margin-top:var(--spacing-medium)}.cart-order-summary__label--bold,.cart-order-summary__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-order-summary__divider-primary,.cart-order-summary__divider-secondary{width:100%;margin:0}.cart-order-summary__divider-secondary{margin:0}.cart-order-summary__taxEntry.cart-order-summary__entry{margin-top:0}.cart-order-summary__entry,.cart-order-summary__taxEntry{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.cart-order-summary__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-order-summary__primaryAction{margin-top:var(--spacing-small);grid-template-columns:1fr}.cart-order-summary__shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small);padding-left:var(--spacing-small)}a.cart-order-summary__shippingLink{text-decoration:underline}.cart-order-summary__shipping--hide{display:none!important}.cart-order-summary__shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-order-summary__shipping--zip,.cart-order-summary__shipping--state{background-color:var(--color-neutral-50)}.cart-order-summary__taxes .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.cart-order-summary--loading{opacity:.4;pointer-events:none}.cart-order-summary__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.coupon-code-form__action{display:flex}.coupon-code-form__action .dropin-input-container{flex-grow:1;margin-right:var(--spacing-small)}.cart-coupons__accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small)}.coupon-code-form__codes{background-color:var(--color-neutral-50)}.coupon-code-form__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-500);margin-top:calc(var(--spacing-xsmall) * -1)}.coupon-code-form__applied{display:flex;flex-wrap:wrap;gap:var(--spacing-small)}div.coupon-code-form__applied button{background:var(--color-neutral-400);color:var(--color-neutral-800);display:flex;flex-direction:row-reverse}",{styleId:"Cart"}); -import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./fragments.js";const f={Cart:{heading:"Shopping Cart ({count})",editCart:"Edit",viewAll:"View all in cart",viewMore:"View more"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",free:"Free",label:"Total",withoutTax:"Total excluding taxes"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free",coupon:{applyAction:"Apply",placeholder:"Enter code",title:"Discount code"}},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available",discountPercentage:"{discount}% off",savingsAmount:"Savings"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},y={default:x},S=({children:o})=>{var i;const[t,s]=u(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(y,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},L=new d(n(S,{}));export{L as render}; +(function(i,t){try{if(typeof document<"u"){const a=document.createElement("style"),n=t.styleId;for(const r in t.attributes)a.setAttribute(r,t.attributes[r]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(i));const e=document.querySelector('style[data-dropin="sdk"]');if(e)e.after(a);else{const r=document.querySelector('link[rel="stylesheet"], style');r?r.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})(".cart-cart{container-type:inline-size;container-name:cart}.cart-cart__wrapper{display:grid;grid-template-rows:auto 1fr}.cart-cart__heading{display:grid;row-gap:var(--spacing-small);padding:var(--spacing-medium);padding-bottom:0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart__heading-divider{width:100%;margin:0}.cart-cart__content{display:grid;grid-template-columns:1fr;padding:0 var(--spacing-medium) var(--spacing-medium)}.cart-cart__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.dropin-price-summary__shipping--zip,.dropin-price-summary__shipping--state{background-color:var(--color-neutral-50)}@container cart (width >= 1024px){.cart-cart__wrapper{grid-template-columns:repeat(var(--grid-3-columns),1fr);grid-column-gap:var(--grid-3-gutters);margin:0 var(--grid-3-margins)}.cart-cart__heading{padding:var(--spacing-small) 0 0 0}.cart-cart__content{padding:var(--spacing-medium) 0}.cart-cart__content .cart-cart-summary-list__heading{padding:0}.cart-cart__heading,.cart-cart__content{grid-column:1 / span 8}.cart-cart__order-summary{grid-row:1 / span 3;grid-column:9 / span 4;height:min-content}.cart-cart__heading--full-width,.cart-cart__content--empty,.cart-cart__content--full-width{grid-column:1 / span 12}}.cart-empty-cart{container-type:inline-size;container-name:cart}.cart-empty-cart__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center}@container cart (width < 737px){.cart-empty-cart__wrapper .dropin-card{border:unset;border-style:hidden}}.cart-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xsmall);align-items:flex-end;color:var(--color-neutral-800)}.cart-estimate-shipping__label,.cart-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-estimate-shipping__price{text-align:right}a.cart-estimate-shippingLink{text-decoration:underline}.cart-estimate-shipping__label--bold,.cart-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-estimate-shipping--zip,.cart-estimate-shipping--state{background-color:var(--color-neutral-50)}.cart-estimate-shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small)}a.cart-estimate-shipping__link{text-decoration:underline}.cart-estimate-shipping--hide{display:none!important}.cart-estimate-shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-estimate-shipping--loading{opacity:.4;pointer-events:none}.cart-mini-cart{display:flex;flex-direction:column;height:100%;padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium);box-sizing:border-box}.cart-mini-cart__empty-cart{width:100%;max-width:800px;height:100%;display:flex;flex-direction:column;justify-content:center;align-self:center}.cart-mini-cart__heading{display:grid;row-gap:var(--spacing-xsmall);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing)}.cart-mini-cart__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 0 0}.cart-mini-cart__products{flex:1;overflow-y:auto;max-height:100%;padding-bottom:var(--spacing-medium)}.cart-mini-cart__products .cart-cart-summary-list__heading{padding:0}.cart-mini-cart__products .dropin-cart-item__configurations li{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cart-mini-cart__footer{display:grid;grid-auto-flow:row;gap:var(--spacing-small);padding-top:var(--spacing-small);row-gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total-excluding-taxes{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall);color:var(--color-neutral-700)}.cart-mini-cart__footer__ctas{display:grid;grid-auto-flow:row;gap:var(--spacing-xsmall);padding-top:var(--spacing-small)}.cart-cart-summary-grid{container-type:inline-size;container-name:cart-summary-grid;max-width:inherit}.cart-cart-summary-grid__content{display:grid;flex-wrap:wrap;gap:var(--spacing-small);grid-template-columns:repeat(6,1fr);margin:auto}.cart-cart-summary-grid__item-container{aspect-ratio:auto 3/4;display:inline-block}.cart-cart-summary-grid__item-container img{height:auto;max-width:100%}.cart-cart-summary-grid__item-container a:focus{display:block}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}.cart-cart-summary-grid__empty-cart{align-self:center;justify-self:center;max-width:800px;width:100%}@container cart-summary-grid (width < 360px){.cart-cart-summary-grid__content{grid-template-columns:repeat(4,1fr);gap:var(--spacing-xsmall)}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}}.cart-cart-summary-list{container-type:inline-size;container-name:cart-summary-list}.cart-cart-summary-list__background--secondary{background-color:var(--color-neutral-200)}.cart-cart-summary-list__heading{display:grid;row-gap:var(--spacing-xsmall);padding:var(--spacing-medium) 0 0 0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart-summary-list__heading--full-width{width:100%}.cart-cart-summary-list__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 var(--spacing-medium) 0}.cart-cart-summary-list__content{display:grid;grid-template-columns:1fr;padding:0}.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-xsmall)) 0 var(--spacing-medium) 0}.cart-cart-summary-list__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.cart-cart-summary-list-footer__action,.cart-cart-summary-list-footer__action:focus .cart-cart-summary-list-footer__action:active,.cart-cart-summary-list-footer__action:link{font:var(--type-body-2-strong-font);margin:0 auto;width:auto;margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.cart-cart-summary-list-footer__action:hover{text-decoration:underline;text-underline-offset:var(--spacing-xxsmall);background:transparent;color:var(--color-brand-700)}.cart-cart-summary-list-footer__action:visited{background-color:none}.cart-cart-summary-list-accordion{border-left:var(--shape-border-width-2) solid var(--color-neutral-400);border-right:var(--shape-border-width-2) solid var(--color-neutral-400)}.cart-cart-summary-list-accordion__section{margin:var(--spacing-medium)}@container cart-summary-list (width >= 768px){.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-small)) 0 var(--spacing-xxbig) 0}}@container cart-summary-list (width >= 1024px){.cart-cart-summary-list__content,.cart-cart-summary-list__heading{grid-column:1 / span 8}.cart-cart-summary-list__heading--full-width,.cart-cart-summary-list__content--empty{grid-column:1 / span 12}.cart-cart-summary-list__content{padding:0}}.cart-order-summary{display:grid;position:relative;grid-auto-flow:row;padding:var(--spacing-medium)}.cart-order-summary__primary{background-color:var(--color-neutral-200)}.cart-order-summary__secondary{background-color:var(--color-neutral-50)}.cart-order-summary__content{display:grid;gap:var(--spacing-xsmall);margin-top:var(--spacing-small)}.cart-order-summary__heading{display:grid;font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);color:var(--color-neutral-800);gap:var(--spacing-small)}.cart-order-summary__discount .cart-order-summary__label,.cart-order-summary__discount .cart-order-summary__price{color:var(--color-warning-800)}.cart-order-summary__coupon__code{display:flex;align-items:center;font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);color:var(--color-neutral-700);gap:var(--spacing-xsmall);grid-column:span 2}.cart-order-summary__taxes .dropin-divider:last-child{margin-bottom:0}.cart-order-summary__total{margin-top:var(--spacing-medium)}.cart-order-summary__divider-primary,.cart-order-summary__divider-secondary{width:100%;margin:0}.cart-order-summary__divider-secondary{margin:0}.cart-order-summary__taxEntry.cart-order-summary__entry{margin-top:0}.cart-order-summary__entry,.cart-order-summary__taxEntry{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.cart-order-summary__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-order-summary__primaryAction{margin-top:var(--spacing-small);grid-template-columns:1fr}.cart-order-summary__shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small);padding-left:var(--spacing-small)}a.cart-order-summary__shippingLink{text-decoration:underline}.cart-order-summary__shipping--hide{display:none!important}.cart-order-summary__shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-order-summary__shipping--zip,.cart-order-summary__shipping--state{background-color:var(--color-neutral-50)}.cart-order-summary__taxes .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.cart-order-summary--loading{opacity:.4;pointer-events:none}.cart-order-summary__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.coupon-code-form__action{display:flex}.coupon-code-form__action .dropin-input-container{flex-grow:1;margin-right:var(--spacing-small)}.cart-coupons__accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small)}.coupon-code-form__codes{background-color:var(--color-neutral-50)}.coupon-code-form__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-500);margin-top:calc(var(--spacing-xsmall) * -1)}.coupon-code-form__applied{display:flex;flex-wrap:wrap;gap:var(--spacing-small)}div.coupon-code-form__applied button{background:var(--color-neutral-400);color:var(--color-neutral-800);display:flex;flex-direction:row-reverse}.cart-order-summary__label,.cart-order-summary__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-order-summary__price{text-align:right;text-transform:uppercase}.cart-order-summary__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-order-summary__label--bold,.cart-order-summary__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}",{styleId:"Cart"}); +import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./fragments.js";const f={Cart:{heading:"Shopping Cart ({count})",editCart:"Edit",viewAll:"View all in cart",viewMore:"View more"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",free:"Free",label:"Total",withoutTax:"Total excluding taxes",saved:"Total saved"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free",coupon:{applyAction:"Apply",placeholder:"Enter code",title:"Discount code"}},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available",discountPercentage:"{discount}% off",savingsAmount:"Savings"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},y={default:x},S=({children:o})=>{var i;const[t,s]=u(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(y,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},L=new d(n(S,{}));export{L as render};