@amedia/user 0.14.4 → 0.14.6
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 +2 -0
- package/package.json +1 -1
- package/src/cache/index.spec.ts +2 -0
- package/src/clients/pluto.spec.ts +2 -0
- package/src/eventHandlers/activation.ts +0 -1
- package/src/index.ts +2 -1
- package/src/utils/log.spec.ts +2 -0
- package/src/utils/log.ts +3 -0
package/dist/user.d.ts
CHANGED
|
@@ -395,6 +395,8 @@ declare module '@amedia/user/index-subscription.spec' {
|
|
|
395
395
|
declare module '@amedia/user/index' {
|
|
396
396
|
export { default as UserDataRequest } from '@amedia/user/lib/UserDataRequest';
|
|
397
397
|
export { default as PaywallUnlockRequest } from '@amedia/user/lib/PaywallUnlockRequest';
|
|
398
|
+
export { default as FetchTimeoutError } from '@amedia/user/exceptions/FetchTimeoutError';
|
|
399
|
+
export { default as PaywallError } from '@amedia/user/exceptions/PaywallError';
|
|
398
400
|
/**
|
|
399
401
|
* This will, if necessary, trigger a redirect to www.aid.no and return
|
|
400
402
|
* to the requestedUrl if supplied or the current url before redirecting away if not.
|
package/package.json
CHANGED
package/src/cache/index.spec.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Record, String } from 'runtypes';
|
|
|
2
2
|
import * as MockDate from 'mockdate';
|
|
3
3
|
import cache, { setCacheEngine } from '.';
|
|
4
4
|
import { setLogger } from '../utils/log';
|
|
5
|
+
import { version } from '../../eik.json';
|
|
5
6
|
|
|
6
7
|
const TestDataSchema = Record({
|
|
7
8
|
test: String,
|
|
@@ -78,6 +79,7 @@ describe('Cache', () => {
|
|
|
78
79
|
},
|
|
79
80
|
cacheData: { invalid: 'data' },
|
|
80
81
|
origin: '@amedia/user',
|
|
82
|
+
originVersion: version,
|
|
81
83
|
}
|
|
82
84
|
);
|
|
83
85
|
});
|
|
@@ -4,6 +4,7 @@ import store from '../store';
|
|
|
4
4
|
import { getCurrentSession, removeSession } from './pluto';
|
|
5
5
|
import { Logger, setLogger } from '../utils/log';
|
|
6
6
|
import { UserAttributes } from '../types';
|
|
7
|
+
import { version } from '../../eik.json';
|
|
7
8
|
import anything = jasmine.anything;
|
|
8
9
|
|
|
9
10
|
beforeEach(async () => {
|
|
@@ -190,6 +191,7 @@ describe('Pluto client', () => {
|
|
|
190
191
|
{
|
|
191
192
|
error: { code: 'session.invalid_for_domain' },
|
|
192
193
|
origin: '@amedia/user',
|
|
194
|
+
originVersion: version,
|
|
193
195
|
response: expect.any(Object),
|
|
194
196
|
}
|
|
195
197
|
);
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,8 @@ import getGlobalThis from './utils/getGlobalThis';
|
|
|
10
10
|
|
|
11
11
|
export { default as UserDataRequest } from './lib/UserDataRequest';
|
|
12
12
|
export { default as PaywallUnlockRequest } from './lib/PaywallUnlockRequest';
|
|
13
|
+
export { default as FetchTimeoutError } from './exceptions/FetchTimeoutError';
|
|
14
|
+
export { default as PaywallError } from './exceptions/PaywallError';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* This will, if necessary, trigger a redirect to www.aid.no and return
|
|
@@ -31,7 +33,6 @@ export const saveStorage = (storage: { [index: string]: Object }) => {
|
|
|
31
33
|
dispatch(new CustomEvent(AmediaUserEvents.SAVE_STORAGE, { detail: storage }));
|
|
32
34
|
};
|
|
33
35
|
|
|
34
|
-
// @ts-ignore
|
|
35
36
|
if (!getGlobalThis().amediaUserTestMode) {
|
|
36
37
|
listenForStateRequests();
|
|
37
38
|
listenForUserAttributeRequests();
|
package/src/utils/log.spec.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import log, { Logger, setLogger } from './log';
|
|
2
|
+
import { version } from '../../eik.json';
|
|
2
3
|
|
|
3
4
|
describe('Log', () => {
|
|
4
5
|
let logger: Logger;
|
|
@@ -23,6 +24,7 @@ describe('Log', () => {
|
|
|
23
24
|
expect(logger[level]).toHaveBeenCalledWith(expect.anything(), {
|
|
24
25
|
...context,
|
|
25
26
|
origin: '@amedia/user',
|
|
27
|
+
originVersion: version,
|
|
26
28
|
});
|
|
27
29
|
});
|
|
28
30
|
}
|
package/src/utils/log.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import mercury from '../clients/mercuryLog';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { version } from '../../eik.json';
|
|
2
4
|
|
|
3
5
|
export type Logger = {
|
|
4
6
|
debug: (message: string | Error, context?: any) => void;
|
|
@@ -62,6 +64,7 @@ const processIncomingLogData = async (
|
|
|
62
64
|
typeof message === 'string' ? message : message.message;
|
|
63
65
|
const internalContext: Record<string, unknown> = {
|
|
64
66
|
origin: '@amedia/user',
|
|
67
|
+
originVersion: version,
|
|
65
68
|
};
|
|
66
69
|
if (message instanceof Error) {
|
|
67
70
|
internalContext.error = rewriteErrorObject(message);
|