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{G as C,r as m,j as a,S as F,z as d}from"./main-343.js";import"./bf-649-79.js";import{S as N}from"./bf-149-261.js";import{a7 as b}from"./bf-659-81.js";import{I as w}from"./bf-58-184.js";import{N as z}from"./bf-713-109.js";import P from"./bf-204-125.js";import{h as E,c as T}from"./bf-310-181.js";import{M as q}from"./bf-391-225.js";import"./bf-974-82.js";import"./bf-750-180.js";import"./bf-684-182.js";import"./bf-594-113.js";function Z({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(!T(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(P,{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=>E(o,i,c),mailerLiteConf:i,setMailerLiteConf:c,isLoading:g,setIsLoading:p,setSnackbar:l}),a.jsx(z,{nextPageHandler:()=>y(3)})]}),a.jsx(w,{step:r,saveConfig:()=>M()})]})}export{Z as default};
