var I=Object.defineProperty;var j=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var L=(s,e,t)=>e in s?I(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,S=(s,e)=>{for(var t in e||(e={}))_.call(e,t)&&L(s,t,e[t]);if(j)for(var t of j(e))k.call(e,t)&&L(s,t,e[t]);return s};import{D as C,r as m,j as a,S as F,V as d}from"./main-634.js";import"./bf-25-81.js";import{S as N}from"./bf-54-258.js";import{a7 as b}from"./bf-746-82.js";import{I as w}from"./bf-942-184.js";import{N as P}from"./bf-123-109.js";import E from"./bf-405-126.js";import{h as T,c as V}from"./bf-630-181.js";import{M as q}from"./bf-128-225.js";import"./bf-275-83.js";import"./bf-822-108.js";import"./bf-509-180.js";import"./bf-535-182.js";import"./bf-438-114.js";function $({formFields:s,setIntegration:e,integrations:t,allIntegURL:f}){const u=C(),[g,p]=m.useState(!1),[r,h]=m.useState(1),[v,l]=m.useState({show:!1}),[i,c]=m.useState({name:"MailerLite",type:"MailerLite",auth_token:"",field_map:[{formField:"",mailerLiteFormField:"email"}],mailer_lite_type:"",mailerLiteFields:[],groups:[],group_ids:[],actions:{}}),M=()=>{p(!0),b(t,e,f,i,u,"","").then(n=>{var x;n.success?(d.success((x=n.data)==null?void 0:x.msg),u(f)):d.error(n.data||n)})},y=o=>{if(!V(i)){d.error("Please map mandatory fields");return}i.field_map.length>0&&h(o),document.querySelector(".btcd-s-wrp").scrollTop=0};return a.jsxs("div",{children:[a.jsx(F,{snack:v,setSnackbar:l}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(N,{step:3,active:r})}),a.jsx(E,{mailerLiteConf:i,setMailerLiteConf:c,step:r,setstep:h,isLoading:g,setIsLoading:p,setSnackbar:l}),a.jsxs("div",{className:"btcd-stp-page",style:S({},r===2&&{width:900,height:"auto",overintegrations:"visible"}),children:[a.jsx(q,{formFields:s,handleInput:o=>T(o,i,c),mailerLiteConf:i,setMailerLiteConf:c,isLoading:g,setIsLoading:p,setSnackbar:l}),a.jsx(P,{nextPageHandler:()=>y(3)})]}),a.jsx(w,{step:r,saveConfig:()=>M()})]})}export{$ as default};
