1import{r as a,j as e}from"./index-Dz7N0PDB.js";function j(i){return new Date(i).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}function A(i){if(!i.length)return"";const o=["ID","Captured At","Name","Email","Company","Title","Industry","Size","Maturity","Pain Point","Privacy Consent"],d=i.map(n=>[n.id,new Date(n.generatedAt).toISOString(),n.name,n.email,n.company,n.title,n.industry,n.size,n.maturity,n.painPointCategory,n.privacyConsent?"Yes":"No"].map(r=>`"${String(r).replace(/"/g,'""')}"`).join(","));return[o.join(","),...d].join(` 2`)}function S(i){const o=A(i),d=new Blob([o],{type:"text/csv"}),n=URL.createObjectURL(d),r=document.createElement("a");r.href=n,r.download=`roadmap-leads-${new Date().toISOString().slice(0,10)}.csv`,r.click(),URL.revokeObjectURL(n)}const w={healthcare:"#10B981",manufacturing:"#F59E0B",financial_services:"#3B82F6",retail:"#EC4899",technology:"#8B5CF6",professional_services:"#06B6D4",education:"#EF4444",logistics:"#F97316"};function y(i,o="#3B82F6"){return e.jsx("span",{style:{padding:"2px 10px",borderRadius:20,fontSize:11,fontWeight:600,background:o+"22",color:o},children:i})}function F(){const[i,o]=a.useState(""),[d,n]=a.useState(!1),[r,p]=a.useState(!1),[g,f]=a.useState(""),[l,m]=a.useState([]),[h,v]=a.useState(""),x=async t=>{p(!0),f("");try{const s=await fetch("/api/roadmap/leads",{headers:{"x-admin-key":t}});if(s.status===401){f("Incorrect password."),p(!1);return}if(!s.ok)throw new Error("Server error");const u=await s.json();m(u),n(!0)}catch{f("Failed to connect. Please try again.")}p(!1)},b=t=>{t.preventDefault(),x(i)},c=l.filter(t=>
2{if(!h)return!0;const s=h.toLowerCase();return[t.name,t.email,t.company,t.title,t.industry,t.painPointCategory].some(u=>u.toLowerCase().includes(s))});return d?e.jsxs("div",{style:{minHeight:"100vh",background:"#0F0F0F",fontFamily:"'Inter', sans-serif",color:"#fff"},children:[e.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",rel:"stylesheet"}),e.jsxs("div",{style:{padding:"18px 32px",borderBottom:"1px solid #1E1E1E",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[e.jsxs("span",{style:{fontSize:18,fontWeight:700},children:["mith",e.jsx("span",{style:{color:"#3B82F6"},children:"AI"})]}),e.jsx("span",{style:{width:1,height:18,background:"#2A2A2A"}}),e.jsx("span",{style:{fontSize:13,color:"#666"},children:"Roadmap Leads"})]}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("button",{"data-testid":"button-refresh",onClick:()=>x(i),style:{padding:"8px 16px",borderRadius:8,border:"1px solid #3A3A3A",background:"#222",color:"#fff",fontSize:13,cursor:"pointer",fontFamily:"'Inter', sans-serif",fontWeight:500},onMouseEnter:t=>{t.currentTarget.style.background="#2A2A2A"},onMouseLeave:t=>{t.currentTarget.style.background="#222"},children:"â» Refresh"}),e.jsx("button",{"data-testid":"button-download-csv",onClick:()=>S(c),style:{padding:"8px 16px",borderRadius:8,border:"none",background:"#3B82F6",color:"#fff",fontSize:13,fontWeight:600,cursor:"pointer"},children:"â Download CSV"})]})]}),e.jsxs("div",{style:{maxWidth:1200,margin:"0 auto",padding:"32px 24px"},children:[e.jsx("div",{style:{display:"flex",gap:16,marginBottom:28,flexWrap:"wrap"},children:[{label:"Total Leads",value:l.length},{label:"Showing",value:c.length},{label:"Unique Companies",value:new Set(l.map(t=>t.company)).size},{label:"Unique Industries",value:new Set(l.map(t=>t.industry)).size}].map(t=>e.jsxs("div",{style:{background:"#1A1A1A",borderRadius:12,padding:"16px 24px",border:"1px solid #2A2A2A",flex:"1 1 160px"},children:[e.jsx("div",{"data-testid":`stat-${t.label.toLowerCase().replace(/\s+/g,"-")}`,style:{fontSize:28,fontWeight:700,color:"#fff"},children:t.value}),e.jsx("div",{style:{fontSize:12,color:"#666",marginTop:2},children:t.label})]},t.label))}),e.jsx("div",{style:{marginBottom:20},children:e.jsx("input",{"data-testid":"input-search",placeholder:"Search by name, email, company, industryâ¦",value:h,onChange:t=>v(t.target.value),style:{width:"100%",maxWidth:400,padding:"10px 14px",borderRadius:8,border:"1px solid #2A2A2A",background:"#1A1A1A",color:"#fff",fontSize:13,outline:"none",fontFamily:"inherit",boxSizing:"border-box"}})}),e.jsxs("div",{style:{background:"#1A1A1A",borderRadius:12,border:"1px solid #2A2A2A",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 2fr 2fr 1.5fr 1.2fr 1.2fr 1.2fr 1.4fr 1.2fr 1.6fr",gap:0,padding:"10px 20px",borderBottom:"1px solid #222",fontSize:11,color:"#555",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em"},children:[e.jsx("div",{children:"Name"}),e.jsx("div",{children:"Email"}),e.jsx("div",{children:"Company"}),e.jsx("div",{children:"Title"}),e.jsx("div",{children:"Industry"}),e.jsx("div",{children:"Size"}),e.jsx("div",{children:"Maturity"}),e.jsx("div",{children:"Pain Point"}),e.jsx("div",{children:"Consent"}),e.jsx("div",{children:"Captured"})]}),c.length===0?e.jsx("div",{"data-testid":"text-no-leads",style:{padding:48,textAlign:"center",color:"#555"},children:l.length===0?"No leads captured yet.":"No results match your search."}):c.map((t,s)=>e.jsxs("div",{"data-testid":`row-lead-${t.id}`,style:{display:"grid",gridTemplateColumns:"2fr 2fr 2fr 1.5fr 1.2fr 1.2fr 1.2fr 1.4fr 1.2fr 1.6fr",gap:0,padding:"12px 20px",borderBottom:s<c.length-1?"1px solid #222":"none",background:s%2===0?"transparent":"#151515",alignItems:"center"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#fff",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},children:t.name}),e.jsx("div",{style:{fontSize:12,color:"#aaa",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},children:t.email}),e.jsx("div",{style:{fontSize:13,color:"#ccc",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},children:t.company}),e.jsx("div",{style:{fontSize:12,color:"#888",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},children:t.title}),e.jsx("div",{children:y(t.industry,w[t.industry]||"#3B82F6")}),e.jsx("div",{style:{fontSize:12,color:"#888"},children:t.size}),e.jsx("div",{style:{fontSize:12,color:"#888"},children:t.maturity}),e.jsx("div",{children:y(t.painPointCategory,"#F59E0B")}),e.jsx("div",{children:e.jsx("span",{"data-testid":`badge-consent-${t.id}`,title:t.privacyConsent?"Agreed to privacy notice":"No privacy consent on record",style:{padding:"2px 10px",borderRadius:20,fontSize:11,fontWeight:600,background:t.privacyConsent?"#10B98122":"#EF444422",color:t.privacyConsent?"#10B981":"#EF4444"},children:t.privacyConsent?"â Consent":"â No consent"})}),e.jsx("div",{style:{fontSize:12,color:"#555"},children:j(t.generatedAt)})]},t.id))]})]})]}):e.jsxs("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#0F0F0F",fontFamily:"'Inter', sans-serif"},children:[e.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",rel:"stylesheet"}),e.jsxs("div",{style:{background:"#1A1A1A",borderRadius:16,padding:"40px 48px",border:"1px solid #2A2A2A",width:"100%",maxWidth:400,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:22,fontWeight:700,color:"#fff",marginBottom:4}
2,children:["mith",e.jsx("span",{style:{color:"#3B82F6"},children:"AI"})]}),e.jsx("div",{style:{fontSize:13,color:"#666",marginBottom:32},children:"Roadmap Leads Admin"}),e.jsxs("form",{onSubmit:b,style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("input",{"data-testid":"input-admin-password",type:"password",placeholder:"Admin password",value:i,onChange:t=>o(t.target.value),autoFocus:!0,style:{padding:"12px 16px",borderRadius:10,border:"1.5px solid #2A2A2A",background:"#111",color:"#fff",fontSize:14,outline:"none",fontFamily:"inherit"},onFocus:t=>t.target.style.borderColor="#3B82F6",onBlur:t=>t.target.style.borderColor="#2A2A2A"}),g&&e.jsx("div",{"data-testid":"text-error",style:{fontSize:13,color:"#EF4444"},children:g}),e.jsx("button",{"data-testid":"button-admin-login",type:"submit",disabled:r||!i,style:{padding:"12px",borderRadius:10,border:"none",background:r?"#2A2A2A":"#3B82F6",color:"#fff",fontSize:14,fontWeight:600,cursor:r?"default":"pointer",fontFamily:"inherit"},children:r?"Checkingâ¦":"Sign In"})]})]})]})}export{F 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.