@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,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
- _excluded2 = ["id", "enabled"];
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)([// @ts-ignore
45
- ...payload.map(loadPlatformData), // @ts-ignore
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
- }), // @ts-ignore
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
- }()]); // @ts-ignore
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
- })); // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
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
- if (newActive === currPlatform.active) return; //TODO: double check
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
- id
261
- } = _ref,
262
- props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
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
- }) // clean the old data
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)([// create new
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
- }), // update exists
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
- id = '',
351
- enabled
352
- } = _subscriptions$,
353
- body = (0, _objectWithoutPropertiesLoose2.default)(_subscriptions$, _excluded2); // @ts-ignore
354
-
355
- return yield (0, _effects.all)([// @ts-ignore
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
- }), // @ts-ignore
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
- }), // delete record with empty recipients
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
- }); // yield put(connectivityActions.postDataSuccess({ platform: type, data: newData }));
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 {} // yield put(connectivityActions.postCodeSuccess());
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); // yield put(connectivityActions.loadScopeSuccess(clientId));
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
- } // @ts-ignore
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
- })); //TODO: Fix types
537
+ }));
538
+ //TODO: Fix types
581
539
  //@ts-ignore
582
-
583
- const data = yield (0, _effects.call)(_restApi.api.connectivity.getWebhookLog, id, offset, limit); // yield put(connectivityActions.loadWebhookLogsSuccess(data));
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)); // @ts-ignore
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.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.
@@ -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,