1import{j as e,r as y}from"./vendor-framer-RW7l0Jrm.js";import{c as U,bf as q,bg as V,bh as K,a6 as w,a7 as I,a8 as R,bd as $,a9 as N,aG as F,Y as G,U as Q,be as J,aq as Z,s as _,W as ee,b6 as te,g as ae,a0 as E,t as re,u as ne,v as se,x as ie,bi as oe,bj as le,y as ce,a1 as de,a2 as ue}from"./index-DK-SlJ-2.js";import{B as j}from"./badge-CQCWj8Y6.js";import{t as f,c as me,a as D,g as ge,e as he,d as A,f as C}from"./en-US-wfBU2YNu.js";import{C as fe}from"./clock-CKmesocp.js";import{S as T}from"./send-0qPnYxV4.js";import{C as pe}from"./circle-check-DL7mKpwT.js";import{C as P}from"./circle-x-Bv9lKzLf.js";import{M as X}from"./mail-CrxmgIRU.js";import{I as xe}from"./inbox-CT0V_aq8.js";import{E as be}from"./eye-dCVJHjwc.js";import{C as Y}from"./circle-check-big-BwLdoCOu.js";import{C as ye}from"./circle-alert-CMGNJJ59.js";const ve=U("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),B=q,W=V,H=K;function S(t,a){const n=f(t),i=f(a),r=n.getTime()-i.getTime();return r<0?-1:r>0?1:r}function je(t){return me(t,Date.now())}function ke(t,a){const n=f(t),i=f(a),r=n.getFullYear()-i.getFullYear(),o=n.getMonth()-i.getMonth();return r*12+o}function Ce(t){return a=>{const i=(t?Math[t]:Math.trunc)(a);return i===0?0:i}}function Se(t,a){return+f(t)-+f(a)}function we(t){const a=f(t);return a.setHours(23,59,59,999),a}function Ne(t){const a=f(t),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(23,59,59,999),a}function Me(t){const a=f(t);return+we(a)==+Ne(a)}function _e(t,a){const n=f(t),i=f(a),r=S(n,i),o=Math.abs(ke(n,i));let c;if(o<1)c=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*o);let l=S(n,i)===-r;Me(f(t))&&o===1&&S(t,i)===1&&(l=!1),c=r*(o-Number(l))}return c===0?0:c}function Te(t,a,n){const i=Se(t,a)/1e3;return Ce(n==null?void 0:n.roundingMethod)(i)}function Le(t,a,n){const i=ge(),r=(n==null?void 0:n.locale)??i.locale??he,o=2520,c=S(t,a);if(isNaN(c))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:c});let h,u;c>0?(h=f(a),u=f(t)):(h=f(t),u=f(a));const m=Te(u,h),x=(D(u)-D(h))/1e3,s=Math.round((m-x)/60);let d;if(s<2)return n!=null&&n.includeSeconds?m<5?r.formatDistance("lessThanXSeconds",5,l):m<10?r.formatDistance("lessThanXSeconds",10,l):m<20?r.formatDistance("lessThanXSeconds",20,l):m<40?r.formatDistance("halfAMinute",0,l):m<60?r.formatDistance("lessThanXMinutes",1,l):r.formatDistance("xMinutes",1,l):s===0?r.formatDistance("lessThanXMinutes",1,l):r.formatDistance("xMinutes",s,l);if(s<45)return r.formatDistance("xMinutes",s,l);if(s<90)return r.formatDistance("aboutXHours",1,l);if(s<A){const p=Math.round(s/60);return r.formatDistance("aboutXHours",p,l)}else{if(s<o)return r.formatDistance("xDays",1,l);if(s<C){const p=Math.round(s/A);return r.formatDistance("xDays",p,l)}else if(s<C*2)return d=Math.round(s/C),r.formatDistance("aboutXMonths",d,l)}if(d=_e(u,h),d<12){const p=Math.round(s/C);return r.formatDistance("xMonths",p,l)}else{const p=d%12,v=Math.trunc(d/12);return p<3?r.formatDistance("aboutXYears",v,l):p<9?r.formatDistance("overXYears",v,l):r.formatDistance("almostXYears",v+1,l)}}function Ee(t,a){return Le(t,je(t),a)}const b=[{value:"storybook_purchase",label:"Storybook Purchase Confirmation",description:"Sent after successful personalized story purchase. Includes story preview, CTA to read, and hardcover upsell.",category:"Storybook",audience:"customer",active:!0,triggerLocation:"stripe-webhook",sendCategory:"transactional"},{value:"payment_confirmed",label:"Payment Confirmed (Magic Link)",description:"Sent when payment is confirmed but story is still generating. Includes magic link for access.",category:"Storybook",audience:"customer",active:!0,triggerLocation:"stripe-webhook",sendCategory:"transactional"},{value:"story_ready",label:"Story Ready for Editing",description:"Sent when story generation completes and is ready for user review/editing.",category:"Storybook",audience:"customer",active:!0,triggerLocation:"send-story-ready-email",sendCategory:"story_updates"},{value:"story_magic_link_resend",label:"Story Magic Link Resend",description:"Sent when user requests a new magic link to access their story.",category:"Storybook",audie
1nce:"customer",active:!0,triggerLocation:"resend-magic-link",sendCategory:"transactional"},{value:"single_resource",label:"Single Marketplace Resource",description:"Sent for single marketplace item purchase. Includes thumbnail and tips.",category:"Marketplace",audience:"customer",active:!0,triggerLocation:"stripe-webhook",sendCategory:"transactional"},{value:"multi_item",label:"Multi-Item Bundle",description:"Sent for cart checkout with multiple items. Shows thumbnail grid and item list.",category:"Marketplace",audience:"customer",active:!0,triggerLocation:"stripe-webhook",sendCategory:"transactional"},{value:"bundle",label:"Curated Bundle",description:"Sent for curated bundle purchase. Shows bundle name and included resources.",category:"Marketplace",audience:"customer",active:!0,triggerLocation:"stripe-webhook",sendCategory:"transactional"},{value:"gift_recipient",label:"Gift Recipient Notification",description:"Sent to gift recipient. Warm gift-themed design with sender message.",category:"Gifts",audience:"customer",active:!0,triggerLocation:"stripe-webhook",sendCategory:"transactional"},{value:"gift_purchaser",label:"Gift Purchaser Confirmation",description:"Sent to person who purchased a gift. Confirms delivery to recipient.",category:"Gifts",audience:"customer",active:!0,triggerLocation:"stripe-webhook",sendCategory:"transactional"},{value:"gift_magic_link_resend",label:"Gift Magic Link Resend",description:"Sent when gift recipient requests a new magic link to claim their gift.",category:"Gifts",audience:"customer",active:!0,triggerLocation:"resend-gift-magic-link",sendCategory:"transactional"},{value:"hardcover_confirmation",label:"Hardcover Order Confirmation",description:"Sent when hardcover print order is placed. Shows book preview and timeline.",category:"Print Orders",audience:"customer",active:!0,triggerLocation:"send-hardcover-confirmation",sendCategory:"transactional"},{value:"shipping_notification",label:"Shipping Notification",description:"Sent when hardcover book ships. Includes tracking number and carrier info.",category:"Print Orders",audience:"customer",active:!0,triggerLocation:"rpi-webhook",sendCategory:"transactional"},{value:"referral_reward",label:"Referral Reward Earned",description:"Sent when user earns a free story from referrals. Shows referral count.",category:"Referrals",audience:"customer",active:!0,triggerLocation:"stripe-webhook",sendCategory:"marketing"},{value:"admin_notification",label:"Admin Purchase Alert",description:"Sent to admins on new purchases. Shows customer and order details.",category:"Admin",audience:"internal",active:!0,triggerLocation:"stripe-webhook",sendCategory:"transactional"},{value:"timeout_alert",label:"Image Timeout Alert",description:"Sent to admins when image generation times out. Contains draft ID and error details.",category:"Admin",audience:"internal",active:!0,triggerLocation:"notify-admin-timeout",sendCategory:"transactional"},{value:"cost_alert",label:"Cost Threshold Alert",description:"Sent to admins when AI generation costs exceed daily/weekly thresholds.",category:"Admin",audience:"internal",active:!0,triggerLocation:"check-cost-alerts",sendCategory:"transactional"},{value:"auth_magic_link",label:"Auth OTP / Magic Link",description:"OTP code and magic link for authentication. Always sends.",category:"Auth",audience:"customer",active:!0,triggerLocation:"send-auth-otp",sendCategory:"transactional"},{value:"test_email",label:"Admin Test Email",description:"Sample email sent from the admin email tester dashboard.",category:"Admin",audience:"internal",active:!0,triggerLocation:"send-test-email",sendCategory:"transactional"},{value:"welcome_email",label:"Welcome Email",description:"Welcome email for new users after signup. Not yet implemented.",category:"Onboarding",audience:"customer",active:!1,triggerLocation:"Not implemented",sendCategory:"product_news"}];function z(){return b.reduce((t,a)=>(t[a.category]||(t[a.category]=[]),t[a.category].push(a),t),{})}function De(){const t=b.filter(r=>r.active).length,a=b.filter(r=>!r.active).length,n=b.filter(r=>r.audience==="customer").length,i=b.filter(r=>r.audience==="internal").length;return{total:b.length,active:t,inactive:a,customer:n,internal:i}}
1const Ae={Storybook:{icon:"ð",color:"bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300"},Marketplace:{icon:"ð",color:"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300"},Gifts:{icon:"ð",color:"bg-pink-100 dark:bg-pink-900/30 text-pink-800 dark:text-pink-300"},"Print Orders":{icon:"ð¦",color:"bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300"},Referrals:{icon:"ð",color:"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300"},Admin:{icon:"âï¸",color:"bg-slate-100 dark:bg-slate-800/50 text-slate-800 dark:text-slate-300"},Onboarding:{icon:"ð",color:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300"},Auth:{icon:"ð",color:"bg-indigo-100 dark:bg-indigo-900/30 text-indigo-800 dark:text-indigo-300"}};function Oe({audience:t}){return t==="customer"?e.jsxs(j,{variant:"outline",className:"gap-1 bg-emerald-50 dark:bg-emerald-900/20 border-emerald-200 dark:border-emerald-800 text-emerald-700 dark:text-emerald-400",children:[e.jsx(Q,{className:"h-3 w-3"}),"Customer"]}):e.jsxs(j,{variant:"outline",className:"gap-1 bg-slate-50 dark:bg-slate-800/50 border-slate-200 dark:border-slate-700 text-slate-700 dark:text-slate-400",children:[e.jsx(J,{className:"h-3 w-3"}),"Internal"]})}function Ie({active:t}){return t?e.jsxs(j,{variant:"outline",className:"gap-1 bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800 text-green-700 dark:text-green-400",children:[e.jsx(pe,{className:"h-3 w-3"}),"Active"]}):e.jsxs(j,{variant:"outline",className:"gap-1 bg-amber-50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800 text-amber-700 dark:text-amber-400",children:[e.jsx(P,{className:"h-3 w-3"}),"Inactive"]})}function Re({email:t,stats:a,onSelect:n,isSelected:i}){const r=(a==null?void 0:a.sentCount)??0,o=a==null?void 0:a.lastSentAt,c=r>0&&a?Math.round(a.deliveredCount/r*100):null,l=a&&a.deliveredCount>0?Math.round(a.openedCount/a.deliveredCount*100):null;return e.jsxs("div",{className:`grid grid-cols-12 gap-2 md:gap-4 items-center p-3 rounded-lg border transition-colors ${i?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"}`,children:[e.jsxs("div",{className:"col-span-12 md:col-span-3",children:[e.jsx("p",{className:"font-medium text-sm text-foreground",children:t.label}),e.jsx("p",{className:"text-xs text-muted-foreground truncate hidden md:block",children:t.triggerLocation})]}),e.jsxs("div",{className:"col-span-6 md:col-span-2 flex flex-wrap gap-1",children:[e.jsx(Oe,{audience:t.audience}),e.jsx(Ie,{active:t.active})]}),e.jsxs("div",{className:"col-span-2 md:col-span-1 text-center",children:[e.jsx("p",{className:"font-semibold text-foreground",children:r.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"sent"})]}),e.jsxs("div",{className:"col-span-2 md:col-span-1 text-center hidden md:block",children:[e.jsx("p",{className:`font-semibold ${c!==null&&c<90?"text-amber-600":"text-foreground"}`,children:c!==null?`${c}%`:"â"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"delivered"})]}),e.jsxs("div",{className:"col-span-2 md:col-span-1 text-center hidden md:block",children:[e.jsx("p",{className:"font-semibold text-foreground",children:l!==null?`${l}%`:"â"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"opened"})]}),e.jsx("div",{className:"col-span-3 md:col-span-2 text-center hidden md:block",children:o?e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center justify-center gap-1",children:[e.jsx(fe,{className:"h-3 w-3"}),Ee(new Date(o),{addSuffix:!0})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"â"})}),e.jsx("div",{className:"col-span-3 md:col-span-2 flex justify-end",children:e.jsxs(G,{size:"sm",variant:i?"default":"outline",onClick:n,disabled:!t.active,className:"h-8 px-2",children:[e.jsx(T,{className:"h-3 w-3 md:mr-1"}),e.jsx("span",{className:"hidden md:inline",children:"Test"})]})})]})}function $e({category:t,emails:a,stats:n,onSelectEmail:i,selectedEmail:r}){const[o,c]=y.useState(!0),l=Ae[t],h=a.reduce((u,m)=>{var x;return u+(((x=n[m.value])==null?void 0:x.sentCount)??0)},0);return e.jsxs(B,{open:o,onOpenChange:c,children:[e.jsx(W,{className:"w-full",children:e.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg ${l.color} mb-2`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:l.icon}),e.jsx("span",{className:"font-semibold",children:t}),e.jsxs(j,{variant:"secondary",className:"ml-2",children:[a.length," templates"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[h.toLocaleStr
1ing()," sent"]}),e.jsx(F,{className:`h-4 w-4 transition-transform ${o?"rotate-180":""}`})]})]})}),e.jsx(H,{children:e.jsx("div",{className:"space-y-2 mb-4",children:a.map(u=>e.jsx(Re,{email:u,stats:n[u.value],onSelect:()=>i(u.value),isSelected:r===u.value},u.value))})})]})}function Fe({stats:t,onSelectEmail:a,selectedEmail:n}){const i=z(),r=["Storybook","Marketplace","Gifts","Print Orders","Referrals","Admin","Onboarding"];return e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(R,{children:"Email Inventory"}),e.jsxs($,{children:["All ",b.length," email templates organized by category"]})]}),e.jsx(N,{children:e.jsx("div",{className:"space-y-2",children:r.map(o=>{const c=i[o];return c!=null&&c.length?e.jsx($e,{category:o,emails:c,stats:t,onSelectEmail:a,selectedEmail:n},o):null})})})]})}function Ge({totalSent:t,sentThisWeek:a,sentToday:n,totalDelivered:i=0,totalOpened:r=0,totalBounced:o=0}){const c=De(),l=t>0?Math.round(i/t*100):0,h=i>0?Math.round(r/i*100):0,u=[{label:"Total Sent",value:t.toLocaleString(),subtext:"All time",icon:X,color:"text-purple-600 dark:text-purple-400",bgColor:"bg-purple-100 dark:bg-purple-900/30"},{label:"This Week",value:a.toLocaleString(),subtext:"Last 7 days",icon:ve,color:"text-blue-600 dark:text-blue-400",bgColor:"bg-blue-100 dark:bg-blue-900/30"},{label:"Delivery Rate",value:t>0?`${l}%`:"â",subtext:`${i.toLocaleString()} delivered`,icon:xe,color:"text-green-600 dark:text-green-400",bgColor:"bg-green-100 dark:bg-green-900/30"},{label:"Open Rate",value:i>0?`${h}%`:"â",subtext:`${r.toLocaleString()} opened`,icon:be,color:"text-emerald-600 dark:text-emerald-400",bgColor:"bg-emerald-100 dark:bg-emerald-900/30"},{label:"Active Templates",value:`${c.active}/${c.total}`,subtext:"Email types",icon:Y,color:"text-teal-600 dark:text-teal-400",bgColor:"bg-teal-100 dark:bg-teal-900/30"},{label:"Bounced",value:o>0?o.toLocaleString():"0",subtext:o>0?"Needs attention":"All clear",icon:P,color:o>0?"text-red-600 dark:text-red-400":"text-slate-600 dark:text-slate-400",bgColor:o>0?"bg-red-100 dark:bg-red-900/30":"bg-slate-100 dark:bg-slate-800/50"}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:u.map(m=>e.jsx(w,{children:e.jsx(N,{className:"pt-4 pb-3 px-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${m.bgColor}`,children:e.jsx(m.icon,{className:`h-4 w-4 ${m.color}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:m.value}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m.label})]})]})})},m.label))})}function O(){const t={};return b.forEach(a=>{t[a.value]={emailType:a.value,sentCount:0,lastSentAt:null,deliveredCount:0,openedCount:0,clickedCount:0,bouncedCount:0}}),t}function Pe(){return Z({queryKey:["email-stats"],queryFn:async()=>{const{data:t,error:a}=await _.from("email_logs").select("email_type, created_at, status, delivered_at, opened_at, clicked_at, bounced_at").order("created_at",{ascending:!1});if(a)return console.error("[useEmailStats] Error fetching logs:",a),{totalSent:0,sentThisWeek:0,sentToday:0,totalDelivered:0,totalOpened:0,totalBounced:0,byType:O()};const n=new Date,i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(i);r.setDate(r.getDate()-7);const o=O();let c=0,l=0,h=0,u=0,m=0,x=0;return t==null||t.forEach(s=>{const d=s.email_type,p=new Date(s.created_at);c++,p>=r&&l++,p>=i&&h++,s.delivered_at&&u++,s.opened_at&&m++,s.bounced_at&&x++,o[d]||(o[d]={emailType:d,sentCount:0,lastSentAt:null,deliveredCount:0,openedCount:0,clickedCount:0,bouncedCount:0}),o[d].sentCount++,s.delivered_at&&o[d].deliveredCount++,s.opened_at&&o[d].openedCount++,s.clicked_at&&o[d].clickedCount++,s.bounced_at&&o[d].bouncedCount++,o[d].lastSentAt||(o[d].lastSentAt=s.created_at)}),{totalSent:c,sentThisWeek:l,sentToday:h,totalDelivered:u,totalOpened:m,totalBounced:x,byType:o}},staleTime:3e4,refetchOnWindowFocus:!0})}function et(){var L;const{toast:t}=ee(),{shadowEmail:a}=te(),[n,i]=y.useState(""),[r,o]=y.useState(a||""),[c,l]=y.useState(!1),[h,u]=y.useState(null),[m,x]=y.useState(!1),{data:s}=Pe(),d=b.find(g=>g.value===n),p=g=>{i(g),x(!0)},v=async()=>
1{if(!n||!r){t({title:"Missing fields",description:"Please select an email type and enter a recipient email.",variant:"destructive"});return}l(!0),u(null);try{const{data:{session:g}}=await _.auth.getSession();if(!(g!=null&&g.access_token))throw new Error("Not authenticated");const k=await _.functions.invoke("send-test-email",{body:{emailType:n,recipientEmail:r}});if(k.error)throw new Error(k.error.message||"Failed to send email");u({type:n,email:r}),t({title:"Email sent!",description:`Sample ${d==null?void 0:d.label} sent to ${r}`})}catch(g){console.error("Failed to send test email:",g),t({title:"Failed to send email",description:g instanceof Error?g.message:"Unknown error",variant:"destructive"})}finally{l(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(ae,{title:"Email Tester | Nookly Admin",description:"Admin dashboard page.",noIndex:!0}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(X,{className:"h-6 w-6"}),"Email Dashboard"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Comprehensive overview of all email communications"})]}),e.jsx(Ge,{totalSent:(s==null?void 0:s.totalSent)??0,sentThisWeek:(s==null?void 0:s.sentThisWeek)??0,sentToday:(s==null?void 0:s.sentToday)??0,totalDelivered:(s==null?void 0:s.totalDelivered)??0,totalOpened:(s==null?void 0:s.totalOpened)??0,totalBounced:(s==null?void 0:s.totalBounced)??0}),e.jsx(Fe,{stats:(s==null?void 0:s.byType)??{},onSelectEmail:p,selectedEmail:n}),e.jsx(B,{open:m,onOpenChange:x,children:e.jsxs(w,{children:[e.jsx(W,{asChild:!0,children:e.jsx(I,{className:"cursor-pointer hover:bg-muted/50 transition-colors rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(R,{className:"flex items-center gap-2",children:[e.jsx(T,{className:"h-5 w-5"}),"Send Test Email"]}),e.jsx($,{className:"mt-1",children:d?`Ready to send: ${d.label}`:"Select an email template from the inventory above"})]}),e.jsx(F,{className:`h-5 w-5 text-muted-foreground transition-transform ${m?"rotate-180":""}`})]})})}),e.jsx(H,{children:e.jsxs(N,{className:"space-y-4 pt-0",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"emailType",children:"Email Template"}),e.jsxs(re,{value:n,onValueChange:i,children:[e.jsx(ne,{id:"emailType",children:e.jsx(se,{placeholder:"Select an email template..."})}),e.jsx(ie,{children:Object.entries(z()).map(([g,k])=>e.jsxs(oe,{children:[e.jsx(le,{children:g}),k.map(M=>e.jsx(ce,{value:M.value,children:M.label},M.value))]},g))})]})]}),d&&e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"font-medium text-sm text-foreground",children:d.label}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${d.audience==="internal"?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"}`,children:d.audience==="internal"?"Internal":"Customer"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d.description})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"recipient",children:"Recipient Email"}),e.jsx(de,{id:"recipient",type:"email",placeholder:"[email protected]",value:r,onChange:g=>o(g.target.value)})]}),e.jsx(G,{onClick:v,disabled:c||!n||!r,className:"w-full",children:c?e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),"Send Sample Email"]})}),h&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-accent/50 rounded-lg text-sm text-primary",children:[e.jsx(Y,{className:"h-4 w-4 flex-shrink-0"}),e.jsxs("span",{children:["Sent ",e.jsx("strong",{children:(L=b.find(g=>g.value===h.type))==null?void 0:L.label})," to"," ",e.jsx("strong",{children:h.email})]})]})]})})]})}),e.jsx(w,{children:e.jsx(N,{className:"pt-6",children:e.jsxs("div",{className:"flex gap-3 text-sm text-muted-foreground",children:[e.jsx(ye,{className:"h-5 w-5 flex-shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:"Sample Email Notes"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1",children:[e.jsx("li",{children:'All test emails have "[SAMPLE]" prefix in subject line'}),e.jsx("li",{children:"Sample data uses placeholder names, images, and order numbers"}),e.jsxs("li",{children:["Emails are sent from ",e.jsx("strong",{children:"[email protected]"})," (unified sender)"]}),e.jsx("li",{children:"Links in sample emails may not work (placeholder URLs)"}),e.jsx("li",{children:"Send counts will be tracked after email logging is implemented (Phase 2)"})]})]})]})})})]})]})}export{et 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.