PageSourceSearch

https://quantumprocure.ai/assets/GPTStoreAnalytics-DL9QABgZ.js

js quantumprocure.ai collected 2026-10-05 15:47:47 UTC 7,790 bytes, 2 lines download raw bytes

1import{j as e}from"./ui-vendor-DQhJDdD7.js";import{r as P}from"./react-vendor-CpvRxpXI.js";import{as as w,B as U,C as l,d,U as G,Z as H,h as V,b as c,c as o,q as p,s as C}from"./index-CaxD6OMc.js";import{S as $,a as F,b as I,c as W,d as x}from"./select-BeRgQ1NG.js";import{T as Y,a as z,b as g,c as f}from"./tabs-BfHpKDEc.js";import{f as v}from"./format-b4E7PPmb.js";import{D as X}from"./download-CU1dQUzb.js";import{T as Z}from"./target-B5FHweF2.js";import{R as y,L as Q,C as L,X as _,Y as T,T as N,k as J,P as ee,l as se,m as ae,B as te,n as re}from"./charts-vendor-BGagbOlt.js";import{s as ne}from"./subDays-BYJOXUml.js";import"./supabase-vendor-B5blHikl.js";import"./index-BdQq_4o_.js";import"./index-ouPMw2vy.js";import"./chevron-up-CNpmaCo8.js";import"./en-US-BdoVNVtW.js";const le={"fema-pw":"#3b82f6","damage-lite":"#ef4444","supplier-finder":"#10b981","emergency-msg":"#f59e0b","wildlife-check":"#8b5cf6","claims-check":"#06b6d4"},we=()=>{const[m,S]=P.useState("7"),{data:r,isLoading:k}=w({queryKey:["gpt-store-leads",m],queryFn:async()=>{const s=ne(new Date,parseInt(m)),{data:a,error:t}=await C.from("gpt_store_leads").select("*").gte("created_at",s.toISOString()).order("created_at",{ascending:!1});if(t)throw t;return a||[]}}),{data:de}=w({queryKey:["gpt-store-agents"],queryFn:async()=>{const{data:s,error:a}=await C.from("gpt_store_agents").select("*").eq("is_active",!0);if(a)throw a;return s||[]}}),i=r?.length||0,h=r?.filter(s=>s.lead_score==="hot").length||0,j=r?.filter(s=>s.lead_score==="warm").length||0,D=r?.filter(s=>s.converted).length||0,R=i>0?(D/i*100).toFixed(1):"0",A=r?.reduce((s,a)=>{const t=a.agent_key||"unknown";return s[t]=(s[t]||0)+1,s},{})||{},B=Object.entries(A).map(([s,a])=>({agent:s.replace("-"," ").replace(/\b\w/g,t=>t.toUpperCase()),leads:a,fill:le[s]||"#6b7280"})),q=r?.reduce((s,a)=>{const t=v(new Date(a.created_at),"MMM dd");return s[t]=(s[t]||0)+1,s},{})||{},K=Object.entries(q).map(([s,a])=>({date:s,leads:a})).reverse(),b=[{name:"Hot",value:h,fill:"#ef4444"},{name:"Warm",value:j,fill:"#f59e0b"},{name:"Cold",value:i-h-j,fill:"#6b7280"}],M=()=>{if(!r?.length)return;const s=["Agent","Email","Organization","Summary","Score","Converted","Created At"],a=r.map(n=>[n.agent_key,n.user_email||"",n.user_organization||"",n.request_summary||"",n.lead_score||"",n.converted?"Yes":"No",n.created_at]),t=[s,...a].map(n=>n.join(",")).join(`
2`),O=new Blob([t],{type:"text/csv"}),E=URL.createObjectURL(O),u=document.createElement("a");u.href=E,u.download=`gpt-store-leads-${v(new Date,"yyyy-MM-dd")}.csv`,u.click()};return e.jsxs("div",{className:"container mx-auto py-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"GPT Store Analytics"}),e.jsx("p",{className:"text-muted-foreground",children:"Track lead generation and conversion from GPT Store micro-agents"})]}),e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs($,{value:m,onValueChange:S,children:[e.jsx(F,{className:"w-40",children:e.jsx(I,{})}),e.jsxs(W,{children:[e.jsx(x,{value:"7",children:"Last 7 days"}),e.jsx(x,{value:"14",children:"Last 14 days"}),e.jsx(x,{value:"30",children:"Last 30 days"}),e.jsx(x,{value:"90",children:"Last 90 days"})]})]}),e.jsxs(U,{onClick:M,variant:"outline",children:[e.jsx(X,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[e.jsx(l,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Leads"}),e.jsx("p",{className:"text-3xl font-bold",children:i})]}),e.jsx(G,{className:"h-8 w-8 text-primary"})]})})}),e.jsx(l,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Hot Leads"}),e.jsx("p",{className:"text-3xl font-bold text-red-500",children:h})]}),e.jsx(H,{className:"h-8 w-8 text-red-500"})]})})}),e.jsx(l,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Warm Leads"}),e.jsx("p",{className:"text-3xl font-bold text-amber-500",children:j})]}),e.jsx(V,{className:"h-8 w-8 text-amber-500"})]})})}),e.jsx(l,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Conversion Rate"}),e.jsxs("p",{className:"text-3xl font-bold text-green-500",children:[R,"%"]})]}),e.jsx(Z,{className:"h-8 w-8 text-green-500"})]})})})]}),e.jsxs(Y,{defaultValue:"overview",className:"space-y-4",children:[e.jsxs(z,{children:[e.jsx(g,{value:"overview",children:"Overview"}),e.jsx(g,{value:"agents",children:"By Agent"}),e.jsx(g,{value:"leads",children:"Lead List"})]}),e.jsx(f,{value:"overview",className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(o,{children:"Lead Trend"})}),e.jsx(d,{children:e.jsx("div",{className:"h-64",children:e.jsx(y,{width:"100%",height:"100%",children:e.jsxs(Q,{data:K,children:[e.jsx(L,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(_,{dataKey:"date",className:"text-xs"}),e.jsx(T,{className:"text-xs"}),e.jsx(N,{}),e.jsx(J,{type:"monotone",dataKey:"leads",stroke:"hsl(var(--primary))",strokeWidth:2})]})})})})]}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(o,{children:"Lead Score Distribution"})}),e.jsx(d,{children:e.jsx("div",{className:"h-64",children:e.jsx(y,{width:"100%",height:"100%",children:e.jsxs(ee,{children:[e.jsx(se,{data:b,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:s,value:a})=>`${s}: ${a}`,children:b.map((s,a)=>e.jsx(ae,{fill:s.fill},`cell-${a}`))}),e.jsx(N,{})]})})})})]})]})}),e.jsx(f,{value:"agents",children:e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(o,{children:"Leads by Agent"})}),e.jsx(d,{children:e.jsx("div",{className:"h-80",children:e.jsx(y,{width:"100%",height:"100%",children:e.jsxs(te,{data:B,layout:"vertical",children:[e.jsx(L,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(_,{type:"number"}),e.jsx(T,{dataKey:"agent",type:"category",width:120,className:"text-xs"}),e.jsx(N,{}),e.jsx(re,{dataKey:"leads",fill:"hsl(var(--primary))",radius:[0,4,4,0]})]})})})})]})}),e.jsx(f,{value:"leads",children:e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(o,{children:"Recent Leads"})}),e.jsx(d,{children:k?e.jsx("p",{className:"text-muted-foreground",children:"Loading leads..."}):e.jsxs("div",{className:"space-y-3 max-h-96 overflow-y-auto",children:[r?.slice(0,50).map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(p,{variant:"outline",children:s.agent_key}),e.jsx(p,{variant:s.lead_score==="hot"?"destructive":s.lead_score==="warm"?"default":"secondary",children:s.lead_score||"cold"}),s.converted&&e.jsx(p,{variant:"default",className:"bg-green-500",children:"Converted"})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:s.request_summary}),s.user_email&&e.jsx("p",{className:"text-xs text-muted-foreground",children:s.user_email})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:v(new Date(s.created_at),"MMM dd, HH:mm")}
2)]},s.id)),(!r||r.length===0)&&e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No leads found for this time period"})]})})]})})]})]})};export{we 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.