PageSourceSearch

https://jacobscounsellaw.com/assets/TeamInbox-B1RHtjsA.js

js jacobscounsellaw.com collected 2026-10-07 18:00:49 UTC 33,639 bytes, 13 lines download raw bytes

1import{c as Ge,b7 as Pe,j as e,G as bt,B as C,L as Nt,a0 as yt,r as c,s as Xe,bI as _t,R as Je,w as Ae,by as Ct,bz as St,bJ as It,bK as At,bL as Tt,M as Rt,I as et}from"./index-BUFlkRC7.js";import{I as Dt,L as Ut,A as qt}from"./AdminLayout-883ClVgJ.js";import{S as pe,a as fe,b as ge,c as ke,d as X}from"./select-B52twkjJ.js";import{g as Lt,E as Ot,F as Pt,T as Ue,U as ve,L as Mt,M as Wt,i as zt,I as Te,V as Ft,X as Q,Y as Qe,O as Bt,Z as Ke,_ as Et,$ as $t,a0 as qe,a1 as we,P as Vt,r as Ht}from"./ContactBriefPanel-DFmdU_Kq.js";import{m as Re,d as Qt}from"./adminSimplify-DFde-1o9.js";import{r as Kt}from"./pagedRead-CAE7D9j7.js";import{a as Yt,u as Zt}from"./useReturnRefresh-CkkluhFv.js";import{c as De,u as Gt,w as Xt,b as Ye,S as Jt,d as es,C as ts,a as ss}from"./ClickUpWorkArea-Bsi1UQWj.js";import{B as Le}from"./badge-CAIFOsOS.js";import{C as as}from"./clock-C0haG-f7.js";import{T as Ze}from"./textarea-CdS5tb8h.js";import{L as he}from"./label-BXiRAz9u.js";import{S as te}from"./separator-DZL9iGc4.js";import{T as ns}from"./triangle-alert-D4rCaf19.js";import"./users-DVe_nbBA.js";import"./book-open-8Wl76_MS.js";import"./index-DTKUpxpY.js";import"./check-DbR4qkvr.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const rs=Ge("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const is=Ge("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);function ls({children:t,title:r}){const{isAdmin:s,signOut:i}=Pe();return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(bt,{children:e.jsx("meta",{name:"robots",content:"noindex, nofollow"})}),e.jsx("header",{className:"sticky top-0 z-40 border-b border-border/60 bg-background/95 backdrop-blur-sm supports-[backdrop-filter]:bg-background/80",children:e.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(Dt,{className:"h-4 w-4 shrink-0 text-primary",strokeWidth:1.5}),e.jsx("h1",{className:"truncate text-sm font-semibold text-foreground",children:r})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s&&e.jsx(C,{asChild:!0,variant:"ghost",size:"sm",className:"h-7 text-xs",children:e.jsx(Nt,{to:"/admin/overview",children:"Back to admin"})}),e.jsxs(C,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>void i(),children:[e.jsx(Ut,{className:"mr-1 h-3.5 w-3.5",strokeWidth:1.5}),"Sign out"]})]})]})}),e.jsx("main",{className:"p-4",children:t})]})}function os({children:t,title:r}){const{user:s,isAdmin:i,loading:x}=Pe(),l=yt(),[g,u]=c.useState("checking");return c.useEffect(()=>{if(x)return;if(!s){l("/auth");return}if(i){u("allowed");return}let v=!1;return Xe.functions.invoke("team-queue-action",{body:{action:"whoami"}}).then(({data:p,error:b})=>{if(v)return;const N=!!(!b&&p&&(p.is_admin||p.can_work||p.can_manage));u(N?"allowed":"denied")}).catch(()=>{v||u("denied")}),()=>{v=!0}},[s,i,x,l]),c.useEffect(()=>{g==="denied"&&l("/auth")},[g,l]),x||!i&&g==="checking"?e.jsx(_t,{}):!s||g!=="allowed"?null:i?e.jsx(qt,{title:r,children:t}):e.jsx(ls,{title:r,children:t})}function cs(t,r){const s=je(Ot(t).text).prose.split(/\r?\n/).map(l=>l.trim());let i;for(const l of[/(?:^|\s)matter_summary:\s*(.+)/i,/(?:^|\s)details:\s*(.+)/i,/(?:^|\s)notes:\s*(.+)/i,/(?:^|\s)legal[-_](?:issue|question):\s*(.+)/i])if(i=s.map(g=>{var u,v;return(v=(u=g.match(l))==null?void 0:u[1])==null?void 0:v.split(/\s+(?=(?:other_parties|practice_area|booking_uid|game_type|matter_type|states|timeline|prior-attorney|cal event):)/i)[0].trim()}).find(Boolean),i)break;if(i)return i.length>180?`${i.slice(0,180)}…`:i;const x=s.filter(l=>l&&!/^---\s*\[/.test(l)&&!/^cal\.com booking for/i.test(l)&&!/^(?:game_type|matter_type|states|topic|prior-attorney|cal event):/i.test(l)&&!/^(booking (status|type|date|time):|https?:\/\/)/i.test(l)&&!/^(duration:|timezone:|video:|downloaded:|source:|event:)/i.test(l)&&!/^(lead_magnet|booking_qualifier|source:|practice_area:|urgency:|event_type:)/i.test(l)&&!/^(?:[\w -]+:\s*){2,}/.test(l)&&!/^(?:deadline|jurisdiction|company|matter type):/i.test(l)&&!/^(?:https?:\/\/|meet\.google\.|zoom\.us)/i.test(l)&&!/^\d{4}-\d\d-\d\dT\d\d:\d\d/.test(l)).join(" ");return x?x.length>180?`${x.slice(0,180)}…`:x:r}function je(t){const r=[],s=[];for(const i of t.split(/\r?\n/))Pt(i).generated||/^\s*(?:Cal\.com booking for .*\(backfilled\)|Scheduled:\s*\d{4}
11-\d\d-\d\dT\S+|Booking (?:UID|URL|ID):\s*\S+|Meeting (?:URL|link):\s*https?:\/\/\S+|attribution_token:\s*\S+|booking_qualifier:\s*\S+|lead_magnet:\s*\S+)\s*$/i.test(i)||/^\s*---\s*\[\d{4}-[^\]]+\]\s*$/.test(i)?s.push(i):r.push(i);return{prose:r.join(`
12`).trim(),technical:s.join(`
13`).trim()}}const us=t=>/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(t.trim());async function ds(t,r=Xe){if(!t.length)return{status:"ok",links:{}};const s={};for(let i=0;i<t.length;i+=100){const x=t.slice(i,i+100),l=await Kt((g,u)=>r.from("leads").select("id,clickup_task_id,merged_into_lead_id",{count:"exact"}).in("id",x).order("id").range(g,u),{cap:2e4});if(!l.ok)return{status:"unavailable",links:{}};if(l.partial)return{status:"partial",links:{}};for(const g of l.rows){if(g.merged_into_lead_id)return{status:"partial",links:{}};if(g.clickup_task_id&&!us(g.clickup_task_id))return{status:"partial",links:{}};s[g.id]=Lt(g.clickup_task_id)}if(l.total!==x.length)return{status:"partial",links:{}}}return{status:"ok",links:s}}const Oe={new:"New",in_progress:"In progress",waiting:"Waiting",attorney_review:"Attorney review",closed:"Closed"};function tt(t){switch(t){case"new":return"default";case"in_progress":return"secondary";case"attorney_review":return"destructive";default:return"outline"}}function se(t){if(!t)return"—";const r=new Date(t);return Number.isNaN(r.getTime())?"—":`${r.toLocaleDateString("en-US",{month:"short",day:"numeric"})} ${r.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})}`}function be(t){if(!t)return"—";const r=new Date(t);return Number.isNaN(r.getTime())?"—":r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function ms(){const t=new Date;return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function xs(t,r){if(r)return"View work in ClickUp";switch(t.team_queue_status){case"waiting":return"Check follow-up status";case"attorney_review":return"Attorney review";case"closed":return"Closed";default:return"Review request"}}function hs(){var $e;const{isAdmin:t}=Pe(),[r,s]=Je(),[i,x]=c.useState([]),[l,g]=c.useState([]),[u,v]=c.useState(null),[p,b]=c.useState(null),[N,y]=c.useState(!0),[W,B]=c.useState(0),[A,S]=c.useState(null),_=(($e=Ue.find(a=>a.value===r.get("filter")))==null?void 0:$e.value)??"needs_action",h=["current","imported","all"].includes(r.get("view")||"")?r.get("view"):"current",z=r.get("q")??"",T=["attention","clickup","history","all"].includes(r.get("work")||"")?r.get("work"):r.get("handling")==="clickup"?"clickup":z||r.get("priority")||r.get("filter")||r.get("handling")==="all"?"all":"attention",E=(a,n,o="")=>s(f=>{const M=new URLSearchParams(f);return n===o?M.delete(a):M.set(a,n),M},{replace:!0}),[k,m]=c.useState({status:"loading",links:{}}),[ae,Ne]=c.useState(0),$=c.useRef(0),K=c.useRef(0),q=c.useRef(0),L=c.useRef(r.get("lead"));L.current=r.get("lead");const[w,O]=c.useState(null),[V,H]=c.useState(!1),[ne,re]=c.useState(null),[ie,le]=c.useState(""),[oe,J]=c.useState(""),[ye,ce]=c.useState("call"),[_e,ue]=c.useState("outbound"),[ee,d]=c.useState(""),[D,R]=c.useState(""),Y=c.useCallback(()=>{R(""),d(""),le(""),J(""),ce("call"),ue("outbound")},[]),Z=c.useCallback(async()=>{const a=++K.current;y(!0),$.current++,m({status:"loading",links:{}});try{const n=await De({action:"list_queue"});if(a!==K.current)return;x(Array.isArray(n==null?void 0:n.items)?n.items:[]),g(Array.isArray(n==null?void 0:n.members)?n.members:[]),v((n==null?void 0:n.me)||null),b((n==null?void 0:n.admin_owner_id)||null),S(null),B(o=>o+1)}catch(n){a===K.current&&S((n==null?void 0:n.message)||"Could not load Follow-ups.")}finally{a===K.current&&y(!1)}},[]),Ce=c.useCallback(async a=>{const n=++q.current;try{const o=await De({action:"get_item",lead_id:a});if(n!==q.current||L.current!==a)return;o!=null&&o.item&&(O({item:{...o.item,has_intake:!!((o==null?void 0:o.has_intake)??o.item.has_intake)},activity:Array.isArray(o==null?void 0:o.activity)?o.activity:[]}),H(!0),J(ve(o.item)===null?"":String(o.item.next_follow_up_at).slice(0,10)))}catch(o){n===q.current&&L.current===a&&Ae.error((o==null?void 0:o.message)||"Could not open the item.")}},[]),st=a=>{r.get("lead")!==a&&(L.current=a,q.current++,O(null),H(!1),Y()),s(n=>{const o=new URLSearchParams(n);return o.set("lead",a),o},{replace:!1})},at=c.useCallback(()=>{L.current=null,q.current++,H(!1),O(null),Y(),s(a=>{const n=new URLSearchParams(a);return n.delete("lead"),n},{replace:!0})},[s,Y]);c.useEffect(()=>{Z()}
13,[Z]),Yt(()=>{Z()},!ne&&!V&&!ee&&!D&&!ie&&!oe);const j=t&&(u==null?void 0:u.is_admin)===!0,Se=c.useMemo(()=>i.map(a=>a.id).sort().join(","),[i]);c.useEffect(()=>{const a=++$.current;if(!j||A||N){m({status:"loading",links:{}});return}return m({status:"loading",links:{}}),ds(Se?Se.split(","):[]).then(n=>{a===$.current&&m(n)}).catch(()=>{a===$.current&&m({status:"unavailable",links:{}})}),()=>{$.current++}},[j,Se,W,ae,A,N]),c.useEffect(()=>{const a=r.get("lead");if(!a&&(V||w)){q.current++,H(!1),O(null),Y();return}a&&w&&w.item.id!==a&&(q.current++,H(!1),O(null),Y()),a&&(!V||(w==null?void 0:w.item.id)!==a)&&!A&&Ce(a)},[N,A,r,V,w==null?void 0:w.item.id,Y]);const nt=c.useCallback(async(a,n,o="Updated")=>{if(!w)return;const f=w.item.id;re(a);try{await De({action:a,lead_id:f,data:n}),Ae.success(o),await Z(),L.current===f&&(await Ce(f),L.current===f&&(R(""),d("")))}catch(M){Ae.error((M==null?void 0:M.message)||"Action failed")}finally{re(null)}},[w,Z,Ce]),I=Zt(void 0,W,j&&!N&&!A),G=c.useMemo(()=>new Map(I.state.status==="ok"?I.briefs.map(a=>[a.lead.id,Mt(a,I.state.status==="ok"?I.state.ds.asOf:"")]):[]),[I.state,I.briefs]),Ie=c.useMemo(()=>new Map(I.state.status==="ok"?I.briefs.map(a=>[a.lead.id,Wt(a,I.state.status==="ok"?I.state.ds.asOf:"")]):[]),[I.state,I.briefs]),de=a=>!Ie.has(a.id)||Ie.get(a.id)===!0,me=zt(r.get("priority"))?r.get("priority"):"all",P=ms(),U=c.useMemo(()=>j?i:i.filter(a=>Re(a,h)),[i,h,j]),rt=c.useMemo(()=>({current:i.filter(a=>Re(a,"current")).length,imported:i.filter(a=>Re(a,"imported")).length,all:i.length,unknown:i.filter(a=>Qt(a)==="unknown").length}),[i]),Me=c.useMemo(()=>{const a=(u==null?void 0:u.profile_id)||null;return U.filter(n=>j&&!r.has("filter")||j&&(k.status!=="ok"||!Object.prototype.hasOwnProperty.call(k.links,n.id)||k.links[n.id]!==null)?!0:Te(n,_,{myProfileId:a})).filter(n=>Ft(n,z)).filter(n=>!j||me==="all"||!G.has(n.id)||G.get(n.id).key===me).sort((n,o)=>{const f=Q(n,P)!==null,M=Q(o,P)!==null;if(f||M)return Qe(n,o,P);const Ve=G.get(n.id),He=G.get(o.id);return(j&&Ve&&He?Bt(Ve,He):0)||Qe(n,o,P)})},[U,_,u,P,z,j,k,G,me,r]),F=!j||k.status==="ok",it=j&&F?U.filter(a=>Object.prototype.hasOwnProperty.call(k.links,a.id)&&k.links[a.id]===null):[],We=j&&F?U.filter(a=>!!k.links[a.id]):[],ze=U.filter(de),xe=j?Me.filter(a=>T==="all"||(T==="attention"?de(a):T==="history"?!de(a):!!k.links[a.id])):Me,lt=xe.filter(a=>it.includes(a)),ot=xe.filter(a=>We.includes(a)),ct=j?xe.filter(a=>!F||!Object.prototype.hasOwnProperty.call(k.links,a.id)):[],ut=c.useMemo(()=>{const a=(u==null?void 0:u.profile_id)||null,n={};for(const o of Ue)n[o.value]=U.filter(f=>(!j||F&&Object.prototype.hasOwnProperty.call(k.links,f.id)&&k.links[f.id]===null)&&Te(f,o.value,{myProfileId:a})).length;return n},[U,u,j,F,k]),dt=c.useMemo(()=>{const a=(j?ze:U).filter(f=>!Ke(f)&&(!j||F&&Object.prototype.hasOwnProperty.call(k.links,f.id)&&k.links[f.id]===null)),n=a.filter(f=>Te(f,"needs_action",{myProfileId:null})),o=a.filter(f=>f.team_queue_status==="waiting");return{act:n.length,actDue:n.filter(f=>Q(f,P)!==null).length,wait:o.length,waitDue:o.filter(f=>Q(f,P)!==null).length}},[U,P,j,F,k,Ie]),mt=w&&u?w.item.owner_id===u.profile_id:!1,Fe=!!(u!=null&&u.can_manage),xt=u?!!u.can_work:!0,ht=D.trim().length>=5,pt=w?Ke(w.item):!1,Be={myProfileId:(u==null?void 0:u.profile_id)??null,isManager:Fe,canWork:xt,adminOwnerId:p},ft=w?Et(w.item,Be):!1,gt=w?$t(w.item,Be):!1,Ee=a=>j&&k.status==="ok"?k.links[a]:null,kt=w?Ee(w.item.id):null,wt=a=>s(n=>{const o=new URLSearchParams(n);o.set("work",a);for(const f of["filter","priority","handling","view"])o.delete(f);return o}),jt=()=>{j&&k.status!=="ok"&&!N&&!A?Ne(a=>a+1):Z()},vt={assignTarget:ie,setAssignTarget:le,nextActionDate:oe,setNextActionDate:J,touchChannel:ye,setTouchChannel:ce,touchDirection:_e,setTouchDirection:ue,touchNote:ee,setTouchNote:d,statusNote:D,setStatusNote:R};return{admin:j,view:h,filter:_,query:z,workView:T,priorityFilter:me,updateParam:E,setWorkView:wt,refreshOrRetry:jt,loading:N,loadError:A,items:i,members:l,adminOwnerId:p,destinations:k,priorityStatus:I.state.status,priorityMap:G,isAttention:de,today:P,viewItems:U,viewCounts:rt,filterCounts:ut,dueSummary:dt,linkageKnown:F,attentionItems:ze,clickupAll:We,scopedItems:xe,websiteItems:lt,clickupItems:ot,uncertainItems:ct,savedDestination:Ee,selectItem:st,detail
13:w,detailOpen:V,closeDetail:at,busy:ne,runAction:nt,draft:vt,isMine:mt,canManage:Fe,canClose:ht,detailClosed:pt,canAct:ft,canClaim:gt,clickupDetail:kt}}function ps({item:t,heading:r,admin:s,attention:i,today:x,priority:l,adminOwnerId:g,destination:u,onSelect:v}){const p=s&&!i?null:Q(t,x),b=ve(t)!==null,N=r==="In ClickUp";return e.jsxs("div",{className:"w-full rounded border border-border/60 bg-card px-3 py-2 text-left",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[e.jsx(C,{variant:"link",className:"h-auto min-w-0 max-w-full break-all p-0 text-left text-sm font-medium",onClick:()=>v(t.id),children:t.name||"Unnamed"}),(!s||r==="Website follow-ups"&&i)&&e.jsx(Le,{variant:tt(t.team_queue_status),className:"h-5 text-[10px] uppercase tracking-wide",children:Oe[t.team_queue_status||"new"]||t.team_queue_status}),e.jsx("span",{className:"text-xs text-muted-foreground",children:qe(t)}),t.has_intake&&e.jsx(Le,{variant:"outline",className:"h-5 text-[10px] uppercase tracking-wide",children:"Full intake"}),t.practice_area_label&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",t.practice_area_label]}),t.urgency&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",t.urgency.replace(/_/g," ")]}),e.jsxs("span",{className:"ml-auto flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(is,{className:"h-3 w-3",strokeWidth:1.5}),we(t,g)]})]}),t.email&&e.jsx("p",{className:"min-w-0 break-all text-xs text-muted-foreground",children:t.email}),s&&!!l&&e.jsxs("p",{className:"mt-1 text-xs",children:[e.jsx(Vt,{priority:l})," ",e.jsxs("span",{children:[l.reason,l.at?` · ${be(l.at)}`:""]})]}),e.jsxs("p",{className:"mt-1 text-xs font-medium",children:["Next step:"," ",s&&!N&&!i?"Review history before any outreach":s&&(l==null?void 0:l.reason)==="Booking awaiting confirmation"?"Confirm the booking details":xs(t,N)]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Received ",se(t.team_queue_entered_at)]}),b&&(!s||r==="Website follow-ups")&&e.jsxs("span",{className:p==="overdue"?"font-medium text-destructive":"",children:[e.jsx(as,{className:"mr-0.5 inline h-3 w-3",strokeWidth:1.5}),"Follow-up ",be(t.next_follow_up_at),p==="overdue"?" (overdue)":p==="today"?" (due today)":""]}),typeof t.touch_count=="number"&&e.jsxs("span",{children:[t.touch_count," touch",t.touch_count===1?"":"es"]}),t.consultation_status&&e.jsxs("span",{children:["Call:"," ",s&&(l==null?void 0:l.reason)==="Booking awaiting confirmation"?"awaiting confirmation":t.consultation_status.replace(/_/g," ")]})]}),t.matter_summary&&e.jsx("p",{className:"mt-1 line-clamp-1 text-xs text-muted-foreground/80",children:cs(t.matter_summary,[qe(t),t.practice_area_label,t.urgency].filter(Boolean).join(" · "))}),s&&u&&e.jsx("a",{className:"text-xs text-primary hover:underline",href:u??void 0,target:"_blank",rel:"noopener noreferrer",children:"Open in ClickUp"}),s&&r==="Linkage unverified"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"ClickUp link not verified · open history or retry"})]},t.id)}function fs({open:t,onClose:r,detail:s,admin:i,destinations:x,clickupDetail:l,priorityReason:g,today:u,adminOwnerId:v,members:p,isMine:b,canManage:N,canAct:y,canClaim:W,canClose:B,detailClosed:A,busy:S,runAction:_,draft:h}){const[z]=Je(),T=z.get("request"),E=Gt(t&&s?s.item.id:null),k=Xt(E.state);return e.jsx(Ct,{open:t,onOpenChange:m=>m?void 0:r(),children:e.jsx(St,{className:"w-full min-w-0 overflow-y-auto overflow-x-hidden sm:max-w-lg [&>*]:min-w-0",children:s&&e.jsxs(e.Fragment,{children:[e.jsxs(It,{children:[e.jsxs(At,{className:"flex min-w-0 flex-wrap items-center gap-2 pr-8",children:[e.jsx("span",{className:"min-w-0 break-all",children:s.item.name||"Unnamed"}),(!i||x.status==="ok"&&Object.prototype.hasOwnProperty.call(x.links,s.item.id)&&x.links[s.item.id]===null)&&e.jsx(Le,{variant:tt(s.item.team_queue_status),className:"h-5 text-[10px] uppercase tracking-wide",children:Oe[s.item.team_queue_status||"new"]||s.item.team_queue_status})]}),e.jsxs(Tt,{className:"space-y-0.5 text-left",children:[e.jsxs("span",{className:"block",children:[qe(s.item),s.item.practice_area_label?` · ${s.item.practice_area_label}`:"",s.item.urgency?` · ${s.item.urgency.replace(/_/g," ")}`:""]}),s.item.has_intake&&e.jsx("span",{className:"block font-medium text-foreground",children:"Full intake submitted"}),e.jsxs("span",{className:"block",children:["Received ",se(s.item.team_queue_entered_at)]})]})]}),e.jsxs("div",{className:"mt-4 space-y-5 text-sm",children:[e.jsxs("div",{className:"space-y-1",children:[s.item.email&&e.jsxs("p",{className:"flex min-w-0 items-center gap-2 text-foreground",children:[e.jsx(Rt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5}),e.jsx("a",{className:"min-w-0 break-all hover:underline",href:`mailto:${s.item.email}`,children:s.item.email})]}),s.item.phone&&e.jsxs("p",{className:"flex items-center gap-2 text-foreground",children:[e.jsx(rs,{className:"h-3.5 w-3.5 text-muted-foreground",strokeWidth:1.5}),e.jsx("a",{className:"hover:underline",href:`tel:${s.item.phone}`,children:s.item.phone})]}),s.item.consultation_status&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Call status:"," ",i&&g==="Booking awaiting confirmation"?"awaiting confirmation":s.item.consultation_status.replace(/_/g," "),s.item.call_booked_at?` · booked ${se(s.item.call_booked_at)}`:""]})]}),s.item.matter_summary&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Saved notes"}),je(s.item.matter_summary).prose&&e.jsx("p",{className:"whitespace-pre-wrap break-words rounded border bg-muted/30 p-2 text-xs",children:je(s.item.matter_summary).prose}),je(s.item.matter_summary).technical&&e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{className:"cursor-pointer",children:"Booking and system notes (as saved)"}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap break-all rounded border bg-muted/30 p-2",children:s.item.matter_summary})]})]}),e.jsx(te,{}),T&&Ye&&e.jsx(Jt,{leadId:s.item.id,requestId:T}),e.jsx(es,{state:E.state,onRefresh:E.refresh}),l&&!Ye,i&&(x.status!=="ok"||!Object.prototype.hasOwnProperty.call(x.links,s.item.id))&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ClickUp linkage"," ",x.status==="loading"?"loading":"uncertain",". Retry from the list; website history remains available."]}),i&&l&&e.jsxs("details",{className:"text-xs text-muted-foreground",children:[e.jsx("summary",{className:"cursor-pointer",children:"Website follow-up history"}),e.jsxs("p",{children:["Website status:"," ",Oe[s.item.team_queue_status||"new"]||s.item.team_queue_status,ve(s.item)!==null?` · Website follow-up: ${be(s.item.next_follow_up_at)}`:""]})]}),!l&&ve(s.item)!==null&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Follow-up ",be(s.item.next_follow_up_at),Q(s.item,u)==="overdue"?" · Overdue":Q(s.item,u)==="today"?" · Due today":""]}),A&&e.jsx("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-xs text-muted-foreground",children:"This item is closed and read-only — a deliberate final stop that does not reopen on its own. If follow-up may still be needed later, use Waiting instead; reserve Closed for when the matter is truly done."}),!A&&!y&&e.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-xs text-muted-foreground",children:["Owned by ",we(s.item,v),". Only the owner, the shared Team Inbox pool, or a manager can act on this item."]}),y&&k&&!l&&(!i||x.status==="ok"&&Object.prototype.hasOwnProperty.call(x.links,s.item.id)&&x.links[s.item.id]===null)&&e.jsxs(e.Fragment,{children:[e.jsxs("details",{className:"space-y-2",children:[e.jsxs("summary",{className:"cursor-pointer text-xs font-medium",children:["Change owner ·"," ",we(s.item,v)]}),e.jsxs("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:["Owner:"," ",e.jsx("span",{className:"text-foreground normal-case",children:we(s.item,v)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[!b&&W&&e.jsx(C,{size:"sm",className:"h-7 text-xs",disabled:S!==null,onClick:()=>void _("claim",void 0,"You now own this item"),children:"Take ownership"}),b&&v&&e.jsx(C,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:S!==null,onClick:()=>void _("assign",{owner_id:v},"Returned to Team Inbox"),children:"Return to Team Inbox"})]}),N&&p.length>0&&e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(he,{className:"text-xs text-muted-foreground",children:"Assign to"}),e.jsxs(pe,{value:h.assignTarget,onValueChange:h.setAssignTarget,children:[e.jsx(fe,{className:"h-8 text-xs",children:e.jsx(ge,{placeholder:"Choose a team member"})}),e.jsx(ke,{children:p.map(m=>e.jsx(X,{value:m.id,className:"text-xs",children:m.label},m.id))})]})]}),e.jsx(C,{size:"sm",variant:"secondary",className:"h-8 text-xs",disabled:!h.assignTarget||S!==null,onClick:()=>void _("assign",{owner_id:h.assignTarget},"Assigned"),children:"Assign"})]})]}),e.jsx(te,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(he,{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Next action"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(et,{type:"date",value:h.nextActionDate,onChange:m=>h.setNextActionDate(m.target.value),className:"h-8 w-44 text-xs"}),e.jsx(C,{size:"sm",variant:"secondary",className:"h-8 text-xs",disabled:!h.nextActionDate||S!==null,onClick:()=>void _("set_next_action",{next_action_date:h.nextActionDate},"Next action set"),children:"Save"}),e.jsx(C,{size:"sm",variant:"ghost",className:"h-8 text-xs",disabled:S!==null,onClick:()=>void _("set_next_action",{next_action_date:null},"Next action cleared"),children:"Clear"})]})]}),e.jsx(te,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(he,{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Record an interaction"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(pe,{value:h.touchChannel,onValueChange:h.setTouchChannel,children:[e.jsx(fe,{className:"h-8 w-32 text-xs",children:e.jsx(ge,{})}),e.jsx(ke,{children:["call","email","sms","meeting","note","other"].map(m=>e.jsx(X,{value:m,className:"text-xs capitalize",children:m},m))})]}),e.jsxs(pe,{value:h.touchDirection,onValueChange:h.setTouchDirection,children:[e.jsx(fe,{className:"h-8 w-32 text-xs",children:e.jsx(ge,{})}),e.jsxs(ke,{children:[e.jsx(X,{value:"outbound",className:"text-xs",children:"Outbound"}),e.jsx(X,{value:"inbound",className:"text-xs",children:"Inbound"})]})]})]}),e.jsx(Ze,{placeholder:"What happened? (optional)",value:h.touchNote,onChange:m=>h.setTouchNote(m.target.value),className:"min-h-16 text-xs",maxLength:2e3}),e.jsx(C,{size:"sm",variant:"secondary",className:"h-8 text-xs",disabled:S!==null,onClick:()=>void _("log_touch",{channel:h.touchChannel,direction:h.touchDirection,note:h.touchNote},"Touch logged"),children:"Save interaction"})]}),e.jsx(te,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(he,{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Update status"}),e.jsx(Ze,{placeholder:"Note (required to close — at least 5 characters)",value:h.statusNote,onChange:m=>h.setStatusNote(m.target.value),className:"min-h-16 text-xs",maxLength:2e3}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{size:"sm",variant:"outline",className:"h-8 text-xs",disabled:S!==null,onClick:()=>void _("set_waiting",{note:h.statusNote},"Moved to Waiting"),children:"Move to Waiting"}),e.jsx(C,{size:"sm",variant:"outline",className:"h-8 text-xs",disabled:S!==null,onClick:()=>void _("escalate",{note:h.statusNote},"Escalated for attorney review"),children:"Escalate for attorney review"}),e.jsx(C,{size:"sm",variant:"destructive",className:"h-8 text-xs",disabled:!B||S!==null,title:B?void 0:"A closing note is required",onClick:()=>void _("close",{note:h.statusNote},"Closed"),children:"Close with note"})]})]})]}),e.jsx(te,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Activity"}),s.activity.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No activity yet."}),e.jsx("ul",{className:"space-y-1.5",children:s.activity.map(m=>m.kind==="touch"?e.jsxs("li",{className:"rounded border border-border/50 px-2 py-1.5 text-xs",children:[e.jsx("span",{className:"font-medium capitalize text-foreground",children:m.channel||"touch"}),e.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",m.direction||"—"," · ",se(m.occurred_at)]}
13),m.note&&e.jsx("p",{className:"mt-0.5 text-muted-foreground/90",children:m.note})]},`t-${m.id}`):e.jsxs("li",{className:"rounded border border-border/40 px-2 py-1.5 text-xs text-muted-foreground",children:[(m.channel||"action").replace(/_/g," ")," ·"," ",se(m.occurred_at),m.note&&e.jsx("p",{className:"mt-0.5",children:m.note})]},`a-${m.id}`))})]})]})]})})})}function Os(){return e.jsx(os,{title:"Follow-ups",children:e.jsx(gs,{})})}function gs(){var ee;const{admin:t,view:r,filter:s,query:i,workView:x,priorityFilter:l,updateParam:g,setWorkView:u,refreshOrRetry:v,loading:p,loadError:b,adminOwnerId:N,destinations:y,priorityStatus:W,priorityMap:B,isAttention:A,today:S,viewItems:_,viewCounts:h,filterCounts:z,dueSummary:T,linkageKnown:E,attentionItems:k,clickupAll:m,scopedItems:ae,websiteItems:Ne,clickupItems:$,uncertainItems:K,savedDestination:q,selectItem:L,members:w,detail:O,detailOpen:V,closeDetail:H,busy:ne,runAction:re,draft:ie,isMine:le,canManage:oe,canClose:J,detailClosed:ye,canAct:ce,canClaim:_e,clickupDetail:ue}=hs();return e.jsxs("div",{className:"mx-auto max-w-6xl space-y-4",children:[e.jsx(ts,{}),e.jsx(ss,{}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"New requests first. Search to find any earlier inquiry or client record."}),!t&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Which records to show",children:[[["current","Current work"],["imported","Imported bookings"],["all","All work"]].map(([d,D])=>e.jsxs(C,{size:"sm",variant:r===d?"secondary":"ghost","aria-pressed":r===d,className:"h-7 text-xs",onClick:()=>g("view",d,"current"),children:[D,e.jsx("span",{className:"ml-1.5 tabular-nums opacity-70",children:p?"—":h[d]})]},d)),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Imported bookings are untouched records from the one-time calendar import; anything updated, contacted or linked to an intake stays in current work. Changing the view never changes a record.",!p&&h.unknown?` ${h.unknown} couldn't be classified and stay in current work.`:""]})]}),!p&&!b&&!t&&e.jsxs("p",{className:"text-xs text-muted-foreground",role:"status",children:["Needs action: ",T.act," (",T.actDue," due or overdue) · Waiting: ",T.wait," (",T.waitDue," due or overdue)"]}),t&&!b&&(p||y.status!=="ok")&&e.jsx("p",{className:"text-xs text-muted-foreground",role:"status",children:"Website due totals unavailable until saved destinations finish loading."}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-2",role:"group","aria-label":"Follow-up view",children:[["attention","Needs attention",k.length],["clickup","In ClickUp",m.length],["history","History",_.length-k.length],["all","All records",_.length]].map(([d,D,R])=>e.jsxs(C,{size:"sm",variant:x===d?"secondary":"outline","aria-pressed":x===d,onClick:()=>u(d),children:[D," ·"," ",p||y.status!=="ok"||W!=="ok"?"—":R]},d))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:x==="attention"?"New website requests and outstanding follow-ups. A new request after a handling review returns here.":x==="history"?"Handled inquiries and older records. An unverified outcome does not mean the matter was resolved.":x==="clickup"?"Current work is managed in ClickUp. Website status is not a second task list.":"Every saved follow-up, including handled and older records."})]}),!t&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":t?"Website status":"Follow-up status",children:[t&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Website status"}),Ue.map(d=>e.jsxs(C,{variant:s===d.value?"default":"outline",size:"sm",className:"h-7 text-xs",onClick:()=>g("filter",d.value,"needs_action"),children:[d.label,e.jsx("span",{className:"ml-1.5 tabular-nums opacity-70",children:p||t&&!E?"—":z[d.value]??0})]},d.value))]}),t&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(pe,{value:l,onValueChange:d=>g("priority",d,"all"),children:[e.jsx(fe,{className:"w-[210px]","aria-label":"Website priority",children:e.jsx(ge,{})}),e.jsxs(ke,{children:[e.jsx(X,{value:"all",children:"All priorities · Hot first"}),Ht.map(d=>e.jsx(X,{value:d.value,children:d.label},d.value))]})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:W==="loading"?"Loading priorities…":W==="error"?"Priorities unavailable; all follow-ups remain visible.":"Real deadlines stay first. Unverified priorities remain visible."})]}),e.jsxs("label",{className:"block max-w-md",children:[e.jsx("span",{className:"sr-only",children:"Search follow-ups"}),e.jsx(et,{"aria-label":"Search follow-ups",placeholder:"Search name, email, phone or matter",value:i,onChange:d=>g("q",d.target.value)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(C,{size:"sm",variant:"outline",onClick:v,disabled:p||t&&!b&&y.status==="loading",children:p||t&&!b&&y.status==="loading"?"Updating…":b||t&&(y.status==="unavailable"||y.status==="partial")?"Retry":"Refresh"}),t&&y.status!=="ok"&&e.jsxs("span",{children:["ClickUp destinations"," ",y.status==="loading"?"loading…":y.status==="partial"?"partly loaded; linkage uncertain":"unavailable; linkage uncertain","."]})]}),b&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[e.jsx(ns,{className:"mt-0.5 h-4 w-4 shrink-0",strokeWidth:1.5}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Follow-ups is unavailable."}),e.jsx("p",{className:"text-xs opacity-80",children:b})]})]}),p&&e.jsx("div",{className:"space-y-2",children:[0,1,2].map(d=>e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-border/60 bg-muted/30"},d))}),!p&&!b&&ae.length===0&&e.jsx("div",{className:"rounded-md border border-border/60 p-8 text-center text-sm text-muted-foreground",children:i?"No follow-ups match this search.":"Nothing in this view. New intakes, contact messages, and bookings land in Follow-ups automatically."}),!p&&!b&&e.jsx("div",{className:"space-y-4",children:(t?[[x==="history"?"Website history":"Website follow-ups",Ne],["In ClickUp",$],["Linkage unverified",K]]:[["Follow-ups",ae]]).filter(([,d])=>d.length).map(([d,D])=>e.jsxs("section",{"aria-label":d,className:"space-y-1.5",children:[e.jsxs("h2",{className:"text-sm font-semibold",children:[d," · ",D.length]}),D.map(R=>e.jsx(ps,{item:R,heading:d,admin:t,attention:A(R),today:S,priority:B.get(R.id),adminOwnerId:N,destination:q(R.id),onSelect:L},R.id))]},d))}),e.jsx(fs,{open:V,onClose:H,detail:O,admin:t,destinations:y,clickupDetail:ue,priorityReason:O?(ee=B.get(O.item.id))==null?void 0:ee.reason:void 0,today:S,adminOwnerId:N,members:w,isMine:le,canManage:oe,canAct:ce,canClaim:_e,canClose:J,detailClosed:ye,busy:ne,runAction:re,draft:ie})]})}
13export{Os 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.