1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[848],{42300:(e,n,s)=>{"use strict";s.r(n),s.d(n,{default:()=>v});var i=s(37876),l=s(77328),a=s.n(l),r=s(14232),t=s(75919),c=s(66412),d=s(95364),o=s(27910),u=s(19512),p=s(34333),x=s(92306),h=s(75656),_=s(60577);function v(e){let{config:n}=(0,_.r)(),[s,l]=(0,r.useState)(""),[c,p]=(0,r.useState)(void 0),{saveData:x,subscriptionData:h,saveSubscription:v,updateSubscription:b,triggerSellerSubCreate:f}=j(),g=h?.subscriptions.filter(e=>!!e.is_active).length;return(0,i.jsxs)(d.Ay,{...e,hideNav:!0,children:[(0,i.jsx)(a(),{children:(0,i.jsx)("title",{children:"Plans"})}),(0,i.jsxs)(t.InnerSection1200NoMargin,{children:[(0,i.jsx)(o.A,{name:"subscriptionId",onChange:e=>l(e.target.value)}),(0,i.jsx)(u.A,{onClick:()=>v(c,s),children:"Create Sub"}),(0,i.jsxs)("div",{className:"mt-12 flex flex-col gap-2",children:["Active: ",g,h?.subscriptions.map(e=>(0,i.jsxs)("div",{className:"flex flex-row gap-2 bg-neutral-800 p-1 items-center rounded-md",children:[(0,i.jsx)("div",{children:e.id}),(0,i.jsx)("div",{children:e.product_id}),(0,i.jsx)("div",{children:e.payment_plan_id}),(0,i.jsx)("div",{children:e.external_sub_id}),(0,i.jsx)("div",{children:e.is_active?"Active":"Inactive"}),(0,i.jsx)("div",{children:e.status}),(0,i.jsx)("div",{children:(0,i.jsx)(u.A,{onClick:()=>b(e.external_sub_id),children:"Refresh"})})]},e.id)),"Features:",h?.features?.map(e=>(0,i.jsxs)("div",{className:"flex flex-row gap-2 bg-neutral-800 p-1 items-center rounded-md",children:[(0,i.jsx)("div",{children:e.id}),(0,i.jsx)("div",{children:e.key}),(0,i.jsx)("div",{children:e.name}),(0,i.jsx)("div",{children:e.description})]},e.id))]}),g<1?(0,i.jsxs)("div",{className:"mt-12",children:["Please choose a plan.. Chosen: ",c,(0,i.jsx)("div",{className:"flex flex-row gap-4",children:[{name:"PLUS",plans:[{name:"monthly",external_plan_id:"P-65G425299C519080GM3RM5SQ"},{name:"yearly",external_plan_id:"P-8RL24847MB9868354M3RVOSI"}]}].map(e=>(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{children:e.name}),(0,i.jsx)("div",{className:"flex flex-row gap-4 ",children:e.plans.map(e=>(0,i.jsxs)("div",{className:`cursor-pointer ${c==e.external_plan_id?"bg-neutral-700":"bg-neutral-900"} p-8`,onClick:()=>p(e.external_plan_id),children:[(0,i.jsx)("div",{children:e.name}),(0,i.jsx)("div",{})]}))})]},e.name))}),c?(0,i.jsx)("div",{className:"mt-8 bg-neutral-900 rounded-md max-w-[500px] p-8 flex flex-row place-content-center",children:(0,i.jsx)(m,{planId:c})}):null]}):null]})]})}function j(){let{data:e,error:n,mutate:s}=(0,h.Ay)("/api/paypal/seller_subscriptions",(0,x.we)()),{data:i,trigger:l}=(0,p.A)("/api/paypal/seller_subscription_create",x.w$),{data:a,trigger:r}=(0,p.A)("/api/paypal/seller_subscription_update",x.w$);async function t(e,n){(await l({plan_id:e,subscription_id:n})).status<=400&&(console.log("Successful created subscription.. ",i),s())}async function c(e){(await r({subscription_id:e})).status<=400&&(console.log("Successful updated subscription.. ",i),s())}return{subscriptionData:e,saveData:i,triggerSellerSubCreate:l,saveSubscription:t,triggerSellerSubUpdate:r,updateSubscription:c}}function m({planId:e}){let{config:n}=(0,_.r)(),{saveData:s,subscriptionData:l,saveSubscription:a,triggerSellerSubCreate:r}=j();async function t(n,s){return console.log("Success",n,s),await a(e,n.subscriptionID),alert("You have successfully subscribed to "+n.subscriptionID),!0}return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(c.ag,{options:{clientId:n.payments.paypalClientId,vault:!0,intent:"subscription"},children:(0,i.jsx)(c.JV,{style:{color:"white",label:"subscribe",height:50},createSubscription:function(n,s){return s.subscription.create({plan_id:e})},onApprove:async function(e,n){await t(e,n)},onError:function(e){console.log("error",e),alert("Error subscribing")},onCancel:async function(e,n){console.log("Cancel",e,n)}})})})}},56500:(e,n,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/plans",function(){return s(42300)}])}},e=>{e.O(0,[1312,636,6593,8792],()=>e(e.s=56500)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.