1import{z as N,r as i,j as e,t as r}from"./index-CfcSdzPN.js";import{u}from"./useServerFn-DgcYVCxo.js";import{u as v}from"./useQuery-DDNSg42L.js";import{u as S}from"./useMutation-e7_SgXT4.js";import{B as x}from"./button-BIdGwjim.js";import{I as p}from"./input-t--B3OUq.js";import{L as d}from"./label-EVUrWavl.js";import{T as k}from"./textarea-Dzb9atqn.js";import{s as C,g as T}from"./integrations.functions-DvyOVYwu.js";import{R as w}from"./refresh-cw-7TxeeduW.js";import{C as F}from"./circle-check-DsoC23PS.js";import{T as R}from"./triangle-alert-H7dW3OPh.js";import{S as q}from"./send-CFsr5sxK.js";import"./index-CertmylC.js";import"./index-Bfj6Pq9H.js";import"./index-CIF9E9WT.js";import"./utils-DDt1maD9.js";function V(){const h=u(T),g=u(C),f=N(),t=v({queryKey:["integrations","resend","status"],queryFn:()=>h()}),[m,j]=i.useState(""),[c,b]=i.useState("Test email - RelyUp"),[l,y]=i.useState("<h1>Hello!</h1><p>This is a test email sent from the RelyUp platform.</p>"),a=S({mutationFn:()=>g({data:{to:m,subject:c,html:l}}),onSuccess:s=>{s.ok?r.success("Email sent successfully",{description:s.id?`ID: ${s.id}`:void 0}):r.error("Failed to send email",{description:s.error})},onError:s=>{r.error("Send error",{description:s instanceof Error?s.message:"Unknown error"})}}),n=t.data,o=!!n?.connected;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-background p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-display text-lg font-semibold",children:"Resend"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Transactional emails and platform notifications."})]}),e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>f.invalidateQueries({queryKey:["integrations","resend","status"]}),disabled:t.isFetching,children:[e.jsx(w,{className:`mr-2 h-4 w-4 ${t.isFetching?"animate-spin":""}`}),"Check"]})]}),e.jsx("div",{className:"mt-4",children:t.isLoading?e.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking connection..."}):o?e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-md bg-green-500/10 px-3 py-1.5 text-sm font-medium text-green-700 dark:text-green-400",children:[e.jsx(F,{className:"h-4 w-4"})," Connected"]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-md bg-yellow-500/10 px-3 py-1.5 text-sm font-medium text-yellow-700 dark:text-yellow-400",children:[e.jsx(R,{className:"h-4 w-4"})," Not connected"]}),n?.reason&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.reason})]})}),e.jsxs("p",{className:"mt-4 text-xs text-muted-foreground",children:["Sender:"," ",e.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"RelyUp <[email protected]>"})]})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-background p-5",children:[e.jsx("h3",{className:"font-display text-base font-semibold",children:"Send test email"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Emails are sent from"," ",e.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"[email protected]"}),". The ",e.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"ezok.ai"})," domain must be verified in the Resend dashboard (SPF/DKIM)."]}),e.jsxs("form",{className:"mt-4 space-y-4",onSubmit:s=>{if(s.preventDefault(),!o){r.error("Resend is not connected");return}a.mutate()},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(d,{htmlFor:"to",children:"To"}),e.jsx(p,{id:"to",type:"email",required:!0,placeholder:"[email protected]",value:m,onChange:s=>j(s.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(d,{htmlFor:"subject",children:"Subject"}),e.jsx(p,{id:"subject",required:!0,value:c,onChange:s=>b(s.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(d,{htmlFor:"html",children:"Content (HTML)"}),e.jsx(k,{id:"html",required:!0,rows:8,className:"font-mono text-xs",value:l,onCh
1ange:s=>y(s.target.value)})]}),e.jsxs(x,{type:"submit",disabled:!o||a.isPending,className:"bg-brand text-asphalt hover:bg-brand/90",children:[e.jsx(q,{className:"mr-2 h-4 w-4"}),a.isPending?"Sending...":"Send test email"]})]})]})]})}export{V as component};
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.