@frontegg/redux-store 7.60.0 → 7.61.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/auth/TenantsState/actions.js +17 -3
- package/auth/TenantsState/interfaces.d.ts +1 -0
- package/auth/TenantsState/state.js +1 -0
- package/auth/index.d.ts +1 -1
- package/auth/index.js +2 -2
- package/index.js +1 -1
- package/node/auth/TenantsState/actions.js +17 -3
- package/node/auth/TenantsState/state.js +1 -0
- package/node/auth/index.js +2 -2
- package/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -12,24 +12,38 @@ export default ((store, api, sharedActions) => {
|
|
|
12
12
|
const switchTenant = async payload => {
|
|
13
13
|
const {
|
|
14
14
|
tenantId,
|
|
15
|
+
silentReload,
|
|
15
16
|
callback
|
|
16
17
|
} = payload;
|
|
17
|
-
actions.
|
|
18
|
+
silentReload ? actions.setTenantsState({
|
|
19
|
+
switchingTenant: true
|
|
20
|
+
}) : actions.setAuthState({
|
|
18
21
|
isLoading: true
|
|
19
22
|
});
|
|
20
23
|
try {
|
|
21
24
|
await api.tenants.switchTenant({
|
|
22
25
|
tenantId
|
|
23
26
|
});
|
|
27
|
+
if (silentReload) {
|
|
28
|
+
actions.resetAuthState({
|
|
29
|
+
isLoading: false,
|
|
30
|
+
isAuthenticated: true,
|
|
31
|
+
user: store.auth.user
|
|
32
|
+
});
|
|
33
|
+
}
|
|
24
34
|
await actions.__refreshToken();
|
|
25
35
|
const callbackConsumed = callback == null ? void 0 : callback(true);
|
|
26
36
|
if (!callbackConsumed) {
|
|
27
|
-
actions.
|
|
37
|
+
silentReload ? actions.setTenantsState({
|
|
38
|
+
switchingTenant: false
|
|
39
|
+
}) : actions.setAuthState({
|
|
28
40
|
isLoading: false
|
|
29
41
|
});
|
|
30
42
|
}
|
|
31
43
|
} catch (e) {
|
|
32
|
-
actions.
|
|
44
|
+
silentReload ? actions.setTenantsState({
|
|
45
|
+
switchingTenant: false
|
|
46
|
+
}) : actions.setAuthState({
|
|
33
47
|
isLoading: false
|
|
34
48
|
});
|
|
35
49
|
callback == null ? void 0 : callback(false, e);
|
package/auth/index.d.ts
CHANGED
|
@@ -145,6 +145,6 @@ export type AuthActions = {
|
|
|
145
145
|
setState: (state: Partial<FronteggState['auth']>) => void;
|
|
146
146
|
setAuthState: (state: Partial<FronteggState['auth']>) => void;
|
|
147
147
|
setErrorByRequestName: (payload: SingleErrorByRequestDataPayload) => void;
|
|
148
|
-
resetAuthState: () => void;
|
|
148
|
+
resetAuthState: (state?: Partial<AuthState>) => void;
|
|
149
149
|
setUser: (user: User | null) => void;
|
|
150
150
|
} & AcceptInvitationActions & AccountSettingsActions & UnlockAccountActions & ActivateAccountActions & ApiTokensActions & ApplicationsActions & CustomLoginActions & EntitlementsActions & ForgotPasswordActions & PasswordRotationActions & GroupsActions & GroupsDialogsActions & ImpersonateActions & LoginActions & MfaActions & AllAccountsActions & AllAccountsDialogActions & PasskeysActions & ProfileActions & ProvisioningActions & ResetPhoneNumberActions & RolesActions & RestrictionsActions & SecurityCenterActions & SecurityPolicyActions & SessionsPolicyActions & SessionsActions & SignUpActions & SmsActions & SocialLoginActions & SSOActions & StepUpActions & TeamActions & TenantsActions;
|
package/auth/index.js
CHANGED
|
@@ -140,8 +140,8 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
|
-
const resetAuthState = () => {
|
|
144
|
-
deepResetState(store, ['auth'], snapshotAuthState);
|
|
143
|
+
const resetAuthState = (state = {}) => {
|
|
144
|
+
deepResetState(store, ['auth'], _extends({}, snapshotAuthState, state));
|
|
145
145
|
};
|
|
146
146
|
const setUser = user => {
|
|
147
147
|
setAuthState({
|
package/index.js
CHANGED
|
@@ -18,24 +18,38 @@ var _default = (store, api, sharedActions) => {
|
|
|
18
18
|
const switchTenant = async payload => {
|
|
19
19
|
const {
|
|
20
20
|
tenantId,
|
|
21
|
+
silentReload,
|
|
21
22
|
callback
|
|
22
23
|
} = payload;
|
|
23
|
-
actions.
|
|
24
|
+
silentReload ? actions.setTenantsState({
|
|
25
|
+
switchingTenant: true
|
|
26
|
+
}) : actions.setAuthState({
|
|
24
27
|
isLoading: true
|
|
25
28
|
});
|
|
26
29
|
try {
|
|
27
30
|
await api.tenants.switchTenant({
|
|
28
31
|
tenantId
|
|
29
32
|
});
|
|
33
|
+
if (silentReload) {
|
|
34
|
+
actions.resetAuthState({
|
|
35
|
+
isLoading: false,
|
|
36
|
+
isAuthenticated: true,
|
|
37
|
+
user: store.auth.user
|
|
38
|
+
});
|
|
39
|
+
}
|
|
30
40
|
await actions.__refreshToken();
|
|
31
41
|
const callbackConsumed = callback == null ? void 0 : callback(true);
|
|
32
42
|
if (!callbackConsumed) {
|
|
33
|
-
actions.
|
|
43
|
+
silentReload ? actions.setTenantsState({
|
|
44
|
+
switchingTenant: false
|
|
45
|
+
}) : actions.setAuthState({
|
|
34
46
|
isLoading: false
|
|
35
47
|
});
|
|
36
48
|
}
|
|
37
49
|
} catch (e) {
|
|
38
|
-
actions.
|
|
50
|
+
silentReload ? actions.setTenantsState({
|
|
51
|
+
switchingTenant: false
|
|
52
|
+
}) : actions.setAuthState({
|
|
39
53
|
isLoading: false
|
|
40
54
|
});
|
|
41
55
|
callback == null ? void 0 : callback(false, e);
|
package/node/auth/index.js
CHANGED
|
@@ -537,8 +537,8 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
537
537
|
}
|
|
538
538
|
});
|
|
539
539
|
};
|
|
540
|
-
const resetAuthState = () => {
|
|
541
|
-
(0, _helpers.deepResetState)(store, ['auth'], snapshotAuthState);
|
|
540
|
+
const resetAuthState = (state = {}) => {
|
|
541
|
+
(0, _helpers.deepResetState)(store, ['auth'], (0, _extends2.default)({}, snapshotAuthState, state));
|
|
542
542
|
};
|
|
543
543
|
const setUser = user => {
|
|
544
544
|
setAuthState({
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.61.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.
|
|
10
|
+
"@frontegg/rest-api": "7.61.0",
|
|
11
11
|
"fast-deep-equal": "3.1.3",
|
|
12
12
|
"get-value": "^3.0.1",
|
|
13
13
|
"proxy-compare": "^3.0.0",
|