import{j as t,_ as l}from"./main.2.8.1.js";import{u as j,h as C,d as i}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as S}from"./BackIcn._kGL_vVw.js";import{S as I}from"./SnackMsg.S8DrwLlT.js";import{I as P,g as W}from"./Integrations.D2bgBas2.js";import k from"./WPCafeAuthorization.akYxZ26K.js";import{c as v}from"./WPCafeCommonFunc.Dxed9e_Q.js";import{W as w}from"./WPCafeIntegLayout.8oIlGVSk.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./ProUtilHelpers.fQlR3mWW.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./GlobalIntegrationHelper.CgnhJgll.js";function K({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&&"200px"},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{K as default};
