From b97180da737e0f118442c627c1e0c0e777dfef34 Mon Sep 17 00:00:00 2001 From: "Chuting (Christina) Yan" <59424839+cctina516@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:47:19 -0600 Subject: [PATCH] Update Cart to 1.0.2 (#274) * Update cart beta * Update cart version --- package-lock.json | 8 ++++---- package.json | 2 +- scripts/__dropins__/storefront-cart/api.js | 2 +- .../storefront-cart/chunks/CartSummaryGrid.js | 2 +- .../storefront-cart/chunks/CartSummaryList.js | 2 +- .../storefront-cart/chunks/ChevronDown.js | 2 +- .../__dropins__/storefront-cart/chunks/Coupon.js | 2 +- .../storefront-cart/chunks/EmptyCart.js | 2 +- .../storefront-cart/chunks/OrderSummary.js | 2 +- .../storefront-cart/chunks/OrderSummaryLine.js | 2 +- .../__dropins__/storefront-cart/chunks/acdl.js | 2 +- .../storefront-cart/chunks/applyCouponsToCart.js | 2 +- .../storefront-cart/chunks/getEstimateShipping.js | 8 ++++---- .../storefront-cart/chunks/getEstimatedTotals.js | 2 +- .../storefront-cart/chunks/persisted-data.js | 2 +- .../storefront-cart/chunks/refreshCart.js | 2 +- .../storefront-cart/chunks/resetCart.js | 2 +- .../chunks/updateProductsFromCart.js | 2 +- .../storefront-cart/containers/CartSummaryGrid.js | 2 +- .../storefront-cart/containers/CartSummaryList.js | 2 +- .../storefront-cart/containers/Coupons.js | 2 +- .../storefront-cart/containers/EmptyCart.js | 2 +- .../containers/EstimateShipping.js | 4 ++-- .../storefront-cart/containers/MiniCart.js | 2 +- .../storefront-cart/containers/OrderSummary.js | 2 +- .../containers/OrderSummaryLine.js | 2 +- .../transforms/__fixtures__/productTypesData.d.ts | 15 --------------- scripts/__dropins__/storefront-cart/fragments.js | 7 ++----- .../storefront-cart/i18n/en_US.json.d.ts | 4 ++-- scripts/__dropins__/storefront-cart/render.js | 4 ++-- 30 files changed, 39 insertions(+), 57 deletions(-) diff --git a/package-lock.json b/package-lock.json index 471e25d363..dd7784ce03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@adobe/magento-storefront-events-sdk": "^1.8.0", "@dropins/storefront-account": "~1.0.0", "@dropins/storefront-auth": "~1.0.0", - "@dropins/storefront-cart": "~1.0.1", + "@dropins/storefront-cart": "~1.0.2", "@dropins/storefront-checkout": "~1.0.0", "@dropins/storefront-order": "~1.0.0", "@dropins/storefront-pdp": "~1.0.0", @@ -1808,9 +1808,9 @@ "integrity": "sha512-dhLXNLUXi8G6FINtjL8DZNrFR8BXKzabzrK0NgKwmCu2YAv2uAOL1JQOJHgD5iCIZ2l1uDwtZcxNqwdN0MUvog==" }, "node_modules/@dropins/storefront-cart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@dropins/storefront-cart/-/storefront-cart-1.0.1.tgz", - "integrity": "sha512-hxv9B4ZPAak67IVnYe79W5l9VkIx1QwCuGZIvM3sUnywZTdCpLxee3LxzC3vcxsPTFKxbvkiW8Mm5mkJslZ6Wg==" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@dropins/storefront-cart/-/storefront-cart-1.0.2.tgz", + "integrity": "sha512-1c3drree2ywTIBJeMtdiVPLLrefEtHDTSwympxSTlhlWC1BgD7T7Lb8WiK9HAhqytERyVdxEMCX+zu4cL6SA+A==" }, "node_modules/@dropins/storefront-checkout": { "version": "1.0.0", diff --git a/package.json b/package.json index a9d446d7c3..3c9f1b764d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@adobe/magento-storefront-events-sdk": "^1.8.0", "@dropins/storefront-account": "~1.0.0", "@dropins/storefront-auth": "~1.0.0", - "@dropins/storefront-cart": "~1.0.1", + "@dropins/storefront-cart": "~1.0.2", "@dropins/storefront-checkout": "~1.0.0", "@dropins/storefront-order": "~1.0.0", "@dropins/storefront-pdp": "~1.0.0", diff --git a/scripts/__dropins__/storefront-cart/api.js b/scripts/__dropins__/storefront-cart/api.js index f71cd26800..360b7127d3 100644 --- a/scripts/__dropins__/storefront-cart/api.js +++ b/scripts/__dropins__/storefront-cart/api.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{s as o,f as d,h as l}from"./chunks/resetCart.js";import{g as $,r as Q,d as H,a as k,b as z,c as V}from"./chunks/resetCart.js";import{C as T,t as g,c as f}from"./chunks/refreshCart.js";import{g as j,b as q,d as B,e as J,i as K,a as W,r as X}from"./chunks/refreshCart.js";import{events as C}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as h}from"./fragments.js";import{b as A,a as I,c as _}from"./chunks/acdl.js";import{u as Z}from"./chunks/updateProductsFromCart.js";import{g as rt,b as at,a as et}from"./chunks/getEstimateShipping.js";import{g as ot}from"./chunks/getEstimatedTotals.js";import{g as E}from"./chunks/persisted-data.js";import{A as it,a as ct}from"./chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const S=` mutation ADD_PRODUCTS_TO_CART_MUTATION( diff --git a/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js b/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js index d9ee755c3e..3b578a8696 100644 --- a/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js +++ b/scripts/__dropins__/storefront-cart/chunks/CartSummaryGrid.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 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{E as _}from"./EmptyCart.js";import{classes as d,VComponent as C}from"@dropins/tools/lib.js";/* empty css */import{Image as v}from"@dropins/tools/components.js";import{events as N}from"@dropins/tools/event-bus.js";import{g as b}from"./persisted-data.js";const j=({className:m,children:i,emptyCart:n,products:e,...c})=>a("div",{...c,className:d(["cart-cart-summary-grid",m]),children:a(l,{children:a("div",{className:d(["cart-cart-summary-grid__content",["cart-cart-summary-grid__content--empty",!e]]),children:e||a(C,{node:n,className:"cart-cart-summary-grid__empty-cart"})})})}),D=({children:m,initialData:i=null,routeProduct:n,routeEmptyCartCTA:e,...c})=>{const[s,g]=y(i);h(()=>{const r=N.on("cart/data",t=>{g(t)},{eager:!0});return()=>{r==null||r.off()}},[]);const p=(r,t)=>{const f=r.selectedOptions?`${r.name}: ${Object.entries(r.selectedOptions).join("; ")}`:r.name,o=a(v,{"data-testid":"cart-grid-item-image",loading:t<4?"eager":"lazy",src:r.image.src,alt:r.image.alt,"aria-label":f,width:"100%"});return n?a("div",{className:"cart-cart-summary-grid__item-container",children:a("a",{href:n(r),children:o})},t):o},u=s&&a(l,{children:s.items.map((r,t)=>p(r,t))});return a(j,{...c,emptyCart:a(_,{ctaLinkURL:e?e():void 0}),products:u})};D.getInitialData=async function(){return b()};export{D as C}; diff --git a/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js b/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js index b0b7e88cf7..564ec966c4 100644 --- a/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js +++ b/scripts/__dropins__/storefront-cart/chunks/CartSummaryList.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 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";import{E as Mt}from"./EmptyCart.js";/* empty css */import{Divider as st,Skeleton as zt,SkeletonRow as Ut,InLineAlert as qt,Icon as z,CartList as lt,Button as U,Accordion as Tt,AccordionSection as Wt,CartItem as Jt,Price as O,Image as Kt}from"@dropins/tools/components.js";import{g as Rt}from"./persisted-data.js";import{events as Yt}from"@dropins/tools/event-bus.js";import{s as Ht}from"./resetCart.js";import{u as ut}from"./updateProductsFromCart.js";import{S as Dt}from"./ChevronDown.js";import{useText as te}from"@dropins/tools/i18n.js";const ee=d=>o.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...d},o.createElement("g",{id:"Large"},o.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),o.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},o.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),dt=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("g",{clipPath:"url(#clip0_4797_15331)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19 13.31L15.5 19.37H22.5L19 13.31Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15331"},o.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),ne=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),gt=({className:d,children:q,heading:k,footer:y,emptyCart:_,products:u,outOfStockMessage:v,variant:S="primary",loading:m=!0,...c})=>n("div",{...c,className:L(["cart-cart-summary-list",d,`cart-cart-summary-list__background--${S}`]),children:m?n(re,{}):h(X,{children:[(k||v)&&h("div",{"data-testid":"cart-summary-list-heading-wrapper",className:L(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!u]]),children:[k&&h(X,{children:[n(b,{node:k,className:"cart-cart-summary-list__heading-text"}),n(st,{variant:"primary",className:L(["cart-cart-summary-list__heading-divider"])})]}),v&&n(b,{node:v,className:"cart-cart-summary-list__out-of-stock-message"})]}),n("div",{className:L(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!u]]),children:u||n(b,{node:_,className:"cart-cart-summary-list__empty-cart"})}),y&&h(X,{children:[n(st,{variant:"primary",className:L(["cart-cart-summary-list__footer-divider"])}),n(b,{node:y,className:"cart-cart-summary-list__footer-text"})]})]})}),re=()=>n(zt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:n(Ut,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),ae=({initialData:d=null,hideHeading:q,hideFooter:k,routeProduct:y,routeEmptyCartCTA:_,routeCart:u,onItemUpdate:v,onItemRemove:S,maxItems:m,slots:c,attributesToHide:l=[],enableRemoveItem:j,enableUpdateItemQuantity:T,onItemsErrorsChange:$,accordion:ft=!1,variant:Z="primary",isLoading:mt,showMaxItems:W,showDiscount:ht,showSavings:yt,quantityType:vt,dropdownOptions:pt,...J})=>{var rt;const[B,kt]=N(!d),[a,Ct]=N(d),[E,wt]=N(new Set),[A,Lt]=N(new Map),s=(rt=Ht.config)==null?void 0:rt.shoppingCartDisplaySetting,[Q,_t]=N(W?!0:!m&&!W),i=te({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage",viewMore:"Cart.Cart.viewMore",viewAll:"Cart.Cart.viewAll",discountPercent:"Cart.CartItem.discountPercentage",savingsAmount:"Cart.CartItem.savingsAmount"}),F=(t,e)=>{wt(r=>(e?r.add(t):r.delete(t),new Set(r)))},K=(t,e)=>{Lt(r=>(e?r.set(t,e):r.delete(t),new Map(r)))},M=(t,e)=>{F(t.uid,!0),K(t.uid),j&&e===0?ut([{uid:t.uid,quantity:e}]).then(()=>{S==null||S({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r)}):T&&ut([{uid:t.uid,quantity:e}]).then(()=>{v==null||v({item:t})}).finally(()=>{F(t.uid,!1)}).catch(r=>{console.warn(r),K(t.uid,r.message)})},St=Ft(()=>{_t(t=>!t)},[]);ot(()=>{const t=Yt.on("cart/data",e=>{Ct(e),kt(!!mt)},{eager:!0});return()=>{t==null||t.off()}},[]),ot(()=>{$&&$(A)},[A,$]);const Et=(t,e)=>{if(l.includes("image"))return;const r=n(Kt,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return n(w,{name:"Thumbnail",slot:c==null?void 0:c.Thumbnail,context:{item:t},children:y?n("a",{href:y(t),children:r}):r})},It=t=>{if(!l.includes("name"))return n("span",{"data-testid":"cart-list-item-title",children:y?n("a",{href:y(t),children:t.name}):t.name})},xt=t=>{if(l.includes("configurations"))return;const e={...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null};if(Object.keys(e).length!==0)return e},Pt=t=>{var e,r,f,g;return(s==null?void 0:s.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(r=t.taxedPrice)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(f=t.regularPrice)==null?void 0:f.value,currency:(g=t.regularPrice)==null?void 0:g.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},Nt=t=>{var e,r;return{amount:(e=t.savingsAmount)==null?void 0:e.value,currency:(r=t.savingsAmount)==null?void 0:r.currency,style:{font:"inherit"},"data-testid":"item-savings-amount"}},Ot=t=>(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX"?n(O,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,At=t=>{var f,g,p,C,I,x,P,at,it,ct;const e={"aria-label":i.regularPrice},r=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(s==null?void 0:s.price)?(e.amount=(f=t.rowTotalIncludingTax)==null?void 0:f.value,e.currency=(g=t.rowTotalIncludingTax)==null?void 0:g.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",r&&(e.amount=(p=t.total)==null?void 0:p.value,e.currency=(C=t.total)==null?void 0:C.currency,r.amount=(I=t.rowTotalIncludingTax)==null?void 0:I.value,r.currency=(x=t.rowTotalIncludingTax)==null?void 0:x.currency,r.sale=!0,r["aria-label"]=i.discountedPrice,r["data-testid"]="discount-total")):(e.amount=(P=t.total)==null?void 0:P.value,e.currency=(at=t.total)==null?void 0:at.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",r&&(r.amount=(it=t.discountedTotal)==null?void 0:it.value,r.currency=(ct=t.discountedTotal)==null?void 0:ct.currency,r.sale=!0,r["aria-label"]=i.regularPrice,r["data-testid"]="discount-total")),{totalProps:e,discountProps:r}},Qt=t=>{var I,x,P;if(l.includes("warning"))return;const e=A.get(t.uid),r=(I=A.get(t.uid))==null?void 0:I.includes("The requested qty is not available"),f=E.has(t.uid),g=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(x=t.stockLevel)==null?void 0:x.toString()).replace("{count}",t.quantity.toString()):"",p=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(P=t.onlyXLeftInStock)==null?void 0:P.toString()),C=!t.outOfStock&&e&&r?i.notAvailableMessage:e;return!f&&(e||t.insufficientQuantity||t.lowInventory)?h("span",{"data-testid":"item-warning",children:[n(z,{source:ne,size:"16"}),C||g||p]}):void 0},Gt=t=>l!=null&&l.includes("alert")?void 0:!E.has(t.uid)&&t.outOfStock?h("span",{"data-testid":"item-alert",children:[n(z,{source:dt,size:"16"}),i.outOfStockAlert]}):void 0,Vt=t=>n(w,{name:"ProductAttributes",slot:c==null?void 0:c.ProductAttributes,context:{item:t}}),bt=t=>{if(!l.includes("sku"))return n("span",{"data-testid":"cart-list-item-sku",children:t.sku})},Xt=t=>n(w,{name:"Footer",slot:c==null?void 0:c.Footer,context:{item:t}}),R=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,r)=>{var p;const{totalProps:f,discountProps:g}=At(e);return n(Jt,{updating:E==null?void 0:E.has(e.uid),loading:B,"data-testid":`cart-list-item-entry-${e.uid}`,image:Et(e,r),title:It(e),sku:bt(e),price:l.includes("price")?void 0:n(O,{...Pt(e)}),quantity:l.includes("quantity")?void 0:e.quantity,total:h(X,{children:[l.includes("total")?void 0:n(O,{...f}),l.includes("totalDiscount")?void 0:g&&n(O,{...g})]}),attributes:Vt(e),configurations:xt(e),totalExcludingTax:l.includes("totalExcludingTax")?void 0:Ot(e),taxIncluded:(s==null?void 0:s.price)==="INCLUDING_TAX",taxExcluded:!l.includes("totalExcludingTax")&&(s==null?void 0:s.price)==="INCLUDING_EXCLUDING_TAX",warning:Qt(e),alert:Gt(e),quantityType:vt,dropdownOptions:pt,onQuantity:T?C=>{M(e,C)}:void 0,onRemove:j?()=>M(e,0):void 0,discount:ht&&e.discounted&&e.discountPercentage?n("div",{"data-testid":"item-discount-percent",children:i.discountPercent.replace("{discount}",((p=e.discountPercentage)==null?void 0:p.toString())??"")}):void 0,savings:yt&&e.discounted&&e.savingsAmount?h("div",{children:[n("span",{children:n(O,{...Nt(e)})})," ",i.savingsAmount]}):void 0,footer:Xt(e)},e.uid)}):null,Y=n(w,{name:"EmptyCart",slot:c==null?void 0:c.EmptyCart,context:{},children:n(Mt,{"data-testid":"empty-cart",ctaLinkURL:_==null?void 0:_()})}),H=n(w,{name:"Heading",slot:c==null?void 0:c.Heading,context:{count:a==null?void 0:a.totalQuantity},children:n("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),jt=H.props.children.props.children,$t=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{M(e,0)})},Zt=R(t=>t.outOfStock||t.insufficientQuantity||!1),D=a!=null&&a.hasOutOfStockItems?n(qt,{"data-testid":"cart-out-of-stock-message",icon:n(z,{source:dt,size:"16"}),itemList:n(lt,{"data-testid":"out-of-stock-cart-items",children:Zt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&j?[{label:i.removeAction,onClick:$t}]:void 0}):void 0,G=R(t=>!t.outOfStock&&!t.insufficientQuantity),tt=Q?Math.max(m||5,5):Math.min((a==null?void 0:a.totalQuantity)||5,5),et=(a==null?void 0:a.totalQuantity)>tt,Bt=et&&!Q&&tt!=m,V=a!=null&&a.totalQuantity&&G?n(w,{name:"Footer",slot:c==null?void 0:c.CartSummaryFooter,context:{displayMaxItems:Q,routeCart:u},"data-testid":"cart-cart-summary-footer-slot",children:n("div",{"data-testid":"cart-cart-summary-footer",children:et?Bt?n(U,{className:"cart-cart-summary-list-footer__action",onClick:St,"data-testid":"view-more-items-button",variant:"tertiary",children:i.viewMore}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-or-less-items-button",children:i.viewAll}):u&&n(U,{className:"cart-cart-summary-list-footer__action",href:u(),variant:"tertiary","data-testid":"view-cart-button",children:i.viewAll})})}):null,nt=a!=null&&a.totalQuantity?n(lt,{"data-testid":"cart-list",children:G==null?void 0:G.slice(0,Q?Math.max(m||(a==null?void 0:a.totalQuantity),5):Math.min(m??5,5))}):null;return ft?n(Tt,{"data-testid":"cart-summary-list-accordion",className:L(["cart-cart-summary-list-accordion",`cart-cart-summary-list__background--${Z}`]),iconOpen:ee,iconClose:Dt,children:n(Wt,{title:jt,"data-testid":"cart-summary-list-accordion__section",open:!0,renderContentWhenClosed:!0,children:n(gt,{...J,"aria-expanded":!0,"aria-label":"TEST",className:"cart-cart-summary-list-accordion__list",loading:B,footer:k?void 0:V||(u?V:void 0),emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})})}):n(gt,{...J,heading:q?void 0:H,footer:k?void 0:V||(u?V:void 0),loading:B,emptyCart:Y,products:nt,outOfStockMessage:D,variant:Z})};ae.getInitialData=async function(){return Rt()};export{ae as C}; diff --git a/scripts/__dropins__/storefront-cart/chunks/ChevronDown.js b/scripts/__dropins__/storefront-cart/chunks/ChevronDown.js index d22f552f68..b0fe49e76c 100644 --- a/scripts/__dropins__/storefront-cart/chunks/ChevronDown.js +++ b/scripts/__dropins__/storefront-cart/chunks/ChevronDown.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import*as e from"@dropins/tools/preact-compat.js";const o=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"}));export{o as S}; diff --git a/scripts/__dropins__/storefront-cart/chunks/Coupon.js b/scripts/__dropins__/storefront-cart/chunks/Coupon.js index 2408ee585b..7d96ff8239 100644 --- a/scripts/__dropins__/storefront-cart/chunks/Coupon.js +++ b/scripts/__dropins__/storefront-cart/chunks/Coupon.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import*as C from"@dropins/tools/preact-compat.js";const M=H=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...H},C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"#3D3D3D"}));export{M as S}; diff --git a/scripts/__dropins__/storefront-cart/chunks/EmptyCart.js b/scripts/__dropins__/storefront-cart/chunks/EmptyCart.js index 81268320a0..91e924c1ea 100644 --- a/scripts/__dropins__/storefront-cart/chunks/EmptyCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/EmptyCart.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 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}; diff --git a/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js b/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js index ffdef31c0f..3143bb1389 100644 --- a/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js +++ b/scripts/__dropins__/storefront-cart/chunks/OrderSummary.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsxs as E,jsx as r,Fragment as We}from"@dropins/tools/preact-jsx-runtime.js";import*as Ie from"@dropins/tools/preact-compat.js";import{useState as M,useEffect as ae,useCallback as Fe}from"@dropins/tools/preact-compat.js";import{VComponent as D,classes as ke,Slot as we}from"@dropins/tools/lib.js";import{events as Ee}from"@dropins/tools/event-bus.js";import{g as Ge}from"./persisted-data.js";import{s as Oe}from"./resetCart.js";import{g as ze}from"./getEstimatedTotals.js";import{p as Ve}from"./acdl.js";import{Accordion as Ne,AccordionSection as Be,ProgressSpinner as Ze,Divider as je,Price as l,Icon as Ue,Button as Qe}from"@dropins/tools/components.js";/* empty css */import{O as v}from"./OrderSummaryLine.js";import{S as Le}from"./ChevronDown.js";import{useText as Ae}from"@dropins/tools/i18n.js";import{S as Xe}from"./Coupon.js";const De=O=>Ie.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...O},Ie.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$e=({className:O,children:A,variant:P="primary",heading:s,loading:N=!0,subTotal:g,shipping:m,discounts:_,taxTotal:x,taxesApplied:e,total:p,primaryAction:B,coupons:o,totalSaved:y,updateLineItems:I=T=>T,...t})=>{const[T,L]=M(!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"})]}))}),S=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:!T&&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:S},...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]=M(!1),[P,s]=M();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,T,L,i,k,w,S,d,h,n,C,ee,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:(T=(t=o.subtotal)==null?void 0:t.excludingTax)==null?void 0:T.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=(S=o.subtotal)==null?void 0:S.includingTax)==null?void 0:d.currency},includingDiscountOnly:{amount:(n=(h=o.subtotal)==null?void 0:h.includingDiscountOnly)==null?void 0:n.value,currency:(ee=(C=o.subtotal)==null?void 0:C.includingDiscountOnly)==null?void 0:ee.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,ie,ne,ce,oe,ue,se,le,me,de,xe,pe,he,ge,ye,Te,Se,Ce,be,fe;const[e,p]=M(A),[B,o]=M(!1),y=e==null?void 0:e.isVirtual;m=m??!0;const{handleEstimateTotals:I,estimatedTotals:t,setEstimatedTotals:T,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",S=i==null?void 0:i.zeroTax;ae(()=>{const c=Ee.on("cart/data",a=>{var J,K,Y;p(a);const te=(J=a==null?void 0:a.addresses)==null?void 0:J.shipping,re=a==null?void 0:a.isVirtual;(te||re)&&T(null),t==null&&T({estimatedTaxTotal:{amount:(K=a==null?void 0:a.totalTax)==null?void 0:K.value,currency:(Y=a==null?void 0:a.totalTax)==null?void 0:Y.currency}})},{eager:!0});return()=>{c==null||c.off()}},[]),ae(()=>{o(N)},[N]),ae(()=>{const c=Ee.on("shipping/estimate",a=>{var J,K,Y,ve,Pe,_e;const te={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:(ve=a==null?void 0:a.address)==null?void 0:ve.postCode},re={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(te,re)});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 ee=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:ee,loading:L,updateLineItems:_,subTotal:{taxIncluded:k&&!S,taxExcluded:w,zeroTaxSubtotal:S,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:!S&&k||!S&&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&&t.estimatedTaxTotal==null?{price:r("span",{"data-testid":"tax-total-tbd",children:d.taxToBeDetermined})}:{price:t!=null&&t.estimatedTaxTotal?r(l,{"data-testid":"tax-total-estimated",...t==null?void 0:t.estimatedTaxTotal}):r(l,{"data-testid":"tax-total-actual",amount:(R=e==null?void 0:e.totalTax)==null?void 0:R.value,currency:(ie=e==null?void 0:e.totalTax)==null?void 0:ie.currency}),estimated:(!t||!t.estimatedTaxTotal)&&!((ne=e==null?void 0:e.addresses)!=null&&ne.shipping)},taxesApplied:y?void 0:i!=null&&i.fullSummary?(oe=((ce=t==null?void 0:t.estimatedAppliedTaxes)==null?void 0:ce.taxes)||(e==null?void 0:e.appliedTaxes))==null?void 0:oe.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?((se=(ue=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:ue.includingTax)==null?void 0:se.amount)===0?r("span",{"data-testid":"total-including-tax",children:d.free}):r(l,{"data-testid":"total-including-tax-estimated",...(le=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:le.includingTax}):((me=e==null?void 0:e.total)==null?void 0:me.includingTax.value)===0?r("span",{"data-testid":"total-including-tax",children:d.free}):r(l,{"data-testid":"total-including-tax-actual",amount:(de=e==null?void 0:e.total)==null?void 0:de.includingTax.value,currency:(xe=e==null?void 0:e.total)==null?void 0:xe.includingTax.currency}),estimated:(!t||!!(t!=null&&t.estimatedTaxTotal))&&!((pe=e==null?void 0:e.addresses)!=null&&pe.shipping),priceWithoutTax:i!=null&&i.grandTotal?t!=null&&t.estimatedAppliedTaxes?((ge=(he=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:he.excludingTax)==null?void 0:ge.amount)===0?r("span",{"data-testid":"total-excluding-tax",children:d.free}):r(l,{"data-testid":"total-excluding-tax",...(ye=t==null?void 0:t.estimatedGrandTotalPrice)==null?void 0:ye.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:(Se=e==null?void 0:e.total)==null?void 0:Se.excludingTax.value,currency:(Ce=e==null?void 0:e.total)==null?void 0:Ce.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:(be=e==null?void 0:e.discount)==null?void 0:be.value,currency:(fe=e==null?void 0:e.total)==null?void 0:fe.includingTax.currency}):void 0})};He.getInitialData=async function(){return Ge()};export{He as O}; diff --git a/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js b/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js index 0619a1d68e..ff228c6915 100644 --- a/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js +++ b/scripts/__dropins__/storefront-cart/chunks/OrderSummaryLine.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 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";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";const u=({label:e,price:a,classSuffixes:s=[],labelClassSuffix:r,testId:m,children:o,...t})=>{const d="cart-order-summary__label",p="cart-order-summary__price";return _("div",{...t,...m?{"data-testid":m}:{},className:c(["cart-order-summary__entry",...s.map(i=>"cart-order-summary__"+i)]),children:[n("span",{className:c([d,...r?[d+"--"+r]:[]]),children:e}),n(y,{node:a,className:c([p,...r?[p+"--"+r]:[]])}),o]})},L=({label:e,price:a,classSuffixes:s=[],labelClassSuffix:r,testId:m,children:o,...t})=>n(u,{...t,label:e,price:a,classSuffixes:s,labelClassSuffix:r,testId:m,children:o});export{L as O}; diff --git a/scripts/__dropins__/storefront-cart/chunks/acdl.js b/scripts/__dropins__/storefront-cart/chunks/acdl.js index 1beee908b2..cc48ca6cbc 100644 --- a/scripts/__dropins__/storefront-cart/chunks/acdl.js +++ b/scripts/__dropins__/storefront-cart/chunks/acdl.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ function d(n){const{cart:e,locale:t="en-US"}=n;return{id:e.id,items:g(e.items,t),prices:{subtotalExcludingTax:e.subtotal.excludingTax,subtotalIncludingTax:e.subtotal.includingTax},totalQuantity:e.totalUniqueItems,possibleOnepageCheckout:void 0,giftMessageSelected:void 0,giftWrappingSelected:void 0,source:void 0}}function g(n,e){return n.map(t=>({canApplyMsrp:!1,formattedPrice:P(e,t.price.currency,t.price.value),id:t.uid,prices:{price:t.price},product:{productId:t.uid,name:t.name,sku:t.sku,topLevelSku:t.topLevelSku,specialToDate:void 0,specialFromDate:void 0,newToDate:void 0,newFromDate:void 0,createdAt:void 0,updatedAt:void 0,manufacturer:void 0,countryOfManufacture:void 0,categories:t.categories,productType:t.itemType,pricing:{regularPrice:t.regularPrice.value,minimalPrice:void 0,maximalPrice:void 0,specialPrice:v(t),tierPricing:void 0,currencyCode:t.regularPrice.currency},canonicalUrl:t.canonicalUrl,mainImageUrl:t.image.src,image:{src:t.image.src,alt:t.image.alt}},configurableOptions:void 0,quantity:t.quantity}))}function P(n,e,t){const o=n.replace("_","-");return new Intl.NumberFormat(o,{style:"currency",currency:e}).format(t)}function v(n){var e;if(n.discounted)return(e=n.price)==null?void 0:e.value}const r={SHOPPING_CART_CONTEXT:"shoppingCartContext",PRODUCT_CONTEXT:"productContext",CHANGED_PRODUCTS_CONTEXT:"changedProductsContext"},c={OPEN_CART:"open-cart",ADD_TO_CART:"add-to-cart",REMOVE_FROM_CART:"remove-from-cart",SHOPPING_CART_VIEW:"shopping-cart-view",INITIATE_CHECKOUT:"initiate-checkout"};function O(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function i(n,e){const t=O();t.push({[n]:null}),t.push({[n]:e})}function T(n,e){O().push(o=>{const C=o.getState?o.getState():{};o.push({event:n,eventInfo:{...C,...e}})})}function D(n,e,t){const o=d({cart:n,locale:t});i(r.SHOPPING_CART_CONTEXT,{...o}),T(c.OPEN_CART),g(e,t).forEach(u=>{i(r.PRODUCT_CONTEXT,u.product),p(o,[u],c.ADD_TO_CART)})}function R(n,e){const t=d({cart:n,locale:e});i(r.SHOPPING_CART_CONTEXT,{...t}),T(c.SHOPPING_CART_VIEW)}function p(n,e,t){const o={items:e};i(r.SHOPPING_CART_CONTEXT,{...n}),i(r.CHANGED_PRODUCTS_CONTEXT,{...o}),T(t)}function I(n,e,t){const o=d({cart:n,locale:t}),C=o.items,u=O(),E=u.getState?u.getState():{},{shoppingCartContext:{items:f=[]}={}}=E;e.forEach(_=>{const s=f.find(l=>l.id===_.uid),a=C.find(l=>l.id===_.uid);!a&&!s||(!s&&a?(i(r.PRODUCT_CONTEXT,a.product),p(o,[a],c.ADD_TO_CART)):s&&!a?(i(r.PRODUCT_CONTEXT,s.product),p(o,[s],c.REMOVE_FROM_CART)):a.quantity>s.quantity?(i(r.PRODUCT_CONTEXT,a.product),p(o,[a],c.ADD_TO_CART)):(i(r.PRODUCT_CONTEXT,a.product),p(o,[a],c.REMOVE_FROM_CART)))})}function h(n,e){const t=d({cart:n,locale:e});i(r.SHOPPING_CART_CONTEXT,{...t}),T(c.INITIATE_CHECKOUT)}export{I as a,D as b,R as c,h as p}; diff --git a/scripts/__dropins__/storefront-cart/chunks/applyCouponsToCart.js b/scripts/__dropins__/storefront-cart/chunks/applyCouponsToCart.js index c075999018..836bdebcff 100644 --- a/scripts/__dropins__/storefront-cart/chunks/applyCouponsToCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/applyCouponsToCart.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{s as c,f as T,h as A}from"./resetCart.js";import{C as _,t as i}from"./refreshCart.js";import{events as n}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as u}from"../fragments.js";const P=` mutation APPLY_COUPONS_TO_CART_MUTATION( diff --git a/scripts/__dropins__/storefront-cart/chunks/getEstimateShipping.js b/scripts/__dropins__/storefront-cart/chunks/getEstimateShipping.js index 901a37bd34..921557bcd7 100644 --- a/scripts/__dropins__/storefront-cart/chunks/getEstimateShipping.js +++ b/scripts/__dropins__/storefront-cart/chunks/getEstimateShipping.js @@ -1,6 +1,6 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{s as a,f as u,h as l}from"./resetCart.js";import{events as p}from"@dropins/tools/event-bus.js";const h=e=>{var r,n;return{countryCode:e.country_code||"US",postCode:e.postcode||"",region:((r=e.region)==null?void 0:r.region)||"",regionId:(n=e.region)==null?void 0:n.id}},m=e=>e?{carrierCode:e.carrier_code||"",methodCode:e.method_code||"",amount:e.amount,...e.price_excl_tax&&{amountExclTax:{value:e.price_excl_tax.value,currency:e.price_excl_tax.currency}},...e.price_incl_tax&&{amountInclTax:{value:e.price_incl_tax.value,currency:e.price_incl_tax.currency}}}:null,g=` +import{s as a,f as u,h as l}from"./resetCart.js";import{events as p}from"@dropins/tools/event-bus.js";const h=e=>{var r,t;return{countryCode:e.country_code||"US",postCode:e.postcode||"",region:((r=e.region)==null?void 0:r.region)||"",regionId:(t=e.region)==null?void 0:t.id}},m=e=>e?{carrierCode:e.carrier_code||"",methodCode:e.method_code||"",amount:e.amount,...e.price_excl_tax&&{amountExclTax:{value:e.price_excl_tax.value,currency:e.price_excl_tax.currency}},...e.price_incl_tax&&{amountInclTax:{value:e.price_incl_tax.value,currency:e.price_incl_tax.currency}}}:null,g=` query COUNTRIES_QUERY { countries { label: full_name_locale @@ -19,7 +19,7 @@ query REGIONS_QUERY($id: String) { } } } -`,y=` +`,E=` mutation ESTIMATE_SHIPPING_METHODS_MUTATION( $cartId: String! $address: EstimateAddressInput! @@ -47,4 +47,4 @@ query REGIONS_QUERY($id: String) { } } } -`,x=async e=>{const r=a.cartId;if(!r)throw new Error("No cart ID found");if(!e)throw new Error("No address parameter found");const{countryCode:n,postcode:c,region:t}=e,i={country_code:n||"US",postcode:c||"",region:{region:(t==null?void 0:t.region)||"",region_id:t==null?void 0:t.id}};return u(y,{variables:{cartId:r,address:i}}).then(({errors:o,data:s})=>{if(o)return l(o);const d=s.estimateShippingMethods.find(_=>!_.error_message)||null;return p.emit("shipping/estimate",{address:h(i),shippingMethod:m(d)}),d})},C=async()=>u(g,{}).then(({errors:e,data:r})=>{var t,i;if(e)return l(e);const n=((t=r==null?void 0:r.countries)==null?void 0:t.sort((o,s)=>o.label.localeCompare(s.label)))||[],c=((i=r==null?void 0:r.storeConfig)==null?void 0:i.defaultCountry)||"US";return n.forEach(o=>{o.isDefaultCountry=o.id===c}),n}),T=async e=>u(f,{variables:{id:e}}).then(({errors:r,data:n})=>{var c;return r?l(r):((c=n==null?void 0:n.country)==null?void 0:c.available_regions)||[]});export{T as a,x as b,C as g}; +`,x=async e=>{const r=a.cartId;if(!r)throw new Error("No cart ID found");if(!e)throw new Error("No address parameter found");const{countryCode:t,postcode:c,region:n}=e,i={country_code:t||"US",postcode:c||"",region:{region:(n==null?void 0:n.region)||"",region_id:n==null?void 0:n.id}};return u(E,{variables:{cartId:r,address:i}}).then(({errors:o,data:s})=>{if(o)return l(o);const d=s.estimateShippingMethods.find(_=>!_.error_message)||null;return p.emit("shipping/estimate",{address:h(i),shippingMethod:m(d)}),d})},C=async()=>u(g,{method:"GET"}).then(({errors:e,data:r})=>{var n,i;if(e)return l(e);const t=((n=r==null?void 0:r.countries)==null?void 0:n.sort((o,s)=>o.label.localeCompare(s.label)))||[],c=((i=r==null?void 0:r.storeConfig)==null?void 0:i.defaultCountry)||"US";return t.forEach(o=>{o.isDefaultCountry=o.id===c}),t}),T=async e=>u(f,{method:"GET",variables:{id:e}}).then(({errors:r,data:t})=>{var c;return r?l(r):((c=t==null?void 0:t.country)==null?void 0:c.available_regions)||[]});export{T as a,x as b,C as g}; diff --git a/scripts/__dropins__/storefront-cart/chunks/getEstimatedTotals.js b/scripts/__dropins__/storefront-cart/chunks/getEstimatedTotals.js index 253c784111..da3a62f3be 100644 --- a/scripts/__dropins__/storefront-cart/chunks/getEstimatedTotals.js +++ b/scripts/__dropins__/storefront-cart/chunks/getEstimatedTotals.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{s as h,f as T,h as m}from"./resetCart.js";import{C as A,t as E}from"./refreshCart.js";import"@dropins/tools/event-bus.js";import{CART_FRAGMENT as I}from"../fragments.js";const u=` mutation GET_ESTIMATED_TOTALS_MUTATION( diff --git a/scripts/__dropins__/storefront-cart/chunks/persisted-data.js b/scripts/__dropins__/storefront-cart/chunks/persisted-data.js index 17cbc0abff..84db81f5c3 100644 --- a/scripts/__dropins__/storefront-cart/chunks/persisted-data.js +++ b/scripts/__dropins__/storefront-cart/chunks/persisted-data.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ function s(e){e?sessionStorage.setItem("DROPIN__CART__CART__DATA",JSON.stringify(e)):sessionStorage.removeItem("DROPIN__CART__CART__DATA")}function t(){const e=sessionStorage.getItem("DROPIN__CART__CART__DATA");return e?JSON.parse(e):null}function _(e){e?sessionStorage.setItem("DROPIN__CART__SHIPPING__DATA",JSON.stringify(e)):sessionStorage.removeItem("DROPIN__CART__SHIPPING__DATA")}export{s as a,t as g,_ as s}; diff --git a/scripts/__dropins__/storefront-cart/chunks/refreshCart.js b/scripts/__dropins__/storefront-cart/chunks/refreshCart.js index 55168d3d2a..4ee9438186 100644 --- a/scripts/__dropins__/storefront-cart/chunks/refreshCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/refreshCart.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{s as i,d as A,f as g,h as y}from"./resetCart.js";import{events as l}from"@dropins/tools/event-bus.js";import{Initializer as R,merge as w}from"@dropins/tools/lib.js";import{a as G}from"./persisted-data.js";import{CART_FRAGMENT as d}from"../fragments.js";const I=new R({init:async r=>{const t={disableGuestCart:!1,...r};I.config.setConfig(t),f().catch(console.error)},listeners:()=>[l.on("authenticated",r=>{i.authenticated&&!r?l.emit("cart/reset",void 0):r&&!i.authenticated&&(i.authenticated=r,f().catch(console.error))},{eager:!0}),l.on("locale",async r=>{r!==i.locale&&(i.locale=r,f().catch(console.error))}),l.on("cart/reset",()=>{A().catch(console.error),l.emit("cart/data",null)}),l.on("cart/data",r=>{G(r)}),l.on("checkout/updated",r=>{r&&tr().catch(console.error)})]}),S=I.config;function b(r){var n,e,c,u,s,a,o,_,p,h;if(!r)return null;const t={id:r.id,totalQuantity:z(r),totalUniqueItems:r.itemsV2.items.length,errors:D(r==null?void 0:r.itemsV2),items:v(r==null?void 0:r.itemsV2),miniCartMaxItems:v(r==null?void 0:r.itemsV2).slice(0,((n=i.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency},excludingTax:{value:r.prices.grand_total_excluding_tax.value,currency:r.prices.grand_total_excluding_tax.currency}},discount:x(r.prices.discounts,r.prices.grand_total.currency),subtotal:{excludingTax:{value:(e=r.prices.subtotal_excluding_tax)==null?void 0:e.value,currency:(c=r.prices.subtotal_excluding_tax)==null?void 0:c.currency},includingTax:{value:(u=r.prices.subtotal_including_tax)==null?void 0:u.value,currency:(s=r.prices.subtotal_including_tax)==null?void 0:s.currency},includingDiscountOnly:{value:(a=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:a.value,currency:(o=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:o.currency}},appliedTaxes:T(r.prices.applied_taxes),totalTax:x(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:T(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&Q(r)},isGuestCart:!i.authenticated,hasOutOfStockItems:q(r),hasFullyOutOfStockItems:V(r),appliedCoupons:r.applied_coupons};return w(t,(h=(p=(_=S.getConfig().models)==null?void 0:_.CartModel)==null?void 0:p.transformer)==null?void 0:h.call(p,r))}function x(r,t){return r!=null&&r.length?r.reduce((n,e)=>({value:n.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:t}):{value:0,currency:t}}function k(r,t){var n,e,c,u;return{src:r!=null&&r.useConfigurableParentThumbnail?t.product.thumbnail.url:((e=(n=t.configured_variant)==null?void 0:n.thumbnail)==null?void 0:e.url)||t.product.thumbnail.url,alt:r!=null&&r.useConfigurableParentThumbnail?t.product.thumbnail.label:((u=(c=t.configured_variant)==null?void 0:c.thumbnail)==null?void 0:u.label)||t.product.thumbnail.label}}function U(r){var t,n,e,c;return r.__typename==="ConfigurableCartItem"?{value:(n=(t=r.configured_variant)==null?void 0:t.price_range)==null?void 0:n.maximum_price.regular_price.value,currency:(c=(e=r.configured_variant)==null?void 0:e.price_range)==null?void 0:c.maximum_price.regular_price.currency}:r.__typename==="GiftCardCartItem"?{value:r.prices.price.value,currency:r.prices.price.currency}:{value:r.prices.original_item_price.value,currency:r.prices.original_item_price.currency}}function M(r){var t,n,e;return r.__typename==="ConfigurableCartItem"?((n=(t=r.configured_variant)==null?void 0:t.price_range)==null?void 0:n.maximum_price.discount.amount_off)>0:((e=r.product.price_range)==null?void 0:e.maximum_price.discount.amount_off)>0}function v(r){var n;if(!((n=r==null?void 0:r.items)!=null&&n.length))return[];const t=i.config;return r.items.map(e=>{var c,u,s,a;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(o=>o.url_key)},canonicalUrl:e.product.canonical_url,categories:e.product.categories.map(o=>o.name),quantity:e.quantity,sku:K(e),topLevelSku:e.product.sku,name:e.product.name,image:k(t,e),price:{value:e.prices.price.value,currency:e.prices.price.currency},taxedPrice:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},fixedProductTaxes:e.prices.fixed_product_taxes,rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency},links:$(e.links),total:{value:(c=e.prices.original_row_total)==null?void 0:c.value,currency:(u=e.prices.original_row_total)==null?void 0:u.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency,label:(s=e.prices.discounts)==null?void 0:s.map(o=>o.label)},regularPrice:U(e),discounted:M(e),bundleOptions:e.__typename==="BundleCartItem"?N(e.bundle_options):null,selectedOptions:P(e.configurable_options),customizableOptions:F(e.customizable_options),sender:e.__typename==="GiftCardCartItem"?e.sender_name:null,senderEmail:e.__typename==="GiftCardCartItem"?e.sender_email:null,recipient:e.__typename==="GiftCardCartItem"?e.recipient_name:null,recipientEmail:e.__typename==="GiftCardCartItem"?e.recipient_email:null,message:e.__typename==="GiftCardCartItem"?e.message:null,discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},onlyXLeftInStock:e.__typename==="ConfigurableCartItem"?(a=e.configured_variant)==null?void 0:a.only_x_left_in_stock:e.product.only_x_left_in_stock,lowInventory:e.is_available&&e.product.only_x_left_in_stock!==null,insufficientQuantity:(e.__typename==="ConfigurableCartItem"?e.configured_variant:e.product).stock_status==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockLevel:L(e),discountPercentage:X(e),savingsAmount:Y(e),productAttributes:j(e)}})}function D(r){var n;const t=(n=r==null?void 0:r.items)==null?void 0:n.reduce((e,c)=>{var u;return(u=c.errors)==null||u.forEach(s=>{e.push({uid:c.uid,text:s.message})}),e},[]);return t!=null&&t.length?t:null}function T(r){return r!=null&&r.length?r.map(t=>({amount:{value:t.amount.value,currency:t.amount.currency},label:t.label,coupon:t.coupon})):[]}function N(r){const t=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(c=>c.label).join(", ")})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function P(r){const t=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),n={};return t==null||t.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function F(r){const t=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(c=>({uid:c.customizable_option_value_uid,label:c.label,value:c.value}))})),n={};return t==null||t.forEach(e=>{var c;switch(e.type){case"field":case"area":case"date_time":n[e.label]=e.values[0].value;break;case"radio":case"drop_down":n[e.label]=e.values[0].label;break;case"multiple":case"checkbox":n[e.label]=e.values.reduce((_,p)=>_?`${_}, ${p.label}`:p.label,"");break;case"file":const u=new DOMParser,s=e.values[0].value,o=((c=u.parseFromString(s,"text/html").querySelector("a"))==null?void 0:c.textContent)||"";n[e.label]=o;break}}),n}function z(r){var t,n;return((t=i.config)==null?void 0:t.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((n=i.config)==null?void 0:n.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function $(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(t=>t.title).join(", ")}:null}function Q(r){var t,n,e,c;return(t=r.shipping_addresses)!=null&&t.length?(n=r.shipping_addresses)==null?void 0:n.map(u=>({countryCode:u.country.code,zipCode:u.postcode,regionCode:u.region.code})):(e=r.addresses)!=null&&e.length?(c=r.addresses)==null?void 0:c.filter(u=>u.default_shipping).map(u=>{var s;return u.default_shipping&&{countryCode:u.country_code,zipCode:u.postcode,regionCode:(s=u.region)==null?void 0:s.region_code}}):null}function q(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function L(r){if(!r.not_available_message)return null;const t=r.not_available_message.match(/-?\d+/);return t?parseInt(t[0]):"noNumber"}function V(r){var t,n;return(n=(t=r==null?void 0:r.itemsV2)==null?void 0:t.items)==null?void 0:n.some(e=>{var c;return((c=e==null?void 0:e.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"})}function X(r){var n,e,c,u,s,a,o,_;let t;if(r.__typename==="ConfigurableCartItem")t=(u=(c=(e=(n=r==null?void 0:r.configured_variant)==null?void 0:n.price_range)==null?void 0:e.maximum_price)==null?void 0:c.discount)==null?void 0:u.percent_off;else{if(r.__typename==="BundleCartItem")return;t=(_=(o=(a=(s=r==null?void 0:r.product)==null?void 0:s.price_range)==null?void 0:a.maximum_price)==null?void 0:o.discount)==null?void 0:_.percent_off}if(t!==0)return Math.round(t)}function K(r){var t;return r.__typename==="ConfigurableCartItem"?r.configured_variant.sku:((t=r.product)==null?void 0:t.variantSku)||r.product.sku}function Y(r){var e,c,u,s,a,o;let t,n;if(t=((c=(e=r==null?void 0:r.prices)==null?void 0:e.original_row_total)==null?void 0:c.value)-((s=(u=r==null?void 0:r.prices)==null?void 0:u.row_total)==null?void 0:s.value),n=(o=(a=r==null?void 0:r.prices)==null?void 0:a.row_total)==null?void 0:o.currency,t!==0)return{value:t,currency:n}}function j(r){var t,n,e;return(e=(n=(t=r==null?void 0:r.product)==null?void 0:t.custom_attributesV2)==null?void 0:n.items)==null?void 0:e.map(c=>{const u=c.code.split("_").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ");return{...c,code:u}})}function B(r){if(!r)return null;const t=n=>{switch(n){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}};return{displayMiniCart:r.minicart_display,miniCartMaxItemsDisplay:r.minicart_max_items,cartExpiresInDays:r.cart_expires_in_days,cartSummaryDisplayTotal:r.cart_summary_display_quantity,cartSummaryMaxItems:r.max_items_in_order_summary,defaultCountry:r.default_country,categoryFixedProductTaxDisplaySetting:r.category_fixed_product_tax_display_setting,productFixedProductTaxDisplaySetting:r.product_fixed_product_tax_display_setting,salesFixedProductTaxDisplaySetting:r.sales_fixed_product_tax_display_setting,shoppingCartDisplaySetting:{zeroTax:r.shopping_cart_display_zero_tax,subtotal:t(r.shopping_cart_display_subtotal),price:t(r.shopping_cart_display_price),shipping:t(r.shopping_cart_display_shipping),fullSummary:r.shopping_cart_display_full_summary,grandTotal:r.shopping_cart_display_grand_total,taxGiftWrapping:r.shopping_cart_display_tax_gift_wrapping},useConfigurableParentThumbnail:r.configurable_thumbnail_source==="parent"}}const C=` $pageSize: Int! = 100, diff --git a/scripts/__dropins__/storefront-cart/chunks/resetCart.js b/scripts/__dropins__/storefront-cart/chunks/resetCart.js index b095b3440b..b8c6fb6321 100644 --- a/scripts/__dropins__/storefront-cart/chunks/resetCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/resetCart.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{FetchGraphQL as i}from"@dropins/tools/fetch-graphql.js";import"@dropins/tools/event-bus.js";import{g as c}from"./persisted-data.js";function u(t){const r=document.cookie.split(";");for(let a=0;a{const t=c();return{cartId:null,authenticated:t?!t.isGuestCart:!1}})(),s=new Proxy(d,{set(t,r,a){var n;if(t[r]=a,r==="cartId"){if(a===s.cartId)return!0;if(a===null)return document.cookie="DROPIN__CART__CART-ID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/",!0;const e=(n=s.config)==null?void 0:n.cartExpiresInDays;e||console.warn('Missing "expiresInDays" config. Cookie expiration will default to 30 days.');const o=new Date;o.setDate(o.getDate()+(e??30)),document.cookie=`DROPIN__CART__CART-ID=${a}; expires=${o.toUTCString()}; path=/`}return!0},get(t,r){return r==="cartId"?u("DROPIN__CART__CART-ID"):t[r]}}),{setEndpoint:f,setFetchGraphQlHeader:C,removeFetchGraphQlHeader:I,setFetchGraphQlHeaders:D,fetchGraphQl:m,getConfig:_}=new i().getMethods(),T=t=>{const r=t.findIndex(({extensions:e})=>(e==null?void 0:e.category)==="graphql-authorization")>-1,a=t.findIndex(({path:e,extensions:o})=>(o==null?void 0:o.category)==="graphql-no-such-entity"&&!(e!=null&&e.includes("applyCouponsToCart")))>-1,n=t.map(e=>e.message).join(" ");if(r||a)return l(),console.error(n),null;throw Error(n)},l=()=>(s.cartId=null,s.authenticated=!1,Promise.resolve(null));export{f as a,C as b,D as c,l as d,m as f,_ as g,T as h,I as r,s}; diff --git a/scripts/__dropins__/storefront-cart/chunks/updateProductsFromCart.js b/scripts/__dropins__/storefront-cart/chunks/updateProductsFromCart.js index d72fa88ae3..1293945268 100644 --- a/scripts/__dropins__/storefront-cart/chunks/updateProductsFromCart.js +++ b/scripts/__dropins__/storefront-cart/chunks/updateProductsFromCart.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{s as m,f as i,h as T}from"./resetCart.js";import{C as _,t as p}from"./refreshCart.js";import{events as n}from"@dropins/tools/event-bus.js";import{a as I}from"./acdl.js";import{CART_FRAGMENT as u}from"../fragments.js";const C=` mutation UPDATE_PRODUCTS_FROM_CART_MUTATION( diff --git a/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js b/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js index bf117fe486..959dca7748 100644 --- a/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js +++ b/scripts/__dropins__/storefront-cart/containers/CartSummaryGrid.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 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"../chunks/EmptyCart.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";export{s as CartSummaryGrid,u as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js b/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js index 42a9d3b180..c79dac202e 100644 --- a/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js +++ b/scripts/__dropins__/storefront-cart/containers/CartSummaryList.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 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";import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/updateProductsFromCart.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/ChevronDown.js";export{b as CartSummaryList,c as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/Coupons.js b/scripts/__dropins__/storefront-cart/containers/Coupons.js index ec3e78f737..a00d1157ae 100644 --- a/scripts/__dropins__/storefront-cart/containers/Coupons.js +++ b/scripts/__dropins__/storefront-cart/containers/Coupons.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as o,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import*as n from"@dropins/tools/preact-compat.js";import{useRef as P,useState as E,useEffect as y}from"@dropins/tools/preact-compat.js";import{classes as a,VComponent as w,getFormValues as I}from"@dropins/tools/lib.js";import{Accordion as M,AccordionSection as b,Button as k,Icon as R,Input as T}from"@dropins/tools/components.js";/* empty css */import{S as j}from"../chunks/Coupon.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import{events as L}from"@dropins/tools/event-bus.js";import{a as x,A as N}from"../chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/refreshCart.js";import"../fragments.js";const z=s=>n.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...s},n.createElement("g",{id:"Large"},n.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),n.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),n.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),q=s=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),n.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),D=s=>n.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},n.createElement("path",{d:"M17.3332 11.75H6.6665",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",fill:"none",stroke:"currentColor"})),V=({className:s,children:_,couponCodeField:f,applyCouponsButton:p,appliedCoupons:u,error:h,onApplyCoupon:d,...r})=>{const c=P(null),g=B({couponTitle:"Cart.PriceSummary.coupon.title"}),C=v=>{var t;v.preventDefault();const S=I(c.current);d==null||d(S);const e=(t=c==null?void 0:c.current)==null?void 0:t.querySelector("input");e&&(e.value="")};return o("div",{...r,"data-testid":"cart-coupons",className:a(["cart-coupons",s]),children:o(M,{"data-testid":"coupon-code",className:a(["cart-coupons__accordion"]),actionIconPosition:"right",iconOpen:z,iconClose:D,children:A(b,{title:g.couponTitle,iconLeft:j,showIconLeft:!0,renderContentWhenClosed:!1,"data-testid":"coupon-code-accordion-section",className:a(["cart-coupons__accordion-section"]),children:[o("form",{"data-testid":"coupon-code-form",className:a(["coupon-code-form--edit"]),ref:c,children:A("div",{className:a(["coupon-code-form__action"]),children:[f&&o(w,{node:f,className:a(["coupon-code-form__codes"])}),p&&o(w,{node:p,className:a(["coupon-code-form--button"]),onClick:C,type:"submit"})]})}),h&&o(w,{node:h,className:a(["coupon-code-form__error"])}),u&&o(w,{node:u,className:a(["coupon-code-form__applied"])})]})})})},oe=({children:s,..._})=>{const[f,p]=E(new Set),[u,h]=E([]),[d,r]=E(new Set),c=B({applyButton:"Cart.PriceSummary.coupon.applyAction",placeholder:"Cart.PriceSummary.coupon.placeholder"}),g=async e=>{const t=e.coupon,i=new Set(f);i.add(t),r(new Set);const l=Array.from(i);x(l,N.REPLACE).then(m=>{if(m===null)throw new Error("Error adding coupon code");p(i)}).catch(m=>{console.warn(m),r(new Set([m.message]))})},C=e=>{const t=new Set(f);t.delete(e),r(new Set);const i=Array.from(t);x(i,N.REPLACE).then(l=>{if(l===null)throw new Error("Error removing coupon code");p(t)}).catch(l=>{console.warn(l),r(new Set([l.message]))})};y(()=>{const e=L.on("cart/data",t=>{const i=t==null?void 0:t.appliedCoupons;if(!i){h([]),r(new Set);return}const l=i.map(m=>m.code);h(l),r(new Set)},{eager:!0});return()=>{e==null||e.off()}},[]),y(()=>{p(new Set(u))},[u]),y(()=>{const e=L.on("shipping/estimate",()=>{r(new Set)},{eager:!0});return()=>{e==null||e.off()}},[]);const v=u.map(e=>o(k,{variant:"tertiary",icon:o(R,{source:q,size:"24"}),onClick:()=>C(e),children:e},e)),S=d.size>0?o("div",{"data-testid":"coupon-code-error",children:Array.from(d)[0]}):void 0;return o(V,{..._,couponCodeField:o(T,{"aria-label":c.placeholder,type:"text",placeholder:c.placeholder,name:"coupon",variant:"primary",value:"","data-testid":"coupon-code-input",maxLength:50,error:d.size>0}),applyCouponsButton:o(k,{variant:"secondary",children:c.applyButton}),error:S,appliedCoupons:o("div",{children:v}),onApplyCoupon:g})};export{oe as Coupons,oe as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/EmptyCart.js b/scripts/__dropins__/storefront-cart/containers/EmptyCart.js index 8958c56215..1b939fe13c 100644 --- a/scripts/__dropins__/storefront-cart/containers/EmptyCart.js +++ b/scripts/__dropins__/storefront-cart/containers/EmptyCart.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{E as p}from"../chunks/EmptyCart.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact-compat.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";const E=({routeCTA:t})=>m(p,{ctaLinkURL:t==null?void 0:t()});export{E as EmptyCart,E as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js b/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js index 787650cb4e..5953d15d3d 100644 --- a/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js +++ b/scripts/__dropins__/storefront-cart/containers/EstimateShipping.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsxs as A,jsx as e,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _,VComponent as Z,getFormValues as $}from"@dropins/tools/lib.js";import{Price as U,Picker as w,Input as G,Button as q}from"@dropins/tools/components.js";/* empty css */import{useRef as H,useState as r,useEffect as P,useCallback as J}from"@dropins/tools/preact-compat.js";import{useText as M,Text as v}from"@dropins/tools/i18n.js";import{s as X}from"../chunks/resetCart.js";import{events as B}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/persisted-data.js";import{g as O,a as Q,b as W}from"../chunks/getEstimateShipping.js";import"@dropins/tools/fetch-graphql.js";const Y=({countryField:k,destinationText:D,estimateButton:z,estimated:I,loading:N,onEstimate:l,price:f,priceExcludingTax:F,priceIncludingTax:n,stateField:S,taxExcluded:b,taxIncluded:T,zipField:m})=>{const d=H(null),[L,C]=r(!0),[y,i]=r("zip"),p=M({editZipAction:"Cart.EstimateShipping.editZipAction",destinationLinkAriaLabel:"Cart.EstimateShipping.destinationLinkAriaLabel",shippingLabel:"Cart.EstimateShipping.label",zipPlaceholder:"Cart.EstimateShipping.zipPlaceholder"}),x=a=>{a.preventDefault(),C(E=>!E)},t=a=>{a.preventDefault(),C(!0),i(E=>E==="zip"?"state":"zip")},h=a=>{a.preventDefault(),C(!1);const E=$(d.current);l==null||l(E)};return A("div",{"data-testid":"estimate-shipping",className:_(["cart-estimate-shipping",["cart-estimate-shipping--loading",N]]),children:[e("span",{className:"cart-estimate-shipping__label",children:I?D?A(V,{children:[e(v,{id:"Cart.EstimateShipping.estimatedDestination"}),e("a",{className:"cart-estimate-shippingLink",role:"button",href:"",onClick:x,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&x(a)},tabIndex:0,"aria-label":p.destinationLinkAriaLabel,"data-testid":"shipping-destination-link",children:D})]}):e(v,{id:"Cart.EstimateShipping.estimated"}):e(v,{id:"Cart.EstimateShipping.label"})}),e(Z,{node:f,className:"cart-estimate-shipping__price"}),I&&A(V,{children:[e("div",{className:_(["cart-estimate-shipping__caption"]),children:e("a",{href:"#",className:"cart-estimate-shipping__link",onClick:t,"data-testid":"shipping-alternate-field-link",children:y==="zip"?e(v,{id:"Cart.EstimateShipping.alternateField.state"}):e(v,{id:"Cart.EstimateShipping.alternateField.zip"})})}),A("form",{className:_(["cart-estimate-shipping--edit",["cart-estimate-shipping--hide",!L]]),ref:d,"data-testid":"shipping-estimate-form",children:[k&&e(Z,{node:k,className:_(["cart-estimate-shipping--country"])}),y==="state"?S&&e(Z,{node:S,className:_(["cart-estimate-shipping--state"])}):m&&e(Z,{node:m,className:_(["cart-estimate-shipping--zip"])}),z&&e(Z,{node:z,className:_(["cart-estimate-shipping--action"]),onClick:h,type:"submit"})]})]}),T&&e("div",{"data-testid":"shipping-tax-included",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[n," ",e(v,{id:"Cart.EstimateShipping.withTaxes"})]})}),b?e("div",{"data-testid":"shipping-tax-included-excluded",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[F," ",e(v,{id:"Cart.EstimateShipping.withoutTaxes"})]})}):void 0]})},ee=()=>{const[k,D]=r(!1),[z,I]=r([]),[N,l]=r("US"),[f,F]=r(""),[n,S]=r(""),[b,T]=r([]),[m,d]=r(!1),[L,C]=r(),[y,i]=r(),[p,x]=r(""),[t,h]=r(!1),a=()=>{l("US"),F(""),S(""),C(null),i(null),x(""),h(!1)},E=async u=>{const{shippingCountry:s,shippingState:o="",shippingZip:c=""}=u,K={countryCode:s,postcode:c,region:{region:o}};return D(!0),W(K).then(g=>(g&&(C({amount:g.amount.value,currency:g.amount.currency,priceIncludingtax:{amount:g.price_incl_tax.value,currency:g.price_incl_tax.currency},priceExcludingtax:{amount:g.price_excl_tax.value,currency:g.price_excl_tax.currency}}),i({carrier_code:g.carrier_code,method_code:g.method_code}),l(s),F(o),S(c),x(o||c||s),h(!0)),l(s),F(o),S(c),x(o||c||s),g)).finally(()=>{D(!1)})},R=u=>{u.preventDefault(),F(""),S("");const s=u.target.value;l(s)};return P(()=>{O().then(u=>{let s="US";const o=u.map(c=>(c.isDefaultCountry&&(s=c.id),{text:c.label,value:c.id}));I(o),l(s)})},[]),P(()=>{d(!0),Q(N).then(u=>{const s=u.map(o=>({text:o.name,value:o.code}));T(s)}).finally(()=>{d(!1)})},[N,d]),{loading:k,regionsLoading:m,estimatedDestinationText:p,countries:z,selectedCountry:N,selectedRegion:f,selectedZip:n,regions:b,estimatedShippingPrice:L,estimatedShippingMethod:y,shippingEstimated:t,handleEstimateShipping:E,handleCountrySelected:R,resetValues:a,setPriceSummaryLoading:D}},me=({showDefaultEstimatedShippingCost:k})=>{var x;const[D,z]=r(!1),{loading:I,countries:N,regions:l,selectedCountry:f,estimatedDestinationText:F,estimatedShippingPrice:n,handleCountrySelected:S,handleEstimateShipping:b,regionsLoading:T,selectedRegion:m,selectedZip:d,shippingEstimated:L,resetValues:C}=ee(),y=J(t=>{b(t).then(()=>{j(t)})},[b]);P(()=>{const t=B.on("cart/data",h=>{var s,o,c;z((h==null?void 0:h.isVirtual)||!1);const a=(o=(s=h==null?void 0:h.addresses)==null?void 0:s.shipping)==null?void 0:o[0];if(k&&!a&&b({shippingCountry:((c=X.config)==null?void 0:c.defaultCountry)??""}),!a)return;const{countryCode:E,regionCode:R,zipCode:u}=a;y({shippingCountry:E,shippingState:R,shippingZip:u})},{eager:!0});return()=>{t==null||t.off()}},[]),P(()=>{const t=B.on("cart/updated",()=>{L&&b({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[L,f,m,d]),P(()=>{const t=B.on("cart/reset",()=>{C(),j(null)});return()=>{t==null||t.off()}},[C]),P(()=>{const t=B.on("cart/merged",()=>{L&&y({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[L,f,m,d,y]);const i=M({applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"});if(D)return null;const p=(x=X.config)==null?void 0:x.shoppingCartDisplaySetting;return e(Y,{loading:I,taxIncluded:(p==null?void 0:p.shipping)==="INCLUDING_TAX",taxExcluded:(p==null?void 0:p.shipping)==="INCLUDING_EXCLUDING_TAX",price:(n==null?void 0:n.amount)==0?e("span",{"data-testId":"free-shipping",children:i.freeShipping}):(p==null?void 0:p.shipping)==="INCLUDING_TAX"&&n?e(U,{"data-testid":"shipping",...n.priceIncludingtax}):n?e(U,{...n}):e("span",{children:i.taxToBeDetermined}),estimated:!0,priceExcludingTax:n!=null&&n.priceExcludingtax?e(U,{"data-testid":"shipping-excluding-tax",...n.priceExcludingtax}):e("span",{children:i.taxToBeDetermined}),countryField:e(w,{name:"shippingCountry",placeholder:i.countryField,value:f,variant:"primary",options:N,handleSelect:S,"data-testid":"estimate-shipping-country-selector"}),stateField:l.length>0?e(w,{name:"shippingState",placeholder:i.stateField,variant:"primary",options:l,value:m,"data-testid":"estimate-shipping-state-selector",disabled:T}):e(G,{"aria-label":i.stateField,name:"shippingState",placeholder:i.stateField,variant:"primary",value:m,disabled:T,"data-testid":"estimate-shipping-state-input",maxLength:50}),zipField:e(G,{"aria-label":i.zipField,name:"shippingZip",placeholder:i.zipField,variant:"primary","data-testid":"estimate-shipping-zip-input",value:d,maxLength:12}),estimateButton:e(q,{variant:"secondary","data-testid":"estimate-shipping-apply-button","aria-label":i.applyButton,children:i.applyButton}),destinationText:F||i.taxToBeDetermined,onEstimate:y})};export{me as EstimateShipping,me as default}; +import{jsxs as A,jsx as e,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _,VComponent as Z,getFormValues as $}from"@dropins/tools/lib.js";import{Price as U,Picker as w,Input as G,Button as q}from"@dropins/tools/components.js";/* empty css */import{useRef as H,useState as r,useEffect as P,useCallback as J}from"@dropins/tools/preact-compat.js";import{useText as M,Text as v}from"@dropins/tools/i18n.js";import{s as X}from"../chunks/resetCart.js";import{events as B}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/persisted-data.js";import{g as O,a as Q,b as W}from"../chunks/getEstimateShipping.js";import"@dropins/tools/fetch-graphql.js";const Y=({countryField:k,destinationText:D,estimateButton:z,estimated:I,loading:N,onEstimate:l,price:f,priceExcludingTax:F,priceIncludingTax:n,stateField:S,taxExcluded:b,taxIncluded:T,zipField:m})=>{const d=H(null),[L,C]=r(!0),[y,i]=r("zip"),p=M({editZipAction:"Cart.EstimateShipping.editZipAction",destinationLinkAriaLabel:"Cart.EstimateShipping.destinationLinkAriaLabel",shippingLabel:"Cart.EstimateShipping.label",zipPlaceholder:"Cart.EstimateShipping.zipPlaceholder"}),x=a=>{a.preventDefault(),C(E=>!E)},t=a=>{a.preventDefault(),C(!0),i(E=>E==="zip"?"state":"zip")},h=a=>{a.preventDefault(),C(!1);const E=$(d.current);l==null||l(E)};return A("div",{"data-testid":"estimate-shipping",className:_(["cart-estimate-shipping",["cart-estimate-shipping--loading",N]]),children:[e("span",{className:"cart-estimate-shipping__label",children:I?D?A(V,{children:[e(v,{id:"Cart.EstimateShipping.estimatedDestination"})," ",e("a",{className:"cart-estimate-shippingLink",role:"button",href:"",onClick:x,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&x(a)},tabIndex:0,"aria-label":p.destinationLinkAriaLabel,"data-testid":"shipping-destination-link",children:D})]}):e(v,{id:"Cart.EstimateShipping.estimated"}):e(v,{id:"Cart.EstimateShipping.label"})}),e(Z,{node:f,className:"cart-estimate-shipping__price"}),I&&A(V,{children:[e("div",{className:_(["cart-estimate-shipping__caption"]),children:e("a",{href:"#",className:"cart-estimate-shipping__link",onClick:t,"data-testid":"shipping-alternate-field-link",children:y==="zip"?e(v,{id:"Cart.EstimateShipping.alternateField.state"}):e(v,{id:"Cart.EstimateShipping.alternateField.zip"})})}),A("form",{className:_(["cart-estimate-shipping--edit",["cart-estimate-shipping--hide",!L]]),ref:d,"data-testid":"shipping-estimate-form",children:[k&&e(Z,{node:k,className:_(["cart-estimate-shipping--country"])}),y==="state"?S&&e(Z,{node:S,className:_(["cart-estimate-shipping--state"])}):m&&e(Z,{node:m,className:_(["cart-estimate-shipping--zip"])}),z&&e(Z,{node:z,className:_(["cart-estimate-shipping--action"]),onClick:h,type:"submit"})]})]}),T&&e("div",{"data-testid":"shipping-tax-included",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[n," ",e(v,{id:"Cart.EstimateShipping.withTaxes"})]})}),b?e("div",{"data-testid":"shipping-tax-included-excluded",className:_(["cart-estimate-shipping__caption"]),children:A("span",{children:[F," ",e(v,{id:"Cart.EstimateShipping.withoutTaxes"})]})}):void 0]})},ee=()=>{const[k,D]=r(!1),[z,I]=r([]),[N,l]=r("US"),[f,F]=r(""),[n,S]=r(""),[b,T]=r([]),[m,d]=r(!1),[L,C]=r(),[y,i]=r(),[p,x]=r(""),[t,h]=r(!1),a=()=>{l("US"),F(""),S(""),C(null),i(null),x(""),h(!1)},E=async u=>{const{shippingCountry:s,shippingState:o="",shippingZip:c=""}=u,K={countryCode:s,postcode:c,region:{region:o}};return D(!0),W(K).then(g=>(g&&(C({amount:g.amount.value,currency:g.amount.currency,priceIncludingtax:{amount:g.price_incl_tax.value,currency:g.price_incl_tax.currency},priceExcludingtax:{amount:g.price_excl_tax.value,currency:g.price_excl_tax.currency}}),i({carrier_code:g.carrier_code,method_code:g.method_code}),l(s),F(o),S(c),x(o||c||s),h(!0)),l(s),F(o),S(c),x(o||c||s),g)).finally(()=>{D(!1)})},R=u=>{u.preventDefault(),F(""),S("");const s=u.target.value;l(s)};return P(()=>{O().then(u=>{let s="US";const o=u.map(c=>(c.isDefaultCountry&&(s=c.id),{text:c.label,value:c.id}));I(o),l(s)})},[]),P(()=>{d(!0),Q(N).then(u=>{const s=u.map(o=>({text:o.name,value:o.code}));T(s)}).finally(()=>{d(!1)})},[N,d]),{loading:k,regionsLoading:m,estimatedDestinationText:p,countries:z,selectedCountry:N,selectedRegion:f,selectedZip:n,regions:b,estimatedShippingPrice:L,estimatedShippingMethod:y,shippingEstimated:t,handleEstimateShipping:E,handleCountrySelected:R,resetValues:a,setPriceSummaryLoading:D}},me=({showDefaultEstimatedShippingCost:k})=>{var x;const[D,z]=r(!1),{loading:I,countries:N,regions:l,selectedCountry:f,estimatedDestinationText:F,estimatedShippingPrice:n,handleCountrySelected:S,handleEstimateShipping:b,regionsLoading:T,selectedRegion:m,selectedZip:d,shippingEstimated:L,resetValues:C}=ee(),y=J(t=>{b(t).then(()=>{j(t)})},[b]);P(()=>{const t=B.on("cart/data",h=>{var s,o,c;z((h==null?void 0:h.isVirtual)||!1);const a=(o=(s=h==null?void 0:h.addresses)==null?void 0:s.shipping)==null?void 0:o[0];if(k&&!a&&b({shippingCountry:((c=X.config)==null?void 0:c.defaultCountry)??""}),!a)return;const{countryCode:E,regionCode:R,zipCode:u}=a;y({shippingCountry:E,shippingState:R,shippingZip:u})},{eager:!0});return()=>{t==null||t.off()}},[]),P(()=>{const t=B.on("cart/updated",()=>{L&&b({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[L,f,m,d]),P(()=>{const t=B.on("cart/reset",()=>{C(),j(null)});return()=>{t==null||t.off()}},[C]),P(()=>{const t=B.on("cart/merged",()=>{L&&y({shippingCountry:f,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[L,f,m,d,y]);const i=M({applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"});if(D)return null;const p=(x=X.config)==null?void 0:x.shoppingCartDisplaySetting;return e(Y,{loading:I,taxIncluded:(p==null?void 0:p.shipping)==="INCLUDING_TAX",taxExcluded:(p==null?void 0:p.shipping)==="INCLUDING_EXCLUDING_TAX",price:(n==null?void 0:n.amount)==0?e("span",{"data-testId":"free-shipping",children:i.freeShipping}):(p==null?void 0:p.shipping)==="INCLUDING_TAX"&&n?e(U,{"data-testid":"shipping",...n.priceIncludingtax}):n?e(U,{...n}):e("span",{children:i.taxToBeDetermined}),estimated:!0,priceExcludingTax:n!=null&&n.priceExcludingtax?e(U,{"data-testid":"shipping-excluding-tax",...n.priceExcludingtax}):e("span",{children:i.taxToBeDetermined}),countryField:e(w,{name:"shippingCountry",placeholder:i.countryField,value:f,variant:"primary",options:N,handleSelect:S,"data-testid":"estimate-shipping-country-selector"}),stateField:l.length>0?e(w,{name:"shippingState",placeholder:i.stateField,variant:"primary",options:l,value:m,"data-testid":"estimate-shipping-state-selector",disabled:T}):e(G,{"aria-label":i.stateField,name:"shippingState",placeholder:i.stateField,variant:"primary",value:m,disabled:T,"data-testid":"estimate-shipping-state-input",maxLength:50}),zipField:e(G,{"aria-label":i.zipField,name:"shippingZip",placeholder:i.zipField,variant:"primary","data-testid":"estimate-shipping-zip-input",value:d,maxLength:12}),estimateButton:e(q,{variant:"secondary","data-testid":"estimate-shipping-apply-button","aria-label":i.applyButton,children:i.applyButton}),destinationText:F||i.taxToBeDetermined,onEstimate:y})};export{me as EstimateShipping,me as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/MiniCart.js b/scripts/__dropins__/storefront-cart/containers/MiniCart.js index 7f14a8349a..b673db6a4a 100644 --- a/scripts/__dropins__/storefront-cart/containers/MiniCart.js +++ b/scripts/__dropins__/storefront-cart/containers/MiniCart.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as i,jsxs as c,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{useState as G,useEffect as X,useCallback as A}from"@dropins/tools/preact-compat.js";import{classes as v,VComponent as b,Slot as H}from"@dropins/tools/lib.js";import{g as R}from"../chunks/persisted-data.js";import{events as j}from"@dropins/tools/event-bus.js";import{Price as C,Button as I}from"@dropins/tools/components.js";/* empty css */import{useText as k}from"@dropins/tools/i18n.js";import{s as d}from"../chunks/resetCart.js";import{p as w}from"../chunks/acdl.js";import{u as F}from"../chunks/updateProductsFromCart.js";import"../chunks/CartSummaryGrid.js";import{C as O}from"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/EmptyCart.js";import"../chunks/ChevronDown.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/Coupon.js";const B=({className:h,products:s,subtotal:u,subtotalExcludingTaxes:a,ctas:l,...m})=>{const o=k({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return i("div",{...m,className:v(["cart-mini-cart",h]),children:s&&c(S,{children:[i("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:s}),c("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[u&&c("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[o.subtotal,i(b,{node:u})]}),a&&c("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[o.subtotalExcludingTaxes,i(b,{node:a,className:v(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),l&&i(b,{node:l,className:"cart-mini-cart__footer__ctas"})]})]})})},V=({children:h,initialData:s=null,hideFooter:u=!0,slots:a,routeProduct:l,routeCart:m,routeCheckout:o,routeEmptyCartCTA:L,showDiscount:N,showSavings:D,...M})=>{var f,_,g;const[t,Q]=G(s),e=(f=d.config)==null?void 0:f.shoppingCartDisplaySetting;X(()=>{const r=j.on("cart/data",p=>{Q(p)},{eager:!0});return()=>{r==null||r.off()}},[]);const x=k({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),y=(r,p)=>F([{uid:r,quantity:p}]),T=r=>y(r,0),n=t==null?void 0:t.hasOutOfStockItems,E=A(()=>{t&&!n&&w(t,d.locale)},[t,n]),P=i(H,{name:"ProductList",slot:a==null?void 0:a.ProductList,context:{itemQuantityUpdateHandler:y,itemRemoveHandler:T,totalQuantity:t==null?void 0:t.totalQuantity},children:i(O,{"data-testid":"default-cart-summary-list",routeProduct:l,routeEmptyCartCTA:L,initialData:t,maxItems:(_=d.config)==null?void 0:_.miniCartMaxItemsDisplay,showMaxItems:!!((g=d.config)!=null&&g.miniCartMaxItemsDisplay),hideHeading:!(t!=null&&t.totalQuantity),hideFooter:u,enableRemoveItem:!0,showDiscount:N,showSavings:D})}),U=()=>(e==null?void 0:e.subtotal)==="INCLUDING_TAX"||(e==null?void 0:e.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return i(B,{...M,subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&i(C,{...U()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((e==null?void 0:e.subtotal)==="INCLUDING_EXCLUDING_TAX"?i(C,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,ctas:t!=null&&t.totalQuantity?c("div",{children:[o&&i(I,{"data-testid":"route-checkout-button",variant:"primary",href:n?void 0:o(),disabled:n,"aria-disabled":n,onClick:E,children:x.checkoutLink}),m&&i(I,{"data-testid":"route-cart-button",variant:"tertiary",href:m(),children:x.cartLink})]}):void 0,products:P})};V.getInitialData=async function(){return R()};export{V as MiniCart,V as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummary.js b/scripts/__dropins__/storefront-cart/containers/OrderSummary.js index a4b26b2308..658e9aa06d 100644 --- a/scripts/__dropins__/storefront-cart/containers/OrderSummary.js +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummary.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{O as g,O as h}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronDown.js";import"@dropins/tools/i18n.js";import"../chunks/Coupon.js";export{g as OrderSummary,h as default}; diff --git a/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js index 7f157619df..4a4510c1c8 100644 --- a/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js +++ b/scripts/__dropins__/storefront-cart/containers/OrderSummaryLine.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 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";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";export{e as OrderSummaryLine,O as default}; diff --git a/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/productTypesData.d.ts b/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/productTypesData.d.ts index 5680e99f83..60ac98bf2f 100644 --- a/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/productTypesData.d.ts +++ b/scripts/__dropins__/storefront-cart/data/transforms/__fixtures__/productTypesData.d.ts @@ -66,7 +66,6 @@ declare const bundleOptions: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -132,7 +131,6 @@ declare const bundleOptionsEmpty: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -200,7 +198,6 @@ declare const giftCardPhysical: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -270,7 +267,6 @@ declare const giftCardVirtual: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -334,7 +330,6 @@ declare const simple: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -417,7 +412,6 @@ declare const simpleCustomizable: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -510,7 +504,6 @@ declare const configurable: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -621,7 +614,6 @@ declare const configurableCustomizable: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -686,7 +678,6 @@ declare const giftCard: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -755,7 +746,6 @@ declare const downloadbleWithMultipleLinks: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -791,7 +781,6 @@ declare const simpleLowInventory: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -859,7 +848,6 @@ declare const complexInsufficientQuantity: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -932,7 +920,6 @@ declare const complexInsufficientQuantityGeneralMessage: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -1015,7 +1002,6 @@ declare const complexWithProductAttributes: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; @@ -1129,7 +1115,6 @@ declare const simpleWithNoDiscount: { label: string; }; url_key: string; - url_suffix: string; categories: { url_path: string; url_key: string; diff --git a/scripts/__dropins__/storefront-cart/fragments.js b/scripts/__dropins__/storefront-cart/fragments.js index 2a0a07c8cd..97dee1c02b 100644 --- a/scripts/__dropins__/storefront-cart/fragments.js +++ b/scripts/__dropins__/storefront-cart/fragments.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const e=` fragment PRICE_RANGE_FRAGMENT on PriceRange { @@ -112,7 +112,6 @@ fragment CART_ITEM_FRAGMENT on CartItemInterface { label } url_key - url_suffix canonical_url categories { url_path @@ -130,13 +129,11 @@ fragment CART_ITEM_FRAGMENT on CartItemInterface { value label } - } } } only_x_left_in_stock - stock_status - + stock_status price_range { ...PRICE_RANGE_FRAGMENT } 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 911a78d479..e9032dd749 100644 --- a/scripts/__dropins__/storefront-cart/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/storefront-cart/i18n/en_US.json.d.ts @@ -30,7 +30,7 @@ declare const _default: { "label": "Shipping", "editZipAction": "Apply", "estimated": "Estimated Shipping", - "estimatedDestination": "Estimated Shipping to ", + "estimatedDestination": "Estimated Shipping to", "destinationLinkAriaLabel": "Change destination", "zipPlaceholder": "Zip Code", "withTaxes": "Including taxes", @@ -96,7 +96,7 @@ declare const _default: { "label": "Shipping", "editZipAction": "Apply", "estimated": "Estimated Shipping", - "estimatedDestination": "Estimated Shipping to ", + "estimatedDestination": "Estimated Shipping to", "destinationLinkAriaLabel": "Change destination", "zipPlaceholder": "Zip Code", "withTaxes": "Including taxes", diff --git a/scripts/__dropins__/storefront-cart/render.js b/scripts/__dropins__/storefront-cart/render.js index cf023ded71..41eaec6afe 100644 --- a/scripts/__dropins__/storefront-cart/render.js +++ b/scripts/__dropins__/storefront-cart/render.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 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-empty-cart{container-type:inline-size;container-name:cart}.cart-empty-cart__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center}@container cart (width < 737px){.cart-empty-cart__wrapper .dropin-card{border:unset;border-style:hidden}}.cart-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xsmall);align-items:flex-end;color:var(--color-neutral-800)}.cart-estimate-shipping__label,.cart-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-estimate-shipping__price{text-align:right}a.cart-estimate-shippingLink{text-decoration:underline}.cart-estimate-shipping__label--bold,.cart-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-estimate-shipping--zip,.cart-estimate-shipping--state{background-color:var(--color-neutral-50)}.cart-estimate-shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small)}a.cart-estimate-shipping__link{text-decoration:underline}.cart-estimate-shipping--hide{display:none!important}.cart-estimate-shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-estimate-shipping--loading{opacity:.4;pointer-events:none}.cart-mini-cart{display:flex;flex-direction:column;height:100%;padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium);box-sizing:border-box}.cart-mini-cart__empty-cart{width:100%;max-width:800px;height:100%;display:flex;flex-direction:column;justify-content:center;align-self:center}.cart-mini-cart__heading{display:grid;row-gap:var(--spacing-xsmall);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing)}.cart-mini-cart__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 0 0}.cart-mini-cart__products{flex:1;overflow-y:auto;max-height:100%;padding-bottom:var(--spacing-medium)}.cart-mini-cart__products .cart-cart-summary-list__heading{padding:0}.cart-mini-cart__products .dropin-cart-item__configurations li{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cart-mini-cart__footer{display:grid;grid-auto-flow:row;gap:var(--spacing-small);padding-top:var(--spacing-small);row-gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total-excluding-taxes{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall);color:var(--color-neutral-700)}.cart-mini-cart__footer__ctas{display:grid;grid-auto-flow:row;gap:var(--spacing-xsmall);padding-top:var(--spacing-small)}.cart-cart-summary-grid{container-type:inline-size;container-name:cart-summary-grid;max-width:inherit}.cart-cart-summary-grid__content{display:grid;flex-wrap:wrap;gap:var(--spacing-small);grid-template-columns:repeat(6,1fr);margin:auto}.cart-cart-summary-grid__item-container{aspect-ratio:auto 3/4;display:inline-block}.cart-cart-summary-grid__item-container img{height:auto;max-width:100%}.cart-cart-summary-grid__item-container a:focus{display:block}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}.cart-cart-summary-grid__empty-cart{align-self:center;justify-self:center;max-width:800px;width:100%}@container cart-summary-grid (width < 360px){.cart-cart-summary-grid__content{grid-template-columns:repeat(4,1fr);gap:var(--spacing-xsmall)}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}}.cart-cart-summary-list{container-type:inline-size;container-name:cart-summary-list}.cart-cart-summary-list__background--secondary{background-color:var(--color-neutral-200)}.cart-cart-summary-list__heading{display:grid;row-gap:var(--spacing-xsmall);padding:var(--spacing-medium) 0 0 0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart-summary-list__heading--full-width{width:100%}.cart-cart-summary-list__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 var(--spacing-medium) 0}.cart-cart-summary-list__content{display:grid;grid-template-columns:1fr;padding:0}.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-xsmall)) 0 var(--spacing-medium) 0}.cart-cart-summary-list__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.cart-cart-summary-list-footer__action,.cart-cart-summary-list-footer__action:focus .cart-cart-summary-list-footer__action:active,.cart-cart-summary-list-footer__action:link{font:var(--type-body-2-strong-font);margin:0 auto;width:auto;margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.cart-cart-summary-list-footer__action:hover{text-decoration:underline;text-underline-offset:var(--spacing-xxsmall);background:transparent;color:var(--color-brand-700)}.cart-cart-summary-list-footer__action:visited{background-color:none}.cart-cart-summary-list-accordion{border-left:var(--shape-border-width-2) solid var(--color-neutral-400);border-right:var(--shape-border-width-2) solid var(--color-neutral-400)}.cart-cart-summary-list-accordion__section{margin:var(--spacing-medium)}@container cart-summary-list (width >= 768px){.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-small)) 0 var(--spacing-xxbig) 0}}@container cart-summary-list (width >= 1024px){.cart-cart-summary-list__content,.cart-cart-summary-list__heading{grid-column:1 / span 8}.cart-cart-summary-list__heading--full-width,.cart-cart-summary-list__content--empty{grid-column:1 / span 12}.cart-cart-summary-list__content{padding:0}}.cart-order-summary{display:grid;position:relative;grid-auto-flow:row;padding:var(--spacing-medium)}.cart-order-summary__primary{background-color:var(--color-neutral-200)}.cart-order-summary__secondary{background-color:var(--color-neutral-50)}.cart-order-summary__content{display:grid;gap:var(--spacing-xsmall);margin-top:var(--spacing-small)}.cart-order-summary__heading{display:grid;font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);color:var(--color-neutral-800);gap:var(--spacing-small)}.cart-order-summary__discount .cart-order-summary__label,.cart-order-summary__discount .cart-order-summary__price{color:var(--color-warning-800)}.cart-order-summary__coupon__code{display:flex;align-items:center;font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);color:var(--color-neutral-700);gap:var(--spacing-xsmall);grid-column:span 2}.cart-order-summary__taxes .dropin-divider:last-child{margin-bottom:0}.cart-order-summary__total{margin-top:var(--spacing-medium)}.cart-order-summary__divider-primary,.cart-order-summary__divider-secondary{width:100%;margin:0}.cart-order-summary__divider-secondary{margin:0}.cart-order-summary__taxEntry.cart-order-summary__entry{margin-top:0}.cart-order-summary__entry,.cart-order-summary__taxEntry{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.cart-order-summary__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-order-summary__primaryAction{margin-top:var(--spacing-small);grid-template-columns:1fr}.cart-order-summary__shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small);padding-left:var(--spacing-small)}a.cart-order-summary__shippingLink{text-decoration:underline}.cart-order-summary__shipping--hide{display:none!important}.cart-order-summary__shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-order-summary__shipping--zip,.cart-order-summary__shipping--state{background-color:var(--color-neutral-50)}.cart-order-summary__taxes .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.cart-order-summary--loading{opacity:.4;pointer-events:none}.cart-order-summary__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.coupon-code-form__action{display:flex}.coupon-code-form__action .dropin-input-container{flex-grow:1;margin-right:var(--spacing-small)}.cart-coupons__accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small)}.coupon-code-form__codes{background-color:var(--color-neutral-50)}.coupon-code-form__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-500);margin-top:calc(var(--spacing-xsmall) * -1)}.coupon-code-form__applied{display:flex;flex-wrap:wrap;gap:var(--spacing-small)}div.coupon-code-form__applied button{background:var(--color-neutral-400);color:var(--color-neutral-800);display:flex;flex-direction:row-reverse}.cart-order-summary__label,.cart-order-summary__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-order-summary__price{text-align:right;text-transform:uppercase}.cart-order-summary__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-order-summary__label--bold,.cart-order-summary__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}",{styleId:"Cart"}); -import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/refreshCart.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./fragments.js";const f={Cart:{heading:"Shopping Cart ({count})",editCart:"Edit",viewAll:"View all in cart",viewMore:"View more"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",free:"Free",label:"Total",withoutTax:"Total excluding taxes",saved:"Total saved"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free",coupon:{applyAction:"Apply",placeholder:"Enter code",title:"Discount code"}},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available",discountPercentage:"{discount}% off",savingsAmount:"Savings"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},y={default:x},S=({children:o})=>{var i;const[t,s]=u(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(y,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},L=new d(n(S,{}));export{L as render}; +import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/refreshCart.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./fragments.js";const f={Cart:{heading:"Shopping Cart ({count})",editCart:"Edit",viewAll:"View all in cart",viewMore:"View more"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",free:"Free",label:"Total",withoutTax:"Total excluding taxes",saved:"Total saved"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free",coupon:{applyAction:"Apply",placeholder:"Enter code",title:"Discount code"}},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available",discountPercentage:"{discount}% off",savingsAmount:"Savings"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},y={default:x},S=({children:o})=>{var i;const[t,s]=u(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(y,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},L=new d(n(S,{}));export{L as render};