summaryrefslogtreecommitdiffstats
path: root/src/web/gui/v2/3621.01ee70ee9c311ac163d9.chunk.js
blob: 4779ee524af6c0a6b5024cc0107c9eacc1f4eaaf (plain)
1
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="faad78fd-e5f3-4fb9-b6d3-062efb04f31c",e._sentryDebugIdIdentifier="sentry-dbid-faad78fd-e5f3-4fb9-b6d3-062efb04f31c")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"30b1ba65cc8722be7e184f4a401fb43e6b21634d"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[3621],{63621:(e,t,n)=>{n.r(t),n.d(t,{default:()=>U});n(30067),n(93518),n(25440),n(3064),n(41393),n(98992),n(72577),n(81454),n(62953);var r=n(96540),o=n(47767),a=n(86663),s=n(26655),i=n(78969),c=n(22292),d=n(63129),u=n(71835),l=n(76201),f=n(3914),g=n(69418);const w=()=>{const e=(0,c.uW)("id"),t=(0,c.uW)("name"),n=(0,c.uW)("email"),o=(0,c.uW)("createdAt"),a=(0,c.uW)("verifiedEmail"),s=(0,c.uW)("avatarUrl"),i=(0,f.UV)("loaded"),d=(0,f.UV)("ids"),[,u,l]=(0,g.A)();(0,r.useEffect)((()=>{e&&i&&!u&&(e=>{let{avatar:t,createdAt:n,email:r,id:o,name:a,spacesCount:s,verifiedEmail:i,maxNodesCount:c}=e;if(!window.envSettings.tracking)return;if(r&&r.includes("@netdata.msdc.co"))return;if(o&&"00000000-0000-0000-0000-000000000000"===o)return;if(r&&r.includes("anonymous@netdata.cloud"))return;const d=new Date,u=d.toISOString(),l=new Date(n),f=Math.floor((d-l)/864e5);var g;window.dataLayer&&(window.dataLayer.push({event:"UserInfoAvailable",user_id:o,userIdentifier:o,userName:a,userEmail:r,userAccountCreatedAt:n,userAccountCreatedDaysAgo:f,userAvatarURL:t,userEmailVerified:i,spacesCount:s}),null!==(g=window.posthog)&&void 0!==g&&g.__loaded&&(window.posthog.identify(o),window.posthog.people.set({email:r||"unknown email",name:a,netdata_cloud_account_created_at:n,netdata_cloud_account_created_days_ago:f,spacesCount:s,maxNodesCount:c}),window.posthog.register({netdata_cloud_account_created_days_ago:f,...window.localNetdataRegistry?{...window.localNetdataRegistry.pg?{netdata_registry_person_guid:window.localNetdataRegistry.pg}:{},...window.localNetdataRegistry.mg?{netdata_registry_machine_guid:window.localNetdataRegistry.mg}:{}}:{}}),window.posthog.register_once({event_source:"cloud",netdata_cloud_account_created_at:n,netdata_cloud_account_email:r||"unknown email",netdata_cloud_account_id:o,netdata_cloud_signed_in_at:u})))})({avatar:s,createdAt:o,email:n,id:e,name:t,spacesCount:d.length,verifiedEmail:a,maxNodesCount:l})}),[e,i,u]),(0,r.useEffect)((()=>{var e;if(null!==(e=window.posthog)&&void 0!==e&&e.__loaded)try{window.posthog.onFeatureFlags((function(){window.posthog.isFeatureEnabled&&window.posthog.isFeatureEnabled("user-age-less-than-7d")&&window.posthog.startSessionRecording()}))}catch(t){}}),[])},p=()=>{var e;if(null===(e=window.posthog)||void 0===e||!e.__loaded)return;const t=(new Date).toISOString();window.posthog.register_once({event_source:"cloud",posthog_first_seen_at:t,posthog_first_distinct_id:"get_distinct_id"in window.posthog&&window.posthog.get_distinct_id()})},m=()=>(0,r.useEffect)(p,[]);var h=n(87337),y=n(9224),v=n(91069),_=n(48388),E=n(37618),b=n(33829),A=n(67276),N=n(38819),C=n(80158),S=n(79731),k=n(50876);const R=()=>{const e=(0,r.useRef)(),[,t]=(0,u.A)(),{error_msg_key:n,error_msg:o}=(0,N.PP)(),{sendLog:a}=(0,k.A)();(0,r.useEffect)((()=>{if(n&&e.current!=n){e.current=n;const r=o?(0,C.Zr)(decodeURIComponent(o)):void 0,s=(0,S.o)(n,r);t({header:"Error",text:s}),a({feature:"url-hash-error",isFailure:!0,errorMsgKey:n,message:s})}}),[e.current,n,o,t,a])},I=e=>{let{errorRetry:t,token:n,redirectUri:o}=e;const s=a.parseUrl(decodeURIComponent(t)),{url:i,query:c}=s,{redirect_uri:d}=c,u=(0,r.useRef)(!1);return u.current||(u.current=!0,window.location="".concat(i,"?token=").concat(n,"&redirect_uri=").concat(d||o)),null},U=()=>{const e=(0,c.uW)("isLoaded"),t=(0,c.uW)("isAnonymous");(0,l.A)(),m(),w(),(0,r.useEffect)((()=>{if(!E.Ay){const e=window.localStorage.getItem(A.lO.visitor);if(e)window.envSettings.visitor=e;else{const e=(0,b.A)();window.localStorage.setItem(A.lO.visitor,e),window.envSettings.visitor=e}}}),[]),(0,r.useEffect)((()=>{sessionStorage.getItem(A.yq.session)||sessionStorage.setItem(A.yq.session,(0,b.A)())}),[]),R();const n=(0,o.RQ)("/sign-in/mobile-app/*"),f=(0,o.RQ)("/sign-in/*"),g=(0,o.RQ)("/sign-up/*"),p=!!f||!!g,N=(()=>{const[,e]=(0,u.A)(),t=(0,h.KF)();return(0,r.useCallback)((function(){let{origin:n,id:r,name:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!n)return;const a=decodeURIComponent(r),c=decodeURIComponent(n);(0,y.ys)(r).then((n=>{let{data:r=[]}=n;return t(a,c,o),r.length?s.A.get(i._9).then((e=>{let{data:t}=e;return Promise.any(t.map((e=>s.A.get((0,v.t)({spaceId:e.id})).then((t=>{let{data:n}=t;return Promise.any(n.map((t=>(0,d.uQ)({roomId:t.id,spaceId:e.id}).then((n=>{let{nodes:o}=n;const a=o.find((e=>{let{id:t}=e;return r.includes(t)}));if(!a)throw new Error("can't find matching node");const{protocol:s,host:i}=window.location;return"".concat(s,"//").concat(i,"/spaces/").concat(e.slug,"/rooms/").concat(t.slug,"/nodes/").concat(a.id)})))))})))))})).catch((()=>{})):(0,y.iY)(a).then((t=>{let{data:n}=t;const{claimed:r}=n;throw e(r?{errorMsgKey:"ErrForbidden",errorMessage:"You tried to access this Node on Netdata and you don't have access to it. Please contact your Space admin to give you access to it."}:{errorMsgKey:"ErrForbidden",errorMessage:"This Node isn't connected to Netdata. Please connect it, if you have permission for it, or contact your Space admin."}),"no access"}))})).then((e=>{e&&setTimeout(location.assign(e))})).catch((()=>{}))}),[])})(),C=(0,_.A)();if(!e||C.isFetching||C.hasAccess&&!p||n)return null;const{pathname:S,search:k,hash:U}=window.location,{error_retry:D,token:x}=a.parse(U),{cloudRoute:T,redirect_uri:P,...F}=a.parse(k);if(!t&&D)return r.createElement(I,{errorRetry:D,token:x,redirectUri:P});if(!t&&p){if(T){const e=T.includes("join-callback")?decodeURI(T):T,t=Array.isArray(e)?e[0]:e;return r.createElement(o.C5,{replace:!0,to:t})}return P?(N(F),window.location.replace(decodeURIComponent(P)),null):r.createElement(o.C5,{replace:!0,to:"/spaces"})}if(E.Ay)return null;if(t&&!p){const e=U.includes("join-callback")?U:encodeURIComponent(U),t="".concat(k).concat(k?"&":"?","cloudRoute=").concat(S);return r.createElement(o.C5,{replace:!0,to:{pathname:"/sign-in",search:t,hash:e}})}return null}},87337:(e,t,n)=>{n.d(t,{xN:()=>p,vS:()=>f,YN:()=>m,KF:()=>w,iw:()=>l,rE:()=>g});n(17333),n(3064),n(41393),n(14905),n(98992),n(54520),n(72577),n(81454),n(8872),n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215),n(62953);var r=n(96540),o=n(47444),a=n(47767),s=n(22292);const i=(0,o.Iz)({key:"visitedNodes",default:()=>[]});var c=n(47762),d=n(9224);const u=(0,o.K0)({key:"visitedNodeIdsValue",get:e=>t=>{let{get:n}=t;return n(i(e)).map((e=>{let{id:t}=e;return t}))}}),l=()=>{const e=(0,s.NJ)(),t=(0,o.vc)(i(e)),n=(0,o.Zs)((e=>{let{set:t}=e;return e=>{t(c.gl,{values:e.reduce(((e,t)=>({...e,[t.id]:{...t,loaded:!0}})),{}),merge:!0})}}),[]);return(0,r.useEffect)((()=>{n(t)}),[t]),(0,o.vc)(u(e))},f=e=>{const t=(0,s.NJ)(),n=(0,o.vc)(i(t)),a=(0,r.useMemo)((()=>e?n.filter((t=>t.name.toUpperCase().includes(e.toUpperCase()))):n),[n,e]);return(0,r.useMemo)((()=>a.map((e=>e.id))),[a])},g=()=>(0,o.Zs)((e=>{let{snapshot:t,set:n}=e;return async(e,r)=>{const o=await t.getPromise((0,s.Dm)("id")),{urls:a,name:u}=await t.getPromise((0,c.GN)({id:e})),l=a.filter((e=>e!==r));n((0,c.GN)({id:e,key:"urls"}),l),l.length||n(i(o),(t=>t.filter((t=>t.id!==e))));try{await(l.length?(0,d.Bz)(o,e,u,l):(0,d.sm)(o,[e])),(0,d.UL)(o,e).catch((()=>{}))}catch(f){n((0,c.GN)({id:e,key:"urls"}),a)}}}),[]),w=()=>{const{pathname:e}=(0,a.zy)(),t=(0,s.NJ)(),n=p({autoFetch:!1});return(0,o.Zs)((e=>{let{snapshot:t,set:r}=e;return async(e,o,a)=>{if(await t.getPromise((0,s.Dm)("isAnonymous")))return;const u=await t.getPromise((0,s.Dm)("id")),{urls:l,name:f}=await t.getPromise((0,c.GN)({id:e}));let g=o?[o,...l]:l;g=[...new Set([window.location.href,...g])];const w=g.length!==l.length;try{r((0,c.GN)({id:e,key:"urls"}),g),r(i(u),(t=>{const n=t.find((t=>t.id===e)),r=t.filter((t=>t.id!==e));return n?[{...n,accessCount:n.accessCount+1,lastAccessTime:(new Date).toISOString()},...r]:[{accessCount:1,id:e,lastAccessTime:(new Date).toISOString(),urls:g,name:a},...r]})),w&&await(0,d.Bz)(u,e,a||f,g),n(),await(0,d.UL)(u,e)}catch(p){r((0,c.GN)({id:e,key:"urls"}),l)}}}),[n,e,t])},p=function(){let{autoFetch:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,isAnonymous:n}=(0,s.uW)(),[,a]=(0,o.L4)(i(t)),[c,u]=(0,r.useState)(0),l=(0,r.useCallback)((()=>{u((e=>e+1))}),[u]);return(0,r.useEffect)((()=>{if(t&&(e||c))if(n){const e=(window.visitedNodes||[]).sort(((e,t)=>new Date(t.lastAccessTime)-new Date(e.lastAccessTime)));a(e)}else(0,d.uQ)(t).then((e=>{if(!e)return;const{data:{results:t}}=e,n=t.sort(((e,t)=>new Date(t.lastAccessTime)-new Date(e.lastAccessTime)));a(n)}))}),[e,c,t,n]),l},m=()=>{const e=(0,s.NJ)(),t=i(e);return(0,o.Zs)((e=>{let{snapshot:n,set:r}=e;return async e=>{const o=(await n.getPromise((0,c.th)(e))).map((e=>e.machineGUID)),a=await n.getPromise(t),s=a.filter((e=>!o.includes(e.id)));s.length!==a.length&&r(t,s)}}),[e])}},84428:(e,t,n)=>{var r=n(78227)("iterator"),o=!1;try{var a=0,s={next:function(){return{done:!!a++}},return:function(){o=!0}};s[r]=function(){return this},Array.from(s,(function(){throw 2}))}catch(i){}e.exports=function(e,t){try{if(!t&&!o)return!1}catch(i){return!1}var n=!1;try{var a={};a[r]=function(){return{next:function(){return{done:n=!0}}}},e(a)}catch(i){}return n}},87290:(e,t,n)=>{var r=n(50516),o=n(19088);e.exports=!r&&!o&&"object"==typeof window&&"object"==typeof document},50516:e=>{e.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},19088:(e,t,n)=>{var r=n(24475),o=n(44576);e.exports="process"===o(r.process)},16193:(e,t,n)=>{var r=n(79504),o=Error,a=r("".replace),s=String(new o("zxcasd").stack),i=/\n\s*at [^:]*:[^\n]*/,c=i.test(s);e.exports=function(e,t){if(c&&"string"==typeof e&&!o.prepareStackTrace)for(;t--;)e=a(e,i,"");return e}},80747:(e,t,n)=>{var r=n(66699),o=n(16193),a=n(24659),s=Error.captureStackTrace;e.exports=function(e,t,n,i){a&&(s?s(e,t):r(e,"stack",o(n,i)))}},24659:(e,t,n)=>{var r=n(79039),o=n(6980);e.exports=!r((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",o(1,7)),7!==e.stack)}))},77584:(e,t,n)=>{var r=n(20034),o=n(66699);e.exports=function(e,t){r(t)&&"cause"in t&&o(e,"cause",t.cause)}},32603:(e,t,n)=>{var r=n(655);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},10916:(e,t,n)=>{var r=n(24475),o=n(80550),a=n(94901),s=n(92796),i=n(33706),c=n(78227),d=n(87290),u=n(50516),l=n(96395),f=n(77388),g=o&&o.prototype,w=c("species"),p=!1,m=a(r.PromiseRejectionEvent),h=s("Promise",(function(){var e=i(o),t=e!==String(o);if(!t&&66===f)return!0;if(l&&(!g.catch||!g.finally))return!0;if(!f||f<51||!/native code/.test(e)){var n=new o((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[w]=r,!(p=n.then((function(){}))instanceof r))return!0}return!t&&(d||u)&&!m}));e.exports={CONSTRUCTOR:h,REJECTION_EVENT:m,SUBCLASSING:p}},90537:(e,t,n)=>{var r=n(80550),o=n(84428),a=n(10916).CONSTRUCTOR;e.exports=a||!o((function(e){r.all(e).then(void 0,(function(){}))}))},17145:(e,t,n)=>{var r=n(46518),o=n(1625),a=n(42787),s=n(52967),i=n(77740),c=n(2360),d=n(66699),u=n(6980),l=n(77584),f=n(80747),g=n(72652),w=n(32603),p=n(78227)("toStringTag"),m=Error,h=[].push,y=function(e,t){var n,r=o(v,this);s?n=s(new m,r?a(this):v):(n=r?this:c(v),d(n,p,"Error")),void 0!==t&&d(n,"message",w(t)),f(n,y,n.stack,1),arguments.length>2&&l(n,arguments[2]);var i=[];return g(e,h,{that:i}),d(n,"errors",i),n};s?s(y,m):i(y,m,{name:!0});var v=y.prototype=c(m.prototype,{constructor:u(1,y),message:u(1,""),name:u(1,"AggregateError")});r({global:!0,constructor:!0,arity:2},{AggregateError:y})},30067:(e,t,n)=>{n(17145)},93518:(e,t,n)=>{var r=n(46518),o=n(69565),a=n(79306),s=n(97751),i=n(36043),c=n(1103),d=n(72652),u=n(90537),l="No one promise resolved";r({target:"Promise",stat:!0,forced:u},{any:function(e){var t=this,n=s("AggregateError"),r=i.f(t),u=r.resolve,f=r.reject,g=c((function(){var r=a(t.resolve),s=[],i=0,c=1,g=!1;d(e,(function(e){var a=i++,d=!1;c++,o(r,t,e).then((function(e){d||g||(g=!0,u(e))}),(function(e){d||g||(d=!0,s[a]=e,--c||f(new n(s,l)))}))})),--c||f(new n(s,l))}));return g.error&&f(g.value),r.promise}})}}]);