PageSourceSearch

https://clearsell.app/assets/reports-Z9LNcMwM.js

js clearsell.app collected 2026-10-02 01:14:32 UTC 4,592 bytes, 1 lines download raw bytes

1import{e as k,aO as A,j as e,a as t,U as C,ao as a,a3 as u,ad as D}from"./index-CQsCPMiJ.js";import{B as f,C as o}from"./shared-BZeBVdot.js";import{u as L}from"./use-page-title-B2FPq3IO.js";import{R as S}from"./report-generation-modal-Cv6iGEnN.js";import{T}from"./teaser-lock-BFpG8wYr.js";import{P as U}from"./package-CzcWqW-4.js";import{C as E}from"./calendar-BbFxK7VZ.js";import{D as P}from"./download-BXR6uZUs.js";import"./client-workspace-selector-DoTRKb5I.js";import"./use-admin-lmsoZXf6.js";import"./star-XwHECkEX.js";const i="";function Q(){L("Client Reports");const{user:c}=k(),j=c?.tier||"free";if(!(c?.isAdmin||A(j,"white-label-reports")))return e.jsx(T,{toolSlug:"white-label-reports",toolName:"White-Label Reports",children:e.jsx("div",{style:{padding:32,textAlign:"center",color:"#666"},children:"White-Label Reports requires Agency tier."})});const[d,m]=t.useState([]),[w,g]=t.useState(!0),[p,h]=t.useState(null),[N,r]=t.useState(!1),{toast:b}=C();t.useEffect(()=>{fetch(`${i}/api/agency/reports`,{credentials:"include"}).then(s=>s.ok?s.json():[]).then(m).catch(()=>{}).finally(()=>g(!1))},[]);const y=async s=>{h(s);try{const n=await fetch(`${i}/api/agency/reports/${s}/download`,{credentials:"include"});if(!n.ok)throw new Error("Download failed");const v=await n.blob(),x=URL.createObjectURL(v),l=document.createElement("a");l.href=x;const R=n.headers.get("Content-Disposition")?.match(/filename="(.+)"/);l.download=R?.[1]||"report.pdf",l.click(),URL.revokeObjectURL(x)}catch{b({title:"Download failed",variant:"destructive"})}finally{h(null)}};return e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white",children:"Client Reports"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"White-label competitive intelligence reports for your clients"})]}),e.jsxs(f,{onClick:()=>r(!0),className:"bg-purple-600 hover:bg-purple-700 text-white",children:[e.jsx(a,{className:"w-4 h-4 mr-2"}),"New Report"]})]}),w?e.jsx(o,{className:"p-12 flex items-center justify-center",children:e.jsx(u,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):d.length===0?e.jsxs(o,{className:"p-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-purple-500/10 flex items-center justify-center mx-auto mb-4",children:e.jsx(a,{className:"w-8 h-8 text-purple-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white mb-2",children:"No reports yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4 max-w-md mx-auto",children:"Generate your first white-label client report. Run some Frustration Finder scans, save them, then create a branded report."}),e.jsxs(f,{onClick:()=>r(!0),className:"bg-purple-600 hover:bg-purple-700 text-white",children:[e.jsx(a,{className:"w-4 h-4 mr-2"}),"Generate First Report"]})]}):e.jsx("div",{className:"space-y-3",children:d.map(s=>e.jsx(o,{className:"p-4 hover:border-purple-500/20 transition-colors",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4 min-w-0 flex-1",children:[e.jsx("div",{className:"p-2 rounded-lg bg-purple-500/10 shrink-0",children:e.jsx(a,{className:"w-5 h-5 text-purple-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-sm font-bold text-white truncate",children:s.reportTitle}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-1 text-xs text-muted-foreground",children:[s.clientName&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"w-3 h-3"})," ",s.clientName]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(U,{className:"w-3 h-3"})," ",s.analysisIds.length," product",s.analysisIds.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(E,{className:"w-3 h-3"})," ",new Date(s.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]})]})]}),e.jsxs("button",{onClick:()=>y(s.id),disabled:p===s.id,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-white/10 text-sm font-medium text-white hover:bg-white/5 transition-colors disabled:opacity-50 shrink-0",children:[p===s.id?e.jsx(u,{className:"w-4 h-4 animate-spin"}):e.jsx(P,{className:"w-4 h-4"}),"Download"]})]})},s.id))}),e.jsx(S,{open:N,onClose:()=>{r(!1),fetch(`${i}/api/agency/reports`,{credentials:"include"}).then(s=>s.ok?s.json():[]).then(m).catch(()=>{})}})]})}export{Q 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.