var _=Object.defineProperty;var v=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var S=(s,t,e)=>t in s?_(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,y=(s,t)=>{for(var e in t||(t={}))w.call(t,e)&&S(s,e,t[e]);if(v)for(var e of v(t))E.call(t,e)&&S(s,e,t[e]);return s};import{_ as m,j as a,z as p}from"./main.2.8.1.js";import{u as I,d as o}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as L}from"./SnackMsg.S8DrwLlT.js";import{S as z}from"./Steps.1hz7v9Vj.js";import{I as T,g as K}from"./Integrations.D2bgBas2.js";import P from"./MailjetAuthorization.BXB5MxIa.js";import{c as q}from"./MailjetCommonFunc.DO_cpz0R.js";import{M as A}from"./MailjetIntegLayout.D3LSNvil.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function st({formFields:s,setFlow:t,flow:e,allIntegURL:d}){const u=I(),[M,f]=o.useState(!1),[g,j]=o.useState({auth:!1,customFields:!1,lists:!1}),[r,x]=o.useState(1),[k,c]=o.useState({show:!1}),C=[{key:"Email",label:m("Email","bit-integrations"),required:!0}],[i,l]=o.useState({name:"Mailjet",type:"Mailjet",apiKey:"",secretKey:"",field_map:[{formField:"",mailjetFormField:""}],staticFields:C,lists:[],customFields:[],selectedLists:"",groups:[],actions:{}}),F=()=>{f(!0),K(e,t,d,i,u,"","",f).then(n=>{var h;n.success?(p.success((h=n.data)==null?void 0:h.msg),u(d)):p.error(n.data||n)})},N=b=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!q(i)){p.error(m("Please map mandatory fields","bit-integrations"));return}i.field_map.length>0&&x(b)};return a.jsxs("div",{children:[a.jsx(L,{snack:k,setSnackbar:c}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(z,{step:3,active:r})}),a.jsx(P,{mailjetConf:i,setMailjetConf:l,step:r,setStep:x,loading:g,setLoading:j,setSnackbar:c}),a.jsxs("div",{className:"btcd-stp-page",style:y({},r===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(A,{formFields:s,mailjetConf:i,setMailjetConf:l,loading:g,setLoading:j,setSnackbar:c}),a.jsxs("button",{onClick:()=>N(3),disabled:!(i!=null&&i.selectedLists),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations"),"  ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(T,{step:r,saveConfig:()=>F(),isLoading:M,dataConf:i,setDataConf:l,formFields:s})]})}export{st as default};
