1import{Z as e}from"./vendor-ui-Cn6fg8C-.js";import{E as t,aq as s,N as n,g as a}from"./vendor-icons-Byg3HwjO.js";import{v as c,w as o,o as i,N as l,k as r}from"./Navbar-H2KFsm7e.js";import d from"./Footer-Bxnois-o.js";import{bf as x,bc as p,ac as u,aY as m,aw as f}from"./index-99Vy6p_n.js";import{G as h,c as y}from"./Checkout-6E8uQlak.js";import{h as g}from"./devices-DcdDbivO.js";import{g as b}from"./vendor-utils-Buu2ZLTn.js";import{b as j,u as N,d as v,L as k}from"./vendor-react-CVjTfUnV.js";import{m as S}from"./vendor-motion-BvcfpNQp.js";import"./vendor-charts-Bma9jRrq.js";import"./vendor-intl-BIQtR30S.js";import"./vendor-stripe-Bj8zZY_l.js";import"./input-BVYhbFAy.js";import"./textarea-4cOcjDkV.js";import"./index-PyBVYi8f.js";import"./errorMessages-KO5_OSqv.js";import"./checkbox-CPmzIvHv.js";const w=e=>e.toLowerCase().includes("pro");const C=e=>{const t=e.replace(/\s+/g,"");return/^\d{9}$/.test(t)?t.replace(/(\d{3})(?=\d)/g,"$1 "):e},F=({voucher:s})=>{const{t:n,i18n:a}=b(),c=s.expiresAt?new Date(s.expiresAt).toLocaleDateString(a.language,{day:"numeric",month:"long",year:"numeric"}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:"grid grid-cols-2 gap-4 m-0",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("dt",{className:"font-body text-[13px] text-[#434343] opacity-70",children:n("checkoutSuccess.voucherEntity","Entity")}),e.jsx("dd",{className:"m-0 font-heading text-[22px] font-medium tracking-wide text-[#141414]",style:{fontVariantNumeric:"tabular-nums"},children:s.entity})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("dt",{className:"font-body text-[13px] text-[#434343] opacity-70",children:n("checkoutSuccess.voucherReference","Reference")}),e.jsx("dd",{className:"m-0 font-heading text-[22px] font-medium tracking-wide text-[#141414]",style:{fontVariantNumeric:"tabular-nums"},children:C(s.reference??"")})]}),"number"==typeof s.amountCents&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("dt",{className:"font-body text-[13px] text-[#434343] opacity-70",children:n("checkoutSuccess.voucherAmount","Amount")}),e.jsx("dd",{className:"m-0 font-body text-[16px] font-semibold text-[#141414]",style:{fontVariantNumeric:"tabular-nums"},children:(o=s.amountCents,i=s.currency,l=a.language,new Intl.NumberFormat(l,{style:"currency",currency:(i||"EUR").toUpperCase()}).format(o/100))})]}),c&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("dt",{className:"font-body text-[13px] text-[#434343] opacity-70",children:n("checkoutSuccess.voucherPayBy","Pay by")}),e.jsx("dd",{className:"m-0 font-body text-[16px] font-semibold text-[#141414]",children:c})]})]}),e.jsx("p",{className:"font-body text-[14px] leading-relaxed text-[#434343] m-0",children:n("checkoutSuccess.voucherHowToPay","Pay at any Multibanco ATM or in your banking app, under payments of services, with the entity and reference above.")}),s.hostedVoucherUrl&&e.jsxs("a",{href:s.hostedVoucherUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex w-fit items-center gap-2 font-body text-[14px] font-semibold text-[#8E00FF] underline underline-offset-2 hover:no-underline",children:[n("checkoutSuccess.voucherOpen","Open the payment voucher"),e.jsx(t,{className:"h-4 w-4","aria-hidden":"true"})]})]});var o,i,l},I=({voucher:t,paymentMethod:s,className:n=""})=>{const{t:a}=b(),c=Boolean(t?.entity&&t?.reference),o="multibanco"===t?.type||"multibanco"===(s??"").toLowerCase()||c;return e.jsxs("div",{className:`bg-[#fdfdfd] rounded-[30px] p-6 tablet:p-[40px_24px] flex flex-col gap-5 shadow-[0_4px_20px_rgba(0,0,0,0.05)] ${n}`,children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"font-heading font-medium text-[24px] tablet:text-[30px] text-[#434343] m-0",style:{letterSpacing:"-0.3px"},children:a("checkoutSuccess.awaitingPaymentTitle","Waiting for your payment")}),s&&e.jsxs("p",{className:"font-body text-[14px] text-[#434343] opacity-80 m-0",children:[a("checkoutSuccess.paymentMethod"),": ",e.jsx("span",{className:"font-semibold",children:s})]})]}),c?e.jsx(F,{voucher:t}):e.jsx("p",{className:"font-body text-[14px] leading-relaxed text-[#434343] m-0",children:o?a("checkoutSuccess.voucherNoDetails","Pay with the Multibanco entity and reference you were given, at an ATM or in your banking app."):a("checkoutSuccess.pendingGeneric","Some payment methods take a little longer to clear.")}),e.jsx("p",{className:"font-body text-[14px] leading-relaxed text-[#434343] m-0 border-t border-[#
1EDEAF2] pt-4",children:a("checkoutSuccess.awaitingPaymentNext","Your order is confirmed as soon as the payment arrives, and we'll email you the confirmation then.")})]})},P={card:"Card",mb_way:"MB WAY",multibanco:"Multibanco",klarna:"Klarna",scalapay:"Scalapay",afterpay_clearpay:"Afterpay",affirm:"Affirm",customer_balance:"Bank transfer",bancontact:"Bancontact",ideal:"iDEAL",sofort:"SOFORT",eps:"EPS",p24:"Przelewy24",giropay:"giropay",paypal:"PayPal",revolut_pay:"Revolut Pay",apple_pay:"Apple Pay",google_pay:"Google Pay",link:"Link",sepa_debit:"SEPA Direct Debit"},D=()=>{const{t:t,i18n:C}=b(),F=j(),D=N(),[_]=v(),E=c(e=>e.clearAllCarts),A=x(e=>e.basicUser),{formatPrice:M}=p(),B=A||(()=>{try{const e=localStorage.getItem("lampsy-user-storage");if(!e)return!1;const t=JSON.parse(e);return!!t?.state?.basicUser}catch{return!1}})(),T=D.state||{},L=T.paymentIntentId||_.get("payment_intent")||null,$=_.get("session_id"),q=_.get("redirect_status"),U=L||$,[O,G]=s.useState(!1),[z,R]=s.useState(!1),[V,Y]=s.useState(()=>{const e="undefined"!=typeof window?(e=>{if(!e)return;const t=P[e];if(t)return t;const s=e.replace(/_/g," ").trim();return s.charAt(0).toUpperCase()+s.slice(1)})(sessionStorage.getItem("lampsy_checkout_pm_type")):void 0,t="undefined"!=typeof window&&sessionStorage.getItem(h)||void 0;return"undefined"!=typeof window&&(sessionStorage.removeItem("lampsy_checkout_pm_type"),sessionStorage.removeItem(h)),T.finalizeData||e||t?{...T.finalizeData||{},appliedGiftCode:T.finalizeData?.appliedGiftCode??t,paymentMethodLabel:e??T.finalizeData?.paymentMethodLabel}:null}),[W,H]=s.useState(!1),[J,K]=s.useState(null),[X,Z]=s.useState(null),Q=s.useRef(F);s.useEffect(()=>{Q.current=F},[F]),s.useEffect(()=>{if(q&&"succeeded"!==q)return void Q.current("/checkout/cancel",{replace:!0});let e=!1;let t=null;const s=s=>{if(e||t===s)return;const n=null===t;if(t=s,K(s),"unpaid"!==s){if(U&&T.analytics&&"paid"===s){const{value:e,currency:t,itemCount:s,items:n}=T.analytics;m(U,e,t,n),f(U,e,t,s)}!n||"paid"!==s&&"pending"!==s||(E(),y()),"paid"!==s&&"unknown"!==s||T.finalizeData||!L&&!$||(()=>{H(!0);const t=s=>{e||(L?u.getOrderByPaymentIntent(L):u.getOrderBySessionId($)).then(n=>{if(!e)return n.isSuccess?(Y(e=>({orderNumber:n.orderNumber,totalAmountCents:n.totalAmountCents,currency:n.currency,subtotalInCents:n.subtotalInCents,shippingCostInCents:n.shippingCostInCents,orderDate:n.orderDate,orderItems:n.orderItems,paymentMethodLabel:n.paymentMethodLabel||e?.paymentMethodLabel,appliedGiftCode:n.appliedGiftCode||e?.appliedGiftCode,discountAmountCents:n.discountAmountCents})),void H(!1)):void(s<12?setTimeout(()=>t(s+1),2500):H(!1))}).catch(()=>{e||(s<12?setTimeout(()=>t(s+1),2500):H(!1))})};t(1)})()}else Q.current("/checkout/cancel",{replace:!0})},n=Date.now();let a;const c=t=>u.getCheckoutSessionStatus(t).then(o=>{if(e)return;const i=o?.outcome??"unknown";"pending"===i&&(Z(o?.voucher??null),Date.now()-n<6e5&&(a=setTimeout(()=>c(t),15e3))),s(i)}).catch(()=>s("unknown"));$?c($):s("paid");const o=setTimeout(()=>G(!0),150);return()=>{e=!0,clearTimeout(o),a&&clearTimeout(a)}},[q]);const ee=A?.firstName||"",te=e=>M(r(e)),se=V?.orderDate?new Date(V.orderDate).toLocaleDateString(C.language,{day:"numeric",month:"long",year:"numeric"}):(new Date).toLocaleDateString(C.language,{day:"numeric",month:"long",year:"numeric"}),ne=V?.orderNumber||T.orderNumber||(W?"...":"â"),ae="paid"===J,ce=V?.paymentMethodLabel||"â",{data:oe}=o(),ie=s.useMemo(()=>(oe??[]).map(i),[oe]),le=s.useMemo(()=>V?.orderItems?.length?function(e,t,s){const n=e=>Math.round(100*e),a=[];for(const i of e){if(w(i.name)){const e=t.find(e=>"pro"===e.type&&e.name===i.name)??t.find(e=>"pro"===e.type),c=t.find(t=>"standard"===t.type&&t.color===e?.color)??t.find(e=>"standard"===e.type),o=c?n(c.price):null;if(c&&null!=o&&o<i.unitPriceInCents){a.push({name:c.name,quantity:i.quantity,unitPriceInCents:o}),a.push({name:s,quantity:i.quantity,unitPriceInCents:i.unitPriceInCents-o});continue}}a.push({name:i.name,quantity:i.quantity,unitPriceInCents:i.unitPriceInCents})}const c=[],o=new Map;for(const i of a){const e=`${i.name}|${i.unitPriceInCents}`,t=o.get(e);if(t)t.quantity+=i.quantity,t.totalPriceInCents+=i.unitPriceInCents*i.quantity;else{const t={name:i.name,quantity:i.quantity,totalPriceInCents:i.unitPriceInCents*i.quantity};o.set(e,t),c.push(t)}}return c}(V.orderItems,ie,t("addOns.tablet.name")):[],[V?.orderItems,ie,t]),re=le.length>0,de=V?.shippingCostInCents??0,xe=V?.subtotalInCents,pe=V?.totalAmountCents,ue=V?.discountAmountCents,me=V?.appliedGiftCode,fe=null!=xe&&null!=pe?Math.max(0,xe+de-pe):0,he=null!=ue&&ue>0?ue:fe;return e.jsxs("div",{className:"min-h-screen px-[20px]",style:{background:"linear-gradient(180deg, #f1f1f1 21.19%, #ede6f2 69.97%)"},children:[e.jsx(l,{}),e.jsx("main",{className:"pt-20 tablet:pt-24",children:O?e.jsx(S.div,{className:"desktop:px-[80px] mac:px-[80px]",initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{duration:.5},children:e.jsxs("div",{className:"max-w-[1092px] mx-auto pt-10 tablet:pt-16 desktop:pt-20 pb-16 tablet:pb-24 flex flex-col gap-12",children:[e.jsxs("header",{className:"flex flex-col gap-3","data-testid":"checkout-success",children:[e.jsx("span",{className:"font-body font-semibold text-[20px] tablet:text-[24px]",style:{letterSpacing:"-0.24px",color:ae?"#518629":"#B45309"},children:ae?t("checkoutSuccess.orderConfirmed"):"pending"===J?t("checkoutSuccess.paymentPending","Payment pending"):t("checkoutSuccess.confirmingPayment","Confirming your payment")}),e.jsx("h1",{className:"font-heading font-medium text-[28px] tablet:text-[35px] desktop:text-[40px] leading-[1.1] m-0 bg-clip-text text-transparent",style:{letterSpacing:"-0.4px",backgroundImage:"radial-gradient(144.36% 132.32% at 2.62% 89.58%, #6100DF 0%, #8E00FF 26.92%, #B761FF 67.31%, #E2B9FF 100%)"},children:ae?`${t("checkoutSuccess.thankYouTitle")}${ee?`, ${ee}!`:"!"}`:t("checkoutSuccess.almostThereTitle","Almost there")}),!ae&&e.jsx("p",{className:"font-body text-[15px] tablet:text-[16px] leading-relaxed text-[#434343] max-w-[640px] m-0",children:"pending"===J?t("checkoutSuccess.paymentPendingBody","Your payment has not arrived yet. Voucher payments, like Multibanco, are confirmed once you pay the reference, and we will email you the moment it arrives."):t("checkoutSuccess.confirmingPaymentBody","We could not confirm this payment just now. If you completed it, your confirmation email is on its way. If you did not, nothing has been charged and your basket is still where you left it.")})]}),e.jsxs("section",{className:"grid grid-cols-1 desktop:grid-cols-2 gap-6 items-start",children:[e.jsxs("div",{className:"bg-[#fcfcfc] rounded-[30px] p-6 tablet:p-[24px_25px] flex flex-col gap-6",children:[e.jsxs("h2",{className:"font-heading font-medium text-[22px] tablet:text-[26px] m-0",style:{letterSpacing:"-0.26px"},children:[t("checkoutSuccess.whatTo")," ",e.jsx("span",{className:"text-[#8E00FF] font-semibold",children:t("checkoutSuccess.expect")})]}),e.jsx("div",{className:"flex flex-col tablet:flex-row gap-4",children:[1,2,3].map(s=>e.jsxs("div",{className:"flex-1 flex flex-col gap-3",children:[e.jsx("div",{className:"w-[35px] h-[35px] rounded-full flex items-center justify-center text-white font-heading font-medium text-[20px]",style:{background:"radial-gradient(144.36% 132.32% at 2.62% 89.58%, #6100DF 0%, #8E00FF 26.92%, #B761FF 67.31%, #E2B9FF 100%)"},children:s}),e.jsx("h3",{className:"font-heading font-medium text-[16px] tablet:text-[18px] m-0 text-[#434343]",children:t(`checkoutSuccess.step${s}Title`)}),e.jsx("p",{className:"font-body font-medium text-[13px] tablet:text-[14px] leading-[1.4] m-0 text-[#434343] opacity-90",children:t(`checkoutSuccess.step${s}Desc`)})]},s))})]}),"pending"===J?e.jsx(I,{voucher:X,paymentMethod:V?.paymentMethodLabel,className:"order-first desktop:order-none"}):e.jsxs("div",{className:"bg-[#fdfdfd] rounded-[30px] p-6 tablet:p-[40px_20px] flex flex-col gap-4 shadow-[0_4px_20px_rgba(0,0,0,0.05)]",children:[e.jsxs("div",{className:"flex justify-between items-center w-full",children:[e.jsx("h2",{className:"font-heading font-medium text-[24px] tablet:text-[30px] text-[#434343] m-0",style:{letterSpacing:"-0.3px"},children:t("checkoutSuccess.orderSummary")}),e.jsx("button",{onClick:()=>R(!z),className:"w-10 h-10 flex items-center justify-center flex-shrink-0","aria-label":z?"Collapse":"Expand",children:e.jsx(a,{className:"w-6 h-6 text-[#434343] transition-transform duration-300 "+(z?"rotate-180":"")})})]}),e.jsxs("div",{className:"flex justify-between w-full py-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-body font-medium text-[14px] text-[#434343] opacity-70",children:t("checkoutSuccess.date")}),e.jsx("span",{className:"font-body font-semibold text-[14px] text-[#434343]",children:se})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-body font-medium text-[14px] text-[#434343] opacity-70",children:t("checkoutSuccess.orderNumber")}),e.jsx("span",{className:"font-body font-semibold text-[14px] text-[#434343]",children:ne})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-body font-medium text-[14px] text-[#434343] opacity-70",children:t("checkoutSuccess.paymentMethod")}),e.jsx("span",{className:"font-body font-semibold text-[14px] text-[#434343]",children:W?"...":ce})]})]}),e.jsxs("div",{className:"flex flex-col gap-4 overflow-hidden transition-all duration-300 ease-in-out",style:{maxHeight:z?"500px":"0",opacity:z?1:0,marginTop:z?"10px":"0"},children:[e.jsx("div",{className:"h-px bg-[#eeeeee] w-full"}),re?e.jsx("div",{className:"flex flex-col gap-3",children:le.map((t,s)=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-body font-semibold text-[14px] text-[#434343]",children:t.name}),e.jsxs("span",{className:"font-body font-medium text-[12px] text-[#8
1c8c8c]",children:["x",t.quantity]})]}),e.jsx("span",{className:"font-body font-semibold text-[14px] text-[#434343]",children:te(t.totalPriceInCents)})]},`${t.name}-${s}`))}):W?e.jsx("div",{className:"flex justify-center py-2",children:e.jsx(n,{className:"w-5 h-5 animate-spin text-[#8E00FF]"})}):null,e.jsx("div",{className:"h-px bg-[#eeeeee] w-full"}),(null!=xe||null!=pe)&&e.jsxs("div",{className:"flex flex-col gap-2",children:[null!=xe&&e.jsxs("div",{className:"flex justify-between font-body font-medium text-[14px] text-[#434343]",children:[e.jsx("span",{children:t("checkoutSuccess.subtotal")}),e.jsx("span",{children:te(xe)})]}),e.jsxs("div",{className:"flex justify-between font-body font-medium text-[14px] text-[#434343]",children:[e.jsx("span",{children:t("checkoutSuccess.shipping")}),0===de?e.jsx("span",{className:"text-[#518629] font-semibold",children:t("checkoutSuccess.free")}):e.jsx("span",{children:te(de)})]}),he>0&&e.jsxs("div",{className:"flex justify-between font-body font-medium text-[14px] text-[#518629]",children:[e.jsx("span",{children:me?`${t("checkoutSuccess.discount")}: ${me}`:t("checkoutSuccess.discount")}),e.jsxs("span",{children:["-",te(he)]})]}),null!=pe&&e.jsxs("div",{className:"flex justify-between font-body font-bold text-[16px] text-[#434343] mt-2",children:[e.jsx("span",{children:t("checkoutSuccess.total")}),e.jsx("span",{children:te(pe)})]})]})]})]})]}),e.jsx("section",{children:e.jsxs("div",{className:"relative rounded-[30px] overflow-hidden p-10 tablet:p-12 desktop:py-20 desktop:px-[123px] flex flex-col items-center text-center gap-4",style:{background:"rgba(252, 252, 252, 0.61)",backdropFilter:"blur(10px)"},children:[e.jsx("img",{src:g,alt:"",className:"absolute pointer-events-none z-[1] object-cover opacity-[0.24]",style:{left:"50%",top:"-281px",width:"966px",height:"966px",transform:"translateX(-50%)"}}),e.jsxs("div",{className:"relative z-[2] max-w-[846px] flex flex-col items-center gap-4",children:[e.jsxs("h2",{className:"font-heading font-medium text-[28px] tablet:text-[35px] desktop:text-[40px] m-0 text-[#434343]",style:{letterSpacing:"-0.4px"},children:[t("checkoutSuccess.getSetUpTitle")," ",e.jsx("span",{className:"text-[#8E00FF] font-semibold",children:t("checkoutSuccess.setUp")})," ",t("checkoutSuccess.forDayOne")]}),e.jsx("p",{className:"font-body font-medium text-[14px] tablet:text-[16px] leading-[1.5] m-0 text-[#434343]",children:t(B?"checkoutSuccess.getSetUpDescriptionAuth":"checkoutSuccess.getSetUpDescription")}),B?e.jsx(k,{to:"/account?tab=purchases",className:"text-white border-none rounded-[30px] px-5 py-2.5 font-body font-semibold text-[15px] hover:scale-105 transition-transform no-underline",style:{background:"radial-gradient(144.36% 132.32% at 2.62% 89.58%, #6100DF 0%, #8E00FF 26.92%, #B761FF 67.31%, #E2B9FF 100%)"},children:t("checkoutSuccess.viewOrders")}):e.jsx(k,{to:"/register",className:"text-white border-none rounded-[30px] px-5 py-2.5 font-body font-semibold text-[15px] hover:scale-105 transition-transform no-underline",style:{background:"radial-gradient(144.36% 132.32% at 2.62% 89.58%, #6100DF 0%, #8E00FF 26.92%, #B761FF 67.31%, #E2B9FF 100%)"},children:t("checkoutSuccess.createAccount")})]})]})}),U&&e.jsxs("p",{className:"text-[12px] text-[#434343] opacity-40 m-0",children:[t("checkoutSuccess.reference"),": ",U.slice(0,16),"..."]})]})}):e.jsx("div",{className:"py-24 flex justify-center",children:e.jsx(n,{className:"w-8 h-8 animate-spin text-[#8E00FF]"})})}),e.jsx(d,{})]})};export{D as default};
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.