@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
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mfaState = exports.mfaReducers = exports.mfaActions = void 0;
7
-
8
7
  var _toolkit = require("@reduxjs/toolkit");
9
-
10
8
  var _interfaces = require("./interfaces");
11
-
12
9
  var _utils = require("../utils");
13
-
14
10
  var _constants = require("../../constants");
15
-
16
11
  const mfaState = {
17
12
  step: _interfaces.MFAStep.verify,
18
13
  loading: false,
@@ -64,14 +59,13 @@ const actions = {
64
59
  payload
65
60
  }))
66
61
  };
62
+
67
63
  /**
68
64
  * To be used for actions types after dispatch, and should contains
69
65
  * the reducers and actions as standalone function
70
66
  */
71
-
72
67
  exports.mfaActions = actions;
73
68
  // noinspection JSUnusedLocalSymbols
74
-
75
69
  /**
76
70
  * if you see error in matcher that's mean the DispatchAction does not
77
71
  * contains the same functions in reducers and actions
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.MFAStep = void 0;
7
7
  let MFAStep;
8
8
  exports.MFAStep = MFAStep;
9
-
10
9
  (function (MFAStep) {
11
10
  MFAStep["verify"] = "verify";
12
11
  MFAStep["recoveryCode"] = "recoveryCode";
@@ -1,41 +1,30 @@
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.mfaSagas = mfaSagas;
9
8
  exports.mfaSagasMock = mfaSagasMock;
10
-
11
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
-
13
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
14
-
15
11
  var _effects = require("redux-saga/effects");
16
-
17
12
  var _restApi = require("@frontegg/rest-api");
18
-
19
13
  var _reducer = require("../reducer");
20
-
21
14
  var _interfaces = require("./interfaces");
22
-
23
15
  var _utils = require("../utils");
24
-
25
16
  var _dummy = require("../dummy");
26
-
27
17
  const _excluded = ["callback"],
28
- _excluded2 = ["callback"],
29
- _excluded3 = ["callback"],
30
- _excluded4 = ["deviceId", "callback"],
31
- _excluded5 = ["deviceId", "callback"],
32
- _excluded6 = ["callback"],
33
- _excluded7 = ["deviceId"],
34
- _excluded8 = ["deviceId"],
35
- _excluded9 = ["callback"],
36
- _excluded10 = ["deviceId"],
37
- _excluded11 = ["callback"];
38
-
18
+ _excluded2 = ["callback"],
19
+ _excluded3 = ["callback"],
20
+ _excluded4 = ["deviceId", "callback"],
21
+ _excluded5 = ["deviceId", "callback"],
22
+ _excluded6 = ["callback"],
23
+ _excluded7 = ["deviceId"],
24
+ _excluded8 = ["deviceId"],
25
+ _excluded9 = ["callback"],
26
+ _excluded10 = ["deviceId"],
27
+ _excluded11 = ["callback"];
39
28
  function* getMfaStateAfterEnroll(res) {
40
29
  const {
41
30
  step
@@ -49,12 +38,10 @@ function* getMfaStateAfterEnroll(res) {
49
38
  };
50
39
  return mfaState;
51
40
  }
52
-
53
41
  function* enrollMfa() {
54
42
  yield (0, _effects.put)(_reducer.actions.setMfaState({
55
43
  saving: true
56
44
  }));
57
-
58
45
  try {
59
46
  const {
60
47
  qrCode
@@ -71,18 +58,16 @@ function* enrollMfa() {
71
58
  }));
72
59
  }
73
60
  }
74
-
75
61
  function* verifyMfa(_ref) {
76
62
  let {
77
- payload: {
78
- callback
79
- }
80
- } = _ref,
81
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref.payload, _excluded);
63
+ payload: {
64
+ callback
65
+ }
66
+ } = _ref,
67
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref.payload, _excluded);
82
68
  yield (0, _effects.put)(_reducer.actions.setMfaState({
83
69
  saving: true
84
70
  }));
85
-
86
71
  try {
87
72
  const user = yield (0, _effects.select)(state => state.auth.user);
88
73
  const data = yield (0, _effects.call)(_restApi.api.auth.verifyMfa, payload);
@@ -103,18 +88,16 @@ function* verifyMfa(_ref) {
103
88
  callback == null ? void 0 : callback(null, e);
104
89
  }
105
90
  }
106
-
107
91
  function* verifyMfaAfterForce(_ref2) {
108
92
  let {
109
- payload: {
110
- callback
111
- }
112
- } = _ref2,
113
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded2);
93
+ payload: {
94
+ callback
95
+ }
96
+ } = _ref2,
97
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded2);
114
98
  yield (0, _effects.put)(_reducer.actions.setMfaState({
115
99
  loading: true
116
100
  }));
117
-
118
101
  try {
119
102
  const user = yield (0, _effects.call)(_restApi.api.auth.loginWithMfa, payload);
120
103
  const mfaState = {
@@ -123,11 +106,9 @@ function* verifyMfaAfterForce(_ref2) {
123
106
  saving: false,
124
107
  error: undefined
125
108
  };
126
-
127
109
  if (user != null && user.recoveryCode) {
128
110
  mfaState.recoveryCode = user.recoveryCode;
129
111
  }
130
-
131
112
  yield (0, _effects.put)(_reducer.actions.setMfaState(mfaState));
132
113
  yield (0, _effects.put)(_reducer.actions.setState({
133
114
  user
@@ -142,17 +123,14 @@ function* verifyMfaAfterForce(_ref2) {
142
123
  callback == null ? void 0 : callback(null, e);
143
124
  }
144
125
  }
145
-
146
126
  function* disableMfa({
147
127
  payload
148
128
  }) {
149
129
  yield (0, _effects.put)(_reducer.actions.setMfaState({
150
130
  saving: true
151
131
  }));
152
-
153
132
  try {
154
133
  var _payload$callback;
155
-
156
134
  yield (0, _effects.call)(_restApi.api.auth.disableMfa, payload);
157
135
  const mfaDevices = yield (0, _effects.call)(_restApi.api.auth.getMFADevices);
158
136
  yield (0, _effects.put)(_reducer.actions.setMfaState({
@@ -163,7 +141,6 @@ function* disableMfa({
163
141
  (_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
164
142
  } catch (e) {
165
143
  var _payload$callback2;
166
-
167
144
  yield (0, _effects.put)(_reducer.actions.setMfaState({
168
145
  saving: false,
169
146
  error: e.message
@@ -171,17 +148,14 @@ function* disableMfa({
171
148
  (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, false, e);
172
149
  }
173
150
  }
174
-
175
151
  function* preEnrollMfaWebAuthn({
176
152
  payload
177
153
  }) {
178
154
  yield (0, _effects.put)(_reducer.actions.setMfaState({
179
155
  saving: true
180
156
  }));
181
-
182
157
  try {
183
158
  var _data$options$exclude, _payload$callback3;
184
-
185
159
  const data = yield (0, _effects.call)(_restApi.api.auth.preEnrollMFAWebAuthn);
186
160
  const options = (0, _extends2.default)({}, data.options, {
187
161
  challenge: (0, _utils.base64urlDecode)(data.options.challenge),
@@ -201,7 +175,6 @@ function* preEnrollMfaWebAuthn({
201
175
  });
202
176
  } catch (e) {
203
177
  var _payload$callback4;
204
-
205
178
  yield (0, _effects.put)(_reducer.actions.setMfaState({
206
179
  saving: false,
207
180
  error: e.message
@@ -209,18 +182,16 @@ function* preEnrollMfaWebAuthn({
209
182
  (_payload$callback4 = payload.callback) == null ? void 0 : _payload$callback4.call(payload, null, e);
210
183
  }
211
184
  }
212
-
213
185
  function* enrollMfaWebAuthn(_ref3) {
214
186
  let {
215
- payload: {
216
- callback
217
- }
218
- } = _ref3,
219
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref3.payload, _excluded3);
187
+ payload: {
188
+ callback
189
+ }
190
+ } = _ref3,
191
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref3.payload, _excluded3);
220
192
  yield (0, _effects.put)(_reducer.actions.setMfaState({
221
193
  saving: true
222
194
  }));
223
-
224
195
  try {
225
196
  const publicKey = (0, _utils.publicKeyCredentialToJSON)(payload.publicKey);
226
197
  const data = yield (0, _effects.call)(_restApi.api.auth.enrollMFAWebAuthn, (0, _extends2.default)({}, payload, {
@@ -240,22 +211,19 @@ function* enrollMfaWebAuthn(_ref3) {
240
211
  callback == null ? void 0 : callback(null, e);
241
212
  }
242
213
  }
243
-
244
214
  function* preDisableMfaWebAuthn(_ref4) {
245
215
  let {
246
- payload: {
247
- deviceId,
248
- callback
249
- }
250
- } = _ref4,
251
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref4.payload, _excluded4);
216
+ payload: {
217
+ deviceId,
218
+ callback
219
+ }
220
+ } = _ref4,
221
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref4.payload, _excluded4);
252
222
  yield (0, _effects.put)(_reducer.actions.setMfaState({
253
223
  saving: true
254
224
  }));
255
-
256
225
  try {
257
226
  var _data$options$allowCr;
258
-
259
227
  const data = yield (0, _effects.call)(_restApi.api.auth.preDisableMFAWebAuthn, deviceId);
260
228
  const options = (0, _extends2.default)({}, data.options, {
261
229
  challenge: (0, _utils.base64urlDecode)(data.options.challenge),
@@ -278,19 +246,17 @@ function* preDisableMfaWebAuthn(_ref4) {
278
246
  callback == null ? void 0 : callback(null, e);
279
247
  }
280
248
  }
281
-
282
249
  function* disableMfaWebAuthn(_ref5) {
283
250
  let {
284
- payload: {
285
- deviceId,
286
- callback
287
- }
288
- } = _ref5,
289
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref5.payload, _excluded5);
251
+ payload: {
252
+ deviceId,
253
+ callback
254
+ }
255
+ } = _ref5,
256
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref5.payload, _excluded5);
290
257
  yield (0, _effects.put)(_reducer.actions.setMfaState({
291
258
  saving: true
292
259
  }));
293
-
294
260
  try {
295
261
  const publicKey = (0, _utils.publicKeyCredentialToJSON)(payload.publicKey);
296
262
  yield (0, _effects.call)(_restApi.api.auth.disableMFAWebAuthn, deviceId, (0, _extends2.default)({}, payload, {
@@ -311,17 +277,14 @@ function* disableMfaWebAuthn(_ref5) {
311
277
  callback == null ? void 0 : callback(false, e);
312
278
  }
313
279
  }
314
-
315
280
  function* preEnrollMfaSms({
316
281
  payload
317
282
  }) {
318
283
  yield (0, _effects.put)(_reducer.actions.setMfaState({
319
284
  saving: true
320
285
  }));
321
-
322
286
  try {
323
287
  var _payload$callback5;
324
-
325
288
  const res = yield (0, _effects.call)(_restApi.api.auth.preEnrollMFASMS, payload);
326
289
  yield (0, _effects.put)(_reducer.actions.setMfaState({
327
290
  saving: false,
@@ -332,7 +295,6 @@ function* preEnrollMfaSms({
332
295
  (_payload$callback5 = payload.callback) == null ? void 0 : _payload$callback5.call(payload, true);
333
296
  } catch (e) {
334
297
  var _payload$callback6;
335
-
336
298
  yield (0, _effects.put)(_reducer.actions.setMfaState({
337
299
  saving: false,
338
300
  error: e.message
@@ -340,18 +302,16 @@ function* preEnrollMfaSms({
340
302
  (_payload$callback6 = payload.callback) == null ? void 0 : _payload$callback6.call(payload, false, e);
341
303
  }
342
304
  }
343
-
344
305
  function* enrollMfaSms(_ref6) {
345
306
  let {
346
- payload: {
347
- callback
348
- }
349
- } = _ref6,
350
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref6.payload, _excluded6);
307
+ payload: {
308
+ callback
309
+ }
310
+ } = _ref6,
311
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref6.payload, _excluded6);
351
312
  yield (0, _effects.put)(_reducer.actions.setMfaState({
352
313
  saving: true
353
314
  }));
354
-
355
315
  try {
356
316
  const data = yield (0, _effects.call)(_restApi.api.auth.enrollMFASMS, payload);
357
317
  const mfaDevices = yield (0, _effects.call)(_restApi.api.auth.getMFADevices);
@@ -368,21 +328,18 @@ function* enrollMfaSms(_ref6) {
368
328
  callback == null ? void 0 : callback(null, e);
369
329
  }
370
330
  }
371
-
372
331
  function* preDisableMfaSms(_ref7) {
373
332
  let {
374
- payload: {
375
- deviceId
376
- }
377
- } = _ref7,
378
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref7.payload, _excluded7);
333
+ payload: {
334
+ deviceId
335
+ }
336
+ } = _ref7,
337
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref7.payload, _excluded7);
379
338
  yield (0, _effects.put)(_reducer.actions.setMfaState({
380
339
  saving: true
381
340
  }));
382
-
383
341
  try {
384
342
  var _payload$callback7;
385
-
386
343
  const res = yield (0, _effects.call)(_restApi.api.auth.preDisableMFASMS, deviceId);
387
344
  yield (0, _effects.put)(_reducer.actions.setMfaState({
388
345
  saving: false,
@@ -393,7 +350,6 @@ function* preDisableMfaSms(_ref7) {
393
350
  (_payload$callback7 = payload.callback) == null ? void 0 : _payload$callback7.call(payload, true);
394
351
  } catch (e) {
395
352
  var _payload$callback8;
396
-
397
353
  yield (0, _effects.put)(_reducer.actions.setMfaState({
398
354
  saving: false,
399
355
  error: e.message
@@ -401,21 +357,18 @@ function* preDisableMfaSms(_ref7) {
401
357
  (_payload$callback8 = payload.callback) == null ? void 0 : _payload$callback8.call(payload, false, e);
402
358
  }
403
359
  }
404
-
405
360
  function* disableMfaSms(_ref8) {
406
361
  let {
407
- payload: {
408
- deviceId
409
- }
410
- } = _ref8,
411
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref8.payload, _excluded8);
362
+ payload: {
363
+ deviceId
364
+ }
365
+ } = _ref8,
366
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref8.payload, _excluded8);
412
367
  yield (0, _effects.put)(_reducer.actions.setMfaState({
413
368
  saving: true
414
369
  }));
415
-
416
370
  try {
417
371
  var _payload$callback9;
418
-
419
372
  yield (0, _effects.call)(_restApi.api.auth.disableMFASMS, deviceId, payload);
420
373
  const mfaDevices = yield (0, _effects.call)(_restApi.api.auth.getMFADevices);
421
374
  yield (0, _effects.put)(_reducer.actions.setMfaState({
@@ -426,7 +379,6 @@ function* disableMfaSms(_ref8) {
426
379
  (_payload$callback9 = payload.callback) == null ? void 0 : _payload$callback9.call(payload, true);
427
380
  } catch (e) {
428
381
  var _payload$callback10;
429
-
430
382
  yield (0, _effects.put)(_reducer.actions.setMfaState({
431
383
  saving: false,
432
384
  error: e.message
@@ -434,12 +386,10 @@ function* disableMfaSms(_ref8) {
434
386
  (_payload$callback10 = payload.callback) == null ? void 0 : _payload$callback10.call(payload, false, e);
435
387
  }
436
388
  }
437
-
438
389
  function* getMFADevices() {
439
390
  yield (0, _effects.put)(_reducer.actions.setMfaState({
440
391
  loading: true
441
392
  }));
442
-
443
393
  try {
444
394
  const user = yield (0, _effects.select)(state => state.auth.user);
445
395
  const mfaDevices = yield (0, _effects.call)(_restApi.api.auth.getMFADevices);
@@ -455,12 +405,10 @@ function* getMFADevices() {
455
405
  }));
456
406
  }
457
407
  }
458
-
459
408
  function* getMFAStrategies() {
460
409
  yield (0, _effects.put)(_reducer.actions.setMfaState({
461
410
  loading: true
462
411
  }));
463
-
464
412
  try {
465
413
  const res = yield (0, _effects.call)(_restApi.api.auth.getMFAStrategiesConfig);
466
414
  const mfaStrategies = res.strategies.filter(({
@@ -480,7 +428,6 @@ function* getMFAStrategies() {
480
428
  }));
481
429
  }
482
430
  }
483
-
484
431
  function* mfaSagas() {
485
432
  yield (0, _effects.takeEvery)(_reducer.actions.enrollMfa, enrollMfa);
486
433
  yield (0, _effects.takeEvery)(_reducer.actions.getMFADevices, getMFADevices);
@@ -497,11 +444,11 @@ function* mfaSagas() {
497
444
  yield (0, _effects.takeEvery)(_reducer.actions.preDisableMfaWebAuthn, preDisableMfaWebAuthn);
498
445
  yield (0, _effects.takeEvery)(_reducer.actions.disableMfaWebAuthn, disableMfaWebAuthn);
499
446
  }
447
+
500
448
  /*********************************
501
449
  * Preview Sagas
502
450
  *********************************/
503
451
 
504
-
505
452
  function* enrollMfaMock() {
506
453
  yield (0, _effects.put)(_reducer.actions.setMfaState({
507
454
  saving: true
@@ -513,7 +460,6 @@ function* enrollMfaMock() {
513
460
  qrCode
514
461
  }));
515
462
  }
516
-
517
463
  function* verifyMfaMock({
518
464
  payload: {
519
465
  callback
@@ -545,25 +491,22 @@ function* verifyMfaMock({
545
491
  }]
546
492
  })
547
493
  };
548
-
549
494
  if (data != null && data.recoveryCode) {
550
495
  mfaState.recoveryCode = data.recoveryCode;
551
496
  }
552
-
553
497
  yield (0, _effects.put)(_reducer.actions.setMfaState(mfaState));
554
498
  yield (0, _effects.put)(_reducer.actions.setUser((0, _extends2.default)({}, _dummy.userDemo, {
555
499
  mfaEnrolled: true
556
500
  })));
557
501
  callback == null ? void 0 : callback(mfaState.recoveryCode);
558
502
  }
559
-
560
503
  function* verifyMfaAfterForceMock(_ref9) {
561
504
  let {
562
- payload: {
563
- callback
564
- }
565
- } = _ref9,
566
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref9.payload, _excluded9);
505
+ payload: {
506
+ callback
507
+ }
508
+ } = _ref9,
509
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref9.payload, _excluded9);
567
510
  yield (0, _effects.put)(_reducer.actions.setMfaState({
568
511
  loading: true
569
512
  }));
@@ -577,11 +520,9 @@ function* verifyMfaAfterForceMock(_ref9) {
577
520
  error: undefined,
578
521
  saving: false
579
522
  };
580
-
581
523
  if (data != null && data.recoveryCode) {
582
524
  mfaState.recoveryCode = data.recoveryCode;
583
525
  }
584
-
585
526
  yield (0, _effects.put)(_reducer.actions.setMfaState(mfaState));
586
527
  yield (0, _utils.delay)();
587
528
  yield (0, _effects.put)(_reducer.actions.setUser((0, _extends2.default)({}, _dummy.userDemo, {
@@ -589,12 +530,10 @@ function* verifyMfaAfterForceMock(_ref9) {
589
530
  })));
590
531
  callback == null ? void 0 : callback(mfaState.recoveryCode);
591
532
  }
592
-
593
533
  function* disableMfaMock({
594
534
  payload
595
535
  }) {
596
536
  var _payload$callback11;
597
-
598
537
  const {
599
538
  mfaDevices = {
600
539
  webauthn: [],
@@ -616,17 +555,14 @@ function* disableMfaMock({
616
555
  yield (0, _effects.put)(_reducer.actions.setUser((0, _extends2.default)({}, _dummy.userDemo)));
617
556
  (_payload$callback11 = payload.callback) == null ? void 0 : _payload$callback11.call(payload, true);
618
557
  }
619
-
620
558
  function* preDisableMfaSmsMock(_ref10) {
621
559
  let {} = _ref10,
622
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref10.payload, _excluded10);
560
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref10.payload, _excluded10);
623
561
  yield (0, _effects.put)(_reducer.actions.setMfaState({
624
562
  saving: true
625
563
  }));
626
-
627
564
  try {
628
565
  var _payload$callback12;
629
-
630
566
  yield (0, _effects.put)(_reducer.actions.setMfaState({
631
567
  saving: false,
632
568
  error: undefined,
@@ -636,7 +572,6 @@ function* preDisableMfaSmsMock(_ref10) {
636
572
  (_payload$callback12 = payload.callback) == null ? void 0 : _payload$callback12.call(payload, true);
637
573
  } catch (e) {
638
574
  var _payload$callback13;
639
-
640
575
  yield (0, _effects.put)(_reducer.actions.setMfaState({
641
576
  saving: false,
642
577
  error: e.message
@@ -644,12 +579,10 @@ function* preDisableMfaSmsMock(_ref10) {
644
579
  (_payload$callback13 = payload.callback) == null ? void 0 : _payload$callback13.call(payload, false, e);
645
580
  }
646
581
  }
647
-
648
582
  function* disableMfaSmsMock({
649
583
  payload
650
584
  }) {
651
585
  var _payload$callback14;
652
-
653
586
  const {
654
587
  mfaDevices = {
655
588
  webauthn: [],
@@ -671,12 +604,10 @@ function* disableMfaSmsMock({
671
604
  yield (0, _effects.put)(_reducer.actions.setUser((0, _extends2.default)({}, _dummy.userDemo)));
672
605
  (_payload$callback14 = payload.callback) == null ? void 0 : _payload$callback14.call(payload, true);
673
606
  }
674
-
675
607
  function* preEnrollMfaSmsMock({
676
608
  payload
677
609
  }) {
678
610
  var _payload$callback15;
679
-
680
611
  yield (0, _effects.put)(_reducer.actions.setMfaState({
681
612
  saving: true
682
613
  }));
@@ -689,14 +620,13 @@ function* preEnrollMfaSmsMock({
689
620
  }));
690
621
  (_payload$callback15 = payload.callback) == null ? void 0 : _payload$callback15.call(payload, true);
691
622
  }
692
-
693
623
  function* enrollMfaSmsMock(_ref11) {
694
624
  let {
695
- payload: {
696
- callback
697
- }
698
- } = _ref11,
699
- payload = (0, _objectWithoutPropertiesLoose2.default)(_ref11.payload, _excluded11);
625
+ payload: {
626
+ callback
627
+ }
628
+ } = _ref11,
629
+ payload = (0, _objectWithoutPropertiesLoose2.default)(_ref11.payload, _excluded11);
700
630
  const {
701
631
  mfaDevices = {
702
632
  webauthn: [],
@@ -724,18 +654,15 @@ function* enrollMfaSmsMock(_ref11) {
724
654
  }]
725
655
  })
726
656
  };
727
-
728
657
  if (data != null && data.recoveryCode) {
729
658
  mfaState.recoveryCode = data.recoveryCode;
730
659
  }
731
-
732
660
  yield (0, _effects.put)(_reducer.actions.setMfaState(mfaState));
733
661
  yield (0, _effects.put)(_reducer.actions.setUser((0, _extends2.default)({}, _dummy.userDemo, {
734
662
  mfaEnrolled: true
735
663
  })));
736
664
  callback == null ? void 0 : callback(mfaState.recoveryCode);
737
665
  }
738
-
739
666
  function* mfaSagasMock() {
740
667
  yield (0, _effects.takeEvery)(_reducer.actions.enrollMfa, enrollMfaMock);
741
668
  yield (0, _effects.takeEvery)(_reducer.actions.verifyMfa, verifyMfaMock);
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.profileState = exports.profileReducers = exports.profileActions = void 0;
7
-
8
7
  var _toolkit = require("@reduxjs/toolkit");
9
-
10
8
  var _utils = require("../utils");
11
-
12
9
  var _constants = require("../../constants");
13
-
14
10
  const profileState = {
15
11
  loading: false,
16
12
  error: null
@@ -32,14 +28,13 @@ const actions = {
32
28
  payload
33
29
  }))
34
30
  };
31
+
35
32
  /**
36
33
  * To be used for actions types after dispatch, and should contains
37
34
  * the reducers and actions as standalone function
38
35
  */
39
-
40
36
  exports.profileActions = actions;
41
37
  // noinspection JSUnusedLocalSymbols
42
-
43
38
  /**
44
39
  * if you see error in matcher that's mean the DispatchAction does not
45
40
  * contains the same functions in reducers and actions