PageSourceSearch

https://www.qoreai.com/assets/PublicQuote-DVwq474r.js

js qoreai.com collected 2026-09-24 13:11:51 UTC 10,789 bytes, 1 lines download raw bytes

1import{r as n,j as e}from"./vendor-react-B5Wrj-9W.js";import{supabase as h}from"./client-DhL_Z3GM.js";import{a as d,e as l}from"./index-DxzR_Sz1.js";import{I as g}from"./input-kgZG-UR5.js";import{L as u}from"./label-BJQtjs12.js";import{T as X}from"./textarea-LzF8TWhy.js";import{i as R,e as Z,b as v}from"./quotes-QxKRU98a.js";import{c as ee}from"./vendor-router-B_GMu44Q.js";import{a1 as se,t as te}from"./vendor-icons-Cz8Y71Nn.js";import"./vendor-supabase-DljY4R_6.js";import"./vendor-radix-DJaxbWLn.js";const ge=()=>{const{token:i}=ee(),[r,b]=n.useState(null),[M,N]=n.useState(!0),[p,c]=n.useState("view"),[m,P]=n.useState(""),[y,F]=n.useState(""),[w,z]=n.useState(null),[f,S]=n.useState(""),[C,q]=n.useState(""),[j,G]=n.useState(""),[_,O]=n.useState(!1),[x,o]=n.useState(!1),[U,T]=n.useState(!1),[D,V]=n.useState(""),k=async()=>{N(!0);const{data:s,error:a}=await h.functions.invoke("quotes-public",{body:{action:"get",token:i}});if(a||s?.error){l.error(s?.error||a?.message),N(!1);return}b(s),s.quote.signed_by_dealer_at&&c("done"),N(!1)};n.useEffect(()=>{k()},[i]);const W=async()=>{if(!m)return;o(!0);const{data:s,error:a}=await h.functions.invoke("quotes-public",{body:{action:"request_code",token:i,email:m}});if(o(!1),a||s?.error){l.error(s?.error||a?.message);return}l.success("Code sent. Check your email."),c("code")},Y=async()=>{o(!0);const{data:s,error:a}=await h.functions.invoke("quotes-public",{body:{action:"verify_code",token:i,email:m,code:y}});if(o(!1),a||s?.error){l.error(s?.error||a?.message);return}z(s.signer_id);const E=r?.signers.find(K=>K.id===s.signer_id);S(E?.name||""),q(E?.title||""),c("sign")},$=async()=>{if(!_||!j||!f||!w){l.error("Complete all fields and confirm");return}o(!0);const{data:s,error:a}=await h.functions.invoke("quotes-public",{body:{action:"sign",token:i,signer_id:w,typed_signature:j,full_name:f,title:C,confirmed:!0}});if(o(!1),a||s?.error){l.error(s?.error||a?.message);return}c("done"),l.success("Signed"),k()},H=async()=>{o(!0);const{data:s,error:a}=await h.functions.invoke("quotes-public",{body:{action:"decline",token:i,email:m,reason:D}});if(o(!1),a||s?.error){l.error(s?.error||a?.message);return}l.success("Quote declined. Thanks for the response."),k()};if(M)return e.jsx("div",{className:"min-h-dvh flex items-center justify-center bg-background",children:e.jsx(se,{className:"animate-spin text-muted-foreground"})});if(!r)return e.jsx("div",{className:"min-h-dvh flex items-center justify-center text-muted-foreground bg-background",children:"Quote not found or link expired."});const{quote:t,line_items:I,signers:re}=r,L=I.filter(R),Q=I.filter(s=>!R(s)),J=["completed","signed_by_dealer","declined","expired","voided"].includes(t.status);return e.jsx("div",{className:"min-h-dvh bg-background text-foreground",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-12",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8 pb-6 border-b border-border/20",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-widest text-muted-foreground",children:"QoreAI Quote"}),e.jsx("div",{className:"font-mono text-sm mt-1",children:t.reference_number})]}),e.jsx("div",{className:"text-right text-xs text-muted-foreground",children:e.jsxs("div",{children:["Expires ",Z(t.expires_at)]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6 mb-8",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase text-muted-foreground mb-2",children:"Prepared for"}),e.jsx("div",{className:"font-semibold",children:t.customer_dealership}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t.customer_contact_name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t.customer_contact_email}),t.customer_billing_address&&e.jsx("div",{className:"text-sm text-muted-foreground whitespace-pre-line mt-1",children:t.customer_billing_address})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase text-muted-foreground mb-2",children:"Prepared by"}),e.jsx("div",{className:"font-semibold",children:t.sales_rep_name_snapshot}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t.sales_rep_email_snapshot}),t.sales_rep_address_snapshot&&e.jsx("div",{className:"text-sm text-muted-foreground",children:t.sales_rep_address_snapshot})]})]}),L.length>0&&e.jsx(A,{title:"Due now",children:e.jsx(B,{items:L})}),Q.length>0&&e.jsx(A,{title:"Due later",children:e.jsx(B,{items:Q})}),e.jsxs("div",{className:"mt-6 rounded-lg bg-card/30 border border-border/20 p-5 grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase text-muted-foreground",children:"One time (
1after discount)"}),e.jsx("div",{className:"text-2xl font-display font-bold",children:v(t.total_one_time_after_discount_cents)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase text-muted-foreground",children:"Monthly recurring"}),e.jsxs("div",{className:"text-2xl font-display font-bold",children:[v(t.total_monthly_recurring_cents),e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]})]})]}),t.comments&&e.jsx("div",{className:"mt-6 text-sm text-muted-foreground whitespace-pre-line border-l-2 border-primary/40 pl-4",children:t.comments}),e.jsxs("div",{className:"mt-8 text-xs text-muted-foreground space-y-1",children:[e.jsxs("div",{children:["Initial term: ",t.term_months," months, auto-renewing for successive 12 month periods."]}),e.jsxs("div",{children:["Renewal increase: ",Number(t.renewal_increase_pct),"%. Cancellation notice: ",t.cancellation_notice_days," days."]}),e.jsx("div",{children:"Governed by the QoreAI SaaS Agreement, Terms and Conditions, and Service Level Agreement."})]}),e.jsx("div",{className:"mt-10 rounded-lg border border-border/30 bg-card/20 p-6",children:J?e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-emerald-500/15 text-emerald-300 w-10 h-10 flex items-center justify-center",children:e.jsx(te,{})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:t.status==="declined"?"This quote was declined.":t.status==="expired"?"This quote has expired.":t.status==="voided"?"This quote was voided.":"Signed. Thanks!"}),t.signed_by_dealer_at&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Signed at ",new Date(t.signed_by_dealer_at).toLocaleString()]})]})]}):U?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"font-semibold",children:"Decline this quote"}),e.jsx(u,{className:"text-xs",children:"Reason (optional)"}),e.jsx(X,{rows:3,value:D,onChange:s=>V(s.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"outline",onClick:()=>T(!1),children:"Back"}),e.jsx(d,{variant:"destructive",onClick:H,disabled:x,children:"Decline"})]})]}):p==="view"?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"font-semibold",children:"Ready to sign?"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"We will verify your email with a 6 digit code, then you can sign."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{onClick:()=>c("email"),className:"gap-2",children:"Start signing"}),e.jsx(d,{variant:"ghost",onClick:()=>T(!0),children:"Decline"})]})]}):p==="email"?e.jsxs("div",{className:"space-y-3",children:[e.jsx(u,{children:"Your email (must match the signer on file)"}),e.jsx(g,{type:"email",value:m,onChange:s=>P(s.target.value),placeholder:"[email protected]"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"outline",onClick:()=>c("view"),children:"Back"}),e.jsx(d,{onClick:W,disabled:x||!m,children:x?"Sending…":"Send code"})]})]}):p==="code"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs(u,{children:["Enter the 6 digit code sent to ",m]}),e.jsx(g,{value:y,onChange:s=>F(s.target.value.replace(/\D/g,"")),maxLength:6,className:"font-mono text-lg tracking-widest text-center"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"outline",onClick:()=>c("email"),children:"Back"}),e.jsx(d,{onClick:Y,disabled:x||y.length!==6,children:"Verify"})]})]}):p==="sign"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(u,{children:"Full name *"}),e.jsx(g,{value:f,onChange:s=>S(s.target.value)})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Title"}),e.jsx(g,{value:C,onChange:s=>q(s.target.value)})]})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Type your signature *"}),e.jsx(g,{value:j,onChange:s=>G(s.target.value),className:"font-['Caveat',cursive] text-2xl h-14",placeholder:"Sign here"})]}),e.jsxs("label",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:s=>O(s.target.checked),className:"mt-1"}),e.jsxs("span",{children:["I agree this electronic signature is the legal equivalent of my handwritten signature and that I am authorized to bind ",t.customer_dealership,"."]})]}),e.jsx(d,{onClick:$,disabled:x||!_||!j||!f,className:"w-full",children:x?"Signing…":"Sign quote"})]}):e.jsx("div",{children:"Signed."})}),e.jsx("div",{className:"mt-10 text-center text-xs text-muted-foreground",children:"QoreAI — Dealership Intelligence"})]})})},A=({title:i,children:r})=>e.jsxs("div",{className:"mt-6",children:[e.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:i}),r]}),B=({items:i})=>e.jsx("div",{className:"rounded-lg border border-border/20 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-card/30 text-xs uppercase text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-2",children:"Item"}),e.jsx("th",{className:"text-right px-4 py-2",children:"Qty"}),e.jsx("th",{className:"text-right px-4 py-2",children:"Unit"}),e.jsx("th",{className:"text-right px-4 py-2",children:"Total"})]})}),e.jsx("tbody",{children:i.map((r,b)=>
1e.jsxs("tr",{className:"border-t border-border/10",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium",children:r.name}),r.description&&e.jsx("div",{className:"text-xs text-muted-foreground",children:r.description}),r.unit_label==="monthly"&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Monthly",r.payment_start_offset_months?` · starts month ${r.payment_start_offset_months+1}`:""]})]}),e.jsx("td",{className:"px-4 py-3 text-right",children:Number(r.quantity)}),e.jsx("td",{className:"px-4 py-3 text-right",children:v(r.unit_price_cents)}),e.jsxs("td",{className:"px-4 py-3 text-right font-medium",children:[v(r.line_total_cents),r.unit_label==="monthly"?"/mo":""]})]},b))})]})});export{ge 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.