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