@frontegg/redux-store 7.88.0-alpha.0 → 7.89.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.
@@ -26,7 +26,7 @@ import { LoginFlow, LoginStep } from '../interfaces';
26
26
  import { base64urlDecode, deepResetState, delay, errorHandler, errorTraceId, GTMEventAction, publicKeyCredentialToJSON, reportGTMEvent, retryIfNeeded, withRetryConfig } from '../../../helpers';
27
27
  import { initialState } from '../state';
28
28
  import { getSearchParam, isEmailPayload, isUsernamePayload, shouldShowPasswordRotationPromptFunc, TENANT_ID_PARAM_KEY } from '../helpers';
29
- import { AuthStrategyEnum, ContextHolder, removeTabTenantFromSessionStorage, WebAuthnDeviceType } from '@frontegg/rest-api';
29
+ import { AuthStrategyEnum, ContextHolder, FeatureFlags, removeTabTenantFromSessionStorage, WebAuthnDeviceType } from '@frontegg/rest-api';
30
30
  import hostedLoginAuthorizeActions from './hostedLoginAuthorize.actions';
31
31
  import { FronteggNativeModule, isEntitlementsDeeplyEqual } from '../../../toolkit';
32
32
  import { REQUEST_NAME, UserVerifiedOriginTypes } from '../../interfaces';
@@ -119,7 +119,9 @@ export default ((store, api, sharedActions) => {
119
119
  }),
120
120
  isAuthenticated: true
121
121
  });
122
- await __handleRedirectRefreshToken(shouldNavigateToRegisterQuickLogin);
122
+ await __handleRedirectRefreshToken({
123
+ shouldNavigateToRegisterQuickLogin
124
+ });
123
125
  }
124
126
  } catch (e) {
125
127
  contextHolder.setAccessToken(null);
@@ -162,9 +164,11 @@ export default ((store, api, sharedActions) => {
162
164
  }
163
165
  return updatedUser;
164
166
  };
165
-
166
167
  /** @private */
167
- const __handleRedirectRefreshToken = async shouldNavigateToRegisterQuickLogin => {
168
+ const __handleRedirectRefreshToken = async ({
169
+ shouldNavigateToRegisterQuickLogin,
170
+ isSocialLoginRefreshToken = false
171
+ }) => {
168
172
  var _window;
169
173
  const url = new URL((_window = window) == null ? void 0 : _window.location.href);
170
174
  const {
@@ -172,6 +176,7 @@ export default ((store, api, sharedActions) => {
172
176
  loginState,
173
177
  onRedirectTo
174
178
  } = store.auth;
179
+ const [preventAuthRedirectOnSocialLogin] = FeatureFlags.getFeatureFlags(['prevent-auth-redirect-on-social-login'], store.root.appName);
175
180
  const invitationToken = url.searchParams.get('invitationToken');
176
181
  const redirectRoutes = [routes.socialLoginCallbackUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl, routes.magicLinkCallbackUrl];
177
182
  if (!invitationToken) {
@@ -185,6 +190,10 @@ export default ((store, api, sharedActions) => {
185
190
  refresh: routes.signUpSuccessUrl.startsWith('http')
186
191
  });
187
192
  } else {
193
+ const isSocialLoginCallbackUrl = routes.socialLoginCallbackUrl && window.location.pathname.endsWith(routes.socialLoginCallbackUrl);
194
+ if (!isSocialLoginRefreshToken && preventAuthRedirectOnSocialLogin && isSocialLoginCallbackUrl) {
195
+ return;
196
+ }
188
197
  await actions.afterAuthNavigation();
189
198
  }
190
199
  }
@@ -1332,7 +1341,10 @@ export default ((store, api, sharedActions) => {
1332
1341
  }),
1333
1342
  isAuthenticated: true
1334
1343
  });
1335
- await __handleRedirectRefreshToken(shouldNavigateToRegisterQuickLogin);
1344
+ await __handleRedirectRefreshToken({
1345
+ shouldNavigateToRegisterQuickLogin,
1346
+ isSocialLoginRefreshToken: true
1347
+ });
1336
1348
  }
1337
1349
  }
1338
1350
  } catch (e) {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.88.0-alpha.0
1
+ /** @license Frontegg v7.89.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.
@@ -126,7 +126,9 @@ var _default = (store, api, sharedActions) => {
126
126
  }),
127
127
  isAuthenticated: true
128
128
  });
129
- await __handleRedirectRefreshToken(shouldNavigateToRegisterQuickLogin);
129
+ await __handleRedirectRefreshToken({
130
+ shouldNavigateToRegisterQuickLogin
131
+ });
130
132
  }
131
133
  } catch (e) {
132
134
  contextHolder.setAccessToken(null);
@@ -169,9 +171,11 @@ var _default = (store, api, sharedActions) => {
169
171
  }
170
172
  return updatedUser;
171
173
  };
172
-
173
174
  /** @private */
174
- const __handleRedirectRefreshToken = async shouldNavigateToRegisterQuickLogin => {
175
+ const __handleRedirectRefreshToken = async ({
176
+ shouldNavigateToRegisterQuickLogin,
177
+ isSocialLoginRefreshToken = false
178
+ }) => {
175
179
  var _window;
176
180
  const url = new URL((_window = window) == null ? void 0 : _window.location.href);
177
181
  const {
@@ -179,6 +183,7 @@ var _default = (store, api, sharedActions) => {
179
183
  loginState,
180
184
  onRedirectTo
181
185
  } = store.auth;
186
+ const [preventAuthRedirectOnSocialLogin] = _restApi.FeatureFlags.getFeatureFlags(['prevent-auth-redirect-on-social-login'], store.root.appName);
182
187
  const invitationToken = url.searchParams.get('invitationToken');
183
188
  const redirectRoutes = [routes.socialLoginCallbackUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl, routes.magicLinkCallbackUrl];
184
189
  if (!invitationToken) {
@@ -192,6 +197,10 @@ var _default = (store, api, sharedActions) => {
192
197
  refresh: routes.signUpSuccessUrl.startsWith('http')
193
198
  });
194
199
  } else {
200
+ const isSocialLoginCallbackUrl = routes.socialLoginCallbackUrl && window.location.pathname.endsWith(routes.socialLoginCallbackUrl);
201
+ if (!isSocialLoginRefreshToken && preventAuthRedirectOnSocialLogin && isSocialLoginCallbackUrl) {
202
+ return;
203
+ }
195
204
  await actions.afterAuthNavigation();
196
205
  }
197
206
  }
@@ -1339,7 +1348,10 @@ var _default = (store, api, sharedActions) => {
1339
1348
  }),
1340
1349
  isAuthenticated: true
1341
1350
  });
1342
- await __handleRedirectRefreshToken(shouldNavigateToRegisterQuickLogin);
1351
+ await __handleRedirectRefreshToken({
1352
+ shouldNavigateToRegisterQuickLogin,
1353
+ isSocialLoginRefreshToken: true
1354
+ });
1343
1355
  }
1344
1356
  }
1345
1357
  } catch (e) {
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.88.0-alpha.0
1
+ /** @license Frontegg v7.89.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.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.88.0-alpha.0",
3
+ "version": "7.89.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.88.0-alpha.0",
10
+ "@frontegg/rest-api": "7.89.0",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",