@amedia/user 0.13.14 → 0.13.15
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 +1 -5
- package/build.js +25 -0
- package/dist/index.d.ts +696 -17
- package/dist/index.esm.js +15 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +7 -0
- package/eik.json +4 -3
- package/package.json +30 -39
- package/src/actions/userData.ts +7 -9
- package/src/clients/jupiter.spec.ts +1 -3
- package/src/clients/pluto.spec.ts +2 -5
- package/tsconfig.eslint.json +2 -4
- package/tsconfig.json +2 -1
- package/dist/cache/engines/indexeddb.d.ts +0 -7
- package/dist/index.js.LICENSE.txt +0 -14
- package/dist/lib/PaywallUnlocker.d.ts +0 -16
- package/dist/lib/PaywallUnlocker.spec.d.ts +0 -4
- package/dist/lib/User.d.ts +0 -21
- package/dist/utils/logValidationError.d.ts +0 -1
- package/rollup.config.js +0 -14
- package/test.html +0 -12
- package/webpack.config.js +0 -28
package/eik.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "user",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.15",
|
|
4
4
|
"server": "https://assets.acdn.no",
|
|
5
5
|
"files": {
|
|
6
|
-
"user.js": "./
|
|
7
|
-
"user.js.map": "./
|
|
6
|
+
"user.js": "./dist/index.esm.js",
|
|
7
|
+
"user.js.map": "./dist/index.esm.js.map",
|
|
8
|
+
"user.d.ts": "./dist/index.d.ts"
|
|
8
9
|
}
|
|
9
10
|
}
|
package/package.json
CHANGED
|
@@ -1,59 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.15",
|
|
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)",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.esm.js",
|
|
9
|
+
"typings": "dist/index.d.ts",
|
|
8
10
|
"scripts": {
|
|
9
11
|
"test": "jest --coverage",
|
|
10
12
|
"lint": "eslint ./src --ext .ts",
|
|
11
|
-
"build": "npm install &&
|
|
12
|
-
"
|
|
13
|
-
"
|
|
13
|
+
"build": "npm install && node build.js",
|
|
14
|
+
"typings": "tsc",
|
|
15
|
+
"eik:publish": "run-p typings lint && npm run test && npm run build && eik package",
|
|
16
|
+
"prepublishOnly": "run-p typings lint && npm run test && npm run build"
|
|
14
17
|
},
|
|
15
18
|
"dependencies": {
|
|
16
|
-
"@amedia/browserid": "0.1.6",
|
|
17
|
-
"@amedia/frontend-rpc": "0.0.12",
|
|
18
|
-
"
|
|
19
|
-
"runtypes": "6.2.1",
|
|
19
|
+
"@amedia/browserid": "^0.1.6",
|
|
20
|
+
"@amedia/frontend-rpc": "^0.0.12",
|
|
21
|
+
"runtypes": "^6.3.2",
|
|
20
22
|
"ts-deepmerge": "^1.0.8"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
23
|
-
"@amedia/eslint-config-base": "4.0.7",
|
|
24
|
-
"@amedia/eslint-config-typescript": "4.0.10",
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "4.22.0",
|
|
37
|
-
"eslint": "7.24.0",
|
|
38
|
-
"eslint-config-airbnb-typescript": "12.3.1",
|
|
39
|
-
"eslint-config-prettier": "8.2.0",
|
|
40
|
-
"eslint-plugin-import": "2.22.1",
|
|
25
|
+
"@amedia/eslint-config-base": "^4.0.7",
|
|
26
|
+
"@amedia/eslint-config-typescript": "^4.0.10",
|
|
27
|
+
"@eik/cli": "^1.8.41",
|
|
28
|
+
"@types/convict": "^6.1.1",
|
|
29
|
+
"@types/dexie": "^1.3.1",
|
|
30
|
+
"@types/jest": "^26.0.24",
|
|
31
|
+
"@types/lodash": "^4.14.172",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
|
33
|
+
"esbuild": "^0.12.19",
|
|
34
|
+
"eslint": "^7.32.0",
|
|
35
|
+
"eslint-config-airbnb-typescript": "^12.3.1",
|
|
36
|
+
"eslint-config-prettier": "^8.3.0",
|
|
37
|
+
"eslint-plugin-import": "^2.24.0",
|
|
41
38
|
"eslint-plugin-prettier": "^3.4.0",
|
|
42
39
|
"jest": "^26.6.3",
|
|
43
40
|
"jest-extended": "^0.11.5",
|
|
44
41
|
"jest-fetch-mock": "^3.0.3",
|
|
45
|
-
"mockdate": "3.0.5",
|
|
46
|
-
"npm-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"ts-jest": "^26.5.5",
|
|
53
|
-
"ts-loader": "9.1.0",
|
|
54
|
-
"tslib": "2.2.0",
|
|
55
|
-
"typescript": "4.2.4",
|
|
56
|
-
"webpack": "5.36.2",
|
|
57
|
-
"webpack-cli": "4.6.0"
|
|
42
|
+
"mockdate": "^3.0.5",
|
|
43
|
+
"npm-dts": "^1.3.10",
|
|
44
|
+
"npm-run-all": "^4.1.5",
|
|
45
|
+
"prettier": "^2.3.2",
|
|
46
|
+
"ts-jest": "^26.5.6",
|
|
47
|
+
"tslib": "^2.3.0",
|
|
48
|
+
"typescript": "^4.3.5"
|
|
58
49
|
}
|
|
59
50
|
}
|
package/src/actions/userData.ts
CHANGED
|
@@ -9,15 +9,13 @@ import { getInfo } from '../clients/nebula';
|
|
|
9
9
|
import { whenIsLoggedIn, whenLoginStateResolved } from '../utils/loginState';
|
|
10
10
|
|
|
11
11
|
const getExtraData = () =>
|
|
12
|
-
Promise.all([
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
isLoggedIn ? store.get('userAttributes')?.trackingKey : undefined
|
|
20
|
-
)
|
|
12
|
+
Promise.all([getBrowserId(), whenLoginStateResolved()]).then(
|
|
13
|
+
([browserId, isLoggedIn]) =>
|
|
14
|
+
getInfo(
|
|
15
|
+
window.location.hostname,
|
|
16
|
+
browserId,
|
|
17
|
+
isLoggedIn ? store.get('userAttributes')?.trackingKey : undefined
|
|
18
|
+
)
|
|
21
19
|
);
|
|
22
20
|
|
|
23
21
|
const dataServiceMap: {
|
|
@@ -151,8 +151,7 @@ describe('Pluto service', () => {
|
|
|
151
151
|
fetch.mockResponseOnce(() =>
|
|
152
152
|
Promise.resolve({
|
|
153
153
|
init: { status: 404 },
|
|
154
|
-
body:
|
|
155
|
-
'{"errors":[{"id":"f84ea34e-d9eb-11eb-afe7-000000000000","title":"No currentSession found","detail":"Got currentSession not found error","status":"404","code":"session.not_found"}]}\n',
|
|
154
|
+
body: '{"errors":[{"id":"f84ea34e-d9eb-11eb-afe7-000000000000","title":"No currentSession found","detail":"Got currentSession not found error","status":"404","code":"session.not_found"}]}\n',
|
|
156
155
|
})
|
|
157
156
|
);
|
|
158
157
|
currentSession = await getCurrentSession();
|
|
@@ -165,9 +164,7 @@ describe('Pluto service', () => {
|
|
|
165
164
|
describe('removeSession()', () => {
|
|
166
165
|
it('should call Plut session delete', () => {
|
|
167
166
|
removeSession('www.rb.no');
|
|
168
|
-
expect(
|
|
169
|
-
fetch
|
|
170
|
-
).toHaveBeenCalledWith(
|
|
167
|
+
expect(fetch).toHaveBeenCalledWith(
|
|
171
168
|
'/api/pluto/v1/sessions/current?publication_domain=www.rb.no',
|
|
172
169
|
{ method: 'DELETE' }
|
|
173
170
|
);
|
package/tsconfig.eslint.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@amedia/eslint-config-typescript/tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist
|
|
5
|
-
//"outFile": "./dist/amedia-user.js",
|
|
4
|
+
"outDir": "./dist",
|
|
6
5
|
"rootDir": "./src",
|
|
7
6
|
"typeRoots": [
|
|
8
7
|
"./node_modules/@types"
|
|
9
8
|
],
|
|
10
9
|
"module": "ES6",
|
|
11
|
-
//"module": "AMD",
|
|
12
10
|
"lib": [
|
|
13
11
|
"DOM"
|
|
14
12
|
],
|
|
@@ -21,4 +19,4 @@
|
|
|
21
19
|
"include": [
|
|
22
20
|
"src/**/*",
|
|
23
21
|
]
|
|
24
|
-
}
|
|
22
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
"extends": "@amedia/eslint-config-typescript/tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"rootDir": "./src",
|
|
5
|
-
"outDir": "./dist
|
|
5
|
+
"outDir": "./dist",
|
|
6
6
|
//"noImplicitAny": true,
|
|
7
7
|
"declaration": true,
|
|
8
|
+
"emitDeclarationOnly": true,
|
|
8
9
|
"typeRoots": [
|
|
9
10
|
"./node_modules/@types"
|
|
10
11
|
],
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CacheEntry, Engine } from '../types';
|
|
2
|
-
export declare const get: (key: string) => Promise<CacheEntry>;
|
|
3
|
-
export declare const set: (key: string, data: unknown, expires: number) => Promise<void>;
|
|
4
|
-
export declare const remove: (key: string) => Promise<void>;
|
|
5
|
-
export declare const clear: () => Promise<void>;
|
|
6
|
-
declare const _default: Engine;
|
|
7
|
-
export default _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
localForage -- Offline Storage, Improved
|
|
3
|
-
Version 1.9.0
|
|
4
|
-
https://localforage.github.io/localForage
|
|
5
|
-
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/*!
|
|
9
|
-
* JavaScript Cookie v2.2.1
|
|
10
|
-
* https://github.com/js-cookie/js-cookie
|
|
11
|
-
*
|
|
12
|
-
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
|
13
|
-
* Released under the MIT license
|
|
14
|
-
*/
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare class PaywallUnlocker {
|
|
2
|
-
private requestedAccessFeatures;
|
|
3
|
-
private reload;
|
|
4
|
-
private requestedUrl;
|
|
5
|
-
withAccessFeatures(accessFeatures: string[]): this;
|
|
6
|
-
reloadOnAccess(): this;
|
|
7
|
-
redirectOnAccess(requestedUrl: string): this;
|
|
8
|
-
tryUnlock(): Promise<{
|
|
9
|
-
isLoggedIn: boolean;
|
|
10
|
-
hasAccess: boolean;
|
|
11
|
-
accessFeatures: string[];
|
|
12
|
-
}>;
|
|
13
|
-
private resolveActualAccessFeatures;
|
|
14
|
-
private setAccessCookiesAndPerformRequestedActions;
|
|
15
|
-
}
|
|
16
|
-
export default PaywallUnlocker;
|
package/dist/lib/User.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { State, UserAttributes } from '../types';
|
|
2
|
-
declare class User<UA extends UserAttributes, S extends {
|
|
3
|
-
[index: string]: unknown;
|
|
4
|
-
}, Attributes extends Array<keyof UA>, Namespaces extends Array<string>, SubscribeResponse extends {} = {
|
|
5
|
-
state: State;
|
|
6
|
-
}> {
|
|
7
|
-
private attributes?;
|
|
8
|
-
private namespaces?;
|
|
9
|
-
constructor(attributes?: Attributes | undefined, namespaces?: Namespaces | undefined);
|
|
10
|
-
withAttributes<NewAttributes extends Array<keyof UA>>(attributes: NewAttributes): User<UA, S, (Attributes[number] & NewAttributes[number])[], Namespaces, SubscribeResponse & {
|
|
11
|
-
attributes: Pick<UA, Attributes[number] & NewAttributes[number]>;
|
|
12
|
-
}>;
|
|
13
|
-
withStorage<NewNamespaces extends Array<string>>(...namespace: NewNamespaces): User<UA, S, Attributes, (Namespaces[number] & NewNamespaces[number])[], SubscribeResponse & {
|
|
14
|
-
storage: Pick<S, Namespaces[number] & NewNamespaces[number]>;
|
|
15
|
-
}>;
|
|
16
|
-
subscribe(onData: (data: SubscribeResponse) => void): void;
|
|
17
|
-
private processUserAttributesEvent;
|
|
18
|
-
private processStorageEvent;
|
|
19
|
-
private setupLocalCache;
|
|
20
|
-
}
|
|
21
|
-
export default User;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function logValidationError(name: string, error: Error, extra?: Object): void;
|
package/rollup.config.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
-
import typescript from 'rollup-plugin-typescript2';
|
|
4
|
-
import { uglify } from 'rollup-plugin-uglify';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
input: 'src/index.ts',
|
|
8
|
-
output: {
|
|
9
|
-
file: 'esm/user.js',
|
|
10
|
-
format: 'esm',
|
|
11
|
-
sourcemap: true,
|
|
12
|
-
},
|
|
13
|
-
plugins: [resolve(), commonjs(), typescript(), uglify()],
|
|
14
|
-
};
|
package/test.html
DELETED
package/webpack.config.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
experiments: {
|
|
5
|
-
outputModule: true,
|
|
6
|
-
},
|
|
7
|
-
entry: './src/index.ts',
|
|
8
|
-
module: {
|
|
9
|
-
rules: [
|
|
10
|
-
{
|
|
11
|
-
test: /\.tsx?$/,
|
|
12
|
-
use: ['ts-loader'],
|
|
13
|
-
exclude: /node_modules/,
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
|
-
resolve: {
|
|
18
|
-
extensions: ['.tsx', '.ts', '.js'],
|
|
19
|
-
},
|
|
20
|
-
output: {
|
|
21
|
-
path: path.resolve(__dirname, 'dist'),
|
|
22
|
-
filename: 'index.js',
|
|
23
|
-
library: {
|
|
24
|
-
type: 'module',
|
|
25
|
-
},
|
|
26
|
-
globalObject: 'this',
|
|
27
|
-
},
|
|
28
|
-
};
|