@amedia/user 0.14.3 → 0.14.5

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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amedia/user",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
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)",
@@ -5,6 +5,7 @@ import {
5
5
  attemptPaywallAutoLogin,
6
6
  AUTOLOGIN_COOKIE_TTL,
7
7
  } from './index';
8
+ import log from '../utils/log';
8
9
  import * as location from '../utils/location';
9
10
  import * as url from '../utils/url';
10
11
  import * as cookie from '../lib/cookie';
@@ -150,7 +151,9 @@ describe('attemptAutoLoginJob', () => {
150
151
  });
151
152
 
152
153
  describe('when in aid emergency mode', () => {
154
+ let logWarnSpy: jasmine.Spy;
153
155
  beforeEach(async () => {
156
+ logWarnSpy = spyOn(log, `warn`).and.stub();
154
157
  store.merge('state', {
155
158
  emergencyMode: ['aid'],
156
159
  });
@@ -160,6 +163,15 @@ describe('attemptAutoLoginJob', () => {
160
163
  it('should not try third party auto login', () => {
161
164
  expect(thirdPartyCookie.default).not.toHaveBeenCalled();
162
165
  });
166
+
167
+ it('should log warning about being in aid emergency mode', () => {
168
+ expect(logWarnSpy).toHaveBeenCalledWith(
169
+ 'Autologin prevented. We are in aid emergency mode.',
170
+ {
171
+ emergencyModes: ['aid'],
172
+ }
173
+ );
174
+ });
163
175
  });
164
176
  });
165
177
  });
@@ -4,6 +4,7 @@ import { navigateTo } from '../utils/location';
4
4
  import { getCookie, removeCookie, setCookie } from '../lib/cookie';
5
5
  import UserDataRequest from '../lib/UserDataRequest';
6
6
  import store from '../store';
7
+ import log from '../utils/log';
7
8
 
8
9
  export type Strategies = Array<{
9
10
  name: string;
@@ -55,6 +56,9 @@ const attemptAutologin = async (strategies: Strategies) => {
55
56
 
56
57
  if (isInAidEmergencyMode()) {
57
58
  // Avoid auto-login if we are in aid emergency mode
59
+ log.warn('Autologin prevented. We are in aid emergency mode.', {
60
+ emergencyModes: store.get('state')?.emergencyMode,
61
+ });
58
62
  return;
59
63
  }
60
64
 
@@ -30,7 +30,6 @@ export const listenForActivationRequests = () => {
30
30
  });
31
31
  };
32
32
 
33
- // @ts-ignore
34
33
  if (!getGlobalThis().amediaUserTestMode) {
35
34
  listenForActivationRequests();
36
35
  }
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();