PageSourceSearch

https://app.outsourceaccelerator.com/build/assets/leads-CedSbt1r.js

js outsourceaccelerator.com collected 2026-10-02 02:30:29 UTC 9,814 bytes, 1 lines download raw bytes

1import{r as o,a as S,c as ge,j as t,H as be}from"./index.esm-BxWFwCRV.js";import{S as ye}from"./data-table-column-header-B6peElYp.js";import{M as Se}from"./metrics-cards-BAaWV041.js";import{V as je,L as _e,K as ve,E as Ce}from"./view-toggle-DIMnLlVY.js";import{B as z}from"./button-C-SSWUAC.js";import"./index-BH5iaPk6.js";import{t as v}from"./index-GQWG8pxW.js";import"./scroll-area-DvVrjmpE.js";import{C as Le,d as Me}from"./card-9qfFMYBn.js";import{g as Ee,D as Ne,d as Pe}from"./date-range-picker-Clohgigh.js";import{S as q,a as G,b as H,c as I,d as n}from"./select-B1-_EmGF.js";import{u as ke}from"./index-Dg8k4TaQ.js";import{u as De}from"./use-typed-page-DXO81OlP.js";import{n as we,p as j,E as Ae,A as Oe,G as Te}from"./app-layout-Di5W296C.js";import{c as Re}from"./date-utils-COFYKiIG.js";import{f as Ve}from"./source-partner-dashboard-CHK471Z3.js";import{f as _}from"./format-C7KB_mWR.js";import{D as Q}from"./download-ayUsXeDR.js";import"./index-DSDuzvrg.js";import"./hub-actions-B9KOtnaA.js";import"./loader-circle-B8EBsjRh.js";import"./createLucideIcon-CDNZ6-WK.js";import"./chevrons-right-CTwLuiI1.js";import"./chevron-left-D4qpdmxj.js";import"./index-CeXmm55O.js";import"./index-C_SHgnPd.js";import"./settings-2-BvuiLzNm.js";import"./debounced-input-ChWul_Ki.js";import"./label-DYLOJOI3.js";import"./search-CBzGfPz5.js";import"./sheet-DvMn9DJh.js";import"./index-D-HdmRDX.js";import"./index-CzMU6HRa.js";import"./index-XmWYkZJ5.js";import"./table-aikJtiyk.js";import"./arrow-up-DUX_b30z.js";import"./chevrons-up-down-CMPk3JOL.js";import"./circle-help-DFlXc0l3.js";import"./popover-Cvi_sG6Z.js";import"./badge-CtVZLXvY.js";import"./arrow-up-right-DkI-kNF4.js";import"./building-2-DMbCoBho.js";import"./circle-WgvNgsKa.js";import"./calendar-DCjiwqD9.js";import"./circle-check-Cxj0YP_N.js";import"./clock-UcQunYx9.js";import"./ban-D-PyKr5n.js";import"./copy-L-YDBtJV.js";import"./toggle-C_Z6TWXP.js";import"./index-BdQq_4o_.js";import"./calendar-Bx0tuWvK.js";import"./addDays-BlqbdMUB.js";import"./toDate-BoFoOYoS.js";import"./isSameYear-CeJLWhC0.js";import"./endOfMonth-B7u5PgeT.js";import"./subDays-BMHCmnye.js";import"./parseISO-BZ6cSQhi.js";import"./index-C0CRxioY.js";import"./chevron-up-PsQYZ1B6.js";import"./index-wW2BnLNW.js";import"./log-out-DtCYhMEq.js";import"./app-logo-icon-CicL3Kjq.js";import"./alert-DJht7zHt.js";import"./checkbox-ZUXC5Ltz.js";import"./building-ByqHc_3B.js";import"./index-CMdn6XKl.js";import"./index-D4-ptLa7.js";const E=10,Be=10,J=["no_meeting","scheduled","completed","no_show","canceled"];function Xt(){const l=ke(),{leads:C,kanbanColumns:i,stats:P,filters:s}=De(),Y=[{title:"Source Partner",href:we.url(l)},{title:"Discovery Calls",href:j.url(l)}
1],k=C.data,[b,Z]=o.useState((s==null?void 0:s.search)||""),[p,W]=o.useState((s==null?void 0:s.type)||"all"),[x,X]=o.useState((s==null?void 0:s.meeting_status)||"all"),[F,ee]=o.useState(s!=null&&s.date_from?"custom":"last-30-days"),[d,te]=o.useState(()=>Ee(s)),[ae,N]=o.useState(!1),[se,D]=o.useState(!1),[L,re]=o.useState((s==null?void 0:s.view)==="kanban"?"kanban":"table"),[m,oe]=o.useState(()=>s!=null&&s.sort_by?[{id:s.sort_by,desc:s.sort_dir==="desc"}]:[]),w=C.meta.per_page??E,ne=o.useMemo(()=>Ve(P,p),[P,p]),g=o.useCallback(e=>`kanban_${e}_count`,[]),A=o.useCallback((e={})=>Object.fromEntries(J.map(a=>{const r=e[a],u=(i==null?void 0:i[a].meta.visible_count)??Number((s==null?void 0:s[g(a)])??E);return[g(a),String(r??u)]})),[g,i,s]),O=o.useCallback(e=>Object.fromEntries(J.flatMap(a=>{const r=e[g(a)];return r?[[a,Number(r)]]:[]})),[g]),h=o.useCallback((e={},a=L)=>{const r={},u=e.search??b,c=e.type??p,f=e.meeting_status??x,V=e.date_from??(d.from?_(d.from,"yyyy-MM-dd"):void 0),B=e.date_to??(d.to?_(d.to,"yyyy-MM-dd"):void 0),K=e.sort_by??(m.length>0?m[0].id:void 0),U=e.sort_dir??(m.length>0?m[0].desc?"desc":"asc":void 0),$=e.per_page??String(w);return u&&(r.search=u),c&&c!=="all"&&(r.type=c),f&&f!=="all"&&(r.meeting_status=f),V&&(r.date_from=V),B&&(r.date_to=B),a==="table"?(K&&(r.sort_by=K),U&&(r.sort_dir=U),e.page&&(r.page=e.page),$!==String(E)&&(r.per_page=$)):(r.view="kanban",Object.assign(r,A(O(e)))
1),r},[A,w,d,O,p,x,b,m,L]),M=e=>{const a=h(e);S.get(j.url(l),a,{preserveState:!0,preserveScroll:!0})},le=e=>{Z(e),M({search:e})},ie=e=>{W(e),M({type:e})},de=e=>{X(e),M({meeting_status:e})},ce=e=>{te(e),e.from&&e.to&&M({date_from:_(e.from,"yyyy-MM-dd"),date_to:_(e.to,"yyyy-MM-dd")})},pe=o.useCallback(e=>{oe(e);const a=h({sort_by:e.length>0?e[0].id:void 0,sort_dir:e.length>0?e[0].desc?"desc":"asc":void 0});S.get(j.url(l),a,{preserveState:!0,preserveScroll:!0})},[l,h]),T=e=>{S.visit(Te.url({organization:l,leadUuid:e.uuid}))},R=()=>{if(y===0){v.error("No leads to export",{description:"There are no discovery calls matching the current filters."});return}N(!0)},me=o.useCallback(async()=>{var e;D(!0);try{const a=new URLSearchParams;b&&a.append("search",b),p&&p!=="all"&&a.append("type",p),x&&x!=="all"&&a.append("meeting_status",x),d.from&&a.append("date_from",_(d.from,"yyyy-MM-dd")),d.to&&a.append("date_to",_(d.to,"yyyy-MM-dd")),m.length>0&&(a.append("sort_by",m[0].id),a.append("sort_dir",m[0].desc?"desc":"asc"));const r=await ge.get(`${Ae.url(l)}?${a.toString()}`,{responseType:"blob",validateStatus:u=>u<500});if((e=r.headers["content-type"])!=null&&e.includes("application/json")){const u=await r.data.text(),c=JSON.parse(u);c.queued?v.success("Export queued",{description:c.message}):c.success||v.error("Export failed",{description:c.message})}else{const u=new Blob([r.data],{type:"text/csv"}),c=window.URL.createObjectURL(u),f=document.createElement("a");f.href=c,f.setAttribute("download",`discovery_calls_export_${Re()}.csv`),document.body.appendChild(f),f.click(),f.remove(),window.URL.revokeObjectURL(c),v.success("Export complete",{description:"Your CSV file has been downloaded."})}}catch{v.error("Export failed",{description:"An unexpected error occurred. Please try again."})}finally{D(!1),N(!1)}},[l,b,p,x,d,m]),ue=o.useCallback(e=>{const a=h({page:String(e.pageIndex+1),per_page:String(e.pageSize)});S.get(j.url(l),a,{preserveState:!0,preserveScroll:!0})},[l,h]),he=o.useCallback(e=>{re(e);const a=h({page:e==="table"?"1":void 0},e);S.get(j.url(l),a,{preserveState:!0,preserveScroll:!0})},[h,l]),y=C.meta.total,fe=o.useMemo(()=>Object.values(i??{}).reduce((e,a)=>e+a.meta.visible_count,0),[i]),xe=o.useCallback(e=>{const a=(i==null?void 0:i[e].meta.visible_count)??E,r=h({[g(e)]:String(a+Be)},"kanban");S.get(j.url(l),r,{preserveState:!0,preserveScroll:!0})},[g,h,i,l]);return t.jsxs(Oe,{breadcrumbs:Y,children:[t.jsx(be,{title:"Source Partner - Leads"}),t.jsxs("div",{className:"flex h-full flex-1 flex-col gap-6 px-6",children:[t.jsx("div",{className:"flex flex-col gap-4",children:t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg font-bold tracking-tight",children:"Leads"}),t.jsx("p",{className:"text-secondary-foreground text-sm",children:"Review assigned leads and track their discovery call status."})]})}),t.jsx(Se,{filteredData:ne,selectedLeadType:p}),t.jsx("div",{className:"flex flex-col gap-4",children:t.jsx(ye,{search:b,searchPlaceholder:"Search by name, email, or company...",onSearchChange:le,action:t.jsxs(t.Fragment,{children:[t.jsxs(q,{value:p,onValueChange:ie,children:[t.jsx(G,{className:"w-full sm:w-[160px]",children:t.jsx(H,{placeholder:"Lead Type"})}),t.jsxs(I,{children:[t.jsx(n,{value:"all",children:"All Types"}),t.jsx(n,{value:"inbound",children:"Inbound"}),t.jsx(n,{value:"outbound",children:"Outbound"}),t.jsx(n,{value:"enterprise",children:"Enterprise"})]})]}),t.jsxs(q,{value:x,onValueChange:de,children:[t.jsx(G,{className:"w-full sm:w-[200px]",children:t.jsx(H,{placeholder:"Meeting Status"})}),t.jsxs(I,{children:[t.jsx(n,{value:"all",children:"All Statuses"}),t.jsx(n,{value:"scheduled",children:"Scheduled"}),t.jsx(n,{value:"rescheduled",children:"Rescheduled"}),t.jsx(n,{value:"attended_by_bpo",children:"Attended by BPO"}),t.jsx(n,{value:"attended_by_lead",children:"Attended by Lead"}),t.jsx(n,{value:"canceled_by_lead",children:"Canceled by Lead"}),t.jsx(n,{value:"canceled_by_partner",children:"Canceled by Partner"}),t.jsx(n,{value:"no_show",children:"No Show"}),t.jsx(n,{value:"both_attended_unqualified",children:"Both Attended - Unqualified"}),t.jsx(n,{value:"both_attended",children:"Both Attended"}),t.jsx(n,{value:"invalid",children:"Invalid"}),t.jsx(n,{value:"no_meeting",children:"No Meeting"})]})]}),t.jsx(Ne,{value:d,onChange:ce,selectedPreset:F,onPresetChange:ee,presets:Pe,disableFutureDates:!1}),t.jsx(je,{value:L,onChange:he})]})})}),t.jsx(Le,{className:"flex flex-1 flex-col overflow-hidden border-none p-0",children:t.jsx(Me,{className:"flex-1 overflow-auto p-0",children:L==="table"?t.jsx(_e,{leads:k,paginationMeta:C.meta,onPaginationChange:ue,initialSorting:m,onSortingChange:pe,onRowClick:T,headerText:`Showing ${k.length} of ${y} leads`,toolbarAction:t.jsxs(z,{onClick:R,variant:"outline",size:"sm",disabled:y===0,children:[t.jsx(Q,{className:"mr-2 h-4 w-4"}),"Export CSV"]})}):t.jsxs("div",{className:"flex h-full flex-col",children:[t.jsxs("div",{className:"flex flex-col gap-3 border-b px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-muted-foreground text-sm",children:["Showing ",fe," of ",y," leads"]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Each column loads 10 leads at a time from the server."})]}),t.jsx("div",{className:"flex flex-wrap items-center gap-2",children:t.jsxs(z,{onClick:R,variant:"outline",size:"sm",disabled:y===0,children:[t.jsx(Q,{className:"mr-2 h-4 w-4"}),"Export CSV"]})})]}),i?t.jsx(ve,{columns:i,onLeadClick:T,onLoadMore:xe}):null]})})})]}),t.jsx(Ce,{open:ae,onOpenChange:N,count:y,title:"Export Leads",recordLabel:"leads",onConfirm:me,isExporting:se})]})}
1export{Xt 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.