1import{j as e,r as l}from"./index-CU9pv9kH.js";import{C as c,a as d}from"./Card-BzpsXsdE.js";import{B as g}from"./Badge-s9iX0649.js";import{D as h}from"./DocumentList-BFYXabR0.js";import{M as f}from"./Modal-C6kFkAbC.js";import{d as j}from"./documentUrls-Cn1xQvsu.js";import{E as v}from"./external-link-CAml7HFm.js";import{j as N,e as y,k as u}from"./ApplicationRoot-D4scxSx1.js";import{u as b}from"./useCustomer-CTl7_4vS.js";import{F as p}from"./file-text-jyLQwAMQ.js";import"./DocumentViewerModal-DhQe74A9.js";import"./plus-DyEPwt-R.js";import"./createLucideIcon-IZvJT3Oh.js";import"./trash-2-B6s-XdFu.js";import"./download-DetgfXnG.js";import"./file-image-ClpwilzM.js";import"./pencil-CV7ycgge.js";import"./save-CRDfMfIA.js";import"./CarrierPortalButton-d58tuFAL.js";import"./Button-D9Hhg3jy.js";import"./quotexConnect-DQ7jyqIj.js";import"./loader-circle-DXUjcncs.js";import"./check-BvqISjvx.js";import"./chevron-up-C9WwYN1L.js";import"./chevron-down-Bt45DgM_.js";import"./circle-check-qSrjwebh.js";import"./send-BodfG4sM.js";import"./arrow-left-B0QZoWyb.js";function E({open:i,onClose:r,document:s,customerName:a}){const n=(s==null?void 0:s.visibility)==="customer_visible"&&s.customerEsignRequired===!0&&!!s.customerEsignSentAt&&!!s.customerId&&s?j(s):null,o=n&&(/^https:\/\//i.test(n)||/^\/(?!\/)/.test(n))?n:null;return e.jsx(f,{open:i,onClose:r,title:"Review document request",size:"lg",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-ink-700",children:"Electronic signing is not available here. Contact your agency for its approved signing process. Opening this document does not sign, approve, or submit it."}),s?e.jsxs("div",{className:"rounded-md border border-ink-200 p-4 space-y-2",children:[e.jsx("div",{className:"font-medium break-words",children:s.fileName}),e.jsxs("div",{className:"text-sm text-ink-500",children:["Request for ",a]}),o?e.jsxs("a",{className:"btn-outline text-sm inline-flex items-center gap-2",href:o,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(v,{className:"h-3.5 w-3.5"})," Open document"]}):e.jsx("p",{role:"status",className:"text-sm text-ink-600",children:"The requested document file is unavailable here. Ask your agency to provide the actual document."})]}):e.jsx("p",{role:"status",className:"text-sm text-ink-600",children:"Document not found."}),e.jsx("button",{type:"button",className:"btn-outline text-sm",onClick:r,children:"Close"})]})})}function Z(){const i=b(),[,r]=l.useState(0),[s,a]=l.useState(null);if(l.useEffect(()=>N(()=>r(t=>t+1)),[]),!i)return null;const m=y.documents.listByEntity({customerId:i.id}).filter(t=>t.visibility==="customer_visible"),n=m.filter(t=>t.customerEsignRequired&&t.customerEsignSentAt&&!t.customerEsignSignedAt),o=m.filter(t=>t.customerEsignRequired&&!!t.customerEsignSignedAt);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-3xl",children:"Documents"}),e.jsx("p",{className:"text-ink-500 text-sm mt-1",children:"All files attached to your portfolio."})]}),n.length>0&&e.jsxs(c,{children:[e.jsx(d,{title:n.length===1?"1 document request":`${n.length} document requests`,subtitle:"Review the available document. Contact your agency for its approved signing process."}),e.jsx("ul",{className:"divide-y divide-ink-100",children:n.map(t=>e.jsx(k,{document:t,onOpen:()=>a(t)},t.id))})]}),e.jsx(E,{open:!!s,onClose:()=>a(null),document:s,customerName:i.name}),e.jsxs(c,{children:[e.jsx(d,{title:"Your documents"}),e.jsx(h,{documents:m})]}),o.length>0&&e.jsxs(c,{children:[e.jsx(d,{title:"Existing acknowledgement records",subtitle:"These stored timestamps do not verify a completed legal signature. Contact your agency to confirm the signing record."}),e.jsx("ul",{className:"divide-y divide-ink-100",children:o.sort((t,x)=>(t.customerEsignSignedAt??"")<(x.customerEsignSignedAt??"")?1:-1).map(t=>e.jsxs("li",{className:"py-2 flex items-center justify-between gap-3 text-sm",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:t.fileName}),e.jsxs("div",{className:"text-[11px] text-ink-500 mt-0.5",children:["Recorded ",u.dateTime(t.customerEsignSignedAt)]})]}),e.jsxs(g,{children:[e.jsx(p,{className:"h-3 w-3"})," Existing record"]})]},t.id))})]})]})}function k({document:i,onOpen:r}){return e.jsxs("li",{className:"py-3 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium truncate",children:i.fileName}),e.jsx("div",{className:"text-[11px] text-ink-500 mt-0.5",children:i.customerEsignSentAt?`Sent ${u.dateTime(i.customerEsignSentAt)}`:"Queued for signature"})]}),e.jsxs("button",{type:"button",className:"btn-primary text-sm",onClick:r,title:"Review the document request",children:[e.jsx(p,{className:"h-3.5 w-3.5"}),"Review request"]})]})}export{Z as CustomerDocumentsPage};
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.