PageSourceSearch

https://www.capture.com/assets/PayLink-K7CdVv-q.js

js capture.com collected 2026-10-04 00:31:54 UTC 18,689 bytes, 2 lines download raw bytes

1import{k as B,r,j as e}from"./react-core-B0D1Bb7z.js";import{E as A,u as M,a as I,P as O,l as W}from"./stripe-YcmsyLM0.js";import{S as q}from"./StarIcon-ZVbXgftr.js";import{a1 as P,aO as g,a9 as N,P as H,T as z,F as Z,G as Y,m as $}from"./icons-BEWyHvZZ.js";import{m as h}from"./proxy-KKZPpz7o.js";const _={theme:"flat",variables:{colorPrimary:"#19BF8C",colorBackground:"#ffffff",colorText:"#1a2b3b",colorDanger:"#ef4444",fontFamily:"Manrope, system-ui, sans-serif",spacingUnit:"4px",borderRadius:"12px",fontSizeBase:"15px"},rules:{".Input":{border:"1px solid #e5e5e5",boxShadow:"none",padding:"12px"},".Input:focus":{border:"1px solid #19BF8C",boxShadow:"0 0 0 3px rgba(25,191,140,0.1)"},".Label":{fontWeight:"500",fontSize:"14px",marginBottom:"6px"}}};let S=null;function R(){return S||(S=fetch("/api/checkout/config").then(n=>n.json()).then(n=>W(n.publishableKey))),S}function U({token:n,orderNumber:t,balanceDue:w,onSuccess:i}){const c=M(),l=I(),[x,o]=r.useState(!1),[f,d]=r.useState(""),[b,m]=r.useState(!1),y=async p=>{if(p.preventDefault(),!c||!l)return;o(!0),d("");const{error:u,paymentIntent:j}=await c.confirmPayment({elements:l,redirect:"if_required"});if(u){d(u.message||"Payment failed"),o(!1);return}if(j?.status==="succeeded"){try{await fetch(`/api/pay-link/${n}/confirm`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentIntentId:j.id,orderNumber:t})})}catch{}m(!0),setTimeout(()=>i(),2e3)}else d("Payment did not complete. Please try again."),o(!1)};return b?e.jsxs("div",{className:"flex flex-col items-center py-10 gap-2 text-center",children:[e.jsx(h.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:300,damping:20},className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-1",children:e.jsx(N,{className:"w-9 h-9 text-primary"})}),e.jsx("p",{className:"font-bold font-sans text-neutral-900 text-lg",children:"Payment received!"}),e.jsx("p",{className:"text-sm text-neutral-500 font-sans",children:"Finalising your order…"})]}):e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsx(O,{}),f&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 border border-red-100",children:[e.jsx(g,{className:"w-4 h-4 text-red-500 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm text-red-600 font-sans",children:f})]}),e.jsxs("button",{type:"submit",disabled:x||!c,className:"w-full flex items-center justify-center gap-2 py-4 rounded-xl bg-primary text-white font-sans font-bold text-base hover:bg-primary/90 transition-colors disabled:opacity-60 disabled:cursor-not-allowed shadow-sm","data-testid":"button-pay-balance",children:[x?e.jsx(P,{className:"w-5 h-5 animate-spin"}):e.jsx($,{className:"w-4 h-4"}),x?"Processing…":`Pay $${w.toFixed(2)}`]}),e.jsx("p",{className:"text-center text-xs text-neutral-400 font-sans",children:"Secured by Stripe · Your payment info is encrypted"})]})}function X(){const{token:n}=B(),[t,w]=r.useState(null),[i,c]=r.useState(""),[l,x]=r.useState(!0),[o,f]=r.useState(null),[d,b]=r.useState(""),[m,y]=r.useState(!1),[p,u]=r.useState(!1);r.useEffect(()=>{n&&fetch(`/api/pay-link/${n}`).then(async s=>{const a=await s.json();if(!s.ok)throw new Error(a.error||"Invalid or expired payment link");w(a),a.alreadyPaid&&u(!0)}).catch(s=>c(s.message)).finally(()=>x(!1))},[n]);const j=async()=>{if(!(!t||!n)){y(!0),b("");try{const s=await fetch(`/api/pay-link/${n}/create-intent`,{method:"POST",headers:{"Content-Type":"application/json"}}),a=await s.json();if(!s.ok)throw new Error(a.error||"Failed to prepare payment");f(a.clientSecret)}catch(s){b(s.message||"Failed to load payment form")}finally{y(!1)}}},E=t?.orderType==="pickup_deposit"?"Doorstep Collection Fee Paid":"Deposit Paid",C=t?.items??[],v=(t?.services??[]).filter(s=>s.price>0||s.type==="digital_output"),L=C.reduce((s,a)=>s+a.unitPrice*a.quantity,0)+v.filter(s=>s.price>0).reduce((s,a)=>s+a.price*a.quantity,0),k=t?.discountAmount??0,T=Math.round((L-k)*100)/100;return e.jsx("div",{className:"min-h-screen bg-neutral-50 flex flex-col items-center py-10 px-4",children:e.jsxs("div",{className:"w-full max-w-md 
1space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-6",children:[e.jsx("div",{className:"w-7 h-7 flex items-center justify-center overflow-hidden",children:e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 180 180",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-7 h-7",children:[e.jsx("path",{d:"M180 90C180 40.2944 139.706 0 90 0C40.2944 0 0 40.2944 0 90C0 139.706 40.2944 180 90 180C139.706 180 180 139.706 180 90Z",fill:"#1E2D42"}),e.jsx("mask",{id:"paylink-mask",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"30",y:"30",width:"112",height:"120",children:e.jsx("path",{d:"M141.6 30H30V150H141.6V30Z",fill:"white"})}),e.jsxs("g",{mask:"url(#paylink-mask)",children:[e.jsx("path",{d:"M136.815 52.4957C126.005 38.9729 109.486 30.2826 90.9424 29.9983L120.336 81.084L136.815 52.4957Z",fill:"#19BF8C"}),e.jsx("path",{d:"M80.9562 30.6865C62.9637 33.4352 47.5648 44.147 38.5684 59.1436H97.4495L80.9562 30.6865Z",fill:"#19BF8C"}),e.jsx("path",{d:"M34.0509 68.0535C31.4217 74.7946 30.0059 82.1854 30.0059 89.8605C30.0059 100.5 32.7565 110.49 37.5701 119.139L66.9775 68.0535H34.0509Z",fill:"#19BF8C"}),e.jsx("path",{d:"M43.0137 127.527C53.9046 141.039 70.5467 149.722 89.2284 150.006L59.615 98.9204L43.0137 127.527Z",fill:"#19BF8C"}),e.jsx("path",{d:"M99.2176 149.308L82.7246 120.851H141.605C132.609 135.826 117.21 146.563 99.1771 149.308H99.2176Z",fill:"#19BF8C"})]})]})}),e.jsx("span",{className:"font-sans text-xl tracking-tight font-extrabold text-[#1a2b3b]",children:"Capture"})]}),l&&e.jsxs("div",{className:"bg-white rounded-2xl border border-neutral-200 p-10 flex flex-col items-center gap-3",children:[e.jsx(P,{className:"w-8 h-8 animate-spin text-primary"}),e.jsx("p",{className:"text-sm text-neutral-500 font-sans",children:"Loading your payment details…"})]}),i&&e.jsxs("div",{className:"bg-white rounded-2xl border border-red-100 p-8 flex flex-col items-center gap-3 text-center",children:[e.jsx(g,{className:"w-10 h-10 text-red-400"}),e.jsx("p",{className:"font-semibold font-sans text-neutral-900",children:"Link unavailable"}),e.jsx("p",{className:"text-sm text-neutral-500 font-sans",children:i}),e.jsxs("p",{className:"text-xs text-neutral-400 font-sans mt-1",children:["If you believe this is an error, please contact us at"," ",e.jsx("a",{href:"mailto:[email protected]",className:"underline text-neutral-600",children:"[email protected]"})]})]}),p&&t&&e.jsxs(h.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},className:"space-y-3",children:[e.jsxs("div",{className:"rounded-2xl overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"bg-gradient-to-br from-[#19BF8C] to-[#0fa876] px-6 pt-8 pb-6 text-center",children:[e.jsx(h.div,{initial:{scale:.4,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:280,damping:18,delay:.15},className:"w-20 h-20 rounded-full bg-white/20 flex items-center justify-center mx-auto mb-4",children:e.jsx(N,{className:"w-11 h-11 text-white",strokeWidth:2})}),e.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-widest text-white/70 mb-1",children:["Order #",t.orderNumber]}),e.jsx("h1",{className:"text-2xl font-extrabold font-sans text-white leading-tight",children:"Payment Complete!"}),e.jsxs("p",{className:"text-white/80 text-sm font-sans mt-1",children:[t.balanceDue!=null?`$${t.balanceDue.toFixed(2)} received · `:"","Thank you ",t.userName.split(" ")[0]||"","!"]})]}),e.jsx("div",{className:"bg-white px-6 py-5 border-b border-neutral-100 text-center",children:e.jsx("p",{className:"text-neutral-600 font-sans text-sm leading-relaxed",children:"Your memories are confirmed and being prepared for shipping. You'll receive a tracking email as soon as your package leaves our facility."})}),e.jsxs("div",{className:"bg-white px-6 py-5",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-neutral-400 mb-4",children:"What happens next"}),e.jsx("div",{className:"space-y-0",children:[{icon:N,color:"text-primary",bg:"bg-primary/10",title:"Order confirmed",desc:"Your payment has been received and your order is now confirmed.",done:!0},{icon:H,color:"text-blue-500",bg:"bg-blue-50",title:"Packing your memories",desc:"We're carefully preparing your digitized files and original media for shipment.",done:!1},{icon:z,color:"text-violet-500",bg:"bg-violet-50",title:"Shipped to your door",desc:"Your package will be dispatched with a tracking number sent to your email.",done:!1}].map((s,a,F)=>e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-9 h-9 rounded-full ${s.bg} flex items-center justify-center shrink-0`,children:e.jsx(s.icon,{className:`w-4.5 h-4.5 ${s.color}`,strokeWidth:2})}),a<F.length-1&&e.jsx("div",{className:"w-px flex-1 bg-neutral-100 my-1"})]}),e.jsxs("div",{className:`pb-4 ${a===F.length-1,""}`,children:[e.jsx("p",{className:`text-sm font-semibold font-sans ${s.done?"text-primary":"text-neutral-800"}`,children:s.title}),e.jsx("p",{className:"text-xs text-neutral-500 font-sans mt-0.5 leading-relaxed",children:s.desc})]})]},a))})]})]}),e.jsxs("div",{className:"text-center space-y-1 pb-6 pt-2",children:[e.jsxs("p",{className:"text-xs text-neutral-400 font-sans",children:["Questions? Email us at"," ",e.jsx("a",{href:"mailto:[email protected]",className:"underline text-neutral-500",children:"[email protected]"})]}),e.jsx("p",{className:"text-xs text-neutral-300 font-sans",children:"© Capture Memory Digitization"})]})]}),!l&&!i&&!p&&t&&t.paymentModel==="full"&&!(t.balanceDue>0)&&e.jsxs(h.div,{initial:{opacity:0,y:24}
1,animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},className:"bg-white rounded-2xl border border-neutral-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"bg-gradient-to-br from-[#19BF8C] to-[#0fa876] px-6 pt-8 pb-6 text-center",children:[e.jsx(h.div,{initial:{scale:.4,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:280,damping:18,delay:.15},className:"w-20 h-20 rounded-full bg-white/20 flex items-center justify-center mx-auto mb-4",children:e.jsx(N,{className:"w-11 h-11 text-white",strokeWidth:2})}),e.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-widest text-white/70 mb-1",children:["Order #",t.orderNumber]}),e.jsx("h1",{className:"text-2xl font-extrabold font-sans text-white leading-tight",children:"Already Paid in Full"}),e.jsx("p",{className:"text-white/80 text-sm font-sans mt-1",children:"No balance due — your order is fully paid."})]}),e.jsx("div",{className:"px-6 py-5 text-center",children:e.jsxs("p",{className:"text-neutral-600 font-sans text-sm leading-relaxed",children:["Hi ",t.userName.split(" ")[0]||"there"," — your order was paid in full at checkout. There's nothing further to pay. We're working on your memories and will be in touch with updates."]})}),e.jsx("div",{className:"px-6 pb-6 text-center",children:e.jsx("a",{href:"/",className:"inline-flex items-center gap-2 py-3 px-6 rounded-xl bg-primary text-white font-sans font-bold text-sm hover:bg-primary/90 transition-colors shadow-sm",children:"Back to Home"})})]}),!l&&!i&&!p&&t&&(t.paymentModel!=="full"||t.balanceDue>0)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-neutral-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:`${t.isSupplemental?"bg-gradient-to-br from-red-700 to-red-900":"bg-gradient-to-br from-[#1a2b3b] to-[#243548]"} px-6 pt-7 pb-6 flex flex-col items-center text-center`,children:[e.jsxs("div",{className:"relative w-20 h-20 mb-3",children:[e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-white/10 flex items-center justify-center",children:t.isSupplemental?e.jsx(g,{className:"w-10 h-10 text-red-300",strokeWidth:1.5}):e.jsx(Z,{className:"w-10 h-10 text-primary",strokeWidth:1.5})}),!t.isSupplemental&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute -top-1.5 -right-1.5 w-7 h-7 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(Y,{className:"w-3.5 h-3.5 text-primary",strokeWidth:2})}),e.jsx("div",{className:"absolute -bottom-1.5 -left-1.5 w-7 h-7 rounded-full bg-amber-400/20 flex items-center justify-center",children:e.jsx(q,{className:"w-3.5 h-3.5 text-amber-400",strokeWidth:2})})]})]}),e.jsx("p",{className:"text-xs font-semibold text-white/50 uppercase tracking-widest",children:t.isSupplemental?"Additional payment required":"Your memories are ready"})]}),e.jsxs("div",{className:"px-6 pb-4 pt-4 text-center",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-neutral-400 uppercase tracking-widest mb-1",children:["Order #",t.orderNumber]}),e.jsxs("h1",{className:"text-xl font-bold font-sans text-neutral-900",children:["Hi ",t.userName.split(" ")[0]||"there"," 👋"]}),t.isSupplemental?e.jsx("p",{className:"text-sm text-neutral-500 font-sans mt-1.5 leading-relaxed",children:"There's a small outstanding balance on your order. Please complete this payment to finalise your account — it only takes a moment."}):e.jsx("p",{className:"text-sm text-neutral-500 font-sans mt-1.5 leading-relaxed",children:"Great news — your memories have been digitized and are ready to ship home. Complete your final payment below and we'll get them on their way."})]}),e.jsx("div",{className:"border-t border-neutral-100 mx-6"}),e.jsxs("div",{className:"px-6 py-4 space-y-2.5",children:[e.jsx("p",{className:"text-[10px] font-semibold text-neutral-400 uppercase tracking-widest mb-1",children:"What we digitized"}),C.map((s,a)=>e.jsxs("div",{className:"flex justify-between items-start gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-sm text-neutral-800 font-sans font-medium leading-snug",children:[s.quantity,"× ",s.productName]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-0.5",children:[s.quality&&e.jsx("span",{className:"text-[10px] bg-neutral-100 text-neutral-500 px-1.5 py-0.5 rounded font-medium",children:s.quality}),s.format&&s.format!==s.productName&&e.jsx("span",{className:"text-[10px] bg-neutral-100 text-neutral-500 px-1.5 py-0.5 rounded font-medium",children:s.format})]})]}),e.jsxs("span",{className:"text-sm text-neutral-800 font-sans font-semibold shrink-0",children:["$",(s.unitPrice*s.quantity).toFixed(2)]})]},a)),v.length>0&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"border-t border-dashed border-neutral-100 pt-2 mt-1",children:[e.jsx("p",{className:"text-[10px] font-semibold text-neutral-400 uppercase tracking-widest mb-2",children:"Add-ons & Services"}),v.map((s,a)=>e.jsxs("div",{className:"flex justify-between items-center text-sm py-0.5",children:[e.jsxs("span",{className:"text-neutral-600 font-sans",children:[s.name,s.quantity>1?` ×${s.quantity}`:""]}),e.jsx("span",{className:"text-neutral-700 font-sans font-medium",children:s.price===0?e.jsx("span",{className:"text-primary text-xs font-semibold",children:"Free"}):`$${(s.price*s.quantity).toFixed(2)}`})]},a))]})})]}),e.jsx("div",{className:"border-t border-neutral-100 mx-6"}),e.jsxs("div",{className:"px-6 py-3 space-y-1.5 text-sm",children:[k>0&&e.jsxs("div",{className:"flex justify-between items-center font-sans",children:[e.jsxs("span",{className:"text-emerald-700 flex items-center gap-1.5",children:["Promo Discount",t.promoCode&&e.jsx("span",{className:"bg-emerald-100 text-emerald-800 text-[10px] font-semibold px-1.5 py-0.5 rounded-full uppercase tracking-wide",children:t.promoCode})]}),e.jsxs("span",{className:"text-emerald-700",children:["−$",k.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between text-neutral-500 font-sans",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{children:["$",T.toFixed(2)]})]}),(t.taxAmount??0)>0&&e.jsxs("div",{className:"flex justify-between text-neutral-500 font-sans",children:[e.jsx("span",{children:"Sales Tax"}),e.jsxs("span",{children:["$",t.taxAmount.toFixed(2)]})]}),t.depositAmount>0&&e.jsxs("div",{className:"flex justify-between text-neutral-500 font-sans",children:[e.jsx("span",{children:E}),e.jsxs("span",{children:["−$",t.depositAmount.toFixed(2)]})]})]}),e.jsxs("div",{className:`mx-4 mb-4 rounded-xl px-5 py-4 flex justify-between items-center ${t.isSupplemental?"bg-red-50 border border-red-100":"bg-amber-50 border border-amber-100"}`,children:[e.jsxs("div",{children:[e.jsx("p",{className:`font-bold font-sans text-base ${t.isSupplemental?"text-red-900":"text-amber-900"}`,children:t.isSupplemental?"Additional Payment Due":"Balance Due"}),e.jsx("p",{className:`text-xs font-sans mt-0.5 ${t.isSupplemental?"text-red-700":"text-amber-700"}`,children:t.isSupplemental?"Outstanding amount on your order":"Due now to release your order"})]}),e.jsxs("p",{className:`font-bold font-sans text-2xl ${t.isSupplemental?"text-red-900":"text-amber-900"}`,children:["$",t.balanceDue.toFixed(2)]})]})]}),o?e.jsxs("div",{className:"bg-white rounded-2xl border border-neutral-200 p-5 shadow-sm",children:[e.jsx("p",{className:"text-sm font-semibold font-sans text-neutral-700 mb-4",children:"Enter your payment details"}),e.jsx(A,{stripe:R(),options:{clientSecret:o,appearance:_},children:e.jsx(U,{token:n,orderNumber:t.orderNumber,balanceDue:t.balanceDue,onSuccess:()=>u(!0)})})]}):e.jsxs("div",{className:"space-y-2",children:[d&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 border border-red-100",children:[e.jsx(g,{className:"w-4 h-4 text-red-500 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm text-red-600 font-sans",children:d})]}),e.jsxs("button",{onClick:j,disabled:m,className:"w-full flex items-center justify-center gap-2 py-4 rounded-xl bg-primary text-white font-sans font-bold text-base hover:bg-primary/90 transition-colors shadow-sm disabled:opacity-60","data-testid":"button-open-payment",children:[m?e.jsx(P,{className:"w-5 h-5 animate-spin"}):e.jsx($,{className:"w-4 h-4"}),m?"Preparing…":`Pay $${t.balanceDue.toFixed(2)}`]}),e.jsx("p",{className:"text-center text-xs text-neutral-400 font-sans pt-1",children:"Secured by Stripe · Encrypted & safe"})]}),e.jsxs("div",{className:"text-center space-y-1 pb-6",children:[e.jsxs("p",{className:"text-xs text-neutral-400 font-sans",children:["Questions? Email us at ",e.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"})]}),e.jsx("p",{className:"text-xs text-neutral-300 font-sans",children:"© Capture Memory Digitization"})]})]})]})})}export{X as default};
2//# sourceMappingURL=PayLink-K7CdVv-q.js.map

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.