var y=Object.defineProperty;var v=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var h=(s,l,e)=>l in s?y(s,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[l]=e,r=(s,l)=>{for(var e in l||(l={}))_.call(l,e)&&h(s,e,l[e]);if(v)for(var e of v(l))N.call(l,e)&&h(s,e,l[e]);return s};import{j as t,L as f}from"./main-333.js";import{b as o,c as A,_ as u,n as L,N as F}from"./bi.636.93.js";const D=(s,l,e,x,a,c)=>{const i=r({},l),{name:g,value:j}=s.target;s.target.value!==""?i[g]=j:delete i[g],i[g]=j,S(i,e,x)},S=(s,l,e,x)=>{e(!0),o(null,"fetch_all_paid_membership_pro_level").then(a=>{if(a&&a.success){const c=r({},s);if(c.default||(c.default={}),a.data)if(c.mainAction==="2"){const i={membershipId:"any",membershipTitle:"Any membership level"};c.default.allMemberShipLevel=[i,...a.data]}else c.default.allMemberShipLevel=a.data;l(c),e(!1),A.success(u("All Paid Membership pro level fetched successfully","bit-integrations"));return}e(!1),A.error(u("Paid Membership pro level fetch failed. please try again","bit-integrations"))}).catch(()=>e(!1))};function E({formFields:s,handleInput:l,paidMembershipProConf:e,setPaidMembershipProConf:x,isLoading:a,setIsLoading:c,setSnackbar:i,allIntegURL:g,isInfo:j,edit:I}){var d;const w=(n,m)=>{const b=r({},e);m==="selectedMembership"&&(n!==""?b[m]=n:delete b[m]),x(r({},b))};return t.jsxs(t.Fragment,{children:[t.jsx("br",{}),t.jsx("b",{className:"wdt-200 d-in-b",children:u("Actions:","bit-integrations")}),t.jsxs("select",{onChange:l,name:"mainAction",value:e==null?void 0:e.mainAction,className:"btcd-paper-inp w-5",children:[t.jsx("option",{value:"",children:u("Select Actions","bit-integrations")}),(e==null?void 0:e.allActions)&&e.allActions.map(({key:n,label:m})=>t.jsx("option",{value:n,children:m},n))]}),t.jsx("br",{}),["1","2"].includes(e==null?void 0:e.mainAction)&&t.jsxs(t.Fragment,{children:[t.jsx("br",{}),t.jsxs("div",{className:"flx mt-4",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:u("Select Membership: ","bit-integrations")}),t.jsx(L,{className:"w-5",defaultValue:e==null?void 0:e.selectedMembership,options:((d=e==null?void 0:e.default)==null?void 0:d.allMemberShipLevel)&&e.default.allMemberShipLevel.map(n=>({label:n.membershipTitle,value:n.membershipId.toString()})),onChange:n=>w(n,"selectedMembership"),singleSelect:!0}),t.jsx("button",{onClick:()=>S(e,x,c),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${u("Fetch All Membership","bit-integrations")}'`},type:"button",disabled:a,children:"↻"})]})]}),t.jsx("br",{}),t.jsx("br",{}),a&&t.jsx(f,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:100,transform:"scale(0.7)"}}),t.jsx("br",{}),t.jsx(F,{note:u("This integration will only work for logged-in users.","bit-integrations")})]})}export{E as P,D as h};
