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.1.js";import{u as N,h as T,d as l}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as q}from"./SnackMsg.S8DrwLlT.js";import{S as D}from"./Steps.1hz7v9Vj.js";import{I as E,s as F}from"./Integrations.D2bgBas2.js";import{h as L}from"./MemberpressCommonFunc.tt3rW2tb.js";import P from"./MemberpressAuthorization.Dbngg8DJ.js";import{M as R}from"./MemberpressIntegLayout.CduQPA9z.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./BackIcn._kGL_vVw.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function ae({formFields:a,setFlow:e,flow:t,allIntegURL:d,isInfo:g,edit:h}){const v=N(),{formID:j}=T(),[o,c]=l.useState(!1),[n,b]=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!==""&&b(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:b,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:d,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:d,navigate:v,conf:s,setIsLoading:c,setSnackbar:m}),isLoading:o,dataConf:s,setDataConf:p,formFields:a})]})}export{ae as default};
