import{D as E,g as S,r as a,a as v,j as e,S as I,W as k,h as _,_ as w}from"./main-634.js";import{m as y}from"./bf-25-81.js";import{S as C}from"./bf-54-258.js";import{a7 as N}from"./bf-746-82.js";import{I as b}from"./bf-942-184.js";import F from"./bf-401-122.js";import{c as P}from"./bf-369-176.js";import{E as B}from"./bf-428-218.js";import"./bf-275-83.js";import"./bf-822-108.js";import"./bf-123-109.js";import"./bf-438-114.js";function J({formFields:c,setIntegration:m,integrations:p,allIntegURL:l}){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(!P(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(F,{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(B,{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(p,m,l,s,g)})]})}export{J as default};
