import{j as t,_ as r}from"./main.2.9.0.js";import{u as h,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as j}from"./BackIcn._8Wofmn2.js";import{S as A}from"./SnackMsg.DYSD96P4.js";import{I as P,g as S}from"./Integrations.DL8wqGct.js";import C from"./UltimateAffiliateProAuthorization.DAAMgcvw.js";import{U as I,c as U}from"./UltimateAffiliateProIntegLayout.4zHDVdyi.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 $({formFields:m,setFlow:u,flow:g,allIntegURL:d}){const x=h(),[l,f]=a.useState(!1),[i,c]=a.useState(1),[b,s]=a.useState({show:!1}),[e,o]=a.useState({name:"Ultimate Affiliate Pro",type:"Ultimate Affiliate Pro",field_map:[{formField:"",ultimateAffiliateProField:""}],actions:{},mainAction:""}),p=n=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),n===3){if(!e.mainAction){s({show:!0,msg:r("Please select an action to continue.","bit-integrations")});return}if(!U(e)){s({show:!0,msg:r("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&c(n)}else c(n)};return t.jsxs("div",{children:[t.jsx(A,{snack:b,setSnackbar:s}),t.jsx(C,{ultimateAffiliateProConf:e,setUltimateAffiliateProConf:o,step:i,nextPage:p,isLoading:l,setIsLoading:f,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(I,{formFields:m,ultimateAffiliateProConf:e,setUltimateAffiliateProConf:o}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>p(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,"","",f),isLoading:l,dataConf:e,setDataConf:o,formFields:m})]})}export{$ as default};
