import{j as t,_ as g}from"./main.2.9.0.js";import{u as b,e as j,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as v}from"./BackIcn._8Wofmn2.js";import{S as E}from"./SnackMsg.DYSD96P4.js";import{S}from"./Steps.BYe8zHkm.js";import{I as C,g as I}from"./Integrations.DL8wqGct.js";import k from"./EnchargeAuthorization.BWCmpwA-.js";import{c as _}from"./EnchargeCommonFunc.CMwwaSTo.js";import{E as y}from"./EnchargeIntegLayout.B8P95rMT.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
