@amedia/user 0.14.110 → 0.14.112
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 +13 -2
- package/dist/user.d.ts +6 -1
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
The goal of this module is to simplify the usage of aID data and services in Amedia frontend code. The module is designed to be used several places on a webpage independently, and the module will ensure that requests from different parts of the webpage are handled in an efficient manner.
|
|
4
4
|
|
|
5
|
+
# TL;DR (details in the linked chapters)
|
|
6
|
+
|
|
7
|
+
- [UserDataRequest](#getting-user-data)<br/>
|
|
8
|
+
All current user data (including login state and access). Call it as much as you like, but only ask for what you actually need.
|
|
9
|
+
- [PaywallUnlockRequest](#unlocking-the-paywall)<br/>
|
|
10
|
+
When you need to actively verify login state and access. May perform redirects and expensive calls for subscription activation, and thus limited in how much it accepts to be called.
|
|
11
|
+
- [SiteAccessRequest](#activating-subscriptions--finding-upgrade-path)<br/>
|
|
12
|
+
When you need to actively verify access. Specify which access feature(s) you need. May attempt subscription activation.
|
|
13
|
+
- [User actions](#actions)<br/>
|
|
14
|
+
Login, logout, that sort of thing.
|
|
15
|
+
|
|
5
16
|
# Usage
|
|
6
17
|
|
|
7
18
|
Please be advised that you are required to use ESM in order to use this module.
|
|
@@ -96,7 +107,7 @@ You access this as any old object, but it provides a save()-method for when to w
|
|
|
96
107
|
import { UserDataRequest } from '@amedia/user';
|
|
97
108
|
|
|
98
109
|
const { storage } = await new UserDataRequest()
|
|
99
|
-
.withStorage('my_namespace')
|
|
110
|
+
.withStorage(['my_namespace'])
|
|
100
111
|
.fetch();
|
|
101
112
|
storage.my_namespace.my_key = 'my data';
|
|
102
113
|
storage.my_namespace.save();
|
|
@@ -109,7 +120,7 @@ In this example, `my_key` in `my_namespace` would be updated to `my data` (and t
|
|
|
109
120
|
|
|
110
121
|
#### State
|
|
111
122
|
|
|
112
|
-
State is
|
|
123
|
+
State is ment to describe the current context the user is in right now. It's not directly requested, but will always be a part of the response.
|
|
113
124
|
|
|
114
125
|
Current attributes in `state`:
|
|
115
126
|
|
package/dist/user.d.ts
CHANGED
|
@@ -127,6 +127,11 @@ declare class EmergencyModeError extends Error {
|
|
|
127
127
|
constructor(message?: string);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
declare class ValidationError extends Error {
|
|
131
|
+
readonly code: string;
|
|
132
|
+
constructor(code: string, message: string);
|
|
133
|
+
}
|
|
134
|
+
|
|
130
135
|
/** @deprecated Should be deleted when removing saveStorage and updateStorage */
|
|
131
136
|
type Storage = Record<string, Record<string, string>>;
|
|
132
137
|
type LoginPageParams = {
|
|
@@ -160,4 +165,4 @@ declare const aidUrls: {
|
|
|
160
165
|
sites: URL;
|
|
161
166
|
};
|
|
162
167
|
|
|
163
|
-
export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, type PaywallUnlockResponse, type PrivacyPreferences, SiteAccessRequest, type SiteAccessResponse, type State, type UserAttributes, UserDataRequest, aidUrls, getLoginUrl, goToLoginPage, logout, requestDataRefresh, saveStorage, updateStorage };
|
|
168
|
+
export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, type PaywallUnlockResponse, type PrivacyPreferences, SiteAccessRequest, type SiteAccessResponse, type State, type UserAttributes, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout, requestDataRefresh, saveStorage, updateStorage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.112",
|
|
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)",
|
|
@@ -49,15 +49,16 @@
|
|
|
49
49
|
"ts-deepmerge": "^6.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@amedia/kragl": "^2.0.
|
|
53
|
-
"@
|
|
54
|
-
"@changesets/
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@types/
|
|
52
|
+
"@amedia/kragl": "^2.0.4",
|
|
53
|
+
"@amedia/prettier-config": "^1.0.5",
|
|
54
|
+
"@changesets/changelog-github": "^0.5.0",
|
|
55
|
+
"@changesets/cli": "^2.27.1",
|
|
56
|
+
"@eik/esbuild-plugin": "^1.1.45",
|
|
57
|
+
"@types/jest": "^29.5.11",
|
|
58
|
+
"@types/node": "^20.10.8",
|
|
58
59
|
"concurrently": "^8.2.2",
|
|
59
60
|
"cors": "^2.8.5",
|
|
60
|
-
"esbuild": "0.19.
|
|
61
|
+
"esbuild": "0.19.11",
|
|
61
62
|
"express": "^4.18.2",
|
|
62
63
|
"jest": "^29.7.0",
|
|
63
64
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -65,10 +66,10 @@
|
|
|
65
66
|
"jest-fetch-mock": "^3.0.3",
|
|
66
67
|
"mockdate": "^3.0.5",
|
|
67
68
|
"npm-run-all": "^4.1.5",
|
|
68
|
-
"rollup": "
|
|
69
|
+
"rollup": "4.9.4",
|
|
69
70
|
"rollup-plugin-dts": "6.1.0",
|
|
70
71
|
"ts-jest": "^29.1.1",
|
|
71
72
|
"tslib": "^2.6.2",
|
|
72
|
-
"typescript": "^5.
|
|
73
|
+
"typescript": "^5.3.3"
|
|
73
74
|
}
|
|
74
75
|
}
|