@frontegg/redux-store 4.18.1 → 4.19.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/LoginState/index.d.ts +3 -0
- package/auth/LoginState/interfaces.d.ts +1 -0
- package/auth/LoginState/saga.d.ts +1 -0
- package/auth/index.d.ts +1 -0
- package/auth/index.js +49 -10
- package/auth/index.js.map +1 -1
- package/auth/reducer.d.ts +1 -0
- package/connectivity/ConnectivityState/index.d.ts +80 -1
- package/connectivity/index.d.ts +2 -0
- package/connectivity/index.js +51 -2
- package/connectivity/index.js.map +1 -1
- package/connectivity/interfaces.d.ts +7 -0
- package/connectivity/reducer.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ILogin, ILoginWithMfa, IPasswordlessPostLogin, IPasswordlessPreLogin, IPostLogin, IPreLogin, IRecoverMFAToken } from '@frontegg/rest-api';
|
|
2
2
|
import { LoginState } from './interfaces';
|
|
3
3
|
import { WithCallback } from '../../interfaces';
|
|
4
|
+
import { IVerifyInviteToken } from '@frontegg/rest-api';
|
|
4
5
|
declare const loginState: LoginState;
|
|
5
6
|
declare const reducers: {
|
|
6
7
|
setLoginState: {
|
|
@@ -89,6 +90,7 @@ declare const actions: {
|
|
|
89
90
|
}, string, never, never>;
|
|
90
91
|
passwordlessPreLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IPasswordlessPreLogin, void>], WithCallback<IPasswordlessPreLogin, void>, string, never, never>;
|
|
91
92
|
passwordlessPostLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[IPasswordlessPostLogin], IPasswordlessPostLogin, string, never, never>;
|
|
93
|
+
verifyInviteToken: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[IVerifyInviteToken], IVerifyInviteToken, string, never, never>;
|
|
92
94
|
};
|
|
93
95
|
/**
|
|
94
96
|
* To be used for actions types after dispatch, and should contains
|
|
@@ -113,6 +115,7 @@ declare type DispatchedActions = {
|
|
|
113
115
|
}) => void;
|
|
114
116
|
passwordlessPreLogin: (payload: IPasswordlessPreLogin) => void;
|
|
115
117
|
passwordlessPostLogin: (payload: IPasswordlessPostLogin) => void;
|
|
118
|
+
verifyInviteToken: (payload: IVerifyInviteToken) => void;
|
|
116
119
|
};
|
|
117
120
|
export declare type LoginActions = DispatchedActions;
|
|
118
121
|
export { loginState, reducers as loginReducers, actions as loginActions };
|
|
@@ -76,6 +76,7 @@ export declare function refreshToken(): Generator<import("redux-saga/effects").S
|
|
|
76
76
|
qrCode?: string | undefined;
|
|
77
77
|
recoveryCode?: string | undefined;
|
|
78
78
|
emailVerified?: boolean | undefined;
|
|
79
|
+
redirectLocation?: string | undefined;
|
|
79
80
|
} & Partial<AuthState>>;
|
|
80
81
|
export declare function loginSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
81
82
|
export declare function loginSagasMock(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
package/auth/index.d.ts
CHANGED
|
@@ -176,6 +176,7 @@ declare const _default: {
|
|
|
176
176
|
}, string, never, never>;
|
|
177
177
|
passwordlessPreLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IPasswordlessPreLogin, void>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IPasswordlessPreLogin, void>, string, never, never>;
|
|
178
178
|
passwordlessPostLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").IPasswordlessPostLogin], import("@frontegg/rest-api").IPasswordlessPostLogin, string, never, never>;
|
|
179
|
+
verifyInviteToken: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").IVerifyInviteToken], import("@frontegg/rest-api").IVerifyInviteToken, string, never, never>;
|
|
179
180
|
setRolesState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./RolesState/interfaces").RolesState>], Partial<import("./RolesState/interfaces").RolesState>, string, never, never>;
|
|
180
181
|
resetRolesState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
181
182
|
setTenantsState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./TenantsState/interfaces").TenantsState>], Partial<import("./TenantsState/interfaces").TenantsState>, string, never, never>;
|
package/auth/index.js
CHANGED
|
@@ -99,6 +99,7 @@ var actions$f = {
|
|
|
99
99
|
checkIfAllowToRememberMfaDevice: toolkit.createAction(constants.authStoreName + "/checkIfAllowToRememberMfaDevice", function (payload) { return ({ payload: payload }); }),
|
|
100
100
|
passwordlessPreLogin: toolkit.createAction(constants.authStoreName + "/passwordlessPreLogin", function (payload) { return ({ payload: payload }); }),
|
|
101
101
|
passwordlessPostLogin: toolkit.createAction(constants.authStoreName + "/passwordlessPostLogin", function (payload) { return ({ payload: payload }); }),
|
|
102
|
+
verifyInviteToken: toolkit.createAction(constants.authStoreName + "/verifyInviteToken", function (payload) { return ({ payload: payload }); }),
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
exports.ActivateAccountStep = void 0;
|
|
@@ -1646,6 +1647,37 @@ function passwordlessPostLogin(_a) {
|
|
|
1646
1647
|
}
|
|
1647
1648
|
});
|
|
1648
1649
|
}
|
|
1650
|
+
function verifyInviteToken(_a) {
|
|
1651
|
+
var inviteTokenTenantName;
|
|
1652
|
+
var payload = _a.payload;
|
|
1653
|
+
return tslib.__generator(this, function (_b) {
|
|
1654
|
+
switch (_b.label) {
|
|
1655
|
+
case 0:
|
|
1656
|
+
_b.trys.push([0, 4, 6, 8]);
|
|
1657
|
+
return [4 /*yield*/, effects.put(actions.setLoginState({ loading: true }))];
|
|
1658
|
+
case 1:
|
|
1659
|
+
_b.sent();
|
|
1660
|
+
return [4 /*yield*/, effects.call(restApi.api.auth.verifyInviteToken, payload)];
|
|
1661
|
+
case 2:
|
|
1662
|
+
inviteTokenTenantName = (_b.sent()).name;
|
|
1663
|
+
return [4 /*yield*/, effects.put(actions.setLoginState({ inviteTokenTenantName: inviteTokenTenantName }))];
|
|
1664
|
+
case 3:
|
|
1665
|
+
_b.sent();
|
|
1666
|
+
return [3 /*break*/, 8];
|
|
1667
|
+
case 4:
|
|
1668
|
+
_b.sent();
|
|
1669
|
+
return [4 /*yield*/, effects.put(actions.setLoginState({ error: "We couldn't verify your invitation" }))];
|
|
1670
|
+
case 5:
|
|
1671
|
+
_b.sent();
|
|
1672
|
+
return [3 /*break*/, 8];
|
|
1673
|
+
case 6: return [4 /*yield*/, effects.put(actions.setLoginState({ loading: false }))];
|
|
1674
|
+
case 7:
|
|
1675
|
+
_b.sent();
|
|
1676
|
+
return [7 /*endfinally*/];
|
|
1677
|
+
case 8: return [2 /*return*/];
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1649
1681
|
function preLogin(_a) {
|
|
1650
1682
|
var onRedirectTo_1, _b, address_1, idpType, oidcRedirectUrl;
|
|
1651
1683
|
var _c = _a.payload, email = _c.email, recaptchaToken = _c.recaptchaToken, callback = _c.callback;
|
|
@@ -1783,7 +1815,7 @@ function postLogin(_a) {
|
|
|
1783
1815
|
});
|
|
1784
1816
|
}
|
|
1785
1817
|
function login(_a) {
|
|
1786
|
-
var user, setMfaState, step, isAuthenticated, loggedInUser, allowRememberDevice, isAllowedToRemember, mfaDeviceExpiration,
|
|
1818
|
+
var user, setMfaState, step, isAuthenticated, loggedInUser, allowRememberDevice, isAllowedToRemember, mfaDeviceExpiration, e_9;
|
|
1787
1819
|
var _b = _a.payload, email = _b.email, password = _b.password, recaptchaToken = _b.recaptchaToken, invitationToken = _b.invitationToken;
|
|
1788
1820
|
return tslib.__generator(this, function (_c) {
|
|
1789
1821
|
switch (_c.label) {
|
|
@@ -1848,12 +1880,12 @@ function login(_a) {
|
|
|
1848
1880
|
_c.label = 9;
|
|
1849
1881
|
case 9: return [3 /*break*/, 12];
|
|
1850
1882
|
case 10:
|
|
1851
|
-
|
|
1883
|
+
e_9 = _c.sent();
|
|
1852
1884
|
restApi.ContextHolder.setAccessToken(null);
|
|
1853
1885
|
restApi.ContextHolder.setUser(null);
|
|
1854
1886
|
return [4 /*yield*/, effects.put(actions.setLoginState({
|
|
1855
1887
|
email: email,
|
|
1856
|
-
error:
|
|
1888
|
+
error: e_9.message,
|
|
1857
1889
|
loading: false,
|
|
1858
1890
|
}))];
|
|
1859
1891
|
case 11:
|
|
@@ -1864,7 +1896,7 @@ function login(_a) {
|
|
|
1864
1896
|
});
|
|
1865
1897
|
}
|
|
1866
1898
|
function loginWithMfa(_a) {
|
|
1867
|
-
var user, step,
|
|
1899
|
+
var user, step, e_10;
|
|
1868
1900
|
var _b = _a.payload, mfaToken = _b.mfaToken, value = _b.value, rememberDevice = _b.rememberDevice, callback = _b.callback;
|
|
1869
1901
|
return tslib.__generator(this, function (_c) {
|
|
1870
1902
|
switch (_c.label) {
|
|
@@ -1896,18 +1928,18 @@ function loginWithMfa(_a) {
|
|
|
1896
1928
|
_c.label = 7;
|
|
1897
1929
|
case 7: return [3 /*break*/, 10];
|
|
1898
1930
|
case 8:
|
|
1899
|
-
|
|
1900
|
-
return [4 /*yield*/, effects.put(actions.setLoginState({ error:
|
|
1931
|
+
e_10 = _c.sent();
|
|
1932
|
+
return [4 /*yield*/, effects.put(actions.setLoginState({ error: e_10.message, loading: false }))];
|
|
1901
1933
|
case 9:
|
|
1902
1934
|
_c.sent();
|
|
1903
|
-
callback === null || callback === void 0 ? void 0 : callback(false,
|
|
1935
|
+
callback === null || callback === void 0 ? void 0 : callback(false, e_10);
|
|
1904
1936
|
return [3 /*break*/, 10];
|
|
1905
1937
|
case 10: return [2 /*return*/];
|
|
1906
1938
|
}
|
|
1907
1939
|
});
|
|
1908
1940
|
}
|
|
1909
1941
|
function recoverMfa(_a) {
|
|
1910
|
-
var
|
|
1942
|
+
var e_11;
|
|
1911
1943
|
var payload = _a.payload;
|
|
1912
1944
|
return tslib.__generator(this, function (_b) {
|
|
1913
1945
|
switch (_b.label) {
|
|
@@ -1928,8 +1960,8 @@ function recoverMfa(_a) {
|
|
|
1928
1960
|
_b.sent();
|
|
1929
1961
|
return [3 /*break*/, 8];
|
|
1930
1962
|
case 6:
|
|
1931
|
-
|
|
1932
|
-
return [4 /*yield*/, effects.put(actions.setLoginState({ error:
|
|
1963
|
+
e_11 = _b.sent();
|
|
1964
|
+
return [4 /*yield*/, effects.put(actions.setLoginState({ error: e_11.message, loading: false }))];
|
|
1933
1965
|
case 7:
|
|
1934
1966
|
_b.sent();
|
|
1935
1967
|
return [3 /*break*/, 8];
|
|
@@ -2016,6 +2048,9 @@ function loginSagas() {
|
|
|
2016
2048
|
_a.sent();
|
|
2017
2049
|
return [4 /*yield*/, effects.takeLeading(actions.passwordlessPostLogin, passwordlessPostLogin)];
|
|
2018
2050
|
case 10:
|
|
2051
|
+
_a.sent();
|
|
2052
|
+
return [4 /*yield*/, effects.takeLeading(actions.verifyInviteToken, verifyInviteToken)];
|
|
2053
|
+
case 11:
|
|
2019
2054
|
_a.sent();
|
|
2020
2055
|
return [2 /*return*/];
|
|
2021
2056
|
}
|
|
@@ -3362,6 +3397,10 @@ function activateAccount(_a) {
|
|
|
3362
3397
|
return [4 /*yield*/, effects.call(restApi.api.auth.activateAccount, payload)];
|
|
3363
3398
|
case 4:
|
|
3364
3399
|
data = _b.sent();
|
|
3400
|
+
if (data.redirectLocation) {
|
|
3401
|
+
window.location.href = data.redirectLocation;
|
|
3402
|
+
return [2 /*return*/];
|
|
3403
|
+
}
|
|
3365
3404
|
if (!isMfaRequired(data)) return [3 /*break*/, 7];
|
|
3366
3405
|
return [4 /*yield*/, getMfaRequiredState(data)];
|
|
3367
3406
|
case 5:
|