import{u as j,k as v,r as i,j as e}from"./main-406.js";import{d as b,j as I,I as S,G as k}from"./bi.394.85.js";import{B as A}from"./bi.46.744.js";import{S as C}from"./bi.68.941.js";import _ from"./bi.987.247.js";import{d as y}from"./bi.344.741.js";import{A as N}from"./bi.619.742.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function z({formFields:m,setFlow:p,flow:d,allIntegURL:u}){const g=j(),{formID:c}=v(),[n,o]=i.useState(!1),[s,l]=i.useState(1),[f,a]=i.useState({show:!1}),[t,r]=i.useState({name:"Active Campaign",type:"ActiveCampaign",api_url:"",api_key:"",field_map:[{formField:"",activeCampaignField:""}],actions:{}}),x=h=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),h===3){if(!y(t)){a({show:!0,msg:"Please map all required fields to continue."});return}if(!(t!=null&&t.listId)){a({show:!0,msg:"Please select list to continue."});return}t.name!==""&&t.field_map.length>0&&l(3)}};return e.jsxs("div",{children:[e.jsx(b,{snack:f,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(C,{step:3,active:s})}),e.jsx(_,{formID:c,activeCampaingConf:t,setActiveCampaingConf:r,step:s,setstep:l,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(N,{formID:c,formFields:m,activeCampaingConf:t,setActiveCampaingConf:r,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("button",{onClick:()=>x(3),disabled:!(t!=null&&t.listId)||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[I("Next","bit-integrations"),"  ",e.jsx(A,{className:"ml-1 rev-icn"})]})]}),e.jsx(S,{step:s,saveConfig:()=>k(d,p,u,t,g,"","",o),isLoading:n,dataConf:t,setDataConf:r,formFields:m})]})}export{z as default};
