1import{j as e,u as M}from"./vendor-query-nkyHp8gL.js";import{r as h}from"./vendor-react-BNT0nzvx.js";import H from"./purify.es-C5KSVp3G.js";import{D as W,C as Y}from"./DashboardLayout-BwqfxABs.js";import{W as $,O as E,n as C,A as V,D as K,E as G,F as Z,B as j,i as Q,o as D,s as v}from"./index-UlqsakHc.js";import{B as f}from"./badge-BgKH0HTc.js";import{I as X}from"./input-O_nO28FK.js";import{T as J,a as ee,b as A,c as L}from"./tabs-BPaWoc3R.js";import{D as U,b as _,c as O,d as F,e as R}from"./dialog-DV4xISIc.js";import{S as te,a as se,b as ie,c as ae,d as P}from"./select-IvvOJAhn.js";import{A as re}from"./activity-CVC2WoCt.js";import{M as w}from"./mail-bMhm6fVu.js";import{C as q}from"./circle-check-big-CXTDCy6D.js";import{C as ne}from"./circle-x-D07oMaC7.js";import{C as oe}from"./chevron-left-HX6_oF1L.js";import{C as le}from"./chevron-right-Cm0QdkHJ.js";import{E as de}from"./eye-Ca0Gb1H3.js";import{S as B}from"./send-DDsiLTn-.js";import{U as ce}from"./user-plus-97vZbADw.js";import{Z as me}from"./zap-BAJFvq0y.js";import{T as pe}from"./triangle-alert-trOYIJ2e.js";import{D as z}from"./dollar-sign-DtyJZyrZ.js";import{S as xe}from"./shield-DMA6z9Kg.js";import{f as ue,s as he}from"./format-BzsegFfT.js";import{s as ge}from"./subDays-B7ip3uR_.js";import"./input-otp-zCOwu37W.js";import"./shield-check-D_dnqQxv.js";import"./mail-check-B9b1HxOk.js";import"./users-C1fVyj3Z.js";import"./newspaper-DDM9CgLF.js";import"./crown-DVNd9quJ.js";import"./target-nBqdJqET.js";import"./list-CEIXZF2y.js";import"./flag-CwDWn1bT.js";import"./vendor-ui-DPPUfW-O.js";import"./vendor-charts-B_MCcq71.js";import"./vendor-supabase-BRDBMtg7.js";import"./index-BdQq_4o_.js";import"./index-DcdyMenS.js";import"./chevron-up-DVkSX4kh.js";import"./check-7w7r-eFz.js";import"./en-US-Dli8qwSn.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const fe=$("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),k=30,S={welcome:"Welcome","reset-password":"Password Reset","listing-activated":"Listing Activated","expiry-warning":"Expiry Warning","listing-expired":"Listing Expired","bump-reminder":"Bump Reminder","listing-verified":"Listing Verified","incomplete-reminder":"Incomplete Reminder","weekly-stats":"Weekly Stats","admin-email":"Admin Email","ban-notification":"Ban Notification","invoice-created-user":"Invoice (User)","invoice-created-admin":"Invoice (Admin)","invoice-link-sent":"Payment Link","invoice-status-request":"Status Check","invoice-confirmed":"Payment Confirmed","card-eligible-invite":"Card Invite","crypto-deposit-confirmed":"Crypto Confirmed","crypto-deposit-failed":"Crypto Failed","admin-topup-notification":"Top-Up (Admin)","seo-score-alert":"SEO Alert","outreach-email":"Outreach","test-outreach":"Test Outreach","contact-form":"Contact Form","send-expiry-warnings":"Expiry Batch","send-weekly-stats":"Stats Batch","send-bump-reminders":"Bump Batch","send-incomplete-reminders":"Incomplete Batch"},ye=i=>i.includes("welcome")||i.includes("activated")?"text-green-600":i.includes("expir")||i.includes("warning")?"text-amber-600":i.includes("invoice")||i.includes("payment")||i.includes("crypto")||i.includes("topup")?"text-blue-600":i.includes("ban")?"text-red-600":i.includes("outreach")?"text-purple-600":"text-foreground",be=(i,l,r)=>M({queryKey:["email-log",i,l,r],queryFn:async()=>{let d=v.from("email_log").select("*",{count:"exact"}).order("created_at",{ascending:!1}).range(i*k,(i+1)*k-1);l&&(d=d.ilike("recipient",`%${l}%`)),r&&r!=="all"&&(d=d.eq("action",r));const{data:m,error:x,count:p}=await d;if(x)throw x;const u=m??[],n=[...new Set(u.map(a=>a.recipient))],t={};if(n.length>0){const{data:a}=await v.from("profiles").select("id, email").in("email",n);if(a?.length){const c=a.map(g=>g.id),{data:o}=await v.rpc("get_user_types",{_user_ids:c});if(o){const g={};for(const y of o)g[y.user_id]=y.user_type;for(const y of a)t[y.email]=g[y.id]||"user"}}}return{logs:u,totalCount:p??0,roleMap:t}}}),je=()=>M({queryKey:["email-stats"],queryFn:async()=>{const{data:i,error:l}=await v.from("email_log").select("created_at, status, action").order("created_at",{ascending:!1}).limit(5e3);if(l)throw l;const r=i??[],d=new Date,m=he(d).toISOString(),x=ge(d,7).toISOString();let p=0,u=0,n=0;const t={};for(const c of r)c.created_at>=m&&p++,c.created_at>=x&&u++,c.status==="failed"&&n++,t[c.action]=(t[c.action]||0)+1;const a=Object.entries(t).sort((c,o)=>o[1]-c[1]).slice(0,5);return{total:r.length,today:p,week:u,failed:n,topActions:a}},staleTime:3e4});function ve(){const[i,l]=h.useState(0),[r,d]=h.useState(""),[m,x]=h.useState(""),[p,u]=h.useState("all"),[n,t]=h.useState(null),{data:a,isLoading:c}=be(i,m,p),{data:o}
6=je(),g=h.useState(null),y=s=>{d(s),g[0]&&clearTimeout(g[0]),g[1](setTimeout(()=>{x(s),l(0)},400))},N=Math.ceil((a?.totalCount??0)/k);return e.jsxs("div",{className:"space-y-4",children:[o&&e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"bg-card border border-border rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Today"}),e.jsx("p",{className:"text-xl font-semibold text-foreground",children:o.today})]}),e.jsxs("div",{className:"bg-card border border-border rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"This Week"}),e.jsx("p",{className:"text-xl font-semibold text-foreground",children:o.week})]}),e.jsxs("div",{className:"bg-card border border-border rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"All Time"}),e.jsx("p",{className:"text-xl font-semibold text-foreground",children:o.total})]}),e.jsxs("div",{className:"bg-card border border-border rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Failed"}),e.jsx("p",{className:`text-xl font-semibold ${o.failed>0?"text-destructive":"text-foreground"}`,children:o.failed})]})]}),o&&o.topActions.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.topActions.map(([s,b])=>e.jsxs(f,{variant:"secondary",className:"text-xs",children:[S[s]||s,": ",b]},s))}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(E,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(X,{placeholder:"Search recipient email...",value:r,onChange:s=>y(s.target.value),className:"pl-9 h-9 text-sm"})]}),e.jsxs(te,{value:p,onValueChange:s=>{u(s),l(0)},children:[e.jsx(se,{className:"w-[180px] h-9 text-sm",children:e.jsx(ie,{placeholder:"All types"})}),e.jsxs(ae,{children:[e.jsx(P,{value:"all",children:"All types"}),Object.entries(S).map(([s,b])=>e.jsx(P,{value:s,children:b},s))]})]})]}),c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(C,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):a?.logs.length?e.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-muted/50 border-b border-border",children:[e.jsx("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground text-xs",children:"Time"}),e.jsx("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground text-xs",children:"Recipient"}),e.jsx("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground text-xs",children:"Role"}),e.jsx("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground text-xs",children:"Type"}),e.jsx("th",{className:"text-left px-3 py-2 font-medium text-muted-foreground text-xs",children:"Subject"}),e.jsx("th",{className:"text-center px-3 py-2 font-medium text-muted-foreground text-xs",children:"Status"}),e.jsx("th",{className:"text-center px-3 py-2 font-medium text-muted-foreground text-xs",children:"View"})]})}),e.jsx("tbody",{children:a.logs.map(s=>e.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/20 transition-colors",children:[e.jsx("td",{className:"px-3 py-2 whitespace-nowrap text-xs text-muted-foreground",children:ue(new Date(s.created_at),"MMM d, HH:mm")}),e.jsx("td",{className:"px-3 py-2 text-xs font-mono truncate max-w-[200px]",children:s.recipient}),e.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:(()=>{const b=a?.roleMap?.[s.recipient];return b==="advertiser"?e.jsx(f,{variant:"secondary",className:"text-xs",children:"Advertiser"}):b==="client"?e.jsx(f,{variant:"outline",className:"text-xs",children:"Client"}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"â"})})()}),e.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:e.jsx("span",{className:`text-xs font-medium ${ye(s.action)}`,children:S[s.action]||s.action})}),e.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground truncate max-w-[250px]",children:s.subject||"â"}),e.jsx("td",{className:"px-3 py-2 text-center",children:e.jsx(V,{children:s.status==="sent"?e.jsxs(f,{variant:"secondary",className:"text-xs gap-1 bg-green-500/10 text-green-600 border-green-500/20",children:[e.jsx(q,{className:"w-3 h-3"})," Sent"]}):e.jsxs(K,{children:[e.jsx(G,{asChild:!0,children:e.jsxs(f,{variant:"destructive",className:"text-xs gap-1 cursor-help",children:[e.jsx(ne,{className:"w-3 h-3"})," Failed"]})}),e.jsx(Z,{side:"top",className:"max-w-[300px] text-xs",children:s.error||"Unknown error"})]})})}),e.jsx("td",{className:"px-3 py-2 text-center",children:e.jsx(j,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>t(s),title:"Preview email",children:e.jsx(E,{className:"w-3.5 h-3.5"})})})]},s.id))})]})})}):e.jsxs("div",{className:"text-center py-12 text-muted-foreground text-sm",children:[e.jsx(w,{className:"w-8 h-8 mx-auto mb-2 opacity-30"}),"No emails logged yet. Emails will appear here after the next send."]}),N>1&&e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[a?.totalCount," total emails"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{variant:"outline",size:"sm",className:"h-7 text-xs",disabled:i===0,onClick:()=>{l(s=>s-1),window.scrollTo({top:0,behavior:"instant"})},children:[e.jsx(oe,{className:"w-3 h-3 mr-1"})," Prev"]}),e.jsxs("span",{children:["Page ",i+1," of ",N]}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-7 text-xs",disabled:i>=N-1,onClick:()=>{l(s=>s+1),window.scrollTo({top:0,behavior:"instant"})},children:["Next ",e.jsx(le,{className:"w-3 h-3 ml-1"})]})]})]}),e.jsx(U,{open:!!n,onOpenChange:()=>t(null),children:e.jsxs(_,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[e.jsxs(O,{children:[e.jsxs(F,{className:"flex items-center gap-2",children:[e.jsx(w,{className:"w-4 h-4"})," Email Preview"]}),e.jsx(R,{children:e.jsxs("span",{className:"font-mono text-xs",children:["To: ",n?.recipient," ⢠",n?.subject||"No subject"]})})]}),n?.metadata?.html_body?e.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-white",children:[e.jsxs("div",{className:"bg-secondary/30 px-4 py-2 border-b border-border flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-destructive/40"}),e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-amber-400/40"}),e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-400/40"})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"Email Preview"})]}),e.jsx("iframe",{srcDoc:n.metadata.html_body,sandbox:"",className:"w-full min-h-[400px] border-0",title:"Email preview"})]}):e.jsxs("div",{className:"text-center py-12 text-muted-foreground text-sm",children:[e.jsx(w,{className:"w-8 h-8 mx-auto mb-2 opacity-30"}),"Preview not available for this email (sent before preview tracking was enabled)."]})]})})]})}const T=[{id:"welcome",name:"Welcome Email",description:"Sent when a new user signs up",trigger:"Automatic â on signup (DB trigger)",recipient:"user",category:"onboarding",action:"welcome",icon:ce,sampleSubject:"Welcome to RubPage!",sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Welcome to RubPage, Sarah!</h1><p style="color:#555;font-size:15px;line-height:1.6;">Your account has been created successfully.</p></div>`},{id:"reset-password",name:"Password Reset",description:"Sent when a user requests a password reset",trigger:"User-initiated via Forgot Password",recipient:"user",category:"onboarding",action:"reset-password",icon:fe,sampleSubject:"Reset your RubPage password",sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Reset Your Password</h1><p style="color:#555;font-size:15px;line-height:1.6;">Click the button below to set a new password.</p></div>`},{id:"listing-activated",name:"Listing Activated",description:"Sent when a listing is activated and goes live",trigger:"Automatic â on activation (DB trigger)",recipient:"user",category:"listing",action:"listing-activated",icon:me,sampleSubject:'Your listing "Premium Massage" is now live!',sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Listing Activated!</h1><p style="color:#555;font-size:15px;line-height:1.6;">Your listing is now live for 30 days.</p></div>`},{id:"expiry-warning",name:"Listing Expiry Warning",description:"Sent 7 and 3 days before a listing expires",trigger:"Cron â hourly check",recipient:"user",category:"listing",action:"expiry-warning",icon:pe,sampleSubject:'Your listing "Premium Massage" expires in 3 days',sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Listing Expiring Soon</h1><p style="color:#555;font-size:15px;line-height:1.6;">Your listing will expire in 3 days. Bump it to extend.</p></div>`},{id:"listing-expired",name:"Listing Expired",description:"Sent when a listing has just expired",trigger:"Cron â hourly check",recipient:"user",category:"listing",action:"send-expiry-warnings",icon:D,sampleSubject:'Your listing "Premium Massage" has expired',sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Listing Expired</h1><p style="color:#555;font-size:15px;line-height:1.6;">Your listing has expired and is no longer visible.</p></div>`}
6,{id:"invoice-created-user",name:"Invoice Created (User)",description:"Sent to user when they request a card payment",trigger:"User-initiated â card payment request",recipient:"user",category:"payment",action:"invoice-created-user",icon:z,sampleSubject:"Your payment request for $100 has been received",sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Payment Request Received</h1><p style="color:#555;font-size:15px;line-height:1.6;">Your request to add $100.00 via card has been submitted.</p></div>`},{id:"invoice-confirmed",name:"Payment Confirmed",description:"Confirms wallet credit after payment is verified",trigger:"Admin-initiated â confirms payment",recipient:"user",category:"payment",action:"invoice-confirmed",icon:q,sampleSubject:"$100 added to your wallet!",sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Payment Confirmed â
</h1><p style="color:#555;font-size:15px;line-height:1.6;">$100.00 has been added to your wallet.</p></div>`},{id:"admin-topup-notification",name:"Top-Up Notification (Admin)",description:"Notifies admin when a user tops up their wallet",trigger:"Automatic â on payment completion",recipient:"admin",category:"payment",action:"admin-topup-notification",icon:z,sampleSubject:"Wallet Top-Up: $100.00 by Sarah",sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Wallet Top-Up</h1><p style="color:#555;font-size:15px;line-height:1.6;">Sarah just topped up their wallet with $100.00.</p></div>`},{id:"weekly-stats",name:"Weekly Stats Digest",description:"Weekly performance summary for advertisers",trigger:"Cron â every Monday 9 AM UTC",recipient:"user",category:"engagement",action:"send-weekly-stats",icon:Y,sampleSubject:"Your weekly stats â summary inside",sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">Your Weekly Stats</h1><p style="color:#555;font-size:15px;line-height:1.6;">Here's how your listings performed this week.</p></div>`},{id:"seo-score-alert",name:"SEO Score Alert",description:"Notifies admin when SEO score drops",trigger:"Automatic â on score drop",recipient:"admin",category:"admin",action:"seo-score-alert",icon:xe,sampleSubject:"SEO Score Dropped: 72/100 (-8)",sampleHtml:`<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;max-width:560px;margin:0 auto;padding:40px 20px;"><h1 style="font-size:24px;color:#111;margin-bottom:16px;">SEO Score Alert</h1><p style="color:#555;font-size:15px;line-height:1.6;">Your site's SEO score dropped from 80/100 to 72/100.</p></div>`}],we=[{id:"all",label:"All Events"},{id:"onboarding",label:"Onboarding"},{id:"listing",label:"Listings"},{id:"payment",label:"Payments"},{id:"engagement",label:"Engagement"},{id:"admin",label:"Admin"}],I=i=>i==="admin"?e.jsx(f,{variant:"outline",className:"text-xs border-primary/40 text-primary",children:"Admin"}):i==="both"?e.jsx(f,{variant:"outline",className:"text-xs border-accent/40 text-accent-foreground",children:"Both"}):e.jsx(f,{variant:"secondary",className:"text-xs",children:"User"});function Ne(){const[i,l]=h.useState("all"),[r,d]=h.useState(null),[m,x]=h.useState(null),{toast:p}=Q(),u=i==="all"?T:T.filter(t=>t.category===i),n=async t=>{x(t.id);try{const{error:a}=await v.functions.invoke("send-email",{body:{action:t.action,email:"[email protected]",displayName:"Admin Test",userName:"Test User",userEmail:"[email protected]",amount:100,method:"Test",listingTitle:"Sample Listing",daysLeft:3}});if(a)throw a;
6p({title:"Test email sent to [email protected]"})}catch(a){p({title:"Failed",description:a.message,variant:"destructive"})}finally{x(null)}};return e.jsxs("div",{children:[e.jsx("div",{className:"flex gap-1.5 mb-4 overflow-x-auto scrollbar-none pb-1",children:we.map(t=>e.jsxs("button",{onClick:()=>l(t.id),className:`px-3 py-1.5 rounded-full text-xs font-medium whitespace-nowrap transition-colors ${i===t.id?"bg-foreground text-background":"bg-secondary text-muted-foreground hover:text-foreground"}`,children:[t.label,t.id!=="all"&&e.jsx("span",{className:"ml-1.5 opacity-60",children:T.filter(a=>a.category===t.id).length})]},t.id))}),e.jsx("div",{className:"grid gap-3",children:u.map(t=>e.jsx("div",{className:"border border-border rounded-lg p-4 bg-card hover:border-foreground/20 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-secondary flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx(t.icon,{className:"w-4.5 h-4.5 text-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t.name}),I(t.recipient)]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:t.description}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(D,{className:"w-3 h-3"}),e.jsx("span",{children:t.trigger})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5 font-mono bg-secondary/50 inline-block px-1.5 py-0.5 rounded",children:["Subject: ",t.sampleSubject]})]}),e.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[e.jsxs(j,{variant:"outline",size:"sm",className:"text-xs h-8",onClick:()=>d(t),children:[e.jsx(de,{className:"w-3.5 h-3.5 mr-1"})," Preview"]}),e.jsxs(j,{variant:"outline",size:"sm",className:"text-xs h-8",onClick:()=>n(t),disabled:m===t.id,children:[m===t.id?e.jsx(C,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(B,{className:"w-3.5 h-3.5 mr-1"}),"Test"]})]})]})},t.id))}),e.jsx(U,{open:!!r,onOpenChange:()=>d(null),children:e.jsxs(_,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[e.jsxs(O,{children:[e.jsxs(F,{className:"flex items-center gap-2",children:[e.jsx(w,{className:"w-4 h-4"})," ",r?.name]}),e.jsx(R,{children:e.jsxs("span",{className:"font-mono text-xs",children:["Subject: ",r?.sampleSubject]})})]}),e.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-white",children:[e.jsxs("div",{className:"bg-secondary/30 px-4 py-2 border-b border-border flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-destructive/40"}),e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-400/40"}),e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-400/40"})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"Email Preview"})]}),e.jsx("div",{className:"p-4",dangerouslySetInnerHTML:{__html:H.sanitize(r?.sampleHtml??"",{ALLOWED_TAGS:["p","br","strong","em","a","div","span","h1","h2","h3","h4","img","ul","ol","li","table","tr","td","th","thead","tbody","hr","b","i","u","center","blockquote"],ALLOWED_ATTR:["href","class","style","src","alt","width","height","align","valign","cellpadding","cellspacing","border","target","rel"]})}})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r&&I(r.recipient),e.jsx("span",{className:"text-xs text-muted-foreground",children:r?.trigger})]}),e.jsxs(j,{size:"sm",onClick:()=>r&&n(r),disabled:!!m,children:[m?e.jsx(C,{className:"w-3.5 h-3.5 animate-spin mr-1"}):e.jsx(B,{className:"w-3.5 h-3.5 mr-1"}),"Send Test Email"]})]})]})})]})}const pt=()=>e.jsxs(W,{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-xl font-medium text-foreground",children:"Email Activity"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Track every email sent, view delivery stats, and manage templates"})]}),e.jsxs(J,{defaultValue:"activity",className:"w-full",children:[e.jsxs(ee,{className:"mb-4",children:[e.jsxs(A,{value:"activity",className:"gap-1.5",children:[e.jsx(re,{className:"w-3.5 h-3.5"}
6)," Activity Log"]}),e.jsxs(A,{value:"templates",className:"gap-1.5",children:[e.jsx(w,{className:"w-3.5 h-3.5"})," Templates"]})]}),e.jsx(L,{value:"activity",children:e.jsx(ve,{})}),e.jsx(L,{value:"templates",children:e.jsx(Ne,{})})]})]});export{pt 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.