1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6067],{7865:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return M}});var n=t(38617),i=t(97729),s=t.n(i),a=t(75174),l=t(5632),c=t(2784),o=t(90087),u=t(78454),d=t(13591),p=t(66627),f=t(69517),m=t(61266),h=t(6590);function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}let g=e=>{let r=(0,h.W)();return(0,m.D)(function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach(function(r){(0,f.Z)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({mutationFn:r.billing.getStripePortal},e))};var x=t(85941),j=t(3437),y=t(56873),v=t(61401),w=t(77994),O=t(89013),N=t(11897),P=t(78219),S=t(12603),E=t(18347),_=t(77169),k=t(30097),C=t(52895),z=t(52322);let D=(0,c.memo)(function(){let{mutateAsync:e}=(0,_.r)(),{spaceSubscriptionList:r}=(0,k.K)(!0),{data:t}=(0,x.m3)(),n=t?(0,x.ah)(t):[],i=t?(0,x.j6)(t):[],s=(0,c.useCallback)(async()=>{let r=await e();window.open(r,"_blank")},[e]),a=n.length>0,l=r.length>0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(w.X,{asChild:!0,size:"h1",children:(0,z.jsx)("h1",{children:"Billing"})}),(0,z.jsx)("div",{className:"flex justify-center",children:(0,z.jsx)("div",{className:"grid h-full w-fit grid-rows-[auto_minmax(0,_1fr)] gap-2 py-8",children:(0,z.jsxs)("div",{className:"grid h-full w-full content-center justify-items-center gap-8",children:[a&&(0,z.jsxs)("div",{className:"w-full",children:[(0,z.jsx)(w.X,{size:"h2",textAlign:"center",className:"mb-4",children:"Personal Subscriptions"}),(0,z.jsxs)("div",{className:"mb-4 grid w-full grid-cols-[320px_auto] border-b px-4 pb-1.5 pt-4 text-muted-foreground",children:[(0,z.jsx)(N.x,{size:"sm",className:"font-demibold",children:"Plan"}),(0,z.jsx)(N.x,{size:"sm",className:"pl-2 font-demibold",children:"Status"})]}),(0,z.jsx)("div",{className:"mb-4",children:n.map((e,r)=>(0,z.jsxs)("div",{className:"grid w-full grid-cols-[320px_auto] px-4 py-2",children:[(0,z.jsx)(N.x,{size:"sm",children:"Personal Plan"}),(0,z.jsx)(N.x,{size:"sm",className:"pl-2 capitalize",children:e.status.toLowerCase()})]},`${e.plan}-${r}`))})]}),l&&(0,z.jsxs)("div",{className:"w-full",children:[(0,z.jsx)(w.X,{size:"h2",textAlign:"center",className:"mb-4",children:"Space Subscriptions"}),(0,z.jsxs)("div",{className:"mb-4 grid w-full grid-cols-[320px_auto_auto] border-b px-4 pb-1.5 pt-4 text-muted-foreground",children:[(0,z.jsx)(N.x,{size:"sm",className:"font-demibold",children:"Space Name"}),(0,z.jsx)(N.x,{size:"sm",className:"pl-2 font-demibold",children:"Subscription"}),(0,z.jsx)(N.x,{size:"sm",className:"pl-4 font-demibold",children:"Status"})]}),(0,z.jsx)("div",{className:"mb-4 max-h-[500px]",children:(0,z.jsx)(C.w,{spaces:r,hideButton:!0,showSpaceId:!0,showSubStatus:!0})})]}),(a||l)&&(0,z.jsx)(O.z,{color:"primary",onClick:s,children:n.length+r.length>1?"Manage Subscriptions":"Manage Subscription"}),i.length>0&&(0,z.jsxs)("div",{className:"mt-4 flex flex-col items-center justify-center gap-4",children:[(0,z.jsx)(w.X,{size:"h3",textAlign:"center",children:"Enterprise or Education Subscription"}),(0,z.jsx)(N.x,{size:"sm",textAlign:"center",className:"max-w-[500px]",children:"You are on an Enterprise or Education plan. Manage your Enterprise or Education subscription by contacting your Spatial representative or your team admin!"})]})]})})})]})});var I=t(10668);let A=(0,c.memo)(function(){var e,r;let{user:t,isLoading:n}=(0,j.aF)(),{replace:i}=(0,l.useRouter)(),s=(0,d.XW)(),a=t.permissions.includes(u.Gm.CAN_ACCESS_ADMIN_PAGE)||!t.myOrganization.id,f=(0,o.r$)(t),m=null==t||null===(e=t.subscription)||void 0===e?void 0:e.subscriptionType,h=null==t||null===(r=t.subscription)||void 0===r?void 0:r.subscriptionSource,{data:b,isLoading:P}=(0,x.m3)(),S=b?(0,x.PN)(b):[],E=b?(0,x.zu)(b):[],_=null==S?void 0:S.filter(e=>"FREE_UGC"!==e.plan&&"FREE"!==e.plan),k=E.length,C=null==_?void 0:_.length,I=k||C,A=g(),R=(0,c.useCallback)(async()=>{s({name:p.AI.ManageStripeProSubscription,type:p.s_.Click});try{let{sessionUrl:e}=await A.mutateAsync();window.open(e,"_blank")}catch(e){e&&y.A.error("Something went wrong. Please try again later.")}},[A,s]);return((0,c.useEffect)(()=>{f||I||P||i("/pricing")},[P,f,i,I]),!n&&!P&&(f||I||P))?I?(0,z.jsx)(D,{}):(0,z.jsxs)("div",{className:"grid h-full grid-rows-[auto_minmax(0,_1fr)] gap-2",children:[(0,z.jsx)(w.X,{asChild:!0,size:"h1",children:(0,z.jsx)("h1",{children:"Billing"})}),(0,z.jsxs)("div",{className:"grid h-full w-full content-center justify-items-center gap-2",children:[(0,z.jsx)(w.X,{size:"h3",textAlign:"center",children:"Thanks for being a valued Spatial+ member!"}),(()=>{if("APPLE"===h||"OCULUS"===h){let e="APPLE"===h;return(0,z.jsx)(O.z,{as:"a",size:"lg",color:"primary",className:"w-fit",href:e?"https://support.apple.com/billing":"https://www.meta.com/help/quest/articles/accounts/purchasing-apps/manage-your-app-subscriptions",onClick:()=>s({name:e?p.AI.ManageAppleProSubscription:p.AI.ManageOculusProSubscription,type:p.s_.Click}),target:"_blank",rel:"noreferrer",children:`Manage ${e?"Apple":"Meta Oculus"} Subscription`})}return"ENTERPRISE"===m?(0,z.jsx)(N.x,{size:"sm",children:"You are on an enterprise plan. Manage your enterprise subscription by contacting your Spatial representative!"}):a?(0,z.jsx)(O.z,{className:"w-fit",size:"lg",color:"primary",isLoading:A.isLoading,onClick:R,children:"Manage Your Subscription"}):(0,z.jsx)(N.x,{size:"sm",children:"To manage your subscription, contact one of your team's administrators."})})()]})]}):(0,z.jsx)(v.l,{variant:"fancy"})}),R=(0,c.memo)(function(){return(0,z.jsx)(I.n,{requiresOnboarded:!0,children:(0,z.jsxs)("div",{className:"grid h-full min-h-screen grid-rows-[auto_minmax(0,_1fr)_auto]",children:[(0,z.jsx)(E.wp,{}),(0,z.jsx)(P.W,{children:(0,z.jsx)(A,{})}),(0,z.jsx)(S.$,{})]})})});var M=()=>(0,z.jsxs)(n.f,{attribute:"class",forcedTheme:"dark",children:[(0,z.jsxs)(s(),{children:[(0,a.Ir)("Billing"),(0,a.T$)()]}),(0,z.jsx)(R,{})]})},77169:function(e,r,t){"use strict";t.d(r,{r:function(){return l}});var n=t(69517),i=t(61266),s=t(6590);function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}let l=e=>{let r=(0,s.W)();return(0,i.D)(function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};
1r%2?a(Object(t),!0).forEach(function(r){(0,n.Z)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({mutationFn:async()=>(await r.subscriptionsV2.getSpaceSubscriptionStripePortal()).url},e))}},30097:function(e,r,t){"use strict";t.d(r,{K:function(){return l},n:function(){return c}});var n=t(2784),i=t(27843),s=t(13117),a=t(85941);function l(e){let{data:r,isLoading:t,isError:l}=(0,s.aT)({type:i.U.YourSpaces}),{data:c,isLoading:o}=(0,a.m3)();return{spaceSubscriptionList:(0,n.useMemo)(()=>{let t=c?(0,a.PN)(c):[];if(!t||!t.length)return[];let n=[];for(let s of t){var i;if(e&&"FREE_UGC"===s.plan)continue;let t=null==r?void 0:r.spaces.find(e=>e.space.id===s.spaceID);n.push({id:s.spaceID,name:null!==(i=null==t?void 0:t.space.name)&&void 0!==i?i:"",pricingPlanId:null==s?void 0:s.plan})}return n},[c,null==r?void 0:r.spaces,e]),isLoadingSpaces:t,isErrorLoadingSpaces:l,isLoadingSpaceSubscriptions:o}}function c(){let{data:e,isLoading:r,isError:t}=(0,s.aT)({type:i.U.YourSpaces}),{data:l,isLoading:c}=(0,a.m3)(),o=(0,n.useMemo)(()=>{let r=l?(0,a.PN)(l):[];if(!(null!=e&&e.spaces))return[];if(!r)return null==e?void 0:e.spaces.map(e=>{var r,t;return{id:null===(r=e.space)||void 0===r?void 0:r.id,name:null===(t=e.space)||void 0===t?void 0:t.name,pricingPlanId:"FREE"}});let t=[];for(let s of e.spaces){var n,i;let e=r.find(e=>{var r;return e.spaceID===(null===(r=s.space)||void 0===r?void 0:r.id)});t.push({id:null===(n=s.space)||void 0===n?void 0:n.id,name:null===(i=s.space)||void 0===i?void 0:i.name,pricingPlanId:(null==e?void 0:e.plan)||"FREE"})}return t},[l,null==e?void 0:e.spaces]);return{spaces:e,spacesWithSubscriptionInfo:o,isLoadingSpaces:r,isErrorLoadingSpaces:t,isLoadingSpaceSubscriptions:c}}},52895:function(e,r,t){"use strict";t.d(r,{w:function(){return h}});var n=t(69517),i=t(2784),s=t(77169),a=t(78749),l=t(46700),c=t(56873),o=t(14978),u=t(30097),d=t(67625),p=t(52322);function f(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?f(Object(t),!0).forEach(function(r){(0,n.Z)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}let h=(0,i.memo)(function(e){let{spaces:r,hideButton:t=!1,selectedBillingTerm:n,selectedPricingPlanId:f,showSpaceId:h,showSubStatus:b}=e,g=(0,a.bp)(e=>e.actions),{mutateAsync:x}=(0,s.r)(),{spacesWithSubscriptionInfo:j}=(0,u.n)(),y=(0,i.useCallback)(async e=>{let{spaceCurrentPricingPlanId:r,spaceId:t}=e;if("FREE"===r||"FREE_UGC"===r){g.openModal({type:l.c3.SpaceSubCheckout,payload:{planId:f,spaceId:t,term:n}});return}try{let e=await x();window.open(e,"_blank")}catch(e){e&&c.A.error("Something went wrong. Please try again later.")}},[g,x,n,f]),v=(0,i.useCallback)(e=>(0,p.jsx)(d.H,{id:e.id,name:e.name,buttonTitle:"Upgrade",onClick:()=>y({spaceCurrentPricingPlanId:e.pricingPlanId,spaceId:e.id}),pricingPlanId:e.pricingPlanId,hideButton:t,showSpaceId:h,isDeletedSpace:e.isDeletedSpace,showSubStatus:b},e.id),[t,y,h,b]),w=(0,i.useMemo)(()=>r.map(e=>m(m({},e),{},{isDeletedSpace:!j.some(r=>r.id===e.id)})).sort((e,r)=>Number(e.isDeletedSpace)-Number(r.isDeletedSpace)),[r,j]);return(0,p.jsx)(o.xr,{className:"h-full",children:(0,p.jsx)("div",{className:"flex flex-col gap-4",children:w.map(v)})})})},65440:function(e,r,t){"use strict";t.d(r,{K:function(){return c}});var n=t(2784),i=t(3277),s=t(14701),a=t(11897),l=t(52322);let c=(0,n.memo)(function(e){let{pricingPlanId:r,className:t,labelClassName:c}=e,o=(0,n.useMemo)(()=>(0,i.Ay)(r),[r]);return(0,l.jsx)("div",{className:(0,s.cn)("flex items-center justify-center rounded-md bg-accent px-2 py-1",{"bg-blue":"PRO"===r||"BUSINESS"===r||"ENTERPRISE"===r},t),children:(0,l.jsx)(a.x,{size:"sm",weight:"bold",className:c,children:o})})})},67625:function(e,r,t){"use strict";t.d(r,{H:function(){return b}});var n,i,s,a=t(39097),l=t.n(a),c=t(2784);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(null,arguments)}let u=(0,c.forwardRef)((e,r)=>{let{title:t,titleId:a,...l}=e;return c.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-external-link",ref:r,"aria-labelledby":a},l),t?c.createElement("title",{id:a},t):null,n||(n=c.createElement("path",{d:"M15 3h6v6"})),i||(i=c.createElement("path",{d:"M10 14 21 3"})),s||(s=c.createElement("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})))});var d=t(14701),p=t(11897),f=t(89013),m=t(65440),h=t(52322);let b=(0,c.memo)(function(e){let{id:r,name:t,pricingPlanId:n,buttonTitle:i,onClick:s,isCreateSpaceRow:a,hideButton:c,showSpaceId:o,isDeletedSpace:b,showSubStatus:g}=e,x=!r||!o||b,j=o&&b?"This space doesn't exist":t;return(0,h.jsxs)("div",{className:(0,d.cn)("flex justify-between gap-3 px-4",c&&"flex-col"),children:[(0,h.jsxs)("div",{className:(0,d.cn)("flex items-center gap-2",c&&"w-full justify-between",g&&"grid grid-cols-[320px_minmax(0,120px)_auto] justify-normal"),children:[(0,h.jsxs)("div",{className:(0,d.cn)(o&&b&&"opacity-30"),children:[(0,h.jsx)(l(),{href:x?"":`/s/${r}`,target:"_blank",rel:"noopener noreferrer",className:(0,d.cn)("no-underline hover:underline",x&&"pointer-events-none"),children:(0,h.jsxs)(p.x,{size:"lg",className:(0,d.cn)("max-w-[320px] truncate text-nowrap",a&&"text-muted-foreground",c&&"w-[320px]"),children:[j,!x&&(0,h.jsx)(u,{className:"icon icon-xs ml-1 pt-1 text-muted-foreground"})]})}),r&&o&&(0,h.jsxs)(p.x,{size:"xs",className:"text-muted-foreground",children:["space ID: ",r]})]}),n&&(0,h.jsx)(m.K,{pricingPlanId:n,className:(0,d.cn)(g&&"w-fit",o&&b&&"bg-muted-foreground opacity-30")}),g&&(0,h.jsx)(p.x,{size:"sm",className:b?"opacity-30":void 0,children:b?"Cancelled":"Active"})]}),!c&&(0,h.jsx)(f.z,{size:"sm",className:"w-24 hover:brightness-75",noScaleOnHover:!0,color:a?"outline":"white",onClick:s,children:i})]})})},14978:function(e,r,t){"use strict";t.d(r,{xr:function(){return h}});var n=t(69517),i=t(43977),s=t(43013),a=t(2784),l=t(14701),c=t(52322);let o=["className","classNameViewport","children","scrollHideDelay"],u=["className","children"],d=["className","orientation"],p=["className"];function f(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};
1r%2?f(Object(t),!0).forEach(function(r){(0,n.Z)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}let h=(0,a.forwardRef)((e,r)=>{let{className:t,classNameViewport:n,children:a,scrollHideDelay:u=500}=e,d=(0,i.Z)(e,o);return(0,c.jsxs)(s.fC,m(m({ref:r,className:(0,l.cn)("relative overflow-hidden",t),scrollHideDelay:u},d),{},{children:[(0,c.jsx)(g,{className:n,children:a}),(0,c.jsx)(x,{}),(0,c.jsx)(b,{})]}))});h.displayName=s.fC.displayName,s.fC;let b=s.lj,g=(0,a.forwardRef)((e,r)=>{let{className:t,children:n}=e,a=(0,i.Z)(e,u);return(0,c.jsx)(s.l_,m(m({ref:r,className:(0,l.cn)("h-full w-full rounded-[inherit]",t)},a),{},{children:n}))});g.displayName=s.l_.displayName;let x=(0,a.forwardRef)((e,r)=>{let{className:t,orientation:n="vertical"}=e,a=(0,i.Z)(e,d);return(0,c.jsx)(s.gb,m(m({ref:r,orientation:n,className:(0,l.cn)("flex touch-none select-none transition-colors animate-in fade-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out","vertical"===n&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===n&&"h-2.5 border-t border-t-transparent p-[1px]",t)},a),{},{children:(0,c.jsx)(j,{})}))});x.displayName=s.gb.displayName;let j=(0,a.forwardRef)((e,r)=>{let{className:t}=e,n=(0,i.Z)(e,p);return(0,c.jsx)(s.q4,m({ref:r,className:(0,l.cn)("relative flex-1 rounded-full bg-gray-500 transition-colors hover:bg-white/50",t)},n))});j.displayName=s.q4.displayName},37291:function(e,r,t){"use strict";t.d(r,{Z:function(){return i}});var n=t(2784);function i(e,r){void 0===r&&(r=0);var t=(0,n.useRef)(!1),i=(0,n.useRef)(),s=(0,n.useRef)(e),a=(0,n.useCallback)(function(){return t.current},[]),l=(0,n.useCallback)(function(){t.current=!1,i.current&&clearTimeout(i.current),i.current=setTimeout(function(){t.current=!0,s.current()},r)},[r]),c=(0,n.useCallback)(function(){t.current=null,i.current&&clearTimeout(i.current)},[]);return(0,n.useEffect)(function(){s.current=e},[e]),(0,n.useEffect)(function(){return l(),c},[r]),[a,c,l]}},22378:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/billing",function(){return t(7865)}])}},function(e){e.O(0,[9097,2445,2288,8435,248,3013,1036,748,1777,668,2888,9774,179],function(){return e(e.s=22378)}),_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.