@frontegg/redux-store 5.10.0 → 5.14.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/ActivateState/index.d.ts +2 -2
- package/auth/ApiTokensState/interfaces.d.ts +2 -1
- package/auth/LoginState/index.d.ts +4 -4
- package/auth/LoginState/saga.d.ts +4 -17
- package/auth/SignUp/saga.d.ts +6 -1
- package/auth/index.d.ts +3 -3
- package/auth/index.js +218 -213
- package/auth/reducer.d.ts +3 -3
- package/connectivity/index.js +2 -1
- package/node/auth/index.js +217 -212
- package/node/connectivity/index.js +2 -1
- package/node/subscriptions/index.js +1 -1
- package/package.json +2 -2
- package/subscriptions/index.js +1 -1
package/node/auth/index.js
CHANGED
|
@@ -770,8 +770,10 @@ const tenantsDemo = [
|
|
|
770
770
|
function* loadAllowSignUps() {
|
|
771
771
|
yield effects.put(actions.setSignUpState({ loading: true }));
|
|
772
772
|
try {
|
|
773
|
-
const
|
|
773
|
+
const policy = yield effects.call(restApi.api.auth.getVendorConfig);
|
|
774
|
+
const { allowSignups: allowSignUps, allowNotVerifiedUsersLogin } = policy;
|
|
774
775
|
yield effects.put(actions.setSignUpState({ loading: false, allowSignUps, allowNotVerifiedUsersLogin, firstLoad: false }));
|
|
776
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ policy, loading: false }));
|
|
775
777
|
}
|
|
776
778
|
catch (e) {
|
|
777
779
|
yield effects.put(actions.setSignUpState({ loading: false, error: e.message, firstLoad: false }));
|
|
@@ -827,207 +829,6 @@ function* signUpSaga() {
|
|
|
827
829
|
yield effects.takeLeading(actions.resetSignUpStateSoft, resetSignUpStateSoft);
|
|
828
830
|
}
|
|
829
831
|
|
|
830
|
-
function* loadSecurityPolicy() {
|
|
831
|
-
yield effects.put(actions.setSecurityPolicyGlobalState({ loading: true, error: null }));
|
|
832
|
-
try {
|
|
833
|
-
const policy = yield effects.call(restApi.api.auth.getGlobalSecurityPolicy);
|
|
834
|
-
yield effects.put(actions.setSecurityPolicyGlobalState({ policy, loading: false }));
|
|
835
|
-
}
|
|
836
|
-
catch (e) {
|
|
837
|
-
yield effects.put(actions.setSecurityPolicyGlobalState({ error: e.message, loading: false }));
|
|
838
|
-
}
|
|
839
|
-
yield effects.put(actions.loadSecurityPolicyMfa());
|
|
840
|
-
yield effects.put(actions.loadSecurityPolicyLockout());
|
|
841
|
-
yield effects.put(actions.loadSecurityPolicyCaptcha());
|
|
842
|
-
}
|
|
843
|
-
function* loadPublicSecurityPolicy() {
|
|
844
|
-
yield effects.put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
|
|
845
|
-
try {
|
|
846
|
-
const policy = yield effects.call(restApi.api.auth.getVendorConfig);
|
|
847
|
-
yield effects.put(actions.setSecurityPolicyPublicState({ policy, loading: false }));
|
|
848
|
-
}
|
|
849
|
-
catch (e) {
|
|
850
|
-
yield effects.put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
function* loadSecurityPolicyMfa() {
|
|
854
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
|
|
855
|
-
try {
|
|
856
|
-
const policy = yield effects.call(restApi.api.auth.getMfaPolicy);
|
|
857
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ policy, loading: false }));
|
|
858
|
-
}
|
|
859
|
-
catch (e) {
|
|
860
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ error: e.message, loading: false }));
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
function* saveSecurityPolicyMfa(_a) {
|
|
864
|
-
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
865
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ saving: true, error: null }));
|
|
866
|
-
try {
|
|
867
|
-
const policy = yield effects.call(restApi.api.auth.saveMfaPolicy, newSecurityPolicy);
|
|
868
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ policy, saving: false }));
|
|
869
|
-
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
870
|
-
}
|
|
871
|
-
catch (e) {
|
|
872
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ saving: false, error: e.message }));
|
|
873
|
-
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
function* loadSecurityPolicyLockout() {
|
|
877
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
878
|
-
try {
|
|
879
|
-
const policy = yield effects.call(restApi.api.auth.getLockoutPolicy);
|
|
880
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, loading: false }));
|
|
881
|
-
}
|
|
882
|
-
catch (e) {
|
|
883
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ error: e.message, loading: false }));
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
function* saveSecurityPolicyLockout(_a) {
|
|
887
|
-
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
888
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: true, error: null }));
|
|
889
|
-
try {
|
|
890
|
-
const policy = yield effects.call(restApi.api.auth.saveLockoutPolicy, newSecurityPolicy);
|
|
891
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, saving: false }));
|
|
892
|
-
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
893
|
-
}
|
|
894
|
-
catch (e) {
|
|
895
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: false, error: e.message }));
|
|
896
|
-
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
function* loadSecurityPolicyCaptcha() {
|
|
900
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
901
|
-
try {
|
|
902
|
-
const policy = yield effects.call(restApi.api.auth.getCaptchaPolicy);
|
|
903
|
-
yield effects.put(actions.setSecurityPolicyCaptchaState({ policy, loading: false }));
|
|
904
|
-
}
|
|
905
|
-
catch (e) {
|
|
906
|
-
yield effects.put(actions.setSecurityPolicyCaptchaState({ error: e.message, loading: false }));
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
function* loadSecurityPolicyPasswordHistory() {
|
|
910
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ loading: true, error: null }));
|
|
911
|
-
try {
|
|
912
|
-
const policy = yield effects.call(restApi.api.auth.getPasswordHistoryPolicy);
|
|
913
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, loading: false }));
|
|
914
|
-
}
|
|
915
|
-
catch (e) {
|
|
916
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ error: e.message, loading: false }));
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
function* saveSecurityPolicyPasswordHistory(_a) {
|
|
920
|
-
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
921
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: true, error: null }));
|
|
922
|
-
try {
|
|
923
|
-
const policy = yield effects.call(restApi.api.auth.savePasswordHistoryPolicy, newSecurityPolicy);
|
|
924
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, saving: false }));
|
|
925
|
-
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
926
|
-
}
|
|
927
|
-
catch (e) {
|
|
928
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: false, error: e.message }));
|
|
929
|
-
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
function* loadVendorPasswordConfig() {
|
|
933
|
-
yield effects.put(actions.setSecurityPolicyPasswordState({ loading: true, error: null }));
|
|
934
|
-
try {
|
|
935
|
-
const policy = yield effects.call(restApi.api.auth.getPasswordConfigPolicy);
|
|
936
|
-
yield effects.put(actions.setSecurityPolicyPasswordState({ policy, loading: false }));
|
|
937
|
-
}
|
|
938
|
-
catch (e) {
|
|
939
|
-
yield effects.put(actions.setSecurityPolicyPasswordState({ error: e.message, loading: false }));
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
function* securityPolicySagas() {
|
|
943
|
-
yield effects.takeLeading(actions.loadSecurityPolicy, loadSecurityPolicy);
|
|
944
|
-
yield effects.takeEvery(actions.saveSecurityPolicyMfa, saveSecurityPolicyMfa);
|
|
945
|
-
yield effects.takeEvery(actions.loadSecurityPolicyMfa, loadSecurityPolicyMfa);
|
|
946
|
-
yield effects.takeEvery(actions.saveSecurityPolicyLockout, saveSecurityPolicyLockout);
|
|
947
|
-
yield effects.takeEvery(actions.loadSecurityPolicyLockout, loadSecurityPolicyLockout);
|
|
948
|
-
yield effects.takeEvery(actions.loadSecurityPolicyCaptcha, loadSecurityPolicyCaptcha);
|
|
949
|
-
yield effects.takeEvery(actions.saveSecurityPolicyPasswordHistory, saveSecurityPolicyPasswordHistory);
|
|
950
|
-
yield effects.takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistory);
|
|
951
|
-
yield effects.takeEvery(actions.loadVendorPasswordConfig, loadVendorPasswordConfig);
|
|
952
|
-
yield effects.takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicy);
|
|
953
|
-
}
|
|
954
|
-
/*********************************
|
|
955
|
-
* Preview Sagas
|
|
956
|
-
*********************************/
|
|
957
|
-
function* loadPublicSecurityPolicyMock() {
|
|
958
|
-
yield effects.put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
|
|
959
|
-
try {
|
|
960
|
-
yield effects.put(actions.setSecurityPolicyPublicState({ policy: publicSecurityPolicy, loading: false }));
|
|
961
|
-
}
|
|
962
|
-
catch (e) {
|
|
963
|
-
yield effects.put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
function* loadSecurityPolicyMock() {
|
|
967
|
-
yield effects.put(actions.setSecurityPolicyGlobalState({ loading: true, error: null }));
|
|
968
|
-
yield delay();
|
|
969
|
-
yield effects.put(actions.setSecurityPolicyGlobalState({ policy: policyDemo, loading: false }));
|
|
970
|
-
yield effects.put(actions.loadSecurityPolicyMfa());
|
|
971
|
-
yield effects.put(actions.loadSecurityPolicyLockout());
|
|
972
|
-
yield effects.put(actions.loadSecurityPolicyCaptcha());
|
|
973
|
-
}
|
|
974
|
-
function* loadSecurityPolicyMfaMock() {
|
|
975
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
|
|
976
|
-
yield delay();
|
|
977
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ policy: policyMfaDemo, loading: false }));
|
|
978
|
-
}
|
|
979
|
-
function* saveSecurityPolicyMfaMock(_a) {
|
|
980
|
-
var _b;
|
|
981
|
-
var _c = _a.payload, { callback } = _c, newSecurityPolicy = tslib.__rest(_c, ["callback"]);
|
|
982
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ saving: true, error: null }));
|
|
983
|
-
const policy = Object.assign(Object.assign({}, policyLockoutDemo), { id: (_b = newSecurityPolicy.id) !== null && _b !== void 0 ? _b : policyLockoutDemo.id, enforceMFAType: newSecurityPolicy.enforceMFAType });
|
|
984
|
-
yield delay();
|
|
985
|
-
yield effects.put(actions.setSecurityPolicyMfaState({ policy, saving: false }));
|
|
986
|
-
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
987
|
-
}
|
|
988
|
-
function* loadSecurityPolicyLockoutMock() {
|
|
989
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
990
|
-
yield delay();
|
|
991
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
|
|
992
|
-
}
|
|
993
|
-
function* saveSecurityPolicyLockoutMock(_a) {
|
|
994
|
-
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
995
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: true, error: null }));
|
|
996
|
-
yield delay();
|
|
997
|
-
const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyLockoutDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyLockoutDemo.id });
|
|
998
|
-
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
999
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, saving: false }));
|
|
1000
|
-
}
|
|
1001
|
-
function* loadSecurityPolicyCaptchaMock() {
|
|
1002
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
1003
|
-
yield delay();
|
|
1004
|
-
yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
|
|
1005
|
-
}
|
|
1006
|
-
function* loadSecurityPolicyPasswordHistoryMock() {
|
|
1007
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ loading: true, error: null }));
|
|
1008
|
-
yield delay();
|
|
1009
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy: policyPasswordHistoryDemo, loading: false }));
|
|
1010
|
-
}
|
|
1011
|
-
function* saveSecurityPolicyPasswordHistoryMock(_a) {
|
|
1012
|
-
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
1013
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: true, error: null }));
|
|
1014
|
-
yield delay();
|
|
1015
|
-
const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyPasswordHistoryDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyPasswordHistoryDemo.id });
|
|
1016
|
-
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
1017
|
-
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, saving: false }));
|
|
1018
|
-
}
|
|
1019
|
-
function* securityPolicySagasMock() {
|
|
1020
|
-
yield effects.takeLeading(actions.loadSecurityPolicy, loadSecurityPolicyMock);
|
|
1021
|
-
yield effects.takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicyMock);
|
|
1022
|
-
yield effects.takeEvery(actions.saveSecurityPolicyMfa, saveSecurityPolicyMfaMock);
|
|
1023
|
-
yield effects.takeEvery(actions.loadSecurityPolicyMfa, loadSecurityPolicyMfaMock);
|
|
1024
|
-
yield effects.takeEvery(actions.saveSecurityPolicyLockout, saveSecurityPolicyLockoutMock);
|
|
1025
|
-
yield effects.takeEvery(actions.loadSecurityPolicyLockout, loadSecurityPolicyLockoutMock);
|
|
1026
|
-
yield effects.takeEvery(actions.loadSecurityPolicyCaptcha, loadSecurityPolicyCaptchaMock);
|
|
1027
|
-
yield effects.takeEvery(actions.saveSecurityPolicyPasswordHistory, saveSecurityPolicyPasswordHistoryMock);
|
|
1028
|
-
yield effects.takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistoryMock);
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
832
|
function* afterAuthNavigation() {
|
|
1032
833
|
var _a;
|
|
1033
834
|
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
@@ -1107,14 +908,14 @@ function* refreshToken() {
|
|
|
1107
908
|
try {
|
|
1108
909
|
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
1109
910
|
const { routes, loginState } = yield effects.select((state) => state.auth);
|
|
1110
|
-
const user = yield effects.call(restApi.api.auth.
|
|
911
|
+
const { user, tenants } = yield effects.call(restApi.api.auth.refreshTokenV2);
|
|
1111
912
|
if (isMfaRequired(user)) {
|
|
1112
913
|
const mfaRequiredState = yield getMfaRequiredState(user);
|
|
1113
914
|
yield effects.put(actions.setState(mfaRequiredState));
|
|
1114
915
|
onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
|
|
1115
916
|
}
|
|
1116
917
|
else {
|
|
1117
|
-
yield effects.put(actions.
|
|
918
|
+
yield effects.put(actions.setTenantsState({ tenants, loading: false }));
|
|
1118
919
|
yield effects.put(actions.setState({ user, isAuthenticated: true }));
|
|
1119
920
|
if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl].some(url => url && window.location.pathname.endsWith(url)) ||
|
|
1120
921
|
(window.location.pathname.endsWith(routes.activateUrl) && user.verified)) {
|
|
@@ -1137,12 +938,11 @@ function* requestAuthorize({ payload: firstTime }) {
|
|
|
1137
938
|
const calls = [];
|
|
1138
939
|
if (firstTime) {
|
|
1139
940
|
yield effects.put(actions.setState({ isLoading: true }));
|
|
1140
|
-
calls.push(effects.call(refreshMetadata));
|
|
1141
941
|
yield effects.put(actions.loadSocialLoginsConfigurationV2());
|
|
1142
942
|
calls.push(effects.call(loadAllowSignUps));
|
|
1143
943
|
calls.push(effects.call(loadSSOPublicConfigurationFunction));
|
|
1144
944
|
calls.push(effects.call(saga.loadVendorPublicInfo));
|
|
1145
|
-
calls.push(effects.call(
|
|
945
|
+
calls.push(effects.call(refreshMetadata));
|
|
1146
946
|
}
|
|
1147
947
|
calls.push(effects.call(refreshToken));
|
|
1148
948
|
yield effects.all(calls);
|
|
@@ -1203,8 +1003,9 @@ function* passwordlessPreLogin(_a) {
|
|
|
1203
1003
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
1204
1004
|
}
|
|
1205
1005
|
}
|
|
1206
|
-
function* passwordlessPostLogin(
|
|
1207
|
-
var
|
|
1006
|
+
function* passwordlessPostLogin(_a) {
|
|
1007
|
+
var _b;
|
|
1008
|
+
var _c = _a.payload, { callback } = _c, payload = tslib.__rest(_c, ["callback"]);
|
|
1208
1009
|
try {
|
|
1209
1010
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1210
1011
|
const data = yield effects.call(restApi.api.auth.passwordlessPostLogin, payload);
|
|
@@ -1221,9 +1022,10 @@ function* passwordlessPostLogin({ payload }) {
|
|
|
1221
1022
|
yield effects.put(actions.setState({ user, isAuthenticated: true }));
|
|
1222
1023
|
yield afterAuthNavigation();
|
|
1223
1024
|
}
|
|
1025
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1224
1026
|
}
|
|
1225
1027
|
catch (e) {
|
|
1226
|
-
yield effects.put(actions.setLoginState({ error: (
|
|
1028
|
+
yield effects.put(actions.setLoginState({ error: (_b = e.message) !== null && _b !== void 0 ? _b : 'Failed to authenticate' }));
|
|
1227
1029
|
}
|
|
1228
1030
|
finally {
|
|
1229
1031
|
yield effects.put(actions.setLoginState({ loading: false }));
|
|
@@ -1307,7 +1109,7 @@ function* postLogin({ payload }) {
|
|
|
1307
1109
|
yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithSSOFailed, loading: false }));
|
|
1308
1110
|
}
|
|
1309
1111
|
}
|
|
1310
|
-
function* login({ payload: { email, password, recaptchaToken, invitationToken } }) {
|
|
1112
|
+
function* login({ payload: { email, password, recaptchaToken, invitationToken, callback } }) {
|
|
1311
1113
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1312
1114
|
try {
|
|
1313
1115
|
const user = yield effects.call(restApi.api.auth.login, {
|
|
@@ -1357,6 +1159,7 @@ function* login({ payload: { email, password, recaptchaToken, invitationToken }
|
|
|
1357
1159
|
yield effects.put(actions.loadTenants());
|
|
1358
1160
|
yield afterAuthNavigation();
|
|
1359
1161
|
}
|
|
1162
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1360
1163
|
}
|
|
1361
1164
|
catch (e) {
|
|
1362
1165
|
restApi.ContextHolder.setAccessToken(null);
|
|
@@ -2309,7 +2112,8 @@ function* forgotPasswordSagas() {
|
|
|
2309
2112
|
yield effects.takeLeading(actions.loadPasswordConfig, loadPasswordConfig);
|
|
2310
2113
|
}
|
|
2311
2114
|
|
|
2312
|
-
function* activateAccount(
|
|
2115
|
+
function* activateAccount(_a) {
|
|
2116
|
+
var _b = _a.payload, { callback } = _b, payload = tslib.__rest(_b, ["callback"]);
|
|
2313
2117
|
yield effects.put(actions.setActivateState({ loading: true }));
|
|
2314
2118
|
try {
|
|
2315
2119
|
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
@@ -2330,6 +2134,7 @@ function* activateAccount({ payload }) {
|
|
|
2330
2134
|
yield effects.put(actions.setState({ user, isAuthenticated: true }));
|
|
2331
2135
|
yield afterAuthNavigation();
|
|
2332
2136
|
}
|
|
2137
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2333
2138
|
}
|
|
2334
2139
|
catch (e) {
|
|
2335
2140
|
yield effects.put(actions.setActivateState({ loading: false, error: e.message }));
|
|
@@ -2798,7 +2603,6 @@ function* loadSocialLoginsConfigurations() {
|
|
|
2798
2603
|
function* loadSocialLoginsConfigurationsV2() {
|
|
2799
2604
|
try {
|
|
2800
2605
|
yield effects.put(actions.setSocialLoginsState({ loading: true }));
|
|
2801
|
-
console.log('api.auth.getSocialLoginProvidersV2', restApi.api.auth.getSocialLoginProvidersV2);
|
|
2802
2606
|
const socialLoginsConfigV2 = yield effects.call(restApi.api.auth.getSocialLoginProvidersV2);
|
|
2803
2607
|
const baseUrl = restApi.fetch.getBaseUrl(restApi.ContextHolder.getContext());
|
|
2804
2608
|
const socialLoginsConfigWithFullUrl = socialLoginsConfigV2.map((_a) => {
|
|
@@ -3041,6 +2845,207 @@ function* apiTokensSagaMock() {
|
|
|
3041
2845
|
yield effects.takeLatest(actions.deleteTenantApiToken, deleteTenantApiTokenMock);
|
|
3042
2846
|
}
|
|
3043
2847
|
|
|
2848
|
+
function* loadSecurityPolicy() {
|
|
2849
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ loading: true, error: null }));
|
|
2850
|
+
try {
|
|
2851
|
+
const policy = yield effects.call(restApi.api.auth.getGlobalSecurityPolicy);
|
|
2852
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ policy, loading: false }));
|
|
2853
|
+
}
|
|
2854
|
+
catch (e) {
|
|
2855
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ error: e.message, loading: false }));
|
|
2856
|
+
}
|
|
2857
|
+
yield effects.put(actions.loadSecurityPolicyMfa());
|
|
2858
|
+
yield effects.put(actions.loadSecurityPolicyLockout());
|
|
2859
|
+
yield effects.put(actions.loadSecurityPolicyCaptcha());
|
|
2860
|
+
}
|
|
2861
|
+
function* loadPublicSecurityPolicy() {
|
|
2862
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
|
|
2863
|
+
try {
|
|
2864
|
+
const policy = yield effects.call(restApi.api.auth.getVendorConfig);
|
|
2865
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ policy, loading: false }));
|
|
2866
|
+
}
|
|
2867
|
+
catch (e) {
|
|
2868
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
function* loadSecurityPolicyMfa() {
|
|
2872
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
|
|
2873
|
+
try {
|
|
2874
|
+
const policy = yield effects.call(restApi.api.auth.getMfaPolicy);
|
|
2875
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ policy, loading: false }));
|
|
2876
|
+
}
|
|
2877
|
+
catch (e) {
|
|
2878
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ error: e.message, loading: false }));
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
function* saveSecurityPolicyMfa(_a) {
|
|
2882
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
2883
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ saving: true, error: null }));
|
|
2884
|
+
try {
|
|
2885
|
+
const policy = yield effects.call(restApi.api.auth.saveMfaPolicy, newSecurityPolicy);
|
|
2886
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ policy, saving: false }));
|
|
2887
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
2888
|
+
}
|
|
2889
|
+
catch (e) {
|
|
2890
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ saving: false, error: e.message }));
|
|
2891
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
function* loadSecurityPolicyLockout() {
|
|
2895
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
2896
|
+
try {
|
|
2897
|
+
const policy = yield effects.call(restApi.api.auth.getLockoutPolicy);
|
|
2898
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, loading: false }));
|
|
2899
|
+
}
|
|
2900
|
+
catch (e) {
|
|
2901
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ error: e.message, loading: false }));
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
function* saveSecurityPolicyLockout(_a) {
|
|
2905
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
2906
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: true, error: null }));
|
|
2907
|
+
try {
|
|
2908
|
+
const policy = yield effects.call(restApi.api.auth.saveLockoutPolicy, newSecurityPolicy);
|
|
2909
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, saving: false }));
|
|
2910
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
2911
|
+
}
|
|
2912
|
+
catch (e) {
|
|
2913
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: false, error: e.message }));
|
|
2914
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
function* loadSecurityPolicyCaptcha() {
|
|
2918
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
2919
|
+
try {
|
|
2920
|
+
const policy = yield effects.call(restApi.api.auth.getCaptchaPolicy);
|
|
2921
|
+
yield effects.put(actions.setSecurityPolicyCaptchaState({ policy, loading: false }));
|
|
2922
|
+
}
|
|
2923
|
+
catch (e) {
|
|
2924
|
+
yield effects.put(actions.setSecurityPolicyCaptchaState({ error: e.message, loading: false }));
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
function* loadSecurityPolicyPasswordHistory() {
|
|
2928
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ loading: true, error: null }));
|
|
2929
|
+
try {
|
|
2930
|
+
const policy = yield effects.call(restApi.api.auth.getPasswordHistoryPolicy);
|
|
2931
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, loading: false }));
|
|
2932
|
+
}
|
|
2933
|
+
catch (e) {
|
|
2934
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ error: e.message, loading: false }));
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
function* saveSecurityPolicyPasswordHistory(_a) {
|
|
2938
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
2939
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: true, error: null }));
|
|
2940
|
+
try {
|
|
2941
|
+
const policy = yield effects.call(restApi.api.auth.savePasswordHistoryPolicy, newSecurityPolicy);
|
|
2942
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, saving: false }));
|
|
2943
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
2944
|
+
}
|
|
2945
|
+
catch (e) {
|
|
2946
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: false, error: e.message }));
|
|
2947
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
function* loadVendorPasswordConfig() {
|
|
2951
|
+
yield effects.put(actions.setSecurityPolicyPasswordState({ loading: true, error: null }));
|
|
2952
|
+
try {
|
|
2953
|
+
const policy = yield effects.call(restApi.api.auth.getPasswordConfigPolicy);
|
|
2954
|
+
yield effects.put(actions.setSecurityPolicyPasswordState({ policy, loading: false }));
|
|
2955
|
+
}
|
|
2956
|
+
catch (e) {
|
|
2957
|
+
yield effects.put(actions.setSecurityPolicyPasswordState({ error: e.message, loading: false }));
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
function* securityPolicySagas() {
|
|
2961
|
+
yield effects.takeLeading(actions.loadSecurityPolicy, loadSecurityPolicy);
|
|
2962
|
+
yield effects.takeEvery(actions.saveSecurityPolicyMfa, saveSecurityPolicyMfa);
|
|
2963
|
+
yield effects.takeEvery(actions.loadSecurityPolicyMfa, loadSecurityPolicyMfa);
|
|
2964
|
+
yield effects.takeEvery(actions.saveSecurityPolicyLockout, saveSecurityPolicyLockout);
|
|
2965
|
+
yield effects.takeEvery(actions.loadSecurityPolicyLockout, loadSecurityPolicyLockout);
|
|
2966
|
+
yield effects.takeEvery(actions.loadSecurityPolicyCaptcha, loadSecurityPolicyCaptcha);
|
|
2967
|
+
yield effects.takeEvery(actions.saveSecurityPolicyPasswordHistory, saveSecurityPolicyPasswordHistory);
|
|
2968
|
+
yield effects.takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistory);
|
|
2969
|
+
yield effects.takeEvery(actions.loadVendorPasswordConfig, loadVendorPasswordConfig);
|
|
2970
|
+
yield effects.takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicy);
|
|
2971
|
+
}
|
|
2972
|
+
/*********************************
|
|
2973
|
+
* Preview Sagas
|
|
2974
|
+
*********************************/
|
|
2975
|
+
function* loadPublicSecurityPolicyMock() {
|
|
2976
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
|
|
2977
|
+
try {
|
|
2978
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ policy: publicSecurityPolicy, loading: false }));
|
|
2979
|
+
}
|
|
2980
|
+
catch (e) {
|
|
2981
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
function* loadSecurityPolicyMock() {
|
|
2985
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ loading: true, error: null }));
|
|
2986
|
+
yield delay();
|
|
2987
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ policy: policyDemo, loading: false }));
|
|
2988
|
+
yield effects.put(actions.loadSecurityPolicyMfa());
|
|
2989
|
+
yield effects.put(actions.loadSecurityPolicyLockout());
|
|
2990
|
+
yield effects.put(actions.loadSecurityPolicyCaptcha());
|
|
2991
|
+
}
|
|
2992
|
+
function* loadSecurityPolicyMfaMock() {
|
|
2993
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
|
|
2994
|
+
yield delay();
|
|
2995
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ policy: policyMfaDemo, loading: false }));
|
|
2996
|
+
}
|
|
2997
|
+
function* saveSecurityPolicyMfaMock(_a) {
|
|
2998
|
+
var _b;
|
|
2999
|
+
var _c = _a.payload, { callback } = _c, newSecurityPolicy = tslib.__rest(_c, ["callback"]);
|
|
3000
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ saving: true, error: null }));
|
|
3001
|
+
const policy = Object.assign(Object.assign({}, policyLockoutDemo), { id: (_b = newSecurityPolicy.id) !== null && _b !== void 0 ? _b : policyLockoutDemo.id, enforceMFAType: newSecurityPolicy.enforceMFAType });
|
|
3002
|
+
yield delay();
|
|
3003
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ policy, saving: false }));
|
|
3004
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3005
|
+
}
|
|
3006
|
+
function* loadSecurityPolicyLockoutMock() {
|
|
3007
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
3008
|
+
yield delay();
|
|
3009
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
|
|
3010
|
+
}
|
|
3011
|
+
function* saveSecurityPolicyLockoutMock(_a) {
|
|
3012
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
3013
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: true, error: null }));
|
|
3014
|
+
yield delay();
|
|
3015
|
+
const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyLockoutDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyLockoutDemo.id });
|
|
3016
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3017
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, saving: false }));
|
|
3018
|
+
}
|
|
3019
|
+
function* loadSecurityPolicyCaptchaMock() {
|
|
3020
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
3021
|
+
yield delay();
|
|
3022
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
|
|
3023
|
+
}
|
|
3024
|
+
function* loadSecurityPolicyPasswordHistoryMock() {
|
|
3025
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ loading: true, error: null }));
|
|
3026
|
+
yield delay();
|
|
3027
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy: policyPasswordHistoryDemo, loading: false }));
|
|
3028
|
+
}
|
|
3029
|
+
function* saveSecurityPolicyPasswordHistoryMock(_a) {
|
|
3030
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
3031
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: true, error: null }));
|
|
3032
|
+
yield delay();
|
|
3033
|
+
const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyPasswordHistoryDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyPasswordHistoryDemo.id });
|
|
3034
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3035
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, saving: false }));
|
|
3036
|
+
}
|
|
3037
|
+
function* securityPolicySagasMock() {
|
|
3038
|
+
yield effects.takeLeading(actions.loadSecurityPolicy, loadSecurityPolicyMock);
|
|
3039
|
+
yield effects.takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicyMock);
|
|
3040
|
+
yield effects.takeEvery(actions.saveSecurityPolicyMfa, saveSecurityPolicyMfaMock);
|
|
3041
|
+
yield effects.takeEvery(actions.loadSecurityPolicyMfa, loadSecurityPolicyMfaMock);
|
|
3042
|
+
yield effects.takeEvery(actions.saveSecurityPolicyLockout, saveSecurityPolicyLockoutMock);
|
|
3043
|
+
yield effects.takeEvery(actions.loadSecurityPolicyLockout, loadSecurityPolicyLockoutMock);
|
|
3044
|
+
yield effects.takeEvery(actions.loadSecurityPolicyCaptcha, loadSecurityPolicyCaptchaMock);
|
|
3045
|
+
yield effects.takeEvery(actions.saveSecurityPolicyPasswordHistory, saveSecurityPolicyPasswordHistoryMock);
|
|
3046
|
+
yield effects.takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistoryMock);
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3044
3049
|
function* saveAccountSettings({ payload }) {
|
|
3045
3050
|
var _a, _b;
|
|
3046
3051
|
try {
|
|
@@ -133,6 +133,7 @@ function* loadDataFunction({ payload = channels }) {
|
|
|
133
133
|
return res.reduce((acc, curr, idx) => (Object.assign(Object.assign({}, acc), { [`${payload[idx]}`]: curr })), {});
|
|
134
134
|
})(),
|
|
135
135
|
]);
|
|
136
|
+
const webhooks = yield loadFunction({ payload: { api: 'webhook' }, type: '' });
|
|
136
137
|
const data = values.reduce((acc, curr, idx) => payload[idx]
|
|
137
138
|
? values[values.length - 1][payload[idx]].length
|
|
138
139
|
? Object.assign(Object.assign({}, acc), { [`${payload[idx]}`]: curr, list: [
|
|
@@ -146,7 +147,7 @@ function* loadDataFunction({ payload = channels }) {
|
|
|
146
147
|
image: channels2Platform[payload[idx]].image,
|
|
147
148
|
},
|
|
148
149
|
] }) : acc
|
|
149
|
-
: Object.assign(Object.assign({}, acc), { [`${addApi[idx - payload.length]}`]: curr }), { list: [] });
|
|
150
|
+
: Object.assign(Object.assign({}, acc), { [`${addApi[idx - payload.length]}`]: curr }), { list: [], webhook: webhooks });
|
|
150
151
|
yield effects.put(actions.setConnectivityState(Object.assign(Object.assign({}, data), { error: undefined, isSaving: false, isLoading: false })));
|
|
151
152
|
}
|
|
152
153
|
catch (e) {
|
|
@@ -52,7 +52,7 @@ const actions$7 = Object.assign({ loadPlans: toolkit.createAction(`${name$6}/loa
|
|
|
52
52
|
const configInitialState = {
|
|
53
53
|
loading: false,
|
|
54
54
|
error: null,
|
|
55
|
-
fetching:
|
|
55
|
+
fetching: true,
|
|
56
56
|
config: null,
|
|
57
57
|
};
|
|
58
58
|
const reducers$5 = Object.assign({}, createModuleCaseReducers());
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
3
|
"libName": "FronteggReduxStore",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.14.0",
|
|
5
5
|
"author": "Frontegg LTD",
|
|
6
6
|
"main": "./node/index.js",
|
|
7
7
|
"module": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@frontegg/rest-api": "2.10.
|
|
10
|
+
"@frontegg/rest-api": "2.10.50",
|
|
11
11
|
"@reduxjs/toolkit": "^1.5.0",
|
|
12
12
|
"redux-saga": "^1.1.0",
|
|
13
13
|
"tslib": "^2.3.1",
|
package/subscriptions/index.js
CHANGED
|
@@ -49,7 +49,7 @@ const actions$7 = Object.assign({ loadPlans: createAction(`${name$6}/loadPlans`)
|
|
|
49
49
|
const configInitialState = {
|
|
50
50
|
loading: false,
|
|
51
51
|
error: null,
|
|
52
|
-
fetching:
|
|
52
|
+
fetching: true,
|
|
53
53
|
config: null,
|
|
54
54
|
};
|
|
55
55
|
const reducers$5 = Object.assign({}, createModuleCaseReducers());
|