PageSourceSearch

https://gigaboost.ai/assets/investor-portal-Cyt5WCsN.js

js gigaboost.ai collected 2026-10-05 12:01:07 UTC 9,967 bytes, 1 lines download raw bytes

1import{a as d,u as C,j as e}from"./vendor-query-DhjOgUDD.js";import{G as U}from"./gigaboost-badge-bkSPGh5m.js";import{T as A,r as h,y as P,af as u,m as B,aa as O,X as _}from"./vendor-icons-443ez2nG.js";import"./index-4ZDWxsof.js";import"./vendor-radix-Bi3hcZEw.js";import"./vendor-router-BMMoSqdB.js";import"./vendor-motion-BL_E91F5.js";const E={pitch_deck:"Pitch Deck",financials:"Financials",cap_table:"Cap Table",legal:"Legal",term_sheet:"Term Sheet",other:"Other"},q=["pitch_deck","financials","cap_table","legal","term_sheet","other"];function F(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function I(s){const i=new Map;for(const m of s){const o=i.get(m.category)||[];o.push(m),i.set(m.category,o)}return i}function z(s){return s==="application/pdf"}function G(s){return s.startsWith("image/")}function W({token:s}){const[i,m]=d.useState(null),[o,x]=d.useState(null),[R,p]=d.useState(!1),[$,g]=d.useState(null),c=d.useRef(null),l=d.useRef(null),f=d.useRef(null),{data:r,isLoading:y,error:T}=C({queryKey:["/api/dataroom",s],queryFn:async()=>{const t=await fetch(`/api/dataroom/${s}`),a=await t.json().catch(()=>({}));if(!t.ok)throw a.founderEmail&&g(a.founderEmail),new Error(a.error||"not_found");const n=a;return n.founderEmail&&g(n.founderEmail),n},retry:!1,staleTime:6e4}),{data:w=[],isLoading:L}=C({queryKey:["/api/dataroom",s,"documents"],queryFn:async()=>{const t=await fetch(`/api/dataroom/${s}/documents`);if(!t.ok)throw new Error("Failed to load documents");return t.json()},enabled:!!r,staleTime:6e4}),S=async(t,a)=>{try{const n=await fetch(`/api/dataroom/${s}/document/${t.id}/view`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({durationSeconds:a??0})});return n.ok?(await n.json()).id??null:null}catch{return null}},j=async(t,a)=>{if(!(a<=0))try{await fetch(`/api/dataroom/doc-view/${t}/duration`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({durationSeconds:Math.round(a),token:s})})}catch{}},D=async t=>{if(f.current&&c.current&&l.current){const a=(Date.now()-c.current)/1e3;a>2&&await j(l.current,a)}m(t),x(null),p(!0),f.current=t,c.current=Date.now(),l.current=null,S(t).then(a=>{l.current=a});try{const a=await fetch(`/api/dataroom/${s}/document/${t.id}`);if(!a.ok)throw new Error("Failed to fetch document");const n=await a.blob(),N=URL.createObjectURL(n);x(N)}catch{x(null)}finally{p(!1)}},b=async()=>{if(o&&URL.revokeObjectURL(o),c.current&&l.current){const t=(Date.now()-c.current)/1e3;t>2&&j(l.current,t)}c.current=null,l.current=null,f.current=null,m(null),x(null)};if(d.useEffect(()=>{const t=()=>{if(c.current&&l.current){const a=(Date.now()-c.current)/1e3;if(a>2){const n=new Blob([JSON.stringify({durationSeconds:Math.round(a),token:s})],{type:"application/json"});navigator.sendBeacon(`/api/dataroom/doc-view/${l.current}/duration`,n)}}};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[]),T||!y&&!r){const t=$||(r?.founderEmail??null);return e.jsx("div",{className:"min-h-screen bg-[#F8FAFC] flex items-center justify-center px-4",children:e.jsxs("div",{className:"max-w-md w-full text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-amber-100 flex items-center justify-center mx-auto mb-4",children:e.jsx(A,{className:"h-7 w-7 text-amber-600"})}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900 mb-2","data-testid":"text-portal-error",children:"This data room link is no longer active."}),e.jsx("p",{className:"text-sm text-gray-500","data-testid":"text-portal-error-detail",children:t?e.jsxs(e.Fragment,{children:["Contact"," ",e.jsx("a",{href:`mailto:${t}`,className:"text-primary hover:underline",children:t})," ","for access."]}):"Contact the founder for access."})]})})}if(y)return e.jsx("div",{className:"min-h-screen bg-[#F8FAFC] flex items-center justify-center",children:e.jsx(h,{className:"h-7 w-7 animate-spin text-muted-foreground"})});const v=I(w),k=q.filter(t=>v.has(t));return e.jsxs("div",{className:"min-h-screen bg-[#F8FAFC] font-sans","data-testid":"page-investor-portal",children:[e.jsx("div",{className:"w-full bg-amber-50 border-b border-amber-200 px-4 py-2 text-center","data-testid":"banner-confidentiality",children:e.jsx("p",{className:"text-xs text-amber-800",children:"Confidential — this data room is shared for investment evaluation purposes only. Do not distribute."})}),e.jsx("header",{className:"border-b border-gray-200 bg-white shadow-sm",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-5 flex items-center gap-4",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-gray-100 flex items-center justify-center overflow-hidden",children:r.foun
1derAvatarUrl?e.jsx("img",{src:r.founderAvatarUrl,alt:r.companyName||r.founderName||"Company",className:"w-full h-full object-cover","data-testid":"img-company-logo"}):e.jsx(P,{className:"h-5 w-5 text-gray-500"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900","data-testid":"text-company-name",children:r.companyName||r.founderName||"Investor Data Room"}),r.companyName&&r.founderName&&e.jsx("p",{className:"text-xs text-gray-500",children:r.founderName})]})]})}),e.jsxs("main",{className:"max-w-4xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-semibold text-gray-900 mb-1","data-testid":"text-portal-greeting",children:r.investorName?`Hello, ${r.investorName.split(" ")[0]}`:"Investor Data Room"}),e.jsxs("p",{className:"text-sm text-gray-500",children:[r.companyName?`${r.companyName}'s`:"The"," data room is available below.",r.allowedCategories.length>0?` You have access to: ${r.allowedCategories.map(t=>E[t]||t).join(", ")}.`:" You have access to all documents."]})]}),L?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(h,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):w.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx(u,{className:"h-10 w-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-500","data-testid":"text-no-documents",children:"No documents available yet."})]}):e.jsx("div",{className:"space-y-8",children:k.map(t=>{const a=v.get(t);return e.jsxs("section",{"data-testid":`section-category-${t}`,children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 uppercase tracking-wide mb-3",children:E[t]||t}),e.jsx("div",{className:"bg-white border border-gray-200 rounded-xl overflow-hidden shadow-sm divide-y divide-gray-100",children:a.map(n=>e.jsxs("button",{type:"button",className:"w-full flex items-center gap-4 px-5 py-4 text-left hover:bg-gray-50 transition-colors",onClick:()=>D(n),"data-testid":`button-document-${n.id}`,children:[e.jsx(u,{className:"h-5 w-5 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 truncate","data-testid":`text-doc-name-${n.id}`,children:n.name}),n.description&&e.jsx("p",{className:"text-xs text-gray-500 truncate",children:n.description})]}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:F(n.fileSize)}),e.jsx(B,{className:"h-4 w-4 text-muted-foreground shrink-0"})]},n.id))})]},t)})}),r.calendlyUrl&&e.jsxs("div",{className:"mt-10 pt-8 border-t border-gray-200 text-center",children:[e.jsx("p",{className:"text-sm text-gray-500 mb-3",children:"Interested in learning more?"}),e.jsxs("a",{href:r.calendlyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 rounded-lg bg-primary hover:bg-primary/90 text-white text-sm font-semibold px-6 py-3 transition-colors","data-testid":"button-request-meeting",children:[e.jsx(O,{className:"h-4 w-4"}),"Request a meeting"]})]})]}),e.jsx("footer",{className:"max-w-4xl mx-auto px-6 py-6 border-t border-gray-100 flex justify-center",children:e.jsx(U,{variant:"data-room"})}),i&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:t=>{t.target===t.currentTarget&&b()},"data-testid":"modal-preview",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl flex flex-col w-full max-w-4xl mx-4",style:{maxHeight:"90vh"},children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-200",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(u,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-gray-800 truncate","data-testid":"text-preview-filename",children:i.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1 whitespace-nowrap",children:F(i.fileSize)})]}),e.jsx("button",{type:"button",onClick:b,className:"p-1.5 rounded-lg hover:bg-gray-100 transition-colors ml-2 shrink-0","data-testid":"button-close-preview",children:e.jsx(_,{className:"h-4 w-4 text-gray-600"})})]}),e.jsx("div",{className:"flex-1 overflow-auto min-h-0 flex items-center justify-center bg-gray-50 rounded-b-xl",children:R?e.jsx(h,{className:"h-8 w-8 animate-spin text-muted-foreground"}
1):o?z(i.fileType)?e.jsx("iframe",{src:r.allowDownload?o:`${o}#toolbar=0&navpanes=0&scrollbar=0`,className:"w-full rounded-b-xl",style:{height:"75vh",border:"none"},title:i.name,"data-testid":"iframe-preview"}):G(i.fileType)?e.jsx("img",{src:o,alt:i.name,className:"max-w-full max-h-[75vh] object-contain p-4","data-testid":"img-preview"}):e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx(u,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Preview not supported for this file type."})]}):e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx(u,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Unable to preview this file."})]})})]})})]})}export{W 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.