PageSourceSearch

https://www.snapcase.ai/assets/OrderSuccess-BifCJNlf.js

js snapcase.ai collected 2026-10-05 14:40:29 UTC 13,644 bytes, 11 lines download raw bytes

1import{r as c,j as e}from"./react-runtime-BZYMbA0n.js";import{d as P,L as f}from"./routing-BJcY-oaB.js";import{c as _,w as T,F as q,t as x,B as m,y as M}from"./index-B66or0X1.js";import{C as $}from"./CartSheet-B_6EOzFB.js";import{b as z,S as I,C as F}from"./SiteMenu-BQhDixbp.js";import{L as R}from"./loader-circle-DBhLYU0r.js";import{m as y}from"./proxy-CIXRnYDg.js";import{A as L}from"./arrow-right-5kK9tTBz.js";import{C as V}from"./circle-alert-HDNlz_Zk.js";import{C as U}from"./clock-3-D8wgFAmF.js";import{R as B}from"./refresh-cw-PA4qzOII.js";import"./data-services-DGj08KhI.js";import"./index-HZMbQ0tZ.js";import"./preview-PUwnEOzL.js";import"./shopping-bag-DS88G65B.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const D=_("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const W=_("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),Y=/^SC-[0-9A-F]{12}$/,H=new Set(["paid","processing","shipped","delivered"]),K=new Set(["order_record_pending","payment_pending","verification_unavailable"]),g=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),S=r=>{if(r==null||typeof r=="string"&&r.trim()==="")return null;const t=typeof r=="number"?r:Number(r);return Number.isFinite(t)?t:null},G=r=>{if(typeof r=="string"&&Y.test(r))return r},J=r=>{if(!g(r))return null;const t=S(r.total);return!Array.isArray(r.items)||t===null||t<0||typeof r.status!="string"||!H.has(r.status.trim().toLowerCase())?null:{items:r.items.map(s=>({quantity:g(s)?s.quantity:void 0})),total:t,status:r.status}},Q=r=>(r??[]).reduce((t,s)=>{if(s.quantity===void 0||s.quantity===null)return t+1;const n=S(s.quantity);return t+(n===null?0:Math.max(0,Math.trunc(n)))},0),X=r=>`${r} ${r===1?"case":"cases"}`,C=r=>{const t=g(r)?r:{},s=J(t.order),n=G(t.supportReference);return t.success===!0&&s&&n?{kind:"verified",order:s,supportReference:n}:t.success===!0?{kind:"retryable",errorCode:"order_record_pending",supportReference:n}:t.retryable===!1&&t.code==="checkout_expired"?{kind:"confirmed_failure",errorCode:"checkout_expired",supportReference:n}:t.retryable===!1&&t.code==="order_requires_review"&&n?{kind:"confirmed_failure",errorCode:"order_requires_review",supportReference:n}:t.retryable===!0&&typeof t.code=="string"&&K.has(t.code)?{kind:"retryable",errorCode:t.code,supportReference:n}:{kind:"retryable",errorCode:"verification_unavailable",supportReference:n}},Z=async r=>{const t=g(r)?r.context:void 0;if(!(t instanceof Response))return null;try{return await t.clone().json()}catch{return null}},ee=r=>{const t=new Map;return{verify(s){const n=t.get(s);if(n)return n;const i=(async()=>{try{const{data:a,error:d}=await r(s);if(d){const u=await Z(d);return C(u)}return C(a)}catch{return{kind:"retryable",errorCode:"verification_unavailable"}}})();return t.set(s,i),i.finally(()=>{t.get(s)===i&&t.delete(s)}),i}}},re=r=>({stage:r.kind,error_code:r.kind==="verified"?"none":r.errorCode}),te=async r=>{const t=new TextEncoder().encode(r),s=await globalThis.crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(s).slice(0,12)).map(n=>n.toString(16).padStart(2,"0")).join("")},se=async({sessionId:r,state:t,storage:s,track:n})=>{const i=re(t);let a="missing-session";if(r)try{a=await te(r)}catch{return n(i),!0}const d=`snapcase_order_verification_outcome:${a}:${i.stage}`;try{if(s.getItem(d)==="1")return!1;s.setItem(d,"1")}catch{}return n(i),!0},N={summary:"Your payment is confirmed. Check My Orders for status updates and tracking when it becomes available.",steps:["Payment is confirmed and your order is recorded","Order status changes appear in My Orders","Tracking is added when it becomes available"]},k=({children:r})=>e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("nav",{className:"border-b border-border bg-card",children:e.jsxs("div",{className:"container mx-auto flex h-16 items-center justify-between px-6",children:[e.jsx(f,{to:"/",className:"-ml-2 inline-flex min-h-11 items-center gap-2 px-2",children:e.jsx("span",{className:"font-display text-lg font-bold text-foreground",children:"Snapcase"})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($,{}),e.jsx(I,{})]})]})}),r]}),E=({reference:r})=>{const[t,s]=c.useState("idle"),n=async()=>{try{await navigator.clipboard.writeText(r),s("copied")}catch{s("failed")}};return e.jsxs("div",{className:"rounded-xl border border-border bg-muted/40 p-4 text-left",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.14em] text-foreground",children:"Support reference"}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-3",children:[e.jsx("code",{className:"text-sm font-semibold text-foreground",children:r}),e.jsxs(m,{type:"button",variant:"outline",size:"sm",onClick:n,"aria-label":`Copy support reference ${r}`,children:[t==="copied"?e.jsx(F,{"aria-hidden":"true"}):e.jsx(W,{"aria-hidden":"true"}),t==="copied"?"Copied":"Copy"]})]}),e.jsx("p",{className:"mt-2 text-xs text-foreground","aria-live":"polite",children:t==="copied"?"Support reference copied.":t==="failed"?`Copy was unavailable. Select ${r} to copy it manually.`:"Share this reference with Snapcase support. It is not a payment credential."})]})},ie=({includeRetry:r=!1,isRetrying:t=!1,onRetry:s})=>e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r&&e.jsxs(m,{type:"button",variant:"cta",size:"lg",className:"!bg-cta-emphasis hover:!bg-cta-emphasis",disabled:t,onClick:s,children:[t?e.jsx(R,{className:"animate-spin","aria-hidden":"true"}):e.jsx(B,{"aria-hidden":"true"}),t?"Checking again…":"Retry verification"]}),e.jsx(m,{asChild:!0,variant:"outline",size:"lg",children:e.jsx(f,{to:"/orders",onClick:()=>x("primary_cta_click",{placement:"order_verification_recovery",label:"view_orders",destination:"/orders"}),children:"View My Orders"})}),e.jsx(m,{asChild:!0,variant:"outline",size:"lg",children:e.jsx(f,{to:"/contact",onClick:()=>x("primary_cta_click",{placement:"order_verification_recovery",label:"contact_support",destination:"/contact"}),children:"Contact support"})}),e.jsx(m,{asChild:!0,variant:"ghost",size:"lg",children:e.jsx(f,{to:"/catalog",onClick:()=>x("primary_cta_click",{placement:"order_verification_recovery",label:"browse_cases",destination:"/catalog"}),children:"Browse cases"})})]}),ne=({state:r,isRetrying:t,onRetry:s,headingRef:n})=>{const i=r.kind==="missing_session",a=r.kind==="confirmed_failure",d=a&&r.errorCode==="checkout_expired",u=r.kind==="retryable"||r.kind==="confirmed_failure"?r.supportReference:void 0,p=i?"We can’t verify this return page":a?d?"This checkout is no longer active":"Your order needs supp
11ort review":"We’re still confirming your order",h=i?"The secure return reference is missing. This does not tell us whether a payment was completed, so please check My Orders or contact support before trying to buy again.":a?d?"Stripe reports that this checkout ended without a confirmed payment. If you see a charge or are unsure, contact us with the support reference before placing another order.":"We found the order, but automated processing stopped and a support review is required. Your cart has not been cleared.":"Payment confirmation can take a moment or the verification service may be temporarily unavailable. Your cart is saved, and retrying only checks the existing order.";return e.jsx(k,{children:e.jsx("main",{className:"container mx-auto px-6 py-12 sm:py-20",children:e.jsxs(y.section,{className:"mx-auto max-w-xl rounded-3xl border border-border bg-card p-6 shadow-soft sm:p-9",initial:{y:16},animate:{opacity:1,y:0},transition:{duration:.35},"aria-labelledby":"verification-heading",children:[e.jsx("div",{className:`mb-6 flex h-14 w-14 items-center justify-center rounded-2xl ${a?"bg-destructive/10 text-destructive-emphasis":"bg-accent/10 text-accent-emphasis"}`,children:a?e.jsx(V,{className:"h-7 w-7","aria-hidden":"true"}):e.jsx(U,{className:"h-7 w-7","aria-hidden":"true"})}),e.jsx("p",{className:"mb-2 text-sm font-semibold text-foreground",children:"Order verification"}),e.jsx("h1",{ref:n,id:"verification-heading",tabIndex:-1,className:"text-2xl font-bold tracking-tight sm:text-3xl",children:p}),e.jsxs("p",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:[p,". ",h]}),e.jsx("p",{className:"mt-3 text-foreground",children:h}),t&&e.jsx("p",{className:"mt-4 text-sm font-medium text-foreground",role:"status","aria-live":"polite",children:"Checking the existing order now. Please keep this page open."}),u&&e.jsx("div",{className:"mt-6",children:e.jsx(E,{reference:u})}),e.jsx("div",{className:"mt-7",children:e.jsx(ie,{includeRetry:!i&&!a,isRetrying:t,onRetry:s})})]})})})},ve=()=>{const[r]=P(),{clearCart:t}=T(),s=r.get("session_id"),n=s?{kind:"verifying"}:{kind:"missing_session",errorCode:"missing_session"},[i,a]=c.useState(n),[d,u]=c.useState(!1),p=c.useRef(null),h=c.useRef(null),b=c.useRef(0),w=c.useRef(new Set),j=c.useRef(null),O=c.useRef(ee(o=>M.functions.invoke("verify-payment",{body:{sessionId:o}}))),v=c.useCallback(async()=>{if(!s)return;const o=b.current+1;b.current=o,u(!0);const l=await O.current.verify(s);b.current===o&&(a(l),u(!1),l.kind==="verified"&&h.current!==l.supportReference&&(h.current=l.supportReference,t()
11))},[t,s]);if(c.useEffect(()=>{if(!s){a({kind:"missing_session",errorCode:"missing_session"});return}p.current!==s&&(p.current=s,a({kind:"verifying"}),v())},[s,v]),c.useEffect(()=>{if(i.kind==="verifying"||q()!=="granted")return;const o=`${s??"missing"}:${i.kind}:${"errorCode"in i?i.errorCode:"none"}`;w.current.has(o)||(w.current.add(o),se({sessionId:s,state:i,storage:window.sessionStorage,track:l=>x("order_verification",l)}))},[s,i]),c.useEffect(()=>{var o;i.kind!=="verifying"&&((o=j.current)==null||o.focus())},[i]),i.kind==="verifying")return e.jsx(k,{children:e.jsx("main",{className:"flex min-h-[calc(100vh-4rem)] items-center justify-center px-6",children:e.jsxs("div",{className:"max-w-sm text-center",role:"status","aria-live":"polite",children:[e.jsx(R,{className:"mx-auto mb-4 h-12 w-12 animate-spin text-accent-emphasis","aria-hidden":"true"}),e.jsx("h1",{className:"text-xl font-semibold",children:"Confirming your order"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"We’re checking the existing payment and order record. This will not start another payment."})]})})});if(i.kind==="missing_session"||i.kind==="retryable"||i.kind==="confirmed_failure")return e.jsx(ne,{state:i,isRetrying:d,headingRef:j,onRetry:()=>{x("primary_cta_click",{placement:"order_verification_recovery",label:"retry_verification",destination:"/order-success"}),v()}});const A=Q(i.order.items);return e.jsx(k,{children:e.jsx("main",{className:"container mx-auto px-6 py-12 sm:py-16",children:e.jsxs(y.div,{className:"mx-auto max-w-2xl text-center",initial:{y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:[e.jsx(y.div,{className:"mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-success/10",initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:200,delay:.2},children:e.jsx(D,{className:"h-10 w-10 text-success-emphasis","aria-hidden":"true"})}),e.jsx("h1",{ref:j,tabIndex:-1,className:"mb-4 text-3xl font-bold md:text-4xl",children:"Thank you for your order!"}),e.jsx("p",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:"Order verified. Thank you for your order."}),e.jsx("p",{className:"mb-8 text-lg text-muted-foreground",children:N.summary}),e.jsxs(y.div,{className:"mb-6 rounded-2xl bg-card p-6 text-left shadow-soft",initial:{y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},children:[e.jsxs("h2",{className:"mb-4 flex items-center gap-2 font-semibold",children:[e.jsx(z,{className:"h-5 w-5","aria-hidden":"true"}),"Order details"]}),e.jsxs("dl",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("dt",{className:"text-foreground",children:"Cases"}),e.jsx("dd",{children:X(A)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-border pt-3 font-semibold",children:[e.jsx("dt",{children:"Total"}),e.jsxs("dd",{children:["$",i.order.total.toFixed(2)," USD"]})]})]})]}),e.jsx("div",{className:"mb-8",children:e.jsx(E,{reference:i.supportReference})}),e.jsxs("div",{className:"mb-8 rounded-xl bg-muted/50 p-6",children:[e.jsx("h2",{className:"mb-2 font-medium",children:"What happens next?"}),e.jsx("ol",{className:"mx-auto max-w-sm space-y-2 text-left text-sm text-muted-foreground",children:N.steps.map((o,l)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-accent/20 text-xs text-accent-emphasis",children:l+1}),o]},o))})]}),e.jsxs("div",{className:"flex flex-col justify-center gap-4 sm:flex-row",children:[e.jsx(m,{asChild:!0,size:"lg",variant:"cta",className:"hover:bg-cta",children:e.jsxs(f,{to:"/catalog",children:["Design another case",e.jsx(L,{"aria-hidden":"true"})]})}),e.jsx(m,{asChild:!0,variant:"outline",size:"lg",children:e.jsx(f,{to:"/orders",children:"View My Orders"})})]})]})})})};export{ve 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.