@amedia/user 0.14.90 → 0.14.91
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/user.d.ts +28 -14
- package/package.json +7 -7
package/dist/user.d.ts
CHANGED
|
@@ -22,35 +22,42 @@ type PrivacyPreferences = {
|
|
|
22
22
|
personalizedContent: boolean;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
declare const DEFAULT_CLIENT_ID = "default";
|
|
26
|
+
type ClientId = string | typeof DEFAULT_CLIENT_ID;
|
|
27
|
+
|
|
28
|
+
type NamespaceList = Array<string>;
|
|
29
|
+
|
|
25
30
|
type Millis = number;
|
|
26
31
|
type UnsubscribeFn = () => void;
|
|
27
|
-
declare class UserDataRequest<
|
|
28
|
-
[index: string]: unknown;
|
|
29
|
-
}, Attributes extends Array<keyof UA>, Namespaces extends Array<string>, SubscribeResponse extends Record<string, unknown> & {
|
|
32
|
+
declare class UserDataRequest<TUserAttributes extends UserAttributes, TStorage extends Record<ClientId, Record<string, string>>, TAttributes extends Array<keyof TUserAttributes>, TRequestedStorage extends Record<keyof TStorage, NamespaceList>, TSubscribeResponse extends Record<string, unknown> & {
|
|
30
33
|
state: State;
|
|
31
34
|
} = {
|
|
32
35
|
state: State;
|
|
33
36
|
}> {
|
|
34
|
-
private
|
|
35
|
-
private
|
|
37
|
+
private requestedAttributes?;
|
|
38
|
+
private requestedStorage?;
|
|
36
39
|
static FETCH_TIMEOUT: Millis;
|
|
37
40
|
private fetchTimeoutId;
|
|
38
41
|
private lastReceivedData?;
|
|
39
42
|
private subscriptionEventListeners;
|
|
40
|
-
constructor(
|
|
41
|
-
withAttributes<NewAttributes extends Array<keyof
|
|
42
|
-
attributes: Pick<
|
|
43
|
+
constructor(requestedAttributes?: TAttributes, requestedStorage?: TRequestedStorage);
|
|
44
|
+
withAttributes<NewAttributes extends Array<keyof TUserAttributes>>(attributes: NewAttributes): UserDataRequest<TUserAttributes, TStorage, (TAttributes[number] & NewAttributes[number])[], TRequestedStorage, TSubscribeResponse & {
|
|
45
|
+
attributes: Pick<TUserAttributes, TAttributes[number] & NewAttributes[number]>;
|
|
46
|
+
}>;
|
|
47
|
+
withStorage(namespaces: Array<string>): UserDataRequest<TUserAttributes, TStorage, TAttributes, TRequestedStorage, TSubscribeResponse & {
|
|
48
|
+
storage: Record<string, Record<string, string>>;
|
|
43
49
|
}>;
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
withClientStorage(clientId: keyof TStorage, namespaces: Array<string>): UserDataRequest<TUserAttributes, TStorage, TAttributes, TRequestedStorage, TSubscribeResponse & {
|
|
51
|
+
clientStorage: Record<ClientId, (typeof namespaces)[number]>;
|
|
46
52
|
}>;
|
|
47
|
-
subscribe(onData: (data:
|
|
53
|
+
subscribe(onData: (data: TSubscribeResponse) => void): UnsubscribeFn;
|
|
48
54
|
fetch(options?: {
|
|
49
55
|
timeout?: Millis;
|
|
50
|
-
}): Promise<
|
|
51
|
-
private unsubscribe;
|
|
52
|
-
private clearFetchTimeout;
|
|
56
|
+
}): Promise<TSubscribeResponse>;
|
|
53
57
|
private startFetchTimeout;
|
|
58
|
+
private clearFetchTimeout;
|
|
59
|
+
private restartFetchTimeout;
|
|
60
|
+
private unsubscribe;
|
|
54
61
|
private processUserAttributesEvent;
|
|
55
62
|
private processStorageEvent;
|
|
56
63
|
private setupLocalCache;
|
|
@@ -100,6 +107,7 @@ declare class PaywallError extends Error {
|
|
|
100
107
|
constructor(message: string, code: string);
|
|
101
108
|
}
|
|
102
109
|
|
|
110
|
+
/** @deprecated Should be deleted when removing saveStorage and updateStorage */
|
|
103
111
|
type Storage = Record<string, Record<string, string>>;
|
|
104
112
|
type LoginPageParams = {
|
|
105
113
|
requestedUrl?: string;
|
|
@@ -113,7 +121,13 @@ type LoginPageParams = {
|
|
|
113
121
|
declare const goToLoginPage: (requestedUrlOrParams?: string | LoginPageParams) => void;
|
|
114
122
|
declare const getLoginUrl: (requestedUrlOrParams?: string | LoginPageParams) => URL;
|
|
115
123
|
declare const logout: () => Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Use Namespace.save() instead
|
|
126
|
+
*/
|
|
116
127
|
declare const updateStorage: (storage: Storage) => void;
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated Use Namespace.save() instead
|
|
130
|
+
*/
|
|
117
131
|
declare const saveStorage: (storage: Storage) => void;
|
|
118
132
|
declare const requestDataRefresh: () => void;
|
|
119
133
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.91",
|
|
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)",
|
|
@@ -46,30 +46,30 @@
|
|
|
46
46
|
"@amedia/browserid": "^1.0.17",
|
|
47
47
|
"@amedia/frontend-rpc": "^0.0.12",
|
|
48
48
|
"runtypes": "^6.6.0",
|
|
49
|
-
"ts-deepmerge": "^
|
|
49
|
+
"ts-deepmerge": "^6.0.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@amedia/kragl": "^1.2.3",
|
|
53
53
|
"@changesets/changelog-github": "^0.4.8",
|
|
54
54
|
"@changesets/cli": "^2.26.0",
|
|
55
55
|
"@eik/esbuild-plugin": "^1.1.27",
|
|
56
|
-
"@types/jest": "^29.
|
|
56
|
+
"@types/jest": "^29.4.0",
|
|
57
57
|
"@types/node": "^18.11.18",
|
|
58
58
|
"concurrently": "^7.6.0",
|
|
59
59
|
"cors": "^2.8.5",
|
|
60
60
|
"esbuild": "0.17.4",
|
|
61
61
|
"express": "^4.18.2",
|
|
62
|
-
"jest": "^29.
|
|
63
|
-
"jest-environment-jsdom": "^29.
|
|
62
|
+
"jest": "^29.4.1",
|
|
63
|
+
"jest-environment-jsdom": "^29.4.1",
|
|
64
64
|
"jest-extended": "^3.2.3",
|
|
65
65
|
"jest-fetch-mock": "^3.0.3",
|
|
66
66
|
"mockdate": "^3.0.5",
|
|
67
67
|
"npm-run-all": "^4.1.5",
|
|
68
68
|
"prettier": "^2.8.3",
|
|
69
|
-
"rollup": "3.
|
|
69
|
+
"rollup": "3.12.0",
|
|
70
70
|
"rollup-plugin-dts": "5.1.1",
|
|
71
71
|
"ts-jest": "^29.0.5",
|
|
72
|
-
"tslib": "^2.
|
|
72
|
+
"tslib": "^2.5.0",
|
|
73
73
|
"typescript": "^4.9.4"
|
|
74
74
|
}
|
|
75
75
|
}
|