PageSourceSearch

https://vidapeps.com/assets/PayLink-B7_8Xkt4.js

js vidapeps.com collected 2026-10-04 08:09:50 UTC 16,015 bytes, 1 lines download raw bytes

1import{j as e,u as pe}from"./vendor-query-CniT1WJL.js";import{k as ye,r as p,e as he,L as v}from"./vendor-react-69GsFwrV.js";import{a9 as te,aa as xe,d4 as fe,d5 as ge,V as P,d2 as ke,d6 as je,d3 as Q,d7 as be,u as Ne,aI as N,a8 as W,ab as ve,d8 as we,c_ as Y,c$ as Ce,d9 as Pe,da as Te,db as Ie}from"./index-KjAD5lCC.js";import{P as h}from"./PaymentCard-CNmbrjef.js";import{P as H,a as q}from"./PayLinkSummaryCard-Cm5xFSna.js";import{ap as Se,g as se,aw as z,aV as Le,b2 as Re,G as O}from"./vendor-ui-Ad3ANzF6.js";import{P as J,a as qe}from"./PayLinkVidapayTile-COzDVRE7.js";import{p as Ae,a as Ve,r as Ee}from"./pay-link-vidapay-return-DbOdzLly.js";import"./vendor-forms-q6h4WU-p.js";function De({payment:s,baseAmountCents:a,memoDocumentNo:k,reportPayer:i}){const x=s.amountCents??a,o=s.discountCents??0,l=s.status;return te(s.railKey)?e.jsx(xe,{railKey:s.railKey,amountCents:x,discountCents:o,referenceCode:s.referenceCode,expiresAt:s.expiresAt,memoDocumentNo:k??null,instructions:s.instructions??null,reportPayer:i??null}):s.railKey==="crypto"?e.jsx(fe,{status:l,amountCents:x,discountCents:o,paidAmountCents:s.paidAmountCents,paymentUrl:s.paymentUrl,expiresAt:s.expiresAt}):s.railKey==="moonpay"?e.jsx(ge,{status:l,amountCents:x,discountCents:o,paymentUrl:s.paymentUrl??null,expiresAt:s.expiresAt??null}):s.paymentUrl?e.jsxs(h,{"data-testid":"block-pay-link-hosted",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Complete secure payment"}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:"Finish payment on the secure checkout page. This page updates automatically the moment your payment is confirmed."}),e.jsx(P,{asChild:!0,block:!0,className:"mt-4","data-testid":"link-pay-link-hosted",children:e.jsxs("a",{href:s.paymentUrl,target:"_blank",rel:"noopener noreferrer",children:["Continue to payment ",e.jsx(Se,{className:"ml-1 h-4 w-4"})]})})]}):e.jsx(h,{children:e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"Your payment was started. Follow the instructions sent to your email, or contact VidaPeps if you need help completing it."})})}function re(s){return s.kind==="vidapay"}function _e(s){return re(s)||s.provider==="vidacode"?!1:s.checkoutMode==="manual"||s.checkoutMode==="redirect"||s.checkoutMode==="popup"}function X({methods:s,baseAmountCents:a,payingKey:k,onSelect:i}){const x=s.filter(_e).sort((o,l)=>o.sortOrder-l.sortOrder);return x.length===0?e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"Online payment is not available right now. Contact VidaPeps to complete payment."}):e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:x.map(o=>{const l=ke(a,o.discountBps),w=k===o.key;return e.jsx(je,{disabled:k!==null,busy:w,onClick:()=>i(o.key),"data-testid":`tile-pay-rail-${o.key}`,className:"min-h-20 rounded-card p-4",icon:e.jsx(be,{railKey:o.key,className:"h-5 w-5"}),label:o.displayName,trailing:e.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx("span",{className:"money-numeral font-display text-sm font-bold",children:Q(a-l)}),w?e.jsx(se,{className:"h-4 w-4 animate-spin text-muted-foreground","aria-hidden":"true"}):null]}),hint:e.jsxs(e.Fragment,{children:[o.description&&e.jsx("span",{className:"block text-xs leading-5",children:o.description}),l>0&&e.jsxs("span",{className:"mt-1 block text-xs font-medium text-primary",children:["save ",Q(l)]})]})},o.key)})})}function Oe(s){return s.notFound?s.paid?"paid":s.vidapaySuccess?s.hasVidapayEvidence?"vidapay_paid":"checkout_closed":s.hasStartedPayment?"status_unknown":"invalid":"active"}const ae=5e3,Ue=24*ae,Me=["sent","viewed","accepted"];function Z(s){if(s instanceof N){const a=s.data;if(a&&typeof a.error=="string"&&a.error!=="not_found")return a.error.replace(/_/g," ")}return"Payment could not be started. Please try again."}function $e(){return e.jsxs("div",{className:"space-y-4","aria-busy":"true",role:"status","aria-label":"Loading payment link",children:[e.jsx("div",{className:"h-44 animate-pulse rounded-card border border-card-border bg-muted/40"}),e.jsx("div",{className:"h-28 animate-pulse rounded-card border border-card-border bg-muted/40"})]})}function ee(){return e.jsx(q,{tone:"neutral",title:"This payment link is no longer valid",titleTestId:"text-pay-link-invalid",actions:e.jsx(P,{asChild:!0,variant:"ghost","data-testid":"link-pay-link-support",children:e.jsxs(v,{href:"/about#contact",children:[e.jsx(O,{className:"mr-2 h-4 w-4"})," Contact support"]})}),children:e.jsx("p",{className:"mt-3 max-w-sm text-sm leading-6 text-muted-foreground",children:"Payment links can expire or be replaced by a newer one. If you still owe a payment, check your email for a more recent link, or contact us and we will send a fresh one."})})}function _({number:s,amountCents:a}){return e.jsxs(q,{tone:"success",title:"Payment received",titleTestId:"text-pay-link-paid",amountCents:a,amountTestId:"text-pay-link-paid-amount",children:[s&&e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":"text-pay-link-paid-order",children:["Order ",s]}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"A confirmation is on its way to your email."}),e.jsxs("p",{className:"mt-4 text-sm",children:["Signed in?"," ",e.jsx(v,{href:"/account",className:"font-semibold text-primary hover:text-primary/80","data-testid":"link-pay-link-account",children:"View it in your account"})]})]})}function Fe({number:s}){return e.jsx(h,{children:e.jsxs("div",{className:"flex flex-col items-center py-4 text-center",children:[e.jsx("div",{className:"rounded-full bg-secondary p-3",children:e.jsx(se,{className:"h-10 w-10 animate-spin text-secondary-foreground","aria-hidden":"true"})}),e.jsx("h2",{className:"mt-4 font-display text-t3 font-bold tracking-tight","data-testid":"text-pay-link-confirming",children:"Confirming your payment"}),s&&e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Order ",s]}),e.jsx("p",{className:"mt-3 max-w-sm text-sm leading-6 text-muted-foreground",children:"Your checkout completed and we are confirming the payment now. This page updates automatically the moment it clears."})]})})}function Ke(){return e.jsx(q,{tone:"neutral",title:"Payment status unavailable",titleTestId:"text-pay-link-status-unknown",actions:e.jsx(P,{asChild:!0,variant:"ghost","data-testid":"link-pay-link-status-unknown-support",children:e.jsxs(v,{href:"/about#contact",children:[e.jsx(O,{className:"mr-2 h-4 w-4"})," Contact support"]})}),children:e.jsx("p",{className:"mt-3 max-w-sm text-sm leading-6 text-muted-foreground",children:"Do not send another payment using the instructions you saw here. Check your email for a receipt and check your order status before trying again. If you are unsure, contact support."})})}function Be(){return e.jsx(q,{tone:"neutral",title:"This checkout is closed","data-testid":"text-pay-link-closed",actions:e.jsx(P,{asChild:!0,variant:"ghost","data-testid":"link-pay-link-closed-support",children:e.jsxs(v,{href:"/about#contact",children:[e.jsx(O,{className:"mr-2 h-4 w-4"})," Contact support"]})}),children:e.jsx("p",{className:"mt-3 max-w-sm text-sm leading-6 text-muted-foreground",children:"This payment link is no longer active. If you completed a payment, a receipt is on its way to your email. If you still owe a payment, contact us and we will send a fresh link."})})}function et(){const[,s]=ye("/pay/:token"),a=s?.token??"",{isAuthenticated:k}=Ne(),[i,x]=p.useState(null),[o,l]=p.useState(null),[w,T]=p.useState(null),[ne,U]=p.useState(!1),[oe,A]=p.useState(!1),ie=he(),V=new URLSearchParams(ie).get("vidapay"),I=V==="success",de=V==="cancelled",[E]=p.useState(()=>
1Ae(a,V)),j=E.value;p.useEffect(()=>{Ve(E)},[E]);const S={cache:"no-store",omitCartToken:!0},m=pe({queryKey:Ie(a),queryFn:({signal:n})=>Te(a,{...S,signal:n}),enabled:!!a,staleTime:0,gcTime:0,retry:(n,r)=>r instanceof N&&r.status>=400&&r.status<500?!1:n<1,refetchInterval:n=>{const r=n.state.error;if(r instanceof N&&r.status>=400&&r.status<500)return!1;const c=n.state.data??null;return c?.targetType==="order"&&c.order.paymentStatus==="paid"?!1:i!==null||c?.targetType==="order"&&c.order.payment!=null?ae:!1}}),t=m.data??null,M=ne||m.error instanceof N&&m.error.status===404,y=p.useMemo(()=>t?.targetType!=="order"?null:t.order.payment??null,[t]),f=p.useMemo(()=>i&&y&&y.referenceCode===i.payment.referenceCode?{...i.payment,status:y.status,expiresAt:y.expiresAt}:i?.payment??y,[i,y]),$=t?.targetType==="order"&&(t.order.paymentStatus==="paid"||y?.status==="paid"),C=Oe({notFound:M,hasStartedPayment:i!==null||y!==null,paid:$,vidapaySuccess:I,hasVidapayEvidence:j!==null}),le=t?.targetType==="order"?t.order.orderNumber??`#${t.order.orderId}`:i?.orderId!=null?`#${i.orderId}`:null,F=I&&j!==null&&t?.targetType==="order"&&t.order.paymentStatus!=="paid"&&y?.status!=="paid",[L,ce]=p.useState(!1);p.useEffect(()=>{if(!F||L)return;const n=window.setTimeout(()=>ce(!0),Ue);return()=>window.clearTimeout(n)},[F,L]);async function K(n){if(!o){l(n),T(null);try{const r=t?.targetType==="quote"?{railKey:n,version:t.quote.ver
1sion}:{railKey:n},c=await we(a,r,S),u=c?.payment??null;if(!u)throw new Error("empty pay response");x({payment:u,orderId:typeof c?.orderId=="number"?c.orderId:null,orderNumber:typeof c?.orderNumber=="string"?c.orderNumber:null}),A(!1);const b=u.paymentUrl;if(typeof b=="string"&&b&&!te(u.railKey)){Y(window.location.pathname+window.location.search),window.location.href=b;return}m.refetch()}catch(r){r instanceof N&&r.status===404?U(!0):T(Z(r))}finally{l(null)}}}async function ue(n){if(!o){l(n),T(null);try{const r=t?.targetType==="quote"?{version:t.quote.version}:void 0,u=(await Pe(a,r,S))?.checkoutUrl;if(typeof u!="string"||!u)throw new Error("empty vidapay response");Ee(a,{number:t?.targetType==="order"?t.order.orderNumber??`#${t.order.orderId}`:null,amountCents:t?.targetType==="order"?t.order.amountDueCents:null}),Y(window.location.pathname+window.location.search),window.location.href=u;return}catch(r){r instanceof N&&r.status===404?U(!0):T(Z(r))}finally{l(null)}}}const me=`/login?redirect=${encodeURIComponent(`/pay/${a}`)}`;let d;if(!a||C==="invalid")d=e.jsx(ee,{});else if(C==="paid")d=e.jsx(_,{number:le});else if(C==="vidapay_paid")d=e.jsx(_,{number:j?.number??null,amountCents:j?.amountCents});else if(C==="checkout_closed")d=e.jsx(Be,{});else if(C==="status_unknown")d=e.jsx(Ke,{});else if(m.isLoading)d=e.jsx($e,{});else if(!t&&m.error&&!M)d=e.jsxs(h,{children:[e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"We could not load this payment link right now. Please try again."}),e.jsx(P,{type:"button",variant:"ghost",className:"mt-4",disabled:m.isFetching,onClick:()=>{m.refetch()},children:m.isFetching?"Retrying...":"Retry"})]});else if(!t)d=e.jsx(ee,{});else{const n=t.targetType==="order",r=n?{targetType:"order",number:t.order.orderNumber??`#${t.order.orderId}`,memoDocumentNo:W(t.order.orderNumber),lines:t.order.lines,amountDueCents:t.order.amountDueCents,methods:t.paymentMethods}:{targetType:"quote",number:t.quote.quoteNumber,memoDocumentNo:W(i?.orderNumber),lines:t.quote.items.map(R=>({name:R.productName,quantity:R.quantity})),amountDueCents:t.quote.totals.totalQuoteCents,methods:t.paymentMethods},c=n?t.order.disclosureTier:t.disclosureTier,u=n?t.order.disclosureRecipients:t.disclosureRecipients,b=c==="summary",B=n?t.order.orderNumber??`#${t.order.orderId}`:i?.orderId!=null?`#${i.orderId}`:t.quote.convertedOrderId!=null?`#${t.quote.convertedOrderId}`:null;if($)d=e.jsx(_,{number:B});else if(n&&t.order.amountDueCents<=0)d=e.jsx(h,{children:e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"No payment is due on this order."})});else if(n&&I&&j!==null&&!L)d=e.jsx(Fe,{number:B});else if(!n&&!i&&t.quote.convertedOrderId!=null)d=e.jsx(h,{children:e.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["This quote was already converted to order #",t.quote.convertedOrderId,". If you still owe a payment on it, check your email for that order's payment link."]})});else if(!n&&!i&&!(t.quote.items.length>0&&t.quote.totals.totalQuoteCents>0&&Me.includes(t.quote.status)))d=e.jsxs("div",{className:"space-y-4",children:[e.jsx(H,{...r}),b&&e.jsx(J,{token:a,recipients:u??[],onUnlocked:()=>{m.refetch()}}),e.jsx(h,{children:e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"This quote is not currently payable. Contact VidaPeps if you need it reopened."})})]});else{const R=f!=null&&(f.status==="created"||f.status==="pending"),D=r.methods.find(re)??null,G=D&&e.jsx(qe,{method:D,baseAmountCents:r.amountDueCents,payingKey:o,onSelect:()=>{ue(D.key)}});d=e.jsxs("div",{className:"space-y-4",children:[e.jsx(H,{...r}),b&&e.jsx(J,{token:a,recipients:u??[],onUnlocked:()=>{m.refetch()}}),w&&e.jsx("div",{role:"alert",className:"rounded-card border border-destructive/30 bg-destructive/10 p-4 text-sm text-destructive","data-testid":"text-pay-link-error",children:w}),de&&e.jsx("div",{className:"rounded-card border border-card-border bg-card p-4 text-sm text-muted-foreground shadow-sm","data-testid":"text-pay-link-vidapay-cancelled",children:"Hosted checkout was cancelled. Choose a payment method below whenever you are ready."}),I&&j!==null&&L&&e.jsx("div",{className:"rounded-card border border-card-border bg-card p-4 text-sm text-muted-foreground shadow-sm","data-testid":"text-pay-link-confirming-delayed",children:"Payment c
1onfirmation is delayed. If you completed checkout, your receipt will arrive by email and this page updates automatically when the payment clears."}),f?e.jsx(De,{payment:f,baseAmountCents:r.amountDueCents,memoDocumentNo:r.memoDocumentNo,reportPayer:ve(g=>Ce(a,g,S))}):e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),e.jsx("h2",{className:"font-semibold",children:"Choose how to pay"})]}),e.jsxs("div",{className:"mt-4 space-y-3",children:[G,e.jsx(X,{methods:r.methods,baseAmountCents:r.amountDueCents,payingKey:o,onSelect:g=>{K(g)}})]})]}),f&&R&&e.jsx("div",{className:"text-left",children:oe?e.jsxs(h,{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Change payment method"}),e.jsx("button",{type:"button",onClick:()=>A(!1),className:"rounded text-sm text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:"Close"})]}),e.jsxs("div",{className:"space-y-3",children:[G,e.jsx(X,{methods:r.methods.filter(g=>g.key!==f.railKey),baseAmountCents:r.amountDueCents,payingKey:o,onSelect:g=>{K(g)}})]})]}):e.jsxs("button",{type:"button",onClick:()=>A(!0),className:"inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:text-primary/80","data-testid":"button-pay-link-change-method",children:[e.jsx(Le,{className:"h-4 w-4","aria-hidden":"true"}),"Want to pay a different way? Change payment method"]})})]})}}return e.jsx("div",{className:"ph-no-capture min-h-screen bg-background text-foreground",children:e.jsxs("main",{className:"mx-auto w-full max-w-2xl px-4 py-8 sm:px-6 lg:py-12",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"})," Secure payment"]}),k?e.jsx(v,{href:"/account",className:"inline-flex min-h-11 items-center gap-1.5 text-sm font-semibold text-primary hover:text-primary/80","data-testid":"link-pay-link-account-top",children:"Your account"}):e.jsxs(v,{href:me,className:"inline-flex min-h-11 items-center gap-1.5 text-sm font-semibold text-primary hover:text-primary/80","data-testid":"link-pay-link-sign-in",children:[e.jsx(Re,{className:"h-4 w-4","aria-hidden":"true"})," Sign in"]})]}),d]})})}export{et 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.