@frontegg/redux-store 7.49.0 → 7.50.0

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.
@@ -1,5 +1,5 @@
1
1
  import { FronteggState, RestApi, RetryConfig, SharedActions, WithCallback, WithRetryConfig } from '../../../interfaces';
2
- import { CaptchaPolicyState, GlobalPolicyState, LockoutPolicyState, MfaPolicyState, PasswordHistoryPolicyState, PasswordPolicyState, PublicAuthStrategyPolicyState, PublicPolicyState, SaveSecurityPolicyLockoutPayload, SaveSecurityPolicyMfaPayload, SaveSecurityPolicyPasswordHistoryPayload, SecurityPolicyState } from './interfaces';
2
+ import { CaptchaPolicyState, GlobalPolicyState, LockoutPolicyState, MfaPolicyState, PasswordHistoryPolicyState, PasswordRotationPolicyState, PasswordPolicyState, PublicAuthStrategyPolicyState, PublicPolicyState, SaveSecurityPolicyLockoutPayload, SaveSecurityPolicyMfaPayload, SaveSecurityPolicyPasswordHistoryPayload, SaveSecurityPolicyPasswordRotationPayload, SecurityPolicyState } from './interfaces';
3
3
  import { IAuthStrategiesConfig, IVendorConfig, TestConfig } from '@frontegg/rest-api';
4
4
  declare const _default: (store: FronteggState, api: RestApi, sharedActions: SharedActions) => {
5
5
  setSecurityPolicyState: (state: Partial<SecurityPolicyState>) => void;
@@ -12,6 +12,7 @@ declare const _default: (store: FronteggState, api: RestApi, sharedActions: Shar
12
12
  setSecurityPolicyCaptchaState: (state: Partial<CaptchaPolicyState>) => void;
13
13
  setSecurityPolicyPasswordHistoryState: (state: Partial<PasswordHistoryPolicyState>) => void;
14
14
  setSecurityPolicyVendorPasswordHistoryState: (state: Partial<PasswordHistoryPolicyState>) => void;
15
+ setSecurityPolicyPasswordRotationState: (state: Partial<PasswordRotationPolicyState>) => void;
15
16
  resetSecurityPolicyState: () => void;
16
17
  setSecurityPolicyPasswordState: (state: Partial<PasswordPolicyState>) => void;
17
18
  setSecurityPolicyAuthStrategyPublicState: (state: Partial<PublicAuthStrategyPolicyState>) => void;
@@ -26,10 +27,12 @@ declare const _default: (store: FronteggState, api: RestApi, sharedActions: Shar
26
27
  loadSecurityPolicyCaptcha: (payload?: WithRetryConfig<{}>) => Promise<void>;
27
28
  loadSecurityPolicyPasswordHistory: () => Promise<void>;
28
29
  loadSecurityPolicyVendorPasswordHistory: (payload?: WithRetryConfig<{}>) => Promise<void>;
30
+ loadSecurityPolicyPasswordRotation: () => Promise<void>;
29
31
  loadPublicAuthStrategiesPolicy: (payload?: WithCallback<WithRetryConfig<{}>, IAuthStrategiesConfig>) => Promise<void>;
30
32
  saveSecurityPolicyMfa: (payload: SaveSecurityPolicyMfaPayload) => Promise<void>;
31
33
  saveSecurityPolicyLockout: (payload: SaveSecurityPolicyLockoutPayload) => Promise<void>;
32
34
  saveSecurityPolicyPasswordHistory: (payload: SaveSecurityPolicyPasswordHistoryPayload) => Promise<void>;
35
+ saveSecurityPolicyPasswordRotation: (payload: SaveSecurityPolicyPasswordRotationPayload) => Promise<void>;
33
36
  __getSecurityPolicyPublicStateWithCustomLogin: (securityPolicyPublicState?: IVendorConfig, retryConfig?: RetryConfig) => Promise<IVendorConfig | undefined>;
34
37
  };
35
38
  export default _default;
@@ -2,9 +2,11 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["callback"],
4
4
  _excluded2 = ["callback"],
5
- _excluded3 = ["callback"];
5
+ _excluded3 = ["callback"],
6
+ _excluded4 = ["callback"];
6
7
  import { deepResetState, errorHandler, retryIfNeeded } from '../../../helpers';
7
8
  import { initialState } from './state';
9
+ import { daysToMinutes, minutesToDays } from './helpers/timeConvertors';
8
10
  export default ((store, api, sharedActions) => {
9
11
  const actions = sharedActions;
10
12
 
@@ -91,6 +93,9 @@ export default ((store, api, sharedActions) => {
91
93
  const setSecurityPolicyVendorPasswordHistoryState = state => {
92
94
  Object.assign(store.auth.securityPolicyState.vendorPasswordHistoryPolicy, state);
93
95
  };
96
+ const setSecurityPolicyPasswordRotationState = state => {
97
+ Object.assign(store.auth.securityPolicyState.passwordRotationPolicy, state);
98
+ };
94
99
  const setSecurityPolicyPasswordState = state => {
95
100
  Object.assign(store.auth.securityPolicyState.passwordPolicy, state);
96
101
  };
@@ -297,6 +302,30 @@ export default ((store, api, sharedActions) => {
297
302
  });
298
303
  }
299
304
  };
305
+ const loadSecurityPolicyPasswordRotation = async () => {
306
+ setSecurityPolicyPasswordRotationState({
307
+ loading: true,
308
+ error: null
309
+ });
310
+ try {
311
+ const policy = await api.securityPolicy.getPasswordRotationPolicy();
312
+ const vendorPolicy = await api.securityPolicy.getVendorPasswordRotationPolicy();
313
+ policy.notificationPeriod = minutesToDays(policy.notificationPeriod);
314
+ const vendorPolicyInDays = minutesToDays(vendorPolicy.rotationPeriod);
315
+ const policyInDays = minutesToDays(policy.rotationPeriod);
316
+ policy.rotationPeriod = Math.min(vendorPolicyInDays, policyInDays);
317
+ policy.vendorRotationPeriod = vendorPolicyInDays;
318
+ setSecurityPolicyPasswordRotationState({
319
+ policy,
320
+ loading: false
321
+ });
322
+ } catch (e) {
323
+ setSecurityPolicyPasswordRotationState({
324
+ error: errorHandler(e),
325
+ loading: false
326
+ });
327
+ }
328
+ };
300
329
  const loadPublicAuthStrategiesPolicy = async payload => {
301
330
  setSecurityPolicyAuthStrategyPublicState({
302
331
  loading: true,
@@ -392,6 +421,33 @@ export default ((store, api, sharedActions) => {
392
421
  callback == null ? void 0 : callback(null, e);
393
422
  }
394
423
  };
424
+ const saveSecurityPolicyPasswordRotation = async payload => {
425
+ const {
426
+ callback
427
+ } = payload,
428
+ newSecurityPolicy = _objectWithoutPropertiesLoose(payload, _excluded4);
429
+ setSecurityPolicyPasswordRotationState({
430
+ saving: true,
431
+ error: null
432
+ });
433
+ try {
434
+ const policy = await api.securityPolicy.savePasswordRotationPolicy(_extends({}, newSecurityPolicy, {
435
+ notificationPeriod: daysToMinutes(newSecurityPolicy.notificationPeriod),
436
+ rotationPeriod: daysToMinutes(newSecurityPolicy.rotationPeriod)
437
+ }));
438
+ setSecurityPolicyPasswordRotationState({
439
+ policy: newSecurityPolicy,
440
+ saving: false
441
+ });
442
+ callback == null ? void 0 : callback(policy);
443
+ } catch (e) {
444
+ setSecurityPolicyPasswordRotationState({
445
+ saving: false,
446
+ error: errorHandler(e)
447
+ });
448
+ callback == null ? void 0 : callback(null, e);
449
+ }
450
+ };
395
451
  return {
396
452
  // reducers
397
453
  setSecurityPolicyState,
@@ -404,6 +460,7 @@ export default ((store, api, sharedActions) => {
404
460
  setSecurityPolicyCaptchaState,
405
461
  setSecurityPolicyPasswordHistoryState,
406
462
  setSecurityPolicyVendorPasswordHistoryState,
463
+ setSecurityPolicyPasswordRotationState,
407
464
  resetSecurityPolicyState,
408
465
  setSecurityPolicyPasswordState,
409
466
  setSecurityPolicyAuthStrategyPublicState,
@@ -419,10 +476,12 @@ export default ((store, api, sharedActions) => {
419
476
  loadSecurityPolicyCaptcha,
420
477
  loadSecurityPolicyPasswordHistory,
421
478
  loadSecurityPolicyVendorPasswordHistory,
479
+ loadSecurityPolicyPasswordRotation,
422
480
  loadPublicAuthStrategiesPolicy,
423
481
  saveSecurityPolicyMfa,
424
482
  saveSecurityPolicyLockout,
425
483
  saveSecurityPolicyPasswordHistory,
484
+ saveSecurityPolicyPasswordRotation,
426
485
  // protected
427
486
  __getSecurityPolicyPublicStateWithCustomLogin
428
487
  };
@@ -0,0 +1 @@
1
+ export declare const oneDayInMinutes: number;
@@ -0,0 +1 @@
1
+ export const oneDayInMinutes = 24 * 60;
@@ -0,0 +1,2 @@
1
+ export declare const minutesToDays: (minutes: number) => number;
2
+ export declare const daysToMinutes: (days: number) => number;
@@ -0,0 +1,7 @@
1
+ import { oneDayInMinutes } from '../consts';
2
+ export const minutesToDays = minutes => {
3
+ return Math.floor(minutes / oneDayInMinutes);
4
+ };
5
+ export const daysToMinutes = days => {
6
+ return days * oneDayInMinutes;
7
+ };
@@ -1,5 +1,5 @@
1
1
  import { WithCallback, WithStatus } from '../../../interfaces';
2
- import { ISaveSecurityPolicyLockout, ISaveSecurityPolicyMfa, ISaveSecurityPolicyPasswordHistory, ISecurityPolicy, ISecurityPolicyCaptcha, ISecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyPasswordHistory, ISecurityPolicyPasswordConfig, IVendorConfig, IAuthStrategiesConfig } from '@frontegg/rest-api';
2
+ import { ISaveSecurityPolicyLockout, ISaveSecurityPolicyMfa, ISaveSecurityPolicyPasswordHistory, ISaveSecurityPolicyPasswordRotation, ISecurityPolicy, ISecurityPolicyCaptcha, ISecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyPasswordHistory, ISecurityPolicyPasswordRotation, ISecurityPolicyPasswordConfig, IVendorConfig, IAuthStrategiesConfig } from '@frontegg/rest-api';
3
3
  type PolicyState<T> = WithStatus & {
4
4
  policy?: T;
5
5
  };
@@ -9,6 +9,7 @@ export type MfaPolicyState = PolicyState<ISecurityPolicyMfa>;
9
9
  export type LockoutPolicyState = PolicyState<ISecurityPolicyLockout>;
10
10
  export type CaptchaPolicyState = PolicyState<ISecurityPolicyCaptcha | null>;
11
11
  export type PasswordHistoryPolicyState = PolicyState<ISecurityPolicyPasswordHistory>;
12
+ export type PasswordRotationPolicyState = PolicyState<ISecurityPolicyPasswordRotation>;
12
13
  export type PasswordPolicyState = PolicyState<ISecurityPolicyPasswordConfig>;
13
14
  export type PublicAuthStrategyPolicyState = PolicyState<IAuthStrategiesConfig>;
14
15
  export interface SecurityPolicyState {
@@ -20,6 +21,7 @@ export interface SecurityPolicyState {
20
21
  vendorLockoutPolicy: LockoutPolicyState;
21
22
  captchaPolicy: CaptchaPolicyState;
22
23
  passwordHistoryPolicy: PasswordHistoryPolicyState;
24
+ passwordRotationPolicy: PasswordRotationPolicyState;
23
25
  vendorPasswordHistoryPolicy: PasswordHistoryPolicyState;
24
26
  passwordPolicy: PasswordPolicyState;
25
27
  publicAuthStrategyPolicy: PublicAuthStrategyPolicyState;
@@ -27,4 +29,5 @@ export interface SecurityPolicyState {
27
29
  export type SaveSecurityPolicyMfaPayload = WithCallback<ISaveSecurityPolicyMfa, ISecurityPolicyMfa>;
28
30
  export type SaveSecurityPolicyLockoutPayload = WithCallback<ISaveSecurityPolicyLockout, ISecurityPolicyLockout>;
29
31
  export type SaveSecurityPolicyPasswordHistoryPayload = WithCallback<ISaveSecurityPolicyPasswordHistory, ISecurityPolicyPasswordHistory>;
32
+ export type SaveSecurityPolicyPasswordRotationPayload = WithCallback<ISaveSecurityPolicyPasswordRotation, ISecurityPolicyPasswordRotation>;
30
33
  export {};
@@ -32,6 +32,9 @@ export const initialState = {
32
32
  },
33
33
  publicAuthStrategyPolicy: {
34
34
  loading: true
35
+ },
36
+ passwordRotationPolicy: {
37
+ loading: true
35
38
  }
36
39
  };
37
40
  export default (overrideState => createProxy(initialState, overrideState));
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.49.0
1
+ /** @license Frontegg v7.50.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -11,6 +11,7 @@ declare const _default: (store: FronteggState, api: RestApi, actions: SharedActi
11
11
  setSecurityPolicyCaptchaState: (state: Partial<import("../../../auth").CaptchaPolicyState>) => void;
12
12
  setSecurityPolicyPasswordHistoryState: (state: Partial<import("../../../auth").PasswordHistoryPolicyState>) => void;
13
13
  setSecurityPolicyVendorPasswordHistoryState: (state: Partial<import("../../../auth").PasswordHistoryPolicyState>) => void;
14
+ setSecurityPolicyPasswordRotationState: (state: Partial<import("../../../auth").PasswordRotationPolicyState>) => void;
14
15
  resetSecurityPolicyState: () => void;
15
16
  setSecurityPolicyPasswordState: (state: Partial<import("../../../auth").PasswordPolicyState>) => void;
16
17
  setSecurityPolicyAuthStrategyPublicState: (state: Partial<import("../../../auth").PublicAuthStrategyPolicyState>) => void;
@@ -25,10 +26,12 @@ declare const _default: (store: FronteggState, api: RestApi, actions: SharedActi
25
26
  loadSecurityPolicyCaptcha: (payload?: import("../../../interfaces").WithRetryConfig<{}>) => Promise<void>;
26
27
  loadSecurityPolicyPasswordHistory: () => Promise<void>;
27
28
  loadSecurityPolicyVendorPasswordHistory: (payload?: import("../../../interfaces").WithRetryConfig<{}>) => Promise<void>;
29
+ loadSecurityPolicyPasswordRotation: () => Promise<void>;
28
30
  loadPublicAuthStrategiesPolicy: (payload?: import("../../../interfaces").WithCallback<import("../../../interfaces").WithRetryConfig<{}>, import("@frontegg/rest-api").IAuthStrategiesConfig>) => Promise<void>;
29
31
  saveSecurityPolicyMfa: (payload: SaveSecurityPolicyMfaPayload) => Promise<void>;
30
32
  saveSecurityPolicyLockout: (payload: SaveSecurityPolicyLockoutPayload) => Promise<void>;
31
33
  saveSecurityPolicyPasswordHistory: (payload: SaveSecurityPolicyPasswordHistoryPayload) => Promise<void>;
34
+ saveSecurityPolicyPasswordRotation: (payload: import("../../../auth").SaveSecurityPolicyPasswordRotationPayload) => Promise<void>;
32
35
  __getSecurityPolicyPublicStateWithCustomLogin: (securityPolicyPublicState?: import("@frontegg/rest-api").IVendorConfig, retryConfig?: import("../../../interfaces").RetryConfig) => Promise<import("@frontegg/rest-api").IVendorConfig | undefined>;
33
36
  };
34
37
  export default _default;
@@ -9,9 +9,11 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _helpers = require("../../../helpers");
11
11
  var _state = require("./state");
12
+ var _timeConvertors = require("./helpers/timeConvertors");
12
13
  const _excluded = ["callback"],
13
14
  _excluded2 = ["callback"],
14
- _excluded3 = ["callback"];
15
+ _excluded3 = ["callback"],
16
+ _excluded4 = ["callback"];
15
17
  var _default = (store, api, sharedActions) => {
16
18
  const actions = sharedActions;
17
19
 
@@ -98,6 +100,9 @@ var _default = (store, api, sharedActions) => {
98
100
  const setSecurityPolicyVendorPasswordHistoryState = state => {
99
101
  Object.assign(store.auth.securityPolicyState.vendorPasswordHistoryPolicy, state);
100
102
  };
103
+ const setSecurityPolicyPasswordRotationState = state => {
104
+ Object.assign(store.auth.securityPolicyState.passwordRotationPolicy, state);
105
+ };
101
106
  const setSecurityPolicyPasswordState = state => {
102
107
  Object.assign(store.auth.securityPolicyState.passwordPolicy, state);
103
108
  };
@@ -304,6 +309,30 @@ var _default = (store, api, sharedActions) => {
304
309
  });
305
310
  }
306
311
  };
312
+ const loadSecurityPolicyPasswordRotation = async () => {
313
+ setSecurityPolicyPasswordRotationState({
314
+ loading: true,
315
+ error: null
316
+ });
317
+ try {
318
+ const policy = await api.securityPolicy.getPasswordRotationPolicy();
319
+ const vendorPolicy = await api.securityPolicy.getVendorPasswordRotationPolicy();
320
+ policy.notificationPeriod = (0, _timeConvertors.minutesToDays)(policy.notificationPeriod);
321
+ const vendorPolicyInDays = (0, _timeConvertors.minutesToDays)(vendorPolicy.rotationPeriod);
322
+ const policyInDays = (0, _timeConvertors.minutesToDays)(policy.rotationPeriod);
323
+ policy.rotationPeriod = Math.min(vendorPolicyInDays, policyInDays);
324
+ policy.vendorRotationPeriod = vendorPolicyInDays;
325
+ setSecurityPolicyPasswordRotationState({
326
+ policy,
327
+ loading: false
328
+ });
329
+ } catch (e) {
330
+ setSecurityPolicyPasswordRotationState({
331
+ error: (0, _helpers.errorHandler)(e),
332
+ loading: false
333
+ });
334
+ }
335
+ };
307
336
  const loadPublicAuthStrategiesPolicy = async payload => {
308
337
  setSecurityPolicyAuthStrategyPublicState({
309
338
  loading: true,
@@ -399,6 +428,33 @@ var _default = (store, api, sharedActions) => {
399
428
  callback == null ? void 0 : callback(null, e);
400
429
  }
401
430
  };
431
+ const saveSecurityPolicyPasswordRotation = async payload => {
432
+ const {
433
+ callback
434
+ } = payload,
435
+ newSecurityPolicy = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded4);
436
+ setSecurityPolicyPasswordRotationState({
437
+ saving: true,
438
+ error: null
439
+ });
440
+ try {
441
+ const policy = await api.securityPolicy.savePasswordRotationPolicy((0, _extends2.default)({}, newSecurityPolicy, {
442
+ notificationPeriod: (0, _timeConvertors.daysToMinutes)(newSecurityPolicy.notificationPeriod),
443
+ rotationPeriod: (0, _timeConvertors.daysToMinutes)(newSecurityPolicy.rotationPeriod)
444
+ }));
445
+ setSecurityPolicyPasswordRotationState({
446
+ policy: newSecurityPolicy,
447
+ saving: false
448
+ });
449
+ callback == null ? void 0 : callback(policy);
450
+ } catch (e) {
451
+ setSecurityPolicyPasswordRotationState({
452
+ saving: false,
453
+ error: (0, _helpers.errorHandler)(e)
454
+ });
455
+ callback == null ? void 0 : callback(null, e);
456
+ }
457
+ };
402
458
  return {
403
459
  // reducers
404
460
  setSecurityPolicyState,
@@ -411,6 +467,7 @@ var _default = (store, api, sharedActions) => {
411
467
  setSecurityPolicyCaptchaState,
412
468
  setSecurityPolicyPasswordHistoryState,
413
469
  setSecurityPolicyVendorPasswordHistoryState,
470
+ setSecurityPolicyPasswordRotationState,
414
471
  resetSecurityPolicyState,
415
472
  setSecurityPolicyPasswordState,
416
473
  setSecurityPolicyAuthStrategyPublicState,
@@ -426,10 +483,12 @@ var _default = (store, api, sharedActions) => {
426
483
  loadSecurityPolicyCaptcha,
427
484
  loadSecurityPolicyPasswordHistory,
428
485
  loadSecurityPolicyVendorPasswordHistory,
486
+ loadSecurityPolicyPasswordRotation,
429
487
  loadPublicAuthStrategiesPolicy,
430
488
  saveSecurityPolicyMfa,
431
489
  saveSecurityPolicyLockout,
432
490
  saveSecurityPolicyPasswordHistory,
491
+ saveSecurityPolicyPasswordRotation,
433
492
  // protected
434
493
  __getSecurityPolicyPublicStateWithCustomLogin
435
494
  };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.oneDayInMinutes = void 0;
7
+ const oneDayInMinutes = 24 * 60;
8
+ exports.oneDayInMinutes = oneDayInMinutes;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.minutesToDays = exports.daysToMinutes = void 0;
7
+ var _consts = require("../consts");
8
+ const minutesToDays = minutes => {
9
+ return Math.floor(minutes / _consts.oneDayInMinutes);
10
+ };
11
+ exports.minutesToDays = minutesToDays;
12
+ const daysToMinutes = days => {
13
+ return days * _consts.oneDayInMinutes;
14
+ };
15
+ exports.daysToMinutes = daysToMinutes;
@@ -38,6 +38,9 @@ const initialState = {
38
38
  },
39
39
  publicAuthStrategyPolicy: {
40
40
  loading: true
41
+ },
42
+ passwordRotationPolicy: {
43
+ loading: true
41
44
  }
42
45
  };
43
46
  exports.initialState = initialState;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.49.0
1
+ /** @license Frontegg v7.50.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -7,13 +7,13 @@ exports.default = void 0;
7
7
  class FronteggNativeModule {
8
8
  constructor() {
9
9
  this.loginWithSSO = email => {
10
- if (this.isWebkitAvailable()) {
10
+ if (this.isIOSNativeBridgeAvailable()) {
11
11
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
12
12
  (_window$webkit = window.webkit) == null ? void 0 : (_window$webkit$messag = _window$webkit.messageHandlers) == null ? void 0 : (_window$webkit$messag2 = _window$webkit$messag.FronteggNativeBridge) == null ? void 0 : _window$webkit$messag2.postMessage(JSON.stringify({
13
13
  action: 'loginWithSSO',
14
14
  payload: email
15
15
  }));
16
- } else if (this.isJsInterfaceAvailable()) {
16
+ } else if (this.isAndroidNativeBridgeAvailable()) {
17
17
  var _window$FronteggNativ;
18
18
  (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(email);
19
19
  } else {
@@ -21,13 +21,13 @@ class FronteggNativeModule {
21
21
  }
22
22
  };
23
23
  this.loginWithSocialLogin = url => {
24
- if (this.isWebkitAvailable()) {
24
+ if (this.isIOSNativeBridgeAvailable()) {
25
25
  var _window$webkit2, _window$webkit2$messa, _window$webkit2$messa2;
26
26
  (_window$webkit2 = window.webkit) == null ? void 0 : (_window$webkit2$messa = _window$webkit2.messageHandlers) == null ? void 0 : (_window$webkit2$messa2 = _window$webkit2$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit2$messa2.postMessage(JSON.stringify({
27
27
  action: 'loginWithSocialLogin',
28
28
  payload: url
29
29
  }));
30
- } else if (this.isJsInterfaceAvailable()) {
30
+ } else if (this.isAndroidNativeBridgeAvailable()) {
31
31
  var _window$FronteggNativ2;
32
32
  (_window$FronteggNativ2 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ2.loginWithSocialLogin(url);
33
33
  } else {
@@ -35,13 +35,13 @@ class FronteggNativeModule {
35
35
  }
36
36
  };
37
37
  this.loginWithSocialLoginProvider = provider => {
38
- if (this.isWebkitAvailable()) {
38
+ if (this.isIOSNativeBridgeAvailable()) {
39
39
  var _window$webkit3, _window$webkit3$messa, _window$webkit3$messa2;
40
40
  (_window$webkit3 = window.webkit) == null ? void 0 : (_window$webkit3$messa = _window$webkit3.messageHandlers) == null ? void 0 : (_window$webkit3$messa2 = _window$webkit3$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit3$messa2.postMessage(JSON.stringify({
41
41
  action: 'loginWithSocialLoginProvider',
42
42
  payload: provider
43
43
  }));
44
- } else if (this.isJsInterfaceAvailable()) {
44
+ } else if (this.isAndroidNativeBridgeAvailable()) {
45
45
  var _window$FronteggNativ3;
46
46
  (_window$FronteggNativ3 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ3.loginWithSocialLoginProvider(provider);
47
47
  } else {
@@ -49,13 +49,13 @@ class FronteggNativeModule {
49
49
  }
50
50
  };
51
51
  this.loginWithCustomSocialLoginProvider = providerId => {
52
- if (this.isWebkitAvailable()) {
52
+ if (this.isIOSNativeBridgeAvailable()) {
53
53
  var _window$webkit4, _window$webkit4$messa, _window$webkit4$messa2;
54
54
  (_window$webkit4 = window.webkit) == null ? void 0 : (_window$webkit4$messa = _window$webkit4.messageHandlers) == null ? void 0 : (_window$webkit4$messa2 = _window$webkit4$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit4$messa2.postMessage(JSON.stringify({
55
55
  action: 'loginWithCustomSocialLoginProvider',
56
56
  payload: providerId
57
57
  }));
58
- } else if (this.isJsInterfaceAvailable()) {
58
+ } else if (this.isAndroidNativeBridgeAvailable()) {
59
59
  var _window$FronteggNativ4;
60
60
  (_window$FronteggNativ4 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ4.loginWithCustomSocialLoginProvider(providerId);
61
61
  } else {
@@ -63,7 +63,7 @@ class FronteggNativeModule {
63
63
  }
64
64
  };
65
65
  this.suggestSavePassword = (email, password) => {
66
- if (this.isWebkitAvailable()) {
66
+ if (this.isIOSNativeBridgeAvailable()) {
67
67
  var _window$webkit5, _window$webkit5$messa, _window$webkit5$messa2;
68
68
  (_window$webkit5 = window.webkit) == null ? void 0 : (_window$webkit5$messa = _window$webkit5.messageHandlers) == null ? void 0 : (_window$webkit5$messa2 = _window$webkit5$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit5$messa2.postMessage(JSON.stringify({
69
69
  action: 'suggestSavePassword',
@@ -72,7 +72,7 @@ class FronteggNativeModule {
72
72
  password
73
73
  })
74
74
  }));
75
- } else if (this.isJsInterfaceAvailable()) {
75
+ } else if (this.isAndroidNativeBridgeAvailable()) {
76
76
  var _window$FronteggNativ5;
77
77
  (_window$FronteggNativ5 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ5.suggestSavePassword(email, password);
78
78
  } else {
@@ -84,11 +84,11 @@ class FronteggNativeModule {
84
84
  return (_window$FronteggNativ6 = (_window$FronteggNativ7 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ7['shouldPromptSocialLoginConsent']) != null ? _window$FronteggNativ6 : false;
85
85
  };
86
86
  }
87
- isWebkitAvailable() {
87
+ isIOSNativeBridgeAvailable() {
88
88
  var _window$webkit6, _window$webkit6$messa;
89
89
  return ((_window$webkit6 = window.webkit) == null ? void 0 : (_window$webkit6$messa = _window$webkit6.messageHandlers) == null ? void 0 : _window$webkit6$messa.FronteggNativeBridge) != null;
90
90
  }
91
- isJsInterfaceAvailable() {
91
+ isAndroidNativeBridgeAvailable() {
92
92
  return window.FronteggNativeBridge != null;
93
93
  }
94
94
 
@@ -111,7 +111,7 @@ class FronteggNativeModule {
111
111
  return this.isAvailable('suggestSavePassword');
112
112
  }
113
113
  isAvailable(method) {
114
- if (this.isWebkitAvailable() || this.isJsInterfaceAvailable()) {
114
+ if (this.isIOSNativeBridgeAvailable() || this.isAndroidNativeBridgeAvailable()) {
115
115
  var _window$FronteggNativ8, _window$FronteggNativ9;
116
116
  return (_window$FronteggNativ8 = (_window$FronteggNativ9 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ9[method]) != null ? _window$FronteggNativ8 : false;
117
117
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.49.0",
3
+ "version": "7.50.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
9
  "@frontegg/entitlements-javascript-commons": "1.1.2",
10
- "@frontegg/rest-api": "7.49.0",
10
+ "@frontegg/rest-api": "7.50.0",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",
@@ -19,8 +19,8 @@ declare global {
19
19
  }
20
20
  }
21
21
  declare class FronteggNativeModule {
22
- private isWebkitAvailable;
23
- private isJsInterfaceAvailable;
22
+ isIOSNativeBridgeAvailable(): boolean;
23
+ isAndroidNativeBridgeAvailable(): boolean;
24
24
  /**
25
25
  * @deprecated use isSocialLoginProviderAvailable instead for pkce flow in mobile
26
26
  */
@@ -1,13 +1,13 @@
1
1
  class FronteggNativeModule {
2
2
  constructor() {
3
3
  this.loginWithSSO = email => {
4
- if (this.isWebkitAvailable()) {
4
+ if (this.isIOSNativeBridgeAvailable()) {
5
5
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
6
6
  (_window$webkit = window.webkit) == null ? void 0 : (_window$webkit$messag = _window$webkit.messageHandlers) == null ? void 0 : (_window$webkit$messag2 = _window$webkit$messag.FronteggNativeBridge) == null ? void 0 : _window$webkit$messag2.postMessage(JSON.stringify({
7
7
  action: 'loginWithSSO',
8
8
  payload: email
9
9
  }));
10
- } else if (this.isJsInterfaceAvailable()) {
10
+ } else if (this.isAndroidNativeBridgeAvailable()) {
11
11
  var _window$FronteggNativ;
12
12
  (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(email);
13
13
  } else {
@@ -15,13 +15,13 @@ class FronteggNativeModule {
15
15
  }
16
16
  };
17
17
  this.loginWithSocialLogin = url => {
18
- if (this.isWebkitAvailable()) {
18
+ if (this.isIOSNativeBridgeAvailable()) {
19
19
  var _window$webkit2, _window$webkit2$messa, _window$webkit2$messa2;
20
20
  (_window$webkit2 = window.webkit) == null ? void 0 : (_window$webkit2$messa = _window$webkit2.messageHandlers) == null ? void 0 : (_window$webkit2$messa2 = _window$webkit2$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit2$messa2.postMessage(JSON.stringify({
21
21
  action: 'loginWithSocialLogin',
22
22
  payload: url
23
23
  }));
24
- } else if (this.isJsInterfaceAvailable()) {
24
+ } else if (this.isAndroidNativeBridgeAvailable()) {
25
25
  var _window$FronteggNativ2;
26
26
  (_window$FronteggNativ2 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ2.loginWithSocialLogin(url);
27
27
  } else {
@@ -29,13 +29,13 @@ class FronteggNativeModule {
29
29
  }
30
30
  };
31
31
  this.loginWithSocialLoginProvider = provider => {
32
- if (this.isWebkitAvailable()) {
32
+ if (this.isIOSNativeBridgeAvailable()) {
33
33
  var _window$webkit3, _window$webkit3$messa, _window$webkit3$messa2;
34
34
  (_window$webkit3 = window.webkit) == null ? void 0 : (_window$webkit3$messa = _window$webkit3.messageHandlers) == null ? void 0 : (_window$webkit3$messa2 = _window$webkit3$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit3$messa2.postMessage(JSON.stringify({
35
35
  action: 'loginWithSocialLoginProvider',
36
36
  payload: provider
37
37
  }));
38
- } else if (this.isJsInterfaceAvailable()) {
38
+ } else if (this.isAndroidNativeBridgeAvailable()) {
39
39
  var _window$FronteggNativ3;
40
40
  (_window$FronteggNativ3 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ3.loginWithSocialLoginProvider(provider);
41
41
  } else {
@@ -43,13 +43,13 @@ class FronteggNativeModule {
43
43
  }
44
44
  };
45
45
  this.loginWithCustomSocialLoginProvider = providerId => {
46
- if (this.isWebkitAvailable()) {
46
+ if (this.isIOSNativeBridgeAvailable()) {
47
47
  var _window$webkit4, _window$webkit4$messa, _window$webkit4$messa2;
48
48
  (_window$webkit4 = window.webkit) == null ? void 0 : (_window$webkit4$messa = _window$webkit4.messageHandlers) == null ? void 0 : (_window$webkit4$messa2 = _window$webkit4$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit4$messa2.postMessage(JSON.stringify({
49
49
  action: 'loginWithCustomSocialLoginProvider',
50
50
  payload: providerId
51
51
  }));
52
- } else if (this.isJsInterfaceAvailable()) {
52
+ } else if (this.isAndroidNativeBridgeAvailable()) {
53
53
  var _window$FronteggNativ4;
54
54
  (_window$FronteggNativ4 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ4.loginWithCustomSocialLoginProvider(providerId);
55
55
  } else {
@@ -57,7 +57,7 @@ class FronteggNativeModule {
57
57
  }
58
58
  };
59
59
  this.suggestSavePassword = (email, password) => {
60
- if (this.isWebkitAvailable()) {
60
+ if (this.isIOSNativeBridgeAvailable()) {
61
61
  var _window$webkit5, _window$webkit5$messa, _window$webkit5$messa2;
62
62
  (_window$webkit5 = window.webkit) == null ? void 0 : (_window$webkit5$messa = _window$webkit5.messageHandlers) == null ? void 0 : (_window$webkit5$messa2 = _window$webkit5$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit5$messa2.postMessage(JSON.stringify({
63
63
  action: 'suggestSavePassword',
@@ -66,7 +66,7 @@ class FronteggNativeModule {
66
66
  password
67
67
  })
68
68
  }));
69
- } else if (this.isJsInterfaceAvailable()) {
69
+ } else if (this.isAndroidNativeBridgeAvailable()) {
70
70
  var _window$FronteggNativ5;
71
71
  (_window$FronteggNativ5 = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ5.suggestSavePassword(email, password);
72
72
  } else {
@@ -78,11 +78,11 @@ class FronteggNativeModule {
78
78
  return (_window$FronteggNativ6 = (_window$FronteggNativ7 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ7['shouldPromptSocialLoginConsent']) != null ? _window$FronteggNativ6 : false;
79
79
  };
80
80
  }
81
- isWebkitAvailable() {
81
+ isIOSNativeBridgeAvailable() {
82
82
  var _window$webkit6, _window$webkit6$messa;
83
83
  return ((_window$webkit6 = window.webkit) == null ? void 0 : (_window$webkit6$messa = _window$webkit6.messageHandlers) == null ? void 0 : _window$webkit6$messa.FronteggNativeBridge) != null;
84
84
  }
85
- isJsInterfaceAvailable() {
85
+ isAndroidNativeBridgeAvailable() {
86
86
  return window.FronteggNativeBridge != null;
87
87
  }
88
88
 
@@ -105,7 +105,7 @@ class FronteggNativeModule {
105
105
  return this.isAvailable('suggestSavePassword');
106
106
  }
107
107
  isAvailable(method) {
108
- if (this.isWebkitAvailable() || this.isJsInterfaceAvailable()) {
108
+ if (this.isIOSNativeBridgeAvailable() || this.isAndroidNativeBridgeAvailable()) {
109
109
  var _window$FronteggNativ8, _window$FronteggNativ9;
110
110
  return (_window$FronteggNativ8 = (_window$FronteggNativ9 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ9[method]) != null ? _window$FronteggNativ8 : false;
111
111
  }