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