import{j as t,_ as d}from"./main.2.8.1.js";import{u as j,h as P,d as n}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as M}from"./BackIcn._kGL_vVw.js";import{S}from"./SnackMsg.S8DrwLlT.js";import{I,g as C}from"./Integrations.D2bgBas2.js";import N from"./MailPoetAuthorization.BCBAfJcv.js";import{M as k,c as _,r as v}from"./MailPoetIntegLayout.DYJx-se1.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./ActionProFeatureLabels.CuihmlQ8.js";function K({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&&"200px"},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{K as default};
