import{j as t,_ as d}from"./main.2.9.0.js";import{u as E,e as S,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as I}from"./BackIcn._8Wofmn2.js";import{S as C}from"./SnackMsg.DYSD96P4.js";import{I as P,g as W}from"./Integrations.DL8wqGct.js";import k from"./WpErpAuthorization.C9QN5z1O.js";import{W as w,c as g}from"./WpErpIntegLayout.DErxCuDv.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";function J({formFields:m,setFlow:u,flow:x,allIntegURL:h}){const b=E(),{formID:c}=S(),[o,r]=a.useState(!1),[s,l]=a.useState(1),[j,i]=a.useState({show:!1}),[e,n]=a.useState({name:"WP ERP",type:"WP ERP",field_map:[{formField:"",wpErpField:""}],actions:{},utilities:{},mainAction:""}),f=p=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),p===3){if(!g(e)){i({show:!0,msg:d("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&l(p)}else l(p)};return t.jsxs("div",{children:[t.jsx(C,{snack:j,setSnackbar:i}),t.jsx(k,{formID:c,wpErpConf:e,setWpErpConf:n,step:s,nextPage:f,isLoading:o,setIsLoading:r,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(w,{formID:c,formFields:m,wpErpConf:e,setWpErpConf:n,setSnackbar:i,setIsLoading:r,isLoading:o}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>f(3),disabled:e.field_map.length<1||!g(e),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[d("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(P,{step:s,saveConfig:()=>W(x,u,h,e,b,"","",r),isLoading:o,dataConf:e,setDataConf:n,formFields:m})]})}export{J as default};
