@amedia/user 0.14.91 → 0.14.92
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.js +23 -3
- package/package.json +4 -4
package/dist/user.js
CHANGED
|
@@ -132,15 +132,35 @@ export class PaywallUnlockRequest {
|
|
|
132
132
|
return this;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
reloadOnAccess() {
|
|
136
|
+
this.reload = true;
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
|
|
135
140
|
async tryUnlock() {
|
|
136
141
|
if (!this.persona.state.isLoggedIn) {
|
|
137
142
|
return { isLoggedIn: false, hasAccess: false, accessFeatures: [] };
|
|
138
143
|
}
|
|
144
|
+
|
|
145
|
+
const hasAccess = this.requestedAccessFeatures.every((raf) =>
|
|
146
|
+
this.persona.attributes.access.includes(raf)
|
|
147
|
+
);
|
|
148
|
+
if (hasAccess) {
|
|
149
|
+
if (this.reload) {
|
|
150
|
+
console.log(
|
|
151
|
+
"[@amedia/user PaywallUnlockRequest]: Access granted. Would've performed reload at this time."
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
if (this.requestedUrl) {
|
|
155
|
+
console.log(
|
|
156
|
+
`[@amedia/user PaywallUnlockRequest]: Access granted. Would've performed redirect (to '${this.requestedUrl}') at this time.`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
139
161
|
return {
|
|
140
162
|
isLoggedIn: true,
|
|
141
|
-
hasAccess
|
|
142
|
-
this.persona.attributes.access.includes(raf)
|
|
143
|
-
),
|
|
163
|
+
hasAccess,
|
|
144
164
|
accessFeatures: this.persona.attributes.access,
|
|
145
165
|
};
|
|
146
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.92",
|
|
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)",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"@amedia/kragl": "^1.2.3",
|
|
53
53
|
"@changesets/changelog-github": "^0.4.8",
|
|
54
54
|
"@changesets/cli": "^2.26.0",
|
|
55
|
-
"@eik/esbuild-plugin": "^1.1.
|
|
55
|
+
"@eik/esbuild-plugin": "^1.1.28",
|
|
56
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
|
-
"esbuild": "0.17.
|
|
60
|
+
"esbuild": "0.17.5",
|
|
61
61
|
"express": "^4.18.2",
|
|
62
62
|
"jest": "^29.4.1",
|
|
63
63
|
"jest-environment-jsdom": "^29.4.1",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"rollup-plugin-dts": "5.1.1",
|
|
71
71
|
"ts-jest": "^29.0.5",
|
|
72
72
|
"tslib": "^2.5.0",
|
|
73
|
-
"typescript": "^4.9.
|
|
73
|
+
"typescript": "^4.9.5"
|
|
74
74
|
}
|
|
75
75
|
}
|