@frontegg/redux-store 5.9.1 → 5.13.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/ApiTokensState/interfaces.d.ts +2 -1
- package/auth/LoginState/index.d.ts +3 -0
- package/auth/LoginState/saga.d.ts +4 -17
- package/auth/SignUp/saga.d.ts +6 -1
- package/auth/index.d.ts +2 -0
- package/auth/index.js +211 -211
- package/auth/reducer.d.ts +2 -0
- package/connectivity/index.js +2 -1
- package/node/auth/index.js +210 -210
- package/node/connectivity/index.js +2 -1
- package/node/subscriptions/index.js +54 -42
- package/package.json +2 -2
- package/subscriptions/Billing/Information/interfaces.d.ts +1 -0
- package/subscriptions/Billing/Invoices/index.d.ts +0 -2
- package/subscriptions/Billing/Invoices/interfaces.d.ts +1 -0
- package/subscriptions/Billing/PaymentMethod/interfaces.d.ts +1 -0
- package/subscriptions/Billing/index.d.ts +0 -1
- package/subscriptions/Config/interfaces.d.ts +1 -0
- package/subscriptions/Plans/index.d.ts +0 -2
- package/subscriptions/Plans/interfaces.d.ts +1 -0
- package/subscriptions/index.d.ts +0 -2
- package/subscriptions/index.js +54 -42
- package/subscriptions/reducer.d.ts +0 -2
- package/subscriptions/utils.d.ts +2 -0
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);
|
|
@@ -1244,7 +1044,7 @@ function* verifyInviteToken({ payload }) {
|
|
|
1244
1044
|
yield effects.put(actions.setLoginState({ loading: false }));
|
|
1245
1045
|
}
|
|
1246
1046
|
}
|
|
1247
|
-
function* preLogin({ payload: { email, recaptchaToken, callback } }) {
|
|
1047
|
+
function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback } }) {
|
|
1248
1048
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1249
1049
|
try {
|
|
1250
1050
|
const onRedirectTo = yield effects.select(({ auth: { onRedirectTo } }) => onRedirectTo);
|
|
@@ -1260,11 +1060,11 @@ function* preLogin({ payload: { email, recaptchaToken, callback } }) {
|
|
|
1260
1060
|
}, 2000);
|
|
1261
1061
|
}
|
|
1262
1062
|
else {
|
|
1263
|
-
yield ssoPreloginFailed({ email, recaptchaToken, callback });
|
|
1063
|
+
yield ssoPreloginFailed({ email, recaptchaToken, callback, invitationToken });
|
|
1264
1064
|
}
|
|
1265
1065
|
}
|
|
1266
1066
|
catch (e) {
|
|
1267
|
-
yield ssoPreloginFailed({ email, recaptchaToken, callback });
|
|
1067
|
+
yield ssoPreloginFailed({ email, recaptchaToken, callback, invitationToken });
|
|
1268
1068
|
}
|
|
1269
1069
|
}
|
|
1270
1070
|
function* ssoPreloginFailed(_a) {
|
|
@@ -2798,7 +2598,6 @@ function* loadSocialLoginsConfigurations() {
|
|
|
2798
2598
|
function* loadSocialLoginsConfigurationsV2() {
|
|
2799
2599
|
try {
|
|
2800
2600
|
yield effects.put(actions.setSocialLoginsState({ loading: true }));
|
|
2801
|
-
console.log('api.auth.getSocialLoginProvidersV2', restApi.api.auth.getSocialLoginProvidersV2);
|
|
2802
2601
|
const socialLoginsConfigV2 = yield effects.call(restApi.api.auth.getSocialLoginProvidersV2);
|
|
2803
2602
|
const baseUrl = restApi.fetch.getBaseUrl(restApi.ContextHolder.getContext());
|
|
2804
2603
|
const socialLoginsConfigWithFullUrl = socialLoginsConfigV2.map((_a) => {
|
|
@@ -3041,6 +2840,207 @@ function* apiTokensSagaMock() {
|
|
|
3041
2840
|
yield effects.takeLatest(actions.deleteTenantApiToken, deleteTenantApiTokenMock);
|
|
3042
2841
|
}
|
|
3043
2842
|
|
|
2843
|
+
function* loadSecurityPolicy() {
|
|
2844
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ loading: true, error: null }));
|
|
2845
|
+
try {
|
|
2846
|
+
const policy = yield effects.call(restApi.api.auth.getGlobalSecurityPolicy);
|
|
2847
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ policy, loading: false }));
|
|
2848
|
+
}
|
|
2849
|
+
catch (e) {
|
|
2850
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ error: e.message, loading: false }));
|
|
2851
|
+
}
|
|
2852
|
+
yield effects.put(actions.loadSecurityPolicyMfa());
|
|
2853
|
+
yield effects.put(actions.loadSecurityPolicyLockout());
|
|
2854
|
+
yield effects.put(actions.loadSecurityPolicyCaptcha());
|
|
2855
|
+
}
|
|
2856
|
+
function* loadPublicSecurityPolicy() {
|
|
2857
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
|
|
2858
|
+
try {
|
|
2859
|
+
const policy = yield effects.call(restApi.api.auth.getVendorConfig);
|
|
2860
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ policy, loading: false }));
|
|
2861
|
+
}
|
|
2862
|
+
catch (e) {
|
|
2863
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
function* loadSecurityPolicyMfa() {
|
|
2867
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
|
|
2868
|
+
try {
|
|
2869
|
+
const policy = yield effects.call(restApi.api.auth.getMfaPolicy);
|
|
2870
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ policy, loading: false }));
|
|
2871
|
+
}
|
|
2872
|
+
catch (e) {
|
|
2873
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ error: e.message, loading: false }));
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
function* saveSecurityPolicyMfa(_a) {
|
|
2877
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
2878
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ saving: true, error: null }));
|
|
2879
|
+
try {
|
|
2880
|
+
const policy = yield effects.call(restApi.api.auth.saveMfaPolicy, newSecurityPolicy);
|
|
2881
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ policy, saving: false }));
|
|
2882
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
2883
|
+
}
|
|
2884
|
+
catch (e) {
|
|
2885
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ saving: false, error: e.message }));
|
|
2886
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
function* loadSecurityPolicyLockout() {
|
|
2890
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
2891
|
+
try {
|
|
2892
|
+
const policy = yield effects.call(restApi.api.auth.getLockoutPolicy);
|
|
2893
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, loading: false }));
|
|
2894
|
+
}
|
|
2895
|
+
catch (e) {
|
|
2896
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ error: e.message, loading: false }));
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
function* saveSecurityPolicyLockout(_a) {
|
|
2900
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
2901
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: true, error: null }));
|
|
2902
|
+
try {
|
|
2903
|
+
const policy = yield effects.call(restApi.api.auth.saveLockoutPolicy, newSecurityPolicy);
|
|
2904
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, saving: false }));
|
|
2905
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
2906
|
+
}
|
|
2907
|
+
catch (e) {
|
|
2908
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: false, error: e.message }));
|
|
2909
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
function* loadSecurityPolicyCaptcha() {
|
|
2913
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
2914
|
+
try {
|
|
2915
|
+
const policy = yield effects.call(restApi.api.auth.getCaptchaPolicy);
|
|
2916
|
+
yield effects.put(actions.setSecurityPolicyCaptchaState({ policy, loading: false }));
|
|
2917
|
+
}
|
|
2918
|
+
catch (e) {
|
|
2919
|
+
yield effects.put(actions.setSecurityPolicyCaptchaState({ error: e.message, loading: false }));
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
function* loadSecurityPolicyPasswordHistory() {
|
|
2923
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ loading: true, error: null }));
|
|
2924
|
+
try {
|
|
2925
|
+
const policy = yield effects.call(restApi.api.auth.getPasswordHistoryPolicy);
|
|
2926
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, loading: false }));
|
|
2927
|
+
}
|
|
2928
|
+
catch (e) {
|
|
2929
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ error: e.message, loading: false }));
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
function* saveSecurityPolicyPasswordHistory(_a) {
|
|
2933
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
2934
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: true, error: null }));
|
|
2935
|
+
try {
|
|
2936
|
+
const policy = yield effects.call(restApi.api.auth.savePasswordHistoryPolicy, newSecurityPolicy);
|
|
2937
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, saving: false }));
|
|
2938
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
2939
|
+
}
|
|
2940
|
+
catch (e) {
|
|
2941
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: false, error: e.message }));
|
|
2942
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
function* loadVendorPasswordConfig() {
|
|
2946
|
+
yield effects.put(actions.setSecurityPolicyPasswordState({ loading: true, error: null }));
|
|
2947
|
+
try {
|
|
2948
|
+
const policy = yield effects.call(restApi.api.auth.getPasswordConfigPolicy);
|
|
2949
|
+
yield effects.put(actions.setSecurityPolicyPasswordState({ policy, loading: false }));
|
|
2950
|
+
}
|
|
2951
|
+
catch (e) {
|
|
2952
|
+
yield effects.put(actions.setSecurityPolicyPasswordState({ error: e.message, loading: false }));
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
function* securityPolicySagas() {
|
|
2956
|
+
yield effects.takeLeading(actions.loadSecurityPolicy, loadSecurityPolicy);
|
|
2957
|
+
yield effects.takeEvery(actions.saveSecurityPolicyMfa, saveSecurityPolicyMfa);
|
|
2958
|
+
yield effects.takeEvery(actions.loadSecurityPolicyMfa, loadSecurityPolicyMfa);
|
|
2959
|
+
yield effects.takeEvery(actions.saveSecurityPolicyLockout, saveSecurityPolicyLockout);
|
|
2960
|
+
yield effects.takeEvery(actions.loadSecurityPolicyLockout, loadSecurityPolicyLockout);
|
|
2961
|
+
yield effects.takeEvery(actions.loadSecurityPolicyCaptcha, loadSecurityPolicyCaptcha);
|
|
2962
|
+
yield effects.takeEvery(actions.saveSecurityPolicyPasswordHistory, saveSecurityPolicyPasswordHistory);
|
|
2963
|
+
yield effects.takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistory);
|
|
2964
|
+
yield effects.takeEvery(actions.loadVendorPasswordConfig, loadVendorPasswordConfig);
|
|
2965
|
+
yield effects.takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicy);
|
|
2966
|
+
}
|
|
2967
|
+
/*********************************
|
|
2968
|
+
* Preview Sagas
|
|
2969
|
+
*********************************/
|
|
2970
|
+
function* loadPublicSecurityPolicyMock() {
|
|
2971
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
|
|
2972
|
+
try {
|
|
2973
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ policy: publicSecurityPolicy, loading: false }));
|
|
2974
|
+
}
|
|
2975
|
+
catch (e) {
|
|
2976
|
+
yield effects.put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
function* loadSecurityPolicyMock() {
|
|
2980
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ loading: true, error: null }));
|
|
2981
|
+
yield delay();
|
|
2982
|
+
yield effects.put(actions.setSecurityPolicyGlobalState({ policy: policyDemo, loading: false }));
|
|
2983
|
+
yield effects.put(actions.loadSecurityPolicyMfa());
|
|
2984
|
+
yield effects.put(actions.loadSecurityPolicyLockout());
|
|
2985
|
+
yield effects.put(actions.loadSecurityPolicyCaptcha());
|
|
2986
|
+
}
|
|
2987
|
+
function* loadSecurityPolicyMfaMock() {
|
|
2988
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
|
|
2989
|
+
yield delay();
|
|
2990
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ policy: policyMfaDemo, loading: false }));
|
|
2991
|
+
}
|
|
2992
|
+
function* saveSecurityPolicyMfaMock(_a) {
|
|
2993
|
+
var _b;
|
|
2994
|
+
var _c = _a.payload, { callback } = _c, newSecurityPolicy = tslib.__rest(_c, ["callback"]);
|
|
2995
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ saving: true, error: null }));
|
|
2996
|
+
const policy = Object.assign(Object.assign({}, policyLockoutDemo), { id: (_b = newSecurityPolicy.id) !== null && _b !== void 0 ? _b : policyLockoutDemo.id, enforceMFAType: newSecurityPolicy.enforceMFAType });
|
|
2997
|
+
yield delay();
|
|
2998
|
+
yield effects.put(actions.setSecurityPolicyMfaState({ policy, saving: false }));
|
|
2999
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3000
|
+
}
|
|
3001
|
+
function* loadSecurityPolicyLockoutMock() {
|
|
3002
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
3003
|
+
yield delay();
|
|
3004
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
|
|
3005
|
+
}
|
|
3006
|
+
function* saveSecurityPolicyLockoutMock(_a) {
|
|
3007
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
3008
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: true, error: null }));
|
|
3009
|
+
yield delay();
|
|
3010
|
+
const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyLockoutDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyLockoutDemo.id });
|
|
3011
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3012
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, saving: false }));
|
|
3013
|
+
}
|
|
3014
|
+
function* loadSecurityPolicyCaptchaMock() {
|
|
3015
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
3016
|
+
yield delay();
|
|
3017
|
+
yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
|
|
3018
|
+
}
|
|
3019
|
+
function* loadSecurityPolicyPasswordHistoryMock() {
|
|
3020
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ loading: true, error: null }));
|
|
3021
|
+
yield delay();
|
|
3022
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy: policyPasswordHistoryDemo, loading: false }));
|
|
3023
|
+
}
|
|
3024
|
+
function* saveSecurityPolicyPasswordHistoryMock(_a) {
|
|
3025
|
+
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
3026
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: true, error: null }));
|
|
3027
|
+
yield delay();
|
|
3028
|
+
const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyPasswordHistoryDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyPasswordHistoryDemo.id });
|
|
3029
|
+
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3030
|
+
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, saving: false }));
|
|
3031
|
+
}
|
|
3032
|
+
function* securityPolicySagasMock() {
|
|
3033
|
+
yield effects.takeLeading(actions.loadSecurityPolicy, loadSecurityPolicyMock);
|
|
3034
|
+
yield effects.takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicyMock);
|
|
3035
|
+
yield effects.takeEvery(actions.saveSecurityPolicyMfa, saveSecurityPolicyMfaMock);
|
|
3036
|
+
yield effects.takeEvery(actions.loadSecurityPolicyMfa, loadSecurityPolicyMfaMock);
|
|
3037
|
+
yield effects.takeEvery(actions.saveSecurityPolicyLockout, saveSecurityPolicyLockoutMock);
|
|
3038
|
+
yield effects.takeEvery(actions.loadSecurityPolicyLockout, loadSecurityPolicyLockoutMock);
|
|
3039
|
+
yield effects.takeEvery(actions.loadSecurityPolicyCaptcha, loadSecurityPolicyCaptchaMock);
|
|
3040
|
+
yield effects.takeEvery(actions.saveSecurityPolicyPasswordHistory, saveSecurityPolicyPasswordHistoryMock);
|
|
3041
|
+
yield effects.takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistoryMock);
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
3044
|
function* saveAccountSettings({ payload }) {
|
|
3045
3045
|
var _a, _b;
|
|
3046
3046
|
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) {
|