@amedia/user 0.14.98 → 0.14.99
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/README.md +17 -4
- package/dist/user.d.ts +7 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -118,6 +118,17 @@ Current attributes in `state`:
|
|
|
118
118
|
| isLoggedIn | boolean | Is the user currently logged in? If not, most attributes will be undefined |
|
|
119
119
|
| emergencyMode | Array<string> | Current state of emergency mode in production environment (paywall, aid etc.) |
|
|
120
120
|
|
|
121
|
+
#### Access not attached to a user
|
|
122
|
+
|
|
123
|
+
A visitor may have access through their IP address, or a specific token that we periodically enable for "avis i skolen".
|
|
124
|
+
|
|
125
|
+
Current elements in the array `nonUserAccess`:
|
|
126
|
+
|
|
127
|
+
| name | type | descriptions |
|
|
128
|
+
| -------------- | ------------- | -------------------- |
|
|
129
|
+
| customer | string | "conocophillips" etc |
|
|
130
|
+
| accessFeatures | Array<string> | ["newspaper"] |
|
|
131
|
+
|
|
121
132
|
### Executing the request
|
|
122
133
|
|
|
123
134
|
Once you have created a request and specified the data you need, the final step is to decide how you want to get the data once it's available. You can either choose to subscribe to data as they get loaded from the various backends or wait until all fetching is done and get everything in one package.
|
|
@@ -137,8 +148,9 @@ const unsubscribe = new UserDataRequest()
|
|
|
137
148
|
.withAttributes(['name', 'trackingKey'])
|
|
138
149
|
.withStorage(['my_namespace'])
|
|
139
150
|
.withClientStorage('client-id', ['my-client-namespace'])
|
|
140
|
-
.
|
|
141
|
-
|
|
151
|
+
.withNonUserAccess()
|
|
152
|
+
.subscribe(({ attributes, state, storage, clientStorage, nonUserAccess }) => {
|
|
153
|
+
console.log(attributes, state, storage, clientStorage, nonUserAccess);
|
|
142
154
|
});
|
|
143
155
|
|
|
144
156
|
// If you wish to unsubscribe from further updates:
|
|
@@ -164,9 +176,10 @@ new UserDataRequest()
|
|
|
164
176
|
.withAttributes(['name'])
|
|
165
177
|
.withStorage(['my_namespace'])
|
|
166
178
|
.withClientStorage('client-id', ['my-client-namespace'])
|
|
179
|
+
.withNonUserAccess()
|
|
167
180
|
.fetch()
|
|
168
|
-
.then(({ attributes, state, storage, clientStorage }) => {
|
|
169
|
-
console.log(attributes, state, storage, clientStorage);
|
|
181
|
+
.then(({ attributes, state, storage, clientStorage, nonUserAccess }) => {
|
|
182
|
+
console.log(attributes, state, storage, clientStorage, nonUserAccess);
|
|
170
183
|
});
|
|
171
184
|
```
|
|
172
185
|
|
package/dist/user.d.ts
CHANGED
|
@@ -36,11 +36,14 @@ declare class UserDataRequest<TUserAttributes extends UserAttributes, TStorage e
|
|
|
36
36
|
}> {
|
|
37
37
|
private requestedAttributes?;
|
|
38
38
|
private requestedStorage?;
|
|
39
|
+
private requestedNonUserAccess;
|
|
39
40
|
static FETCH_TIMEOUT: Millis;
|
|
41
|
+
private static WITH_NON_USER_ACCESS;
|
|
40
42
|
private fetchTimeoutId;
|
|
41
43
|
private lastReceivedData?;
|
|
42
44
|
private subscriptionEventListeners;
|
|
43
|
-
|
|
45
|
+
private resolveNonUserAccess;
|
|
46
|
+
constructor(requestedAttributes?: TAttributes, requestedStorage?: TRequestedStorage, requestedNonUserAccess?: boolean);
|
|
44
47
|
withAttributes<NewAttributes extends Array<keyof TUserAttributes>>(attributes: NewAttributes): UserDataRequest<TUserAttributes, TStorage, (TAttributes[number] & NewAttributes[number])[], TRequestedStorage, TSubscribeResponse & {
|
|
45
48
|
attributes: Pick<TUserAttributes, TAttributes[number] & NewAttributes[number]>;
|
|
46
49
|
}>;
|
|
@@ -50,6 +53,9 @@ declare class UserDataRequest<TUserAttributes extends UserAttributes, TStorage e
|
|
|
50
53
|
withClientStorage(clientId: keyof TStorage, namespaces: Array<string>): UserDataRequest<TUserAttributes, TStorage, TAttributes, TRequestedStorage, TSubscribeResponse & {
|
|
51
54
|
clientStorage: Record<ClientId, (typeof namespaces)[number]>;
|
|
52
55
|
}>;
|
|
56
|
+
withNonUserAccess(): UserDataRequest<TUserAttributes, TStorage, TAttributes, TRequestedStorage, TSubscribeResponse & {
|
|
57
|
+
nonUserAccess: Array<Record<string, string>>;
|
|
58
|
+
}>;
|
|
53
59
|
subscribe(onData: (data: TSubscribeResponse) => void): UnsubscribeFn;
|
|
54
60
|
fetch(options?: {
|
|
55
61
|
timeout?: Millis;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.99",
|
|
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)",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@changesets/changelog-github": "^0.4.8",
|
|
54
54
|
"@changesets/cli": "^2.26.0",
|
|
55
55
|
"@eik/esbuild-plugin": "^1.1.29",
|
|
56
|
-
"@types/jest": "^29.4.
|
|
57
|
-
"@types/node": "^18.15.
|
|
56
|
+
"@types/jest": "^29.4.2",
|
|
57
|
+
"@types/node": "^18.15.3",
|
|
58
58
|
"concurrently": "^7.6.0",
|
|
59
59
|
"cors": "^2.8.5",
|
|
60
60
|
"esbuild": "0.17.11",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"mockdate": "^3.0.5",
|
|
67
67
|
"npm-run-all": "^4.1.5",
|
|
68
68
|
"prettier": "^2.8.4",
|
|
69
|
-
"rollup": "3.19.
|
|
69
|
+
"rollup": "3.19.1",
|
|
70
70
|
"rollup-plugin-dts": "5.2.0",
|
|
71
71
|
"ts-jest": "^29.0.5",
|
|
72
72
|
"tslib": "^2.5.0",
|