PageSourceSearch

https://futuresummit.ai/assets/SponsorInvoice-tACtp6zL.js

js futuresummit.ai collected 2026-10-05 11:59:58 UTC 6,618 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/client-3Rgyq3FX.js","assets/tslib.es6-CmEaCU22.js"])))=>i.map(i=>d[i]);
2import{r as c,j as n,g as S,z as A,_ as M}from"./index-Cb0uFkxi.js";import{B as $}from"./button-BXT4L8KI.js";import{m as R,f as D,I as L}from"./InvoiceDocumentView-DZORMmHB.js";function O(e,t){return!Number.isInteger(e)||e<=0||!Number.isInteger(t)||t<=0?0:Math.floor((e*t+5e3)/1e4)}function d(e){return typeof e=="string"?e.trim():""}function F(e){if(!e)return!1;const t=e.address&&typeof e.address=="object"?e.address:{};return[d(e.region),d(e.province),d(t.region),d(t.province),d(e.billing_address),typeof e.address=="string"?d(e.address):""].map(r=>r.toLowerCase()).some(r=>r==="qc"||r.includes("quebec")||r.includes("québec")||/(^|[\s,])qc([\s,]|$)/.test(r))}function T(e){const t=F(e.bill_to)?0:e.fee_bps,a=O(e.remaining_minor,t);return{amount_minor:e.remaining_minor,fee_minor:a,fee_bps:a>0?t:0,total_minor:e.remaining_minor+a,currency:e.currency}}const k=1e4;function Q(e,t){return!Number.isSafeInteger(t)||t<=0?null:e==null?t:typeof e!="number"||!Number.isSafeInteger(e)||e<Math.min(k,t)||e>t?null:e}function V({card:e,currency:t,balanceMinor:a,feeBps:r,paying:o,error:i,onPay:v}){const l=c.useId(),[f,p]=c.useState("full"),[h,g]=c.useState(""),b=r!==null&&a>0,s=b&&f==="partial",u=R(h),m=u===null?null:Q(u,a),x=m===null?null:T({remaining_minor:m,currency:t,fee_bps:r??0}),y=_=>D(_,t),j=`Minimum ${y(Math.min(k,a))}, maximum ${y(a)}.`,w=s&&h.trim()!==""&&m===null,I=e.hasFee?`Pay the full balance: ${e.total} incl. ${e.feeLabel} card fee`:`Pay the full balance: ${e.total}`,N=s?x?y(x.total_minor):null:e.total,P=!o&&(!s||m!==null),E=()=>{P&&v(s?m??void 0:void 0)};return n.jsxs("div",{children:[b&&n.jsxs("fieldset",{className:"space-y-2",children:[n.jsx("legend",{className:"sr-only",children:"How much to pay by card"}),n.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[n.jsx("input",{type:"radio",name:`${l}-choice`,value:"full",className:"mt-1 accent-[#b39653]",checked:f==="full",onChange:()=>p("full")}),n.jsx("span",{children:I})]}),n.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[n.jsx("input",{type:"radio",name:`${l}-choice`,value:"partial",className:"mt-1 accent-[#b39653]",checked:f==="partial",onChange:()=>p("partial")}),n.jsx("span",{children:"Pay a different amount"})]}),s&&n.jsxs("div",{className:"ml-6 space-y-1",children:[n.jsxs("label",{htmlFor:`${l}-amount`,className:"block text-sm font-medium",children:["Amount to pay before the card fee (",t,")"]}),n.jsx("input",{id:`${l}-amount`,type:"text",inputMode:"decimal",autoComplete:"off",placeholder:"2,500.00",value:h,onChange:_=>g(_.target.value),onKeyDown:_=>{_.key==="Enter"&&E()},"aria-invalid":w,"aria-describedby":`${l}-help`,className:"w-48 rounded border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#b39653]"}),n.jsx("p",{id:`${l}-help`,className:"text-sm text-neutral-600","aria-live":"polite",children:x?`Card fee ${y(x.fee_minor)} · Card total ${y(x.total_minor)}`:j}),w&&n.jsx("p",{role:"alert",className:"text-sm text-red-700",children:j})]})]}),n.jsx($,{className:"mt-3",onClick:E,disabled:!P,children:o?"Opening secure payment…":N?`Pay ${N} by credit card`:"Pay by credit card"}),i&&n.jsx("p",{role:"alert",className:"mt-2 text-sm text-red-700",children:i})]})}const B={payment_processing:"A card payment for this invoice is already being processed. Please wait a few minutes before trying again.",nothing_due:"This invoice has no balance due.",invoice_not_open:"This invoice can no longer be paid online.",collection_blocked:"Online payment is paused for this invoice. Please contact [email protected].",needs_review:"Online payment is paused for this invoice. Please contact [email protected].",rate_limited:"Too many attempts. Please try again later.",invalid_amount:"Enter an amount between the minimum and the balance due."};async function C(e){const{supabase:t}=await M(async()=>{const{supabase:o}=await import("./client-3Rgyq3FX.js").then(i=>i.c);return{supabase:o}},__vite__mapDeps([0,1])),{data:a,error:r}=await t.functions.invoke("sponsor-invoice-public",{body:e});if(r){const o=r.context,i=o?await o.json().catch(()=>null):null;throw new Error((i==null?void 0:i.error)??"request_failed")}return a}function Y(){c.useEffect(()=>{const e=document.createElement("meta");e.name="referrer",e.content="no-referrer";const t=document.createElement("meta");return t.name="robots",t.content="noindex, nofollow",document.head.append(e,t),()=>{e.remove(),t.remove()}},[])}function W(){Y();const{publicId:e=""}=S(),[t]=A(),[a,r]=c.useState(null),[o,i]=c.useState(!1),[v,l]=c.useState(!1),[f,p]=c.useState(null);c.useEffect(()=>{let s=!0;return C({action:"view",public_id:e}).then(u=>s&&r(u)).catch(()=>s&&i(!0)),()=>{s=!1}},[e]);const h=c.useCallback(async s=>{l(!0),p(null);try{const u=await C({action:"card_checkout",public_id:e,...s===void 0?{}:{amount_minor:s}});window.location.assign(u.url)}catch(u){const m=u instanceof Error?u.message:"";
2p(B[m]??"We couldn't start the card payment. Please try again or pay by wire or e-transfer."),l(!1)}},[e]),g=t.get("card")==="success",b=a==null?void 0:a.document.payment.card;return n.jsx("main",{className:"min-h-screen bg-neutral-100 px-4 py-10 sm:py-16",children:n.jsxs("div",{className:"mx-auto max-w-3xl",children:[g&&n.jsx("p",{role:"status",className:"mb-4 rounded border border-green-300 bg-green-50 p-3 text-sm text-green-900",children:"Thank you. Your card payment was submitted. This invoice updates once the payment is confirmed, usually within a few minutes."}),o&&n.jsx("p",{role:"alert",className:"rounded bg-white p-6 text-center text-neutral-700",children:"This invoice link isn't available. Please check the link in your email or contact [email protected]."}),!a&&!o&&n.jsx("p",{className:"rounded bg-white p-6 text-center text-neutral-500","aria-live":"polite",children:"Loading invoice…"}),a&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mb-4 flex justify-end",children:n.jsx($,{asChild:!0,variant:"outline",className:"bg-white text-neutral-900",children:n.jsx("a",{href:a.pdf_url,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:"Download PDF"})})}),n.jsx(L,{document:a.document,cardAction:b&&a.card_available&&!g?n.jsx(V,{card:b,currency:a.document.currency,balanceMinor:a.document.balanceMinor,feeBps:typeof a.card_fee_bps=="number"?a.card_fee_bps:null,paying:v,error:f,onPay:s=>void h(s)}):void 0})]})]})})}export{W 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.