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