@frontegg/js 7.82.0-alpha.1 → 7.82.0-alpha.2

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.82.0-alpha.1
1
+ /** @license Frontegg v7.82.0-alpha.2
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/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.82.0-alpha.1
1
+ /** @license Frontegg v7.82.0-alpha.2
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/node/version.js CHANGED
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
- cdnVersion: '7.82.0-alpha.1'
8
+ cdnVersion: '7.82.0-alpha.2'
9
9
  };
10
10
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/js",
3
- "version": "7.82.0-alpha.1",
3
+ "version": "7.82.0-alpha.2",
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
- "@frontegg/types": "7.82.0-alpha.1"
9
+ "@frontegg/types": "7.82.0-alpha.2"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1788,7 +1788,7 @@ __webpack_require__.r(__webpack_exports__);
1788
1788
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1789
1789
  /* harmony export */ });
1790
1790
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1791
- cdnVersion: '7.82.0-alpha.1'
1791
+ cdnVersion: '7.82.0-alpha.2'
1792
1792
  });
1793
1793
 
1794
1794
  /***/ }),
@@ -3418,11 +3418,11 @@ __webpack_require__.r(__webpack_exports__);
3418
3418
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
3419
3419
  /* harmony export */ });
3420
3420
  /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
3421
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
3421
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
3422
3422
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
3423
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
3423
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
3424
3424
  /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/ApplicationsState/state.js");
3425
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers */ "../../dist/@frontegg/redux-store/auth/ApplicationsState/helpers.js");
3425
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "../../dist/@frontegg/redux-store/auth/ApplicationsState/helpers.js");
3426
3426
 
3427
3427
 
3428
3428
 
@@ -3436,6 +3436,16 @@ __webpack_require__.r(__webpack_exports__);
3436
3436
  const resetApplicationsState = () => {
3437
3437
  (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.deepResetState)(store, ['auth', 'applicationsState'], _state__WEBPACK_IMPORTED_MODULE_2__.initialState);
3438
3438
  };
3439
+ const updateCombinedUserApplications = () => {
3440
+ const {
3441
+ userApplications,
3442
+ accountApplications
3443
+ } = store.auth.applicationsState;
3444
+ const combinedUserApplications = (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.combineUserApplicationsWithTenantFreeAccess)(userApplications, accountApplications);
3445
+ setApplicationsState({
3446
+ combinedUserApplications
3447
+ });
3448
+ };
3439
3449
  const loadUserApplications = async payload => {
3440
3450
  setApplicationsState({
3441
3451
  loading: true,
@@ -3456,11 +3466,12 @@ __webpack_require__.r(__webpack_exports__);
3456
3466
  fetching: false,
3457
3467
  loading: false
3458
3468
  });
3469
+ updateCombinedUserApplications();
3459
3470
  } catch (e) {
3460
3471
  setApplicationsState({
3461
3472
  loading: false,
3462
3473
  fetching: false,
3463
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.errorHandler)(e)
3474
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e)
3464
3475
  });
3465
3476
  }
3466
3477
  };
@@ -3502,11 +3513,12 @@ __webpack_require__.r(__webpack_exports__);
3502
3513
  fetching: false,
3503
3514
  loading: false
3504
3515
  });
3516
+ updateCombinedUserApplications();
3505
3517
  } catch (e) {
3506
3518
  setApplicationsState({
3507
3519
  loading: false,
3508
3520
  fetching: false,
3509
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.errorHandler)(e)
3521
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e)
3510
3522
  });
3511
3523
  }
3512
3524
  };
@@ -3521,10 +3533,10 @@ __webpack_require__.r(__webpack_exports__);
3521
3533
  }), retryConfig), (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.retryIfNeeded)(() => api.applications.getTenantsApplicationsV2(), retryConfig)]);
3522
3534
 
3523
3535
  // Step 2: Identify tenant-level free apps
3524
- const tenantFreeAppIds = tenantAppAssignments.flatMap(tenant => tenant.assignments).filter(assignment => assignment.accessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.ApplicationAccessType.FREE_ACCESS).map(assignment => assignment.appId);
3536
+ const tenantFreeAppIds = tenantAppAssignments.flatMap(tenant => tenant.assignments).filter(assignment => assignment.accessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ApplicationAccessType.FREE_ACCESS).map(assignment => assignment.appId);
3525
3537
 
3526
3538
  // Step 3: Get all app IDs that need to be fetched (user assignments + tenant-free apps)
3527
- const userAssignedAppIds = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.getFlattenAppIds)(usersAppIds);
3539
+ const userAssignedAppIds = (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getFlattenAppIds)(usersAppIds);
3528
3540
  const appIdsToFetch = [...new Set([...userAssignedAppIds, ...tenantFreeAppIds])];
3529
3541
 
3530
3542
  // Step 4: Fetch details for all apps
@@ -3544,7 +3556,7 @@ __webpack_require__.r(__webpack_exports__);
3544
3556
 
3545
3557
  // Add apps that are assigned to the user OR are app-level free OR are tenant-level free
3546
3558
  fetchedAppsMap.forEach((app, appId) => {
3547
- if (userSpecificAppIds.has(appId) || app.accessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.ApplicationAccessType.FREE_ACCESS || tenantFreeAppIds.includes(appId)) {
3559
+ if (userSpecificAppIds.has(appId) || app.accessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ApplicationAccessType.FREE_ACCESS || tenantFreeAppIds.includes(appId)) {
3548
3560
  finalApps.push(app);
3549
3561
  }
3550
3562
  });
@@ -3553,7 +3565,7 @@ __webpack_require__.r(__webpack_exports__);
3553
3565
  }, {});
3554
3566
  } catch (e) {
3555
3567
  setApplicationsState({
3556
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.errorHandler)(e)
3568
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e)
3557
3569
  });
3558
3570
  }
3559
3571
  };
@@ -3588,7 +3600,7 @@ __webpack_require__.r(__webpack_exports__);
3588
3600
  callback == null ? void 0 : callback(true);
3589
3601
  } catch (e) {
3590
3602
  setApplicationsState({
3591
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.errorHandler)(e, ASSIGNMENT_DEFAULT_ERROR_MESSAGE)
3603
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e, ASSIGNMENT_DEFAULT_ERROR_MESSAGE)
3592
3604
  });
3593
3605
  callback == null ? void 0 : callback(false);
3594
3606
  }
@@ -3619,7 +3631,7 @@ __webpack_require__.r(__webpack_exports__);
3619
3631
  callback == null ? void 0 : callback(true);
3620
3632
  } catch (e) {
3621
3633
  setApplicationsState({
3622
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.errorHandler)(e, ASSIGNMENT_DEFAULT_ERROR_MESSAGE)
3634
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e, ASSIGNMENT_DEFAULT_ERROR_MESSAGE)
3623
3635
  });
3624
3636
  callback == null ? void 0 : callback(false);
3625
3637
  }
@@ -3634,7 +3646,7 @@ __webpack_require__.r(__webpack_exports__);
3634
3646
  return;
3635
3647
  }
3636
3648
  const apps = (_store$auth6 = store.auth) == null ? void 0 : (_store$auth6$applicat = _store$auth6.applicationsState) == null ? void 0 : _store$auth6$applicat.accountApplications;
3637
- const defaultApps = (_apps$filter = apps == null ? void 0 : apps.filter(app => app.accessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.ApplicationAccessType.FREE_ACCESS || app.tenantApplicationAccessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.ApplicationAccessType.FREE_ACCESS)) != null ? _apps$filter : [];
3649
+ const defaultApps = (_apps$filter = apps == null ? void 0 : apps.filter(app => app.accessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ApplicationAccessType.FREE_ACCESS || app.tenantApplicationAccessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ApplicationAccessType.FREE_ACCESS)) != null ? _apps$filter : [];
3638
3650
  if (appIds != null && appIds.length) {
3639
3651
  var _store$auth$user$tena3, _store$auth7, _store$auth7$user;
3640
3652
  const tenantId = (_store$auth$user$tena3 = (_store$auth7 = store.auth) == null ? void 0 : (_store$auth7$user = _store$auth7.user) == null ? void 0 : _store$auth7$user.tenantId) != null ? _store$auth$user$tena3 : '';
@@ -3696,8 +3708,11 @@ __webpack_require__.r(__webpack_exports__);
3696
3708
  "use strict";
3697
3709
  __webpack_require__.r(__webpack_exports__);
3698
3710
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3711
+ /* harmony export */ combineUserApplicationsWithTenantFreeAccess: () => (/* binding */ combineUserApplicationsWithTenantFreeAccess),
3699
3712
  /* harmony export */ getFlattenAppIds: () => (/* binding */ getFlattenAppIds)
3700
3713
  /* harmony export */ });
3714
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
3715
+
3701
3716
  const getFlattenAppIds = listWithAppIds => {
3702
3717
  var _listWithAppIds$map$r;
3703
3718
  return (_listWithAppIds$map$r = listWithAppIds.map(({
@@ -3711,6 +3726,18 @@ const getFlattenAppIds = listWithAppIds => {
3711
3726
  return allAppIds;
3712
3727
  }, [])) != null ? _listWithAppIds$map$r : [];
3713
3728
  };
3729
+ const combineUserApplicationsWithTenantFreeAccess = (userApplications, accountApplications) => {
3730
+ if (!userApplications && !accountApplications) return [];
3731
+ const userAppIds = new Set((userApplications == null ? void 0 : userApplications.map(app => app.id)) || []);
3732
+ const tenantFreeApps = (accountApplications == null ? void 0 : accountApplications.filter(app => app.tenantApplicationAccessType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.ApplicationAccessType.FREE_ACCESS)) || [];
3733
+
3734
+ // Add tenant-free apps that aren't already in user apps
3735
+ const additionalApps = tenantFreeApps.filter(app => !userAppIds.has(app.id));
3736
+
3737
+ // Create a combined list
3738
+ const combinedApps = [...(userApplications || []), ...additionalApps];
3739
+ return combinedApps;
3740
+ };
3714
3741
 
3715
3742
  /***/ }),
3716
3743
 
@@ -3733,7 +3760,8 @@ const initialState = {
3733
3760
  fetching: true,
3734
3761
  error: null,
3735
3762
  userApplications: [],
3736
- accountApplications: []
3763
+ accountApplications: [],
3764
+ combinedUserApplications: []
3737
3765
  };
3738
3766
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (overrideState => (0,_toolkit_proxy__WEBPACK_IMPORTED_MODULE_0__.createProxy)(initialState, overrideState));
3739
3767
 
@@ -19210,7 +19238,7 @@ __webpack_require__.r(__webpack_exports__);
19210
19238
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
19211
19239
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
19212
19240
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
19213
- /** @license Frontegg v7.82.0-alpha.1
19241
+ /** @license Frontegg v7.82.0-alpha.2
19214
19242
  *
19215
19243
  * This source code is licensed under the MIT license found in the
19216
19244
  * LICENSE file in the root directory of this source tree.
@@ -29506,7 +29534,7 @@ __webpack_require__.r(__webpack_exports__);
29506
29534
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
29507
29535
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
29508
29536
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
29509
- /** @license Frontegg v7.82.0-alpha.1
29537
+ /** @license Frontegg v7.82.0-alpha.2
29510
29538
  *
29511
29539
  * This source code is licensed under the MIT license found in the
29512
29540
  * LICENSE file in the root directory of this source tree.
@@ -32244,7 +32272,7 @@ __webpack_require__.r(__webpack_exports__);
32244
32272
  /* harmony export */ });
32245
32273
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
32246
32274
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
32247
- /** @license Frontegg v7.82.0-alpha.1
32275
+ /** @license Frontegg v7.82.0-alpha.2
32248
32276
  *
32249
32277
  * This source code is licensed under the MIT license found in the
32250
32278
  * LICENSE file in the root directory of this source tree.