From d9b005544d1da676c552e50bbd90cd645c53fb61 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak Date: Mon, 18 Nov 2024 10:42:42 -0600 Subject: [PATCH 1/2] update packages to 0.36.0 (#208) --- package-lock.json | 8 ++++---- package.json | 2 +- scripts/__dropins__/tools/components.js | 2 +- scripts/__dropins__/tools/event-bus.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6a72248448..06e54060b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@dropins/storefront-checkout": "0.1.0-alpha53", "@dropins/storefront-order": "0.1.0-alpha21", "@dropins/storefront-pdp": "0.4.0", - "@dropins/tools": "^0.35.0" + "@dropins/tools": "^0.36.0" }, "devDependencies": { "@adobe/aem-cli": "^16.5.8", @@ -826,9 +826,9 @@ "integrity": "sha512-njTZ6gCbqeMANmabRWo/cnFUthPKix6lgQ04r1N5frFbEXvaKGpiWXsAdRZ+NjhdU8Lvz2zKDR9WwIyx3P2whA==" }, "node_modules/@dropins/tools": { - "version": "0.35.0", - "resolved": "https://registry.npmjs.org/@dropins/tools/-/tools-0.35.0.tgz", - "integrity": "sha512-VglMPLIvZ8rBYemr2gUaj7Kzd3Kn0IhAH3S9wQzfIGwfr/RT/0RaUZ5df700UtyHID+kRCkDcrvC56RuXqIQqQ==" + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/@dropins/tools/-/tools-0.36.0.tgz", + "integrity": "sha512-5FRH1KhL6DU/dMc39Yhp77uFJwpI5pmW8ymydcD8ip0nfxa9tZysrSjbeXhGQhV/SygE8x8VFoYwSPMseZpPlw==" }, "node_modules/@dual-bundle/import-meta-resolve": { "version": "4.1.0", diff --git a/package.json b/package.json index 09230c2983..4a83fdf84e 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,6 @@ "@dropins/storefront-checkout": "0.1.0-alpha53", "@dropins/storefront-order": "0.1.0-alpha21", "@dropins/storefront-pdp": "0.4.0", - "@dropins/tools": "^0.35.0" + "@dropins/tools": "^0.36.0" } } diff --git a/scripts/__dropins__/tools/components.js b/scripts/__dropins__/tools/components.js index 31bbe4d37b..6d412e4a42 100644 --- a/scripts/__dropins__/tools/components.js +++ b/scripts/__dropins__/tools/components.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as e}from"./preact-jsx-runtime.js";import{d as Z,c as o,R as be,a as oe,V as y,g as fe,i as ve}from"./chunks/is-number.js";import{G as ge,T as M,k as R,F as g,L as Ne,h as B,q as C,S as K,y as W,_ as we,N as se,E as ke,A as le,x as ye}from"./chunks/icons/Add.js";import{IntlProvider as xe,Localizer as Q,Text as z,useText as I}from"./i18n.js";import U from"./chunks/icons/Minus.js";import De from"./chunks/icons/CheckWithCircle.js";import Ie from"./chunks/icons/WarningWithCircle.js";import Ee from"./chunks/icons/Date.js";import $e from"./chunks/icons/Locker.js";import Se from"./chunks/icons/Eye.js";import Te from"./chunks/icons/EyeClose.js";import de from"./chunks/icons/Check.js";import j from"./chunks/icons/Close.js";import J from"./chunks/icons/ChevronDown.js";import Le from"./chunks/icons/Trash.js";import"./chunks/image-params-keymap.js";import"./signals.js";const Pe={ExampleComponentName:{item:{label:"string"}},Pagination:{backwardButton:{ariaLabel:"Go to previous page"},forwardButton:{ariaLabel:"Go to next page"}},Incrementer:{decreaseLabel:"Decrease Quantity",increaseLabel:"Increase Quantity",label:"Quantity",errorMessage:"Enter a valid quantity",minQuantityMessage:"Enter at least {{minQuantity}}",maxQuantityMessage:"Maximum quantity is {{maxQuantity}}"},Modal:{Close:{label:"Close"}},InputPassword:{placeholder:"Password",floatingLabel:"Password",buttonTitle:"Click to show or hide password"},PasswordStatusIndicator:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long"},InlineAlert:{dismissLabel:"Dismiss Alert"},PriceSummary:{subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",label:"Total",withoutTax:"Total excluding taxes"}},ProgressSpinner:{updating:{label:"Item is updating"},updatingChildren:{label:"Items are updating"}},PriceRange:{from:{label:"From"},to:{label:"to"},asLowAs:{label:"As low as"}},Swatches:{outOfStock:{label:"out of stock swatch"},selected:{label:"swatch selected"},swatch:{label:"swatch"}},Accordion:{open:{label:"Open"},close:{label:"Close"}},CartItem:{each:{label:"each"},pricePerItem:{label:"price per item"},quantity:{label:"Quantity"},remove:{label:"Remove {product} from the cart"},removeDefault:{label:"Remove item from the cart"},taxIncluded:{label:"incl. VAT"},taxExcluded:{label:"excl. tax"},updating:{label:"{product} is updating"}},InputDate:{picker:"Select a date"}},ee={Dropin:Pe},te={default:ee,en_US:ee},Oe=a=>Z(te.default,te[a]||{}),re=1,q=({className:a,fullWidth:r=!1,lines:n=re,size:t="small",variant:s="row",children:i=null,multilineGap:l="medium",...d})=>{const _=[[`dropin-skeleton-row__${s}`,s],[`dropin-skeleton-row__${s}-${t}`,s&&t]];if(!i&&s==="empty")return e("div",{className:o(["dropin-skeleton-row dropin-skeleton-row__empty",a])});if(i){const h=i.trim();return e("div",{...d,class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],a]),dangerouslySetInnerHTML:{__html:h}})}return n>re===!1?e("div",{...d,class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],"dropin-skeleton--row__content",..._,a])}):e("div",{...d,style:{"--multiline-gap-spacing":`var(--spacing-${l})`},class:o(["dropin-skeleton-row--multiline",["dropin-skeleton-row--full",r],a]),children:Array.from({length:n}).map((h,p)=>e("div",{class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],"dropin-skeleton--row__content",..._])},p))})},Ce=({className:a,children:r,rowGap:n="medium",...t})=>e("div",{style:{"--row-gap-spacing":`var(--spacing-${n})`},...t,className:o(["dropin-skeleton",a]),role:"status","aria-label":"Loading...",children:r}),ce=ge({locale:"en-US"}),Ae=({lang:a="en_US",langDefinitions:r={},children:n})=>{const t=M(()=>{const i=Z(r.default,r[a]??{});return Z(Oe(a),i)},[a,r]),s=a.replace("_","-");return e(ce.Provider,{value:{locale:s},children:e(xe,{definition:t,children:e(R,{children:n})})})},ut=new be(e(Ae,{})),Ve=function(){const r=typeof document<"u"&&document.createElement("link").relList;return r&&r.supports&&r.supports("modulepreload")?"modulepreload":"preload"}(),Re=function(a){return"/"+a},ne={},N=function(r,n,t){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.all(n.map(d=>{if(d=Re(d),d in ne)return;ne[d]=!0;const _=d.endsWith(".css"),m=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=_?"stylesheet":Ve,_||(h.as="script",h.crossOrigin=""),h.href=d,l&&h.setAttribute("nonce",l),document.head.appendChild(h),_)return new Promise((p,c)=>{h.addEventListener("load",p),h.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${d}`)))})}))}return s.then(()=>r()).catch(i=>{const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i})},Be={Add:g(()=>N(()=>import("./chunks/icons/Add.js").then(a=>a.$),[])),Bulk:g(()=>N(()=>import("./chunks/icons/Bulk.js"),[])),Burger:g(()=>N(()=>import("./chunks/icons/Burger.js"),[])),Cart:g(()=>N(()=>import("./chunks/icons/Cart.js"),[])),Check:g(()=>N(()=>import("./chunks/icons/Check.js"),[])),ChevronDown:g(()=>N(()=>import("./chunks/icons/ChevronDown.js"),[])),ChevronUp:g(()=>N(()=>import("./chunks/icons/ChevronUp.js"),[])),ChevronRight:g(()=>N(()=>import("./chunks/icons/ChevronRight.js"),[])),Close:g(()=>N(()=>import("./chunks/icons/Close.js"),[])),Heart:g(()=>N(()=>import("./chunks/icons/Heart.js"),[])),Minus:g(()=>N(()=>import("./chunks/icons/Minus.js"),[])),Placeholder:g(()=>N(()=>import("./chunks/icons/Placeholder.js"),[])),PlaceholderFilled:g(()=>N(()=>import("./chunks/icons/PlaceholderFilled.js"),[])),Search:g(()=>N(()=>import("./chunks/icons/Search.js"),[])),SearchFilled:g(()=>N(()=>import("./chunks/icons/SearchFilled.js"),[])),Sort:g(()=>N(()=>import("./chunks/icons/Sort.js"),[])),Star:g(()=>N(()=>import("./chunks/icons/Star.js"),[])),View:g(()=>N(()=>import("./chunks/icons/View.js"),[])),User:g(()=>N(()=>import("./chunks/icons/User.js"),[])),Warning:g(()=>N(()=>import("./chunks/icons/Warning.js"),[])),Locker:g(()=>N(()=>import("./chunks/icons/Locker.js"),[])),Wallet:g(()=>N(()=>import("./chunks/icons/Wallet.js"),[])),Card:g(()=>N(()=>import("./chunks/icons/Card.js"),[])),Order:g(()=>N(()=>import("./chunks/icons/Order.js"),[])),Delivery:g(()=>N(()=>import("./chunks/icons/Delivery.js"),[])),OrderError:g(()=>N(()=>import("./chunks/icons/OrderError.js"),[])),OrderSuccess:g(()=>N(()=>import("./chunks/icons/OrderSuccess.js"),[])),PaymentError:g(()=>N(()=>import("./chunks/icons/PaymentError.js"),[])),CheckWithCircle:g(()=>N(()=>import("./chunks/icons/CheckWithCircle.js"),[])),WarningWithCircle:g(()=>N(()=>import("./chunks/icons/WarningWithCircle.js"),[])),WarningFilled:g(()=>N(()=>import("./chunks/icons/WarningFilled.js"),[])),InfoFilled:g(()=>N(()=>import("./chunks/icons/InfoFilled.js"),[])),HeartFilled:g(()=>N(()=>import("./chunks/icons/HeartFilled.js"),[])),Trash:g(()=>N(()=>import("./chunks/icons/Trash.js"),[])),Eye:g(()=>N(()=>import("./chunks/icons/Eye.js"),[])),EyeClose:g(()=>N(()=>import("./chunks/icons/EyeClose.js"),[])),Date:g(()=>N(()=>import("./chunks/icons/Date.js"),[])),AddressBook:g(()=>N(()=>import("./chunks/icons/AddressBook.js"),[])),EmptyBox:g(()=>N(()=>import("./chunks/icons/EmptyBox.js"),[])),Coupon:g(()=>N(()=>import("./chunks/icons/Coupon.js"),[]))};function T({source:a,size:r="24",stroke:n="2",viewBox:t="0 0 24 24",className:s,...i}){const l=typeof a=="string"?Be[a]:null,d={className:o(["dropin-icon",`dropin-icon--shape-stroke-${n}`,s]),width:r,height:r,viewBox:t};return e(Ne,{fallback:e("svg",{...i,...d}),children:l?e(l,{...i,...d}):e(a,{...i,...d})})}const Fe=({name:a,value:r="1",className:n,disabled:t,error:s,success:i,min:l,max:d,onValue:_,onUpdateError:m,size:h="medium",...p})=>{const[c,u]=B(Number(r)),b=Number(l),f=Number(d),v=s||cf,w=cf?"Dropin.Incrementer.maxQuantityMessage":"Dropin.Incrementer.errorMessage",x=C(oe(async $=>{if(_)try{_($)}catch(k){m&&m(k)}},200),[_,m]),E=$=>{let k=$;x(k),u(k)};return e("div",{className:o(["dropin-incrementer",`dropin-incrementer--${h}`,n]),children:[e("div",{className:o(["dropin-incrementer__content",`dropin-incrementer__content--${h}`,["dropin-incrementer__content--error",v],["dropin-incrementer__content--success",i],["dropin-incrementer__content--disabled",t]]),children:[e("div",{className:o(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",t]]),children:e(Q,{children:e("button",{type:"button",className:o(["dropin-incrementer__decrease-button",["dropin-incrementer__decrease-button--disabled",t]]),onClick:()=>E(c-1),disabled:t||c{E(Number(c))},onChange:$=>{const k=$.currentTarget.value;k!==""&&u(Number(k))},...p}),e("div",{className:o(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",t]]),children:e(Q,{children:e("button",{type:"button",className:o(["dropin-incrementer__increase-button",["dropin-incrementer__increase-button--disabled",t]]),onClick:()=>E(c+1),disabled:t||c>f-1,"aria-label":e(z,{id:"Dropin.Incrementer.increaseLabel"}),children:e(T,{source:K,size:"16",stroke:"1",viewBox:"4 2 20 20",className:"dropin-incrementer__add"})})})})]}),v&&e("p",{className:"dropin-incrementer__content--error-message",children:e(z,{id:w,fields:{minQuantity:l,maxQuantity:d}})})]})},pe=({name:a,value:r,variant:n="primary",className:t,disabled:s,error:i,floatingLabel:l,onValue:d,onUpdateError:_,size:m="medium",icon:h,maxLength:p,success:c,...u})=>{const b=(u==null?void 0:u.id)||a||`dropin-input-${Math.random().toString(36)}`,f=C(oe(async w=>{if(d)try{await d(w)}catch(x){_&&_(x)}},200),[d,_]),v=w=>{const x=w.target;f(x.value.trim())};return e("div",{className:o(["dropin-input-container",`dropin-input-container--${n}`,["dropin-input-container--floating",!!l],["dropin-input-container--disabled",s]]),children:[h&&e(y,{node:h,className:o(["dropin-input__field-icon--left",h.props.className])}),e("div",{className:"dropin-input-label-container",children:[e("input",{id:b,onChange:v,type:"text",maxLength:p,name:a,value:r,...u,className:o(["dropin-input",`dropin-input--${m}`,`dropin-input--${n}`,["dropin-input--error",!!i],["dropin-input--success",!!c],["dropin-input--disabled",s],["dropin-input--floating",!!l],["dropin-input--icon-left",!!h],t]),disabled:s}),l&&e("label",{htmlFor:b,className:o([["dropin-input__label--floating",!!l],["dropin-input__label--floating--icon-left",!!h],["dropin-input__label--floating--error",!!i]]),children:l})]}),i&&e("div",{className:o(["dropin-input__field-icon--right","dropin-input__field-icon--error"]),children:e(T,{source:Ie,size:"16",stroke:"2",className:"dropin-input--warning-icon",viewBox:"-1 -1 26 26"})}),c&&e("div",{className:o(["dropin-input__field-icon--right","dropin-input__field-icon--success"]),children:e(T,{source:De,size:"16",stroke:"2",className:"dropin-input--success-icon",viewBox:"-1 -1 26 26"})})]})},ht=({name:a="",error:r,value:n,label:t,onChange:s,onBlur:i,...l})=>{const d=I({picker:"Dropin.InputDate.picker"}),_=p=>{p.currentTarget.setAttribute("type","date")},m=p=>{var u;const c=(u=p.currentTarget.parentElement)==null?void 0:u.querySelector("input");c==null||c.focus(),c==null||c.showPicker()},h=p=>{p.currentTarget.setAttribute("type","text"),i==null||i(p)};return e("div",{className:o(["dropin-input-date"]),children:[e(me,{error:r,children:e(pe,{error:!!r,name:a,value:n==null?void 0:n.toString(),placeholder:t,floatingLabel:t,onFocus:_,onBlur:h,onChange:s,"aria-labelledby":t,className:"dropin-input-date__input",...l})}),e("button",{className:"dropin-input-date__icon","aria-label":d.picker,onClick:m,children:e(T,{source:Ee,size:"24"})})]})},ie={pending:e(U,{}),success:e(de,{}),error:e(j,{style:{fill:"red"}})},qe=({minLength:a=0,requiredCharacterClasses:r=0,uniqueSymbolsStatus:n="pending",validateLengthConfig:t={status:"",icon:"",message:""}})=>{const s=I({chartTwoSymbols:"Dropin.PasswordStatusIndicator.chartTwoSymbols",chartThreeSymbols:"Dropin.PasswordStatusIndicator.chartThreeSymbols",chartFourSymbols:"Dropin.PasswordStatusIndicator.chartFourSymbols"}),i=l=>{switch(l){case 2:return s.chartTwoSymbols;case 3:return s.chartThreeSymbols;case 4:return s.chartFourSymbols;default:return""}};return e("div",{className:o(["dropin-password-status-indicator"]),children:[a>0?e("div",{className:`dropin-password-status-indicator__item dropin-password-status-indicator__item--${t.status}`,"data-testid":`dropin-password-status-indicator__item--${t.icon}`,children:[ie[t.icon],e("span",{className:`${t.status}`,children:t.message})]}):null,r>=2?e("div",{className:`dropin-password-status-indicator__item dropin-password-status-indicator__item--${n}`,"data-testid":`dropin-password-status-indicator__item--${n}`,children:[ie[n],e("span",{className:"pending",children:i(r)})]}):null]})},bt=({placeholder:a,floatingLabel:r,children:n,name:t,required:s,className:i,minLength:l,autoComplete:d,defaultValue:_="",hideStatusIndicator:m=!1,uniqueSymbolsStatus:h,validateLengthConfig:p,requiredCharacterClasses:c,errorMessage:u,onValue:b,onBlur:f,...v})=>{const w=I({placeholder:"Dropin.InputPassword.placeholder",floatingLabel:"Dropin.InputPassword.floatingLabel",buttonTitle:"Dropin.InputPassword.buttonTitle"}),[x,E]=B(!1),$=C(()=>{E(k=>!k)},[]);return e("div",{"data-testid":"passwordFieldInput",className:o(["dropin-input-password",["dropin-input-password--error",u],i]),...v,children:[e(me,{error:u,children:e(pe,{autoComplete:d,name:t??"password",type:x?"text":"password",placeholder:a||w.placeholder,floatingLabel:r||w.floatingLabel,"aria-label":w.placeholder,"aria-required":!0,required:s||!1,value:_,onValue:b,icon:e($e,{}),onBlur:f,"data-testid":"passwordInput"})}),e(V,{"aria-label":w.buttonTitle,title:w.buttonTitle,type:"button","data-testid":"toggle-password-icon",variant:"tertiary",className:o(["dropin-input-password__eye-icon",`dropin-input-password__eye-icon--${x?"show":"hide"}`,i]),onClick:$,children:x?e(Se,{}):e(Te,{})}),m?null:e(qe,{minLength:l,requiredCharacterClasses:c,validateLengthConfig:p,uniqueSymbolsStatus:h}),n]})},ft=({disabled:a,name:r="",errorMessage:n,value:t,label:s,className:i,onChange:l,onBlur:d,..._})=>{const m=(_==null?void 0:_.id)||r||`dropin-textarea-${Math.random().toString(36)}`,h=!!(n!=null&&n.length),p=C(c=>{const u=c.target;u.style.height="auto",u.style.height=`${u.scrollHeight}px`,l==null||l(c)},[l]);return e("div",{className:o(["dropin-textarea-container",i]),"data-testid":"dropin-textarea-container",children:[e("textarea",{"data-testid":"dropin-textarea-field",className:o(["dropin-textarea",["dropin-textarea--error",h],["dropin-textarea--disabled",!!a]]),id:m,placeholder:s,name:r,value:t,disabled:a,onBlur:d,onChange:p,..._}),e("label",{htmlFor:m,className:o(["dropin-textarea__label--floating",["dropin-textarea__label--floating--error",h]]),children:s}),h?e("div",{className:o(["dropin-textarea__label--floating--text",["dropin-textarea__label--floating--error",h]]),children:n}):null]})},Me=({className:a,src:r,params:n,loading:t="lazy",srcSet:s,onLoad:i,...l})=>{const[d,_]=B(!1),m=M(()=>{if(s)return s;if(!(!r||!n))return fe(r,{...n})},[n,r,s]),h=p=>{_(!0),i==null||i(p)};return e("img",{...l,className:o(["dropin-image",["dropin-image--loaded",d],a]),loading:t,onLoad:h,src:r,srcSet:m})},_e=({variant:a="primary",className:r})=>e("hr",{role:"separator",className:o(["dropin-divider",`dropin-divider--${a}`,r])}),A=({amount:a=0,currency:r,locale:n=void 0,variant:t="default",weight:s="bold",className:i,children:l,sale:d=!1,formatOptions:_={},size:m="small",...h})=>{const p=M(()=>new Intl.NumberFormat(n,{style:"currency",currency:r||"USD",minimumFractionDigits:2,maximumFractionDigits:2,..._}),[n,r,_]),c=M(()=>p.format(a),[a,p]);return e("span",{...h,className:o(["dropin-price",`dropin-price--${t}`,`dropin-price--${m}`,`dropin-price--${s}`,["dropin-price--sale",d],i]),children:c})},He=({name:a,label:r,value:n,size:t="medium",checked:s=!1,disabled:i=!1,error:l=!1,description:d="",busy:_=!1,className:m,children:h,...p})=>e("label",{className:o([m,"dropin-radio-button",["dropin-radio-button--error",l],["dropin-radio-button--disabled",i]]),children:[e("input",{name:a,value:n,checked:s,disabled:i,type:"radio",className:o(["dropin-radio-button__input",["dropin-radio-button__input--error",l],["dropin-radio-button__input--disabled",i]]),"aria-busy":_,...p}),e("span",{className:o(["dropin-radio-button__label",`dropin-radio-button__label--${t}`,["dropin-radio-button__label--error",l],["dropin-radio-button__label--disabled",i]]),children:r}),e("span",{className:o(["dropin-radio-button__description",`dropin-radio-button__description--${t}`,["dropin-radio-button__description--disabled",i]]),children:d})]}),V=({value:a,variant:r="primary",size:n="medium",icon:t,className:s,children:i,disabled:l=!1,active:d=!1,activeChildren:_,activeIcon:m,href:h,...p})=>{let c="dropin-button";(t&&!i||t&&d&&!_||!t&&d&&m)&&(c="dropin-iconButton"),d&&_&&(c="dropin-button"),s=o([c,`${c}--${n}`,`${c}--${r}`,[`${c}--${r}--disabled`,l],i&&t&&`${c}--with-icon`,!i&&_&&t&&`${c}--with-icon`,d&&m&&`${c}--with-icon`,s]);const u=o(["dropin-button-icon",`dropin-button-icon--${r}`,[`dropin-button-icon--${r}--disabled`,l],t==null?void 0:t.props.className]),b=h?{node:e("a",{}),role:"link",href:h,...p,disabled:l,active:d,onKeyDown:f=>{l&&f.preventDefault()},tabIndex:l?-1:0}:{node:e("button",{}),role:"button",...p,value:a,disabled:l,active:d};return e(y,{...b,className:s,children:[t&&!d&&e(y,{node:t,className:u}),m&&d&&e(y,{node:m,className:u}),i&&!d&&(typeof i=="string"?e("span",{children:i}):i),d&&_&&(typeof _=="string"?e("span",{children:_}):_)]})};function ae(a,r,n,t,s){return a||(r?r.value:n||t?"":s?s.value:null)}const We=({name:a,value:r=null,options:n,variant:t="primary",floatingLabel:s,size:i="medium",handleSelect:l=()=>{},disabled:d=!1,error:_=!1,placeholder:m,defaultOption:h,icon:p,className:c,...u})=>{const b=(u==null?void 0:u.id)||a||`dropin-picker-${Math.random().toString(36)}`,f=!!(u!=null&&u.required),v=n==null?void 0:n.find(L=>!L.disabled),[w,x]=B(()=>ae(r,h,m,s,v));W(()=>{x(ae(r,h,m,s,v))},[r,h,m,s,v]);const E=L=>{const{options:D,value:S}=L.target;for(const H of D)H.selected&&(x(S),l(L))},$=n==null?void 0:n.map(L=>{const{value:D,text:S,disabled:H}=L;return e("option",{value:D,selected:D===w,disabled:H,className:o(["dropin-picker__option"]),children:S},D)}),k=!!w,O=()=>(!f||!k)&&(s||m);return e("div",{className:o([c,"dropin-picker",`dropin-picker__${i}`,["dropin-picker__floating",!!s],["dropin-picker__selected",k],["dropin-picker__error",_],["dropin-picker__disabled",d],["dropin-picker__icon",p]]),children:[p&&e(p.type,{...p.props,className:"dropin-picker__icon--placeholder"}),e("select",{id:b,className:o(["dropin-picker__select",`dropin-picker__select--${t}`,`dropin-picker__select--${i}`,["dropin-picker__select--floating",!!s]]),name:a,"aria-label":a,disabled:d,onChange:E,...u,children:[O()&&e("option",{selected:!k,value:"",className:o(["dropin-picker__option dropin-picker__placeholder"]),children:s??m},r),$]}),e(T,{source:J,size:"24",stroke:"2",className:"dropin-picker__chevronDown"}),s&&k&&e("label",{htmlFor:b,className:o(["dropin-picker__floatingLabel",!!s]),children:s})]})},me=({className:a,label:r,error:n,hint:t,success:s,size:i="medium",disabled:l=!1,children:d,..._})=>{var p;const m=((p=d==null?void 0:d.props)==null?void 0:p.id)??`dropin-field-${Math.random().toString(36)}`,h=d&&typeof d.type!="string"?d.type:null;return e("div",{..._,className:o(["dropin-field",a]),children:[r&&e("label",{className:o(["dropin-field__label",["dropin-field__label--disabled",l],`dropin-field__label--${i}`]),htmlFor:m,children:r}),e("div",{className:o(["dropin-field__content"]),children:h&&d&&we(h,{...d.props,id:m,key:d.key,disabled:l,size:i,error:!!n,success:!!s&&!n})}),e("div",{className:o(["dropin-field__hint",[`dropin-field__hint--${i}`,i],["dropin-field__hint--error",!!n],["dropin-field__hint--success",!!s&&!n],["dropin-field__hint--disabled",!!l]]),children:n||s||t})]})},vt=({icon:a,className:r,children:n,active:t=!1,disabled:s=!1,...i})=>e("button",{role:"button",disabled:s,...i,className:o(["dropin-action-button",["dropin-action-button--active",t],["dropin-action-button--disabled",s],r]),children:[a&&e(y,{node:a,className:o(["dropin-action-button-icon"])}),n&&(typeof n=="string"?e("span",{children:n}):n)]}),gt=({className:a,variant:r="primary",activeOption:n,disabled:t=!1,dividers:s=!0,children:i,handleSelect:l,...d})=>{const[_,m]=B(n),h=C(c=>{t||c.props.disabled||(m(c.props.value),l&&l(c.props.value))},[l,m,t]),p=se.map(i,c=>{const u=t||c.props.disabled,b=c.props.value===_;return ke(c,{disabled:u,active:b,onClick:()=>h(c),className:o(["dropin-action-button-group__option",`dropin-action-button-group__option--${r}`,["dropin-action-button-group__option--active",b],["dropin-action-button-group__option--with-dividers",s]])})});return e("div",{role:"group",...d,className:o(["dropin-action-button-group",`dropin-action-button-group--${r}`,a]),children:p})},Ge=({variant:a="primary",className:r,children:n,...t})=>e("div",{...t,className:o(["dropin-card",`dropin-card--${a}`,r]),children:e("div",{class:"dropin-card__content",children:n})}),Nt=({name:a,value:r,size:n="medium",disabled:t=!1,error:s=!1,label:i="",description:l="",className:d,checked:_,...m})=>{const[h,p]=B(_===void 0?!1:_),c=le(null),u=f=>{var v;(v=m.onChange)==null||v.call(m,f),p(f.currentTarget.checked)},b=f=>{var v;f.key===" "&&(f.preventDefault(),(v=c==null?void 0:c.current)==null||v.click())};return e("label",{className:o(["dropin-checkbox",["dropin-checkbox--disabled",t]]),children:[e("input",{ref:c,name:a,value:r,type:"checkbox",disabled:t,className:o(["dropin-checkbox__checkbox",["dropin-checkbox__checkbox--error",s],d]),...m,onChange:u,checked:h}),e("span",{"aria-checked":h?"true":"false","aria-labelledby":`${a}-label`,"aria-describedby":`${a}-description`,className:o(["dropin-checkbox__box",["dropin-checkbox__box--error",s],["dropin-checkbox__box--disabled",t]]),role:"checkbox",tabIndex:t?-1:0,onKeyDown:b,children:e(T,{className:o(["dropin-checkbox__checkmark"]),source:de,size:"16",stroke:"3"})}),e("div",{id:`${a}-label`,className:o(["dropin-checkbox__label",`dropin-checkbox__label--${n}`,["dropin-checkbox__label--disabled",t]]),children:i}),e("div",{}),e("div",{id:`${a}-description`,role:"note",className:o(["dropin-checkbox__description",`dropin-checkbox__description--${n}`,["dropin-checkbox__description--disabled",t]]),children:l})]})},wt=({className:a,name:r,value:n,id:t,label:s,groupAriaLabel:i,size:l="medium",color:d,disabled:_=!1,selected:m=!1,outOfStock:h=!1,multi:p=!1,onValue:c,onUpdateError:u,...b})=>{const f=I("Dropin.Swatches.outOfStock.label").label,v=I("Dropin.Swatches.selected.label").label,w=I("Dropin.Swatches.swatch.label").label,x=C(async D=>{if(c)try{await c(D)}catch(S){u&&u(S)}},[c,u]),E=D=>{const S=D.target;x(S.value)},O=d&&(D=>{const S=new Option().style;return S.color=D,S.color!==""})(d)?d:"var(--color-gray-300);",L=()=>h?`${i}: ${s} ${f}`:m?`${i}: ${s} ${v}`:`${i}: ${s} ${w}`;return e("label",{className:o(["dropin-color-swatch__container",`dropin-color-swatch__container--${l}`,a]),children:[e("input",{type:p?"checkbox":"radio",name:r,id:t,value:n,"aria-label":L(),checked:m,disabled:_,onChange:E,...b,className:o(["dropin-color-swatch",["dropin-color-swatch--selected",m],["dropin-color-swatch--disabled",_],a])}),e("span",{style:{"--bg-color":O},className:o(["dropin-color-swatch__span",["dropin-color-swatch__span--out-of-stock",h],a])})]})},kt=({className:a,name:r,value:n,label:t,groupAriaLabel:s,id:i,disabled:l=!1,selected:d=!1,outOfStock:_=!1,multi:m=!1,onValue:h,onUpdateError:p,...c})=>{const u=I("Dropin.Swatches.outOfStock.label").label,b=I("Dropin.Swatches.selected.label").label,f=I("Dropin.Swatches.swatch.label").label,[v,w]=B(!1),x=le(null),E=C(async O=>{if(h)try{await h(O)}catch(L){p&&p(L)}},[h,p]),$=O=>{const L=O.target;E(L.value)},k=()=>_?`${s}: ${t} ${u}`:d?`${s}: ${t} ${b}`:`${s}: ${t} ${f}`;return W(()=>{x.current&&x.current.scrollWidth>x.current.clientWidth&&w(!0)},[t]),e("div",{className:"dropin-text-swatch__container",...v?{"data-tooltip":t}:{},children:[e("input",{type:m?"checkbox":"radio",name:r,id:i,value:n,"aria-label":k(),checked:d,disabled:l,onChange:$,...c,className:o(["dropin-text-swatch",["dropin-text-swatch--selected",d],["dropin-text-swatch--disabled",l],a])}),e("label",{htmlFor:i,ref:x,className:o(["dropin-text-swatch__label",["dropin-text-swatch__label--out-of-stock",_],a]),children:t})]})},Ke=({ariaLabel:a,size:r="small",stroke:n="4",children:t,className:s,style:i,...l})=>{const d=["dropin-progress-spinner",`dropin-progress-spinner--shape-size-${r}`,`dropin-progress-spinner--shape-stroke-${n}`],_=I({updating:"Dropin.ProgressSpinner.updating.label",updatingChildren:"Dropin.ProgressSpinner.updatingChildren.label"}),m=()=>a||(t?_.updatingChildren:_.updating);return t?e("div",{...l,className:o(["dropin-progress-spinner-provider"]),"aria-live":"polite",role:"status",children:[e("div",{"aria-hidden":!0,children:t}),e("div",{"aria-label":m(),role:"status",className:o(["dropin-progress-spinner-background",s]),style:i}),e("div",{className:o(["dropin-progress-spinner-with-provider",...d]),"aria-hidden":!0})]}):e("div",{...l,className:o([s,...d]),"aria-live":"polite",role:"status","aria-label":m()})},yt=({className:a,name:r,value:n,id:t,label:s,groupAriaLabel:i,src:l,alt:d,disabled:_=!1,selected:m=!1,outOfStock:h=!1,multi:p=!1,onValue:c,onUpdateError:u,...b})=>{const f=I("Dropin.Swatches.outOfStock.label").label,v=I("Dropin.Swatches.selected.label").label,w=I("Dropin.Swatches.swatch.label").label,x=C(async k=>{if(c)try{await c(k)}catch(O){u&&u(O)}},[c,u]),E=k=>{const O=k.target;x(O.value)},$=()=>h?`${i}: ${s} ${f}`:m?`${i}: ${s} ${v}`:`${i}: ${s} ${w}`;return e("label",{className:o(["dropin-image-swatch__container",a]),children:[e("input",{type:p?"checkbox":"radio",name:r,id:t,value:n,"aria-label":$(),checked:m,disabled:_,onChange:E,...b,className:o(["dropin-image-swatch",["dropin-image-swatch--selected",m],["dropin-image-swatch--disabled",_],a])}),e("span",{className:o(["dropin-image-swatch__span",["dropin-image-swatch__span--out-of-stock",h],a]),children:e(Me,{src:l,className:o(["dropin-image-swatch__content"]),params:{width:100,fit:"bounds",crop:!0},alt:d,loading:"lazy",onError:k=>k.target.style.display="none"})})]})},Ue=({className:a,children:r,title:n,secondaryText:t,actionIconPosition:s="left",iconOpen:i=K,iconClose:l=U,iconLeft:d=K,showIconLeft:_=!1,renderContentWhenClosed:m=!0,defaultOpen:h=!1,onStateChange:p,...c})=>{const[u,b]=B(h),f=$=>{$.stopImmediatePropagation();const k=!u;b(k),p==null||p(k)},v=I(`Dropin.Accordion.${u?"close":"open"}.label`).label,w=e(T,{source:i,size:"24",onClick:f,onKeyPress:f,className:"dropin-accordion-section__open-icon"}),x=e(T,{source:l,size:"24",onClick:f,onKeyPress:f,className:"dropin-accordion-section__close-icon"}),E=e(T,{source:d,size:"24"});return e("div",{...c,className:o(["dropin-accordion-section",a]),children:[e("div",{className:"dropin-accordion-section__heading",children:[e("div",{className:"dropin-accordion-section__flex",onClick:f,onKeyPress:f,role:"button","aria-label":`${v} ${n}`,tabIndex:0,children:e("div",{className:"dropin-accordion-section__title-container",children:[s==="left"&&(u?x:w),_&&E,e("h3",{className:"dropin-accordion-section__title",children:n})]})}),e("div",{className:"dropin-accordion-section__secondary-text-container",children:[t&&e("h4",{className:"dropin-accordion-section__secondary-text",children:t}),s==="right"&&(u?x:w)]})]}),e("div",{className:"dropin-accordion-section__content-container",style:{display:u?"grid":"none"},children:(u||m&&!u)&&r})]})},xt=({className:a,children:r,actionIconPosition:n="left",iconOpen:t=K,iconClose:s=U,...i})=>{const l=e(_e,{variant:"secondary"}),d=_=>e(R,{children:[e(Ue,{..._.props,actionIconPosition:n,iconOpen:t,iconClose:s}),l]});return e("div",{...i,className:o(["dropin-accordion",a]),children:[l,...(Array.isArray(r)?r:[r]).map(d)]})},Dt=({variant:a="primary",className:r,type:n="warning",additionalActions:t,onDismiss:s,heading:i,description:l,icon:d,itemList:_,actionButtonPosition:m,...h})=>{var c,u,b;const p=I({dismiss:"Dropin.InlineAlert.dismissLabel"});return e("div",{...h,className:o(["dropin-in-line-alert",`dropin-in-line-alert--${n}`,`dropin-in-line-alert--${a}`,r]),children:[e("div",{className:"dropin-in-line-alert__heading",children:[e("div",{className:"dropin-in-line-alert__title-container",children:[d&&e(y,{node:d,className:"dropin-in-line-alert__icon"}),e("span",{className:"dropin-in-line-alert__title",children:i})]}),e("div",{className:"dropin-in-line-alert__actions-container",children:[t&&(m==="top"||!m&&t.length<=1)&&e(V,{variant:"tertiary",className:"dropin-in-line-alert__additional-action",onClick:t.length>0?(c=t[0])==null?void 0:c.onClick:void 0,"aria-label":(u=t[0])==null?void 0:u.label,children:(b=t[0])==null?void 0:b.label}),s&&e(V,{icon:e(T,{source:j,size:"24",stroke:"2"}),className:"dropin-in-line-alert__dismiss-button",variant:"tertiary",onClick:s,"aria-label":p.dismiss})]})]}),l&&e("p",{className:"dropin-in-line-alert__description",children:l}),e("div",{className:"dropin-in-line-alert__item-list-container",children:_&&e(y,{node:_,className:o(["dropin-in-line-alert__item-list"])})}),t&&(m==="bottom"||!m&&t.length>1)&&e("div",{className:"dropin-in-line-alert__additional-actions-container",children:t.map(f=>e(V,{variant:"tertiary",className:"dropin-in-line-alert__additional-action",onClick:f.onClick,children:f.label},f.label))})]})},It=({size:a="small",title:r=null,centered:n=!1,backgroundDim:t=!0,clickToDismiss:s=!0,escapeToDismiss:i=!0,onClose:l,showCloseButton:d=!0,className:_,children:m=null,...h})=>{const p=C(()=>{l==null||l()},[l]),c=I({modalCloseLabel:"Dropin.Modal.Close.label"});return W(()=>{const u=b=>{const f=document.querySelector(".dropin-modal"),v=document.querySelector(".dropin-modal__body");s&&f&&v&&!v.contains(b.target)&&p()};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[p,s]),W(()=>{const u=b=>{b.key==="Escape"&&i&&p()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[p,i]),W(()=>{const u=document.scrollingElement,b=u.style.overflow;return u.style.overflow="hidden",()=>{u.style.overflow=b}},[]),e("div",{className:o(["dropin-modal",["dropin-modal--dim",t]]),children:e("div",{...h,className:o(["dropin-modal__body",[`dropin-modal__body--${a}`,a],_]),children:[e("div",{className:o(["dropin-modal__header",["dropin-modal__header-title",!!r]]),children:[r&&e("div",{className:o(["dropin-modal__header-title-content"]),children:r}),d&&e(V,{"aria-label":c.modalCloseLabel,variant:"tertiary",className:"dropin-modal__header-close-button",onClick:p,icon:e(j,{})})]}),e("div",{className:o(["dropin-modal__content",["dropin-modal__body--centered",n]]),children:m})]})})},Et=({className:a,children:r,ariaLabel:n,image:t,title:s,price:i,taxIncluded:l=!1,taxExcluded:d=!1,total:_,totalExcludingTax:m,sku:h,configurations:p,warning:c,alert:u,discount:b,savings:f,quantity:v,description:w,attributes:x,footer:E,loading:$=!1,updating:k=!1,quantityType:O,dropdownOptions:L,onQuantity:D,onRemove:S,...H})=>{var X,Y;const{locale:G}=ye(ce),P=I({each:"Dropin.CartItem.each.label",pricePerItem:"Dropin.CartItem.pricePerItem.label",quantity:"Dropin.CartItem.quantity.label",remove:"Dropin.CartItem.remove.label",removeDefault:"Dropin.CartItem.removeDefault.label",taxIncluded:"Dropin.CartItem.taxIncluded.label",taxExcluded:"Dropin.CartItem.taxExcluded.label",updating:"Dropin.CartItem.updating.label",updatingDefault:"Dropin.ProgressSpinner.updating.label"});if($)return e(je,{});const ue=O==="dropdown"?e(We,{className:o(["dropin-cart-item__quantity__picker"]),value:String(v),name:"quantity","aria-label":P.quantity,disabled:k,variant:"primary",options:L,handleSelect:F=>D==null?void 0:D(Number(F.target.value))}):e(Fe,{className:o(["dropin-cart-item__quantity__incrementer"]),value:v,min:1,onValue:F=>D==null?void 0:D(Number(F)),name:"quantity","aria-label":P.quantity,disabled:k});return e("div",{...H,className:o(["dropin-cart-item",["dropin-cart-item--updating",k],a]),children:[k&&e(Ke,{className:o(["dropin-cart-item__spinner"]),ariaLabel:n?(X=P.updating)==null?void 0:X.replace("{product}",n):P.updatingDefault}),e("div",{className:"dropin-cart-item__wrapper",children:[t&&e(y,{node:t,className:o(["dropin-cart-item__image"])}),s&&e(y,{node:s,className:o(["dropin-cart-item__title",["dropin-cart-item__title--edit",!!D||!!S]])}),w&&e(y,{node:w,className:o(["dropin-cart-item__description"])}),h&&e(y,{node:h,className:o(["dropin-cart-item__sku"])}),e("div",{className:o(["dropin-cart-item__savings__wrapper"]),children:[b&&e(y,{node:b,className:o(["dropin-cart-item__discount","dropin-cart-item__discount__large-screen"])}),f&&e(y,{node:f,className:o(["dropin-cart-item__savings","dropin-cart-item__savings__large-screen"])})]}),x&&e("div",{className:o(["dropin-cart-item__attributes"]),children:e(y,{node:x})}),p&&e("ul",{className:o(["dropin-cart-item__configurations"]),children:Object.entries(p).map(([F,he])=>e("li",{className:o(["dropin-cart-item__configurations__item"]),children:[F,":"," ",e("strong",{className:o(["dropin-cart-item__configurations__item__value"]),children:he})]},F))}),i&&e("span",{className:o(["dropin-cart-item__price"]),"aria-label":P.pricePerItem,children:[v&&!D&&e(R,{children:[e("span",{className:"dropin-cart-item__price__quantity","aria-hidden":!0,children:[v.toLocaleString(G)," x"," "]}),e("div",{className:"dropin-cart-item__sr-only",children:[P.quantity,": ",v==null?void 0:v.toLocaleString(G),";"]})]}),e(y,{node:i,role:"text"}),v&&v>1&&e(R,{children:[" ",P.each]}),l&&e("span",{"data-testid":"tax-message",className:"dropin-cart-item__price-tax-message",children:[" ",P.taxIncluded]}),d&&e("span",{"data-testid":"tax-message",className:"dropin-cart-item__price-tax-message",children:[" ",P.taxExcluded]})]}),e("div",{className:o(["dropin-cart-item__quantity",["dropin-cart-item__quantity--edit",!!D]]),children:[D?ue:v&&e("span",{className:o(["dropin-cart-item__quantity__value"]),children:[P.quantity,":"," ",e("strong",{className:"dropin-cart-item__quantity__number",children:Number(v).toLocaleString(G)})]}),c&&e(y,{node:c,className:o(["dropin-cart-item__warning","dropin-cart-item__warning--quantity"])}),u&&e(y,{node:u,className:o(["dropin-cart-item__alert","dropin-cart-item__alert--quantity"])})]}),c&&e(y,{node:c,className:o(["dropin-cart-item__warning"])}),u&&e(y,{node:u,className:o(["dropin-cart-item__alert"])}),e("div",{className:o(["dropin-cart-item__total",["dropin-cart-item__total--edit",!!S]]),children:[e("div",{className:"dropin-cart-item__row-total__wrapper",children:[_&&e("div",{className:"dropin-cart-item__row-total",children:e(y,{node:_,role:"text"})}),l&&e("div",{className:"dropin-cart-item__total-tax-included",children:e("span",{"data-testid":"tax-message",className:o(["dropin-cart-item__total-tax-message"]),children:P.taxIncluded})})]}),d&&e("div",{className:"dropin-cart-item__total-tax-excluded",children:e("span",{"data-testid":"tax-message",className:o(["dropin-cart-item__total-tax-excluded-message"]),children:[m&&e(y,{node:m,role:"text"})," ",P.taxExcluded]})}),b&&e(y,{node:b,className:o(["dropin-cart-item__discount"])}),f&&e(y,{node:f,className:o(["dropin-cart-item__savings"])})]}),E&&e("div",{className:o(["dropin-cart-item__footer"]),children:e(y,{node:E})})]}),S&&e(V,{"data-testid":"cart-item-remove-button",className:o(["dropin-cart-item__remove"]),variant:"tertiary",onClick:()=>S==null?void 0:S(),icon:e(T,{"data-testid":"cart-item-remove-icon",source:Le,size:"24",stroke:"2",viewBox:"0 0 24 24","aria-label":n?(Y=P.remove)==null?void 0:Y.replace("{product}",n):P.removeDefault}),disabled:k})]})},je=()=>e("div",{className:"dropin-cart-item dropin-cart-item-skeleton",children:e(Ce,{className:"dropin-cart-item__skeleton dropin-cart-item__wrapper",children:[e("div",{className:"dropin-cart-item__image",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__title",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__sku",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__price",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__quantity",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__total",children:e(q,{className:"dropin-cart-item__skeleton__item"})})]})}),$t=({className:a,children:r,...n})=>e("div",{...n,className:o(["dropin-cart-list",a]),children:e("div",{className:"dropin-cart-list__wrapper","aria-live":"assertive","aria-relevant":"all",children:se.map(r,(t,s)=>e("div",{className:"dropin-cart-list__item",children:t},s))})}),St=({className:a,children:r,locale:n,currency:t,amount:s,variant:i="default",minimumAmount:l,maximumAmount:d,size:_="small",display:m="dash",specialPrice:h,sale:p=!1,...c})=>{const u=M(()=>s||l===d||l&&!d||d&&!l,[s,d,l]);return e("div",{children:u?e("div",{...c,className:o(["dropin-price-range",a]),children:e(A,{amount:s??l??d,currency:t,locale:n,size:_,variant:i,sale:p})}):e("div",{...c,className:o(["dropin-price-range",a]),children:[m==="dash"?e(ze,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null,m==="from to"?e(Ze,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null,m==="as low as"?e(Je,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null]})})};function ze({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){return e(R,{children:[e(A,{amount:a??r,currency:t,locale:s,size:i,sale:!!a&&l}),e("span",{className:"dropin-price-range__separator",children:"-"}),e(A,{amount:n,currency:t,locale:s,size:i})]})}function Ze({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){const d=I({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return e(R,{children:[e("span",{className:o(["dropin-price-range__from",`dropin-price-range__from--${i}`]),children:d.from}),e(A,{amount:a??r,currency:t,locale:s,size:i,sale:!!a&&l}),e("span",{className:o(["dropin-price-range__to",`dropin-price-range__to--${i}`]),children:d.to}),e(A,{amount:n,currency:t,locale:s,size:i})]})}function Je({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){const d=I({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return e(R,{children:[e("span",{className:o(["dropin-price-range__as-low-as",`dropin-price-range__as-low-as--${i}`]),children:d.asLowAs}),a?e("div",{children:[e(A,{amount:n,currency:t,locale:s,size:i,variant:"strikethrough"}),e(A,{amount:a,currency:t,locale:s,size:i,className:"dropin-price-range__special",sale:!!a&&l})]}):e(A,{amount:r,currency:t,locale:s,size:i})]})}const Tt=({className:a,categories:r,separator:n,...t})=>e(R,{children:(r==null?void 0:r.length)>1&&e("nav",{role:"navigation",...t,className:o(["dropin-breadcrumbs__container",a]),children:e("ul",{className:"dropin-breadcrumbs__items",children:r==null?void 0:r.map((s,i)=>e("li",{className:o(["dropin-breadcrumbs__item",["dropin-breadcrumbs__item--last",i===r.length-1]]),children:[e(y,{node:s,className:"dropin-breadcrumbs__link"}),!n&&i!==r.length-1&&e("span",{className:"dropin-breadcrumbs__separator--default",children:[" ","/"," "]}),n&&i!==r.length-1&&e(y,{node:n,className:"dropin-breadcrumbs__separator--icon"})]},i))})})}),Lt=({className:a,variant:r,icon:n,message:t,onDismiss:s,action:i,...l})=>{const d=I({dismiss:"Dropin.InlineAlert.dismissLabel"});return e("div",{...l,className:o([a,"dropin-alert-banner",`dropin-alert-banner--${r}`]),children:[e("div",{className:"dropin-alert-banner__content",children:[n&&e(y,{node:n,"aria-hidden":"true",className:"dropin-alert-banner__icon"}),e(y,{node:t,className:o(["dropin-alert-banner__message"])})]}),e("div",{className:"dropin-alert-banner__actions",children:[i&&e(V,{variant:"tertiary",className:"dropin-alert-banner__action",onClick:i.onClick,"aria-label":i.label,children:i.label}),e(V,{icon:e(T,{source:j,size:"24",stroke:"2"}),className:"dropin-alert-banner__dismiss-button",variant:"primary",onClick:s,"aria-label":d.dismiss})]})]})},Pt=({className:a,icon:r,heading:n,headingLevel:t=2,message:s,action:i,variant:l="secondary",...d})=>{const _=t>=1&&t<=6?`h${t}`:"h2";return e("div",{...d,className:o(["dropin-illustrated-message",a]),children:e(Ge,{variant:l,children:[r&&e(y,{node:r,"aria-hidden":"true",size:"80",className:"dropin-illustrated-message__icon"}),n&&e(_,{className:"dropin-illustrated-message__heading",children:n}),s&&e(y,{node:s,className:"dropin-illustrated-message__message"}),i&&e(y,{node:i,className:"dropin-illustrated-message__action"})]})})},Ot=({className:a,label:r,name:n,value:t,selected:s=!0,onChange:i,icon:l,busy:d=!1,children:_,...m})=>e("div",{...m,className:o(["dropin-toggle-button",a,["dropin-toggle-button__selected",s]]),children:e("label",{className:"dropin-toggle-button__actionButton",children:[e(He,{label:"",name:n,value:t,checked:s,onChange:()=>i&&i(t),"aria-label":r,busy:d,className:o([a,"dropin-toggle-button__radioButton"])}),e("span",{className:"dropin-toggle-button__content",children:[l&&e(l.type,{...l==null?void 0:l.props,className:"dropin-toggle-button__icon"}),r]})]})}),Ct=({title:a=null,size:r="medium",cta:n,divider:t=!0,className:s,...i})=>a?e("div",{...i,className:o(["dropin-header-container",s]),"data-testid":"dropin-header-container",children:[e("span",{className:o(["dropin-header-container__title",["dropin-header-container__title--medium",r==="medium"],["dropin-header-container__title--large",r==="large"]]),children:a}),n?e(y,{node:n,className:"dropin-header-container__actions"}):null,t?e(_e,{className:o(["dropin-header-container__divider",["dropin-header-container__divider--medium",r==="medium"],["dropin-header-container__divider--large",r==="large"]])}):null]}):null,At=({label:a,className:r,...n})=>a?e("div",{...n,className:o(["dropin-tag-container",r]),"data-testid":"dropin-tag-container",children:e("span",{className:"dropin-tag-container__label",children:a})}):null,Vt=({className:a,children:r,maxColumns:n,emptyGridContent:t,...s})=>{const i=!!r&&(Array.isArray(r)?r.length>0:!0),l=i?{gridTemplateColumns:`repeat(${n}, 1fr)`}:void 0;return e("div",{...s,className:o(["dropin-content-grid",a]),tabindex:0,children:e("div",{"data-testid":"content-grid-content",className:o(["dropin-content-grid__content",["dropin-content-grid__dynamic-columns-content",!n],["dropin-content-grid__content--empty",!i]]),style:l,children:i?r:t})})},Rt=({totalPages:a=10,currentPage:r=1,onChange:n,className:t,...s})=>{const i=I({backwardButton:"Dropin.Pagination.backwardButton.ariaLabel",forwardButton:"Dropin.Pagination.forwardButton.ariaLabel"}),l=C(()=>{const p=Math.min(r+1,a);n==null||n(p)},[r,n,a]),d=C(()=>{const p=Math.max(r-1,1);n==null||n(p)},[r,n]),_=C(p=>{ve(p)&&(n==null||n(p))},[n]),m=C((p,c)=>{let u=[];const b=(f,v)=>{for(let w=f;w<=v;w++)u.push({page:w,isActive:w===p,label:w})};return c<=5?b(1,c):p<=2?(b(1,2),u.push({page:"ellipsis",isActive:!1,label:"..."}),b(c-1,c)):p>=c-3?b(c-4,c):(b(p-1,p),u.push({page:"ellipsis",isActive:!1,label:"..."}),b(c-1,c)),u},[]),h=M(()=>m(r,a),[m,r,a]);return e("div",{...s,className:o(["dropin-pagination",t]),children:[e("button",{type:"button","data-testid":"prev-button","aria-label":i.backwardButton,disabled:r===1,onClick:d,className:o(["dropin-pagination-arrow","dropin-pagination-arrow--backward"]),children:e(T,{size:"24",source:J})}),e("ul",{className:"dropin-pagination_list",children:h.map((p,c)=>e("li",{"data-testid":`dropin-pagination_list-item--${p.page}`,className:o(["dropin-pagination_list-item",`dropin-pagination_list-item--${p.page}`,["dropin-pagination_list-item--active",p.isActive]]),children:e("button",{type:"button","data-testid":`set-page-button-${p.page}`,onClick:()=>_(p.page),children:p.label})},`${p.page}_${c}`))}),e("button",{type:"button","data-testid":"next-button","aria-label":i.forwardButton,disabled:r===a,onClick:l,className:o(["dropin-pagination-arrow","dropin-pagination-arrow--forward"]),children:e(T,{size:"24",source:J})})]})};export{xt as Accordion,Ue as AccordionSection,vt as ActionButton,gt as ActionButtonGroup,Lt as AlertBanner,Tt as Breadcrumbs,V as Button,Ge as Card,Et as CartItem,je as CartItemSkeleton,$t as CartList,Nt as Checkbox,wt as ColorSwatch,Vt as ContentGrid,_e as Divider,me as Field,Ct as Header,T as Icon,Pt as IllustratedMessage,Me as Image,yt as ImageSwatch,Dt as InLineAlert,Fe as Incrementer,pe as Input,ht as InputDate,bt as InputPassword,It as Modal,Rt as Pagination,We as Picker,A as Price,St as PriceRange,Ke as ProgressSpinner,He as RadioButton,Ce as Skeleton,q as SkeletonRow,At as Tag,ft as TextArea,kt as TextSwatch,Ot as ToggleButton,ce as UIContext,Ae as UIProvider,ut as provider}; +import{jsx as e}from"./preact-jsx-runtime.js";import{d as Z,c as o,R as be,a as oe,V as y,g as fe,i as ve}from"./chunks/is-number.js";import{G as ge,T as M,k as R,F as g,L as Ne,h as B,q as C,S as K,y as W,_ as we,N as se,E as ke,A as le,x as ye}from"./chunks/icons/Add.js";import{IntlProvider as xe,Localizer as Q,Text as z,useText as I}from"./i18n.js";import U from"./chunks/icons/Minus.js";import De from"./chunks/icons/CheckWithCircle.js";import Ie from"./chunks/icons/WarningWithCircle.js";import Ee from"./chunks/icons/Date.js";import $e from"./chunks/icons/Locker.js";import Se from"./chunks/icons/Eye.js";import Te from"./chunks/icons/EyeClose.js";import de from"./chunks/icons/Check.js";import j from"./chunks/icons/Close.js";import J from"./chunks/icons/ChevronDown.js";import Le from"./chunks/icons/Trash.js";import"./chunks/image-params-keymap.js";import"./signals.js";const Pe={ExampleComponentName:{item:{label:"string"}},Pagination:{backwardButton:{ariaLabel:"Go to previous page"},forwardButton:{ariaLabel:"Go to next page"}},Incrementer:{decreaseLabel:"Decrease Quantity",increaseLabel:"Increase Quantity",label:"Quantity",errorMessage:"Enter a valid quantity",minQuantityMessage:"Enter at least {{minQuantity}}",maxQuantityMessage:"Maximum quantity is {{maxQuantity}}"},Modal:{Close:{label:"Close"}},InputPassword:{placeholder:"Password",floatingLabel:"Password",buttonTitle:"Click to show or hide password"},PasswordStatusIndicator:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long"},InlineAlert:{dismissLabel:"Dismiss Alert"},PriceSummary:{subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",label:"Total",withoutTax:"Total excluding taxes"}},ProgressSpinner:{updating:{label:"Item is updating"},updatingChildren:{label:"Items are updating"}},PriceRange:{from:{label:"From"},to:{label:"to"},asLowAs:{label:"As low as"}},Swatches:{outOfStock:{label:"out of stock swatch"},selected:{label:"swatch selected"},swatch:{label:"swatch"}},Accordion:{open:{label:"Open"},close:{label:"Close"}},CartItem:{each:{label:"each"},pricePerItem:{label:"price per item"},quantity:{label:"Quantity"},remove:{label:"Remove {product} from the cart"},removeDefault:{label:"Remove item from the cart"},taxIncluded:{label:"incl. VAT"},taxExcluded:{label:"excl. tax"},updating:{label:"{product} is updating"}},InputDate:{picker:"Select a date"}},ee={Dropin:Pe},te={default:ee,en_US:ee},Oe=a=>Z(te.default,te[a]||{}),re=1,q=({className:a,fullWidth:r=!1,lines:n=re,size:t="small",variant:s="row",children:i=null,multilineGap:l="medium",...d})=>{const _=[[`dropin-skeleton-row__${s}`,s],[`dropin-skeleton-row__${s}-${t}`,s&&t]];if(!i&&s==="empty")return e("div",{className:o(["dropin-skeleton-row dropin-skeleton-row__empty",a])});if(i){const h=i.trim();return e("div",{...d,class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],a]),dangerouslySetInnerHTML:{__html:h}})}return n>re===!1?e("div",{...d,class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],"dropin-skeleton--row__content",..._,a])}):e("div",{...d,style:{"--multiline-gap-spacing":`var(--spacing-${l})`},class:o(["dropin-skeleton-row--multiline",["dropin-skeleton-row--full",r],a]),children:Array.from({length:n}).map((h,p)=>e("div",{class:o(["dropin-skeleton-row",["dropin-skeleton-row--full",r],"dropin-skeleton--row__content",..._])},p))})},Ce=({className:a,children:r,rowGap:n="medium",...t})=>e("div",{style:{"--row-gap-spacing":`var(--spacing-${n})`},...t,className:o(["dropin-skeleton",a]),role:"status","aria-label":"Loading...",children:r}),ce=ge({locale:"en-US"}),Ae=({lang:a="en_US",langDefinitions:r={},children:n})=>{const t=M(()=>{const i=Z(r.default,r[a]??{});return Z(Oe(a),i)},[a,r]),s=a.replace("_","-");return e(ce.Provider,{value:{locale:s},children:e(xe,{definition:t,children:e(R,{children:n})})})},ut=new be(e(Ae,{})),Ve=function(){const r=typeof document<"u"&&document.createElement("link").relList;return r&&r.supports&&r.supports("modulepreload")?"modulepreload":"preload"}(),Re=function(a){return"/"+a},ne={},N=function(r,n,t){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.all(n.map(d=>{if(d=Re(d),d in ne)return;ne[d]=!0;const _=d.endsWith(".css"),m=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=_?"stylesheet":Ve,_||(h.as="script",h.crossOrigin=""),h.href=d,l&&h.setAttribute("nonce",l),document.head.appendChild(h),_)return new Promise((p,c)=>{h.addEventListener("load",p),h.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${d}`)))})}))}return s.then(()=>r()).catch(i=>{const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i})},Be={Add:g(()=>N(()=>import("./chunks/icons/Add.js").then(a=>a.$),[])),Bulk:g(()=>N(()=>import("./chunks/icons/Bulk.js"),[])),Burger:g(()=>N(()=>import("./chunks/icons/Burger.js"),[])),Cart:g(()=>N(()=>import("./chunks/icons/Cart.js"),[])),Check:g(()=>N(()=>import("./chunks/icons/Check.js"),[])),ChevronDown:g(()=>N(()=>import("./chunks/icons/ChevronDown.js"),[])),ChevronUp:g(()=>N(()=>import("./chunks/icons/ChevronUp.js"),[])),ChevronRight:g(()=>N(()=>import("./chunks/icons/ChevronRight.js"),[])),Close:g(()=>N(()=>import("./chunks/icons/Close.js"),[])),Heart:g(()=>N(()=>import("./chunks/icons/Heart.js"),[])),Minus:g(()=>N(()=>import("./chunks/icons/Minus.js"),[])),Placeholder:g(()=>N(()=>import("./chunks/icons/Placeholder.js"),[])),PlaceholderFilled:g(()=>N(()=>import("./chunks/icons/PlaceholderFilled.js"),[])),Search:g(()=>N(()=>import("./chunks/icons/Search.js"),[])),SearchFilled:g(()=>N(()=>import("./chunks/icons/SearchFilled.js"),[])),Sort:g(()=>N(()=>import("./chunks/icons/Sort.js"),[])),Star:g(()=>N(()=>import("./chunks/icons/Star.js"),[])),View:g(()=>N(()=>import("./chunks/icons/View.js"),[])),User:g(()=>N(()=>import("./chunks/icons/User.js"),[])),Warning:g(()=>N(()=>import("./chunks/icons/Warning.js"),[])),Locker:g(()=>N(()=>import("./chunks/icons/Locker.js"),[])),Wallet:g(()=>N(()=>import("./chunks/icons/Wallet.js"),[])),Card:g(()=>N(()=>import("./chunks/icons/Card.js"),[])),Order:g(()=>N(()=>import("./chunks/icons/Order.js"),[])),Delivery:g(()=>N(()=>import("./chunks/icons/Delivery.js"),[])),OrderError:g(()=>N(()=>import("./chunks/icons/OrderError.js"),[])),OrderSuccess:g(()=>N(()=>import("./chunks/icons/OrderSuccess.js"),[])),PaymentError:g(()=>N(()=>import("./chunks/icons/PaymentError.js"),[])),CheckWithCircle:g(()=>N(()=>import("./chunks/icons/CheckWithCircle.js"),[])),WarningWithCircle:g(()=>N(()=>import("./chunks/icons/WarningWithCircle.js"),[])),WarningFilled:g(()=>N(()=>import("./chunks/icons/WarningFilled.js"),[])),InfoFilled:g(()=>N(()=>import("./chunks/icons/InfoFilled.js"),[])),HeartFilled:g(()=>N(()=>import("./chunks/icons/HeartFilled.js"),[])),Trash:g(()=>N(()=>import("./chunks/icons/Trash.js"),[])),Eye:g(()=>N(()=>import("./chunks/icons/Eye.js"),[])),EyeClose:g(()=>N(()=>import("./chunks/icons/EyeClose.js"),[])),Date:g(()=>N(()=>import("./chunks/icons/Date.js"),[])),AddressBook:g(()=>N(()=>import("./chunks/icons/AddressBook.js"),[])),EmptyBox:g(()=>N(()=>import("./chunks/icons/EmptyBox.js"),[])),Coupon:g(()=>N(()=>import("./chunks/icons/Coupon.js"),[]))};function T({source:a,size:r="24",stroke:n="2",viewBox:t="0 0 24 24",className:s,...i}){const l=typeof a=="string"?Be[a]:null,d={className:o(["dropin-icon",`dropin-icon--shape-stroke-${n}`,s]),width:r,height:r,viewBox:t};return e(Ne,{fallback:e("svg",{...i,...d}),children:l?e(l,{...i,...d}):e(a,{...i,...d})})}const Fe=({name:a,value:r="1",className:n,disabled:t,error:s,success:i,min:l,max:d,onValue:_,onUpdateError:m,size:h="medium",...p})=>{const[c,u]=B(Number(r)),b=Number(l),f=Number(d),v=s||cf,w=cf?"Dropin.Incrementer.maxQuantityMessage":"Dropin.Incrementer.errorMessage",x=C(oe(async $=>{if(_)try{_($)}catch(k){m&&m(k)}},200),[_,m]),E=$=>{let k=$;x(k),u(k)};return e("div",{className:o(["dropin-incrementer",`dropin-incrementer--${h}`,n]),children:[e("div",{className:o(["dropin-incrementer__content",`dropin-incrementer__content--${h}`,["dropin-incrementer__content--error",v],["dropin-incrementer__content--success",i],["dropin-incrementer__content--disabled",t]]),children:[e("div",{className:o(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",t]]),children:e(Q,{children:e("button",{type:"button",className:o(["dropin-incrementer__decrease-button",["dropin-incrementer__decrease-button--disabled",t]]),onClick:()=>E(c-1),disabled:t||c{E(Number(c))},onChange:$=>{const k=$.currentTarget.value;k!==""&&E(Number(k))},...p}),e("div",{className:o(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",t]]),children:e(Q,{children:e("button",{type:"button",className:o(["dropin-incrementer__increase-button",["dropin-incrementer__increase-button--disabled",t]]),onClick:()=>E(c+1),disabled:t||c>f-1,"aria-label":e(z,{id:"Dropin.Incrementer.increaseLabel"}),children:e(T,{source:K,size:"16",stroke:"1",viewBox:"4 2 20 20",className:"dropin-incrementer__add"})})})})]}),v&&e("p",{className:"dropin-incrementer__content--error-message",children:e(z,{id:w,fields:{minQuantity:l,maxQuantity:d}})})]})},pe=({name:a,value:r,variant:n="primary",className:t,disabled:s,error:i,floatingLabel:l,onValue:d,onUpdateError:_,size:m="medium",icon:h,maxLength:p,success:c,...u})=>{const b=(u==null?void 0:u.id)||a||`dropin-input-${Math.random().toString(36)}`,f=C(oe(async w=>{if(d)try{await d(w)}catch(x){_&&_(x)}},200),[d,_]),v=w=>{const x=w.target;f(x.value.trim())};return e("div",{className:o(["dropin-input-container",`dropin-input-container--${n}`,["dropin-input-container--floating",!!l],["dropin-input-container--disabled",s]]),children:[h&&e(y,{node:h,className:o(["dropin-input__field-icon--left",h.props.className])}),e("div",{className:"dropin-input-label-container",children:[e("input",{id:b,onChange:v,type:"text",maxLength:p,name:a,value:r,...u,className:o(["dropin-input",`dropin-input--${m}`,`dropin-input--${n}`,["dropin-input--error",!!i],["dropin-input--success",!!c],["dropin-input--disabled",s],["dropin-input--floating",!!l],["dropin-input--icon-left",!!h],t]),disabled:s}),l&&e("label",{htmlFor:b,className:o([["dropin-input__label--floating",!!l],["dropin-input__label--floating--icon-left",!!h],["dropin-input__label--floating--error",!!i]]),children:l})]}),i&&e("div",{className:o(["dropin-input__field-icon--right","dropin-input__field-icon--error"]),children:e(T,{source:Ie,size:"16",stroke:"2",className:"dropin-input--warning-icon",viewBox:"-1 -1 26 26"})}),c&&e("div",{className:o(["dropin-input__field-icon--right","dropin-input__field-icon--success"]),children:e(T,{source:De,size:"16",stroke:"2",className:"dropin-input--success-icon",viewBox:"-1 -1 26 26"})})]})},ht=({name:a="",error:r,value:n,label:t,onChange:s,onBlur:i,...l})=>{const d=I({picker:"Dropin.InputDate.picker"}),_=p=>{p.currentTarget.setAttribute("type","date")},m=p=>{var u;const c=(u=p.currentTarget.parentElement)==null?void 0:u.querySelector("input");c==null||c.focus(),c==null||c.showPicker()},h=p=>{p.currentTarget.setAttribute("type","text"),i==null||i(p)};return e("div",{className:o(["dropin-input-date"]),children:[e(me,{error:r,children:e(pe,{error:!!r,name:a,value:n==null?void 0:n.toString(),placeholder:t,floatingLabel:t,onFocus:_,onBlur:h,onChange:s,"aria-labelledby":t,className:"dropin-input-date__input",...l})}),e("button",{className:"dropin-input-date__icon","aria-label":d.picker,onClick:m,children:e(T,{source:Ee,size:"24"})})]})},ie={pending:e(U,{}),success:e(de,{}),error:e(j,{style:{fill:"red"}})},qe=({minLength:a=0,requiredCharacterClasses:r=0,uniqueSymbolsStatus:n="pending",validateLengthConfig:t={status:"",icon:"",message:""}})=>{const s=I({chartTwoSymbols:"Dropin.PasswordStatusIndicator.chartTwoSymbols",chartThreeSymbols:"Dropin.PasswordStatusIndicator.chartThreeSymbols",chartFourSymbols:"Dropin.PasswordStatusIndicator.chartFourSymbols"}),i=l=>{switch(l){case 2:return s.chartTwoSymbols;case 3:return s.chartThreeSymbols;case 4:return s.chartFourSymbols;default:return""}};return e("div",{className:o(["dropin-password-status-indicator"]),children:[a>0?e("div",{className:`dropin-password-status-indicator__item dropin-password-status-indicator__item--${t.status}`,"data-testid":`dropin-password-status-indicator__item--${t.icon}`,children:[ie[t.icon],e("span",{className:`${t.status}`,children:t.message})]}):null,r>=2?e("div",{className:`dropin-password-status-indicator__item dropin-password-status-indicator__item--${n}`,"data-testid":`dropin-password-status-indicator__item--${n}`,children:[ie[n],e("span",{className:"pending",children:i(r)})]}):null]})},bt=({placeholder:a,floatingLabel:r,children:n,name:t,required:s,className:i,minLength:l,autoComplete:d,defaultValue:_="",hideStatusIndicator:m=!1,uniqueSymbolsStatus:h,validateLengthConfig:p,requiredCharacterClasses:c,errorMessage:u,onValue:b,onBlur:f,...v})=>{const w=I({placeholder:"Dropin.InputPassword.placeholder",floatingLabel:"Dropin.InputPassword.floatingLabel",buttonTitle:"Dropin.InputPassword.buttonTitle"}),[x,E]=B(!1),$=C(()=>{E(k=>!k)},[]);return e("div",{"data-testid":"passwordFieldInput",className:o(["dropin-input-password",["dropin-input-password--error",u],i]),...v,children:[e(me,{error:u,children:e(pe,{autoComplete:d,name:t??"password",type:x?"text":"password",placeholder:a||w.placeholder,floatingLabel:r||w.floatingLabel,"aria-label":w.placeholder,"aria-required":!0,required:s||!1,value:_,onValue:b,icon:e($e,{}),onBlur:f,"data-testid":"passwordInput"})}),e(V,{"aria-label":w.buttonTitle,title:w.buttonTitle,type:"button","data-testid":"toggle-password-icon",variant:"tertiary",className:o(["dropin-input-password__eye-icon",`dropin-input-password__eye-icon--${x?"show":"hide"}`,i]),onClick:$,children:x?e(Se,{}):e(Te,{})}),m?null:e(qe,{minLength:l,requiredCharacterClasses:c,validateLengthConfig:p,uniqueSymbolsStatus:h}),n]})},ft=({disabled:a,name:r="",errorMessage:n,value:t,label:s,className:i,onChange:l,onBlur:d,..._})=>{const m=(_==null?void 0:_.id)||r||`dropin-textarea-${Math.random().toString(36)}`,h=!!(n!=null&&n.length),p=C(c=>{const u=c.target;u.style.height="auto",u.style.height=`${u.scrollHeight}px`,l==null||l(c)},[l]);return e("div",{className:o(["dropin-textarea-container",i]),"data-testid":"dropin-textarea-container",children:[e("textarea",{"data-testid":"dropin-textarea-field",className:o(["dropin-textarea",["dropin-textarea--error",h],["dropin-textarea--disabled",!!a]]),id:m,placeholder:s,name:r,value:t,disabled:a,onBlur:d,onChange:p,..._}),e("label",{htmlFor:m,className:o(["dropin-textarea__label--floating",["dropin-textarea__label--floating--error",h]]),children:s}),h?e("div",{className:o(["dropin-textarea__label--floating--text",["dropin-textarea__label--floating--error",h]]),children:n}):null]})},Me=({className:a,src:r,params:n,loading:t="lazy",srcSet:s,onLoad:i,...l})=>{const[d,_]=B(!1),m=M(()=>{if(s)return s;if(!(!r||!n))return fe(r,{...n})},[n,r,s]),h=p=>{_(!0),i==null||i(p)};return e("img",{...l,className:o(["dropin-image",["dropin-image--loaded",d],a]),loading:t,onLoad:h,src:r,srcSet:m})},_e=({variant:a="primary",className:r})=>e("hr",{role:"separator",className:o(["dropin-divider",`dropin-divider--${a}`,r])}),A=({amount:a=0,currency:r,locale:n=void 0,variant:t="default",weight:s="bold",className:i,children:l,sale:d=!1,formatOptions:_={},size:m="small",...h})=>{const p=M(()=>new Intl.NumberFormat(n,{style:"currency",currency:r||"USD",minimumFractionDigits:2,maximumFractionDigits:2,..._}),[n,r,_]),c=M(()=>p.format(a),[a,p]);return e("span",{...h,className:o(["dropin-price",`dropin-price--${t}`,`dropin-price--${m}`,`dropin-price--${s}`,["dropin-price--sale",d],i]),children:c})},He=({name:a,label:r,value:n,size:t="medium",checked:s=!1,disabled:i=!1,error:l=!1,description:d="",busy:_=!1,className:m,children:h,...p})=>e("label",{className:o([m,"dropin-radio-button",["dropin-radio-button--error",l],["dropin-radio-button--disabled",i]]),children:[e("input",{name:a,value:n,checked:s,disabled:i,type:"radio",className:o(["dropin-radio-button__input",["dropin-radio-button__input--error",l],["dropin-radio-button__input--disabled",i]]),"aria-busy":_,...p}),e("span",{className:o(["dropin-radio-button__label",`dropin-radio-button__label--${t}`,["dropin-radio-button__label--error",l],["dropin-radio-button__label--disabled",i]]),children:r}),e("span",{className:o(["dropin-radio-button__description",`dropin-radio-button__description--${t}`,["dropin-radio-button__description--disabled",i]]),children:d})]}),V=({value:a,variant:r="primary",size:n="medium",icon:t,className:s,children:i,disabled:l=!1,active:d=!1,activeChildren:_,activeIcon:m,href:h,...p})=>{let c="dropin-button";(t&&!i||t&&d&&!_||!t&&d&&m)&&(c="dropin-iconButton"),d&&_&&(c="dropin-button"),s=o([c,`${c}--${n}`,`${c}--${r}`,[`${c}--${r}--disabled`,l],i&&t&&`${c}--with-icon`,!i&&_&&t&&`${c}--with-icon`,d&&m&&`${c}--with-icon`,s]);const u=o(["dropin-button-icon",`dropin-button-icon--${r}`,[`dropin-button-icon--${r}--disabled`,l],t==null?void 0:t.props.className]),b=h?{node:e("a",{}),role:"link",href:h,...p,disabled:l,active:d,onKeyDown:f=>{l&&f.preventDefault()},tabIndex:l?-1:0}:{node:e("button",{}),role:"button",...p,value:a,disabled:l,active:d};return e(y,{...b,className:s,children:[t&&!d&&e(y,{node:t,className:u}),m&&d&&e(y,{node:m,className:u}),i&&!d&&(typeof i=="string"?e("span",{children:i}):i),d&&_&&(typeof _=="string"?e("span",{children:_}):_)]})};function ae(a,r,n,t,s){return a||(r?r.value:n||t?"":s?s.value:null)}const We=({name:a,value:r=null,options:n,variant:t="primary",floatingLabel:s,size:i="medium",handleSelect:l=()=>{},disabled:d=!1,error:_=!1,placeholder:m,defaultOption:h,icon:p,className:c,...u})=>{const b=(u==null?void 0:u.id)||a||`dropin-picker-${Math.random().toString(36)}`,f=!!(u!=null&&u.required),v=n==null?void 0:n.find(L=>!L.disabled),[w,x]=B(()=>ae(r,h,m,s,v));W(()=>{x(ae(r,h,m,s,v))},[r,h,m,s,v]);const E=L=>{const{options:D,value:S}=L.target;for(const H of D)H.selected&&(x(S),l(L))},$=n==null?void 0:n.map(L=>{const{value:D,text:S,disabled:H}=L;return e("option",{value:D,selected:D===w,disabled:H,className:o(["dropin-picker__option"]),children:S},D)}),k=!!w,O=()=>(!f||!k)&&(s||m);return e("div",{className:o([c,"dropin-picker",`dropin-picker__${i}`,["dropin-picker__floating",!!s],["dropin-picker__selected",k],["dropin-picker__error",_],["dropin-picker__disabled",d],["dropin-picker__icon",p]]),children:[p&&e(p.type,{...p.props,className:"dropin-picker__icon--placeholder"}),e("select",{id:b,className:o(["dropin-picker__select",`dropin-picker__select--${t}`,`dropin-picker__select--${i}`,["dropin-picker__select--floating",!!s]]),name:a,"aria-label":a,disabled:d,onChange:E,...u,children:[O()&&e("option",{selected:!k,value:"",className:o(["dropin-picker__option dropin-picker__placeholder"]),children:s??m},r),$]}),e(T,{source:J,size:"24",stroke:"2",className:"dropin-picker__chevronDown"}),s&&k&&e("label",{htmlFor:b,className:o(["dropin-picker__floatingLabel",!!s]),children:s})]})},me=({className:a,label:r,error:n,hint:t,success:s,size:i="medium",disabled:l=!1,children:d,..._})=>{var p;const m=((p=d==null?void 0:d.props)==null?void 0:p.id)??`dropin-field-${Math.random().toString(36)}`,h=d&&typeof d.type!="string"?d.type:null;return e("div",{..._,className:o(["dropin-field",a]),children:[r&&e("label",{className:o(["dropin-field__label",["dropin-field__label--disabled",l],`dropin-field__label--${i}`]),htmlFor:m,children:r}),e("div",{className:o(["dropin-field__content"]),children:h&&d&&we(h,{...d.props,id:m,key:d.key,disabled:l,size:i,error:!!n,success:!!s&&!n})}),e("div",{className:o(["dropin-field__hint",[`dropin-field__hint--${i}`,i],["dropin-field__hint--error",!!n],["dropin-field__hint--success",!!s&&!n],["dropin-field__hint--disabled",!!l]]),children:n||s||t})]})},vt=({icon:a,className:r,children:n,active:t=!1,disabled:s=!1,...i})=>e("button",{role:"button",disabled:s,...i,className:o(["dropin-action-button",["dropin-action-button--active",t],["dropin-action-button--disabled",s],r]),children:[a&&e(y,{node:a,className:o(["dropin-action-button-icon"])}),n&&(typeof n=="string"?e("span",{children:n}):n)]}),gt=({className:a,variant:r="primary",activeOption:n,disabled:t=!1,dividers:s=!0,children:i,handleSelect:l,...d})=>{const[_,m]=B(n),h=C(c=>{t||c.props.disabled||(m(c.props.value),l&&l(c.props.value))},[l,m,t]),p=se.map(i,c=>{const u=t||c.props.disabled,b=c.props.value===_;return ke(c,{disabled:u,active:b,onClick:()=>h(c),className:o(["dropin-action-button-group__option",`dropin-action-button-group__option--${r}`,["dropin-action-button-group__option--active",b],["dropin-action-button-group__option--with-dividers",s]])})});return e("div",{role:"group",...d,className:o(["dropin-action-button-group",`dropin-action-button-group--${r}`,a]),children:p})},Ge=({variant:a="primary",className:r,children:n,...t})=>e("div",{...t,className:o(["dropin-card",`dropin-card--${a}`,r]),children:e("div",{class:"dropin-card__content",children:n})}),Nt=({name:a,value:r,size:n="medium",disabled:t=!1,error:s=!1,label:i="",description:l="",className:d,checked:_,...m})=>{const[h,p]=B(_===void 0?!1:_),c=le(null),u=f=>{var v;(v=m.onChange)==null||v.call(m,f),p(f.currentTarget.checked)},b=f=>{var v;f.key===" "&&(f.preventDefault(),(v=c==null?void 0:c.current)==null||v.click())};return e("label",{className:o(["dropin-checkbox",["dropin-checkbox--disabled",t]]),children:[e("input",{ref:c,name:a,value:r,type:"checkbox",disabled:t,className:o(["dropin-checkbox__checkbox",["dropin-checkbox__checkbox--error",s],d]),...m,onChange:u,checked:h}),e("span",{"aria-checked":h?"true":"false","aria-labelledby":`${a}-label`,"aria-describedby":`${a}-description`,className:o(["dropin-checkbox__box",["dropin-checkbox__box--error",s],["dropin-checkbox__box--disabled",t]]),role:"checkbox",tabIndex:t?-1:0,onKeyDown:b,children:e(T,{className:o(["dropin-checkbox__checkmark"]),source:de,size:"16",stroke:"3"})}),e("div",{id:`${a}-label`,className:o(["dropin-checkbox__label",`dropin-checkbox__label--${n}`,["dropin-checkbox__label--disabled",t]]),children:i}),e("div",{}),e("div",{id:`${a}-description`,role:"note",className:o(["dropin-checkbox__description",`dropin-checkbox__description--${n}`,["dropin-checkbox__description--disabled",t]]),children:l})]})},wt=({className:a,name:r,value:n,id:t,label:s,groupAriaLabel:i,size:l="medium",color:d,disabled:_=!1,selected:m=!1,outOfStock:h=!1,multi:p=!1,onValue:c,onUpdateError:u,...b})=>{const f=I("Dropin.Swatches.outOfStock.label").label,v=I("Dropin.Swatches.selected.label").label,w=I("Dropin.Swatches.swatch.label").label,x=C(async D=>{if(c)try{await c(D)}catch(S){u&&u(S)}},[c,u]),E=D=>{const S=D.target;x(S.value)},O=d&&(D=>{const S=new Option().style;return S.color=D,S.color!==""})(d)?d:"var(--color-gray-300);",L=()=>h?`${i}: ${s} ${f}`:m?`${i}: ${s} ${v}`:`${i}: ${s} ${w}`;return e("label",{className:o(["dropin-color-swatch__container",`dropin-color-swatch__container--${l}`,a]),children:[e("input",{type:p?"checkbox":"radio",name:r,id:t,value:n,"aria-label":L(),checked:m,disabled:_,onChange:E,...b,className:o(["dropin-color-swatch",["dropin-color-swatch--selected",m],["dropin-color-swatch--disabled",_],a])}),e("span",{style:{"--bg-color":O},className:o(["dropin-color-swatch__span",["dropin-color-swatch__span--out-of-stock",h],a])})]})},kt=({className:a,name:r,value:n,label:t,groupAriaLabel:s,id:i,disabled:l=!1,selected:d=!1,outOfStock:_=!1,multi:m=!1,onValue:h,onUpdateError:p,...c})=>{const u=I("Dropin.Swatches.outOfStock.label").label,b=I("Dropin.Swatches.selected.label").label,f=I("Dropin.Swatches.swatch.label").label,[v,w]=B(!1),x=le(null),E=C(async O=>{if(h)try{await h(O)}catch(L){p&&p(L)}},[h,p]),$=O=>{const L=O.target;E(L.value)},k=()=>_?`${s}: ${t} ${u}`:d?`${s}: ${t} ${b}`:`${s}: ${t} ${f}`;return W(()=>{x.current&&x.current.scrollWidth>x.current.clientWidth&&w(!0)},[t]),e("div",{className:"dropin-text-swatch__container",...v?{"data-tooltip":t}:{},children:[e("input",{type:m?"checkbox":"radio",name:r,id:i,value:n,"aria-label":k(),checked:d,disabled:l,onChange:$,...c,className:o(["dropin-text-swatch",["dropin-text-swatch--selected",d],["dropin-text-swatch--disabled",l],a])}),e("label",{htmlFor:i,ref:x,className:o(["dropin-text-swatch__label",["dropin-text-swatch__label--out-of-stock",_],a]),children:t})]})},Ke=({ariaLabel:a,size:r="small",stroke:n="4",children:t,className:s,style:i,...l})=>{const d=["dropin-progress-spinner",`dropin-progress-spinner--shape-size-${r}`,`dropin-progress-spinner--shape-stroke-${n}`],_=I({updating:"Dropin.ProgressSpinner.updating.label",updatingChildren:"Dropin.ProgressSpinner.updatingChildren.label"}),m=()=>a||(t?_.updatingChildren:_.updating);return t?e("div",{...l,className:o(["dropin-progress-spinner-provider"]),"aria-live":"polite",role:"status",children:[e("div",{"aria-hidden":!0,children:t}),e("div",{"aria-label":m(),role:"status",className:o(["dropin-progress-spinner-background",s]),style:i}),e("div",{className:o(["dropin-progress-spinner-with-provider",...d]),"aria-hidden":!0})]}):e("div",{...l,className:o([s,...d]),"aria-live":"polite",role:"status","aria-label":m()})},yt=({className:a,name:r,value:n,id:t,label:s,groupAriaLabel:i,src:l,alt:d,disabled:_=!1,selected:m=!1,outOfStock:h=!1,multi:p=!1,onValue:c,onUpdateError:u,...b})=>{const f=I("Dropin.Swatches.outOfStock.label").label,v=I("Dropin.Swatches.selected.label").label,w=I("Dropin.Swatches.swatch.label").label,x=C(async k=>{if(c)try{await c(k)}catch(O){u&&u(O)}},[c,u]),E=k=>{const O=k.target;x(O.value)},$=()=>h?`${i}: ${s} ${f}`:m?`${i}: ${s} ${v}`:`${i}: ${s} ${w}`;return e("label",{className:o(["dropin-image-swatch__container",a]),children:[e("input",{type:p?"checkbox":"radio",name:r,id:t,value:n,"aria-label":$(),checked:m,disabled:_,onChange:E,...b,className:o(["dropin-image-swatch",["dropin-image-swatch--selected",m],["dropin-image-swatch--disabled",_],a])}),e("span",{className:o(["dropin-image-swatch__span",["dropin-image-swatch__span--out-of-stock",h],a]),children:e(Me,{src:l,className:o(["dropin-image-swatch__content"]),params:{width:100,fit:"bounds",crop:!0},alt:d,loading:"lazy",onError:k=>k.target.style.display="none"})})]})},Ue=({className:a,children:r,title:n,secondaryText:t,actionIconPosition:s="left",iconOpen:i=K,iconClose:l=U,iconLeft:d=K,showIconLeft:_=!1,renderContentWhenClosed:m=!0,defaultOpen:h=!1,onStateChange:p,...c})=>{const[u,b]=B(h),f=$=>{$.stopImmediatePropagation();const k=!u;b(k),p==null||p(k)},v=I(`Dropin.Accordion.${u?"close":"open"}.label`).label,w=e(T,{source:i,size:"24",onClick:f,onKeyPress:f,className:"dropin-accordion-section__open-icon"}),x=e(T,{source:l,size:"24",onClick:f,onKeyPress:f,className:"dropin-accordion-section__close-icon"}),E=e(T,{source:d,size:"24"});return e("div",{...c,className:o(["dropin-accordion-section",a]),children:[e("div",{className:"dropin-accordion-section__heading",children:[e("div",{className:"dropin-accordion-section__flex",onClick:f,onKeyPress:f,role:"button","aria-label":`${v} ${n}`,tabIndex:0,children:e("div",{className:"dropin-accordion-section__title-container",children:[s==="left"&&(u?x:w),_&&E,e("h3",{className:"dropin-accordion-section__title",children:n})]})}),e("div",{className:"dropin-accordion-section__secondary-text-container",children:[t&&e("h4",{className:"dropin-accordion-section__secondary-text",children:t}),s==="right"&&(u?x:w)]})]}),e("div",{className:"dropin-accordion-section__content-container",style:{display:u?"grid":"none"},children:(u||m&&!u)&&r})]})},xt=({className:a,children:r,actionIconPosition:n="left",iconOpen:t=K,iconClose:s=U,...i})=>{const l=e(_e,{variant:"secondary"}),d=_=>e(R,{children:[e(Ue,{..._.props,actionIconPosition:n,iconOpen:t,iconClose:s}),l]});return e("div",{...i,className:o(["dropin-accordion",a]),children:[l,...(Array.isArray(r)?r:[r]).map(d)]})},Dt=({variant:a="primary",className:r,type:n="warning",additionalActions:t,onDismiss:s,heading:i,description:l,icon:d,itemList:_,actionButtonPosition:m,...h})=>{var c,u,b;const p=I({dismiss:"Dropin.InlineAlert.dismissLabel"});return e("div",{...h,className:o(["dropin-in-line-alert",`dropin-in-line-alert--${n}`,`dropin-in-line-alert--${a}`,r]),children:[e("div",{className:"dropin-in-line-alert__heading",children:[e("div",{className:"dropin-in-line-alert__title-container",children:[d&&e(y,{node:d,className:"dropin-in-line-alert__icon"}),e("span",{className:"dropin-in-line-alert__title",children:i})]}),e("div",{className:"dropin-in-line-alert__actions-container",children:[t&&(m==="top"||!m&&t.length<=1)&&e(V,{variant:"tertiary",className:"dropin-in-line-alert__additional-action",onClick:t.length>0?(c=t[0])==null?void 0:c.onClick:void 0,"aria-label":(u=t[0])==null?void 0:u.label,children:(b=t[0])==null?void 0:b.label}),s&&e(V,{icon:e(T,{source:j,size:"24",stroke:"2"}),className:"dropin-in-line-alert__dismiss-button",variant:"tertiary",onClick:s,"aria-label":p.dismiss})]})]}),l&&e("p",{className:"dropin-in-line-alert__description",children:l}),e("div",{className:"dropin-in-line-alert__item-list-container",children:_&&e(y,{node:_,className:o(["dropin-in-line-alert__item-list"])})}),t&&(m==="bottom"||!m&&t.length>1)&&e("div",{className:"dropin-in-line-alert__additional-actions-container",children:t.map(f=>e(V,{variant:"tertiary",className:"dropin-in-line-alert__additional-action",onClick:f.onClick,children:f.label},f.label))})]})},It=({size:a="small",title:r=null,centered:n=!1,backgroundDim:t=!0,clickToDismiss:s=!0,escapeToDismiss:i=!0,onClose:l,showCloseButton:d=!0,className:_,children:m=null,...h})=>{const p=C(()=>{l==null||l()},[l]),c=I({modalCloseLabel:"Dropin.Modal.Close.label"});return W(()=>{const u=b=>{const f=document.querySelector(".dropin-modal"),v=document.querySelector(".dropin-modal__body");s&&f&&v&&!v.contains(b.target)&&p()};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[p,s]),W(()=>{const u=b=>{b.key==="Escape"&&i&&p()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[p,i]),W(()=>{const u=document.scrollingElement,b=u.style.overflow;return u.style.overflow="hidden",()=>{u.style.overflow=b}},[]),e("div",{className:o(["dropin-modal",["dropin-modal--dim",t]]),children:e("div",{...h,className:o(["dropin-modal__body",[`dropin-modal__body--${a}`,a],_]),children:[e("div",{className:o(["dropin-modal__header",["dropin-modal__header-title",!!r]]),children:[r&&e("div",{className:o(["dropin-modal__header-title-content"]),children:r}),d&&e(V,{"aria-label":c.modalCloseLabel,variant:"tertiary",className:"dropin-modal__header-close-button",onClick:p,icon:e(j,{})})]}),e("div",{className:o(["dropin-modal__content",["dropin-modal__body--centered",n]]),children:m})]})})},Et=({className:a,children:r,ariaLabel:n,image:t,title:s,price:i,taxIncluded:l=!1,taxExcluded:d=!1,total:_,totalExcludingTax:m,sku:h,configurations:p,warning:c,alert:u,discount:b,savings:f,quantity:v,description:w,attributes:x,footer:E,loading:$=!1,updating:k=!1,quantityType:O,dropdownOptions:L,onQuantity:D,onRemove:S,...H})=>{var X,Y;const{locale:G}=ye(ce),P=I({each:"Dropin.CartItem.each.label",pricePerItem:"Dropin.CartItem.pricePerItem.label",quantity:"Dropin.CartItem.quantity.label",remove:"Dropin.CartItem.remove.label",removeDefault:"Dropin.CartItem.removeDefault.label",taxIncluded:"Dropin.CartItem.taxIncluded.label",taxExcluded:"Dropin.CartItem.taxExcluded.label",updating:"Dropin.CartItem.updating.label",updatingDefault:"Dropin.ProgressSpinner.updating.label"});if($)return e(je,{});const ue=O==="dropdown"?e(We,{className:o(["dropin-cart-item__quantity__picker"]),value:String(v),name:"quantity","aria-label":P.quantity,disabled:k,variant:"primary",options:L,handleSelect:F=>D==null?void 0:D(Number(F.target.value))}):e(Fe,{className:o(["dropin-cart-item__quantity__incrementer"]),value:v,min:1,onValue:F=>D==null?void 0:D(Number(F)),name:"quantity","aria-label":P.quantity,disabled:k});return e("div",{...H,className:o(["dropin-cart-item",["dropin-cart-item--updating",k],a]),children:[k&&e(Ke,{className:o(["dropin-cart-item__spinner"]),ariaLabel:n?(X=P.updating)==null?void 0:X.replace("{product}",n):P.updatingDefault}),e("div",{className:"dropin-cart-item__wrapper",children:[t&&e(y,{node:t,className:o(["dropin-cart-item__image"])}),s&&e(y,{node:s,className:o(["dropin-cart-item__title",["dropin-cart-item__title--edit",!!D||!!S]])}),w&&e(y,{node:w,className:o(["dropin-cart-item__description"])}),h&&e(y,{node:h,className:o(["dropin-cart-item__sku"])}),e("div",{className:o(["dropin-cart-item__savings__wrapper"]),children:[b&&e(y,{node:b,className:o(["dropin-cart-item__discount","dropin-cart-item__discount__large-screen"])}),f&&e(y,{node:f,className:o(["dropin-cart-item__savings","dropin-cart-item__savings__large-screen"])})]}),x&&e("div",{className:o(["dropin-cart-item__attributes"]),children:e(y,{node:x})}),p&&e("ul",{className:o(["dropin-cart-item__configurations"]),children:Object.entries(p).map(([F,he])=>e("li",{className:o(["dropin-cart-item__configurations__item"]),children:[F,":"," ",e("strong",{className:o(["dropin-cart-item__configurations__item__value"]),children:he})]},F))}),i&&e("span",{className:o(["dropin-cart-item__price"]),"aria-label":P.pricePerItem,children:[v&&!D&&e(R,{children:[e("span",{className:"dropin-cart-item__price__quantity","aria-hidden":!0,children:[v.toLocaleString(G)," x"," "]}),e("div",{className:"dropin-cart-item__sr-only",children:[P.quantity,": ",v==null?void 0:v.toLocaleString(G),";"]})]}),e(y,{node:i,role:"text"}),v&&v>1&&e(R,{children:[" ",P.each]}),l&&e("span",{"data-testid":"tax-message",className:"dropin-cart-item__price-tax-message",children:[" ",P.taxIncluded]}),d&&e("span",{"data-testid":"tax-message",className:"dropin-cart-item__price-tax-message",children:[" ",P.taxExcluded]})]}),e("div",{className:o(["dropin-cart-item__quantity",["dropin-cart-item__quantity--edit",!!D]]),children:[D?ue:v&&e("span",{className:o(["dropin-cart-item__quantity__value"]),children:[P.quantity,":"," ",e("strong",{className:"dropin-cart-item__quantity__number",children:Number(v).toLocaleString(G)})]}),c&&e(y,{node:c,className:o(["dropin-cart-item__warning","dropin-cart-item__warning--quantity"])}),u&&e(y,{node:u,className:o(["dropin-cart-item__alert","dropin-cart-item__alert--quantity"])})]}),c&&e(y,{node:c,className:o(["dropin-cart-item__warning"])}),u&&e(y,{node:u,className:o(["dropin-cart-item__alert"])}),e("div",{className:o(["dropin-cart-item__total",["dropin-cart-item__total--edit",!!S]]),children:[e("div",{className:"dropin-cart-item__row-total__wrapper",children:[_&&e("div",{className:"dropin-cart-item__row-total",children:e(y,{node:_,role:"text"})}),l&&e("div",{className:"dropin-cart-item__total-tax-included",children:e("span",{"data-testid":"tax-message",className:o(["dropin-cart-item__total-tax-message"]),children:P.taxIncluded})})]}),d&&e("div",{className:"dropin-cart-item__total-tax-excluded",children:e("span",{"data-testid":"tax-message",className:o(["dropin-cart-item__total-tax-excluded-message"]),children:[m&&e(y,{node:m,role:"text"})," ",P.taxExcluded]})}),b&&e(y,{node:b,className:o(["dropin-cart-item__discount"])}),f&&e(y,{node:f,className:o(["dropin-cart-item__savings"])})]}),E&&e("div",{className:o(["dropin-cart-item__footer"]),children:e(y,{node:E})})]}),S&&e(V,{"data-testid":"cart-item-remove-button",className:o(["dropin-cart-item__remove"]),variant:"tertiary",onClick:()=>S==null?void 0:S(),icon:e(T,{"data-testid":"cart-item-remove-icon",source:Le,size:"24",stroke:"2",viewBox:"0 0 24 24","aria-label":n?(Y=P.remove)==null?void 0:Y.replace("{product}",n):P.removeDefault}),disabled:k})]})},je=()=>e("div",{className:"dropin-cart-item dropin-cart-item-skeleton",children:e(Ce,{className:"dropin-cart-item__skeleton dropin-cart-item__wrapper",children:[e("div",{className:"dropin-cart-item__image",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__title",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__sku",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__price",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__quantity",children:e(q,{className:"dropin-cart-item__skeleton__item"})}),e("div",{className:"dropin-cart-item__total",children:e(q,{className:"dropin-cart-item__skeleton__item"})})]})}),$t=({className:a,children:r,...n})=>e("div",{...n,className:o(["dropin-cart-list",a]),children:e("div",{className:"dropin-cart-list__wrapper","aria-live":"assertive","aria-relevant":"all",children:se.map(r,(t,s)=>e("div",{className:"dropin-cart-list__item",children:t},s))})}),St=({className:a,children:r,locale:n,currency:t,amount:s,variant:i="default",minimumAmount:l,maximumAmount:d,size:_="small",display:m="dash",specialPrice:h,sale:p=!1,...c})=>{const u=M(()=>s||l===d||l&&!d||d&&!l,[s,d,l]);return e("div",{children:u?e("div",{...c,className:o(["dropin-price-range",a]),children:e(A,{amount:s??l??d,currency:t,locale:n,size:_,variant:i,sale:p})}):e("div",{...c,className:o(["dropin-price-range",a]),children:[m==="dash"?e(ze,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null,m==="from to"?e(Ze,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null,m==="as low as"?e(Je,{specialPrice:h,minimumAmount:l,maximumAmount:d,currency:t,locale:n,size:_,sale:p}):null]})})};function ze({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){return e(R,{children:[e(A,{amount:a??r,currency:t,locale:s,size:i,sale:!!a&&l}),e("span",{className:"dropin-price-range__separator",children:"-"}),e(A,{amount:n,currency:t,locale:s,size:i})]})}function Ze({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){const d=I({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return e(R,{children:[e("span",{className:o(["dropin-price-range__from",`dropin-price-range__from--${i}`]),children:d.from}),e(A,{amount:a??r,currency:t,locale:s,size:i,sale:!!a&&l}),e("span",{className:o(["dropin-price-range__to",`dropin-price-range__to--${i}`]),children:d.to}),e(A,{amount:n,currency:t,locale:s,size:i})]})}function Je({specialPrice:a,minimumAmount:r,maximumAmount:n,currency:t,locale:s,size:i,sale:l}){const d=I({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return e(R,{children:[e("span",{className:o(["dropin-price-range__as-low-as",`dropin-price-range__as-low-as--${i}`]),children:d.asLowAs}),a?e("div",{children:[e(A,{amount:n,currency:t,locale:s,size:i,variant:"strikethrough"}),e(A,{amount:a,currency:t,locale:s,size:i,className:"dropin-price-range__special",sale:!!a&&l})]}):e(A,{amount:r,currency:t,locale:s,size:i})]})}const Tt=({className:a,categories:r,separator:n,...t})=>e(R,{children:(r==null?void 0:r.length)>1&&e("nav",{role:"navigation",...t,className:o(["dropin-breadcrumbs__container",a]),children:e("ul",{className:"dropin-breadcrumbs__items",children:r==null?void 0:r.map((s,i)=>e("li",{className:o(["dropin-breadcrumbs__item",["dropin-breadcrumbs__item--last",i===r.length-1]]),children:[e(y,{node:s,className:"dropin-breadcrumbs__link"}),!n&&i!==r.length-1&&e("span",{className:"dropin-breadcrumbs__separator--default",children:[" ","/"," "]}),n&&i!==r.length-1&&e(y,{node:n,className:"dropin-breadcrumbs__separator--icon"})]},i))})})}),Lt=({className:a,variant:r,icon:n,message:t,onDismiss:s,action:i,...l})=>{const d=I({dismiss:"Dropin.InlineAlert.dismissLabel"});return e("div",{...l,className:o([a,"dropin-alert-banner",`dropin-alert-banner--${r}`]),children:[e("div",{className:"dropin-alert-banner__content",children:[n&&e(y,{node:n,"aria-hidden":"true",className:"dropin-alert-banner__icon"}),e(y,{node:t,className:o(["dropin-alert-banner__message"])})]}),e("div",{className:"dropin-alert-banner__actions",children:[i&&e(V,{variant:"tertiary",className:"dropin-alert-banner__action",onClick:i.onClick,"aria-label":i.label,children:i.label}),e(V,{icon:e(T,{source:j,size:"24",stroke:"2"}),className:"dropin-alert-banner__dismiss-button",variant:"primary",onClick:s,"aria-label":d.dismiss})]})]})},Pt=({className:a,icon:r,heading:n,headingLevel:t=2,message:s,action:i,variant:l="secondary",...d})=>{const _=t>=1&&t<=6?`h${t}`:"h2";return e("div",{...d,className:o(["dropin-illustrated-message",a]),children:e(Ge,{variant:l,children:[r&&e(y,{node:r,"aria-hidden":"true",size:"80",className:"dropin-illustrated-message__icon"}),n&&e(_,{className:"dropin-illustrated-message__heading",children:n}),s&&e(y,{node:s,className:"dropin-illustrated-message__message"}),i&&e(y,{node:i,className:"dropin-illustrated-message__action"})]})})},Ot=({className:a,label:r,name:n,value:t,selected:s=!0,onChange:i,icon:l,busy:d=!1,children:_,...m})=>e("div",{...m,className:o(["dropin-toggle-button",a,["dropin-toggle-button__selected",s]]),children:e("label",{className:"dropin-toggle-button__actionButton",children:[e(He,{label:"",name:n,value:t,checked:s,onChange:()=>i&&i(t),"aria-label":r,busy:d,className:o([a,"dropin-toggle-button__radioButton"])}),e("span",{className:"dropin-toggle-button__content",children:[l&&e(l.type,{...l==null?void 0:l.props,className:"dropin-toggle-button__icon"}),r]})]})}),Ct=({title:a=null,size:r="medium",cta:n,divider:t=!0,className:s,...i})=>a?e("div",{...i,className:o(["dropin-header-container",s]),"data-testid":"dropin-header-container",children:[e("span",{className:o(["dropin-header-container__title",["dropin-header-container__title--medium",r==="medium"],["dropin-header-container__title--large",r==="large"]]),children:a}),n?e(y,{node:n,className:"dropin-header-container__actions"}):null,t?e(_e,{className:o(["dropin-header-container__divider",["dropin-header-container__divider--medium",r==="medium"],["dropin-header-container__divider--large",r==="large"]])}):null]}):null,At=({label:a,className:r,...n})=>a?e("div",{...n,className:o(["dropin-tag-container",r]),"data-testid":"dropin-tag-container",children:e("span",{className:"dropin-tag-container__label",children:a})}):null,Vt=({className:a,children:r,maxColumns:n,emptyGridContent:t,...s})=>{const i=!!r&&(Array.isArray(r)?r.length>0:!0),l=i?{gridTemplateColumns:`repeat(${n}, 1fr)`}:void 0;return e("div",{...s,className:o(["dropin-content-grid",a]),tabindex:0,children:e("div",{"data-testid":"content-grid-content",className:o(["dropin-content-grid__content",["dropin-content-grid__dynamic-columns-content",!n],["dropin-content-grid__content--empty",!i]]),style:l,children:i?r:t})})},Rt=({totalPages:a=10,currentPage:r=1,onChange:n,className:t,...s})=>{const i=I({backwardButton:"Dropin.Pagination.backwardButton.ariaLabel",forwardButton:"Dropin.Pagination.forwardButton.ariaLabel"}),l=C(()=>{const p=Math.min(r+1,a);n==null||n(p)},[r,n,a]),d=C(()=>{const p=Math.max(r-1,1);n==null||n(p)},[r,n]),_=C(p=>{ve(p)&&(n==null||n(p))},[n]),m=C((p,c)=>{let u=[];const b=(f,v)=>{for(let w=f;w<=v;w++)u.push({page:w,isActive:w===p,label:w})};return c<=5?b(1,c):p<=2?(b(1,2),u.push({page:"ellipsis",isActive:!1,label:"..."}),b(c-1,c)):p>=c-3?b(c-4,c):(b(p-1,p),u.push({page:"ellipsis",isActive:!1,label:"..."}),b(c-1,c)),u},[]),h=M(()=>m(r,a),[m,r,a]);return e("div",{...s,className:o(["dropin-pagination",t]),children:[e("button",{type:"button","data-testid":"prev-button","aria-label":i.backwardButton,disabled:r===1,onClick:d,className:o(["dropin-pagination-arrow","dropin-pagination-arrow--backward"]),children:e(T,{size:"24",source:J})}),e("ul",{className:"dropin-pagination_list",children:h.map((p,c)=>e("li",{"data-testid":`dropin-pagination_list-item--${p.page}`,className:o(["dropin-pagination_list-item",`dropin-pagination_list-item--${p.page}`,["dropin-pagination_list-item--active",p.isActive]]),children:e("button",{type:"button","data-testid":`set-page-button-${p.page}`,onClick:()=>_(p.page),children:p.label})},`${p.page}_${c}`))}),e("button",{type:"button","data-testid":"next-button","aria-label":i.forwardButton,disabled:r===a,onClick:l,className:o(["dropin-pagination-arrow","dropin-pagination-arrow--forward"]),children:e(T,{size:"24",source:J})})]})};export{xt as Accordion,Ue as AccordionSection,vt as ActionButton,gt as ActionButtonGroup,Lt as AlertBanner,Tt as Breadcrumbs,V as Button,Ge as Card,Et as CartItem,je as CartItemSkeleton,$t as CartList,Nt as Checkbox,wt as ColorSwatch,Vt as ContentGrid,_e as Divider,me as Field,Ct as Header,T as Icon,Pt as IllustratedMessage,Me as Image,yt as ImageSwatch,Dt as InLineAlert,Fe as Incrementer,pe as Input,ht as InputDate,bt as InputPassword,It as Modal,Rt as Pagination,We as Picker,A as Price,St as PriceRange,Ke as ProgressSpinner,He as RadioButton,Ce as Skeleton,q as SkeletonRow,At as Tag,ft as TextArea,kt as TextSwatch,Ot as ToggleButton,ce as UIContext,Ae as UIProvider,ut as provider}; diff --git a/scripts/__dropins__/tools/event-bus.js b/scripts/__dropins__/tools/event-bus.js index 33589dad62..d5933661f4 100644 --- a/scripts/__dropins__/tools/event-bus.js +++ b/scripts/__dropins__/tools/event-bus.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -var a=Object.defineProperty;var d=(n,e,t)=>e in n?a(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var r=(n,e,t)=>d(n,typeof e!="symbol"?e+"":e,t);const f=Date.now().toString(36).substring(2);class l{static on(e,t,i){if(typeof BroadcastChannel>"u")return;const o=new BroadcastChannel("ElsieSDK/EventBus");if(i!=null&&i.eager){const s=this._lastEvent[e];s&&t(s.payload)}return o.addEventListener("message",({data:s})=>{this._identifier&&this._identifier!==s.identifier||s.event===e&&t(s.payload)}),window.addEventListener("beforeunload",()=>{o.close()}),{off(){o.close()}}}static emit(e,t){if(typeof BroadcastChannel>"u")return;const i=new BroadcastChannel("ElsieSDK/EventBus");i.postMessage({event:e,identifier:this._identifier,payload:t}),this._lastEvent[e]={payload:t},i.close()}static enableLogger(e){var t;typeof BroadcastChannel>"u"||((t=this._logger)==null||t.close(),this._logger=null,e!==!1&&(this._logger=new BroadcastChannel("ElsieSDK/EventBus"),this._logger.addEventListener("message",({data:i})=>{this._identifier&&this._identifier!==i.identifier||(console.group(`📡 Event (${i.identifier}) ➡ ${i.event}`),console.log(i.payload),console.groupEnd())}),window.addEventListener("beforeunload",()=>{var i;(i=this._logger)==null||i.close()})))}}r(l,"_identifier",f),r(l,"_logger",null),r(l,"_lastEvent",{});export{l as events}; +var o=Object.defineProperty;var f=(n,e,i)=>e in n?o(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var r=(n,e,i)=>f(n,typeof e!="symbol"?e+"":e,i);const c=Date.now().toString(36).substring(2);class l{static on(e,i,t){if(typeof BroadcastChannel>"u")return;const a=new BroadcastChannel("ElsieSDK/EventBus");if(t!=null&&t.eager){const s=this._lastEvent[e];s&&i(s.payload)}return a.addEventListener("message",({data:s})=>{this._identifier&&this._identifier!==s.identifier||s.event===e&&i(s.payload)}),{off(){a.close()}}}static emit(e,i){if(typeof BroadcastChannel>"u")return;const t=new BroadcastChannel("ElsieSDK/EventBus");t.postMessage({event:e,identifier:this._identifier,payload:i}),this._lastEvent[e]={payload:i},t.close()}static enableLogger(e){var i;typeof BroadcastChannel>"u"||((i=this._logger)==null||i.close(),this._logger=null,e!==!1&&(this._logger=new BroadcastChannel("ElsieSDK/EventBus"),this._logger.addEventListener("message",({data:t})=>{this._identifier&&this._identifier!==t.identifier||(console.group(`📡 Event (${t.identifier}) ➡ ${t.event}`),console.log(t.payload),console.groupEnd())})))}}r(l,"_identifier",c),r(l,"_logger",null),r(l,"_lastEvent",{});export{l as events}; From 1b9957c27da7c6b9ddd7e60f0ab6c334aa07288d Mon Sep 17 00:00:00 2001 From: OscarMerino Date: Tue, 19 Nov 2024 11:17:15 +0100 Subject: [PATCH 2/2] Checkout drop in version to 0.1.0-alpha57 (#206) --- .../commerce-checkout/commerce-checkout.css | 288 +++++++++--------- blocks/commerce-checkout/commerce-checkout.js | 42 +-- blocks/modal/modal.css | 74 +++-- blocks/modal/modal.js | 36 +-- build.mjs | 4 + package-lock.json | 8 +- package.json | 2 +- .../__dropins__/storefront-checkout/api.js | 8 +- .../storefront-checkout/api/fragments.d.ts | 2 + .../setGuestEmailOnCart.d.ts | 30 +- .../chunks/fetch-graphql.js | 4 +- .../chunks/isEmailAvailable.js | 2 +- .../storefront-checkout/chunks/placeOrder2.js | 252 +-------------- .../chunks/setBillingAddress.js | 6 +- .../chunks/setGuestEmailOnCart.js | 6 +- .../chunks/setPaymentMethod.js | 6 +- .../chunks/setShippingMethods.js | 6 +- .../chunks/store-config.js | 2 +- .../chunks/synchronizeCheckout.js | 12 +- .../chunks/withConditionalRendering.js | 2 +- .../containers/BillToShippingAddress.js | 2 +- .../containers/EstimateShipping.js | 2 +- .../containers/LoginForm.js | 2 +- .../containers/MergedCartBanner.js | 2 +- .../MergedCartBanner/MergedCartBanner.d.ts | 6 +- .../containers/MergedCartBanner/index.d.ts | 30 +- .../containers/OrderConfirmationHeader.js | 2 +- .../containers/OutOfStock.js | 2 +- .../containers/PaymentMethods.js | 2 +- .../containers/PlaceOrder.js | 2 +- .../containers/ShippingMethods.js | 2 +- .../storefront-checkout/fragments.js | 252 ++++++++++++++- .../__dropins__/storefront-checkout/render.js | 9 +- 33 files changed, 574 insertions(+), 533 deletions(-) diff --git a/blocks/commerce-checkout/commerce-checkout.css b/blocks/commerce-checkout/commerce-checkout.css index 93f108bc8b..65e2001f95 100644 --- a/blocks/commerce-checkout/commerce-checkout.css +++ b/blocks/commerce-checkout/commerce-checkout.css @@ -1,40 +1,39 @@ /* stylelint-disable selector-class-pattern */ - .checkout__content { - display: grid; - grid-template-columns: 1fr; - gap: var(--spacing-big) 0; + display: grid; + grid-template-columns: 1fr; + gap: var(--spacing-big) 0; } .checkout__main { - display: grid; - row-gap: var(--spacing-xbig); - margin-top: var(--spacing-medium); + display: grid; + row-gap: var(--spacing-xbig); + margin-top: var(--spacing-medium); } .checkout__aside { - display: grid; - gap: var(--spacing-xbig); + display: grid; + gap: var(--spacing-xbig); } /* Block dividers */ .checkout__block.checkout__heading .dropin-header-container { - gap: var(--spacing-xsmall); + gap: var(--spacing-xsmall); } .checkout__shipping-form { - padding-top: var(--spacing-xbig); - border-top: var(--shape-border-width-3) solid var(--color-neutral-400); + padding-top: var(--spacing-xbig); + border-top: var(--shape-border-width-3) solid var(--color-neutral-400); } .checkout__payment-methods { - padding-top: var(--spacing-xbig); - border-top: var(--shape-border-width-3) solid var(--color-neutral-400); + padding-top: var(--spacing-xbig); + border-top: var(--shape-border-width-3) solid var(--color-neutral-400); } /* Hide empty blocks */ .checkout__block:empty { - display: none; + display: none; } /* Hide blocks with empty divs */ @@ -42,7 +41,7 @@ .checkout__out-of-stock:has(> :empty), .checkout__delivery:has(> :empty), .checkout__bill-to-shipping:has(> :empty) { - display: none; + display: none; } /* Hide main containers when the cart is empty or there is a server error */ @@ -61,13 +60,13 @@ .checkout__content--empty .checkout__delivery, .checkout__content--empty .checkout__payment-methods, .checkout__content--empty .checkout__billing-form { - display: none !important; + display: none !important; } /* Hide aside containers when the cart is empty or there is a server error */ .checkout__content--error .checkout__aside, .checkout__content--empty .checkout__aside { - display: none; + display: none; } /* Integrate place order button into Order Summary - mobile */ @@ -80,105 +79,105 @@ /* Hide the place order button when the cart is empty or there is a server error */ .checkout__content--error .checkout__place-order, .checkout__content--empty .checkout__place-order { - display: none; + display: none; } .checkout__loader { - align-items: center; - background: var(--color-neutral-50); - display: flex; - height: 100vh; - justify-content: center; - left: 0; - opacity: 0.5; - position: fixed; - top: 0; - width: 100%; - z-index: 9999; + align-items: center; + background: var(--color-neutral-50); + display: flex; + height: 100vh; + justify-content: center; + left: 0; + opacity: 0.5; + position: fixed; + top: 0; + width: 100%; + z-index: 9999; } .checkout__loader:empty { - display: none; + display: none; } .checkout__error-banner, .checkout__merged-cart-banner { - grid-column: 1; + grid-column: 1; } /* remove margin from the heading divider */ .checkout__heading .dropin-divider { - margin: 0; + margin: 0; } /* Cart Summary */ .checkout__block .cart-cart-summary-list { - padding: var(--spacing-medium); + padding: var(--spacing-medium); } /* Order Summary Coupon */ .dropin-accordion-section__heading { - margin: var(--spacing-medium) auto; + margin: var(--spacing-medium) auto; } .cart-coupons__accordion { - margin-top: var(--spacing-xsmall); + margin-top: var(--spacing-xsmall); } /* temporary fix to hide the default cart heading */ [data-testid='default-cart-heading'] { - display: none; + display: none; } .cart-summary-list__heading { - display: flex; - justify-content: space-between; + display: flex; + justify-content: space-between; } .cart-summary-list__heading-text { - font: var(--type-headline-2-strong-font); - letter-spacing: var(--type-headline-2-strong-letter-spacing); - color: var(--color-neutral-800); + font: var(--type-headline-2-strong-font); + letter-spacing: var(--type-headline-2-strong-letter-spacing); + color: var(--color-neutral-800); } .cart-cart-summary-list__heading { - row-gap: var(--spacing-small); - padding-top: 0; + row-gap: var(--spacing-small); + padding-top: 0; } .cart-cart-summary-list__heading-text { - font: var(--type-headline-2-strong-font); - letter-spacing: var(--type-headline-2-strong-letter-spacing); - color: var(--color-neutral-800); + font: var(--type-headline-2-strong-font); + letter-spacing: var(--type-headline-2-strong-letter-spacing); + color: var(--color-neutral-800); } .cart-summary-list__edit { - font: var(--type-body-2-strong-font); - letter-spacing: var(--type-body-2-strong-letter-spacing); + font: var(--type-body-2-strong-font); + letter-spacing: var(--type-body-2-strong-letter-spacing); } .checkout__block - .cart-cart-summary-list - .cart-cart-summary-list__footer-divider { - margin: var(--spacing-small) 0; +.cart-cart-summary-list +.cart-cart-summary-list__footer-divider { + margin: var(--spacing-small) 0; } /* Sign-in modal */ #modal { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgb(0 0 0 / 50%); - display: flex; - justify-content: center; - align-items: center; - z-index: 2; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgb(0 0 0 / 50%); + display: flex; + justify-content: center; + align-items: center; + z-index: 2; } #modal-form { - width: 800px; + width: 800px; } /* Address form */ @@ -186,128 +185,127 @@ .checkout__shipping-form .dropin-header-container__title, .checkout__billing-form .account-address-form-wrapper__title, .checkout__billing-form .dropin-header-container__title { - font: var(--type-headline-2-default-font); - letter-spacing: var(--type-headline-2-default-letter-spacing); - color: var(--color-neutral-800); - margin: 0 0 var(--spacing-medium) 0; + font: var(--type-headline-2-default-font); + letter-spacing: var(--type-headline-2-default-letter-spacing); + color: var(--color-neutral-800); + margin: 0 0 var(--spacing-medium) 0; } .checkout__shipping-form .dropin-header-container .dropin-divider, .checkout__billing-form .dropin-header-container .dropin-divider { - display: none; + display: none; } /* Order confirmation */ .order-confirmation { - display: grid; - align-items: start; - grid-template-columns: repeat(var(--grid-4-columns), 1fr); - grid-template-areas: 'main aside'; - grid-column-gap: var(--grid-4-gutters); - margin-bottom: var(--spacing-xbig); - padding-top: var(--spacing-xxlarge); + display: grid; + align-items: start; + grid-template-columns: repeat(var(--grid-4-columns), 1fr); + grid-template-areas: 'main aside'; + grid-column-gap: var(--grid-4-gutters); + margin-bottom: var(--spacing-xbig); + padding-top: var(--spacing-xxlarge); } .order-confirmation__main { - display: grid; - grid-row-gap: var(--spacing-xbig); - grid-column: 1 / span 7; + display: grid; + grid-row-gap: var(--spacing-xbig); + grid-column: 1 / span 7; } .order-confirmation__aside { - display: grid; - grid-row-gap: var(--spacing-xbig); - grid-column: 9 / span 4; + display: grid; + grid-row-gap: var(--spacing-xbig); + grid-column: 9 / span 4; } .order-confirmation__footer { - display: grid; - gap: var(--spacing-small); - text-align: center; + display: grid; + gap: var(--spacing-small); + text-align: center; } .order-confirmation__footer p { - margin: 0; + margin: 0; } .order-confirmation__footer .order-confirmation-footer__continue-button { - margin: 0 auto; - text-align: center; - display: inline-block; + margin: 0 auto; + text-align: center; + display: inline-block; } .order-confirmation-footer__contact-support { - font: var(--type-body-2-default-font); - letter-spacing: var(--type-body-2-default-letter-spacing); - color: var(--color-neutral-700); + font: var(--type-body-2-default-font); + letter-spacing: var(--type-body-2-default-letter-spacing); + color: var(--color-neutral-700); } .order-confirmation-footer__contact-support a { - font: var(--type-body-2-strong-font); - letter-spacing: var(--type-body-2-strong-letter-spacing); - color: var(--color-brand-500); - cursor: pointer; + font: var(--type-body-2-strong-font); + letter-spacing: var(--type-body-2-strong-letter-spacing); + color: var(--color-brand-500); + cursor: pointer; } /* Hide empty blocks */ .order-confirmation__block:empty { - display: none; + display: none; } @media only screen and (width >= 320px) and (width <= 768px) { - .order-confirmation { - grid-template-columns: repeat(var(--grid-1-columns), 1fr); - padding-top: 0; - } + .order-confirmation { + grid-template-columns: repeat(var(--grid-1-columns), 1fr); + padding-top: 0; + } - .order-confirmation__main, - .order-confirmation__aside { - grid-row-gap: var(--spacing-medium); - } + .order-confirmation__main, + .order-confirmation__aside { + grid-row-gap: var(--spacing-medium); + } - .order-confirmation > div { - grid-column: 1 / span 4; - } + .order-confirmation > div { + grid-column: 1 / span 4; + } - .order-confirmation__block .dropin-card { - border: 0; - } + .order-confirmation__block .dropin-card { + border: 0; + } } @media only screen and (width >= 768px) { - .checkout__content { - display: grid; - align-items: start; - grid-template-columns: repeat(var(--grid-4-columns), 1fr); - gap: var(--spacing-big) var(--grid-4-gutters); - } - - .checkout__content--error, - .checkout__content--empty { - display: grid; - grid-template-columns: 1fr; - } - - .checkout__main { - grid-column: 1 / span 7; - row-gap: var(--spacing-xbig); - } - - .checkout__aside { - grid-column: 9 / span 4; - gap: var(--spacing-xbig); - } - - .checkout__error-banner, - .checkout__merged-cart-banner { - display: grid; - grid-column: 1 / span 12; - } - - .checkout__place-order { - display: grid; - grid-column: 1 / span 12; - justify-items: center; - margin-top: 0; - } + .checkout__content { + display: grid; + align-items: start; + grid-template-columns: repeat(var(--grid-4-columns), 1fr); + gap: var(--spacing-big) var(--grid-4-gutters); + } + + .checkout__content--error, + .checkout__content--empty { + display: grid; + grid-template-columns: 1fr; + } + + .checkout__main { + grid-column: 1 / span 7; + row-gap: var(--spacing-xbig); + } + + .checkout__aside { + grid-column: 9 / span 4; + gap: var(--spacing-xbig); + } + + .checkout__error-banner, + .checkout__merged-cart-banner { + display: grid; + grid-column: 1 / span 12; + } + + .checkout__place-order { + display: grid; + grid-column: 1 / span 7; + margin-top: 0; + } } diff --git a/blocks/commerce-checkout/commerce-checkout.js b/blocks/commerce-checkout/commerce-checkout.js index f68469ae8e..fdad61cc5f 100644 --- a/blocks/commerce-checkout/commerce-checkout.js +++ b/blocks/commerce-checkout/commerce-checkout.js @@ -32,15 +32,16 @@ import { render as AccountProvider } from '@dropins/storefront-account/render.js import * as cartApi from '@dropins/storefront-cart/api.js'; import CartSummaryList from '@dropins/storefront-cart/containers/CartSummaryList.js'; import EmptyCart from '@dropins/storefront-cart/containers/EmptyCart.js'; -import { OrderSummary } from '@dropins/storefront-cart/containers/OrderSummary.js'; -import { render as CartProvider } from '@dropins/storefront-cart/render.js'; +import OrderSummary from '@dropins/storefront-cart/containers/OrderSummary.js'; import Coupons from '@dropins/storefront-cart/containers/Coupons.js'; +import { render as CartProvider } from '@dropins/storefront-cart/render.js'; // Checkout Dropin import * as checkoutApi from '@dropins/storefront-checkout/api.js'; import BillToShippingAddress from '@dropins/storefront-checkout/containers/BillToShippingAddress.js'; import EstimateShipping from '@dropins/storefront-checkout/containers/EstimateShipping.js'; import LoginForm from '@dropins/storefront-checkout/containers/LoginForm.js'; +import MergedCartBanner from '@dropins/storefront-checkout/containers/MergedCartBanner.js'; import OrderConfirmationHeader from '@dropins/storefront-checkout/containers/OrderConfirmationHeader.js'; import OutOfStock from '@dropins/storefront-checkout/containers/OutOfStock.js'; import PaymentMethods from '@dropins/storefront-checkout/containers/PaymentMethods.js'; @@ -69,13 +70,11 @@ import { setAddressOnCart, } from '../../scripts/checkout.js'; -// Initializers -import '../../scripts/initializers/account.js'; -import '../../scripts/initializers/auth.js'; -import '../../scripts/initializers/cart.js'; -import '../../scripts/initializers/checkout.js'; - export default async function decorate(block) { + // Initializers + import('../../scripts/initializers/account.js'); + import('../../scripts/initializers/checkout.js'); + const DEBOUNCE_TIME = 1000; const LOGIN_FORM_NAME = 'login-form'; const SHIPPING_FORM_NAME = 'selectedShippingAddress'; @@ -90,6 +89,7 @@ export default async function decorate(block) { const checkoutFragment = document.createRange().createContextualFragment(`
+
@@ -104,16 +104,20 @@ export default async function decorate(block) {
-
-
+
+
-
+
`); const $content = checkoutFragment.querySelector('.checkout__content'); const $loader = checkoutFragment.querySelector('.checkout__loader'); + const $mergedCartBanner = checkoutFragment.querySelector( + '.checkout__merged-cart-banner', + ); + const $heading = checkoutFragment.querySelector('.checkout__heading'); const $emptyCart = checkoutFragment.querySelector('.checkout__empty-cart'); const $serverError = checkoutFragment.querySelector( @@ -178,6 +182,7 @@ export default async function decorate(block) { }; const [ + _mergedCartBanner, _heading, _serverError, _outOfStock, @@ -191,6 +196,8 @@ export default async function decorate(block) { _cartSummary, _placeOrder, ] = await Promise.all([ + CheckoutProvider.render(MergedCartBanner)($mergedCartBanner), + UI.render(Header, { title: 'Checkout', size: 'large', @@ -246,12 +253,11 @@ export default async function decorate(block) { hideOnVirtualCart: true, onChange: (checked) => { $billingForm.style.display = checked ? 'none' : 'block'; - - if (!checked && billingFormRef.current) { - const isDataValid = billingFormRef.current.handleValidationSubmit(); + if (!checked && billingFormRef?.current) { + const { formData, isDataValid } = billingFormRef.current; setAddressOnCart( - { data: billingFormRef.current.formData, isDataValid }, + { data: formData, isDataValid }, checkoutApi.setBillingAddress, ); } @@ -364,7 +370,7 @@ export default async function decorate(block) { return success; }, onPlaceOrder: async () => { - displayOverlaySpinner(); + await displayOverlaySpinner(); try { await checkoutApi.placeOrder(); @@ -372,7 +378,7 @@ export default async function decorate(block) { console.error(error); throw error; } finally { - removeOverlaySpinner(); + await removeOverlaySpinner(); } }, })($placeOrder), @@ -777,7 +783,7 @@ export default async function decorate(block) { if (data.isGuest) { await displayGuestAddressForms(data); } else { - removeOverlaySpinner(); + await removeOverlaySpinner(); await displayCustomerAddressForms(data); } }; diff --git a/blocks/modal/modal.css b/blocks/modal/modal.css index ca4efc3c4e..b1f5deec1f 100644 --- a/blocks/modal/modal.css +++ b/blocks/modal/modal.css @@ -3,11 +3,10 @@ body.modal-open { } .modal dialog { - --dialog-border-radius: 16px; - - padding: 0; + --dialog-border-radius: var(--shape-border-radius-2); + overscroll-behavior: none; - border: 1px solid #ccc; + border: var(--shape-border-width-1) solid var(--color-neutral-400); border-radius: var(--dialog-border-radius); width: 100vw; } @@ -18,17 +17,6 @@ body.modal-open { max-height: calc(100dvh - 60px); } -@media (width >= 600px) { - .modal dialog { - width: 80vw; - max-width: 730px; - } - - .modal dialog .modal-content { - max-height: calc(100vh - 90px); - } -} - .modal dialog::backdrop { background-color: rgb(0 0 0 / 50%); } @@ -37,17 +25,57 @@ body.modal-open { position: absolute; top: 0; right: 0; - width: 20px; - height: 100%; - max-height: 54px; - border-radius: 0 var(--dialog-border-radius) 0 0; - background-color: unset; - text-overflow: clip; + width: 48px; + height: 48px; margin: 0; border: none; - padding-right: 30px; + border-radius: 0; + padding: 0; + background-color: transparent; + color: var(--color-brand-600); + line-height: 0; +} + +.modal .close-button .icon.icon-close { + content: ''; + width: 24px; + height: 24px; +} + +.modal .close-button .icon.icon-close::before, +.modal .close-button .icon.icon-close::after { + content: ''; + box-sizing: border-box; + display: block; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) rotate(45deg); + width: 24px; + height: 2px; + border-radius: var(--shape-border-radius-1); + background-color: currentcolor; +} + +.modal .close-button .icon.icon-close::after { + transform: translate(-50%, -50%) rotate(-45deg) +} + +.modal .close-button span { + cursor: pointer; } .modal dialog .section { padding: 0; -} \ No newline at end of file +} + +@media (width >= 600px) { + .modal dialog { + width: 80vw; + max-width: 700px; + } + + .modal dialog .modal-content { + max-height: calc(100vh - 90px); + } +} diff --git a/blocks/modal/modal.js b/blocks/modal/modal.js index 15a1bba5c4..2941ac27b2 100644 --- a/blocks/modal/modal.js +++ b/blocks/modal/modal.js @@ -1,26 +1,11 @@ -/** ****************************************************************** - * ADOBE CONFIDENTIAL - * __________________ - * - * Copyright 2024 Adobe - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - ****************************************************************** */ - import { loadCSS, buildBlock } from '../../scripts/aem.js'; -// eslint-disable-next-line import/prefer-default-export export default async function createModal(contentNodes) { await loadCSS('./blocks/modal/modal.css'); const dialog = document.createElement('dialog'); + dialog.setAttribute('tabindex', 1); + dialog.setAttribute('role', 'dialog'); + const dialogContent = document.createElement('div'); dialogContent.classList.add('modal-content'); dialogContent.append(...contentNodes); @@ -29,6 +14,7 @@ export default async function createModal(contentNodes) { const closeButton = document.createElement('button'); closeButton.classList.add('close-button'); closeButton.setAttribute('aria-label', 'Close'); + closeButton.setAttribute('data-dismiss', 'modal'); closeButton.type = 'button'; closeButton.innerHTML = ''; closeButton.addEventListener('click', () => dialog.close()); @@ -36,6 +22,8 @@ export default async function createModal(contentNodes) { // close dialog on clicks outside the dialog. https://stackoverflow.com/a/70593278/79461 dialog.addEventListener('click', (event) => { + if (event.pointerType !== 'mouse') return; + const dialogDimensions = dialog.getBoundingClientRect(); if ( event.clientX < dialogDimensions.left @@ -56,6 +44,7 @@ export default async function createModal(contentNodes) { }); block.append(dialog); + return { block, removeModal: () => dialog.close(), @@ -67,6 +56,17 @@ export default async function createModal(contentNodes) { dialogContent.scrollTop = 0; }, 0); + // Focus the first input when content is fully loaded using MutationObserver. + const observer = new MutationObserver(() => { + const firstInput = dialogContent.querySelector('input'); + if (firstInput) { + firstInput.focus(); + observer.disconnect(); + } + }); + + observer.observe(dialogContent, { childList: true, subtree: true }); + document.body.classList.add('modal-open'); }, }; diff --git a/build.mjs b/build.mjs index d4ffa80fc6..fca97b1fd9 100644 --- a/build.mjs +++ b/build.mjs @@ -6,4 +6,8 @@ overrideGQLOperations([ npm: '@dropins/storefront-cart', operations: [], }, + { + npm: '@dropins/storefront-checkout', + operations: [], + }, ]); diff --git a/package-lock.json b/package-lock.json index 06e54060b3..633d12d0c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@dropins/storefront-account": "0.1.0-alpha20", "@dropins/storefront-auth": "0.0.1-alpha25", "@dropins/storefront-cart": "0.10.0", - "@dropins/storefront-checkout": "0.1.0-alpha53", + "@dropins/storefront-checkout": "0.1.0-alpha57", "@dropins/storefront-order": "0.1.0-alpha21", "@dropins/storefront-pdp": "0.4.0", "@dropins/tools": "^0.36.0" @@ -811,9 +811,9 @@ "integrity": "sha512-1xbwAGHndT2zEJoCpANkTcq7gQP1QF97BEMMJ7fk0VFrpam1ZDVg9b96w2Z4BELQOz6wRBcnKWxnHcnd4ZNeGA==" }, "node_modules/@dropins/storefront-checkout": { - "version": "0.1.0-alpha53", - "resolved": "https://registry.npmjs.org/@dropins/storefront-checkout/-/storefront-checkout-0.1.0-alpha53.tgz", - "integrity": "sha512-Pni2JFmQ2O3efhV1nfoqjNxPJdGRf4exwgTSEZ8CE0XnYwdICW14GMyCRse6mjLdetldTe0FNbSxWXpqp/edCg==" + "version": "0.1.0-alpha57", + "resolved": "https://registry.npmjs.org/@dropins/storefront-checkout/-/storefront-checkout-0.1.0-alpha57.tgz", + "integrity": "sha512-dDgNDYxBsDZuy4WNc62QAmMtccEf3Px0+6DeR1TFUEHOxmbl43PC7aZAuUyDPa6nZGX4OkmNyb/3yJqMvnnJBQ==" }, "node_modules/@dropins/storefront-order": { "version": "0.1.0-alpha21", diff --git a/package.json b/package.json index 4a83fdf84e..da9084c32a 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@dropins/storefront-account": "0.1.0-alpha20", "@dropins/storefront-auth": "0.0.1-alpha25", "@dropins/storefront-cart": "0.10.0", - "@dropins/storefront-checkout": "0.1.0-alpha53", + "@dropins/storefront-checkout": "0.1.0-alpha57", "@dropins/storefront-order": "0.1.0-alpha21", "@dropins/storefront-pdp": "0.4.0", "@dropins/tools": "^0.36.0" diff --git a/scripts/__dropins__/storefront-checkout/api.js b/scripts/__dropins__/storefront-checkout/api.js index dfd9a2f649..b33f821c9f 100644 --- a/scripts/__dropins__/storefront-checkout/api.js +++ b/scripts/__dropins__/storefront-checkout/api.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{b as _,a as f,t as g}from"./chunks/synchronizeCheckout.js";import{c as N,e as Q,g as R,d as q,i as K,f as P,r as j,s as L}from"./chunks/synchronizeCheckout.js";import{M as m,c as C,d as o,e as S}from"./chunks/fetch-graphql.js";import{D as J,F as V,I as W,b as X,f as Z,a as tt,S as st,U as et,i as it,j as rt,k as at,r as nt,s as ot,g as pt,h as dt}from"./chunks/fetch-graphql.js";import{s as l,a as A,i as y}from"./chunks/store-config.js";import"./chunks/ServerErrorSignal.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{i as ht}from"./chunks/isEmailAvailable.js";import{p as mt}from"./chunks/placeOrder2.js";import{a as M}from"./chunks/setBillingAddress.js";import{s as ut}from"./chunks/setBillingAddress.js";import{s as ft}from"./chunks/setGuestEmailOnCart.js";import{s as St}from"./chunks/setPaymentMethod.js";import{CHECKOUT_DATA_FRAGMENT as I}from"./fragments.js";import{s as yt}from"./chunks/setShippingMethods.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";const T=` +import{t as _,a as A,b as g}from"./chunks/synchronizeCheckout.js";import{d as Q,c as R,g as q,e as K,i as P,f as j,r as L,s as Y}from"./chunks/synchronizeCheckout.js";import{s as m,M as u,a as C,d as p,b as S}from"./chunks/fetch-graphql.js";import{D as V,F as W,I as X,f as Z,c as tt,e as st,S as et,U as it,j as at,k as rt,l as nt,r as ot,g as pt,h as dt,i as ct}from"./chunks/fetch-graphql.js";import{a as y,i as M}from"./chunks/store-config.js";import"./chunks/ServerErrorSignal.js";import"@dropins/tools/lib.js";import{events as l}from"@dropins/tools/event-bus.js";import{i as gt}from"./chunks/isEmailAvailable.js";import{p as mt}from"./chunks/placeOrder2.js";import{a as I}from"./chunks/setBillingAddress.js";import{s as ft}from"./chunks/setBillingAddress.js";import{s as At}from"./chunks/setGuestEmailOnCart.js";import{s as St}from"./chunks/setPaymentMethod.js";import{CHECKOUT_DATA_FRAGMENT as T}from"./fragments.js";import{s as Mt}from"./chunks/setShippingMethods.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";const v=` mutation estimateShippingMethods( $cartId: String! $address: EstimateAddressInput! @@ -26,7 +26,7 @@ import{b as _,a as f,t as g}from"./chunks/synchronizeCheckout.js";import{c as N, error_message } } -`,D=async r=>{var h;const s=l.cartId,{criteria:a}=r||{},{country_code:e,region_id:t,region_name:i,zip:n}=a||{},p=e||((h=A.value.data)==null?void 0:h.defaultCountry);if(!s)throw new m;if(!p)throw new C;const d=typeof t=="string"?parseInt(t,10):t,c=t||i?{...d&&{region_id:d},...i&&{region_code:i}}:void 0,u={country_code:p,...n&&{postcode:n},...c&&{region:c}};return await o({type:"mutation",query:T,options:{variables:{cartId:s,address:u}},path:"estimateShippingMethods",signalType:"estimateShippingMethods",transformer:_})},E=` +`,D=async r=>{var h;const e=m.cartId,{criteria:n}=r||{},{country_code:i,region_id:t,region_name:s,zip:o}=n||{},a=i||((h=y.value.data)==null?void 0:h.defaultCountry);if(!e)throw new u;if(!a)throw new C;const d=typeof t=="string"?parseInt(t,10):t,c=t||s?{...d&&{region_id:d},...s&&{region_code:s}}:void 0,f={country_code:a,...o&&{postcode:o},...c&&{region:c}};return await p({type:"mutation",query:v,options:{variables:{cartId:e,address:f}},path:"estimateShippingMethods",signalType:"estimateShippingMethods",transformer:_})},E=` mutation setShippingAddress($input: SetShippingAddressesOnCartInput!) { setShippingAddressesOnCart(input: $input) { cart { @@ -35,5 +35,5 @@ import{b as _,a as f,t as g}from"./chunks/synchronizeCheckout.js";import{c as N, } } - ${I} -`,H=async({address:r,customerAddressId:s,pickupLocationCode:a})=>{const e=l.cartId;if(!e)throw new m;const t={cart_id:e,shipping_addresses:[]};if(s)t.shipping_addresses.push({customer_address_id:s});else if(a)t.shipping_addresses.push({pickup_location_code:a});else{if(!r)throw new S;t.shipping_addresses.push({address:f(r)})}const i=await o({type:"mutation",query:E,options:{variables:{input:t}},path:"setShippingAddressesOnCart.cart",signalType:"cart",transformer:g});return y.value?await o({type:"mutation",query:M,options:{variables:{input:{cart_id:e,billing_address:{same_as_shipping:!0}}}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:g}):i};export{J as DEFAULT_COUNTRY,V as FetchError,W as InvalidArgument,X as MissingBillingAddress,m as MissingCart,C as MissingCountry,Z as MissingEmail,tt as MissingPaymentMethod,S as MissingShippinghAddress,st as STORE_CONFIG_DEFAULTS,et as UnexpectedError,N as authenticateCustomer,Q as config,D as estimateShippingMethods,it as fetchGraphQl,R as getCart,rt as getConfig,q as getCustomer,at as getStoreConfig,K as initialize,P as initializeCheckout,ht as isEmailAvailable,mt as placeOrder,nt as removeFetchGraphQlHeader,j as resetCheckout,ut as setBillingAddress,ot as setEndpoint,pt as setFetchGraphQlHeader,dt as setFetchGraphQlHeaders,ft as setGuestEmailOnCart,St as setPaymentMethod,H as setShippingAddress,yt as setShippingMethodsOnCart,L as synchronizeCheckout}; + ${T} +`,H=async({address:r,customerAddressId:e,pickupLocationCode:n})=>{const i=m.cartId;if(!i)throw new u;const t={cart_id:i,shipping_addresses:[]};if(e)t.shipping_addresses.push({customer_address_id:e});else if(n)t.shipping_addresses.push({pickup_location_code:n});else{if(!r)throw new S;t.shipping_addresses.push({address:A(r)})}const s=await p({type:"mutation",query:E,options:{variables:{input:t}},path:"setShippingAddressesOnCart.cart",signalType:"cart",transformer:g});if(!M.value)return l.emit("checkout/updated",s||null),s;const a=await p({type:"mutation",query:I,options:{variables:{input:{cart_id:i,billing_address:{same_as_shipping:!0}}}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:g});return l.emit("checkout/updated",a||null),a};export{V as DEFAULT_COUNTRY,W as FetchError,X as InvalidArgument,Z as MissingBillingAddress,u as MissingCart,C as MissingCountry,tt as MissingEmail,st as MissingPaymentMethod,S as MissingShippinghAddress,et as STORE_CONFIG_DEFAULTS,it as UnexpectedError,Q as authenticateCustomer,R as config,D as estimateShippingMethods,at as fetchGraphQl,q as getCart,rt as getConfig,K as getCustomer,nt as getStoreConfig,P as initialize,j as initializeCheckout,gt as isEmailAvailable,mt as placeOrder,ot as removeFetchGraphQlHeader,L as resetCheckout,ft as setBillingAddress,pt as setEndpoint,dt as setFetchGraphQlHeader,ct as setFetchGraphQlHeaders,At as setGuestEmailOnCart,St as setPaymentMethod,H as setShippingAddress,Mt as setShippingMethodsOnCart,Y as synchronizeCheckout}; diff --git a/scripts/__dropins__/storefront-checkout/api/fragments.d.ts b/scripts/__dropins__/storefront-checkout/api/fragments.d.ts index d992d36b96..12860eda2b 100644 --- a/scripts/__dropins__/storefront-checkout/api/fragments.d.ts +++ b/scripts/__dropins__/storefront-checkout/api/fragments.d.ts @@ -16,4 +16,6 @@ *******************************************************************/ export { CHECKOUT_DATA_FRAGMENT } from './graphql/CheckoutDataFragment.graphql'; export { CUSTOMER_FRAGMENT } from './graphql/CustomerFragment.graphql'; +export { ORDER_FRAGMENT } from './graphql/OrderFragment.graphql'; +export { ORDER_ITEM_FRAGMENT } from './graphql/OrderItemFragment.graphql'; //# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-checkout/api/setGuestEmailOnCart/setGuestEmailOnCart.d.ts b/scripts/__dropins__/storefront-checkout/api/setGuestEmailOnCart/setGuestEmailOnCart.d.ts index 0ea8a0e883..9a0f7f7461 100644 --- a/scripts/__dropins__/storefront-checkout/api/setGuestEmailOnCart/setGuestEmailOnCart.d.ts +++ b/scripts/__dropins__/storefront-checkout/api/setGuestEmailOnCart/setGuestEmailOnCart.d.ts @@ -1,18 +1,18 @@ /******************************************************************** -* ADOBE CONFIDENTIAL -* __________________ -* -* Copyright 2024 Adobe -* All Rights Reserved. -* -* NOTICE: All information contained herein is, and remains -* the property of Adobe and its suppliers, if any. The intellectual -* and technical concepts contained herein are proprietary to Adobe -* and its suppliers and are protected by all applicable intellectual -* property laws, including trade secret and copyright laws. -* Dissemination of this information or reproduction of this material -* is strictly forbidden unless prior written permission is obtained -* from Adobe. -*******************************************************************/ + * ADOBE CONFIDENTIAL + * __________________ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + *******************************************************************/ export declare const setGuestEmailOnCart: (email: string) => Promise; //# sourceMappingURL=setGuestEmailOnCart.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-checkout/chunks/fetch-graphql.js b/scripts/__dropins__/storefront-checkout/chunks/fetch-graphql.js index 49ebc6cb5f..1b61ddf501 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/fetch-graphql.js +++ b/scripts/__dropins__/storefront-checkout/chunks/fetch-graphql.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{c as S,d as T,e as A,a as v,T as i}from"./store-config.js";import"./ServerErrorSignal.js";import{events as G}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{FetchGraphQL as b}from"@dropins/tools/fetch-graphql.js";class x extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class a extends Error{constructor(t){super(t),this.name="InvalidArgument"}}class H extends Error{constructor(t){super(t),this.name="UnexpectedError"}}class V extends a{constructor(){super("Cart ID is required")}}class j extends a{constructor(){super("Email is required")}}class B extends a{constructor(){super("Payment method code is required")}}class Y extends a{constructor(){super("Shipping address is required")}}class $ extends a{constructor(){super("Billing address is required")}}class z extends a{constructor(){super("Country Code is required")}}const p=[];function D(e){return new Promise((t,s)=>{p.push(e);const r=()=>{p[0]===e?e().then(t).catch(s).finally(()=>p.shift()):setTimeout(r,100)};r()})}const k=["sender_email","recipient_email"];function w(e){return e.filter(t=>!t.path||!k.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}const C=e=>{throw e instanceof DOMException&&e.name==="AbortError"||G.emit("error",{source:"checkout",type:"network",error:e}),e},I={cart:S,customer:T,estimateShippingMethods:A,storeConfig:v};function M(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}const E={cart:null,customer:null,estimateShippingMethods:null,storeConfig:null};async function U(e){const{defaultValueOnFail:t,query:s,options:r,path:c,signalType:d,type:y,transformer:h}=e,n=I[d],g=Symbol();E[d]=g,n.value={...n.value,pending:!0};try{const{data:l,errors:f}=await(y==="mutation"?D(()=>_(s,r).catch(C)):_(s,{method:"GET",cache:"no-cache",...r}).catch(C));if(f){const m=w(f);if(m.length>0)throw new x(m)}let o=M(l,c);if(o===void 0)throw new Error(`No data found at path: ${c}`);return h&&(o=h(o)),n.value={...n.value,data:o},setTimeout(()=>{n.value={...n.value,pending:E[d]===g?!1:n.value.pending}},0),o}catch(l){if(t)return n.value={pending:!1,data:t},t;if(l.name==="AbortError")return;throw n.value={...n.value,pending:!1},l}}const q=` +import{c as S,b as T,e as A,a as b,T as i}from"./store-config.js";import"./ServerErrorSignal.js";import{events as v}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{FetchGraphQL as G}from"@dropins/tools/fetch-graphql.js";const x={authenticated:!1,cartId:null,initialized:!1},V=new Proxy(x,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}});class w extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class a extends Error{constructor(t){super(t),this.name="InvalidArgument"}}class j extends Error{constructor(t){super(t),this.name="UnexpectedError"}}class B extends a{constructor(){super("Cart ID is required")}}class z extends a{constructor(){super("Email is required")}}class Y extends a{constructor(){super("Payment method code is required")}}class $ extends a{constructor(){super("Shipping address is required")}}class J extends a{constructor(){super("Billing address is required")}}class K extends a{constructor(){super("Country Code is required")}}const p=[];function D(e){return new Promise((t,s)=>{p.push(e);const r=()=>{p[0]===e?e().then(t).catch(s).finally(()=>p.shift()):setTimeout(r,100)};r()})}const k=["sender_email","recipient_email"];function I(e){return e.filter(t=>!t.path||!k.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}const C=e=>{throw e instanceof DOMException&&e.name==="AbortError"||v.emit("error",{source:"checkout",type:"network",error:e}),e},M={cart:S,customer:T,estimateShippingMethods:A,storeConfig:b};function U(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}const E={cart:null,customer:null,estimateShippingMethods:null,storeConfig:null};async function q(e){const{defaultValueOnFail:t,query:s,options:r,path:c,signalType:d,type:y,transformer:h}=e,n=M[d],g=Symbol();E[d]=g,n.value={...n.value,pending:!0};try{const{data:l,errors:f}=await(y==="mutation"?D(()=>_(s,r).catch(C)):_(s,{method:"GET",cache:"no-cache",...r}).catch(C));if(f){const m=I(f);if(m.length>0)throw new w(m)}let o=U(l,c);if(o===void 0)throw new Error(`No data found at path: ${c}`);return h&&(o=h(o)),n.value={...n.value,data:o},setTimeout(()=>{n.value={...n.value,pending:E[d]===g?!1:n.value.pending}},0),o}catch(l){if(t)return n.value={pending:!1,data:t},t;if(l.name==="AbortError")return;throw n.value={...n.value,pending:!1},l}}const N=` query getStoreConfig { storeConfig { default_country @@ -9,4 +9,4 @@ import{c as S,d as T,e as A,a as v,T as i}from"./store-config.js";import"./Serve shopping_cart_display_shipping } } -`,N="US",u={defaultCountry:N,isGuestCheckoutEnabled:!1,isOnePageCheckoutEnabled:!1,shoppingCartDisplaySetting:{shipping:i.EXCLUDING_TAX}},J=async()=>await U({type:"query",query:q,options:{method:"GET",cache:"no-cache"},path:"storeConfig",signalType:"storeConfig",transformer:L,defaultValueOnFail:u});function F(e){switch(e){case 1:return i.EXCLUDING_TAX;case 2:return i.INCLUDING_TAX;case 3:return i.INCLUDING_EXCLUDING_TAX;default:return i.EXCLUDING_TAX}}function L(e){if(!e)return u;const{default_country:t,is_guest_checkout_enabled:s,is_one_page_checkout_enabled:r,shopping_cart_display_shipping:c}=e;return{defaultCountry:t||u.defaultCountry,isGuestCheckoutEnabled:s||u.isGuestCheckoutEnabled,isOnePageCheckoutEnabled:r||u.isOnePageCheckoutEnabled,shoppingCartDisplaySetting:{shipping:F(c)}}}const{setEndpoint:K,setFetchGraphQlHeader:W,removeFetchGraphQlHeader:Z,setFetchGraphQlHeaders:ee,fetchGraphQl:_,getConfig:te}=new b().getMethods();export{N as D,x as F,a as I,V as M,u as S,H as U,B as a,$ as b,z as c,U as d,Y as e,j as f,W as g,ee as h,_ as i,te as j,J as k,C as l,Z as r,K as s}; +`,F="US",u={defaultCountry:F,isGuestCheckoutEnabled:!1,isOnePageCheckoutEnabled:!1,shoppingCartDisplaySetting:{shipping:i.EXCLUDING_TAX}},W=async()=>await q({type:"query",query:N,options:{method:"GET",cache:"no-cache"},path:"storeConfig",signalType:"storeConfig",transformer:O,defaultValueOnFail:u});function L(e){switch(e){case 1:return i.EXCLUDING_TAX;case 2:return i.INCLUDING_TAX;case 3:return i.INCLUDING_EXCLUDING_TAX;default:return i.EXCLUDING_TAX}}function O(e){if(!e)return u;const{default_country:t,is_guest_checkout_enabled:s,is_one_page_checkout_enabled:r,shopping_cart_display_shipping:c}=e;return{defaultCountry:t||u.defaultCountry,isGuestCheckoutEnabled:s||u.isGuestCheckoutEnabled,isOnePageCheckoutEnabled:r||u.isOnePageCheckoutEnabled,shoppingCartDisplaySetting:{shipping:L(c)}}}const{setEndpoint:Z,setFetchGraphQlHeader:ee,removeFetchGraphQlHeader:te,setFetchGraphQlHeaders:se,fetchGraphQl:_,getConfig:re}=new G().getMethods();export{F as D,w as F,a as I,B as M,u as S,j as U,K as a,$ as b,z as c,q as d,Y as e,J as f,Z as g,ee as h,se as i,_ as j,re as k,W as l,C as m,te as r,V as s}; diff --git a/scripts/__dropins__/storefront-checkout/chunks/isEmailAvailable.js b/scripts/__dropins__/storefront-checkout/chunks/isEmailAvailable.js index d43a0a78dd..2b309924e9 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/isEmailAvailable.js +++ b/scripts/__dropins__/storefront-checkout/chunks/isEmailAvailable.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import"./store-config.js";import"./ServerErrorSignal.js";import{f as e,i as r,l as o}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const s=i=>!!(i!=null&&i.is_email_available),t=` +import{c as e,j as r,m as o}from"./fetch-graphql.js";import"./store-config.js";import"./ServerErrorSignal.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const s=i=>!!(i!=null&&i.is_email_available),t=` query isEmailAvailable($email: String!) { isEmailAvailable(email: $email) { is_email_available diff --git a/scripts/__dropins__/storefront-checkout/chunks/placeOrder2.js b/scripts/__dropins__/storefront-checkout/chunks/placeOrder2.js index cf449c2fd9..dbb21439db 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/placeOrder2.js +++ b/scripts/__dropins__/storefront-checkout/chunks/placeOrder2.js @@ -1,252 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{M as L,i as k,l as $,F as B,U as Q}from"./fetch-graphql.js";import{s as P}from"./store-config.js";import"./ServerErrorSignal.js";import{events as q}from"@dropins/tools/event-bus.js";import{merge as j}from"@dropins/tools/lib.js";import{e as V}from"./synchronizeCheckout.js";const X=e=>({id:P.cartId,totalQuantity:e.totalQuantity,possibleOnepageCheckout:!0,items:e.items.map(n=>{var t;return{canApplyMsrp:!0,formattedPrice:"",id:n.id,quantity:n.totalQuantity,product:{canonicalUrl:n.product.canonicalUrl||"",mainImageUrl:n.product.image||"",name:n.product.name,productId:0,productType:n.product.productType,sku:n.product.sku},prices:{price:{value:n.price.value,currency:n.price.currency}},configurableOptions:((t=n.selectedOptions)==null?void 0:t.map(a=>({optionLabel:a.label,valueLabel:a.value})))||[]}})}),Y=e=>{var a,r,i;const n=e.coupons[0],t=(a=e.payments)==null?void 0:a[0];return{appliedCouponCode:(n==null?void 0:n.code)||"",email:e.email,grandTotal:e.total,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax,shipping:{shippingMethod:((r=e.shipping)==null?void 0:r.code)||"",shippingAmount:((i=e.shipping)==null?void 0:i.amount)||0},subtotalExcludingTax:e.subtotal,subtotalIncludingTax:0,payments:t?[{paymentMethodCode:(t==null?void 0:t.code)||"",paymentMethodName:(t==null?void 0:t.name)||"",total:e.total}]:[]}},H=e=>e.replace(/_([a-z])/g,(n,t)=>t.toUpperCase()),g=(e,n,t)=>{const a=["string","boolean","number"],r=H;return Array.isArray(e)?e.map(i=>a.includes(typeof i)||i===null?i:typeof i=="object"?g(i,n,t):i):e!==null&&typeof e=="object"?Object.entries(e).reduce((i,[s,c])=>{const l=t&&t[s]?t[s]:r(s);return i[l]=a.includes(typeof c)||c===null?c:g(c,n,t),i},{}):e},K=e=>e||0,z=e=>{var n,t,a;return{...e,canonicalUrl:(e==null?void 0:e.canonical_url)||"",id:(e==null?void 0:e.uid)||"",name:(e==null?void 0:e.name)||"",sku:(e==null?void 0:e.sku)||"",image:((n=e==null?void 0:e.image)==null?void 0:n.url)||"",productType:(e==null?void 0:e.__typename)||"",thumbnail:{label:((t=e==null?void 0:e.thumbnail)==null?void 0:t.label)||"",url:((a=e==null?void 0:e.thumbnail)==null?void 0:a.url)||""}}},J=e=>{if(!e||!("selected_options"in e))return;const n={};for(const t of e.selected_options)n[t.label]=t.value;return n},W=e=>{const n=e==null?void 0:e.map(a=>({uid:a.uid,label:a.label,values:a.values.map(r=>r.product_name).join(", ")})),t={};return n==null||n.forEach(a=>{t[a.label]=a.values}),Object.keys(t).length>0?t:null},Z=e=>(e==null?void 0:e.length)>0?{count:e.length,result:e.map(n=>n.title).join(", ")}:null,I=e=>e==null?void 0:e.filter(n=>typeof n.__typename<"u").map(n=>{var t,a,r,i,s,c,l,_,p,d,m,y,u,R,E,o,f,T,O,b,h,A,v,C,M,N,D,G,F,x;return{type:n.__typename,productName:n.product_name,quantityCanceled:n.quantity_canceled||0,quantityInvoiced:n.quantity_invoiced||0,quantityOrdered:n.quantity_ordered||0,quantityRefunded:n.quantity_refunded||0,quantityReturned:n.quantity_returned||0,quantityShipped:n.quantity_shipped||0,id:n.id,discounted:((i=(r=(a=(t=n.product)==null?void 0:t.price_range)==null?void 0:a.maximum_price)==null?void 0:r.regular_price)==null?void 0:i.value)*n.quantity_ordered!==((s=n.product_sale_price)==null?void 0:s.value)*n.quantity_ordered,total:{value:((c=n.product_sale_price)==null?void 0:c.value)*n.quantity_ordered||0,currency:((l=n.product_sale_price)==null?void 0:l.currency)||""},totalInclTax:{value:((_=n.product_sale_price)==null?void 0:_.value)*n.quantity_ordered||0,currency:(p=n.product_sale_price)==null?void 0:p.currency},price:{value:((d=n.product_sale_price)==null?void 0:d.value)||0,currency:(m=n.product_sale_price)==null?void 0:m.currency},priceInclTax:{value:((y=n.product_sale_price)==null?void 0:y.value)||0,currency:(u=n.product_sale_price)==null?void 0:u.currency},totalQuantity:K(n.quantity_ordered),regularPrice:{value:(f=(o=(E=(R=n.product)==null?void 0:R.price_range)==null?void 0:E.maximum_price)==null?void 0:o.regular_price)==null?void 0:f.value,currency:(h=(b=(O=(T=n.product)==null?void 0:T.price_range)==null?void 0:O.maximum_price)==null?void 0:b.regular_price)==null?void 0:h.currency},product:z(n.product),thumbnail:{label:((v=(A=n.product)==null?void 0:A.thumbnail)==null?void 0:v.label)||"",url:((M=(C=n.product)==null?void 0:C.thumbnail)==null?void 0:M.url)||""},giftCard:n.__typename==="GiftCardOrderItem"?{senderName:((N=n.gift_card)==null?void 0:N.sender_name)||"",senderEmail:((D=n.gift_card)==null?void 0:D.sender_email)||"",recipientEmail:((G=n.gift_card)==null?void 0:G.recipient_email)||"",recipientName:((F=n.gift_card)==null?void 0:F.recipient_name)||"",message:((x=n.gift_card)==null?void 0:x.message)||""}:void 0,configurableOptions:J(n),bundleOptions:n.__typename==="BundleOrderItem"?W(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?Z(n.downloadable_links):null}}),ee=e=>{var _,p,d,m,y,u,R;const n=I(e.items),{total:t,...a}=g({...e,items:n},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),r=(_=e==null?void 0:e.payment_methods)==null?void 0:_[0],i=(r==null?void 0:r.type)||"",s=(r==null?void 0:r.name)||"",c=(p=a==null?void 0:a.items)==null?void 0:p.reduce((E,o)=>E+(o==null?void 0:o.totalQuantity),0),l={...t,...a,totalQuantity:c,shipping:{amount:((d=t==null?void 0:t.totalShipping)==null?void 0:d.value)??0,currency:((m=t==null?void 0:t.totalShipping)==null?void 0:m.currency)||"",code:a.shippingMethod??""},payments:[{code:i,name:s}]};return j(l,(R=(u=(y=V.getConfig().models)==null?void 0:y.OrderModel)==null?void 0:u.transformer)==null?void 0:R.call(u,e))},ne=` - fragment ORDER_ADDRESS_FRAGMENT on OrderAddress { - city - company - country_code - fax - firstname - lastname - middlename - postcode - prefix - region - region_id - street - suffix - telephone - vat_id - custom_attributesV2 { - code - ... on AttributeValue { - value - } - } - } -`,te=` - fragment PRODUCT_FRAGMENT on ProductInterface { - __typename - canonical_url - uid - name - sku - only_x_left_in_stock - stock_status - image { - url - } - thumbnail { - label - url - } - price_range { - maximum_price { - regular_price { - currency - value - } - } - } - } -`,ae=` - fragment PRICE_FRAGMENT on OrderItemInterface { - prices { - price_including_tax { - value - currency - } - original_price { - value - currency - } - original_price_including_tax { - value - currency - } - price { - value - currency - } - } - } -`,re=` - fragment GIFT_CARD_FRAGMENT on GiftCardOrderItem { - ...PRICE_FRAGMENT - gift_message { - message - } - gift_card { - recipient_name - recipient_email - sender_name - sender_email - message - } - } -`,ie=` - fragment ORDER_ITEM_FRAGMENT on OrderItemInterface { - __typename - status - product_name - id - quantity_ordered - quantity_shipped - quantity_canceled - quantity_invoiced - quantity_refunded - quantity_returned - product_sale_price { - value - currency - } - selected_options { - label - value - } - product { - ...PRODUCT_FRAGMENT - } - ...PRICE_FRAGMENT - } -`,ce=` - fragment BUNDLE_ORDER_ITEM_FRAGMENT on BundleOrderItem { - ...PRICE_FRAGMENT - bundle_options { - uid - label - values { - uid - product_name - } - } - } -`,se=` - fragment ORDER_SUMMARY_FRAGMENT on OrderTotal { - grand_total { - value - currency - } - total_giftcard { - currency - value - } - subtotal { - currency - value - } - taxes { - amount { - currency - value - } - rate - } - total_tax { - currency - value - } - total_shipping { - currency - value - } - discounts { - amount { - currency - value - } - label - } - } -`,ue=` - fragment ORDER_FRAGMENT on CustomerOrder { - email - id - number - order_date - order_status_change_date - status - token - carrier - shipping_method - printed_card_included - gift_receipt_included - available_actions - is_virtual - payment_methods { - name - type - } - applied_coupons { - code - } - shipments { - id - tracking { - title - number - carrier - } - comments { - message - timestamp - } - items { - id - product_sku - product_name - order_item { - ...ORDER_ITEM_FRAGMENT - ... on GiftCardOrderItem { - ...GIFT_CARD_FRAGMENT - product { - ...PRODUCT_FRAGMENT - } - } - } - } - } - payment_methods { - name - type - } - shipping_address { - ...ORDER_ADDRESS_FRAGMENT - } - billing_address { - ...ORDER_ADDRESS_FRAGMENT - } - items { - ...ORDER_ITEM_FRAGMENT - ... on BundleOrderItem { - ...BUNDLE_ORDER_ITEM_FRAGMENT - } - ... on GiftCardOrderItem { - ...GIFT_CARD_FRAGMENT - product { - ...PRODUCT_FRAGMENT - } - } - ... on DownloadableOrderItem { - product_name - downloadable_links { - sort_order - title - } - } - } - total { - ...ORDER_SUMMARY_FRAGMENT - } - } - ${ce} - ${re} - ${ne} - ${ie} - ${se} - ${ae} - ${te} -`,le=` +import{s as P,M as F,j as G,m as k,F as $,U as Q}from"./fetch-graphql.js";import{ORDER_FRAGMENT as X}from"../fragments.js";import"./store-config.js";import"./ServerErrorSignal.js";import{events as S}from"@dropins/tools/event-bus.js";import{merge as B}from"@dropins/tools/lib.js";import{c as H}from"./synchronizeCheckout.js";const K=e=>({id:P.cartId,totalQuantity:e.totalQuantity,possibleOnepageCheckout:!0,items:e.items.map(n=>{var a;return{canApplyMsrp:!0,formattedPrice:"",id:n.id,quantity:n.totalQuantity,product:{canonicalUrl:n.product.canonicalUrl||"",mainImageUrl:n.product.image||"",name:n.product.name,productId:0,productType:n.product.productType,sku:n.product.sku},prices:{price:{value:n.price.value,currency:n.price.currency}},configurableOptions:((a=n.selectedOptions)==null?void 0:a.map(t=>({optionLabel:t.label,valueLabel:t.value})))||[]}})}),V=e=>{var t,i,s;const n=e.coupons[0],a=(t=e.payments)==null?void 0:t[0];return{appliedCouponCode:(n==null?void 0:n.code)||"",email:e.email,grandTotal:e.total,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax,shipping:{shippingMethod:((i=e.shipping)==null?void 0:i.code)||"",shippingAmount:((s=e.shipping)==null?void 0:s.amount)||0},subtotalExcludingTax:e.subtotal,subtotalIncludingTax:0,payments:a?[{paymentMethodCode:(a==null?void 0:a.code)||"",paymentMethodName:(a==null?void 0:a.name)||"",total:e.total}]:[]}},z=e=>e.replace(/_([a-z])/g,(n,a)=>a.toUpperCase()),b=(e,n,a)=>{const t=["string","boolean","number"],i=z;return Array.isArray(e)?e.map(s=>t.includes(typeof s)||s===null?s:typeof s=="object"?b(s,n,a):s):e!==null&&typeof e=="object"?Object.entries(e).reduce((s,[r,c])=>{const u=a&&a[r]?a[r]:i(r);return s[u]=t.includes(typeof c)||c===null?c:b(c,n,a),s},{}):e},J=e=>e||0,W=e=>{var n,a,t;return{...e,canonicalUrl:(e==null?void 0:e.canonical_url)||"",id:(e==null?void 0:e.uid)||"",name:(e==null?void 0:e.name)||"",sku:(e==null?void 0:e.sku)||"",image:((n=e==null?void 0:e.image)==null?void 0:n.url)||"",productType:(e==null?void 0:e.__typename)||"",thumbnail:{label:((a=e==null?void 0:e.thumbnail)==null?void 0:a.label)||"",url:((t=e==null?void 0:e.thumbnail)==null?void 0:t.url)||""}}},Y=e=>{if(!e||!("selected_options"in e))return;const n={};for(const a of e.selected_options)n[a.label]=a.value;return n},Z=e=>{const n=e==null?void 0:e.map(t=>({uid:t.uid,label:t.label,values:t.values.map(i=>i.product_name).join(", ")})),a={};return n==null||n.forEach(t=>{a[t.label]=t.values}),Object.keys(a).length>0?a:null},I=e=>(e==null?void 0:e.length)>0?{count:e.length,result:e.map(n=>n.title).join(", ")}:null,ee=e=>e==null?void 0:e.filter(n=>typeof n.__typename<"u").map(n=>{var a,t,i,s,r,c,u,p,_,y,f,g,l,m,h,o,d,O,C,v,E,T,x,w,q,N,R,L,A,M;return{type:n.__typename,productName:n.product_name,quantityCanceled:n.quantity_canceled||0,quantityInvoiced:n.quantity_invoiced||0,quantityOrdered:n.quantity_ordered||0,quantityRefunded:n.quantity_refunded||0,quantityReturned:n.quantity_returned||0,quantityShipped:n.quantity_shipped||0,id:n.id,discounted:((s=(i=(t=(a=n.product)==null?void 0:a.price_range)==null?void 0:t.maximum_price)==null?void 0:i.regular_price)==null?void 0:s.value)*n.quantity_ordered!==((r=n.product_sale_price)==null?void 0:r.value)*n.quantity_ordered,total:{value:((c=n.product_sale_price)==null?void 0:c.value)*n.quantity_ordered||0,currency:((u=n.product_sale_price)==null?void 0:u.currency)||""},totalInclTax:{value:((p=n.product_sale_price)==null?void 0:p.value)*n.quantity_ordered||0,currency:(_=n.product_sale_price)==null?void 0:_.currency},price:{value:((y=n.product_sale_price)==null?void 0:y.value)||0,currency:(f=n.product_sale_price)==null?void 0:f.currency},priceInclTax:{value:((g=n.product_sale_price)==null?void 0:g.value)||0,currency:(l=n.product_sale_price)==null?void 0:l.currency},totalQuantity:J(n.quantity_ordered),regularPrice:{value:(d=(o=(h=(m=n.product)==null?void 0:m.price_range)==null?void 0:h.maximum_price)==null?void 0:o.regular_price)==null?void 0:d.value,currency:(E=(v=(C=(O=n.product)==null?void 0:O.price_range)==null?void 0:C.maximum_price)==null?void 0:v.regular_price)==null?void 0:E.currency},product:W(n.product),thumbnail:{label:((x=(T=n.product)==null?void 0:T.thumbnail)==null?void 0:x.label)||"",url:((q=(w=n.product)==null?void 0:w.thumbnail)==null?void 0:q.url)||""},giftCard:n.__typename==="GiftCardOrderItem"?{senderName:((N=n.gift_card)==null?void 0:N.sender_name)||"",senderEmail:((R=n.gift_card)==null?void 0:R.sender_email)||"",recipientEmail:((L=n.gift_card)==null?void 0:L.recipient_email)||"",recipientName:((A=n.gift_card)==null?void 0:A.recipient_name)||"",message:((M=n.gift_card)==null?void 0:M.message)||""}:void 0,configurableOptions:Y(n),bundleOptions:n.__typename==="BundleOrderItem"?Z(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?I(n.downloadable_links):null}}),ne=e=>{var p,_,y,f,g,l,m;const n=ee(e.items),{total:a,...t}=b({...e,items:n},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),i=(p=e==null?void 0:e.payment_methods)==null?void 0:p[0],s=(i==null?void 0:i.type)||"",r=(i==null?void 0:i.name)||"",c=(_=t==null?void 0:t.items)==null?void 0:_.reduce((h,o)=>h+(o==null?void 0:o.totalQuantity),0),u={...a,...t,totalQuantity:c,shipping:{amount:((y=a==null?void 0:a.totalShipping)==null?void 0:y.value)??0,currency:((f=a==null?void 0:a.totalShipping)==null?void 0:f.currency)||"",code:t.shippingMethod??""},payments:[{code:s,name:r}]};return B(u,(m=(l=(g=H.getConfig().models)==null?void 0:g.OrderModel)==null?void 0:l.transformer)==null?void 0:m.call(l,e))},ae=` mutation placeOrder($cartId: String!) { placeOrder(input: { cart_id: $cartId }) { errors { @@ -259,5 +13,5 @@ import{M as L,i as k,l as $,F as B,U as Q}from"./fetch-graphql.js";import{s as P } } - ${ue} -`,w={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},oe={PLACE_ORDER:"place-order"};function U(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function S(e,n){const t=U();t.push({[e]:null}),t.push({[e]:n})}function _e(e,n){U().push(a=>{const r=a.getState?a.getState():{};a.push({event:e,eventInfo:{...r,...n}})})}function pe(e){const n=X(e),t=Y(e);S(w.SHOPPING_CART_CONTEXT,{...n}),S(w.ORDER_CONTEXT,{...t}),_e(oe.PLACE_ORDER)}function de(e){throw e.every(t=>{var a;return(a=t.extensions)==null?void 0:a.category})?new B(e):new Q(e[0].message)}const Te=async()=>{const e=P.cartId;if(!e)throw new L;const{data:n,errors:t}=await k(le,{variables:{cartId:e}}).catch($);t&&de(t);const a=ee(n.placeOrder.orderV2);return pe(a),q.emit("checkout/order",a),q.emit("cart/reset",void 0),a};export{Te as p}; + ${X} +`,j={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},te={PLACE_ORDER:"place-order"};function U(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function D(e,n){const a=U();a.push({[e]:null}),a.push({[e]:n})}function ie(e,n){U().push(t=>{const i=t.getState?t.getState():{};t.push({event:e,eventInfo:{...i,...n}})})}function se(e){const n=K(e),a=V(e);D(j.SHOPPING_CART_CONTEXT,{...n}),D(j.ORDER_CONTEXT,{...a}),ie(te.PLACE_ORDER)}function ce(e){throw e.every(a=>{var t;return(t=a.extensions)==null?void 0:t.category})?new $(e):new Q(e[0].message)}function re(e){const n=e.map(a=>a==null?void 0:a.message).join(", ");throw new Q(`${n}`)}const ge=async()=>{var i,s;const e=P.cartId;if(!e)throw new F;const{data:n,errors:a}=await G(ae,{variables:{cartId:e}}).catch(k);a&&ce(a),(i=n.placeOrder)!=null&&i.errors&&n.placeOrder.errors.length>0&&re((s=n.placeOrder)==null?void 0:s.errors);const t=ne(n.placeOrder.orderV2);return se(t),S.emit("checkout/order",t),S.emit("cart/reset",void 0),t};export{ge as p}; diff --git a/scripts/__dropins__/storefront-checkout/chunks/setBillingAddress.js b/scripts/__dropins__/storefront-checkout/chunks/setBillingAddress.js index fd00546623..c2ba9e565f 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/setBillingAddress.js +++ b/scripts/__dropins__/storefront-checkout/chunks/setBillingAddress.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{M as e,b as o,d as l}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as d}from"../fragments.js";import{s as p}from"./store-config.js";import{a as f,t as m}from"./synchronizeCheckout.js";import"./ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const _=` +import{s as o,M as d,f as l,d as p}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as u}from"../fragments.js";import{a as c,b as f}from"./synchronizeCheckout.js";import"./store-config.js";import"./ServerErrorSignal.js";import{events as m}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const _=` mutation setBillingAddress($input: SetBillingAddressOnCartInput!) { setBillingAddressOnCart(input: $input) { cart { @@ -9,5 +9,5 @@ import{M as e,b as o,d as l}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGME } } - ${d} -`,M=async({address:r,customerAddressId:t,sameAsShipping:s=!1,useForShipping:n=!1})=>{const a=p.cartId;if(!a)throw new e;const i={cart_id:a,billing_address:{same_as_shipping:s,use_for_shipping:n}};if(!s&&t&&(i.billing_address.customer_address_id=t),!s&&!t){if(!r)throw new o;i.billing_address.address=f(r)}return await l({type:"mutation",query:_,options:{variables:{input:i}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:m})};export{_ as a,M as s}; + ${u} +`,b=async({address:a,customerAddressId:t,sameAsShipping:s=!1,useForShipping:e=!1})=>{const r=o.cartId;if(!r)throw new d;const i={cart_id:r,billing_address:{same_as_shipping:s,use_for_shipping:e}};if(!s&&t&&(i.billing_address.customer_address_id=t),!s&&!t){if(!a)throw new l;i.billing_address.address=c(a)}const n=await p({type:"mutation",query:_,options:{variables:{input:i}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:f});return m.emit("checkout/updated",n||null),n};export{_ as a,b as s}; diff --git a/scripts/__dropins__/storefront-checkout/chunks/setGuestEmailOnCart.js b/scripts/__dropins__/storefront-checkout/chunks/setGuestEmailOnCart.js index 30b858265e..331282e5e6 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/setGuestEmailOnCart.js +++ b/scripts/__dropins__/storefront-checkout/chunks/setGuestEmailOnCart.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{M as r,d as i}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as s}from"../fragments.js";import{s as m}from"./store-config.js";import{t as o}from"./synchronizeCheckout.js";import"./ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const e=` +import{s as i,M as s,d as e}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as o}from"../fragments.js";import{b as m}from"./synchronizeCheckout.js";import"./store-config.js";import"./ServerErrorSignal.js";import{events as n}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const c=` mutation setGuestEmail($cartId: String!, $email: String!) { setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) { cart { @@ -9,5 +9,5 @@ import{M as r,d as i}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as s } } - ${s} -`,d=async a=>{const t=m.cartId;if(!t)throw new r;return await i({type:"mutation",query:e,options:{variables:{cartId:t,email:a}},path:"setGuestEmailOnCart.cart",signalType:"cart",transformer:o})};export{d as s}; + ${o} +`,A=async r=>{const t=i.cartId;if(!t)throw new s;const a=await e({type:"mutation",query:c,options:{variables:{cartId:t,email:r}},path:"setGuestEmailOnCart.cart",signalType:"cart",transformer:m});return n.emit("checkout/updated",a||null),a};export{A as s}; diff --git a/scripts/__dropins__/storefront-checkout/chunks/setPaymentMethod.js b/scripts/__dropins__/storefront-checkout/chunks/setPaymentMethod.js index e580014600..2f1bb9228f 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/setPaymentMethod.js +++ b/scripts/__dropins__/storefront-checkout/chunks/setPaymentMethod.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{M as r,a as o,d as e}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s}from"./store-config.js";import{t as i}from"./synchronizeCheckout.js";import"./ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const m=` +import{s as r,M as o,e as n,d as s}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as i}from"../fragments.js";import{b as m}from"./synchronizeCheckout.js";import"./store-config.js";import"./ServerErrorSignal.js";import{events as d}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const p=` mutation setPaymentMethod($cartId: String!, $paymentMethod: String!) { setPaymentMethodOnCart( input: { cart_id: $cartId, payment_method: { code: $paymentMethod } } @@ -11,5 +11,5 @@ import{M as r,a as o,d as e}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGME } } - ${n} -`,f=async t=>{const a=s.cartId;if(!a)throw new r;if(!t)throw new o;return await e({type:"mutation",query:m,options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",signalType:"cart",transformer:i})};export{f as s}; + ${i} +`,A=async t=>{const a=r.cartId;if(!a)throw new o;if(!t)throw new n;const e=await s({type:"mutation",query:p,options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",signalType:"cart",transformer:m});return d.emit("checkout/updated",e||null),e};export{A as s}; diff --git a/scripts/__dropins__/storefront-checkout/chunks/setShippingMethods.js b/scripts/__dropins__/storefront-checkout/chunks/setShippingMethods.js index 5ed4442adf..af1877c83e 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/setShippingMethods.js +++ b/scripts/__dropins__/storefront-checkout/chunks/setShippingMethods.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{s as r}from"./store-config.js";import"./ServerErrorSignal.js";import{M as s,d as p}from"./fetch-graphql.js";import{t as a}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as o}from"../fragments.js";const n=` +import{s as a,M as p,d as r}from"./fetch-graphql.js";import"./store-config.js";import"./ServerErrorSignal.js";import{b as o}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import{events as n}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";const h=` mutation setShippingMethods( $cartId: String! $shippingMethods: [ShippingMethodInput]! @@ -14,5 +14,5 @@ import{s as r}from"./store-config.js";import"./ServerErrorSignal.js";import{M as } } - ${o} -`,C=async i=>{const t=r.cartId;if(!t)throw new s;return await p({type:"mutation",query:n,options:{variables:{cartId:t,shippingMethods:i}},path:"setShippingMethodsOnCart.cart",signalType:"cart",transformer:a})};export{C as s}; + ${e} +`,f=async s=>{const t=a.cartId;if(!t)throw new p;const i=await r({type:"mutation",query:h,options:{variables:{cartId:t,shippingMethods:s}},path:"setShippingMethodsOnCart.cart",signalType:"cart",transformer:o});return n.emit("checkout/updated",i||null),i};export{f as s}; diff --git a/scripts/__dropins__/storefront-checkout/chunks/store-config.js b/scripts/__dropins__/storefront-checkout/chunks/store-config.js index 295a51ecf6..9b96ba373b 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/store-config.js +++ b/scripts/__dropins__/storefront-checkout/chunks/store-config.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{signal as e,effect as i}from"@dropins/tools/signals.js";import{events as o}from"@dropins/tools/event-bus.js";const d={authenticated:!1,cartId:null,initialized:!1},r=new Proxy(d,{set(t,a,s){return t[a]=s,!0},get(t,a){return t[a]}}),l=e(!0),n=e({pending:!1,data:void 0});i(()=>{var t;(t=n.value.data)!=null&&t.isVirtual&&(l.value=!1)});i(()=>{const{data:t,pending:a}=n.value;r.initialized&&(a||t===void 0||o.emit("checkout/updated",t))});const f=e({pending:!1,data:void 0}),p=e({pending:!1,data:void 0}),I=e(void 0),N=e({data:void 0,pending:!1});var c=(t=>(t.EXCLUDING_TAX="EXCLUDING_TAX",t.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",t.INCLUDING_TAX="INCLUDING_TAX",t))(c||{});export{c as T,N as a,I as b,n as c,f as d,p as e,l as i,r as s}; +import{signal as i,effect as e}from"@dropins/tools/signals.js";const n=i(!0),s=i({pending:!1,data:void 0});e(()=>{var a;(a=s.value.data)!=null&&a.isVirtual&&(n.value=!1)});const d=i({pending:!1,data:void 0}),l=i({pending:!1,data:void 0}),g=i(void 0),N=i({data:void 0,pending:!1});var t=(a=>(a.EXCLUDING_TAX="EXCLUDING_TAX",a.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",a.INCLUDING_TAX="INCLUDING_TAX",a))(t||{});export{t as T,N as a,d as b,s as c,l as e,n as i,g as s}; diff --git a/scripts/__dropins__/storefront-checkout/chunks/synchronizeCheckout.js b/scripts/__dropins__/storefront-checkout/chunks/synchronizeCheckout.js index d53e339f1b..001453e6c0 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/synchronizeCheckout.js +++ b/scripts/__dropins__/storefront-checkout/chunks/synchronizeCheckout.js @@ -1,13 +1,13 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{s as i,d as v,a as A,c as l}from"./store-config.js";import"./ServerErrorSignal.js";import{events as s}from"@dropins/tools/event-bus.js";import{merge as a,Initializer as b}from"@dropins/tools/lib.js";import{M,d as u,k as T}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as m,CUSTOMER_FRAGMENT as I}from"../fragments.js";const S=async(e=!1)=>{i.authenticated=e,e?await K():v.value={pending:!1,data:null}},x=e=>e==null,E=(e,t)=>e.amount.value-t.amount.value,f=e=>!(!e||!e.method_code||!e.method_title||x(e.amount.value)||!e.amount.currency),d=e=>({amount:{value:e.amount.value,currency:e.amount.currency},title:e.method_title,code:e.method_code,carrier:{code:e.carrier_code,title:e.carrier_title},value:`${e.carrier_code} - ${e.method_code}`,...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}}}),N=e=>{if(f(e))return d(e)},w=e=>{if(e)return e.filter(f).map(t=>d(t)).sort(E)},k=e=>e?!!e.code&&!!e.label:!1,z=e=>{if(!k(e))return;const{code:t,label:n,region_id:r}=e;return r?{code:t,name:n,id:r}:{code:t,name:n}},R=e=>{const{code:t,label:n}=e;return{value:t,label:n}},q=e=>e?"code"in e&&"value"in e:!1,G=e=>e.filter(q).map(t=>{const{code:n,value:r}=t;return{code:n,value:r}}),p=e=>{const t=e.street.filter(Boolean);return{id:(e==null?void 0:e.id)||void 0,city:e.city,company:e.company||void 0,country:R(e.country),customAttributes:G(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:z(e.region),street:t,telephone:e.telephone||void 0,vatId:e.vat_id||void 0}},O=e=>{if(e)return p(e)},P=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:n,selected_shipping_method:r,same_as_billing:o,...C}=t;return{...p(C),availableShippingMethods:w(n),selectedShippingMethod:N(r),sameAsBilling:o}}),ee=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId}),$=e=>{if(e)return{code:e.code,title:e.title}},B=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:n,title:r}=t;return{code:n,title:r}})},F=e=>{var n,r,o;if(!e)return;const t={availablePaymentMethods:B(e.available_payment_methods),billingAddress:O(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:$(e.selected_payment_method),shippingAddresses:P(e.shipping_addresses),isGuest:!i.authenticated};return a(t,(o=(r=(n=_.getConfig().models)==null?void 0:n.CartModel)==null?void 0:r.transformer)==null?void 0:o.call(r,e))},U=e=>{var n,r,o;if(!e)return;const t={firstName:e.firstname||"",lastName:e.lastname||"",email:e.email||""};return a(t,(o=(r=(n=_.getConfig().models)==null?void 0:n.CustomerModel)==null?void 0:r.transformer)==null?void 0:o.call(r,e))},D=` +import{s as i,M as C,d as l,l as A}from"./fetch-graphql.js";import{b,a as M,c}from"./store-config.js";import"./ServerErrorSignal.js";import{events as s}from"@dropins/tools/event-bus.js";import{merge as a,Initializer as T}from"@dropins/tools/lib.js";import{CHECKOUT_DATA_FRAGMENT as u,CUSTOMER_FRAGMENT as S}from"../fragments.js";const I=async(e=!1)=>{i.authenticated=e,e?await K():b.value={pending:!1,data:null}},x=e=>e==null,E=(e,t)=>e.amount.value-t.amount.value,m=e=>!(!e||!e.method_code||!e.method_title||x(e.amount.value)||!e.amount.currency),f=e=>({amount:{value:e.amount.value,currency:e.amount.currency},title:e.method_title,code:e.method_code,carrier:{code:e.carrier_code,title:e.carrier_title},value:`${e.carrier_code} - ${e.method_code}`,...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}}}),N=e=>{if(m(e))return f(e)},k=e=>{if(e)return e.filter(m).map(t=>f(t)).sort(E)},w=e=>e?!!e.code&&!!e.label:!1,z=e=>{if(!w(e))return;const{code:t,label:r,region_id:n}=e;return n?{code:t,name:r,id:n}:{code:t,name:r}},R=e=>{const{code:t,label:r}=e;return{value:t,label:r}},q=e=>e?"code"in e&&"value"in e:!1,G=e=>e.filter(q).map(t=>{const{code:r,value:n}=t;return{code:r,value:n}}),d=e=>{const t=e.street.filter(Boolean);return{id:(e==null?void 0:e.id)||void 0,city:e.city,company:e.company||void 0,country:R(e.country),customAttributes:G(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:z(e.region),street:t,telephone:e.telephone||void 0,vatId:e.vat_id||void 0}},O=e=>{if(e)return d(e)},P=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:r,selected_shipping_method:n,same_as_billing:o,...v}=t;return{...d(v),availableShippingMethods:k(r),selectedShippingMethod:N(n),sameAsBilling:o}}),ee=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId}),$=e=>{if(e)return{code:e.code,title:e.title}},B=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:r,title:n}=t;return{code:r,title:n}})},D=e=>{var r,n,o;if(!e)return;const t={availablePaymentMethods:B(e.available_payment_methods),billingAddress:O(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:$(e.selected_payment_method),shippingAddresses:P(e.shipping_addresses),isGuest:!i.authenticated};return a(t,(o=(n=(r=_.getConfig().models)==null?void 0:r.CartModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},F=e=>{var r,n,o;if(!e)return;const t={firstName:e.firstname||"",lastName:e.lastname||"",email:e.email||""};return a(t,(o=(n=(r=_.getConfig().models)==null?void 0:r.CustomerModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},U=` query getCart($cartId: String!) { cart(cart_id: $cartId) { ...CHECKOUT_DATA_FRAGMENT } } - ${m} + ${u} `,V=` query getCustomerCart { cart: customerCart { @@ -15,13 +15,13 @@ import{s as i,d as v,a as A,c as l}from"./store-config.js";import"./ServerErrorS } } - ${m} -`,c=async()=>{const e=i.cartId,t=i.authenticated===!1,n=t?D:V,r=t?{cartId:e}:{};if(t&&!e)throw new M;return await u({type:"query",query:n,options:{method:"POST",cache:"no-cache",variables:r},path:"cart",signalType:"cart",transformer:F})},H=` + ${u} +`,p=async()=>{const e=i.cartId,t=i.authenticated===!1,r=t?U:V,n=t?{cartId:e}:{};if(t&&!e)throw new C;return await l({type:"query",query:r,options:{method:"POST",cache:"no-cache",variables:n},path:"cart",signalType:"cart",transformer:D})},H=` query getCustomer { customer { ...CUSTOMER_FRAGMENT } } - ${I} -`,K=async()=>{if(i.authenticated)return await u({type:"query",query:H,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:U})},Q=()=>[s.on("authenticated",S,{eager:!0}),s.on("cart/initialized",h,{eager:!0}),s.on("cart/reset",y),s.on("cart/updated",L),s.on("checkout/initialized",()=>{i.initialized=!0})],g=new b({init:async e=>{const t=e||{};g.config.setConfig(t),A.value.data||await T()},listeners:Q}),_=g.config,h=async e=>{if(!e)i.cartId=null,l.value={pending:!1,data:null},s.emit("checkout/initialized",null);else{i.cartId=e.id;const t=await c();s.emit("checkout/initialized",t||null)}},y=()=>{i.cartId=null,l.value={pending:!1,data:null}},L=async e=>{if(!i.initialized){await h(e);return}if(e===null){y();return}i.cartId===null?(i.cartId=e.id,await c()):i.cartId===e.id&&await c()};export{ee as a,w as b,S as c,K as d,_ as e,h as f,c as g,g as i,y as r,L as s,F as t}; + ${S} +`,K=async()=>{if(i.authenticated)return await l({type:"query",query:H,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:F})},Q=()=>[s.on("authenticated",I,{eager:!0}),s.on("cart/initialized",h,{eager:!0}),s.on("cart/reset",L),s.on("cart/updated",y)],g=new T({init:async e=>{const t=e||{};g.config.setConfig(t),M.value.data||await A()},listeners:Q}),_=g.config,h=async e=>{if(i.initialized)return y(e);const t=e?e.id:null;i.cartId=t;const r=t?await p():null;c.value={pending:!1,data:r},i.initialized=!0,s.emit("checkout/initialized",r||null)},L=()=>{i.cartId=null,c.value={pending:!1,data:null},s.emit("checkout/updated",null)},y=async e=>{if(!i.initialized)return h(e);const t=e?e.id:null;i.cartId=t;const r=t?await p():null;c.value={pending:!1,data:r},s.emit("checkout/updated",r||null)};export{ee as a,D as b,_ as c,I as d,K as e,h as f,p as g,g as i,L as r,y as s,k as t}; diff --git a/scripts/__dropins__/storefront-checkout/chunks/withConditionalRendering.js b/scripts/__dropins__/storefront-checkout/chunks/withConditionalRendering.js index 1888d95e28..0b1174afa9 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/withConditionalRendering.js +++ b/scripts/__dropins__/storefront-checkout/chunks/withConditionalRendering.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{c as d}from"./store-config.js";import"./ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./fetch-graphql.js";function u(i){return i.displayName||i.name||"Component"}const h=i=>{const o=u(i),a=({hideOnEmptyCart:s=!0,hideOnVirtualCart:r=!1,...e})=>{const t=d.value.data,l=t!==void 0&&(t===null||t.isEmpty),m=!!(t!=null&&t.isVirtual),c=s&&l||r&&m,p=`conditional-${o.toLowerCase()}`;return n("div",{className:p,children:!c&&n(i,{...e})})};return a.displayName=`Conditional(${o})`,a};export{h as w}; +import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{c as d}from"./store-config.js";import"./ServerErrorSignal.js";import"./fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";function u(i){return i.displayName||i.name||"Component"}const h=i=>{const o=u(i),a=({hideOnEmptyCart:s=!0,hideOnVirtualCart:r=!1,...e})=>{const t=d.value.data,l=t!==void 0&&(t===null||t.isEmpty),m=!!(t!=null&&t.isVirtual),c=s&&l||r&&m,p=`conditional-${o.toLowerCase()}`;return n("div",{className:p,children:!c&&n(i,{...e})})};return a.displayName=`Conditional(${o})`,a};export{h as w}; diff --git a/scripts/__dropins__/storefront-checkout/containers/BillToShippingAddress.js b/scripts/__dropins__/storefront-checkout/containers/BillToShippingAddress.js index 4663664735..15010b59b6 100644 --- a/scripts/__dropins__/storefront-checkout/containers/BillToShippingAddress.js +++ b/scripts/__dropins__/storefront-checkout/containers/BillToShippingAddress.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{i as d,c as u}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{s as S}from"../chunks/setBillingAddress.js";/* empty css */import{Checkbox as b,Skeleton as f,SkeletonRow as A}from"@dropins/tools/components.js";import{c as B}from"../chunks/classes.js";import{useText as x}from"@dropins/tools/i18n.js";import{w as T}from"../chunks/withConditionalRendering.js";import{useState as v,useEffect as _}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const w=({className:i,checked:e,loading:r,onChange:n,disabled:s})=>{const c=x({title:"Checkout.BillToShippingAddress.title"});return r?t(y,{}):t("div",{className:"checkout-bill-to-shipping-address",children:t(b,{checked:e,className:B(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",disabled:s,label:c.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:n})})},y=()=>t(f,{className:"bill-to-shipping-address__skeleton",children:t(A,{variant:"row",size:"small"})}),k=({onChange:i})=>{var g;const[e,r]=v(!0),n=d.value,s=u.value.data,c=u.value.pending,p=!!s,m=!!(s==null?void 0:s.billingAddress),l=(g=s==null?void 0:s.shippingAddresses)==null?void 0:g[0],h=l==null?void 0:l.sameAsBilling;return _(()=>{if(!e||!p)return;r(!1);const o=h??!m;d.value=o,i==null||i(o)},[p,m,h,e,i]),t(w,{checked:n,disabled:c,loading:e,onChange:async o=>{const a=o.target.checked;d.value=a,i==null||i(a),!e&&l&&a&&await S({sameAsShipping:!0}).catch(console.error)}})};k.displayName="BillToShippingAddressContainer";const U=T(k);export{U as BillToShippingAddress,U as default}; +import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/fetch-graphql.js";import{i as d,c as u}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{s as S}from"../chunks/setBillingAddress.js";/* empty css */import{Checkbox as b,Skeleton as f,SkeletonRow as A}from"@dropins/tools/components.js";import{c as B}from"../chunks/classes.js";import{useText as x}from"@dropins/tools/i18n.js";import{w as T}from"../chunks/withConditionalRendering.js";import{useState as v,useEffect as _}from"@dropins/tools/preact-compat.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const w=({className:i,checked:e,loading:r,onChange:n,disabled:s})=>{const c=x({title:"Checkout.BillToShippingAddress.title"});return r?t(y,{}):t("div",{className:"checkout-bill-to-shipping-address",children:t(b,{checked:e,className:B(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",disabled:s,label:c.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:n})})},y=()=>t(f,{className:"bill-to-shipping-address__skeleton",children:t(A,{variant:"row",size:"small"})}),k=({onChange:i})=>{var g;const[e,r]=v(!0),n=d.value,s=u.value.data,c=u.value.pending,p=!!s,m=!!(s==null?void 0:s.billingAddress),l=(g=s==null?void 0:s.shippingAddresses)==null?void 0:g[0],h=l==null?void 0:l.sameAsBilling;return _(()=>{if(!e||!p)return;r(!1);const o=h??!m;d.value=o,i==null||i(o)},[p,m,h,e,i]),t(w,{checked:n,disabled:c,loading:e,onChange:async o=>{const a=o.target.checked;d.value=a,i==null||i(a),!e&&l&&a&&await S({sameAsShipping:!0}).catch(console.error)}})};k.displayName="BillToShippingAddressContainer";const U=T(k);export{U as BillToShippingAddress,U as default}; diff --git a/scripts/__dropins__/storefront-checkout/containers/EstimateShipping.js b/scripts/__dropins__/storefront-checkout/containers/EstimateShipping.js index 6edbfae2a0..e7470ae97b 100644 --- a/scripts/__dropins__/storefront-checkout/containers/EstimateShipping.js +++ b/scripts/__dropins__/storefront-checkout/containers/EstimateShipping.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as k,Fragment as M,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as A,SkeletonRow as L,Price as g}from"@dropins/tools/components.js";/* empty css */import{VComponent as w,classes as I}from"@dropins/tools/lib.js";import{Text as l,useText as z}from"@dropins/tools/i18n.js";import{useState as B,useEffect as x}from"@dropins/tools/preact-hooks.js";/* empty css */import{a as G,T as C}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as f}from"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";const P=({estimated:e=!1,price:o,priceExclTax:d,taxExcluded:p=!1,taxIncluded:a=!1})=>k(M,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(l,{id:"Checkout.EstimateShipping.estimated"}):t(l,{id:"Checkout.EstimateShipping.label"})}),t(w,{node:o,className:"checkout-estimate-shipping__price"}),a&&t("span",{"data-testid":"shipping-tax-included",className:I(["checkout-estimate-shipping__caption"]),children:t(l,{id:"Checkout.EstimateShipping.withTaxes"})}),p&&k("span",{"data-testid":"shipping-tax-included-excluded",className:I(["checkout-estimate-shipping__caption"]),children:[d," ",t(l,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),U=()=>t(A,{"data-testid":"estimate-shipping-skeleton",children:t(L,{size:"xsmall"})}),W=()=>{const[e,o]=B(),d=e!==void 0,p=(e==null?void 0:e.amount.value)===0,{data:a,pending:_}=G.value,y=_||a===void 0,T=a==null?void 0:a.shoppingCartDisplaySetting.shipping,D=T===C.INCLUDING_EXCLUDING_TAX,E=T===C.INCLUDING_TAX,S=z({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});x(()=>{const i=f.on("shipping/estimate",n=>{const s=n.shippingMethod,{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!0,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),x(()=>{const i=f.on("checkout/initialized",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),x(()=>{const i=f.on("checkout/updated",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]);const N=()=>p?t("span",{"data-testId":"free-shipping",children:S.freeShipping}):E&&(e!=null&&e.amountInclTax)?t(g,{"data-testid":"shipping",amount:e.amountInclTax.value,currency:e.amountInclTax.currency}):t(g,{"data-testid":"shipping",amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency}),v=()=>e!=null&&e.amountExclTax?t(g,{"data-testid":"shipping-excluding-tax",amount:e.amountExclTax.value,currency:e.amountExclTax.currency}):t("span",{children:S.taxToBeDetermined});return t("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:!d||y?t(U,{}):t(P,{estimated:e.estimated,price:N(),taxExcluded:D&&!p,taxIncluded:E&&!p,priceExclTax:v()})})};export{W as EstimateShipping,W as default}; +import{jsxs as k,Fragment as M,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as A,SkeletonRow as L,Price as g}from"@dropins/tools/components.js";/* empty css */import{VComponent as w,classes as I}from"@dropins/tools/lib.js";import{Text as l,useText as z}from"@dropins/tools/i18n.js";import{useState as B,useEffect as x}from"@dropins/tools/preact-hooks.js";/* empty css */import{a as G,T as C}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as f}from"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";const P=({estimated:e=!1,price:o,priceExclTax:d,taxExcluded:p=!1,taxIncluded:a=!1})=>k(M,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(l,{id:"Checkout.EstimateShipping.estimated"}):t(l,{id:"Checkout.EstimateShipping.label"})}),t(w,{node:o,className:"checkout-estimate-shipping__price"}),a&&t("span",{"data-testid":"shipping-tax-included",className:I(["checkout-estimate-shipping__caption"]),children:t(l,{id:"Checkout.EstimateShipping.withTaxes"})}),p&&k("span",{"data-testid":"shipping-tax-included-excluded",className:I(["checkout-estimate-shipping__caption"]),children:[d," ",t(l,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),U=()=>t(A,{"data-testid":"estimate-shipping-skeleton",children:t(L,{size:"xsmall"})}),W=()=>{const[e,o]=B(),d=e!==void 0,p=(e==null?void 0:e.amount.value)===0,{data:a,pending:_}=G.value,D=_||a===void 0,T=a==null?void 0:a.shoppingCartDisplaySetting.shipping,N=T===C.INCLUDING_EXCLUDING_TAX,E=T===C.INCLUDING_TAX,S=z({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});x(()=>{const i=f.on("shipping/estimate",n=>{const s=n.shippingMethod,{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!0,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),x(()=>{const i=f.on("checkout/initialized",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),x(()=>{const i=f.on("checkout/updated",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]);const v=()=>p?t("span",{"data-testId":"free-shipping",children:S.freeShipping}):E&&(e!=null&&e.amountInclTax)?t(g,{"data-testid":"shipping",amount:e.amountInclTax.value,currency:e.amountInclTax.currency}):t(g,{"data-testid":"shipping",amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency}),y=()=>e!=null&&e.amountExclTax?t(g,{"data-testid":"shipping-excluding-tax",amount:e.amountExclTax.value,currency:e.amountExclTax.currency}):t("span",{children:S.taxToBeDetermined});return t("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:!d||D?t(U,{}):t(P,{estimated:e.estimated,price:v(),taxExcluded:N&&!p,taxIncluded:E&&!p,priceExclTax:y()})})};export{W as EstimateShipping,W as default}; diff --git a/scripts/__dropins__/storefront-checkout/containers/LoginForm.js b/scripts/__dropins__/storefront-checkout/containers/LoginForm.js index abbd9fd561..7f6cf78a2d 100644 --- a/scripts/__dropins__/storefront-checkout/containers/LoginForm.js +++ b/scripts/__dropins__/storefront-checkout/containers/LoginForm.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as e,jsxs as s,Fragment as P}from"@dropins/tools/preact-jsx-runtime.js";import{c as w,d as R,s as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as j}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{i as q}from"../chunks/isEmailAvailable.js";import{s as D}from"../chunks/setGuestEmailOnCart.js";import{Field as W,Input as G,Skeleton as U,SkeletonRow as x}from"@dropins/tools/components.js";/* empty css *//* empty css */import{H as J}from"../chunks/Heading.js";import{useText as b,Text as _}from"@dropins/tools/i18n.js";import{useState as p,useRef as K,useEffect as C}from"@dropins/tools/preact-hooks.js";/* empty css */import{w as O}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const Q=({value:t,error:i,hint:g,onChange:h,onBlur:o,onInvalid:u})=>{const m=b({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return e(W,{size:"medium",error:i,hint:g,children:e(G,{"aria-label":m.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:m.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",onBlur:o,onChange:h,onInvalid:u,placeholder:m.LoginFormPlaceholder,required:!0,type:"email",value:t})})},X=({onClick:t})=>s("div",{className:"checkout-login-form__sign-in",children:[e(_,{id:"Checkout.LoginForm.account"}),e("a",{"data-testid":"sign-in-link",className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signIn"})})]}),Y=({className:t,customerDetails:i,email:g,error:h,hint:o,loading:u=!1,name:m,onEmailBlur:f,onEmailChange:k,onEmailInvalid:E,onSignInClick:a,onSignOutClick:F,...L})=>{const l=b({Title:"Checkout.LoginForm.title"});return u?e(Z,{}):s("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[s("div",{className:"checkout-login-form__heading",children:[e(J,{level:2,className:"checkout-login-form__title",children:l.Title}),i?e(S,{onClick:d=>{d.preventDefault(),F==null||F()}}):e(X,{onClick:d=>{d.preventDefault(),a==null||a(g)}})]}),i?s("div",{className:"checkout-login-form__customer-details",children:[e("div",{className:"checkout-login-form__customer-name",children:`${i.firstName} ${i.lastName}`}),e("div",{className:"checkout-login-form__customer-email",children:i.email})]}):e("div",{className:"checkout-login-form__content",children:s("form",{...L,className:j(["dropin-login-form__form",t]),name:m,noValidate:!0,children:[e("button",{type:"submit",disabled:!0,style:"display: none","aria-hidden":"true"}),e(Q,{value:g,error:h,hint:o,onChange:k,onBlur:f,onInvalid:E})]})})]})},Z=()=>s(U,{"data-testid":"login-form-skeleton",children:[e(x,{variant:"heading",fullWidth:!0}),e(x,{size:"medium",fullWidth:!0})]}),S=({onClick:t})=>s("p",{className:"checkout-login-form__sign-out",children:[e(_,{id:"Checkout.LoginForm.switch"}),e("a",{className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signOut"})})]}),ee={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},N=t=>ee.EMAIL.test(t),re=1e3,y=({onSignInClick:t,onSignOutClick:i,initialData:g,...h})=>{const[o,u]=p(""),[m,f]=p(""),[k,E]=p(!0),[a,F]=p(!0),L=K(""),l=w.value.data,d=(l==null?void 0:l.email)||"",v=R.value.data,c=b({LoginFormInvalidEmailError:"Checkout.LoginForm.invalidEmailError",LoginFormMissingEmailError:"Checkout.LoginForm.missingEmailError",LoginFormEmailExistsAlreadyHaveAccount:"Checkout.LoginForm.emailExists.alreadyHaveAccount",LoginFormEmailExistsSignInButton:"Checkout.LoginForm.emailExists.signInButton",LoginFormEmailExistsForFasterCheckout:"Checkout.LoginForm.emailExists.forFasterCheckout"}),A=r=>r.valid?"":r.valueMissing?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,B=r=>N(r)?"":r===""?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,M=r=>{const n=r.target;u(n.value),f(""),E(!0)},T=r=>{const n=r.target;f(B(n.value))},z=r=>{const n=r.target;f(A(n.validity))};C(()=>{!a||!l||(F(!1),u(l.email||""))},[l,a]),C(()=>{if(a||V.authenticated)return;const r=setTimeout(()=>{!N(o)||o===L.current||(L.current=o,q(o).then(n=>{E(n),d!==o&&D(o).catch(console.error)}).catch(n=>{console.error(n),E(!0)}))},re);return()=>{r&&clearTimeout(r)}},[d,o,a]);const I=k?"":s(P,{children:[c.LoginFormEmailExistsAlreadyHaveAccount," ",e("a",{href:"#",onClick:r=>{r.preventDefault(),t==null||t(o)},children:c.LoginFormEmailExistsSignInButton})," ",c.LoginFormEmailExistsForFasterCheckout]}),$=r=>{t==null||t(N(r)?r:"")},H=v?{firstName:v.firstName,lastName:v.lastName,email:v.email}:void 0;return e(Y,{...h,customerDetails:H,email:o,error:m,hint:I,loading:a,onEmailBlur:T,onEmailChange:M,onEmailInvalid:z,onSignInClick:$,onSignOutClick:i})};y.displayName="LoginFormContainer";const ke=O(y);export{ke as LoginForm,ke as default}; +import{jsx as e,jsxs as s,Fragment as P}from"@dropins/tools/preact-jsx-runtime.js";import{s as w}from"../chunks/fetch-graphql.js";import{c as R,b as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as j}from"@dropins/tools/lib.js";import{i as q}from"../chunks/isEmailAvailable.js";import{s as D}from"../chunks/setGuestEmailOnCart.js";import{Field as W,Input as G,Skeleton as U,SkeletonRow as x}from"@dropins/tools/components.js";/* empty css *//* empty css */import{H as J}from"../chunks/Heading.js";import{useText as b,Text as _}from"@dropins/tools/i18n.js";import{useState as p,useRef as K,useEffect as C}from"@dropins/tools/preact-hooks.js";/* empty css */import{w as O}from"../chunks/withConditionalRendering.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const Q=({value:t,error:i,hint:g,onChange:h,onBlur:o,onInvalid:u})=>{const m=b({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return e(W,{size:"medium",error:i,hint:g,children:e(G,{"aria-label":m.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:m.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",onBlur:o,onChange:h,onInvalid:u,placeholder:m.LoginFormPlaceholder,required:!0,type:"email",value:t})})},X=({onClick:t})=>s("div",{className:"checkout-login-form__sign-in",children:[e(_,{id:"Checkout.LoginForm.account"}),e("a",{"data-testid":"sign-in-link",className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signIn"})})]}),Y=({className:t,customerDetails:i,email:g,error:h,hint:o,loading:u=!1,name:m,onEmailBlur:f,onEmailChange:k,onEmailInvalid:E,onSignInClick:a,onSignOutClick:F,...L})=>{const l=b({Title:"Checkout.LoginForm.title"});return u?e(Z,{}):s("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[s("div",{className:"checkout-login-form__heading",children:[e(J,{level:2,className:"checkout-login-form__title",children:l.Title}),i?e(S,{onClick:d=>{d.preventDefault(),F==null||F()}}):e(X,{onClick:d=>{d.preventDefault(),a==null||a(g)}})]}),i?s("div",{className:"checkout-login-form__customer-details",children:[e("div",{className:"checkout-login-form__customer-name",children:`${i.firstName} ${i.lastName}`}),e("div",{className:"checkout-login-form__customer-email",children:i.email})]}):e("div",{className:"checkout-login-form__content",children:s("form",{...L,className:j(["dropin-login-form__form",t]),name:m,noValidate:!0,children:[e("button",{type:"submit",disabled:!0,style:"display: none","aria-hidden":"true"}),e(Q,{value:g,error:h,hint:o,onChange:k,onBlur:f,onInvalid:E})]})})]})},Z=()=>s(U,{"data-testid":"login-form-skeleton",children:[e(x,{variant:"heading",fullWidth:!0}),e(x,{size:"medium",fullWidth:!0})]}),S=({onClick:t})=>s("p",{className:"checkout-login-form__sign-out",children:[e(_,{id:"Checkout.LoginForm.switch"}),e("a",{className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signOut"})})]}),ee={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},N=t=>ee.EMAIL.test(t),re=1e3,y=({onSignInClick:t,onSignOutClick:i,initialData:g,...h})=>{const[o,u]=p(""),[m,f]=p(""),[k,E]=p(!0),[a,F]=p(!0),L=K(""),l=R.value.data,d=(l==null?void 0:l.email)||"",v=V.value.data,c=b({LoginFormInvalidEmailError:"Checkout.LoginForm.invalidEmailError",LoginFormMissingEmailError:"Checkout.LoginForm.missingEmailError",LoginFormEmailExistsAlreadyHaveAccount:"Checkout.LoginForm.emailExists.alreadyHaveAccount",LoginFormEmailExistsSignInButton:"Checkout.LoginForm.emailExists.signInButton",LoginFormEmailExistsForFasterCheckout:"Checkout.LoginForm.emailExists.forFasterCheckout"}),A=r=>r.valid?"":r.valueMissing?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,B=r=>N(r)?"":r===""?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,M=r=>{const n=r.target;u(n.value),f(""),E(!0)},T=r=>{const n=r.target;f(B(n.value))},z=r=>{const n=r.target;f(A(n.validity))};C(()=>{!a||!l||(F(!1),u(l.email||""))},[l,a]),C(()=>{if(a||w.authenticated)return;const r=setTimeout(()=>{!N(o)||o===L.current||(L.current=o,q(o).then(n=>{E(n),d!==o&&D(o).catch(console.error)}).catch(n=>{console.error(n),E(!0)}))},re);return()=>{r&&clearTimeout(r)}},[d,o,a]);const I=k?"":s(P,{children:[c.LoginFormEmailExistsAlreadyHaveAccount," ",e("a",{href:"#",onClick:r=>{r.preventDefault(),t==null||t(o)},children:c.LoginFormEmailExistsSignInButton})," ",c.LoginFormEmailExistsForFasterCheckout]}),$=r=>{t==null||t(N(r)?r:"")},H=v?{firstName:v.firstName,lastName:v.lastName,email:v.email}:void 0;return e(Y,{...h,customerDetails:H,email:o,error:m,hint:I,loading:a,onEmailBlur:T,onEmailChange:M,onEmailInvalid:z,onSignInClick:$,onSignOutClick:i})};y.displayName="LoginFormContainer";const ke=O(y);export{ke as LoginForm,ke as default}; diff --git a/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner.js b/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner.js index 44d9d40533..915e96391d 100644 --- a/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner.js +++ b/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as u,Icon as g}from"@dropins/tools/components.js";import{c as p}from"../chunks/classes.js";import{events as I}from"@dropins/tools/event-bus.js";import*as i from"@dropins/tools/preact-compat.js";import{useState as h,useEffect as v}from"@dropins/tools/preact-compat.js";import{useText as B,Text as M}from"@dropins/tools/i18n.js";const w=t=>i.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 12C0 5.37931 5.37931 0 12 0C18.6207 0 24 5.37931 24 12C24 18.6207 18.6207 24 12 24C5.37931 24 0 18.6207 0 12ZM11.8885 5.06101C11.1405 5.06101 10.5357 5.66579 10.5357 6.4138V6.57295C10.5835 7.27321 11.1882 7.81433 11.8885 7.76658H12.0795C12.7797 7.70292 13.289 7.09815 13.2413 6.4138C13.2413 5.66579 12.6365 5.06101 11.8885 5.06101ZM13.1935 16.8223H14.1007C14.2599 16.8223 14.4031 16.9655 14.4031 17.1247V17.7294C14.4031 17.9045 14.2599 18.0318 14.1007 18.0318H9.8832C9.70813 18.0318 9.58081 17.8886 9.58081 17.7294V17.1247C9.58081 16.9496 9.72405 16.8223 9.8832 16.8223H10.7904V10.7905H9.8832C9.70813 10.7905 9.58081 10.6472 9.58081 10.4881V9.88329C9.58081 9.70823 9.72405 9.58091 9.8832 9.58091H12.5888C12.923 9.58091 13.1935 9.85146 13.1935 10.1857V16.8223Z",fill:"currentColor"})),b=({className:t,initialData:x,...c})=>{const[r,s]=h(0),a=B({mergedCartBannerItems:e(M,{id:"Checkout.MergedCartBanner.items",fields:{count:r},plural:r})});v(()=>{const n=I.on("cart/merged",o=>{var m;const l=(m=o==null?void 0:o.oldCartItems)==null?void 0:m.reduce((d,f)=>d+f.quantity,0);l>0&&s(l)});return()=>{n==null||n.off()}},[]);const C=()=>{s(0)};return r?e(u,{...c,"aria-label":a.mergedCartBannerItems,className:p(["checkout__banner",t]),"data-testid":"merged-cart-banner",icon:e(g,{source:w}),message:e("span",{children:a.mergedCartBannerItems}),onDismiss:C,variant:"neutral"}):null};export{b as MergedCartBanner,b as default}; +import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as g,Icon as u}from"@dropins/tools/components.js";import{c as h}from"../chunks/classes.js";import{events as B}from"@dropins/tools/event-bus.js";import*as l from"@dropins/tools/preact-compat.js";import{useState as I,useEffect as M}from"@dropins/tools/preact-compat.js";import{w as v}from"../chunks/withConditionalRendering.js";import{useText as w,Text as x}from"@dropins/tools/i18n.js";import"../chunks/store-config.js";import"@dropins/tools/signals.js";import"../chunks/ServerErrorSignal.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";const H=t=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 12C0 5.37931 5.37931 0 12 0C18.6207 0 24 5.37931 24 12C24 18.6207 18.6207 24 12 24C5.37931 24 0 18.6207 0 12ZM11.8885 5.06101C11.1405 5.06101 10.5357 5.66579 10.5357 6.4138V6.57295C10.5835 7.27321 11.1882 7.81433 11.8885 7.76658H12.0795C12.7797 7.70292 13.289 7.09815 13.2413 6.4138C13.2413 5.66579 12.6365 5.06101 11.8885 5.06101ZM13.1935 16.8223H14.1007C14.2599 16.8223 14.4031 16.9655 14.4031 17.1247V17.7294C14.4031 17.9045 14.2599 18.0318 14.1007 18.0318H9.8832C9.70813 18.0318 9.58081 17.8886 9.58081 17.7294V17.1247C9.58081 16.9496 9.72405 16.8223 9.8832 16.8223H10.7904V10.7905H9.8832C9.70813 10.7905 9.58081 10.6472 9.58081 10.4881V9.88329C9.58081 9.70823 9.72405 9.58091 9.8832 9.58091H12.5888C12.923 9.58091 13.1935 9.85146 13.1935 10.1857V16.8223Z",fill:"currentColor"})),C=({className:t,initialData:V,...c})=>{const[r,a]=I(0),i=w({mergedCartBannerItems:e(x,{id:"Checkout.MergedCartBanner.items",fields:{count:r},plural:r})});M(()=>{const n=B.on("cart/merged",o=>{var m;const s=(m=o==null?void 0:o.oldCartItems)==null?void 0:m.reduce((f,p)=>f+p.quantity,0);s>0&&a(s)});return()=>{n==null||n.off()}},[]);const d=()=>{a(0)};return r?e(g,{...c,"aria-label":i.mergedCartBannerItems,className:h(["checkout__banner",t]),"data-testid":"merged-cart-banner",icon:e(u,{source:H}),message:e("span",{children:i.mergedCartBannerItems}),onDismiss:d,variant:"neutral"}):null};C.displayName="MergedCartBannerContainer";const A=v(C);export{A as MergedCartBanner,A as default}; diff --git a/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner/MergedCartBanner.d.ts b/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner/MergedCartBanner.d.ts index a7d248a0b8..a8e6efdc4e 100644 --- a/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner/MergedCartBanner.d.ts +++ b/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner/MergedCartBanner.d.ts @@ -1,5 +1,7 @@ import { AlertBannerProps } from '@dropins/tools/types/elsie/src/components'; -import { Container } from '@dropins/tools/types/elsie/src/lib/types'; -export declare const MergedCartBanner: Container; +export declare const MergedCartBanner: { + ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs').ConditionalProps & AlertBannerProps): import("preact/compat").JSX.Element; + displayName: string; +}; //# sourceMappingURL=MergedCartBanner.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner/index.d.ts b/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner/index.d.ts index 23c88520d5..aa90d286e1 100644 --- a/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner/index.d.ts +++ b/scripts/__dropins__/storefront-checkout/containers/MergedCartBanner/index.d.ts @@ -1,19 +1,19 @@ /******************************************************************** -* ADOBE CONFIDENTIAL -* __________________ -* -* Copyright 2024 Adobe -* All Rights Reserved. -* -* NOTICE: All information contained herein is, and remains -* the property of Adobe and its suppliers, if any. The intellectual -* and technical concepts contained herein are proprietary to Adobe -* and its suppliers and are protected by all applicable intellectual -* property laws, including trade secret and copyright laws. -* Dissemination of this information or reproduction of this material -* is strictly forbidden unless prior written permission is obtained -* from Adobe. -*******************************************************************/ + * ADOBE CONFIDENTIAL + * __________________ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + *******************************************************************/ export * from './MergedCartBanner'; export { MergedCartBanner as default } from './MergedCartBanner'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-checkout/containers/OrderConfirmationHeader.js b/scripts/__dropins__/storefront-checkout/containers/OrderConfirmationHeader.js index 8688673815..f474c76133 100644 --- a/scripts/__dropins__/storefront-checkout/containers/OrderConfirmationHeader.js +++ b/scripts/__dropins__/storefront-checkout/containers/OrderConfirmationHeader.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as t,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Icon as E,Button as y,Skeleton as A,SkeletonRow as n}from"@dropins/tools/components.js";/* empty css */import"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";/* empty css */import*as o from"@dropins/tools/preact-compat.js";import{useState as C,useEffect as N}from"@dropins/tools/preact-compat.js";import{Text as l}from"@dropins/tools/i18n.js";import{s as f}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"../chunks/fetch-graphql.js";import{i as b}from"../chunks/isEmailAvailable.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";function p(e){var r;return{region:{region_id:e!=null&&e.regionId?Number(e==null?void 0:e.regionId):null,region:e==null?void 0:e.region},city:e==null?void 0:e.city,company:e==null?void 0:e.company,country_code:e==null?void 0:e.country,firstname:e==null?void 0:e.firstName,lastname:e==null?void 0:e.lastName,middlename:e==null?void 0:e.middleName,postcode:e==null?void 0:e.postCode,street:e==null?void 0:e.street,telephone:e==null?void 0:e.telephone,custom_attributesV2:((r=e==null?void 0:e.customAttributes)==null?void 0:r.map(c=>({attribute_code:c.code,value:c.value})))||[]}}const z=e=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},o.createElement("g",{clipPath:"url(#clip0_4797_15077)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.15 20.85L1.5 17.53V6.63L10.15 10V20.85Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.63001L10.15 3.20001L18.8 6.63001L10.15 10L1.5 6.63001Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.17969 4.77002L14.8297 8.15002V11.47",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.7896 12.64V6.63L10.1396 10V20.85L14.8296 19.05",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M15.71 17.26C15.71 15.38 17.23 13.86 19.11 13.86C20.99 13.86 22.51 15.38 22.51 17.26C22.51 19.14 20.99 20.66 19.11 20.66C17.23 20.66 15.71 19.14 15.71 17.26Z",stroke:"currentColor"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M17.4805 17.49L18.5605 18.41L20.7205 16.33",stroke:"currentColor",strokeLinecap:"square",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15077"},o.createElement("rect",{width:22,height:18.65,fill:"white",transform:"translate(1 2.70001)"})))),V=({customerName:e,isLoading:r,orderNumber:c,onSignUpClick:m})=>r?t(w,{}):h("div",{className:"order-confirmation-header order-confirmation__card",children:[t(E,{source:z,size:"64",className:"order-confirmation-header__icon"}),t("h1",{className:"order-confirmation-header__title",children:e?t(l,{id:"Checkout.OrderConfirmationHeader.title",fields:{name:e}}):t(l,{id:"Checkout.OrderConfirmationHeader.defaultTitle"})}),c&&t("p",{className:"order-confirmation-header__order",children:t(l,{id:"Checkout.OrderConfirmationHeader.order",fields:{order:c}})}),m&&h("div",{className:"order-confirmation-create-account",children:[t("p",{className:"order-confirmation-create-account__message",children:t(l,{id:"Checkout.OrderConfirmationHeader.CreateAccount.message"})}),t(y,{"data-testid":"create-account-button",className:"order-confirmation-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:m,children:t(l,{id:"Checkout.OrderConfirmationHeader.CreateAccount.button"})})]})]}),w=()=>h(A,{"data-testid":"order-confirmation-header-skeleton",className:"order-confirmation-header",children:[t(n,{variant:"empty",size:"xlarge",fullWidth:!0}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{size:"small",fullWidth:!0}),t(n,{variant:"heading",size:"xsmall",fullWidth:!0})]}),J=({orderData:e,onSignUpClick:r})=>{var g;const[c,m]=C(!f.authenticated),[v,s]=C();N(()=>{f.authenticated||b(e.email).then(a=>s(!a)).catch(()=>s(!0)).finally(()=>m(!1))},[e.email]);const _=r&&!f.authenticated&&v===!1?()=>{const a=e.shippingAddress,i=e.billingAddress,L=[{code:"firstname",defaultValue:(i==null?void 0:i.firstName)||""},{code:"lastname",defaultValue:(i==null?void 0:i.lastName)||""},{code:"email",defaultValue:e.email||""}];let u;if(a){const k={...p(a),default_shipping:!0};u=[{...p(i),default_billing:!0},k]}else u=[{...p(i),default_billing:!0,default_shipping:!0}];r({inputsDefaultValueSet:L,addressesData:u})}:void 0;return t("div",{children:t(V,{customerName:(g=e.billingAddress)==null?void 0:g.firstName,isLoading:c,onSignUpClick:_,orderNumber:e.number})})};export{J as OrderConfirmationHeader,J as default}; +import{jsx as t,jsxs as s}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Icon as A,Button as E,Skeleton as y,SkeletonRow as n}from"@dropins/tools/components.js";/* empty css */import"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{H as N}from"../chunks/Heading.js";import*as o from"@dropins/tools/preact-compat.js";import{useState as C,useEffect as b}from"@dropins/tools/preact-compat.js";import{useText as H,Text as v}from"@dropins/tools/i18n.js";import{s as f}from"../chunks/fetch-graphql.js";import"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{i as z}from"../chunks/isEmailAvailable.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";function p(e){var r;return{region:{region_id:e!=null&&e.regionId?Number(e==null?void 0:e.regionId):null,region:e==null?void 0:e.region},city:e==null?void 0:e.city,company:e==null?void 0:e.company,country_code:e==null?void 0:e.country,firstname:e==null?void 0:e.firstName,lastname:e==null?void 0:e.lastName,middlename:e==null?void 0:e.middleName,postcode:e==null?void 0:e.postCode,street:e==null?void 0:e.street,telephone:e==null?void 0:e.telephone,custom_attributesV2:((r=e==null?void 0:e.customAttributes)==null?void 0:r.map(c=>({attribute_code:c.code,value:c.value})))||[]}}const V=e=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},o.createElement("g",{clipPath:"url(#clip0_4797_15077)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.15 20.85L1.5 17.53V6.63L10.15 10V20.85Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.63001L10.15 3.20001L18.8 6.63001L10.15 10L1.5 6.63001Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.17969 4.77002L14.8297 8.15002V11.47",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.7896 12.64V6.63L10.1396 10V20.85L14.8296 19.05",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M15.71 17.26C15.71 15.38 17.23 13.86 19.11 13.86C20.99 13.86 22.51 15.38 22.51 17.26C22.51 19.14 20.99 20.66 19.11 20.66C17.23 20.66 15.71 19.14 15.71 17.26Z",stroke:"currentColor"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M17.4805 17.49L18.5605 18.41L20.7205 16.33",stroke:"currentColor",strokeLinecap:"square",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15077"},o.createElement("rect",{width:22,height:18.65,fill:"white",transform:"translate(1 2.70001)"})))),w=({customerName:e,isLoading:r,orderNumber:c,onSignUpClick:a})=>{const l=H({title:t(v,{id:"Checkout.OrderConfirmationHeader.title",fields:{name:e}}),defaultTitle:"Checkout.OrderConfirmationHeader.defaultTitle",order:t(v,{id:"Checkout.OrderConfirmationHeader.order",fields:{order:c}}),createAccountMessage:"Checkout.OrderConfirmationHeader.CreateAccount.message",createAccountButton:"Checkout.OrderConfirmationHeader.CreateAccount.button"});return r?t(x,{}):s("div",{className:"order-confirmation-header order-confirmation__card",children:[t(A,{source:V,size:"64",className:"order-confirmation-header__icon"}),t(N,{level:1,className:"order-confirmation-header__title",children:e?l.title:l.defaultTitle}),c&&t("p",{className:"order-confirmation-header__order",children:l.order}),a&&s("div",{className:"order-confirmation-create-account",children:[t("p",{className:"order-confirmation-create-account__message",children:l.createAccountMessage}),t(E,{"data-testid":"create-account-button",className:"order-confirmation-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:a,children:l.createAccountButton})]})]})},x=()=>s(y,{"data-testid":"order-confirmation-header-skeleton",className:"order-confirmation-header",children:[t(n,{variant:"empty",size:"xlarge",fullWidth:!0}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{size:"small",fullWidth:!0}),t(n,{variant:"heading",size:"xsmall",fullWidth:!0})]}),U=({orderData:e,onSignUpClick:r})=>{var g;const[c,a]=C(!f.authenticated),[l,h]=C();b(()=>{f.authenticated||z(e.email).then(m=>h(!m)).catch(()=>h(!0)).finally(()=>a(!1))},[e.email]);const _=r&&!f.authenticated&&l===!1?()=>{const m=e.shippingAddress,i=e.billingAddress,L=[{code:"firstname",defaultValue:(i==null?void 0:i.firstName)||""},{code:"lastname",defaultValue:(i==null?void 0:i.lastName)||""},{code:"email",defaultValue:e.email||""}];let u;if(m){const k={...p(m),default_shipping:!0};u=[{...p(i),default_billing:!0},k]}else u=[{...p(i),default_billing:!0,default_shipping:!0}];r({inputsDefaultValueSet:L,addressesData:u})}:void 0;return t("div",{children:t(w,{customerName:(g=e.billingAddress)==null?void 0:g.firstName,isLoading:c,onSignUpClick:_,orderNumber:e.number})})};export{U as OrderConfirmationHeader,U as default}; diff --git a/scripts/__dropins__/storefront-checkout/containers/OutOfStock.js b/scripts/__dropins__/storefront-checkout/containers/OutOfStock.js index 3f4f5a4f4a..d3cb768909 100644 --- a/scripts/__dropins__/storefront-checkout/containers/OutOfStock.js +++ b/scripts/__dropins__/storefront-checkout/containers/OutOfStock.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as n,jsx as e}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Card as k,Icon as l,Image as h}from"@dropins/tools/components.js";/* empty css */import{classes as O}from"@dropins/tools/lib.js";import{S as d}from"../chunks/OrderError.js";import{useText as S}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{events as p}from"@dropins/tools/event-bus.js";import{useState as v,useCallback as _,useEffect as g}from"@dropins/tools/preact-compat.js";const N=({className:i,items:r,onRemoveOutOfStock:o,routeCart:a,...m})=>{const s=S({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return n(k,{className:O(["checkout-out-of-stock",i]),"data-testid":"checkout-out-of-stock",variant:"secondary",...m,children:[n("h4",{className:"checkout-out-of-stock__title",children:[e(l,{source:d,size:"16",stroke:"1"}),s.title]}),e("p",{className:"checkout-out-of-stock__message",children:s.message}),e("ol",{className:"checkout-out-of-stock__items",children:r.map(u=>e("li",{"data-testid":"out-of-stock-item",className:"checkout-out-of-stock__item",children:e(h,{loading:"eager",src:u.image.src,alt:u.image.alt,width:"100",height:"100",params:{width:100}})},u.sku))}),n("div",{className:"checkout-out-of-stock__actions",children:[a&&e("a",{"data-testid":"review-cart",className:"checkout-out-of-stock__action",href:a,children:s.reviewCart}),o&&e("button",{className:"checkout-out-of-stock__action","data-testid":"remove-out-of-stock",type:"button",onClick:o,children:s.removeOutOfStock})]})]})},z=({onCartProductsUpdate:i,routeCart:r})=>{const[o,a]=v([]),m=t=>t.outOfStock||t.insufficientQuantity,s=_(()=>{if(!i)return;const t=o.filter(c=>c.outOfStock).map(c=>({uid:c.uid,quantity:0}));i(t)},[o,i]);if(g(()=>{const t=p.on("cart/data",c=>{const f=(c==null?void 0:c.items)||[];a(f.filter(m))},{eager:!0});return()=>{t==null||t.off()}},[]),o.length===0)return null;const u=!o.some(t=>t.insufficientQuantity);return e(N,{items:o,onRemoveOutOfStock:u?s:void 0,routeCart:r==null?void 0:r()})};export{z as OutOfStock,z as default}; +import{jsxs as n,jsx as e}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Card as k,Icon as l,Image as h}from"@dropins/tools/components.js";/* empty css */import{classes as O}from"@dropins/tools/lib.js";import{H as d}from"../chunks/Heading.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{S as p}from"../chunks/OrderError.js";import{useText as S}from"@dropins/tools/i18n.js";import{events as v}from"@dropins/tools/event-bus.js";import{useState as g,useCallback as _,useEffect as N}from"@dropins/tools/preact-compat.js";const w=({className:i,items:r,onRemoveOutOfStock:o,routeCart:a,...m})=>{const s=S({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return n(k,{className:O(["checkout-out-of-stock",i]),"data-testid":"checkout-out-of-stock",variant:"secondary",...m,children:[n(d,{level:4,className:"checkout-out-of-stock__title",children:[e(l,{source:p,size:"16",stroke:"1"}),s.title]}),e("p",{className:"checkout-out-of-stock__message",children:s.message}),e("ol",{className:"checkout-out-of-stock__items",children:r.map(u=>e("li",{"data-testid":"out-of-stock-item",className:"checkout-out-of-stock__item",children:e(h,{loading:"eager",src:u.image.src,alt:u.image.alt,width:"100",height:"100",params:{width:100}})},u.sku))}),n("div",{className:"checkout-out-of-stock__actions",children:[a&&e("a",{"data-testid":"review-cart",className:"checkout-out-of-stock__action",href:a,children:s.reviewCart}),o&&e("button",{className:"checkout-out-of-stock__action","data-testid":"remove-out-of-stock",type:"button",onClick:o,children:s.removeOutOfStock})]})]})},T=({onCartProductsUpdate:i,routeCart:r})=>{const[o,a]=g([]),m=t=>t.outOfStock||t.insufficientQuantity,s=_(()=>{if(!i)return;const t=o.filter(c=>c.outOfStock).map(c=>({uid:c.uid,quantity:0}));i(t)},[o,i]);if(N(()=>{const t=v.on("cart/data",c=>{const f=(c==null?void 0:c.items)||[];a(f.filter(m))},{eager:!0});return()=>{t==null||t.off()}},[]),o.length===0)return null;const u=!o.some(t=>t.insufficientQuantity);return e(w,{items:o,onRemoveOutOfStock:u?s:void 0,routeCart:r==null?void 0:r()})};export{T as OutOfStock,T as default}; diff --git a/scripts/__dropins__/storefront-checkout/containers/PaymentMethods.js b/scripts/__dropins__/storefront-checkout/containers/PaymentMethods.js index 18c49e9f2d..cdb8709842 100644 --- a/scripts/__dropins__/storefront-checkout/containers/PaymentMethods.js +++ b/scripts/__dropins__/storefront-checkout/containers/PaymentMethods.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as n,jsxs as M,Fragment as R}from"@dropins/tools/preact-jsx-runtime.js";import{c as C,s as D}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as H,Slot as L}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{s as $}from"../chunks/setPaymentMethod.js";/* empty css */import{IllustratedMessage as B,Icon as U,ProgressSpinner as Z,ToggleButton as F,Skeleton as q,SkeletonRow as y}from"@dropins/tools/components.js";/* empty css */import{H as G}from"../chunks/Heading.js";import{useRef as J}from"@dropins/tools/preact-hooks.js";/* empty css */import*as g from"@dropins/tools/preact-compat.js";import{useState as S,useCallback as T,useEffect as w}from"@dropins/tools/preact-compat.js";import{useText as K}from"@dropins/tools/i18n.js";import{w as Q}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const X=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Y=({code:e,loading:a,selected:r,onChange:d,title:h})=>n(F,{className:"checkout-payment-methods__method",label:h,name:"payment-method",value:e,selected:r,onChange:d,busy:a}),ee=({className:e,paymentMethodContent:a,loading:r=!1,initializing:d=!1,onChange:h=()=>{},options:s,selection:k})=>{const o=K({Title:"Checkout.PaymentMethods.title",EmptyState:"Checkout.PaymentMethods.emptyState"});return d?n(te,{}):M("div",{className:H(["checkout-payment-methods",e]),children:[n(G,{level:2,className:"checkout-payment-methods__title",children:o.Title}),!r&&s.length===0&&n(B,{icon:n(U,{source:X}),message:n("p",{children:o.EmptyState})}),M("div",{className:H(["checkout-payment-methods__wrapper"]),children:[r&&n(Z,{className:"checkout-payment-methods__spinner"}),n("div",{className:H(["checkout-payment-methods__methods",["checkout-payment-methods--loading",r],["checkout-payment-methods--full-width",s.length%2!==0]]),children:s==null?void 0:s.map(i=>n(Y,{code:i.code,onChange:h,selected:i.code===k,title:i.title},i.code))}),a&&n("div",{className:"checkout-payment-methods__content",children:a})]})]})},te=()=>M(q,{"data-testid":"payment-methods-skeleton",children:[n(y,{variant:"heading",size:"medium"}),n(y,{variant:"empty",size:"medium"}),n(y,{size:"xlarge",fullWidth:!0}),n(y,{size:"xlarge",fullWidth:!0})]}),N={free:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)},checkmo:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)}},ne=(e,a)=>{const r=J(e);return a(r.current,e)||(r.current=e),r.current},V=({slots:e})=>{var x,_;const[a,r]=S(),[d,h]=S(N),[s,k]=S(!0),o=C.value.data,i=!!C.value.data,W=C.value.pending,j=(o==null?void 0:o.isVirtual)??!1,z=(x=o==null?void 0:o.shippingAddresses)==null?void 0:x[0],A=(o==null?void 0:o.availablePaymentMethods)||[],l=(_=o==null?void 0:o.selectedPaymentMethod)==null?void 0:_.code,E=j?!0:!!z,m=ne(A,(t,c)=>t.length!==c.length?!1:t.every((p,v)=>p.code===c[v].code)),u=T(t=>{r(t),!(!t||!E)&&t!==l&&$(t).catch(console.error)},[E,l]);w(()=>{if(!i)return;if(!!!(m!=null&&m.length)){u(void 0);return}const c=m[0].code;if(!l){u(c);return}const p=m.some(v=>v.code===l);u(p?l:c)},[m,i,l,u]);const I=t=>{u(t)},b=T((t,c)=>{if(!t){console.warn("Payment method handler is ignored because it has no code");return}if(!c){console.warn("Payment method handler is ignored because it is empty");return}h(p=>({...p,[t]:c}))},[]);w(()=>{e!=null&&e.Handlers&&Object.entries(e.Handlers).forEach(([t,c])=>{b(t,c)})},[b,e==null?void 0:e.Handlers]);const f=e!=null&&e.Main?n(L,{name:"PaymentMethods",slot:e==null?void 0:e.Main,context:{replaceHTML(t){this.replaceWith(t),k(!1)}}}):null,P=a?d[a]:null,O=P?n(L,{name:"PaymentMethodContent",slot:P,context:{cartId:D.cartId||"",replaceHTML(t){this.replaceWith(t)}}},P):void 0;return w(()=>{!s&&d!=N&&console.warn("Payment method handlers you have added are ignored because the default content has been replaced")},[s,d]),M(R,{children:[f&&n(f.type,{ref:f.ref,...f.props}),s&&n(ee,{initializing:i===!1,loading:i&&W,onChange:I,options:m,paymentMethodContent:O,selection:a})]})};V.displayName="PaymentMethodsContainer";const He=Q(V);export{He as PaymentMethods,He as default}; +import{jsx as n,jsxs as M,Fragment as R}from"@dropins/tools/preact-jsx-runtime.js";import{s as D}from"../chunks/fetch-graphql.js";import{c as C}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as H,Slot as L}from"@dropins/tools/lib.js";import{s as $}from"../chunks/setPaymentMethod.js";/* empty css */import{IllustratedMessage as B,Icon as U,ProgressSpinner as Z,ToggleButton as F,Skeleton as q,SkeletonRow as y}from"@dropins/tools/components.js";/* empty css */import{H as G}from"../chunks/Heading.js";import{useRef as J}from"@dropins/tools/preact-hooks.js";/* empty css */import*as g from"@dropins/tools/preact-compat.js";import{useState as S,useCallback as T,useEffect as w}from"@dropins/tools/preact-compat.js";import{useText as K}from"@dropins/tools/i18n.js";import{w as Q}from"../chunks/withConditionalRendering.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const X=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Y=({code:e,loading:a,selected:r,onChange:d,title:h})=>n(F,{className:"checkout-payment-methods__method",label:h,name:"payment-method",value:e,selected:r,onChange:d,busy:a}),ee=({className:e,paymentMethodContent:a,loading:r=!1,initializing:d=!1,onChange:h=()=>{},options:c,selection:k})=>{const o=K({Title:"Checkout.PaymentMethods.title",EmptyState:"Checkout.PaymentMethods.emptyState"});return d?n(te,{}):M("div",{className:H(["checkout-payment-methods",e]),children:[n(G,{level:2,className:"checkout-payment-methods__title",children:o.Title}),!r&&c.length===0&&n(B,{icon:n(U,{source:X}),message:n("p",{children:o.EmptyState})}),M("div",{className:H(["checkout-payment-methods__wrapper"]),children:[r&&n(Z,{className:"checkout-payment-methods__spinner"}),n("div",{className:H(["checkout-payment-methods__methods",["checkout-payment-methods--loading",r],["checkout-payment-methods--full-width",c.length%2!==0]]),children:c==null?void 0:c.map(i=>n(Y,{code:i.code,onChange:h,selected:i.code===k,title:i.title},i.code))}),a&&n("div",{className:"checkout-payment-methods__content",children:a})]})]})},te=()=>M(q,{"data-testid":"payment-methods-skeleton",children:[n(y,{variant:"heading",size:"medium"}),n(y,{variant:"empty",size:"medium"}),n(y,{size:"xlarge",fullWidth:!0}),n(y,{size:"xlarge",fullWidth:!0})]}),N={free:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)},checkmo:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)}},ne=(e,a)=>{const r=J(e);return a(r.current,e)||(r.current=e),r.current},V=({slots:e})=>{var x,_;const[a,r]=S(),[d,h]=S(N),[c,k]=S(!0),o=C.value.data,i=!!C.value.data,W=C.value.pending,j=(o==null?void 0:o.isVirtual)??!1,z=(x=o==null?void 0:o.shippingAddresses)==null?void 0:x[0],A=(o==null?void 0:o.availablePaymentMethods)||[],l=(_=o==null?void 0:o.selectedPaymentMethod)==null?void 0:_.code,E=j?!0:!!z,m=ne(A,(t,s)=>t.length!==s.length?!1:t.every((p,v)=>p.code===s[v].code)),u=T(t=>{r(t),!(!t||!E)&&t!==l&&$(t).catch(console.error)},[E,l]);w(()=>{if(!i)return;if(!!!(m!=null&&m.length)){u(void 0);return}const s=m[0].code;if(!l){u(s);return}const p=m.some(v=>v.code===l);u(p?l:s)},[m,i,l,u]);const I=t=>{u(t)},b=T((t,s)=>{if(!t){console.warn("Payment method handler is ignored because it has no code");return}if(!s){console.warn("Payment method handler is ignored because it is empty");return}h(p=>({...p,[t]:s}))},[]);w(()=>{e!=null&&e.Handlers&&Object.entries(e.Handlers).forEach(([t,s])=>{b(t,s)})},[b,e==null?void 0:e.Handlers]);const f=e!=null&&e.Main?n(L,{name:"PaymentMethods",slot:e==null?void 0:e.Main,context:{replaceHTML(t){this.replaceWith(t),k(!1)}}}):null,P=a?d[a]:null,O=P?n(L,{name:"PaymentMethodContent",slot:P,context:{cartId:D.cartId||"",replaceHTML(t){this.replaceWith(t)}}},P):void 0;return w(()=>{!c&&d!=N&&console.warn("Payment method handlers you have added are ignored because the default content has been replaced")},[c,d]),M(R,{children:[f&&n(f.type,{ref:f.ref,...f.props}),c&&n(ee,{initializing:i===!1,loading:i&&W,onChange:I,options:m,paymentMethodContent:O,selection:a})]})};V.displayName="PaymentMethodsContainer";const He=Q(V);export{He as PaymentMethods,He as default}; diff --git a/scripts/__dropins__/storefront-checkout/containers/PlaceOrder.js b/scripts/__dropins__/storefront-checkout/containers/PlaceOrder.js index ec6ffca1d9..f4b5b8ee0c 100644 --- a/scripts/__dropins__/storefront-checkout/containers/PlaceOrder.js +++ b/scripts/__dropins__/storefront-checkout/containers/PlaceOrder.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{c as x}from"../chunks/store-config.js";import{s as E}from"../chunks/ServerErrorSignal.js";import{events as g}from"@dropins/tools/event-bus.js";import{classes as u}from"@dropins/tools/lib.js";import{U as P}from"../chunks/fetch-graphql.js";import{p as v}from"../chunks/placeOrder2.js";/* empty css */import{Button as S}from"@dropins/tools/components.js";import{Text as b,useText as U}from"@dropins/tools/i18n.js";import{w}from"../chunks/withConditionalRendering.js";import{useState as T,useCallback as l,useEffect as z}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const H=({className:e,onClick:t,disabled:n=!1})=>s("div",{className:u(["checkout-place-order",e]),children:s(S,{className:u(["checkout-place-order__button",e]),"data-testid":"place-order-button",disabled:n,onClick:t,size:"medium",type:"submit",variant:"primary",children:s(b,{id:"Checkout.PlaceOrder.button"})},"placeOrder")}),I=e=>e instanceof TypeError||e instanceof P,f=({handleValidation:e,onPlaceOrder:t})=>{var d;const[n,h]=T(!1),{data:c,pending:O}=x.value,k=!!c,a=((d=c==null?void 0:c.selectedPaymentMethod)==null?void 0:d.code)||"",i=U({CheckoutUnexpectedError:"Checkout.ServerError.unexpected"}),m=l(r=>{const o=I(r)?i.CheckoutUnexpectedError:r.message;E.value=o},[i]),C=l(async()=>{try{if(!(e?e():!0))return;t?await t({code:a}):await v()}catch(r){m(r)}},[e,t,a,m]);return z(()=>{const r=g.on("cart/initialized",o=>{const y=(o==null?void 0:o.items)||[];h(y.some(p=>p.outOfStock||p.insufficientQuantity))},{eager:!0});return()=>{r==null||r.off()}},[]),s(H,{onClick:C,disabled:!k||O||n})};f.displayName="PlaceOrderContainer";const W=w(f);export{W as PlaceOrder,W as default}; +import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{U as y}from"../chunks/fetch-graphql.js";import{c as E}from"../chunks/store-config.js";import{s as P}from"../chunks/ServerErrorSignal.js";import{events as g}from"@dropins/tools/event-bus.js";import{classes as l}from"@dropins/tools/lib.js";import{p as v}from"../chunks/placeOrder2.js";/* empty css */import{Button as S}from"@dropins/tools/components.js";import{Text as b,useText as U}from"@dropins/tools/i18n.js";import{w}from"../chunks/withConditionalRendering.js";import{useState as T,useCallback as u,useEffect as z}from"@dropins/tools/preact-compat.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const H=({className:e,onClick:t,disabled:s=!1})=>c("div",{className:l(["checkout-place-order",e]),children:c(S,{className:l(["checkout-place-order__button",e]),"data-testid":"place-order-button",disabled:s,onClick:t,size:"medium",type:"submit",variant:"primary",children:c(b,{id:"Checkout.PlaceOrder.button"})},"placeOrder")}),I=e=>e instanceof TypeError||e instanceof y,f=({handleValidation:e,onPlaceOrder:t})=>{var d;const[s,h]=T(!1),{data:o,pending:O}=E.value,k=!!o,a=((d=o==null?void 0:o.selectedPaymentMethod)==null?void 0:d.code)||"",i=U({CheckoutUnexpectedError:"Checkout.ServerError.unexpected"}),m=u(r=>{P.value=I(r)?i.CheckoutUnexpectedError:r.message},[i]),C=u(async()=>{try{if(!(e?e():!0))return;t?await t({code:a}):await v()}catch(r){m(r)}},[e,t,a,m]);return z(()=>{const r=g.on("cart/initialized",n=>{const x=(n==null?void 0:n.items)||[];h(x.some(p=>p.outOfStock||p.insufficientQuantity))},{eager:!0});return()=>{r==null||r.off()}},[]),c(H,{onClick:C,disabled:!k||O||s})};f.displayName="PlaceOrderContainer";const W=w(f);export{W as PlaceOrder,W as default}; diff --git a/scripts/__dropins__/storefront-checkout/containers/ShippingMethods.js b/scripts/__dropins__/storefront-checkout/containers/ShippingMethods.js index 16b00e3bde..645917dbe2 100644 --- a/scripts/__dropins__/storefront-checkout/containers/ShippingMethods.js +++ b/scripts/__dropins__/storefront-checkout/containers/ShippingMethods.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as i,jsxs as L,Fragment as z}from"@dropins/tools/preact-jsx-runtime.js";import{b as v,e as M,c as W,a as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as T}from"@dropins/tools/event-bus.js";import{classes as j,Slot as A}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{s as O}from"../chunks/setShippingMethods.js";/* empty css */import{IllustratedMessage as P,Icon as Z,ProgressSpinner as $,RadioButton as q,Price as F,Skeleton as G,SkeletonRow as _}from"@dropins/tools/components.js";/* empty css */import{H as J}from"../chunks/Heading.js";import{useState as I,useEffect as S}from"@dropins/tools/preact-hooks.js";/* empty css */import*as p from"@dropins/tools/preact-compat.js";import{useCallback as K,useMemo as Q,useEffect as X}from"@dropins/tools/preact-compat.js";import{useText as Y}from"@dropins/tools/i18n.js";import{w as D}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const U=e=>({countryCode:e.country_id,postCode:e.postcode||"",...e.region_id?{regionId:Number(e.region_id)}:{...e.region?{region:e.region}:{}}}),ee=e=>({carrierCode:e.carrier.code||"",methodCode:e.code||"",amount:e.amount,amountExclTax:e.amountExclTax,amountInclTax:e.amountInclTax}),te=e=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.47266 4.90002H15.1851V10.9645H21.2495L23 12.715V17.6124H20.073",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76151 16.7898C9.76151 18.0525 8.72845 19.076 7.46582 19.076C6.20318 19.076 5.17969 18.0429 5.17969 16.7803C5.17969 15.5176 6.20318 14.4941 7.46582 14.4941C8.72845 14.4941 9.75195 15.5176 9.76151 16.7803C9.76151 16.7803 9.76151 16.7803 9.76151 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8726 16.7898C19.8726 18.062 18.8491 19.0855 17.5769 19.0855C16.3047 19.0855 15.2812 18.062 15.2812 16.7898C15.2812 15.5176 16.3047 14.4941 17.5769 14.4941C18.8491 14.4941 19.8726 15.5176 19.8726 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),oe=({className:e,isLoading:t=!1,onSelectionChange:o=()=>{},options:s,selection:u,...a})=>{const c=Y({Title:"Checkout.ShippingMethods.title",EmptyState:"Checkout.ShippingMethods.emptyState"});return s===void 0?i(ne,{}):L("div",{...a,className:j(["checkout-shipping-methods",e]),children:[i(J,{level:3,className:"checkout-shipping-methods__title",children:c.Title}),!t&&s.length===0&&i(P,{icon:i(Z,{source:te}),message:i("p",{children:c.EmptyState})}),L("div",{className:j(["checkout-shipping-methods__content"]),children:[t&&i($,{className:"checkout-shipping-methods__spinner"}),i("div",{className:j(["checkout-shipping-methods__options",["checkout-shipping-methods__options--loading",t]]),children:s.map(n=>i(q,{"data-testid":"shipping-method-radiobutton","aria-busy":t,id:n.value,name:"shipping-method",className:"checkout-shipping-methods__method",label:L(z,{children:[i(F,{amount:n.amount.value,currency:n.amount.currency})," ",i("span",{children:n.carrier.title})]}),description:n.title,value:n.value,checked:(u==null?void 0:u.value)===n.value,onChange:()=>o(n)},n.value))})]})]})},ne=()=>L(G,{"data-testid":"shipping-methods-skeleton",children:[i(_,{variant:"heading",size:"small"}),i(_,{variant:"empty",size:"small"}),i(_,{size:"medium",fullWidth:!0}),i(_,{size:"medium",fullWidth:!0})]});function ie(){var C;const[e,t]=I(),[o,s]=I();S(()=>{T.on("checkout/estimate-shipping-address",({address:x,isValid:g})=>{t({address:x,isValid:g})})},[]),S(()=>{s(v.value)},[v.value]),S(()=>{M.value.pending?s(void 0):s(v.value)},[M.value.pending]);const{country_id:u,region_id:a,region:c,postcode:n}=(e==null?void 0:e.address)||{},f=!!e,r=W.value.data,k=!!((C=r==null?void 0:r.shippingAddresses)!=null&&C[0]),l=e==null?void 0:e.isValid;S(()=>{k||l||!o||!f||T.emit("shipping/estimate",{address:U({country_id:u,region_id:a,region:c,postcode:n}),shippingMethod:ee(o)})},[o,u,a,c,n,f,k,l])}const H=(e,t)=>e.code===t.code&&e.carrier.code===t.carrier.code;function re({onCheckoutDataUpdate:e,preSelectedMethod:t,onShippingMethodSelect:o}){const u=!V.value.data,a=W.value.data,c=W.value.pending,n=M.value.data,f=M.value.pending,r=v.value,k=a==null?void 0:a.shippingAddresses,l=k==null?void 0:k[0],C=!!l,x=l==null?void 0:l.availableShippingMethods,g=l==null?void 0:l.selectedShippingMethod,d=x||n,b=K(h=>{if(!C)return;const E={method_code:h.code,carrier_code:h.carrier.code};O([E]).then(()=>{e==null||e()}).catch(y=>{console.error("setting shipping methods on cart failed:",y)})},[C,e]),R=h=>{v.value=h,o==null||o(h)},m=Q(()=>{if(!(d!=null&&d.length))return;const h=d[0],E=r||g;return E?d.some(w=>H(w,E))?E:h:d.find(N=>N.carrier.code===(t==null?void 0:t.carrierCode)&&N.code===(t==null?void 0:t.methodCode))||h},[r,g,d,t]);return X(()=>{m&&((!r||!H(m,r))&&(v.value=m,o==null||o(m)),(!g||!H(m,g))&&b(m))},[m,r,g,b,o]),{isLoading:c||u||f,options:d,selection:m,onSelectionChange:R}}const B=({preSelectedMethod:e,onCheckoutDataUpdate:t,shippingMethodsSlot:o,onShippingMethodSelect:s,initialData:u,...a})=>{const{isLoading:c,options:n,selection:f,onSelectionChange:r}=re({preSelectedMethod:e,onCheckoutDataUpdate:t,onShippingMethodSelect:s});return ie(),L(z,{children:[i(oe,{...a,isLoading:c,onSelectionChange:r,options:n,selection:f}),!c&&o&&i(A,{name:"ShippingMethods",slot:o})]})};B.displayName="ShippingMethodsContainer";const je=D(B);export{je as ShippingMethods,je as default}; +import{jsx as i,jsxs as L,Fragment as z}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/fetch-graphql.js";import{s as v,e as M,c as W,a as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as T}from"@dropins/tools/event-bus.js";import{classes as j,Slot as A}from"@dropins/tools/lib.js";import{s as O}from"../chunks/setShippingMethods.js";/* empty css */import{IllustratedMessage as P,Icon as Z,ProgressSpinner as $,RadioButton as q,Price as F,Skeleton as G,SkeletonRow as _}from"@dropins/tools/components.js";/* empty css */import{H as J}from"../chunks/Heading.js";import{useState as I,useEffect as S}from"@dropins/tools/preact-hooks.js";/* empty css */import*as p from"@dropins/tools/preact-compat.js";import{useCallback as K,useMemo as Q,useEffect as X}from"@dropins/tools/preact-compat.js";import{useText as Y}from"@dropins/tools/i18n.js";import{w as D}from"../chunks/withConditionalRendering.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const U=e=>({countryCode:e.country_id,postCode:e.postcode||"",...e.region_id?{regionId:Number(e.region_id)}:{...e.region?{region:e.region}:{}}}),ee=e=>({carrierCode:e.carrier.code||"",methodCode:e.code||"",amount:e.amount,amountExclTax:e.amountExclTax,amountInclTax:e.amountInclTax}),te=e=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.47266 4.90002H15.1851V10.9645H21.2495L23 12.715V17.6124H20.073",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76151 16.7898C9.76151 18.0525 8.72845 19.076 7.46582 19.076C6.20318 19.076 5.17969 18.0429 5.17969 16.7803C5.17969 15.5176 6.20318 14.4941 7.46582 14.4941C8.72845 14.4941 9.75195 15.5176 9.76151 16.7803C9.76151 16.7803 9.76151 16.7803 9.76151 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8726 16.7898C19.8726 18.062 18.8491 19.0855 17.5769 19.0855C16.3047 19.0855 15.2812 18.062 15.2812 16.7898C15.2812 15.5176 16.3047 14.4941 17.5769 14.4941C18.8491 14.4941 19.8726 15.5176 19.8726 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),oe=({className:e,isLoading:t=!1,onSelectionChange:o=()=>{},options:s,selection:u,...a})=>{const c=Y({Title:"Checkout.ShippingMethods.title",EmptyState:"Checkout.ShippingMethods.emptyState"});return s===void 0?i(ne,{}):L("div",{...a,className:j(["checkout-shipping-methods",e]),children:[i(J,{level:3,className:"checkout-shipping-methods__title",children:c.Title}),!t&&s.length===0&&i(P,{icon:i(Z,{source:te}),message:i("p",{children:c.EmptyState})}),L("div",{className:j(["checkout-shipping-methods__content"]),children:[t&&i($,{className:"checkout-shipping-methods__spinner"}),i("div",{className:j(["checkout-shipping-methods__options",["checkout-shipping-methods__options--loading",t]]),children:s.map(n=>i(q,{"data-testid":"shipping-method-radiobutton","aria-busy":t,id:n.value,name:"shipping-method",className:"checkout-shipping-methods__method",label:L(z,{children:[i(F,{amount:n.amount.value,currency:n.amount.currency})," ",i("span",{children:n.carrier.title})]}),description:n.title,value:n.value,checked:(u==null?void 0:u.value)===n.value,onChange:()=>o(n)},n.value))})]})]})},ne=()=>L(G,{"data-testid":"shipping-methods-skeleton",children:[i(_,{variant:"heading",size:"small"}),i(_,{variant:"empty",size:"small"}),i(_,{size:"medium",fullWidth:!0}),i(_,{size:"medium",fullWidth:!0})]});function ie(){var C;const[e,t]=I(),[o,s]=I();S(()=>{T.on("checkout/estimate-shipping-address",({address:x,isValid:g})=>{t({address:x,isValid:g})})},[]),S(()=>{s(v.value)},[v.value]),S(()=>{M.value.pending?s(void 0):s(v.value)},[M.value.pending]);const{country_id:u,region_id:a,region:c,postcode:n}=(e==null?void 0:e.address)||{},f=!!e,r=W.value.data,k=!!((C=r==null?void 0:r.shippingAddresses)!=null&&C[0]),l=e==null?void 0:e.isValid;S(()=>{k||l||!o||!f||T.emit("shipping/estimate",{address:U({country_id:u,region_id:a,region:c,postcode:n}),shippingMethod:ee(o)})},[o,u,a,c,n,f,k,l])}const H=(e,t)=>e.code===t.code&&e.carrier.code===t.carrier.code;function re({onCheckoutDataUpdate:e,preSelectedMethod:t,onShippingMethodSelect:o}){const u=!V.value.data,a=W.value.data,c=W.value.pending,n=M.value.data,f=M.value.pending,r=v.value,k=a==null?void 0:a.shippingAddresses,l=k==null?void 0:k[0],C=!!l,x=l==null?void 0:l.availableShippingMethods,g=l==null?void 0:l.selectedShippingMethod,d=x||n,b=K(h=>{if(!C)return;const E={method_code:h.code,carrier_code:h.carrier.code};O([E]).then(()=>{e==null||e()}).catch(w=>{console.error("setting shipping methods on cart failed:",w)})},[C,e]),R=h=>{v.value=h,o==null||o(h)},m=Q(()=>{if(!(d!=null&&d.length))return;const h=d[0],E=r||g;return E?d.some(y=>H(y,E))?E:h:d.find(N=>N.carrier.code===(t==null?void 0:t.carrierCode)&&N.code===(t==null?void 0:t.methodCode))||h},[r,g,d,t]);return X(()=>{m&&((!r||!H(m,r))&&(v.value=m,o==null||o(m)),(!g||!H(m,g))&&b(m))},[m,r,g,b,o]),{isLoading:c||u||f,options:d,selection:m,onSelectionChange:R}}const B=({preSelectedMethod:e,onCheckoutDataUpdate:t,shippingMethodsSlot:o,onShippingMethodSelect:s,initialData:u,...a})=>{const{isLoading:c,options:n,selection:f,onSelectionChange:r}=re({preSelectedMethod:e,onCheckoutDataUpdate:t,onShippingMethodSelect:s});return ie(),L(z,{children:[i(oe,{...a,isLoading:c,onSelectionChange:r,options:n,selection:f}),!c&&o&&i(A,{name:"ShippingMethods",slot:o})]})};B.displayName="ShippingMethodsContainer";const je=D(B);export{je as ShippingMethods,je as default}; diff --git a/scripts/__dropins__/storefront-checkout/fragments.js b/scripts/__dropins__/storefront-checkout/fragments.js index 784a05b541..fbe3a85a4b 100644 --- a/scripts/__dropins__/storefront-checkout/fragments.js +++ b/scripts/__dropins__/storefront-checkout/fragments.js @@ -93,7 +93,7 @@ const e=` } same_as_billing } -`,a=` +`,d=` fragment CHECKOUT_DATA_FRAGMENT on Cart { id is_virtual @@ -117,10 +117,256 @@ const e=` ${e} ${t} -`,_=` +`,l=` fragment CUSTOMER_FRAGMENT on Customer { firstname lastname email } -`;export{a as CHECKOUT_DATA_FRAGMENT,_ as CUSTOMER_FRAGMENT}; +`,r=` + fragment ORDER_ADDRESS_FRAGMENT on OrderAddress { + city + company + country_code + fax + firstname + lastname + middlename + postcode + prefix + region + region_id + street + suffix + telephone + vat_id + custom_attributesV2 { + code + ... on AttributeValue { + value + } + } + } +`,a=` + fragment PRODUCT_FRAGMENT on ProductInterface { + __typename + canonical_url + uid + name + sku + only_x_left_in_stock + stock_status + image { + url + } + thumbnail { + label + url + } + price_range { + maximum_price { + regular_price { + currency + value + } + } + } + } +`,_=` + fragment PRICE_FRAGMENT on OrderItemInterface { + prices { + price_including_tax { + value + currency + } + original_price { + value + currency + } + original_price_including_tax { + value + currency + } + price { + value + currency + } + } + } +`,n=` + fragment GIFT_CARD_FRAGMENT on GiftCardOrderItem { + ...PRICE_FRAGMENT + gift_message { + message + } + gift_card { + recipient_name + recipient_email + sender_name + sender_email + message + } + } +`,i=` + fragment ORDER_ITEM_FRAGMENT on OrderItemInterface { + __typename + status + product_name + id + quantity_ordered + quantity_shipped + quantity_canceled + quantity_invoiced + quantity_refunded + quantity_returned + product_sale_price { + value + currency + } + selected_options { + label + value + } + product { + ...PRODUCT_FRAGMENT + } + ...PRICE_FRAGMENT + } +`,c=` + fragment BUNDLE_ORDER_ITEM_FRAGMENT on BundleOrderItem { + ...PRICE_FRAGMENT + bundle_options { + uid + label + values { + uid + product_name + } + } + } +`,o=` + fragment ORDER_SUMMARY_FRAGMENT on OrderTotal { + grand_total { + value + currency + } + total_giftcard { + currency + value + } + subtotal { + currency + value + } + taxes { + amount { + currency + value + } + rate + } + total_tax { + currency + value + } + total_shipping { + currency + value + } + discounts { + amount { + currency + value + } + label + } + } +`,u=` + fragment ORDER_FRAGMENT on CustomerOrder { + email + id + number + order_date + order_status_change_date + status + token + carrier + shipping_method + printed_card_included + gift_receipt_included + available_actions + is_virtual + payment_methods { + name + type + } + applied_coupons { + code + } + shipments { + id + tracking { + title + number + carrier + } + comments { + message + timestamp + } + items { + id + product_sku + product_name + order_item { + ...ORDER_ITEM_FRAGMENT + ... on GiftCardOrderItem { + ...GIFT_CARD_FRAGMENT + product { + ...PRODUCT_FRAGMENT + } + } + } + } + } + payment_methods { + name + type + } + shipping_address { + ...ORDER_ADDRESS_FRAGMENT + } + billing_address { + ...ORDER_ADDRESS_FRAGMENT + } + items { + ...ORDER_ITEM_FRAGMENT + ... on BundleOrderItem { + ...BUNDLE_ORDER_ITEM_FRAGMENT + } + ... on GiftCardOrderItem { + ...GIFT_CARD_FRAGMENT + product { + ...PRODUCT_FRAGMENT + } + } + ... on DownloadableOrderItem { + product_name + downloadable_links { + sort_order + title + } + } + } + total { + ...ORDER_SUMMARY_FRAGMENT + } + } + ${c} + ${n} + ${r} + ${i} + ${o} + ${_} + ${a} +`;export{d as CHECKOUT_DATA_FRAGMENT,l as CUSTOMER_FRAGMENT,u as ORDER_FRAGMENT,i as ORDER_ITEM_FRAGMENT}; diff --git a/scripts/__dropins__/storefront-checkout/render.js b/scripts/__dropins__/storefront-checkout/render.js index 7eabb40515..d83205f31c 100644 --- a/scripts/__dropins__/storefront-checkout/render.js +++ b/scripts/__dropins__/storefront-checkout/render.js @@ -1,6 +1,7 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -(function(r,o){try{if(typeof document<"u"){const t=document.createElement("style"),n=o.styleId;for(const e in o.attributes)t.setAttribute(e,o.attributes[e]);t.setAttribute("data-dropin",n),t.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const e=document.querySelector('link[rel="stylesheet"], style');e?e.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(`.checkout-place-order{display:grid;padding-bottom:var(--spacing-big)}.checkout-place-order__button{align-self:flex-end;justify-self:flex-end}@media only screen and (min-width:320px) and (max-width: 768px){.checkout-place-order{background-color:var(--color-neutral-200);padding:var(--spacing-medium) var(--spacing-medium) var(--spacing-big) var(--spacing-medium)}.checkout-place-order__button{align-self:center;justify-self:stretch}} -.checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0} -.checkout-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.checkout-estimate-shipping__label,.checkout-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-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)}.checkout-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-estimate-shipping__price{text-align:right}.checkout-estimate-shipping__label--bold,.checkout-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.checkout-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__shipping .dropin-skeleton{grid-template-columns:1fr}.checkout-login-form__heading{display:grid;grid-template-columns:1fr max-content;grid-auto-rows:max-content}.checkout-login-form__content{grid-auto-rows:max-content}.checkout-login-form__customer-details{display:grid;grid-auto-flow:row;gap:var(--spacing-xxsmall)}.checkout-login-form__customer-name{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-login-form__customer-email{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-login-form__title{grid-column-start:1;color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);justify-self:flex-end;margin-top:var(--spacing-xxsmall)}a.checkout-login-form__link{font:var(--type-body-2-strong-font);margin-left:var(--spacing-xxsmall)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-login-form__heading{grid-template-columns:repeat(1,1fr [col-start]);grid-template-rows:1fr}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:0;margin-bottom:var(--spacing-medium)}}.checkout-out-of-stock.dropin-card{border-color:var(--color-warning-500)}.checkout-out-of-stock .dropin-card__content{gap:var(--spacing-small);padding:var(--spacing-small)}.checkout-out-of-stock__title{color:var(--color-neutral-900);font:var(--type-body-2-strong-font);margin:0;display:flex;gap:var(--spacing-xxsmall);align-items:center;justify-content:left;text-align:center}.checkout-out-of-stock__message{color:var(--color-neutral-800);font:var(--type-body-2-default-font);margin:0}.checkout-out-of-stock__items{display:grid;grid-template-columns:repeat(5,100px);grid-gap:var(--spacing-small);list-style:none;padding:0;margin:0}.checkout-out-of-stock__item img{width:100%;height:auto}.checkout-out-of-stock__actions{display:flex;gap:var(--spacing-small);justify-content:flex-end}a.checkout-out-of-stock__action{font:var(--type-details-caption-1-font)}.checkout-out-of-stock__action{background:none;border:none;padding:0;cursor:pointer}.checkout-out-of-stock__action:hover{--textColor: var(--color-brand-700);text-decoration:solid underline var(--textColor);text-underline-offset:6px}.checkout-overlay-loader{align-items:center;background:var(--color-neutral-50);display:flex;height:100vh;justify-content:center;left:0;opacity:.5;position:fixed;top:0;width:100%;z-index:9999}.checkout-payment-methods__title{color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-payment-methods__wrapper{position:relative;display:grid}.checkout-payment-methods__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-payment-methods__content{margin-top:var(--spacing-medium)}.checkout-payment-methods--full-width{grid-template-columns:1fr}.checkout-payment-methods--loading{opacity:.4;pointer-events:none}.checkout-payment-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout__content [data-slot=PaymentMethods]:empty{display:none}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}.checkout-server-error{position:relative;text-align:center}.checkout-server-error__icon .error-icon{color:var(--color-alert-500)}.checkout-server-error a{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.order-confirmation-header{text-align:center;padding:var(--spacing-xxbig)}.order-confirmation-header__icon{margin-bottom:var(--spacing-small)}.order-confirmation-header__title{color:var(--color-neutral-800);font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0}.order-confirmation-header__title:first-letter{text-transform:uppercase}.order-confirmation-header__order{color:var(--color-neutral-700);font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);margin:var(--spacing-xxsmall) 0 0 0}.order-confirmation-header .success-icon{color:var(--color-positive-500)}.order-confirmation-create-account{gap:var(--spacing-small);margin-top:var(--spacing-large)}.order-confirmation-create-account__message{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-confirmation-create-account__button{margin:0 auto;text-align:center;display:inline-block}.checkout-shipping-methods__title{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-shipping-methods__content{position:relative;display:block}.checkout-shipping-methods__method{margin-bottom:var(--spacing-medium);width:fit-content;cursor:pointer;font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-shipping-methods__method:last-child{margin-bottom:0}.dropin-radio-button__label .dropin-price{color:var(--color-neutral-800);font-weight:400}.checkout-shipping-methods__options--loading{opacity:.4;pointer-events:none}.checkout-shipping-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}`,{styleId:"checkout"}); -import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import"./chunks/store-config.js";import"./chunks/ServerErrorSignal.js";import{events as p}from"@dropins/tools/event-bus.js";import"./chunks/fetch-graphql.js";import{e as y}from"./chunks/synchronizeCheckout.js";import{UIProvider as g}from"@dropins/tools/components.js";import{useState as b,useEffect as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"./fragments.js";function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S=function(r){return E(r)&&!v(r)};function E(e){return!!e&&typeof e=="object"}function v(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||M(e)}var w=typeof Symbol=="function"&&Symbol.for,j=w?Symbol.for("react.element"):60103;function M(e){return e.$$typeof===j}function A(e){return Array.isArray(e)?[]:{}}function i(e,r){return r.clone!==!1&&r.isMergeableObject(e)?a(A(e),e,r):e}function P(e,r,t){return e.concat(r).map(function(o){return i(o,t)})}function T(e,r){if(!r.customMerge)return a;var t=r.customMerge(e);return typeof t=="function"?t:a}function C(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function l(e){return Object.keys(e).concat(C(e))}function m(e,r){try{return r in e}catch{return!1}}function I(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function x(e,r,t){var o={};return t.isMergeableObject(e)&&l(e).forEach(function(n){o[n]=i(e[n],t)}),l(r).forEach(function(n){I(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?o[n]=T(n,t)(e[n],r[n],t):o[n]=i(r[n],t))}),o}function a(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||P,t.isMergeableObject=t.isMergeableObject||S,t.cloneUnlessOtherwiseSpecified=i;var o=Array.isArray(r),n=Array.isArray(e),c=o===n;return c?o?t.arrayMerge(e,r,t):x(e,r,t):i(r,t)}a.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(o,n){return a(o,n,t)},{})};var D=a,k=D;const R=O(k),B={title:"Checkout",LoginForm:{title:"Contact details",account:"Already have an account?",ariaLabel:"Email",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",signInButton:"Sign in",forFasterCheckout:"for a faster checkout."},floatingLabel:"Email *",placeholder:"Enter your email address",signIn:"Sign In",switch:"Do you want to switch account?",signOut:"Sign Out"},ShippingMethods:{title:"Shipping options",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct."},BillToShippingAddress:{title:"Bill to shipping address"},PaymentMethods:{title:"Payment",emptyState:"No payment methods available"},OutOfStock:{title:"Your cart contains items that are out of stock",message:"The following items are out of stock:",actions:{reviewCart:"Review cart",removeOutOfStock:"Remove out of stock items"},lowInventory:{one:"Last item!",many:"Only {{count}} left!"},alert:"Out of stock!"},PlaceOrder:{button:"Place Order"},ServerError:{title:"We were unable to process your order",contactSupport:"If you continue to have issues, please contact support.",unexpected:"An unexpected error occurred while processing your order. Please try again later.",button:"Try again"},EmptyCart:{title:"Your cart is empty",button:"Start shopping"},ErrorBanner:{genericMessage:"Server error detected. Please check your connection and try again."},MergedCartBanner:{items:{one:"1 item from a previous session was added to your cart. Please review your new subtotal.",many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal."}},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withTaxes:"Including taxes",withoutTaxes:"Excluding taxes"},OrderConfirmationHeader:{title:"{{name}}, thank you for your order!",defaultTitle:"Thank you for your order!",order:"ORDER #{{order}}",CreateAccount:{message:"Save your information for faster checkout next time.",button:"Create an account"}}},L={Checkout:B},_={default:L},U=({children:e})=>{var c;const[r,t]=b(),o=(c=y.getConfig())==null?void 0:c.langDefinitions;h(()=>{const s=p.on("locale",u=>{u!==r&&t(u)},{eager:!0});return()=>{s==null||s.off()}},[r]);const n=R(_,o??{});return f(g,{lang:r,langDefinitions:n,children:e})},Q=new d(f(U,{}));export{U as Provider,Q as render}; +(function(r,o){try{if(typeof document<"u"){const t=document.createElement("style"),n=o.styleId;for(const e in o.attributes)t.setAttribute(e,o.attributes[e]);t.setAttribute("data-dropin",n),t.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const e=document.querySelector('link[rel="stylesheet"], style');e?e.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(`.checkout__banner{margin-bottom:var(--spacing-xlarge)} +.checkout-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.checkout-estimate-shipping__label,.checkout-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-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)}.checkout-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-estimate-shipping__price{text-align:right}.checkout-estimate-shipping__label--bold,.checkout-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.checkout-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__shipping .dropin-skeleton{grid-template-columns:1fr}.checkout-login-form__heading{display:grid;grid-template-columns:1fr max-content;grid-auto-rows:max-content}.checkout-login-form__content{grid-auto-rows:max-content}.checkout-login-form__customer-details{display:grid;grid-auto-flow:row;gap:var(--spacing-xxsmall)}.checkout-login-form__customer-name{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-login-form__customer-email{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-login-form__title{grid-column-start:1;color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);justify-self:flex-end;margin-top:var(--spacing-xxsmall)}a.checkout-login-form__link{font:var(--type-body-2-strong-font);margin-left:var(--spacing-xxsmall)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-login-form__heading{grid-template-columns:repeat(1,1fr [col-start]);grid-template-rows:1fr}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:0;margin-bottom:var(--spacing-medium)}}.checkout-out-of-stock.dropin-card{border-color:var(--color-warning-500)}.checkout-out-of-stock .dropin-card__content{gap:var(--spacing-small);padding:var(--spacing-small)}.checkout-out-of-stock__title{color:var(--color-neutral-900);font:var(--type-body-2-strong-font);margin:0;display:flex;gap:var(--spacing-xxsmall);align-items:center;justify-content:left;text-align:center}.checkout-out-of-stock__message{color:var(--color-neutral-800);font:var(--type-body-2-default-font);margin:0}.checkout-out-of-stock__items{display:grid;grid-template-columns:repeat(5,100px);grid-gap:var(--spacing-small);list-style:none;padding:0;margin:0}.checkout-out-of-stock__item img{width:100%;height:auto}.checkout-out-of-stock__actions{display:flex;gap:var(--spacing-small);justify-content:flex-end}a.checkout-out-of-stock__action{font:var(--type-details-caption-1-font)}.checkout-out-of-stock__action{background:none;border:none;padding:0;cursor:pointer}.checkout-out-of-stock__action:hover{--textColor: var(--color-brand-700);text-decoration:solid underline var(--textColor);text-underline-offset:6px}.checkout-overlay-loader{align-items:center;background:var(--color-neutral-50);display:flex;height:100vh;justify-content:center;left:0;opacity:.5;position:fixed;top:0;width:100%;z-index:9999}.checkout-payment-methods__title{color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-payment-methods__wrapper{position:relative;display:grid}.checkout-payment-methods__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-payment-methods__content{margin-top:var(--spacing-medium)}.checkout-payment-methods--full-width{grid-template-columns:1fr}.checkout-payment-methods--loading{opacity:.4;pointer-events:none}.checkout-payment-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout__content [data-slot=PaymentMethods]:empty{display:none}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}.checkout-server-error{position:relative;text-align:center}.checkout-server-error__icon .error-icon{color:var(--color-alert-500)}.checkout-server-error a{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.order-confirmation-header{text-align:center;padding:var(--spacing-xxbig)}.order-confirmation-header__icon{margin-bottom:var(--spacing-small)}.order-confirmation-header__title{color:var(--color-neutral-800);font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0}.order-confirmation-header__title:first-letter{text-transform:uppercase}.order-confirmation-header__order{color:var(--color-neutral-700);font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);margin:var(--spacing-xxsmall) 0 0 0}.order-confirmation-header .success-icon{color:var(--color-positive-500)}.order-confirmation-create-account{display:grid;gap:var(--spacing-small);margin-top:var(--spacing-large)}.order-confirmation-create-account__message{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-confirmation-create-account__button{display:flex;margin:0 auto;text-align:center}.checkout-shipping-methods__title{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-shipping-methods__content{position:relative;display:block}.checkout-shipping-methods__method{margin-bottom:var(--spacing-medium);width:fit-content;cursor:pointer;font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-shipping-methods__method:last-child{margin-bottom:0}.dropin-radio-button__label .dropin-price{color:var(--color-neutral-800);font-weight:400}.checkout-shipping-methods__options--loading{opacity:.4;pointer-events:none}.checkout-shipping-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0} +.checkout-place-order{display:grid;padding-bottom:var(--spacing-big)}.checkout-place-order__button{align-self:flex-end;justify-self:flex-end}@media only screen and (min-width:320px) and (max-width: 768px){.checkout-place-order{background-color:var(--color-neutral-200);padding:var(--spacing-medium) var(--spacing-medium) var(--spacing-big) var(--spacing-medium)}.checkout-place-order__button{align-self:center;justify-self:stretch}} +.checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0}`,{styleId:"checkout"}); +import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import"./chunks/fetch-graphql.js";import"./chunks/store-config.js";import"./chunks/ServerErrorSignal.js";import{events as p}from"@dropins/tools/event-bus.js";import{c as y}from"./chunks/synchronizeCheckout.js";import{UIProvider as g}from"@dropins/tools/components.js";import{useState as b,useEffect as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"./fragments.js";function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S=function(r){return E(r)&&!v(r)};function E(e){return!!e&&typeof e=="object"}function v(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||M(e)}var w=typeof Symbol=="function"&&Symbol.for,j=w?Symbol.for("react.element"):60103;function M(e){return e.$$typeof===j}function A(e){return Array.isArray(e)?[]:{}}function i(e,r){return r.clone!==!1&&r.isMergeableObject(e)?a(A(e),e,r):e}function P(e,r,t){return e.concat(r).map(function(o){return i(o,t)})}function T(e,r){if(!r.customMerge)return a;var t=r.customMerge(e);return typeof t=="function"?t:a}function C(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function l(e){return Object.keys(e).concat(C(e))}function m(e,r){try{return r in e}catch{return!1}}function I(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function x(e,r,t){var o={};return t.isMergeableObject(e)&&l(e).forEach(function(n){o[n]=i(e[n],t)}),l(r).forEach(function(n){I(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?o[n]=T(n,t)(e[n],r[n],t):o[n]=i(r[n],t))}),o}function a(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||P,t.isMergeableObject=t.isMergeableObject||S,t.cloneUnlessOtherwiseSpecified=i;var o=Array.isArray(r),n=Array.isArray(e),c=o===n;return c?o?t.arrayMerge(e,r,t):x(e,r,t):i(r,t)}a.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(o,n){return a(o,n,t)},{})};var D=a,k=D;const R=O(k),B={title:"Checkout",LoginForm:{title:"Contact details",account:"Already have an account?",ariaLabel:"Email",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",signInButton:"Sign in",forFasterCheckout:"for a faster checkout."},floatingLabel:"Email *",placeholder:"Enter your email address",signIn:"Sign In",switch:"Do you want to switch account?",signOut:"Sign Out"},ShippingMethods:{title:"Shipping options",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct."},BillToShippingAddress:{title:"Bill to shipping address"},PaymentMethods:{title:"Payment",emptyState:"No payment methods available"},OutOfStock:{title:"Your cart contains items that are out of stock",message:"The following items are out of stock:",actions:{reviewCart:"Review cart",removeOutOfStock:"Remove out of stock items"},lowInventory:{one:"Last item!",many:"Only {{count}} left!"},alert:"Out of stock!"},PlaceOrder:{button:"Place Order"},ServerError:{title:"We were unable to process your order",contactSupport:"If you continue to have issues, please contact support.",unexpected:"An unexpected error occurred while processing your order. Please try again later.",button:"Try again"},EmptyCart:{title:"Your cart is empty",button:"Start shopping"},ErrorBanner:{genericMessage:"Server error detected. Please check your connection and try again."},MergedCartBanner:{items:{one:"1 item from a previous session was added to your cart. Please review your new subtotal.",many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal."}},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withTaxes:"Including taxes",withoutTaxes:"Excluding taxes"},OrderConfirmationHeader:{title:"{{name}}, thank you for your order!",defaultTitle:"Thank you for your order!",order:"ORDER #{{order}}",CreateAccount:{message:"Save your information for faster checkout next time.",button:"Create an account"}}},L={Checkout:B},_={default:L},U=({children:e})=>{var c;const[r,t]=b(),o=(c=y.getConfig())==null?void 0:c.langDefinitions;h(()=>{const s=p.on("locale",u=>{u!==r&&t(u)},{eager:!0});return()=>{s==null||s.off()}},[r]);const n=R(_,o??{});return f(g,{lang:r,langDefinitions:n,children:e})},Q=new d(f(U,{}));export{U as Provider,Q as render};