1import{hG as k,hJ as j,hM as b,hN as g,hO as N,hL as v,j as e}from"./vendor-data-eBPZki-Z.js";import{k as w,r as s,L as d}from"./vendor-react-BgtJhS2O.js";import"./vendor-zod-Bei2Z9MS.js";import{u as C,m as S,av as z,dw as I,ff as O,fd as M}from"./index-DTQGL8n8.js";import{u as E}from"./useTrackScreen-BLOOZkQ_.js";import{c as P}from"./checkoutContext-BJvytwtB.js";function F(){E("OrderConfirmed");const[c]=w(),t=c.get("orderId"),a=c.get("payment_intent"),i=c.get("redirect_status")==="succeeded",l=C(r=>r.user),m=k(),u=j(),[n,x]=s.useState(()=>i&&t&&a?"pending":"succeeded"),[p,h]=s.useState(null);s.useEffect(()=>{if(n!=="pending"||!i||!t||!a)return;let r=!1;return(async()=>{try{if(await b(t,a,g(m.data?.items??[],{userId:l?.id,checkoutStep:"submit",paymentMethod:"stripe"})),r)return;u.mutate(),P(),x("succeeded")}catch(y){if(r)return;h(N(v(y,"Your payment was authorized but we could not finalize the order. Please contact support."))),x("failed")}})(),()=>{r=!0}},[i,t,a,n]);const o=s.useMemo(()=>t?t.slice(-8).toUpperCase():null,[t]),f=s.useCallback(()=>{window.open("https://parler-support.zendesk.com/","_blank","noopener,noreferrer")},[]);return n==="pending"?e.jsxs("div",{className:"max-w-xl mx-auto px-4 py-16 text-center space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx(S,{})}),e.jsx("p",{className:"text-sm text-text-secondary dark:text-text-secondary-dark",children:"Finalizing your orderâ¦"})]}):n==="failed"?e.jsxs("div",{className:"max-w-xl mx-auto px-4 py-16 text-center space-y-6",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx(z,{size:56,className:"text-red-500","aria-hidden":!0})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-semibold text-text dark:text-text-dark",children:"Order not finalized"}),e.jsx("p",{className:"text-sm text-text-secondary dark:text-text-secondary-dark",children:p??"Your card was authorized but we could not finalize the order on our end."}),o&&e.jsxs("p",{className:"text-xs text-text-secondary dark:text-text-secondary-dark",children:["Reference: #",o]})]}),e.jsxs("div",{className:"flex flex-col gap-3 max-w-xs mx-auto pt-2",children:[e.jsx("button",{type:"button",onClick:f,className:"inline-flex items-center justify-center gap-2 rounded-full bg-brand text-text-on-brand font-medium py-3 px-6 transition-colors hover:bg-brand/90",children:"Contact support"}),e.jsx(d,{to:"/shop/cart",className:"text-sm font-medium text-text-secondary dark:text-text-secondary-dark hover:text-text dark:hover:text-text-dark",children:"Back to cart"})]})]}):e.jsxs("div",{className:"max-w-xl mx-auto px-4 py-16 text-center space-y-6",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx(I,{size:72,className:"text-brand","aria-hidden":!0})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-semibold text-text dark:text-text-dark",children:"Order placed"}),e.jsx("p",{className:"text-sm text-text-secondary dark:text-text-secondary-dark",children:"Thanks for your purchase. A confirmation email is on its way to your inbox."})]}),o&&e.jsxs("div",{className:"inline-flex flex-col items-center rounded-2xl bg-brand/10 px-6 py-4",children:[e.jsx("span",{className:"text-xs uppercase tracking-wide text-text-secondary dark:text-text-secondary-dark",children:"Order ID"}),e.jsxs("span",{className:"text-lg font-semibold text-brand",children:["#",o]})]}),e.jsxs("ul",{className:"text-sm text-text-secondary dark:text-text-secondary-dark space-y-1",children:[e.jsx("li",{children:"A confirmation email will be sent to your registered address."}),e.jsxs("li",{children:["Track your order status in"," ",e.jsx(d,{to:"/shop/orders",className:"text-brand hover:underline",children:"Orders"}),"."]})]}),e.jsxs("div",{className:"flex flex-col gap-3 max-w-xs mx-auto pt-2",children:[e.jsxs(d,{to:"/shop",className:"group inline-flex items-center justify-center gap-2 rounded-full bg-brand text-text-on-brand font-medium py-3 px-6 transition-colors hover:bg-brand/90",children:[e.jsx(O,{size:16}),"Continue shopping",e.jsx(M,{size:16,className:"transition-transform group-hover:translate-x-0.5"})]}),e.jsx(d,{to:"/feed",className:"text-sm font-medium text-text-secondary dark:text-text-secondary-dark hover:text-text dark:hover:text-text-dark",children:"Back to feed"})]})]})}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.