@amedia/user 0.14.20 → 0.14.22
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 +39 -41
- package/package.json +24 -23
package/dist/user.d.ts
CHANGED
|
@@ -35,13 +35,13 @@ declare module '@amedia/user/actions/authorization.spec' {
|
|
|
35
35
|
|
|
36
36
|
}
|
|
37
37
|
declare module '@amedia/user/actions/preferences' {
|
|
38
|
-
import
|
|
38
|
+
import * as rt from 'runtypes';
|
|
39
39
|
import { UserAttributes } from '@amedia/user/types';
|
|
40
|
-
export const PrivacyPreferencesSchema: Record<{
|
|
41
|
-
allowResearchUsage: Boolean;
|
|
42
|
-
connectWithSurveys: Boolean;
|
|
43
|
-
personalizedAds: Boolean;
|
|
44
|
-
personalizedContent: Boolean;
|
|
40
|
+
export const PrivacyPreferencesSchema: rt.Record<{
|
|
41
|
+
allowResearchUsage: rt.Boolean;
|
|
42
|
+
connectWithSurveys: rt.Boolean;
|
|
43
|
+
personalizedAds: rt.Boolean;
|
|
44
|
+
personalizedContent: rt.Boolean;
|
|
45
45
|
}, false>;
|
|
46
46
|
export const getPrivacyPreferences: () => Promise<Pick<UserAttributes, 'privacyPreferences'>>;
|
|
47
47
|
|
|
@@ -157,8 +157,8 @@ declare module '@amedia/user/cache/types' {
|
|
|
157
157
|
|
|
158
158
|
}
|
|
159
159
|
declare module '@amedia/user/clients/europa' {
|
|
160
|
-
import
|
|
161
|
-
export const EuropaSchema: Dictionary<Unknown, string>;
|
|
160
|
+
import * as rt from 'runtypes';
|
|
161
|
+
export const EuropaSchema: rt.Dictionary<rt.Unknown, string>;
|
|
162
162
|
export const clearLocalCache: () => Promise<void>;
|
|
163
163
|
export const updateNamespace: (namespace: string, data: Object) => Promise<void | {}>;
|
|
164
164
|
export const getNamespaces: <S extends {
|
|
@@ -188,32 +188,32 @@ declare module '@amedia/user/clients/europa.spec' {
|
|
|
188
188
|
|
|
189
189
|
}
|
|
190
190
|
declare module '@amedia/user/clients/jupiter' {
|
|
191
|
-
import
|
|
191
|
+
import * as rt from 'runtypes';
|
|
192
192
|
import { UserAttributes } from '@amedia/user/types';
|
|
193
193
|
export type AccessFeatures = string[];
|
|
194
|
-
export const CheckAccessForPaperSchema: Record<{
|
|
195
|
-
status: Literal<"success">;
|
|
196
|
-
access: Union<[Literal<"granted">, Literal<"denied">]>;
|
|
197
|
-
publication: Record<{
|
|
198
|
-
id: Number;
|
|
199
|
-
domain: String;
|
|
194
|
+
export const CheckAccessForPaperSchema: rt.Record<{
|
|
195
|
+
status: rt.Literal<"success">;
|
|
196
|
+
access: rt.Union<[rt.Literal<"granted">, rt.Literal<"denied">]>;
|
|
197
|
+
publication: rt.Record<{
|
|
198
|
+
id: rt.Number;
|
|
199
|
+
domain: rt.String;
|
|
200
200
|
}, false>;
|
|
201
|
-
access_features: Array<String, false>;
|
|
201
|
+
access_features: rt.Array<rt.String, false>;
|
|
202
202
|
}, false>;
|
|
203
|
-
export type CheckAccessForPaper = Static<typeof CheckAccessForPaperSchema>;
|
|
204
|
-
const GetVstokenSchema: Record<{
|
|
205
|
-
status: Literal<"success">;
|
|
206
|
-
cookie: String;
|
|
207
|
-
access_features: Array<String, false>;
|
|
203
|
+
export type CheckAccessForPaper = rt.Static<typeof CheckAccessForPaperSchema>;
|
|
204
|
+
const GetVstokenSchema: rt.Record<{
|
|
205
|
+
status: rt.Literal<"success">;
|
|
206
|
+
cookie: rt.String;
|
|
207
|
+
access_features: rt.Array<rt.String, false>;
|
|
208
208
|
}, false>;
|
|
209
|
-
export type GetVstoken = Static<typeof GetVstokenSchema>;
|
|
210
|
-
const GetNonUserAccessSchema: Record<{
|
|
211
|
-
status: Literal<"success">;
|
|
212
|
-
vstoken_cookie: String;
|
|
213
|
-
uuid: String;
|
|
214
|
-
access_features: Array<String, false>;
|
|
209
|
+
export type GetVstoken = rt.Static<typeof GetVstokenSchema>;
|
|
210
|
+
const GetNonUserAccessSchema: rt.Record<{
|
|
211
|
+
status: rt.Literal<"success">;
|
|
212
|
+
vstoken_cookie: rt.String;
|
|
213
|
+
uuid: rt.String;
|
|
214
|
+
access_features: rt.Array<rt.String, false>;
|
|
215
215
|
}, false>;
|
|
216
|
-
export type GetNonUserAccess = Static<typeof GetNonUserAccessSchema>;
|
|
216
|
+
export type GetNonUserAccess = rt.Static<typeof GetNonUserAccessSchema>;
|
|
217
217
|
export const checkForAccess: (siteDomain: string, accessFeatures: AccessFeatures) => Promise<Pick<UserAttributes, 'access'>>;
|
|
218
218
|
export const getUserAccess: (siteDomain: string) => Promise<GetVstoken>;
|
|
219
219
|
export const getNonUserAccess: (siteDomain: string) => Promise<GetNonUserAccess>;
|
|
@@ -225,7 +225,7 @@ declare module '@amedia/user/clients/jupiter.spec' {
|
|
|
225
225
|
|
|
226
226
|
}
|
|
227
227
|
declare module '@amedia/user/clients/mercury' {
|
|
228
|
-
import
|
|
228
|
+
import * as rt from 'runtypes';
|
|
229
229
|
export class UserDeactivatedError extends Error {
|
|
230
230
|
}
|
|
231
231
|
export enum AffiliationType {
|
|
@@ -233,13 +233,13 @@ declare module '@amedia/user/clients/mercury' {
|
|
|
233
233
|
FAMILY = "family",
|
|
234
234
|
SUBSCRIPTION = "subscription"
|
|
235
235
|
}
|
|
236
|
-
const PrimarySiteSchema: Record<{
|
|
237
|
-
domain: String;
|
|
238
|
-
name: String;
|
|
239
|
-
affiliation: Literal<AffiliationType.ACCESS>;
|
|
240
|
-
affiliations: Array<Union<[Literal<AffiliationType.ACCESS>, Literal<AffiliationType.FAMILY>, Literal<AffiliationType.SUBSCRIPTION>]>, false>;
|
|
236
|
+
const PrimarySiteSchema: rt.Record<{
|
|
237
|
+
domain: rt.String;
|
|
238
|
+
name: rt.String;
|
|
239
|
+
affiliation: rt.Literal<AffiliationType.ACCESS>;
|
|
240
|
+
affiliations: rt.Array<rt.Union<[rt.Literal<AffiliationType.ACCESS>, rt.Literal<AffiliationType.FAMILY>, rt.Literal<AffiliationType.SUBSCRIPTION>]>, false>;
|
|
241
241
|
}, false>;
|
|
242
|
-
export type PrimarySite = Static<typeof PrimarySiteSchema>;
|
|
242
|
+
export type PrimarySite = rt.Static<typeof PrimarySiteSchema>;
|
|
243
243
|
export const activateSubscription: (accessFeatures: string[], siteDomain: string) => Promise<string[]>;
|
|
244
244
|
export const getPrimarySite: (accessFeatures: string[]) => Promise<PrimarySite | null>;
|
|
245
245
|
export {};
|
|
@@ -509,8 +509,6 @@ declare module '@amedia/user/lib/PaywallUnlockRequest' {
|
|
|
509
509
|
reloadOnAccess(): this;
|
|
510
510
|
redirectOnAccess(requestedUrl: string): this;
|
|
511
511
|
tryUnlock(): Promise<UnlockResponse>;
|
|
512
|
-
private setAccessCookiesAndGetAccessFeatures;
|
|
513
|
-
private activateAccess;
|
|
514
512
|
}
|
|
515
513
|
export default PaywallUnlockRequest;
|
|
516
514
|
|
|
@@ -735,10 +733,10 @@ declare module '@amedia/user/utils/location.spec' {
|
|
|
735
733
|
}
|
|
736
734
|
declare module '@amedia/user/utils/log' {
|
|
737
735
|
export type Logger = {
|
|
738
|
-
debug: (message: string | Error, context?: any) => void;
|
|
739
|
-
info: (message: string | Error, context?: any) => void;
|
|
740
|
-
warn: (message: string | Error, context?: any) => void;
|
|
741
|
-
error: (message: string | Error, context?: any) => void;
|
|
736
|
+
debug: (message: string | Error | any, context?: any) => void;
|
|
737
|
+
info: (message: string | Error | any, context?: any) => void;
|
|
738
|
+
warn: (message: string | Error | any, context?: any) => void;
|
|
739
|
+
error: (message: string | Error | any, context?: any) => void;
|
|
742
740
|
};
|
|
743
741
|
export const setLogger: (engine: Logger) => void;
|
|
744
742
|
const _default: Logger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.22",
|
|
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)",
|
|
@@ -29,37 +29,38 @@
|
|
|
29
29
|
"postpublish": "npm run build && eik package"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@amedia/browserid": "^0.
|
|
32
|
+
"@amedia/browserid": "^1.0.17",
|
|
33
33
|
"@amedia/frontend-rpc": "^0.0.12",
|
|
34
|
-
"runtypes": "^6.
|
|
35
|
-
"ts-deepmerge": "^1.0
|
|
34
|
+
"runtypes": "^6.5.0",
|
|
35
|
+
"ts-deepmerge": "^1.1.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@amedia/eslint-config-base": "^4.0.
|
|
39
|
-
"@amedia/eslint-config-typescript": "^4.0.
|
|
40
|
-
"@
|
|
41
|
-
"@eik/
|
|
38
|
+
"@amedia/eslint-config-base": "^4.0.13",
|
|
39
|
+
"@amedia/eslint-config-typescript": "^4.0.13",
|
|
40
|
+
"@babel/eslint-parser": "^7.16.5",
|
|
41
|
+
"@eik/cli": "^2.0.20",
|
|
42
|
+
"@eik/esbuild-plugin": "^1.1.0",
|
|
42
43
|
"@types/convict": "^6.1.1",
|
|
43
|
-
"@types/
|
|
44
|
-
"@
|
|
45
|
-
"@typescript-eslint/
|
|
46
|
-
"express": "^4.17.1",
|
|
44
|
+
"@types/jest": "^27.4.0",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
|
46
|
+
"@typescript-eslint/parser": "^5.9.0",
|
|
47
47
|
"cors": "^2.8.5",
|
|
48
|
-
"esbuild": "^0.
|
|
49
|
-
"eslint": "^
|
|
50
|
-
"eslint-config-airbnb-typescript": "^
|
|
48
|
+
"esbuild": "^0.14.10",
|
|
49
|
+
"eslint": "^8.6.0",
|
|
50
|
+
"eslint-config-airbnb-typescript": "^16.1.0",
|
|
51
51
|
"eslint-config-prettier": "^8.3.0",
|
|
52
|
-
"eslint-plugin-import": "^2.
|
|
53
|
-
"eslint-plugin-prettier": "^
|
|
54
|
-
"
|
|
55
|
-
"jest
|
|
52
|
+
"eslint-plugin-import": "^2.25.4",
|
|
53
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
54
|
+
"express": "^4.17.2",
|
|
55
|
+
"jest": "^27.4.5",
|
|
56
|
+
"jest-extended": "^1.2.0",
|
|
56
57
|
"jest-fetch-mock": "^3.0.3",
|
|
57
58
|
"mockdate": "^3.0.5",
|
|
58
59
|
"npm-dts": "^1.3.10",
|
|
59
60
|
"npm-run-all": "^4.1.5",
|
|
60
|
-
"prettier": "^2.
|
|
61
|
-
"ts-jest": "^
|
|
62
|
-
"tslib": "^2.3.
|
|
63
|
-
"typescript": "^4.
|
|
61
|
+
"prettier": "^2.5.1",
|
|
62
|
+
"ts-jest": "^27.1.2",
|
|
63
|
+
"tslib": "^2.3.1",
|
|
64
|
+
"typescript": "^4.5.4"
|
|
64
65
|
}
|
|
65
66
|
}
|