import{j as t,_ as d}from"./main.2.8.10.js";import{u as j,e as P,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as M}from"./BackIcn.BFDZx8No.js";import{S}from"./SnackMsg.7BjcJK1j.js";import{I,g as C}from"./Integrations.BFhED4ck.js";import N from"./MailPoetAuthorization.C0R1vEUP.js";import{M as k,c as _,r as v}from"./MailPoetIntegLayout.BxpdcGjz.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./ActionProFeatureLabels.BzMNdAoD.js";function O({formFields:l,setFlow:g,flow:u,allIntegURL:x}){const h=j(),{formID:m}=P(),[p,i]=n.useState(!1),[s,c]=n.useState(1),[b,a]=n.useState({show:!1}),[e,o]=n.useState({name:"Mail Poet",type:"Mail Poet",field_map:[{formField:"",mailPoetField:""}],actions:{}}),f=r=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),r===3){if(!_(e)){a({show:!0,msg:d("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&c(r)}else c(r),r===2&&e.name&&v(m,e,o,i,a)};return t.jsxs("div",{children:[t.jsx(S,{snack:b,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(N,{formID:m,mailPoetConf:e,setMailPoetConf:o,step:s,nextPage:f,isLoading:p,setIsLoading:i,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[t.jsx(k,{formID:m,formFields:l,mailPoetConf:e,setMailPoetConf:o,setSnackbar:a,setIsLoading:i}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>f(3),disabled:e.lists===""||e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[d("Next","bit-integrations"),t.jsx(M,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:s,saveConfig:()=>C(u,g,x,e,h,"","",i),isLoading:p,dataConf:e,setDataConf:o,formFields:l})]})}export{O as default};
