@frontegg/js 7.133.0 → 7.135.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 +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +111 -46
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -1
- package/version.js +1 -1
package/index.js
CHANGED
package/node/index.js
CHANGED
package/node/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/js",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.135.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.
|
|
9
|
+
"@frontegg/types": "7.135.0"
|
|
10
10
|
},
|
|
11
11
|
"browserslist": {
|
|
12
12
|
"production": [
|
|
@@ -1965,7 +1965,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1965
1965
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1966
1966
|
/* harmony export */ });
|
|
1967
1967
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
1968
|
-
cdnVersion: '7.
|
|
1968
|
+
cdnVersion: '7.135.0'
|
|
1969
1969
|
});
|
|
1970
1970
|
|
|
1971
1971
|
/***/ }),
|
|
@@ -2808,19 +2808,21 @@ const initialState = {
|
|
|
2808
2808
|
"use strict";
|
|
2809
2809
|
__webpack_require__.r(__webpack_exports__);
|
|
2810
2810
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2811
|
+
/* harmony export */ KEEP_AUTH_FLOWS_REDIRECT_ON_ACTIVATION_FF: () => (/* binding */ KEEP_AUTH_FLOWS_REDIRECT_ON_ACTIVATION_FF),
|
|
2811
2812
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2812
2813
|
/* harmony export */ });
|
|
2813
2814
|
/* 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");
|
|
2814
2815
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
|
|
2815
2816
|
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/ActivateAccountState/state.js");
|
|
2816
|
-
/* harmony import */ var
|
|
2817
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
2817
2818
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
2818
|
-
/* harmony import */ var
|
|
2819
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
2819
2820
|
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interfaces */ "../../dist/@frontegg/redux-store/auth/ActivateAccountState/interfaces.js");
|
|
2820
|
-
/* harmony import */ var
|
|
2821
|
-
/* harmony import */ var
|
|
2822
|
-
/* harmony import */ var
|
|
2823
|
-
/* harmony import */ var
|
|
2821
|
+
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/interfaces.js");
|
|
2822
|
+
/* harmony import */ var _helpers_gtm__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../helpers/gtm */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
|
|
2823
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
|
|
2824
|
+
/* harmony import */ var _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../TeamState/interfaces */ "../../dist/@frontegg/redux-store/auth/TeamState/interfaces.js");
|
|
2825
|
+
/* harmony import */ var _LoginState_oauthStorage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../LoginState/oauthStorage */ "../../dist/@frontegg/redux-store/auth/LoginState/oauthStorage.js");
|
|
2824
2826
|
|
|
2825
2827
|
|
|
2826
2828
|
const _excluded = ["user"],
|
|
@@ -2838,6 +2840,8 @@ const _excluded = ["user"],
|
|
|
2838
2840
|
|
|
2839
2841
|
|
|
2840
2842
|
|
|
2843
|
+
|
|
2844
|
+
const KEEP_AUTH_FLOWS_REDIRECT_ON_ACTIVATION_FF = 'login-box-keep-auth-flows-redirect-on-activation';
|
|
2841
2845
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
|
|
2842
2846
|
const actions = sharedActions;
|
|
2843
2847
|
const setActivateState = state => {
|
|
@@ -2861,7 +2865,11 @@ const _excluded = ["user"],
|
|
|
2861
2865
|
try {
|
|
2862
2866
|
const isAuthenticated = store.auth.isAuthenticated;
|
|
2863
2867
|
if (isAuthenticated) {
|
|
2864
|
-
await actions.
|
|
2868
|
+
const [keepAuthFlowsRedirect] = await actions.getFeatureFlags([KEEP_AUTH_FLOWS_REDIRECT_ON_ACTIVATION_FF]);
|
|
2869
|
+
const hostedOAuthKeysToKeep = keepAuthFlowsRedirect ? [_LoginState_oauthStorage__WEBPACK_IMPORTED_MODULE_5__.FRONTEGG_AUTHENTICATION_FLOWS_REDIRECT_AFTER_LOGIN] : [];
|
|
2870
|
+
await actions.silentLogout({
|
|
2871
|
+
hostedOAuthKeysToKeep
|
|
2872
|
+
});
|
|
2865
2873
|
}
|
|
2866
2874
|
const strategy = await api.auth.getActivateAccountStrategy({
|
|
2867
2875
|
userId,
|
|
@@ -2881,7 +2889,7 @@ const _excluded = ["user"],
|
|
|
2881
2889
|
} catch (e) {
|
|
2882
2890
|
setActivateState({
|
|
2883
2891
|
loading: false,
|
|
2884
|
-
error: (0,
|
|
2892
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
|
|
2885
2893
|
});
|
|
2886
2894
|
}
|
|
2887
2895
|
};
|
|
@@ -2899,7 +2907,7 @@ const _excluded = ["user"],
|
|
|
2899
2907
|
window.location.href = user.redirectLocation;
|
|
2900
2908
|
return;
|
|
2901
2909
|
}
|
|
2902
|
-
if ((0,
|
|
2910
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_7__.isMfaRequired)(user, store.root.appName)) {
|
|
2903
2911
|
setActivateState({
|
|
2904
2912
|
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ActivateAccountStep.success
|
|
2905
2913
|
});
|
|
@@ -2916,14 +2924,14 @@ const _excluded = ["user"],
|
|
|
2916
2924
|
});
|
|
2917
2925
|
const userVerifiedPayload = {
|
|
2918
2926
|
email: user.email,
|
|
2919
|
-
origin:
|
|
2927
|
+
origin: _interfaces__WEBPACK_IMPORTED_MODULE_8__.UserVerifiedOriginTypes.ACTIVATION_LINK,
|
|
2920
2928
|
id: user.id,
|
|
2921
2929
|
tenantId: user.tenantId,
|
|
2922
2930
|
name: user.name,
|
|
2923
2931
|
createdAt: (_user$createdAt = user == null ? void 0 : user.createdAt) != null ? _user$createdAt : new Date()
|
|
2924
2932
|
};
|
|
2925
2933
|
events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
|
|
2926
|
-
(0,
|
|
2934
|
+
(0,_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.reportGTMEvent)(_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.GTMEventAction.USER_VERIFIED, userVerifiedPayload);
|
|
2927
2935
|
const loginCompletedPayload = {
|
|
2928
2936
|
tenantId: user.tenantId,
|
|
2929
2937
|
userId: user.id,
|
|
@@ -2932,7 +2940,7 @@ const _excluded = ["user"],
|
|
|
2932
2940
|
email: user.email,
|
|
2933
2941
|
name: user.name
|
|
2934
2942
|
};
|
|
2935
|
-
(0,
|
|
2943
|
+
(0,_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.reportGTMEvent)(_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
|
|
2936
2944
|
actions.afterAuthenticationStateUpdate((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({
|
|
2937
2945
|
user
|
|
2938
2946
|
}, rest), {
|
|
@@ -2954,7 +2962,7 @@ const _excluded = ["user"],
|
|
|
2954
2962
|
submitting: true
|
|
2955
2963
|
});
|
|
2956
2964
|
try {
|
|
2957
|
-
const onRedirectTo =
|
|
2965
|
+
const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__.ContextHolder.for(store.root.appName).onRedirectTo;
|
|
2958
2966
|
const routes = store.auth.routes;
|
|
2959
2967
|
const _await$api$auth$activ = await api.auth.activateAccountV2(payload),
|
|
2960
2968
|
{
|
|
@@ -2979,7 +2987,7 @@ const _excluded = ["user"],
|
|
|
2979
2987
|
}
|
|
2980
2988
|
setActivateState({
|
|
2981
2989
|
loading: false,
|
|
2982
|
-
error: (0,
|
|
2990
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
|
|
2983
2991
|
});
|
|
2984
2992
|
}
|
|
2985
2993
|
};
|
|
@@ -2994,7 +3002,7 @@ const _excluded = ["user"],
|
|
|
2994
3002
|
submitting: true
|
|
2995
3003
|
});
|
|
2996
3004
|
try {
|
|
2997
|
-
const onRedirectTo =
|
|
3005
|
+
const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__.ContextHolder.for(store.root.appName).onRedirectTo;
|
|
2998
3006
|
const routes = store.auth.routes;
|
|
2999
3007
|
const _await$api$auth$activ2 = await api.auth.activateAccountWithOTC(payload),
|
|
3000
3008
|
{
|
|
@@ -3020,7 +3028,7 @@ const _excluded = ["user"],
|
|
|
3020
3028
|
setActivateState({
|
|
3021
3029
|
submitting: false,
|
|
3022
3030
|
loading: false,
|
|
3023
|
-
error: (0,
|
|
3031
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e),
|
|
3024
3032
|
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ActivateAccountStep.activating
|
|
3025
3033
|
});
|
|
3026
3034
|
}
|
|
@@ -3044,7 +3052,7 @@ const _excluded = ["user"],
|
|
|
3044
3052
|
} catch (e) {
|
|
3045
3053
|
setActivateStrategyState({
|
|
3046
3054
|
loading: false,
|
|
3047
|
-
error: (0,
|
|
3055
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
|
|
3048
3056
|
});
|
|
3049
3057
|
}
|
|
3050
3058
|
};
|
|
@@ -3054,7 +3062,7 @@ const _excluded = ["user"],
|
|
|
3054
3062
|
} = payload,
|
|
3055
3063
|
body = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(payload, _excluded7);
|
|
3056
3064
|
actions.setTeamLoader({
|
|
3057
|
-
key:
|
|
3065
|
+
key: _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_11__.TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
3058
3066
|
value: body.email
|
|
3059
3067
|
});
|
|
3060
3068
|
setActivateState({
|
|
@@ -3071,12 +3079,12 @@ const _excluded = ["user"],
|
|
|
3071
3079
|
} catch (e) {
|
|
3072
3080
|
setActivateState({
|
|
3073
3081
|
loading: false,
|
|
3074
|
-
error: (0,
|
|
3082
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
|
|
3075
3083
|
});
|
|
3076
3084
|
callback == null ? void 0 : callback(null, e);
|
|
3077
3085
|
} finally {
|
|
3078
3086
|
actions.setTeamLoader({
|
|
3079
|
-
key:
|
|
3087
|
+
key: _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_11__.TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
3080
3088
|
value: false
|
|
3081
3089
|
});
|
|
3082
3090
|
}
|
|
@@ -7201,7 +7209,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7201
7209
|
}
|
|
7202
7210
|
};
|
|
7203
7211
|
const clearLogoutLocalState = async ({
|
|
7204
|
-
keepHostedOAuthState = false
|
|
7212
|
+
keepHostedOAuthState = false,
|
|
7213
|
+
hostedOAuthKeysToKeep = []
|
|
7205
7214
|
} = {}) => {
|
|
7206
7215
|
if (contextHolder.isSessionPerTenantEnabled()) {
|
|
7207
7216
|
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.removeTabTenantFromSessionStorage)();
|
|
@@ -7210,7 +7219,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7210
7219
|
}
|
|
7211
7220
|
// Step-up re-login goes through silentLogout but still needs the hosted OAuth state to finish the client flow.
|
|
7212
7221
|
if (!keepHostedOAuthState) {
|
|
7213
|
-
(0,_oauthStorage__WEBPACK_IMPORTED_MODULE_23__.clearHostedOAuthState)();
|
|
7222
|
+
(0,_oauthStorage__WEBPACK_IMPORTED_MODULE_23__.clearHostedOAuthState)(hostedOAuthKeysToKeep);
|
|
7214
7223
|
}
|
|
7215
7224
|
};
|
|
7216
7225
|
const logout = async payload => {
|
|
@@ -7241,7 +7250,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7241
7250
|
}
|
|
7242
7251
|
const isStepUpInProgress = !!((_window2 = window) != null && _window2.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY));
|
|
7243
7252
|
await clearLogoutLocalState({
|
|
7244
|
-
keepHostedOAuthState: isStepUpInProgress
|
|
7253
|
+
keepHostedOAuthState: isStepUpInProgress,
|
|
7254
|
+
hostedOAuthKeysToKeep: payload == null ? void 0 : payload.hostedOAuthKeysToKeep
|
|
7245
7255
|
});
|
|
7246
7256
|
setTimeout(() => {
|
|
7247
7257
|
var _payload$callback3;
|
|
@@ -9263,11 +9273,12 @@ function getStoredHostedOAuthValue(key) {
|
|
|
9263
9273
|
}
|
|
9264
9274
|
return null;
|
|
9265
9275
|
}
|
|
9266
|
-
function clearHostedOAuthState() {
|
|
9276
|
+
function clearHostedOAuthState(keysToKeep = []) {
|
|
9267
9277
|
if (typeof window === 'undefined') {
|
|
9268
9278
|
return;
|
|
9269
9279
|
}
|
|
9270
|
-
HOSTED_OAUTH_STORAGE_KEYS.
|
|
9280
|
+
const keysToClear = HOSTED_OAUTH_STORAGE_KEYS.filter(key => !keysToKeep.includes(key));
|
|
9281
|
+
keysToClear.forEach(key => {
|
|
9271
9282
|
window.localStorage.removeItem(key);
|
|
9272
9283
|
window.sessionStorage.removeItem(key);
|
|
9273
9284
|
removeHostedOAuthCookie(key);
|
|
@@ -17509,11 +17520,21 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
17509
17520
|
|
|
17510
17521
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
|
|
17511
17522
|
const actions = sharedActions;
|
|
17512
|
-
const
|
|
17523
|
+
const isEnvironmentScopedRolesFlagOn = () => {
|
|
17513
17524
|
const [isEnabled] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.FeatureFlags.getFeatureFlags([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.ENVIRONMENT_SCOPED_ROLES_FF], store.root.appName);
|
|
17514
17525
|
return isEnabled;
|
|
17515
17526
|
};
|
|
17516
|
-
|
|
17527
|
+
|
|
17528
|
+
// The flag loads before login, so it can't target an account; identity tells per account by sending environmentRoles.
|
|
17529
|
+
// The answer is kept with the tenant it came from, so a tenant switch never reuses it
|
|
17530
|
+
const isEnvironmentScopedRolesEnabled = () => {
|
|
17531
|
+
var _store$auth$user;
|
|
17532
|
+
const tenantId = (_store$auth$user = store.auth.user) == null ? void 0 : _store$auth$user.tenantId;
|
|
17533
|
+
return isEnvironmentScopedRolesFlagOn() && !!tenantId && store.auth.teamState.environmentRolesEnabledForTenantId === tenantId;
|
|
17534
|
+
};
|
|
17535
|
+
|
|
17536
|
+
// Saves keep the requested roles even before identity's answer loads; identity rejects them when off for the account
|
|
17537
|
+
const getEnabledEnvironmentRoles = requested => isEnvironmentScopedRolesFlagOn() ? requested : undefined;
|
|
17517
17538
|
|
|
17518
17539
|
/**
|
|
17519
17540
|
* @private
|
|
@@ -17537,6 +17558,7 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
17537
17558
|
* Enriches users with roles, groups, permissions, and application data
|
|
17538
17559
|
*/
|
|
17539
17560
|
const __enrichUsersWithRolesGroupsAndPermissions = async (users, options) => {
|
|
17561
|
+
var _options$tenantId, _store$auth$user2, _store$auth$user3;
|
|
17540
17562
|
const {
|
|
17541
17563
|
shouldLoadRoles = true,
|
|
17542
17564
|
shouldLoadApps,
|
|
@@ -17546,6 +17568,8 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
17546
17568
|
|
|
17547
17569
|
// Get user IDs for fetching roles and groups and emails
|
|
17548
17570
|
const userIds = users.map(user => user.id);
|
|
17571
|
+
// Identity answers for the tenant the load started on, so a switch during the load discards the answer
|
|
17572
|
+
const requestTenantId = (_options$tenantId = options.tenantId) != null ? _options$tenantId : (_store$auth$user2 = store.auth.user) == null ? void 0 : _store$auth$user2.tenantId;
|
|
17549
17573
|
|
|
17550
17574
|
// Fetch roles, permissions, user roles, user groups, user emails, and all groups in parallel
|
|
17551
17575
|
const [{
|
|
@@ -17575,7 +17599,18 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
17575
17599
|
}, __getGroupsForUsers(retryConfig), shouldLoadRoles ? loadRoles({
|
|
17576
17600
|
retryConfig
|
|
17577
17601
|
}) : undefined]);
|
|
17578
|
-
const shouldKeepEnvironmentRoles =
|
|
17602
|
+
const shouldKeepEnvironmentRoles = isEnvironmentScopedRolesFlagOn();
|
|
17603
|
+
if (shouldKeepEnvironmentRoles && userRoles.length > 0 && requestTenantId === ((_store$auth$user3 = store.auth.user) == null ? void 0 : _store$auth$user3.tenantId)) {
|
|
17604
|
+
const isEnabledForAccount = userRoles.some(({
|
|
17605
|
+
environmentRoles
|
|
17606
|
+
}) => environmentRoles !== undefined);
|
|
17607
|
+
const environmentRolesEnabledForTenantId = isEnabledForAccount ? requestTenantId : undefined;
|
|
17608
|
+
if (environmentRolesEnabledForTenantId !== store.auth.teamState.environmentRolesEnabledForTenantId) {
|
|
17609
|
+
actions.setTeamState({
|
|
17610
|
+
environmentRolesEnabledForTenantId
|
|
17611
|
+
});
|
|
17612
|
+
}
|
|
17613
|
+
}
|
|
17579
17614
|
|
|
17580
17615
|
// Map user roles and groups to users
|
|
17581
17616
|
const usersWithRolesAndGroups = users.map(user => {
|
|
@@ -17704,6 +17739,8 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
17704
17739
|
pageOffset
|
|
17705
17740
|
});
|
|
17706
17741
|
try {
|
|
17742
|
+
var _store$auth$user4;
|
|
17743
|
+
const requestTenantId = (_store$auth$user4 = store.auth.user) == null ? void 0 : _store$auth$user4.tenantId;
|
|
17707
17744
|
const response = await fetchFunction(pageOffset, pageSize);
|
|
17708
17745
|
if (!response.items || response.items.length === 0) {
|
|
17709
17746
|
sharedActions.setTeamState({
|
|
@@ -17739,7 +17776,8 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
17739
17776
|
shouldLoadRoles,
|
|
17740
17777
|
shouldLoadApps,
|
|
17741
17778
|
shouldLoadEmails,
|
|
17742
|
-
retryConfig
|
|
17779
|
+
retryConfig,
|
|
17780
|
+
tenantId: requestTenantId
|
|
17743
17781
|
});
|
|
17744
17782
|
__setUsersStateAndCallback(enrichedUsers, roles, permissions, response._metadata.totalPages, response._metadata.totalItems, callback);
|
|
17745
17783
|
} catch (e) {
|
|
@@ -17782,35 +17820,59 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
17782
17820
|
});
|
|
17783
17821
|
}
|
|
17784
17822
|
};
|
|
17823
|
+
let latestEnvironmentsRequest = 0;
|
|
17824
|
+
const isSameEnvironments = (current = [], loaded) => current.length === loaded.length && current.every(({
|
|
17825
|
+
id,
|
|
17826
|
+
environmentName
|
|
17827
|
+
}, index) => id === loaded[index].id && environmentName === loaded[index].environmentName);
|
|
17828
|
+
|
|
17829
|
+
// Only the latest request updates the state, so an older answer arriving last can't bring back an old list.
|
|
17830
|
+
// The list is stored with its tenant, so a switch during the request discards it and another tenant's list is never shown
|
|
17785
17831
|
const loadEnvironments = async payload => {
|
|
17832
|
+
var _store$auth$user5;
|
|
17786
17833
|
if (!isEnvironmentScopedRolesEnabled()) {
|
|
17787
17834
|
return;
|
|
17788
17835
|
}
|
|
17836
|
+
const request = ++latestEnvironmentsRequest;
|
|
17837
|
+
const isLatestRequest = () => request === latestEnvironmentsRequest;
|
|
17838
|
+
const requestTenantId = (_store$auth$user5 = store.auth.user) == null ? void 0 : _store$auth$user5.tenantId;
|
|
17789
17839
|
actions.setTeamLoader({
|
|
17790
17840
|
key: _interfaces__WEBPACK_IMPORTED_MODULE_6__.TeamStateKeys.ENVIRONMENTS,
|
|
17791
17841
|
value: true
|
|
17792
17842
|
});
|
|
17793
17843
|
try {
|
|
17794
|
-
var _payload$callback3;
|
|
17844
|
+
var _store$auth$user6, _payload$callback3;
|
|
17795
17845
|
const {
|
|
17796
17846
|
vendors: environments
|
|
17797
17847
|
} = await api.vendor.getAccount();
|
|
17798
|
-
|
|
17799
|
-
environments
|
|
17800
|
-
|
|
17848
|
+
const {
|
|
17849
|
+
environments: currentEnvironments,
|
|
17850
|
+
environmentsTenantId
|
|
17851
|
+
} = store.auth.teamState;
|
|
17852
|
+
const isStoredForTenant = environmentsTenantId === requestTenantId && isSameEnvironments(currentEnvironments, environments);
|
|
17853
|
+
if (isLatestRequest() && requestTenantId === ((_store$auth$user6 = store.auth.user) == null ? void 0 : _store$auth$user6.tenantId) && !isStoredForTenant) {
|
|
17854
|
+
actions.setTeamState({
|
|
17855
|
+
environments,
|
|
17856
|
+
environmentsTenantId: requestTenantId
|
|
17857
|
+
});
|
|
17858
|
+
}
|
|
17801
17859
|
payload == null ? void 0 : (_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, environments);
|
|
17802
17860
|
} catch (e) {
|
|
17803
17861
|
var _payload$callback4;
|
|
17804
17862
|
payload == null ? void 0 : (_payload$callback4 = payload.callback) == null ? void 0 : _payload$callback4.call(payload, null, e);
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17863
|
+
if (isLatestRequest()) {
|
|
17864
|
+
actions.setTeamError({
|
|
17865
|
+
key: _interfaces__WEBPACK_IMPORTED_MODULE_6__.TeamStateKeys.ENVIRONMENTS,
|
|
17866
|
+
value: (0,_helpers__WEBPACK_IMPORTED_MODULE_7__.errorHandler)(e)
|
|
17867
|
+
});
|
|
17868
|
+
}
|
|
17809
17869
|
} finally {
|
|
17810
|
-
|
|
17811
|
-
|
|
17812
|
-
|
|
17813
|
-
|
|
17870
|
+
if (isLatestRequest()) {
|
|
17871
|
+
actions.setTeamLoader({
|
|
17872
|
+
key: _interfaces__WEBPACK_IMPORTED_MODULE_6__.TeamStateKeys.ENVIRONMENTS,
|
|
17873
|
+
value: false
|
|
17874
|
+
});
|
|
17875
|
+
}
|
|
17814
17876
|
}
|
|
17815
17877
|
};
|
|
17816
17878
|
/*** @deprecated loadUsers is deprecated, use loadUsersV3 instead */
|
|
@@ -17986,6 +18048,8 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
17986
18048
|
pageOffset
|
|
17987
18049
|
});
|
|
17988
18050
|
try {
|
|
18051
|
+
var _store$auth$user7;
|
|
18052
|
+
const requestTenantId = (_store$auth$user7 = store.auth.user) == null ? void 0 : _store$auth$user7.tenantId;
|
|
17989
18053
|
// First fetch users with v3 API
|
|
17990
18054
|
const {
|
|
17991
18055
|
items: users,
|
|
@@ -18012,7 +18076,8 @@ const _excluded = ["callback", "appIds", "environmentRoles"],
|
|
|
18012
18076
|
shouldLoadRoles,
|
|
18013
18077
|
shouldLoadApps,
|
|
18014
18078
|
shouldLoadEmails,
|
|
18015
|
-
retryConfig
|
|
18079
|
+
retryConfig,
|
|
18080
|
+
tenantId: requestTenantId
|
|
18016
18081
|
});
|
|
18017
18082
|
__setUsersStateAndCallback(enrichedUsers, roles, permissions, totalPages, totalItems, callback);
|
|
18018
18083
|
} catch (e) {
|
|
@@ -21612,7 +21677,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21612
21677
|
/* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
|
|
21613
21678
|
/* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
|
|
21614
21679
|
/* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
|
|
21615
|
-
/** @license Frontegg v7.
|
|
21680
|
+
/** @license Frontegg v7.135.0
|
|
21616
21681
|
*
|
|
21617
21682
|
* This source code is licensed under the MIT license found in the
|
|
21618
21683
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -32455,7 +32520,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32455
32520
|
/* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
|
|
32456
32521
|
/* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
|
|
32457
32522
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
|
|
32458
|
-
/** @license Frontegg v7.
|
|
32523
|
+
/** @license Frontegg v7.135.0
|
|
32459
32524
|
*
|
|
32460
32525
|
* This source code is licensed under the MIT license found in the
|
|
32461
32526
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -35312,7 +35377,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35312
35377
|
/* harmony export */ });
|
|
35313
35378
|
/* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
|
|
35314
35379
|
/* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
|
|
35315
|
-
/** @license Frontegg v7.
|
|
35380
|
+
/** @license Frontegg v7.135.0
|
|
35316
35381
|
*
|
|
35317
35382
|
* This source code is licensed under the MIT license found in the
|
|
35318
35383
|
* LICENSE file in the root directory of this source tree.
|