var _=Object.defineProperty;var u=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var f=(a,e,t)=>e in a?_(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,x=(a,e)=>{for(var t in e||(e={}))w.call(e,t)&&f(a,t,e[t]);if(u)for(var t of u(e))C.call(e,t)&&f(a,t,e[t]);return a};import{_ as r,j as i}from"./main.2.8.10.js";import{u as N,e as T,b as l}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as q}from"./SnackMsg.7BjcJK1j.js";import{S as D}from"./Steps.B84Ui3GU.js";import{I as E,s as F}from"./Integrations.BFhED4ck.js";import{h as L}from"./MemberpressCommonFunc.BggM6OhT.js";import P from"./MemberpressAuthorization.CN9fC6qY.js";import{M as R}from"./MemberpressIntegLayout.BKUwlt_P.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./BackIcn.BFDZx8No.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function ae({formFields:a,setFlow:e,flow:t,allIntegURL:b,isInfo:g,edit:h}){const v=N(),{formID:j}=T(),[o,c]=l.useState(!1),[n,d]=l.useState(1),[y,m]=l.useState({show:!1}),S=[{key:"1",label:r("Add the user to a membership","bit-integrations")},{key:"2",label:r("Remove the user from a membership","bit-integrations")}],k=[{key:"sub_total",label:r("Sub Total","bit-integrations"),required:!1},{key:"tax_amount",label:r("Tax Amount","bit-integrations"),required:!1},{key:"taxrate",label:r("Tax Rate","bit-integrations"),required:!1},{key:"expiration_date",label:r("Expiration Date","bit-integrations"),required:!1}],[s,p]=l.useState({name:"Memberpress",type:"Memberpress",mainAction:"",field_map:[{formField:"",memberpressFormField:""}],allActions:S,memberpressFields:k,actions:{}}),A=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),s.mainAction!==""&&d(3)};function I(){return s.mainAction==="1"?s.statusId===void 0||s.gatewayId===void 0||s.selectedMembership===void 0:!1}return i.jsxs("div",{children:[i.jsx(q,{snack:y,setSnackbar:m}),i.jsx("div",{className:"txt-center mt-2",children:i.jsx(D,{step:3,active:n})}),i.jsx(P,{formID:j,memberpressConf:s,setMemberpressConf:p,step:n,setStep:d,isLoading:o,setIsLoading:c,setSnackbar:m}),i.jsxs("div",{className:"btcd-stp-page",style:x({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[i.jsx(R,{formFields:a,handleInput:M=>L(M,s,p),memberpressConf:s,setMemberpressConf:p,isLoading:o,setIsLoading:c,setSnackbar:m,allIntegURL:b,isInfo:g,edit:h}),i.jsxs("button",{onClick:()=>A(),disabled:!s.mainAction||o||I(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[r("Next","bit-integrations")," ",i.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),i.jsx(E,{step:n,saveConfig:()=>F({flow:t,setFlow:e,allIntegURL:b,navigate:v,conf:s,setIsLoading:c,setSnackbar:m}),isLoading:o,dataConf:s,setDataConf:p,formFields:a})]})}export{ae as default};
