@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,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.configReducer = exports.configInitialState = exports.configActions = 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 _constants = require("../../constants");
15
-
16
11
  var _utils = require("../utils");
17
-
18
12
  const configInitialState = {
19
13
  loading: false,
20
14
  error: null,
@@ -5,26 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.configSagas = configSagas;
7
7
  exports.configSagasMock = configSagasMock;
8
-
9
8
  var _effects = require("redux-saga/effects");
10
-
11
9
  var _index = require("./index");
12
-
13
10
  var _restApi = require("@frontegg/rest-api");
14
-
15
11
  var _interfaces = require("../interfaces");
16
-
17
12
  function* configSagas() {
18
13
  yield (0, _effects.takeEvery)(_index.configActions.loadPaymentConfiguration, loadPaymentConfiguration);
19
14
  }
20
-
21
15
  function* loadPaymentConfiguration() {
22
16
  yield (0, _effects.put)(_index.configActions.setLoading(true));
23
-
24
17
  try {
25
18
  const response = yield (0, _effects.call)(_restApi.api.subscriptions.getPaymentProviders) || [];
26
19
  const stripePaymentProvider = response.find(paymentProvider => paymentProvider.status === '1' && paymentProvider.providerType === _restApi.ProviderType.Stripe);
27
-
28
20
  if (stripePaymentProvider) {
29
21
  yield loadStripePaymentConfiguration();
30
22
  } else {
@@ -34,10 +26,8 @@ function* loadPaymentConfiguration() {
34
26
  yield (0, _effects.put)(_index.configActions.setError(e.message));
35
27
  }
36
28
  }
37
-
38
29
  function* loadStripePaymentConfiguration() {
39
30
  yield (0, _effects.put)(_index.configActions.setLoading(true));
40
-
41
31
  try {
42
32
  const response = yield (0, _effects.call)(_restApi.api.subscriptions.getStripePaymentProviderConfiguration);
43
33
  yield (0, _effects.put)(_index.configActions.setState({
@@ -52,11 +42,11 @@ function* loadStripePaymentConfiguration() {
52
42
  yield (0, _effects.put)(_index.configActions.setError(e.message));
53
43
  }
54
44
  }
45
+
55
46
  /*********************************
56
47
  * Preview Sagas
57
48
  *********************************/
58
49
 
59
-
60
50
  function* loadPaymentConfigurationMock() {
61
51
  yield (0, _effects.put)(_index.configActions.setLoading(true));
62
52
  yield (0, _effects.delay)(500);
@@ -69,7 +59,6 @@ function* loadPaymentConfigurationMock() {
69
59
  }
70
60
  }));
71
61
  }
72
-
73
62
  function* configSagasMock() {
74
63
  yield (0, _effects.takeEvery)(_index.configActions.loadPaymentConfiguration, loadPaymentConfigurationMock);
75
64
  }
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.plansReducer = exports.plansInitialState = exports.plansActions = 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 _constants = require("../../constants");
15
-
16
11
  var _utils = require("../utils");
17
-
18
12
  const plansInitialState = {
19
13
  loading: false,
20
14
  error: null,
@@ -1,35 +1,25 @@
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.plansSagas = plansSagas;
9
8
  exports.plansSagasMock = plansSagasMock;
10
-
11
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
-
13
10
  var _effects = require("redux-saga/effects");
14
-
15
11
  var _index = require("./index");
16
-
17
12
  var _restApi = require("@frontegg/rest-api");
18
-
19
13
  var _dummy = require("../dummy");
20
-
21
14
  function* plansSagas() {
22
15
  yield (0, _effects.takeEvery)(_index.plansActions.loadPlans, loadPlans);
23
16
  }
24
-
25
17
  function* loadPlans() {
26
18
  yield (0, _effects.put)(_index.plansActions.setLoading(true));
27
-
28
19
  try {
29
20
  const products = yield (0, _effects.call)(_restApi.api.subscriptions.getSubscriptionPlans);
30
21
  const plans = products.map(item => {
31
22
  var _item$price, _item$price2;
32
-
33
23
  return {
34
24
  id: item.id,
35
25
  name: item.name,
@@ -49,11 +39,11 @@ function* loadPlans() {
49
39
  yield (0, _effects.put)(_index.plansActions.setError(e.message));
50
40
  }
51
41
  }
42
+
52
43
  /*********************************
53
44
  * Preview Sagas
54
45
  *********************************/
55
46
 
56
-
57
47
  function* loadPlansMock() {
58
48
  yield (0, _effects.put)(_index.plansActions.setLoading(true));
59
49
  yield (0, _effects.delay)(500);
@@ -62,7 +52,6 @@ function* loadPlansMock() {
62
52
  loading: false,
63
53
  plans: _dummy.planResponseMock.map(item => {
64
54
  var _item$price3, _item$price4;
65
-
66
55
  return (0, _extends2.default)({}, item, {
67
56
  price: ((_item$price3 = item.price) == null ? void 0 : _item$price3.amount) || 0,
68
57
  currency: ((_item$price4 = item.price) == null ? void 0 : _item$price4.currency) || 'usd',
@@ -71,7 +60,6 @@ function* loadPlansMock() {
71
60
  })
72
61
  }));
73
62
  }
74
-
75
63
  function* plansSagasMock() {
76
64
  yield (0, _effects.takeEvery)(_index.plansActions.loadPlans, loadPlansMock);
77
65
  }
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.stripeReducer = exports.stripeActions = exports.initialSubscriptionStripeState = 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
  const initialSubscriptionStripeState = {
19
13
  loading: false,
20
14
  error: null,
@@ -4,17 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.subscriptionStripeSagas = subscriptionStripeSagas;
7
-
8
7
  var _effects = require("redux-saga/effects");
9
-
10
8
  var _index = require("./index");
11
-
12
9
  var _restApi = require("@frontegg/rest-api");
13
-
14
10
  function* subscriptionStripeSagas() {
15
11
  yield (0, _effects.takeEvery)(_index.stripeActions.createCardSetupIntentSecret, createCardSetupIntentSecret);
16
12
  }
17
-
18
13
  function* createCardSetupIntentSecret({
19
14
  payload
20
15
  }) {
@@ -23,14 +18,11 @@ function* createCardSetupIntentSecret({
23
18
  error: null,
24
19
  cardSetupIntentSecret: null
25
20
  }));
26
-
27
21
  try {
28
22
  const request = {};
29
-
30
23
  if (payload) {
31
24
  request.paymentMethodId = payload;
32
25
  }
33
-
34
26
  const {
35
27
  setupIntentSecret
36
28
  } = yield (0, _effects.call)(_restApi.api.subscriptions.createStripePaymentMethodSetupIntentSecret, request);
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.vendorPublicConfigReducer = exports.vendorPublicConfigInitialState = exports.vendorPublicConfigActions = 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 _constants = require("../../constants");
15
-
16
11
  var _utils = require("../utils");
17
-
18
12
  const vendorPublicConfigInitialState = {
19
13
  loading: false,
20
14
  fetching: true,
@@ -5,22 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.vendorPublicConfigSagas = vendorPublicConfigSagas;
7
7
  exports.vendorPublicConfigSagasMock = vendorPublicConfigSagasMock;
8
-
9
8
  var _effects = require("redux-saga/effects");
10
-
11
9
  var _index = require("./index");
12
-
13
10
  var _restApi = require("@frontegg/rest-api");
14
-
15
11
  var _dummy = require("../dummy");
16
-
17
12
  function* vendorPublicConfigSagas() {
18
13
  yield (0, _effects.takeEvery)(_index.vendorPublicConfigActions.loadVendorPublicConfiguration, loadVendorPublicConfiguration);
19
14
  }
20
-
21
15
  function* loadVendorPublicConfiguration() {
22
16
  yield (0, _effects.put)(_index.vendorPublicConfigActions.setLoading(true));
23
-
24
17
  try {
25
18
  const vendorPublicConfig = yield (0, _effects.call)(_restApi.api.subscriptions.getVendorPublicConfigurations);
26
19
  yield (0, _effects.put)(_index.vendorPublicConfigActions.setState({
@@ -32,11 +25,11 @@ function* loadVendorPublicConfiguration() {
32
25
  yield (0, _effects.put)(_index.vendorPublicConfigActions.setError(e.message));
33
26
  }
34
27
  }
28
+
35
29
  /*********************************
36
30
  * Preview Sagas
37
31
  *********************************/
38
32
 
39
-
40
33
  function* loadVendorPublicConfigurationMock() {
41
34
  yield (0, _effects.put)(_index.vendorPublicConfigActions.setLoading(true));
42
35
  yield (0, _effects.delay)(500);
@@ -46,7 +39,6 @@ function* loadVendorPublicConfigurationMock() {
46
39
  vendorPublicConfig: _dummy.vendorPublicConfigurationResponseMock
47
40
  }));
48
41
  }
49
-
50
42
  function* vendorPublicConfigSagasMock() {
51
43
  yield (0, _effects.takeEvery)(_index.vendorPublicConfigActions.loadVendorPublicConfiguration, loadVendorPublicConfigurationMock);
52
44
  }
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.vendorPublicConfigurationResponseMock = exports.subscriptionResponseMock = exports.planResponseMock = exports.paymentMethodsMock = exports.invoicesMock = void 0;
7
-
8
7
  var _restApi = require("@frontegg/rest-api");
9
-
10
8
  const subscriptionResponseMock = {
11
9
  id: 'sub_1JbhYVEwsu4qiqnnfMhYAdY6',
12
10
  externalId: 'sub_1JbhYVEwsu4qiqnnfMhYAdY6',
@@ -19,7 +17,8 @@ const subscriptionResponseMock = {
19
17
  plan: {
20
18
  // TODO: fix dummy data
21
19
  slug: 'test'
22
- } // items: [
20
+ }
21
+ // items: [
23
22
  // {
24
23
  // id: 'si_KGE0p5himocPXH',
25
24
  // externalId: 'prod_J60fUEvI7qV1eL',
@@ -32,7 +31,6 @@ const subscriptionResponseMock = {
32
31
  // },
33
32
  // },
34
33
  // ],
35
-
36
34
  };
37
35
  exports.subscriptionResponseMock = subscriptionResponseMock;
38
36
  const planResponseMock = [{
@@ -6,14 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.SubscriptionStatus = exports.SubscriptionCancellationPolicy = exports.PaymentProvider = void 0;
7
7
  let PaymentProvider;
8
8
  exports.PaymentProvider = PaymentProvider;
9
-
10
9
  (function (PaymentProvider) {
11
10
  PaymentProvider["STRIPE"] = "Stripe";
12
11
  })(PaymentProvider || (exports.PaymentProvider = PaymentProvider = {}));
13
-
14
12
  let SubscriptionStatus;
15
13
  exports.SubscriptionStatus = SubscriptionStatus;
16
-
17
14
  (function (SubscriptionStatus) {
18
15
  SubscriptionStatus["ACTIVE"] = "ACTIVE";
19
16
  SubscriptionStatus["CANCELED"] = "CANCELED";
@@ -21,10 +18,8 @@ exports.SubscriptionStatus = SubscriptionStatus;
21
18
  SubscriptionStatus["EXPIRED"] = "EXPIRED";
22
19
  SubscriptionStatus["TRIALING"] = "TRIALING";
23
20
  })(SubscriptionStatus || (exports.SubscriptionStatus = SubscriptionStatus = {}));
24
-
25
21
  let SubscriptionCancellationPolicy;
26
22
  exports.SubscriptionCancellationPolicy = SubscriptionCancellationPolicy;
27
-
28
23
  (function (SubscriptionCancellationPolicy) {
29
24
  SubscriptionCancellationPolicy["AT_PERIOD_END"] = "atPeriodEnd";
30
25
  })(SubscriptionCancellationPolicy || (exports.SubscriptionCancellationPolicy = SubscriptionCancellationPolicy = {}));
@@ -48,15 +48,10 @@ Object.defineProperty(exports, "subscriptionsStoreName", {
48
48
  return _constants.subscriptionsStoreName;
49
49
  }
50
50
  });
51
-
52
51
  var _constants = require("../constants");
53
-
54
52
  var _reducer = require("./reducer");
55
-
56
53
  var _saga = require("./saga");
57
-
58
54
  var _interfaces = require("./interfaces");
59
-
60
55
  Object.keys(_interfaces).forEach(function (key) {
61
56
  if (key === "default" || key === "__esModule") return;
62
57
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _general = require("./general.interfaces");
8
-
9
7
  Object.keys(_general).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _general[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_general).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _interfaces = require("./Checkout/interfaces");
21
-
22
18
  Object.keys(_interfaces).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _interfaces[key]) return;
@@ -29,9 +25,7 @@ Object.keys(_interfaces).forEach(function (key) {
29
25
  }
30
26
  });
31
27
  });
32
-
33
28
  var _interfaces2 = require("./Billing/interfaces");
34
-
35
29
  Object.keys(_interfaces2).forEach(function (key) {
36
30
  if (key === "default" || key === "__esModule") return;
37
31
  if (key in exports && exports[key] === _interfaces2[key]) return;
@@ -42,9 +36,7 @@ Object.keys(_interfaces2).forEach(function (key) {
42
36
  }
43
37
  });
44
38
  });
45
-
46
39
  var _interfaces3 = require("./Plans/interfaces");
47
-
48
40
  Object.keys(_interfaces3).forEach(function (key) {
49
41
  if (key === "default" || key === "__esModule") return;
50
42
  if (key in exports && exports[key] === _interfaces3[key]) return;
@@ -55,9 +47,7 @@ Object.keys(_interfaces3).forEach(function (key) {
55
47
  }
56
48
  });
57
49
  });
58
-
59
50
  var _interfaces4 = require("./Config/interfaces");
60
-
61
51
  Object.keys(_interfaces4).forEach(function (key) {
62
52
  if (key === "default" || key === "__esModule") return;
63
53
  if (key in exports && exports[key] === _interfaces4[key]) return;
@@ -68,9 +58,7 @@ Object.keys(_interfaces4).forEach(function (key) {
68
58
  }
69
59
  });
70
60
  });
71
-
72
61
  var _interfaces5 = require("./Stripe/interfaces");
73
-
74
62
  Object.keys(_interfaces5).forEach(function (key) {
75
63
  if (key === "default" || key === "__esModule") return;
76
64
  if (key in exports && exports[key] === _interfaces5[key]) return;
@@ -81,9 +69,7 @@ Object.keys(_interfaces5).forEach(function (key) {
81
69
  }
82
70
  });
83
71
  });
84
-
85
72
  var _interfaces6 = require("./VendorPublicConfig/interfaces");
86
-
87
73
  Object.keys(_interfaces6).forEach(function (key) {
88
74
  if (key === "default" || key === "__esModule") return;
89
75
  if (key in exports && exports[key] === _interfaces6[key]) return;
@@ -7,15 +7,11 @@ exports.toApiPaymentProviderType = toApiPaymentProviderType;
7
7
  exports.toSubscriptionCancellation = toSubscriptionCancellation;
8
8
  exports.toSubscriptionCancellationPolicy = toSubscriptionCancellationPolicy;
9
9
  exports.toSubscriptionStatus = toSubscriptionStatus;
10
-
11
10
  var _restApi = require("@frontegg/rest-api");
12
-
13
11
  var _general = require("./general.interfaces");
14
-
15
12
  function toApiPaymentProviderType(paymentProvider) {
16
13
  return _restApi.ProviderType.Stripe;
17
14
  }
18
-
19
15
  function toSubscriptionCancellation({
20
16
  policy
21
17
  }) {
@@ -23,28 +19,21 @@ function toSubscriptionCancellation({
23
19
  policy: toSubscriptionCancellationPolicy(policy)
24
20
  };
25
21
  }
26
-
27
22
  function toSubscriptionCancellationPolicy(policy) {
28
23
  return _general.SubscriptionCancellationPolicy.AT_PERIOD_END;
29
24
  }
30
-
31
25
  function toSubscriptionStatus(status) {
32
26
  switch (status) {
33
27
  case _restApi.ISubscriptionStatus.ACTIVE:
34
28
  return _general.SubscriptionStatus.ACTIVE;
35
-
36
29
  case _restApi.ISubscriptionStatus.INCOMPLETE:
37
30
  return _general.SubscriptionStatus.INCOMPLETE;
38
-
39
31
  case _restApi.ISubscriptionStatus.CANCELED:
40
32
  return _general.SubscriptionStatus.CANCELED;
41
-
42
33
  case _restApi.ISubscriptionStatus.EXPIRED:
43
34
  return _general.SubscriptionStatus.EXPIRED;
44
-
45
35
  case _restApi.ISubscriptionStatus.TRIALING:
46
36
  return _general.SubscriptionStatus.TRIALING;
47
-
48
37
  default:
49
38
  return _general.SubscriptionStatus.EXPIRED;
50
39
  }
@@ -11,23 +11,14 @@ Object.defineProperty(exports, "name", {
11
11
  }
12
12
  });
13
13
  exports.reducer = void 0;
14
-
15
14
  var _toolkit = require("@reduxjs/toolkit");
16
-
17
15
  var _constants = require("../constants");
18
-
19
16
  var _Plans = require("./Plans");
20
-
21
17
  var _Config = require("./Config");
22
-
23
18
  var _Billing = require("./Billing");
24
-
25
19
  var _Checkout = require("./Checkout");
26
-
27
20
  var _Stripe = require("./Stripe");
28
-
29
21
  var _VendorPublicConfig = require("./VendorPublicConfig");
30
-
31
22
  const initialState = {
32
23
  config: _Config.configInitialState,
33
24
  plans: _Plans.plansInitialState,
@@ -5,25 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.mockSagas = mockSagas;
7
7
  exports.sagas = sagas;
8
-
9
8
  var _effects = require("redux-saga/effects");
10
-
11
9
  var _saga = require("./Billing/saga");
12
-
13
10
  var _saga2 = require("./Checkout/saga");
14
-
15
11
  var _saga3 = require("./Plans/saga");
16
-
17
12
  var _saga4 = require("./Config/saga");
18
-
19
13
  var _saga5 = require("./Stripe/saga");
20
-
21
14
  var _saga6 = require("./VendorPublicConfig/saga");
22
-
23
15
  function* sagas() {
24
16
  yield (0, _effects.all)([(0, _effects.call)(_saga.billingSagas), (0, _effects.call)(_saga2.checkoutSagas), (0, _effects.call)(_saga3.plansSagas), (0, _effects.call)(_saga4.configSagas), (0, _effects.call)(_saga5.subscriptionStripeSagas), (0, _effects.call)(_saga6.vendorPublicConfigSagas)]);
25
17
  }
26
-
27
18
  function* mockSagas() {
28
19
  yield (0, _effects.all)([(0, _effects.call)(_saga.billingSagasMock), (0, _effects.call)(_saga2.checkoutSagasMock), (0, _effects.call)(_saga3.plansSagasMock), (0, _effects.call)(_saga4.configSagasMock), (0, _effects.call)(_saga6.vendorPublicConfigSagasMock)]);
29
20
  }
@@ -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
  });
@@ -9,9 +8,7 @@ exports.createKeyCaseErrorReducer = createKeyCaseErrorReducer;
9
8
  exports.createKeyCaseLoadingReducer = createKeyCaseLoadingReducer;
10
9
  exports.createKeyCaseReducer = createKeyCaseReducer;
11
10
  exports.createModuleCaseReducers = createModuleCaseReducers;
12
-
13
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
-
15
12
  function createModuleCaseReducers() {
16
13
  return {
17
14
  setLoading: {
@@ -42,7 +39,6 @@ function createModuleCaseReducers() {
42
39
  }
43
40
  };
44
41
  }
45
-
46
42
  function createKeyCaseReducer(key, setState) {
47
43
  return {
48
44
  prepare: payload => ({
@@ -53,13 +49,11 @@ function createKeyCaseReducer(key, setState) {
53
49
  })
54
50
  };
55
51
  }
56
-
57
52
  function createKeyCaseLoadingReducer(key) {
58
53
  return createKeyCaseReducer(key, (state, action) => (0, _extends2.default)({}, state, {
59
54
  loading: action.payload
60
55
  }));
61
56
  }
62
-
63
57
  function createKeyCaseErrorReducer(key) {
64
58
  return createKeyCaseReducer(key, (state, action) => (0, _extends2.default)({}, state, {
65
59
  error: action.payload,
@@ -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
  });
@@ -16,31 +15,18 @@ Object.defineProperty(exports, "bindActionCreators", {
16
15
  }
17
16
  });
18
17
  exports.createFronteggStore = void 0;
19
-
20
18
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
21
-
22
19
  var _auth = _interopRequireWildcard(require("../auth"));
23
-
24
20
  var _toolkit = require("@reduxjs/toolkit");
25
-
26
21
  var _reduxSaga = _interopRequireDefault(require("redux-saga"));
27
-
28
22
  var _effects = require("redux-saga/effects");
29
-
30
23
  var _restApi = require("@frontegg/rest-api");
31
-
32
24
  var _audits = _interopRequireDefault(require("../audits"));
33
-
34
25
  var oldAuditsStore = _interopRequireWildcard(require("../audits/backward-compatibility"));
35
-
36
26
  var _connectivity = _interopRequireDefault(require("../connectivity"));
37
-
38
27
  var _subscriptions = _interopRequireDefault(require("../subscriptions"));
39
-
40
28
  var _vendor = _interopRequireDefault(require("../vendor"));
41
-
42
29
  var _redux = require("./redux");
43
-
44
30
  Object.keys(_redux).forEach(function (key) {
45
31
  if (key === "default" || key === "__esModule") return;
46
32
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -52,9 +38,7 @@ Object.keys(_redux).forEach(function (key) {
52
38
  }
53
39
  });
54
40
  });
55
-
56
41
  var _reduxSaga2 = require("./redux-saga");
57
-
58
42
  Object.keys(_reduxSaga2).forEach(function (key) {
59
43
  if (key === "default" || key === "__esModule") return;
60
44
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -66,11 +50,8 @@ Object.keys(_reduxSaga2).forEach(function (key) {
66
50
  }
67
51
  });
68
52
  });
69
-
70
53
  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); }
71
-
72
54
  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; }
73
-
74
55
  const initialState = {
75
56
  context: undefined,
76
57
  urlStrategy: 'path',
@@ -90,7 +71,6 @@ const {
90
71
  payload
91
72
  }) => {
92
73
  _restApi.ContextHolder.setContext(payload);
93
-
94
74
  return (0, _extends2.default)({}, state, {
95
75
  context: payload
96
76
  });
@@ -98,26 +78,20 @@ const {
98
78
  }
99
79
  }
100
80
  });
101
-
102
81
  const createFronteggStore = (rootInitialState, storeHolder, previewMode = false, authInitialState, overrideInitialState, builderMode = false, urlStrategy = 'path') => {
103
82
  const isSSR = typeof window === 'undefined';
104
83
  let holder = storeHolder;
105
-
106
84
  if (isSSR && storeHolder == null) {
107
85
  throw Error('createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering');
108
86
  }
109
-
110
87
  if (!holder) {
111
88
  holder = window;
112
89
  }
113
-
114
90
  if (!holder.store) {
115
91
  var _overrideInitialState, _authInitialState$rou, _overrideInitialState2, _overrideInitialState3, _overrideInitialState4, _overrideInitialState5, _overrideInitialState6, _overrideInitialState7, _overrideInitialState8, _overrideInitialState9;
116
-
117
92
  if (!previewMode && !builderMode) {
118
93
  _restApi.ContextHolder.setContext(rootInitialState.context);
119
94
  }
120
-
121
95
  const sagaMiddleware = (0, _reduxSaga.default)();
122
96
  const middleware = [...(0, _toolkit.getDefaultMiddleware)({
123
97
  thunk: false,
@@ -154,15 +128,12 @@ const createFronteggStore = (rootInitialState, storeHolder, previewMode = false,
154
128
  [_vendor.default.storeName]: _vendor.default.reducer
155
129
  })
156
130
  });
157
-
158
131
  const rootSaga = function* () {
159
132
  yield (0, _effects.all)([(0, _effects.call)(_auth.default.sagas), (0, _effects.call)(_audits.default.sagas), (0, _effects.call)(oldAuditsStore.sagas), (0, _effects.call)(_connectivity.default.sagas), (0, _effects.call)(_subscriptions.default.sagas), (0, _effects.call)(_vendor.default.sagas)]);
160
133
  };
161
-
162
134
  const rootMockSaga = function* () {
163
135
  yield (0, _effects.all)([(0, _effects.call)(_auth.default.mockSagas), (0, _effects.call)(_audits.default.mockSagas), (0, _effects.call)(_subscriptions.default.mockSagas)]);
164
136
  };
165
-
166
137
  if (previewMode) {
167
138
  holder.store.destroy = sagaMiddleware.run(rootMockSaga).cancel;
168
139
  holder.store.dispatch(_auth.authActions.requestAuthorize(true));
@@ -170,8 +141,6 @@ const createFronteggStore = (rootInitialState, storeHolder, previewMode = false,
170
141
  holder.store.destroy = sagaMiddleware.run(rootSaga).cancel;
171
142
  }
172
143
  }
173
-
174
144
  return holder.store;
175
145
  };
176
-
177
146
  exports.createFronteggStore = createFronteggStore;