PageSourceSearch

https://www.wovar.nl/assets/checkout-Bb-5yyiM.js

js wovar.nl collected 2026-09-28 06:47:39 UTC 44,548 bytes, 2 lines download raw bytes

1import{r as i,j as e,e as ds,h as cs,o as ms,p as Ss,u as ws,a as us,f as Es,d as Is}from"./components-DnchwV6p.js";import{u as X,L as As,y as re,x as Ce,c as oe,v as Ms,M as Ps,d as Se,W as ve,a as he,N as ge,f as ps,O as Bs,r as Rs,g as ae,l as we,P as Ts,Q as Vs,G as Ls,B as $s}from"./blogs-D72JHPRX.js";import{u as _e}from"./useErrorAlert-rrX2bY8u.js";import{u as fe,I as ee,a as be,s as gs,W as Fs,b as Ne,c as ts,E as ns,d as hs,e as Ds,f as Os,g as ks,h as as,i as Ws,C as qs,j as Us,k as Hs,l as is}from"./useUserEmailCookie-B6Bm0__3.js";import{m as _s,W as V,a as B,n as zs,k as Ys,V as Ks}from"./WvInputField-BGj9FnPr.js";import{a as fs,u as Gs}from"./index-C-7yl6vQ.js";import{a as Js,u as Qs}from"./useCheckoutCountry-5cJXKsoM.js";import{a as Zs}from"./addressUtils-CuM8r_WQ.js";import{W as bs}from"./WvLink-2yczwrc_.js";import{C as Xs}from"./ChevronDownIcon-NyIvLUIG.js";import{u as xs}from"./abandonCart-BK3q4yvW.js";import{a as et,u as st}from"./use-hydrated-D1ujNxp4.js";import{y as ls,v as rs}from"./exports-DtI854OP.js";import{g as je}from"./index-BkT4P4eo.js";import{m as Ot}from"./meta-AH_HhgjY.js";import"./utils-c7KcBLZ3.js";import"./networkUtils-CyAYAL7w.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"99f1f37daa57ff822cb85b50dd6ead78faae7cfb"},s._sentryModuleMetadata=s._sentryModuleMetadata||{},s._sentryModuleMetadata[new s.Error().stack]=function(c){for(var o=1;o<arguments.length;o++){var d=arguments[o];if(d!=null)for(var n in d)d.hasOwnProperty(n)&&(c[n]=d[n])}return c}({},s._sentryModuleMetadata[new s.Error().stack],{"_sentryBundlerPluginAppKey:wovar-webshop":!0});var l=new s.Error().stack;l&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[l]="acc1bfd4-54ec-4848-a12c-7d39a1afc4b2",s._sentryDebugIdIdentifier="sentry-dbid-acc1bfd4-54ec-4848-a12c-7d39a1afc4b2")}catch{}})();const ys=()=>{const s=i.createContext({terms:null});return{CheckoutContentCtxProvider:({children:l,terms:c})=>e.jsx(s.Provider,{value:{terms:c},children:l}),useCheckoutContent:()=>i.useContext(s)}};ys();const Cs=i.forwardRef(({isLoading:s,showRegister:l},c)=>{const{$pt:o}=X(),d=As(),{isManualAddress:n,isSameAddress:b,billingCountryCode:_,shippingCountryCode:g}=fe(),a=b===ee.NO,{verifyAddress:r,setIsVerifying:w,setSuggestionModalData:v,bypassValidation:h}=be(),{show:C}=_e(),{state:A}=ds({key:"setPaymentMethod"}),{getValues:j,validate:Y,submit:U}=_s(),[R,Q]=i.useState(!1),L=i.useMemo(()=>s||A!=="idle"||R,[s,A,R]),K=(m,x)=>{const t=Ce((m||"").toLowerCase());if(!t||!x.trim())return!0;try{const y=t.startsWith("^")?t:`^${t}`,M=y.endsWith("$")?y:`${y}$`;return new RegExp(M,"i").test(x.trim())}catch{return!0}},G=()=>{var t,y;const m=j(),x=((t=m.get("billing_postalCode"))==null?void 0:t.toString())??"";if(!K(_,x))return!0;if(a){const M=((y=m.get("shipping_postalCode"))==null?void 0:y.toString())??"";if(!K(g,M))return!0}return!1},$=()=>{if(n)return!1;const m=j(),x=t=>{var y,M,D;return!((y=m.get(`${t}_address1`))!=null&&y.toString().trim())||!((M=m.get(`${t}_city`))!=null&&M.toString().trim())||!((D=m.get(`${t}_postalCode`))!=null&&D.toString().trim())};return!!(x("billing")||a&&x("shipping"))},Z=()=>{var x,t,y,M,D,O,z,k,I,J;const m=j();return{billing_postalCode:((x=m.get("billing_postalCode"))==null?void 0:x.toString())??"",billing_city:((t=m.get("billing_city"))==null?void 0:t.toString())??"",billing_address1:((y=m.get("billing_address1"))==null?void 0:y.toString())??"",billing_houseNumber:((M=m.get("billing_houseNumber"))==null?void 0:M.toString())??"",billing_additionalStreetInfo:((D=m.get("billing_additionalStreetInfo"))==null?void 0:D.toString())??"",shipping_postalCode:((O=m.get("shipping_postalCode"))==null?void 0:O.toString())??"",shipping_city:((z=m.get("shipping_city"))==null?void 0:z.toString())??"",shipping_address1:((k=m.get("shipping_address1"))==null?void 0:k.toString())??"",shipping_houseNumber:((I=m.get("shipping_houseNumber"))==null?void 0:I.toString())??"",shipping_additionalStreetInfo:((J=m.get("shipping_additionalStreetInfo"))==null?void 0:J.toString())??""}},N=async()=>
1{if(!n)return!0;const{error:m}=await Y();if(m)return!1;if(h)return!0;const x=Z(),t=[{Country:_||"",PostalCode:x.billing_postalCode,Locality:x.billing_city,Address:`${x.billing_address1} ${x.billing_houseNumber} ${x.billing_additionalStreetInfo}`},...a?[{Country:g||"",PostalCode:x.shipping_postalCode,Locality:x.shipping_city,Address:`${x.shipping_address1} ${x.shipping_houseNumber} ${x.shipping_additionalStreetInfo}`}]:[]],y=await r(t);if(!y)return C(o("invalid_loqate_address",{addressType:"Billing"}),"danger"),!1;const M=["Billing","Shipping"],D=[];let O=!1;for(const[z,k]of y.entries())if(k.score<=79||!k.isVerified){const I=o("invalid_loqate_address",{addressType:M[z]});C(I,"danger"),O=!0}else k.score>=80&&k.score<=92&&k.suggestions&&k.suggestions.length>0&&D.push(k);return O?!1:D.length>0?(v(D),!1):!y.some(z=>z.score>=80&&z.score<=92)},H=()=>{var x,t,y,M;const m=j();return{email:((x=m.get("billing_email"))==null?void 0:x.toString())||"",phone_number:((t=m.get("billing_phone"))==null?void 0:t.toString())||"",first_name:((y=m.get("billing_firstName"))==null?void 0:y.toString())||"",last_name:((M=m.get("billing_lastName"))==null?void 0:M.toString())||""}},p=()=>{const m=H();d(m),m.email&&gs(m.email)},E=async m=>{var t,y,M,D;if($()){(t=m==null?void 0:m.preventDefault)==null||t.call(m),C(o("generic_invalid_loqate_address"),"danger");return}if(G()){(y=m==null?void 0:m.preventDefault)==null||y.call(m),C(o("checkout_address_country_mismatch"),"danger");return}if(!n){l&&p();return}"preventDefault"in m&&m.preventDefault();const x=await Y();if(!x.data){const O=document.getElementById("checkoutForm")??null;if(!O)return;const z=((M=x.error)==null?void 0:M.fieldErrors)??{},k=Array.from(O.querySelectorAll("input[name]:not([type='hidden']):not(:disabled), select[name]:not(:disabled), textarea[name]:not(:disabled)")).filter(P=>{const S=window.getComputedStyle(P),q=P.getBoundingClientRect();return S.display!=="none"&&S.visibility!=="hidden"&&S.opacity!=="0"&&q.width>0&&q.height>0});let I=null,J=1/0;for(const P of k)if(z[P.name]){const S=P.getBoundingClientRect().top;S<J&&(J=S,I=P)}if(!I){const P=Object.keys(z)[0],S=O.querySelector(`[data-error-for="${P}"]`);S&&S.getBoundingClientRect().top<J&&(I=S)}if(!I&&z.paymentMethods&&(I=document.getElementById("payment-methods")),I){I.scrollIntoView({behavior:"smooth",block:"center"});let P=null;I.matches('input, button, select, textarea, [role="radio"]')?P=I:P=I.querySelector('[role="radio"], input, button, select, textarea'),(D=P==null?void 0:P.focus)==null||D.call(P,{preventScroll:!0})}return}if(!R){Q(!0),w(!0);try{await N()&&(l&&p(),U())}finally{Q(!1),w(!1)}}};return i.useImperativeHandle(c,()=>({handleSubmit:async m=>{await E(m||{})}})),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-3 col-12",children:e.jsx("p",{className:"text content text--gray",children:o("checkout_label_agreement_title")})}),e.jsx("div",{className:"col-12",children:e.jsx("button",{id:"checkoutSubmitBtn",type:n?"button":"submit",className:re("uppercase btn big btn--100 btn--primary-green js-checkout-submit",{"opacity-50":L}),disabled:L,onClick:E,children:L?e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"zmdi-hc-spin","data-icon-after":""}),e.jsx("span",{className:"ml-3",children:o("form_action_loading")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2",children:e.jsx("svg",{width:"25",height:"23",xmlns:"http://www.w3.org/2000/svg",children:e.jsxs("g",{fill:"#FFF",fillRule:"nonzero",children:[e.jsx("path",{d:"M8.53 18.882a1.882 1.882 0 100 3.765 1.882 1.882 0 000-3.765zM21.706 18.882a1.882 1.882 0 100 3.765 1.882 1.882 0 000-3.765zM4.765.059c.45 0 .836.318.923.757l.004.02L8.378 16.06h14.27c.513 0 .93.411.94.922V17a.941.941 0 01-.922.941H7.588a.941.941 0 01-.923-.757l-.004-.02L3.975 1.94H1a.941.941 0 01-.941-.922V1C.059.486.47.069.98.059H4.765z"}),e.jsx("path",{d:"M23.673 3.864c.636-.205 1.338.338 1.21 1.063l-.005.022-1.694 8.47a.941.941 0 01-.902.757H7.588a.941.941 0 01-.018-1.882h13.92l1.317-6.588H5.706a.941.941 0 01-.941-.923v-.018c0-.514.411-.931.922-.941h17.705c.09 0 .178.012.263.037l.014.004h.004z"})]})})}),e.jsx("span",{className:"inline-block sentence-case",children:o("checkout_action_payment_submit")})]})})})]})}),os=({id:s,label:l,isSelected:c,value:o,onChange:d})=>{const{$pt:n}=X();return e.jsxs("label",{htmlFor:s,className:"d-inline-flex align-items-center",children:[e.jsx("input",{id:s,onChange:b=>d==null?void 0:d(b.target.value),value:o,type:"radio",checked:c}),e.jsx("span",{className:"ml-2 mr-3 heading sans-serif xs strong mb-0",children:n(l)})]})},tt=s=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",...s,children:e.jsx("path",{d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"})}),nt=s=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"
1currentColor",...s,children:[e.jsx("path",{d:"M16 2.286c1.237 0 2.434 0.24 3.559 0.712 1.089 0.457 2.066 1.113 2.905 1.949 1.727 1.721 2.678 4.023 2.678 6.483 0 1.326-0.282 2.843-0.84 4.508-0.519 1.551-1.277 3.23-2.252 4.99-2.094 3.781-4.622 6.941-6.051 8.602-1.429-1.662-3.957-4.823-6.051-8.602-0.975-1.76-1.733-3.439-2.252-4.99-0.557-1.665-0.84-3.181-0.84-4.508 0-2.46 0.951-4.762 2.678-6.483 0.839-0.836 1.816-1.491 2.905-1.949 1.125-0.473 2.323-0.712 3.559-0.712zM16 0c-6.302 0-11.428 5.063-11.428 11.429 0 6.667 5.715 15.013 9.881 19.805 0.016 0.019 0.684 0.766 1.511 0.766h0.072c0.827 0 1.495-0.748 1.511-0.766 4.167-4.792 9.881-13.138 9.881-19.805-0-6.367-5.126-11.429-11.428-11.429z"}),e.jsx("path",{d:"M16 9.143c1.26 0 2.286 1.025 2.286 2.286s-1.025 2.286-2.286 2.286-2.286-1.025-2.286-2.286 1.025-2.286 2.286-2.286zM16 6.857c-2.525 0-4.571 2.047-4.571 4.571s2.047 4.571 4.571 4.571 4.571-2.047 4.571-4.571-2.047-4.571-4.571-4.571z"})]}),at=["billing_postalCode","billing_city","billing_address1","billing_houseNumber","billing_additionalStreetInfo","shipping_postalCode","shipping_city","shipping_address1","shipping_houseNumber","shipping_additionalStreetInfo"],it=({checkout:s,kvkIsRequired:l,setKvkIsRequired:c,setEmail:o,phoneCodeCountries:d,showRegister:n})=>{var Ae,Me,Pe,Be,Re,Te,Ve,Le,$e,Fe,De,Oe,ke,We,qe,Ue,He,ze,Ye,Ke,Ge,Je,Qe,Ze,Xe,es;const{checkoutCountries:b,disableCountryOption:_,checkoutDefaultAddress:g}=Js(((Ae=s==null?void 0:s.shippingAddress)==null?void 0:Ae.countryCode)||""),{$pt:a}=X(),{updateSearchTerm:r}=be(),w=oe(),{fieldErrors:v}=_s(),h=i.useMemo(()=>{const u=a("checkout_msg_become_a_b2b_customer")??"",F=a("checkout_intra_community_link_path")??"",W=u.split(/\{(.+?)\}/);return W.length>=3&&F?e.jsxs(e.Fragment,{children:[W[0],e.jsx(bs,{to:w(F),className:"underline",children:W[1]}),W[2]]}):u},[a,w]),[C,A]=i.useState(""),[j,Y]=i.useState(""),[U,R]=i.useState(""),[Q,L]=i.useState(!1),{isBusinessAccount:K,setIsBusinessAccount:G,isSameAddress:$,setIsSameAddress:Z,isManualAddress:N,setIsManualAddress:H,billingCountryCode:p,setBillingCountryCode:E,shippingCountryCode:m,setShippingCountryCode:x}=fe();i.useEffect(()=>{var u;H(!!((u=s==null?void 0:s.billingAddress)!=null&&u.postalCode))},[]);const{customer:t}=Ms(),{error:y}=_e(),M=Qs(),[D,O]=i.useState(""),[z,k]=i.useState(""),I=i.useMemo(()=>a("form_valid_postal_code_example"),[a]),J=i.useMemo(()=>Ce(p.toLowerCase()),[p]),P=i.useMemo(()=>Ce(m.toLowerCase()),[m]),S=i.useMemo(()=>Zs(s==null?void 0:s.billingAddress,s==null?void 0:s.shippingAddress,t==null?void 0:t.defaultBillingAddress,t==null?void 0:t.defaultShippingAddress),[s,t]),[q,f]=i.useState(S);i.useEffect(()=>{y!=null&&y.toString().includes("INVALID_PHONENUMBER")?R(`${a("checkout_message_invalid_phone_no")}`):R(""),y!=null&&y.toString().includes("INVALID_COC_NUMBER")?A(`${a("checkout_message_invalid_coc_number")}`):A("")},[y,a]);const{dispatch:{setCheckoutInfoBox:T}}=fs();i.useEffect(()=>{var u;K&&!Ps(t==null?void 0:t.type)&&(g==null?void 0:g.value)!=="NL"?T(!0):T(!1),o((u=s==null?void 0:s.billingAddress)==null?void 0:u.email)},[]),i.useEffect(()=>c(!["be","it","pt","es"].includes(p.toLocaleLowerCase())),[p]);const{localeFullName:de}=Se(),Ee=(u,F)=>{var ss;const W=u.Building||u.BuildingName||u.Company||"",te=u.Street||"",ue=[W,te].filter(
1Boolean).join(" ").trim();f(le=>({...le,[`${F}_postalCode`]:u.PostalCode.replaceAll(" ","")||"",[`${F}_city`]:u.City||"",[`${F}_address1`]:ue,[`${F}_houseNumber`]:u.BuildingNumber||"",[`${F}_additionalStreetInfo`]:u.SubBuilding||""}));const ie=(ss=u.CountryIso2)==null?void 0:ss.toUpperCase();if(ie){F==="billing"?E(ie):x(ie);const le=document.getElementById("checkoutForm"),pe=le==null?void 0:le.querySelector(`[name="${F}_countryCode"]`);pe&&pe.value!==ie&&(pe.value=ie,pe.dispatchEvent(new Event("change",{bubbles:!0})))}},ce=u=>{f(F=>({...F,...u==="billing"?{billing_postalCode:"",billing_city:"",billing_address1:"",billing_houseNumber:"",billing_additionalStreetInfo:""}:{shipping_postalCode:"",shipping_city:"",shipping_address1:"",shipping_houseNumber:"",shipping_additionalStreetInfo:""}})),r(`${u}_address_search`,"")},vs=u=>{E(u),ce("billing")},Ns=u=>{x(u),ce("shipping")},js=u=>{if(p!==m){L(!0);return}L(!1),ce("billing"),ce("shipping"),Z(u.target.checked?ee.YES:ee.NO)};i.useEffect(()=>{p===m&&L(!1)},[p,m]);const ne=i.useMemo(()=>{var u,F,W,te,ue;return(u=t==null?void 0:t.defaultBillingAddress)!=null&&u.address1?`${(F=t==null?void 0:t.defaultBillingAddress)==null?void 0:F.address1} ${((W=t==null?void 0:t.defaultBillingAddress)==null?void 0:W.address2)??""} ${((te=t==null?void 0:t.defaultBillingAddress)==null?void 0:te.postalCode)??""} ${((ue=t==null?void 0:t.defaultBillingAddress)==null?void 0:ue.city)??""}`.trim():""},[t==null?void 0:t.defaultBillingAddress]),me=i.useRef(null),[se,Ie]=i.useState(!1);return i.useEffect(()=>{if(!ne||se)return;const u=at.find(F=>v==null?void 0:v[F]);u&&(me.current=u,H(!0),Ie(!0))},[v,ne,se,H]),i.useEffect(()=>{if(!se||!me.current)return;const u=me.current;me.current=null;const F=window.setTimeout(()=>{var te;const W=document.querySelector(`[name="${u}"]`);W==null||W.scrollIntoView({behavior:"smooth",block:"center"}),(te=W==null?void 0:W.focus)==null||te.call(W,{preventScroll:!0})},150);return()=>window.clearTimeout(F)},[se]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"row position-relative z-1",children:e.jsx("div",{className:"mb-3 col-12",children:e.jsxs("div",{className:"cursor-pointer radio d-flex",children:[e.jsx(os,{id:"buyer_type_individual",label:a("checkout_label_is_b2c"),isSelected:!K,value:"individual",onChange:()=>{G(!1)}}),e.jsx(os,{id:"buyer_type_business",label:a("checkout_label_is_b2b"),isSelected:K,value:"business",onChange:()=>{G(!0)}})]})})}),!t&&K&&de!=="nl-nl"?e.jsx("p",{className:"text-center text--danger mb-2 position-relative z-1",children:h}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"row",children:[e.jsx(V,{name:"billing_firstName",label:a("form_label_first_name"),required:!0,fieldClass:"col-12 col-lg-6",children:e.jsx(B,{initialValue:((Me=s==null?void 0:s.billingAddress)==null?void 0:Me.firstName)??((Pe=t==null?void 0:t.defaultBillingAddress)==null?void 0:Pe.firstName)??(t==null?void 0:t.firstName)??"",name:"billing_firstName",placeholder:a("form_placeholder_first_name")})}),e.jsx(V,{name:"billing_lastName",required:!0,label:a("form_label_last_name"),fieldClass:"col-12 col-lg-6",children:e.jsx(B,{initialValue:((Be=s==null?void 0:s.billingAddress)==null?void 0:Be.lastName)??((Re=t==null?void 0:t.defaultBillingAddress)==null?void 0:Re.lastName)??(t==null?void 0:t.lastName)??"",name:"billing_lastName",placeholder:a("form_placeholder_last_name")})}),e.jsx(V,{name:"billing_email",required:!0,label:a("form_label_email"),fieldClass:"col-12 col-lg-6",children:e.jsx(B,{initialValue:((Te=s==null?void 0:s.billingAddress)==null?void 0:Te.email)??((Ve=t==null?void 0:t.defaultBillingAddress)==null?void 0:Ve.email)??(t==null?void 0:t.email)??"",name:"billing_email",type:"email",autoComplete:n?"username":"email",placeholder:a("form_placeholder_email"),onChange:u=>o(u)})}),e.jsx(Fs,{initialValue:((Le=s==null?void 0:s.billingAddress)==null?void 0:Le.phone)||(($e=t==null?void 0:t.defaultBillingAddress)==null?void 0:$e.phone)||(t==null?void 0:t.phone)||"",name:"billing_phone",type:"tel",placeholder:a("form_placeholder_phone"),customError:U,phoneCodeCountries:d}),K?e.jsxs(e.Fragment,{children:[e.jsx(V,{name:"billing_companyName",required:!0,label:a("form_label_company_name"),fieldClass:"col-12 col-lg-6",children:e.jsx(B,{initialValue:((Fe=t==null?void 0:t.company)==null?void 0:Fe.name)||((De=s==null?void 0:s.billingAddress)==null?void 0:De.company)||((Oe=t==null?void 0:t.defaultBillingAddress)==null?void 0:Oe.company)||"",name:"billing_companyName",type:"text",placeholder:a("form_placeholder_company_name")})}),e.jsx(V,{name:"billing_vatNumber",required:!0,label:a("form_label_vat_number"),fieldClass:"col-6 col-lg-3",customError:j,children:e.jsx(B,{initialValue:(t==null?void 0:t.vatNumber)||((ke=s==null?void 0:s.billingAddress)==null?void 0:ke.vatNumber)||((We=s==null?void 0:s.shippingAddress)==null?void 0:We.vatNumber)||((qe=t==null?void 0:t.defaultBillingAddress)==null?void 0:qe.vatNumber)||"",name:"billing_vatNumber",type:"text",placeholder:a("form_placeholder_vat_number"),customError:j,onDefaultChange:u=>Y(u.target.value.length>zs?"vat_number_maximum_char_limit":"")})}),e.jsx(V,{name:"billing_kvkNumber",required:l,label:a("form_label_kvk_number"),fieldClass:"col-6 col-lg-3",customError:C,children:e.jsx(B,{initialValue:(t==null?void 0:t.kvkNumber)||((Ue=s==null?void 0:s.billingAddress)==null?void 0:Ue.kvkNumber)||((He=s==null?void 0:s.shippingAddress)==null?void 0:He.kvkNumber)||((ze=t==null?void 0:t.defaultBillingAddress)==null?void 0:ze.kvkNumber)||"",name:"billing_kvkNumber",type:"text",placeholder:a("form_placeholder_kvk_number"),customError:C,revalidateChecker:p})}),e.jsx(V,{name:"billing_purchaseReference",label:a("form_purchase_reference"),fieldClass:"col-12",children:e.jsx(B,{initialValue:((Ye=s==null?void 0:s.shippingAddress)==null?void 0:Ye.purchaseReference)||"",name:"billing_purchaseReference",type:"text",placeholder:a("form_purchase_reference")})})]}):null]}),e.jsxs("div",{className:"row",children:[$===ee.NO?e.jsx("div",{className:"col-12",children:e.jsx("h3",{className:"pb-3 mb-3 heading strong mdl underlined left",children:a("checkout_billing_address_title")})}):null,e.jsx(Ne,{name:_?"":"billing_countryCode",list:b,placeholder:a("form_placeholder_country"),label:a("form_label_country_option"),className:"mt-2",disabled:$!==ee.NO||!1,defaultValue:g==null?void 0:g.value,onChanged:vs}),e.jsx("input",{type:"hidden",value:g==null?void 0:g.value,name:_?"billing_countryCode":""}),(!ne||se)&&e.jsx(ts,{countryCode:p,label:a("form_label_address_search"),placeholder:a("form_placeholder_address_search"),onAddressSelect:u=>Ee(u,"billing"),name:"billing_address_search",fieldClass:"col-12",isManualAddress:N,manualAddressLabel:a("checkout_manual_address"),addressFinderLabel:a("checkout_address_finder"),onManualAddressToggle:H},`billing-lookup-${p}-${$}`),e.jsx("div",{className:"mb-3 col-12",children:e.jsxs("div",{className:"checkbox",children:[e.jsxs("label",{className:"d-inline-flex align-items-center",children:[e.jsx("input",{type:"checkbox",className:"pointer",name:"ship-to-invoice",id:"ship-to-invoice",checked:$===ee.YES,onChange:js}),e.jsx("span",{className:"mb-0 ml-2 heading sans-serif xs strong",children:a("checkout_delivery_address_is_same")})]}),Q&&e.jsx("small",{className:"text-danger mt-1 d-block",children:a("checkout_address_country_mismatch")})]})}),ne&&!se&&e.jsxs("button",{type:"button",className:"customer-address-summary",onClick:()=>Ie(!0),children:[e.jsx(nt,{width:20,height:20,className:"mr-3 flex-shrink-0","aria-hidden":!0}),e.jsx("span",{children:ne}),e.jsx(tt,{width:20,height:20,className:"ml-2 flex-shrink-0","aria-hidden":!0})]}),e.jsx(ns,{isOpen:N,headerClass:"fit-content",className:!ne||se?"":"d-none",children:N&&e.jsxs("div",{className:re("flex-wrap w-100 d-flex",{}),children:[e.jsx(V,{name:"billing_postalCode",required:!0,label:a("form_label_postal_code"),fieldClass:"col-12 col-lg-6",customError:D,children:J?e.jsx(B,{initialValue:S.billing_postalCode,name:"billing_postalCode",placeholder:a("form_placeholder_postal_code"),pattern:J,onDefaultChange:u=>{u.target.reportValidity(),u.target.validity.patternMismatch?(u.target.setCustomValidity(I),O(I)):(u.target.setCustomValidity(""),O(""))},customError:D}):e.jsx(B,{initialValue:S.billing_postalCode,name:"billing_postalCode",placeholder:a("form_placeholder_postal_code")})}),e.jsx(V,{name:"billing_city",label:a("form_label_city"),required:!0,fieldClass:"col-12 col-lg-6",children:e.jsx(B,{initialValue:S.billing_city,name:"billing_city",placeholder:"London"})}),e.jsx(V,{name:"billing_address1",label:a("form_label_address1"),fieldClass:"col-12 col-lg-6",required:!0,children:e.jsx(B,{initialValue:S.billing_address1,name:"billing_address1",placeholder:a("form_placeholder_address1")})}),e.jsx(V,{name:"billing_houseNumber",label:a("form_label_house_number"),fieldClass:"col-6 col-lg-3",required:M,children:e.jsx(B,{t
1ype:"number",initialValue:S.billing_houseNumber,name:"billing_houseNumber",placeholder:a("form_placeholder_house_number")})}),e.jsx(V,{name:"billing_additionalStreetInfo",label:a("form_label_house_number_additional"),fieldClass:"col-6 col-lg-3",children:e.jsx(B,{initialValue:S.billing_additionalStreetInfo,name:"billing_additionalStreetInfo",placeholder:a("form_placeholder_house_number_additional")})})]})}),!N&&e.jsx(ve,{data:{billing_postalCode:q.billing_postalCode,billing_city:q.billing_city,billing_address1:q.billing_address1,billing_houseNumber:q.billing_houseNumber,billing_additionalStreetInfo:q.billing_additionalStreetInfo}}),$===ee.NO?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-3 col-12",children:e.jsx("h3",{className:"pb-3 mb-3 heading strong mdl underlined left",children:a("checkout_delivery_address_title")})}),e.jsx(V,{name:"shipping_firstName",label:a("form_label_first_name"),required:!0,fieldClass:"col-12 col-lg-6",children:e.jsx(B,{initialValue:((Ke=s==null?void 0:s.shippingAddress)==null?void 0:Ke.firstName)??((Ge=t==null?void 0:t.defaultShippingAddress)==null?void 0:Ge.firstName)??(t==null?void 0:t.firstName)??"",name:"shipping_firstName",placeholder:a("form_placeholder_first_name")})}),e.jsx(V,{name:"shipping_lastName",required:!0,label:a("form_label_last_name"),fieldClass:"col-12 col-lg-6",children:e.jsx(B,{initialValue:((Je=s==null?void 0:s.shippingAddress)==null?void 0:Je.lastName)??((Qe=t==null?void 0:t.defaultShippingAddress)==null?void 0:Qe.lastName)??(t==null?void 0:t.lastName)??"",name:"shipping_lastName",placeholder:a("form_placeholder_last_name")})}),e.jsx(Ne,{name:_?"":"shipping_countryCode",list:b,placeholder:a("form_placeholder_country"),label:a("form_label_country_option"),className:"mt-2",disabled:_,defaultValue:g==null?void 0:g.value,onChanged:Ns}),e.jsx("input",{type:"hidden",value:g==null?void 0:g.value,name:_?"shipping_countryCode":""}),e.jsx(ts,{countryCode:m,label:a("form_label_address_search"),placeholder:a("form_placeholder_address_search"),onAddressSelect:u=>Ee(u,"shipping"),name:"shipping_address_search",fieldClass:"col-12",isManualAddress:N,manualAddressLabel:a("checkout_manual_address"),addressFinderLabel:a("checkout_address_finder"),onManualAddressToggle:H},`shipping-lookup-${m}-${$}`),e.jsx(ns,{isOpen:N,isHeader:!1,children:e.jsxs("div",{className:re("flex-wrap w-100 d-flex",{invisible:!N}),children:[e.jsx(V,{name:"shipping_postalCode",required:!0,label:a("form_label_postal_code"),fieldClass:"col-12 col-lg-6",customError:z,children:e.jsx(B,{initialValue:S.shipping_postalCode,name:"shipping_postalCode",placeholder:a("form_placeholder_postal_code"),disabled:!N,pattern:P,onDefaultChange:u=>{u.target.reportValidity(),u.target.validity.patternMismatch?(u.target.setCustomValidity(I),k(I)):(u.target.setCustomValidity(""),k(""))},customError:z})}),e.jsx(V,{name:"shipping_city",label:a("form_label_city"),required:!0,fieldClass:"col-12 col-lg-6",children:e.jsx(B,{initialValue:S.shipping_city,name:"shipping_city",placeholder:"London",disabled:!N})}),e.jsx(V,{name:"shipping_address1",label:a("form_label_address1"),fieldClass:"col-12 col-lg-6",required:!0,children:e.jsx(B,{initialValue:S.shipping_address1,name:"shipping_address1",placeholder:a("form_placeholder_address1"),disabled:!N})}),e.jsx(V,{name:"shipping_houseNumber",label:a("form_label_house_number"),fieldClass:"col-6 col-lg-3",required:M,children:e.jsx(B,{type:"number",initialValue:S.shipping_houseNumber,name:"shipping_houseNumber",placeholder:a("form_placeholder_house_number"),disabled:!N})}),e.jsx(V,{name:"shipping_additionalStreetInfo",label:a("form_label_house_number_additional"),fieldClass:"col-6 col-lg-3",children:e.jsx(B,{initialValue:S.shipping_additionalStreetInfo,name:"shipping_additionalStreetInfo",placeholder:a("form_placeholder_house_number_additional"),disabled:!N})})]})}),!N&&e.jsx(ve,{data:{shipping_postalCode:q.shipping_postalCode,shipping_city:q.shipping_city,shipping_address1:q.shipping_address1,shipping_houseNumber:q.shipping_houseNumber,shipping_additionalStreetInfo:q.shipping_additionalStreetInfo}})]}):null,e.jsx("input",{type:"checkbox",className:"d-none",name:"terms",id:"terms",defaultChecked:!0}),e.jsx("input",{type:"hidden",name:"isSameAddress",value:$}),e.jsx("input",{type:"hidden",name:"shippingOptionId",value:((Ze=s==null?void 0:s.shippingOption)==null?void 0:Ze.id)??""}),e.jsx("input",{type:"hidden",name:"shippingOptionName",value:((Xe=s==null?void 0:s.shippingOption)==null?void 0:Xe.name)??""}),e.jsx("input",{type:"hidden",name:"shippingOptionCountryCode",value:((es=s==null?void 0:s.shippingOption)==null?void 0:es.countryCode)??""})]})]})]})},lt=({payment:s,onSelect:l,isSelected:c})=>{const{$pt:o}
1=X(),d=s.charge?`+${s.charge}`:o("shopping_cart_free_shipping_label");return e.jsxs("label",{className:"payment-method pt-0",children:[e.jsx("input",{type:"radio",name:"data[payment][method]",id:`payment_method_${s.id}`,value:s.id,className:"payment-method__input js-payment-radio",onChange:()=>l(s),checked:c}),e.jsxs("div",{className:"payment-method__label row no-gutters align-items-center",children:[e.jsx("span",{className:"payment-method__radio col-auto"}),e.jsx("h3",{className:"heading sans-serif sm strong col mx-3 mb-0",children:s.code}),e.jsxs("div",{className:"d-flex items-center",children:[e.jsx("span",{className:`d-inline-block ${s.charge?"text-danger":"text-success"}`,children:d}),e.jsx("picture",{className:"payment-method__icon img col-auto",children:e.jsx("img",{loading:"lazy",width:"56",height:"35",src:s.image??s.icon??"",alt:s.code,title:s.code})})]})]})]})},rt=()=>{const{$pt:s}=X(),{checkout:l}=he(),c=cs(),{paymentMethods:o,setPaymentMethod:d,paymentMethod:n}=hs(),[b,_]=i.useState(!1),g=i.useRef(!1),a=o.length>3,r=a&&!b?o.slice(0,3):o,w=()=>{var A;const{error:h}=Ys("paymentMethods"),C=((A=n.current)==null?void 0:A.id)||typeof window<"u"&&sessionStorage.getItem("paymentMethod");return!h||C?null:e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"error-label",children:s(h)})})},v=({id:h})=>{var A,j,Y,U;const C=o.find(R=>R.id===h);if(C){const{id:R,code:Q}=C;d({id:R,name:Q}),typeof window<"u"&&sessionStorage.setItem("paymentMethod",JSON.stringify({id:R,name:Q})),c({checkoutId:l==null?void 0:l.id,paymentMethodId:(A=n.current)==null?void 0:A.id,shippingOptionId:(j=l==null?void 0:l.shippingOption)==null?void 0:j.id,shippingOptionName:((Y=l==null?void 0:l.shippingOption)==null?void 0:Y.description)??"",shippingOptionCountryCode:(U=l==null?void 0:l.shippingAddress)==null?void 0:U.countryCode,_action:ge.SET_PAYMENT_METHOD,_root_refresh:!1},{method:"post",navigate:!1,fetcherKey:"setPaymentMethod"})}};return i.useEffect(()=>{if(typeof window<"u"){const h=sessionStorage.getItem("paymentMethod");if(h){const C=document.getElementById(`payment_method_${JSON.parse(h).id}`);C&&(C.checked=!0)}}},[n]),i.useEffect(()=>{g.current||o.length===0||(g.current=!0,v(o[0]))},[o]),e.jsxs("div",{children:[e.jsx("h3",{className:"pb-3 mt-5 mb-0 heading sans-serif strong mdl underlined left",children:s("checkout_label_payment_method_title")}),e.jsx(w,{}),e.jsxs("div",{className:"payment-option-container",children:[o.length?r.map(h=>{var C;return e.jsx(lt,{payment:h,onSelect:v,isSelected:((C=n.current)==null?void 0:C.id)===h.id},h.id)}):null,a&&!b?e.jsxs("button",{type:"button",className:"show-more-payment-methods",onClick:()=>_(!0),children:[e.jsx("span",{children:s("checkout_show_more_payment_methods")}),e.jsx(Xs,{"aria-hidden":!0})]}):null]})]})},ot="registerData",dt=s=>{s&&sessionStorage.setItem(ot,JSON.stringify({branch:s}))},ct=({branches:s,registerData:l})=>{const{$pt:c}=X(),[o,d]=i.useState(""),{isBusinessAccount:n}=fe(),[b,_]=i.useState(""),g=i.useMemo(()=>[{name:"",value:""}].concat(s==null?void 0:s.map(({branch:v})=>({name:c(v??""),value:v}))),[s,c]),a=v=>{let h=0;return["[A-Z]","[a-z]","[0-9]","[\\W_]"].forEach(A=>{new RegExp(A).test(v)&&h<3&&h++}),v.length>=8&&h++,h},r=["empty","worst","bad","weak","good","strong"],w=v=>{const h=a(v);_((r==null?void 0:r[h])||"empty")};return i.useEffect(()=>{dt(o)},[o]),e.jsxs("div",{id:"checkoutRegister",className:"mt-4",children:[e.jsx("h1",{className:"pb-3 mb-0 heading sans-serif mdl strong underlined left",children:c("register_action_submit")}),e.jsxs("div",{className:"mt-3 row",children:[n?e.jsx(Ne,{name:"branch",list:g,defaultValue:l.branch??o,placeholder:c("form_placeholder_branch"),label:c("form_label_branch"),className:"col-12",onChanged:v=>d(v)}):null,e.jsx(V,{name:"password",label:c("form_label_password"),required:!0,fieldClass:"col-12 col-sm-6",passwordStrength:b,children:e.jsx(B,{name:"password",placeholder:c("form_placeholder_password"),type:"password",autoComplete:"new-password",onChange:v=>{w(v.toString())}})}),e.jsx(V,{name:"confirmPassword",label:c("form_label_confirm_password"),required:!0,fieldClass:"col-12 col-sm-6",children:e.jsx(B,{name:"confirmPassword",placeholder:c("form_placeholder_confirm_password"),type:"password",autoComplete:"new-password"})})]})]})},mt=({showInfo:s,info:l,onClose:c})=>{const o=oe(),{$pt:d}=X(),n=d("checkout_intra_community_link_path");return e.jsx(e.Fragment,{children:s&&e.jsx("div",{className:"payment-method mb-3 p-2",children:e.jsxs("div",{className:"d-flex ",children:[l?e.jsx("span",{className:"text-danger",children:l}):e.jsxs("span",{children:[d("checkout_intra_community_info")," ",e.jsx(bs,{to:o(n),className:"link",children:d("checkout_intra_community_link_text")})]}),e.jsx("span",{className:"pointer p-1 fs-400",onClick:c,children:"x"})]})})})},xe=(s,l,c="")=>e.jsx("div",{className:"col-auto",children:e.jsx("span",{className:`price price--sm ${c}`,"data-price":s,children:l})}),ut=(s,l,c,o,d,n,b,_)=>e.jsxs("div",{className:"col-auto text-right",children:[e.jsx("span",{className:"price price--sm js-price","data-price":s,children:l}),_?null:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-1 mb-1 heading sans-serif xxs normal",children:d}),e.jsxs("div",{className:"mb-0 heading sans-serif xxs normal",children:["(",e.jsx("span",{className:"d-inline js-price","data-price":c,children:o})," ",n,")"]}),b&&e.jsx("div",{className:"mb-0 heading sans-serif xxs text-success",children:e.jsxs("span",{children:["(",b,")"]})})]})]}),pt=({Left:s,Right:l,hidden:c,bold:o})=>c?null:e.jsxs("div",{className:re("row no-gutters mb-2",o?"mt-3":""),children:[e.jsxs("div",{className:re("col",o?"heading sans-serif sm strong ":"text"),children:[s,":"]}),l]}),gt=({isLoading:s,showRegister:l,shippingOption:c})=>{const o=et(),{localeFullName:d}=Se(),{checkout:n}=he(),{customer:b}=ps(),{$pt:_}=X();i.useEffect(()=>{const h=document.getElementById("subNewsletter");o&&h&&(h.checked=[null,"true"].includes(sessionStorage.getItem("subNewsletter")))},[o]);const{state:{showCheckoutInfoBox:g},dispatch:{setCheckoutInfoBox:a}}=fs(),r=i.useMemo(()=>n!=null&&n.shippingOption?n.shippingOption:{description:"",id:"",cost:{value:0,currencyCode:"EUR"}},[n]),w=i.useMemo(()=>b==null?void 0:b.type.toLowerCase().endsWith("tf"),[b]),v=i.useMemo(()=>{var A,j,Y,U,R,Q,L,K,G,$,Z,N,H,p;if(!c||!d)return[];const h=Bs(n==null?void 0:n.taxTotal,n==null?void 0:n.shippingCostInclTax,n==null?void 0:n.shippingCostExclTax),C=Rs(d,((A=n==null?void 0:n.totalInclTax)==null?void 0:A.currencyCode)??((j=n==null?void 0:n.subtotalExclTax)==null?void 0:j.currencyCode));return[{left:_("shopping_cart_summary_subtotal",{currency:C}),right:xe(w?(Y=n==null?void 0:n.subtotalInclTax)==null?void 0:Y.value:(U=n==null?void 0:n.subtotalExclTax)==null?void 0:U.value,ae(d,w?n==null?void 0:n.subtotalInclTax:n==null?void 0:n.subtotalExclTax)),bold:!1,hidden:!1},{left:_("shopping_cart_summary_tax_total"),right:xe(h.value,ae(d,h)),bold:!1,hidden:w},{left:_("shopping_cart_summary_delivery"),right:xe((R=r==null?void 0:r.cost)==null?void 0:R.value,+((Q=r==null?void 0:r.cost)==null?void 0:Q.value)>
10?ae(d,r==null?void 0:r.cost):_("shopping_cart_free_shipping_label"),+((L=r==null?void 0:r.cost)==null?void 0:L.value)>0?"":"text-success"),bold:!1,hidden:!(r!=null&&r.id)},{left:_("shopping_cart_summary_total",{currency:C}),right:ut(((K=n==null?void 0:n.totalInclTax)==null?void 0:K.value)??((G=c==null?void 0:c.totalInclTax)==null?void 0:G.value)??0,ae(d,{currencyCode:(n==null?void 0:n.totalInclTax.currencyCode)??"EUR",value:(($=n==null?void 0:n.totalInclTax)==null?void 0:$.value)??((Z=c==null?void 0:c.totalInclTax)==null?void 0:Z.value)??0}),((N=n==null?void 0:n.totalExclTax)==null?void 0:N.value)??0,ae(d,{currencyCode:(n==null?void 0:n.totalExclTax.currencyCode)??"EUR",value:((H=n==null?void 0:n.totalExclTax)==null?void 0:H.value)??0}),_("shopping_cart_summary_total_inc_vat",{currency:C}),_("shopping_cart_summary_total_exc_vat",{currency:C}),(p=n==null?void 0:n.discountTotal)!=null&&p.value?_("shopping_cart_discount_total",{amount:ae(d,n==null?void 0:n.discountTotal)}):void 0,w),bold:!0,hidden:!1}]},[n,_,r,c,w,d]);return n!=null&&n.id?e.jsxs("div",{className:"p-3 mt-5 mb-3 checkout__summary checkout__summary-bg mt-lg-2",children:[e.jsx("div",{className:"checkout__summary-section",children:e.jsx("h3",{className:"pb-3 heading sans-serif mdl strong underlined left",children:_("shopping_cart_summary_title")})}),e.jsx(mt,{showInfo:g,onClose:()=>a(!1)}),e.jsx("div",{className:"checkout__summary-section text checkout__summary-section--delivery js-summary-delivery"}),e.jsxs("div",{className:"checkout__summary-section",children:[v.map(({left:h,right:C,bold:A,hidden:j},Y)=>e.jsx(pt,{Left:h,Right:C,bold:A,hidden:j},h)),e.jsxs("div",{className:"mt-4 mb-3 row d-none d-lg-block",children:[e.jsx("div",{className:"col-12 scheckout-order-newsletter",children:e.jsx("div",{className:"content",children:e.jsxs("label",{className:"newsletter-label",children:[e.jsx("input",{type:"checkbox",defaultChecked:!0,className:"newsletter-check",name:"subNewsletter",id:"subNewsletter",onChange:h=>sessionStorage.setItem("subNewsletter",h.target.checked.toString())}),_("checkout_label_newletter")]})})}),e.jsx(Cs,{isLoading:s,showRegister:l})]})]})]}):null},ye=s=>!!s&&/\S+@\S+\.\S{2,}/.test(s==null?void 0:s.trim()),ht=({shippingOption:s,branches:l,sendEmail:c})=>{var q;const{$pt:o}=X(),{checkout:d,registerData:n,phoneCodeCountries:b}=he(),{setPaymentFlow:_}=xs(),{customer:g}=ps(),{localeFullName:a}=Se(),r=oe(),[w,v]=i.useState(""),h=Gs(),[C,A]=i.useState(!0),[j,Y]=i.useState(!1),{setIsSignup:U}=Ds(),{isBusinessAccount:R,isSameAddress:Q}=fe(),{show:L}=_e(),{returnUrl:K,paymentMethod:G}=hs(),{validator:$,validatorWithKvk:Z}=Os(h),{fetcher:N,isLoading:H,error:p}=we({key:"checkoutForm"}),{isVerifying:E,setIsVerifying:m,suggestionModalData:x,setSuggestionModalData:t}=be(),{state:y}=ds({key:"setPaymentMethod"}),M=C?Z:$,D=E||H,O=i.useMemo(()=>y!=="idle",[y]);i.useEffect(()=>{let f=null;if(p){switch(p==null?void 0:p.toString()){case"INVALID_POSTAL_CODE":f=o("profile_message_invalid_postal_code");break;case"INVALID_PHONENUMBER":f=o("checkout_message_invalid_email");break;case"INVALID_COC_NUMBER":f=o("checkout_message_invalid_coc_number");break;case"BECOME_A_B2B_CUSTOMER":f=o("checkout_msg_become_a_b2b_customer");break;case"PAYMENT_METHOD_REQUIRED":f=o("payment_method_required_message");break;default:f=p[0];break}m(!1)}p&&f&&L(f,"warning")},[p,L,o]),i.useEffect(()=>{var f,T,de;!H&&((f=N.data)!=null&&f.paymentUrl)&&typeof window<"u"&&(_(!0),(T=N.data)!=null&&T.orderId&&(sessionStorage.setItem("orderId",N.data.orderId),sessionStorage.removeItem("registerData"),sessionStorage.removeItem("subNewsletter")),window.location.href=(de=N.data)==null?void 0:de.paymentUrl)},[H,N]);const z=Ts(),k=Vs(),I=i.useRef(!1),J=i.useRef(null),P=i.useRef(null);i.useEffect(()=>{var f;if(d&&!I.current&&(z(d),I.current=!0),d&&!J.current){const T=(f=ks())==null?void 0:f.trim();T&&ye(T)&&(k(d,T),J.current=T)}},[]);const S=async f=>{t(null),f&&P.current&&await P.current.handleSubmit()};return i.useEffect(()=>{if(!d)return;const f=w==null?void 0:w.trim();if(!ye(f)||f===J.current)return;const T=setTimeout(()=>{f!==J.current&&d&&(k(d,f),J.current=f)},1e3);return()=>clearTimeout(T)}
1,[w,d]),i.useEffect(()=>{j&&setTimeout(()=>{const f=document.getElementById("checkoutRegister");if(f){const{y:T}=f.getBoundingClientRect();window.scrollTo({top:T-100,behavior:"smooth"})}},500)},[j]),e.jsxs("article",{className:"py-3 checkout checkout--wrapper position-relative",children:[e.jsxs(Ks,{fetcher:N,validator:M,method:"post",id:"checkoutForm",name:"checkoutForm",className:"form",children:[e.jsx(ve,{data:{_action:ge.CREATE_ORDER,returnUrl:K,billingAddress:JSON.stringify(d==null?void 0:d.billingAddress),paymentMethods:((q=G.current)==null?void 0:q.id)||"",_root_refresh:!0,isBusinessAccount:R,...j?{redirect:r(`/customer/thank-you?type=${R?"B2B":"B2C"}&&email=${w}`)}:{}}}),e.jsx("div",{className:"container",children:e.jsxs("div",{className:"row pb-lg-3 mb-lg-5",children:[e.jsxs("div",{className:"col-12 col-lg mr-xxl-5 checkout--wrapper",children:[e.jsx("h1",{className:"pb-3 mb-0 heading sans-serif mdl strong underlined left",children:o("checkout_label_your_details")}),e.jsx(it,{checkout:d,setKvkIsRequired:A,kvkIsRequired:C,setEmail:f=>{const T=f==null?void 0:f.trim();v(f),c(f),ye(T)&&gs(T)},phoneCodeCountries:b,showRegister:j}),g?null:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:Q===ee.YES&&!R?"mt-n3":"",children:e.jsxs("label",{className:"d-inline-flex align-items-center",children:[e.jsx("input",{type:"checkbox",className:"pointer",name:"showRegister",id:"showRegister",checked:j,onChange:f=>{const T=f.target.checked;Y(T),U(T?as.YES:as.NO),!T&&typeof window<"u"&&sessionStorage.removeItem("registerData")}}),e.jsx("span",{className:"mb-0 ml-2 heading sans-serif xs strong",children:o("register_in_checkout_label")})]})}),j?e.jsx(ct,{branches:l,registerData:n}):null]}),e.jsxs("div",{className:`relative ${O?"opacity-50":""}`,id:"payment-methods","data-error-for":"paymentMethod",tabIndex:-1,children:[O&&e.jsx("div",{className:"absolute inset-0 z-1"}),e.jsx(rt,{})]})]}),e.jsx("div",{className:`checkout__sticky col-12 col-lg-5 ml-lg-5 ${O?"opacity-50":""}`,children:e.jsx(gt,{isLoading:D,showRegister:j,shippingOption:s})}),e.jsx("div",{className:"w-full d-block d-lg-none",children:e.jsx(Cs,{ref:P,isLoading:D,showRegister:j})})]})})]}),O&&e.jsx("div",{className:"absolute inset-0 z-1"}),!g&&R&&a!=="nl-nl"&&e.jsx("div",{style:{position:"absolute",inset:0}}),x&&e.jsx(Ws,{modalData:x,isOpen:!!x,onClose:S})]})},{CheckoutContentCtxProvider:_t,useCheckoutContent:Vt}=ys(),ft=(s,l,c="An {origin} error occurred {error}",o={},d={})=>{const n={origin:l,...o},b={pathname:typeof window<"u"?window.location.pathname:null,...d},_=(g,a)=>c.replace("{origin}",g).replace("{error}",a);if(ms(s)){ls(_(l,`${s.status} - ${s.statusText}`),{tags:n,level:s.status>=500?"error":"warning",extra:{...b,kind:"response",status:s.status,statusText:s.statusText,data:s.data}});return}if(s instanceof Response){ls(_(l,`${s.status} - ${s.statusText}`),{level:s.status>=500?"error":"warning",tags:n,extra:{...b,kind:"response",status:s.status,statusText:s.statusText}});return}if(s instanceof Error){rs(s,{tags:n,extra:{...b,kind:"error",name:s.name,message:s.message,stack:s.stack}});return}rs(s,{tags:n,extra:{...b,kind:"unknown",error:String(s)}})};function Lt(){const s=Ss();return i.useEffect(()=>{var l;ft(s,"checkout-client","[WOV-2039] {origin} error {error}",{issue:"WOV-2039"}),ms(s)&&s.status>=400&&s.status<600&&((l=je())==null||l.flush())},[s]),e.jsx(Ls,{skipSentryCapture:!0})}const bt=({children:s})=>{const{error:l}=we(),{$pt:c}=X(),{error:o,show:d}=_e(),n=us(),b=Es(),_=oe();return Is(),i.useEffect(()=>{let g=null;l===is.LOAD_PAYMENT_METHODS_FAILED?g=c("checkout_message_load_payment_methods_failure"):l
1===is.EMPTY_CART_ITEMS?g=c("shopping_cart_message_is_empty"):o!=null&&o.toString().includes("INVALID_PHONENUMBER")?g=c("checkout_message_invalid_phone_no"):l!=null&&l.toString().includes("INVALID_COC_NUMBER")?g=c("checkout_message_invalid_coc_number"):l!=null&&l.toString().includes("BECOME_A_B2B_CUSTOMER")&&(g=c("checkout_msg_become_a_b2b_customer"));let a;const r=typeof window<"u"?sessionStorage.getItem("orderId"):null;return g&&b.state==="idle"&&!r&&(d(g,"warning"),a=setTimeout(()=>{n(_("/cart"))},1800)),()=>{a&&clearTimeout(a)}},[c,l,o,_,n,b,d]),e.jsx(e.Fragment,{children:s})},$t=()=>{const{paymentMethods:s,paymentMethodsSortOrder:l,terms:c,branches:o,customer:d,shippingOptions:n,phoneCountryCodeRules:b}=ws(),_=oe(),g=us(),a=cs(),{checkout:r,setPhoneCodeCountries:w,phoneCodeCountries:v}=he(),{setAbandonData:h,clearAbandonData:C,clearPaymentFlow:A}=xs(),{isLoading:j}=we({key:"checkoutForm"}),{isVerifying:Y}=be(),U=j||Y,[R,Q]=i.useState(""),L=(d==null?void 0:d.email)??R,K=i.useRef(Date.now()),G=i.useRef(null),$=i.useRef(!1),Z=st(),N=i.useMemo(()=>(n==null?void 0:n.find(p=>{var E;return(p==null?void 0:p.id)===((E=r==null?void 0:r.shippingOption)==null?void 0:E.id)}))||null,[n,r]);i.useEffect(()=>{var p;(p=r==null?void 0:r.lineItems)!=null&&p.length&&r.lineItems.some(E=>!E.valid)&&g(_("/cart"))},[r==null?void 0:r.lineItems]),i.useEffect(()=>{const p=sessionStorage.getItem("isPaymentFlow"),E=sessionStorage.getItem("orderId");p&&!E&&A()},[]),i.useEffect(()=>{var p;return(p=je())==null||p.startBuffering(),()=>{var E;(E=je())==null||E.stop()}},[]),i.useEffect(()=>{U&&G.current===null&&(G.current=Date.now()),sessionStorage.getItem("orderId")&&U&&G.current&&Date.now()-G.current>=1e4&&($.current=!0,C(),sessionStorage.removeItem("orderId"))},[U]),i.useEffect(()=>{const p=sessionStorage.getItem("paymentMethod");if(p){const E=document.getElementById(`payment_method_${JSON.parse(p).id}`);E&&(E.checked=!1),sessionStorage.removeItem("paymentMethod")}},[]);const H=p=>{if($.current)return;$.current=!0,sessionStorage.setItem("cartAbandoned","true");const E=JSON.stringify({email:p,checkoutId:r==null?void 0:r.id,_action:ge.ABANDON_CART});a(E,{action:"/checkout",navigate:!1,method:"post"}),C()};return i.useEffect(()=>{L&&(r!=null&&r.id)&&!sessionStorage.getItem("abandonCartParams")&&h({email:L,checkoutId:r==null?void 0:r.id,_action:ge.ABANDON_CART})},[L,r==null?void 0:r.id]),i.useEffect(()=>{const p=Date.now()-K.current;!$.current&&L&&(r!=null&&r.id)&&p>=9e4&&G.current===null&&H(L)},[L,r==null?void 0:r.id]),i.useEffect(()=>{b&&b.length>0&&w(b)},[b]),e.jsxs("div",{className:"position-relative",children:[(U||!v||v.length===0)&&e.jsx("div",{className:"page-overlay productlist--loading position-fixed",style:{to
1p:0,left:0,right:0,bottom:0,zIndex:9999,backgroundColor:"rgba(255, 255, 255, 0.8)"},children:e.jsx("div",{className:"d-flex justify-content-center align-items-center h-100",children:e.jsx("div",{className:"spinner-border",role:"status",children:e.jsx("span",{className:"sr-only",children:"Loading..."})})})}),v&&v.length>0&&e.jsx($s,{customer:d,children:e.jsx(_t,{terms:c,children:e.jsx(qs,{paymentMethods:s,sortOrder:l,returnUrl:Z.origin+"/thank-you",children:e.jsx(bt,{children:e.jsx(Us,{children:e.jsx(Hs,{children:e.jsx(ht,{shippingOption:N,branches:o,sendEmail:Q})})})})})})})]})};export{Lt as ErrorBoundary,$t as default,Ot as meta};
2//# sourceMappingURL=checkout-Bb-5yyiM.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.