1import"../chunks/NZTpNUN0.js";import{p as X,l as P,v as Z,a as r,b as ee,s as te,c as g,f as _,e as re,n as u,r as v,d as c,i as G,g as S,o,j as n,t as oe}from"../chunks/CswluXHk.js";import{s as ae}from"../chunks/D5MUd0dc.js";import{i as O}from"../chunks/Cvwav-Rz.js";import{c as y}from"../chunks/DCqg9Lcd.js";import{d as se,a as ne}from"../chunks/BnZqlU5Q.js";import{g as ie}from"../chunks/CdQ3TTyj.js";import{p as de}from"../chunks/BfpkmJ9v.js";import"../chunks/aH0YTA77.js";import{t as C}from"../chunks/CFi-xeDB.js";import{B as R}from"../chunks/DltdByd6.js";import{I as le}from"../chunks/DuX34-Zw.js";import{C as ce}from"../chunks/BFGY4aR1.js";import{C as pe}from"../chunks/C3F0Z4bJ.js";import{C as me,a as fe,b as ge}from"../chunks/DQXZ4mXD.js";import{C as ue}from"../chunks/BcsrqGLJ.js";import{A as ve}from"../chunks/r7UZdRXb.js";var ye=_("<!> <!>",1),_e=_('<p class="text-red-500 text-sm"> </p>'),$e=_(`<form class="space-y-4"><div class="space-y-2"><label for="apiKey" class="text-sm font-medium">API Key</label> <!> <p class="text-sm text-gray-500">Your SendGrid API key can be found in your account settings under 2 API Keys.</p></div> <!></form>`),he=_('<div class="flex items-center gap-4"><p class="text-sm text-gray-500">Need help? <a href="https://docs.sendgrid.com/ui/account-and-settings/api-keys" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline">Learn how to get your API key</a></p></div> <div class="space-x-2"><!> <!></div>',1),xe=_("<!> <!> <!>",1),be=_('<div class="mb-20"><button class="flex items-center text-sm text-gray-600 hover:text-gray-900 mb-4"><!> Back to Integrations</button> <!></div>');function Je(J,j){X(j,!0);const q=()=>re(de,"$page",D),[D,Y]=te(),{sendgridIntegration:K,team:F}=j.data;let $=P(Z(K?.config?.api_key||"")),i=P(""),w=P(!1),A=P(!1);async function z(){try{if(o(i,""),o(w,!0),!n($)){o(i,"API Key is required");return}const t=await fetch("/api/install/sendgrid",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({teamId:F.id,config:{api_key:n($)}})}),h=await t.json();if(!t.ok)throw new Error(h.error||"Failed to save integration");C.success("SendGrid integration saved successfully",{position:"top-right"})}catch(t){console.error("Error saving SendGrid integration:",t),o(i,t.message||"Failed to save integration",!0),C.error(n(i),{position:"top-right"})}finally{o(w,!1)}}async function H(){try{o(A,!0);const t=await fetch("/api/install/sendgrid",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({teamId:F.id})}),h=await t.json();if(!t.ok)throw new Error(h.error||"Failed to remove integration");o($,""),C.success("SendGrid integration removed successfully",{position:"top-right"})}catch(t){console.error("Error removing SendGrid integration:",t),o(i,t.message||"Failed to remove integration",!0),C.error(n(i),{position:"top-right"})}finally{o(A,!1)}}var E=be(),I=g(E),M=g(I);ve(M,{class:"w-4 h-4 mr-1"}),u(),v(I);var Q=c(I,2);y(Q,()=>ce,(t,h)=>{h(t,{class:"my-4",children:(U,ke)=>{var L=xe(),T=G(L);y(T,()=>me,(x,b)=>{b(x,{children:(k,N)=>{var a=ye(),s=G(a);y(s,()=>fe,(p,m)=>{m(p,{class:"text-lg font-semibold",children:(e,d)=>{u();var l=S("SendGrid Integration");r(e,l)},$$slots:{default:!0}})});var f=c(s,2);y(f,()=>ge,(p,m)=>{m(p,{children:(e,d)=>{u();var l=S(`Connect your SendGrid account to sync contacts and manage email 3 campaigns.`);r(e,l)},$$slots:{default:!0}})}),r(k,a)},$$slots:{default:!0}})});var B=c(T,2);y(B,()=>pe,(x,b)=>{b(x,{children:(k,N)=>{var a=$e(),s=g(a),f=c(g(s),2);le(f,{id:"apiKey",type:"text",placeholder:"Enter your SendGrid API key",class:"w-full",get value(){return n($)},set value(e){o($,e,!0)}}),u(2),v(s);var p=c(s,2);{var m=e=>{var d=_e(),l=g(d,!0);v(d),oe(()=>ae(l,n(i))),r(e,d)};O(p,e=>{n(i)&&e(m)})}v(a),r(k,a)},$$slots:{default:!0}})});var V=c(B,2);y(V,()=>ue,(x,b)=>{b(x,{class:"flex justify-between items-center border-t bg-gray-50 rounded-b-[11px] py-4",children:(k,N)=>{var a=he(),s=c(G(a),2),f=g(s);{var p=e=>{R(e,{variant:"destructive",onclick:H,get isLoading(){return n(A)},children:(d,l)=>{u();var W=S("Remove Connection");r(d,W)},$$slots:{default:!0}})};O(f,e=>{K?.config?.api_key&&e(p)})}var m=c(f,2);R(m,{type:"button",onclick:z,get isLoading(){return n(w)},children:(e,d)=>{u();var l=S("Save Integration");r(e,l)}
3,$$slots:{default:!0}}),v(s),r(k,a)},$$slots:{default:!0}})}),r(U,L)},$$slots:{default:!0}})}),v(E),ne("click",I,()=>ie(`/brand/${q().params.teamSlug}/settings/integrations`)),r(J,E),ee(),Y()}se(["click"]);export{Je as component}; 4//# sourceMappingURL=47.BmLKXxYz.js.map
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.