import{u as j,k as b,r,j as t}from"./main-406.js";import{d as P,_ as M,I,G as S}from"./bi.394.85.js";import{B as k}from"./bi.46.744.js";import C from"./bi.451.244.js";import{M as N,c as _,r as v}from"./bi.804.737.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function q({formFields:m,setFlow:f,flow:u,allIntegURL:g}){const x=j(),{formID:l}=b(),[c,i]=r.useState(!1),[s,p]=r.useState(1),[h,a]=r.useState({show:!1}),[e,o]=r.useState({name:"Mail Poet",type:"Mail Poet",field_map:[{formField:"",mailPoetField:""}],actions:{}}),d=n=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),n===3){if(!_(e)){a({show:!0,msg:"Please map all required fields to continue."});return}e.name!==""&&e.field_map.length>0&&p(n)}else p(n),n===2&&e.name&&v(l,e,o,i,a)};return t.jsxs("div",{children:[t.jsx(P,{snack:h,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(C,{formID:l,mailPoetConf:e,setMailPoetConf:o,step:s,nextPage:d,isLoading:c,setIsLoading:i,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"200px"},children:[t.jsx(N,{formID:l,formFields:m,mailPoetConf:e,setMailPoetConf:o,setSnackbar:a,setIsLoading:i}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>d(3),disabled:e.lists===""||e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[M("Next","bit-integrations"),t.jsx(k,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:s,saveConfig:()=>S(u,f,g,e,x,"","",i),isLoading:c,dataConf:e,setDataConf:o,formFields:m})]})}export{q as default};
