PageSourceSearch

https://blisshousestudios.com/assets/admin.export-leads-CuhVMfzD.js

js blisshousestudios.com collected 2026-10-04 14:39:42 UTC 2,845 bytes, 3 lines download raw bytes

1import{d as x,j as e,r as c,t as b}from"./index-zQ28h6J3.js";import{u as f}from"./useServerFn-C6c5hgZC.js";import{c as h}from"./createServerFn-DXWxxDTW.js";import{r as j}from"./code-middleware-vCKd7Kl8.js";import{A as g}from"./AdminGate-DjsOGBxm.js";const y=h({method:"GET"}).middleware([j]).handler(x("8d09f38ba1c223672a419b3a69b42acd986c4541481b83c2646ba53b8842b293")),N="blisshouse",m=["email","name","phone","notes","utm_source","utm_medium","utm_campaign","utm_content","campaign","submitted_at"];function w(r){return/[",\r\n]/.test(r)?`"${r.replace(/"/g,'""')}"`:r}function E(r){const t=[];t.push(m.join(","));for(const n of r)t.push(m.map(d=>w(String(n[d]??""))).join(","));return t.join(`\r
2`)+`\r
3`}function v(){const r=f(y),[t,n]=c.useState(null),[d,l]=c.useState(!0);c.useEffect(()=>{l(!0),r({data:void 0}).then(s=>n(s)).catch(s=>b.error(s instanceof Error?s.message:"Failed to load")).finally(()=>l(!1))},[r]);function u(){if(!t)return;const s=E(t.rows),a=new Blob(["\uFEFF"+s],{type:"text/csv;charset=utf-8"}),i=URL.createObjectURL(a),p=new Date().toISOString().slice(0,10),o=document.createElement("a");o.href=i,o.download=`${N}-leads-${p}.csv`,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(i)}return e.jsxs("div",{className:"mx-auto max-w-2xl px-6 py-16",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-muted-foreground",children:"Admin"}),e.jsx("h1",{className:"mb-8 font-display text-3xl",children:"Export Leads"}),d?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading leads…"}):t?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-2xl border border-border bg-card/40 p-6",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-muted-foreground",children:"Total rows"}),e.jsx("p",{className:"font-display text-4xl",children:t.total})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-card/40 p-6",children:[e.jsx("p",{className:"mb-3 text-xs uppercase tracking-[0.18em] text-muted-foreground",children:"Breakdown by form"}),e.jsxs("ul",{className:"space-y-1 text-sm",children:[Object.entries(t.breakdown).sort((s,a)=>a[1]-s[1]).map(([s,a])=>e.jsxs("li",{className:"flex justify-between border-b border-border/40 py-1.5",children:[e.jsx("span",{children:s}),e.jsx("span",{className:"font-medium",children:a})]},s)),Object.keys(t.breakdown).length===0&&e.jsx("li",{className:"text-muted-foreground",children:"No leads yet."})]})]}),e.jsx("button",{onClick:u,disabled:t.total===0,className:"w-full rounded-full bg-primary px-6 py-4 text-sm uppercase tracking-[0.18em] text-primary-foreground disabled:opacity-50",children:"Download all leads as CSV"})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No data."})]})}const A=()=>e.jsx(g,{children:e.jsx(v,{})});export{A 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.