@amedia/user 0.13.29 → 0.13.30
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/dist/actions/storage.d.ts +3 -0
- package/dist/eventHandlers/eventMap.d.ts +5 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/lib/authentication.d.ts +17 -0
- package/dist/lib/authentication.js +74 -0
- package/dist/lib/authorization.d.ts +14 -0
- package/dist/lib/authorization.js +51 -0
- package/{esm/cache/engines/indexeddb.d.ts → dist/lib/cache/db.d.ts} +6 -7
- package/dist/lib/cache/db.js +13 -0
- package/dist/lib/cache/global.d.ts +9 -0
- package/dist/lib/cache/global.js +16 -0
- package/dist/lib/cache/types.d.ts +5 -0
- package/dist/lib/cache/types.js +2 -0
- package/dist/lib/queue.d.ts +5 -0
- package/dist/lib/queue.js +17 -0
- package/dist/lib/tools.d.ts +1 -0
- package/dist/lib/tools.js +2 -0
- package/dist/lib/user.js +3 -0
- package/dist/services/cache.d.ts +9 -0
- package/dist/services/cache.js +34 -0
- package/{esm/clients → dist/services}/jupiter.d.ts +29 -30
- package/dist/services/jupiter.js +72 -0
- package/dist/services/pluto.d.ts +12 -0
- package/dist/services/pluto.js +40 -0
- package/eik.json +2 -2
- package/package.json +2 -2
- package/src/actions/storage.ts +10 -1
- package/src/clients/mercuryLog.ts +1 -0
- package/src/clients/pluto.ts +1 -1
- package/src/eventHandlers/eventMap.ts +5 -1
- package/src/eventHandlers/storage.ts +7 -1
- package/src/index-storage.spec.ts +30 -1
- package/src/index.ts +4 -0
- package/amedia-user-js.iml +0 -9
- package/dist/janitor/index.spec.d.ts +0 -4
- package/esm/actions/authentication.d.ts +0 -5
- package/esm/actions/authentication.spec.d.ts +0 -4
- package/esm/actions/authorization.d.ts +0 -9
- package/esm/actions/preferences.d.ts +0 -9
- package/esm/actions/preferences.spec.d.ts +0 -1
- package/esm/actions/storage.d.ts +0 -4
- package/esm/actions/userData.d.ts +0 -2
- package/esm/autologin/index.d.ts +0 -1
- package/esm/autologin/thirdPartyCookie.d.ts +0 -3
- package/esm/autologin/thirdPartyCookie.spec.d.ts +0 -1
- package/esm/cache/engines/global.d.ts +0 -21
- package/esm/cache/engines/global.spec.d.ts +0 -1
- package/esm/cache/index.d.ts +0 -11
- package/esm/cache/index.spec.d.ts +0 -4
- package/esm/cache/types.d.ts +0 -11
- package/esm/clients/europa.d.ts +0 -28
- package/esm/clients/europa.spec.d.ts +0 -1
- package/esm/clients/jupiter.spec.d.ts +0 -1
- package/esm/clients/mercury.d.ts +0 -18
- package/esm/clients/mercury.spec.d.ts +0 -4
- package/esm/clients/nebula.d.ts +0 -2
- package/esm/clients/nebula.spec.d.ts +0 -1
- package/esm/clients/pluto.d.ts +0 -3
- package/esm/clients/pluto.spec.d.ts +0 -1
- package/esm/eventHandlers/activation.d.ts +0 -15
- package/esm/eventHandlers/authentication.d.ts +0 -17
- package/esm/eventHandlers/userAttributes.d.ts +0 -24
- package/esm/exceptions/PaywallError.d.ts +0 -7
- package/esm/index-authentcation.spec.d.ts +0 -4
- package/esm/index-storage.spec.d.ts +0 -4
- package/esm/index-subscription.spec.d.ts +0 -4
- package/esm/index.d.ts +0 -26
- package/esm/janitor/index.d.ts +0 -10
- package/esm/janitor/jobs/accessCookieRefresher.d.ts +0 -1
- package/esm/janitor/jobs/accessCookieRefresher.spec.d.ts +0 -4
- package/esm/lib/PaywallUnlocker.d.ts +0 -16
- package/esm/lib/PaywallUnlocker.spec.d.ts +0 -4
- package/esm/lib/User.d.ts +0 -21
- package/esm/lib/cookie.d.ts +0 -5
- package/esm/lib/rpc.d.ts +0 -6
- package/esm/store/index.d.ts +0 -22
- package/esm/store/index.spec.d.ts +0 -1
- package/esm/types.d.ts +0 -22
- package/esm/user.js +0 -2
- package/esm/user.js.map +0 -1
- package/esm/utils/customEventWrapper.d.ts +0 -17
- package/esm/utils/deepEquals.d.ts +0 -4
- package/esm/utils/getOrUpdate.d.ts +0 -6
- package/esm/utils/getOrUpdate.spec.d.ts +0 -1
- package/esm/utils/location.d.ts +0 -3
- package/esm/utils/log.d.ts +0 -26
- package/esm/utils/queue.d.ts +0 -12
- package/esm/utils/url.d.ts +0 -6
- package/esm/utils/url.spec.d.ts +0 -1
- /package/dist/lib/{User.d.ts → user.d.ts} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as europa from './clients/europa';
|
|
6
|
-
import { updateStorage } from './index';
|
|
6
|
+
import { saveStorage, updateStorage } from './index';
|
|
7
7
|
import store from './store';
|
|
8
8
|
import UserDataRequest from './lib/UserDataRequest';
|
|
9
9
|
import { setRootElement } from './utils/customEventWrapper';
|
|
@@ -29,6 +29,7 @@ beforeEach(() => {
|
|
|
29
29
|
|
|
30
30
|
describe('Storage', () => {
|
|
31
31
|
beforeEach(() => {
|
|
32
|
+
spyOn(europa, 'saveNamespace');
|
|
32
33
|
spyOn(europa, 'updateNamespace');
|
|
33
34
|
});
|
|
34
35
|
|
|
@@ -37,6 +38,21 @@ describe('Storage', () => {
|
|
|
37
38
|
store.set('state', { isLoggedIn: true });
|
|
38
39
|
});
|
|
39
40
|
|
|
41
|
+
describe('when saving storage', () => {
|
|
42
|
+
beforeEach(() => {
|
|
43
|
+
saveStorage({
|
|
44
|
+
user_info: {
|
|
45
|
+
some: 'data',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
it('should save storage', () => {
|
|
50
|
+
expect(europa.saveNamespace).toHaveBeenCalledWith('user_info', {
|
|
51
|
+
some: 'data',
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
40
56
|
describe('when updating storage', () => {
|
|
41
57
|
beforeEach(() => {
|
|
42
58
|
updateStorage({
|
|
@@ -88,6 +104,19 @@ describe('Storage', () => {
|
|
|
88
104
|
store.set('state', { isLoggedIn: false });
|
|
89
105
|
});
|
|
90
106
|
|
|
107
|
+
describe('when saving storage', () => {
|
|
108
|
+
beforeEach(() => {
|
|
109
|
+
saveStorage({
|
|
110
|
+
user_info: {
|
|
111
|
+
some: 'data',
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
it('should not attempt storage save', () => {
|
|
116
|
+
expect(europa.saveNamespace).not.toHaveBeenCalled();
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
91
120
|
describe('when updating storage', () => {
|
|
92
121
|
beforeEach(() => {
|
|
93
122
|
updateStorage({
|
package/src/index.ts
CHANGED
|
@@ -46,6 +46,10 @@ export const updateStorage = (storage: { [index: string]: Object }) => {
|
|
|
46
46
|
);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
export const saveStorage = (storage: { [index: string]: Object }) => {
|
|
50
|
+
dispatch(new CustomEvent(AmediaUserEvents.SAVE_STORAGE, { detail: storage }));
|
|
51
|
+
};
|
|
52
|
+
|
|
49
53
|
listenForStateRequests();
|
|
50
54
|
listenForUserAttributeRequests();
|
|
51
55
|
listenForStorageRequests();
|
package/amedia-user-js.iml
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
-
</component>
|
|
9
|
-
</module>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { UserAttributes } from '../types';
|
|
2
|
-
export declare const login: (requestedUrl: URL | string) => void;
|
|
3
|
-
export declare const logout: () => Promise<void>;
|
|
4
|
-
export declare const getSession: () => Promise<UserAttributes>;
|
|
5
|
-
export declare const isLoggedIn: () => boolean;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UserAttributes } from '../types';
|
|
2
|
-
export declare const getAccess: (accessFeatures?: string[]) => Promise<Pick<UserAttributes, 'access'>>;
|
|
3
|
-
export declare const activate: (accessFeatures: string[]) => Promise<boolean>;
|
|
4
|
-
export declare const hasAccess: (currentAccessFeatures: string[], requestedAccessFeatures: string[]) => boolean;
|
|
5
|
-
export declare const setUserAccessCookie: (publicationDomain: any) => Promise<boolean>;
|
|
6
|
-
export declare const setNonUserAccessCookie: (publicationDomain: any) => Promise<boolean>;
|
|
7
|
-
export declare const hasRecentlyTriedToUnlockPaywall: () => boolean;
|
|
8
|
-
export declare const setAccessCookies: (publicationDomain: any) => Promise<boolean>;
|
|
9
|
-
export declare const setHasTriedToUnlockPaywall: () => void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Record, Boolean } from 'runtypes';
|
|
2
|
-
import { UserAttributes } from '../types';
|
|
3
|
-
export declare const PrivacyPreferencesSchema: Record<{
|
|
4
|
-
allowResearchUsage: Boolean;
|
|
5
|
-
connectWithSurveys: Boolean;
|
|
6
|
-
personalizedAds: Boolean;
|
|
7
|
-
personalizedContent: Boolean;
|
|
8
|
-
}, false>;
|
|
9
|
-
export declare const getPrivacyPreferences: () => Promise<Pick<UserAttributes, 'privacyPreferences'>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/actions/storage.d.ts
DELETED
package/esm/autologin/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const attemptAutologin: () => Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|
|
16
|
-
export declare const get: (key: string) => Promise<CacheEntry>;
|
|
17
|
-
export declare const set: (key: string, data: unknown, expires: number) => Promise<void>;
|
|
18
|
-
export declare const remove: (key: string) => Promise<void>;
|
|
19
|
-
export declare const clear: () => Promise<void>;
|
|
20
|
-
declare const _default: Engine;
|
|
21
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/cache/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Static } from 'runtypes';
|
|
2
|
-
import { RuntypeBase } from 'runtypes/lib/runtype';
|
|
3
|
-
import { Engine } from './types';
|
|
4
|
-
export declare const setCacheEngine: (engine: Engine) => void;
|
|
5
|
-
declare const _default: {
|
|
6
|
-
get: <T extends RuntypeBase<unknown>>(key: string, validator: T) => Promise<void | Static<T>>;
|
|
7
|
-
set: (key: string, value: unknown, expires: number) => Promise<void>;
|
|
8
|
-
remove: (key: string) => Promise<void>;
|
|
9
|
-
clear: () => Promise<void>;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
package/esm/cache/types.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare type CacheEntry = {
|
|
2
|
-
key: string;
|
|
3
|
-
data: unknown;
|
|
4
|
-
expires: number;
|
|
5
|
-
};
|
|
6
|
-
export declare type Engine = {
|
|
7
|
-
get: (key: string) => Promise<CacheEntry | null>;
|
|
8
|
-
set: (key: string, data: unknown, expires: number) => Promise<void>;
|
|
9
|
-
remove: (key: string) => Promise<void>;
|
|
10
|
-
clear: () => Promise<void>;
|
|
11
|
-
};
|
package/esm/clients/europa.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Record, Unknown, Dictionary } from 'runtypes';
|
|
2
|
-
export declare const EuropaSchema: Record<{
|
|
3
|
-
namespaces: Dictionary<Unknown, string>;
|
|
4
|
-
}, false>;
|
|
5
|
-
export declare const clearLocalCache: () => Promise<void>;
|
|
6
|
-
export declare const updateNamespace: (namespace: string, data: Object) => Promise<void | {}>;
|
|
7
|
-
export declare const getNamespaces: <S extends {
|
|
8
|
-
[namespace: string]: {
|
|
9
|
-
[index: string]: unknown;
|
|
10
|
-
};
|
|
11
|
-
}, Namespaces extends (keyof S)[]>(namespaces: Namespaces, options?: {
|
|
12
|
-
ignoreCache: boolean;
|
|
13
|
-
}) => Promise<Pick<S, Namespaces[number]>>;
|
|
14
|
-
export declare const saveNamespace: (namespace: string, data: Object) => Promise<Pick<{
|
|
15
|
-
[namespace: string]: {
|
|
16
|
-
[index: string]: unknown;
|
|
17
|
-
};
|
|
18
|
-
}, string>>;
|
|
19
|
-
export declare const getAllNamespaces: () => Promise<{
|
|
20
|
-
namespaces: {
|
|
21
|
-
[x: string]: unknown;
|
|
22
|
-
};
|
|
23
|
-
}>;
|
|
24
|
-
export declare const deleteNamespaceKey: (namespace: string, key: string) => Promise<Pick<{
|
|
25
|
-
[namespace: string]: {
|
|
26
|
-
[index: string]: unknown;
|
|
27
|
-
};
|
|
28
|
-
}, string>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/clients/mercury.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare const log: {
|
|
2
|
-
error: (message: string, context: {
|
|
3
|
-
[index: string]: any;
|
|
4
|
-
}) => void;
|
|
5
|
-
warn: (message: string, context: {
|
|
6
|
-
[index: string]: any;
|
|
7
|
-
}) => void;
|
|
8
|
-
info: (message: string, context: {
|
|
9
|
-
[index: string]: any;
|
|
10
|
-
}) => void;
|
|
11
|
-
debug: (message: string, context: {
|
|
12
|
-
[index: string]: any;
|
|
13
|
-
}) => void;
|
|
14
|
-
};
|
|
15
|
-
export declare class UserDeactivatedError extends Error {
|
|
16
|
-
}
|
|
17
|
-
export declare const activateSubscription: (accessFeatures: string[]) => Promise<boolean>;
|
|
18
|
-
export default log;
|
package/esm/clients/nebula.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/clients/pluto.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare enum ActivationEvents {
|
|
2
|
-
REQUEST_ACTIVATION = 'amedia-user.activation.request-activation',
|
|
3
|
-
ON_ACTIVATION_COMPLETE = 'amedia-user.activation.on-activation-complete',
|
|
4
|
-
}
|
|
5
|
-
declare global {
|
|
6
|
-
interface WindowEventMap {
|
|
7
|
-
[ActivationEvents.REQUEST_ACTIVATION]: CustomEvent<{
|
|
8
|
-
accessFeatures: string[];
|
|
9
|
-
}>;
|
|
10
|
-
[ActivationEvents.ON_ACTIVATION_COMPLETE]: CustomEvent<{
|
|
11
|
-
accessFeatures: string[];
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export declare const listenForActivationRequests: () => void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare enum AuthenticationEvents {
|
|
2
|
-
REQUEST_LOGIN = "amedia-user.authentication.request-login",
|
|
3
|
-
REQUEST_LOGOUT = "amedia-user.authentication.request-logout",
|
|
4
|
-
ON_LOGGED_OUT = "amedia-user.authentication.on-logged-out"
|
|
5
|
-
}
|
|
6
|
-
declare global {
|
|
7
|
-
interface WindowEventMap {
|
|
8
|
-
[AuthenticationEvents.REQUEST_LOGIN]: CustomEvent<{
|
|
9
|
-
requestedUrl: string;
|
|
10
|
-
}>;
|
|
11
|
-
[AuthenticationEvents.REQUEST_LOGOUT]: CustomEvent<{
|
|
12
|
-
onLoggedOut: () => void;
|
|
13
|
-
}>;
|
|
14
|
-
[AuthenticationEvents.ON_LOGGED_OUT]: CustomEvent;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export declare const listenForAuthenticationRequests: () => void;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { State, UserAttributes } from '../types';
|
|
2
|
-
export declare enum AmediaUserEvents {
|
|
3
|
-
REQUEST_USER_ATTRIBUTES = "amedia-user.request-user-attributes",
|
|
4
|
-
REQUEST_STORAGE_NAMESPACES = "amedia-user.request-storage-namespaces",
|
|
5
|
-
UPDATE_STORAGE = "amedua-user.update-storage-namespaces",
|
|
6
|
-
ON_ATTRIBUTES_UPDATED = "amedia-user.on-user-attributes-updated",
|
|
7
|
-
ON_STATE_UPDATED = "amedia-user.on-state-updated",
|
|
8
|
-
ON_STORAGE_UPDATED = "amedia-user.on-storage-updated"
|
|
9
|
-
}
|
|
10
|
-
declare global {
|
|
11
|
-
interface WindowEventMap {
|
|
12
|
-
[AmediaUserEvents.REQUEST_USER_ATTRIBUTES]: CustomEvent<Array<keyof UserAttributes>>;
|
|
13
|
-
[AmediaUserEvents.REQUEST_STORAGE_NAMESPACES]: CustomEvent<Array<string>>;
|
|
14
|
-
[AmediaUserEvents.UPDATE_STORAGE]: CustomEvent<{
|
|
15
|
-
[namespace: string]: object;
|
|
16
|
-
}>;
|
|
17
|
-
[AmediaUserEvents.ON_ATTRIBUTES_UPDATED]: CustomEvent<UserAttributes>;
|
|
18
|
-
[AmediaUserEvents.ON_STATE_UPDATED]: CustomEvent<State>;
|
|
19
|
-
[AmediaUserEvents.ON_STORAGE_UPDATED]: CustomEvent<{
|
|
20
|
-
[index: string]: unknown;
|
|
21
|
-
}>;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export declare const listenForUserAttributeRequests: () => void;
|
package/esm/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import 'regenerator-runtime';
|
|
2
|
-
import User from './lib/User';
|
|
3
|
-
import PaywallUnlocker from './lib/PaywallUnlocker';
|
|
4
|
-
/**
|
|
5
|
-
* Enables you to subscribe to the user attributes you care about and
|
|
6
|
-
* get notified when something changes
|
|
7
|
-
*/
|
|
8
|
-
export declare const user: () => User<import("./types").UserAttributes, {
|
|
9
|
-
[index: string]: unknown;
|
|
10
|
-
}, (keyof import("./types").UserAttributes)[], string[], {
|
|
11
|
-
state: import("./types").State;
|
|
12
|
-
}>;
|
|
13
|
-
/**
|
|
14
|
-
* This will, if necessary, trigger a redirect to www.aid.no and return
|
|
15
|
-
* to the requestedUrl if supplied or the current url before redirecting away if not.
|
|
16
|
-
* @param requestedUrl
|
|
17
|
-
*/
|
|
18
|
-
export declare const goToLoginPage: (requestedUrl?: string | undefined) => void;
|
|
19
|
-
export declare const logout: () => Promise<void>;
|
|
20
|
-
export declare const tryActivateSubscriptionAccess: (accessFeatures: string[]) => Promise<{
|
|
21
|
-
hasAccess: boolean;
|
|
22
|
-
}>;
|
|
23
|
-
export declare const paywall: () => PaywallUnlocker;
|
|
24
|
-
export declare const updateStorage: (storage: {
|
|
25
|
-
[index: string]: Object;
|
|
26
|
-
}) => void;
|
package/esm/janitor/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function accessCookieRefresher(): Promise<[void, void]>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare class PaywallUnlocker {
|
|
2
|
-
private requestedAccessFeatures;
|
|
3
|
-
private reload;
|
|
4
|
-
private requestedUrl;
|
|
5
|
-
withAccessFeatures(accessFeatures: string[]): this;
|
|
6
|
-
reloadOnAccess(): this;
|
|
7
|
-
redirectOnAccess(requestedUrl: string): this;
|
|
8
|
-
tryUnlock(): Promise<{
|
|
9
|
-
isLoggedIn: boolean;
|
|
10
|
-
hasAccess: boolean;
|
|
11
|
-
accessFeatures: string[];
|
|
12
|
-
}>;
|
|
13
|
-
private resolveActualAccessFeatures;
|
|
14
|
-
private setAccessCookiesAndPerformRequestedActions;
|
|
15
|
-
}
|
|
16
|
-
export default PaywallUnlocker;
|
package/esm/lib/User.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { State, UserAttributes } from '../types';
|
|
2
|
-
declare class User<UA extends UserAttributes, S extends {
|
|
3
|
-
[index: string]: unknown;
|
|
4
|
-
}, Attributes extends Array<keyof UA>, Namespaces extends Array<string>, SubscribeResponse extends {} = {
|
|
5
|
-
state: State;
|
|
6
|
-
}> {
|
|
7
|
-
private attributes?;
|
|
8
|
-
private namespaces?;
|
|
9
|
-
constructor(attributes?: Attributes | undefined, namespaces?: Namespaces | undefined);
|
|
10
|
-
withAttributes<NewAttributes extends Array<keyof UA>>(attributes: NewAttributes): User<UA, S, (Attributes[number] & NewAttributes[number])[], Namespaces, SubscribeResponse & {
|
|
11
|
-
attributes: Pick<UA, Attributes[number] & NewAttributes[number]>;
|
|
12
|
-
}>;
|
|
13
|
-
withStorage<NewNamespaces extends Array<string>>(...namespace: NewNamespaces): User<UA, S, Attributes, (Namespaces[number] & NewNamespaces[number])[], SubscribeResponse & {
|
|
14
|
-
storage: Pick<S, Namespaces[number] & NewNamespaces[number]>;
|
|
15
|
-
}>;
|
|
16
|
-
subscribe(onData: (data: SubscribeResponse) => void): void;
|
|
17
|
-
private processUserAttributesEvent;
|
|
18
|
-
private processStorageEvent;
|
|
19
|
-
private setupLocalCache;
|
|
20
|
-
}
|
|
21
|
-
export default User;
|
package/esm/lib/cookie.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
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: string): void;
|
package/esm/lib/rpc.d.ts
DELETED
package/esm/store/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { State, UserAttributes } from '../types';
|
|
2
|
-
declare type StoreDataMap = {
|
|
3
|
-
userAttributes: UserAttributes;
|
|
4
|
-
state: State;
|
|
5
|
-
storage: {
|
|
6
|
-
[namespace: string]: {
|
|
7
|
-
[index: string]: unknown;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
declare type Listener<T> = (data: T) => void;
|
|
12
|
-
declare const _default: {
|
|
13
|
-
set: (key: keyof StoreDataMap, value: UserAttributes | State | {
|
|
14
|
-
[namespace: string]: {
|
|
15
|
-
[index: string]: unknown;
|
|
16
|
-
};
|
|
17
|
-
}) => void;
|
|
18
|
-
get: <K extends keyof StoreDataMap, T = StoreDataMap[K]>(key: K) => T | undefined;
|
|
19
|
-
on: <K_1 extends keyof StoreDataMap, T_1 = StoreDataMap[K_1]>(key: K_1, listener: Listener<T_1>) => void;
|
|
20
|
-
clear: () => void;
|
|
21
|
-
};
|
|
22
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/types.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare type UserAttributes = {
|
|
2
|
-
uuid?: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
email?: string;
|
|
5
|
-
phone?: string;
|
|
6
|
-
trackingKey?: string;
|
|
7
|
-
extraData?: {
|
|
8
|
-
[index: string]: unknown;
|
|
9
|
-
};
|
|
10
|
-
access?: string[];
|
|
11
|
-
privacyPreferences?: PrivacyPreferences;
|
|
12
|
-
};
|
|
13
|
-
export declare type State = {
|
|
14
|
-
isLoggedIn: boolean;
|
|
15
|
-
emergencyMode?: string[];
|
|
16
|
-
};
|
|
17
|
-
export declare type PrivacyPreferences = {
|
|
18
|
-
allowResearchUsage: boolean;
|
|
19
|
-
connectWithSurveys: boolean;
|
|
20
|
-
personalizedAds: boolean;
|
|
21
|
-
personalizedContent: boolean;
|
|
22
|
-
};
|