var M=Object.defineProperty;var u=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var b=(a,e,t)=>e in a?M(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,f=(a,e)=>{for(var t in e||(e={}))_.call(e,t)&&b(a,t,e[t]);if(u)for(var t of u(e))w.call(e,t)&&b(a,t,e[t]);return a};import{u as C,k as N,r as l,j as r}from"./main-406.js";import{d as T,_ as q,I as D,s as E}from"./bi.394.85.js";import{S as F}from"./bi.68.941.js";import{h as L}from"./bi.344.828.js";import P from"./bi.464.284.js";import{M as R}from"./bi.977.827.js";import"./bi.46.744.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function Y({formFields:a,setFlow:e,flow:t,allIntegURL:d,isInfo:x,edit:h}){const g=C(),{formID:v}=N(),[i,c]=l.useState(!1),[o,p]=l.useState(1),[j,n]=l.useState({show:!1}),k=[{key:"1",label:"Add the user to a membership"},{key:"2",label:"Remove the user from a membership"}],y=[{key:"sub_total",label:"Sub Total",required:!1},{key:"tax_amount",label:"Tax Amount",required:!1},{key:"taxrate",label:"Tax Rate",required:!1},{key:"expiration_date",label:"Expiration Date",required:!1}],[s,m]=l.useState({name:"Memberpress",type:"Memberpress",mainAction:"",field_map:[{formField:"",memberpressFormField:""}],allActions:k,memberpressFields:y,actions:{}}),S=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),s.mainAction!==""&&p(3)};function A(){switch(s.mainAction){case"1":return s.statusId===void 0||s.gatewayId===void 0||s.selectedMembership===void 0;default:return!1}}return r.jsxs("div",{children:[r.jsx(T,{snack:j,setSnackbar:n}),r.jsx("div",{className:"txt-center mt-2",children:r.jsx(F,{step:3,active:o})}),r.jsx(P,{formID:v,memberpressConf:s,setMemberpressConf:m,step:o,setStep:p,isLoading:i,setIsLoading:c,setSnackbar:n}),r.jsxs("div",{className:"btcd-stp-page",style:f({},o===2&&{width:900,height:"auto",overflow:"visible"}),children:[r.jsx(R,{formFields:a,handleInput:I=>L(I,s,m),memberpressConf:s,setMemberpressConf:m,isLoading:i,setIsLoading:c,setSnackbar:n,allIntegURL:d,isInfo:x,edit:h}),r.jsxs("button",{onClick:()=>S(),disabled:!s.mainAction||i||A(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[q("Next","bit-integrations")," ",r.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),r.jsx(D,{step:o,saveConfig:()=>E({flow:t,setFlow:e,allIntegURL:d,navigate:g,conf:s,setIsLoading:c,setSnackbar:n}),isLoading:i,dataConf:s,setDataConf:m,formFields:a})]})}export{Y as default};
