PageSourceSearch

https://stuartandrews.me/assets/CommandCentrePlatformPanel-0fqQwOJu.js

js stuartandrews.me collected 2026-09-24 22:18:46 UTC 10,033 bytes, 1 lines download raw bytes

1import{r as a,j as e}from"./react-vendor-DHsc3z8R.js";import{M as h,j as g}from"./index-D70tPUFV.js";import{U as b}from"./users-L8YqcNFi.js";import{C as f}from"./credit-card-_LsVMXN5.js";import{C as j}from"./clock-DRmGwmeo.js";import{C as N}from"./circle-alert-Dyl6ivaA.js";import{C as v}from"./chart-column-6QrhEeEI.js";import{Z as y}from"./zap-DHT0pPwN.js";import{T as w}from"./trending-up-rd2Rru8q.js";import"./query-vendor-BpSM1h0G.js";import"./ui-vendor-CSbCjZRx.js";import"./motion-vendor-BtpmimIC.js";function l(d){switch((d||"usd").toLowerCase()){case"gbp":return"£";case"eur":return"€";case"aud":case"cad":return"A$";default:return"$"}}const C=[{label:"Churn risk analysis",prompt:"Identify the 5 members most at risk of churning, explain why based on their activity data, and draft a personalised re-engagement email for each."},{label:"Retention deep-dive",prompt:"Conduct a full retention analysis: show me the data patterns, identify the key drop-off points, and suggest 3 program changes that would improve 30-day retention."},{label:"Revenue snapshot + action",prompt:"Give me a full revenue snapshot for this month — MRR, churn, new subscribers — then suggest the single highest-impact action I could take to grow MRR by 10%."},{label:"Member health report",prompt:"Generate a member health report: tier breakdown, idle members, high-urgency leads, CAP engagement rates, and a priority action list for this week."}],o=["enterprise","professional","free"],k={enterprise:"text-[hsl(var(--accent-gold))]",professional:"text-info",starter:"text-success",free:"text-muted-foreground"};function U({token:d,onInjectPrompt:c}){const[s,i]=a.useState(null),[x,m]=a.useState(!0),[p,n]=a.useState(!1);return a.useEffect(()=>{(async()=>
1{try{const r=await fetch("/api/admin/health/snapshot",{headers:{...g()}});r.ok?i(await r.json()):n(!0)}catch(r){console.error("Failed to load platform snapshot",r),n(!0)}finally{m(!1)}})()},[d]),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-widest font-semibold mb-2",children:"Platform Health Snapshot"}),x?e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[1,2,3,4].map(t=>e.jsx("div",{className:"h-14 rounded-lg bg-secondary/50 animate-pulse"},t))}):p?e.jsx("p",{className:"text-xs text-muted-foreground py-2",children:"Snapshot unavailable — ask the AI for live metrics"}):s&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"rounded-lg bg-secondary/50 border border-border/40 px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(b,{className:"w-3 h-3 text-info"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Total Members"})]}),e.jsx("p",{className:"text-base font-bold text-info",children:s.members.total}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[s.members.active," active"]})]}),e.jsxs("div",{className:"rounded-lg bg-secondary/50 border border-border/40 px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(f,{className:"w-3 h-3 text-success"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Subscribers"})]}),e.jsx("p",{className:"text-base font-bold text-success",children:s.members.withActiveSubscription}),s.members.pastDue>0&&e.jsxs("p",{className:"text-[10px] text-warning",children:[s.members.pastDue," past due"]})]}),e.jsxs("div",{className:"rounded-lg bg-secondary/50 border border-border/40 px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(j,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Idle 14+ days"})]}),e.jsx("p",{className:`text-base font-bold ${s.leads.idleOver14Days>5?"text-warning":"text-muted-foreground"}`,children:s.leads.idleOver14Days}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[s.leads.recentSignups7Days," new this week"]})]}),e.jsxs("div",{className:"rounded-lg bg-secondary/50 border border-border/40 px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(N,{className:"w-3 h-3 text-destructive"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"High urgency"})]}),e.jsx("p",{className:`text-base font-bold ${s.leads.highUrgencyNotPurchased>0?"text-destructive":"text-muted-foreground"}`,children:s.leads.highUrgencyNotPurchased}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"not purchased"})]})]}),e.jsxs("div",{className:"rounded-lg bg-secondary/40 border border-border/40 px-3 py-2",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground mb-1.5 uppercase tracking-widest font-semibold",children:"Tier Breakdown"}),e.jsxs("div",{className:"space-y-1",children:[o.filter(t=>s.members.byTier[t]!=null).map(t=>{const r=s.members.byTier[t]??0,u=s.members.total>0?Math.round(r/s.members.total*100):0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-[10px] font-medium capitalize w-20 shrink-0 ${k[t]??"text-muted-foreground"}`,children:t}),e.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-secondary overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-current opacity-60",style:{width:`${u}%`,color:"inherit"}})}),e.jsx("span",{className:"text-[10px] text-muted-foreground w-6 text-right",children:r})]},t)}),Object.keys(s.members.byTier).filter(t=>!o.includes(t)).map(t=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] font-medium capitalize w-20 shrink-0 text-muted-foreground",children:t}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:s.members.byTier[t]})]},t))]})]}),s.revenue&&e.jsxs("div",{className:"rounded-lg bg-secondary/40 border border-border/40 px-3 py-2",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground mb-1.5 uppercase tracking-widest font-semibold",children:"Revenue Summary"}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Last 30 days"}),e.jsxs("p",{className:`text-sm font-bold ${s.revenue.last30Days>0?"text-success":"text-muted-foreground"}`,children:[l(s.revenue.currency),s.revenue.last30Days.toLocaleStr
1ing()]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"All time"}),e.jsxs("p",{className:"text-sm font-bold text-info",children:[l(s.revenue.currency),s.revenue.allTime.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Active subs"}),e.jsx("p",{className:"text-sm font-bold text-info",children:s.revenue.activeSubscribers})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Purchases (30d)"}),e.jsx("p",{className:"text-sm font-bold text-accent-gold-ink",children:s.revenue.purchasesLast30Days})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.newsletter&&e.jsxs("div",{className:"rounded-lg bg-secondary/50 border border-border/40 px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(h,{className:"w-3 h-3 text-info"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Newsletter"})]}),e.jsx("p",{className:"text-base font-bold text-info",children:s.newsletter.total}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[s.newsletter.active," active"]})]}),s.email.campaignCount>0&&e.jsxs("div",{className:"rounded-lg bg-secondary/50 border border-border/40 px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(v,{className:"w-3 h-3 text-info"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Email open rate"})]}),e.jsxs("p",{className:`text-base font-bold ${s.email.avgOpenRateLast90Days>=30?"text-success":s.email.avgOpenRateLast90Days>=15?"text-warning":"text-muted-foreground"}`,children:[s.email.avgOpenRateLast90Days,"%"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"avg last 90 days"})]}),e.jsxs("div",{className:"rounded-lg bg-secondary/50 border border-border/40 px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(y,{className:"w-3 h-3 text-accent-gold"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Diagnostics"})]}),e.jsx("p",{className:"text-base font-bold text-accent-gold-ink",children:s.leads.totalDiagnosticSessions}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"sessions total"})]}),e.jsxs("div",{className:"rounded-lg bg-secondary/50 border border-border/40 px-2.5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(w,{className:"w-3 h-3 text-success"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Purchases"})]}),e.jsx("p",{className:"text-base font-bold text-success",children:s.leads.totalPurchases}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"all time"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-widest font-semibold mb-2",children:"Multi-step Outcome Chains"}),e.jsx("div",{className:"space-y-1.5",children:C.map(t=>e.jsxs("button",{onClick:()=>c(t.prompt),className:"w-full text-left px-3 py-2 rounded-lg bg-secondary/50 border border-border/40 hover:border-info/40 hover:bg-info/5 transition-colors group",children:[e.jsx("p",{className:"text-xs font-medium text-foreground group-hover:text-info transition-colors",children:t.label}),e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5 line-clamp-1",children:[t.prompt.slice(0,80),"…"]})]},t.label))})]})]})}export{U as CommandCentrePlatformPanel};

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.