1import{a as n,j as e}from"./query-Ban24u4e.js";import{u as y,d as b,H as C,m as d,F as N,l as v,P as k,i as w,B as h,L as g,A as I}from"./index-jvhwSSW_.js";import{C as S}from"./circle-check-2-BAdcva.js";import"./radix-ui-DdasXo-Q.js";const m="https://voltedge.com";function T(c,a="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:a}).format(c/100)}function F(){const[c]=y(),a=c.get("orderId"),{clearCart:u}=b(),[t,j]=n.useState(null),[i,l]=n.useState("polling"),r=n.useRef(null),x=n.useRef(!1);return n.useEffect(()=>{if(!a){l("confirmed");return}async function s(){try{const o=await(await fetch(`/api/commerce/order-status?orderId=${encodeURIComponent(a)}`)).json();if(!o.success||!o.order)return;const p=o.order.status.toLowerCase();j(o.order),(p==="paid"||p==="fulfilled")&&(l("confirmed"),r.current&&clearInterval(r.current),x.current||(x.current=!0,u()))}catch{l("error"),r.current&&clearInterval(r.current)}}return s(),r.current=setInterval(s,5e3),()=>{r.current&&clearInterval(r.current)}},[a,u]),e.jsxs(e.Fragment,{children:[e.jsxs(C,{children:[e.jsx("title",{children:"Order Confirmed â CTVCam Electronics"}),e.jsx("meta",{name:"description",content:"Your CTVCam Electronics order has been confirmed. Thank you for your purchase."}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"}),e.jsx("link",{rel:"canonical",href:`${m}/checkout/success`}),e.jsx("meta",{property:"og:title",content:"Order Confirmed â CTVCam Electronics"}),e.jsx("meta",{property:"og:description",content:"Your CTVCam Electronics order has been confirmed. Thank you for your purchase."}),e.jsx("meta",{property:"og:image",content:"https://ctvcam.com/og-image.png"}),e.jsx("meta",{property:"og:url",content:`${m}/checkout/success`}),e.jsx("meta",{property:"og:type",content:"website"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:image",content:"https://ctvcam.com/og-image.png"}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebPage",name:"Order Confirmed â CTVCam Electronics",url:`${m}/checkout/success`}).replace(/</g,"<")})]}),e.jsx("main",{className:"pt-20 min-h-screen bg-background flex items-center justify-center px-4",children:e.jsx("div",{className:"w-full max-w-lg",children:e.jsxs(d.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},transition:{duration:.5,ease:"easeOut"},className:"bg-card border border-border/60 rounded-2xl p-8 text-center",children:[e.jsx(d.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.4,delay:.1,ease:"backOut"},className:"w-20 h-20 rounded-full bg-green-500/10 border border-green-500/30 flex items-center justify-center mx-auto mb-6",children:e.jsx(S,{size:36,className:"text-green-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Order Confirmed!"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Thank you for your purchase. A confirmation email is on its way to you."}),t&&i==="confirmed"&&e.jsxs(d.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3},className:"bg-background/60 border border-border/40 rounded-xl p-4 mb-6 text-left",children:[t.amount&&e.jsxs("div",{className:"flex justify-between items-center mb-3",children:[e.jsx("span",{className:"text-muted-foreground text-sm",children:"Order total"}),e.jsx("span",{className:"text-foreground font-bold text-lg",children:e.jsx(N,{devId:"d77b55",guard:{file:"src/pages/checkout/success.tsx",tagName:"span",sourceKind:"bound-expression",contentKey:null,contentKeyTemplate:null,expressionHash:"sha256:d8bfe976863e72b8e147802ecaace7daa77642ca1c003fdf6f386764f390fd6a"},children:T(t.amount.value,t.amount.currencyCode)})})]}),t.lineItems&&t.lineItems.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"bg-border/40 mb-3"}),e.jsx("div",{className:"flex flex-col gap-2",children:t.lineItems.map((s,f)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(k,{size:14,className:"text-primary shrink-0"}),e.jsx("span",{className:"text-foreground flex-1 truncate",children:s.name??"Product"}),s.quantity&&s.quantity>1&&e.jsxs("span",{className:"text-muted-foreground shrink-0",children:["Ã",s.quantity]})]},f))})]})]}),i==="polling"&&a&&e.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground text-sm mb-6",children:[e.jsx(w,{size:14,className:"animate-spin"}),e.jsx("span",{children:"Confirming your orderâ¦"})]}),i==="error"&&e.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"A confirmation email is on its way with your order details."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx(h,{asChild:!0,className:"flex-1 bg-primary hover:bg-primary/90 text-primary-foreground font-semibold",children:e.jsxs(g,{to:"/products",children:["Continue Shopping",e.jsx(I,{size:14,className:"ml-2"})]})}),e.jsx(h,{asChild:!0,variant:"outline",className:"flex-1 border-border/60 text-foreground hover:bg-muted",children:e.jsx(g,{to:"/services",children:"Book Installation"})})]})]})})})]})}export{F 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.