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