import{j as t,_ as f}from"./main.2.8.10.js";import{u as E,e as S,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as I}from"./BackIcn.BFDZx8No.js";import{S as P}from"./SnackMsg.7BjcJK1j.js";import{I as W,g as k}from"./Integrations.BFhED4ck.js";import w from"./WpErpAuthorization.CFjHAzuS.js";import{W as _,c as d}from"./WpErpIntegLayout.D9TZMEU2.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";function J({formFields:g,setFlow:u,flow:x,allIntegURL:h}){const b=E(),{formID:p}=S(),[r,a]=o.useState(!1),[s,m]=o.useState(1),[j,i]=o.useState({show:!1}),[e,c]=o.useState({name:"WP ERP",type:"WP ERP",field_map:[{formField:"",wpErpField:""}],actions:{},utilities:{},mainAction:""}),l=n=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),n===3){if(!d(e)){i({show:!0,msg:f("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&m(n)}else m(n)};return t.jsxs("div",{children:[t.jsx(P,{snack:j,setSnackbar:i}),t.jsx(w,{formID:p,wpErpConf:e,setWpErpConf:c,step:s,nextPage:l,isLoading:r,setIsLoading:a,setSnackbar:i}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[t.jsx(_,{formID:p,formFields:g,wpErpConf:e,setWpErpConf:c,setSnackbar:i,setIsLoading:a,isLoading:r}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>l(3),disabled:e.field_map.length<1||!d(e),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[f("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(W,{step:s,saveConfig:()=>k(x,u,h,e,b,"","",a),isLoading:r})]})}export{J as default};
