PageSourceSearch

https://arsitios.com/build/assets/EmailSettingsTab-lsOPAu5j.js

js arsitios.com collected 2026-10-02 00:28:41 UTC 7,636 bytes, 1 lines download raw bytes

1import{j as e}from"./radix-ui-DHg0P0-S.js";import{u as D,l as R,C as B,f as O,g as V,m as A,h as H,L as l,B as x,E as Y,r as z}from"./app-CxedAqe5.js";import{a as h}from"./monaco-editor-qnYGAC4j.js";import{I as n}from"./input-nZMiT4KD.js";import{S as f,a as v,b as g,c as N,d as S}from"./select-DaLkKxd-.js";import{C as U}from"./checkbox--7v6D8-F.js";import{S as _}from"./separator-DWqZ3Xk-.js";import{B as q}from"./badge-krkS0PR_.js";import{t as o}from"./index-DQ_dvxAD.js";import{C as G}from"./check-B17N6gqb.js";import{E as J}from"./eye-off-B_v9et64.js";import{L as y}from"./loader-circle-xQ_6etjc.js";import{S as K}from"./send-CKrQwvxf.js";import{S as Q}from"./save-B6TE313o.js";import"./react-vendor-DFVNanZi.js";import"./chevron-down-C1mKpdkx.js";function pe({settings:i,notificationEvents:C}){const{t:a}=D(),[u,c]=h.useState(!1),[d,E]=h.useState(""),[p,b]=h.useState(!1),w=[{value:"sendmail",label:a("Sendmail")},{value:"smtp",label:a("SMTP")}],T=[{value:"tls",label:a("TLS")},{value:"ssl",label:a("SSL")},{value:"none",label:a("None")}],{data:t,setData:m,put:F,processing:j,errors:r}=R({mail_mailer:i.mail_mailer||"smtp",smtp_host:i.smtp_host||"",smtp_port:i.smtp_port?.toString()||"587",smtp_username:i.smtp_username||"",smtp_password:"",smtp_encryption:i.smtp_encryption||"tls",mail_from_address:i.mail_from_address||"",mail_from_name:i.mail_from_name||"",admin_notification_email:i.admin_notification_email||"",admin_notification_events:i.admin_notification_events||[]}),P=s=>{s.preventDefault(),F(route("admin.settings.email"),{preserveScroll:!0,onSuccess:()=>o.success(a("Email settings updated")),onError:()=>o.error(a("Failed to update settings"))})},k=()=>{if(!d){o.error(a("Please enter an email address"));return}c(!0),z.post(route("admin.settings.email.test"),{email:d},{preserveScroll:!0,onSuccess:()=>{o.success(a("Test email sent to :email",{email:d})),c(!1)},onError:s=>{o.error(s.email||a("Failed to send test email")),c(!1)}})},I=s=>{const L=t.admin_notification_events.includes(s)?t.admin_notification_events.filter(M=>M!==s):[...t.admin_notification_events,s];m("admin_notification_events",L)};return e.jsxs(B,{children:[e.jsxs(O,{children:[e.jsx(V,{children:a("Email Settings")}),e.jsx(A,{children:a("Configure email delivery and notification settings")})]}),e.jsx(H,{children:e.jsxs("form",{onSubmit:P,className:"space-y-8",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-medium",children:a("Sender Information")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"mail_from_name",children:a("From Name")}),e.jsx(n,{id:"mail_from_name",value:t.mail_from_name,onChange:s=>m("mail_from_name",s.target.value),placeholder:a("Your Site Name")}),r.mail_from_name&&e.jsx("p",{className:"text-sm text-destructive",children:r.mail_from_name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"mail_from_address",children:a("From Email")}),e.jsx(n,{id:"mail_from_address",type:"email",value:t.mail_from_address,onChange:s=>m("mail_from_address",s.target.value),placeholder:a("[email protected]")}),r.mail_from_address&&e.jsx("p",{className:"text-sm text-destructive",children:r.mail_from_address})]})]})]}),e.jsx(_,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-medium",children:a("Mail Driver")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"mail_mailer",children:a("Email Driver")}),e.jsxs(f,{value:t.mail_mailer,onValueChange:s=>m("mail_mailer",s),children:[e.jsx(v,{className:"max-w-xs",children:e.jsx(g,{})}),e.jsx(N,{children:w.map(s=>e.jsx(S,{value:s.value,children:s.label},s.value))})]})]}),t.mail_mailer==="smtp"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 ps-6 border-s-2 border-muted",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"smtp_host",children:a("SMTP Host")}),e.jsx(n,{id:"smtp_host",value:t.smtp_host,onChange:s=>m("smtp_host",s.target.value),placeholder:a("smtp.example.com")}),r.smtp_host&&e.jsx("p",{className:"text-sm text-destructive",children:r.smtp_host})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"smtp_port",children:a("SMTP Port")}),e.jsx(n,{id:"smtp_port",type:"number",value:t.smtp_port,onChange:s=>m("smtp_port",s.target.value),placeholder:"587"}),r.smtp_port&&e.jsx("p",{className:"text-sm text-destructive",children:r.smtp_port})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"smtp_username",children:a("SMTP Username")}),e.jsx(n,{id:"smtp_username",value:t.smtp_username,onChange:s=>m("smtp_username",s.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{htmlFor:"smtp_password",children:a("SMTP Password")}),i.smtp_has_password&&e.jsxs(q,{variant:"success",className:"text-xs",children:[e.jsx(G,{className:"h-3 w-3 me-1"}),a("Configured")]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(n,{id:"smtp_password",type:p?"text":"password",value:t.smtp_password,onChange:s=>m("smtp_password",s.target.value),placeholder:i.smtp_has_password?a("Leave blank to keep existing"):a("Enter password")}),e.jsx(x,{type:"button",variant:"ghost",size:"sm",className:"absolute end-2 top-1/2 -translate-y-1/2",onClick:()=>b(!p),children:p?e.jsx(J,{className:"h-4 w-4"}):e.jsx(Y,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"smtp_encryption",children:a("Encryption")}),e.jsxs(f,{value:t.smtp_encryption,onValueChange:s=>m("smtp_encryption",s),children:[e.jsx(v,{children:e.jsx(g,{})}),e.jsx(N,{children:T.map(s=>e.jsx(S,{value:s.value,children:s.label},s.value))})]})]})]})]}),e.jsx(_,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-medium",children:a("Admin Notifications")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"admin_notification_email",children:a("Admin Email")}),e.jsx(n,{id:"admin_notification_email",type:"email",value:t.admin_notification_email,onChange:s=>m("admin_notification_email",s.target.value),placeholder:a("[email protected]"),className:"max-w-md"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("Receive notifications for important events")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:a("Notification 
1Events")}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:C.map(s=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(U,{id:s.value,checked:t.admin_notification_events.includes(s.value),onCheckedChange:()=>I(s.value)}),e.jsx(l,{htmlFor:s.value,className:"text-sm font-normal cursor-pointer",children:s.label})]},s.value))})]})]}),e.jsx(_,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-medium",children:a("Test Email")}),e.jsxs("div",{className:"flex gap-2 max-w-md",children:[e.jsx(n,{type:"email",placeholder:a("Enter email address"),value:d,onChange:s=>E(s.target.value)}),e.jsxs(x,{type:"button",variant:"outline",onClick:k,disabled:u||!t.mail_from_address,children:[u?e.jsx(y,{className:"h-4 w-4 me-2 animate-spin"}):e.jsx(K,{className:"h-4 w-4 me-2"}),a("Send Test Email")]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("Save your settings before sending a test email")})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs(x,{type:"submit",disabled:j,children:[j?e.jsx(y,{className:"h-4 w-4 me-2 animate-spin"}):e.jsx(Q,{className:"h-4 w-4 me-2"}),a("Save Changes")]})})]})})]})}export{pe 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.