@frontegg/redux-store 6.0.3-alpha.3 → 6.2.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 (126) 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/toolkit/redux-types.js +5 -0
  103. package/node/vendor/VendorState/index.js +11 -0
  104. package/node/vendor/index.js +2 -0
  105. package/node/vendor/saga.js +4 -0
  106. package/package.json +1 -1
  107. package/subscriptions/Billing/Information/saga.js +3 -0
  108. package/subscriptions/Billing/Invoices/saga.js +4 -0
  109. package/subscriptions/Billing/PaymentMethod/index.js +2 -1
  110. package/subscriptions/Billing/PaymentMethod/interfaces.js +1 -0
  111. package/subscriptions/Billing/PaymentMethod/saga.js +4 -0
  112. package/subscriptions/Billing/Subscription/saga.js +6 -1
  113. package/subscriptions/Billing/interfaces.js +1 -0
  114. package/subscriptions/Checkout/saga.js +8 -0
  115. package/subscriptions/Config/saga.js +4 -0
  116. package/subscriptions/Plans/saga.js +4 -0
  117. package/subscriptions/VendorPublicConfig/saga.js +4 -0
  118. package/subscriptions/dummy.js +15 -1
  119. package/subscriptions/index.js +3 -1
  120. package/toolkit/index.d.ts +1 -1
  121. package/toolkit/redux-types.d.ts +3 -0
  122. package/toolkit/redux-types.js +1 -0
  123. package/toolkit/redux.d.ts +2 -1
  124. package/vendor/VendorState/index.js +11 -0
  125. package/vendor/index.js +4 -2
  126. package/vendor/saga.js +3 -0
@@ -17,8 +17,22 @@ const subscriptionResponseMock = {
17
17
  currentPeriodStart: '2021-09-20T08:08:51.000Z',
18
18
  currentPeriodEnd: '2021-10-20T08:08:51.000Z',
19
19
  plan: {
20
+ // TODO: fix dummy data
20
21
  slug: 'test'
21
- }
22
+ } // items: [
23
+ // {
24
+ // id: 'si_KGE0p5himocPXH',
25
+ // externalId: 'prod_J60fUEvI7qV1eL',
26
+ // planId: 'prod_J60fUEvI7qV1eL',
27
+ // price: {
28
+ // id: 'price_1IToe8Ewsu4qiqnndAV76J69',
29
+ // externalId: 'price_1IToe8Ewsu4qiqnndAV76J69',
30
+ // currency: 'usd',
31
+ // amount: 10000,
32
+ // },
33
+ // },
34
+ // ],
35
+
22
36
  };
23
37
  exports.subscriptionResponseMock = subscriptionResponseMock;
24
38
  const planResponseMock = [{
@@ -68,6 +68,8 @@ Object.keys(_interfaces).forEach(function (key) {
68
68
  }
69
69
  });
70
70
  });
71
+ // export store
72
+ // export store
71
73
  var _default = {
72
74
  sagas: _saga.sagas,
73
75
  mockSagas: _saga.mockSagas,
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -22,5 +22,16 @@ exports.vendorReducers = reducers;
22
22
  const actions = {
23
23
  loadVendorPublicInfo: (0, _toolkit.createAction)(`${_constants.vendorStoreName}/loadVendorPublicInfo`)
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
+
25
30
  exports.vendorActions = actions;
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 = {};
@@ -61,6 +61,8 @@ Object.keys(_interfaces).forEach(function (key) {
61
61
  }
62
62
  });
63
63
  });
64
+ // export types
65
+ // export store
64
66
  var _default = {
65
67
  sagas: _saga.sagas,
66
68
  storeName: _constants.vendorStoreName,
@@ -27,6 +27,10 @@ function* loadVendorPublicInfo() {
27
27
  console.error('failed to getVendorPublicInfo - ', e);
28
28
  }
29
29
  }
30
+ /*********************************
31
+ * Preview Sagas
32
+ *********************************/
33
+
30
34
 
31
35
  function* loadVendorPublicInfoMock() {
32
36
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "6.0.3-alpha.3",
3
+ "version": "6.2.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
@@ -84,6 +84,9 @@ export function* loadSummaries(tenantId, forceActive) {
84
84
  yield put(informationActions.setError(e.message));
85
85
  }
86
86
  }
87
+ /*********************************
88
+ * Preview Sagas
89
+ *********************************/
87
90
 
88
91
  function* loadBillingInformationMock() {
89
92
  yield loadSummariesMock();
@@ -53,6 +53,10 @@ function* downloadInvoice({
53
53
  }));
54
54
  }
55
55
  }
56
+ /*********************************
57
+ * Preview Sagas
58
+ *********************************/
59
+
56
60
 
57
61
  function* loadInvoicesMock() {
58
62
  yield put(invoicesActions.setLoading(true));
@@ -35,6 +35,7 @@ const actions = _extends({
35
35
  updatePaymentMethodBillingDetails: createAction(`${name}/updateBillingDetails`, payload => ({
36
36
  payload
37
37
  }))
38
- }, paymentActions);
38
+ }, paymentActions); //TODO: refactor to general code-style like export type ConnectivityActions = DispatchedActions;
39
+
39
40
 
40
41
  export { reducer as subscriptionsPaymentMethodReducer, actions as subscriptionsPaymentMethodActions };
@@ -1,3 +1,4 @@
1
+ //TODO: consider use types from typescript-rest-api or duplicate them.
1
2
  export let PaymentMethodType;
2
3
 
3
4
  (function (PaymentMethodType) {
@@ -64,6 +64,10 @@ function* submitPaymentMethodError({
64
64
  function* submitPaymentMethodSuccess() {
65
65
  yield put(subscriptionsPaymentMethodActions.loadPaymentMethod());
66
66
  }
67
+ /*********************************
68
+ * Preview Sagas
69
+ *********************************/
70
+
67
71
 
68
72
  function* loadPaymentMethodMock() {
69
73
  yield put(subscriptionsPaymentMethodActions.setLoading(true));
@@ -16,7 +16,8 @@ function* loadSubscriptionTenant() {
16
16
  return (_state$auth = state.auth) == null ? void 0 : (_state$auth$user = _state$auth.user) == null ? void 0 : _state$auth$user.tenantId;
17
17
  });
18
18
  yield loadSummaries(tenantId);
19
- }
19
+ } // @ts-ignore
20
+
20
21
 
21
22
  export function* loadSubscription() {
22
23
  yield put(subscriptionActions.setLoading(true));
@@ -100,6 +101,10 @@ function* renewSubscription() {
100
101
  }
101
102
  }
102
103
  }
104
+ /*********************************
105
+ * Preview Sagas
106
+ *********************************/
107
+
103
108
 
104
109
  function* loadMock() {
105
110
  yield put(subscriptionActions.setLoading(true));
@@ -1,3 +1,4 @@
1
+ //TODO: rename information to billing
1
2
  export * from './Information/interfaces';
2
3
  export * from './PaymentMethod/interfaces';
3
4
  export * from './Invoices/interfaces';
@@ -31,6 +31,10 @@ function* resetCheckout() {
31
31
  confirmed: false
32
32
  }));
33
33
  }
34
+ /**
35
+ * Based on payment provider type
36
+ */
37
+
34
38
 
35
39
  function* submitCheckout() {
36
40
  yield put(checkoutActions.setState({
@@ -104,6 +108,10 @@ function* errorCheckout({
104
108
  error: payload
105
109
  }));
106
110
  }
111
+ /*********************************
112
+ * Preview Sagas
113
+ *********************************/
114
+
107
115
 
108
116
  export function* checkoutSagasMock() {
109
117
  yield takeEvery(checkoutActions.resetCheckout, resetCheckout);
@@ -40,6 +40,10 @@ function* loadStripePaymentConfiguration() {
40
40
  yield put(configActions.setError(e.message));
41
41
  }
42
42
  }
43
+ /*********************************
44
+ * Preview Sagas
45
+ *********************************/
46
+
43
47
 
44
48
  function* loadPaymentConfigurationMock() {
45
49
  yield put(configActions.setLoading(true));
@@ -34,6 +34,10 @@ function* loadPlans() {
34
34
  yield put(plansActions.setError(e.message));
35
35
  }
36
36
  }
37
+ /*********************************
38
+ * Preview Sagas
39
+ *********************************/
40
+
37
41
 
38
42
  function* loadPlansMock() {
39
43
  yield put(plansActions.setLoading(true));
@@ -20,6 +20,10 @@ function* loadVendorPublicConfiguration() {
20
20
  yield put(vendorPublicConfigActions.setError(e.message));
21
21
  }
22
22
  }
23
+ /*********************************
24
+ * Preview Sagas
25
+ *********************************/
26
+
23
27
 
24
28
  function* loadVendorPublicConfigurationMock() {
25
29
  yield put(vendorPublicConfigActions.setLoading(true));
@@ -9,8 +9,22 @@ export const subscriptionResponseMock = {
9
9
  currentPeriodStart: '2021-09-20T08:08:51.000Z',
10
10
  currentPeriodEnd: '2021-10-20T08:08:51.000Z',
11
11
  plan: {
12
+ // TODO: fix dummy data
12
13
  slug: 'test'
13
- }
14
+ } // items: [
15
+ // {
16
+ // id: 'si_KGE0p5himocPXH',
17
+ // externalId: 'prod_J60fUEvI7qV1eL',
18
+ // planId: 'prod_J60fUEvI7qV1eL',
19
+ // price: {
20
+ // id: 'price_1IToe8Ewsu4qiqnndAV76J69',
21
+ // externalId: 'price_1IToe8Ewsu4qiqnndAV76J69',
22
+ // currency: 'usd',
23
+ // amount: 10000,
24
+ // },
25
+ // },
26
+ // ],
27
+
14
28
  };
15
29
  export const planResponseMock = [{
16
30
  id: 'prod_J60fUEvI7qV1eL',
@@ -1,8 +1,10 @@
1
+ // export store
1
2
  import { subscriptionsStoreName as storeName } from '../constants';
2
3
  import { actions, initialState, reducer } from './reducer';
3
4
  import { sagas, mockSagas } from './saga';
4
5
  export * from './interfaces';
5
- export { sagas as subscriptionSagas, mockSagas as subscriptionSagasMock, reducer as subscriptionReducers, actions as subscriptionActions, initialState as subscriptionInitialState, storeName as subscriptionsStoreName };
6
+ export { sagas as subscriptionSagas, mockSagas as subscriptionSagasMock, reducer as subscriptionReducers, actions as subscriptionActions, initialState as subscriptionInitialState, storeName as subscriptionsStoreName }; // export store
7
+
6
8
  export default {
7
9
  sagas,
8
10
  mockSagas,
@@ -1,8 +1,8 @@
1
1
  import { AuthPageRoutes, AuthState } from '../auth';
2
- import { EnhancedStore } from '@reduxjs/toolkit';
3
2
  import { ContextOptions } from '@frontegg/rest-api';
4
3
  import { AuditsState } from '../audits';
5
4
  import { OldAuditsState } from '../audits/backward-compatibility';
5
+ import { EnhancedStore } from './redux-types';
6
6
  export * from './redux';
7
7
  export * from './redux-saga';
8
8
  declare type InitialState = {
@@ -0,0 +1,3 @@
1
+ import { EnhancedStore as ReduxEnhancedStore } from '@reduxjs/toolkit';
2
+ import { FronteggState } from '../index';
3
+ export declare type EnhancedStore = ReduxEnhancedStore<FronteggState, any, any>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
1
  export type { Middleware } from 'redux';
2
2
  export { getDefaultMiddleware, combineReducers, configureStore, bindActionCreators, createSelector, createSlice } from '@reduxjs/toolkit';
3
- export type { PayloadAction, Reducer, EnhancedStore, Dispatch, } from '@reduxjs/toolkit';
3
+ export type { PayloadAction, Reducer, Dispatch, } from '@reduxjs/toolkit';
4
+ export type { EnhancedStore, } from './redux-types';
@@ -9,5 +9,16 @@ const reducers = {
9
9
  const actions = {
10
10
  loadVendorPublicInfo: createAction(`${vendorStoreName}/loadVendorPublicInfo`)
11
11
  };
12
+ /**
13
+ * To be used for actions types after dispatch, and should contains
14
+ * the reducers and actions as standalone function
15
+ */
16
+
17
+ // noinspection JSUnusedLocalSymbols
18
+
19
+ /**
20
+ * if you see error in matcher that's mean the DispatchAction does not
21
+ * contains the same functions in reducers and actions
22
+ */
12
23
  const Matcher = {};
13
24
  export { reducers as vendorReducers, actions as vendorActions };
package/vendor/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import { reducer, actions, initialState } from './reducer';
2
2
  import { sagas } from './saga';
3
- import { vendorStoreName as storeName } from '../constants';
3
+ import { vendorStoreName as storeName } from '../constants'; // export types
4
+
4
5
  export * from './interfaces';
5
- export { sagas as vendorSagas, reducer as vendorReducers, actions as vendorActions, initialState as vendorInitialState, storeName as vendorStoreName };
6
+ export { sagas as vendorSagas, reducer as vendorReducers, actions as vendorActions, initialState as vendorInitialState, storeName as vendorStoreName }; // export store
7
+
6
8
  export default {
7
9
  sagas,
8
10
  storeName,
package/vendor/saga.js CHANGED
@@ -14,6 +14,9 @@ export function* loadVendorPublicInfo() {
14
14
  console.error('failed to getVendorPublicInfo - ', e);
15
15
  }
16
16
  }
17
+ /*********************************
18
+ * Preview Sagas
19
+ *********************************/
17
20
 
18
21
  function* loadVendorPublicInfoMock() {
19
22
  try {