import{j as t,_ as g}from"./main.2.8.10.js";import{u as b,e as j,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as v}from"./BackIcn.BFDZx8No.js";import{S as E}from"./SnackMsg.7BjcJK1j.js";import{S}from"./Steps.B84Ui3GU.js";import{I as C,g as I}from"./Integrations.BFhED4ck.js";import k from"./EnchargeAuthorization.DHzKJ5Sm.js";import{c as _}from"./EnchargeCommonFunc.CY6U3Haz.js";import{E as y}from"./EnchargeIntegLayout.Cv8f9Zv2.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function Q({formFields:o,setFlow:l,flow:f,allIntegURL:d}){const h=b(),{formID:r}=j(),[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&&"500px",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(f,l,d,e,h,"","",c),isLoading:m,dataConf:e,setDataConf:n,formFields:o})]})}export{Q as default};
