1import{f as p,j as e,L as h}from"./index-C3bYeAVA.js";import{b as s}from"./vendor-toast-DhlHen1U.js";import{J as g,K as j,R as N}from"./email-preview.functions-ByG_4Zx8.js";import{L as v}from"./lock-CVqi6jnl.js";import{M as y}from"./mail-WsVJzoyA.js";import"./vendor-validation-Cq2ukCOO.js";const f=[{id:"paid",label:"Paid",blurb:"Stripe cleared. Amount, item, and reference stated outright."},{id:"unpaid",label:"Unpaid (captured)",blurb:"Step one captured, money not cleared yet. Subject reads [UNPAID]."},{id:"abandoned",label:"Abandoned",blurb:"Thirty minutes passed with no payment. Outcome reads Abandoned."},{id:"party-multi-child",label:"Party â multiple children",blurb:"Birthday inquiry with a full party roster in the participants table."}];function P(){const i=p(g),n=p(j),[d,o]=s.useState(null),[r,b]=s.useState("paid"),[a,c]=s.useState(null),[m,u]=s.useState(!1);if(s.useEffect(()=>{let t=!0;return i({}).then(l=>{t&&o(l.unlocked)}).catch(()=>{t&&o(!1)}),()=>{t=!1}},[i]),s.useEffect(()=>{if(!d)return;let t=!0;return u(!0),n({data:{scenario:r}}).then(l=>{t&&c(l)}).catch(()=>{t&&c(null)}).finally(()=>{t&&u(!1)}),()=>{t=!1}},[n,r,d]),d===!1)return e.jsxs("main",{className:"mx-auto flex min-h-[60vh] max-w-xl flex-col items-center justify-center gap-4 px-6 text-center",children:[e.jsx(v,{className:"size-8 text-muted-foreground","aria-hidden":!0}),e.jsx("h1",{className:"font-display text-2xl text-foreground",children:"Staff email preview"}),e.jsx("p",{className:"text-muted-foreground",children:"This page is internal. Unlock the dashboard first and come back."}),e.jsx(h,{to:"/dashboard",search:{tab:"forms",view:void 0,form:void 0},className:"rounded-full bg-brand-primary-deep px-5 py-2 font-semibold text-brand-primary-foreground",children:"Go to the dashboard"})]});const x=f.find(t=>t.id===r);return e.jsxs("main",{className:"mx-auto max-w-5xl px-6 py-10",children:[e.jsxs("header",{className:"mb-6",children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-brand-primary-deep",children:[e.jsx(y,{className:"size-4","aria-hidden":!0})," Internal preview"]}),e.jsx("h1",{className:"font-display text-3xl text-foreground",children:"Staff email preview"}),e.jsx("p",{className:"mt-2 max-w-2xl text-muted-foreground",children:"The exact notification template staff receive, rendered with live template values. Nothing here sends mail or touches a real submission."})]}),e.jsx("div",{className:"mb-6 flex flex-wrap gap-2",children:f.map(t=>e.jsx("button",{type:"button",onClick:()=>b(t.id),"aria-pressed":t.id===r,className:t.id===r?"rounded-full bg-brand-primary-deep px-4 py-2 text-sm font-semibold text-brand-primary-foreground":"rounded-full border border-border px-4 py-2 text-sm font-semibold text-foreground hover:bg-muted",children:t.label},t.id))}),x?e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:x.blurb}):null,m?e.jsxs("p",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(N,{className:"size-4 animate-spin","aria-hidden":!0})," Renderingâ¦"]}):null,a?.ok?e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Subject line"}),e.jsx("p",{className:"font-semibold text-foreground",children:a.subject}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Goes to: ",a.recipients.join(", ")]})]}),e.jsx("iframe",{title:`Staff email preview â ${r}`,srcDoc:a.html,className:"h-[900px] w-full rounded-xl border border-border bg-white"}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Template values in this render"}),e.jsx("dl",{className:"grid gap-x-6 gap-y-1 sm:grid-cols-2",children:a.rows.map(t=>e.jsxs("div",{className:"flex gap-2 text-sm",children:[e.jsxs("dt",{className:"shrink-0 font-medium text-muted-foreground",children:[t.label,":"]}
1),e.jsx("dd",{className:"text-foreground",children:t.value})]},`${t.label}-${t.value}`))})]})]}):null,!m&&a&&!a.ok?e.jsx("p",{className:"text-muted-foreground",children:"Preview unavailable â unlock the dashboard and reload."}):null]})}export{P 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.