import{j as t,_ as f}from"./main.2.9.0.js";import{u as j,e as T,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as D}from"./BackIcn._8Wofmn2.js";import{S}from"./SnackMsg.DYSD96P4.js";import{I,g as C}from"./Integrations.DL8wqGct.js";import W from"./WpDataTablesAuthorization.CHd7gC-5.js";import{W as k,c as v}from"./WpDataTablesIntegLayout.CnVAaCcn.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:p,setFlow:d,flow:g,allIntegURL:b}){const u=j(),{formID:x}=T(),[i,o]=a.useState(!1),[s,l]=a.useState(1),[h,n]=a.useState({show:!1}),[e,r]=a.useState({name:"WpDataTables",type:"WpDataTables",field_map:[{formField:"",wpDataTablesField:""}],actions:{},mainAction:""}),c=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!v(e)){n({show:!0,msg:f("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&l(m)}else l(m)};return t.jsxs("div",{children:[t.jsx(S,{snack:h,setSnackbar:n}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(W,{formID:x,wpDataTablesConf:e,setWpDataTablesConf:r,step:s,nextPage:c,isLoading:i,setIsLoading:o,setSnackbar:n}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[t.jsx(k,{formFields:p,wpDataTablesConf:e,setWpDataTablesConf:r,isLoading:i,setIsLoading:o}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>c(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[f("Next","bit-integrations"),t.jsx(D,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:s,saveConfig:()=>C(g,d,b,e,u,"","",o),isLoading:i,dataConf:e,setDataConf:r,formFields:p})]})}export{J as default};
