@frontegg/redux-store 6.0.3-alpha.2 → 6.1.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 (121) hide show
  1. package/audits/AuditLogsState/index.js +11 -0
  2. package/audits/AuditLogsState/saga.js +3 -0
  3. package/audits/AuditsMetadataState/index.js +11 -0
  4. package/audits/AuditsMetadataState/saga.js +3 -0
  5. package/audits/backward-compatibility/saga.js +1 -0
  6. package/audits/index.js +4 -2
  7. package/auth/AcceptInvitationState/index.js +11 -0
  8. package/auth/AccountSettingsState/index.js +11 -0
  9. package/auth/AccountSettingsState/saga.js +3 -0
  10. package/auth/ActivateState/index.d.ts +12 -3
  11. package/auth/ActivateState/index.js +11 -0
  12. package/auth/ApiTokensState/index.js +11 -0
  13. package/auth/ApiTokensState/saga.js +3 -0
  14. package/auth/ForgotPasswordState/index.js +11 -0
  15. package/auth/LoginState/index.js +11 -0
  16. package/auth/LoginState/saga.js +24 -8
  17. package/auth/MfaState/index.d.ts +8 -2
  18. package/auth/MfaState/index.js +11 -0
  19. package/auth/MfaState/saga.js +3 -0
  20. package/auth/ProfileState/index.js +11 -0
  21. package/auth/ProfileState/saga.js +11 -4
  22. package/auth/ResetPhoneNumberState/index.js +11 -0
  23. package/auth/RolesState/index.js +11 -0
  24. package/auth/SSOState/index.js +12 -0
  25. package/auth/SSOState/saga.js +3 -0
  26. package/auth/SecurityPolicyState/index.js +11 -0
  27. package/auth/SecurityPolicyState/saga.js +4 -0
  28. package/auth/SessionsPolicyState/index.js +11 -0
  29. package/auth/SessionsState/index.d.ts +8 -0
  30. package/auth/SessionsState/index.js +11 -0
  31. package/auth/SessionsState/saga.js +3 -0
  32. package/auth/SignUp/index.js +11 -0
  33. package/auth/SocialLogins/index.d.ts +2 -8
  34. package/auth/SocialLogins/index.js +11 -0
  35. package/auth/TeamState/index.js +11 -0
  36. package/auth/TeamState/saga.js +3 -0
  37. package/auth/TenantsState/index.js +11 -0
  38. package/auth/TenantsState/saga.js +3 -0
  39. package/auth/dummy.js +2 -1
  40. package/auth/index.js +4 -2
  41. package/auth/interfaces.d.ts +1 -0
  42. package/auth/saga.js +7 -1
  43. package/connectivity/ConnectivityState/index.js +7 -0
  44. package/connectivity/index.js +4 -2
  45. package/connectivity/saga.js +40 -10
  46. package/helpers.js +2 -1
  47. package/index.js +1 -1
  48. package/node/audits/AuditLogsState/index.js +11 -0
  49. package/node/audits/AuditLogsState/saga.js +4 -0
  50. package/node/audits/AuditsMetadataState/index.js +11 -0
  51. package/node/audits/AuditsMetadataState/saga.js +4 -0
  52. package/node/audits/backward-compatibility/saga.js +1 -0
  53. package/node/audits/index.js +2 -0
  54. package/node/auth/AcceptInvitationState/index.js +11 -0
  55. package/node/auth/AccountSettingsState/index.js +11 -0
  56. package/node/auth/AccountSettingsState/saga.js +4 -0
  57. package/node/auth/ActivateState/index.js +11 -0
  58. package/node/auth/ApiTokensState/index.js +11 -0
  59. package/node/auth/ApiTokensState/saga.js +4 -0
  60. package/node/auth/ForgotPasswordState/index.js +11 -0
  61. package/node/auth/LoginState/index.js +11 -0
  62. package/node/auth/LoginState/saga.js +25 -8
  63. package/node/auth/MfaState/index.js +11 -0
  64. package/node/auth/MfaState/saga.js +4 -0
  65. package/node/auth/ProfileState/index.js +11 -0
  66. package/node/auth/ProfileState/saga.js +12 -4
  67. package/node/auth/ResetPhoneNumberState/index.js +11 -0
  68. package/node/auth/RolesState/index.js +11 -0
  69. package/node/auth/SSOState/index.js +12 -0
  70. package/node/auth/SSOState/saga.js +4 -0
  71. package/node/auth/SecurityPolicyState/index.js +11 -0
  72. package/node/auth/SecurityPolicyState/saga.js +4 -0
  73. package/node/auth/SessionsPolicyState/index.js +11 -0
  74. package/node/auth/SessionsState/index.js +11 -0
  75. package/node/auth/SessionsState/saga.js +4 -0
  76. package/node/auth/SignUp/index.js +11 -0
  77. package/node/auth/SocialLogins/index.js +11 -0
  78. package/node/auth/TeamState/index.js +11 -0
  79. package/node/auth/TeamState/saga.js +4 -0
  80. package/node/auth/TenantsState/index.js +11 -0
  81. package/node/auth/TenantsState/saga.js +4 -0
  82. package/node/auth/dummy.js +2 -1
  83. package/node/auth/index.js +2 -0
  84. package/node/auth/saga.js +7 -1
  85. package/node/connectivity/ConnectivityState/index.js +7 -0
  86. package/node/connectivity/index.js +2 -0
  87. package/node/connectivity/saga.js +40 -10
  88. package/node/helpers.js +2 -1
  89. package/node/index.js +1 -1
  90. package/node/subscriptions/Billing/Information/saga.js +4 -0
  91. package/node/subscriptions/Billing/Invoices/saga.js +4 -0
  92. package/node/subscriptions/Billing/PaymentMethod/index.js +2 -1
  93. package/node/subscriptions/Billing/PaymentMethod/interfaces.js +1 -0
  94. package/node/subscriptions/Billing/PaymentMethod/saga.js +4 -0
  95. package/node/subscriptions/Billing/Subscription/saga.js +6 -1
  96. package/node/subscriptions/Checkout/saga.js +8 -0
  97. package/node/subscriptions/Config/saga.js +4 -0
  98. package/node/subscriptions/Plans/saga.js +4 -0
  99. package/node/subscriptions/VendorPublicConfig/saga.js +4 -0
  100. package/node/subscriptions/dummy.js +15 -1
  101. package/node/subscriptions/index.js +2 -0
  102. package/node/vendor/VendorState/index.js +11 -0
  103. package/node/vendor/index.js +2 -0
  104. package/node/vendor/saga.js +4 -0
  105. package/package.json +1 -1
  106. package/subscriptions/Billing/Information/saga.js +3 -0
  107. package/subscriptions/Billing/Invoices/saga.js +4 -0
  108. package/subscriptions/Billing/PaymentMethod/index.js +2 -1
  109. package/subscriptions/Billing/PaymentMethod/interfaces.js +1 -0
  110. package/subscriptions/Billing/PaymentMethod/saga.js +4 -0
  111. package/subscriptions/Billing/Subscription/saga.js +6 -1
  112. package/subscriptions/Billing/interfaces.js +1 -0
  113. package/subscriptions/Checkout/saga.js +8 -0
  114. package/subscriptions/Config/saga.js +4 -0
  115. package/subscriptions/Plans/saga.js +4 -0
  116. package/subscriptions/VendorPublicConfig/saga.js +4 -0
  117. package/subscriptions/dummy.js +15 -1
  118. package/subscriptions/index.js +3 -1
  119. package/vendor/VendorState/index.js +11 -0
  120. package/vendor/index.js +4 -2
  121. package/vendor/saga.js +3 -0
@@ -22,5 +22,16 @@ const actions = {
22
22
  payload
23
23
  }))
24
24
  };
25
+ /**
26
+ * To be used for actions types after dispatch, and should contains
27
+ * the reducers and actions as standalone function
28
+ */
29
+
30
+ // noinspection JSUnusedLocalSymbols
31
+
32
+ /**
33
+ * if you see error in matcher that's mean the DispatchAction does not
34
+ * contains the same functions in reducers and actions
35
+ */
25
36
  const Matcher = {};
26
37
  export { socialLoginState, reducers as socialLoginsReducer, actions as socialLoginsActions };
@@ -110,5 +110,16 @@ const actions = {
110
110
  payload
111
111
  }))
112
112
  };
113
+ /**
114
+ * To be used for actions types after dispatch, and should contains
115
+ * the reducers and actions as standalone function
116
+ */
117
+
118
+ // noinspection JSUnusedLocalSymbols
119
+
120
+ /**
121
+ * if you see error in matcher that's mean the DispatchAction does not
122
+ * contains the same functions in reducers and actions
123
+ */
113
124
  const Matcher = {};
114
125
  export { teamState, reducers as teamReducers, actions as teamActions };
@@ -815,6 +815,9 @@ export function* teamSagas() {
815
815
  yield takeEvery(actions.openDeleteUserDialog, openDeleteUserDialog);
816
816
  yield takeEvery(actions.closeDeleteUserDialog, closeDeleteUserDialog);
817
817
  }
818
+ /*********************************
819
+ * Preview Sagas
820
+ *********************************/
818
821
 
819
822
  function* loadUsersMock({
820
823
  payload
@@ -27,5 +27,16 @@ const actions = {
27
27
  payload
28
28
  }))
29
29
  };
30
+ /**
31
+ * To be used for actions types after dispatch, and should contains
32
+ * the reducers and actions as standalone function
33
+ */
34
+
35
+ // noinspection JSUnusedLocalSymbols
36
+
37
+ /**
38
+ * if you see error in matcher that's mean the DispatchAction does not
39
+ * contains the same functions in reducers and actions
40
+ */
30
41
  const Matcher = {};
31
42
  export { tenantsState, reducers as tenantsReducers, actions as tenantsActions };
@@ -119,6 +119,9 @@ export function* tenantsSagas() {
119
119
  yield takeEvery(actions.switchTenant, switchTenant);
120
120
  yield takeEvery(actions.loadSubTenantsTree, loadSubTenantsTree);
121
121
  }
122
+ /*********************************
123
+ * Preview Sagas
124
+ *********************************/
122
125
 
123
126
  function* loadTenantsMock({}) {
124
127
  yield put(actions.setTenantsState({
package/auth/dummy.js CHANGED
@@ -192,7 +192,8 @@ export const userTeamDemo2 = {
192
192
  lastLogin: undefined,
193
193
  mfaEnabled: undefined,
194
194
  roles: []
195
- };
195
+ }; // TODO add verified to ITeamUser
196
+
196
197
  export const userTeamDemo = {
197
198
  id: 'id',
198
199
  email: 'demo-user@frontegg.com',
package/auth/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { reducer, actions } from './reducer';
2
2
  import { mockSagas, sagas } from './saga';
3
3
  import { authStoreName as storeName } from '../constants';
4
- import { initialState } from './initialState';
4
+ import { initialState } from './initialState'; // export types
5
+
5
6
  export * from './interfaces';
6
7
  export * from './LoginState/interfaces';
7
8
  export * from './LoginState';
@@ -39,7 +40,8 @@ export * from './SessionsState';
39
40
  export * from './SessionsState/interfaces';
40
41
  export * from './SessionsPolicyState';
41
42
  export * from './SessionsPolicyState/interfaces';
42
- export { sagas as authSagas, mockSagas as authMockSagas, reducer as authReducers, actions as authActions, initialState as authInitialState, storeName as authStoreName };
43
+ export { sagas as authSagas, mockSagas as authMockSagas, reducer as authReducers, actions as authActions, initialState as authInitialState, storeName as authStoreName }; // export store
44
+
43
45
  export default {
44
46
  sagas,
45
47
  mockSagas,
@@ -22,6 +22,7 @@ export interface User extends IUserProfile {
22
22
  refreshToken: string;
23
23
  expiresIn: number;
24
24
  expires: string;
25
+ sid?: string;
25
26
  }
26
27
  export interface Routes {
27
28
  routes: AuthPageRoutes;
package/auth/saga.js CHANGED
@@ -22,5 +22,11 @@ export function* sagas() {
22
22
  yield all([call(loginSagas), call(activateSagas), call(acceptInvitationSagas), call(forgotPasswordSagas), call(resetPhoneNumberSagas), call(ssoSagas), call(ssoSagasV2), call(profileSagas), call(mfaSagas), call(teamSagas), call(socialLoginsSaga), call(signUpSaga), call(apiTokensSaga), call(securityPolicySagas), call(accountSettingsSaga), call(tenantsSagas), call(rolesSagas), call(sessionsSaga), call(sessionsPolicySaga)]);
23
23
  }
24
24
  export function* mockSagas() {
25
- yield all([call(loginSagasMock), call(ssoSagasMock), call(profileSagasMock), call(mfaSagasMock), call(teamSagasMock), call(apiTokensSagaMock), call(securityPolicySagasMock), call(sessionsSagaMock), call(accountSettingsSagaMock), call(tenantsSagasMock), call(sessionsPolicySagaMock)]);
25
+ yield all([call(loginSagasMock), // call(activateSagas),
26
+ // call(acceptInvitationSagas),
27
+ // call(forgotPasswordSagas),
28
+ // call(socialLoginsSaga),
29
+ // call(signUpSaga),
30
+ call(ssoSagasMock), call(profileSagasMock), call(mfaSagasMock), call(teamSagasMock), call(apiTokensSagaMock), call(securityPolicySagasMock), call(sessionsSagaMock), call(accountSettingsSagaMock), call(tenantsSagasMock), call(sessionsPolicySagaMock) // call(rolesSagas),
31
+ ]);
26
32
  }
@@ -12,6 +12,8 @@ const initialState = {
12
12
  };
13
13
  const reducers = {
14
14
  initData: () => _extends({}, initialState),
15
+ // Deprecated: use initData instead;
16
+ // cleanData: () => ({ ...initialState }),
15
17
  setConnectivityState: (state, {
16
18
  payload
17
19
  }) => _extends({}, state, payload),
@@ -91,4 +93,9 @@ const actions = {
91
93
  }
92
94
  }))
93
95
  };
96
+ /**
97
+ * To be used for actions types after dispatch, and should contains
98
+ * the reducers and actions as standalone function
99
+ */
100
+
94
101
  export { reducers as connectivityReducers, actions as connectivityActions };
@@ -1,8 +1,10 @@
1
1
  import { reducer, actions, initialState } from './reducer';
2
2
  import { sagas } from './saga';
3
- import { connectivityStoreName as storeName } from '../constants';
3
+ import { connectivityStoreName as storeName } from '../constants'; // export types
4
+
4
5
  export * from './interfaces';
5
- export { sagas as connectivitySagas, reducer as connectivityReducers, actions as connectivityActions, initialState as connectivityInitialState, storeName as connectivityStoreName };
6
+ export { sagas as connectivitySagas, reducer as connectivityReducers, actions as connectivityActions, initialState as connectivityInitialState, storeName as connectivityStoreName }; // export store
7
+
6
8
  export default {
7
9
  sagas,
8
10
  storeName,
@@ -127,7 +127,8 @@ function* checkNewStatus(platform, data) {
127
127
  }) => key === platform);
128
128
  if (!currPlatform) return;
129
129
  const newActive = channels2Platform[platform].isActive(data);
130
- if (newActive === currPlatform.active) return;
130
+ if (newActive === currPlatform.active) return; //TODO: double check
131
+
131
132
  yield put(connectivityActions.setConnectivityState({
132
133
  list: list.map(elm => elm.key === platform ? _extends({}, elm, {
133
134
  active: newActive
@@ -149,6 +150,7 @@ function* postDataFunction({
149
150
  try {
150
151
  yield put(connectivityActions.setConnectivityState({
151
152
  isSaving: true,
153
+ //@ts-ignore
152
154
  processIds: platform === 'webhook' ? [data._id, ...processIds] : processIds
153
155
  }));
154
156
 
@@ -250,7 +252,21 @@ function* postSlackData({
250
252
  return acc;
251
253
  }, []).map(function* (el) {
252
254
  return yield call(api.connectivity.deleteSlackConfiguration, el);
253
- })]);
255
+ }) // clean the old data
256
+ // ...stateSlackSubscriptions
257
+ // // @ts-ignore
258
+ // .reduce((acc, curr) => {
259
+ // const el = slackSubscriptions.find(({ id }) => id === curr.id);
260
+ // if (!el) {
261
+ // return [...acc, curr];
262
+ // }
263
+ // return acc;
264
+ // }, [])
265
+ // // @ts-ignore
266
+ // .map(function* (el) {
267
+ // return yield call(api.connectivity.deleteSlackConfiguration, el as Required<ISlackSubscription>);
268
+ // }),
269
+ ]);
254
270
  }
255
271
 
256
272
  function* postEmailSMSData({
@@ -268,7 +284,8 @@ function* postEmailSMSData({
268
284
  let actionsResult = [];
269
285
 
270
286
  try {
271
- actionsResult = yield all([...payload.reduce((acc, curr) => {
287
+ actionsResult = yield all([// create new
288
+ ...payload.reduce((acc, curr) => {
272
289
  const state = stateData.find(({
273
290
  eventKey
274
291
  }) => eventKey === curr.eventKey);
@@ -280,7 +297,8 @@ function* postEmailSMSData({
280
297
  return acc;
281
298
  }, []).map(function* (data) {
282
299
  return yield call(type === 'email' ? api.connectivity.postEmailConfiguration : api.connectivity.postSMSConfiguration, data);
283
- }), ...payload.reduce((acc, curr) => {
300
+ }), // update exists
301
+ ...payload.reduce((acc, curr) => {
284
302
  const state = stateData.find(({
285
303
  eventKey
286
304
  }) => eventKey === curr.eventKey);
@@ -309,7 +327,8 @@ function* postEmailSMSData({
309
327
  }), yield call(type === 'email' ? api.connectivity.putEmailSubscriptions : api.connectivity.putSMSSubscriptions, id, eventKey, _extends({}, body, {
310
328
  enabled
311
329
  }))]);
312
- }), ...payload.reduce((acc, curr) => {
330
+ }), // delete record with empty recipients
331
+ ...payload.reduce((acc, curr) => {
313
332
  const state = stateData.find(({
314
333
  eventKey
315
334
  }) => eventKey === curr.eventKey);
@@ -333,7 +352,8 @@ function* postEmailSMSData({
333
352
  api: type
334
353
  },
335
354
  type: ''
336
- });
355
+ }); // yield put(connectivityActions.postDataSuccess({ platform: type, data: newData }));
356
+
337
357
  yield put(connectivityActions.setConnectivityState({
338
358
  error: undefined,
339
359
  isSaving: false,
@@ -342,6 +362,7 @@ function* postEmailSMSData({
342
362
  }));
343
363
  yield checkNewStatus(type, newData);
344
364
  } else {
365
+ // yield put(connectivityActions.postDataSuccess({ platform: type, data: stateData }));
345
366
  yield put(connectivityActions.setConnectivityState({
346
367
  error: undefined,
347
368
  isSaving: false,
@@ -356,7 +377,8 @@ function* postCodeFunction({
356
377
  }) {
357
378
  try {
358
379
  yield api.connectivity.postSlackCode(payload);
359
- } catch {}
380
+ } catch {} // yield put(connectivityActions.postCodeSuccess());
381
+
360
382
 
361
383
  yield put(connectivityActions.setConnectivityState({
362
384
  error: undefined,
@@ -377,7 +399,8 @@ function* loadSlackPermissions() {
377
399
  }));
378
400
  const {
379
401
  clientId
380
- } = yield call(api.connectivity.getSlackScope);
402
+ } = yield call(api.connectivity.getSlackScope); // yield put(connectivityActions.loadScopeSuccess(clientId));
403
+
381
404
  yield put(connectivityActions.setConnectivityState({
382
405
  slackChannels: {
383
406
  error: undefined,
@@ -387,6 +410,7 @@ function* loadSlackPermissions() {
387
410
  }
388
411
  }));
389
412
  } catch {
413
+ // yield put(connectivityActions.loadScopeSuccess(null));
390
414
  yield put(connectivityActions.setConnectivityState({
391
415
  slackChannels: {
392
416
  error: undefined,
@@ -449,6 +473,7 @@ function* postWebhookTestFunction({
449
473
  } = yield call(api.connectivity.postWebhookTest, payload);
450
474
 
451
475
  if ([201, 200].includes(statusCode)) {
476
+ // yield put(connectivityActions.postWebhookTestSuccess('success', JSON.stringify(body, null, 2)));
452
477
  const message = JSON.stringify(body, null, 2);
453
478
  yield put(connectivityActions.setConnectivityState({
454
479
  isTesting: false,
@@ -458,6 +483,7 @@ function* postWebhookTestFunction({
458
483
  }
459
484
  }));
460
485
  } else {
486
+ // yield put(connectivityActions.postWebhookTestSuccess('failed', body.toString()));
461
487
  yield put(connectivityActions.setConnectivityState({
462
488
  isTesting: false,
463
489
  testResult: {
@@ -466,6 +492,7 @@ function* postWebhookTestFunction({
466
492
  }));
467
493
  }
468
494
  } catch (e) {
495
+ // yield put(connectivityActions.postWebhookTestSuccess('failed', e.toString()));
469
496
  yield put(connectivityActions.setConnectivityState({
470
497
  isTesting: false,
471
498
  testResult: {
@@ -515,8 +542,11 @@ function* loadWebhookLogsFunction({
515
542
  webhookLogs: _extends({}, webhookLogs, {
516
543
  isLoading: true
517
544
  })
518
- }));
519
- const data = yield call(api.connectivity.getWebhookLog, id, offset, limit);
545
+ })); //TODO: Fix types
546
+ //@ts-ignore
547
+
548
+ const data = yield call(api.connectivity.getWebhookLog, id, offset, limit); // yield put(connectivityActions.loadWebhookLogsSuccess(data));
549
+
520
550
  yield put(connectivityActions.setConnectivityState({
521
551
  error: undefined,
522
552
  webhookLogs: _extends({
package/helpers.js CHANGED
@@ -14,7 +14,8 @@ export function generateActionCreator(storeName) {
14
14
  })) : createAction(`${storeName}/${key}`);
15
15
  }
16
16
  export async function generateCodeChallenge(codeVerifier) {
17
- const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
17
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier)); // @ts-ignore
18
+
18
19
  return btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
19
20
  }
20
21
  export function createRandomString(length = 16) {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.0.3-alpha.2
1
+ /** @license Frontegg v6.1.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.
@@ -39,5 +39,16 @@ const actions = {
39
39
  payload
40
40
  }))
41
41
  };
42
+ /**
43
+ * To be used for actions types after dispatch, and should contains
44
+ * the reducers and actions as standalone function
45
+ */
46
+
42
47
  exports.auditLogsActions = actions;
48
+ // noinspection JSUnusedLocalSymbols
49
+
50
+ /**
51
+ * if you see error in matcher that's mean the DispatchAction does not
52
+ * contains the same functions in reducers and actions
53
+ */
43
54
  const Matcher = {};
@@ -124,6 +124,10 @@ function* auditLogsSagas() {
124
124
  yield (0, _effects.takeEvery)(_reducer.actions.exportAuditsCsv, exportAuditsCsv);
125
125
  yield (0, _effects.takeEvery)(_reducer.actions.loadAuditLogs, loadAuditLogs);
126
126
  }
127
+ /*********************************
128
+ * Preview Sagas
129
+ *********************************/
130
+
127
131
 
128
132
  function* loadAuditLogsMock({
129
133
  payload
@@ -29,5 +29,16 @@ exports.auditsMetadataReducers = reducers;
29
29
  const actions = {
30
30
  loadAuditsMetadata: (0, _toolkit.createAction)(`${_constants.auditsStoreName}/loadAuditsMetadata`)
31
31
  };
32
+ /**
33
+ * To be used for actions types after dispatch, and should contains
34
+ * the reducers and actions as standalone function
35
+ */
36
+
32
37
  exports.auditsMetadataActions = actions;
38
+ // noinspection JSUnusedLocalSymbols
39
+
40
+ /**
41
+ * if you see error in matcher that's mean the DispatchAction does not
42
+ * contains the same functions in reducers and actions
43
+ */
33
44
  const Matcher = {};
@@ -39,6 +39,10 @@ function* loadAuditsMetadata() {
39
39
  function* auditsMetadataSagas() {
40
40
  yield (0, _effects.takeEvery)(_reducer.actions.loadAuditsMetadata, loadAuditsMetadata);
41
41
  }
42
+ /*********************************
43
+ * Preview Sagas
44
+ *********************************/
45
+
42
46
 
43
47
  function* loadAuditsMetadataMock() {
44
48
  yield (0, _effects.put)(_reducer.actions.setAuditsMetadataState({
@@ -93,6 +93,7 @@ function* loadAuditsFunction({
93
93
  sortBy,
94
94
  filter
95
95
  }, f2o, {
96
+ // TODO: refactor once api become V2 with query field for virtual scroll
96
97
  offset: virtualScroll ? rowsData.length + incomeOffset || rowsData.length + offset : incomeOffset || offset,
97
98
  count: _reducer.defaultItemsPerPage
98
99
  }));
@@ -126,6 +126,8 @@ Object.keys(_AuditsMetadataState).forEach(function (key) {
126
126
  }
127
127
  });
128
128
  });
129
+ // export types
130
+ // export store
129
131
  var _default = {
130
132
  sagas: _saga.sagas,
131
133
  mockSagas: _saga.mockSagas,
@@ -29,5 +29,16 @@ const actions = {
29
29
  payload
30
30
  }))
31
31
  };
32
+ /**
33
+ * To be used for actions types after dispatch, and should contains
34
+ * the reducers and actions as standalone function
35
+ */
36
+
32
37
  exports.acceptInvitationActions = actions;
38
+ // noinspection JSUnusedLocalSymbols
39
+
40
+ /**
41
+ * if you see error in matcher that's mean the DispatchAction does not
42
+ * contains the same functions in reducers and actions
43
+ */
33
44
  const Matcher = {};
@@ -30,5 +30,16 @@ const actions = {
30
30
  payload
31
31
  }))
32
32
  };
33
+ /**
34
+ * To be used for actions types after dispatch, and should contains
35
+ * the reducers and actions as standalone function
36
+ */
37
+
33
38
  exports.accountSettingsActions = actions;
39
+ // noinspection JSUnusedLocalSymbols
40
+
41
+ /**
42
+ * if you see error in matcher that's mean the DispatchAction does not
43
+ * contains the same functions in reducers and actions
44
+ */
34
45
  const Matcher = {};
@@ -86,6 +86,10 @@ function* accountSettingsSaga() {
86
86
  yield (0, _effects.takeLeading)(_reducer.actions.saveAccountSettings, saveAccountSettings);
87
87
  yield (0, _effects.takeLeading)(_reducer.actions.loadAccountSettings, loadAccountSettings);
88
88
  }
89
+ /*********************************
90
+ * Preview Sagas
91
+ *********************************/
92
+
89
93
 
90
94
  function* saveAccountSettingsMock({
91
95
  payload
@@ -44,5 +44,16 @@ const actions = {
44
44
  payload
45
45
  }))
46
46
  };
47
+ /**
48
+ * To be used for actions types after dispatch, and should contains
49
+ * the reducers and actions as standalone function
50
+ */
51
+
47
52
  exports.activateAccountActions = actions;
53
+ // noinspection JSUnusedLocalSymbols
54
+
55
+ /**
56
+ * if you see error in matcher that's mean the DispatchAction does not
57
+ * contains the same functions in reducers and actions
58
+ */
48
59
  const Matcher = {};
@@ -62,5 +62,16 @@ const actions = {
62
62
  payload
63
63
  }))
64
64
  };
65
+ /**
66
+ * To be used for actions types after dispatch, and should contains
67
+ * the reducers and actions as standalone function
68
+ */
69
+
65
70
  exports.apiTokensActions = actions;
71
+ // noinspection JSUnusedLocalSymbols
72
+
73
+ /**
74
+ * if you see error in matcher that's mean the DispatchAction does not
75
+ * contains the same functions in reducers and actions
76
+ */
66
77
  const Matcher = {};
@@ -293,6 +293,10 @@ function* apiTokensSaga() {
293
293
  yield (0, _effects.takeLatest)(_reducer.actions.deleteTenantApiToken, deleteTenantApiToken);
294
294
  yield (0, _effects.takeLatest)(_reducer.actions.deleteUserApiToken, deleteUserApiToken);
295
295
  }
296
+ /*********************************
297
+ * Preview Sagas
298
+ *********************************/
299
+
296
300
 
297
301
  function* loadApiTokensDataMock({
298
302
  payload: apiTokenType
@@ -38,5 +38,16 @@ const actions = {
38
38
  payload
39
39
  }))
40
40
  };
41
+ /**
42
+ * To be used for actions types after dispatch, and should contains
43
+ * the reducers and actions as standalone function
44
+ */
45
+
41
46
  exports.forgotPasswordActions = actions;
47
+ // noinspection JSUnusedLocalSymbols
48
+
49
+ /**
50
+ * if you see error in matcher that's mean the DispatchAction does not
51
+ * contains the same functions in reducers and actions
52
+ */
42
53
  const Matcher = {};
@@ -97,5 +97,16 @@ const actions = {
97
97
  payload
98
98
  }))
99
99
  };
100
+ /**
101
+ * To be used for actions types after dispatch, and should contains
102
+ * the reducers and actions as standalone function
103
+ */
104
+
100
105
  exports.loginActions = actions;
106
+ // noinspection JSUnusedLocalSymbols
107
+
108
+ /**
109
+ * if you see error in matcher that's mean the DispatchAction does not
110
+ * contains the same functions in reducers and actions
111
+ */
101
112
  const Matcher = {};
@@ -298,10 +298,15 @@ function* refreshTokenEmbedded() {
298
298
  }));
299
299
  const url = new URL((_window2 = window) == null ? void 0 : _window2.location.href);
300
300
  const invitationToken = url.searchParams.get('invitationToken');
301
+ const redirectRoutes = [routes.socialLoginCallbackUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl];
302
+
303
+ if (!invitationToken) {
304
+ redirectRoutes.push(routes.loginUrl, routes.signUpUrl);
305
+ }
301
306
 
302
307
  if (shouldNavigateToRegisterQuicKLogin) {
303
308
  onRedirectTo(routes.loginUrl);
304
- } else if (!invitationToken && [routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl].some(url => url && window.location.pathname.endsWith(url))) {
309
+ } else if (redirectRoutes.some(url => url && window.location.pathname.endsWith(url))) {
305
310
  if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
306
311
  onRedirectTo(routes.signUpSuccessUrl, {
307
312
  refresh: routes.signUpSuccessUrl.startsWith('http')
@@ -430,14 +435,17 @@ function* requestHostedLoginAuthorize({
430
435
  routes: state.auth.routes,
431
436
  onRedirectTo: state.auth.onRedirectTo,
432
437
  context: state.root.context
433
- }));
438
+ })); // Generate the relevant params for the redirect
439
+
434
440
  const nonce = (0, _helpers.createRandomString)();
435
441
  const code_verifier = (0, _helpers.createRandomString)();
436
- const code_challenge = yield (0, _effects.call)(_helpers.generateCodeChallenge, code_verifier);
442
+ const code_challenge = yield (0, _effects.call)(_helpers.generateCodeChallenge, code_verifier); // We are saving the verifier in session storage to be able to validate the response
443
+
437
444
  localStorage.setItem(_constants.HOSTED_LOGIN_VERIFIER_KEY, code_verifier);
438
445
  const redirectUrl = `${window.location.origin}${routes.hostedLoginRedirectUrl}`;
439
446
 
440
- const baseUrl = _restApi.fetch.getBaseUrl(context, '/oauth/authorize');
447
+ const baseUrl = _restApi.fetch.getBaseUrl(context, '/oauth/authorize'); // Hard coded for now
448
+
441
449
 
442
450
  const oauthUrl = `${baseUrl}/oauth/authorize`;
443
451
  const params = (0, _extends2.default)({
@@ -459,6 +467,7 @@ function* requestHostedLoginAuthorize({
459
467
  function* handleHostedLoginCallback({
460
468
  payload
461
469
  }) {
470
+ // Hard coded for now
462
471
  const code_verifier = localStorage.getItem(_constants.HOSTED_LOGIN_VERIFIER_KEY) || 'INVALID-CODE-VERIFIER';
463
472
  const routes = yield (0, _effects.select)(state => state.auth.routes);
464
473
  const redirectUrl = `${window.location.origin}${routes.hostedLoginRedirectUrl}`;
@@ -468,7 +477,8 @@ function* handleHostedLoginCallback({
468
477
  code_verifier,
469
478
  grant_type: 'authorization_code'
470
479
  };
471
- const user = yield (0, _effects.call)(_restApi.api.auth.exchangeOAuthTokens, body);
480
+ const user = yield (0, _effects.call)(_restApi.api.auth.exchangeOAuthTokens, body); // TODO: Validate nonce and aud
481
+
472
482
  yield (0, _effects.put)(_reducer.actions.setState({
473
483
  user,
474
484
  isAuthenticated: true
@@ -979,9 +989,11 @@ function* webAuthnPostLogin(_ref10) {
979
989
  yield (0, _effects.put)(_reducer.actions.setLoginState({
980
990
  error: undefined
981
991
  }));
982
- yield afterAuthNavigation();
992
+ yield afterAuthNavigation(); // TODO: Itamar why moving callback to inside the else block
993
+
983
994
  callback == null ? void 0 : callback(true);
984
- }
995
+ } // callback?.(true);
996
+
985
997
  } catch (e) {
986
998
  yield (0, _effects.put)(_reducer.actions.setLoginState({
987
999
  error: e.message
@@ -1130,7 +1142,8 @@ function* login({
1130
1142
 
1131
1143
  if (isAuthenticated && loginState.flow === _interfaces2.LoginFlow.Login) {
1132
1144
  yield afterAuthNavigation();
1133
- }
1145
+ } // TODO: extract item name to constants
1146
+
1134
1147
 
1135
1148
  localStorage.removeItem('register-quick-login');
1136
1149
  callback == null ? void 0 : callback(true);
@@ -1289,6 +1302,10 @@ function* loginSagas() {
1289
1302
  yield (0, _effects.takeLeading)(_reducer.actions.webAuthnVerifyNewDeviceSession, webAuthnVerifyNewDeviceSession);
1290
1303
  yield (0, _effects.takeLeading)(_reducer.actions.afterAuthNavigation, afterAuthNavigation);
1291
1304
  }
1305
+ /*********************************
1306
+ * Preview Sagas
1307
+ *********************************/
1308
+
1292
1309
 
1293
1310
  function* requestAuthorizeMock({
1294
1311
  payload: firstTime
@@ -37,5 +37,16 @@ const actions = {
37
37
  payload
38
38
  }))
39
39
  };
40
+ /**
41
+ * To be used for actions types after dispatch, and should contains
42
+ * the reducers and actions as standalone function
43
+ */
44
+
40
45
  exports.mfaActions = actions;
46
+ // noinspection JSUnusedLocalSymbols
47
+
48
+ /**
49
+ * if you see error in matcher that's mean the DispatchAction does not
50
+ * contains the same functions in reducers and actions
51
+ */
41
52
  const Matcher = {};
@@ -163,6 +163,10 @@ function* mfaSagas() {
163
163
  yield (0, _effects.takeEvery)(_reducer.actions.disableMfa, disableMfa);
164
164
  yield (0, _effects.takeEvery)(_reducer.actions.verifyMfaAfterForce, verifyMfaAfterForce);
165
165
  }
166
+ /*********************************
167
+ * Preview Sagas
168
+ *********************************/
169
+
166
170
 
167
171
  function* enrollMfaMock() {
168
172
  yield (0, _effects.put)(_reducer.actions.setMfaState({