PageSourceSearch

https://start.firstbreaklabs.com/assets/PortalDocuments-Dc4Q_KkD.js

js firstbreaklabs.com collected 2026-10-08 01:58:37 UTC 9,160 bytes, 1 lines download raw bytes

1import{r as o,j as e,d as T,F as R,s as L,aW as I,aS as z,aX as G,w as Q,L as W,t as q}from"./index-BKLWdUpX.js";import{S as F}from"./skeleton-CgqkqNsa.js";import{D as H,a as K,b as M}from"./dialog-DUyDZZcA.js";import{g as X,a as Y}from"./pdfGenerator-D-Z1UW11.js";import{P as O}from"./PortalPage-BNRWwAvq.js";import"./jspdf.es.min-DiAcCFPm.js";const E="legal-documents",Z="h-11 w-full rounded-none border border-white/25 bg-black px-3 text-sm text-white outline-none placeholder:text-white/30 focus:border-white/50 disabled:text-white/40";function N(t){return t?t.file_path?t.file_path:t.signature_data?.template_file_path||null:null}async function U(t){if(!t)return!1;const{data:s,error:i}=await L.storage.from(E).createSignedUrl(t,3600);return i||!s?.signedUrl?!1:(window.open(s.signedUrl,"_blank","noopener,noreferrer"),!0)}function $(t){return t.replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"")||"signed"}function J(t,s){const i=URL.createObjectURL(t),r=window.document.createElement("a");r.href=i,r.download=s,r.rel="noopener",window.document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),2e3)}async function V(t,s){const i=String(s.signer_full_name||s.typed_name),r=s.signed_at.slice(0,10);try{if(t.document_type==="nda")return X({recipient_first_name:String(s.recipient_first_name||i),recipient_email:String(s.recipient_email||""),sent_at:String(s.sent_at||s.signed_at),fbl_signer_name:s.fbl_signer_name,fbl_signer_title:s.fbl_signer_title,fbl_signed_at:s.fbl_signed_at,signer_full_name:i,signer_company:s.signer_company,signer_title:s.signer_title,signature_type:"type",signed_at:s.signed_at}).save(`signed-nda-${$(i)}-${r}.pdf`),!0;if(t.document_type==="publishing_agreement"){const l=N(t);if(!l)return!1;const{data:d,error:c}=await L.storage.from(E).download(l);if(c||!d)return!1;const u=await Y(await d.arrayBuffer(),{recipient_name:String(s.recipient_name||i),recipient_email:String(s.recipient_email||""),signer_full_name:i,signer_company:s.signer_company,signer_title:s.signer_title,signature_type:"type",signed_at:s.signed_at,ip_address:s.ip_address,sent_at:s.sent_at});return J(u,`signed-agreement-${$(i)}-${r}.pdf`),!0}}catch(l){console.error("Portal signed PDF",l)}return!1}function ee(t){switch(t){case"nda":return"Non-Disclosure Agreement";case"publishing_agreement":return"Publishing Agreement";case"amendment":return"Amendment";default:return t?.replaceAll("_"," ")||"Document"}}function te({document:t,open:s,onClose:i,onSigned:r}){const[l,d]=o.useState(!1),[c,u]=o.useState(""),[g,S]=o.useState(!1),[p,m]=o.useState(null),[x,_]=o.useState(!1),[D,w]=o.useState(!1),[k,y]=o.useState(!1),h=()=>{d(!1),u(""),m(null),_(!1),w(!1),i()},f=N(t),v=async()=>{if(!f)return;y(!0);const a=await U(f);y(!1),a||m("No file on this document yet.")},b=async()=>{if(!(!t||!l||!c.trim())){S(!0),m(null);try{let a="unknown";try{a=(await(await fetch("https://api.ipify.org?format=json")).json()).ip}catch{}const A=new Date().toISOString(),C={...t.signature_data??{},typed_name:c.trim(),signer_full_name:c.trim(),signature_type:"type",ip_address:a,user_agent:navigator.userAgent,signed_at:A},{error:P}=await L.from("documents").update({status:"signed",signature_data:C,signed_at:A}).eq("id",t.id);if(P)throw P;const B=await V(t,C);w(B),_(!0),r?.({...t,status:"signed",signature_data:C,signed_at:A}),window.setTimeout(()=>{h()},2e3)}catch(a){console.error("Error signing document:",a),m("Could not sign. Try again.")}finally{S(!1)}}};if(!t)return null;const n=l&&c.trim().length>=2&&t.status==="pending_signature",j=t.status==="signed";return e.jsx(H,{open:s,onOpenChange:a=>!a&&h(),children:e.jsxs(K,{className:"flex max-h-[90vh] max-w-2xl flex-col rounded-none border-white/10 bg-black p-0 text-white",children:[e.jsxs("div",{className:"border-b border-white/10 px-5 py-4",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-white/50",children:ee(t.document_type)}),e.jsx(M,{className:"mt-1 text-lg font-medium tracking-tight",children:t.title})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-5",children:[f?e.jsx("button",{type:"button",onClick:()=>{v()},className:"text-sm text-[#7ac142] hover:text-white",children:k?"Opening":"Open PDF"}):e.jsx("p",{className:"max-w-[38em] text-sm text-white/50",children:"This is a legal agreement between you and First Break Labs. Read it before you type your name."}),j&&t.signature_data?e.jsxs("p",{className:"text-sm text-[#7ac142]",children:["Signed by ",t.signature_data.typed_name," on"," ",new Date(t.signature_data.signed_at).toLocaleStr
1ing()]}):null,t.status==="pending_signature"&&!x?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("label",{className:"flex items-start gap-3 text-sm",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:a=>d(a.target.checked),className:"mt-1 size-4 rounded-none border-white/25 bg-black accent-[#7ac142]"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-white",children:"I have read and agree to the terms"}),e.jsx("span",{className:"mt-1 block text-white/50",children:"You confirm you read the document and agree to be bound by it."})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"signature",className:"block text-sm text-white",children:"Type your full legal name"}),e.jsx("input",{id:"signature",placeholder:"Full name",value:c,onChange:a=>u(a.target.value),className:Z,disabled:!l,autoComplete:"name"})]}),e.jsx("p",{className:"text-sm text-white/50",children:"This electronic signature has the same legal validity as a handwritten one. IP and time are recorded."}),p?e.jsx("p",{className:"text-sm text-[#f26545]",children:p}):null]}):null,x?e.jsx("p",{className:"text-sm text-[#7ac142]",children:D?"Signed. A copy downloaded.":"Signed. A copy is on Documents."}):null]}),e.jsx("div",{className:"flex flex-wrap items-center gap-3 border-t border-white/10 px-5 py-4",children:t.status==="pending_signature"&&!x?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:b,disabled:!n||g,className:`${T} disabled:opacity-50`,children:[e.jsx(R,{}),g?"Signing":"Sign"]}),e.jsx("button",{type:"button",onClick:h,disabled:g,className:"text-sm text-white/50 hover:text-white disabled:opacity-50",children:"Cancel"})]}):e.jsx("button",{type:"button",onClick:h,className:"text-sm text-white/50 hover:text-white",children:"Close"})})]})})}function ne(){const{selected:t}=z(),s=G(),[i,r]=o.useState(null),[l,d]=o.useState(null),[c,u]=o.useState(!1),g=s.data??[],p=(i??g).filter(n=>n.status!=="draft"&&(!n.game_id||n.game_id===t?.id)),m=s.isLoading&&p.length===0,x=p.filter(n=>n.status==="pending_signature"),_=p.filter(n=>n.status!=="pending_signature"),D=n=>{d(n),u(!0)},w=async n=>{await U(N(n))||q.error("No file on this document yet.")},k=n=>{r(j=>(j??g).map(a=>a.id===n.id?{...a,...n}:a))},y=n=>{switch(n){case"pending_signature":return"Sign";case"signed":return"Signed";case"draft":return"Draft";case"expired":return"Expired";default:return n}},h=n=>{switch(n){case"nda":return"Non-Disclosure Agreement";case"publishing_agreement":return"Publishing Agreement";case"amendment":return"Amendment";case"invoice":return"Invoice";case"statement":return"Royalty Statement";default:return n||"Document"}},f=t?Q("kit",t.pipeline_stage):!1,v=t?`/portal/marketing/${t.id}`:"/portal";if(m)return e.jsxs(O,{title:"Documents",lede:`NDA and the agreement for ${t?.title??"this title"}. Sign here.`,children:[e.jsx(F,{className:"h-20 w-full"}),e.jsx(F,{className:"h-20 w-full"})]});const b=[...x,..._];return e.jsxs(O,{title:"Documents",lede:`NDA and the agreement for ${t?.title??"this title"}. Sign here.`,children:[b.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-white/50",children:f?"Nothing to sign on this title yet. The kit is the work until the agreement lands.":"Nothing to sign yet. We’ll put the agreement here when it’s ready."}),f?e.jsxs(W,{to:v,className:`${T} w-fit`,children:[e.jsx(R,{}),"Open kit"]}):null]}):e.jsx("ul",{className:"divide-y divide-white/10 border-y border-white/10",children:b.map(n=>e.jsxs("li",{className:"flex flex-wrap items-baseline justify-between gap-3 py-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-medium",children:n.title}),e.jsxs("p",{className:"mt-0.5 text-xs text-white/50",children:[h(n.document_type),n.game?` · ${n.game.title}`:"",n.status==="signed"&&n.signed_at?` · ${new Date(n.signed_at).toLocaleDateString()}`:` · ${new Date(n.created_at).toLocaleDateString()}`]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-sm",children:[n.status==="pending_signature"?e.jsx("button",{type:"button",onClick:()=>D(n),className:"text-[#7ac142] hover:text-white",children:"Review & sign"}):e.jsx("span",{className:"text-white/50",children:y(n.status)}),N(n)?e.jsx("button",{type:"button",onClick:()=>{w(n)},className:"text-white/50 hover:text-white",children:"Open PDF"}):null]})]},n.id))}),e.jsx(te,{document:l,open:c,onClose:()=>{u(!1),d(null)},onSigned:k})]})}function ge(){return e.jsx(I,{tool:"documents",children:e.jsx(ne,{})})}
1export{ge 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.