import{j as t,_ as g}from"./main.2.8.1.js";import{u as j,h as b,d as a}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as v}from"./BackIcn._kGL_vVw.js";import{S as E}from"./SnackMsg.S8DrwLlT.js";import{S}from"./Steps.1hz7v9Vj.js";import{I as C,g as I}from"./Integrations.D2bgBas2.js";import k from"./EnchargeAuthorization.DjvSPdvp.js";import{c as _}from"./EnchargeCommonFunc.1cTg0e70.js";import{E as y}from"./EnchargeIntegLayout.B-3xwfzz.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function Q({formFields:o,setFlow:l,flow:d,allIntegURL:f}){const h=j(),{formID:r}=b(),[m,c]=a.useState(!1),[s,p]=a.useState(1),[u,i]=a.useState({show:!1}),[e,n]=a.useState({name:"Encharge",type:"Encharge",tags:"",api_key:"",field_map:[{formField:"",enChargeFields:""}],actions:{}}),x=N=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!_(e)){i({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(E,{snack:u,setSnackbar:i}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(S,{step:3,active:s})}),t.jsx(k,{formID:r,enchargeConf:e,setEnchargeConf:n,step:s,setstep:p,isLoading:m,setIsLoading:c,setSnackbar:i}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,minHeight:s===2&&"200",height:s===2&&"auto"},children:[t.jsx(y,{formID:r,formFields:o,enchargeConf:e,setEnchargeConf:n}),t.jsxs("button",{onClick:()=>x(),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(v,{className:"ml-1 rev-icn"})]})]}),t.jsx(C,{step:s,saveConfig:()=>I(d,l,f,e,h,"","",c),isLoading:m,dataConf:e,setDataConf:n,formFields:o})]})}export{Q as default};
