import{j as t,_ as a}from"./main.2.8.10.js";import{u as P,e as j,b as i}from"./react-router.DMwpH23k.js";import{B as S}from"./BackIcn.BFDZx8No.js";import{S as w}from"./SnackMsg.7BjcJK1j.js";import{I,g as v}from"./Integrations.BFhED4ck.js";import W from"./WordPressAuthorization.BLbpouHz.js";import{W as k,c as N}from"./WordPressIntegLayout.zHdM26zm.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.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 K({formFields:d,setFlow:l,flow:u,allIntegURL:f}){const g=P(),{formID:x}=j(),[o,n]=i.useState(!1),[e,h]=i.useState(1),[b,r]=i.useState({show:!1}),[s,m]=i.useState({name:"WordPress",type:"WordPress",field_map:[{formField:"",wordPressField:""}],wordPressFields:[],mainAction:"",actions:{}}),c=p=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),p===3){if(!s.mainAction){r({show:!0,msg:a("Please select an action to continue.","bit-integrations")});return}if(!N(s)){r({show:!0,msg:a("Please map all required fields to continue.","bit-integrations")});return}}h(p)};return t.jsxs("div",{children:[t.jsx(w,{snack:b,setSnackbar:r}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(W,{wordPressConf:s,setWordPressConf:m,step:e,nextPage:c,isLoading:o,setIsLoading:n,setSnackbar:r}),t.jsxs("div",{className:"btcd-stp-page",style:{width:e===2&&900,height:e===2&&"auto",minHeight:e===2&&"500px"},children:[t.jsx(k,{formID:x,formFields:d,wordPressConf:s,setWordPressConf:m,isLoading:o}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>c(3),disabled:o||!s.mainAction||s.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[a("Next","bit-integrations"),t.jsx(S,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:e,saveConfig:()=>v(u,l,f,s,g,"","",n),isLoading:o})]})}export{K as default};
