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