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