PageSourceSearch

https://mysendbit.com/assets/EvidenceRequestDetailsPage-26s4re8B.js

js mysendbit.com collected 2026-10-02 00:53:52 UTC 31,899 bytes, 1 lines download raw bytes

1import{r as x,j as e,q as we,h as Se}from"./vendor-react-Dw7X3JZT.js";import{a as xe,C as E,o as R,r as A,p as C,L as b,M as J,I,B as y,S as Ee,x as Ce,y as $e,z as ke,E as Te,an as ee,Y as Ie,ao as Re,ap as Ae}from"./index-BEZ7mpN6.js";import{C as Z}from"./checkbox-B5VwnM8L.js";import{ap as Q,a9 as de,bm as he,v as se,bn as Le,i as me,ac as Ue,bk as De,u as Fe,an as Oe,bl as ze,E as Pe,bo as Me,aC as Be}from"./vendor-ui-ODtAki8E.js";import{S as Ve}from"./safe-external-link-CEs-L7G1.js";import{e as qe,c as We,a as Xe,b as Ye,f as B}from"./evidence-utils-BOdi06X0.js";import"./vendor-utils-WadUx6vN.js";import"./vendor-CZR7Gm73.js";import"./vendor-framer-motion-CpxrKHsN.js";const He=["pdf","jpg","jpeg","png","webp","doc","docx","txt","csv","json","log"],Ke=10*1024*1024,Ge=50*1024*1024,H=10,ue=(i,l,m)=>{const a={},p=Math.max(l,i.length);m.forEach((u,_)=>{const N=u.name.split(".").pop()?.toLowerCase()||"";He.includes(N)?u.size>Ke&&(a[_]=`${u.name} exceeds the 10 MB limit.`):a[_]=`${u.name} is not an allowed file type.`});let f;return p+m.length>H&&(f=`A maximum of ${H} files is allowed, including existing attachments.`),i.reduce((u,_)=>u+_.size_bytes,0)+m.reduce((u,_)=>u+_.size,0)>Ge&&(f="Existing and newly selected files cannot exceed 50 MB combined."),{filesError:f||Object.values(a)[0],itemErrors:a}},pe=i=>{const l=i.split(".");return l.length===4&&l.every(m=>/^(0|[1-9]\d{0,2})$/.test(m)&&Number(m)<=255)},Je=i=>{if(!i||/[^0-9a-fA-F:.]/.test(i)||i.split("::").length>2)return!1;let l=i,m=0;if(l.includes(".")){const g=l.lastIndexOf(":");if(g<0||!pe(l.slice(g+1)))return!1;l=`${l.slice(0,g)}:v4`,m=2}const a=l.includes("::"),[p="",f=""]=l.split("::"),L=p?p.split(":"):[],u=a&&f?f.split(":"):[],_=[...L,...u];if(!_.every(g=>g==="v4"||/^[0-9a-fA-F]{1,4}$/.test(g)))return!1;const N=_.filter(g=>g!=="v4").length+m;return a?N<8:N===8},Ze=i=>pe(i)||Je(i),Qe=i=>(i.requires_response??["requested","more_information_required"].includes(i.status))&&["requested","more_information_required"].includes(i.status),te=5,ae=25,ge=()=>({occurred_at:"",event_type:"accessed",description:"",ip_address:"",customer_identifier:"",resource:"",source:""}),fe=i=>{if(!i)return"";const l=new Date(i);return Number.isNaN(l.getTime())?"":new Date(l.getTime()-l.getTimezoneOffset()*6e4).toISOString().slice(0,16)},es=i=>i.map(l=>({...l,occurred_at:fe(l.occurred_at)})),ss=(i,l)=>{const m={description:l.description||"",supportingUrls:l.supporting_urls||[],activityEntries:l.category==="access_activity_log"?l.activity_log_entries.length?es(l.activity_log_entries):[ge()]:[]};try{const a=localStorage.getItem(i);if(!a)return m;const p=JSON.parse(a);return{description:typeof p.description=="string"?p.description:m.description,supportingUrls:Array.isArray(p.supportingUrls)?p.supportingUrls.slice(0,te):m.supportingUrls,activityEntries:l.category==="access_activity_log"&&Array.isArray(p.activityEntries)?p.activityEntries.slice(0,ae):m.activityEntries}}catch{return m}},ts=({request:i,onCancel:l,onConflict:m,onSuccess:a})=>{const{addToast:p}=xe(),f=`sendbit_evidence_draft:${i.reference}`,L=ss(f,i),[u,_]=x.useState(L.description),[N,g]=x.useState(L.supportingUrls),[j,P]=x.useState(L.activityEntries),[F,O]=x.useState([]),[M,d]=x.useState(!1),[U,je]=x.use
1State(!1),[h,V]=x.useState({name:"",phone:"",email:"",source:"",contact_permission:!1}),[ve,w]=x.useState({}),[D,ie]=x.useState(!1),[X,q]=x.useState(!1),[Y,re]=x.useState(!1),[ce,ne]=x.useState(0),W=x.useRef(null),K=x.useRef(!1);x.useEffect(()=>{const s={description:u,supportingUrls:N,activityEntries:j};localStorage.setItem(f,JSON.stringify(s))},[j,u,f,N]);const c=s=>ve[s],$=s=>w(t=>{if(!t[s])return t;const r={...t};return delete r[s],r}),z=(s,t,r)=>{P(n=>n.map((o,S)=>S===s?{...o,[t]:r}:o)),$(`activity_log_entries.${s}.${t}`)},_e=s=>{const t=Array.from(s.target.files||[]),r=[...F,...t],n=ue(i.files,i.file_count,r),o=Object.fromEntries(Object.entries(n.itemErrors).map(([S,k])=>[`files.${S}`,k]));if(n.filesError&&(o.files=n.filesError),Object.keys(o).length){w(S=>({...S,...o})),W.current&&(W.current.value="");return}w(S=>Object.fromEntries(Object.entries(S).filter(([k])=>k!=="files"&&!k.startsWith("files.")))),O(r),W.current&&(W.current.value="")},Ne=()=>{const s={},t=i.server_time?new Date(i.server_time).getTime():Number.NaN,r=Number.isNaN(t)?Date.now():t,n=u.trim();(n.length<20||n.length>5e3)&&(s.description="Description must be between 20 and 5,000 characters.");const o=N.map(v=>v.trim()).filter(Boolean);o.length>te&&(s.supporting_urls="A maximum of five supporting URLs is allowed."),new Set(o).size!==o.length&&(s.supporting_urls="Supporting URLs must be distinct."),o.forEach((v,T)=>{(!Ie(v)||v.length>2048)&&(s[`supporting_urls.${T}`]="Enter a valid HTTPS URL without embedded credentials.")}),M||(s.merchant_declaration="You must accept the merchant declaration."),i.category==="access_activity_log"&&((!j.length||j.length>ae)&&(s.activity_log_entries="Provide between one and 25 activity entries."),j.forEach((v,T)=>{const oe=new Date(v.occurred_at);(!v.occurred_at||Number.isNaN(oe.getTime())||oe.getTime()>r)&&(s[`activity_log_entries.${T}.occurred_at`]="Activity time is required and cannot be in the future."),v.event_type||(s[`activity_log_entries.${T}.event_type`]="Select an activity type."),(v.description.trim().length<10||v.description.trim().length>500)&&(s[`activity_log_entries.${T}.description`]="Description must be between 10 and 500 characters."),Ze(v.ip_address.trim())||(s[`activity_log_entries.${T}.ip_address`]="Enter a valid IPv4 or IPv6 address."),v.resource.trim()||(s[`activity_log_entries.${T}.resource`]="Resource is required."),v.source.trim()||(s[`activity_log_entries.${T}.source`]="Source is required.")}));const k=Math.max(i.file_count,i.files.length),G=ue(i.files,i.file_count,F);return G.filesError&&(s.files=G.filesError),Object.entries(G.itemErrors).forEach(([v,T])=>{s[`files.${v}`]=T}),!k&&!F.length&&!o.length&&i.category!=="access_activity_log"&&(s.evidence="Provide at least one supporting file or URL."),U&&(h.name.trim()||(s["customer_contact.name"]="Customer name is required."),h.source.trim()||(s["customer_contact.source"]="Explain how you obtained the customer details."),!h.phone.trim()&&!h.email.trim()&&(s.customer_contact="Provide a phone number or email address."),h.phone&&!/^\+[1-9]\d{7,14}$/.test(h.phone.trim())&&(s["customer_contact.phone"]="Use international E.164 format, for example +13016745851."),h.email&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(h.email.trim())&&(s["customer_contact.email"]="Enter a valid email address."),h.contact_permission||(s["customer_contact.contact_permission"]="Customer contact permission is required.")),w(s),Object.keys(s).length===0},le=async()=>{re(!0);try{const s=await ee.get(i.reference);if(!Qe(s)){localStorage.removeItem(f),O([]),q(!1),p({title:"Submission status confirmed",description:`The evidence request is now ${s.status_label.toLowerCase()}.`}),a(s);return}if(s.category!==i.category){q(!1),m();return}q(!1),w(t=>({...t,form:"The submission was not recorded. You can safely try again."}))}catch{q(!0),w(s=>({...s,form:"We could not confirm whether the upload was recorded. Check its status before trying again."}))}finally{re(!1)}},ye=async s=>{if(s.preventDefault(),K.current||D||X||!Ne())return;K.current=!0,ie(!0),ne(0);const t=N.map(r=>r.trim()).filter(Boolean);g(t);try{const r=await ee.submit(i.reference,{category:i.category,description:u.trim(),merchant_declaration:M,supporting_urls:t,files:F,...U?{customer_contact:{name:h.name.trim(),phone:h.phone.trim()||void 0,email:h.email.trim()||void 0,source:h.source.trim(),contact_permission:h.contact_permission}}:{},...i.category==="access_activity_log"?{activity_log_entries:j.map(n=>({...n,occurred_at:new Date(n.occurred_at).toISOString(),description:n.description.trim(),ip_address:n.ip_address.trim(),customer_identifier:n.customer_identifier?.trim()||null,resource:n.resource.trim(),source:n.source.trim()}))}:{}},n=>{n.total&&ne(Math.round(n.loaded*100/n.total))});localStorage.removeItem(f),O([]),p({title:"Evidence submitted",description:"Your evidence was submitted for compliance review."}),a(r)}catch(r){const n=r.response;if(n?.status===422&&n.data?.errors){const o=Object.fromEntries(Object.entries(n.data.errors).map(([S,k])=>[S,Array.isArray(k)?k.join(" "):String(k)]));w(o),p({title:"Check your evidence",description:n.data.message||"Please correct the highlighted fields.",variant:"destructive"})}else n?.status===409?(w({form:"This request changed while you were responding. The latest request details have been loaded."}),m()):n?.status===404?w({form:"This evidence request no longer exists or is unavailable to this account."}):n?w(o=>({...o,form:"We could not submit your evidence. Your draft is still saved; please try again."})):(q(!0),w(o=>({...o,form:"The connection ended before we could confirm the upload. Checking the request status now…"})),await le())}finally{K.current=!1,ie(!1)}},be=()=>{localStorage.removeItem(f),O([]),l()};return e.jsxs("form",{onSubmit:ye,className:"space-y-5",noValidate:!0,children:[c("form")&&e.jsx("p",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:c("form")}),e.jsxs(E,{children:[e.jsx(R,{children:e.jsx(A,{className:"text-lg",children:"Evidence response"})}),e.jsxs(C,{className:"space-y-5",children:[e.jsxs("div",{className:"rounded-lg bg-gray-50 p-3 text-sm",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Requested category:"})," ",i.category_label]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:"evidence-description",children:["Description ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(J,{id:"evidence-description",value:u,onChange:s=>{_(s.target.value),$("description")},placeholder:"Explain what the evidence shows and how it relates to this transaction.",minLength:20,maxLength:5e3,className:"min-h-36 resize-y","aria-invalid":!!c("description")}),e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:c("description")?"text-red-600":"text-muted-foreground",children:c("description")||"Minimum 20 characters."}),e.jsxs("span",{className:"text-muted-foreground",children:[u.length,"/5,000"]})]})]})]})]}),e.jsxs(E,{children:[e.jsx(R,{children:e.jsx(A,{className:"text-lg",children:"Supporting evidence"})}),e.jsxs(C,{className:"space-y-6",children:[c("evidence")&&e.jsx("p",{className:"rounded-md bg-red-50 p-3 text-sm text-red-700",children:c("evidence")}),i.files.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Existing files"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These files remain attached. Downloads are not available from this screen."}),i.files.map(s=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border bg-gray-50 p-3 text-sm",children:[e.jsx("span",{className:"min-w-0 truncate font-medium",children:s.original_filename}),e.jsxs("span",{className:"ml-3 shrink-0 text-xs text-muted-foreground",children:[(s.size_bytes/1024).toFixed(0)," KB"]}
1)]},s.uuid))]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(b,{htmlFor:"evidence-files",children:"Add files"}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Up to ",H," files total, 10 MB each and 50 MB combined. PDF, images, documents, text, CSV, JSON, and log files."]})]}),e.jsx(I,{ref:W,id:"evidence-files",type:"file",multiple:!0,accept:".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.txt,.csv,.json,.log",onChange:_e,disabled:D||X||Math.max(i.file_count,i.files.length)+F.length>=H}),c("files")&&e.jsx("p",{className:"text-sm text-red-600",children:c("files")}),F.map((s,t)=>e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(s.size/1024).toFixed(0)," KB"]})]}),e.jsx(y,{type:"button",size:"icon",variant:"ghost",onClick:()=>{O(r=>r.filter((n,o)=>o!==t)),w(r=>Object.fromEntries(Object.entries(r).filter(([n])=>n!=="files"&&!n.startsWith("files."))))},"aria-label":`Remove ${s.name}`,children:e.jsx(Q,{className:"h-4 w-4"})})]}),c(`files.${t}`)&&e.jsx("p",{className:"mt-2 text-xs text-red-600",children:c(`files.${t}`)})]},`${s.name}-${s.lastModified}`))]}),e.jsxs("div",{className:"space-y-3 border-t pt-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Supporting URLs"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add up to five distinct HTTP or HTTPS links."})]}),e.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:()=>g(s=>[...s,""]),disabled:N.length>=te||D,children:[e.jsx(de,{className:"mr-1 h-4 w-4"})," Add URL"]})]}),c("supporting_urls")&&e.jsx("p",{className:"text-sm text-red-600",children:c("supporting_urls")}),N.map((s,t)=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{type:"url",value:s,onChange:r=>{g(n=>n.map((o,S)=>S===t?r.target.value:o)),$(`supporting_urls.${t}`)},placeholder:"https://example.com/completed-work",maxLength:2048,"aria-label":`Supporting URL ${t+1}`}),e.jsx(y,{type:"button",size:"icon",variant:"ghost",onClick:()=>g(r=>r.filter((n,o)=>o!==t)),"aria-label":`Remove supporting URL ${t+1}`,children:e.jsx(Q,{className:"h-4 w-4"})})]}),c(`supporting_urls.${t}`)&&e.jsx("p",{className:"text-xs text-red-600",children:c(`supporting_urls.${t}`)})]},t))]})]})]}),i.category==="access_activity_log"&&e.jsxs(E,{children:[e.jsxs(R,{className:"flex flex-row items-center justify-between",children:[e.jsx(A,{className:"text-lg",children:"Access activity log"}),e.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:()=>P(s=>[...s,ge()]),disabled:j.length>=ae||D,children:[e.jsx(de,{className:"mr-1 h-4 w-4"})," Add entry"]})]}),e.jsxs(C,{className:"space-y-4",children:[c("activity_log_entries")&&e.jsx("p",{className:"text-sm text-red-600",children:c("activity_log_entries")}),j.map((s,t)=>e.jsxs("div",{className:"space-y-4 rounded-xl border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"font-semibold text-gray-900",children:["Activity ",t+1]}),j.length>1&&e.jsx(y,{type:"button",variant:"ghost",size:"icon",onClick:()=>P(r=>r.filter((n,o)=>o!==t)),"aria-label":`Remove activity ${t+1}`,children:e.jsx(Q,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:`activity-${t}-time`,children:["Occurred at ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(I,{id:`activity-${t}-time`,type:"datetime-local",value:s.occurred_at,max:fe(i.server_time||new Date().toISOString()),onChange:r=>z(t,"occurred_at",r.target.value)}),c(`activity_log_entries.${t}.occurred_at`)&&e.jsx("p",{className:"text-xs text-red-600",children:c(`activity_log_entries.${t}.occurred_at`)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{children:["Event type ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(Ee,{value:s.event_type,onValueChange:r=>z(t,"event_type",r),children:[e.jsx(Ce,{className:"border",children:e.jsx($e,{})}),e.jsx(ke,{children:["accessed","viewed","downloaded","signed_in","published","delivered","other"].map(r=>e.jsx(Te,{value:r,children:r.replace("_"," ")},r))})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:`activity-${t}-description`,children:["Description ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(J,{id:`activity-${t}-description`,value:s.description,maxLength:500,onChange:r=>z(t,"description",r.target.value)}),c(`activity_log_entries.${t}.description`)&&e.jsx("p",{className:"text-xs text-red-600",children:c(`activity_log_entries.${t}.description`)})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:`activity-${t}-ip`,children:["IP address ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(I,{id:`activity-${t}-ip`,value:s.ip_address,onChange:r=>z(t,"ip_address",r.target.value),placeholder:"203.0.113.42"}),c(`activity_log_entries.${t}.ip_address`)&&e.jsx("p",{className:"text-xs text-red-600",children:c(`activity_log_entries.${t}.ip_address`)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:`activity-${t}-identifier`,children:"Customer identifier (Optional)"}),e.jsx(I,{id:`activity-${t}-identifier`,value:s.customer_identifier||"",onChange:r=>z(t,"customer_identifier",r.target.value),placeholder:"[email protected]"})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:`activity-${t}-resource`,children:["Resource ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(I,{id:`activity-${t}
1-resource`,value:s.resource,onChange:r=>z(t,"resource",r.target.value),placeholder:"/downloads/website.zip"}),c(`activity_log_entries.${t}.resource`)&&e.jsx("p",{className:"text-xs text-red-600",children:c(`activity_log_entries.${t}.resource`)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:`activity-${t}-source`,children:["Source ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(I,{id:`activity-${t}-source`,value:s.source,onChange:r=>z(t,"source",r.target.value),placeholder:"Merchant delivery portal"}),c(`activity_log_entries.${t}.source`)&&e.jsx("p",{className:"text-xs text-red-600",children:c(`activity_log_entries.${t}.source`)})]})]})]},t))]})]}),e.jsxs(E,{children:[e.jsx(R,{children:e.jsxs(A,{className:"flex items-center gap-2 text-lg",children:[e.jsx(he,{className:"h-5 w-5"})," Customer contact (Optional)"]})}),e.jsxs(C,{className:"space-y-5",children:[i.customer_contact&&e.jsxs("div",{className:"rounded-lg bg-gray-50 p-4 text-sm text-gray-700",children:["Existing masked contact: ",[i.customer_contact.name,i.customer_contact.phone,i.customer_contact.email].filter(Boolean).join(" · "),". Enter new details below only to replace it."]}),e.jsxs("label",{className:"flex items-center gap-3 text-sm font-medium",children:[e.jsx(Z,{checked:U,onCheckedChange:s=>{je(s===!0),$("customer_contact")}}),"Supply or replace customer contact details"]}),c("customer_contact")&&e.jsx("p",{className:"text-sm text-red-600",children:c("customer_contact")}),U&&e.jsxs("div",{className:"space-y-4 rounded-xl border p-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:"contact-name",children:["Customer name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(I,{id:"contact-name",value:h.name,onChange:s=>{V(t=>({...t,name:s.target.value})),$("customer_contact.name")}}),c("customer_contact.name")&&e.jsx("p",{className:"text-xs text-red-600",children:c("customer_contact.name")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"contact-phone",children:"Phone (E.164)"}),e.jsx(I,{id:"contact-phone",type:"tel",value:h.phone,onChange:s=>{V(t=>({...t,phone:s.target.value})),$("customer_contact.phone")},placeholder:"+13016745851"}),c("customer_contact.phone")&&e.jsx("p",{className:"text-xs text-red-600",children:c("customer_contact.phone")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"contact-email",children:"Email"}),e.jsx(I,{id:"contact-email",type:"email",value:h.email,onChange:s=>{V(t=>({...t,email:s.target.value})),$("customer_contact.email")}}),c("customer_contact.email")&&e.jsx("p",{className:"text-xs text-red-600",children:c("customer_contact.email")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:"contact-source",children:["How were these details obtained? ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(J,{id:"contact-source",value:h.source,onChange:s=>{V(t=>({...t,source:s.target.value})),$("customer_contact.source")}}),c("customer_contact.source")&&e.jsx("p",{className:"text-xs text-red-600",children:c("customer_contact.source")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-start gap-3 text-sm leading-6",children:[e.jsx(Z,{className:"mt-1",checked:h.contact_permission,onCheckedChange:s=>{V(t=>({...t,contact_permission:s===!0})),$("customer_contact.contact_permission")}}),e.jsx("span",{children:i.customer_contact_permission_declaration})]}),c("customer_contact.contact_permission")&&e.jsx("p",{className:"text-xs text-red-600",children:c("customer_contact.contact_permission")})]})]})]})]}),e.jsx(E,{children:e.jsxs(C,{className:"space-y-4 p-5",children:[e.jsxs("label",{className:"flex items-start gap-3 text-sm leading-6",children:[e.jsx(Z,{className:"mt-1",checked:M,onCheckedChange:s=>{d(s===!0),$("merchant_declaration")}}),e.jsx("span",{children:"I confirm that this evidence is authentic, relates to the identified transaction, and has not been altered to misrepresent the service or its delivery."})]}),c("merchant_declaration")&&e.jsx("p",{className:"text-sm text-red-600",children:c("merchant_declaration")}),D&&e.jsxs("div",{className:"space-y-2","aria-live":"polite",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Uploading evidence"}),e.jsxs("span",{children:[ce,"%"]})]}),e.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-gray-200",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${ce}%`}})})]}),e.jsxs("div",{className:"flex flex-col-reverse gap-3 sm:flex-row sm:justify-end",children:[X&&e.jsxs(y,{type:"button",variant:"outline",onClick:le,disabled:Y,children:[Y?e.jsx(se,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Check submission status"]}),e.jsx(y,{type:"button",variant:"outline",onClick:be,disabled:D||Y,children:"Discard and cancel"}),e.jsxs(y,{type:"submit",disabled:D||X||Y,children:[D?e.jsx(se,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Le,{className:"mr-2 h-4 w-4"}),D?"Submitting...":"Submit evidence"]})]})]})})]})},us=()=>{const{reference:i}=we(),l=Se(),{addToast:m}=xe(),[a,p]=x.useState(null),[f,L]=x.useState(!0),[u,_]=x.useState(null),[N,g]=x.use
1State(!1),j=x.useCallback(async()=>{if(i){L(!0),_(null);try{p(await ee.get(i))}catch(d){const U=d.response;_({status:U?.status,message:U?.status===404?"This evidence request no longer exists or is unavailable to this account.":"We could not load this evidence request. Please try again."})}finally{L(!1)}}},[i]);if(x.useEffect(()=>{j()},[j]),f)return e.jsx("div",{className:"flex min-h-64 items-center justify-center",children:e.jsx(se,{className:"h-8 w-8 animate-spin text-primary","aria-label":"Loading evidence request"})});if(u||!a)return e.jsx(E,{className:"mx-auto max-w-2xl",children:e.jsxs(C,{className:"flex flex-col items-center py-12 text-center",children:[e.jsx(me,{className:"mb-3 h-10 w-10 text-red-600"}),e.jsx("h1",{className:"text-lg font-semibold text-gray-900",children:"Evidence request unavailable"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:u?.message}),e.jsxs("div",{className:"mt-5 flex gap-3",children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>l("/dashboard/evidence-requests"),children:"Back to inbox"}),u?.status!==404&&e.jsx(y,{type:"button",onClick:j,children:"Try again"})]})]})});const P=qe(a,a.server_time),F=We(a)&&["requested","more_information_required"].includes(a.status),O=Re(a.resource_type,a.resource_uuid),M=Ae(a.resource_type);return e.jsxs("div",{className:"container max-w-5xl space-y-6 py-2",children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(y,{type:"button",variant:"ghost",size:"icon",onClick:()=>l("/dashboard/evidence-requests"),"aria-label":"Back to Evidence Requests",children:e.jsx(Ue,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:a.category_label}),e.jsx("span",{className:`rounded-full px-2.5 py-1 text-xs font-medium ${Xe(a.status)}`,children:a.status_label}),P&&e.jsx("span",{className:"rounded-full bg-red-100 px-2.5 py-1 text-xs font-semibold text-red-700",children:"Overdue"})]}),e.jsx("p",{className:"mt-1 break-all text-sm text-muted-foreground",children:a.reference})]})]}),e.jsxs("div",{className:"flex gap-2 pl-12 sm:pl-0",children:[O&&M&&e.jsxs(y,{type:"button",variant:"outline",onClick:()=>l(O),children:[e.jsx(De,{className:"mr-2 h-4 w-4"}),M]}),e.jsxs(y,{type:"button",variant:"outline",onClick:j,children:[e.jsx(Fe,{className:"mr-2 h-4 w-4"}),"Refresh"]}),F&&!N&&e.jsx(y,{type:"button",onClick:()=>g(!0),children:"Submit evidence"})]})]}),P&&e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-red-300 bg-red-50 p-4 text-red-800",children:[e.jsx(me,{className:"mt-0.5 h-5 w-5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"This evidence request is overdue."}),e.jsx("p",{className:"mt-1 text-sm",children:"Submit the requested information as soon as possible."})]})]}),a.rejection_reason&&e.jsxs("div",{className:"rounded-xl border border-red-300 bg-red-50 p-4",children:[e.jsx("h2",{className:"font-semibold text-red-900",children:"Rejection reason"}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-sm text-red-800",children:a.rejection_reason})]}),N?e.jsx(ts,{request:a,onCancel:()=>g(!1),onConflict:()=>{g(!1),j(),m({title:"Request updated",description:"The latest evidence request details are now displayed.",variant:"destructive"})},onSuccess:d=>{p(d),g(!1)}},a.reference):e.jsxs(e.Fragment,{children:[e.jsxs(E,{children:[e.jsx(R,{children:e.jsx(A,{className:"text-lg",children:"Compliance request"})}),e.jsxs(C,{className:"space-y-5",children:[e.jsx("p",{className:"whitespace-pre-wrap leading-7 text-gray-800",children:a.request_message}),e.jsxs("div",{className:"grid gap-4 rounded-xl bg-gray-50 p-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Service"}),e.jsx("p",{className:"mt-1 font-medium",children:Ye(a.service)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Transaction reference"}),e.jsx("p",{className:"mt-1 break-all font-medium",children:a.subject_reference})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Requested"}),e.jsx("p",{className:"mt-1 font-medium",children:B(a.requested_at)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Response deadline"}),e.jsx("p",{className:"mt-1 font-medium",children:B(a.due_at)})]})]})]})]}),(a.description||a.submitted_at||a.declared_at)&&e.jsxs(E,{children:[e.jsx(R,{children:e.jsx(A,{className:"text-lg",children:"Merchant response"})}),e.jsxs(C,{className:"space-y-5",children:[a.description&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Description"}),e.jsx("p",{className:"mt-2 whitespace-pre-wrap leading-7 text-gray-700",children:a.description})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.submitted_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Submitted"}),e.jsx("p",{className:"mt-1 text-sm font-medium",children:B(a.submitted_at)})]}),a.reviewed_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Reviewed"}),e.jsx("p",{className:"mt-1 text-sm font-medium",children:B(a.reviewed_at)})]})]}),a.merchant_declaration&&e.jsxs("div",{className:"flex gap-3 rounded-lg bg-emerald-50 p-3 text-sm text-emerald-800",children:[e.jsx(Oe,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{children:a.merchant_declaration})]})]})]}),a.supporting_urls.length>0&&e.jsxs(E,{children:[e.jsx(R,{children:e.jsxs(A,{className:"flex items-center gap-2 text-lg",children:[e.jsx(ze,{className:"h-5 w-5"})," Supporting URLs"]})}),e.jsx(C,{className:"space-y-2",children:a.supporting_urls.map(d=>e.jsx(Ve,{href:d,className:"block break-all rounded-md border p-3 text-sm text-primary hover:bg-primary/5",children:d},d))})]}),a.files.length>0&&e.jsxs(E,{children:[e.jsx(R,{children:e.jsxs(A,{className:"flex items-center gap-2 text-lg",children:[e.jsx(Pe,{className:"h-5 w-5"})," Attached files"]})}),e.jsxs(C,{className:"space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"File metadata only. Downloads are not currently available."}),a.files.map(d=>e.jsxs("div",{className:"flex flex-col gap-1 rounded-md border p-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:d.original_filename}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d.extension.toUpperCase()," · ",(d.size_bytes/1024).toFixed(0)," KB"]}
1)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Uploaded ",B(d.uploaded_at)]})]},d.uuid))]})]}),a.activity_log_entries.length>0&&e.jsxs(E,{children:[e.jsx(R,{children:e.jsxs(A,{className:"flex items-center gap-2 text-lg",children:[e.jsx(Me,{className:"h-5 w-5"})," Access activity"]})}),e.jsx(C,{className:"space-y-3",children:a.activity_log_entries.map((d,U)=>e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("p",{className:"font-semibold capitalize",children:d.event_type.replace("_"," ")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:B(d.occurred_at)})]}),e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:d.description}),e.jsxs("div",{className:"mt-3 grid gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[e.jsxs("span",{children:["IP: ",d.ip_address]}),e.jsxs("span",{children:["Resource: ",d.resource]}),e.jsxs("span",{children:["Source: ",d.source]}),d.customer_identifier&&e.jsxs("span",{children:["Customer: ",d.customer_identifier]})]})]},`${d.occurred_at}-${U}`))})]}),a.customer_contact&&e.jsxs(E,{children:[e.jsx(R,{children:e.jsxs(A,{className:"flex items-center gap-2 text-lg",children:[e.jsx(he,{className:"h-5 w-5"})," Customer contact"]})}),e.jsxs(C,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Name"}),e.jsx("p",{className:"mt-1 font-medium",children:a.customer_contact.name||"Not provided"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Phone"}),e.jsx("p",{className:"mt-1 font-medium",children:a.customer_contact.phone||"Not provided"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Email"}),e.jsx("p",{className:"mt-1 font-medium",children:a.customer_contact.email||"Not provided"})]})]}),a.customer_contact.source&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Source"}),e.jsx("p",{className:"mt-1 text-sm",children:a.customer_contact.source})]}),a.customer_contact.latest_verification&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-gray-50 p-3 text-sm",children:[e.jsx(Be,{className:"h-4 w-4 text-primary"}),e.jsxs("span",{className:"capitalize",children:["Latest verification: ",a.customer_contact.latest_verification.status.replaceAll("_"," ")," by ",a.customer_contact.latest_verification.channel]})]})]})]})]})]})};export{us 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.