PageSourceSearch

https://meetborderless.com/build/assets/show-DG3G4nhO.js

js meetborderless.com collected 2026-10-09 22:42:39 UTC 14,413 bytes, 1 lines download raw bytes

1import{j as e}from"./app-C1iegf7Q.js";import{h as I,b as p,H as R,f as w,L as A}from"./inertia-BpyZy4w-.js";import{C as U}from"./contact-email-dialog-ByGdXKGI.js";import{a as D}from"./admin-layout-BhXWbUlP.js";import{j as L}from"./journey-labels-D75PCX0v.js";import{a as b}from"./utils-BiuKVCuu.js";import{A as F}from"./arrow-left-DCX0fhKH.js";import{S as T}from"./shield-E3smhAzV.js";import{U as J}from"./users-BCcupCXV.js";import{M as B}from"./mail-Dwbp3545.js";import{L as O}from"./log-in-Dg2nNREu.js";import{T as M}from"./triangle-alert-C7AVwNi-.js";import{E as H}from"./external-link-avvfS30C.js";/* empty css            */import"./button-BE4q1_FS.js";import"./index-CGXdj8xB.js";import"./dialog-DrkalYDs.js";import"./index-BewtL6Hn.js";import"./index-Dc_FVRD7.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"./x-DQSeRCcH.js";import"./createLucideIcon-wqc1LSWg.js";import"./input-DJt0nBB3.js";import"./label-Czc25Mye.js";import"./index-DdRFMukF.js";import"./textarea-CXLxrYIG.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./info-D2ZN_yLm.js";import"./circle-x-Bp6Mbpgt.js";import"./circle-check-BMWvzPMx.js";import"./menu-BR3Nc3Gr.js";import"./folder-open-I72SPUVk.js";import"./pound-sterling-D16GLaAZ.js";import"./book-open-DVFlG_9t.js";function d(s){return s?s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," "):"—"}function N(s){return s?new Date(s).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function m(s){return s?new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):"—"}function V(s){return s==null||s===""?"—":Array.isArray(s)?s.join(", "):typeof s=="object"?JSON.stringify(s):String(s)}function G(s){return["signed_off","submitted"].includes(s)?"bg-green/10 text-green-ink":["opened","discovery"].includes(s)?"border border-line bg-white text-ink-2":"bg-bg-2 text-ink-3"}const h="inline-flex items-center gap-1 rounded-tag px-2 py-0.5 text-2xs font-bold";function De(){const{props:s}=I(),{user:t,profile:l,billing:r,contact:o,cases:x,attention:c,plan_options:f}=s,[k,g]=p.useState(null),C=()=>{confirm(`Log in as ${t.name} (${t.email})?`)&&w.post(`/admin/users/${t.id}/impersonate`)},v=o!==null&&!t.suppressed&&!t.email_unsubscribed,j=Object.entries(o?.metadata??{});return e.jsxs(D,{children:[e.jsx(R,{title:`${t.name} · Admin`}),e.jsxs("div",{className:"flex flex-col gap-6 px-4 py-5 sm:px-6 sm:py-7",children:[e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>w.visit("/admin/users"),className:"mb-2 inline-flex items-center gap-1 text-xs font-medium text-ink-3 hover:text-ink",children:[e.jsx(F,{className:"h-3.5 w-3.5"})," Back to users"]}),e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-ink",children:t.name}),e.jsx("p",{className:"mt-0.5 text-sm text-ink-3",children:t.email}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[e.jsxs("span",{className:b(h,"border border-line bg-white text-ink-2"),children:["Joined ",m(t.created_at)]}),t.is_admin&&e.jsxs("span",{className:b(h,"bg-red/10 text-red"),children:[e.jsx(T,{className:"h-3 w-3"}),"Admin"]}),t.is_provider&&e.jsxs("span",{className:b(h,t.provider_approved?"bg-green/10 text-green-ink":"border border-line bg-white text-ink-2"),children:[e.jsx(J,{className:"h-3 w-3"}),t.provider_approved?"Provider":"Provider (pending)"]}),(t.suppressed||t.email_unsubscribed)&&e.jsx("span",{className:b(h,"bg-red/10 text-red"),children:"Unsubscribed / suppressed"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>o&&g({contactId:o.id,label:t.name}),disabled:!v,title:v?`Email ${t.name}`:"No contact record, or address is suppressed",className:"inline-flex items-center gap-1.5 rounded-lg border border-line bg-white px-4 py-2 text-sm font-medium text-ink-2 hover:bg-bg-2 disabled:cursor-not-allowed disabled:opacity-40",children:[e.jsx(B,{className:"h-4 w-4"}),"Email"]}),e.jsxs("button",{type:"button",onClick:C,disabled:t.is_admin,className:"inline-flex items-center gap-1.5 rounded-lg bg-ink px-4 py-2 text-sm font-medium text-white hover:bg-ink/90 disabled:cursor-not-allowed disabled:opacity-40",children:[e.jsx(O,{className:"h-4 w-4"}),"Impersonate"]})]})]})]}),c.length>0&&e.jsxs("div",{className:"rounded-card border border-amber/30 bg-amber/12 p-5",children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 text-base font-semibold text-ink",children:[e.jsx(M,{className:"h-4 w-4 text-amber-ink"}),"Needs attention"]}),e.jsx("div",{className:"flex flex-col gap-2",children:c.map((a,u)=>e.jsxs(A,{href:`/admin/cases/${a.case_uuid}`,className:"flex items-start justify-between gap-3 rounded-md border border-line bg-white p-3 hover:bg-bg-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-ink",children:a.label}),e.jsx("span",{className:b(h,"border border-line bg-white text-ink-2"),children:L(a.journey_type)})]}),e.jsx("p",{className:"text-sm text-ink-3",children:a.detail})]}),e.jsx("span",{className:"shrink-0 text-xs text-ink-3",children:a.since?`since ${m(a.since)}`:""})]},`${a.case_uuid}-${a.code}-${u}`))})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-card border border-line bg-white p-5 lg:col-span-2",children:[e.jsx("h2",{className:"mb-4 text-base font-semibold text-ink",children:"Cases"}),x.length===0?e.jsx("p",{className:"text-sm text-ink-3",children:"No cases opened yet."}):e.jsx("div",{className:"flex flex-col gap-3",children:x.map(a=>e.jsxs(A,{href:`/admin/cases/${a.uuid}`,className:"flex flex-wrap items-center justify-between gap-3 rounded-md border border-line p-3 hover:bg-bg-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:b(h,"border border-line bg-white text-ink-2"),children:L(a.journey_type)}),e.jsx("span",{className:b(h,"capitalize",G(a.status)),children:d(a.status)}),e.jsx("span",{className:"text-xs text-ink-3",children:a.lead==="specialist_led"?"Specialist led":"Agent led"})]}),e.jsxs("span",{className:"text-xs text-ink-3",children:["Opened ",m(a.opened_at)," · Last activity"," ",a.last_activity_at?m(a.last_activity_at):"—",a.target_submission_at&&` · Target ${m(a.target_submission_at)}`]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-ink-3",children:["Readiness"," ",e.jsxs("span",{className:"font-medium text-ink",children:[a.readiness_score??0,"%"]})]}),e.jsx("span",{className:"text-ink-3",children:a.specialist?a.specialist.name:"Unassigned"}),e.jsx(H,{className:"h-3.5 w-3.5 text-ink-3"})]})]},a.uuid))})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-4 text-base font-semibold text-ink",children:"Billing"}),e.jsxs("div",{className:"flex flex-col gap-3 text-sm",children:[e.jsx(i,{label:"Tier",value:d(r.subscription_tier)}),e.jsx(i,{label:"Status",value:r.subscription_status??"—"}),e.jsx(i,{label:"Interval",value:r.subscription_interval??"—"}),e.jsx(i,{label:"Renews / ends",value:m(r.current_period_end)}),r.trial_ends_at&&e.jsx(i,{label:"Trial ends",value:m(r.trial_ends_at)}),r.lifetime_member_at&&e.jsx(i,{label:"Lifetime member since",value:m(r.lifetime_member_at)}),r.plans.length>0&&e.jsxs("div",{className:"mt-1 flex flex-col gap-2 border-t border-line-2 pt-3",children:[e.jsx("span",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Active journey plans"}),r.plans.map((a,u)=>e.jsx(W,{plan:a},`${a.journey}-${a.plan}-${u}`))]})]})]}),e.jsx(z,{userId:t.id,planOptions:f}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-4 text-base font-semibold text-ink",children:"Immigration profile"}),e.jsxs("div",{className:"flex flex-col gap-3 text-sm",children:[e.jsx(i,{label:"Pathway",value:d(l.pathway)}),e.jsx(i,{label:"Visa type",value:d(l.visa_type)}),e.jsx(i,{label:"Visa status",value:d(l.visa_status)}),e.jsx(i,{label:"Employment",value:d(l.employment_status)}),e.jsx(i,{label:"Field",value:l.profession_field??"—"}),e.jsx(i,{label:"Country",value:l.country??"—"}),e.jsx(i,{label:"Why they're here",value:d(l.onboarding_intent)}),l.onboarding_reasons.length>0&&e.jsx(i,{label:"Reasons",value:l.onboarding_reasons.map(d).join(", ")})]})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-4 text-base font-semibold text-ink",children:"How they arrived"}),e.jsx("div",{className:"flex flex-col gap-3 text-sm",children:o?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"First source",value:d(o.source)}),e.jsx(i,{label:"Most recent source",value:d(o.last_source)}),e.jsx(i,{label:"First seen",value:N(o.first_seen_at)}),e.jsx(i,{label:"Last seen",value:N(o.last_seen_at)}),j.length>0&&e.jsxs("div",{className:"mt-1 flex flex-col gap-2 border-t border-line-2 pt-3",children:[e.jsx("span",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Captured data"}),j.map(([a,u])=>e.jsx(i,{label:d(a),value:V(u)},a))]})]}):e.jsx("p",{className:"text-ink-3",children:"No capture record linked to this account."})})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-4 text-base font-semibold text-ink",children:"Engagement"}),e.jsxs("div",{className:"flex flex-col gap-3 text-sm",children:[e.jsx(i,{label:"Onboarding completed",value:N(t.onboarding_completed_at)}),e.jsx(i,{label:"Last active",value:N(t.last_activity_at)}),e.jsx(i,{label:"Last email sent",value:N(t.last_email_at)}),e.jsx(i,{label:"Email status",value:t.email_unsubscribed||t.suppressed?"Unsubscribed / suppressed":"Subscribed"})]})]})]})]}),e.jsx(U,{target:k,onClose:()=>g(null)})]})}function i({label:s,value:t}){return e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"shrink-0 text-ink-3",children:s}),e.jsx("span",{className:"break-words text-right font-medium text-ink",children:t})]})}function W({plan:s}){const[t,l]=p.useState(!1),[r,o]=p.useState(""),x=()=>{w.post(s.revoke_url,{reason:r},{onSuccess:()=>l(!1)})};return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-ink",children:[L(s.journey),": ",s.label]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1 text-right",children:[e.jsxs("span",{className:"text-xs text-ink-3",children:[s.kind==="subscription"?"Subscription":"One-off",s.renews_at&&` · ${m(s.renews_at)}`]}),s.revoke_url&&!t&&e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-xs text-red hover:underline",children:"Revoke"})]})]}),t&&e.jsxs("div",{className:"space-y-2 rounded-md border border-red/30 bg-red/10 p-2",children:[e.jsx("input",{type:"text",value:r,onChange:c=>o(c.target.value),placeholder:"Reason for revoking",className:"w-full rounded-md border border-line bg-bg px-2 py-1 text-xs text-ink placeholder:text-ink-3 focus:border-line-strong focus:outline-none"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",disabled:!r.trim(),onClick:x,className:"rounded-md bg-red px-2 py-1 text-xs font-medium text-white disabled:opacity-50",children:"Confirm revoke"}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"rounded-md px-2 py-1 text-xs text-ink-3 hover:text-ink",children:"Cancel"})]})]})]})}function z({userId:s,planOptions:t}){const[l,r]=p.useState(""),[o,x]=p.useState(""),[c,f]=p.useState(""),[k,g]=p.useState(""),[C,v]=p.useState(!1),j=t.find(n=>n.key===l),a=j?.plans.find(n=>n.key===o),u=n=>{r(n),x(""),f("")},E=n=>{x(n);const $=t.find(S=>S.key===l)?.plans.find(S=>S.key===n);$&&f(String(Math.round($.price_gbp*100)))},P=()=>
1{v(!0),w.post(`/admin/users/${s}/activate-plan`,{journey:l,plan:o,amount_pence:parseInt(c,10),notes:k||void 0},{onFinish:()=>v(!1),onSuccess:()=>{r(""),x(""),f(""),g("")}})},y="w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink focus:border-line-strong focus:outline-none",_="mb-1 block text-2xs font-bold uppercase tracking-eyebrow text-ink-3";return e.jsxs("div",{className:"rounded-card border border-line bg-white p-5",children:[e.jsx("h2",{className:"mb-4 text-base font-semibold text-ink",children:"Grant plan (offline)"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx("p",{className:"text-xs text-ink-3",children:"Use when the user paid by bank transfer or invoice. Works without an open case."}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:_,children:"Journey"}),e.jsxs("select",{value:l,onChange:n=>u(n.target.value),className:y,children:[e.jsx("option",{value:"",children:"Select journey…"}),t.map(n=>e.jsx("option",{value:n.key,children:n.label},n.key))]})]}),j&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:_,children:"Plan"}),e.jsxs("select",{value:o,onChange:n=>E(n.target.value),className:y,children:[e.jsx("option",{value:"",children:"Select plan…"}),j.plans.map(n=>e.jsxs("option",{value:n.key,children:[n.label," — £",n.price_gbp.toLocaleString()," (",n.cadence,")"]},n.key))]})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:_,children:"Amount received (pence)"}),e.jsx("input",{type:"number",min:"0",value:c,onChange:n=>f(n.target.value),placeholder:"e.g. 49900 for £499",className:y}),c&&e.jsxs("p",{className:"mt-1 text-xs text-ink-3",children:["= £",(parseInt(c,10)/100).toFixed(2)]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:_,children:"Notes (optional)"}),e.jsx("textarea",{value:k,onChange:n=>g(n.target.value),placeholder:"e.g. Bank transfer ref BL-2026-001",rows:2,className:y})]}),e.jsx("button",{type:"button",disabled:!o||!c||C,onClick:P,className:"rounded-md bg-ink px-4 py-2 text-sm font-medium text-white disabled:opacity-50",children:"Activate offline"})]})]})]})}export{De 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.