@frontegg/redux-store 6.69.0 → 6.70.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/audits/AuditLogsState/index.js +1 -1
- package/audits/AuditLogsState/saga.js +1 -18
- package/audits/AuditsMetadataState/index.js +1 -1
- package/audits/AuditsMetadataState/saga.js +1 -5
- package/audits/backward-compatibility/saga.js +0 -18
- package/audits/dummy.js +0 -16
- package/audits/index.js +4 -2
- package/audits/reducer.js +0 -2
- package/auth/AcceptInvitationState/index.d.ts +2 -0
- package/auth/AcceptInvitationState/index.js +1 -1
- package/auth/AcceptInvitationState/interfaces.js +0 -1
- package/auth/AcceptInvitationState/saga.js +0 -3
- package/auth/AccountSettingsState/index.d.ts +2 -0
- package/auth/AccountSettingsState/index.js +1 -1
- package/auth/AccountSettingsState/interfaces.d.ts +2 -0
- package/auth/AccountSettingsState/saga.js +1 -11
- package/auth/ActivateState/index.d.ts +3 -0
- package/auth/ActivateState/index.js +1 -1
- package/auth/ActivateState/interfaces.js +0 -1
- package/auth/ActivateState/saga.js +14 -34
- package/auth/ApiTokensState/index.d.ts +2 -0
- package/auth/ApiTokensState/index.js +1 -1
- package/auth/ApiTokensState/interfaces.d.ts +1 -0
- package/auth/ApiTokensState/interfaces.js +0 -1
- package/auth/ApiTokensState/saga.js +1 -44
- package/auth/ForgotPasswordState/index.d.ts +2 -0
- package/auth/ForgotPasswordState/index.js +1 -1
- package/auth/ForgotPasswordState/interfaces.js +0 -1
- package/auth/ForgotPasswordState/saga.js +5 -12
- package/auth/ImpersonationState/index.d.ts +2 -0
- package/auth/ImpersonationState/index.js +1 -1
- package/auth/ImpersonationState/interfaces.js +0 -1
- package/auth/ImpersonationState/saga.js +5 -9
- package/auth/LoginState/index.d.ts +2 -0
- package/auth/LoginState/index.js +1 -1
- package/auth/LoginState/interfaces.js +0 -6
- package/auth/LoginState/saga.d.ts +2 -38
- package/auth/LoginState/saga.js +132 -292
- package/auth/MfaState/index.d.ts +4 -2
- package/auth/MfaState/index.js +1 -1
- package/auth/MfaState/interfaces.d.ts +2 -2
- package/auth/MfaState/interfaces.js +0 -1
- package/auth/MfaState/saga.js +64 -143
- package/auth/ProfileState/index.d.ts +2 -0
- package/auth/ProfileState/index.js +1 -1
- package/auth/ProfileState/saga.js +22 -50
- package/auth/Provisioning/index.d.ts +2 -0
- package/auth/Provisioning/index.js +1 -1
- package/auth/Provisioning/saga.js +11 -23
- package/auth/ResetPhoneNumberState/index.d.ts +2 -0
- package/auth/ResetPhoneNumberState/index.js +1 -1
- package/auth/ResetPhoneNumberState/interfaces.js +0 -1
- package/auth/ResetPhoneNumberState/saga.js +17 -26
- package/auth/RestrictionsState/index.d.ts +3 -0
- package/auth/RestrictionsState/index.js +1 -1
- package/auth/RestrictionsState/saga.js +52 -105
- package/auth/RolesState/index.d.ts +2 -0
- package/auth/RolesState/index.js +1 -1
- package/auth/RolesState/saga.js +30 -51
- package/auth/SSOState/index.d.ts +2 -0
- package/auth/SSOState/index.js +1 -1
- package/auth/SSOState/interfaces.js +0 -3
- package/auth/SSOState/saga.js +10 -58
- package/auth/SSOState/saga.v2.js +13 -49
- package/auth/SecurityPolicyState/index.d.ts +13 -0
- package/auth/SecurityPolicyState/index.js +1 -1
- package/auth/SecurityPolicyState/saga.js +36 -90
- package/auth/SessionsPolicyState/index.d.ts +2 -0
- package/auth/SessionsPolicyState/index.js +1 -1
- package/auth/SessionsPolicyState/saga.js +7 -19
- package/auth/SessionsState/index.d.ts +2 -0
- package/auth/SessionsState/index.js +1 -1
- package/auth/SessionsState/saga.js +1 -15
- package/auth/SignUp/index.d.ts +2 -0
- package/auth/SignUp/index.js +1 -1
- package/auth/SignUp/interfaces.js +0 -1
- package/auth/SignUp/saga.js +6 -15
- package/auth/SocialLogins/index.d.ts +2 -0
- package/auth/SocialLogins/index.js +1 -1
- package/auth/SocialLogins/saga.js +10 -20
- package/auth/TeamState/index.d.ts +2 -0
- package/auth/TeamState/index.js +1 -1
- package/auth/TeamState/interfaces.js +0 -1
- package/auth/TeamState/saga.js +85 -205
- package/auth/TenantsState/index.d.ts +2 -0
- package/auth/TenantsState/index.js +1 -1
- package/auth/TenantsState/saga.js +1 -17
- package/auth/index.d.ts +2 -2
- package/auth/index.js +4 -3
- package/auth/interfaces.d.ts +2 -1
- package/auth/interfaces.js +0 -6
- package/auth/reducer.d.ts +2 -2
- package/auth/reducer.js +0 -2
- package/auth/saga.js +2 -1
- package/auth/utils.d.ts +4 -0
- package/auth/utils.js +7 -21
- package/connectivity/ConnectivityState/index.d.ts +9 -0
- package/connectivity/ConnectivityState/index.js +1 -1
- package/connectivity/consts.js +0 -5
- package/connectivity/index.js +4 -2
- package/connectivity/interfaces.d.ts +1 -0
- package/connectivity/reducer.js +0 -2
- package/connectivity/saga.js +48 -85
- package/helpers.js +4 -7
- package/index.js +1 -1
- package/node/audits/AuditLogsState/index.js +1 -8
- package/node/audits/AuditLogsState/saga.js +1 -26
- package/node/audits/AuditsMetadataState/index.js +1 -8
- package/node/audits/AuditsMetadataState/saga.js +1 -10
- package/node/audits/backward-compatibility/index.js +0 -8
- package/node/audits/backward-compatibility/reducer.js +0 -5
- package/node/audits/backward-compatibility/saga.js +0 -23
- package/node/audits/dummy.js +0 -19
- package/node/audits/index.js +0 -14
- package/node/audits/initialState.js +0 -3
- package/node/audits/reducer.js +0 -8
- package/node/audits/saga.js +0 -5
- package/node/audits/utils.js +0 -4
- package/node/auth/AcceptInvitationState/index.js +1 -7
- package/node/auth/AcceptInvitationState/interfaces.js +0 -1
- package/node/auth/AcceptInvitationState/saga.js +0 -7
- package/node/auth/AccountSettingsState/index.js +1 -6
- package/node/auth/AccountSettingsState/saga.js +1 -16
- package/node/auth/ActivateState/index.js +1 -7
- package/node/auth/ActivateState/interfaces.js +0 -1
- package/node/auth/ActivateState/saga.js +14 -41
- package/node/auth/ApiTokensState/index.js +1 -6
- package/node/auth/ApiTokensState/interfaces.js +0 -1
- package/node/auth/ApiTokensState/saga.js +1 -51
- package/node/auth/ForgotPasswordState/index.js +1 -7
- package/node/auth/ForgotPasswordState/interfaces.js +0 -1
- package/node/auth/ForgotPasswordState/saga.js +5 -19
- package/node/auth/ImpersonationState/index.js +1 -7
- package/node/auth/ImpersonationState/interfaces.js +0 -1
- package/node/auth/ImpersonationState/saga.js +5 -15
- package/node/auth/LoginState/index.js +1 -7
- package/node/auth/LoginState/interfaces.js +0 -7
- package/node/auth/LoginState/saga.js +132 -322
- package/node/auth/MfaState/index.js +1 -7
- package/node/auth/MfaState/interfaces.js +0 -1
- package/node/auth/MfaState/saga.js +64 -137
- package/node/auth/ProfileState/index.js +1 -6
- package/node/auth/ProfileState/saga.js +22 -58
- package/node/auth/Provisioning/index.js +1 -6
- package/node/auth/Provisioning/saga.js +11 -28
- package/node/auth/ResetPhoneNumberState/index.js +1 -7
- package/node/auth/ResetPhoneNumberState/interfaces.js +0 -1
- package/node/auth/ResetPhoneNumberState/saga.js +17 -32
- package/node/auth/RestrictionsState/index.js +1 -7
- package/node/auth/RestrictionsState/saga.js +52 -109
- package/node/auth/RolesState/index.js +1 -6
- package/node/auth/RolesState/saga.js +30 -54
- package/node/auth/SSOState/index.js +1 -6
- package/node/auth/SSOState/interfaces.js +0 -3
- package/node/auth/SSOState/saga.js +10 -63
- package/node/auth/SSOState/saga.v2.js +13 -53
- package/node/auth/SecurityPolicyState/index.js +1 -6
- package/node/auth/SecurityPolicyState/saga.js +36 -89
- package/node/auth/SessionsPolicyState/index.js +1 -6
- package/node/auth/SessionsPolicyState/saga.js +7 -24
- package/node/auth/SessionsState/index.js +1 -6
- package/node/auth/SessionsState/saga.js +1 -22
- package/node/auth/SignUp/index.js +1 -7
- package/node/auth/SignUp/interfaces.js +0 -1
- package/node/auth/SignUp/saga.js +6 -30
- package/node/auth/SocialLogins/index.js +1 -6
- package/node/auth/SocialLogins/saga.js +10 -33
- package/node/auth/TeamState/index.js +1 -6
- package/node/auth/TeamState/interfaces.js +0 -1
- package/node/auth/TeamState/saga.js +86 -190
- package/node/auth/TenantsState/index.js +1 -6
- package/node/auth/TenantsState/saga.js +1 -24
- package/node/auth/dummy.js +0 -5
- package/node/auth/index.js +0 -90
- package/node/auth/initialState.js +0 -23
- package/node/auth/interfaces.js +0 -6
- package/node/auth/reducer.js +0 -28
- package/node/auth/saga.js +2 -26
- package/node/auth/utils.js +7 -42
- package/node/connectivity/ConnectivityState/index.js +1 -7
- package/node/connectivity/consts.js +1 -7
- package/node/connectivity/index.js +0 -5
- package/node/connectivity/reducer.js +0 -6
- package/node/connectivity/saga.js +47 -91
- package/node/helpers.js +2 -14
- package/node/index.js +1 -17
- package/node/subscriptions/Billing/Information/index.js +0 -7
- package/node/subscriptions/Billing/Information/saga.js +1 -25
- package/node/subscriptions/Billing/Invoices/index.js +0 -6
- package/node/subscriptions/Billing/Invoices/saga.js +1 -13
- package/node/subscriptions/Billing/PaymentMethod/index.js +2 -8
- package/node/subscriptions/Billing/PaymentMethod/interfaces.js +0 -1
- package/node/subscriptions/Billing/PaymentMethod/saga.js +1 -17
- package/node/subscriptions/Billing/Subscription/index.js +0 -6
- package/node/subscriptions/Billing/Subscription/saga.js +3 -23
- package/node/subscriptions/Billing/index.js +0 -6
- package/node/subscriptions/Billing/interfaces.js +0 -8
- package/node/subscriptions/Billing/saga.js +0 -7
- package/node/subscriptions/Checkout/index.js +0 -6
- package/node/subscriptions/Checkout/saga.js +2 -22
- package/node/subscriptions/Config/index.js +0 -6
- package/node/subscriptions/Config/saga.js +1 -12
- package/node/subscriptions/Plans/index.js +0 -6
- package/node/subscriptions/Plans/saga.js +1 -13
- package/node/subscriptions/Stripe/index.js +0 -6
- package/node/subscriptions/Stripe/saga.js +0 -8
- package/node/subscriptions/VendorPublicConfig/index.js +0 -6
- package/node/subscriptions/VendorPublicConfig/saga.js +1 -9
- package/node/subscriptions/dummy.js +2 -4
- package/node/subscriptions/general.interfaces.js +0 -5
- package/node/subscriptions/index.js +0 -5
- package/node/subscriptions/interfaces.js +0 -14
- package/node/subscriptions/mapper.js +0 -11
- package/node/subscriptions/reducer.js +0 -9
- package/node/subscriptions/saga.js +0 -9
- package/node/subscriptions/utils.js +0 -6
- package/node/toolkit/index.js +0 -31
- package/node/toolkit/redux-saga.js +0 -3
- package/node/toolkit/redux.js +0 -1
- package/node/vendor/VendorState/index.js +1 -7
- package/node/vendor/index.js +0 -5
- package/node/vendor/reducer.js +0 -6
- package/node/vendor/saga.js +1 -9
- package/package.json +1 -1
- package/subscriptions/Billing/Information/index.js +0 -4
- package/subscriptions/Billing/Information/saga.js +1 -12
- package/subscriptions/Billing/Invoices/index.js +0 -4
- package/subscriptions/Billing/Invoices/saga.js +1 -5
- package/subscriptions/Billing/PaymentMethod/index.js +2 -6
- package/subscriptions/Billing/PaymentMethod/interfaces.js +1 -1
- package/subscriptions/Billing/PaymentMethod/saga.js +1 -9
- package/subscriptions/Billing/Subscription/index.js +0 -4
- package/subscriptions/Billing/Subscription/saga.js +3 -17
- package/subscriptions/Billing/interfaces.js +1 -0
- package/subscriptions/Checkout/index.js +0 -4
- package/subscriptions/Checkout/saga.js +2 -12
- package/subscriptions/Config/index.js +0 -4
- package/subscriptions/Config/saga.js +1 -7
- package/subscriptions/Plans/index.js +0 -2
- package/subscriptions/Plans/saga.js +1 -6
- package/subscriptions/Stripe/index.js +0 -4
- package/subscriptions/Stripe/saga.js +0 -4
- package/subscriptions/VendorPublicConfig/index.js +0 -2
- package/subscriptions/VendorPublicConfig/saga.js +1 -4
- package/subscriptions/dummy.js +3 -2
- package/subscriptions/general.interfaces.js +0 -5
- package/subscriptions/index.js +3 -1
- package/subscriptions/mapper.js +0 -5
- package/toolkit/index.d.ts +1 -1
- package/toolkit/index.js +0 -9
- package/vendor/VendorState/index.js +1 -0
- package/vendor/index.js +4 -2
- package/vendor/reducer.js +0 -2
- package/vendor/saga.js +1 -2
|
@@ -1,41 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.profileSagas = profileSagas;
|
|
9
8
|
exports.profileSagasMock = profileSagasMock;
|
|
10
|
-
|
|
11
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
-
|
|
13
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
-
|
|
15
11
|
var _effects = require("redux-saga/effects");
|
|
16
|
-
|
|
17
12
|
var _restApi = require("@frontegg/rest-api");
|
|
18
|
-
|
|
19
13
|
var _reducer = require("../reducer");
|
|
20
|
-
|
|
21
14
|
var _dummy = require("../dummy");
|
|
22
|
-
|
|
23
15
|
var _utils = require("../utils");
|
|
24
|
-
|
|
25
16
|
const _excluded = ["callback", "profilePictureUrl"],
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
_excluded2 = ["callback", "profilePictureUrl"];
|
|
28
18
|
function* loadProfile() {
|
|
29
19
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
30
20
|
loading: true
|
|
31
21
|
}));
|
|
32
|
-
|
|
33
22
|
try {
|
|
34
23
|
const profile = yield (0, _effects.retry)(3, 2000, _restApi.api.teams.getProfile);
|
|
35
24
|
const currentUser = yield (0, _effects.select)(state => state.auth.user);
|
|
36
|
-
|
|
37
25
|
_reducer.actions.setUser((0, _extends2.default)({}, currentUser, profile));
|
|
38
|
-
|
|
39
26
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
40
27
|
profile,
|
|
41
28
|
loading: false
|
|
@@ -47,72 +34,62 @@ function* loadProfile() {
|
|
|
47
34
|
}));
|
|
48
35
|
}
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
function b64toBlob(base64, contentType) {
|
|
52
38
|
const sliceSize = 512;
|
|
53
39
|
const byteCharacters = atob(base64);
|
|
54
40
|
const byteArrays = [];
|
|
55
|
-
|
|
56
41
|
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
|
57
42
|
const slice = byteCharacters.slice(offset, offset + sliceSize);
|
|
58
43
|
const byteNumbers = new Array(slice.length);
|
|
59
|
-
|
|
60
44
|
for (let i = 0; i < slice.length; i++) {
|
|
61
45
|
byteNumbers[i] = slice.charCodeAt(i);
|
|
62
46
|
}
|
|
63
|
-
|
|
64
47
|
byteArrays.push(new Uint8Array(byteNumbers));
|
|
65
48
|
}
|
|
66
|
-
|
|
67
49
|
return new Blob(byteArrays, {
|
|
68
50
|
type: contentType
|
|
69
51
|
});
|
|
70
52
|
}
|
|
71
|
-
|
|
72
53
|
function base64ToFormData(base64, key = 'file') {
|
|
73
54
|
const matchResult = base64.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);
|
|
74
|
-
|
|
75
55
|
if (matchResult == null) {
|
|
76
56
|
return null;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const contentType = `image/${matchResult[1]}`; // get the real base64 content of the file
|
|
57
|
+
}
|
|
81
58
|
|
|
82
|
-
|
|
59
|
+
// Get the content type of the image
|
|
60
|
+
const contentType = `image/${matchResult[1]}`;
|
|
61
|
+
// get the real base64 content of the file
|
|
62
|
+
const data = matchResult[2];
|
|
83
63
|
|
|
84
|
-
|
|
64
|
+
// Convert it to a blob to upload
|
|
65
|
+
const blob = b64toBlob(data, contentType);
|
|
85
66
|
|
|
67
|
+
// Create a FormData and append the file with "image" as parameter name
|
|
86
68
|
const formDataToUpload = new FormData();
|
|
87
69
|
formDataToUpload.append(key, new File([blob], key, {
|
|
88
70
|
type: contentType
|
|
89
71
|
}));
|
|
90
72
|
return formDataToUpload;
|
|
91
73
|
}
|
|
92
|
-
|
|
93
74
|
function* saveProfile(_ref) {
|
|
94
75
|
let {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
76
|
+
payload: {
|
|
77
|
+
callback,
|
|
78
|
+
profilePictureUrl
|
|
79
|
+
}
|
|
80
|
+
} = _ref,
|
|
81
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref.payload, _excluded);
|
|
101
82
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
102
83
|
saving: true,
|
|
103
84
|
error: null
|
|
104
85
|
}));
|
|
105
|
-
|
|
106
86
|
try {
|
|
107
87
|
const oldProfileData = yield (0, _effects.select)(state => state.auth.profileState.profile);
|
|
108
88
|
let newProfilePictureUrl = oldProfileData.profilePictureUrl;
|
|
109
|
-
|
|
110
89
|
if (profilePictureUrl !== oldProfileData.profilePictureUrl && profilePictureUrl) {
|
|
111
90
|
const matchResult = (profilePictureUrl || '').match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);
|
|
112
|
-
|
|
113
91
|
if (matchResult) {
|
|
114
92
|
const profileImage = base64ToFormData(profilePictureUrl, 'image');
|
|
115
|
-
|
|
116
93
|
if (profileImage) {
|
|
117
94
|
newProfilePictureUrl = yield (0, _effects.call)(_restApi.api.teams.updateProfileImage, profileImage);
|
|
118
95
|
const imageTimeStamp = Date.now().toString();
|
|
@@ -122,7 +99,6 @@ function* saveProfile(_ref) {
|
|
|
122
99
|
}
|
|
123
100
|
}
|
|
124
101
|
}
|
|
125
|
-
|
|
126
102
|
const newProfileData = (0, _extends2.default)({}, oldProfileData, payload, {
|
|
127
103
|
profilePictureUrl: newProfilePictureUrl
|
|
128
104
|
});
|
|
@@ -142,17 +118,14 @@ function* saveProfile(_ref) {
|
|
|
142
118
|
callback == null ? void 0 : callback(null, e);
|
|
143
119
|
}
|
|
144
120
|
}
|
|
145
|
-
|
|
146
121
|
function* changePassword({
|
|
147
122
|
payload
|
|
148
123
|
}) {
|
|
149
124
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
150
125
|
loading: true
|
|
151
126
|
}));
|
|
152
|
-
|
|
153
127
|
try {
|
|
154
128
|
var _payload$callback;
|
|
155
|
-
|
|
156
129
|
yield (0, _effects.call)(_restApi.api.teams.changePassword, payload);
|
|
157
130
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
158
131
|
loading: false,
|
|
@@ -161,7 +134,6 @@ function* changePassword({
|
|
|
161
134
|
(_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
|
|
162
135
|
} catch (e) {
|
|
163
136
|
var _payload$callback2;
|
|
164
|
-
|
|
165
137
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
166
138
|
loading: false,
|
|
167
139
|
error: e.message
|
|
@@ -169,17 +141,16 @@ function* changePassword({
|
|
|
169
141
|
(_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, null, e);
|
|
170
142
|
}
|
|
171
143
|
}
|
|
172
|
-
|
|
173
144
|
function* profileSagas() {
|
|
174
145
|
yield (0, _effects.takeLeading)(_reducer.actions.loadProfile, loadProfile);
|
|
175
146
|
yield (0, _effects.takeEvery)(_reducer.actions.saveProfile, saveProfile);
|
|
176
147
|
yield (0, _effects.takeEvery)(_reducer.actions.changePassword, changePassword);
|
|
177
148
|
}
|
|
149
|
+
|
|
178
150
|
/*********************************
|
|
179
151
|
* Preview Sagas
|
|
180
152
|
*********************************/
|
|
181
153
|
|
|
182
|
-
|
|
183
154
|
function* loadProfileMock() {
|
|
184
155
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
185
156
|
loading: true
|
|
@@ -191,30 +162,26 @@ function* loadProfileMock() {
|
|
|
191
162
|
profile: _dummy.userProfileDemo
|
|
192
163
|
}));
|
|
193
164
|
}
|
|
194
|
-
|
|
195
165
|
function* saveProfileMock(_ref2) {
|
|
196
166
|
let {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
167
|
+
payload: {
|
|
168
|
+
callback,
|
|
169
|
+
profilePictureUrl
|
|
170
|
+
}
|
|
171
|
+
} = _ref2,
|
|
172
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded2);
|
|
203
173
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
204
174
|
saving: true,
|
|
205
175
|
error: null
|
|
206
176
|
}));
|
|
207
177
|
const oldProfileData = _dummy.profileStateDemo;
|
|
208
178
|
let newProfilePictureUrl = oldProfileData.profile.profilePictureUrl;
|
|
209
|
-
|
|
210
179
|
if (profilePictureUrl !== oldProfileData.profile.profilePictureUrl && profilePictureUrl) {
|
|
211
180
|
const matchResult = (profilePictureUrl || '').match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);
|
|
212
|
-
|
|
213
181
|
if (matchResult) {
|
|
214
182
|
newProfilePictureUrl = profilePictureUrl;
|
|
215
183
|
}
|
|
216
184
|
}
|
|
217
|
-
|
|
218
185
|
const newProfileData = (0, _extends2.default)({}, oldProfileData.profile, payload, {
|
|
219
186
|
profilePictureUrl: newProfilePictureUrl
|
|
220
187
|
});
|
|
@@ -229,12 +196,10 @@ function* saveProfileMock(_ref2) {
|
|
|
229
196
|
}));
|
|
230
197
|
callback == null ? void 0 : callback(newProfileData);
|
|
231
198
|
}
|
|
232
|
-
|
|
233
199
|
function* changePasswordMock({
|
|
234
200
|
payload
|
|
235
201
|
}) {
|
|
236
202
|
var _payload$callback3;
|
|
237
|
-
|
|
238
203
|
yield (0, _effects.put)(_reducer.actions.setProfileState({
|
|
239
204
|
loading: true
|
|
240
205
|
}));
|
|
@@ -245,7 +210,6 @@ function* changePasswordMock({
|
|
|
245
210
|
}));
|
|
246
211
|
(_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, true);
|
|
247
212
|
}
|
|
248
|
-
|
|
249
213
|
function* profileSagasMock() {
|
|
250
214
|
yield (0, _effects.takeLeading)(_reducer.actions.loadProfile, loadProfileMock);
|
|
251
215
|
yield (0, _effects.takeEvery)(_reducer.actions.saveProfile, saveProfileMock);
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.provisioningState = exports.provisioningReducers = exports.provisioningActions = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
9
|
var _constants = require("../../constants");
|
|
13
|
-
|
|
14
10
|
const provisioningState = {
|
|
15
11
|
loading: false
|
|
16
12
|
};
|
|
@@ -34,14 +30,13 @@ const actions = {
|
|
|
34
30
|
payload
|
|
35
31
|
}))
|
|
36
32
|
};
|
|
33
|
+
|
|
37
34
|
/**
|
|
38
35
|
* To be used for actions types after dispatch, and should contains
|
|
39
36
|
* the reducers and actions as standalone function
|
|
40
37
|
*/
|
|
41
|
-
|
|
42
38
|
exports.provisioningActions = actions;
|
|
43
39
|
// noinspection JSUnusedLocalSymbols
|
|
44
|
-
|
|
45
40
|
/**
|
|
46
41
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
47
42
|
* contains the same functions in reducers and actions
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.provisionSagas = provisionSagas;
|
|
9
|
-
|
|
10
8
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _effects = require("redux-saga/effects");
|
|
15
|
-
|
|
16
11
|
var _restApi = require("@frontegg/rest-api");
|
|
17
|
-
|
|
18
12
|
var _reducer = require("../reducer");
|
|
19
|
-
|
|
20
13
|
const _excluded = ["callback"],
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
_excluded2 = ["id"];
|
|
23
15
|
function* loadCountForConnection(connection) {
|
|
24
16
|
const {
|
|
25
17
|
count
|
|
@@ -28,13 +20,11 @@ function* loadCountForConnection(connection) {
|
|
|
28
20
|
count
|
|
29
21
|
});
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
function* loadScim2Connections() {
|
|
33
24
|
yield (0, _effects.put)(_reducer.actions.setProvisioningState({
|
|
34
25
|
loading: true,
|
|
35
26
|
error: null
|
|
36
27
|
}));
|
|
37
|
-
|
|
38
28
|
try {
|
|
39
29
|
const connections = yield (0, _effects.call)(_restApi.api.directory.getConfigs);
|
|
40
30
|
const connectionsWithCount = yield (0, _effects.all)(connections.map(connection => loadCountForConnection(connection)));
|
|
@@ -49,19 +39,17 @@ function* loadScim2Connections() {
|
|
|
49
39
|
}));
|
|
50
40
|
}
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
function* createScim2Connection(_ref) {
|
|
54
43
|
let {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
payload: {
|
|
45
|
+
callback
|
|
46
|
+
}
|
|
47
|
+
} = _ref,
|
|
48
|
+
newConnectionBody = (0, _objectWithoutPropertiesLoose2.default)(_ref.payload, _excluded);
|
|
60
49
|
yield (0, _effects.put)(_reducer.actions.setProvisioningState({
|
|
61
50
|
loading: true,
|
|
62
51
|
error: null
|
|
63
52
|
}));
|
|
64
|
-
|
|
65
53
|
try {
|
|
66
54
|
const newConnectionResponse = yield (0, _effects.call)(_restApi.api.directory.createConfiguration, newConnectionBody);
|
|
67
55
|
const connections = yield (0, _effects.call)(_restApi.api.directory.getConfigs);
|
|
@@ -78,19 +66,17 @@ function* createScim2Connection(_ref) {
|
|
|
78
66
|
}));
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
|
-
|
|
82
69
|
function* updateScim2Connection(_ref2) {
|
|
83
70
|
let {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
payload: {
|
|
72
|
+
id
|
|
73
|
+
}
|
|
74
|
+
} = _ref2,
|
|
75
|
+
updateRequest = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded2);
|
|
89
76
|
yield (0, _effects.put)(_reducer.actions.setProvisioningState({
|
|
90
77
|
loading: true,
|
|
91
78
|
error: null
|
|
92
79
|
}));
|
|
93
|
-
|
|
94
80
|
try {
|
|
95
81
|
yield (0, _effects.call)(_restApi.api.directory.updateConfiguration, id, updateRequest);
|
|
96
82
|
const connections = yield (0, _effects.call)(_restApi.api.directory.getConfigs);
|
|
@@ -106,7 +92,6 @@ function* updateScim2Connection(_ref2) {
|
|
|
106
92
|
}));
|
|
107
93
|
}
|
|
108
94
|
}
|
|
109
|
-
|
|
110
95
|
function* deleteScim2Connection({
|
|
111
96
|
payload: {
|
|
112
97
|
id,
|
|
@@ -117,7 +102,6 @@ function* deleteScim2Connection({
|
|
|
117
102
|
loading: true,
|
|
118
103
|
error: null
|
|
119
104
|
}));
|
|
120
|
-
|
|
121
105
|
try {
|
|
122
106
|
yield (0, _effects.call)(_restApi.api.directory.deleteConfiguration, id);
|
|
123
107
|
const connections = yield (0, _effects.call)(_restApi.api.directory.getConfigs);
|
|
@@ -135,7 +119,6 @@ function* deleteScim2Connection({
|
|
|
135
119
|
callback == null ? void 0 : callback(false, e);
|
|
136
120
|
}
|
|
137
121
|
}
|
|
138
|
-
|
|
139
122
|
function* provisionSagas() {
|
|
140
123
|
yield (0, _effects.takeLeading)(_reducer.actions.loadProvisionConnections, loadScim2Connections);
|
|
141
124
|
yield (0, _effects.takeEvery)(_reducer.actions.createProvisionConnection, createScim2Connection);
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.resetPhoneNumberState = exports.resetPhoneNumberReducers = exports.resetPhoneNumberActions = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
9
|
var _interfaces = require("./interfaces");
|
|
13
|
-
|
|
14
10
|
var _constants = require("../../constants");
|
|
15
|
-
|
|
16
11
|
const resetPhoneNumberState = {
|
|
17
12
|
step: _interfaces.ResetPhoneNumberStep.ResetPhoneNumber,
|
|
18
13
|
loading: false
|
|
@@ -36,14 +31,13 @@ const actions = {
|
|
|
36
31
|
payload
|
|
37
32
|
}))
|
|
38
33
|
};
|
|
34
|
+
|
|
39
35
|
/**
|
|
40
36
|
* To be used for actions types after dispatch, and should contains
|
|
41
37
|
* the reducers and actions as standalone function
|
|
42
38
|
*/
|
|
43
|
-
|
|
44
39
|
exports.resetPhoneNumberActions = actions;
|
|
45
40
|
// noinspection JSUnusedLocalSymbols
|
|
46
|
-
|
|
47
41
|
/**
|
|
48
42
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
49
43
|
* contains the same functions in reducers and actions
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ResetPhoneNumberStep = void 0;
|
|
7
7
|
let ResetPhoneNumberStep;
|
|
8
8
|
exports.ResetPhoneNumberStep = ResetPhoneNumberStep;
|
|
9
|
-
|
|
10
9
|
(function (ResetPhoneNumberStep) {
|
|
11
10
|
ResetPhoneNumberStep["ResetPhoneNumber"] = "ResetPhoneNumber";
|
|
12
11
|
ResetPhoneNumberStep["VerifyResetPhoneNumber"] = "VerifyResetPhoneNumber";
|
|
@@ -1,40 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.changePhoneNumber = changePhoneNumber;
|
|
9
8
|
exports.resetPhoneNumberSagas = resetPhoneNumberSagas;
|
|
10
|
-
|
|
11
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
-
|
|
13
10
|
var _effects = require("redux-saga/effects");
|
|
14
|
-
|
|
15
11
|
var _restApi = require("@frontegg/rest-api");
|
|
16
|
-
|
|
17
12
|
var _reducer = require("../reducer");
|
|
18
|
-
|
|
19
13
|
var _interfaces = require("./interfaces");
|
|
20
|
-
|
|
21
14
|
var _interfaces2 = require("../LoginState/interfaces");
|
|
22
|
-
|
|
23
15
|
const _excluded = ["callback"],
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
_excluded2 = ["callback"],
|
|
17
|
+
_excluded3 = ["callback"];
|
|
27
18
|
function* resetPhoneNumber(_ref) {
|
|
28
19
|
let {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
payload: {
|
|
21
|
+
callback
|
|
22
|
+
}
|
|
23
|
+
} = _ref,
|
|
24
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref.payload, _excluded);
|
|
34
25
|
yield (0, _effects.put)(_reducer.actions.setResetPhoneNumberState({
|
|
35
26
|
loading: true
|
|
36
27
|
}));
|
|
37
|
-
|
|
38
28
|
try {
|
|
39
29
|
const res = yield (0, _effects.call)(_restApi.api.auth.resetPhoneNumber, body);
|
|
40
30
|
yield (0, _effects.put)(_reducer.actions.setResetPhoneNumberState({
|
|
@@ -54,18 +44,16 @@ function* resetPhoneNumber(_ref) {
|
|
|
54
44
|
callback == null ? void 0 : callback(null, e);
|
|
55
45
|
}
|
|
56
46
|
}
|
|
57
|
-
|
|
58
47
|
function* verifyResetPhoneNumber(_ref2) {
|
|
59
48
|
let {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
payload: {
|
|
50
|
+
callback
|
|
51
|
+
}
|
|
52
|
+
} = _ref2,
|
|
53
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded2);
|
|
65
54
|
yield (0, _effects.put)(_reducer.actions.setResetPhoneNumberState({
|
|
66
55
|
loading: true
|
|
67
56
|
}));
|
|
68
|
-
|
|
69
57
|
try {
|
|
70
58
|
const res = yield (0, _effects.call)(_restApi.api.auth.verifyResetPhoneNumber, body);
|
|
71
59
|
yield (0, _effects.put)(_reducer.actions.setResetPhoneNumberState({
|
|
@@ -83,18 +71,16 @@ function* verifyResetPhoneNumber(_ref2) {
|
|
|
83
71
|
callback == null ? void 0 : callback(null, e);
|
|
84
72
|
}
|
|
85
73
|
}
|
|
86
|
-
|
|
87
74
|
function* changePhoneNumber(_ref3) {
|
|
88
75
|
let {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
payload: {
|
|
77
|
+
callback
|
|
78
|
+
}
|
|
79
|
+
} = _ref3,
|
|
80
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref3.payload, _excluded3);
|
|
94
81
|
yield (0, _effects.put)(_reducer.actions.setResetPhoneNumberState({
|
|
95
82
|
loading: true
|
|
96
83
|
}));
|
|
97
|
-
|
|
98
84
|
try {
|
|
99
85
|
const {
|
|
100
86
|
onRedirectTo,
|
|
@@ -133,7 +119,6 @@ function* changePhoneNumber(_ref3) {
|
|
|
133
119
|
callback == null ? void 0 : callback(null, e);
|
|
134
120
|
}
|
|
135
121
|
}
|
|
136
|
-
|
|
137
122
|
function* resetPhoneNumberSagas() {
|
|
138
123
|
yield (0, _effects.takeLeading)(_reducer.actions.resetPhoneNumber, resetPhoneNumber);
|
|
139
124
|
yield (0, _effects.takeLeading)(_reducer.actions.verifyResetPhoneNumber, verifyResetPhoneNumber);
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.restrictionsState = exports.restrictionsReducers = exports.restrictionsActions = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
9
|
var _constants = require("../../constants");
|
|
13
|
-
|
|
14
10
|
var _restApi = require("@frontegg/rest-api");
|
|
15
|
-
|
|
16
11
|
const restrictionsState = {
|
|
17
12
|
ipRestrictions: {
|
|
18
13
|
loading: false,
|
|
@@ -61,14 +56,13 @@ const actions = {
|
|
|
61
56
|
payload
|
|
62
57
|
}))
|
|
63
58
|
};
|
|
59
|
+
|
|
64
60
|
/**
|
|
65
61
|
* To be used for actions types after dispatch, and should contains
|
|
66
62
|
* the reducers and actions as standalone function
|
|
67
63
|
*/
|
|
68
|
-
|
|
69
64
|
exports.restrictionsActions = actions;
|
|
70
65
|
// noinspection JSUnusedLocalSymbols
|
|
71
|
-
|
|
72
66
|
/**
|
|
73
67
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
74
68
|
* contains the same functions in reducers and actions
|