import{u as j,k as P,r,j as t}from"./main-333.js";import{d as M,_ as f,I,F as S}from"./bi.636.93.js";import{B as k}from"./bi.429.767.js";import C from"./bi.897.255.js";import{M as N,c as _,r as v}from"./bi.855.760.js";import"./bi.318.783.js";import"./bi.535.730.js";import"./bi.286.731.js";function q({formFields:m,setFlow:g,flow:u,allIntegURL:x}){const h=j(),{formID:l}=P(),[c,i]=r.useState(!1),[s,p]=r.useState(1),[b,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:f("Please map all required fields to continue.","bit-integrations")});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(M,{snack:b,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:[f("Next","bit-integrations"),t.jsx(k,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:s,saveConfig:()=>S(u,g,x,e,h,"","",i),isLoading:c,dataConf:e,setDataConf:o,formFields:m})]})}export{q as default};
