@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.
Files changed (254) hide show
  1. package/audits/AuditLogsState/index.js +1 -1
  2. package/audits/AuditLogsState/saga.js +1 -18
  3. package/audits/AuditsMetadataState/index.js +1 -1
  4. package/audits/AuditsMetadataState/saga.js +1 -5
  5. package/audits/backward-compatibility/saga.js +0 -18
  6. package/audits/dummy.js +0 -16
  7. package/audits/index.js +4 -2
  8. package/audits/reducer.js +0 -2
  9. package/auth/AcceptInvitationState/index.d.ts +2 -0
  10. package/auth/AcceptInvitationState/index.js +1 -1
  11. package/auth/AcceptInvitationState/interfaces.js +0 -1
  12. package/auth/AcceptInvitationState/saga.js +0 -3
  13. package/auth/AccountSettingsState/index.d.ts +2 -0
  14. package/auth/AccountSettingsState/index.js +1 -1
  15. package/auth/AccountSettingsState/interfaces.d.ts +2 -0
  16. package/auth/AccountSettingsState/saga.js +1 -11
  17. package/auth/ActivateState/index.d.ts +3 -0
  18. package/auth/ActivateState/index.js +1 -1
  19. package/auth/ActivateState/interfaces.js +0 -1
  20. package/auth/ActivateState/saga.js +14 -34
  21. package/auth/ApiTokensState/index.d.ts +2 -0
  22. package/auth/ApiTokensState/index.js +1 -1
  23. package/auth/ApiTokensState/interfaces.d.ts +1 -0
  24. package/auth/ApiTokensState/interfaces.js +0 -1
  25. package/auth/ApiTokensState/saga.js +1 -44
  26. package/auth/ForgotPasswordState/index.d.ts +2 -0
  27. package/auth/ForgotPasswordState/index.js +1 -1
  28. package/auth/ForgotPasswordState/interfaces.js +0 -1
  29. package/auth/ForgotPasswordState/saga.js +5 -12
  30. package/auth/ImpersonationState/index.d.ts +2 -0
  31. package/auth/ImpersonationState/index.js +1 -1
  32. package/auth/ImpersonationState/interfaces.js +0 -1
  33. package/auth/ImpersonationState/saga.js +5 -9
  34. package/auth/LoginState/index.d.ts +2 -0
  35. package/auth/LoginState/index.js +1 -1
  36. package/auth/LoginState/interfaces.js +0 -6
  37. package/auth/LoginState/saga.d.ts +2 -38
  38. package/auth/LoginState/saga.js +132 -292
  39. package/auth/MfaState/index.d.ts +4 -2
  40. package/auth/MfaState/index.js +1 -1
  41. package/auth/MfaState/interfaces.d.ts +2 -2
  42. package/auth/MfaState/interfaces.js +0 -1
  43. package/auth/MfaState/saga.js +64 -143
  44. package/auth/ProfileState/index.d.ts +2 -0
  45. package/auth/ProfileState/index.js +1 -1
  46. package/auth/ProfileState/saga.js +22 -50
  47. package/auth/Provisioning/index.d.ts +2 -0
  48. package/auth/Provisioning/index.js +1 -1
  49. package/auth/Provisioning/saga.js +11 -23
  50. package/auth/ResetPhoneNumberState/index.d.ts +2 -0
  51. package/auth/ResetPhoneNumberState/index.js +1 -1
  52. package/auth/ResetPhoneNumberState/interfaces.js +0 -1
  53. package/auth/ResetPhoneNumberState/saga.js +17 -26
  54. package/auth/RestrictionsState/index.d.ts +3 -0
  55. package/auth/RestrictionsState/index.js +1 -1
  56. package/auth/RestrictionsState/saga.js +52 -105
  57. package/auth/RolesState/index.d.ts +2 -0
  58. package/auth/RolesState/index.js +1 -1
  59. package/auth/RolesState/saga.js +30 -51
  60. package/auth/SSOState/index.d.ts +2 -0
  61. package/auth/SSOState/index.js +1 -1
  62. package/auth/SSOState/interfaces.js +0 -3
  63. package/auth/SSOState/saga.js +10 -58
  64. package/auth/SSOState/saga.v2.js +13 -49
  65. package/auth/SecurityPolicyState/index.d.ts +13 -0
  66. package/auth/SecurityPolicyState/index.js +1 -1
  67. package/auth/SecurityPolicyState/saga.js +36 -90
  68. package/auth/SessionsPolicyState/index.d.ts +2 -0
  69. package/auth/SessionsPolicyState/index.js +1 -1
  70. package/auth/SessionsPolicyState/saga.js +7 -19
  71. package/auth/SessionsState/index.d.ts +2 -0
  72. package/auth/SessionsState/index.js +1 -1
  73. package/auth/SessionsState/saga.js +1 -15
  74. package/auth/SignUp/index.d.ts +2 -0
  75. package/auth/SignUp/index.js +1 -1
  76. package/auth/SignUp/interfaces.js +0 -1
  77. package/auth/SignUp/saga.js +6 -15
  78. package/auth/SocialLogins/index.d.ts +2 -0
  79. package/auth/SocialLogins/index.js +1 -1
  80. package/auth/SocialLogins/saga.js +10 -20
  81. package/auth/TeamState/index.d.ts +2 -0
  82. package/auth/TeamState/index.js +1 -1
  83. package/auth/TeamState/interfaces.js +0 -1
  84. package/auth/TeamState/saga.js +85 -205
  85. package/auth/TenantsState/index.d.ts +2 -0
  86. package/auth/TenantsState/index.js +1 -1
  87. package/auth/TenantsState/saga.js +1 -17
  88. package/auth/index.d.ts +2 -2
  89. package/auth/index.js +4 -3
  90. package/auth/interfaces.d.ts +2 -1
  91. package/auth/interfaces.js +0 -6
  92. package/auth/reducer.d.ts +2 -2
  93. package/auth/reducer.js +0 -2
  94. package/auth/saga.js +2 -1
  95. package/auth/utils.d.ts +4 -0
  96. package/auth/utils.js +7 -21
  97. package/connectivity/ConnectivityState/index.d.ts +9 -0
  98. package/connectivity/ConnectivityState/index.js +1 -1
  99. package/connectivity/consts.js +0 -5
  100. package/connectivity/index.js +4 -2
  101. package/connectivity/interfaces.d.ts +1 -0
  102. package/connectivity/reducer.js +0 -2
  103. package/connectivity/saga.js +48 -85
  104. package/helpers.js +4 -7
  105. package/index.js +1 -1
  106. package/node/audits/AuditLogsState/index.js +1 -8
  107. package/node/audits/AuditLogsState/saga.js +1 -26
  108. package/node/audits/AuditsMetadataState/index.js +1 -8
  109. package/node/audits/AuditsMetadataState/saga.js +1 -10
  110. package/node/audits/backward-compatibility/index.js +0 -8
  111. package/node/audits/backward-compatibility/reducer.js +0 -5
  112. package/node/audits/backward-compatibility/saga.js +0 -23
  113. package/node/audits/dummy.js +0 -19
  114. package/node/audits/index.js +0 -14
  115. package/node/audits/initialState.js +0 -3
  116. package/node/audits/reducer.js +0 -8
  117. package/node/audits/saga.js +0 -5
  118. package/node/audits/utils.js +0 -4
  119. package/node/auth/AcceptInvitationState/index.js +1 -7
  120. package/node/auth/AcceptInvitationState/interfaces.js +0 -1
  121. package/node/auth/AcceptInvitationState/saga.js +0 -7
  122. package/node/auth/AccountSettingsState/index.js +1 -6
  123. package/node/auth/AccountSettingsState/saga.js +1 -16
  124. package/node/auth/ActivateState/index.js +1 -7
  125. package/node/auth/ActivateState/interfaces.js +0 -1
  126. package/node/auth/ActivateState/saga.js +14 -41
  127. package/node/auth/ApiTokensState/index.js +1 -6
  128. package/node/auth/ApiTokensState/interfaces.js +0 -1
  129. package/node/auth/ApiTokensState/saga.js +1 -51
  130. package/node/auth/ForgotPasswordState/index.js +1 -7
  131. package/node/auth/ForgotPasswordState/interfaces.js +0 -1
  132. package/node/auth/ForgotPasswordState/saga.js +5 -19
  133. package/node/auth/ImpersonationState/index.js +1 -7
  134. package/node/auth/ImpersonationState/interfaces.js +0 -1
  135. package/node/auth/ImpersonationState/saga.js +5 -15
  136. package/node/auth/LoginState/index.js +1 -7
  137. package/node/auth/LoginState/interfaces.js +0 -7
  138. package/node/auth/LoginState/saga.js +132 -322
  139. package/node/auth/MfaState/index.js +1 -7
  140. package/node/auth/MfaState/interfaces.js +0 -1
  141. package/node/auth/MfaState/saga.js +64 -137
  142. package/node/auth/ProfileState/index.js +1 -6
  143. package/node/auth/ProfileState/saga.js +22 -58
  144. package/node/auth/Provisioning/index.js +1 -6
  145. package/node/auth/Provisioning/saga.js +11 -28
  146. package/node/auth/ResetPhoneNumberState/index.js +1 -7
  147. package/node/auth/ResetPhoneNumberState/interfaces.js +0 -1
  148. package/node/auth/ResetPhoneNumberState/saga.js +17 -32
  149. package/node/auth/RestrictionsState/index.js +1 -7
  150. package/node/auth/RestrictionsState/saga.js +52 -109
  151. package/node/auth/RolesState/index.js +1 -6
  152. package/node/auth/RolesState/saga.js +30 -54
  153. package/node/auth/SSOState/index.js +1 -6
  154. package/node/auth/SSOState/interfaces.js +0 -3
  155. package/node/auth/SSOState/saga.js +10 -63
  156. package/node/auth/SSOState/saga.v2.js +13 -53
  157. package/node/auth/SecurityPolicyState/index.js +1 -6
  158. package/node/auth/SecurityPolicyState/saga.js +36 -89
  159. package/node/auth/SessionsPolicyState/index.js +1 -6
  160. package/node/auth/SessionsPolicyState/saga.js +7 -24
  161. package/node/auth/SessionsState/index.js +1 -6
  162. package/node/auth/SessionsState/saga.js +1 -22
  163. package/node/auth/SignUp/index.js +1 -7
  164. package/node/auth/SignUp/interfaces.js +0 -1
  165. package/node/auth/SignUp/saga.js +6 -30
  166. package/node/auth/SocialLogins/index.js +1 -6
  167. package/node/auth/SocialLogins/saga.js +10 -33
  168. package/node/auth/TeamState/index.js +1 -6
  169. package/node/auth/TeamState/interfaces.js +0 -1
  170. package/node/auth/TeamState/saga.js +86 -190
  171. package/node/auth/TenantsState/index.js +1 -6
  172. package/node/auth/TenantsState/saga.js +1 -24
  173. package/node/auth/dummy.js +0 -5
  174. package/node/auth/index.js +0 -90
  175. package/node/auth/initialState.js +0 -23
  176. package/node/auth/interfaces.js +0 -6
  177. package/node/auth/reducer.js +0 -28
  178. package/node/auth/saga.js +2 -26
  179. package/node/auth/utils.js +7 -42
  180. package/node/connectivity/ConnectivityState/index.js +1 -7
  181. package/node/connectivity/consts.js +1 -7
  182. package/node/connectivity/index.js +0 -5
  183. package/node/connectivity/reducer.js +0 -6
  184. package/node/connectivity/saga.js +47 -91
  185. package/node/helpers.js +2 -14
  186. package/node/index.js +1 -17
  187. package/node/subscriptions/Billing/Information/index.js +0 -7
  188. package/node/subscriptions/Billing/Information/saga.js +1 -25
  189. package/node/subscriptions/Billing/Invoices/index.js +0 -6
  190. package/node/subscriptions/Billing/Invoices/saga.js +1 -13
  191. package/node/subscriptions/Billing/PaymentMethod/index.js +2 -8
  192. package/node/subscriptions/Billing/PaymentMethod/interfaces.js +0 -1
  193. package/node/subscriptions/Billing/PaymentMethod/saga.js +1 -17
  194. package/node/subscriptions/Billing/Subscription/index.js +0 -6
  195. package/node/subscriptions/Billing/Subscription/saga.js +3 -23
  196. package/node/subscriptions/Billing/index.js +0 -6
  197. package/node/subscriptions/Billing/interfaces.js +0 -8
  198. package/node/subscriptions/Billing/saga.js +0 -7
  199. package/node/subscriptions/Checkout/index.js +0 -6
  200. package/node/subscriptions/Checkout/saga.js +2 -22
  201. package/node/subscriptions/Config/index.js +0 -6
  202. package/node/subscriptions/Config/saga.js +1 -12
  203. package/node/subscriptions/Plans/index.js +0 -6
  204. package/node/subscriptions/Plans/saga.js +1 -13
  205. package/node/subscriptions/Stripe/index.js +0 -6
  206. package/node/subscriptions/Stripe/saga.js +0 -8
  207. package/node/subscriptions/VendorPublicConfig/index.js +0 -6
  208. package/node/subscriptions/VendorPublicConfig/saga.js +1 -9
  209. package/node/subscriptions/dummy.js +2 -4
  210. package/node/subscriptions/general.interfaces.js +0 -5
  211. package/node/subscriptions/index.js +0 -5
  212. package/node/subscriptions/interfaces.js +0 -14
  213. package/node/subscriptions/mapper.js +0 -11
  214. package/node/subscriptions/reducer.js +0 -9
  215. package/node/subscriptions/saga.js +0 -9
  216. package/node/subscriptions/utils.js +0 -6
  217. package/node/toolkit/index.js +0 -31
  218. package/node/toolkit/redux-saga.js +0 -3
  219. package/node/toolkit/redux.js +0 -1
  220. package/node/vendor/VendorState/index.js +1 -7
  221. package/node/vendor/index.js +0 -5
  222. package/node/vendor/reducer.js +0 -6
  223. package/node/vendor/saga.js +1 -9
  224. package/package.json +1 -1
  225. package/subscriptions/Billing/Information/index.js +0 -4
  226. package/subscriptions/Billing/Information/saga.js +1 -12
  227. package/subscriptions/Billing/Invoices/index.js +0 -4
  228. package/subscriptions/Billing/Invoices/saga.js +1 -5
  229. package/subscriptions/Billing/PaymentMethod/index.js +2 -6
  230. package/subscriptions/Billing/PaymentMethod/interfaces.js +1 -1
  231. package/subscriptions/Billing/PaymentMethod/saga.js +1 -9
  232. package/subscriptions/Billing/Subscription/index.js +0 -4
  233. package/subscriptions/Billing/Subscription/saga.js +3 -17
  234. package/subscriptions/Billing/interfaces.js +1 -0
  235. package/subscriptions/Checkout/index.js +0 -4
  236. package/subscriptions/Checkout/saga.js +2 -12
  237. package/subscriptions/Config/index.js +0 -4
  238. package/subscriptions/Config/saga.js +1 -7
  239. package/subscriptions/Plans/index.js +0 -2
  240. package/subscriptions/Plans/saga.js +1 -6
  241. package/subscriptions/Stripe/index.js +0 -4
  242. package/subscriptions/Stripe/saga.js +0 -4
  243. package/subscriptions/VendorPublicConfig/index.js +0 -2
  244. package/subscriptions/VendorPublicConfig/saga.js +1 -4
  245. package/subscriptions/dummy.js +3 -2
  246. package/subscriptions/general.interfaces.js +0 -5
  247. package/subscriptions/index.js +3 -1
  248. package/subscriptions/mapper.js +0 -5
  249. package/toolkit/index.d.ts +1 -1
  250. package/toolkit/index.js +0 -9
  251. package/vendor/VendorState/index.js +1 -0
  252. package/vendor/index.js +4 -2
  253. package/vendor/reducer.js +0 -2
  254. package/vendor/saga.js +1 -2
@@ -1,15 +1,14 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["id"],
4
- _excluded2 = ["id", "enabled"];
5
-
4
+ _excluded2 = ["id", "enabled"];
6
5
  /* eslint-disable */
6
+
7
7
  import { all, call, put, select, takeEvery, takeLatest } from 'redux-saga/effects';
8
8
  import { actions as connectivityActions } from './reducer';
9
9
  import { channels, channels2Platform, type2ApiGet, type2ApiPost } from './consts';
10
10
  import { api } from '@frontegg/rest-api';
11
11
  const addApi = ['categories', 'channelMap'];
12
-
13
12
  function* loadPlatformData(ch) {
14
13
  return yield call(loadFunction, {
15
14
  payload: {
@@ -18,24 +17,25 @@ function* loadPlatformData(ch) {
18
17
  type: ''
19
18
  });
20
19
  }
21
-
22
20
  function* loadDataFunction({
23
21
  payload = channels
24
22
  }) {
25
23
  yield put(connectivityActions.setConnectivityState({
26
24
  isLoading: true
27
25
  }));
28
-
29
26
  try {
30
27
  // @ts-ignore
31
- const values = yield all([// @ts-ignore
32
- ...payload.map(loadPlatformData), // @ts-ignore
28
+ const values = yield all([
29
+ // @ts-ignore
30
+ ...payload.map(loadPlatformData),
31
+ // @ts-ignore
33
32
  yield loadFunction({
34
33
  payload: {
35
34
  api: 'categories'
36
35
  },
37
36
  type: ''
38
- }), // @ts-ignore
37
+ }),
38
+ // @ts-ignore
39
39
  yield function* () {
40
40
  // @ts-ignore
41
41
  const res = yield all(payload.map(function* (ch) {
@@ -51,8 +51,8 @@ function* loadDataFunction({
51
51
  return res.reduce((acc, curr, idx) => _extends({}, acc, {
52
52
  [`${payload[idx]}`]: curr
53
53
  }), {});
54
- }()]); // @ts-ignore
55
-
54
+ }()]);
55
+ // @ts-ignore
56
56
  const webhooks = yield loadFunction({
57
57
  payload: {
58
58
  api: 'webhook'
@@ -86,7 +86,6 @@ function* loadDataFunction({
86
86
  }));
87
87
  }
88
88
  }
89
-
90
89
  function* loadFunction({
91
90
  payload: {
92
91
  api,
@@ -101,16 +100,16 @@ function* loadFunction({
101
100
  return undefined;
102
101
  }
103
102
  }
104
-
105
103
  function* loadSlackFunction() {
106
104
  try {
107
105
  yield put(connectivityActions.setConnectivityState({
108
106
  slackChannels: {
109
107
  isLoading: true
110
108
  }
111
- })); // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
112
- // @ts-ignore
109
+ }));
113
110
 
111
+ // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
112
+ // @ts-ignore
114
113
  const data = yield call(api.connectivity.getSlackChannels);
115
114
  yield put(connectivityActions.setConnectivityState({
116
115
  error: undefined,
@@ -128,7 +127,6 @@ function* loadSlackFunction() {
128
127
  }));
129
128
  }
130
129
  }
131
-
132
130
  function* checkNewStatus(platform, data) {
133
131
  const {
134
132
  connectivity: {
@@ -140,15 +138,14 @@ function* checkNewStatus(platform, data) {
140
138
  }) => key === platform);
141
139
  if (!currPlatform) return;
142
140
  const newActive = channels2Platform[platform].isActive(data);
143
- if (newActive === currPlatform.active) return; //TODO: double check
144
-
141
+ if (newActive === currPlatform.active) return;
142
+ //TODO: double check
145
143
  yield put(connectivityActions.setConnectivityState({
146
144
  list: list.map(elm => elm.key === platform ? _extends({}, elm, {
147
145
  active: newActive
148
146
  }) : elm)
149
147
  }));
150
148
  }
151
-
152
149
  function* postDataFunction({
153
150
  payload: {
154
151
  platform,
@@ -159,14 +156,12 @@ function* postDataFunction({
159
156
  const {
160
157
  processIds
161
158
  } = yield select(state => state.connectivity);
162
-
163
159
  try {
164
160
  yield put(connectivityActions.setConnectivityState({
165
161
  isSaving: true,
166
162
  //@ts-ignore
167
163
  processIds: platform === 'webhook' ? [data._id, ...processIds] : processIds
168
164
  }));
169
-
170
165
  if (platform === 'slack') {
171
166
  yield postSlackData({
172
167
  payload: data,
@@ -180,7 +175,6 @@ function* postDataFunction({
180
175
  } else {
181
176
  yield call(type2ApiPost[platform], data);
182
177
  }
183
-
184
178
  if (!['sms', 'email'].includes(platform)) {
185
179
  // @ts-ignore
186
180
  const newData = yield loadFunction({
@@ -189,11 +183,9 @@ function* postDataFunction({
189
183
  },
190
184
  type: ''
191
185
  });
192
-
193
186
  if (platform === 'webhook') {
194
187
  newData.id = data._id;
195
188
  }
196
-
197
189
  yield put(connectivityActions.setConnectivityState({
198
190
  error: undefined,
199
191
  isSaving: false,
@@ -205,7 +197,6 @@ function* postDataFunction({
205
197
  }
206
198
  } catch (e) {
207
199
  var _e$message;
208
-
209
200
  yield put(connectivityActions.setConnectivityState({
210
201
  error: (_e$message = e.message) != null ? _e$message : e.toString(),
211
202
  isSaving: false,
@@ -213,7 +204,6 @@ function* postDataFunction({
213
204
  }));
214
205
  }
215
206
  }
216
-
217
207
  function* postSlackData({
218
208
  payload
219
209
  }) {
@@ -222,11 +212,9 @@ function* postSlackData({
222
212
  slack
223
213
  }
224
214
  } = yield select();
225
-
226
215
  if (!slack) {
227
216
  return;
228
217
  }
229
-
230
218
  const {
231
219
  slackSubscriptions: stateSlackSubscriptions
232
220
  } = slack;
@@ -235,26 +223,21 @@ function* postSlackData({
235
223
  } = payload;
236
224
  yield all([...slackSubscriptions.reduce((acc, curr) => {
237
225
  var _curr$slackEvents$0$c, _curr$slackEvents$0$c2;
238
-
239
226
  if (!curr.id && curr.slackEvents && (_curr$slackEvents$0$c = curr.slackEvents[0].channelIds) != null && _curr$slackEvents$0$c.length) {
240
227
  return [...acc, curr];
241
228
  }
242
-
243
229
  const el = stateSlackSubscriptions == null ? void 0 : stateSlackSubscriptions.find(_ref => {
244
230
  let {
245
- id
246
- } = _ref,
247
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
248
-
231
+ id
232
+ } = _ref,
233
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
249
234
  return id === curr.id && JSON.stringify(_extends({
250
235
  id
251
236
  }, props)) !== JSON.stringify(curr);
252
237
  });
253
-
254
238
  if (el && curr.slackEvents && (_curr$slackEvents$0$c2 = curr.slackEvents[0].channelIds) != null && _curr$slackEvents$0$c2.length) {
255
239
  return [...acc, curr];
256
240
  }
257
-
258
241
  return acc;
259
242
  }, []).map(function* (el) {
260
243
  // @ts-ignore
@@ -263,12 +246,12 @@ function* postSlackData({
263
246
  if (curr.id && !curr.slackEvents[0].channelIds.length) {
264
247
  return [...acc, curr];
265
248
  }
266
-
267
249
  return acc;
268
250
  }, []).map(function* (el) {
269
251
  // @ts-ignore
270
252
  return yield call(api.connectivity.deleteSlackConfiguration, el);
271
- }) // clean the old data
253
+ })
254
+ // clean the old data
272
255
  // ...stateSlackSubscriptions
273
256
  // // @ts-ignore
274
257
  // .reduce((acc, curr) => {
@@ -298,66 +281,62 @@ function* postEmailSMSData({
298
281
  const stateData = connectivity[type];
299
282
  if (!stateData) return;
300
283
  let actionsResult = [];
301
-
302
284
  try {
303
- actionsResult = yield all([// create new
285
+ actionsResult = yield all([
286
+ // create new
304
287
  ...payload.reduce((acc, curr) => {
305
288
  const state = stateData.find(({
306
289
  eventKey
307
290
  }) => eventKey === curr.eventKey);
308
-
309
291
  if (!state && curr.subscriptions[0].recipients.filter(el => el).length) {
310
292
  return [...acc, curr];
311
293
  }
312
-
313
294
  return acc;
314
295
  }, []).map(function* (data) {
315
296
  // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
316
297
  // @ts-ignore
317
298
  return yield call(type === 'email' ? api.connectivity.postEmailConfiguration : api.connectivity.postSMSConfiguration, data);
318
- }), // update exists
299
+ }),
300
+ // update exists
319
301
  ...payload.reduce((acc, curr) => {
320
302
  const state = stateData.find(({
321
303
  eventKey
322
304
  }) => eventKey === curr.eventKey);
323
-
324
305
  if (state && JSON.stringify(state) !== JSON.stringify(curr)) {
325
306
  return [...acc, curr];
326
307
  }
327
-
328
308
  return acc;
329
309
  }, []).map(function* (data) {
330
310
  const {
331
311
  subscriptions,
332
312
  eventKey
333
313
  } = data;
334
-
335
314
  const _subscriptions$ = subscriptions[0],
336
- {
337
- id = '',
338
- enabled
339
- } = _subscriptions$,
340
- body = _objectWithoutPropertiesLoose(_subscriptions$, _excluded2); // @ts-ignore
341
-
342
-
343
- return yield all([// @ts-ignore
315
+ {
316
+ id = '',
317
+ enabled
318
+ } = _subscriptions$,
319
+ body = _objectWithoutPropertiesLoose(_subscriptions$, _excluded2);
320
+ // @ts-ignore
321
+ return yield all([
322
+ // @ts-ignore
344
323
  yield call(type === 'email' ? api.connectivity.patchEmailConfiguration : api.connectivity.patchSMSConfiguration, {
345
324
  eventKey,
346
325
  enabled
347
- }), // @ts-ignore
326
+ }),
327
+ // @ts-ignore
348
328
  yield call(type === 'email' ? api.connectivity.putEmailSubscriptions : api.connectivity.putSMSSubscriptions, id, eventKey, _extends({}, body, {
349
329
  enabled
350
330
  }))]);
351
- }), // delete record with empty recipients
331
+ }),
332
+ // delete record with empty recipients
352
333
  ...payload.reduce((acc, curr) => {
353
334
  const state = stateData.find(({
354
335
  eventKey
355
336
  }) => eventKey === curr.eventKey);
356
-
357
337
  if (state && state.subscriptions[0].recipients.length && !curr.subscriptions[0].recipients.filter(el => !!el).length) {
358
338
  return [...acc, curr];
359
339
  }
360
-
361
340
  return acc;
362
341
  }, []).map(function* ({
363
342
  eventKey,
@@ -366,7 +345,6 @@ function* postEmailSMSData({
366
345
  return call(type === 'email' ? api.connectivity.deleteEmailSubscriptions : api.connectivity.deleteSMSSubscriptions, eventKey, subscriptions[0].id || '');
367
346
  })]);
368
347
  } catch {}
369
-
370
348
  if (actionsResult.length) {
371
349
  // @ts-ignore
372
350
  const newData = yield loadFunction({
@@ -374,8 +352,8 @@ function* postEmailSMSData({
374
352
  api: type
375
353
  },
376
354
  type: ''
377
- }); // yield put(connectivityActions.postDataSuccess({ platform: type, data: newData }));
378
-
355
+ });
356
+ // yield put(connectivityActions.postDataSuccess({ platform: type, data: newData }));
379
357
  yield put(connectivityActions.setConnectivityState({
380
358
  error: undefined,
381
359
  isSaving: false,
@@ -393,26 +371,22 @@ function* postEmailSMSData({
393
371
  }));
394
372
  }
395
373
  }
396
-
397
374
  function* postCodeFunction({
398
375
  payload
399
376
  }) {
400
377
  try {
401
378
  yield api.connectivity.postSlackCode(payload);
402
- } catch {} // yield put(connectivityActions.postCodeSuccess());
403
-
404
-
379
+ } catch {}
380
+ // yield put(connectivityActions.postCodeSuccess());
405
381
  yield put(connectivityActions.setConnectivityState({
406
382
  error: undefined,
407
383
  isSaving: false
408
384
  }));
409
385
  }
410
-
411
386
  function* loadSlackPermissions() {
412
387
  const {
413
388
  slackChannels
414
389
  } = yield select(state => state.connectivity);
415
-
416
390
  try {
417
391
  yield put(connectivityActions.setConnectivityState({
418
392
  slackChannels: _extends({}, slackChannels, {
@@ -421,8 +395,8 @@ function* loadSlackPermissions() {
421
395
  }));
422
396
  const {
423
397
  clientId
424
- } = yield call(api.connectivity.getSlackScope); // yield put(connectivityActions.loadScopeSuccess(clientId));
425
-
398
+ } = yield call(api.connectivity.getSlackScope);
399
+ // yield put(connectivityActions.loadScopeSuccess(clientId));
426
400
  yield put(connectivityActions.setConnectivityState({
427
401
  slackChannels: {
428
402
  error: undefined,
@@ -442,7 +416,6 @@ function* loadSlackPermissions() {
442
416
  }));
443
417
  }
444
418
  }
445
-
446
419
  function* deleteWebhookConfigFunction({
447
420
  payload
448
421
  }) {
@@ -453,7 +426,6 @@ function* deleteWebhookConfigFunction({
453
426
  const {
454
427
  processIds
455
428
  } = yield select(state => state.connectivity);
456
-
457
429
  try {
458
430
  yield put(connectivityActions.setConnectivityState({
459
431
  isSaving: true
@@ -461,16 +433,14 @@ function* deleteWebhookConfigFunction({
461
433
  yield call(api.connectivity.deleteWebhooksConfiguration, webhookId);
462
434
  } catch (e) {
463
435
  callback == null ? void 0 : callback(null, e.message);
464
- } // @ts-ignore
465
-
466
-
436
+ }
437
+ // @ts-ignore
467
438
  const newData = yield loadFunction({
468
439
  payload: {
469
440
  api: 'webhook'
470
441
  },
471
442
  type: ''
472
443
  });
473
-
474
444
  if (newData) {
475
445
  yield put(connectivityActions.setConnectivityState({
476
446
  error: undefined,
@@ -479,10 +449,8 @@ function* deleteWebhookConfigFunction({
479
449
  processIds: newData.id ? processIds.filter(el => el !== newData.id) : processIds
480
450
  }));
481
451
  }
482
-
483
452
  callback == null ? void 0 : callback(true);
484
453
  }
485
-
486
454
  function* postWebhookTestFunction({
487
455
  payload
488
456
  }) {
@@ -494,7 +462,6 @@ function* postWebhookTestFunction({
494
462
  statusCode,
495
463
  body
496
464
  } = yield call(api.connectivity.postWebhookTest, payload);
497
-
498
465
  if ([201, 200].includes(statusCode)) {
499
466
  // yield put(connectivityActions.postWebhookTestSuccess('success', JSON.stringify(body, null, 2)));
500
467
  const message = JSON.stringify(body, null, 2);
@@ -525,7 +492,6 @@ function* postWebhookTestFunction({
525
492
  }));
526
493
  }
527
494
  }
528
-
529
495
  function* postWebhookRetryFunction({
530
496
  payload
531
497
  }) {
@@ -548,7 +514,6 @@ function* postWebhookRetryFunction({
548
514
  }));
549
515
  }
550
516
  }
551
-
552
517
  function* loadWebhookLogsFunction({
553
518
  payload: {
554
519
  id,
@@ -559,17 +524,16 @@ function* loadWebhookLogsFunction({
559
524
  const {
560
525
  webhookLogs
561
526
  } = yield select(state => state.connectivity);
562
-
563
527
  try {
564
528
  yield put(connectivityActions.setConnectivityState({
565
529
  webhookLogs: _extends({}, webhookLogs, {
566
530
  isLoading: true
567
531
  })
568
- })); //TODO: Fix types
532
+ }));
533
+ //TODO: Fix types
569
534
  //@ts-ignore
570
-
571
- const data = yield call(api.connectivity.getWebhookLog, id, offset, limit); // yield put(connectivityActions.loadWebhookLogsSuccess(data));
572
-
535
+ const data = yield call(api.connectivity.getWebhookLog, id, offset, limit);
536
+ // yield put(connectivityActions.loadWebhookLogsSuccess(data));
573
537
  yield put(connectivityActions.setConnectivityState({
574
538
  error: undefined,
575
539
  webhookLogs: _extends({
@@ -585,7 +549,6 @@ function* loadWebhookLogsFunction({
585
549
  }));
586
550
  }
587
551
  }
588
-
589
552
  export function* sagas() {
590
553
  yield takeEvery(connectivityActions.loadDataAction, loadDataFunction);
591
554
  yield takeLatest(connectivityActions.loadSlackActions, loadSlackFunction);
package/helpers.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { createAction } from '@reduxjs/toolkit'; // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ import { createAction } from '@reduxjs/toolkit';
3
3
 
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
5
  export function omitProps(props, keys) {
5
6
  const newProps = _extends({}, props);
6
-
7
7
  keys.forEach(key => {
8
8
  delete newProps[key];
9
9
  });
@@ -15,25 +15,22 @@ export function generateActionCreator(storeName) {
15
15
  })) : createAction(`${storeName}/${key}`);
16
16
  }
17
17
  export async function generateCodeChallenge(codeVerifier) {
18
- const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier)); // @ts-ignore
18
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
19
19
 
20
+ // @ts-ignore
20
21
  return btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
21
22
  }
22
23
  export function createRandomString(length = 16) {
23
24
  let text = '';
24
25
  const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
25
-
26
26
  for (let i = 0; i < length; i++) {
27
27
  text += possible.charAt(Math.floor(Math.random() * possible.length));
28
28
  }
29
-
30
29
  return text;
31
30
  }
32
31
  export const readFileAsText = file => new Promise((resolve, reject) => {
33
32
  const reader = new FileReader();
34
33
  reader.readAsText(file);
35
-
36
34
  reader.onload = () => resolve(reader.result);
37
-
38
35
  reader.onerror = reject;
39
36
  });
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.69.0
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.
@@ -1,20 +1,14 @@
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.auditLogsState = exports.auditLogsReducers = exports.auditLogsActions = void 0;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
9
  var _utils = require("../utils");
13
-
14
10
  var _toolkit = require("@reduxjs/toolkit");
15
-
16
11
  var _constants = require("../../constants");
17
-
18
12
  const auditLogsState = {
19
13
  loading: true,
20
14
  pageOffset: 0,
@@ -39,14 +33,13 @@ const actions = {
39
33
  payload
40
34
  }))
41
35
  };
36
+
42
37
  /**
43
38
  * To be used for actions types after dispatch, and should contains
44
39
  * the reducers and actions as standalone function
45
40
  */
46
-
47
41
  exports.auditLogsActions = actions;
48
42
  // noinspection JSUnusedLocalSymbols
49
-
50
43
  /**
51
44
  * if you see error in matcher that's mean the DispatchAction does not
52
45
  * contains the same functions in reducers and actions
@@ -1,35 +1,24 @@
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.auditLogsSagas = auditLogsSagas;
9
8
  exports.auditLogsSagasMock = auditLogsSagasMock;
10
-
11
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
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 _constants = require("../../constants");
20
-
21
14
  var _dummy = require("../dummy");
22
-
23
15
  const select = () => (0, _effects.select)(_ => _[_constants.auditsStoreName].auditLogsState);
24
-
25
16
  const selectMetadata = () => (0, _effects.select)(_ => _[_constants.auditsStoreName].auditsMetadataState);
26
-
27
17
  function* exportAuditsCsv() {
28
18
  const state = yield select();
29
19
  const {
30
20
  columns
31
21
  } = yield selectMetadata();
32
-
33
22
  try {
34
23
  const filter = state.filter;
35
24
  const sort = state.sort;
@@ -53,12 +42,10 @@ function* exportAuditsCsv() {
53
42
  } catch (e) {
54
43
  console.error('failed to export audits - ', e);
55
44
  }
56
-
57
45
  yield (0, _effects.put)(_reducer.actions.setAuditLogsState({
58
46
  isDownloadingCsv: false
59
47
  }));
60
48
  }
61
-
62
49
  function* loadAuditLogs({
63
50
  payload
64
51
  }) {
@@ -70,10 +57,8 @@ function* loadAuditLogs({
70
57
  const {
71
58
  columns
72
59
  } = yield selectMetadata();
73
-
74
60
  try {
75
61
  var _payload$pageSize, _payload$pageOffset, _payload$filter, _payload$sort, _payload$callback;
76
-
77
62
  const pageSize = (_payload$pageSize = payload.pageSize) != null ? _payload$pageSize : state.pageSize;
78
63
  const pageOffset = (_payload$pageOffset = payload.pageOffset) != null ? _payload$pageOffset : state.pageOffset;
79
64
  const filter = (_payload$filter = payload.filter) != null ? _payload$filter : state.filter;
@@ -91,11 +76,9 @@ function* loadAuditLogs({
91
76
  const filterParams = filter.reduce((p, n) => (0, _extends2.default)({}, p, {
92
77
  [n.id]: n.value
93
78
  }), {});
94
-
95
79
  if (!columns) {
96
80
  yield (0, _effects.put)(_reducer.actions.loadAuditsMetadata());
97
81
  }
98
-
99
82
  const {
100
83
  data,
101
84
  total
@@ -111,7 +94,6 @@ function* loadAuditLogs({
111
94
  payload == null ? void 0 : (_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
112
95
  } catch (e) {
113
96
  var _payload$callback2;
114
-
115
97
  yield (0, _effects.put)(_reducer.actions.setAuditLogsState({
116
98
  loading: false,
117
99
  error: e.message
@@ -119,16 +101,15 @@ function* loadAuditLogs({
119
101
  payload == null ? void 0 : (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, null, e);
120
102
  }
121
103
  }
122
-
123
104
  function* auditLogsSagas() {
124
105
  yield (0, _effects.takeEvery)(_reducer.actions.exportAuditsCsv, exportAuditsCsv);
125
106
  yield (0, _effects.takeEvery)(_reducer.actions.loadAuditLogs, loadAuditLogs);
126
107
  }
108
+
127
109
  /*********************************
128
110
  * Preview Sagas
129
111
  *********************************/
130
112
 
131
-
132
113
  function* loadAuditLogsMock({
133
114
  payload
134
115
  }) {
@@ -140,10 +121,8 @@ function* loadAuditLogsMock({
140
121
  const {
141
122
  columns
142
123
  } = yield selectMetadata();
143
-
144
124
  try {
145
125
  var _payload$pageSize2, _payload$pageOffset2, _payload$filter2, _payload$sort2, _payload$callback3;
146
-
147
126
  const pageSize = (_payload$pageSize2 = payload.pageSize) != null ? _payload$pageSize2 : state.pageSize;
148
127
  const pageOffset = (_payload$pageOffset2 = payload.pageOffset) != null ? _payload$pageOffset2 : state.pageOffset;
149
128
  const filter = (_payload$filter2 = payload.filter) != null ? _payload$filter2 : state.filter;
@@ -154,11 +133,9 @@ function* loadAuditLogsMock({
154
133
  filter,
155
134
  sort
156
135
  }));
157
-
158
136
  if (!columns) {
159
137
  yield (0, _effects.put)(_reducer.actions.loadAuditsMetadata());
160
138
  }
161
-
162
139
  const {
163
140
  data,
164
141
  total
@@ -171,7 +148,6 @@ function* loadAuditLogsMock({
171
148
  payload == null ? void 0 : (_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, true);
172
149
  } catch (e) {
173
150
  var _payload$callback4;
174
-
175
151
  yield (0, _effects.put)(_reducer.actions.setAuditLogsState({
176
152
  loading: false,
177
153
  error: e.message
@@ -179,7 +155,6 @@ function* loadAuditLogsMock({
179
155
  payload == null ? void 0 : (_payload$callback4 = payload.callback) == null ? void 0 : _payload$callback4.call(payload, null, e);
180
156
  }
181
157
  }
182
-
183
158
  function* auditLogsSagasMock() {
184
159
  yield (0, _effects.takeEvery)(_reducer.actions.loadAuditLogs, loadAuditLogsMock);
185
160
  }