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.9.0.js";import{u as I,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as L}from"./SnackMsg.DYSD96P4.js";import{S as z}from"./Steps.BYe8zHkm.js";import{I as T,g as K}from"./Integrations.DL8wqGct.js";import P from"./MailjetAuthorization.Sv7tff8p.js";import{c as q}from"./MailjetCommonFunc.Cs3is0ky.js";import{M as A}from"./MailjetIntegLayout.DvHWiToq.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
