@frontegg/js 7.99.0 → 7.100.0-alpha.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.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.99.0
1
+ /** @license Frontegg v7.100.0-alpha.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/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.99.0
1
+ /** @license Frontegg v7.100.0-alpha.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/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.99.0'
8
+ cdnVersion: '7.100.0-alpha.0'
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.99.0",
3
+ "version": "7.100.0-alpha.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
- "@frontegg/types": "7.99.0"
9
+ "@frontegg/types": "7.100.0-alpha.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1839,7 +1839,7 @@ __webpack_require__.r(__webpack_exports__);
1839
1839
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1840
1840
  /* harmony export */ });
1841
1841
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1842
- cdnVersion: '7.99.0'
1842
+ cdnVersion: '7.100.0-alpha.0'
1843
1843
  });
1844
1844
 
1845
1845
  /***/ }),
@@ -10560,14 +10560,35 @@ const _excluded = ["callback", "profilePictureUrl"];
10560
10560
  const resetProfileState = () => {
10561
10561
  (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.deepResetState)(store, ['auth', 'profileState'], _state__WEBPACK_IMPORTED_MODULE_3__.initialState);
10562
10562
  };
10563
+
10564
+ /**
10565
+ * Helper function to preserve groups from currentUser if profile doesn't have them
10566
+ * The authorization API returns merged roles/permissions but may not include groups array
10567
+ * @param profileData - User profile data from API (may or may not have groups)
10568
+ * @param currentUser - Current user from store (has groups if they were loaded before)
10569
+ * @returns Groups array to use (prefers profile.groups if they exist, otherwise currentUser.groups)
10570
+ */
10571
+ const preserveGroups = (profileData, currentUser) => {
10572
+ if (profileData != null && profileData.groups && profileData.groups.length > 0) {
10573
+ return profileData.groups;
10574
+ }
10575
+ if (currentUser != null && currentUser.groups && currentUser.groups.length > 0) {
10576
+ return currentUser.groups;
10577
+ }
10578
+ return profileData == null ? void 0 : profileData.groups;
10579
+ };
10563
10580
  const loadProfile = async () => {
10564
10581
  setProfileState({
10565
10582
  loading: true
10566
10583
  });
10567
10584
  try {
10568
- const profile = await (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.retry)(api.teams.getProfile, 3, 2000);
10585
+ const profile = await (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.retry)(api.auth.getMeAndEntitlements, 3, 2000);
10569
10586
  const currentUser = store.auth.user;
10570
- actions.setUser((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, currentUser, profile));
10587
+ const preservedGroups = preserveGroups(profile, currentUser);
10588
+ const mergedUser = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, currentUser, profile, {
10589
+ groups: preservedGroups
10590
+ });
10591
+ actions.setUser(mergedUser);
10571
10592
  setProfileState({
10572
10593
  profile,
10573
10594
  loading: false
@@ -10666,13 +10687,16 @@ const _excluded = ["callback", "profilePictureUrl"];
10666
10687
  const newProfileData = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, oldProfileData, payload, {
10667
10688
  profilePictureUrl: newProfilePictureUrl
10668
10689
  });
10669
-
10670
- //TODO: change the payload type to IUpdateUserProfile which is the right type to send, currently we send more data then actually needed.
10671
- const profile = await api.users.updateUserProfileV2(newProfileData);
10690
+ await api.users.updateUserProfileV2(newProfileData);
10672
10691
  const currentUser = store.auth.user;
10673
- actions.setUser((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, currentUser, profile));
10692
+ const completeUserData = await (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.retry)(api.auth.getMeAndEntitlements, 3, 2000);
10693
+ const preservedGroups = preserveGroups(completeUserData, currentUser);
10694
+ const mergedUser = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, currentUser, completeUserData, {
10695
+ groups: preservedGroups
10696
+ });
10697
+ actions.setUser(mergedUser);
10674
10698
  actions.setProfileState({
10675
- profile,
10699
+ profile: completeUserData,
10676
10700
  saving: false,
10677
10701
  loading: false
10678
10702
  });
@@ -19810,7 +19834,7 @@ __webpack_require__.r(__webpack_exports__);
19810
19834
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
19811
19835
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
19812
19836
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
19813
- /** @license Frontegg v7.99.0
19837
+ /** @license Frontegg v7.100.0-alpha.0
19814
19838
  *
19815
19839
  * This source code is licensed under the MIT license found in the
19816
19840
  * LICENSE file in the root directory of this source tree.
@@ -30137,7 +30161,7 @@ __webpack_require__.r(__webpack_exports__);
30137
30161
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
30138
30162
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
30139
30163
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
30140
- /** @license Frontegg v7.99.0
30164
+ /** @license Frontegg v7.100.0-alpha.0
30141
30165
  *
30142
30166
  * This source code is licensed under the MIT license found in the
30143
30167
  * LICENSE file in the root directory of this source tree.
@@ -32932,7 +32956,7 @@ __webpack_require__.r(__webpack_exports__);
32932
32956
  /* harmony export */ });
32933
32957
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
32934
32958
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
32935
- /** @license Frontegg v7.99.0
32959
+ /** @license Frontegg v7.100.0-alpha.0
32936
32960
  *
32937
32961
  * This source code is licensed under the MIT license found in the
32938
32962
  * LICENSE file in the root directory of this source tree.