import{G as E,g as S,r as a,a as v,j as e,S as I,U as k,h as _,_ as w}from"./main-343.js";import{B as y}from"./bf-649-79.js";import{S as C}from"./bf-149-261.js";import{a7 as N}from"./bf-659-81.js";import{I as b}from"./bf-58-184.js";import B from"./bf-876-121.js";import{c as F}from"./bf-66-176.js";import{E as P}from"./bf-894-218.js";import"./bf-974-82.js";import"./bf-713-109.js";import"./bf-594-113.js";function $({formFields:c,setIntegration:m,integrations:l,allIntegURL:p}){const g=E(),{formID:n}=S(),[d,f]=a.useState(!1),[t,r]=a.useState(1),[h,i]=a.useState({show:!1}),{css:u}=v(),[s,o]=a.useState({name:"Encharge API",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(!F(s)){i({show:!0,msg:"Please map all required fields to continue."});return}s.name!==""&&s.field_map.length>0&&r(3)}};return e.jsxs("div",{children:[e.jsx(I,{snack:h,setSnackbar:i}),e.jsx("div",{className:"txt-center w-9 mt-2 cal-width",children:e.jsx(C,{step:3,active:t})}),e.jsx(B,{formID:n,enchargeConf:s,setEnchargeConf:o,step:t,setstep:r,isLoading:d,setisLoading:f,setSnackbar:i}),e.jsxs("div",{className:"btcd-stp-page",style:{width:t===2&&900,minHeight:t===2&&"900px"},children:[e.jsx(P,{formID:n,formFields:c,enchargeConf:s,setEnchargeConf:o}),e.jsxs(k,{variant:"success",onClick:()=>x(3),disabled:s.field_map.length<1,className:u(_.ftRight),children:[w("Next")," ",e.jsx(y,{className:"ml-1 rev-icn"})]})]}),e.jsx(b,{step:t,saveConfig:()=>N(l,m,p,s,g)})]})}export{$ as default};
