PageSourceSearch

https://www.eciresearch.ai/assets/CrmReviewPage-DwiI_QzS.js

js eciresearch.ai collected 2026-10-05 13:43:19 UTC 10,802 bytes, 6 lines download raw bytes

1import{b as S,r as o,j as e,L as v,n as C,d as w,g as E,f as A,o as _,I as y}from"./index-C5V2G9ed.js";import{P as $,L as D}from"./PortalLayout-BvibNBbP.js";import{A as N}from"./AccountPicker-DEymPsp9.js";import{v as L,w as T,p as I,A as z,a as F,x as R,y as B,z as M,u as K,B as W,C as P,D as U}from"./crmApi-zEt7F59e.js";import{T as k}from"./trash-2-BDO5OQ0L.js";/**
2 * @license lucide-react v1.8.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 O=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],q=S("merge",O),J=["deal","account","briefing","contact"],V="h-8 rounded-md border border-border bg-background px-2 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-orange-500/40";function b({id:a,label:h,value:i,onSave:u,placeholder:p}){const[m,l]=o.useState(i??"");return o.useEffect(()=>{l(i??"")},[i]),e.jsxs("label",{htmlFor:a,className:"block space-y-0.5",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wider text-slate-500",children:h}),e.jsx(y,{id:a,value:m,placeholder:p,className:"h-8 text-sm",onChange:c=>l(c.target.value),onBlur:()=>{const c=m.trim()||null;c!==(i??null)&&u(c)}})]})}function G({item:a,onChanged:h,onDone:i,onError:u}){const[p,m]=o.useState(!1),[l,c]=o.useState(null),[d,r]=o.useState(!1),s=a.account;if(!s)return null;const x=n=>K(a.id,n).then(h).catch(t=>u(t instanceof Error?t.message:String(t)));async function f(){if(l)try{await W(l.id,a.id),i()}catch(n){u(n instanceof Error?n.message:String(n))}}return e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(b,{id:`acct-name-${a.id}`,label:"Name",value:s.name,onSave:n=>{n&&x({name:n})}}),e.jsx(b,{id:`acct-domain-${a.id}`,label:"Domain",value:s.domain,placeholder:"example.com",onSave:n=>void x({domain:n})}),e.jsx(b,{id:`acct-industry-${a.id}`,label:"Industry",value:s.industry,placeholder:"Set the industry",onSave:n=>void x({industry:n})}),e.jsxs("label",{htmlFor:`acct-status-${a.id}`,className:"block space-y-0.5",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wider text-slate-500",children:"Status"}),e.jsx("select",{id:`acct-status-${a.id}`,value:s.status,className:`${V} w-full`,onChange:n=>void x({status:n.target.value}),children:z.map(n=>e.jsx("option",{value:n,children:F[n]},n))})]})]}),d?e.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/[0.04] p-2 space-y-1.5",children:[e.jsxs("p",{className:"text-xs text-slate-300",children:["Delete ",e.jsx("span",{className:"text-slate-100",children:s.name}),"? Its contacts and deals stay, without a company, and turn up in the review queues. Work already delivered keeps its client, so a company with projects can't be deleted — merge that into the right one instead."]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void R(a.id).then(i).catch(n=>u(n instanceof Error?n.message:String(n))),className:"rounded-md border border-red-500/40 px-2 py-1 text-xs text-red-300 hover:bg-red-500/10",children:"Delete it"}),e.jsx("button",{type:"button",onClick:()=>r(!1),className:"text-xs text-slate-400 hover:text-slate-200",children:"Keep"})]})]}):p?e.jsxs("div",{className:"rounded-md border border-border p-2 space-y-1.5",children:[e.jsxs("p",{className:"text-xs text-slate-400",children:["Everything filed against ",e.jsx("span",{className:"text-slate-200",children:s.name})," moves to the company you pick, and this one goes."]}),e.jsx(N,{id:`merge-${a.id}`,value:l,onChange:c,placeholder:"Which company is the real one?"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:!l,onClick:()=>void f(),className:"rounded-md border border-border px-2 py-1 text-xs text-slate-200 hover:border-orange-500/50 disabled:opacity-40",children:["Merge into ",(l==null?void 0:l.name)??"…"]}),e.jsx("button",{type:"button",onClick:()=>{m(!1),c(null)},className:"text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]})]}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>m(!0),className:"inline-flex items-center gap-1 text-xs text-slate-400 hover:text-orange-300",children:[e.jsx(q,{size:12})," This is a duplicate"]}),e.jsxs("button",{type:"button",onClick:()=>r(!0),className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-red-300",children:[e.jsx(k,{size:12})," This shouldn't exist"]})]})]})}function H({item:a,onChanged:h,onDone:i,onError:u}){const[p,m]=o.useState(a.account_id&&a.account_name?{id:a.account_id,name:a.account_name}:null),[l,c]=o.useState(!1),d=a.contact;if(!d)return null;const r=s=>P(a.id,s).then(h).catch(x=>u(x instanceof Error?x.message:String(x)));return e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(b,{id:`c-first-${a.id}`,label:"First name",value:d.first_name,onSave:s=>void r({first_name:s})}),e.jsx(b,{id:`c-last-${a.id}`,label:"Last name",value:d.last_name,onSave:s=>void r({last_name:s})}),e.jsx(b,{id:`c-email-${a.id}`,label:"Email",value:d.email,onSave:s=>void r({email:s})}),e.jsx(b,{id:`c-title-${a.id}`,label:"Title",value:d.title,placeholder:"Job title",onSave:s=>void r({title:s})})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"min-w-[240px]",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wider text-slate-500",children:"Company"}),e.jsx(N,{id:`c-acct-${a.id}`,value:p,onChange:s=>{m(s),r({account_id:(s==null?void 0:s.id)??null})},placeholder:"Which company?"})]}),l?e.jsxs("span",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-400",children:"Delete this contact?"}),e.jsx("button",{type:"button",onClick:()=>void B(a.id).then(i).catch(s=>u(s instanceof Error?s.message:String(s))),className:"rounded-md border border-red-500/40 px-2 py-1 text-red-300 hover:bg-red-500/10",children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>c(!1),className:"text-slate-400 hover:text-slate-200",children:"Keep"})]}):e.jsxs("button",{type:"button",onClick:()=>c(!0),className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-red-300",children:[e.jsx(k,{size:12})," Nobody — delete"]})]})]})}function Q({item:a,onDone:h}){const[i,u]=o.useState(""),[p,m]=o.useState([]),[l,c]=o.useState(null);o.useEffect(()=>{const r=setTimeout(()=>{M(i).then(m).catch(s=>c(s instanceof Error?s.message:String(s)))},250);return()=>clearTimeout(r)},[i]);async function d(r){try{await U(a.id,r),h()}catch(s){c(s instanceof Error?s.message:String(s))}}return e.jsxs("div",{className:"mt-2 space-y-1.5",children:[e.jsx(y,{id:`assign-${a.id}`,value:i,onChange:r=>u(r.target.value),placeholder:"Find the account this briefing belongs to",className:"h-8 text-sm"}),l&&e.jsx("p",{className:"text-xs text-red-300",children:l}),p.length>0&&e.jsx("ul",{className:"rounded-md border border-border divide-y divide-border",children:p.map(r=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>void d(r.id),className:"w-full text-left px-3 py-1.5 text-sm hover:bg-card",children:[r.name," ",r.domain&&e.jsxs("span",{className:"text-xs text-slate-500",children:["· ",r.domain]})]})},r.id))})]})}
6function se(){const[a,h]=o.useState([]),[i,u]=o.useState("deal"),[p,m]=o.useState(!0),[l,c]=o.useState(null),d=o.useCallback(async()=>{m(!0),c(null);try{h(await L())}catch(t){c(t instanceof Error?t.message:String(t))}finally{m(!1)}},[]);o.useEffect(()=>{d()},[d]);const r=o.useMemo(()=>{const t={account:0,deal:0,contact:0,briefing:0};for(const g of a)t[g.kind]++;return t},[a]),s=a.filter(t=>t.kind===i);function x(t){h(g=>g.filter(j=>!(j.kind===t.kind&&j.id===t.id)))}const f=o.useCallback(()=>{d()},[d]);async function n(t){if(t.kind!=="briefing")try{await I(t.kind,t.id),x(t)}catch(g){c(g instanceof Error?g.message:String(g))}}return e.jsx($,{children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-8 space-y-5",children:[e.jsxs(v,{to:"/accounts",className:"inline-flex items-center gap-1 text-sm text-slate-400 hover:text-foreground",children:[e.jsx(C,{size:14})," Accounts"]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(D,{className:"text-orange-400 mt-1",size:26}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Import review list"}),e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"What the imports couldn't settle, and the contacts email created from a reply. Fix the record here, then mark it reviewed."})]})]}),l&&e.jsxs(w,{variant:"destructive",children:[e.jsx(E,{size:16}),e.jsx(A,{children:l})]}),e.jsx("div",{className:"flex gap-1 border-b border-border",children:J.map(t=>e.jsxs("button",{type:"button",onClick:()=>u(t),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${i===t?"border-orange-400 text-foreground":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[T[t]," ",e.jsx("span",{className:"text-xs text-slate-500 tabular-nums",children:r[t]})]},t))}),p?e.jsx("p",{className:"text-sm text-slate-400 py-6",children:"Loading…"}):s.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-10 text-center text-sm text-slate-400",children:"Nothing left to review here."}):e.jsx("ul",{className:"space-y-2",children:s.map(t=>e.jsx("li",{className:"rounded-lg border border-border bg-card px-4 py-3",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:t.kind==="account"?e.jsx(v,{to:`/accounts/${t.id}`,className:"hover:text-orange-300",children:t.label}):t.label}),t.note&&e.jsx("p",{className:"mt-0.5 text-sm text-slate-400",children:t.note}),t.kind==="deal"&&t.account_id&&e.jsx(v,{to:`/accounts/${t.account_id}`,className:"mt-1 inline-block text-xs text-slate-300 hover:text-orange-300",children:t.account_name??"Open account"}),t.kind==="account"&&e.jsx(G,{item:t,onChanged:f,onDone:()=>x(t),onError:c}),t.kind==="contact"&&e.jsx(H,{item:t,onChanged:f,onDone:()=>x(t),onError:c}),t.kind==="briefing"&&e.jsx(Q,{item:t,onDone:()=>x(t)})]}),t.kind!=="briefing"&&e.jsxs("button",{type:"button",onClick:()=>void n(t),className:"shrink-0 inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-slate-300 hover:border-emerald-500/50 hover:text-emerald-300",children:[e.jsx(_,{size:13})," Mark reviewed"]})]})},`${t.kind}-${t.id}`))})]})})}export{se 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.