PageSourceSearch

https://meetborderless.com/build/assets/build-reference-letter-s0wXX-CW.js

js meetborderless.com collected 2026-10-09 22:43:05 UTC 17,105 bytes, 1 lines download raw bytes

1import{j as e}from"./app-C1iegf7Q.js";import{b as o,L as Ae,f as A}from"./inertia-BpyZy4w-.js";import{S as Re}from"./seo-meta-BiuXzdeE.js";import{E as $e}from"./evidence-builder-DOSzY-as.js";import{A as Te}from"./app-layout-N5SYko6V.js";import{RefereeAnglePicker as J}from"./RefereeAnglePicker-eErWaEc5.js";import{RefereeIntake as Ee}from"./RefereeIntake-hpSReVty.js";import{X as _e}from"./x-DQSeRCcH.js";import{L as K}from"./loader-circle-C_KBZAGS.js";import{A as Oe}from"./arrow-left-DCX0fhKH.js";import{U as Fe}from"./upload-C1CGckSw.js";import{C as De}from"./clipboard-list-O4HZX3KF.js";/* empty css            */import"./document-canvas-DXwi1o4d.js";import"./sheet-DNayBxlr.js";import"./index-BewtL6Hn.js";import"./index-Dc_FVRD7.js";import"./index-CGXdj8xB.js";import"./index-C_n-C52S.js";import"./index-CL12STDK.js";import"./index-XydtsrKA.js";import"./index-BDqbV96p.js";import"./index-Cja0wFUH.js";import"./Combination-Cr5kvm8y.js";import"./index-B1PKR-s8.js";import"./utils-BiuKVCuu.js";import"./download-CXbkSkxk.js";import"./createLucideIcon-wqc1LSWg.js";import"./message-square-E9C1K8Gx.js";import"./history-29VTm3ac.js";import"./paperclip-Cc7CaGPI.js";import"./check-0O-UND6N.js";import"./circle-alert-D8tEThd5.js";import"./chevron-down-B1YaU0K5.js";import"./document-builder-5UH2XUUr.js";import"./trash-2-CrI9a2Po.js";import"./sparkles-C0aC1RHI.js";import"./image-plus-Drz-1lbN.js";import"./plus-BJl-aJiX.js";import"./triangle-alert-C7AVwNi-.js";import"./index-DJlprK4q.js";import"./index-DV0GpYST.js";import"./index-B9qJRYKv.js";import"./link-DKPEjeqT.js";import"./list-BgP0xxm1.js";import"./pen-line-DxMOfwPU.js";import"./markdown-renderer-CJUAlNY6.js";import"./video-embed-XSCcqTy1.js";import"./index-DnOwzyLg.js";import"./refresh-cw-Cog2DILh.js";import"./ellipsis-dh0qVsjB.js";import"./arrow-right-CQhEyoMD.js";import"./template-specimen-Dl-ug0G8.js";import"./info-D2ZN_yLm.js";import"./link-2-D0ZKUr8N.js";import"./image-vCg-0Xge.js";import"./button-BE4q1_FS.js";import"./unit-badge-B1FxxFNU.js";import"./dialog-DrkalYDs.js";import"./stamp-DioeSsh-.js";import"./file-text-XcQuIA-l.js";import"./zap-Bczke022.js";import"./gauge-DL0bVHaV.js";import"./eye-DoZffUO5.js";import"./message-square-plus-DhS9yu8k.js";import"./case-shell-EPUgGCr1.js";import"./mobile-chrome-C0ug21w9.js";import"./shield-alert-CGX6PHoz.js";import"./menu-BR3Nc3Gr.js";import"./message-circle-c43k_fjC.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./circle-x-Bp6Mbpgt.js";import"./circle-check-BMWvzPMx.js";import"./site-announcement-fVSM8f3a.js";import"./use-funnel-tracking-DZvQDmiU.js";import"./journey-labels-D75PCX0v.js";import"./bell-BvDZckLh.js";import"./guest-nav-Dk8jWUwY.js";function p(){return document.querySelector('meta[name="csrf-token"]')?.content??""}function lr({case:s,document_id:h=null,can_write:W=!0,asks:q=[],can_resolve_asks:M=!1,review_notes:V=null,editing:G=null,headings_are_labels:H=!1,review_state:Q=null,base_version:R=null,referee:u,referees:d=[],angle_options:y,taken_angles:$,guide:Y,specimen:Z,specimen_url:ee,min_items:te,initial_items:re,initial_briefing:ne,versions:ie,working_draft:se,editor_variant:oe}){const[i,T]=o.useState(u.id),[E,w]=o.useState(!1),[_,O]=o.useState(!1),[ae,le]=o.useState(u.id!=null),[g,N]=o.useState(u.name??""),[b,de]=o.useState(u.affiliation??""),[m,S]=o.useState(u.relationship??""),[j,ce]=o.useState(u.focus_angle??""),[l,F]=o.use
1State(ne);o.useEffect(()=>{if(!_||d.length===0)return;const t=d[d.length-1];T(t.id),N(t.name??""),S(t.relationship??""),O(!1)},[_,d]);function D(t){ce(t),i!=null&&A.patch(`/cases/${s.uuid}/referees/${i}/angle`,{focus_angle:t},{preserveScroll:!0,preserveState:!0})}const[k,L]=o.useState(!1),[B,me]=o.useState(""),[C,f]=o.useState(!1);o.useEffect(()=>{if(!C)return;const t=n=>{n.key==="Escape"&&f(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[C]);async function pe(){if(!k){L(!0);try{const t=await fetch(`/cases/${s.uuid}/draft-reference-briefing`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":p()},body:JSON.stringify({referee_name:g,referee_role:b,referee_relationship:m,focus:B})}),n=await t.json().catch(()=>({}));F(t.ok&&n.briefing?n.briefing:n.message??"Could not draft a briefing just now.")}catch{F("Could not draft a briefing just now.")}finally{L(!1)}}}async function ue({title:t,summary:n,context:a}){const r=await fetch(`/cases/${s.uuid}/draft-reference-letter-point`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":p()},body:JSON.stringify({referee:i,referee_name:g,referee_role:b,referee_relationship:m,title:t,summary:n,context:a})}),c=await r.json().catch(()=>({}));return r.ok&&typeof c.narrative=="string"?c.narrative:null}async function fe(t){const n=new FormData;n.append("document",t);const a=await fetch(`/cases/${s.uuid}/import-evidence`,{method:"POST",headers:{Accept:"application/json","X-CSRF-TOKEN":p()},body:n}),r=await a.json().catch(()=>({}));return a.ok&&Array.isArray(r.items)?{items:r.items,images:[]}:null}async function xe(t,n,a){const r=new FormData;i!=null&&r.append("referee",String(i)),h!==null&&r.append("document_id",String(h)),r.append("context",n),R!==null&&r.append("base_version",String(R)),r.append("version_key",a.key),r.append("version_source",a.source),a.restoredFrom&&r.append("restored_from_key",a.restoredFrom),r.append("referee_name",g),r.append("referee_role",b),r.append("referee_relationship",m),r.append("focus_angle",j),l&&r.append("briefing",l),r.append("items",JSON.stringify(t.map(X=>({title:X.title,narrative:X.narrative}))));const c=await fetch(`/cases/${s.uuid}/build-reference-letter`,{method:"POST",headers:{Accept:"application/json","X-CSRF-TOKEN":p()},body:r}),x=await c.json().catch(()=>({}));if(!c.ok||!x.redirect)return x.message??"Something went wrong. Please try again.";A.visit(x.redirect)}async function he(t,n,a){const r=await fetch(`/cases/${s.uuid}/review-document-draft`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":p()},body:JSON.stringify({document_type:"reference_letter",version_key:a,context:`Referee: ${b}. Relationship: ${m}. ${n}`,sections:t.map(x=>({heading:x.title,text:x.narrative}))})}),c=await r.json().catch(()=>({}));if(!r.ok)throw new Error(c.message??"Could not review this draft just now.");return c}async function ge(t){if(!(await fetch(`/cases/${s.uuid}/document-editor-working-draft`,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":p()},body:JSON.stringify({document_type:"reference_letter",context_key:i==null?null:String(i),version_key:t.key,source:t.source,restored_from_key:t.restoredFrom,items:t.items,editor_context:t.context})})).ok)throw new Error("Autosave failed")}async function be(){if(!(await fetch(`/cases/${s.uuid}/document-editor-working-draft`,{method:"DELETE",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":p()},body:JSON.stringify({document_type:"reference_letter",context_key:i==null?null:String(i)})})).ok)throw new Error("Discard failed")}const v=g.trim(),ye=v?`Reference letter from ${v}`:"Reference letter",je=v?`We draft this in ${v}'s voice, point by point${m.trim()?` (${m.trim()})`:""}. Add what the letter should say, then save a version to hand over for signing.`:"Add each point the letter should make. We draft it in your referee's voice, then save a draft you can hand to them to sign.",ke=d.find(t=>
1t.id===i)?.has_signed??!1,I=o.useRef(null),[P,U]=o.useState(!1);function ve(t){i!==null&&(U(!0),A.post(`/cases/${s.uuid}/referees/${i}/letter`,{letter:t},{forceFormData:!0,preserveScroll:!0,onFinish:()=>U(!1)}))}const we=i===null?null:e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:I,type:"file",accept:".pdf,.doc,.docx",className:"hidden",onChange:t=>{const n=t.target.files?.[0];n&&ve(n),t.target.value=""}}),e.jsxs("button",{type:"button",onClick:()=>I.current?.click(),disabled:P,className:"inline-flex shrink-0 items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-2 text-xs font-medium text-ink hover:bg-bg-2 disabled:opacity-50",children:[P?e.jsx(K,{size:14,className:"animate-spin"}):e.jsx(Fe,{size:14}),e.jsx("span",{className:"hidden sm:inline",children:ke?"Replace the signed copy":"Upload the signed copy"}),e.jsx("span",{className:"sm:hidden",children:"Signed copy"})]})]}),Ne=i===null||!ae,z=e.jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[d.map(t=>{const n=i===t.id;return e.jsxs("button",{type:"button",onClick:()=>{T(t.id),N(t.name??""),S(t.relationship??""),w(!1)},className:`rounded-full border px-3 py-1.5 text-xs font-medium ${n?"border-ink bg-ink text-white":"border-line bg-surface text-ink hover:border-ink"}`,children:[t.name||"Unnamed referee",t.has_letter&&e.jsx("span",{className:`ml-1.5 ${n?"text-white/60":"text-ink-3"}`,children:"· has a letter"})]},t.id)}),e.jsx("button",{type:"button",onClick:()=>w(t=>!t),className:"rounded-full border border-dashed border-line-strong bg-surface px-3 py-1.5 text-xs font-medium text-ink-2 hover:border-ink hover:text-ink",children:E?"Cancel":"+ Add a referee"})]}),(E||d.length===0)&&e.jsx(Ee,{caseUuid:s.uuid,reloadOnly:["referees"],onAdded:()=>{w(!1),O(!0)}})]}),Se=C?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/45 p-4",onMouseDown:t=>{t.target===t.currentTarget&&f(!1)},children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"referee-details-title",className:"max-h-[90vh] w-full max-w-3xl overflow-y-auto rounded-card border border-line bg-surface p-5 shadow-xl",children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"referee-details-title",className:"text-base font-semibold text-ink",children:"Referee details and briefing"}),e.jsx("p",{className:"mt-1 text-xs text-ink-3",children:"These details guide the letter and the optional note you can send your referee."})]}),e.jsx("button",{type:"button",onClick:()=>f(!1),"aria-label":"Close",className:"rounded-md p-1.5 text-ink-3 hover:bg-bg-2 hover:text-ink",children:e.jsx(_e,{size:18})})]}),e.jsx("p",{className:"mb-3 text-2xs font-semibold tracking-eyebrow text-ink-3 uppercase",children:"Who is writing this letter"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("span",{className:"mb-1.5 block text-xs font-medium text-ink-2",children:"Which referee is this for?"}),z]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-medium text-ink-2",children:"Their name"}),e.jsx("input",{value:g,onChange:t=>N(t.target.value),placeholder:"Dr Sarah Adeolu",className:"w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink placeholder:text-ink-3 focus:ring-1 focus:ring-ink/20 focus:outline-none"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-medium text-ink-2",children:"Their role and organisation"}),e.jsx("input",{value:b,onChange:t=>de(t.target.value),placeholder:"VP Engineering, Stripe",className:"w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink placeholder:text-ink-3 focus:ring-1 focus:ring-ink/20 focus:outline-none"})]})]}),e.jsxs("label",{className:"mt-3 block",children:[e.jsx("span",{className:"mb-1 block text-xs font-medium text-ink-2",children:"How they know the applicant"}),e.jsx("input",{value:m,onChange:t=>S(t.target.value),placeholder:"Managed the applicant on the payments team, 2019 to 2022",className:"w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink placeholder:text-ink-3 focus:ring-1 focus:ring-ink/20 focus:outline-none"})]}),y.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(J,{options:y,value:j,takenAngles:$,onChange:D})}),e.jsxs("div",{className:"mt-4 border-t border-line pt-3",children:[e.jsx("p",{className:"text-xs font-medium text-ink-2",children:"Briefing for your referee"}),e.jsx("p",{className:"mt-0.5 text-xs text-ink-3",children:"A short note you can send them. It explains what the endorsing body expects, so they know what to write. Optional."}),e.jsx("textarea",{value:B,onChange:t=>me(t.target.value),rows:2,placeholder:"Anything you'd like them to speak to? (optional) e.g. my work leading the payments rewrite",className:"mt-2 w-full resize-y rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink placeholder:text-ink-3 focus:ring-1 focus:ring-ink/20 focus:outline-none"}),e.jsxs("button",{type:"button",onClick:pe,disabled:k,className:"mt-2 inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-1.5 text-xs font-medium text-ink hover:bg-bg-2 disabled:opacity-60",children:[k&&e.jsx(K,{size:13,className:"animate-spin"}),k?"Writing the briefing...":l?"Regenerate briefing":"Generate a briefing to send them"]}),l&&e.jsxs("div",{className:"mt-2 rounded-md border border-line bg-bg p-3",children:[e.jsx("p",{className:"text-xs leading-relaxed whitespace-pre-line text-ink-2",children:l}),e.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(l)},className:"mt-2 rounded-md border border-line bg-surface px-2.5 py-1 text-xs font-medium text-ink hover:bg-bg-2",children:"Copy briefing"})]})]}),e.jsx("div",{className:"mt-4 flex justify-end border-t border-line pt-4",children:e.jsx("button",{type:"button",onClick:()=>f(!1),className:"rounded-md bg-ink px-4 py-2 text-xs font-semibold text-white hover:opacity-90",children:"Done"})})]})}):null,Ce=e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>f(!0),className:"inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-2 text-xs font-medium text-ink hover:bg-bg-2",children:[e.jsx(De,{size:14}),l?"View referee briefing":"Referee details & briefing"]}),l&&e.jsxs("div",{className:"basis-full rounded-md border border-line bg-bg p-3",children:[e.jsx("p",{className:"mb-1 text-2xs font-semibold tracking-eyebrow text-ink-3 uppercase",children:"Briefing for your referee"}),e.jsx("p",{className:"line-clamp-3 text-xs leading-relaxed whitespace-pre-line text-ink-2",children:l}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(l)},className:"text-xs font-medium text-teal hover:underline",children:"Copy briefing"}),e.jsx("button",{type:"button",onClick:()=>f(!0),className:"text-xs font-medium text-teal hover:underline",children:"Edit details"})]})]})]});return e.jsxs(Te,{children:[e.jsx(Re,{title:"Reference letter",description:"A reference letter on your case.",url:`/cases/${s.uuid}/build-reference-letter`}),e.jsx("div",{className:"mx-auto max-w-3xl px-4 pt-6",children:e.jsxs(Ae,{href:`/cases/${s.uuid}
1?tab=documents&focus=reference_letters`,className:"inline-flex items-center gap-1.5 text-xs font-medium text-ink-2 hover:text-ink",children:[e.jsx(Oe,{size:14}),"Back to your case"]})}),Ne?e.jsxs("div",{className:"mx-auto mt-6 max-w-3xl px-4",children:[e.jsx("p",{className:"text-2xs font-semibold tracking-eyebrow text-ink-3 uppercase",children:"Build your document"}),e.jsx("h1",{className:"mt-1 font-serif text-3xl leading-tight font-normal tracking-display text-ink",children:"Reference letter"}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-ink-2",children:"A reference letter is written by somebody who knows your work. Tell us who, and we draft it in their voice, point by point, for them to sign."}),e.jsxs("div",{className:"mt-6 rounded-card border border-line bg-surface p-5",children:[e.jsx("h2",{className:"text-base font-semibold text-ink",children:"Who is writing this letter?"}),e.jsx("div",{className:"mt-3",children:z}),i!==null&&y.length>0&&e.jsxs("div",{className:"mt-5 border-t border-line pt-4",children:[e.jsx(J,{options:y,value:j,takenAngles:$,onChange:D}),e.jsx("button",{type:"button",onClick:()=>le(!0),className:"mt-4 rounded-md bg-ink px-4 py-2 text-sm font-medium text-white hover:opacity-90",children:j?"Start the letter":"Skip and start the letter"})]})]})]}):e.jsx($e,{title:ye,subtitle:je,intro:Y,specimen:Z,specimenUrl:ee,proofs:[],proofsEnabled:!1,headingsAsLabels:H,initialItems:re,quickStartSlot:Ce,itemNoun:"point",minItems:te,metered:null,createLabel:"Save",creatingLabel:"Saving version...",contextPlaceholder:"e.g. the referee also chaired the committee that gave the applicant an award.",onDraftItem:ue,onCreate:xe,onImport:fe,onReview:he,reviewSuggestionBase:`/cases/${s.uuid}/document-draft-suggestions`,versions:ie,versionBase:`/cases/${s.uuid}/document-editor-versions`,workingDraft:se,onAutosave:ge,onDiscardDraft:be,downloadUrl:h!==null?`/cases/${s.uuid}/documents/${h}/download`:i!=null?`/cases/${s.uuid}/referees/${i}/example-letter.docx`:null,extraActions:we,caseUuid:s.uuid,documentId:h,canWrite:W,asks:q,canResolveAsks:M,reviewNotes:V,editing:G,reviewState:Q,editorVariant:oe}),Se]})}export{lr 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.