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