@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
@@ -24,5 +24,16 @@ const actions = {
24
24
  payload
25
25
  }))
26
26
  };
27
+ /**
28
+ * To be used for actions types after dispatch, and should contains
29
+ * the reducers and actions as standalone function
30
+ */
31
+
32
+ // noinspection JSUnusedLocalSymbols
33
+
34
+ /**
35
+ * if you see error in matcher that's mean the DispatchAction does not
36
+ * contains the same functions in reducers and actions
37
+ */
27
38
  const Matcher = {};
28
39
  export { auditLogsState, reducers as auditLogsReducers, actions as auditLogsActions };
@@ -109,6 +109,9 @@ export function* auditLogsSagas() {
109
109
  yield takeEvery(actions.exportAuditsCsv, exportAuditsCsv);
110
110
  yield takeEvery(actions.loadAuditLogs, loadAuditLogs);
111
111
  }
112
+ /*********************************
113
+ * Preview Sagas
114
+ *********************************/
112
115
 
113
116
  function* loadAuditLogsMock({
114
117
  payload
@@ -14,5 +14,16 @@ const reducers = {
14
14
  const actions = {
15
15
  loadAuditsMetadata: createAction(`${auditsStoreName}/loadAuditsMetadata`)
16
16
  };
17
+ /**
18
+ * To be used for actions types after dispatch, and should contains
19
+ * the reducers and actions as standalone function
20
+ */
21
+
22
+ // noinspection JSUnusedLocalSymbols
23
+
24
+ /**
25
+ * if you see error in matcher that's mean the DispatchAction does not
26
+ * contains the same functions in reducers and actions
27
+ */
17
28
  const Matcher = {};
18
29
  export { auditsMetadataState, reducers as auditsMetadataReducers, actions as auditsMetadataActions };
@@ -28,6 +28,9 @@ function* loadAuditsMetadata() {
28
28
  export function* auditsMetadataSagas() {
29
29
  yield takeEvery(actions.loadAuditsMetadata, loadAuditsMetadata);
30
30
  }
31
+ /*********************************
32
+ * Preview Sagas
33
+ *********************************/
31
34
 
32
35
  function* loadAuditsMetadataMock() {
33
36
  yield put(actions.setAuditsMetadataState({
@@ -81,6 +81,7 @@ function* loadAuditsFunction({
81
81
  sortBy,
82
82
  filter
83
83
  }, f2o, {
84
+ // TODO: refactor once api become V2 with query field for virtual scroll
84
85
  offset: virtualScroll ? rowsData.length + incomeOffset || rowsData.length + offset : incomeOffset || offset,
85
86
  count: defaultItemsPerPage
86
87
  }));
package/audits/index.js CHANGED
@@ -1,13 +1,15 @@
1
1
  import { reducer, actions } from './reducer';
2
2
  import { sagas, mockSagas } from './saga';
3
3
  import { auditsStoreName 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 './AuditLogsState/interfaces';
7
8
  export * from './AuditLogsState';
8
9
  export * from './AuditsMetadataState/interfaces';
9
10
  export * from './AuditsMetadataState';
10
- export { sagas as auditsSagas, mockSagas as auditsMockSagas, reducer as auditsReducers, actions as auditsActions, initialState as auditsInitialState, storeName as auditsStoreName };
11
+ export { sagas as auditsSagas, mockSagas as auditsMockSagas, reducer as auditsReducers, actions as auditsActions, initialState as auditsInitialState, storeName as auditsStoreName }; // export store
12
+
11
13
  export default {
12
14
  sagas,
13
15
  mockSagas,
@@ -16,5 +16,16 @@ const actions = {
16
16
  payload
17
17
  }))
18
18
  };
19
+ /**
20
+ * To be used for actions types after dispatch, and should contains
21
+ * the reducers and actions as standalone function
22
+ */
23
+
24
+ // noinspection JSUnusedLocalSymbols
25
+
26
+ /**
27
+ * if you see error in matcher that's mean the DispatchAction does not
28
+ * contains the same functions in reducers and actions
29
+ */
19
30
  const Matcher = {};
20
31
  export { acceptInvitationState, reducers as acceptInvitationReducers, actions as acceptInvitationActions };
@@ -18,5 +18,16 @@ const actions = {
18
18
  payload
19
19
  }))
20
20
  };
21
+ /**
22
+ * To be used for actions types after dispatch, and should contains
23
+ * the reducers and actions as standalone function
24
+ */
25
+
26
+ // noinspection JSUnusedLocalSymbols
27
+
28
+ /**
29
+ * if you see error in matcher that's mean the DispatchAction does not
30
+ * contains the same functions in reducers and actions
31
+ */
21
32
  const Matcher = {};
22
33
  export { accountSettingsState, reducers as accountSettingsReducers, actions as accountSettingsActions };
@@ -72,6 +72,9 @@ export function* accountSettingsSaga() {
72
72
  yield takeLeading(actions.saveAccountSettings, saveAccountSettings);
73
73
  yield takeLeading(actions.loadAccountSettings, loadAccountSettings);
74
74
  }
75
+ /*********************************
76
+ * Preview Sagas
77
+ *********************************/
75
78
 
76
79
  function* saveAccountSettingsMock({
77
80
  payload
@@ -15,7 +15,10 @@ declare const reducers: {
15
15
  error?: any;
16
16
  isAuthenticated: boolean;
17
17
  isLoading: boolean;
18
- keepSessionAlive?: boolean | undefined;
18
+ keepSessionAlive?: boolean | undefined; /**
19
+ * To be used for actions types after dispatch, and should contains
20
+ * the reducers and actions as standalone function
21
+ */
19
22
  user?: import("..").User | null | undefined;
20
23
  isSSOAuth: boolean;
21
24
  ssoACS?: string | undefined;
@@ -48,7 +51,10 @@ declare const reducers: {
48
51
  error?: any;
49
52
  isAuthenticated: boolean;
50
53
  isLoading: boolean;
51
- keepSessionAlive?: boolean | undefined;
54
+ keepSessionAlive?: boolean | undefined; /**
55
+ * To be used for actions types after dispatch, and should contains
56
+ * the reducers and actions as standalone function
57
+ */
52
58
  user?: import("..").User | null | undefined;
53
59
  isSSOAuth: boolean;
54
60
  ssoACS?: string | undefined;
@@ -87,7 +93,10 @@ declare const reducers: {
87
93
  error?: any;
88
94
  isAuthenticated: boolean;
89
95
  isLoading: boolean;
90
- keepSessionAlive?: boolean | undefined;
96
+ keepSessionAlive?: boolean | undefined; /**
97
+ * To be used for actions types after dispatch, and should contains
98
+ * the reducers and actions as standalone function
99
+ */
91
100
  user?: import("..").User | null | undefined;
92
101
  isSSOAuth: boolean;
93
102
  ssoACS?: string | undefined;
@@ -31,5 +31,16 @@ const actions = {
31
31
  payload
32
32
  }))
33
33
  };
34
+ /**
35
+ * To be used for actions types after dispatch, and should contains
36
+ * the reducers and actions as standalone function
37
+ */
38
+
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 = {};
35
46
  export { activateState, reducers as activateAccountReducers, actions as activateAccountActions };
@@ -50,5 +50,16 @@ const actions = {
50
50
  payload
51
51
  }))
52
52
  };
53
+ /**
54
+ * To be used for actions types after dispatch, and should contains
55
+ * the reducers and actions as standalone function
56
+ */
57
+
58
+ // noinspection JSUnusedLocalSymbols
59
+
60
+ /**
61
+ * if you see error in matcher that's mean the DispatchAction does not
62
+ * contains the same functions in reducers and actions
63
+ */
53
64
  const Matcher = {};
54
65
  export { apiTokensState, reducers as apiTokensReducers, actions as apiTokensActions };
@@ -277,6 +277,9 @@ export function* apiTokensSaga() {
277
277
  yield takeLatest(actions.deleteTenantApiToken, deleteTenantApiToken);
278
278
  yield takeLatest(actions.deleteUserApiToken, deleteUserApiToken);
279
279
  }
280
+ /*********************************
281
+ * Preview Sagas
282
+ *********************************/
280
283
 
281
284
  function* loadApiTokensDataMock({
282
285
  payload: apiTokenType
@@ -25,5 +25,16 @@ const actions = {
25
25
  payload
26
26
  }))
27
27
  };
28
+ /**
29
+ * To be used for actions types after dispatch, and should contains
30
+ * the reducers and actions as standalone function
31
+ */
32
+
33
+ // noinspection JSUnusedLocalSymbols
34
+
35
+ /**
36
+ * if you see error in matcher that's mean the DispatchAction does not
37
+ * contains the same functions in reducers and actions
38
+ */
28
39
  const Matcher = {};
29
40
  export { forgotPasswordState, reducers as forgotPasswordReducers, actions as forgotPasswordActions };
@@ -84,5 +84,16 @@ const actions = {
84
84
  payload
85
85
  }))
86
86
  };
87
+ /**
88
+ * To be used for actions types after dispatch, and should contains
89
+ * the reducers and actions as standalone function
90
+ */
91
+
92
+ // noinspection JSUnusedLocalSymbols
93
+
94
+ /**
95
+ * if you see error in matcher that's mean the DispatchAction does not
96
+ * contains the same functions in reducers and actions
97
+ */
87
98
  const Matcher = {};
88
99
  export { loginState, reducers as loginReducers, actions as loginActions };
@@ -249,10 +249,15 @@ function* refreshTokenEmbedded() {
249
249
  }));
250
250
  const url = new URL((_window2 = window) == null ? void 0 : _window2.location.href);
251
251
  const invitationToken = url.searchParams.get('invitationToken');
252
+ const redirectRoutes = [routes.socialLoginCallbackUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl];
253
+
254
+ if (!invitationToken) {
255
+ redirectRoutes.push(routes.loginUrl, routes.signUpUrl);
256
+ }
252
257
 
253
258
  if (shouldNavigateToRegisterQuicKLogin) {
254
259
  onRedirectTo(routes.loginUrl);
255
- } else if (!invitationToken && [routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl].some(url => url && window.location.pathname.endsWith(url))) {
260
+ } else if (redirectRoutes.some(url => url && window.location.pathname.endsWith(url))) {
256
261
  if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
257
262
  onRedirectTo(routes.signUpSuccessUrl, {
258
263
  refresh: routes.signUpSuccessUrl.startsWith('http')
@@ -375,13 +380,16 @@ function* requestHostedLoginAuthorize({
375
380
  routes: state.auth.routes,
376
381
  onRedirectTo: state.auth.onRedirectTo,
377
382
  context: state.root.context
378
- }));
383
+ })); // Generate the relevant params for the redirect
384
+
379
385
  const nonce = createRandomString();
380
386
  const code_verifier = createRandomString();
381
- const code_challenge = yield call(generateCodeChallenge, code_verifier);
387
+ const code_challenge = yield call(generateCodeChallenge, code_verifier); // We are saving the verifier in session storage to be able to validate the response
388
+
382
389
  localStorage.setItem(HOSTED_LOGIN_VERIFIER_KEY, code_verifier);
383
390
  const redirectUrl = `${window.location.origin}${routes.hostedLoginRedirectUrl}`;
384
- const baseUrl = fetch.getBaseUrl(context, '/oauth/authorize');
391
+ const baseUrl = fetch.getBaseUrl(context, '/oauth/authorize'); // Hard coded for now
392
+
385
393
  const oauthUrl = `${baseUrl}/oauth/authorize`;
386
394
 
387
395
  const params = _extends({
@@ -404,6 +412,7 @@ function* requestHostedLoginAuthorize({
404
412
  function* handleHostedLoginCallback({
405
413
  payload
406
414
  }) {
415
+ // Hard coded for now
407
416
  const code_verifier = localStorage.getItem(HOSTED_LOGIN_VERIFIER_KEY) || 'INVALID-CODE-VERIFIER';
408
417
  const routes = yield select(state => state.auth.routes);
409
418
  const redirectUrl = `${window.location.origin}${routes.hostedLoginRedirectUrl}`;
@@ -413,7 +422,8 @@ function* handleHostedLoginCallback({
413
422
  code_verifier,
414
423
  grant_type: 'authorization_code'
415
424
  };
416
- const user = yield call(api.auth.exchangeOAuthTokens, body);
425
+ const user = yield call(api.auth.exchangeOAuthTokens, body); // TODO: Validate nonce and aud
426
+
417
427
  yield put(actions.setState({
418
428
  user,
419
429
  isAuthenticated: true
@@ -925,9 +935,11 @@ function* webAuthnPostLogin(_ref10) {
925
935
  yield put(actions.setLoginState({
926
936
  error: undefined
927
937
  }));
928
- yield afterAuthNavigation();
938
+ yield afterAuthNavigation(); // TODO: Itamar why moving callback to inside the else block
939
+
929
940
  callback == null ? void 0 : callback(true);
930
- }
941
+ } // callback?.(true);
942
+
931
943
  } catch (e) {
932
944
  yield put(actions.setLoginState({
933
945
  error: e.message
@@ -1070,7 +1082,8 @@ function* login({
1070
1082
 
1071
1083
  if (isAuthenticated && loginState.flow === LoginFlow.Login) {
1072
1084
  yield afterAuthNavigation();
1073
- }
1085
+ } // TODO: extract item name to constants
1086
+
1074
1087
 
1075
1088
  localStorage.removeItem('register-quick-login');
1076
1089
  callback == null ? void 0 : callback(true);
@@ -1227,6 +1240,9 @@ export function* loginSagas() {
1227
1240
  yield takeLeading(actions.webAuthnVerifyNewDeviceSession, webAuthnVerifyNewDeviceSession);
1228
1241
  yield takeLeading(actions.afterAuthNavigation, afterAuthNavigation);
1229
1242
  }
1243
+ /*********************************
1244
+ * Preview Sagas
1245
+ *********************************/
1230
1246
 
1231
1247
  function* requestAuthorizeMock({
1232
1248
  payload: firstTime
@@ -12,7 +12,10 @@ declare const reducers: {
12
12
  type: string;
13
13
  }) => {
14
14
  onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
15
- error?: any;
15
+ error?: any; /**
16
+ * if you see error in matcher that's mean the DispatchAction does not
17
+ * contains the same functions in reducers and actions
18
+ */
16
19
  isAuthenticated: boolean;
17
20
  isLoading: boolean;
18
21
  keepSessionAlive?: boolean | undefined;
@@ -45,7 +48,10 @@ declare const reducers: {
45
48
  };
46
49
  resetMfaState: (state: import("..").AuthState) => {
47
50
  onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
48
- error?: any;
51
+ error?: any; /**
52
+ * if you see error in matcher that's mean the DispatchAction does not
53
+ * contains the same functions in reducers and actions
54
+ */
49
55
  isAuthenticated: boolean;
50
56
  isLoading: boolean;
51
57
  keepSessionAlive?: boolean | undefined;
@@ -24,5 +24,16 @@ const actions = {
24
24
  payload
25
25
  }))
26
26
  };
27
+ /**
28
+ * To be used for actions types after dispatch, and should contains
29
+ * the reducers and actions as standalone function
30
+ */
31
+
32
+ // noinspection JSUnusedLocalSymbols
33
+
34
+ /**
35
+ * if you see error in matcher that's mean the DispatchAction does not
36
+ * contains the same functions in reducers and actions
37
+ */
27
38
  const Matcher = {};
28
39
  export { mfaState, reducers as mfaReducers, actions as mfaActions };
@@ -147,6 +147,9 @@ export function* mfaSagas() {
147
147
  yield takeEvery(actions.disableMfa, disableMfa);
148
148
  yield takeEvery(actions.verifyMfaAfterForce, verifyMfaAfterForce);
149
149
  }
150
+ /*********************************
151
+ * Preview Sagas
152
+ *********************************/
150
153
 
151
154
  function* enrollMfaMock() {
152
155
  yield put(actions.setMfaState({
@@ -20,5 +20,16 @@ const actions = {
20
20
  payload
21
21
  }))
22
22
  };
23
+ /**
24
+ * To be used for actions types after dispatch, and should contains
25
+ * the reducers and actions as standalone function
26
+ */
27
+
28
+ // noinspection JSUnusedLocalSymbols
29
+
30
+ /**
31
+ * if you see error in matcher that's mean the DispatchAction does not
32
+ * contains the same functions in reducers and actions
33
+ */
23
34
  const Matcher = {};
24
35
  export { profileState, reducers as profileReducers, actions as profileActions };
@@ -55,11 +55,15 @@ function base64ToFormData(base64, key = 'file') {
55
55
 
56
56
  if (matchResult == null) {
57
57
  return null;
58
- }
58
+ } // Get the content type of the image
59
+
60
+
61
+ const contentType = `image/${matchResult[1]}`; // get the real base64 content of the file
62
+
63
+ const data = matchResult[2]; // Convert it to a blob to upload
64
+
65
+ const blob = b64toBlob(data, contentType); // Create a FormData and append the file with "image" as parameter name
59
66
 
60
- const contentType = `image/${matchResult[1]}`;
61
- const data = matchResult[2];
62
- const blob = b64toBlob(data, contentType);
63
67
  const formDataToUpload = new FormData();
64
68
  formDataToUpload.append(key, new File([blob], key, {
65
69
  type: contentType
@@ -154,6 +158,9 @@ export function* profileSagas() {
154
158
  yield takeEvery(actions.saveProfile, saveProfile);
155
159
  yield takeEvery(actions.changePassword, changePassword);
156
160
  }
161
+ /*********************************
162
+ * Preview Sagas
163
+ *********************************/
157
164
 
158
165
  function* loadProfileMock() {
159
166
  yield put(actions.setProfileState({
@@ -23,5 +23,16 @@ const actions = {
23
23
  payload
24
24
  }))
25
25
  };
26
+ /**
27
+ * To be used for actions types after dispatch, and should contains
28
+ * the reducers and actions as standalone function
29
+ */
30
+
31
+ // noinspection JSUnusedLocalSymbols
32
+
33
+ /**
34
+ * if you see error in matcher that's mean the DispatchAction does not
35
+ * contains the same functions in reducers and actions
36
+ */
26
37
  const Matcher = {};
27
38
  export { resetPhoneNumberState, reducers as resetPhoneNumberReducers, actions as resetPhoneNumberActions };
@@ -33,5 +33,16 @@ const actions = {
33
33
  payload
34
34
  }))
35
35
  };
36
+ /**
37
+ * To be used for actions types after dispatch, and should contains
38
+ * the reducers and actions as standalone function
39
+ */
40
+
41
+ // noinspection JSUnusedLocalSymbols
42
+
43
+ /**
44
+ * if you see error in matcher that's mean the DispatchAction does not
45
+ * contains the same functions in reducers and actions
46
+ */
36
47
  const Matcher = {};
37
48
  export { rolesState, reducers as rolesReducers, actions as rolesActions };
@@ -57,6 +57,7 @@ const actions = {
57
57
  saveSSOConfigurations: createAction(`${authStoreName}/saveSSOConfigurations`, payload => ({
58
58
  payload
59
59
  })),
60
+ // NOTE: use withCallback in case of promise response
60
61
  saveSSOConfigurationsFile: createAction(`${authStoreName}/saveSSOConfigurationsFile`, payload => ({
61
62
  payload
62
63
  })),
@@ -79,5 +80,16 @@ const actions = {
79
80
  payload
80
81
  }))
81
82
  };
83
+ /**
84
+ * To be used for actions types after dispatch, and should contains
85
+ * the reducers and actions as standalone function
86
+ */
87
+
88
+ // noinspection JSUnusedLocalSymbols
89
+
90
+ /**
91
+ * if you see error in matcher that's mean the DispatchAction does not
92
+ * contains the same functions in reducers and actions
93
+ */
82
94
  const Matcher = {};
83
95
  export { ssoState, reducers as ssoReducers, actions as ssoActions };
@@ -372,6 +372,9 @@ export function* ssoSagas() {
372
372
  yield takeEvery(actions.createSamlGroup, createSamlGroupFunction);
373
373
  yield takeEvery(actions.oidcPostlogin, oidcPostloginFunction);
374
374
  }
375
+ /*********************************
376
+ * Preview Sagas
377
+ *********************************/
375
378
 
376
379
  function* loadSSOConfigurationsMock() {
377
380
  yield put(actions.setSSOState({
@@ -65,5 +65,16 @@ const actions = {
65
65
  loadVendorPasswordConfig: createAction(`${authStoreName}/loadVendorPasswordConfig`),
66
66
  loadPublicAuthStrategiesPolicy: createAction(`${authStoreName}/loadPublicAuthStrategiesPolicy`)
67
67
  };
68
+ /**
69
+ * To be used for actions types after dispatch, and should contains
70
+ * the reducers and actions as standalone function
71
+ */
72
+
73
+ // noinspection JSUnusedLocalSymbols
74
+
75
+ /**
76
+ * if you see error in matcher that's mean the DispatchAction does not
77
+ * contains the same functions in reducers and actions
78
+ */
68
79
  const Matcher = {};
69
80
  export { securityPolicyState, reducers as securityPolicyReducers, actions as securityPolicyActions };
@@ -298,6 +298,10 @@ export function* securityPolicySagas() {
298
298
  yield takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicy);
299
299
  yield takeEvery(actions.loadPublicAuthStrategiesPolicy, loadPublicAuthStrategiesPolicy);
300
300
  }
301
+ /*********************************
302
+ * Preview Sagas
303
+ *********************************/
304
+
301
305
  export function* loadPublicSecurityPolicyMock() {
302
306
  yield put(actions.setSecurityPolicyPublicState({
303
307
  loading: true,
@@ -17,5 +17,16 @@ const actions = {
17
17
  payload
18
18
  }))
19
19
  };
20
+ /**
21
+ * To be used for actions types after dispatch, and should contains
22
+ * the reducers and actions as standalone function
23
+ */
24
+
25
+ // noinspection JSUnusedLocalSymbols
26
+
27
+ /**
28
+ * if you see error in matcher that's mean the DispatchAction does not
29
+ * contains the same functions in reducers and actions
30
+ */
20
31
  const Matcher = {};
21
32
  export { sessionsPolicyState, reducers as sessionsPolicyReducers, actions as sessionsPolicyActions };
@@ -10,6 +10,10 @@ declare const reducers: {
10
10
  payload: Partial<SessionsState>;
11
11
  type: string;
12
12
  }) => {
13
+ /**
14
+ * if you see error in matcher that's mean the DispatchAction does not
15
+ * contains the same functions in reducers and actions
16
+ */
13
17
  onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
14
18
  error?: any;
15
19
  isAuthenticated: boolean;
@@ -43,6 +47,10 @@ declare const reducers: {
43
47
  };
44
48
  };
45
49
  resetSessionsState: (state: import("..").AuthState) => {
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
+ */
46
54
  onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
47
55
  error?: any;
48
56
  isAuthenticated: boolean;
@@ -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 { sessionsState, reducers as sessionsReducers, actions as sessionsActions };
@@ -111,6 +111,9 @@ export function* sessionsSaga() {
111
111
  yield takeLatest(actions.loadCurrentUserSession, loadCurrentUserSession);
112
112
  yield takeEvery(actions.revokeUserSessions, revokeUserSessions);
113
113
  }
114
+ /*********************************
115
+ * Preview Sagas
116
+ *********************************/
114
117
 
115
118
  function* loadCurrentUserSessionsMock() {
116
119
  yield put(actions.setSessionsState({
@@ -21,5 +21,16 @@ const actions = {
21
21
  })),
22
22
  resetSignUpStateSoft: createAction(`${authStoreName}/resetSignUpStateSoft`)
23
23
  };
24
+ /**
25
+ * To be used for actions types after dispatch, and should contains
26
+ * the reducers and actions as standalone function
27
+ */
28
+
29
+ // noinspection JSUnusedLocalSymbols
30
+
31
+ /**
32
+ * if you see error in matcher that's mean the DispatchAction does not
33
+ * contains the same functions in reducers and actions
34
+ */
24
35
  const Matcher = {};
25
36
  export { signUpState, reducers as signUpReducers, actions as signUpActions };
@@ -14,10 +14,7 @@ declare const reducers: {
14
14
  error?: any;
15
15
  isAuthenticated: boolean;
16
16
  isLoading: boolean;
17
- keepSessionAlive?: boolean | undefined; /**
18
- * if you see error in matcher that's mean the DispatchAction does not
19
- * contains the same functions in reducers and actions
20
- */
17
+ keepSessionAlive?: boolean | undefined;
21
18
  user?: import("..").User | null | undefined;
22
19
  isSSOAuth: boolean;
23
20
  ssoACS?: string | undefined;
@@ -50,10 +47,7 @@ declare const reducers: {
50
47
  error?: any;
51
48
  isAuthenticated: boolean;
52
49
  isLoading: boolean;
53
- keepSessionAlive?: boolean | undefined; /**
54
- * if you see error in matcher that's mean the DispatchAction does not
55
- * contains the same functions in reducers and actions
56
- */
50
+ keepSessionAlive?: boolean | undefined;
57
51
  user?: import("..").User | null | undefined;
58
52
  isSSOAuth: boolean;
59
53
  ssoACS?: string | undefined;