var N=Object.defineProperty;var v=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var j=(e,t,s)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,S=(e,t)=>{for(var s in t||(t={}))w.call(t,s)&&j(e,s,t[s]);if(v)for(var s of v(t))F.call(t,s)&&j(e,s,t[s]);return e};import{u as I,r as o,j as a}from"./main-333.js";import{d as L,_ as T,I as E,F as P,c as d}from"./bi.636.93.js";import{S as z}from"./bi.563.969.js";import{c as M}from"./bi.256.961.js";import{M as A}from"./bi.530.962.js";import B from"./bi.729.353.js";import"./bi.535.730.js";import"./bi.286.731.js";import"./bi.318.783.js";function W({formFields:e,setFlow:t,flow:s,allIntegURL:m}){const p=I(),[C,f]=o.useState(!1),[g,u]=o.useState({auth:!1,fields:!1,lists:!1,tags:!1}),[r,x]=o.useState(1),[_,l]=o.useState({show:!1}),[i,c]=o.useState({name:"Mailster",type:"Mailster",field_map:[{formField:"",mailsterFormField:""}],mailsterFields:[],selectedStatus:"",lists:[],selectedLists:"",tags:[],selectedTags:""}),k=()=>{f(!0),P(s,t,m,i,p,"","",f).then(n=>{var b;n.success?(d.success((b=n.data)==null?void 0:b.msg),p(m)):d.error(n.data||n)})},y=h=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!M(i)){d.error("Please map mandatory fields");return}i.field_map.length>0&&x(h)};return a.jsxs("div",{children:[a.jsx(L,{snack:_,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:S({},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:()=>y(3),disabled:!M(i),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[T("Next","bit-integrations"),"  ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(E,{step:r,saveConfig:()=>k(),isLoading:C,dataConf:i,setDataConf:c,formFields:e})]})}export{W as default};
