import{j as t,_ as C}from"./main.2.8.10.js";import{u as v,e as A,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as S}from"./BackIcn.BFDZx8No.js";import{S as I}from"./SnackMsg.7BjcJK1j.js";import{I as w,g as W}from"./Integrations.BFhED4ck.js";import N from"./WCAffiliateAuthorization.Dm7t18m-.js";import{W as _,v as d}from"./WCAffiliateIntegLayout.DJoD5CWb.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";function G({formFields:g,setFlow:u,flow:x,allIntegURL:h}){const b=v(),{formID:m}=A(),[n,r]=o.useState(!1),[i,f]=o.useState(1),[j,a]=o.useState({show:!1}),[e,l]=o.useState({name:"WC Affiliate",type:"WC Affiliate",field_map:[{formField:"",wcAffiliateField:""}],actions:{},fixedFieldValues:{},mainAction:""}),c=s=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),s===3){const p=d(e);if(!p.isValid){a({show:!0,msg:p.message});return}e.name!==""&&e.field_map.length>0&&f(s)}else f(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:m,wcAffiliateConf:e,setWCAffiliateConf:l,step:i,nextPage:c,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:m,formFields:g,wcAffiliateConf:e,setWCAffiliateConf:l,setSnackbar:a,setIsLoading:r,isLoading:n}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>c(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=d(e);if(!s.isValid){a({show:!0,msg:s.message});return}W(x,u,h,e,b,"","",r)},isLoading:n})]})}export{G as default};
