@frontegg/redux-store 6.165.0-alpha.13 → 6.165.0-alpha.14

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.
@@ -238,4 +238,3 @@ declare type DispatchedActions = {
238
238
  export declare type LoginActions = DispatchedActions;
239
239
  export { loginState, reducers as loginReducers, actions as loginActions };
240
240
  export { getRedirectUrl, getSearchParam } from './utils';
241
- export { defaultFronteggRoutes } from './consts';
@@ -139,5 +139,4 @@ const actions = {
139
139
  */
140
140
  const Matcher = {};
141
141
  export { loginState, reducers as loginReducers, actions as loginActions };
142
- export { getRedirectUrl, getSearchParam } from './utils';
143
- export { defaultFronteggRoutes } from './consts';
142
+ export { getRedirectUrl, getSearchParam } from './utils';
@@ -1,5 +1,5 @@
1
1
  import { CallEffect } from 'redux-saga/effects';
2
- import { ISamlMetadata, ResolvedTenantResult } from '@frontegg/rest-api';
2
+ import { ISamlMetadata } from '@frontegg/rest-api';
3
3
  import { AuthState } from '../interfaces';
4
4
  export declare function refreshMetadata(): Generator<import("redux-saga/effects").PutEffect<{
5
5
  payload: Partial<AuthState>;
@@ -15,12 +15,6 @@ export declare function loadSSOPublicConfigurationFunction(): Generator<import("
15
15
  }>;
16
16
  export declare function refreshToken(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<any>, void, AuthState>;
17
17
  export declare function refreshTokenForSocialLogins(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<any>, void, AuthState>;
18
- export declare function requestHostedLoginAuthorize(additionalParams?: Record<string, string>): Generator<any, void, {
19
- routes: any;
20
- context: any;
21
- onRedirectTo: any;
22
- urlStrategy: any;
23
- } & string & ResolvedTenantResult>;
24
18
  export declare function loginSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
25
19
  export { afterAuthNavigation } from './sagas/afterAuthNavigation.saga';
26
20
  export { mfaWithAuthenticator } from './sagas/mfaWithAuthenticator.saga';
@@ -37,8 +37,7 @@ import { isEntitlementsDeeplyEqual } from '../Entitlements';
37
37
  import { loadCustomLoginRoutes } from '../CustomLoginState/saga';
38
38
  import { FronteggNativeModule } from '../../toolkit';
39
39
  import { afterAuthenticationStateUpdate, shouldShowPromptPasskeys } from './saga.utils';
40
- import { afterAuthNavigation, loginWithMfa, preVerifyMFASMSForLogin, verifyMFASMSForLogin, preVerifyMFAWebAuthnForLogin, verifyMFAWebAuthnForLogin, preVerifyMFAEmailCodeForLogin, verifyMFAEmailCodeForLogin, afterStepUpAuthNavigation } from './sagas';
41
- import { SHOULD_STEP_UP_KEY } from '../StepUpState/consts';
40
+ import { afterAuthNavigation, loginWithMfa, preVerifyMFASMSForLogin, verifyMFASMSForLogin, preVerifyMFAWebAuthnForLogin, verifyMFAWebAuthnForLogin, preVerifyMFAEmailCodeForLogin, verifyMFAEmailCodeForLogin } from './sagas';
42
41
 
43
42
  /******************************************************************
44
43
  *** ****
@@ -510,7 +509,7 @@ function* refreshOrRequestHostedLoginAuthorizeV2({
510
509
  yield requestHostedLoginAuthorize(additionalParams);
511
510
  }
512
511
  }
513
- export function* requestHostedLoginAuthorize(additionalParams) {
512
+ function* requestHostedLoginAuthorize(additionalParams) {
514
513
  const {
515
514
  routes,
516
515
  context,
@@ -620,12 +619,7 @@ function* handleHostedLoginCallback({
620
619
  }));
621
620
  console.error('Failed to exchangeOAuthTokens', e);
622
621
  } finally {
623
- const isStepUpFlow = window.localStorage.getItem(SHOULD_STEP_UP_KEY);
624
- if (isStepUpFlow) {
625
- yield afterStepUpAuthNavigation();
626
- } else {
627
- yield afterAuthNavigation();
628
- }
622
+ yield afterAuthNavigation();
629
623
  }
630
624
  }
631
625
  function* changePhoneNumberWithVerification(_ref4) {
@@ -15,7 +15,3 @@ export declare const AMR_ADDITIONAL_VALUE: string[];
15
15
  * Used for scenarios when we logout for re-login and then should redirect to step up page
16
16
  */
17
17
  export declare const SHOULD_STEP_UP_KEY = "SHOULD_STEP_UP";
18
- /**
19
- * The name of the query param that contains the max age of the step up
20
- */
21
- export declare const STEP_UP_MAX_AGE_PARAM_NAME = "maxAge";
@@ -17,9 +17,4 @@ export const AMR_ADDITIONAL_VALUE = ['otp', 'sms', 'hwk'];
17
17
  * SHOULD_STEP_UP_KEY local storage key
18
18
  * Used for scenarios when we logout for re-login and then should redirect to step up page
19
19
  */
20
- export const SHOULD_STEP_UP_KEY = 'SHOULD_STEP_UP';
21
-
22
- /**
23
- * The name of the query param that contains the max age of the step up
24
- */
25
- export const STEP_UP_MAX_AGE_PARAM_NAME = 'maxAge';
20
+ export const SHOULD_STEP_UP_KEY = 'SHOULD_STEP_UP';
@@ -1,5 +1,5 @@
1
1
  import { IPreVerifyMFA, IVerifyMFASMS, IVerifyMFAEmailCode } from '@frontegg/rest-api';
2
- import { IGenerateStepUpSession, IStepUpHostedLogin, IStepUpWithAuthenticator, StepUpState } from './interfaces';
2
+ import { IGenerateStepUpSession, IStepUpWithAuthenticator, StepUpState } from './interfaces';
3
3
  import { WithCallback } from '../../interfaces';
4
4
  import { IPreVerifyMFAWebAuthNForLoginResponse, IVerifyMFAWebAuthnPayload, WithDeviceId } from '../LoginState/interfaces';
5
5
  declare const stepUpState: StepUpState;
@@ -108,7 +108,6 @@ declare const reducers: {
108
108
  };
109
109
  };
110
110
  declare const actions: {
111
- stepUpHostedLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[IStepUpHostedLogin], IStepUpHostedLogin, string, never, never>;
112
111
  generateStepUpSession: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IGenerateStepUpSession, boolean>], WithCallback<IGenerateStepUpSession, boolean>, string, never, never>;
113
112
  stepUpWithAuthenticator: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IStepUpWithAuthenticator, boolean>], WithCallback<IStepUpWithAuthenticator, boolean>, string, never, never>;
114
113
  preVerifyMFASMSForStepUp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<WithDeviceId<IPreVerifyMFA>, boolean>], WithCallback<WithDeviceId<IPreVerifyMFA>, boolean>, string, never, never>;
@@ -126,7 +125,6 @@ declare type DispatchedActions = {
126
125
  setStepUpState: (state: Partial<StepUpState>) => void;
127
126
  resetStepUpState: () => void;
128
127
  generateStepUpSession: (payload: WithCallback<IGenerateStepUpSession>) => void;
129
- stepUpHostedLogin: (payload: IStepUpHostedLogin) => void;
130
128
  stepUpWithAuthenticator: (payload: WithCallback<IStepUpWithAuthenticator>) => void;
131
129
  preVerifyMFASMSForStepUp: (payload: WithCallback<WithDeviceId<IPreVerifyMFA>>) => void;
132
130
  verifyMFASMSForStepUp: (payload: WithCallback<WithDeviceId<IVerifyMFASMS>>) => void;
@@ -138,4 +136,3 @@ declare type DispatchedActions = {
138
136
  export declare type StepUpActions = DispatchedActions;
139
137
  export { stepUpState, reducers as stepUpReducers, actions as stepUpActions };
140
138
  export * from './utils';
141
- export { STEP_UP_MAX_AGE_PARAM_NAME, SHOULD_STEP_UP_KEY } from './consts';
@@ -13,9 +13,6 @@ const reducers = {
13
13
  })
14
14
  };
15
15
  const actions = {
16
- stepUpHostedLogin: createAction(`${authStoreName}/stepUpHostedLogin`, payload => ({
17
- payload
18
- })),
19
16
  generateStepUpSession: createAction(`${authStoreName}/generateStepUpSession`, payload => ({
20
17
  payload
21
18
  })),
@@ -54,5 +51,4 @@ const actions = {
54
51
  */
55
52
  const Matcher = {};
56
53
  export { stepUpState, reducers as stepUpReducers, actions as stepUpActions };
57
- export * from './utils';
58
- export { STEP_UP_MAX_AGE_PARAM_NAME, SHOULD_STEP_UP_KEY } from './consts';
54
+ export * from './utils';
@@ -21,15 +21,3 @@ export interface IStepUpWithAuthenticator {
21
21
  mfaToken: string;
22
22
  value: string;
23
23
  }
24
- /**
25
- * Step up hosted login options
26
- */
27
- export interface IStepUpHostedLogin {
28
- maxAge?: number;
29
- }
30
- /**
31
- * Step up options (for stepUp function)
32
- */
33
- export interface StepUpOptions {
34
- maxAge?: number;
35
- }
@@ -5,7 +5,6 @@ import { preVerifyMFASMS, verifyMFASMS } from '../LoginState/sagas/mfaWithSMS.sa
5
5
  import { preVerifyMFAWebAuthn, verifyMFAWebAuthn } from '../LoginState/sagas/mfaWithWebAuthn.saga';
6
6
  import { verifyMFAEmailCode, preVerifyMFAEmailCode } from '../LoginState/sagas/mfaWithEmailCode.saga';
7
7
  import { generateStepUpSession } from './generateStepUpSession.saga';
8
- import { stepUpHostedLogin } from './stepUpHostedLogin.saga';
9
8
 
10
9
  /**
11
10
  * Step up with authenticator app
@@ -94,7 +93,6 @@ export function* preVerifyMFAEmailCodeForStepUp({
94
93
  yield preVerifyMFAEmailCode(payload, actions.setStepUpState);
95
94
  }
96
95
  export function* stepUpSagas() {
97
- yield takeLeading(actions.stepUpHostedLogin, stepUpHostedLogin);
98
96
  yield takeLeading(actions.generateStepUpSession, generateStepUpSession);
99
97
  yield takeLeading(actions.stepUpWithAuthenticator, stepUpWithAuthenticator);
100
98
  yield takeLeading(actions.preVerifyMFASMSForStepUp, preVerifyMFASMSForStepUp);
@@ -1,11 +1,8 @@
1
- import { RedirectOptions } from '@frontegg/rest-api';
2
- export interface IsSteppedUpOptions {
3
- maxAge?: number;
4
- }
5
- export interface SteppedUpJWTValues {
1
+ interface IsSteppedUpOptions {
6
2
  amr?: string[];
7
3
  acr?: string;
8
4
  auth_time?: number;
5
+ maxAge?: number;
9
6
  }
10
7
  /**
11
8
  * @param options.amr
@@ -14,16 +11,5 @@ export interface SteppedUpJWTValues {
14
11
  * @param options.maxAge - max age of step up
15
12
  * @returns true when the user is stepped up, false otherwise
16
13
  */
17
- export declare const isSteppedUp: (user?: SteppedUpJWTValues | null | undefined, { maxAge }?: IsSteppedUpOptions) => boolean;
18
- /**
19
- * Set the url and query params in the local storage FRONTEGG_AFTER_AUTH_REDIRECT_URL value
20
- */
21
- export declare function setAfterAuthRedirectUrlForStepUp(): void;
22
- /**
23
- * Redirects to the step up url with the max age param and set the redirect url in the local storage
24
- * The redirect url will be used after the step up flow is done
25
- * @param stepUpUrl - step up url to redirect to
26
- * @param onRedirectTo - redirect to function
27
- * @param maxAge - max age of step up
28
- */
29
- export declare const redirectByStepUpUrl: (stepUpUrl: string, onRedirectTo: (path: string, opts?: RedirectOptions | undefined) => void, maxAge?: number | undefined) => void;
14
+ export declare const isSteppedUp: ({ amr, acr, auth_time, maxAge }?: IsSteppedUpOptions) => boolean;
15
+ export {};
@@ -1,5 +1,4 @@
1
- import { FRONTEGG_AFTER_AUTH_REDIRECT_URL } from '../../constants';
2
- import { ACR_VALUE, AMR_MFA_VALUE, AMR_ADDITIONAL_VALUE, STEP_UP_MAX_AGE_PARAM_NAME } from './consts';
1
+ import { ACR_VALUE, AMR_MFA_VALUE, AMR_ADDITIONAL_VALUE } from './consts';
3
2
  /**
4
3
  * @param options.amr
5
4
  * @param options.acr
@@ -7,15 +6,12 @@ import { ACR_VALUE, AMR_MFA_VALUE, AMR_ADDITIONAL_VALUE, STEP_UP_MAX_AGE_PARAM_N
7
6
  * @param options.maxAge - max age of step up
8
7
  * @returns true when the user is stepped up, false otherwise
9
8
  */
10
- export const isSteppedUp = (user, {
9
+ export const isSteppedUp = ({
10
+ amr = [],
11
+ acr = '',
12
+ auth_time,
11
13
  maxAge
12
14
  } = {}) => {
13
- if (!user) return false;
14
- const {
15
- amr = [],
16
- acr = '',
17
- auth_time
18
- } = user;
19
15
  if (maxAge && auth_time) {
20
16
  // when user is logged in for a long time (more than maxAge, but jwt is still valid because it's not refreshed yet)
21
17
  const isMaxAgeValid = Date.now() / 1000 - auth_time <= maxAge;
@@ -25,27 +21,4 @@ export const isSteppedUp = (user, {
25
21
  const isAMRIncludesMFA = amr.indexOf(AMR_MFA_VALUE) !== -1;
26
22
  const isAMRIncludesMethod = AMR_ADDITIONAL_VALUE.find(method => amr.indexOf(method)) !== undefined;
27
23
  return isACRValid && isAMRIncludesMFA && isAMRIncludesMethod;
28
- };
29
-
30
- /**
31
- * Set the url and query params in the local storage FRONTEGG_AFTER_AUTH_REDIRECT_URL value
32
- */
33
- export function setAfterAuthRedirectUrlForStepUp() {
34
- const encodedRedirectUrl = window.location.pathname + window.location.search;
35
- window.localStorage.setItem(FRONTEGG_AFTER_AUTH_REDIRECT_URL, encodedRedirectUrl);
36
- }
37
-
38
- /**
39
- * Redirects to the step up url with the max age param and set the redirect url in the local storage
40
- * The redirect url will be used after the step up flow is done
41
- * @param stepUpUrl - step up url to redirect to
42
- * @param onRedirectTo - redirect to function
43
- * @param maxAge - max age of step up
44
- */
45
- export const redirectByStepUpUrl = (stepUpUrl, onRedirectTo, maxAge) => {
46
- setAfterAuthRedirectUrlForStepUp();
47
- const maxAgePart = maxAge !== undefined ? `?${STEP_UP_MAX_AGE_PARAM_NAME}=${maxAge}` : '';
48
- onRedirectTo(`${stepUpUrl}${maxAgePart}`, {
49
- refresh: false
50
- });
51
24
  };
package/auth/index.d.ts CHANGED
@@ -495,7 +495,6 @@ declare const _default: {
495
495
  } | undefined, string, never, never>;
496
496
  loginViaSocialLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("./SocialLogins/interfaces").ILoginViaSocialLoginPayload], import("./SocialLogins/interfaces").ILoginViaSocialLoginPayload, string, never, never>;
497
497
  setSocialLoginError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISetSocialLoginError], import("@frontegg/rest-api").ISetSocialLoginError, string, never, never>;
498
- stepUpHostedLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("./StepUpState/interfaces").IStepUpHostedLogin], import("./StepUpState/interfaces").IStepUpHostedLogin, string, never, never>;
499
498
  generateStepUpSession: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("./StepUpState/interfaces").IGenerateStepUpSession, boolean>], import("..").WithCallback<import("./StepUpState/interfaces").IGenerateStepUpSession, boolean>, string, never, never>;
500
499
  stepUpWithAuthenticator: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("./StepUpState/interfaces").IStepUpWithAuthenticator, boolean>], import("..").WithCallback<import("./StepUpState/interfaces").IStepUpWithAuthenticator, boolean>, string, never, never>;
501
500
  preVerifyMFASMSForStepUp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("./LoginState/interfaces").WithDeviceId<import("@frontegg/rest-api").IPreVerifyMFA>, boolean>], import("..").WithCallback<import("./LoginState/interfaces").WithDeviceId<import("@frontegg/rest-api").IPreVerifyMFA>, boolean>, string, never, never>;
package/auth/reducer.d.ts CHANGED
@@ -453,7 +453,6 @@ declare const actions: {
453
453
  } | undefined, string, never, never>;
454
454
  loginViaSocialLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import(".").ILoginViaSocialLoginPayload], import(".").ILoginViaSocialLoginPayload, string, never, never>;
455
455
  setSocialLoginError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISetSocialLoginError], import("@frontegg/rest-api").ISetSocialLoginError, string, never, never>;
456
- stepUpHostedLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import(".").IStepUpHostedLogin], import(".").IStepUpHostedLogin, string, never, never>;
457
456
  generateStepUpSession: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import(".").IGenerateStepUpSession, boolean>], import("..").WithCallback<import(".").IGenerateStepUpSession, boolean>, string, never, never>;
458
457
  stepUpWithAuthenticator: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import(".").IStepUpWithAuthenticator, boolean>], import("..").WithCallback<import(".").IStepUpWithAuthenticator, boolean>, string, never, never>;
459
458
  preVerifyMFASMSForStepUp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import(".").WithDeviceId<import("@frontegg/rest-api").IPreVerifyMFA>, boolean>], import("..").WithCallback<import(".").WithDeviceId<import("@frontegg/rest-api").IPreVerifyMFA>, boolean>, string, never, never>;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.165.0-alpha.13
1
+ /** @license Frontegg v6.165.0-alpha.14
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.
@@ -3,12 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "defaultFronteggRoutes", {
7
- enumerable: true,
8
- get: function () {
9
- return _consts.defaultFronteggRoutes;
10
- }
11
- });
12
6
  Object.defineProperty(exports, "getRedirectUrl", {
13
7
  enumerable: true,
14
8
  get: function () {
@@ -27,7 +21,6 @@ var _interfaces = require("./interfaces");
27
21
  var _utils = require("../utils");
28
22
  var _constants = require("../../constants");
29
23
  var _utils2 = require("./utils");
30
- var _consts = require("./consts");
31
24
  const loginState = {
32
25
  flow: _interfaces.LoginFlow.Login,
33
26
  step: _interfaces.LoginStep.preLogin,
@@ -22,7 +22,6 @@ Object.defineProperty(exports, "mfaWithAuthenticator", {
22
22
  exports.refreshMetadata = refreshMetadata;
23
23
  exports.refreshToken = refreshToken;
24
24
  exports.refreshTokenForSocialLogins = refreshTokenForSocialLogins;
25
- exports.requestHostedLoginAuthorize = requestHostedLoginAuthorize;
26
25
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
27
26
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
28
27
  var _effects = require("redux-saga/effects");
@@ -48,7 +47,6 @@ var _saga4 = require("../CustomLoginState/saga");
48
47
  var _toolkit = require("../../toolkit");
49
48
  var _saga5 = require("./saga.utils");
50
49
  var _sagas = require("./sagas");
51
- var _consts2 = require("../StepUpState/consts");
52
50
  var _afterAuthNavigation = require("./sagas/afterAuthNavigation.saga");
53
51
  var _mfaWithAuthenticator = require("./sagas/mfaWithAuthenticator.saga");
54
52
  const _excluded = ["callback"],
@@ -646,12 +644,7 @@ function* handleHostedLoginCallback({
646
644
  }));
647
645
  console.error('Failed to exchangeOAuthTokens', e);
648
646
  } finally {
649
- const isStepUpFlow = window.localStorage.getItem(_consts2.SHOULD_STEP_UP_KEY);
650
- if (isStepUpFlow) {
651
- yield (0, _sagas.afterStepUpAuthNavigation)();
652
- } else {
653
- yield (0, _sagas.afterAuthNavigation)();
654
- }
647
+ yield (0, _sagas.afterAuthNavigation)();
655
648
  }
656
649
  }
657
650
  function* changePhoneNumberWithVerification(_ref4) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.STEP_UP_MAX_AGE_PARAM_NAME = exports.SHOULD_STEP_UP_KEY = exports.AMR_MFA_VALUE = exports.AMR_ADDITIONAL_VALUE = exports.ACR_VALUE = void 0;
6
+ exports.SHOULD_STEP_UP_KEY = exports.AMR_MFA_VALUE = exports.AMR_ADDITIONAL_VALUE = exports.ACR_VALUE = void 0;
7
7
  /**
8
8
  * The required ACR (Authorization Context Reference) value for the step up flow
9
9
  */
@@ -27,10 +27,4 @@ const AMR_ADDITIONAL_VALUE = ['otp', 'sms', 'hwk'];
27
27
  */
28
28
  exports.AMR_ADDITIONAL_VALUE = AMR_ADDITIONAL_VALUE;
29
29
  const SHOULD_STEP_UP_KEY = 'SHOULD_STEP_UP';
30
-
31
- /**
32
- * The name of the query param that contains the max age of the step up
33
- */
34
- exports.SHOULD_STEP_UP_KEY = SHOULD_STEP_UP_KEY;
35
- const STEP_UP_MAX_AGE_PARAM_NAME = 'maxAge';
36
- exports.STEP_UP_MAX_AGE_PARAM_NAME = STEP_UP_MAX_AGE_PARAM_NAME;
30
+ exports.SHOULD_STEP_UP_KEY = SHOULD_STEP_UP_KEY;
@@ -6,22 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  var _exportNames = {
7
7
  stepUpState: true,
8
8
  stepUpReducers: true,
9
- stepUpActions: true,
10
- STEP_UP_MAX_AGE_PARAM_NAME: true,
11
- SHOULD_STEP_UP_KEY: true
9
+ stepUpActions: true
12
10
  };
13
- Object.defineProperty(exports, "SHOULD_STEP_UP_KEY", {
14
- enumerable: true,
15
- get: function () {
16
- return _consts.SHOULD_STEP_UP_KEY;
17
- }
18
- });
19
- Object.defineProperty(exports, "STEP_UP_MAX_AGE_PARAM_NAME", {
20
- enumerable: true,
21
- get: function () {
22
- return _consts.STEP_UP_MAX_AGE_PARAM_NAME;
23
- }
24
- });
25
11
  exports.stepUpState = exports.stepUpReducers = exports.stepUpActions = void 0;
26
12
  var _toolkit = require("@reduxjs/toolkit");
27
13
  var _utils = require("../utils");
@@ -38,7 +24,6 @@ Object.keys(_utils2).forEach(function (key) {
38
24
  }
39
25
  });
40
26
  });
41
- var _consts = require("./consts");
42
27
  const stepUpState = {
43
28
  loading: false,
44
29
  mfaDevices: undefined,
@@ -53,9 +38,6 @@ const reducers = {
53
38
  };
54
39
  exports.stepUpReducers = reducers;
55
40
  const actions = {
56
- stepUpHostedLogin: (0, _toolkit.createAction)(`${_constants.authStoreName}/stepUpHostedLogin`, payload => ({
57
- payload
58
- })),
59
41
  generateStepUpSession: (0, _toolkit.createAction)(`${_constants.authStoreName}/generateStepUpSession`, payload => ({
60
42
  payload
61
43
  })),
@@ -18,7 +18,6 @@ var _mfaWithSMS = require("../LoginState/sagas/mfaWithSMS.saga");
18
18
  var _mfaWithWebAuthn = require("../LoginState/sagas/mfaWithWebAuthn.saga");
19
19
  var _mfaWithEmailCode = require("../LoginState/sagas/mfaWithEmailCode.saga");
20
20
  var _generateStepUpSession = require("./generateStepUpSession.saga");
21
- var _stepUpHostedLogin = require("./stepUpHostedLogin.saga");
22
21
  /**
23
22
  * Step up with authenticator app
24
23
  * @param payload.callback - callback function to be called after the verification is done
@@ -106,7 +105,6 @@ function* preVerifyMFAEmailCodeForStepUp({
106
105
  yield (0, _mfaWithEmailCode.preVerifyMFAEmailCode)(payload, _reducer.actions.setStepUpState);
107
106
  }
108
107
  function* stepUpSagas() {
109
- yield (0, _effects.takeLeading)(_reducer.actions.stepUpHostedLogin, _stepUpHostedLogin.stepUpHostedLogin);
110
108
  yield (0, _effects.takeLeading)(_reducer.actions.generateStepUpSession, _generateStepUpSession.generateStepUpSession);
111
109
  yield (0, _effects.takeLeading)(_reducer.actions.stepUpWithAuthenticator, stepUpWithAuthenticator);
112
110
  yield (0, _effects.takeLeading)(_reducer.actions.preVerifyMFASMSForStepUp, preVerifyMFASMSForStepUp);
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.redirectByStepUpUrl = exports.isSteppedUp = void 0;
7
- exports.setAfterAuthRedirectUrlForStepUp = setAfterAuthRedirectUrlForStepUp;
8
- var _constants = require("../../constants");
6
+ exports.isSteppedUp = void 0;
9
7
  var _consts = require("./consts");
10
8
  /**
11
9
  * @param options.amr
@@ -14,15 +12,12 @@ var _consts = require("./consts");
14
12
  * @param options.maxAge - max age of step up
15
13
  * @returns true when the user is stepped up, false otherwise
16
14
  */
17
- const isSteppedUp = (user, {
15
+ const isSteppedUp = ({
16
+ amr = [],
17
+ acr = '',
18
+ auth_time,
18
19
  maxAge
19
20
  } = {}) => {
20
- if (!user) return false;
21
- const {
22
- amr = [],
23
- acr = '',
24
- auth_time
25
- } = user;
26
21
  if (maxAge && auth_time) {
27
22
  // when user is logged in for a long time (more than maxAge, but jwt is still valid because it's not refreshed yet)
28
23
  const isMaxAgeValid = Date.now() / 1000 - auth_time <= maxAge;
@@ -33,28 +28,4 @@ const isSteppedUp = (user, {
33
28
  const isAMRIncludesMethod = _consts.AMR_ADDITIONAL_VALUE.find(method => amr.indexOf(method)) !== undefined;
34
29
  return isACRValid && isAMRIncludesMFA && isAMRIncludesMethod;
35
30
  };
36
-
37
- /**
38
- * Set the url and query params in the local storage FRONTEGG_AFTER_AUTH_REDIRECT_URL value
39
- */
40
- exports.isSteppedUp = isSteppedUp;
41
- function setAfterAuthRedirectUrlForStepUp() {
42
- const encodedRedirectUrl = window.location.pathname + window.location.search;
43
- window.localStorage.setItem(_constants.FRONTEGG_AFTER_AUTH_REDIRECT_URL, encodedRedirectUrl);
44
- }
45
-
46
- /**
47
- * Redirects to the step up url with the max age param and set the redirect url in the local storage
48
- * The redirect url will be used after the step up flow is done
49
- * @param stepUpUrl - step up url to redirect to
50
- * @param onRedirectTo - redirect to function
51
- * @param maxAge - max age of step up
52
- */
53
- const redirectByStepUpUrl = (stepUpUrl, onRedirectTo, maxAge) => {
54
- setAfterAuthRedirectUrlForStepUp();
55
- const maxAgePart = maxAge !== undefined ? `?${_consts.STEP_UP_MAX_AGE_PARAM_NAME}=${maxAge}` : '';
56
- onRedirectTo(`${stepUpUrl}${maxAgePart}`, {
57
- refresh: false
58
- });
59
- };
60
- exports.redirectByStepUpUrl = redirectByStepUpUrl;
31
+ exports.isSteppedUp = isSteppedUp;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.165.0-alpha.13
1
+ /** @license Frontegg v6.165.0-alpha.14
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.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "6.165.0-alpha.13",
3
+ "version": "6.165.0-alpha.14",
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.0.1",
10
- "@frontegg/rest-api": "3.1.55",
10
+ "@frontegg/rest-api": "3.1.56",
11
11
  "@reduxjs/toolkit": "1.8.5",
12
12
  "fast-deep-equal": "3.1.3",
13
13
  "redux-saga": "^1.2.1",
@@ -1,12 +0,0 @@
1
- import { PayloadAction } from '@reduxjs/toolkit';
2
- import { IStepUpHostedLogin } from './interfaces';
3
- /**
4
- * Step up for hosted login apps
5
- * @param payload.maxAge
6
- */
7
- export declare function stepUpHostedLogin({ payload }: PayloadAction<IStepUpHostedLogin>): Generator<Generator<any, void, {
8
- routes: any;
9
- context: any;
10
- onRedirectTo: any;
11
- urlStrategy: any;
12
- } & string & import("@frontegg/rest-api").ResolvedTenantResult>, void, unknown>;
@@ -1,24 +0,0 @@
1
- import { requestHostedLoginAuthorize } from '../LoginState/saga';
2
- import { ACR_VALUE, SHOULD_STEP_UP_KEY } from './consts';
3
- import { setAfterAuthRedirectUrlForStepUp } from './utils';
4
-
5
- /**
6
- * Step up for hosted login apps
7
- * @param payload.maxAge
8
- */
9
- export function* stepUpHostedLogin({
10
- payload
11
- }) {
12
- const params = {
13
- acr_values: ACR_VALUE
14
- };
15
- const {
16
- maxAge
17
- } = payload || {};
18
- if (maxAge !== undefined) {
19
- params.max_age = maxAge.toString();
20
- }
21
- setAfterAuthRedirectUrlForStepUp();
22
- window.localStorage.setItem(SHOULD_STEP_UP_KEY, 'true');
23
- yield requestHostedLoginAuthorize(params);
24
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.stepUpHostedLogin = stepUpHostedLogin;
7
- var _saga = require("../LoginState/saga");
8
- var _consts = require("./consts");
9
- var _utils = require("./utils");
10
- /**
11
- * Step up for hosted login apps
12
- * @param payload.maxAge
13
- */
14
- function* stepUpHostedLogin({
15
- payload
16
- }) {
17
- const params = {
18
- acr_values: _consts.ACR_VALUE
19
- };
20
- const {
21
- maxAge
22
- } = payload || {};
23
- if (maxAge !== undefined) {
24
- params.max_age = maxAge.toString();
25
- }
26
- (0, _utils.setAfterAuthRedirectUrlForStepUp)();
27
- window.localStorage.setItem(_consts.SHOULD_STEP_UP_KEY, 'true');
28
- yield (0, _saga.requestHostedLoginAuthorize)(params);
29
- }