PageSourceSearch

https://servicetosuccess.com/assets/Leads-7eKC3vhB.js

js servicetosuccess.com collected 2026-10-07 16:23:27 UTC 7,645 bytes, 2 lines download raw bytes

1import{a as m,j as e}from"./vendor-react-6dZusYjs.js";import{A as P}from"./AdminLayout-BVakGVJG.js";import{T as Q,a as V,b as w,c,d as H,e as l}from"./table-ClBrmjs6.js";import{B as b}from"./badge-9gqaM3ij.js";import{B as E}from"./button-Pc9UU9Kq.js";import{C as R}from"./checkbox-BIjoK_YI.js";import{z as W}from"./api-aIMl2mP_.js";import{b as Z}from"./vendor-query-DG6KTijm.js";import{J as q}from"./vendor-jszip-x41k_oZz.js";import{o as G,f as K}from"./adminResume-DTmm6Qfj.js";import{a3 as X,aa as Y,Q as ee,u as T,ab as se,F as te,a6 as ae,a0 as ne}from"./vendor-icons-BPjLpime.js";import"./vendor-frIWoMVD.js";import"./vendor-radix-SDBhz8M8.js";import"./index-zmOjOZHb.js";function A(d,o){const h=URL.createObjectURL(d),r=document.createElement("a");r.href=h,r.download=o,r.click(),URL.revokeObjectURL(h)}const re={milmentor_candidate:"Mailing List",exit_popup:"Exit Popup"};function ie(d){return re[d]??d.replace(/_/g," ")}function Ne(){const d=Z(),[o,h]=m.useState("leads"),[r,u]=m.useState(new Set),[v,k]=m.useState(!1),{data:p,isLoading:z}=W();async function U(s){if(!window.confirm("Delete this lead? This cannot be undone."))return;const a=localStorage.getItem("s2s_admin_token")??"";(await fetch(`/api/admin/leads/${s}`,{method:"DELETE",headers:{Authorization:`Bearer ${a}`}})).ok&&d.invalidateQueries()}const C=localStorage.getItem("s2s_last_login"),N=C?new Date(C):null,D=s=>N?new Date(s)>N:!1,g=m.useMemo(()=>(p??[]).filter(s=>s.source!=="milmentor_candidate"),[p]),f=m.useMemo(()=>(p??[]).filter(s=>s.source==="milmentor_candidate"),[p]),i=o==="leads"?g:f,$=m.useMemo(()=>i.filter(s=>D(s.createdAt)).length,[i,N]),y=m.useMemo(()=>r.size>0?i.filter(s=>r.has(s.id)):i,[i,r]),S=i.length>0&&i.every(s=>r.has(s.id)),I=i.some(s=>r.has(s.id)),B=()=>{u(S?s=>{const a=new Set(s);return i.forEach(t=>a.delete(t.id)),a}:s=>{const a=new Set(s);return i.forEach(t=>a.add(t.id)),a})},F=s=>u(a=>{const t=new Set(a);return t.has(s)?t.delete(s):t.add(s),t}),_=s=>{h(s),u(new Set)},M=()=>{if(!y.length)return;const s=o==="mailinglist",a=s?["First Name","Email","Work Location","Resume","Date Joined"]:["First Name","Email","Type","Interests","Source","Date"],t=y.map(n=>s?[n.firstName||"",n.email,n.workLocation||"",n.resumeUrl||"",new Date(n.createdAt).toLocaleString()].map(L=>`"${String(L).replace(/"/g,'""')}"`).join(","):[n.firstName||"",n.email,n.type||"",n.interests||"",n.source||"exit_popup",new Date(n.createdAt).toLocaleString()].map(L=>`"${String(L).replace(/"/g,'""')}"`).join(",")),x=s?`mailing_list_${new Date().toISOString().slice(0,10)}.csv`:`leads_${new Date().toISOString().slice(0,10)}.csv`;A(new Blob([[a.join(","),...t].join(`
2`)],{type:"text/csv"}),x)},j=y.filter(s=>s.resumeUrl),O=async()=>{if(j.length){k(!0);try{const s=new q;await Promise.all(j.map(async t=>{const x=t.resumeUrl,n=await K(x);n&&s.file(`${t.firstName||t.email}_resume.${n.ext}`,n.blob)}));const a=await s.generateAsync({type:"blob"});A(a,`mailing_list_resumes_${new Date().toISOString().slice(0,10)}.zip`)}finally{k(!1)}}},J=r.size>0?`${r.size} selected`:o==="leads"?`${g.length} lead${g.length!==1?"s":""}`:`${f.length} subscriber${f.length!==1?"s":""}`;return e.jsxs(P,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Leads"}),e.jsxs("p",{className:"text-muted-foreground mt-1 flex items-center gap-2 text-sm",children:[J,$>0&&e.jsxs(b,{className:"bg-primary/10 text-primary border-primary/20 text-xs gap-1",children:[e.jsx(X,{className:"w-3 h-3"})," ",$," new"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[o==="mailinglist"&&j.length>0&&e.jsxs(E,{variant:"outline",size:"sm",className:"gap-1.5",onClick:O,disabled:v,children:[e.jsx(Y,{className:"w-4 h-4"}),v?"Zipping...":`Resumes (${j.length})`]}),e.jsxs(E,{variant:"outline",size:"sm",className:"gap-1.5",onClick:M,children:[e.jsx(ee,{className:"w-4 h-4"}),r.size>0?`Export CSV (${r.size})`:"Export CSV"]})]})]}),e.jsxs("div",{className:"flex gap-1 mb-4 border border-border rounded-lg overflow-hidden w-fit",children:[e.jsxs("button",{onClick:()=>_("leads"),className:`px-4 py-2 text-sm font-medium transition-colors flex items-center gap-2 ${o==="leads"?"bg-primary text-white":"text-muted-foreground hover:bg-muted"}`,children:[e.jsx(T,{className:"w-3.5 h-3.5"})," Exit-Intent Leads",e.jsx(b,{variant:"secondary",className:"text-xs ml-1",children:g.length})]}),e.jsxs("button",{onClick:()=>_("mailinglist"),className:`px-4 py-2 text-sm font-medium transition-colors flex items-center gap-2 ${o==="mailinglist"?"bg-primary text-white":"text-muted-foreground hover:bg-muted"}`,children:[e.jsx(se,{className:"w-3.5 h-3.5"}
2)," Mailing List Sign-ups",e.jsx(b,{variant:"secondary",className:"text-xs ml-1",children:f.length})]})]}),e.jsx("div",{className:"bg-card rounded-lg border border-border overflow-hidden",children:e.jsxs(Q,{children:[e.jsx(V,{children:e.jsxs(w,{children:[e.jsx(c,{className:"w-10 pl-4",children:e.jsx(R,{checked:S,"data-state":I&&!S?"indeterminate":void 0,onCheckedChange:B})}),e.jsx(c,{children:"Email"}),e.jsx(c,{children:"Name"}),o==="leads"?e.jsxs(e.Fragment,{children:[e.jsx(c,{children:"Type"}),e.jsx(c,{children:"Source"})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{children:"Work Location"}),e.jsx(c,{children:"Resume"})]}),e.jsx(c,{children:"Date"}),e.jsx(c,{})]})}),e.jsx(H,{children:z?e.jsx(w,{children:e.jsx(l,{colSpan:7,className:"text-center py-8",children:"Loading..."})}):i.length?i.map(s=>{const a=r.has(s.id),t=D(s.createdAt),x=s.resumeUrl;return e.jsxs(w,{className:`${a?"bg-primary/5":""} transition-colors`,children:[e.jsx(l,{className:"pl-4",children:e.jsx(R,{checked:a,onCheckedChange:()=>F(s.id)})}),e.jsx(l,{className:"font-medium",children:s.email}),e.jsx(l,{className:"text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.firstName||"—",t&&e.jsx(b,{className:"text-xs bg-primary/10 text-primary border-primary/20 py-0",children:"New"})]})}),o==="leads"?e.jsxs(e.Fragment,{children:[e.jsx(l,{className:"text-sm capitalize text-muted-foreground",children:s.type||"—"}),e.jsx(l,{className:"text-sm text-muted-foreground capitalize",children:ie(s.source||"exit_popup")})]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{className:"text-sm text-muted-foreground",children:s.workLocation||e.jsx("span",{className:"opacity-30",children:"—"})}),e.jsx(l,{children:x?e.jsxs("button",{onClick:()=>G(x),className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline",children:[e.jsx(te,{className:"w-3.5 h-3.5"})," View"]}):e.jsx("span",{className:"text-muted-foreground opacity-30 text-sm",children:"—"})})]}),e.jsx(l,{className:"text-sm text-muted-foreground",children:new Date(s.createdAt).toLocaleDateString()}),e.jsx(l,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:`/admin/people/${encodeURIComponent(s.email)}`,className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-primary transition-colors whitespace-nowrap",children:[e.jsx(ae,{className:"w-3 h-3"})," Profile"]}),e.jsx("button",{onClick:()=>U(s.id),className:"p-1 rounded text-muted-foreground hover:text-destructive transition-colors",title:"Delete",children:e.jsx(ne,{className:"w-3.5 h-3.5"})})]})})]},s.id)}):e.jsx(w,{children:e.jsxs(l,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:[e.jsx(T,{className:"w-8 h-8 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:o==="leads"?"No leads captured yet.":"No mailing list sign-ups yet."})]})})})]})})]})}export{Ne 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.