1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4011],{45709:(e,r,t)=>{"use strict";t.d(r,{n:()=>o});var s=t(803);let i={IE:"pk_test_51PkhkN03WNbiwYerYPCEKksSpnaJRJh3lKnmQL752UJvfEHai5nbNeZzN13Ui6dS0PnWElcfVZGSzg8NL3aQ1n8J00UoLJlTsZ",XI:"pk_test_51PkhkN03WNbiwYerYPCEKksSpnaJRJh3lKnmQL752UJvfEHai5nbNeZzN13Ui6dS0PnWElcfVZGSzg8NL3aQ1n8J00UoLJlTsZ",US:"pk_live_51MZK55Gu5fAFjK0Lii2lL24UpRAAqIHsDR539TZssPMoR52L5gxeKeJbbdGzIxIjvXXMwD77RFRSRIPsqLXXVKtE00QK6Vcwvt",PL:"pk_test_51T1R3RKHw2oGi20jIEViQM4zYZ6RvnnZbBBnI7K4nz0rgCunpOYcbeKn5pK0u49merhLk4kpHnuj7wrf3Fnd7atv00vbzYPQYL"},o=e=>{if(!e)return null;let r=i[e];return r?(0,s.loadStripe)(r):null}},63769:(e,r,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/[country]/checkout",function(){return t(79784)}])},79784:(e,r,t)=>{"use strict";t.r(r),t.d(r,{__N_SSP:()=>eA,default:()=>ew});var s=t(37876),i=t(10748),o=t(19581),n=t(30966),a=t(14232),l=t(52913),d=t(30647),c=t(14169),u=t(25407),m=t(66402),p=t(61902),h=t(5302),g=t(78234),y=t(40575),f=t(77561),v=t(53104),x=t(48230),E=t.n(x),b=t(88229),N=t(73985),j=t(89099),C=t(14430),A=t(89810);function w({data:e}){let r="X1338E7867FAD49F29306D240C5087DF8",t=(0,a.useRef)(!1);return((0,a.useEffect)(()=>{if(!r||t.current)return;let e=setTimeout(()=>{let e=document.getElementById("trusted-shops-badge");e&&e.remove();let s=document.createElement("script");s.id="trusted-shops-badge-checkout",s.src=`//widgets.trustedshops.com/js/${r}.js`,s.async=!0,document.body.appendChild(s),t.current=!0},500);return()=>clearTimeout(e)},[r]),r)?(0,s.jsxs)("div",{id:A.J.container,style:{display:"none"},children:[(0,s.jsx)("span",{id:A.J.orderNumber,children:e.orderNumber}),(0,s.jsx)("span",{id:A.J.buyerEmail,children:e.buyerEmail}),(0,s.jsx)("span",{id:A.J.orderAmount,children:e.orderAmount}),(0,s.jsx)("span",{id:A.J.orderCurrency,children:e.orderCurrency}),e.orderPaymentType&&(0,s.jsx)("span",{id:A.J.orderPaymentType,children:e.orderPaymentType}),e.products.map((e,r)=>(0,s.jsx)("span",{className:A.J.productItemClass,children:(0,s.jsx)("span",{className:A.J.productSkuClass,children:e.sku})},r))]}):null}t(78555);var k=t(83388);function S({order:e,variants:r}){let{t}=(0,l.A)(),{customer:i}=(0,g.cN)(),o=(0,j.useRouter)(),{language:n,urlCountry:a}=(0,C.JK)(o),{checkoutEnabled:c}=(0,k.A)();return(0,s.jsxs)(y.x,{children:[(0,s.jsxs)(y.x.Col,{md:8,children:[(0,s.jsx)(f.h,{order:1,"data-cy":"order-success",color:"sarred.4",weight:500,children:t("common:orderSuccessful")}),(0,s.jsx)(d.E,{mt:"md",weight:700,children:t("common:youWillReceiveConfirmation")}),(0,s.jsxs)(d.E,{weight:700,children:[t("common:orderNumber"),": ",e.orderNumber||""]}),(0,s.jsxs)(v.Y,{my:"lg",children:[i&&(0,s.jsx)(u.$,{component:E(),href:`/${n}/${a}/customer/orders`,className:"secondary",children:t("forms:orderOverviewLabel")}),(0,s.jsx)(u.$,{component:E(),href:`/${n}/${a}`,children:t("forms:continueShoppingLabel")})]}),(0,s.jsx)(f.h,{order:2,mt:"xl",mb:"md",weight:700,children:t("common:orderedArticle")}),(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsx)("table",{className:"table-auto border-collapse",children:(0,s.jsx)("tbody",{children:e.lineItems.map(e=>{let t=r?.find(r=>r.sku===e.variant.sku);return(0,s.jsx)(N.c,{item:e,variant:t?{sku:t.sku,variant:t}:void 0},e.id)})})})})]}),(0,s.jsx)(y.x.Col,{md:4,children:(0,s.jsx)(b.sK,{data:e})}),c&&(0,s.jsx)(w,{data:function(e){let r=e.taxedPrice?.totalGross||e.totalPrice,t=(r.centAmount/100).toFixed(2);return{orderNumber:e.orderNumber||e.id,buyerEmail:e.customerEmail||"",orderAmount:t,orderCurrency:r.currencyCode,orderPaymentType:e.custom?.fields?.paymentMethod,products:e.lineItems.map(e=>({sku:e.variant?.sku||e.productId}))}}(e)})]})}var I=t(3934),$=t(67948),P=t(35215),L=t(19093),R=t(97389);function T(e,r,t="Unknown"){return e?"string"==typeof e?e:e[r]??e.en??Object.values(e)[0]??t:t}let M={SHIPPING_ADDRESS_INCOMPLETE:"checkoutAddressIncomplete",TAX_NOT_CALCULATED:"checkoutTaxUnavailable",ORDER_FIELDS_MISSING:"checkoutOrderFieldsMissing",SHARPS_UPGRADE_REQUIRED:"sharpsRestrictionOrderBlocked"};function O(e){return e?.code&&M[e.code]||null}function _({variants:e}){let{t:r}=(0,l.A)(),t=(0,n.FU)(),{cart:i,createNewCart:y}=(0,h._$)(),{location:f}=(0,I.zy)(),{customer:v}=(0,g.cN)(),x=(0,p.useStripe)(),E=(0,j.useRouter)(),{originalLocale:b,urlCountry:N,language:A}=(0,C.JK)(E),{allowOrderAsGuest:w}=(0,k.A)(),[M,_]=(0,a.useState)(!1),[D,B]=(0,a.useState)(!1),[F,K]=(0,a.useState)(null),[z,J]=(0,a.useState)(null),[U,q]=(0,a.useState)(null),{regonData:G}=(0,L.D)(),Z=f?.country==="PL";function X(){t.setFieldValue("payment",{...t.values.payment,method:null,
1stripePaymentMethod:void 0,individualOrderNumber:""})}let{payment:V}=t.values,H=(0,a.useRef)(!1),Y=(0,a.useRef)(!1),Q=(0,P.vd)(),W=async e=>{if(f&&f.storeKey){if(!Y.current){(0,$.Du)({transactionId:e.orderNumber||e.id,items:e.lineItems.map(e=>({itemId:e.variant.sku||"",itemName:T(e.name,b),price:(e.price?.value?.centAmount||0)/100,quantity:e.quantity,category:T(e.productType?.obj?.name,b,e.productType?.id||"Unknown")})),tax:e.taxedPrice?.taxPortions?.[0]?.amount?.centAmount!=null?e.taxedPrice.taxPortions[0].amount.centAmount/100:void 0,shipping:e.shippingInfo?.price?.centAmount!=null?e.shippingInfo.price.centAmount/100:void 0,coupon:e.discountCodes?.[0]?.discountCode?.obj?.code||e.discountCodes?.[0]?.discountCode?.id});let r=(0,P.Hj)(A),t=e.totalPrice?.currencyCode||"",s=new Map;e.lineItems.forEach(e=>{let t=`${e.productId}.${e.variant.id}`,i=Q(t),o=i?.indexName||r,n=i?.queryID,a=`${o}::${n||""}`,l=s.get(a)||{indexName:o,queryID:n,objects:[]};l.objects.push({objectID:t,price:e.totalPrice?.centAmount!=null&&e.quantity>0?e.totalPrice.centAmount/e.quantity/100:(e.price?.value?.centAmount||0)/100,quantity:e.quantity}),s.set(a,l)}),s.forEach(e=>{(0,P.Du)(e.indexName,e.objects,t,e.queryID)}),Y.current=!0}await y(),q(e),t.reset(),(0,n.I5)()}};return((0,a.useEffect)(()=>{if(!v&&!w){H.current=!0;return}if(H.current||!i||i?.lineItems?.length===0||!t.values.payment.method)return;if(Z&&!G?.eligible){R.$e.show({title:r("forms:regonNotEligibleTitle"),message:r("forms:regonNotEligibleMessage"),...o.TF.ERROR}),_(!0),H.current=!0;return}let e=e=>!!e?.country&&!!e?.streetName&&!!e?.postalCode&&!!e?.city,s=v?.addresses?.find(e=>e.id===v.defaultShippingAddressId)||v?.addresses?.find(e=>e.id===v.defaultBillingAddressId);if(!e(i.shippingAddress)&&!e(s)){J("checkoutAddressIncomplete"),_(!0),H.current=!0;return}if(v&&(t.values.customer.saveBillingAddress&&(0,n.Ex)(v,t.values.customer.billingAddress,"billing").catch(e=>{}),t.values.customer.saveShippingAddress&&(0,n.Ex)(v,t.values.customer.shippingAddress,"shipping").catch(e=>{})),"creditcard"===V.method&&V.stripePaymentMethod&&x){let e=f?.country;if(!e){console.error("Stripe checkout requires a resolved country code"),_(!0),H.current=!0;return}let r="Disabled"===i.taxMode?i.totalPrice.centAmount:i.taxedPrice?.totalGross?.centAmount;if(null==r){(0,n.UE)("Cart reached payment with no taxed total",{cartId:i.id,taxMode:i.taxMode,country:e,customerEmail:t.values.customer.email}),J("checkoutTaxUnavailable"),_(!0),H.current=!0;return}let s=t.values.customer.email||v?.email||"unknown",o=v?.id??`${new Date().getTime()}-${s}`,a=v?.custom?.fields?.stripeCustomerId||t.values.payment.stripeCustomerID,l=V.stripePaymentMethod.id;(async()=>{let i,d=await (0,n.eQ)(l,r,o,s,e,a,`Pending checkout â ${s}`,"manual"),c=await (0,n.K7)(x,d,e),u=c?.id??d.id;try{i=await (0,n.fS)(b,!!v,v?.custom?.fields?.preregistered,t.values.customer.customerGroup,t.values.shipping.carrierCode??void 0,u,t.values.payment.method,v?void 0:t.values.customer.firstName,v?void 0:t.values.customer.lastName,t.values.customer.companyName,"Paid",t.values.customer.vatGroup,t.values.customer.territorialSelfGovernmentUnit,t.values.customer.taxID,t.values.customer.invoiceEmail,t.values.customer.invoiceOperatorCode,t.values.customer.saveBillingAddress,t.values.customer.saveShippingAddress)}catch(e){throw await (0,n.HY)(u,b).catch(r=>{let t=r?.message||"unknown";console.error("Failed to cancel stripe authorization after order failure",r),(0,$.Oz)({errorMessage:`Stripe authorization left orphaned: ${u} â ${t}`,errorType:"api_error"}),(0,n.UE)("Stripe authorization left orphaned (cancel failed after order error)",{paymentIntentId:u,orderError:e?.message||"unknown",cancelError:t,customerEmail:s,locale:b,country:f?.country})}),e}let m=i.orderNumber||i.id,p=v?.customerNumber??i.customerEmail??"GUEST",h=`Order: ${m} | Customer: ${p} | Email: ${s}`;try{await (0,n.Fz)(u,h,b,{orderNumber:m})}catch(e){console.error("Failed to update stripe payment intent description",e)}let g=await (0,n.Jk)(u,b,i.id,m).catch(e=>{let r=e?.message||"unknown";return console.error("Failed to capture stripe payment intent",e),(0,$.Oz)({errorMessage:`Stripe capture failed for paid order: ${u} (order ${m}) â ${r}`,errorType:"api_error"}),(0,n.UE)("Stripe capture failed for already-created order",{paymentIntentId:u,orderId:i.id,orderNumber:m,customerEmail:i.customerEmail||s,captureError:r,locale:b,country:f?.country}),null});return g&&"captureDeferred"in g&&g.captureDeferred&&(0,n.UE)("Stripe capture deferred (server retries exhausted)",{paymentIntentId:u,orderId:i.id,orderNumber:m,customerEmail:i.customerEmail||s,locale:b,country:f?.country}),i})().then(W).catch(e=>{let r=O(e);e?.code==="CART_TOTAL_CHANGED"?B(!0):r?J(r):e&&"object"==typeof e&&"i18nKey"in e&&e.
1i18nKey?K(e.i18nKey):(0,$.Oz)({errorMessage:e?.message||"Failed to create order with Stripe payment",errorType:"api_error"}),_(!0)}).finally(()=>{v||X()})}else if("blik"===V.method&&x){let e=t.values.payment.blikCode?.trim();if(!e||6!==e.length)return void _(!0);let r=t.values.customer.email||v?.email||"unknown",s=v?.id??`${new Date().getTime()}-${r}`,o=v?.custom?.fields?.stripeCustomerId||t.values.payment.stripeCustomerID,a=`${t.values.customer.firstName||""} ${t.values.customer.lastName||""}`.trim()||r,l=async()=>{let l=await (0,n.vX)(i.taxedPrice?.totalGross?.centAmount||0,s,r,b,o,`Pending BLIK checkout â ${r}`);await (0,n.V8)(x,l.client_secret,e,{name:a,email:r}),await (0,n.fS)(b,!!v,v?.custom?.fields?.preregistered,t.values.customer.customerGroup,t.values.shipping.carrierCode??void 0,l.id,"blik",!v?t.values.customer.firstName:void 0,!v?t.values.customer.lastName:void 0,t.values.customer.companyName,void 0,t.values.customer.vatGroup,t.values.customer.territorialSelfGovernmentUnit,t.values.customer.taxID,t.values.customer.invoiceEmail,t.values.customer.invoiceOperatorCode,t.values.customer.saveBillingAddress,t.values.customer.saveShippingAddress).then(W)};H.current=!0,l().catch(e=>{let r=O(e);e&&"object"==typeof e&&"i18nKey"in e&&e.i18nKey?K(e.i18nKey):r?J(r):(0,$.Oz)({errorMessage:e?.message||"Failed BLIK payment",errorType:"api_error"}),_(!0),v||X()})}else"invoice"===V.method&&(v||w)?(0,n.fS)(b,!!v,v?.custom?.fields?.preregistered,t.values.customer.customerGroup,t.values.shipping.carrierCode??void 0,void 0,t.values.payment.method,!v?t.values.customer.firstName:void 0,!v?t.values.customer.lastName:void 0,t.values.customer.companyName,void 0,t.values.customer.vatGroup,t.values.customer.territorialSelfGovernmentUnit,t.values.customer.taxID,t.values.customer.invoiceEmail,t.values.customer.invoiceOperatorCode,t.values.customer.saveBillingAddress,t.values.customer.saveShippingAddress).then(W).catch(e=>{let r=O(e);e?.code==="CART_TOTAL_CHANGED"?B(!0):r?J(r):(0,$.Oz)({errorMessage:e?.message||"Failed to create order with invoice payment",errorType:"api_error"}),_(!0)}):(X(),_(!0));H.current=!0},[i,v]),M)?D?(0,s.jsx)(d.E,{children:r("common:cartTotalChangedError")}):F?(0,s.jsx)(d.E,{children:r(`common:${F}`)}):z?(0,s.jsxs)(c.s,{justify:"center",direction:"column",align:"center",children:[(0,s.jsx)(d.E,{my:"xl",children:r(`common:${z}`)}),(0,s.jsx)(u.$,{onClick:()=>E.push(`/${A}/${N}/checkout`),children:r("common:checkoutBackToAddress")})]}):(0,s.jsx)(d.E,{children:r("common:orderProcessingError")}):v||w?U?(0,s.jsx)(S,{order:U,variants:e}):(0,s.jsxs)(c.s,{justify:"center",direction:"column",align:"center",children:[(0,s.jsx)(d.E,{my:"xl",children:r("common:orderProcessing")}),(0,s.jsx)(m.a,{my:"xl",color:"red",size:"lg"})]}):(0,s.jsxs)(c.s,{justify:"center",direction:"column",align:"center",children:[(0,s.jsx)(d.E,{my:"xl",children:r("common:anonymousOrderNotSupported")}),(0,s.jsx)(u.$,{onClick:()=>E.push(`/${A}/${N}/user/login`),children:r("common:login")})]})}var D=t(45709);function B({location:e,locale:r,children:t}){let{cart:i}=(0,h._$)(),[o,n]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&!o&&n((0,D.n)(e))},[e,o]);let l=i?.totalPrice?.currencyCode||"usd",d=r?r.split("-")[0].toLowerCase():"en",c={mode:"payment",amount:1099,currency:l?.toLowerCase(),paymentMethodCreation:"manual",locale:d,appearance:{theme:"stripe"}};return(0,s.jsx)(p.Elements,{options:c,stripe:o,children:t})}var F=t(14739),K=t(95068),z=t(40222),J=t(30406),U=t(39277),q=t(85671),G=t(54498),Z=t(6909),X=t(88828),V=t(3033),H=t(70332),Y=t(27343),Q=t(27786),W=t(47497),ee=t(5076),er=t(4454),et=t(99824),es=t(90696),ei=t(75511),eo=t(3502);let en={src:"/_next/static/media/Logo_default.7eb407d1.svg",height:46,width:283,blurWidth:0,blurHeight:0};var ea=t(77328),el=t.n(ea),ed=t(54587),ec=t.n(ed),eu=t(26250),em=t(91535),ep=t(75656),eh=t(74226),eg=t(43123),ey=t(51695),ef=t(57639),ev=t(48727),ex=t(90657);function eE({isBackorderAllowed:e,disableNextStep:r,isNextStepDisabled:t,isBelowMinimumOrder:i,formattedMinimumOrder:o,nextStep:n,country:a,consentMissing:d}){let{t:c}=(0,l.A)(),{isValidating:m,regonData:p,error:h,isRegonValidated:g}=(0,L.D)(),y="PL"===a&&(m||!g||!!h||!p?.eligible);return(0,s.jsx)(u.$,{disabled:!e||r||y||d,loading:t,ml:"auto",onClick:n,"data-cy":"proceed",sx:{transition:"background-color 300ms ease, border-color 300ms ease, color 300ms ease"},children:i?c("common:minimumOrderNotReached",{amount:o}
1):c("common:orderNew")})}let eb=e=>({streetName:e.streetName??"",city:e.city??"",postalCode:e.postalCode??"",country:e.country??"",state:e.state??""}),eN=(e,r)=>{if(!r)return!1;let t=eb(e);return t.streetName===r.streetName&&t.city===r.city&&t.postalCode===r.postalCode&&t.country===r.country&&t.state===r.state},ej=({customerId:e,shippingbox:r,qualitySeal:t,variants:p})=>{let{t:h}=(0,l.A)(),{location:g}=(0,I.zy)(),{allowOrderAsGuest:v,region:x}=(0,k.A)(),b=(0,j.useRouter)(),[N,A]=(0,a.useState)(0),[w,S]=(0,a.useState)(!1),[$,P]=(0,a.useState)(!1),{setCustomerDetails:R,recalculateCart:T,cart:M,addCustomFields:O,isAllowedCheckout:D,isBelowMinimumOrder:F,formattedMinimumOrder:z}=(0,o._$)(),[J,en]=(0,a.useState)(e),[ea,ed]=(0,a.useState)(!!e),[ec,ey]=(0,a.useState)(!1),[ej,eC]=(0,a.useState)(""),[eA,ew]=(0,a.useState)({open:!1}),[ek,eS]=(0,a.useState)(null),[eI,e$]=(0,a.useState)(null),[,eP]=(0,a.useState)("invoice"),[,eL]=(0,a.useState)(),[eR,eT]=(0,a.useState)(!1),{mutate:eM}=(0,em.iX)(),{customer:eO,customerConfig:{backorderAllowed:e_},isCustomerLoading:eD,mutate:eB}=(0,o.cN)();(0,a.useEffect)(()=>{eM("/api/auth/get-customer-id")},[eM]);let eF=(0,a.useMemo)(()=>!D||M?.lineItems?.length===0,[D,M?.lineItems?.length]);(0,a.useEffect)(()=>{eO?.id&&!eW.current&&(en(eO.id),ea||ed(!0))},[eO?.id,ea]),function(){let e=(0,j.useRouter)(),r=(0,a.useRef)(!1),[t,s]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t=e.pathname.includes("/checkout");r.current=t,s(t);let i=e=>{!e.includes("/checkout")&&r.current&&(0,n.I5)()},o=e=>{let t=r.current,i=e.includes("/checkout");r.current=i,s(i),t&&!i&&(0,n.I5)()},a=()=>{(0,n.I5)()},l=()=>{(0,n.I5)()},d=()=>{(0,n.I5)()};return window.addEventListener("beforeunload",a),window.addEventListener("unload",d),window.addEventListener("pagehide",l),e.events.on("routeChangeStart",i),e.events.on("routeChangeComplete",o),()=>{(0,n.I5)(),window.removeEventListener("beforeunload",a),window.removeEventListener("unload",d),window.removeEventListener("pagehide",l),e.events.off("routeChangeStart",i),e.events.off("routeChangeComplete",o)}},[e.events,e.pathname]),(0,a.useEffect)(()=>{let e=()=>{window.location.pathname.includes("/checkout")||(0,n.I5)()};return window.addEventListener("focus",e),()=>{window.removeEventListener("focus",e)}},[])}();let{data:eK}=(0,ep.Ay)(M?.id?`/api/commercetools/cart/get-low-stock-warning?cartId=${M.id}`:null,{refreshInterval:1e4}),ez=eK?.success?eK.lowStockItems:[],eJ=eK?.success?eK.lowButBackorderAllowed:[],eU=ez.filter(e=>!eJ.includes(e)),{country:eq,language:eG}=(0,C.JK)(b);function eZ(){return 0===ez.length||!!e_&&0===eU.length}let eX=(0,a.useMemo)(()=>(0,G.a)(g?.country),[g?.country]),{isRegonValidated:eV,isValidating:eH}=(0,L.D)(),eY=(0,a.useRef)(function(){let e=window.localStorage.getItem("checkout-form-state-v2");if(e)try{let r=JSON.parse(e);return r?.customer?.billingAddress?.country||(r.customer.billingAddress.country=eq),r?.customer?.shippingAddress?.country||(r.customer.shippingAddress.country=eq),r}catch{return}}()),eQ=(0,a.useRef)(null),eW=(0,a.useRef)(!1),e0=(0,n.cW)({initialValues:eY.current||{...n.XE,customer:{...n.XE.customer,billingAddress:{...n.XE.customer.billingAddress,country:eq},shippingAddress:{...n.XE.customer.shippingAddress,country:eq}}},validate:{customer:0===N?{nip:(e,r)=>"PL"===r.customer.billingAddress.country?(0,ei.h)(h("forms:errorNipEmpty"))(e):null,firstName:(0,ei.h)(h(x.isNordic?"forms:errorNameEmpty":"forms:errorFirstNameEmpty")),lastName:x.isNordic?void 0:(0,ei.h)(h("forms:errorLastNameEmpty")),phone:(0,V.Z1)({country:g?.country,isRequired:eX.phone.isRequired,requiredMessage:h("forms:errorInputEmpty"),invalidMessage:h("forms:phoneMinLengthError"),tooLongMessage:h("forms:phoneMaxLengthError")}),email:(0,eo.x)(h("forms:errorEmailInvalid")),companyName:(0,ei.h)(h("forms:errorBusinessEmpty")),taxID:!eO&&eX.taxID?.isRequired?(0,ei.h)(h("forms:errorInputEmpty")):void 0,invoiceOperatorCode:!eO&&eX.invoiceOperatorCode?.isRequired?(0,ei.h)(h("forms:errorInputEmpty")):void 0,invoiceEmail:e=>!eO&&eX.invoiceEmail?.isRequired&&!e?h("forms:errorInputEmpty"):!eO&&e?(0,eo.x)(h("forms:errorEmailInvalid"))(e):null,billingAddress:{firstName:x.isNordic?void 0:(0,ei.h)(h("forms:errorFirstNameEmpty")),lastName:x.isNordic?void 0:(0,ei.h)(h("forms:errorLastNameEmpty")),streetName:(0,ei.h)(h("forms:errorStreetEmpty")),postalCode:(0,ei.h)(h("forms:errorZipInvalid")),city:(0,ei.h)(h("forms:errorCityEmpty")),country:(0,ei.h)(h("forms:errorCountryEmpty")),company:(e,r)=>"US"===r.customer.billingAddress.country?e&&e.trim()?null:h("forms:errorCompanyEmpty"):null,state:eX.state.isRequired?(0,ei.h)(h("forms:errorStateEmpty")):void 0},shippingAddress:{firstName:(e,r)=>r.customer.shippingIsBilling?null:(0,ei.h)(h(x.isNordic?"forms:errorNameEmpty":"forms:errorFirstNameEmpty"))(e),lastName:(e,r)=>r.customer.shippingIsBilling||x.isNordic?null:(0,ei.h)(h("forms:errorLastNameEmpty"))(e),streetName:(e,r)=>r.customer.shippingIsBilling?null:(0,ei.h)(h("forms:errorStreetEmpty"))(e),postalCode:(e,r)=>r.customer.shippingIsBilling?null:(0,ei.h)(h("forms:errorZipInvalid"))(e),city:(e,r)=>r.customer.shippingIsBilling?null:(0,ei.h)(h("forms:errorCityEmpty"))(e),country:(e,r)=>r.customer.shippingIsBilling?null:(0,ei.h)(h("forms:errorCountryEmpty"))(e),company:(e,r)=>r.customer.shippingIsBilling?null:"US"===r.customer.shippingAddress.country?e&&e.trim()?null:h("forms:errorCompanyEmpty"):null,state:(e,r)=>r.customer.shippingIsBilling?null:eX.state.isRequired?(0,ei.h)(h("forms:errorStateEmpty"))(e):void 0,phone:(e,r)=>r.customer.shippingIsBilling||!(0,Y.$1)(r.customer.shippingAddress.country)?null:(0,V.Z1)({country:r.customer.shippingAddress.country,isRequired:!0,requiredMessage:h("forms:errorInputEmpty"),invalidMessage:h("forms:phoneMinLengthError"),tooLongMessage:h("forms:phoneMaxLengthError")})(e),email:(e,r)=>r.customer.shippingIsBilling||!(0,Y.$1)(r.customer.shippingAddress.country)?null:e?(0,eo.x)(h("forms:errorEmailInvalid"))(e):null}}:{},payment:1===N?{stripePaymentMethod:(e,r)=>"creditcard"!==r.payment.method||r.payment.stripePaymentMethod?null:h("forms:stripeMissing"),method:(e,r)=>"creditcard"!==r.payment.method||e?(0,ei.h)(h("forms:paymentMethodMissing"))(e):h("forms:paymentMethodMissing"),blikCode:(e,r)=>"blik"!==r.payment.method||e&&6===e.trim().length?null:h("forms:errorInputEmpty"),individualOrder
1Number:(e,r)=>(0,Q.E)(r.customer.billingAddress.country,r.payment.method)?(0,ei.h)(h("forms:orderNumberMissing"))(e):null}:{},shipping:1===N?{method:e=>(0,ei.h)(h("forms:errorCarrierCodeMissing"))(e),carrierCode:(e,r)=>"Express"===r.shipping.method?(0,ei.h)(h("forms:errorCarrierCodeMissing"))(e):null}:{}}});(0,a.useEffect)(()=>{window.localStorage.setItem("checkout-form-state-v2",JSON.stringify(e0.values))},[e0.values]),(0,a.useEffect)(()=>{M?.lineItems?.length===0&&b.push(`/${eG}/${(0,C.$9)(eq)}/cart`)},[]),(0,a.useEffect)(()=>{if(eR||!M||J&&!eO||eD)return;let e={...e0.values};if(e={...e,...(0,n.ZP)(e,(0,n.Lo)(M))},eO){let r=!eY.current;e={...e,...(0,n.ZP)(e,(0,n.Jw)(eO),{preferNew:r})}}e.customer.billingAddress.country||(e.customer.billingAddress.country=eq),e.customer.shippingAddress.country||(e.customer.shippingAddress.country=eq),e0.setValues(e),eT(!0)},[M,eO,eD,J]),(0,a.useEffect)(()=>{if(eW.current)return;let e=(0,n.On)(e0.values),{shouldPopulate:r,nextPopulatedId:t}=(0,n.zJ)(eQ.current,eO?.id,eR,e);if(eQ.current=t,!r||!eO)return;let s=(0,n.Jw)(eO),i={...e0.values},o={...i,...(0,n.ZP)(i,s,{preferNew:!e})};JSON.stringify(i)!==JSON.stringify(o)&&e0.setValues(o)},[eO,eR]);let e1=async()=>{if(e0.validate().hasErrors)return!1;ey(!1),eC("");let e=g?.country==="PL",r=e0.values.customer.shippingIsBilling,t=e0.values.customer.billingAddress,s=function({country:e,isBilling:r,isShipping:t=!1}){return r&&!t&&(0,X.go)(e)}({country:g?.country,isBilling:!0,isShipping:!1});if(!e&&!s&&!eN(t,ek)){let e={line1:t.streetName,city:t.city,postalCode:t.postalCode,country:t.country,state:t.state},r=await (0,n.dC)([e]);if(!r?.success)return ey(!0),r?.fieldErrors?(eC(""),Object.entries(r.fieldErrors).forEach(([e,r])=>{let t=h(`forms:${r}`)||String(r),s=(0,Z.rk)(e,"billing");s&&e0.setFieldError(s,t)})):r?.error?.message&&eC(String(r.error.message)),(0,ev.Po)(t.country)&&ew({open:!0,suggested:r?.suggestedAddress,addressType:"billing"}),!1}let i=r?t:e0.values.customer.shippingAddress,o=r?"billing":"shipping";if(!r||s){if(x.isNordic&&i.country!==g?.country)return e0.setFieldError(`customer.${r?"billingAddress":"shippingAddress"}.country`,h("forms:shippingCountryRestriction")),ey(!0),!1;if(!eN(i,r?ek:eI)){let e={line1:i.streetName,city:i.city,postalCode:i.postalCode,country:i.country,state:i.state},r=await (0,n.dC)([e]);if(!r?.success)return ey(!0),r?.fieldErrors?(eC(""),Object.entries(r.fieldErrors).forEach(([e,r])=>{let t=h(`forms:${r}`)||String(r),s=(0,Z.rk)(e,o);s&&e0.setFieldError(s,t)})):r?.error?.message&&eC(String(r.error.message)),(0,ev.Po)(i.country)&&ew({open:!0,suggested:r?.suggestedAddress,addressType:o}),!1}}return!0},e5=async()=>{if(!g?.storeKey)return;let e=(0,H.sS)(e0.values.customer.billingAddress),r=(0,H.sS)(e0.values.customer.shippingIsBilling?e0.values.customer.billingAddress:e0.values.customer.shippingAddress),t=x.isNordic?{...e,lastName:void 0}:e,s=x.isNordic?{...r,lastName:void 0}:r;await R({customer:{id:J??void 0,email:e0.values.customer.email,industry:e0.values.customer.industry,sarstedtCustomerNumber:J?eO?.custom?.fields?.sarstedtCustomerNumber:void 0,nip:e0.values.customer.nip||void 0},storeKey:g.storeKey,billingAddress:t,shippingAddress:s}),J&&((await fetch("/api/commercetools/customer/update-customer-fields",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taxID:e0.values.customer.taxID,invoiceEmail:e0.values.customer.invoiceEmail,invoiceOperatorCode:e0.values.customer.invoiceOperatorCode,phone:e0.values.customer.phone,...!(0,Y.$1)(g?.country)&&{department:e0.values.customer.department}})})).ok||console.error("Failed to update customer business invoicing fields"))},e7=async e=>{try{let r=await fetch(`/api/auth/is-email-used?email=${encodeURIComponent(e)}`);
1if(!r.ok)throw Error("Failed to check email usage");let{exists:t}=await r.json();return t}catch(e){return console.error("Error checking email usage:",e),!1}},e8=()=>!!e0.values.extras?.rabattCodeNumber?.trim()&&!M?.discountCodes?.length,e3=async()=>{if(!await e1()||!g?.storeKey)return!1;if(!J&&!eO?.id&&!eW.current&&await e7(e0.values.customer.email)){let e=h("forms:errorEmailAlreadyInUse");return ey(!0),eC(e),e0.setFieldError("customer.email",e),!1}return await e5(),!0},e2=async()=>{if(e0.validate().hasErrors)return!1;if(M){let e={...M.custom?.fields,purchaseOrderNumber:e0.values.payment.individualOrderNumber,transactionId:e0.values.payment.stripePaymentMethod?.id,paymentMethod:"string"==typeof e0.values.payment.method?e0.values.payment.method:void 0,carrierCode:"Express"===e0.values.shipping.method?e0.values.shipping.carrierCode:"",customerStatus:eO?.custom?.fields?.preregistered||(eO?.custom?.fields?.sarstedtCustomerNumber?"Bestandskunde":"Gast"),industry:e0.values.customer.industry,isShippingCostExempt:(0,ex.Xk)(M,eO||null,g?.country)};if(Object.keys(e).length>0)try{await O(e,g?.storeKey)}catch(e){console.error("Error adding custom fields to cart:",e)}}return!0},e4=async()=>{let e=e0.validate();if(e.hasErrors)return void(0,W.$w)(e.errors);if((0!==N||(()=>{let{customer:e}=e0.values;return(g?.country!=="PL"||!!e.nip?.trim()&&!!eV)&&!!(e.firstName?.trim()&&(x.isNordic||e.lastName?.trim())&&e.email?.trim()&&e.companyName?.trim()&&(x.isNordic||e.billingAddress.firstName?.trim())&&(x.isNordic||e.billingAddress.lastName?.trim())&&e.billingAddress.streetName?.trim()&&e.billingAddress.postalCode?.trim()&&e.billingAddress.city?.trim()&&e.billingAddress.country?.trim())&&(!eX.state.isRequired||!!e.billingAddress.state?.trim())&&(!!e.shippingIsBilling||!!(e.shippingAddress.firstName?.trim()&&(x.isNordic||e.shippingAddress.lastName?.trim())&&e.shippingAddress.streetName?.trim()&&e.shippingAddress.postalCode?.trim()&&e.shippingAddress.city?.trim()&&e.shippingAddress.country?.trim())&&(!eX.state.isRequired||!!e.shippingAddress.state?.trim()))&&!0})())&&(1!==N||(()=>{let{payment:e,shipping:r}=e0.values;return!(e8()||!e.method?.trim()||"creditcard"===e.method&&!e.stripePaymentMethod||"blik"===e.method&&(!e.blikCode||6!==e.blikCode.trim().length)||(0,Q.E)(e0.values.customer.billingAddress.country,e.method)&&!e.individualOrderNumber?.trim())&&!!r.method?.trim()&&("Express"!==r.method||!!r.carrierCode?.trim())})())){P(!0);try{switch(N){case 0:if(!await e3())return;break;case 1:if(!await e2())return}await T(),A(e=>e<3?e+1:e)}finally{P(!1)}}},e6={...t?.richText.fields,includes:t?.includes},e9={seo:{title:h("seo:checkoutTitle"),description:h("seo:checkoutDescription"),canonicalUrl:`${(0,K.$_)()}/${eG}/${(0,C.$9)(eq)}/checkout`,hreflang:{currentUrl:`${(0,K.$_)()}/${eG}/${(0,C.$9)(eq)}/checkout`,languageSlugs:{en:"/checkout",de:"/checkout",ru:"/checkout",ja:"/checkout",pt:"/checkout",fr:"/checkout",es:"/checkout"}},robots:{noFollow:!0,noIndex:!0}}},re=(0,K.cp)(e9);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ef.A,{opened:eA.open,onClose:()=>ew({open:!1}),suggestedAddress:eA.suggested,onUseSuggested:e=>{let r=eA.addressType;ew({open:!1}),ey(!1),eC(""),e0.clearErrors();let t=eb({streetName:e.line1,city:e.city,postalCode:e.postalCode,country:e.country,state:e.state});"billing"===r?(eS(t),e0.setValues({customer:{...e0.values.customer,billingAddress:{...e0.values.customer.billingAddress,streetName:e.line1,city:e.city,postalCode:e.postalCode,country:e.country,...e.state&&{state:e.state}}}})):"shipping"===r&&(e$(t),e0.setValues({customer:{...e0.values.customer,shippingAddress:{...e0.values.customer.shippingAddress,streetName:e.line1,city:e.city,postalCode:e.postalCode,country:e.country,...e.state&&{state:e.state}}}}))},onUseAsEntered:()=>{let e=eA.addressType;ew({open:!1}),ey(!1),eC(""),e0.clearErrors(),"billing"===e?eS(eb(e0.values.customer.billingAddress)):"shipping"===e&&e$(eb(e0.values.customer.shippingAddress))},addressType:eA.addressType}),(0,s.jsx)(el(),{children:(0,s.jsx)(s.Fragment,{children:re})}),ea?(0,s.jsxs)(n.E8,{form:e0,children:[(0,s.jsx)(B,{location:g?.country,locale:eG,children:(0,s.jsxs)(es.C,{active:N,color:"sarred.4",size:"md",mx:"auto",className:"w-full",breakpoint:"sm",mt:"xl",children:[(0,s.jsx)(es.C.Step,{label:h("forms:checkoutStepper1"),children:!eR||eD?(0,s.jsx)(c.s,{justify:"center",align:"center",py:"xl",mih:200,children:(0,s.jsx)(m.a,{color:"red"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.F,{mb:"md"}),(0,s.jsx)(n.eT,{fieldsVisibility:eX})]})}),(0,s.jsx)(es.C.Step,{label:h("forms:checkoutStepper2"),children:(0,s.jsx)(n.j6,{shippingbox:r,setPaymentMethod:eP,setShippingMethod:eL})}),(0,s.jsx)(es.C.Step,{label:h("forms:checkoutStepper3"),children:(0,s.jsx)(n.sC,{setStep:A,isBackorderAllowed:eZ(),variants:p,orderConsent:w,setOrderConsent:S})}),(0,s.jsx)(es.C.Completed,{children:(0,s.jsx)(_,{variants:p})})]})}),(0,s.jsx)(y.x,{children:(0,s.jsxs)(y.x.Col,{md:8,children:[ec&&(0,s.jsx)(c.s,{w:"100%",justify:"flex-end",children:(0,s.jsx)(d.E,{color:"var(--mantine-color-sarred-5)",children:ej||h("forms:errorAddressValidation")})}),(0,s.jsxs)(c.s,{mt:ec?"23px":"xl",children:[N<2&&(0,s.jsx)(u.$,{disabled:eF,mr:"auto",onClick:()=>
1{if(0===N){(0,n.I5)(),b.push(`/${eG}/${(0,C.$9)(eq)}/cart`);return}A(e=>e>0?e-1:e)},className:"secondary",children:h("common:backLabel")}),0===N&&(0,s.jsx)(u.$,{disabled:eF||g?.country==="PL"&&(!eV||eH||!e0.values.customer.nip?.trim()),loading:$||eH,ml:"auto",onClick:e4,"data-cy":"proceed",children:F?h("common:minimumOrderNotReached",{amount:z}):h("forms:nextToPayment")}),1===N&&(0,s.jsx)(u.$,{disabled:eF||e8(),loading:$,ml:"auto",onClick:e4,"data-cy":"proceed",children:F?h("common:minimumOrderNotReached",{amount:z}):h("forms:nextCheckOrder")}),2===N&&(0,s.jsx)(eE,{isBackorderAllowed:eZ(),disableNextStep:eF,isNextStepDisabled:$,isBelowMinimumOrder:F,formattedMinimumOrder:z,nextStep:e4,country:g?.country,consentMissing:!w})]})]})})]}):(0,s.jsxs)(c.s,{w:"100%",justify:"space-between",gap:"xl",sx:{"@media (max-width: 768px)":{flexDirection:"column",width:"100%",gap:"1.5rem"}},children:[(0,s.jsx)(ee.t,{maw:"624px",withBorder:!0,radius:"0",p:"48px",sx:{"@media (max-width: 768px)":{padding:"24px",width:"100%",maxWidth:"100%",marginTop:"1.5rem"}},children:(0,s.jsx)(U.A,{checkout:!0,onConfirm:async()=>{ed(!0),await eB()}})}),(0,s.jsxs)(c.s,{direction:"column",gap:"md",w:"406px",m:"auto",sx:{"@media (max-width: 768px)":{width:"100%",maxWidth:"100%",margin:0}},children:[(0,s.jsx)(f.h,{fz:"2.75rem",lh:1.3,order:2,color:"var(--mantine-color-sarred-5)",sx:{"@media (max-width: 768px)":{fontSize:"2rem"}},children:h("register:noAccountHeadline")}),(0,s.jsx)(d.E,{children:h("register:noAccountCopy")}),(0,s.jsxs)(c.s,{direction:"column",gap:"xs",bg:"var(--mantine-color-sargray-0)",px:"16px",py:"12px",children:[(0,s.jsxs)(c.s,{gap:"xs",children:[(0,s.jsx)(eu.qxq,{size:"16px",role:"presentation","aria-hidden":"true"}),(0,s.jsx)(d.E,{size:"0.875rem",mt:"-4px",children:h("register:benefit1")})]}),(0,s.jsxs)(c.s,{gap:"xs",children:[(0,s.jsx)(eu.qxq,{size:"16px",role:"presentation","aria-hidden":"true"}),(0,s.jsx)(d.E,{size:"0.875rem",mt:"-4px",children:h("register:benefit2")})]}),(0,s.jsxs)(c.s,{gap:"xs",children:[(0,s.jsx)(eu.qxq,{size:"16px",role:"presentation","aria-hidden":"true"}),(0,s.jsx)(d.E,{size:"0.875rem",mt:"-4px",children:h("register:benefit3")})]})]}),(0,s.jsx)(eg.A,{variant:"secondary",textAlign:"center",component:E(),href:`/${eG}/${(0,C.$9)(eq)}/user/registration`,children:h("register:registerButtonLabel")}),v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.E,{mt:"sm",children:h("register:orderNoRegisterCopy")}),(0,s.jsx)(er.N,{className:"link-text",disabled:!eZ(),onClick:()=>{eZ()&&(eW.current=!0,ed(!0),en(null))},children:(0,s.jsxs)(c.s,{gap:"xs",children:[(0,s.jsx)(d.E,{size:"1rem",mt:"-5px",children:(0,s.jsx)("strong",{children:h("register:noRegisterButtonLabel")})}),(0,s.jsx)(q.fl,{width:"1.125rem",height:"1.125rem"})]})})]}),!eZ()&&(0,s.jsx)(c.s,{pl:"lg",pr:"sm",py:"xs",bg:"var(--mantine-color-sarred-0)",children:(0,s.jsx)(et.C,{position:"middle-start",offset:2,size:8,color:"var(--mantine-color-sarred-6)",children:(0,s.jsx)(d.E,{color:"var(--mantine-color-sarred-1)",children:h("common:backorderNotAllowed")})})})]})]}),(0,s.jsx)(eh.A,{internalTitle:"",refId:"n/a",...e6,checkout:!0},t?.richText.sys.id)]})};function eC(){let e=(0,j.useRouter)(),{language:r,urlCountry:t}=(0,C.JK)(e);return(0,s.jsxs)("header",{style:{paddingBottom:"1rem"},children:[(0,s.jsx)("div",{className:"flex justify-between items-center py-8 flex-wrap gap-8",children:(0,s.jsx)(E(),{href:`/${r}/${t}`,children:(0,s.jsx)(ec(),{src:en,alt:"Sarstedt Logo",height:50,priority:!0})})}),(0,s.jsx)(J.A,{})]})}ej.getLayout=e=>(0,s.jsxs)(z.H,{children:[(0,s.jsx)(el(),{children:(0,s.jsx)("title",{children:"Checkout"})}),(0,s.jsx)(ey.D,{}),(0,s.jsxs)("div",{className:"flex flex-col w-full min-h-screen px-4 mx-auto max-w-7xl",children:[(0,s.jsx)(eC,{}),(0,s.jsx)("main",{id:"main-content",className:"pt-8 pb-24",tabIndex:-1,children:e}),(0,s.jsx)(F.P,{id:"footer-content"})]})]});var eA=!0;let ew=ej}},e=>{e.O(0,[4188,1078,696,636,6593,8792],()=>e(e.s=63769)),_N_E=e.O()}]);
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.