@frontegg/redux-store 5.49.0 → 5.51.1

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/auth/index.js CHANGED
@@ -977,9 +977,16 @@ function* refreshToken() {
977
977
  else {
978
978
  yield put(actions.setTenantsState({ tenants, loading: false }));
979
979
  yield put(actions.setState({ user, isAuthenticated: true }));
980
- if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl]
981
- .some(url => url && window.location.pathname.endsWith(url))) {
982
- if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
980
+ if ([
981
+ routes.loginUrl,
982
+ routes.socialLoginCallbackUrl,
983
+ routes.signUpUrl,
984
+ routes.oidcRedirectUrl,
985
+ routes.samlCallbackUrl,
986
+ ].some((url) => url && window.location.pathname.endsWith(url))) {
987
+ if (loginState.isNewUser &&
988
+ routes.signUpSuccessUrl &&
989
+ routes.socialLoginCallbackUrl === window.location.pathname) {
983
990
  onRedirectTo(routes.signUpSuccessUrl, { refresh: routes.signUpSuccessUrl.startsWith('http') });
984
991
  }
985
992
  else {
@@ -1174,14 +1181,14 @@ function* verifyInviteToken({ payload }) {
1174
1181
  yield put(actions.setLoginState({ loading: false }));
1175
1182
  }
1176
1183
  }
1177
- function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback, }, }) {
1184
+ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback }, }) {
1178
1185
  yield put(actions.setLoginState({ loading: true }));
1179
1186
  try {
1180
1187
  const onRedirectTo = yield select(({ auth: { onRedirectTo } }) => onRedirectTo);
1181
1188
  let { address, idpType } = yield call(api.auth.preLoginV2, { email });
1182
1189
  if (address) {
1183
1190
  if (idpType === SamlVendors.Oidc && !address.includes('redirect_uri')) {
1184
- const { routes: { oidcRedirectUrl } } = yield select(({ auth: { routes } }) => ({ routes }));
1191
+ const { routes: { oidcRedirectUrl }, } = yield select(({ auth: { routes } }) => ({ routes }));
1185
1192
  address += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
1186
1193
  }
1187
1194
  yield put(actions.setLoginState({ step: LoginStep.redirectToSSO, loading: false, ssoRedirectUrl: address }));
@@ -1199,7 +1206,7 @@ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback
1199
1206
  }
1200
1207
  function* ssoPreloginFailed(_a) {
1201
1208
  var { callback } = _a, body = __rest(_a, ["callback"]);
1202
- const publicPolicy = yield select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy } } } }) => publicPolicy);
1209
+ const publicPolicy = yield select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy }, }, }, }) => publicPolicy);
1203
1210
  if (!(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
1204
1211
  yield put(actions.setLoginState({ step: LoginStep.loginWithPassword, loading: false }));
1205
1212
  callback === null || callback === void 0 ? void 0 : callback();
@@ -1237,7 +1244,7 @@ function* postLogin({ payload }) {
1237
1244
  yield put(actions.setLoginState({ step: LoginStep.loginWithSSOFailed, loading: false }));
1238
1245
  }
1239
1246
  }
1240
- function* login({ payload: { email, password, recaptchaToken, invitationToken, callback, }, }) {
1247
+ function* login({ payload: { email, password, recaptchaToken, invitationToken, callback }, }) {
1241
1248
  yield put(actions.setLoginState({ loading: true }));
1242
1249
  try {
1243
1250
  const user = yield call(api.auth.login, {
@@ -1336,8 +1343,7 @@ function* logout({ payload }) {
1336
1343
  try {
1337
1344
  yield call(api.auth.logout);
1338
1345
  }
1339
- catch (_a) {
1340
- }
1346
+ catch (_a) { }
1341
1347
  yield put(actions.resetState());
1342
1348
  yield put(actions.requestAuthorize(true));
1343
1349
  payload === null || payload === void 0 ? void 0 : payload();
@@ -1346,8 +1352,7 @@ function* silentLogout({ payload }) {
1346
1352
  try {
1347
1353
  yield call(api.auth.logout);
1348
1354
  }
1349
- catch (_a) {
1350
- }
1355
+ catch (_a) { }
1351
1356
  setTimeout(() => payload === null || payload === void 0 ? void 0 : payload(), 500);
1352
1357
  }
1353
1358
  function* loginSagas() {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var auth_index = require('../index-b7daa5b9.js');
5
+ var auth_index = require('../index-60f5f9e5.js');
6
6
  var constants = require('../constants-52e37c08.js');
7
7
  var restApi = require('@frontegg/rest-api');
8
8
  require('@reduxjs/toolkit');
@@ -986,9 +986,16 @@ function* refreshToken() {
986
986
  else {
987
987
  yield effects.put(actions.setTenantsState({ tenants, loading: false }));
988
988
  yield effects.put(actions.setState({ user, isAuthenticated: true }));
989
- if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl]
990
- .some(url => url && window.location.pathname.endsWith(url))) {
991
- if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
989
+ if ([
990
+ routes.loginUrl,
991
+ routes.socialLoginCallbackUrl,
992
+ routes.signUpUrl,
993
+ routes.oidcRedirectUrl,
994
+ routes.samlCallbackUrl,
995
+ ].some((url) => url && window.location.pathname.endsWith(url))) {
996
+ if (loginState.isNewUser &&
997
+ routes.signUpSuccessUrl &&
998
+ routes.socialLoginCallbackUrl === window.location.pathname) {
992
999
  onRedirectTo(routes.signUpSuccessUrl, { refresh: routes.signUpSuccessUrl.startsWith('http') });
993
1000
  }
994
1001
  else {
@@ -1183,14 +1190,14 @@ function* verifyInviteToken({ payload }) {
1183
1190
  yield effects.put(actions.setLoginState({ loading: false }));
1184
1191
  }
1185
1192
  }
1186
- function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback, }, }) {
1193
+ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback }, }) {
1187
1194
  yield effects.put(actions.setLoginState({ loading: true }));
1188
1195
  try {
1189
1196
  const onRedirectTo = yield effects.select(({ auth: { onRedirectTo } }) => onRedirectTo);
1190
1197
  let { address, idpType } = yield effects.call(restApi.api.auth.preLoginV2, { email });
1191
1198
  if (address) {
1192
1199
  if (idpType === exports.SamlVendors.Oidc && !address.includes('redirect_uri')) {
1193
- const { routes: { oidcRedirectUrl } } = yield effects.select(({ auth: { routes } }) => ({ routes }));
1200
+ const { routes: { oidcRedirectUrl }, } = yield effects.select(({ auth: { routes } }) => ({ routes }));
1194
1201
  address += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
1195
1202
  }
1196
1203
  yield effects.put(actions.setLoginState({ step: exports.LoginStep.redirectToSSO, loading: false, ssoRedirectUrl: address }));
@@ -1208,7 +1215,7 @@ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback
1208
1215
  }
1209
1216
  function* ssoPreloginFailed(_a) {
1210
1217
  var { callback } = _a, body = tslib.__rest(_a, ["callback"]);
1211
- const publicPolicy = yield effects.select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy } } } }) => publicPolicy);
1218
+ const publicPolicy = yield effects.select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy }, }, }, }) => publicPolicy);
1212
1219
  if (!(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
1213
1220
  yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithPassword, loading: false }));
1214
1221
  callback === null || callback === void 0 ? void 0 : callback();
@@ -1246,7 +1253,7 @@ function* postLogin({ payload }) {
1246
1253
  yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithSSOFailed, loading: false }));
1247
1254
  }
1248
1255
  }
1249
- function* login({ payload: { email, password, recaptchaToken, invitationToken, callback, }, }) {
1256
+ function* login({ payload: { email, password, recaptchaToken, invitationToken, callback }, }) {
1250
1257
  yield effects.put(actions.setLoginState({ loading: true }));
1251
1258
  try {
1252
1259
  const user = yield effects.call(restApi.api.auth.login, {
@@ -1345,8 +1352,7 @@ function* logout({ payload }) {
1345
1352
  try {
1346
1353
  yield effects.call(restApi.api.auth.logout);
1347
1354
  }
1348
- catch (_a) {
1349
- }
1355
+ catch (_a) { }
1350
1356
  yield effects.put(actions.resetState());
1351
1357
  yield effects.put(actions.requestAuthorize(true));
1352
1358
  payload === null || payload === void 0 ? void 0 : payload();
@@ -1355,8 +1361,7 @@ function* silentLogout({ payload }) {
1355
1361
  try {
1356
1362
  yield effects.call(restApi.api.auth.logout);
1357
1363
  }
1358
- catch (_a) {
1359
- }
1364
+ catch (_a) { }
1360
1365
  setTimeout(() => payload === null || payload === void 0 ? void 0 : payload(), 500);
1361
1366
  }
1362
1367
  function* loginSagas() {
package/node/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var auth_index = require('./index-b7daa5b9.js');
5
+ var auth_index = require('./index-60f5f9e5.js');
6
6
  var audits_index = require('./audits/index.js');
7
7
  var connectivity_index = require('./connectivity/index.js');
8
8
  var subscriptions_index = require('./subscriptions/index.js');
@@ -283,6 +283,7 @@ const planResponseMock = [
283
283
  currency: 'usd',
284
284
  amount: 10000,
285
285
  },
286
+ slug: 'premium',
286
287
  },
287
288
  {
288
289
  id: 'prod_J60duauCpXfcur',
@@ -295,6 +296,7 @@ const planResponseMock = [
295
296
  currency: 'usd',
296
297
  amount: 0,
297
298
  },
299
+ slug: 'free',
298
300
  },
299
301
  ];
300
302
  const invoicesMock = [
@@ -480,6 +482,7 @@ function* loadSummaries(tenantId, forceActive) {
480
482
  price: ((_a = planResponse.price) === null || _a === void 0 ? void 0 : _a.amount) || 0,
481
483
  currency: ((_b = planResponse.price) === null || _b === void 0 ? void 0 : _b.currency) || 'usd',
482
484
  recurringInterval: 'month',
485
+ slug: planResponse.slug,
483
486
  },
484
487
  }
485
488
  : {}))));
@@ -761,6 +764,7 @@ function* loadPlans() {
761
764
  price: ((_a = item.price) === null || _a === void 0 ? void 0 : _a.amount) || 0,
762
765
  currency: ((_b = item.price) === null || _b === void 0 ? void 0 : _b.currency) || 'usd',
763
766
  recurringInterval: 'month',
767
+ slug: item.slug,
764
768
  });
765
769
  });
766
770
  yield effects.put(actions$8.setState({
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var auth_index = require('../index-b7daa5b9.js');
5
+ var auth_index = require('../index-60f5f9e5.js');
6
6
  var toolkit = require('@reduxjs/toolkit');
7
7
  var createSagaMiddleware = require('redux-saga');
8
8
  var effects = require('redux-saga/effects');
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
3
  "libName": "FronteggReduxStore",
4
- "version": "5.49.0",
4
+ "version": "5.51.1",
5
5
  "author": "Frontegg LTD",
6
6
  "main": "./node/index.js",
7
7
  "module": "./index.js",
8
8
  "types": "./index.d.ts",
9
9
  "dependencies": {
10
- "@frontegg/rest-api": "2.10.66",
10
+ "@frontegg/rest-api": "2.10.67",
11
11
  "@reduxjs/toolkit": "^1.5.0",
12
12
  "redux-saga": "^1.1.0",
13
13
  "tslib": "^2.3.1",
@@ -8,6 +8,7 @@ export interface Plan {
8
8
  price: number;
9
9
  currency: string;
10
10
  recurringInterval: string;
11
+ slug: string;
11
12
  }
12
13
  export declare enum SubscriptionStatus {
13
14
  ACTIVE = "ACTIVE",
@@ -280,6 +280,7 @@ const planResponseMock = [
280
280
  currency: 'usd',
281
281
  amount: 10000,
282
282
  },
283
+ slug: 'premium',
283
284
  },
284
285
  {
285
286
  id: 'prod_J60duauCpXfcur',
@@ -292,6 +293,7 @@ const planResponseMock = [
292
293
  currency: 'usd',
293
294
  amount: 0,
294
295
  },
296
+ slug: 'free',
295
297
  },
296
298
  ];
297
299
  const invoicesMock = [
@@ -477,6 +479,7 @@ function* loadSummaries(tenantId, forceActive) {
477
479
  price: ((_a = planResponse.price) === null || _a === void 0 ? void 0 : _a.amount) || 0,
478
480
  currency: ((_b = planResponse.price) === null || _b === void 0 ? void 0 : _b.currency) || 'usd',
479
481
  recurringInterval: 'month',
482
+ slug: planResponse.slug,
480
483
  },
481
484
  }
482
485
  : {}))));
@@ -758,6 +761,7 @@ function* loadPlans() {
758
761
  price: ((_a = item.price) === null || _a === void 0 ? void 0 : _a.amount) || 0,
759
762
  currency: ((_b = item.price) === null || _b === void 0 ? void 0 : _b.currency) || 'usd',
760
763
  recurringInterval: 'month',
764
+ slug: item.slug,
761
765
  });
762
766
  });
763
767
  yield put(actions$8.setState({