@frontegg/redux-store 7.96.0 → 7.98.0-alpha.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.
@@ -4,6 +4,7 @@ import { PasswordRecoveryStrategyEnum } from '@frontegg/rest-api';
4
4
  import { ForgotPasswordStep } from './interfaces';
5
5
  import { initialState } from './state';
6
6
  import { errorHandler, deepResetState } from '../../helpers';
7
+ import { FORGOT_PASSWORD_ERROR_KEYS } from './consts';
7
8
  export default ((store, api, sharedActions) => {
8
9
  const actions = sharedActions;
9
10
  const loadPasswordRecoveryStrategies = async () => {
@@ -46,7 +47,7 @@ export default ((store, api, sharedActions) => {
46
47
  var _payload$callback2;
47
48
  setForgotPasswordState({
48
49
  loading: false,
49
- error: errorHandler(e, 'Unknown error occurred')
50
+ error: errorHandler(e, FORGOT_PASSWORD_ERROR_KEYS.UNKNOWN_ERROR)
50
51
  });
51
52
  (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, false, e);
52
53
  }
@@ -72,7 +73,7 @@ export default ((store, api, sharedActions) => {
72
73
  } catch (e) {
73
74
  setForgotPasswordState({
74
75
  loading: false,
75
- error: errorHandler(e, 'An error occurred while sending recovery email')
76
+ error: errorHandler(e, FORGOT_PASSWORD_ERROR_KEYS.SENDING_RECOVERY_EMAIL_ERROR)
76
77
  });
77
78
  }
78
79
  };
@@ -97,7 +98,7 @@ export default ((store, api, sharedActions) => {
97
98
  } catch (e) {
98
99
  setForgotPasswordState({
99
100
  loading: false,
100
- error: errorHandler(e, 'An error occurred while sending recovery sms')
101
+ error: errorHandler(e, FORGOT_PASSWORD_ERROR_KEYS.SENDING_RECOVERY_SMS_ERROR)
101
102
  });
102
103
  }
103
104
  };
@@ -106,10 +107,9 @@ export default ((store, api, sharedActions) => {
106
107
  sessionId
107
108
  } = store.auth.forgotPasswordState;
108
109
  if (!sessionId) {
109
- const error = 'Session ID not found in state for verifying password via sms.';
110
110
  setForgotPasswordState({
111
111
  loading: false,
112
- error
112
+ error: FORGOT_PASSWORD_ERROR_KEYS.SESSION_ID_NOT_FOUND
113
113
  });
114
114
  return;
115
115
  }
@@ -122,8 +122,7 @@ export default ((store, api, sharedActions) => {
122
122
  sessionId
123
123
  });
124
124
  if (!response.userId || !response.token) {
125
- const error = 'Invalid response from server: missing userId or token';
126
- throw new Error(error);
125
+ throw new Error(FORGOT_PASSWORD_ERROR_KEYS.INVALID_SERVER_RESPONSE);
127
126
  }
128
127
  setForgotPasswordState({
129
128
  loading: false,
@@ -135,7 +134,7 @@ export default ((store, api, sharedActions) => {
135
134
  } catch (e) {
136
135
  setForgotPasswordState({
137
136
  loading: false,
138
- error: errorHandler(e, 'An error occurred while verifying password via sms')
137
+ error: errorHandler(e, FORGOT_PASSWORD_ERROR_KEYS.VERIFYING_SMS_ERROR)
139
138
  });
140
139
  }
141
140
  };
@@ -165,17 +164,16 @@ export default ((store, api, sharedActions) => {
165
164
  activeStrategies: strategies
166
165
  });
167
166
  } else {
168
- const error = 'No active password recovery methods found.';
169
167
  setForgotPasswordState({
170
168
  loading: false,
171
- error,
169
+ error: FORGOT_PASSWORD_ERROR_KEYS.NO_ACTIVE_RECOVERY_METHODS,
172
170
  activeStrategies: strategies
173
171
  });
174
172
  }
175
173
  } catch (e) {
176
174
  setForgotPasswordState({
177
175
  loading: false,
178
- error: errorHandler(e, 'An error occurred while determining recovery strategy')
176
+ error: errorHandler(e, FORGOT_PASSWORD_ERROR_KEYS.DETERMINING_RECOVERY_STRATEGY_ERROR)
179
177
  });
180
178
  }
181
179
  };
@@ -0,0 +1,10 @@
1
+ export declare const FORGOT_PASSWORD_ERROR_KEYS: {
2
+ readonly UNKNOWN_ERROR: "unknownError";
3
+ readonly SENDING_RECOVERY_EMAIL_ERROR: "sendingRecoveryEmailError";
4
+ readonly SENDING_RECOVERY_SMS_ERROR: "sendingRecoverySmsError";
5
+ readonly SESSION_ID_NOT_FOUND: "sessionIdNotFound";
6
+ readonly INVALID_SERVER_RESPONSE: "invalidServerResponse";
7
+ readonly VERIFYING_SMS_ERROR: "verifyingSmsError";
8
+ readonly NO_ACTIVE_RECOVERY_METHODS: "noActiveRecoveryMethods";
9
+ readonly DETERMINING_RECOVERY_STRATEGY_ERROR: "determiningRecoveryStrategyError";
10
+ };
@@ -0,0 +1,11 @@
1
+ // Error keys for localization - these map to loginBox.forgetPassword.{key}
2
+ export const FORGOT_PASSWORD_ERROR_KEYS = {
3
+ UNKNOWN_ERROR: 'unknownError',
4
+ SENDING_RECOVERY_EMAIL_ERROR: 'sendingRecoveryEmailError',
5
+ SENDING_RECOVERY_SMS_ERROR: 'sendingRecoverySmsError',
6
+ SESSION_ID_NOT_FOUND: 'sessionIdNotFound',
7
+ INVALID_SERVER_RESPONSE: 'invalidServerResponse',
8
+ VERIFYING_SMS_ERROR: 'verifyingSmsError',
9
+ NO_ACTIVE_RECOVERY_METHODS: 'noActiveRecoveryMethods',
10
+ DETERMINING_RECOVERY_STRATEGY_ERROR: 'determiningRecoveryStrategyError'
11
+ };
@@ -1,3 +1,4 @@
1
1
  import createForgotPasswordState from './state';
2
2
  import buildForgotPasswordActions from './actions';
3
+ export { FORGOT_PASSWORD_ERROR_KEYS } from './consts';
3
4
  export { createForgotPasswordState, buildForgotPasswordActions };
@@ -1,3 +1,4 @@
1
1
  import createForgotPasswordState from './state';
2
2
  import buildForgotPasswordActions from './actions';
3
+ export { FORGOT_PASSWORD_ERROR_KEYS } from './consts';
3
4
  export { createForgotPasswordState, buildForgotPasswordActions };
package/auth/index.d.ts CHANGED
@@ -9,7 +9,8 @@ import { buildApprovalFlowActions } from './ApprovalFlowState';
9
9
  import { buildApiTokensActions } from './ApiTokensState';
10
10
  import { buildApplicationsActions } from './ApplicationsState';
11
11
  import { buildCustomLoginActions } from './CustomLoginState';
12
- import { buildForgotPasswordActions } from './ForgotPasswordState';
12
+ import { buildForgotPasswordActions, FORGOT_PASSWORD_ERROR_KEYS } from './ForgotPasswordState';
13
+ export { FORGOT_PASSWORD_ERROR_KEYS };
13
14
  import { buildPasswordRotationActions } from './PasswordRotationState';
14
15
  import { buildGroupsActions } from './GroupsState';
15
16
  import { buildGroupsDialogsActions } from './GroupsDialogsState';
package/auth/index.js CHANGED
@@ -10,7 +10,8 @@ import { buildApprovalFlowActions, createApprovalFlowState } from './ApprovalFlo
10
10
  import { buildApiTokensActions, createApiTokensState } from './ApiTokensState';
11
11
  import { buildApplicationsActions, createApplicationsState } from './ApplicationsState';
12
12
  import { buildCustomLoginActions, createCustomLoginState } from './CustomLoginState';
13
- import { buildForgotPasswordActions, createForgotPasswordState } from './ForgotPasswordState';
13
+ import { buildForgotPasswordActions, createForgotPasswordState, FORGOT_PASSWORD_ERROR_KEYS } from './ForgotPasswordState';
14
+ export { FORGOT_PASSWORD_ERROR_KEYS };
14
15
  import { buildPasswordRotationActions, createPasswordRotationState } from './PasswordRotationState';
15
16
  import { buildGroupsActions, createGroupsState } from './GroupsState';
16
17
  import { buildGroupsDialogsActions, createGroupsDialogsState } from './GroupsDialogsState';
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.96.0
1
+ /** @license Frontegg v7.98.0-alpha.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -10,6 +10,7 @@ var _restApi = require("@frontegg/rest-api");
10
10
  var _interfaces = require("./interfaces");
11
11
  var _state = require("./state");
12
12
  var _helpers = require("../../helpers");
13
+ var _consts = require("./consts");
13
14
  const _excluded = ["callback"];
14
15
  var _default = (store, api, sharedActions) => {
15
16
  const actions = sharedActions;
@@ -53,7 +54,7 @@ var _default = (store, api, sharedActions) => {
53
54
  var _payload$callback2;
54
55
  setForgotPasswordState({
55
56
  loading: false,
56
- error: (0, _helpers.errorHandler)(e, 'Unknown error occurred')
57
+ error: (0, _helpers.errorHandler)(e, _consts.FORGOT_PASSWORD_ERROR_KEYS.UNKNOWN_ERROR)
57
58
  });
58
59
  (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, false, e);
59
60
  }
@@ -79,7 +80,7 @@ var _default = (store, api, sharedActions) => {
79
80
  } catch (e) {
80
81
  setForgotPasswordState({
81
82
  loading: false,
82
- error: (0, _helpers.errorHandler)(e, 'An error occurred while sending recovery email')
83
+ error: (0, _helpers.errorHandler)(e, _consts.FORGOT_PASSWORD_ERROR_KEYS.SENDING_RECOVERY_EMAIL_ERROR)
83
84
  });
84
85
  }
85
86
  };
@@ -104,7 +105,7 @@ var _default = (store, api, sharedActions) => {
104
105
  } catch (e) {
105
106
  setForgotPasswordState({
106
107
  loading: false,
107
- error: (0, _helpers.errorHandler)(e, 'An error occurred while sending recovery sms')
108
+ error: (0, _helpers.errorHandler)(e, _consts.FORGOT_PASSWORD_ERROR_KEYS.SENDING_RECOVERY_SMS_ERROR)
108
109
  });
109
110
  }
110
111
  };
@@ -113,10 +114,9 @@ var _default = (store, api, sharedActions) => {
113
114
  sessionId
114
115
  } = store.auth.forgotPasswordState;
115
116
  if (!sessionId) {
116
- const error = 'Session ID not found in state for verifying password via sms.';
117
117
  setForgotPasswordState({
118
118
  loading: false,
119
- error
119
+ error: _consts.FORGOT_PASSWORD_ERROR_KEYS.SESSION_ID_NOT_FOUND
120
120
  });
121
121
  return;
122
122
  }
@@ -129,8 +129,7 @@ var _default = (store, api, sharedActions) => {
129
129
  sessionId
130
130
  });
131
131
  if (!response.userId || !response.token) {
132
- const error = 'Invalid response from server: missing userId or token';
133
- throw new Error(error);
132
+ throw new Error(_consts.FORGOT_PASSWORD_ERROR_KEYS.INVALID_SERVER_RESPONSE);
134
133
  }
135
134
  setForgotPasswordState({
136
135
  loading: false,
@@ -142,7 +141,7 @@ var _default = (store, api, sharedActions) => {
142
141
  } catch (e) {
143
142
  setForgotPasswordState({
144
143
  loading: false,
145
- error: (0, _helpers.errorHandler)(e, 'An error occurred while verifying password via sms')
144
+ error: (0, _helpers.errorHandler)(e, _consts.FORGOT_PASSWORD_ERROR_KEYS.VERIFYING_SMS_ERROR)
146
145
  });
147
146
  }
148
147
  };
@@ -172,17 +171,16 @@ var _default = (store, api, sharedActions) => {
172
171
  activeStrategies: strategies
173
172
  });
174
173
  } else {
175
- const error = 'No active password recovery methods found.';
176
174
  setForgotPasswordState({
177
175
  loading: false,
178
- error,
176
+ error: _consts.FORGOT_PASSWORD_ERROR_KEYS.NO_ACTIVE_RECOVERY_METHODS,
179
177
  activeStrategies: strategies
180
178
  });
181
179
  }
182
180
  } catch (e) {
183
181
  setForgotPasswordState({
184
182
  loading: false,
185
- error: (0, _helpers.errorHandler)(e, 'An error occurred while determining recovery strategy')
183
+ error: (0, _helpers.errorHandler)(e, _consts.FORGOT_PASSWORD_ERROR_KEYS.DETERMINING_RECOVERY_STRATEGY_ERROR)
186
184
  });
187
185
  }
188
186
  };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FORGOT_PASSWORD_ERROR_KEYS = void 0;
7
+ // Error keys for localization - these map to loginBox.forgetPassword.{key}
8
+ const FORGOT_PASSWORD_ERROR_KEYS = {
9
+ UNKNOWN_ERROR: 'unknownError',
10
+ SENDING_RECOVERY_EMAIL_ERROR: 'sendingRecoveryEmailError',
11
+ SENDING_RECOVERY_SMS_ERROR: 'sendingRecoverySmsError',
12
+ SESSION_ID_NOT_FOUND: 'sessionIdNotFound',
13
+ INVALID_SERVER_RESPONSE: 'invalidServerResponse',
14
+ VERIFYING_SMS_ERROR: 'verifyingSmsError',
15
+ NO_ACTIVE_RECOVERY_METHODS: 'noActiveRecoveryMethods',
16
+ DETERMINING_RECOVERY_STRATEGY_ERROR: 'determiningRecoveryStrategyError'
17
+ };
18
+ exports.FORGOT_PASSWORD_ERROR_KEYS = FORGOT_PASSWORD_ERROR_KEYS;
@@ -4,6 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ Object.defineProperty(exports, "FORGOT_PASSWORD_ERROR_KEYS", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _consts.FORGOT_PASSWORD_ERROR_KEYS;
11
+ }
12
+ });
7
13
  Object.defineProperty(exports, "buildForgotPasswordActions", {
8
14
  enumerable: true,
9
15
  get: function () {
@@ -17,4 +23,5 @@ Object.defineProperty(exports, "createForgotPasswordState", {
17
23
  }
18
24
  });
19
25
  var _state = _interopRequireDefault(require("./state"));
20
- var _actions = _interopRequireDefault(require("./actions"));
26
+ var _actions = _interopRequireDefault(require("./actions"));
27
+ var _consts = require("./consts");
@@ -6,8 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  var _exportNames = {
8
8
  createAuthState: true,
9
- buildAuthActions: true
9
+ buildAuthActions: true,
10
+ FORGOT_PASSWORD_ERROR_KEYS: true
10
11
  };
12
+ Object.defineProperty(exports, "FORGOT_PASSWORD_ERROR_KEYS", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _ForgotPasswordState.FORGOT_PASSWORD_ERROR_KEYS;
16
+ }
17
+ });
11
18
  exports.createAuthState = exports.buildAuthActions = void 0;
12
19
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
20
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.96.0
1
+ /** @license Frontegg v7.98.0-alpha.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.96.0",
3
+ "version": "7.98.0-alpha.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
9
  "@frontegg/entitlements-javascript-commons": "1.1.2",
10
- "@frontegg/rest-api": "7.96.0",
10
+ "@frontegg/rest-api": "7.98.0-alpha.0",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",