import{j as t,_ as d}from"./main.2.9.0.js";import{u as j,e as C,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as S}from"./BackIcn._8Wofmn2.js";import{S as I}from"./SnackMsg.DYSD96P4.js";import{I as P,g as W}from"./Integrations.DL8wqGct.js";import k from"./WPCafeAuthorization.CJIExf8h.js";import{c as v}from"./WPCafeCommonFunc.B28K388S.js";import{W as w}from"./WPCafeIntegLayout.CxKbl1X4.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";function O({formFields:p,setFlow:g,flow:u,allIntegURL:x}){const h=j(),{formID:c}=C(),[o,n]=i.useState(!1),[s,f]=i.useState(1),[b,a]=i.useState({show:!1}),[e,r]=i.useState({name:"WPCafe",type:"WPCafe",field_map:[{formField:"",wpcafeField:""}],actions:{},mainAction:""}),l=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!v(e)){a({show:!0,msg:d("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&f(m)}else f(m)};return t.jsxs("div",{children:[t.jsx(I,{snack:b,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(k,{formID:c,wpcafeConf:e,setWpcafeConf:r,step:s,nextPage:l,isLoading:o,setIsLoading:n,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:c,formFields:p,wpcafeConf:e,setWpcafeConf:r,setSnackbar:a,setIsLoading:n,isLoading: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:[d("Next","bit-integrations"),t.jsx(S,{className:"ml-1 rev-icn"})]})]}),t.jsx(P,{step:s,saveConfig:()=>W(u,g,x,e,h,"","",n),isLoading:o,dataConf:e,setDataConf:r,formFields:p})]})}export{O as default};
