import{j as t,_ as l}from"./main.2.8.10.js";import{u as j,e as C,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as S}from"./BackIcn.BFDZx8No.js";import{S as I}from"./SnackMsg.7BjcJK1j.js";import{I as P,g as W}from"./Integrations.BFhED4ck.js";import k from"./WPCafeAuthorization.CdyjW6Rz.js";import{c as v}from"./WPCafeCommonFunc.CIov9d9a.js";import{W as w}from"./WPCafeIntegLayout.hOT6Y5Zr.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";function O({formFields:d,setFlow:g,flow:u,allIntegURL:x}){const h=j(),{formID:m}=C(),[o,r]=i.useState(!1),[s,p]=i.useState(1),[b,a]=i.useState({show:!1}),[e,c]=i.useState({name:"WPCafe",type:"WPCafe",field_map:[{formField:"",wpcafeField:""}],actions:{},mainAction:""}),f=n=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),n===3){if(!v(e)){a({show:!0,msg:l("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&p(n)}else p(n)};return t.jsxs("div",{children:[t.jsx(I,{snack:b,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(k,{formID:m,wpcafeConf:e,setWpcafeConf:c,step:s,nextPage:f,isLoading:o,setIsLoading:r,setSnackbar:a}),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:m,formFields:d,wpcafeConf:e,setWpcafeConf:c,setSnackbar:a,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,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),t.jsx(S,{className:"ml-1 rev-icn"})]})]}),t.jsx(P,{step:s,saveConfig:()=>W(u,g,x,e,h,"","",r),isLoading:o})]})}export{O as default};
