@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,28 +1,19 @@
|
|
|
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.sagas = sagas;
|
|
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 _reducer = require("./reducer");
|
|
17
|
-
|
|
18
12
|
var _consts = require("./consts");
|
|
19
|
-
|
|
20
13
|
var _restApi = require("@frontegg/rest-api");
|
|
21
|
-
|
|
22
14
|
const _excluded = ["id"],
|
|
23
|
-
|
|
15
|
+
_excluded2 = ["id", "enabled"];
|
|
24
16
|
const addApi = ['categories', 'channelMap'];
|
|
25
|
-
|
|
26
17
|
function* loadPlatformData(ch) {
|
|
27
18
|
return yield (0, _effects.call)(loadFunction, {
|
|
28
19
|
payload: {
|
|
@@ -31,24 +22,25 @@ function* loadPlatformData(ch) {
|
|
|
31
22
|
type: ''
|
|
32
23
|
});
|
|
33
24
|
}
|
|
34
|
-
|
|
35
25
|
function* loadDataFunction({
|
|
36
26
|
payload = _consts.channels
|
|
37
27
|
}) {
|
|
38
28
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
39
29
|
isLoading: true
|
|
40
30
|
}));
|
|
41
|
-
|
|
42
31
|
try {
|
|
43
32
|
// @ts-ignore
|
|
44
|
-
const values = yield (0, _effects.all)([
|
|
45
|
-
|
|
33
|
+
const values = yield (0, _effects.all)([
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
...payload.map(loadPlatformData),
|
|
36
|
+
// @ts-ignore
|
|
46
37
|
yield loadFunction({
|
|
47
38
|
payload: {
|
|
48
39
|
api: 'categories'
|
|
49
40
|
},
|
|
50
41
|
type: ''
|
|
51
|
-
}),
|
|
42
|
+
}),
|
|
43
|
+
// @ts-ignore
|
|
52
44
|
yield function* () {
|
|
53
45
|
// @ts-ignore
|
|
54
46
|
const res = yield (0, _effects.all)(payload.map(function* (ch) {
|
|
@@ -64,8 +56,8 @@ function* loadDataFunction({
|
|
|
64
56
|
return res.reduce((acc, curr, idx) => (0, _extends2.default)({}, acc, {
|
|
65
57
|
[`${payload[idx]}`]: curr
|
|
66
58
|
}), {});
|
|
67
|
-
}()]);
|
|
68
|
-
|
|
59
|
+
}()]);
|
|
60
|
+
// @ts-ignore
|
|
69
61
|
const webhooks = yield loadFunction({
|
|
70
62
|
payload: {
|
|
71
63
|
api: 'webhook'
|
|
@@ -99,7 +91,6 @@ function* loadDataFunction({
|
|
|
99
91
|
}));
|
|
100
92
|
}
|
|
101
93
|
}
|
|
102
|
-
|
|
103
94
|
function* loadFunction({
|
|
104
95
|
payload: {
|
|
105
96
|
api,
|
|
@@ -114,16 +105,16 @@ function* loadFunction({
|
|
|
114
105
|
return undefined;
|
|
115
106
|
}
|
|
116
107
|
}
|
|
117
|
-
|
|
118
108
|
function* loadSlackFunction() {
|
|
119
109
|
try {
|
|
120
110
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
121
111
|
slackChannels: {
|
|
122
112
|
isLoading: true
|
|
123
113
|
}
|
|
124
|
-
}));
|
|
125
|
-
// @ts-ignore
|
|
114
|
+
}));
|
|
126
115
|
|
|
116
|
+
// TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
117
|
+
// @ts-ignore
|
|
127
118
|
const data = yield (0, _effects.call)(_restApi.api.connectivity.getSlackChannels);
|
|
128
119
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
129
120
|
error: undefined,
|
|
@@ -141,7 +132,6 @@ function* loadSlackFunction() {
|
|
|
141
132
|
}));
|
|
142
133
|
}
|
|
143
134
|
}
|
|
144
|
-
|
|
145
135
|
function* checkNewStatus(platform, data) {
|
|
146
136
|
const {
|
|
147
137
|
connectivity: {
|
|
@@ -152,18 +142,15 @@ function* checkNewStatus(platform, data) {
|
|
|
152
142
|
key
|
|
153
143
|
}) => key === platform);
|
|
154
144
|
if (!currPlatform) return;
|
|
155
|
-
|
|
156
145
|
const newActive = _consts.channels2Platform[platform].isActive(data);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
146
|
+
if (newActive === currPlatform.active) return;
|
|
147
|
+
//TODO: double check
|
|
160
148
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
161
149
|
list: list.map(elm => elm.key === platform ? (0, _extends2.default)({}, elm, {
|
|
162
150
|
active: newActive
|
|
163
151
|
}) : elm)
|
|
164
152
|
}));
|
|
165
153
|
}
|
|
166
|
-
|
|
167
154
|
function* postDataFunction({
|
|
168
155
|
payload: {
|
|
169
156
|
platform,
|
|
@@ -174,14 +161,12 @@ function* postDataFunction({
|
|
|
174
161
|
const {
|
|
175
162
|
processIds
|
|
176
163
|
} = yield (0, _effects.select)(state => state.connectivity);
|
|
177
|
-
|
|
178
164
|
try {
|
|
179
165
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
180
166
|
isSaving: true,
|
|
181
167
|
//@ts-ignore
|
|
182
168
|
processIds: platform === 'webhook' ? [data._id, ...processIds] : processIds
|
|
183
169
|
}));
|
|
184
|
-
|
|
185
170
|
if (platform === 'slack') {
|
|
186
171
|
yield postSlackData({
|
|
187
172
|
payload: data,
|
|
@@ -195,7 +180,6 @@ function* postDataFunction({
|
|
|
195
180
|
} else {
|
|
196
181
|
yield (0, _effects.call)(_consts.type2ApiPost[platform], data);
|
|
197
182
|
}
|
|
198
|
-
|
|
199
183
|
if (!['sms', 'email'].includes(platform)) {
|
|
200
184
|
// @ts-ignore
|
|
201
185
|
const newData = yield loadFunction({
|
|
@@ -204,11 +188,9 @@ function* postDataFunction({
|
|
|
204
188
|
},
|
|
205
189
|
type: ''
|
|
206
190
|
});
|
|
207
|
-
|
|
208
191
|
if (platform === 'webhook') {
|
|
209
192
|
newData.id = data._id;
|
|
210
193
|
}
|
|
211
|
-
|
|
212
194
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
213
195
|
error: undefined,
|
|
214
196
|
isSaving: false,
|
|
@@ -220,7 +202,6 @@ function* postDataFunction({
|
|
|
220
202
|
}
|
|
221
203
|
} catch (e) {
|
|
222
204
|
var _e$message;
|
|
223
|
-
|
|
224
205
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
225
206
|
error: (_e$message = e.message) != null ? _e$message : e.toString(),
|
|
226
207
|
isSaving: false,
|
|
@@ -228,7 +209,6 @@ function* postDataFunction({
|
|
|
228
209
|
}));
|
|
229
210
|
}
|
|
230
211
|
}
|
|
231
|
-
|
|
232
212
|
function* postSlackData({
|
|
233
213
|
payload
|
|
234
214
|
}) {
|
|
@@ -237,11 +217,9 @@ function* postSlackData({
|
|
|
237
217
|
slack
|
|
238
218
|
}
|
|
239
219
|
} = yield (0, _effects.select)();
|
|
240
|
-
|
|
241
220
|
if (!slack) {
|
|
242
221
|
return;
|
|
243
222
|
}
|
|
244
|
-
|
|
245
223
|
const {
|
|
246
224
|
slackSubscriptions: stateSlackSubscriptions
|
|
247
225
|
} = slack;
|
|
@@ -250,25 +228,21 @@ function* postSlackData({
|
|
|
250
228
|
} = payload;
|
|
251
229
|
yield (0, _effects.all)([...slackSubscriptions.reduce((acc, curr) => {
|
|
252
230
|
var _curr$slackEvents$0$c, _curr$slackEvents$0$c2;
|
|
253
|
-
|
|
254
231
|
if (!curr.id && curr.slackEvents && (_curr$slackEvents$0$c = curr.slackEvents[0].channelIds) != null && _curr$slackEvents$0$c.length) {
|
|
255
232
|
return [...acc, curr];
|
|
256
233
|
}
|
|
257
|
-
|
|
258
234
|
const el = stateSlackSubscriptions == null ? void 0 : stateSlackSubscriptions.find(_ref => {
|
|
259
235
|
let {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
236
|
+
id
|
|
237
|
+
} = _ref,
|
|
238
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
263
239
|
return id === curr.id && JSON.stringify((0, _extends2.default)({
|
|
264
240
|
id
|
|
265
241
|
}, props)) !== JSON.stringify(curr);
|
|
266
242
|
});
|
|
267
|
-
|
|
268
243
|
if (el && curr.slackEvents && (_curr$slackEvents$0$c2 = curr.slackEvents[0].channelIds) != null && _curr$slackEvents$0$c2.length) {
|
|
269
244
|
return [...acc, curr];
|
|
270
245
|
}
|
|
271
|
-
|
|
272
246
|
return acc;
|
|
273
247
|
}, []).map(function* (el) {
|
|
274
248
|
// @ts-ignore
|
|
@@ -277,12 +251,12 @@ function* postSlackData({
|
|
|
277
251
|
if (curr.id && !curr.slackEvents[0].channelIds.length) {
|
|
278
252
|
return [...acc, curr];
|
|
279
253
|
}
|
|
280
|
-
|
|
281
254
|
return acc;
|
|
282
255
|
}, []).map(function* (el) {
|
|
283
256
|
// @ts-ignore
|
|
284
257
|
return yield (0, _effects.call)(_restApi.api.connectivity.deleteSlackConfiguration, el);
|
|
285
|
-
})
|
|
258
|
+
})
|
|
259
|
+
// clean the old data
|
|
286
260
|
// ...stateSlackSubscriptions
|
|
287
261
|
// // @ts-ignore
|
|
288
262
|
// .reduce((acc, curr) => {
|
|
@@ -312,33 +286,30 @@ function* postEmailSMSData({
|
|
|
312
286
|
const stateData = connectivity[type];
|
|
313
287
|
if (!stateData) return;
|
|
314
288
|
let actionsResult = [];
|
|
315
|
-
|
|
316
289
|
try {
|
|
317
|
-
actionsResult = yield (0, _effects.all)([
|
|
290
|
+
actionsResult = yield (0, _effects.all)([
|
|
291
|
+
// create new
|
|
318
292
|
...payload.reduce((acc, curr) => {
|
|
319
293
|
const state = stateData.find(({
|
|
320
294
|
eventKey
|
|
321
295
|
}) => eventKey === curr.eventKey);
|
|
322
|
-
|
|
323
296
|
if (!state && curr.subscriptions[0].recipients.filter(el => el).length) {
|
|
324
297
|
return [...acc, curr];
|
|
325
298
|
}
|
|
326
|
-
|
|
327
299
|
return acc;
|
|
328
300
|
}, []).map(function* (data) {
|
|
329
301
|
// TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
330
302
|
// @ts-ignore
|
|
331
303
|
return yield (0, _effects.call)(type === 'email' ? _restApi.api.connectivity.postEmailConfiguration : _restApi.api.connectivity.postSMSConfiguration, data);
|
|
332
|
-
}),
|
|
304
|
+
}),
|
|
305
|
+
// update exists
|
|
333
306
|
...payload.reduce((acc, curr) => {
|
|
334
307
|
const state = stateData.find(({
|
|
335
308
|
eventKey
|
|
336
309
|
}) => eventKey === curr.eventKey);
|
|
337
|
-
|
|
338
310
|
if (state && JSON.stringify(state) !== JSON.stringify(curr)) {
|
|
339
311
|
return [...acc, curr];
|
|
340
312
|
}
|
|
341
|
-
|
|
342
313
|
return acc;
|
|
343
314
|
}, []).map(function* (data) {
|
|
344
315
|
const {
|
|
@@ -346,30 +317,31 @@ function* postEmailSMSData({
|
|
|
346
317
|
eventKey
|
|
347
318
|
} = data;
|
|
348
319
|
const _subscriptions$ = subscriptions[0],
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
return yield (0, _effects.all)([
|
|
320
|
+
{
|
|
321
|
+
id = '',
|
|
322
|
+
enabled
|
|
323
|
+
} = _subscriptions$,
|
|
324
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_subscriptions$, _excluded2);
|
|
325
|
+
// @ts-ignore
|
|
326
|
+
return yield (0, _effects.all)([
|
|
327
|
+
// @ts-ignore
|
|
356
328
|
yield (0, _effects.call)(type === 'email' ? _restApi.api.connectivity.patchEmailConfiguration : _restApi.api.connectivity.patchSMSConfiguration, {
|
|
357
329
|
eventKey,
|
|
358
330
|
enabled
|
|
359
|
-
}),
|
|
331
|
+
}),
|
|
332
|
+
// @ts-ignore
|
|
360
333
|
yield (0, _effects.call)(type === 'email' ? _restApi.api.connectivity.putEmailSubscriptions : _restApi.api.connectivity.putSMSSubscriptions, id, eventKey, (0, _extends2.default)({}, body, {
|
|
361
334
|
enabled
|
|
362
335
|
}))]);
|
|
363
|
-
}),
|
|
336
|
+
}),
|
|
337
|
+
// delete record with empty recipients
|
|
364
338
|
...payload.reduce((acc, curr) => {
|
|
365
339
|
const state = stateData.find(({
|
|
366
340
|
eventKey
|
|
367
341
|
}) => eventKey === curr.eventKey);
|
|
368
|
-
|
|
369
342
|
if (state && state.subscriptions[0].recipients.length && !curr.subscriptions[0].recipients.filter(el => !!el).length) {
|
|
370
343
|
return [...acc, curr];
|
|
371
344
|
}
|
|
372
|
-
|
|
373
345
|
return acc;
|
|
374
346
|
}, []).map(function* ({
|
|
375
347
|
eventKey,
|
|
@@ -378,7 +350,6 @@ function* postEmailSMSData({
|
|
|
378
350
|
return (0, _effects.call)(type === 'email' ? _restApi.api.connectivity.deleteEmailSubscriptions : _restApi.api.connectivity.deleteSMSSubscriptions, eventKey, subscriptions[0].id || '');
|
|
379
351
|
})]);
|
|
380
352
|
} catch {}
|
|
381
|
-
|
|
382
353
|
if (actionsResult.length) {
|
|
383
354
|
// @ts-ignore
|
|
384
355
|
const newData = yield loadFunction({
|
|
@@ -386,8 +357,8 @@ function* postEmailSMSData({
|
|
|
386
357
|
api: type
|
|
387
358
|
},
|
|
388
359
|
type: ''
|
|
389
|
-
});
|
|
390
|
-
|
|
360
|
+
});
|
|
361
|
+
// yield put(connectivityActions.postDataSuccess({ platform: type, data: newData }));
|
|
391
362
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
392
363
|
error: undefined,
|
|
393
364
|
isSaving: false,
|
|
@@ -405,26 +376,22 @@ function* postEmailSMSData({
|
|
|
405
376
|
}));
|
|
406
377
|
}
|
|
407
378
|
}
|
|
408
|
-
|
|
409
379
|
function* postCodeFunction({
|
|
410
380
|
payload
|
|
411
381
|
}) {
|
|
412
382
|
try {
|
|
413
383
|
yield _restApi.api.connectivity.postSlackCode(payload);
|
|
414
|
-
} catch {}
|
|
415
|
-
|
|
416
|
-
|
|
384
|
+
} catch {}
|
|
385
|
+
// yield put(connectivityActions.postCodeSuccess());
|
|
417
386
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
418
387
|
error: undefined,
|
|
419
388
|
isSaving: false
|
|
420
389
|
}));
|
|
421
390
|
}
|
|
422
|
-
|
|
423
391
|
function* loadSlackPermissions() {
|
|
424
392
|
const {
|
|
425
393
|
slackChannels
|
|
426
394
|
} = yield (0, _effects.select)(state => state.connectivity);
|
|
427
|
-
|
|
428
395
|
try {
|
|
429
396
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
430
397
|
slackChannels: (0, _extends2.default)({}, slackChannels, {
|
|
@@ -433,8 +400,8 @@ function* loadSlackPermissions() {
|
|
|
433
400
|
}));
|
|
434
401
|
const {
|
|
435
402
|
clientId
|
|
436
|
-
} = yield (0, _effects.call)(_restApi.api.connectivity.getSlackScope);
|
|
437
|
-
|
|
403
|
+
} = yield (0, _effects.call)(_restApi.api.connectivity.getSlackScope);
|
|
404
|
+
// yield put(connectivityActions.loadScopeSuccess(clientId));
|
|
438
405
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
439
406
|
slackChannels: {
|
|
440
407
|
error: undefined,
|
|
@@ -454,7 +421,6 @@ function* loadSlackPermissions() {
|
|
|
454
421
|
}));
|
|
455
422
|
}
|
|
456
423
|
}
|
|
457
|
-
|
|
458
424
|
function* deleteWebhookConfigFunction({
|
|
459
425
|
payload
|
|
460
426
|
}) {
|
|
@@ -465,7 +431,6 @@ function* deleteWebhookConfigFunction({
|
|
|
465
431
|
const {
|
|
466
432
|
processIds
|
|
467
433
|
} = yield (0, _effects.select)(state => state.connectivity);
|
|
468
|
-
|
|
469
434
|
try {
|
|
470
435
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
471
436
|
isSaving: true
|
|
@@ -473,16 +438,14 @@ function* deleteWebhookConfigFunction({
|
|
|
473
438
|
yield (0, _effects.call)(_restApi.api.connectivity.deleteWebhooksConfiguration, webhookId);
|
|
474
439
|
} catch (e) {
|
|
475
440
|
callback == null ? void 0 : callback(null, e.message);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
|
|
441
|
+
}
|
|
442
|
+
// @ts-ignore
|
|
479
443
|
const newData = yield loadFunction({
|
|
480
444
|
payload: {
|
|
481
445
|
api: 'webhook'
|
|
482
446
|
},
|
|
483
447
|
type: ''
|
|
484
448
|
});
|
|
485
|
-
|
|
486
449
|
if (newData) {
|
|
487
450
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
488
451
|
error: undefined,
|
|
@@ -491,10 +454,8 @@ function* deleteWebhookConfigFunction({
|
|
|
491
454
|
processIds: newData.id ? processIds.filter(el => el !== newData.id) : processIds
|
|
492
455
|
}));
|
|
493
456
|
}
|
|
494
|
-
|
|
495
457
|
callback == null ? void 0 : callback(true);
|
|
496
458
|
}
|
|
497
|
-
|
|
498
459
|
function* postWebhookTestFunction({
|
|
499
460
|
payload
|
|
500
461
|
}) {
|
|
@@ -506,7 +467,6 @@ function* postWebhookTestFunction({
|
|
|
506
467
|
statusCode,
|
|
507
468
|
body
|
|
508
469
|
} = yield (0, _effects.call)(_restApi.api.connectivity.postWebhookTest, payload);
|
|
509
|
-
|
|
510
470
|
if ([201, 200].includes(statusCode)) {
|
|
511
471
|
// yield put(connectivityActions.postWebhookTestSuccess('success', JSON.stringify(body, null, 2)));
|
|
512
472
|
const message = JSON.stringify(body, null, 2);
|
|
@@ -537,7 +497,6 @@ function* postWebhookTestFunction({
|
|
|
537
497
|
}));
|
|
538
498
|
}
|
|
539
499
|
}
|
|
540
|
-
|
|
541
500
|
function* postWebhookRetryFunction({
|
|
542
501
|
payload
|
|
543
502
|
}) {
|
|
@@ -560,7 +519,6 @@ function* postWebhookRetryFunction({
|
|
|
560
519
|
}));
|
|
561
520
|
}
|
|
562
521
|
}
|
|
563
|
-
|
|
564
522
|
function* loadWebhookLogsFunction({
|
|
565
523
|
payload: {
|
|
566
524
|
id,
|
|
@@ -571,17 +529,16 @@ function* loadWebhookLogsFunction({
|
|
|
571
529
|
const {
|
|
572
530
|
webhookLogs
|
|
573
531
|
} = yield (0, _effects.select)(state => state.connectivity);
|
|
574
|
-
|
|
575
532
|
try {
|
|
576
533
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
577
534
|
webhookLogs: (0, _extends2.default)({}, webhookLogs, {
|
|
578
535
|
isLoading: true
|
|
579
536
|
})
|
|
580
|
-
}));
|
|
537
|
+
}));
|
|
538
|
+
//TODO: Fix types
|
|
581
539
|
//@ts-ignore
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
540
|
+
const data = yield (0, _effects.call)(_restApi.api.connectivity.getWebhookLog, id, offset, limit);
|
|
541
|
+
// yield put(connectivityActions.loadWebhookLogsSuccess(data));
|
|
585
542
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
586
543
|
error: undefined,
|
|
587
544
|
webhookLogs: (0, _extends2.default)({
|
|
@@ -597,7 +554,6 @@ function* loadWebhookLogsFunction({
|
|
|
597
554
|
}));
|
|
598
555
|
}
|
|
599
556
|
}
|
|
600
|
-
|
|
601
557
|
function* sagas() {
|
|
602
558
|
yield (0, _effects.takeEvery)(_reducer.actions.loadDataAction, loadDataFunction);
|
|
603
559
|
yield (0, _effects.takeLatest)(_reducer.actions.loadSlackActions, loadSlackFunction);
|
package/node/helpers.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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
|
});
|
|
@@ -10,11 +9,8 @@ exports.generateActionCreator = generateActionCreator;
|
|
|
10
9
|
exports.generateCodeChallenge = generateCodeChallenge;
|
|
11
10
|
exports.omitProps = omitProps;
|
|
12
11
|
exports.readFileAsText = void 0;
|
|
13
|
-
|
|
14
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
-
|
|
16
13
|
var _toolkit = require("@reduxjs/toolkit");
|
|
17
|
-
|
|
18
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
15
|
function omitProps(props, keys) {
|
|
20
16
|
const newProps = (0, _extends2.default)({}, props);
|
|
@@ -23,37 +19,29 @@ function omitProps(props, keys) {
|
|
|
23
19
|
});
|
|
24
20
|
return newProps;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
function generateActionCreator(storeName) {
|
|
28
23
|
return (key, withPayload) => withPayload ? (0, _toolkit.createAction)(`${storeName}/${key}`, payload => ({
|
|
29
24
|
payload
|
|
30
25
|
})) : (0, _toolkit.createAction)(`${storeName}/${key}`);
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
async function generateCodeChallenge(codeVerifier) {
|
|
34
|
-
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
|
|
28
|
+
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
|
|
35
29
|
|
|
30
|
+
// @ts-ignore
|
|
36
31
|
return btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
|
37
32
|
}
|
|
38
|
-
|
|
39
33
|
function createRandomString(length = 16) {
|
|
40
34
|
let text = '';
|
|
41
35
|
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
42
|
-
|
|
43
36
|
for (let i = 0; i < length; i++) {
|
|
44
37
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
return text;
|
|
48
40
|
}
|
|
49
|
-
|
|
50
41
|
const readFileAsText = file => new Promise((resolve, reject) => {
|
|
51
42
|
const reader = new FileReader();
|
|
52
43
|
reader.readAsText(file);
|
|
53
|
-
|
|
54
44
|
reader.onload = () => resolve(reader.result);
|
|
55
|
-
|
|
56
45
|
reader.onerror = reject;
|
|
57
46
|
});
|
|
58
|
-
|
|
59
47
|
exports.readFileAsText = readFileAsText;
|
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Frontegg v6.
|
|
1
|
+
/** @license Frontegg v6.70.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -45,9 +45,7 @@ Object.defineProperty(exports, "vendor", {
|
|
|
45
45
|
return _vendor.default;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
|
|
49
48
|
var _auth = _interopRequireWildcard(require("./auth"));
|
|
50
|
-
|
|
51
49
|
Object.keys(_auth).forEach(function (key) {
|
|
52
50
|
if (key === "default" || key === "__esModule") return;
|
|
53
51
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -59,9 +57,7 @@ Object.keys(_auth).forEach(function (key) {
|
|
|
59
57
|
}
|
|
60
58
|
});
|
|
61
59
|
});
|
|
62
|
-
|
|
63
60
|
var _audits = _interopRequireWildcard(require("./audits"));
|
|
64
|
-
|
|
65
61
|
Object.keys(_audits).forEach(function (key) {
|
|
66
62
|
if (key === "default" || key === "__esModule") return;
|
|
67
63
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -73,9 +69,7 @@ Object.keys(_audits).forEach(function (key) {
|
|
|
73
69
|
}
|
|
74
70
|
});
|
|
75
71
|
});
|
|
76
|
-
|
|
77
72
|
var _connectivity = _interopRequireWildcard(require("./connectivity"));
|
|
78
|
-
|
|
79
73
|
Object.keys(_connectivity).forEach(function (key) {
|
|
80
74
|
if (key === "default" || key === "__esModule") return;
|
|
81
75
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -87,9 +81,7 @@ Object.keys(_connectivity).forEach(function (key) {
|
|
|
87
81
|
}
|
|
88
82
|
});
|
|
89
83
|
});
|
|
90
|
-
|
|
91
84
|
var _subscriptions = _interopRequireWildcard(require("./subscriptions"));
|
|
92
|
-
|
|
93
85
|
Object.keys(_subscriptions).forEach(function (key) {
|
|
94
86
|
if (key === "default" || key === "__esModule") return;
|
|
95
87
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -101,9 +93,7 @@ Object.keys(_subscriptions).forEach(function (key) {
|
|
|
101
93
|
}
|
|
102
94
|
});
|
|
103
95
|
});
|
|
104
|
-
|
|
105
96
|
var _vendor = _interopRequireWildcard(require("./vendor"));
|
|
106
|
-
|
|
107
97
|
Object.keys(_vendor).forEach(function (key) {
|
|
108
98
|
if (key === "default" || key === "__esModule") return;
|
|
109
99
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -115,9 +105,7 @@ Object.keys(_vendor).forEach(function (key) {
|
|
|
115
105
|
}
|
|
116
106
|
});
|
|
117
107
|
});
|
|
118
|
-
|
|
119
108
|
var _backwardCompatibility = require("./audits/backward-compatibility");
|
|
120
|
-
|
|
121
109
|
Object.keys(_backwardCompatibility).forEach(function (key) {
|
|
122
110
|
if (key === "default" || key === "__esModule") return;
|
|
123
111
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -129,9 +117,7 @@ Object.keys(_backwardCompatibility).forEach(function (key) {
|
|
|
129
117
|
}
|
|
130
118
|
});
|
|
131
119
|
});
|
|
132
|
-
|
|
133
120
|
var _toolkit = require("./toolkit");
|
|
134
|
-
|
|
135
121
|
Object.keys(_toolkit).forEach(function (key) {
|
|
136
122
|
if (key === "default" || key === "__esModule") return;
|
|
137
123
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -143,7 +129,5 @@ Object.keys(_toolkit).forEach(function (key) {
|
|
|
143
129
|
}
|
|
144
130
|
});
|
|
145
131
|
});
|
|
146
|
-
|
|
147
132
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
148
|
-
|
|
149
133
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -1,22 +1,15 @@
|
|
|
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.initialBillingInformationState = exports.informationReducer = exports.informationActions = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _toolkit = require("@reduxjs/toolkit");
|
|
13
|
-
|
|
14
10
|
var _utils = require("../../utils");
|
|
15
|
-
|
|
16
11
|
var _constants = require("../../../constants");
|
|
17
|
-
|
|
18
12
|
var _Subscription = require("../Subscription");
|
|
19
|
-
|
|
20
13
|
const initialBillingInformationState = {
|
|
21
14
|
loading: false,
|
|
22
15
|
error: null,
|