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.1.js";import{u as L,d as o}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as T}from"./SnackMsg.S8DrwLlT.js";import{S as z}from"./Steps.1hz7v9Vj.js";import{I as E,g as P}from"./Integrations.D2bgBas2.js";import{c as C}from"./MailsterCommonFunc.CkwfErOT.js";import{M as A}from"./MailsterIntegLayout.DFS7vK6t.js";import B from"./MailsterAuthorization.DObLixBe.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";function st({formFields:e,setFlow:t,flow:s,allIntegURL:d}){const p=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,d,i,p,"","",f).then(n=>{var b;n.success?(m.success((b=n.data)==null?void 0:b.msg),p(d)):m.error(n.data||n)})},_=h=>{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(h)};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};
