PageSourceSearch

https://sellpilothub.com/assets/platform.sales-leads.index-BDezqXsb.js

js sellpilothub.com collected 2026-10-08 02:07:02 UTC 5,800 bytes, 1 lines download raw bytes

1import{r as n,j as e,aJ as u,aK as h,aL as g,aM as j,aN as a,L,i as P,B as A}from"./index-Byr3-ZG9.js";import{u as C}from"./useInfiniteQuery-BtMo6lYH.js";import{u as I}from"./useServerFn-B7pgqgaZ.js";import{S as v,l as T}from"./sales-leads.functions-ByMpZ9y8.js";import{B as E}from"./badge-Co1U19Ka.js";import{I as B}from"./input-Bhe-H49g.js";import"./useBaseQuery-BzlRu7Qh.js";const F={new_lead:"New",contacted:"Contacted",qualified:"Qualified",demo_scheduled:"Demo Booked",trial_started:"Trial Started",proposal_sent:"Proposal Sent",won:"Won",lost:"Lost"};function k(i){return i==="hot"?"bg-red-500/15 text-red-400 border-red-500/30":i==="warm"?"bg-amber-500/15 text-amber-300 border-amber-500/30":"bg-slate-500/15 text-slate-300 border-slate-500/30"}function Q(){const i=I(T),[x,b]=n.useState(""),[f,N]=n.useState(""),[o,S]=n.useState("all"),[c,y]=n.useState("all"),[d,_]=n.useState("all");n.useEffect(()=>{const t=setTimeout(()=>N(x.trim()),250);return()=>clearTimeout(t)},[x]);const r=C({queryKey:["sa-sales-leads",f,o,c,d],queryFn:({pageParam:t})=>i({data:{search:f||void 0,interest:o==="all"?void 0:o,priority:c==="all"?void 0:c,source:d==="all"?void 0:d,cursor:t}}),initialPageParam:void 0,getNextPageParam:t=>t.nextCursor??void 0}),m=n.useMemo(()=>{const t=new Set,l=[];for(const s of r.data?.pages??[])for(const p of s.rows??[])t.has(p.id)||(t.add(p.id),l.push(p));return l},[r.data]),w=n.useMemo(()=>{const t=new Map;for(const l of v)t.set(l,[]);for(const l of m){const s=t.get(l.status)??[];s.push(l),t.set(l.status,s)}return t},[m]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Sales Pipeline"}),e.jsx("p",{className:"text-sm text-slate-400",children:"Leads captured by Sara, the public AI Sales Agent."})]}),e.jsxs("div",{className:"text-xs text-slate-400",children:[m.length," leads"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(B,{placeholder:"Search name, email, company, pain point…",className:"w-[280px] bg-slate-900 border-slate-800 text-slate-100",value:x,onChange:t=>b(t.target.value)}),e.jsxs(u,{value:o,onValueChange:S,children:[e.jsx(h,{className:"w-[140px] bg-slate-900 border-slate-800 text-slate-100",children:e.jsx(g,{placeholder:"Interest"})}),e.jsxs(j,{children:[e.jsx(a,{value:"all",children:"All interest"}),e.jsx(a,{value:"hot",children:"Hot"}),e.jsx(a,{value:"warm",children:"Warm"}),e.jsx(a,{value:"cold",children:"Cold"})]})]}),e.jsxs(u,{value:c,onValueChange:y,children:[e.jsx(h,{className:"w-[140px] bg-slate-900 border-slate-800 text-slate-100",children:e.jsx(g,{placeholder:"Priority"})}),e.jsxs(j,{children:[e.jsx(a,{value:"all",children:"All priority"}),e.jsx(a,{value:"urgent",children:"Urgent"}),e.jsx(a,{value:"high",children:"High"}),e.jsx(a,{value:"medium",children:"Medium"}),e.jsx(a,{value:"low",children:"Low"})]})]}),e.jsxs(u,{value:d,onValueChange:_,children:[e.jsx(h,{className:"w-[180px] bg-slate-900 border-slate-800 text-slate-100",children:e.jsx(g,{placeholder:"Source"})}),e.jsxs(j,{children:[e.jsx(a,{value:"all",children:"All sources"}),e.jsx(a,{value:"sara_sales_agent",children:"Sara (AI agent)"}),e.jsx(a,{value:"pricing_page",children:"Pricing page"}),e.jsx(a,{value:"home_page",children:"Home page"}),e.jsx(a,{value:"contact_form",children:"Contact form"})]})]})]}),e.jsx("div",{className:"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-7",children:v.map(t=>{const l=w.get(t)??[];return e.jsxs("div",{className:"rounded-lg border border-slate-800 bg-slate-900/40 flex flex-col min-h-[200px]",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-slate-800 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-200",children:F[t]}),e.jsx("span",{className:"text-[10px] text-slate-500",children:l.length})]}),e.jsxs("div",{className:"p-2 space-y-2 flex-1",children:[l.length===0&&e.jsx("p",{className:"text-[11px] text-slate-600 italic px-1",children:"No leads"}),l.map(s=>e.jsxs(L,{to:"/platform/sales-leads/$leadId",params:{leadId:s.id},className:"block rounded-md border border-slate-800 bg-slate-950/60 p-2.5 hover:border-amber-500/40 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[10px] font-mono text-amber-400",children:s.lead_number??"—"}),e.jsx(E,{variant:"outline",className:P("text-[9px] px-1 py-0 border",k(s.interest_level)),children:s.lead_score})]}),e.jsx("div",{className:"text-xs font-medium text-slate-100 truncate mt-0.5",children:s.name||s.email||"Anonymous visitor"}),s.company_name&&e.jsx("div",{className:"text-[10px] text-slate-400 truncate",children:s.company_name}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[e.jsx("span",{className:"text-[9px] uppercase tracking-wider text-slate-500",children:s.priority}),s.interested_plan&&e.jsxs("span",{className:"text-[9px] text-slate-400",children:["· ",s.interested_plan]})]}),s.pain_point&&e.jsx("div",{className:"text-[10px] text-slate-500 mt-1 line-clamp-2",children:s.pain_point}),e.jsxs("div",{className:"text-[9px] text-slate-600 mt-1.5",children:[new Date(s.created_at).toLocaleDateString()," ·"," ",s.source_page??s.source??"—"]})]},s.id))]})]},t)})}),r.isLoading&&e.jsx("p",{className:"text-center text-slate-500 py-8 text-sm",children:"Loading…"}),r.hasNextPage&&!r.isLoading&&e.jsx("div",{className:"flex justify-center py-3",children:e.jsx(A,{variant:"outline",size:"sm",onClick:()=>r.fetchNextPage(),disabled:r.isFetchingNextPage,"data-testid":"sales-leads-load-more",children:r.isFetchingNextPage?"Loading…":"Load older leads"})})]})}export{Q as component};

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.