PageSourceSearch

https://portal.commoninterest.com/assets/requests.upload-Bu8j1A7b.js

js commoninterest.com collected 2026-09-24 13:28:11 UTC 7,271 bytes, 1 lines download raw bytes

1import{r,j as e,M as B,B as i,q as v,F as y,d0 as D,d1 as Q,E as G,bP as H}from"./elements-DVh2jUIM.js";import{x as W,A as Y,aZ as I,W as j,L as $}from"./index-DeQvL4I7.js";import{u as Z}from"./useLogo-b3_H3dYq.js";import"./grids-DXrfAsUA.js";import"./startOfDay-AazlW55I.js";const xe={showPropertySelector:!1,showAi:!1,full:!0,hideSidebar:!0},V="Upload ARC Documents",_="image/*",X="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/*",J=25*1024*1024,K="Total file size exceeds 25 MB limit.",ee="Open camera",se="Browse photos",te="Browse files",ae=u=>u===1?"1 file selected":`${u} files selected`,re="Continue to request",ne="Retry",le="Rescan QR from desktop",oe="Retry login",ie="You can now return to the ARC Form to complete your submission",ce="Uploading selected files...";function he(){const u=Z(),N=W(),[F]=Y(),c=F.get("session"),w=r.useRef(null),R=r.useRef(null),E=r.useRef(null),[m,C]=r.useState([]),[f,A]=r.useState(!1),[S,p]=r.useState(null),[o,n]=r.useState("validating"),[k,q]=r.useState(!1),T=I(s=>s.setFlagOverrides),O=I(s=>s.clearFlagOverrides),x=r.useCallback(async()=>{var s;if(!c){n("missing");return}n("validating"),p(null);try{await j.getArcRequestDraft(c),n("ready")}catch(a){const t=(s=a==null?void 0:a.response)==null?void 0:s.status;n(t===401||t===403?"unauthorized":t===404?"expired":"invalid")}},[c]);r.useEffect(()=>(T(["redesign-v3","redesign-v3-phase-2"]),()=>O()),[T,O]),r.useEffect(()=>{x()},[x]);const M=async s=>{var a;if(!c||o!=="ready"||s.length===0)return!1;p(null),A(!0);try{const l=((await j.listArcRequestDraftAttachments(c)).attachments??[]).reduce((g,b)=>g+(b.fileSize??0),0),L=s.reduce((g,b)=>g+b.size,0);return l+L>J?(p(K),!1):(await j.uploadArcRequestDraftAttachments(c,{files:H(s)}),!0)}catch(t){const l=(a=t==null?void 0:t.response)==null?void 0:a.status;return l===401||l===403?n("unauthorized"):l===404?n("expired"):l===void 0?n("invalid"):p("Upload failed. Please try again."),!1}finally{A(!1)}},h=(s,a)=>{const t=s.target.files;t!=null&&t.length&&(C([...m,...Array.from(t)]),s.target.value="")},z=s=>{C(a=>a.filter((t,l)=>l!==s))},P=async()=>{await M(m)&&(window.close(),window.setTimeout(()=>{window.closed||q(!0)},150))},U=()=>o==="missing"?e.jsxs("div",{"data-feature":"v3-requests-upload-session-missing",className:"mb-4 rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-900",children:[e.jsx("p",{className:"font-medium",children:"Missing upload session."}),e.jsx("p",{className:"mt-1",children:"This page must be opened from the QR code in the desktop ARC form."}),e.jsx(i,{type:"button",variant:"primaryOutline",size:"sm",className:"mt-3",onClick:()=>N("/community/new-request"),children:le})]}):o==="expired"||o==="invalid"?e.jsxs("div",{"data-feature":"v3-requests-upload-session-invalid",className:"mb-4 rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-900",children:[e.jsx("p",{className:"font-medium",children:"This upload session is no longer available."}),e.jsx("p",{className:"mt-1",children:"Please rescan the QR code from the desktop ARC request form to start a new mobile upload session."}),e.jsx(i,{type:"button",variant:"primaryOutline",size:"sm",className:"mt-3",onClick:x,children:ne})]}):o==="unauthorized"?e.jsxs("div",{"data-feature":"v3-requests-upload-session-unauthorized",className:"mb-4 rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-900",children:[e.jsx("p",{className:"font-medium",children:"You are not authorized for this draft upload session."}),e.jsx("p",{className:"mt-1",children:"Please sign in again and rescan the desktop QR code."}),e.jsx(i,{type:"button",variant:"primaryOutline",size:"sm",className:"mt-3",onClick:()=>N("/login"),children:oe})]}):null,d=o==="ready"&&!f;return e.jsxs("div",{"data-feature":"v3-requests-upload-page",className:"flex flex-col min-h-screen w-full max-w-md mx-auto px-4 py-6 sm:py-10",children:[e.jsx(B,{open:k,onClose:()=>{},"data-feature":"v3-requests-upload-return-message-modal",title:"",hideCloseButton:!0,textAlign:"left",children:e.jsx("p",{className:"text-base text-base-header",children:ie})}),U(),e.jsxs("div",{className:"-mt-10 flex flex-1 flex-col justify-center gap-3",children:[e.jsx("input",{ref:w,type:"file",accept:_,capture:"environment",className:"sr-only","aria-hidden":!0,disabled:!d,onChange:s=>h(s)}),e.jsx("input",{ref:R,type:"file",accept:_,multiple:!0,className:"sr-only","aria-hidden":!0,disabled:!d,onChange:s=>h(s)}),e.jsx("input",{ref:E,type:"file",accept:X,multiple:!0,className:"sr-only","aria-hidden":!0,disabled:!d,onChange:s=>h(s)}),u&&e.jsx("div",{className:"mb-3 flex justify-center",children:e.jsx($,{to:"/dashboard",children:e.jsx("img",{src:u,alt:"logo",className:"h-16 w-auto"})})}),e.jsx("h1",{className:"text-xl font-semibold text-base-header text-center mb-5",children:V}),e.jsx("p",{className:"text-sm text-base-header/70 text-center mb-2",children:"Max 25 MB total attachments."}),o==="validating"&&e.jsx("p",{className:"text-sm text-base-header/70 text-center mb-2",children:"Validating upload session..."}),e.jsx(i,{"data-feature":"v3-requests-upload-open-camera",type:"button",variant:"primary",size:"lg",startIcon:e.jsx(y,{icon:D,className:"text-xl"}),className:v("w-full !justify-center gap-3 h-14 sm:h-16 rounded-xl text-base font-semibold","[&>.grow]:grow-0 shadow-sm border-0"),disabled:!d,onClick:()=>{var s;return(s=w.current)==null?void 0:s.click()},children:ee}),e.jsx(i,{"data-feature":"v3-requests-upload-browse-photos",type:"button",variant:"primaryOutline",size:"lg",startIcon:e.jsx(y,{icon:Q,className:"text-xl"}),className:v("w-full !justify-center [&>.grow]:grow-0 gap-3 h-14 sm:h-16 rounded-xl text-base font-semibold"),disabled:!d,onClick:()=>{var s;return(s=R.current)==null?void 0:s.click()},children:se}),e.jsx(i,{"data-feature":"v3-requests-upload-browse-files",type:"button",variant:"primaryOutline",size:"lg",startIcon:e.jsx(y,{icon:G,className:"text-xl"}),className:v("w-full !justify-center [&>.grow]:grow-0 gap-3 h-14 sm:h-16 rounded-xl text-base font-semibold"),disabled:!d,onClick:()=>{var s;return(s=E.current)==null?void 0:s.click()},children:te}),S&&e.jsx("p",{className:"text-sm text-red-700 text-center",children:S})]}),m.length>0&&e.jsxs("div",{"data-feature":"v3-requests-upload-selected-files-panel",className:"mt-8 pt-6 border-t border-primary bg-primary/5 rounded-lg p-4 flex flex-col gap-3",children:[e.jsx("p",{className:"text-sm font-medium text-base-header",children:ae(m.length)}),e.jsx("ul",{className:"flex flex-col gap-1 max-h-32 overflow-y-auto",children:m.map((s,a)=>e.jsxs("li",{className:"flex items-center justify-between gap-2 text-sm text-base-header/90 truncate",children:[e.jsx("span",{className:"truncate min-w-0",children:s.name}),e.jsx("button",{type:"button",onClick:()=>z(a),className:"shrink-0 text-base-header/60 hover:text-base-header underline",children:"Remove"})]},`${s.name}-${a}`))}),f&&e.jsx("p",{className:"text-sm text-base-header/70 text-center",children:ce}),e.jsx(i,{"data-feature":"v3-requests-upload-continue",type:"button",variant:"primary",size:"md",className:"mt-2 w-full !justify-center [&>.grow]:grow-0 rounded-xl",disabled:f,onClick:()=>void P(),children:re})]})]})}export{he as Component,xe as handle};

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.