var w=Object.defineProperty;var v=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var S=(e,t,s)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,j=(e,t)=>{for(var s in t||(t={}))I.call(t,s)&&S(e,s,t[s]);if(v)for(var s of v(t))F.call(t,s)&&S(e,s,t[s]);return e};import{j as a,_ as M,z as m}from"./main.2.8.10.js";import{u as L,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as T}from"./SnackMsg.7BjcJK1j.js";import{S as z}from"./Steps.B84Ui3GU.js";import{I as E,g as P}from"./Integrations.BFhED4ck.js";import{c as C}from"./MailsterCommonFunc.Dwztgq2W.js";import{M as A}from"./MailsterIntegLayout.ByY0q9fS.js";import B from"./MailsterAuthorization.BszF4B5Q.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./TutorialLink.D6K_DiHL.js";function st({formFields:e,setFlow:t,flow:s,allIntegURL:p}){const d=L(),[k,f]=o.useState(!1),[g,u]=o.useState({auth:!1,fields:!1,lists:!1,tags:!1}),[r,x]=o.useState(1),[y,l]=o.useState({show:!1}),[i,c]=o.useState({name:"Mailster",type:"Mailster",field_map:[{formField:"",mailsterFormField:""}],mailsterFields:[],selectedStatus:"",lists:[],selectedLists:"",tags:[],selectedTags:""}),N=()=>{f(!0),P(s,t,p,i,d,"","",f).then(n=>{var h;n.success?(m.success((h=n.data)==null?void 0:h.msg),d(p)):m.error(n.data||n)})},_=b=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!C(i)){m.error(M("Please map mandatory fields","bit-integrations"));return}i.field_map.length>0&&x(b)};return a.jsxs("div",{children:[a.jsx(T,{snack:y,setSnackbar:l}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(z,{step:3,active:r})}),a.jsx(B,{mailsterConf:i,setMailsterConf:c,step:r,setStep:x,loading:g,setLoading:u,setSnackbar:l}),a.jsxs("div",{className:"btcd-stp-page",style:j({},r===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(A,{formFields:e,mailsterConf:i,setMailsterConf:c,loading:g,setLoading:u,setSnackbar:l}),a.jsxs("button",{onClick:()=>_(3),disabled:!C(i),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(E,{step:r,saveConfig:()=>N(),isLoading:k,dataConf:i,setDataConf:c,formFields:e})]})}export{st as default};
