@amedia/user 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc +8 -3
- package/dist/actions/authentication.d.ts +1 -1
- package/dist/actions/authorization.d.ts +6 -2
- package/dist/cache/engines/global.d.ts +15 -0
- package/dist/cache/engines/global.spec.d.ts +1 -0
- package/dist/cache/engines/indexeddb.d.ts +1 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.spec.d.ts +4 -0
- package/dist/cache/types.d.ts +1 -0
- package/dist/eventHandlers/authentication.d.ts +5 -3
- package/dist/index-authentcation.spec.d.ts +4 -0
- package/dist/index-userdata.spec.d.ts +4 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/lib/cookie.d.ts +5 -0
- package/dist/lib/rpc.d.ts +1 -0
- package/dist/services/jupiter.spec.d.ts +1 -0
- package/dist/services/mercury.spec.d.ts +4 -0
- package/dist/services/pluto.d.ts +2 -2
- package/dist/services/pluto.spec.d.ts +1 -0
- package/dist/utils/log.d.ts +7 -0
- package/dist/utils/queue.d.ts +9 -2
- package/package.json +5 -4
- package/src/actions/authentication.ts +28 -5
- package/src/actions/authorization.ts +42 -38
- package/src/{lib/dataOrganizer.ts → actions/userData.ts} +5 -2
- package/src/cache/engines/global.spec.ts +62 -0
- package/src/cache/engines/global.ts +25 -7
- package/src/cache/engines/indexeddb.ts +3 -1
- package/src/cache/index.spec.ts +33 -1
- package/src/cache/index.ts +8 -1
- package/src/cache/types.ts +1 -0
- package/src/eventHandlers/authentication.ts +10 -5
- package/src/eventHandlers/userAttributes.ts +1 -1
- package/src/index-authentcation.spec.ts +44 -0
- package/src/{index.spec.ts → index-userdata.spec.ts} +8 -15
- package/src/index.ts +9 -6
- package/src/lib/cookie.ts +109 -0
- package/src/lib/rpc.ts +15 -0
- package/src/services/jupiter.spec.ts +5 -3
- package/src/services/jupiter.ts +5 -3
- package/src/services/pluto.ts +8 -6
- package/src/utils/log.ts +29 -2
- package/src/utils/queue.ts +19 -4
- package/tsconfig.json +2 -0
- package/webpack.config.js +1 -1
- package/.babelrc +0 -3
- package/dist/lib/authentication.d.ts +0 -20
- package/dist/lib/authorization.d.ts +0 -15
- package/dist/lib/cache/db.d.ts +0 -6
- package/dist/lib/cache/global.d.ts +0 -9
- package/dist/lib/cache/types.d.ts +0 -5
- package/dist/lib/eventHandler.d.ts +0 -3
- package/dist/lib/queue.d.ts +0 -5
- package/dist/lib/types.d.ts +0 -7
- package/dist/lib/userAttributes.d.ts +0 -12
- package/dist/services/cache.d.ts +0 -9
- /package/dist/{lib/dataOrganizer.d.ts → actions/userData.d.ts} +0 -0
package/.eslintignore
ADDED
package/.eslintrc
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@amedia/eslint-config-typescript",
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
"plugins": ["prettier"],
|
|
4
|
+
"parserOptions": {
|
|
5
|
+
"project": "./tsconfig.eslint.json"
|
|
6
|
+
},
|
|
7
|
+
"rules": {
|
|
8
|
+
"prettier/prettier": "warn",
|
|
9
|
+
"import/prefer-default-export": "off"
|
|
10
|
+
}
|
|
6
11
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Record, Array, String, Static } from 'runtypes';
|
|
2
|
+
declare const AccessSchema: Record<{
|
|
3
|
+
access: Array<String, false>;
|
|
4
|
+
}, false>;
|
|
5
|
+
export declare const getAccess: () => Promise<Static<typeof AccessSchema>>;
|
|
3
6
|
export declare const activate: () => Promise<unknown>;
|
|
7
|
+
export {};
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { CacheEntry, Engine } from '../types';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
amediaUserCache?: {
|
|
5
|
+
[index: string]: CacheEntry;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
namespace NodeJS {
|
|
9
|
+
interface Global {
|
|
10
|
+
amediaUserCache?: {
|
|
11
|
+
[index: string]: CacheEntry;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
2
16
|
export declare const get: (key: string) => Promise<CacheEntry>;
|
|
3
17
|
export declare const set: (key: string, data: unknown, expires: number) => Promise<void>;
|
|
4
18
|
export declare const remove: (key: string) => Promise<void>;
|
|
19
|
+
export declare const clear: () => Promise<void>;
|
|
5
20
|
declare const _default: Engine;
|
|
6
21
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,5 +2,6 @@ import { CacheEntry, Engine } from '../types';
|
|
|
2
2
|
export declare const get: (key: string) => Promise<CacheEntry>;
|
|
3
3
|
export declare const set: (key: string, data: unknown, expires: number) => Promise<void>;
|
|
4
4
|
export declare const remove: (key: string) => Promise<void>;
|
|
5
|
+
export declare const clear: () => Promise<void>;
|
|
5
6
|
declare const _default: Engine;
|
|
6
7
|
export default _default;
|
package/dist/cache/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ declare const _default: {
|
|
|
5
5
|
get: <T extends Record<any, any>>(key: string, validator: T) => Promise<void | Static<T>>;
|
|
6
6
|
set: (key: string, value: unknown, expires: number) => Promise<void>;
|
|
7
7
|
remove: (key: string) => Promise<void>;
|
|
8
|
+
clear: () => Promise<void>;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
package/dist/cache/types.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
export declare enum AuthenticationEvents {
|
|
2
2
|
REQUEST_LOGIN = "amedia-user.authentication.request-login",
|
|
3
|
-
REQUEST_LOGOUT = "amedia-user.authentication.request-logout"
|
|
3
|
+
REQUEST_LOGOUT = "amedia-user.authentication.request-logout",
|
|
4
|
+
ON_LOGGED_OUT = "amedia-user.authentication.on-logged-out"
|
|
4
5
|
}
|
|
5
6
|
declare global {
|
|
6
7
|
interface WindowEventMap {
|
|
7
8
|
[AuthenticationEvents.REQUEST_LOGIN]: CustomEvent<{
|
|
8
|
-
requestedUrl
|
|
9
|
+
requestedUrl: string;
|
|
9
10
|
}>;
|
|
10
11
|
[AuthenticationEvents.REQUEST_LOGOUT]: CustomEvent<{
|
|
11
|
-
|
|
12
|
+
onLoggedOut: () => void;
|
|
12
13
|
}>;
|
|
14
|
+
[AuthenticationEvents.ON_LOGGED_OUT]: CustomEvent;
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
export declare const listenForAuthenticationRequests: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'regenerator-runtime/runtime';
|
|
1
2
|
import { UserAttributes } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Enables you to subscribe to the user attributes you care about and
|
|
@@ -17,5 +18,6 @@ export declare const subscribeToUserUpdates: <T extends (keyof UserAttributes)[]
|
|
|
17
18
|
* to the requestedUrl if supplied or the current url before redirecting away if not.
|
|
18
19
|
* @param requestedUrl
|
|
19
20
|
*/
|
|
20
|
-
export declare const
|
|
21
|
+
export declare const login: (requestedUrl?: string | undefined) => void;
|
|
22
|
+
export declare const logout: (onLoggedOut: () => void) => void;
|
|
21
23
|
export declare const activate: () => Promise<unknown>;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.user=t():e.user=t()}(this,(function(){return(()=>{var e={390:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new I(n||[]);return i._invoke=function(e,t,r){var n=f;return function(o,i){if(n===v)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=C(a,r);if(u){if(u===h)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=v;var c=l(e,t,r);if("normal"===c.type){if(n=r.done?y:d,c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(e,r,a),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var f="suspendedStart",d="suspendedYield",v="executing",y="completed",h={};function p(){}function E(){}function g(){}var R={};R[i]=function(){return this};var _=Object.getPrototypeOf,b=_&&_(_(N([])));b&&b!==r&&n.call(b,i)&&(R=b);var O=g.prototype=p.prototype=Object.create(R);function m(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(o,i,a,u){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,u)}))}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function C(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=l(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function N(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:P}}function P(){return{value:t,done:!0}}return E.prototype=O.constructor=g,g.constructor=E,E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===E||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,u,"GeneratorFunction")),e.prototype=Object.create(O),e},e.awrap=function(e){return{__await:e}},m(T.prototype),T.prototype[a]=function(){return this},e.AsyncIterator=T,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new T(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(O),c(O,u,"Generator"),O[i]=function(){return this},O.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=N,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(w),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;w(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),h}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}},896:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncContract=void 0;var i=r(174),a=r(589);t.AsyncContract=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length-1,u=e.slice(0,r),c=e[r];return{enforce:function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length<u.length){var s="Expected "+u.length+" arguments but only received "+t.length,l=a.FAILURE.ARGUMENT_INCORRECT(s);throw new i.ValidationError(l)}for(var f=0;f<u.length;f++)u[f].check(t[f]);var d=e.apply(void 0,o([],n(t)));if(!(d instanceof Promise))throw s="Expected function to return a promise, but instead got "+d,l=a.FAILURE.RETURN_INCORRECT(s),new i.ValidationError(l);return d.then(c.check)}}}}},308:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Contract=void 0;var i=r(174),a=r(589);t.Contract=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length-1,u=e.slice(0,r),c=e[r];return{enforce:function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length<u.length){var s="Expected "+u.length+" arguments but only received "+t.length,l=a.FAILURE.ARGUMENT_INCORRECT(s);throw new i.ValidationError(l)}for(var f=0;f<u.length;f++)u[f].check(t[f]);return c.check(e.apply(void 0,o([],n(t))))}}}}},965:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checked=t.check=void 0;var n=r(174),o=r(589),i=new WeakMap;function a(e,t,r){var n=i.get(e),o=n&&n.get(t);if(o)return o;for(var a=[],u=0;u<r;u++)a.push(u);return a}t.check=function(e,t,r){var n=i.get(e)||new Map;i.set(e,n);var o=n.get(t)||[];n.set(t,o),o.push(r)},t.checked=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("No runtype provided to `@checked`. Please remove the decorator.");return function(t,r,i){var u=i.value,c=(t.name||t.constructor.name+".prototype")+("string"==typeof r?'["'+r+'"]':"["+String(r)+"]"),s=a(t,r,e.length);if(s.length!==e.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(s.length>u.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");i.value=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.forEach((function(e,r){var i=s[r],a=e.validate(t[i]);if(!a.success){var u=c+", argument #"+i+": "+a.message,l=o.FAILURE.ARGUMENT_INCORRECT(u);throw new n.ValidationError(l)}})),u.apply(this,t)}}}},174:function(e,t){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationError=void 0;var o=function(e){function t(r){var n=e.call(this,r.message)||this;return n.name="ValidationError",n.code=r.code,void 0!==r.details&&(n.details=r.details),Object.setPrototypeOf(n,t.prototype),n}return n(t,e),t}(Error);t.ValidationError=o},61:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.InstanceOf=t.Null=t.Undefined=t.Literal=void 0,o(r(350),t),o(r(205),t),o(r(308),t),o(r(896),t),o(r(339),t),o(r(174),t),o(r(615),t),o(r(551),t),o(r(362),t);var i=r(620);Object.defineProperty(t,"Literal",{enumerable:!0,get:function(){return i.Literal}}),Object.defineProperty(t,"Undefined",{enumerable:!0,get:function(){return i.Undefined}}),Object.defineProperty(t,"Null",{enumerable:!0,get:function(){return i.Null}}),o(r(643),t),o(r(422),t),o(r(172),t),o(r(856),t),o(r(59),t),o(r(669),t),o(r(941),t),o(r(489),t),o(r(745),t),o(r(219),t),o(r(617),t),o(r(979),t),o(r(548),t);var a=r(937);Object.defineProperty(t,"InstanceOf",{enumerable:!0,get:function(){return a.InstanceOf}}),o(r(813),t),o(r(277),t),o(r(550),t),o(r(965),t)},339:function(e,t){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.match=void 0,t.match=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var o,i;try{for(var a=r(e),u=a.next();!u.done;u=a.next()){var c=n(u.value,2),s=c[0],l=c[1];if(s.guard(t))return l(t)}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}throw new Error("No alternatives were matched")}}},350:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},205:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Failcode=void 0,t.Failcode={TYPE_INCORRECT:"TYPE_INCORRECT",VALUE_INCORRECT:"VALUE_INCORRECT",KEY_INCORRECT:"KEY_INCORRECT",CONTENT_INCORRECT:"CONTENT_INCORRECT",ARGUMENT_INCORRECT:"ARGUMENT_INCORRECT",RETURN_INCORRECT:"RETURN_INCORRECT",CONSTRAINT_FAILED:"CONSTRAINT_FAILED",PROPERTY_MISSING:"PROPERTY_MISSING",PROPERTY_PRESENT:"PROPERTY_PRESENT",NOTHING_EXPECTED:"NOTHING_EXPECTED"}},705:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.innerValidate=t.create=void 0;var n=r(61),o=r(268),i=r(174),a=r(589);t.create=function(e,t){return t.check=r,t.assert=r,t._innerValidate=function(r,n){return n.has(r,t)?a.SUCCESS(r):e(r,n)},t.validate=function(e){return t._innerValidate(e,(r=new WeakMap,n=function(e,t){if(null!==e&&"object"==typeof e){var n=r.get(e);r.set(e,n?n.set(t,!0):(new WeakMap).set(t,!0))}},{has:function(e,t){var o=r.get(e),i=o&&o.get(t)||!1;return n(e,t),i}}));var r,n},t.guard=function(e){return t.validate(e).success},t.Or=function(e){return n.Union(t,e)},t.And=function(e){return n.Intersect(t,e)},t.optional=function(){return n.Optional(t)},t.nullable=function(){return n.Union(t,n.Null)},t.withConstraint=function(e,r){return n.Constraint(t,e,r)},t.withGuard=function(e,r){return n.Constraint(t,e,r)},t.withBrand=function(e){return n.Brand(e,t)},t.reflect=t,t.toString=function(){return"Runtype<"+o.default(t)+">"},t;function r(e){var r=t.validate(e);if(r.success)return r.value;throw new i.ValidationError(r)}},t.innerValidate=function(e,t,r){return e._innerValidate(t,r)}},268:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){return function(o){var i=function(t){return e?"("+t+")":t};if(t.has(o))return i("CIRCULAR "+o.tag);t.add(o);try{switch(o.tag){case"unknown":case"never":case"void":case"boolean":case"number":case"bigint":case"string":case"symbol":case"function":return o.tag;case"literal":var a=o.value;return"string"==typeof a?'"'+a+'"':String(a);case"array":return""+n(o)+r(!0,t)(o.element)+"[]";case"dictionary":return"{ [_: "+o.key+"]: "+r(!1,t)(o.value)+" }";case"record":var u=Object.keys(o.fields);return u.length?"{ "+u.map((function(e){return""+n(o)+e+(a=e,u=(i=o).isPartial,c=i.fields,(u||void 0!==a&&"optional"===c[a].tag?"?":"")+": ")+("optional"===o.fields[e].tag?r(!1,t)(o.fields[e].underlying):r(!1,t)(o.fields[e]))+";";var i,a,u,c})).join(" ")+" }":"{}";case"tuple":return"["+o.components.map(r(!1,t)).join(", ")+"]";case"union":return i(""+o.alternatives.map(r(!0,t)).join(" | "));case"intersect":return i(""+o.intersectees.map(r(!0,t)).join(" & "));case"optional":return r(e,t)(o.underlying)+" | undefined";case"constraint":return o.name||r(e,t)(o.underlying);case"instanceof":return o.ctor.name;case"brand":return r(e,t)(o.entity)}}finally{t.delete(o)}throw Error("impossible")}};function n(e){return e.isReadonly?"readonly ":""}t.default=r(!1,new Set)},669:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Array=void 0;var n=r(705),o=r(589);function i(e,t){var r,a={tag:"array",isReadonly:t,element:e};return(r=n.create((function(t,r){if(!Array.isArray(t))return o.FAILURE.TYPE_INCORRECT(a,t);var i=o.enumerableKeysOf(t),u=i.map((function(o){return n.innerValidate(e,t[o],r)})),c=i.reduce((function(e,t){var r=u[t];return r.success||(e[t]=r.details||r.message),e}),[]);return 0!==o.enumerableKeysOf(c).length?o.FAILURE.CONTENT_INCORRECT(a,c):o.SUCCESS(t)}),a)).asReadonly=function(){return i(r.element,!0)},r}t.Array=function(e){return i(e,!1)}},172:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BigInt=void 0;var n=r(705),o=r(589),i={tag:"bigint"};t.BigInt=n.create((function(e){return"bigint"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},643:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Boolean=void 0;var n=r(705),o=r(589),i={tag:"boolean"};t.Boolean=n.create((function(e){return"boolean"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Brand=void 0;var n=r(705);t.Brand=function(e,t){var r={tag:"brand",brand:e,entity:t};return n.create((function(e){return t.validate(e)}),r)}},277:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Guard=t.Constraint=void 0;var n=r(705),o=r(589),i=r(615);t.Constraint=function(e,t,r){var i=r&&r.name,a=r&&r.args,u={tag:"constraint",underlying:e,constraint:t,name:i,args:a};return n.create((function(r){var n=e.validate(r);if(!n.success)return n;var i=t(n.value);return"string"==typeof i?o.FAILURE.CONSTRAINT_FAILED(u,i):i?o.SUCCESS(n.value):o.FAILURE.CONSTRAINT_FAILED(u)}),u)},t.Guard=function(e,t){return i.Unknown.withGuard(e,t)}},745:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Dictionary=void 0;var n=r(705),o=r(856),i=r(277),a=r(268),u=r(589),c=i.Constraint(o.String,(function(e){return!isNaN(+e)}),{name:"number"});t.Dictionary=function(e,t){var i=void 0===t||"string"===t?o.String:"number"===t?c:t,s=a.default(i),l={tag:"dictionary",key:s,value:e};return n.create((function(t,o){if(null==t||"object"!=typeof t)return u.FAILURE.TYPE_INCORRECT(l,t);if(Object.getPrototypeOf(t)!==Object.prototype&&(!Array.isArray(t)||"string"===s))return u.FAILURE.TYPE_INCORRECT(l,t);var a=/^(?:NaN|-?\d+(?:\.\d+)?)$/u,c=u.enumerableKeysOf(t),f=c.reduce((function(c,s){var f="string"==typeof s&&a.test(s),d=f?r.g.Number(s):s;return(f?i.guard(d)||i.guard(s):i.guard(d))?c[s]=n.innerValidate(e,t[s],o):c[s]=u.FAILURE.KEY_INCORRECT(l,i.reflect,d),c}),{}),d=c.reduce((function(e,t){var r=f[t];return r.success||(e[t]=r.details||r.message),e}),{});return 0!==u.enumerableKeysOf(d).length?u.FAILURE.CONTENT_INCORRECT(l,d):u.SUCCESS(t)}),l)}},548:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Function=void 0;var n=r(705),o=r(589),i={tag:"function"};t.Function=n.create((function(e){return"function"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},937:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InstanceOf=void 0;var n=r(705),o=r(589);t.InstanceOf=function(e){var t={tag:"instanceof",ctor:e};return n.create((function(r){return r instanceof e?o.SUCCESS(r):o.FAILURE.TYPE_INCORRECT(t,r)}),t)}},617:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Intersect=void 0;var o=r(705),i=r(589);t.Intersect=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"intersect",intersectees:e};return o.create((function(t,r){var a,u;try{for(var c=n(e),s=c.next();!s.done;s=c.next()){var l=s.value,f=o.innerValidate(l,t,r);if(!f.success)return f}}catch(e){a={error:e}}finally{try{s&&!s.done&&(u=c.return)&&u.call(c)}finally{if(a)throw a.error}}return i.SUCCESS(t)}),r)}},813:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Lazy=void 0;var n=r(705);t.Lazy=function(e){var t,r={get tag(){return o().tag}};function o(){if(!t)for(var n in t=e())"tag"!==n&&(r[n]=t[n]);return t}return n.create((function(e){return o().validate(e)}),r)}},620:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Null=t.Undefined=t.Literal=void 0;var n=r(705),o=r(589);function i(e){return Array.isArray(e)?String(e.map(String)):"bigint"==typeof e?String(e)+"n":String(e)}function a(e){var t={tag:"literal",value:e};return n.create((function(t){return t===e?o.SUCCESS(t):o.FAILURE.VALUE_INCORRECT("literal","`"+i(e)+"`","`"+i(t)+"`")}),t)}t.Literal=a,t.Undefined=a(void 0),t.Null=a(null)},551:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Never=void 0;var n=r(705),o=r(589);t.Never=n.create(o.FAILURE.NOTHING_EXPECTED,{tag:"never"})},422:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Number=void 0;var n=r(705),o=r(589),i={tag:"number"};t.Number=n.create((function(e){return"number"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},979:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Optional=void 0;var n=r(705),o=r(589);t.Optional=function(e){var t={tag:"optional",underlying:e};return n.create((function(t){return void 0===t?o.SUCCESS(t):e.validate(t)}),t)}},489:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Partial=t.Record=t.InternalRecord=void 0;var i=r(705),a=r(589);function u(e,t,r){var c,s={tag:"record",isPartial:t,isReadonly:r,fields:e};return(c=i.create((function(r,u){if(null==r)return a.FAILURE.TYPE_INCORRECT(s,r);var c=a.enumerableKeysOf(e);if(0!==c.length&&"object"!=typeof r)return a.FAILURE.TYPE_INCORRECT(s,r);var l=o([],n(new Set(o(o([],n(c)),n(a.enumerableKeysOf(r)))))),f=l.reduce((function(n,o){var c=a.hasKey(o,e),s=a.hasKey(o,r);if(c){var l=e[o],f=t||"optional"===l.reflect.tag;if(s){var d=r[o];n[o]=f&&void 0===d?a.SUCCESS(d):i.innerValidate(l,d,u)}else n[o]=f?a.SUCCESS(void 0):a.FAILURE.PROPERTY_MISSING(l.reflect)}else{if(!s)throw new Error("impossible");d=r[o],n[o]=a.SUCCESS(d)}return n}),{}),d=l.reduce((function(e,t){var r=f[t];return r.success||(e[t]=r.details||r.message),e}),{});return 0!==a.enumerableKeysOf(d).length?a.FAILURE.CONTENT_INCORRECT(s,d):a.SUCCESS(r)}),s)).asPartial=function(){return u(c.fields,!0,c.isReadonly)},c.asReadonly=function(){return u(c.fields,c.isPartial,!0)},c.pick=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={};return e.forEach((function(e){r[e]=c.fields[e]})),u(r,c.isPartial,c.isReadonly)},c.omit=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={};return a.enumerableKeysOf(c.fields).forEach((function(t){e.includes(t)||(r[t]=c.fields[t])})),u(r,c.isPartial,c.isReadonly)},c}t.InternalRecord=u,t.Record=function(e){return u(e,!1,!1)},t.Partial=function(e){return u(e,!0,!1)}},856:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.String=void 0;var n=r(705),o=r(589),i={tag:"string"};t.String=n.create((function(e){return"string"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},59:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Symbol=void 0;var n=r(705),o=r(589),i={tag:"symbol"};t.Symbol=n.create((function(e){return"symbol"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),Object.assign((function(e){var t={tag:"symbol",key:e};return n.create((function(n){if("symbol"!=typeof n)return o.FAILURE.TYPE_INCORRECT(t,n);var i=r.g.Symbol.keyFor(n);return i!==e?o.FAILURE.VALUE_INCORRECT("symbol key",a(e),a(i)):o.SUCCESS(n)}),t)}),i));var a=function(e){return void 0===e?"undefined":'"'+e+'"'}},941:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tuple=void 0;var n=r(705),o=r(589);t.Tuple=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"tuple",components:e};return n.create((function(t,i){if(!Array.isArray(t))return o.FAILURE.TYPE_INCORRECT(r,t);if(t.length!==e.length)return o.FAILURE.CONSTRAINT_FAILED(r,"Expected length "+e.length+", but was "+t.length);var a=o.enumerableKeysOf(t),u=a.map((function(r){return n.innerValidate(e[r],t[r],i)})),c=a.reduce((function(e,t){var r=u[t];return r.success||(e[t]=r.details||r.message),e}),[]);return 0!==o.enumerableKeysOf(c).length?o.FAILURE.CONTENT_INCORRECT(r,c):o.SUCCESS(t)}),r)}},219:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Union=void 0;var o=r(705),i=r(589);t.Union=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return function(r){for(var n=0;n<e.length;n++)if(e[n].guard(r))return t[n](r)}},a={tag:"union",alternatives:e,match:r};return o.create((function(t,r){var u,c,s,l,f,d,v,y;if("object"!=typeof t||null===t){try{for(var h=n(e),p=h.next();!p.done;p=h.next()){var E=p.value;if(o.innerValidate(E,t,r).success)return i.SUCCESS(t)}}catch(e){u={error:e}}finally{try{p&&!p.done&&(c=h.return)&&c.call(h)}finally{if(u)throw u.error}}return i.FAILURE.TYPE_INCORRECT(a,t)}var g={};try{for(var R=n(e),_=R.next();!_.done;_=R.next())if("record"===(E=_.value).reflect.tag){var b=function(e){var t=E.reflect.fields[e];"literal"===t.tag&&(g[e]?g[e].every((function(e){return e!==t.value}))&&g[e].push(t.value):g[e]=[t.value])};for(var O in E.reflect.fields)b(O)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(l=R.return)&&l.call(R)}finally{if(s)throw s.error}}for(var O in g)if(g[O].length===e.length)try{for(var m=(f=void 0,n(e)),T=m.next();!T.done;T=m.next())if("record"===(E=T.value).reflect.tag){var C=E.reflect.fields[O];if("literal"===C.tag&&i.hasKey(O,t)&&t[O]===C.value)return o.innerValidate(E,t,r)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(d=m.return)&&d.call(m)}finally{if(f)throw f.error}}try{for(var S=n(e),w=S.next();!w.done;w=S.next()){var I=w.value;if(o.innerValidate(I,t,r).success)return i.SUCCESS(t)}}catch(e){v={error:e}}finally{try{w&&!w.done&&(y=S.return)&&y.call(S)}finally{if(v)throw v.error}}return i.FAILURE.TYPE_INCORRECT(a,t)}),a)}},615:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Unknown=void 0;var n=r(705),o=r(589);t.Unknown=n.create((function(e){return o.SUCCESS(e)}),{tag:"unknown"})},362:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Void=void 0;var n=r(615);t.Void=n.Unknown},589:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.FAILURE=t.SUCCESS=t.enumerableKeysOf=t.typeOf=t.hasKey=void 0;var o=r(205),i=r(268);t.hasKey=function(e,t){return"object"==typeof t&&null!==t&&e in t},t.typeOf=function(e){return"object"==typeof e?null===e?"null":Array.isArray(e)?"array":"Object"===e.constructor.name?"object":e.constructor.name:typeof e},t.enumerableKeysOf=function(e){return"object"==typeof e&&null!==e?Reflect.ownKeys(e).filter((function(t){var r,n;return null===(n=null===(r=e.propertyIsEnumerable)||void 0===r?void 0:r.call(e,t))||void 0===n||n})):[]},t.SUCCESS=function(e){return{success:!0,value:e}},t.FAILURE=Object.assign((function(e,t,r){return n({success:!1,code:e,message:t},r?{details:r}:{})}),{TYPE_INCORRECT:function(e,r){var n="Expected "+i.default(e)+", but was "+t.typeOf(r);return t.FAILURE(o.Failcode.TYPE_INCORRECT,n)},VALUE_INCORRECT:function(e,r,n){return t.FAILURE(o.Failcode.VALUE_INCORRECT,"Expected "+e+" "+String(r)+", but was "+String(n))},KEY_INCORRECT:function(e,r,n){return t.FAILURE(o.Failcode.KEY_INCORRECT,"Expected "+i.default(e)+" key to be "+i.default(r)+", but was "+t.typeOf(n))},CONTENT_INCORRECT:function(e,r){var n="Expected "+i.default(e)+", but was incompatible";return t.FAILURE(o.Failcode.CONTENT_INCORRECT,n,r)},ARGUMENT_INCORRECT:function(e){return t.FAILURE(o.Failcode.ARGUMENT_INCORRECT,e)},RETURN_INCORRECT:function(e){return t.FAILURE(o.Failcode.RETURN_INCORRECT,e)},CONSTRAINT_FAILED:function(e,r){var n=r?": "+r:"";return t.FAILURE(o.Failcode.CONSTRAINT_FAILED,"Failed constraint check for "+i.default(e)+n)},PROPERTY_MISSING:function(e){var r="Expected "+i.default(e)+", but was missing";return t.FAILURE(o.Failcode.PROPERTY_MISSING,r)},PROPERTY_PRESENT:function(e){var r="Expected nothing, but was "+t.typeOf(e);return t.FAILURE(o.Failcode.PROPERTY_PRESENT,r)},NOTHING_EXPECTED:function(e){var r="Expected nothing, but was "+t.typeOf(e);return t.FAILURE(o.Failcode.NOTHING_EXPECTED,r)}})}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{activate:()=>L,requestLogin:()=>A,subscribeToUserUpdates:()=>U}),r(390);const e={debug:console.debug,info:console.log,warn:console.warn,error:console.error};var t,o;"undefined"!=typeof window&&(o=window,t=o);var i=function(r,n){t?t.addEventListener(r,(function(e){e.stopImmediatePropagation(),n.apply(window,[e])})):e.error("No root element to bind event to!")},a=function(r,n){t?t.addEventListener(r,(function(e){n.apply(window,[e])})):e.error("No root element to bind event to!")},u=function(r){t?t.dispatchEvent(r):e.error("No root element to dispatch event on!")},c=r(61);function s(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}var l=(0,c.Record)({user_name:c.String,tracking_key:c.String}),f=(0,c.Record)({name:c.String,trackingKey:c.String}),d=function(){var e,t=(e=regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("/api/pluto/v1/sessions/current").then((function(e){if(!e.ok)throw new Error("Request not ok (".concat(e.status,": ").concat(e.statusText,")."));return e.json()})).then((function(e){try{return{name:(t=l.check(e)).user_name,trackingKey:t.tracking_key}}catch(e){throw console.error("Invalid schema",e),e}var t})));case 1:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){s(i,n,o,a,u,"next",e)}function u(e){s(i,n,o,a,u,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}(),v=("undefined"!=typeof window?window:r.g)["amedia-user-cache"]={};const y={get:function(e){var t=v[e];return Promise.resolve(t)},set:function(e,t,r){return v[e]={key:e,data:t,expires:r},Promise.resolve()},remove:function(e){return delete v[e],Promise.resolve()}};function h(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}var p=function(){return y},E=function(e){return p().remove(e)};const g={get:function(){var t,r=(t=regeneratorRuntime.mark((function t(r,n){var o,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p().get(r);case 2:if(o=t.sent){t.next=5;break}return t.abrupt("return",Promise.resolve());case 5:if(!(Date.now()>o.expires)){t.next=8;break}return E(r),t.abrupt("return",Promise.resolve());case 8:return t.prev=8,i=n.check(o.data),t.abrupt("return",i);case 13:return t.prev=13,t.t0=t.catch(8),t.t0 instanceof c.ValidationError?e.error("Failed validating data",{data:o.data,error:t.t0.details}):e.error("Unknown error",t.t0),E(r),t.abrupt("return",Promise.resolve());case 18:case"end":return t.stop()}}),t,null,[[8,13]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(e){h(i,n,o,a,u,"next",e)}function u(e){h(i,n,o,a,u,"throw",e)}a(void 0)}))});return function(e,t){return r.apply(this,arguments)}}(),set:function(e,t,r){return p().set(e,t,r)},remove:E};function R(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}var _,b=!1,O="is_logged_in",m=function(){var e,t=(e=regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!b){e.next=2;break}return e.abrupt("return",null);case 2:return b=!0,e.next=5,g.get(O,f);case 5:if(!(t=e.sent)){e.next=9;break}return b=!1,e.abrupt("return",t);case 9:return e.next=11,d();case 11:return r=e.sent,g.set(O,r,Date.now()+1e4),b=!1,e.abrupt("return",r);case 15:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){R(i,n,o,a,u,"next",e)}function u(e){R(i,n,o,a,u,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();!function(e){e.REQUEST_LOGIN="amedia-user.authentication.request-login",e.REQUEST_LOGOUT="amedia-user.authentication.request-logout"}(_||(_={})),i(_.REQUEST_LOGIN,(function(e){var t,r;t=e.detail.requestedUrl||window.location.href,(r=new URL("https://aid.no/logg_inn/")).searchParams.set("requestedUrl",t||window.location.href),window.location.href=r.href})),i(_.REQUEST_LOGOUT,(function(){}));var T,C={name:m,trackingKey:m};function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){I(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.REQUEST_USER_ATTRIBUTES="amedia-user.request-user-attributes",e.ON_USER_ATTRIBUTES_UPDATED="amedia-user.on-user-attributes-updated"}(T||(T={})),i(T.REQUEST_USER_ATTRIBUTES,(function(e){!function(e,t){var r=[];for(e.forEach((function(e){var t=C[e];t?r.includes(t)||r.push(t):console.warn("Unknown attribute was requested")}));r.length>0;){var n=r.pop();n&&n().then((function(e){t(e)}))}}(e.detail,(function(e){u(new CustomEvent(T.ON_USER_ATTRIBUTES_UPDATED,{detail:w(w({},e),{},{isLoggedIn:!(null==e||!e.name)})}))}))}));var N,P=(0,c.Record)({id:c.Number,domain:c.String});(0,c.Record)({status:(0,c.Literal)("success"),access:(0,c.Union)((0,c.Literal)("granted"),(0,c.Literal)("denied")),publication:P,access_features:(0,c.Array)(c.String)}),(0,c.Record)({status:(0,c.Literal)("success"),cookie:c.String,access_features:(0,c.Array)(c.String)}),(0,c.Record)({status:(0,c.Literal)("success"),vstoken_cookie:c.String,uuid:c.String,access_features:(0,c.Array)(c.String)}),function(e){e.REQUEST_ACTIVATION="amedia-user.activation.request-activation",e.ON_ACTIVATION_COMPLETE="amedia-user.activation.on-activation-complete"}(N||(N={})),i(N.REQUEST_ACTIVATION,(function(){new Promise((function(e,t){setTimeout((function(){e({status:"success"})}),1e3)})).then((function(e){u(new CustomEvent(N.ON_ACTIVATION_COMPLETE,{detail:e}))}))}));var U=function(t,r){a(T.ON_USER_ATTRIBUTES_UPDATED,(function(n){var o=n.detail;if(o){var i={};void 0!==o.isLoggedIn&&(i.isLoggedIn=o.isLoggedIn),t.forEach((function(e){void 0!==o[e]&&(i[e]=o[e])})),r(i)}else e.warn("Nå attributes received",o)})),u(new CustomEvent(T.REQUEST_USER_ATTRIBUTES,{detail:t}))},A=function(e){return u(new CustomEvent(_.REQUEST_LOGIN,{detail:{requestedUrl:e}}))},L=function(){return new Promise((function(e,t){a(N.ON_ACTIVATION_COMPLETE,(function(t){e(t)})),u(new CustomEvent(N.REQUEST_ACTIVATION))}))}})(),n})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.user=t():e.user=t()}(this,(function(){return(()=>{var e={390:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new I(n||[]);return i._invoke=function(e,t,r){var n=f;return function(o,i){if(n===v)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return U()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=b(a,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=v;var c=l(e,t,r);if("normal"===c.type){if(n=r.done?h:d,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(e,r,a),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var f="suspendedStart",d="suspendedYield",v="executing",h="completed",y={};function p(){}function E(){}function g(){}var m={};m[i]=function(){return this};var R=Object.getPrototypeOf,_=R&&R(R(N([])));_&&_!==r&&n.call(_,i)&&(m=_);var O=g.prototype=p.prototype=Object.create(m);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function r(o,i,a,u){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,u)}))}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function b(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,b(e,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=l(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function N(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:U}}function U(){return{value:t,done:!0}}return E.prototype=O.constructor=g,g.constructor=E,E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===E||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,u,"GeneratorFunction")),e.prototype=Object.create(O),e},e.awrap=function(e){return{__await:e}},T(C.prototype),C.prototype[a]=function(){return this},e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},T(O),c(O,u,"Generator"),O[i]=function(){return this},O.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=N,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}},896:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncContract=void 0;var i=r(174),a=r(589);t.AsyncContract=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length-1,u=e.slice(0,r),c=e[r];return{enforce:function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length<u.length){var s="Expected "+u.length+" arguments but only received "+t.length,l=a.FAILURE.ARGUMENT_INCORRECT(s);throw new i.ValidationError(l)}for(var f=0;f<u.length;f++)u[f].check(t[f]);var d=e.apply(void 0,o([],n(t)));if(!(d instanceof Promise))throw s="Expected function to return a promise, but instead got "+d,l=a.FAILURE.RETURN_INCORRECT(s),new i.ValidationError(l);return d.then(c.check)}}}}},308:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Contract=void 0;var i=r(174),a=r(589);t.Contract=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length-1,u=e.slice(0,r),c=e[r];return{enforce:function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length<u.length){var s="Expected "+u.length+" arguments but only received "+t.length,l=a.FAILURE.ARGUMENT_INCORRECT(s);throw new i.ValidationError(l)}for(var f=0;f<u.length;f++)u[f].check(t[f]);return c.check(e.apply(void 0,o([],n(t))))}}}}},965:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checked=t.check=void 0;var n=r(174),o=r(589),i=new WeakMap;function a(e,t,r){var n=i.get(e),o=n&&n.get(t);if(o)return o;for(var a=[],u=0;u<r;u++)a.push(u);return a}t.check=function(e,t,r){var n=i.get(e)||new Map;i.set(e,n);var o=n.get(t)||[];n.set(t,o),o.push(r)},t.checked=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("No runtype provided to `@checked`. Please remove the decorator.");return function(t,r,i){var u=i.value,c=(t.name||t.constructor.name+".prototype")+("string"==typeof r?'["'+r+'"]':"["+String(r)+"]"),s=a(t,r,e.length);if(s.length!==e.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(s.length>u.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");i.value=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.forEach((function(e,r){var i=s[r],a=e.validate(t[i]);if(!a.success){var u=c+", argument #"+i+": "+a.message,l=o.FAILURE.ARGUMENT_INCORRECT(u);throw new n.ValidationError(l)}})),u.apply(this,t)}}}},174:function(e,t){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationError=void 0;var o=function(e){function t(r){var n=e.call(this,r.message)||this;return n.name="ValidationError",n.code=r.code,void 0!==r.details&&(n.details=r.details),Object.setPrototypeOf(n,t.prototype),n}return n(t,e),t}(Error);t.ValidationError=o},61:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.InstanceOf=t.Null=t.Undefined=t.Literal=void 0,o(r(350),t),o(r(205),t),o(r(308),t),o(r(896),t),o(r(339),t),o(r(174),t),o(r(615),t),o(r(551),t),o(r(362),t);var i=r(620);Object.defineProperty(t,"Literal",{enumerable:!0,get:function(){return i.Literal}}),Object.defineProperty(t,"Undefined",{enumerable:!0,get:function(){return i.Undefined}}),Object.defineProperty(t,"Null",{enumerable:!0,get:function(){return i.Null}}),o(r(643),t),o(r(422),t),o(r(172),t),o(r(856),t),o(r(59),t),o(r(669),t),o(r(941),t),o(r(489),t),o(r(745),t),o(r(219),t),o(r(617),t),o(r(979),t),o(r(548),t);var a=r(937);Object.defineProperty(t,"InstanceOf",{enumerable:!0,get:function(){return a.InstanceOf}}),o(r(813),t),o(r(277),t),o(r(550),t),o(r(965),t)},339:function(e,t){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.match=void 0,t.match=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var o,i;try{for(var a=r(e),u=a.next();!u.done;u=a.next()){var c=n(u.value,2),s=c[0],l=c[1];if(s.guard(t))return l(t)}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}throw new Error("No alternatives were matched")}}},350:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},205:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Failcode=void 0,t.Failcode={TYPE_INCORRECT:"TYPE_INCORRECT",VALUE_INCORRECT:"VALUE_INCORRECT",KEY_INCORRECT:"KEY_INCORRECT",CONTENT_INCORRECT:"CONTENT_INCORRECT",ARGUMENT_INCORRECT:"ARGUMENT_INCORRECT",RETURN_INCORRECT:"RETURN_INCORRECT",CONSTRAINT_FAILED:"CONSTRAINT_FAILED",PROPERTY_MISSING:"PROPERTY_MISSING",PROPERTY_PRESENT:"PROPERTY_PRESENT",NOTHING_EXPECTED:"NOTHING_EXPECTED"}},705:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.innerValidate=t.create=void 0;var n=r(61),o=r(268),i=r(174),a=r(589);t.create=function(e,t){return t.check=r,t.assert=r,t._innerValidate=function(r,n){return n.has(r,t)?a.SUCCESS(r):e(r,n)},t.validate=function(e){return t._innerValidate(e,(r=new WeakMap,n=function(e,t){if(null!==e&&"object"==typeof e){var n=r.get(e);r.set(e,n?n.set(t,!0):(new WeakMap).set(t,!0))}},{has:function(e,t){var o=r.get(e),i=o&&o.get(t)||!1;return n(e,t),i}}));var r,n},t.guard=function(e){return t.validate(e).success},t.Or=function(e){return n.Union(t,e)},t.And=function(e){return n.Intersect(t,e)},t.optional=function(){return n.Optional(t)},t.nullable=function(){return n.Union(t,n.Null)},t.withConstraint=function(e,r){return n.Constraint(t,e,r)},t.withGuard=function(e,r){return n.Constraint(t,e,r)},t.withBrand=function(e){return n.Brand(e,t)},t.reflect=t,t.toString=function(){return"Runtype<"+o.default(t)+">"},t;function r(e){var r=t.validate(e);if(r.success)return r.value;throw new i.ValidationError(r)}},t.innerValidate=function(e,t,r){return e._innerValidate(t,r)}},268:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){return function(o){var i=function(t){return e?"("+t+")":t};if(t.has(o))return i("CIRCULAR "+o.tag);t.add(o);try{switch(o.tag){case"unknown":case"never":case"void":case"boolean":case"number":case"bigint":case"string":case"symbol":case"function":return o.tag;case"literal":var a=o.value;return"string"==typeof a?'"'+a+'"':String(a);case"array":return""+n(o)+r(!0,t)(o.element)+"[]";case"dictionary":return"{ [_: "+o.key+"]: "+r(!1,t)(o.value)+" }";case"record":var u=Object.keys(o.fields);return u.length?"{ "+u.map((function(e){return""+n(o)+e+(a=e,u=(i=o).isPartial,c=i.fields,(u||void 0!==a&&"optional"===c[a].tag?"?":"")+": ")+("optional"===o.fields[e].tag?r(!1,t)(o.fields[e].underlying):r(!1,t)(o.fields[e]))+";";var i,a,u,c})).join(" ")+" }":"{}";case"tuple":return"["+o.components.map(r(!1,t)).join(", ")+"]";case"union":return i(""+o.alternatives.map(r(!0,t)).join(" | "));case"intersect":return i(""+o.intersectees.map(r(!0,t)).join(" & "));case"optional":return r(e,t)(o.underlying)+" | undefined";case"constraint":return o.name||r(e,t)(o.underlying);case"instanceof":return o.ctor.name;case"brand":return r(e,t)(o.entity)}}finally{t.delete(o)}throw Error("impossible")}};function n(e){return e.isReadonly?"readonly ":""}t.default=r(!1,new Set)},669:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Array=void 0;var n=r(705),o=r(589);function i(e,t){var r,a={tag:"array",isReadonly:t,element:e};return(r=n.create((function(t,r){if(!Array.isArray(t))return o.FAILURE.TYPE_INCORRECT(a,t);var i=o.enumerableKeysOf(t),u=i.map((function(o){return n.innerValidate(e,t[o],r)})),c=i.reduce((function(e,t){var r=u[t];return r.success||(e[t]=r.details||r.message),e}),[]);return 0!==o.enumerableKeysOf(c).length?o.FAILURE.CONTENT_INCORRECT(a,c):o.SUCCESS(t)}),a)).asReadonly=function(){return i(r.element,!0)},r}t.Array=function(e){return i(e,!1)}},172:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BigInt=void 0;var n=r(705),o=r(589),i={tag:"bigint"};t.BigInt=n.create((function(e){return"bigint"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},643:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Boolean=void 0;var n=r(705),o=r(589),i={tag:"boolean"};t.Boolean=n.create((function(e){return"boolean"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Brand=void 0;var n=r(705);t.Brand=function(e,t){var r={tag:"brand",brand:e,entity:t};return n.create((function(e){return t.validate(e)}),r)}},277:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Guard=t.Constraint=void 0;var n=r(705),o=r(589),i=r(615);t.Constraint=function(e,t,r){var i=r&&r.name,a=r&&r.args,u={tag:"constraint",underlying:e,constraint:t,name:i,args:a};return n.create((function(r){var n=e.validate(r);if(!n.success)return n;var i=t(n.value);return"string"==typeof i?o.FAILURE.CONSTRAINT_FAILED(u,i):i?o.SUCCESS(n.value):o.FAILURE.CONSTRAINT_FAILED(u)}),u)},t.Guard=function(e,t){return i.Unknown.withGuard(e,t)}},745:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Dictionary=void 0;var n=r(705),o=r(856),i=r(277),a=r(268),u=r(589),c=i.Constraint(o.String,(function(e){return!isNaN(+e)}),{name:"number"});t.Dictionary=function(e,t){var i=void 0===t||"string"===t?o.String:"number"===t?c:t,s=a.default(i),l={tag:"dictionary",key:s,value:e};return n.create((function(t,o){if(null==t||"object"!=typeof t)return u.FAILURE.TYPE_INCORRECT(l,t);if(Object.getPrototypeOf(t)!==Object.prototype&&(!Array.isArray(t)||"string"===s))return u.FAILURE.TYPE_INCORRECT(l,t);var a=/^(?:NaN|-?\d+(?:\.\d+)?)$/u,c=u.enumerableKeysOf(t),f=c.reduce((function(c,s){var f="string"==typeof s&&a.test(s),d=f?r.g.Number(s):s;return(f?i.guard(d)||i.guard(s):i.guard(d))?c[s]=n.innerValidate(e,t[s],o):c[s]=u.FAILURE.KEY_INCORRECT(l,i.reflect,d),c}),{}),d=c.reduce((function(e,t){var r=f[t];return r.success||(e[t]=r.details||r.message),e}),{});return 0!==u.enumerableKeysOf(d).length?u.FAILURE.CONTENT_INCORRECT(l,d):u.SUCCESS(t)}),l)}},548:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Function=void 0;var n=r(705),o=r(589),i={tag:"function"};t.Function=n.create((function(e){return"function"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},937:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InstanceOf=void 0;var n=r(705),o=r(589);t.InstanceOf=function(e){var t={tag:"instanceof",ctor:e};return n.create((function(r){return r instanceof e?o.SUCCESS(r):o.FAILURE.TYPE_INCORRECT(t,r)}),t)}},617:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Intersect=void 0;var o=r(705),i=r(589);t.Intersect=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"intersect",intersectees:e};return o.create((function(t,r){var a,u;try{for(var c=n(e),s=c.next();!s.done;s=c.next()){var l=s.value,f=o.innerValidate(l,t,r);if(!f.success)return f}}catch(e){a={error:e}}finally{try{s&&!s.done&&(u=c.return)&&u.call(c)}finally{if(a)throw a.error}}return i.SUCCESS(t)}),r)}},813:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Lazy=void 0;var n=r(705);t.Lazy=function(e){var t,r={get tag(){return o().tag}};function o(){if(!t)for(var n in t=e())"tag"!==n&&(r[n]=t[n]);return t}return n.create((function(e){return o().validate(e)}),r)}},620:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Null=t.Undefined=t.Literal=void 0;var n=r(705),o=r(589);function i(e){return Array.isArray(e)?String(e.map(String)):"bigint"==typeof e?String(e)+"n":String(e)}function a(e){var t={tag:"literal",value:e};return n.create((function(t){return t===e?o.SUCCESS(t):o.FAILURE.VALUE_INCORRECT("literal","`"+i(e)+"`","`"+i(t)+"`")}),t)}t.Literal=a,t.Undefined=a(void 0),t.Null=a(null)},551:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Never=void 0;var n=r(705),o=r(589);t.Never=n.create(o.FAILURE.NOTHING_EXPECTED,{tag:"never"})},422:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Number=void 0;var n=r(705),o=r(589),i={tag:"number"};t.Number=n.create((function(e){return"number"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},979:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Optional=void 0;var n=r(705),o=r(589);t.Optional=function(e){var t={tag:"optional",underlying:e};return n.create((function(t){return void 0===t?o.SUCCESS(t):e.validate(t)}),t)}},489:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Partial=t.Record=t.InternalRecord=void 0;var i=r(705),a=r(589);function u(e,t,r){var c,s={tag:"record",isPartial:t,isReadonly:r,fields:e};return(c=i.create((function(r,u){if(null==r)return a.FAILURE.TYPE_INCORRECT(s,r);var c=a.enumerableKeysOf(e);if(0!==c.length&&"object"!=typeof r)return a.FAILURE.TYPE_INCORRECT(s,r);var l=o([],n(new Set(o(o([],n(c)),n(a.enumerableKeysOf(r)))))),f=l.reduce((function(n,o){var c=a.hasKey(o,e),s=a.hasKey(o,r);if(c){var l=e[o],f=t||"optional"===l.reflect.tag;if(s){var d=r[o];n[o]=f&&void 0===d?a.SUCCESS(d):i.innerValidate(l,d,u)}else n[o]=f?a.SUCCESS(void 0):a.FAILURE.PROPERTY_MISSING(l.reflect)}else{if(!s)throw new Error("impossible");d=r[o],n[o]=a.SUCCESS(d)}return n}),{}),d=l.reduce((function(e,t){var r=f[t];return r.success||(e[t]=r.details||r.message),e}),{});return 0!==a.enumerableKeysOf(d).length?a.FAILURE.CONTENT_INCORRECT(s,d):a.SUCCESS(r)}),s)).asPartial=function(){return u(c.fields,!0,c.isReadonly)},c.asReadonly=function(){return u(c.fields,c.isPartial,!0)},c.pick=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={};return e.forEach((function(e){r[e]=c.fields[e]})),u(r,c.isPartial,c.isReadonly)},c.omit=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={};return a.enumerableKeysOf(c.fields).forEach((function(t){e.includes(t)||(r[t]=c.fields[t])})),u(r,c.isPartial,c.isReadonly)},c}t.InternalRecord=u,t.Record=function(e){return u(e,!1,!1)},t.Partial=function(e){return u(e,!0,!1)}},856:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.String=void 0;var n=r(705),o=r(589),i={tag:"string"};t.String=n.create((function(e){return"string"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},59:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Symbol=void 0;var n=r(705),o=r(589),i={tag:"symbol"};t.Symbol=n.create((function(e){return"symbol"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),Object.assign((function(e){var t={tag:"symbol",key:e};return n.create((function(n){if("symbol"!=typeof n)return o.FAILURE.TYPE_INCORRECT(t,n);var i=r.g.Symbol.keyFor(n);return i!==e?o.FAILURE.VALUE_INCORRECT("symbol key",a(e),a(i)):o.SUCCESS(n)}),t)}),i));var a=function(e){return void 0===e?"undefined":'"'+e+'"'}},941:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tuple=void 0;var n=r(705),o=r(589);t.Tuple=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"tuple",components:e};return n.create((function(t,i){if(!Array.isArray(t))return o.FAILURE.TYPE_INCORRECT(r,t);if(t.length!==e.length)return o.FAILURE.CONSTRAINT_FAILED(r,"Expected length "+e.length+", but was "+t.length);var a=o.enumerableKeysOf(t),u=a.map((function(r){return n.innerValidate(e[r],t[r],i)})),c=a.reduce((function(e,t){var r=u[t];return r.success||(e[t]=r.details||r.message),e}),[]);return 0!==o.enumerableKeysOf(c).length?o.FAILURE.CONTENT_INCORRECT(r,c):o.SUCCESS(t)}),r)}},219:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Union=void 0;var o=r(705),i=r(589);t.Union=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return function(r){for(var n=0;n<e.length;n++)if(e[n].guard(r))return t[n](r)}},a={tag:"union",alternatives:e,match:r};return o.create((function(t,r){var u,c,s,l,f,d,v,h;if("object"!=typeof t||null===t){try{for(var y=n(e),p=y.next();!p.done;p=y.next()){var E=p.value;if(o.innerValidate(E,t,r).success)return i.SUCCESS(t)}}catch(e){u={error:e}}finally{try{p&&!p.done&&(c=y.return)&&c.call(y)}finally{if(u)throw u.error}}return i.FAILURE.TYPE_INCORRECT(a,t)}var g={};try{for(var m=n(e),R=m.next();!R.done;R=m.next())if("record"===(E=R.value).reflect.tag){var _=function(e){var t=E.reflect.fields[e];"literal"===t.tag&&(g[e]?g[e].every((function(e){return e!==t.value}))&&g[e].push(t.value):g[e]=[t.value])};for(var O in E.reflect.fields)_(O)}}catch(e){s={error:e}}finally{try{R&&!R.done&&(l=m.return)&&l.call(m)}finally{if(s)throw s.error}}for(var O in g)if(g[O].length===e.length)try{for(var T=(f=void 0,n(e)),C=T.next();!C.done;C=T.next())if("record"===(E=C.value).reflect.tag){var b=E.reflect.fields[O];if("literal"===b.tag&&i.hasKey(O,t)&&t[O]===b.value)return o.innerValidate(E,t,r)}}catch(e){f={error:e}}finally{try{C&&!C.done&&(d=T.return)&&d.call(T)}finally{if(f)throw f.error}}try{for(var w=n(e),S=w.next();!S.done;S=w.next()){var I=S.value;if(o.innerValidate(I,t,r).success)return i.SUCCESS(t)}}catch(e){v={error:e}}finally{try{S&&!S.done&&(h=w.return)&&h.call(w)}finally{if(v)throw v.error}}return i.FAILURE.TYPE_INCORRECT(a,t)}),a)}},615:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Unknown=void 0;var n=r(705),o=r(589);t.Unknown=n.create((function(e){return o.SUCCESS(e)}),{tag:"unknown"})},362:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Void=void 0;var n=r(615);t.Void=n.Unknown},589:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.FAILURE=t.SUCCESS=t.enumerableKeysOf=t.typeOf=t.hasKey=void 0;var o=r(205),i=r(268);t.hasKey=function(e,t){return"object"==typeof t&&null!==t&&e in t},t.typeOf=function(e){return"object"==typeof e?null===e?"null":Array.isArray(e)?"array":"Object"===e.constructor.name?"object":e.constructor.name:typeof e},t.enumerableKeysOf=function(e){return"object"==typeof e&&null!==e?Reflect.ownKeys(e).filter((function(t){var r,n;return null===(n=null===(r=e.propertyIsEnumerable)||void 0===r?void 0:r.call(e,t))||void 0===n||n})):[]},t.SUCCESS=function(e){return{success:!0,value:e}},t.FAILURE=Object.assign((function(e,t,r){return n({success:!1,code:e,message:t},r?{details:r}:{})}),{TYPE_INCORRECT:function(e,r){var n="Expected "+i.default(e)+", but was "+t.typeOf(r);return t.FAILURE(o.Failcode.TYPE_INCORRECT,n)},VALUE_INCORRECT:function(e,r,n){return t.FAILURE(o.Failcode.VALUE_INCORRECT,"Expected "+e+" "+String(r)+", but was "+String(n))},KEY_INCORRECT:function(e,r,n){return t.FAILURE(o.Failcode.KEY_INCORRECT,"Expected "+i.default(e)+" key to be "+i.default(r)+", but was "+t.typeOf(n))},CONTENT_INCORRECT:function(e,r){var n="Expected "+i.default(e)+", but was incompatible";return t.FAILURE(o.Failcode.CONTENT_INCORRECT,n,r)},ARGUMENT_INCORRECT:function(e){return t.FAILURE(o.Failcode.ARGUMENT_INCORRECT,e)},RETURN_INCORRECT:function(e){return t.FAILURE(o.Failcode.RETURN_INCORRECT,e)},CONSTRAINT_FAILED:function(e,r){var n=r?": "+r:"";return t.FAILURE(o.Failcode.CONSTRAINT_FAILED,"Failed constraint check for "+i.default(e)+n)},PROPERTY_MISSING:function(e){var r="Expected "+i.default(e)+", but was missing";return t.FAILURE(o.Failcode.PROPERTY_MISSING,r)},PROPERTY_PRESENT:function(e){var r="Expected nothing, but was "+t.typeOf(e);return t.FAILURE(o.Failcode.PROPERTY_PRESENT,r)},NOTHING_EXPECTED:function(e){var r="Expected nothing, but was "+t.typeOf(e);return t.FAILURE(o.Failcode.NOTHING_EXPECTED,r)}})}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{activate:()=>B,login:()=>$,logout:()=>K,subscribeToUserUpdates:()=>D}),r(390);const e={debug:console.debug,info:console.info,warn:console.warn,error:console.error};let t;var o;"undefined"!=typeof window&&(o=window,t=o);const i=(r,n)=>{t?t.addEventListener(r,(e=>{e.stopImmediatePropagation(),n.apply(window,[e])})):e.error("No root element to bind event to!")},a=(r,n)=>{t?t.addEventListener(r,(e=>{n.apply(window,[e])})):e.error("No root element to bind event to!")},u=r=>{t?t.dispatchEvent(r):e.error("No root element to dispatch event on!")};var c=r(61),s=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}c((n=n.apply(e,t||[])).next())}))};const l=(0,c.Record)({user_name:c.String,tracking_key:c.String}),f=(0,c.Record)({name:c.String,trackingKey:c.String}),d=()=>{const e="undefined"!=typeof window?window:r.g;return e.amediaUserCache||(e.amediaUserCache={})},v={get:e=>{const t=d()[e];return Promise.resolve(t)},set:(e,t,r)=>(d()[e]={key:e,data:t,expires:r},Promise.resolve()),remove:e=>(delete d()[e],Promise.resolve())};const h=()=>v,y=e=>h().remove(e),p=(t,r)=>{return n=void 0,o=void 0,a=function*(){const n=yield h().get(t);if(!n)return Promise.resolve();if(Date.now()>n.expires)return y(t),Promise.resolve();try{return r.check(n.data)}catch(r){return r instanceof c.ValidationError?e.error("Failed validating data",{data:n.data,error:r.details}):e.error("Unknown error",r),y(t),Promise.resolve()}},new((i=void 0)||(i=Promise))((function(e,t){function r(e){try{c(a.next(e))}catch(e){t(e)}}function u(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,u)}c((a=a.apply(n,o||[])).next())}));var n,o,i,a},E=(e,t,r)=>h().set(e,t,r);let g;const m=self||window,R="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||void 0!==m.msCrypto&&"function"==typeof m.msCrypto.getRandomValues&&m.msCrypto.getRandomValues.bind(m.msCrypto);if(R){const e=new Uint8Array(16);g=function(){return R(e),e}}else{const e=new Array(16);g=function(){for(let t,r=0;r<16;r+=1)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}}const _=[];for(let e=0;e<256;++e)_[e]=(e+256).toString(16).substr(1);function O(e,t){return(...r)=>{const{resolve:n,reject:o,promise:i}=function(){let e,t,r=!1;return{promise:new Promise(((n,o)=>{e=e=>{r||n(e),r=!0},t=e=>{r||o(e),r=!0}})),resolve:e,reject:t}}(),a=function(){const e=g();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e,t){let r=0;const n=_;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}(e)}(),u=new CustomEvent(`amedia-rpc-event:${e}:${t}`,{detail:{eventId:a,args:r}});if(self.dispatchEvent(u),self.amediaNativeBridge){const n=JSON.stringify(r);self.amediaNativeBridge.callNativeMethod(e,t,n,a)}return self.addEventListener(`amedia-rpc-event:${e}:${t}:${a}`,(e=>{e.detail||n();const{error:t,result:r}=e.detail;return t?o(t):n(r)})),i}}class T{constructor({version:e,component:t,methods:r=[]}){this.component=t,this.version=e,this.queue=[],r.forEach((e=>this.addMethod(e))),this.boundLiveHandler=this.liveHandler.bind(this),self.addEventListener(`amedia-rpc-event:${t}:live`,this.boundLiveHandler),setTimeout((()=>self.dispatchEvent(new CustomEvent(`amedia-rpc-event:${t}:ready`))),0)}liveHandler(e){const[t,r]=e.detail.version.split(".").map((e=>parseInt(e,10))),[n,o]=this.version.split(".").map((e=>parseInt(e,10)));if(t!==n)throw new Error(`${this.component} version mismatch. Server version: ${t}. Client version: ${n}`);r<o&&console.warn(`${this.component} server version is on an earlier minor version (${r}) than the client (${o})`);const i=this.queue.slice(0);delete this.queue,i.forEach((e=>e())),self.removeEventListener(`amedia-rpc-event:${this.component}:live`,this.boundLiveHandler)}addMethod(e){if(this[e])throw new Error(`${e} already exists on the RPC interface.`);this[e]=(...t)=>{if(this.queue){let r,n;const o=new Promise(((e,t)=>{r=e,n=t}));return this.queue.push((()=>this[e](...t).then(r).catch(n))),o}return this[e]=O(this.component,e),this[e](...t)}}}let C;const b=(e,t)=>{const r=t.substring(e.length,t.length);return"{"===r.substring(0,1)?JSON.parse(r):"%7B"===r.substring(0,3)?JSON.parse(decodeURIComponent(r)):"undefined"!==r?""===r||"null"===r?null:r:void 0};function w(e){!function(e,t,r=Date.now(),n="/",o=!1){const i=new Date;let a=`${e}=`;t&&""!==t||(r=-1),a+=(e=>e&&""!==e?e instanceof Object?encodeURIComponent(JSON.stringify(e)):"number"==typeof e?e.toString(10):e:"")(t),a+=((e,t)=>t?t instanceof Date?`; expires=${t.toUTCString()}`:(e.setTime(e.getTime()+24*t*60*60*1e3),`; expires=${e.toUTCString()}`):"")(i,r),a+=`; path=${n}`,o&&(a+="; secure"),document.cookie=a,r&&-1!==r&&null===(e=>{const t=`${e}=`,r=document.cookie.split(";");for(let e=r.length-1;e>=0;e-=1){const n=r[e].trim();if(0===n.indexOf(t))return b(t,n)}return null})(e)&&(document.cookie=a.replace(/; expires=[^;]*/,""))}(e)}var S=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}c((n=n.apply(e,t||[])).next())}))};let I=!1;const N="is_logged_in",U=()=>S(void 0,void 0,void 0,(function*(){if(I)return null;I=!0;const t=yield p(N,f);if(t)return I=!1,t;const r=yield s(void 0,void 0,void 0,(function*(){return fetch("/api/pluto/v1/sessions/current").then((e=>{if(!e.ok)throw new Error(`Request not ok (${e.status}: ${e.statusText}).`);return e.json()})).then((t=>{try{return{name:(r=l.check(t)).user_name,trackingKey:r.tracking_key}}catch(t){throw e.error("Invalid schema",t),t}var r}))}));return E(N,r,Date.now()+1e4),I=!1,r}));var P;!function(e){e.REQUEST_LOGIN="amedia-user.authentication.request-login",e.REQUEST_LOGOUT="amedia-user.authentication.request-logout",e.ON_LOGGED_OUT="amedia-user.authentication.on-logged-out"}(P||(P={})),i(P.REQUEST_LOGIN,(e=>{(e=>{const t=new URL("https://aid.no/logg_inn/");t.searchParams.set("requestedUrl",e||window.location.href),window.location.href=t.href})(e.detail.requestedUrl)})),i(P.REQUEST_LOGOUT,(()=>{S(void 0,void 0,void 0,(function*(){return Promise.all([(e=window.location.host,s(void 0,void 0,void 0,(function*(){return fetch(`/api/pluto/v1/sessions/current?publication_domain=${e}`,{method:"DELETE"}).then((e=>{if(!e.ok)throw new Error(`Error, could not perform deleteRequest. Status: ${e.status} Text: ${e.statusText}`)}))}))),h().clear()]).then((()=>{(C||(C=new T({version:"1.0.0",component:"userdata-session"}),C.addMethod("userAuthenticated"),C)).userAuthenticated(!1),w("VSTOKEN"),w("aid.session"),w("aid_invitation_code"),w("aid-reload-article"),w("VSTOKEN2")}));var e})).finally((()=>{u(new CustomEvent(P.ON_LOGGED_OUT))}))}));const A=(0,c.Record)({id:c.Number,domain:c.String}),L=(0,c.Record)({status:(0,c.Literal)("success"),access:(0,c.Union)((0,c.Literal)("granted"),(0,c.Literal)("denied")),publication:A,access_features:(0,c.Array)(c.String)}),j=((0,c.Record)({status:(0,c.Literal)("success"),cookie:c.String,access_features:(0,c.Array)(c.String)}),(0,c.Record)({status:(0,c.Literal)("success"),vstoken_cookie:c.String,uuid:c.String,access_features:(0,c.Array)(c.String)}),{}),x=e=>{const t=j[e];return t?(delete j[e],t):[]};const F="authorization.getAccess",k="authorization.getAccess",M=(0,c.Record)({access:(0,c.Array)(c.String)}),V={name:U,trackingKey:U,access:()=>{return t=void 0,r=void 0,o=function*(){return new Promise(((t,r)=>{var n,o;o={resolve:t,reject:r},j[n=k]||(j[n]=[]),j[n].push(o),(e=>{var t;return(null===(t=j[e])||void 0===t?void 0:t.length)||0})(k)>1||p(F,M).then((t=>{var r,n;t?x(k).forEach((e=>{e.resolve(t)})):(r=window.location.host,n=["newspaper"],fetch(`/api/jupiter/v1/check_access_for_paper/${r}/?require=any&access_features=${n.join(",")}`).then((e=>{if(!e.ok)throw new Error(`Request not ok (${e.status}: ${e.statusText}).`);return e.json()})).then((t=>{try{return L.check(t)}catch(t){throw e.error("Invalid schema",t),t}}))).then((e=>{E(F,e.access_features,Date.now()+1e4),x(k).forEach((t=>{t.resolve({access:e.access_features})}))})).catch((t=>{e.error("Could not get access",t),x(k).forEach((e=>{e.reject()}))}))}))}))},new((n=void 0)||(n=Promise))((function(e,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function u(e){try{c(o.throw(e))}catch(e){i(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,u)}c((o=o.apply(t,r||[])).next())}));var t,r,n,o}};var G,Y;!function(e){e.REQUEST_USER_ATTRIBUTES="amedia-user.request-user-attributes",e.ON_USER_ATTRIBUTES_UPDATED="amedia-user.on-user-attributes-updated"}(G||(G={})),i(G.REQUEST_USER_ATTRIBUTES,(t=>{((t,r)=>{const n=[];for(t.forEach((t=>{const r=V[t];r?n.includes(r)||n.push(r):e.warn("Unknown attribute was requested")}));n.length>0;){const e=n.pop();e&&e().then((e=>{r(e)}))}})(t.detail,(e=>{u(new CustomEvent(G.ON_USER_ATTRIBUTES_UPDATED,{detail:Object.assign(Object.assign({},e),{isLoggedIn:!!(null==e?void 0:e.name)})}))}))})),function(e){e.REQUEST_ACTIVATION="amedia-user.activation.request-activation",e.ON_ACTIVATION_COMPLETE="amedia-user.activation.on-activation-complete"}(Y||(Y={})),i(Y.REQUEST_ACTIVATION,(()=>{new Promise((e=>{setTimeout((()=>{e({status:"success"})}),1e3)})).then((e=>{u(new CustomEvent(Y.ON_ACTIVATION_COMPLETE,{detail:e}))}))}));const D=(t,r)=>{a(G.ON_USER_ATTRIBUTES_UPDATED,(n=>{const o=n.detail;if(!o)return void e.warn("Nå attributes received",o);const i={};void 0!==o.isLoggedIn&&(i.isLoggedIn=o.isLoggedIn),t.forEach((e=>{void 0!==o[e]&&(i[e]=o[e])})),r(i)})),u(new CustomEvent(G.REQUEST_USER_ATTRIBUTES,{detail:t}))},$=e=>u(new CustomEvent(P.REQUEST_LOGIN,{detail:{requestedUrl:e||window.location.href}})),K=e=>{a(P.ON_LOGGED_OUT,e),u(new CustomEvent(P.REQUEST_LOGOUT))},B=()=>new Promise((e=>{a(Y.ON_ACTIVATION_COMPLETE,e),u(new CustomEvent(Y.REQUEST_ACTIVATION))}))})(),n})()}));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const getCookie: (name: string) => string | {
|
|
2
|
+
[index: string]: unknown;
|
|
3
|
+
} | null | undefined;
|
|
4
|
+
export declare function setCookie(name: string, value?: unknown, validTimeInDateOrDays?: Date | number, path?: string, secure?: boolean): string;
|
|
5
|
+
export declare function removeCookie(name: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getRPCClient: () => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/services/pluto.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Record, Static, String } from 'runtypes';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const InternalSessionSchema: Record<{
|
|
3
3
|
name: String;
|
|
4
4
|
trackingKey: String;
|
|
5
5
|
}, false>;
|
|
6
|
-
export declare type Session = Static<typeof
|
|
6
|
+
export declare type Session = Static<typeof InternalSessionSchema>;
|
|
7
7
|
export declare const getCurrentSession: () => Promise<Session>;
|
|
8
8
|
export declare const removeSession: (domain: string) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils/log.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export declare type Logger = {
|
|
2
|
+
debug: (message: string | any, ...extra: any[]) => void;
|
|
3
|
+
info: (message: string | any, ...extra: any[]) => void;
|
|
4
|
+
warn: (message: string | any, ...extra: any[]) => void;
|
|
5
|
+
error: (message: string | any, ...extra: any[]) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const setLogger: (engine: Logger) => void;
|
|
1
8
|
declare const _default: {
|
|
2
9
|
debug: {
|
|
3
10
|
(...data: any[]): void;
|
package/dist/utils/queue.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
add: (key: string,
|
|
3
|
-
|
|
2
|
+
add: (key: string, promiseCallbacks: {
|
|
3
|
+
resolve: (PromiseLike: any) => void;
|
|
4
|
+
reject: (reason?: any) => void;
|
|
5
|
+
}) => void;
|
|
6
|
+
getAll: (key: string) => {
|
|
7
|
+
resolve: (PromiseLike: any) => void;
|
|
8
|
+
reject: (reason?: any) => void;
|
|
9
|
+
}[];
|
|
10
|
+
peekQueueSize: (key: string) => number;
|
|
4
11
|
};
|
|
5
12
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Client lib for working with aID user and associated data",
|
|
5
5
|
"repository": "https://github.com/amedia/amedia-user-js",
|
|
6
6
|
"author": "Amedia Utvikling (ID og data)",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "jest",
|
|
10
|
+
"lint": "eslint . --ext .ts",
|
|
10
11
|
"build": "webpack --mode=production"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
14
|
+
"@amedia/frontend-rpc": "0.0.12",
|
|
13
15
|
"dexie": "3.0.3",
|
|
16
|
+
"regenerator-runtime": "^0.13.7",
|
|
14
17
|
"runtypes": "6.2.1"
|
|
15
18
|
},
|
|
16
19
|
"devDependencies": {
|
|
@@ -23,17 +26,15 @@
|
|
|
23
26
|
"@types/dexie": "1.3.1",
|
|
24
27
|
"@types/jest": "^26.0.23",
|
|
25
28
|
"@typescript-eslint/eslint-plugin": "4.22.0",
|
|
26
|
-
"babel-eslint": "10.1.0",
|
|
27
|
-
"babel-loader": "8.2.2",
|
|
28
29
|
"eslint": "7.24.0",
|
|
29
30
|
"eslint-config-airbnb-typescript": "12.3.1",
|
|
30
31
|
"eslint-config-prettier": "8.2.0",
|
|
31
32
|
"eslint-plugin-import": "2.22.1",
|
|
33
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
32
34
|
"jest": "^26.6.3",
|
|
33
35
|
"jest-fetch-mock": "^3.0.3",
|
|
34
36
|
"npm-run-all": "4.1.5",
|
|
35
37
|
"prettier": "2.2.1",
|
|
36
|
-
"regenerator-runtime": "0.13.7",
|
|
37
38
|
"source-map-loader": "2.0.1",
|
|
38
39
|
"ts-jest": "^26.5.5",
|
|
39
40
|
"ts-loader": "9.1.0",
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getCurrentSession,
|
|
3
|
+
InternalSessionSchema,
|
|
4
|
+
removeSession,
|
|
5
|
+
Session,
|
|
6
|
+
} from '../services/pluto';
|
|
2
7
|
import cache from '../cache';
|
|
8
|
+
import { getRPCClient } from '../lib/rpc';
|
|
9
|
+
import { removeCookie } from '../lib/cookie';
|
|
3
10
|
|
|
4
11
|
const EXPIRES_10_SECONDS = 10000;
|
|
5
12
|
|
|
@@ -10,20 +17,36 @@ export const login = (requestedUrl: string) => {
|
|
|
10
17
|
window.location.href = url.href;
|
|
11
18
|
};
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
function clearCookies() {
|
|
21
|
+
removeCookie('VSTOKEN');
|
|
22
|
+
removeCookie('aid.session');
|
|
23
|
+
removeCookie('aid_invitation_code');
|
|
24
|
+
removeCookie('aid-reload-article');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const logout = async () =>
|
|
28
|
+
// TODO: It now clears the entire cache. Might be too aggressive.
|
|
29
|
+
Promise.all([removeSession(window.location.host), cache.clear()]).then(() => {
|
|
30
|
+
getRPCClient().userAuthenticated(false);
|
|
31
|
+
clearCookies();
|
|
32
|
+
// In addition to removing the regular cookies we also want to remove VSTOKEN2 on explicit logout
|
|
33
|
+
removeCookie('VSTOKEN2');
|
|
34
|
+
});
|
|
16
35
|
|
|
17
36
|
let isFetchingSession = false;
|
|
18
37
|
const IS_LOGGED_IN_CACHE_KEY = 'is_logged_in';
|
|
19
38
|
export const getSession = async (): Promise<Session | null> => {
|
|
20
39
|
if (isFetchingSession) {
|
|
40
|
+
// TODO Perhaps return a promise to be resolved later?
|
|
21
41
|
return null;
|
|
22
42
|
}
|
|
23
43
|
isFetchingSession = true;
|
|
24
44
|
|
|
25
45
|
// Try the cache first
|
|
26
|
-
const cacheResponse = await cache.get(
|
|
46
|
+
const cacheResponse = await cache.get(
|
|
47
|
+
IS_LOGGED_IN_CACHE_KEY,
|
|
48
|
+
InternalSessionSchema
|
|
49
|
+
);
|
|
27
50
|
if (cacheResponse) {
|
|
28
51
|
isFetchingSession = false;
|
|
29
52
|
return cacheResponse;
|
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
CheckAccessForPaper,
|
|
4
|
-
CheckAccessForPaperSchema,
|
|
5
|
-
checkForAccess,
|
|
6
|
-
} from '../services/jupiter';
|
|
1
|
+
import { Record, Array, String, Static } from 'runtypes';
|
|
2
|
+
import { checkForAccess } from '../services/jupiter';
|
|
7
3
|
import cache from '../cache';
|
|
4
|
+
import queue from '../utils/queue';
|
|
5
|
+
import log from '../utils/log';
|
|
8
6
|
|
|
9
7
|
const EXPIRES_OFFSET = 10000; // 10 seconds
|
|
10
|
-
const
|
|
8
|
+
const GET_ACCESS_CACHE_KEY = 'authorization.getAccess';
|
|
9
|
+
const GET_ACCESS_QUEUE_KEY = 'authorization.getAccess';
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
accessFeatures: AccessFeatures
|
|
16
|
-
): Promise<CheckAccessForPaper | null> => {
|
|
17
|
-
if (isCheckingForAccess) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
isCheckingForAccess = true;
|
|
11
|
+
const AccessSchema = Record({
|
|
12
|
+
access: Array(String),
|
|
13
|
+
});
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
isCheckingForAccess = false;
|
|
29
|
-
return cacheResponse;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Actually perform a request against backend for the accessState
|
|
33
|
-
const accessState = await checkForAccess(publicationDomain, accessFeatures);
|
|
34
|
-
cache.set(
|
|
35
|
-
CHECK_FOR_ACCESS_CACHE_KEY,
|
|
36
|
-
accessState,
|
|
37
|
-
Date.now() + EXPIRES_OFFSET
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
isCheckingForAccess = false;
|
|
15
|
+
export const getAccess = async (): Promise<Static<typeof AccessSchema>> =>
|
|
16
|
+
new Promise((resolve, reject) => {
|
|
17
|
+
queue.add(GET_ACCESS_QUEUE_KEY, { resolve, reject });
|
|
18
|
+
if (queue.peekQueueSize(GET_ACCESS_QUEUE_KEY) > 1) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
41
21
|
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
cache.get(GET_ACCESS_CACHE_KEY, AccessSchema).then((cacheResponse) => {
|
|
23
|
+
if (cacheResponse) {
|
|
24
|
+
queue.getAll(GET_ACCESS_QUEUE_KEY).forEach((promise) => {
|
|
25
|
+
promise.resolve(cacheResponse);
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
checkForAccess(window.location.host, ['newspaper'])
|
|
30
|
+
.then((accessState) => {
|
|
31
|
+
cache.set(
|
|
32
|
+
GET_ACCESS_CACHE_KEY,
|
|
33
|
+
accessState.access_features,
|
|
34
|
+
Date.now() + EXPIRES_OFFSET
|
|
35
|
+
);
|
|
36
|
+
queue.getAll(GET_ACCESS_QUEUE_KEY).forEach((promise) => {
|
|
37
|
+
promise.resolve({ access: accessState.access_features });
|
|
38
|
+
});
|
|
39
|
+
})
|
|
40
|
+
.catch((error) => {
|
|
41
|
+
log.error('Could not get access', error);
|
|
42
|
+
queue.getAll(GET_ACCESS_QUEUE_KEY).forEach((promise) => {
|
|
43
|
+
promise.reject();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
44
48
|
|
|
45
49
|
// TODO This is just mock implementation
|
|
46
50
|
export const activate = () =>
|
|
47
|
-
new Promise((resolve
|
|
51
|
+
new Promise((resolve) => {
|
|
48
52
|
setTimeout(() => {
|
|
49
53
|
resolve({ status: 'success' });
|
|
50
54
|
}, 1000);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import log from '../utils/log';
|
|
1
2
|
import { UserAttributes } from '../types';
|
|
2
|
-
import { getSession } from '
|
|
3
|
+
import { getSession } from './authentication';
|
|
4
|
+
import { getAccess } from './authorization';
|
|
3
5
|
|
|
4
6
|
// TODO We may want actions to tell us what they can deliver and not have this "organizer" (wohoo-bad-name) tell the actions..
|
|
5
7
|
const dataServiceMap: {
|
|
@@ -8,6 +10,7 @@ const dataServiceMap: {
|
|
|
8
10
|
} = {
|
|
9
11
|
name: getSession,
|
|
10
12
|
trackingKey: getSession,
|
|
13
|
+
access: getAccess,
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
export const fetchDataBasedOnAttributes = (
|
|
@@ -18,7 +21,7 @@ export const fetchDataBasedOnAttributes = (
|
|
|
18
21
|
attributes.forEach((attribute) => {
|
|
19
22
|
const service = dataServiceMap[attribute];
|
|
20
23
|
if (!service) {
|
|
21
|
-
|
|
24
|
+
log.warn('Unknown attribute was requested');
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
27
|
if (!requiredServices.includes(service)) {
|