import{D as b,E as x,q as m,f as t,j as e,G as u,e as s,H as r,K as v,B as o,M as S,N as P,n as N,O as w,P as T}from"./main-few-lands-burn.js";import{u as M,T as k,S as z,C as L,R as C}from"./index-ubWv-fhI.js";import{C as c}from"./index-Budcgb8A.js";import"./index-CyNIBchZ.js";function B(){const a=b();return x({mutationFn:()=>m("smtp/install",{}),mutationKey:["smtp-install"],onSuccess:()=>{a.invalidateQueries({queryKey:["smtp-status"]})}})}function j(){return M({queryFn:()=>m("smtp/status",void 0,void 0,"GET"),queryKey:["smtp-status"],select:a=>a.data})}const q=N.PLUGIN_ADMIN_URL.replace(/admin\.php\?page=.+/,"admin.php?page=bit-smtp"),{Paragraph:E,Text:i,Title:d}=k,I=[{description:s("Deliver emails via Gmail, SendGrid, Mailgun, Amazon SES, and more instead of unreliable PHP mail()."),icon:e(u,{size:20}),title:s("SMTP Provider Support")},{description:s("Emails sent from your flows reach the inbox reliably — no more silent failures or spam folder drops."),icon:e(w,{size:20}),title:s("Reliable Delivery")},{description:s("Full email log with status, subject, recipient, and content — so you can debug failed sends easily."),icon:e(T,{size:20}),title:s("Email Logs")}];function D(){const{data:a,isLoading:p}=j(),{error:h,isError:g,isPending:l,mutate:f}=B(),y=a?.active===!0;return t("div",{className:"p-6",children:[t("div",{className:"mb-6",children:[t("div",{className:"mb-2 flex items-center gap-3",children:[e("span",{className:"rounded-xl flex h-10 w-10 items-center justify-center bg-blue-50 text-blue-600 dark:bg-blue-900/20 dark:text-blue-400",children:e(u,{size:22})}),e(d,{className:"!mb-0",level:3,children:s("SMTP Configuration")})]}),e(i,{type:"secondary",children:s(`Bit Flows sends emails in your automations (e.g. "Send Email" actions). WordPress's default PHP mail() is often blocked or marked as spam — install Bit SMTP to send through a real mail provider.`)})]}),t(c,{className:"mb-6",children:[p?e(z,{active:!0,paragraph:{rows:1}}):y?t("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[t("div",{className:"flex items-start gap-3",children:[e(r,{className:"mt-0.5 shrink-0 text-green-500",size:22}),t("div",{children:[e(i,{strong:!0,children:s("Bit SMTP is installed and active")}),e("br",{}),e(i,{className:"text-sm",type:"secondary",children:s("Your email actions in flows will use SMTP for delivery. Configure your provider in the Bit SMTP settings.")})]})]}),e(o,{href:q,icon:e(v,{size:15}),size:"large",target:"_blank",type:"default",children:s("View SMTP Settings")})]}):t("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[t("div",{className:"flex items-start gap-3",children:[e(S,{className:"mt-0.5 shrink-0 text-amber-500",size:20}),t("div",{children:[e(i,{strong:!0,children:s("Bit SMTP is not installed")}),e("br",{}),e(i,{className:"text-sm",type:"secondary",children:s("Without SMTP, email actions in your flows rely on PHP mail(), which frequently fails or lands in spam.")})]})]}),e(o,{disabled:l,icon:l?void 0:e(r,{size:15}),loading:l,onClick:()=>f(),size:"large",type:"primary",children:l?s("Installing…"):s("Install & Activate Bit SMTP")})]}),g&&e(P,{className:"mt-4",description:h?.message??s("Something went wrong. Please try again."),message:s("Installation failed"),showIcon:!0,type:"error"})]}),e(d,{className:"!mb-4",level:5,children:s("What Bit SMTP adds to your flows")}),e(C,{gutter:[16,16],children:I.map(n=>e(L,{lg:8,md:24,xs:24,children:t(c,{className:"h-full",size:"small",children:[e("div",{className:"mb-2 flex h-8 w-8 items-center justify-center rounded-lg bg-blue-50 text-blue-600 dark:bg-blue-900/20 dark:text-blue-400",children:n.icon}),e(i,{className:"mb-1 block text-sm",strong:!0,children:n.title}),e(E,{className:"!mb-0 text-xs",type:"secondary",children:n.description})]})},n.title))})]})}export{D as default};
