PageSourceSearch

https://octofold.com/build/assets/Index-BRyZquX3.js

js octofold.com collected 2026-10-03 20:08:46 UTC 34,579 bytes, 2 lines download raw bytes

1import{r as m,j as e}from"./vendor-react-BzXAup97.js";import{A as Ce}from"./AdminPageWrapper-Uq3LcqGL.js";import{C as De,b as Fe,c as Ae,a as Te}from"./Card-Czp7NDRY.js";import{B as c,L as i,D as B,a as H,b as K,c as V,T as ue,d as X}from"./app-BcVXXONv.js";import{B as I}from"./Badge-BYM-_53-.js";import{T as $e,a as Me,b as v,c as b}from"./Tabs-BqjmlK_T.js";import{T as w,a as S,b as x,c as t,d as k,e as a}from"./Table-Cn6JNXmi.js";import{I as o}from"./Input-Cg7VKGAS.js";import{u as Le,c as Q,L as q,r as g}from"./vendor-inertia-C6ujBw2R.js";import{$ as Re,a0 as Ee,G as Ie}from"./vendor-lucide-1jXEw7Bh.js";import"./AuthenticatedLayout-CluqGnv5.js";import"./vendor-radix-Bha8dDJB.js";import"./vendor-tiptap-CF47o3zI.js";import"./pushNotifications-BVHqr3g7.js";import"./vendor-firebase-CCnLmBjb.js";import"./UpgradeModal-H1XLTufz.js";import"./upgradeFeatureCatalog-DQsdO-8d.js";import"./AppModal-Bf_aZlPN.js";import"./transition-Cx0OHrt1.js";import"./dialog-D_ql7LVY.js";import"./Sheet-BZ90mOOl.js";import"./rememberedProfile-pkm-wW4S.js";import"./vendor-framer-DOQvBjnK.js";import"./vendor-dnd-aV9yv6Pg.js";import"./useRoutePulse-Cu98qn9H.js";import"./vendor-ably-DQ6H01js.js";import"./vendor-recharts-MX9_f30n.js";import"./vendor-assistant-ui-rpsJ9Qdc.js";import"./vendor-voip-BKCre8sD.js";function qe(u){switch(u){case"sent":return"success";case"scheduled":case"queued":return"warning";case"failed":case"cancelled":return"destructive";default:return"secondary"}}function ps({templates:u,campaigns:G,logs:W=[],initialTab:J="templates",template_filter_locale:Y,mailSettings:j,drip:h,suppressions:f,deliverability:r}){const Z=Le(),ee=Z.props.enabled_locales??[],y=Z.props.flash,[pe,M]=m.useState(!1),[he,L]=m.useState(!1),[je,C]=m.useState(!1),[U,O]=m.useState(""),[se,D]=m.useState([]),[ge,ae]=m.useState(!1),[F,R]=m.useState([]),l=Q({title:"",message:"",url:"",audience_type:"all_users",user_ids:[]}),d=Q({mail_mailer:j.mail_mailer,mail_host:j.mail_host,mail_port:j.mail_port,mail_username:j.mail_username,mail_password:"",mail_encryption:j.mail_encryption??"",mail_from_address:j.mail_from_address,mail_from_name:j.mail_from_name??"",mail_reply_to:j.mail_reply_to??"",mail_unsubscribe_mailto:j.mail_unsubscribe_mailto??""}),_=Q({to:""});m.useEffect(()=>{const s=new URLSearchParams(window.location.search);if(s.get("mail_settings")==="1"){C(!0),s.delete("mail_settings");const n=s.toString(),p=`${window.location.pathname}${n?`?${n}`:""}${window.location.hash}`;window.history.replaceState({},"",p)}},[]);const[te,re]=m.useState(""),[E,P]=m.useState(u[0]?.id??0),[A,ne]=m.useState("all"),[le,de]=m.useState(""),[ie,ce]=m.useState(""),[oe,me]=m.useState(!1),T=`?locale=${encodeURIComponent(Y)}`;m.useEffect(()=>{u.length>0&&!u.some(s=>s.id===E)&&P(u[0].id)},[u,E]);const xe=m.useCallback(async s=>{if(s.trim().length<2){D([]);return}ae(!0);try{const n=new URLSearchParams({q:s.trim()}),N=await(await fetch(`${route("admin.marketing.saas-users.search")}?${n}`,{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"})).json();D(N.users??[])}catch{D([])}finally{ae(!1)}},[]);m.useEffect(()=>{const s=window.setTimeout(()=>xe(U),300);return()=>window.clearTimeout(s)},[U,xe]);const fe=s=>{F.some(n=>n.id===s.id)||F.length>=500||(R(n=>[...n,s]),O(""),D([]))},Ne=s=>{R(n=>n.filter(p=>p.id!==s))},_e=s=>{s.preventDefault(),l.transform(n=>{if(n.audience_type==="selected")return{...n,user_ids:F.map(z=>z.id)};const{user_ids:p,...N}=n;return N}),l.post(route("admin.marketing.in-app-notifications.send"),{preserveScroll:!0,onSuccess:()=>{L(!1),R([]),O(""),D([]),l.reset(),l.clearErrors()}})},ve=s=>{const n=new URLSearchParams(window.location.search);n.set("locale",s);const p=n.get("tab")||J;p&&p!=="templates"?n.set("tab",p):n.delete("tab");const N=n.toString();g.get(`${route("admin.marketing.index")}${N?`?${N}`:""}`,{},{preserveScroll:!0})},be=(s,n)=>{window.confirm(`Delete template "${n}"?`)&&g.delete(`${route("admin.marketing.templates.destroy",s)}${T}`)},we=s=>{g.post(route("admin.marketing.campaigns.send-now",s))},Se=s=>{g.post(route("admin.marketing.campaigns.cancel",s))},ke=s=>{s.preventDefault();const n=A==="manual"?le.split(/\r?\n/).map(p=>
1p.trim()).filter(Boolean):[];me(!0),g.post(route("admin.marketing.campaigns.store"),{name:te,email_template_id:E,audience_type:A,audience_payload:A==="manual"&&n.length>0?{emails:n}:null,scheduled_at:ie||null},{preserveScroll:!0,onFinish:()=>me(!1),onSuccess:()=>{M(!1),re(""),ne("all"),de(""),ce(""),P(u[0]?.id??0)}})},ye=s=>{s.preventDefault(),d.put(route("admin.marketing.mail-settings.update"),{preserveScroll:!0,onSuccess:()=>C(!1)})};return e.jsx(Ce,{title:"Marketing Module - Admin",header:e.jsx("h1",{className:"text-xl font-semibold leading-tight text-foreground",children:"Marketing Module"}),children:e.jsx("div",{className:"p-4 md:p-6",children:e.jsxs(De,{children:[e.jsxs(Fe,{className:"flex flex-row flex-wrap items-start justify-between gap-4 space-y-0",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ae,{children:"Marketing"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage email templates and launch marketing campaigns."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(q,{href:`${route("admin.marketing.saas-broadcast")}${T}`,children:e.jsx(c,{type:"button",variant:"outline",size:"icon",title:"SaaS user broadcast","aria-label":"SaaS broadcast",children:e.jsx(Re,{className:"h-4 w-4"})})}),e.jsx(c,{type:"button",variant:"outline",size:"icon",title:"Email / SMTP settings","aria-label":"Email settings",onClick:()=>C(!0),children:e.jsx(Ee,{className:"h-4 w-4"})}),e.jsx(q,{href:`${route("admin.marketing.templates.create")}${T}`,children:e.jsx(c,{variant:"destructive",children:"+ New template"})})]})]}),e.jsxs(Te,{children:[(y?.success||y?.error)&&e.jsx("div",{className:`mb-4 rounded-md border p-3 text-sm ${y?.error?"border-destructive/50 bg-destructive/10 text-destructive":"border-green-500/50 bg-green-500/10 text-green-800 dark:text-green-400"}`,children:y?.error??y?.success}),e.jsxs($e,{defaultValue:J,className:"w-full",children:[e.jsxs(Me,{children:[e.jsx(v,{value:"templates",children:"Email Templates"}),e.jsx(v,{value:"campaigns",children:"Campaigns"}),e.jsx(v,{value:"drip",children:"Drip Sequences"}),e.jsx(v,{value:"suppressions",children:"Suppressions"}),e.jsx(v,{value:"deliverability",children:"Deliverability"}),e.jsx(v,{value:"logs",children:"Logs"})]}),e.jsxs(b,{value:"templates",className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(i,{htmlFor:"template_locale_filter",className:"text-xs text-muted-foreground",children:"Template language"}),e.jsx("select",{id:"template_locale_filter",className:"flex h-10 min-w-[200px] rounded-md border border-input bg-background px-3 py-2 text-sm",value:Y,onChange:s=>ve(s.target.value),children:(ee.length>0?ee:[{code:"en",name:"English",native_name:"English"}]).map(s=>e.jsxs("option",{value:s.code,children:[s.native_name||s.name," (",s.code,")"]},s.code))})]}),e.jsx("p",{className:"pb-2 text-xs text-muted-foreground",children:"Showing templates for the selected locale. Default matches your header language."})]}),e.jsxs(w,{children:[e.jsx(S,{children:e.jsxs(x,{children:[e.jsx(t,{children:"Name"}),e.jsx(t,{children:"Slug"}),e.jsx(t,{className:"w-[72px]",children:"Locale"}),e.jsx(t,{children:"Subject"}),e.jsx(t,{children:"Created"}),e.jsx(t,{})]})}),e.jsx(k,{children:u.length===0?e.jsx(x,{children:e.jsx(a,{colSpan:6,className:"py-8 text-center text-muted-foreground",children:"No templates for this language. Create one to get started."})}):u.map(s=>e.jsxs(x,{children:[e.jsx(a,{className:"font-medium",children:s.name}),e.jsx(a,{className:"font-mono text-muted-foreground",children:s.slug}),e.jsx(a,{className:"font-mono text-muted-foreground",children:s.locale}),e.jsx(a,{children:s.subject}),e.jsx(a,{className:"text-muted-foreground",children:new Date(s.created_at).toLocaleDateString()}),e.jsxs(a,{className:"flex gap-2",children:[e.jsx(q,{href:`${route("admin.marketing.templates.edit",s.id)}${T}`,children:e.jsx(c,{variant:"outline",size:"sm",children:"Edit"})}),e.jsx(c,{variant:"destructive",size:"sm",onClick:()=>be(s.id,s.name),children:"Delete"})]})]},s.id))})]})]}),e.jsxs(b,{value:"campaigns",className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsxs(c,{type:"button",variant:"outline",onClick:()=>L(!0),className:"gap-2",children:[e.jsx(Ie,{className:"h-4 w-4"}),"In-app notification"]}),e.jsx(c,{onClick:()=>M(!0),disabled:u.length===0,children:"New campaign"}),e.jsx(q,{href:`${route("admin.marketing.logs")}${T}`,children:e.jsx(c,{variant:"outline",children:"Open logs"})})]}),e.jsx(B,{open:he,onOpenChange:s=>{L(s),s||l.clearErrors()},children:e.jsx(H,{className:"max-h-[90vh] max-w-lg overflow-y-auto",children:e.jsxs("form",{onSubmit:_e,children:[e.jsxs(K,{children:[e.jsx(V,{children:"In-app notification"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sends a database notification (bell / dynamic island) and push where enabled. Not an email campaign."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"inapp_title",children:"Title"}),e.jsx(o,{id:"inapp_title",value:l.data.title,onChange:s=>l.setData("title",s.target.value),className:"mt-1",required:!0}),e.jsx($,{message:l.errors.title})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"inapp_message",children:"Message"}),e.jsx(ue,{id:"inapp_message",value:l.data.message,onChange:s=>l.setData("message",s.target.value),className:"mt-1 min-h-[100px]",required:!0}),e.jsx($,{message:l.errors.message})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"inapp_url",children:"Link URL (optional)"}),e.jsx(o,{id:"inapp_url",type:"text",placeholder:"https://… or /dashboard",value:l.data.url,onChange:s=>l.setData("url",s.target.value),className:"mt-1"}),e.jsx($,{message:l.errors.url})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Audience"}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-sm",children:[e.jsx("input",{type:"radio",name:"inapp_audience",className:"mt-1",checked:l.data.audience_type==="all_users",onChange:()=>{l.setData("audience_type","all_users"),R([])}}),e.jsx("span",{children:"All active users (not suspended), max 3000 per send"})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-sm",children:[e.jsx("input",{type:"radio",name:"inapp_audience",className:"mt-1",checked:l.data.audience_type==="selected",onChange:()=>l.setData("audience_type","selected")}),e.jsx("span",{children:"Selected users (search, up to 500)"})]}),e.jsx($,{message:l.errors.audience_type})]}),l.data.audience_type==="selected"&&e.jsxs("div",{className:"space-y-2 rounded-md border border-border p-3",children:[e.jsx(i,{htmlFor:"inapp_user_search",children:"Search users"}),e.jsx(o,{id:"inapp_user_search",value:U,onChange:s=>O(s.target.value),placeholder:"Name or email (min 2 chars)",autoComplete:"off"}),ge&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Searching…"}),se.length>0&&e.jsx("ul",{className:"max-h-40 overflow-y-auto rounded-md border border-border bg-muted/30 text-sm",children:se.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted",onClick:()=>fe(s),children:[e.jsx("span",{className:"font-medium",children:s.name||s.email}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:s.email})]})},s.id))}),F.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:F.map(s=>e.jsxs("button",{type:"button",className:"rounded-full border border-border bg-background px-2 py-0.5 text-xs",onClick:()=>Ne(s.id),title:"Remove",children:[s.email," ×"]},s.id))}),e.jsx($,{message:l.errors.user_ids})]})]}),e.jsxs(X,{children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>L(!1),children:"Cancel"}),e.jsx(c,{type:"submit",disabled:l.processing,children:l.processing?"Sending…":"Send"})]})]})})}),e.jsx(B,{open:pe,onOpenChange:M,children:e.jsx(H,{className:"max-w-md",children:e.jsxs("form",{onSubmit:ke,children:[e.jsx(K,{children:e.jsx(V,{children:"New campaign"})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"camp_name",children:"Name"}),e.jsx(o,{id:"camp_name",value:te,onChange:s=>re(s.target.value),className:"mt-1",required:!0})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"camp_template",children:"Template"}),e.jsx("select",{id:"camp_template",className:"mt-1 flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:E,onChange:s=>P(Number(s.target.value)),required:!0,children:u.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"camp_audience",children:"Audience"}),e.jsxs("select",{id:"camp_audience",className:"mt-1 flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:A,onChange:s=>ne(s.target.value),children:[e.jsx("option",{value:"all",children:"All marketing-consented contacts"}),e.jsx("option",{value:"manual",children:"Manual list (emails below)"})]})]}),A==="manual"&&e.jsxs("div",{children:[e.jsx(i,{htmlFor:"camp_manual",children:"Emails (one per line)"}),e.jsx(ue,{id:"camp_manual",value:le,onChange:s=>de(s.target.value),className:"mt-1 min-h-[100px] font-mono text-sm",placeholder:`[email protected]
2[email protected]`})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"camp_sched",children:"Schedule send (optional, local time)"}),e.jsx(o,{id:"camp_sched",type:"datetime-local",value:ie,onChange:s=>ce(s.target.value),className:"mt-1"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Leave empty for draft; cron dispatches due campaigns every minute when the worker runs."})]})]}),e.jsxs(X,{children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>M(!1),children:"Cancel"}),e.jsx(c,{type:"submit",disabled:oe,children:oe?"Saving…":"Create"})]})]})})}),e.jsxs(w,{children:[e.jsx(S,{children:e.jsxs(x,{children:[e.jsx(t,{children:"Name"}),e.jsx(t,{children:"Template"}),e.jsx(t,{children:"Status"}),e.jsx(t,{children:"Scheduled"}),e.jsx(t,{children:"Sent"}),e.jsx(t,{})]})}),e.jsx(k,{children:G.length===0?e.jsx(x,{children:e.jsx(a,{colSpan:6,className:"py-8 text-center text-muted-foreground",children:"No campaigns yet."})}):G.map(s=>e.jsxs(x,{children:[e.jsx(a,{className:"font-medium",children:s.name}),e.jsx(a,{children:s.template_name}),e.jsx(a,{children:e.jsx(I,{variant:qe(s.status),children:s.status})}),e.jsx(a,{className:"text-muted-foreground",children:s.scheduled_at?new Date(s.scheduled_at).toLocaleStr
2ing():"—"}),e.jsx(a,{className:"text-muted-foreground",children:s.sent_at?new Date(s.sent_at).toLocaleString():"—"}),e.jsxs(a,{className:"flex items-center gap-2",children:[e.jsx(c,{variant:"outline",size:"sm",onClick:()=>we(s.id),disabled:["processing","sent","queued"].includes(s.status),children:"Send now"}),e.jsx(c,{variant:"destructive",size:"sm",onClick:()=>Se(s.id),disabled:!["draft","scheduled","queued"].includes(s.status),children:"Cancel"})]})]},s.id))})]})]}),e.jsx(b,{value:"drip",className:"space-y-4",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Daily cron: 09:00 — runs ",e.jsx("code",{className:"font-mono",children:"drip:dispatch"})," across all eligible users."]}),e.jsx(c,{size:"sm",variant:"outline",onClick:()=>{window.confirm("Run drip dispatch for up to 500 eligible users now?")&&g.post(route("admin.marketing.drip.run-all"),{},{preserveScroll:!0})},children:"Run dispatch now"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3",children:[e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sent (30d)"}),e.jsx("p",{className:"text-2xl font-semibold",children:h.totals.sent_30d})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Open rate"}),e.jsxs("p",{className:"text-2xl font-semibold",children:[h.totals.open_rate??0,"%"]}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[h.totals.opened_30d??0," opened"]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Click rate"}),e.jsxs("p",{className:"text-2xl font-semibold",children:[h.totals.click_rate??0,"%"]}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[h.totals.clicked_30d??0," clicked"]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Failed (30d)"}),e.jsx("p",{className:"text-2xl font-semibold text-red-500",children:h.totals.failed_30d})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Unsubscribed"}),e.jsx("p",{className:"text-2xl font-semibold",children:h.totals.unsubscribed})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Sequence slugs"}),e.jsxs(w,{children:[e.jsx(S,{children:e.jsxs(x,{children:[e.jsx(t,{children:"Slug"}),e.jsx(t,{className:"text-right",children:"Sent"}),e.jsx(t,{className:"text-right",children:"Open %"}),e.jsx(t,{className:"text-right",children:"Click %"}),e.jsx(t,{className:"text-right",children:"Conv"}),e.jsx(t,{className:"text-right",children:"Revenue"}),e.jsx(t,{className:"text-right",children:"Failed"}),e.jsx(t,{className:"text-right",children:"Locales"})]})}),e.jsx(k,{children:h.slugs.map(s=>e.jsxs(x,{children:[e.jsx(a,{className:"font-mono text-xs",children:s.slug}),e.jsx(a,{className:"text-right",children:s.sent_30d}),e.jsx(a,{className:"text-right",children:s.open_rate!==null?`${s.open_rate}%`:"—"}),e.jsx(a,{className:"text-right",children:s.click_rate!==null?`${s.click_rate}%`:"—"}),e.jsx(a,{className:"text-right",children:s.conversions_30d??0}),e.jsx(a,{className:"text-right",children:s.revenue_30d?`$${s.revenue_30d.toFixed(2)}`:"—"}),e.jsx(a,{className:"text-right",children:s.failed_30d>0?e.jsx("span",{className:"text-red-500",children:s.failed_30d}):0}),e.jsx(a,{className:"text-right",children:e.jsxs("span",{className:s.locales_covered<s.locales_total?"text-amber-500":"",children:[s.locales_covered,"/",s.locales_total]})})]},s.slug))})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Recent journeys"}),e.jsxs(w,{children:[e.jsx(S,{children:e.jsxs(x,{children:[e.jsx(t,{children:"User"}),e.jsx(t,{children:"Slug"}),e.jsx(t,{children:"Kind"}),e.jsx(t,{children:"Locale"}),e.jsx(t,{children:"Status"}),e.jsx(t,{children:"Sent"}),e.jsx(t,{className:"text-right",children:"Actions"})]})}),e.jsx(k,{children:h.recent.length===0?e.jsx(x,{children:e.jsx(a,{colSpan:7,className:"py-8 text-center text-muted-foreground",children:"No drip emails dispatched yet."})}):h.recent.map(s=>e.jsxs(x,{children:[e.jsxs(a,{children:[e.jsx("div",{className:"text-xs font-medium",children:s.user_name??"—"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.user_email??`#${s.user_id}`})]}),e.jsx(a,{className:"font-mono text-xs",children:s.slug}),e.jsx(a,{className:"text-xs text-muted-foreground",children:s.journey_kind??"—"}),e.jsx(a,{className:"text-xs",children:s.locale??s.user_locale??"—"}),e.jsx(a,{children:e.jsx(I,{variant:s.status==="sent"?"success":s.status==="failed"?"destructive":"secondary",children:s.status})}),e.jsx(a,{className:"text-xs text-muted-foreground",children:s.sent_at?new Date(s.sent_at).toLocaleStr
2ing():"—"}),e.jsxs(a,{className:"text-right space-x-1",children:[e.jsx(c,{size:"sm",variant:"outline",onClick:()=>{g.post(route("admin.marketing.drip.toggle",s.user_id),{action:s.unsubscribed?"enable":"disable"},{preserveScroll:!0})},children:s.unsubscribed?"Re-enable":"Unsubscribe"}),e.jsx(c,{size:"sm",variant:"outline",onClick:()=>{g.post(route("admin.marketing.drip.dispatch",s.user_id),{},{preserveScroll:!0})},children:"Run today"})]})]},s.id))})]})]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Drip data unavailable."})}),e.jsx(b,{value:"suppressions",className:"space-y-4",children:f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-6 gap-2",children:[e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Total"}),e.jsx("p",{className:"text-xl font-semibold",children:f.totals.all})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-red-500 uppercase tracking-wide",children:"Hard bounce"}),e.jsx("p",{className:"text-xl font-semibold text-red-500",children:f.totals.hard_bounce})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-amber-500 uppercase tracking-wide",children:"Soft repeat"}),e.jsx("p",{className:"text-xl font-semibold",children:f.totals.soft_repeated})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-red-500 uppercase tracking-wide",children:"Complaint"}),e.jsx("p",{className:"text-xl font-semibold text-red-500",children:f.totals.complaint})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Unsubscribed"}),e.jsx("p",{className:"text-xl font-semibold",children:f.totals.unsubscribed})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Manual"}),e.jsx("p",{className:"text-xl font-semibold",children:f.totals.manual})]})]}),e.jsxs("form",{onSubmit:s=>{s.preventDefault();const n=new FormData(s.currentTarget),p=String(n.get("email")??"").trim(),N=String(n.get("reason")??"manual"),z=String(n.get("note")??"");p&&(g.post(route("admin.marketing.suppressions.store"),{email:p,reason:N,note:z},{preserveScroll:!0}),s.currentTarget.reset())},className:"flex flex-wrap items-end gap-2 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex-1 min-w-[200px]",children:[e.jsx(i,{htmlFor:"sup_email",className:"text-xs",children:"Add to suppression list"}),e.jsx(o,{id:"sup_email",name:"email",type:"email",placeholder:"[email protected]",required:!0,className:"mt-1"})]}),e.jsxs("select",{name:"reason",defaultValue:"manual",className:"h-9 rounded-md border bg-background px-2 text-sm",children:[e.jsx("option",{value:"manual",children:"manual"}),e.jsx("option",{value:"hard_bounce",children:"hard_bounce"}),e.jsx("option",{value:"soft_bounce_repeated",children:"soft_bounce_repeated"}),e.jsx("option",{value:"complaint",children:"complaint"}),e.jsx("option",{value:"invalid_address",children:"invalid_address"})]}),e.jsx(o,{name:"note",placeholder:"Optional note",className:"flex-1 min-w-[200px]"}),e.jsx(c,{type:"submit",size:"sm",children:"Suppress"})]}),e.jsxs(w,{children:[e.jsx(S,{children:e.jsxs(x,{children:[e.jsx(t,{children:"Email"}),e.jsx(t,{children:"Reason"}),e.jsx(t,{children:"Source"}),e.jsx(t,{children:"Code"}),e.jsx(t,{children:"Suppressed"}),e.jsx(t,{className:"text-right",children:"Actions"})]})}),e.jsx(k,{children:f.recent.length===0?e.jsx(x,{children:e.jsx(a,{colSpan:6,className:"py-8 text-center text-muted-foreground",children:"No suppressed addresses."})}):f.recent.map(s=>e.jsxs(x,{children:[e.jsx(a,{className:"font-mono text-xs",children:s.email}),e.jsx(a,{children:e.jsx(I,{variant:s.reason==="hard_bounce"||s.reason==="complaint"?"destructive":"secondary",children:s.reason})}),e.jsx(a,{className:"text-xs text-muted-foreground",children:s.source}),e.jsx(a,{className:"text-xs",children:s.error_code??"—"}),e.jsx(a,{className:"text-xs text-muted-foreground",children:s.suppressed_at?new Date(s.suppressed_at).toLocaleStr
2ing():"—"}),e.jsx(a,{className:"text-right",children:e.jsx(c,{size:"sm",variant:"outline",onClick:()=>{window.confirm(`Remove ${s.email} from suppression list?`)&&g.delete(route("admin.marketing.suppressions.destroy",s.id),{preserveScroll:!0})},children:"Remove"})})]},s.id))})]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No suppression data."})}),e.jsx(b,{value:"deliverability",className:"space-y-4",children:r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sending domain"}),e.jsx("p",{className:"font-mono text-base",children:r.domain||"— (set MAIL_FROM_ADDRESS)"}),e.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["DKIM selector: ",e.jsx("code",{className:"font-mono",children:r.dkim_selector})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-2",children:[e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"SPF"}),e.jsx("p",{className:`text-lg font-semibold ${r.dns.spf?.exists?"text-emerald-500":"text-red-500"}`,children:r.dns.spf?.exists?"OK":"Missing"}),r.dns.spf?.value?e.jsx("p",{className:"mt-1 text-[10px] font-mono text-muted-foreground break-all",children:r.dns.spf.value}):null]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"DKIM"}),e.jsx("p",{className:`text-lg font-semibold ${r.dns.dkim?.public_key_present?"text-emerald-500":"text-red-500"}`,children:r.dns.dkim?.public_key_present?"OK":"Missing"}),r.dns.dkim?.host?e.jsx("p",{className:"mt-1 text-[10px] font-mono text-muted-foreground break-all",children:r.dns.dkim.host}):null]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"DMARC"}),e.jsx("p",{className:`text-lg font-semibold ${r.dns.dmarc?.exists?"text-emerald-500":"text-red-500"}`,children:r.dns.dmarc?.exists?r.dns.dmarc.policy??"OK":"Missing"}),r.dns.dmarc?.host?e.jsx("p",{className:"mt-1 text-[10px] font-mono text-muted-foreground break-all",children:r.dns.dmarc.host}):null]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"MX"}),e.jsx("p",{className:`text-lg font-semibold ${r.dns.mx.exists?"text-emerald-500":"text-red-500"}`,children:r.dns.mx.exists?`${r.dns.mx.count} records`:"Missing"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"30-day deliverability metrics"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-2",children:[e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Sent"}),e.jsx("p",{className:"text-xl font-semibold",children:r.metrics_30d.sent})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Hard bounce"}),e.jsx("p",{className:"text-xl font-semibold text-red-500",children:r.metrics_30d.hard_bounce})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Bounce rate"}),e.jsxs("p",{className:`text-xl font-semibold ${r.metrics_30d.bounce_rate>5?"text-red-500":r.metrics_30d.bounce_rate>2?"text-amber-500":""}`,children:[r.metrics_30d.bounce_rate,"%"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"target < 2%"})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Complaints"}),e.jsx("p",{className:"text-xl font-semibold text-red-500",children:r.metrics_30d.complaint})]}),e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Complaint rate"}),e.jsxs("p",{className:`text-xl font-semibold ${r.metrics_30d.complaint_rate>.3?"text-red-500":r.metrics_30d.complaint_rate>.1?"text-amber-500":""}`,children:[r.metrics_30d.complaint_rate,"%"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Gmail kapı: 0.3%"})]})]})]}),e.jsxs("div",{className:"rounded-lg border p-3 text-xs text-muted-foreground space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"SPF örnek:"})," ",e.jsx("code",{children:"v=spf1 include:_spf.your-esp.com -all"})]}),e.jsxs("p",{children:[e.jsx("strong",{children:"DMARC örnek:"})," ",e.jsxs("code",{children:["v=DMARC1; p=quarantine; rua=mailto:dmarc@",r.domain||"yourdomain.com"]})]}),e.jsxs("p",{children:[e.jsx("strong",{children:"DKIM:"}
2)," ESP'nizin verdiği TXT record'unu ",e.jsxs("code",{children:[r.dkim_selector,"._domainkey.",r.domain||"yourdomain.com"]})," olarak yayımlayın."]})]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No deliverability data."})}),e.jsx(b,{value:"logs",className:"space-y-4",children:e.jsxs(w,{children:[e.jsx(S,{children:e.jsxs(x,{children:[e.jsx(t,{children:"Campaign"}),e.jsx(t,{children:"Level"}),e.jsx(t,{children:"Event"}),e.jsx(t,{children:"Message"}),e.jsx(t,{children:"Created"})]})}),e.jsx(k,{children:W.length===0?e.jsx(x,{children:e.jsx(a,{colSpan:5,className:"py-8 text-center text-muted-foreground",children:"No campaign logs yet."})}):W.map(s=>e.jsxs(x,{children:[e.jsx(a,{className:"font-medium",children:s.campaign_name||"—"}),e.jsx(a,{children:e.jsx(I,{variant:s.level==="error"?"destructive":s.level==="warning"?"warning":"secondary",children:s.level})}),e.jsx(a,{className:"font-mono text-xs",children:s.event}),e.jsx(a,{children:s.message||"—"}),e.jsx(a,{className:"text-muted-foreground",children:s.created_at?new Date(s.created_at).toLocaleString():"—"})]},s.id))})]})})]}),e.jsx(B,{open:je,onOpenChange:C,children:e.jsx(H,{className:"max-h-[90vh] max-w-lg overflow-y-auto",children:e.jsxs("form",{onSubmit:ye,children:[e.jsxs(K,{children:[e.jsx(V,{children:"Email (SMTP) settings"}),e.jsxs("p",{className:"text-sm text-muted-foreground text-left",children:["Values are written to the server ",e.jsx("span",{className:"font-mono",children:".env"})," file and config cache is cleared."]})]}),e.jsxs("div",{className:"grid gap-3 py-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(i,{htmlFor:"m_mailer",children:"Driver"}),e.jsx(o,{id:"m_mailer",value:d.data.mail_mailer,onChange:s=>d.setData("mail_mailer",s.target.value),className:"mt-1",placeholder:"smtp"})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(i,{htmlFor:"m_host",children:"Host"}),e.jsx(o,{id:"m_host",value:d.data.mail_host,onChange:s=>d.setData("mail_host",s.target.value),className:"mt-1",required:!0})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"m_port",children:"Port"}),e.jsx(o,{id:"m_port",type:"number",value:d.data.mail_port,onChange:s=>d.setData("mail_port",parseInt(s.target.value,10)||0),className:"mt-1",required:!0})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"m_enc",children:"Encryption"}),e.jsx(o,{id:"m_enc",value:d.data.mail_encryption,onChange:s=>d.setData("mail_encryption",s.target.value),className:"mt-1",placeholder:"tls, ssl, or empty"})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(i,{htmlFor:"m_user",children:"Username"}),e.jsx(o,{id:"m_user",value:d.data.mail_username,onChange:s=>d.setData("mail_username",s.target.value),className:"mt-1",required:!0})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(i,{htmlFor:"m_pass",children:"Password"}),e.jsx(o,{id:"m_pass",type:"password",autoComplete:"off",placeholder:j.mail_password_is_set?"Leave blank to keep current":"",value:d.data.mail_password,onChange:s=>d.setData("mail_password",s.target.value),className:"mt-1"})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(i,{htmlFor:"m_from",children:"From address"}),e.jsx(o,{id:"m_from",type:"email",value:d.data.mail_from_address,onChange:s=>d.setData("mail_from_address",s.target.value),className:"mt-1",required:!0})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(i,{htmlFor:"m_from_name",children:"From name"}),e.jsx(o,{id:"m_from_name",value:d.data.mail_from_name,onChange:s=>d.setData("mail_from_name",s.target.value),className:"mt-1"})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(i,{htmlFor:"m_reply_to",children:"Reply-To address"}),e.jsx(o,{id:"m_reply_to",type:"email",value:d.data.mail_reply_to,onChange:s=>d.setData("mail_reply_to",s.target.value),className:"mt-1",placeholder:"[email protected]"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Replies to transactional/drip mails go here. Leave blank to use From address."})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(i,{htmlFor:"m_unsub_mailto",children:"List-Unsubscribe mailto"}),e.jsx(o,{id:"m_unsub_mailto",type:"email",value:d.data.mail_unsubscribe_mailto,onChange:s=>d.setData("mail_unsubscribe_mailto",s.target.value),className:"mt-1",placeholder:"[email protected]"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Used in the List-Unsubscribe header. Auto-derived from From address if blank."})]})]}),e.jsxs("div",{className:"mb-4 rounded-md border border-border p-3",children:[e.jsx(i,{htmlFor:"m_test_to",children:"Test recipient"}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[e.jsx(o,{id:"m_test_to",type:"email",className:"max-w-xs flex-1",placeholder:"[email protected]",value:_.data.to,onChange:s=>_.setData("to",s.target.value)}),e.jsx(c,{type:"button",variant:"secondary",disabled:_.processing||!_.data.to,onClick:()=>_.post(route("admin.security.test-mail"),{preserveScroll:!0}),children:_.processing?"Sending…":"Send test"})]}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Uses saved SMTP credentials (save first if you just changed them)."})]}),e.jsxs(X,{className:"gap-2 sm:gap-0",children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>C(!1),children:"Close"}),e.jsx(c,{type:"submit",disabled:d.processing,children:d.processing?"Saving…":"Save to .env"})]})]})})})]})]})})})}function $({message:u}){return u?e.jsx("p",{className:"mt-1 text-sm text-destructive",children:u}):null}export{ps 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.