import{u as b,k as j,r as i,j as e}from"./main-333.js";import{d as C,_ as m,I,F as S}from"./bi.636.93.js";import{B as k}from"./bi.429.767.js";import{S as _}from"./bi.563.969.js";import N from"./bi.230.309.js";import{c as w}from"./bi.452.878.js";import{C as y}from"./bi.37.879.js";import"./bi.318.783.js";function M({formFields:c,setFlow:d,flow:f,allIntegURL:u}){const g=b(),{formID:l}=j(),[n,o]=i.useState(!1),[s,p]=i.useState(1),[x,a]=i.useState({show:!1}),[t,r]=i.useState({name:"ConvertKit",type:"ConvertKit",api_secret:"",field_map:[{formField:"",convertKitField:""}],actions:{}}),h=v=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),v===3){if(!w(t)){a({show:!0,msg:m("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.formId)){a({show:!0,msg:m("Please select form to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&p(3)}};return e.jsxs("div",{children:[e.jsx(C,{snack:x,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(_,{step:3,active:s})}),e.jsx(N,{formID:l,convertKitConf:t,setConvertKitConf:r,step:s,setstep:p,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(y,{formID:l,formFields:c,convertKitConf:t,setConvertKitConf:r,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("button",{onClick:()=>h(3),disabled:!(t!=null&&t.formId)||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations"),"  ",e.jsx(k,{className:"ml-1 rev-icn"})]})]}),e.jsx(I,{step:s,saveConfig:()=>S(f,d,u,t,g,"","",o),isLoading:n,dataConf:t,setDataConf:r,formFields:c})]})}export{M as default};
