import{j as t,_ as C}from"./main.2.9.0.js";import{u as v,e as A,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as S}from"./BackIcn._8Wofmn2.js";import{S as I}from"./SnackMsg.DYSD96P4.js";import{I as w,g as W}from"./Integrations.DL8wqGct.js";import N from"./WCAffiliateAuthorization.CT9nUQ1G.js";import{W as _,v as g}from"./WCAffiliateIntegLayout.Dycb58Fv.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";function G({formFields:f,setFlow:u,flow:x,allIntegURL:h}){const b=v(),{formID:l}=A(),[n,r]=o.useState(!1),[i,c]=o.useState(1),[j,a]=o.useState({show:!1}),[e,m]=o.useState({name:"WC Affiliate",type:"WC Affiliate",field_map:[{formField:"",wcAffiliateField:""}],actions:{},fixedFieldValues:{},mainAction:""}),p=s=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),s===3){const d=g(e);if(!d.isValid){a({show:!0,msg:d.message});return}e.name!==""&&e.field_map.length>0&&c(s)}else c(s)};return t.jsxs("div",{children:[t.jsx(I,{snack:j,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(N,{formID:l,wcAffiliateConf:e,setWCAffiliateConf:m,step:i,nextPage:p,isLoading:n,setIsLoading:r,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:i===2&&900,height:i===2&&"auto",minHeight:i===2&&"500px"},children:[t.jsx(_,{formID:l,formFields:f,wcAffiliateConf:e,setWCAffiliateConf:m,setSnackbar:a,setIsLoading:r,isLoading:n}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>p(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[C("Next","bit-integrations"),t.jsx(S,{className:"ml-1 rev-icn"})]})]}),t.jsx(w,{step:i,saveConfig:()=>{const s=g(e);if(!s.isValid){a({show:!0,msg:s.message});return}W(x,u,h,e,b,"","",r)},isLoading:n,dataConf:e,setDataConf:m,formFields:f})]})}export{G as default};
