PageSourceSearch

https://cdn.myijack.com/spa/client/quote.approve._publicId-CReLD96v.js

js myijack.com collected 2026-10-10 00:09:16 UTC 6,809 bytes, 3 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="c5e58700-d835-4054-8969-d56cbb4dd4cd")}catch(e){}}();import{r as o,j as e}from"./vendor-charts-ZyOnrnOL.js";import{C as d,b as m,c as x,a as u}from"./card-BG9SBMsZ.js";import{c as L,V as k,Y as C,B as A,e as D,I as F,ao as h,m as E}from"./main-B0AbJiqc.js";import{u as J}from"./use-toast-uvFSCPZA.js";import{Q as K}from"./QuoteApprovalRecorded-CAiqIs8F.js";import{M}from"./mail-warning-J3KjCZ46.js";import{F as _}from"./file-text-Cdzb35Cj.js";import{c as Q}from"./auth-Cw10tY91.js";import"./circle-check-DMZO9JpY.js";import"./use-neutralize-inertia-scroll-Dx1arWFQ.js";import"./index-Da6jBqK0.js";import"./ijack-logo-yold39tW.js";import"./vendor-table-B1Yyu8Rd.js";import"./auth-DqTSZZIL.js";import"./shield-check-B_j1nm6b.js";import"./shield-C2laEIRp.js";import"./NotFoundPage-D7npbEBq.js";import"./lazyRouteComponent-ClkG6AAQ.js";import"./index-B2HZQb_J.js";const U=[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]],W=L("link-2-off",U);function B({publicId:r,onApprove:f}){const{toast:y}=J(),[a]=o.useState(()=>window.location.hash.slice(1)),[i,g]=o.useState(()=>a?{status:"resolving"}:{status:"incomplete"}),[c,P]=o.useState(""),[v,j]=o.useState(!1),[O,S]=o.useState(!1),[w,N]=o.useState(!1);o.useEffect(()=>{if(!a)return;let t=!1;return(async()=>{try{const n=await h.POST("/v1/quote-approval/state",{body:{public_id:r,secret:a}});if(t)return;g(n.data?.quote?{status:"valid",quote:n.data.quote}:{status:"invalid"})}catch{t||g({status:"invalid"})}})(),()=>{t=!0}},[r,a]);const q=t=>y({title:"We could not record your approval",description:t,variant:"destructive"}),I=async()=>{if(f){f(a,c);return}j(!0);try{const t=await h.POST("/v1/quote-approval/approve",{body:{public_id:r,secret:a,signatory:c}});if(t.error){q(E(t.error,"Please contact your IJACK salesperson."));return}window.history.replaceState(null,"","/quote/approved"),S(!0)}catch{q("We could not reach IJACK. Check your connection and try again, or reply to the email and we will confirm it for you.")}finally{j(!1)}},T=async()=>{N(!0);const t=p=>y({title:"We could not open the quote PDF",description:p,variant:"destructive"});try{const n=(await h.POST("/v1/quote-approval/quote.pdf",{body:{public_id:r,secret:a},parseAs:"blob"})).data;if(!(n instanceof Blob)){t("Please contact your IJACK salesperson and we will send it to you.");return}const b=URL.createObjectURL(n),l=document.createElement("a");l.href=b,l.download="quote.pdf",document.body.appendChild(l),l.click(),setTimeout(()=>{document.body.removeChild(l),URL.revokeObjectURL(b)},0)}catch{t("Check your connection and try again.")}finally{N(!1)}};if(O)return e.jsx(K,{});if(i.status==="incomplete")return e.jsx("div",{className:"mx-auto flex w-full max-w-xl flex-col gap-4 px-4 py-10",children:e.jsxs(d,{children:[e.jsx(m,{children:e.jsxs(x,{className:"flex items-center gap-2 text-xl",children:[e.jsx(W,{className:"h-5 w-5","aria-hidden":"true"}),"This link looks incomplete"]})}),e.jsxs(u,{className:"flex flex-col gap-3",children:[e.jsx(k,{children:e.jsx(C,{"data-testid":"quote-approval-incomplete",children:"Part of the address is missing, so we cannot open your quote. Some email systems shorten links when they scan them."})}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Please open the link from the original email again, or reply to it and your IJACK salesperson will send you a new one."})]})]})});if(i.status==="resolving")return e.jsx("div",{className:"mx-auto flex w-full max-w-xl flex-col gap-4 px-4 py-10",children:e.jsx(d,{children:e.jsx(u,{className:"py-10",children:e.jsx("p",{className:"text-muted-foreground text-sm","data-testid":"quote-approval-loading",children:"Opening your quote…"})})})});if(i.status==="invalid")return e.jsx("div",{className:"mx-auto flex w-full max-w-xl flex-col gap-4 px-4 py-10",children:e.jsxs(d,{children:[e.jsx(m,{children:e.jsxs(x,{className:"flex items-center gap-2 text-xl",children:[e.jsx(M,{className:"h-5 w-5","aria-hidden":"true"}),"This approval link is no longer valid"]})}),e.jsx(u,{children:e.jsx(k,{children:e.jsx(C,{children:"Approval links last as long as the quote does, can only be used once, and stop w
1orking if the quote is updated. Please contact your IJACK salesperson and we will send you a new one."})})})]})});const s=i.quote,R=new Intl.NumberFormat("en-CA",{style:"currency",currency:s.currency,currencyDisplay:"code"}).format(s.total);return e.jsx("div",{className:"mx-auto flex w-full max-w-xl flex-col gap-4 px-4 py-10",children:e.jsxs(d,{children:[e.jsx(m,{children:e.jsxs(x,{className:"text-xl",children:["Approve quote #",s.workOrderId,s.workOrderNumber?` · ${s.workOrderNumber}`:""]})}),e.jsxs(u,{className:"flex flex-col gap-4",children:[s.customerName?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Prepared for"," ",e.jsx("strong",{className:"text-foreground",children:s.customerName}),"."]}):null,s.description?e.jsx("p",{className:"text-sm [overflow-wrap:anywhere]",children:s.description}):null,e.jsxs("p",{className:"text-sm",children:["Total excluding taxes: ",e.jsx("strong",{children:R})]}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Valid until ",new Date(s.expiresAt).toLocaleDateString(),"."]}),e.jsxs(A,{type:"button",variant:"outline",className:"w-full",disabled:w,onClick:T,"data-testid":"quote-approval-pdf",children:[e.jsx(_,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),w?"Opening the quote PDF…":"Open the quote PDF"]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{htmlFor:"quote-approval-signatory",children:"Type your full name to approve"}),e.jsx(F,{id:"quote-approval-signatory",value:c,autoComplete:"name",placeholder:"Your full name",onChange:t=>P(t.target.value),"data-testid":"quote-approval-signatory"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Typing your name here is your signature. It is recorded against this quote along with the date."})]}),e.jsx(A,{className:"h-12 w-full text-base",onClick:I,disabled:v||c.trim().length<2,"data-testid":"quote-approval-submit",children:v?"Recording your approval…":"Approve this quote"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Not expecting this? Close this page — nothing is approved until you press the button above."})]})]})})}function ue(){const{publicId:r}=Q.useParams();return e.jsx(B,{publicId:r})}export{ue as component};
2
3//# chunkId=c5e58700-d835-4054-8969-d56cbb4dd4cd

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.