1import{j as e,_ as p,r as a,S as h}from"./vendor-BOadm9Gy.js";import{P as u}from"./ProtectedRoute-CrAct2uw.js";import{S as b}from"./SEO-BlctqH_J.js";import{c as j}from"./index-DcN63-UG.js";import{u as g,l as s,c as f,m as r}from"./billing-DUvobp70.js";import{bz as y}from"./vendor-icons-kUGsRs8M.js";import"./SignInGate-C8h4QWAT.js";import"./vendor-ui-CeWyqG0w.js";import"./vendor-classnames-CSqCgoPn.js";import"./vendor-motion-DwikGbVM.js";import"./vendor-toast-D6B0hGGw.js";const N={succeeded:{label:"Paid",tone:"bg-emerald-100 text-emerald-700"},refunded:{label:"Refunded",tone:"bg-gray-100 text-gray-700"},failed:{label:"Failed",tone:"bg-red-100 text-red-700"}};function C(){const{paymentId:i=""}=p(),d=g(),[t,c]=a.useState(null),[l,o]=a.useState("");if(a.useEffect(()=>{d.receipt(i).then(c).catch(x=>o(x.status===404?"Receipt not found.":"Couldn't load this receipt."))},[d,i]),l)return e.jsxs("div",{className:"mx-auto max-w-md px-4 py-20 text-center",children:[e.jsx("p",{className:"font-semibold text-[#0C1A2B]",children:l}),e.jsx(h,{to:"/dashboard?section=subscription",className:"mt-4 inline-block rounded-full bg-[#0C1A2B] px-5 py-2.5 font-semibold text-white",children:"Your subscription"})]});if(!t)return e.jsx(j,{label:"Loading receipt",size:"lg",className:"min-h-[60vh]"});const n=N[t.status]||{label:t.status,tone:"bg-gray-100 text-gray-700"},m=t.amountCents+t.discountCents;return e.jsxs("div",{className:"mx-auto max-w-2xl px-4 py-8 print:max-w-none print:p-0",children:[e.jsx("div",{className:"mb-4 flex items-center justify-end print:hidden",children:e.jsxs("button",{type:"button",onClick:()=>window.print(),className:"inline-flex items-center gap-2 rounded-full border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-[#0C1A2B] hover:bg-gray-50",children:[e.jsx(y,{className:"h-4 w-4"})," Print or save PDF"]})}),e.jsxs("article",{className:"rounded-2xl border border-gray-200 bg-white p-6 sm:p-10 print:border-0",children:[e.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-[#0C1A2B]",children:"Snestico"}),e.jsxs("p",{className:"text-sm text-gray-500",children:[t.seller.website," · ",t.seller.email]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("h1",{className:"text-lg font-semibold text-[#0C1A2B]",children:"Receipt"}),e.jsx("p",{className:"text-sm text-gray-600",children:t.invoiceNumber}),e.jsx("span",{className:`mt-1 inline-block rounded-full px-2.5 py-0.5 text-xs font-semibold ${n.tone}`,children:n.label})]})]}),e.jsxs("dl",{className:"mt-8 grid gap-4 text-sm sm:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-gray-500",children:"Billed to"}),e.jsx("dd",{className:"font-medium text-[#0C1A2B]",children:t.billedTo.name||t.billedTo.email}),t.billedTo.name&&e.jsx("dd",{className:"text-gray-600",children:t.billedTo.email})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-gray-500",children:"Date"}),e.jsx("dd",{className:"font-medium text-[#0C1A2B]",children:s(t.createdAt)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-gray-500",children:"Payment method"}),e.jsx("dd",{className:"font-medium text-[#0C1A2B]",children:t.card?f(t.card):t.amountCents===0?"None (no charge)":"Card"})]})]}),e.jsxs("table",{className:"mt-8 w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 text-left text-gray-500",children:[e.jsx("th",{className:"pb-2 font-medium",children:"Description"}),e.jsx("th",{className:"pb-2 text-right font-medium",children:"Amount"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b border-gray-100",children:[e.jsxs("td",{className:"py-3 pr-4",children:[e.jsx("p",{className:"font-medium text-[#0C1A2B]",children:t.description}),t.periodStart&&t.periodEnd&&e.jsxs("p",{className:"text-gray-500",children:[s(t.periodStart)," to ",s(t.periodEnd)]})]}),e.jsx("td",{className:"py-3 text-right",children:r(m,t.currency)})]}),t.discountCents>0&&e.jsxs("tr",{className:"border-b border-gray-100 text-emerald-700",children:[e.jsxs("td",{className:"py-3",children:["Promo code ",t.coupon]}),e.jsxs("td",{className:"py-3 text-right",children:["â",r(t.discountCents,t.currency)]})]})]}),e.jsxs("tfoot",{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"pt-4 font-semibold text-[#0C1A2B]",children:t.status==="failed"?"Amount due":"Total paid"}),e.jsx("td",{className:"pt-4 text-right text-lg font-bold text-[#0C1A2B]",children:r(t.amountCents,t.currency)})]}),t.status==="refunded"&&e.jsxs("tr",{children:[e.jsxs("td",{className:"pt-1 text-gray-600",children:["Refunded ",t.refundedAt?s(t.refundedAt):""]}),e.jsxs("td",{className:"pt-1 text-right text-gray-600",children:["â",r(t.amountCents,t.currency)]})]})]})]}),t.failure&&e.jsxs("p",{className:"mt-4 text-sm text-red-700",children:["This payment didn't go through: ",t.failure]}),e.jsxs("p",{className:"mt-10 text-xs text-gray-500",children:["Questions about this charge? Write to ",t.seller.email," with the receipt number. Cards are processed securely by Square."]})]})]})}function L(){return e.jsxs(u,{children:[e.jsx(b,{title:"Receipt | Snestico",description:"Your Snestico payment receipt.",noindex:!0}),e.jsx(C,{})]})}
1export{L as ReceiptPage};
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.