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.10.js";import{u as I,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as L}from"./SnackMsg.7BjcJK1j.js";import{S as z}from"./Steps.B84Ui3GU.js";import{I as T,g as K}from"./Integrations.BFhED4ck.js";import P from"./MailjetAuthorization.B9nhguM1.js";import{c as q}from"./MailjetCommonFunc.BV-1x4TT.js";import{M as A}from"./MailjetIntegLayout.fA9Egq9Q.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function st({formFields:s,setFlow:t,flow:e,allIntegURL:d}){const u=I(),[M,f]=o.useState(!1),[g,b]=o.useState({auth:!1,customFields:!1,lists:!1}),[r,j]=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=x=>{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&&j(x)};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:j,loading:g,setLoading:b,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:b,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};
