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