1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7916],{29994:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});var n=r(47758),a=r(3934),o=r(86435),i=r(56937),l=r(79069),s=r(24123),d=r(38345),c=r(82077),u=r(90989),p=r(83877);let h={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:{xs:"90%",sm:600,desktop:800},bgcolor:"background.paper",border:"2px solid #000",boxShadow:24,p:{xs:1,tablet:2}},m=()=>{var e,t;let{t:r}=(0,o.A)(),{state:m,dispatch:x}=(0,a.useContext)(c.M),[f,y]=(0,a.useState)({loading:!1}),A=(0,u.useRouter)(),g=async()=>{if(!f.loading){y({...f,loading:!0});try{await (0,p.oi)(),x({type:"reloadCart"}),y({...f,loading:!1})}catch(e){console.error("Error recreating cart",e),y({...f,loading:!1,error:r("Problem recreating cart. Try again later.")})}}};return(0,n.jsx)(i.A,{open:(null==m||null==(t=m.cart)||null==(e=t.existingOrderIdentifiers)?void 0:e.length)>0,children:(0,n.jsxs)(l.A,{sx:{...h},children:[(0,n.jsx)(s.A,{variant:"h4",children:r("Existing order found")}),(0,n.jsxs)(l.A,{sx:{display:"flex",flexDirection:"column"},children:[(0,n.jsxs)(l.A,{component:"p",children:[r("An order for this cart already exists, please decide how to proceed"),"."]}),f.error&&(0,n.jsx)(l.A,{sx:{color:"red"},children:f.error}),(0,n.jsx)(d.A,{variant:"contained",sx:{mb:3,mt:1},onClick:()=>g(),children:r("Create new order")}),(0,n.jsx)(d.A,{variant:"contained",sx:{mb:2},onClick:()=>void(async e=>{await (0,p.h8)(),x({type:"reloadCart"}),A.push("/order/".concat(e))})(m.cart.existingOrderIdentifiers[0]),children:r("Goto to order page of existing order")})]})]})})}},57439:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(47758),a=r(3934),o=r(5451),i=r(79069),l=r(20254),s=r(11700),d=r(39062),c=r(90989);let u=e=>{let{message:t,removeParam:r}=e,[u,p]=(0,a.useState)(!0),h=(0,c.useRouter)();return(0,n.jsx)(o.A,{open:u,anchorOrigin:{vertical:"bottom",horizontal:"center"},sx:{mb:10},children:(0,n.jsxs)(i.A,{sx:{color:"#611a15",backgroundColor:"#fdecea",border:"solid 1px",borderColor:"#d32f2f",boxShadow:12,m:0,my:1,p:2,display:"flex",alignItems:"center","& > div":{paddingRight:"1em",color:"#f44336"}},children:[(0,n.jsx)(i.A,{children:(0,n.jsx)(s.A,{})}),t,(0,n.jsx)(l.A,{onClick:()=>(()=>{if(r){let e=h.query;delete e.error,h.push({query:e},void 0,{shallow:!0})}p(!1)})(),sx:{cursor:"ponter",ml:"auto"},children:(0,n.jsx)(d.A,{})})]})})}},60178:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/[lang]/checkoutfull",function(){return r(80619)}])},80564:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var n=r(47758),a=r(3934),o=r(24366),i=r(86435),l=r(63813),s=r(83877),d=r(66805),c=r(38345),u=r(82077);let p=(0,a.memo)(function(e){let{paymentData:t,isFullCheckout:r,cartUuid:p}=e,{t:h}=(0,i.A)(),{dispatch:m}=(0,a.useContext)(u.M),x=(0,a.useRef)(0),f=()=>{let e=Date.now();e-x.current>=1e3&&((0,s.xA)(p),x.current=e)};return((0,a.useEffect)(()=>{if((0,o.oc)()&&r)return document.addEventListener("walleyCheckoutCustomerUpdated",f),document.addEventListener("walleyCheckoutShippingUpdated",f),()=>{document.removeEventListener("walleyCheckoutCustomerUpdated",f),document.removeEventListener("walleyCheckoutShippingUpdated",f)}},[]),(0,a.useEffect)(()=>{if(!(0,o.oc)()||!(null==t?void 0:t.token)||!(null==t?void 0:t.checkoutPath))return;let e="walley-checkout-container",r=document.getElementById(e);if(!r)return;r.innerHTML="";let n=document.createElement("script");return n.src="".concat(t.checkoutPath,"?q=").concat((0,l.A)(new Date)),n.setAttribute("data-token",t.token),n.setAttribute("data-container-id",e),n.setAttribute("data-lang",(e=>{switch(e){case"fi":return"fi-FI";case"se":return"sv-SE";case"no":return"nb-NO";case"dk":return"da-DK";default:return"en-EU"}})(d.constants.COUNTRY)),n.async=!0,r.appendChild(n),()=>{n.parentNode&&n.parentNode.removeChild(n),r.innerHTML=""}},[null==t?void 0:t.token,null==t?void 0:t.checkoutPath]),t)?t.error?(0,n.jsxs)(n.Fragment,{children:[h("The current status of the payment with the provider is in an open state. Please wait a few seconds and try reloading the payment."),(0,n.jsx)("br",{}),(0,n.jsx)(c.A,{sx:{mt:2},variant:"contained",color:"primary",onClick:()=>m({type:"reloadPaymentData"}),children:h("Reload payment")})]}):t.token&&t.checkoutPath?(null==t?void 0:t.token)&&(null==t?void 0:t.checkoutPath)?(0,n.jsx)("div",{id:"walley-checkout-container"}):(0,n.jsx)(n.Fragment,{}):(0,n.jsx)(n.Fragment,{children:h("Invalid payment")}):(0,n.jsx)(n.Fragment,{children:h("Unable to load payment data, try different option")})})},80619:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSP:()=>q,default:()=>G});var n=r(47758),a=r(3934),o=r(79069),i=r(72851),l=r(28013),s=r(24123),d=r(39507),c=r(47168),u=r(24557),p=r(86435),h=r(82077),m=r(49864),x=r(90989),f=r(78654),y=r(24366),A=r(70984),g=r(3950),v=r.n(g),j=r(66805),E=r(18818),C=r(57682),P=r(39139),k=r(6
17193),R=r.n(k),w=r(89545),b=r(1617),N=r(80332),I=r(54099),M=r(484),_=r.n(M),L=r(29994),S=r(83877),T=r(57439),O=r(3843),D=r(90279),U=r(80564);let F=(0,a.memo)(function(e){return(0,n.jsx)(o.A,{children:(e=>{let{type:t,paymentData:r,...a}=e;return t===D.uq.WALLEY?(0,n.jsx)(U.A,{paymentData:r,isFullCheckout:!0,cartUuid:a.cartUuid,...a}):(0,n.jsx)(n.Fragment,{})})(e)})});var Y=r(49937);let K=R()(()=>r.e(1566).then(r.bind(r,81566)),{loadableGenerated:{webpack:()=>[81566]},ssr:!1});var q=!0;let G=function(e){var t,r;let g=(0,x.useRouter)(),{t:k,locale:R,currencyString:M}=(0,p.A)(),{shopWarehouseId:U}=e,{state:q,dispatch:G}=(0,a.useContext)(h.M),{state:H}=(0,a.useContext)(E.V),{state:W,dispatch:z}=(0,a.useContext)(f.z),{cart:B,error:V,loading:X,paymentData:J,loadingPaymentData:Q,reloadPaymentData:$}=q,[Z,ee]=(0,a.useState)(null),[et,er]=(0,a.useState)(null),[en,ea]=(0,a.useState)([]),{trackPageView:eo}=(0,A.A)(),ei=(0,y.yC)(),el="".concat(k("Shopping cart")," - ").concat(ei),es=B?B.items:[],ed=B?B.soldOutItems:[],ec=(0,a.useRef)(),eu=(0,a.useRef)(),ep=(0,a.useRef)(),eh=(0,I.RG)(),em=eh?eh.allowOffer:null,ex=eh?null==eh?void 0:eh.allowOfferLimit:void 0,ef=null==(t=j.constants.FEATURES)?void 0:t.includes(Y.F.FULL_PAGE_CHECKOUT),ey=eh.fullPageCheckoutType,eA=B&&B.paymentMethod&&B.paymentMethod.id?B.paymentMethod:null,eg=B&&B.deliveryMethod&&B.deliveryMethod.id?B.deliveryMethod:null;(0,a.useEffect)(()=>{(0,y.oc)()&&B&&B.items&&eo("checkout",B,M)},[es]),(0,a.useEffect)(()=>{let e=async()=>
1{let e=await m.A.get("/api/product/suggested").catch(e=>{throw e});e.data&&ea(e.data)};q.loading||!q.loaded||W.loaded||(q.cart&&q.cart.items?q.cart.items:[]).map(e=>{(0,y.R0)(e)&&(W["".concat(e.productNumber,"--A").concat(e.amount)]||(0,y.YJ)(z,e.productNumber,e.amount))}),q.loaded&&(!q.cart||q.cart&&(!q.cart.items||0===q.cart.items.length))&&e()},[q.loaded,q.loading]),(0,a.useEffect)(()=>{(null==B?void 0:B.invalidPromocode)===!0&&G({type:"toggleGenericNotification",visible:!0,notification:{subject:k("Promocode {1} is no longer valid",[B.code]),message:k("Code you have added earlier is not valid anymore")}})},[q.loaded,B]),(0,a.useEffect)(()=>{(async()=>{er("mainLoader");let e=await (0,S.Qw)(ey);if(G({type:"setPaymentMethods",paymentMethods:e}),(null==e?void 0:e.length)===1||(null==e?void 0:e.length)>1&&e.find(e=>"PERSON"===e.customerType)){let t=e.find(e=>"PERSON"===e.customerType)||e[0],r=Object.assign({},B),n=t.id;if(n===B.paymentMethodId)return er(null);r.paymentMethodId=n,await (0,S.iH)({paymentMethodId:n}).catch(e=>{G({type:"setCartUpdateError",error:e.response})})&&G({type:"updatePaymentMethod",paymentMethodId:n}),er(null)}})()},[]),(0,a.useEffect)(()=>{let e=async()=>{var e;if(ee({...Z,order:null}),er("mainLoader"),(null==eA?void 0:eA.type)===D.uq.FREE&&!(0,y.pW)())return void G({type:"setPaymentData",paymentData:[]});let t=await (0,S.p8)().catch(e=>{console.error("error loading payment data",e),ee({order:k("Error loading payment data")}),G({type:"paymentDataError",error:e})});if(t&&(null==(e=t.redirect)?void 0:e.length)>0&&"ok"===t.status)return void window.location.replace(t.redirect);G({type:"setPaymentData",paymentData:t}),er(null)};!Q&&$&&(null==eA?void 0:eA.id)&&e()},[$,Q,eA]);let ev=async e=>{let t=e.target.value;er("mainLoader"),await (0,S.iH)({paymentMethodId:t}).catch(e=>{G({type:"setCartUpdateError",error:e.response})})&&G({type:"updatePaymentMethod",paymentMethodId:t}),er(null)};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(o.A,{sx:{display:"flex",flexDirection:"column",backgroundColor:"#fff",mb:2},children:[(0,n.jsx)(O.A,{categories:e.categories}),(0,n.jsxs)(v(),{children:[(0,n.jsx)("title",{children:el}),(0,n.jsx)("meta",{property:"og:title",content:el},"og:title")]}),(0,n.jsx)(o.A,{sx:{"& h1":{mx:{xs:1,lg:0},my:1,px:{xs:1,lg:3},py:0,fontSize:{xs:"1.2rem",desktop:"1.7rem"}}},children:(0,n.jsx)("h1",{ref:ec,children:k("title_checkout")})}),(0,n.jsxs)(o.A,{children:[H&&H.notifications&&H.notifications.length>0&&(e=>{if(e&&e.length>0)return e.map(e=>{let t=(e.modules||[]).find(e=>"NotificationBanner"===e.component);if(!t)return(0,n.jsx)(a.Fragment,{},"notification_".concat(e.id));let r=t.data,i=(0,y.RM)(r,"html",j.constants.COUNTRY,j.constants.LANGUAGE),l={borderRadius:.5,py:.5,px:2,my:1.5,mx:1};return e.backgroundColour&&(l.backgroundColor=e.backgroundColour),(0,n.jsx)(o.A,{sx:l,children:(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:i.value}})},"notification_".concat(e.id))})})(H.notifications.filter(e=>"CART_PAGE"===e.target)),g.query&&"ERROR_IN_PAYMENT_FLOW"===g.query.error&&(null==eA?void 0:eA.id)&&(null==eg?void 0:eg.id)&&(0,n.jsx)(T.A,{message:k("ERROR_IN_PAYMENT_FLOW"),removeParam:!0}),g.query&&"ERROR_PAYMENT_FAILURE"===g.query.error&&(null==eA?void 0:eA.id)&&(null==eg?void 0:eg.id)&&(0,n.jsx)(T.A,{message:k("ERROR_PAYMENT_FAILURE"),removeParam:!0}),V?(0,n.jsx)(T.A,{message:k((0,y.N7)(V))}):(0,n.jsx)(n.Fragment,{}),Z&&Z.order?(0,n.jsx)(T.A,{message:Z.order}):(0,n.jsx)(n.Fragment,{}),(0,y.$D)(j.dynamicConfigs,B)&&(0,n.jsx)(C.A,{variant:"cart",price:B.total}),(0,n.jsx)(K,{}),(0,n.jsx)(b.A,{}),(0,n.jsx)(L.A,{})]}),"mainLoader"===et&&(0,n.jsx)(i.A,{sx:{position:"absolute",left:"50%",top:"40%",transform:"translateX(-50%)",zIndex:"1000000000000",p:2},children:(0,n.jsx)(l.A,{size:150})}),ed&&ed.length>0&&(0,n.jsx)(N.A,{items:ed}),(!ef||!ey)&&(0,n.jsx)(o.A,{children:k("Invalid configurations")}),X||es&&0!==es.length?(0,n.jsxs)(o.A,{sx:{display:"flex",width:"100%",flexDirection:{xs:"column",desktop:"row-reverse"},p:2,pt:1},children:[(0,n.jsx)(o.A,{sx:{width:{xs:"100%",desktop:"40%"},display:"flex",flexDirection:{xs:"column",desktop:"column-reverse"},justifyContent:"flex-end",pointerEvents:et?"none":"",filter:et?"blur(5px)":""},children:(0,n.jsxs)(o.A,{sx:{display:"flex",flexDirection:"column",mt:1,scrollMarginTop:"60px"}
1,ref:eu,children:[(0,n.jsx)(w.A,{cartState:q,cartDispatch:G,items:es,deliveryMethod:eg,paymentMethod:eA,availabilities:W,cartCustomerDetailsRef:ep,shopWarehouseId:U}),em&&B.total>=ex&&(0,n.jsx)(o.A,{sx:{textAlign:"right",pt:1,"& a":{color:"inherit"}},children:(0,n.jsx)(_(),{href:"/[lang]/cart",as:"/".concat(R,"/cart"),children:k("Request offer for the cart")})})]})}),(0,n.jsxs)(o.A,{sx:{width:{xs:"100%",desktop:"60%"},p:1,display:"flex",flexDirection:"column",pr:{xs:1,desktop:2},pointerEvents:et?"none":"",filter:et?"blur(5px)":""},children:[(0,n.jsxs)(o.A,{sx:{mb:3,scrollMarginTop:"110px"},ref:ep,children:[(0,n.jsx)(s.A,{variant:"h6",sx:{fontSize:"1.3rem"},children:k("Customer type")}),q.paymentMethods&&q.paymentMethods.length>0&&(0,n.jsx)(d.A,{name:"type",row:!0,value:+(null==(r=B.paymentMethod)?void 0:r.id),onChange:ev,sx:{mb:1},children:q.paymentMethods.map(e=>(0,n.jsx)(c.A,{value:e.id,label:(e=>{var t;if(!e.allowedCustomerTypes||(null==(t=e.allowedCustomerTypes)?void 0:t.length)===0)return k("Consumer");let r=e.allowedCustomerTypes;if(r.length>0)switch(r[0]){case"PERSONAL":default:return k("Consumer");case"BUSINESS":return k("Business")}return e.name})(e),control:(0,n.jsx)(u.A,{})},e.id))})]}),(0,n.jsx)(o.A,{children:!Q&&J&&(null==eA?void 0:eA.id)&&(0,n.jsx)(F,{type:ey,paymentData:J,cartUuid:B.uuid})})]})]}):(0,n.jsxs)(o.A,{"data-test-id":"Checkout--NoProducts--Div",children:[(0,n.jsx)(o.A,{sx:{textAlign:"center",fontWeight:"bold",p:1},children:k("No products in cart")}),(0,n.jsx)(o.A,{sx:{py:1,backgroundColor:"#f2f2f2"}
1,children:(0,n.jsx)(P.default,{products:en,gridMargin:!1,condensedCard:!0})})]})]})})}},90279:(e,t,r)=>{"use strict";r.d(t,{Ke:()=>a,uq:()=>n});let n={FREE:"Free",KLARNA:"Klarnacheckout3",KLARNAPERSHOP:"Klarnacheckout3perShop",PAYTRAIL:"Paytrail",LASKU:"Lasku",INVOICE:"Invoice",PREPAID_INVOICE:"PrepaidInvoice",PENDING_PREPAID_INVOICE:"PendingPrepaidInvoice",PAYONDELIVERY:"Postiennakko",STRIPE:"Stripe",AVARDA:"Avarda",PAYPAL:"Paypal",POPLAPAY_TERMINAL:"Poplapay terminal",KLARNAPAYMENTSBUTTON:"KlarnaPaymentsButton",WALLEY:"Walley",STRIPE_CHECKOUT:"StripeCheckout"},a=e=>e&&[n.KLARNA,n.KLARNAPERSHOP].includes(e)}},e=>{e.O(0,[6097,4011,4991,6771,2483,636,6593,8792],()=>e(e.s=60178)),_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.