@reachfive/identity-ui 1.22.0 → 1.23.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.
package/index.d.ts CHANGED
@@ -49,13 +49,13 @@ interface I18n {
49
49
 
50
50
  interface OnReady {
51
51
  /**
52
- * Callback function called after the widget has been successfully loaded and rendered inside the container.
52
+ * Callback function called after the widget has been successfully loaded and rendered inside the container.
53
53
  * The callback is called with the widget instance.
54
54
  */
55
55
  onReady?: (arg: WidgetInstance) => void
56
56
  }
57
57
 
58
- interface OnSuccess {
58
+ interface OnSuccess {
59
59
  /** Callback function called when the request has failed. */
60
60
  onSuccess?: () => void
61
61
  }
@@ -68,7 +68,7 @@ interface OnError {
68
68
  interface Theme {
69
69
  /**
70
70
  * The options to set up to customize the appearance of the widget.
71
- *
71
+ *
72
72
  * @type Theme
73
73
  */
74
74
  theme?: ThemeOptions
@@ -112,9 +112,9 @@ export interface SocialButtonTheme {
112
112
  borderWidth?: string
113
113
  /** Boolean that specifies if there is a box shadow on the button or not. */
114
114
  focusBoxShadow?: boolean
115
- }
115
+ }
116
116
 
117
- /**
117
+ /**
118
118
  * The field's type.
119
119
  * @enum {('hidden' | 'text' | 'number' | 'email' | 'tel')}
120
120
  */
@@ -128,7 +128,7 @@ export interface Field {
128
128
  type?: FieldType
129
129
  }
130
130
 
131
- /**
131
+ /**
132
132
  * The auth type.
133
133
  * @enum {('magic_link' | 'sms')}
134
134
  */
@@ -137,44 +137,44 @@ export type AuthType = 'magic_link' | 'sms'
137
137
  export interface AuthOptions extends Container, I18n, OnReady, Theme {
138
138
  /**
139
139
  * Boolean that specifies if the forgot password option is enabled.
140
- *
140
+ *
141
141
  * If the `allowLogin` and `allowSignup` properties are set to `false`, the forgot password feature is enabled even if `allowForgotPassword` is set to `false`.
142
- *
142
+ *
143
143
  * @default true
144
144
  */
145
145
  allowForgotPassword?: boolean
146
146
 
147
147
  /**
148
148
  * Boolean that specifies whether biometric login is enabled.
149
- *
149
+ *
150
150
  * @default false
151
151
  */
152
152
  allowWebAuthnLogin?: boolean
153
153
 
154
154
  /**
155
155
  * Boolean that specifies whether biometric signup is enabled.
156
- *
156
+ *
157
157
  * @default false
158
158
  */
159
159
  allowWebAuthnSignup?: boolean
160
160
 
161
161
  /**
162
162
  * Boolean that specifies whether login is enabled.
163
- *
163
+ *
164
164
  * @default true
165
165
  */
166
166
  allowLogin?: boolean
167
167
 
168
168
  /**
169
169
  * Boolean that specifies whether signup is enabled.
170
- *
170
+ *
171
171
  * @default true
172
172
  */
173
173
 
174
174
  allowSignup?: boolean
175
175
  /**
176
176
  * Boolean that specifies whether an additional field for the custom identifier is shown.
177
- *
177
+ *
178
178
  * @default false
179
179
  */
180
180
 
@@ -185,7 +185,7 @@ export interface AuthOptions extends Container, I18n, OnReady, Theme {
185
185
 
186
186
  /**
187
187
  * Whether or not to provide the display password in clear text option.
188
- *
188
+ *
189
189
  * @default false
190
190
  */
191
191
  canShowPassword?: boolean
@@ -197,16 +197,16 @@ export interface AuthOptions extends Container, I18n, OnReady, Theme {
197
197
  countryCode?: string
198
198
 
199
199
  /**
200
- * Whether or not to display a safe error message on password reset, given an invalid email address.
200
+ * Whether or not to display a safe error message on password reset, given an invalid email address.
201
201
  * This mode ensures not to leak email addresses registered to the platform.
202
- *
202
+ *
203
203
  * @default false
204
204
  */
205
205
  displaySafeErrorMessage?: boolean
206
206
 
207
207
  /**
208
208
  * The widget’s initial screen.
209
- *
209
+ *
210
210
  * - if `allowLogin` is set to `true`, it defaults to `login`.
211
211
  * - if `allowLogin` is set to `false` and `allowSignup` is set to `true`, it defaults to `signup`.
212
212
  * - if `allowLogin` is set to `false` and `allowWebAuthnLogin` is set to `true`, it defaults to `login-with-web-authn`.
@@ -234,39 +234,39 @@ export interface AuthOptions extends Container, I18n, OnReady, Theme {
234
234
 
235
235
  /**
236
236
  * Whether the signup form fields' labels are displayed on the login view.
237
- *
237
+ *
238
238
  * @default false
239
239
  */
240
240
  showLabels?: boolean
241
241
 
242
242
  /**
243
243
  * Whether the Remember me checkbox is displayed on the login view. Affects user session duration.
244
- *
244
+ *
245
245
  * The account session duration configured in the ReachFive Console (Settings Security SSO) applies when:
246
246
  * - The checkbox is hidden from the user
247
247
  * - The checkbox is visible and selected by the user
248
- *
248
+ *
249
249
  * If the checkbox is visible and not selected by the user, the default session duration of 1 day applies.
250
- *
250
+ *
251
251
  * @default false
252
252
  */
253
253
  showRememberMe?: boolean
254
254
 
255
255
  /**
256
256
  * List of the signup fields to display in the form.
257
- *
257
+ *
258
258
  * You can pass a field as an object to override default values :
259
- *
259
+ *
260
260
  * @example
261
261
  * {
262
262
  * "key": "family_name",
263
- * "defaultValue": "Moreau",
263
+ * "defaultValue": "Moreau",
264
264
  * "required": true
265
265
  * }
266
266
  */
267
267
  signupFields?: (Field | string)[]
268
268
 
269
- /**
269
+ /**
270
270
  * Lists the available social providers. This is an array of strings.
271
271
  * Tip: If you pass an empty array, social providers will not be displayed.
272
272
  */
@@ -282,7 +282,7 @@ export interface AuthOptions extends Container, I18n, OnReady, Theme {
282
282
  export interface EmailEditorOptions extends AccessToken, Container, I18n, OnReady, Theme {
283
283
  /** The URL sent in the email to which the user is redirected. This URL must be whitelisted in the `Allowed Callback URLs` field of your ReachFive client settings. */
284
284
  redirectUrl?: string
285
-
285
+
286
286
  /**
287
287
  * Whether the signup form fields' labels are displayed on the login view.
288
288
  * @default false
@@ -296,13 +296,13 @@ export interface PasswordEditorOptions extends AccessToken, Container, I18n, OnR
296
296
  * @default false
297
297
  */
298
298
  showLabels?: boolean
299
-
299
+
300
300
  /**
301
301
  * Ask for the old password before entering a new one.
302
302
  * @default false
303
303
  */
304
304
  promptOldPassword?: boolean
305
-
305
+
306
306
  /** The URL sent in the email to which the user is redirected. This URL must be whitelisted in the Allowed Callback URLs field of your ReachFive client settings. */
307
307
  redirectUrl?: string
308
308
  }
@@ -310,13 +310,13 @@ export interface PasswordEditorOptions extends AccessToken, Container, I18n, OnR
310
310
  export interface PasswordResetOptions extends Container, OnReady, I18n, Theme {
311
311
  /** The URL to which the user is redirected after a password reset. */
312
312
  loginLink?: string
313
-
313
+
314
314
  /**
315
315
  * Whether or not to provide the display password in clear text option.
316
316
  * @default false
317
317
  */
318
318
  canShowPassword?: boolean
319
-
319
+
320
320
  /** The URL sent in the email to which the user is redirected. This URL must be whitelisted in the Allowed Callback URLs field of your ReachFive client settings. */
321
321
  redirectUrl?: string
322
322
  }
@@ -327,10 +327,10 @@ export interface PhoneNumberEditorOptions extends AccessToken, Container, OnRead
327
327
  * @default false
328
328
  */
329
329
  showLabels?: boolean
330
-
330
+
331
331
  /**
332
332
  * The [ISO country](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code useful to format phone numbers.
333
- *
333
+ *
334
334
  * Defaults to the predefined country code in your account settings or `FR`.
335
335
  */
336
336
  countryCode?: string
@@ -339,30 +339,30 @@ export interface PhoneNumberEditorOptions extends AccessToken, Container, OnRead
339
339
  export interface ProfileEditorOptions extends AccessToken, Container, OnReady, OnSuccess, OnError, I18n, Theme {
340
340
  /**
341
341
  * List of the fields to display in the form.
342
- *
342
+ *
343
343
  * **Important:**
344
- *
344
+ *
345
345
  * The following fields can not be changed with this widget:
346
346
  * - `password`
347
347
  * - `password_confirmation`
348
- *
348
+ *
349
349
  * It is not possible to update the primary identifier submitted at registration (email or phone number). When the primary identifier is the email address (SMS feature disabled), users can only enter a phone number and update without limit.
350
350
  */
351
351
  fields?: (Field | string)[]
352
-
352
+
353
353
  /**
354
354
  * Whether the signup form fields' labels are displayed on the login view.
355
355
  * @default false
356
356
  */
357
357
  showLabels?: boolean
358
-
358
+
359
359
  /**
360
360
  * The [ISO country](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code useful to format phone numbers.
361
- *
361
+ *
362
362
  * Defaults to the predefined country code in your account settings or `FR`.
363
363
  */
364
364
  countryCode?: string
365
-
365
+
366
366
  /** The URL sent in the email to which the user is redirected. This URL must be whitelisted in the `Allowed Callback URLs` field of your ReachFive client settings. */
367
367
  redirectUrl?: string
368
368
  }
@@ -370,11 +370,11 @@ export interface ProfileEditorOptions extends AccessToken, Container, OnReady, O
370
370
  export interface SocialAccountsOptions extends AccessToken, Container, I18n, OnReady, Theme {
371
371
  /**
372
372
  * Lists the available social providers. This is an array of strings.
373
- *
374
- * Tip: If you pass an empty array, social providers will not be displayed.
373
+ *
374
+ * Tip: If you pass an empty array, social providers will not be displayed.
375
375
  * */
376
376
  socialProviders?: ProviderId[]
377
-
377
+
378
378
  /** List of authentication options */
379
379
  auth?: CoreAuthOptions
380
380
  }
@@ -382,8 +382,8 @@ export interface SocialAccountsOptions extends AccessToken, Container, I18n, OnR
382
382
  export interface SocialLoginOptions extends Container, I18n, OnReady, Theme {
383
383
  /**
384
384
  * Lists the available social providers. This is an array of strings.
385
- *
386
- * Tip: If you pass an empty array, social providers will not be displayed.
385
+ *
386
+ * Tip: If you pass an empty array, social providers will not be displayed.
387
387
  * */
388
388
  socialProviders?: ProviderId[]
389
389
 
@@ -409,8 +409,8 @@ export interface PassswordlessOptions extends Container, I18n, OnReady, OnSucces
409
409
 
410
410
  /**
411
411
  * Lists the available social providers. This is an array of strings.
412
- *
413
- * Tip: If you pass an empty array, social providers will not be displayed.
412
+ *
413
+ * Tip: If you pass an empty array, social providers will not be displayed.
414
414
  */
415
415
  socialProviders?: ProviderId[]
416
416
 
@@ -422,7 +422,7 @@ export interface PassswordlessOptions extends Container, I18n, OnReady, OnSucces
422
422
 
423
423
  /**
424
424
  * The [ISO country](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code useful to format phone numbers.
425
- *
425
+ *
426
426
  * Defaults to the predefined country code in your account settings or `FR`.
427
427
  */
428
428
  countryCode?: string
@@ -454,6 +454,12 @@ export interface MfaOptions extends AccessToken, Container, I18n, OnReady, Theme
454
454
  * @default true
455
455
  */
456
456
  showRemoveMfaCredentials?: boolean
457
+
458
+ /**
459
+ * Boolean to enable (`true`) or disable (`false`) whether the option to remove MFA credentials are displayed.
460
+ * @default false
461
+ */
462
+ requireMfaRegistration?: boolean
457
463
  }
458
464
 
459
465
  export interface MfaCredentialsOptions extends AccessToken, Container, I18n, OnReady, Theme {}
@@ -467,4 +473,10 @@ export interface StepUpOptions extends AccessToken, Container, I18n, OnReady, Th
467
473
  * @default true
468
474
  */
469
475
  showIntro?: boolean
476
+
477
+ /**
478
+ * Show the stepup button. Unnecessary for console use
479
+ * @default true
480
+ */
481
+ showStepUpStart?: boolean
470
482
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reachfive/identity-ui",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "ReachFive Identity Web UI SDK",
5
5
  "author": "ReachFive",
6
6
  "repository": {
@@ -46078,6 +46078,9 @@
46078
46078
  checked: checked,
46079
46079
  name: name,
46080
46080
  onChange: onSelect,
46081
+ style: radio && {
46082
+ appearance: "radio"
46083
+ },
46081
46084
  required: required,
46082
46085
  value: value
46083
46086
  }), label);
@@ -58839,66 +58842,89 @@
58839
58842
  })];
58840
58843
  }
58841
58844
  });
58842
- var MfaStepUpView = /*#__PURE__*/function (_React$Component) {
58843
- _inherits(MfaStepUpView, _React$Component);
58844
- var _super = _createSuper(MfaStepUpView);
58845
- function MfaStepUpView() {
58845
+ var MainView = /*#__PURE__*/function (_React$Component) {
58846
+ _inherits(MainView, _React$Component);
58847
+ var _super = _createSuper(MainView);
58848
+ function MainView(props) {
58846
58849
  var _this;
58847
- _classCallCheck(this, MfaStepUpView);
58848
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
58849
- args[_key] = arguments[_key];
58850
- }
58851
- _this = _super.call.apply(_super, [this].concat(args));
58850
+ _classCallCheck(this, MainView);
58851
+ _this = _super.call(this, props);
58852
58852
  _defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function () {
58853
58853
  return _this.props.apiClient.getMfaStepUpToken({
58854
58854
  options: _this.props.auth,
58855
58855
  accessToken: _this.props.accessToken
58856
+ }).then(function (res) {
58857
+ return _this.setState({
58858
+ response: res
58859
+ });
58856
58860
  });
58857
58861
  });
58862
+ _this.state = {
58863
+ response: undefined
58864
+ };
58858
58865
  return _this;
58859
58866
  }
58860
- _createClass(MfaStepUpView, [{
58867
+ _createClass(MainView, [{
58868
+ key: "componentDidMount",
58869
+ value: function componentDidMount() {
58870
+ this.onGetStepUpToken();
58871
+ }
58872
+ }, {
58861
58873
  key: "render",
58862
58874
  value: function render() {
58863
58875
  var _this2 = this;
58864
- return /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement(StartStepUpMfaButton, {
58876
+ var _this$props = this.props,
58877
+ showStepUpStart = _this$props.showStepUpStart,
58878
+ goTo = _this$props.goTo;
58879
+ return this.state.response === undefined ? null : /*#__PURE__*/react.createElement("div", null, showStepUpStart ? /*#__PURE__*/react.createElement(StartStepUpMfaButton, {
58865
58880
  handler: this.onGetStepUpToken,
58866
- onSuccess: function onSuccess(data) {
58867
- return _this2.props.goTo('fa-selection', _objectSpread2({}, data));
58881
+ onSuccess: function onSuccess(_) {
58882
+ return goTo('fa-selection', _this2.state.response);
58868
58883
  }
58869
- }));
58884
+ }) : /*#__PURE__*/react.createElement(FaSelectionView, _extends({}, this.state.response, this.props)));
58870
58885
  }
58871
58886
  }]);
58872
- return MfaStepUpView;
58887
+ return MainView;
58873
58888
  }(react.Component);
58874
58889
  var FaSelectionView = /*#__PURE__*/function (_React$Component2) {
58875
58890
  _inherits(FaSelectionView, _React$Component2);
58876
58891
  var _super2 = _createSuper(FaSelectionView);
58877
- function FaSelectionView() {
58892
+ function FaSelectionView(props) {
58878
58893
  var _this3;
58879
58894
  _classCallCheck(this, FaSelectionView);
58880
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
58881
- args[_key2] = arguments[_key2];
58882
- }
58883
- _this3 = _super2.call.apply(_super2, [this].concat(args));
58895
+ _this3 = _super2.call(this, props);
58884
58896
  _defineProperty(_assertThisInitialized(_this3), "onChooseFa", function (factor) {
58885
58897
  return _this3.props.apiClient.startPasswordless(_objectSpread2(_objectSpread2({}, factor), {}, {
58886
58898
  stepUp: _this3.props.token
58887
- })).then(function (resp) {
58888
- return _objectSpread2(_objectSpread2({}, resp), factor);
58899
+ })).then(function (res) {
58900
+ return _this3.setState({
58901
+ response: _objectSpread2(_objectSpread2({}, res), factor)
58902
+ });
58889
58903
  });
58890
58904
  });
58905
+ _this3.state = {
58906
+ response: undefined
58907
+ };
58891
58908
  return _this3;
58892
58909
  }
58893
58910
  _createClass(FaSelectionView, [{
58911
+ key: "componentDidMount",
58912
+ value: function componentDidMount() {
58913
+ if (this.props.amr.length == 1) this.onChooseFa({
58914
+ authType: this.props.amr[0]
58915
+ });else this.setState({
58916
+ response: {}
58917
+ });
58918
+ }
58919
+ }, {
58894
58920
  key: "render",
58895
58921
  value: function render() {
58896
58922
  var _this4 = this;
58897
- var _this$props = this.props,
58898
- amr = _this$props.amr,
58899
- showIntro = _this$props.showIntro,
58900
- i18n = _this$props.i18n;
58901
- return /*#__PURE__*/react.createElement("div", null, showIntro && /*#__PURE__*/react.createElement(Intro, null, i18n('mfa.select.factor')), /*#__PURE__*/react.createElement(StartPasswordlessForm, {
58923
+ var _this$props2 = this.props,
58924
+ amr = _this$props2.amr,
58925
+ showIntro = _this$props2.showIntro,
58926
+ i18n = _this$props2.i18n;
58927
+ return this.state.response === undefined ? null : amr.length == 1 ? /*#__PURE__*/react.createElement(VerificationCodeView, _extends({}, this.state.response, this.props)) : /*#__PURE__*/react.createElement("div", null, showIntro && /*#__PURE__*/react.createElement(Intro, null, i18n('mfa.select.factor')), /*#__PURE__*/react.createElement(StartPasswordlessForm, {
58902
58928
  options: amr.map(function (factor) {
58903
58929
  return {
58904
58930
  key: factor,
@@ -58910,7 +58936,7 @@
58910
58936
  onSuccess: function onSuccess(data) {
58911
58937
  return _this4.props.goTo('verification-code', _objectSpread2(_objectSpread2({}, data), {}, {
58912
58938
  amr: amr
58913
- }));
58939
+ }, _this4.state.response));
58914
58940
  }
58915
58941
  }));
58916
58942
  }
@@ -58923,8 +58949,8 @@
58923
58949
  function VerificationCodeView() {
58924
58950
  var _this5;
58925
58951
  _classCallCheck(this, VerificationCodeView);
58926
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
58927
- args[_key3] = arguments[_key3];
58952
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
58953
+ args[_key] = arguments[_key];
58928
58954
  }
58929
58955
  _this5 = _super3.call.apply(_super3, [this].concat(args));
58930
58956
  _defineProperty(_assertThisInitialized(_this5), "handleSubmit", function (data) {
@@ -58952,15 +58978,16 @@
58952
58978
  return VerificationCodeView;
58953
58979
  }(react.Component);
58954
58980
  var mfaStepUpWidget = createMultiViewWidget({
58955
- initialView: 'mfa-step-up',
58981
+ initialView: 'main',
58956
58982
  views: {
58957
- 'mfa-step-up': MfaStepUpView,
58983
+ 'main': MainView,
58958
58984
  'fa-selection': FaSelectionView,
58959
58985
  'verification-code': VerificationCodeView
58960
58986
  },
58961
58987
  prepare: function prepare(options) {
58962
58988
  return deepDefaults({}, options, {
58963
- showIntro: true
58989
+ showIntro: true,
58990
+ showStepUpStart: true
58964
58991
  });
58965
58992
  }
58966
58993
  });
@@ -59024,7 +59051,7 @@
59024
59051
  validator: email
59025
59052
  })]
59026
59053
  });
59027
- var MainView = /*#__PURE__*/function (_React$Component) {
59054
+ var MainView$1 = /*#__PURE__*/function (_React$Component) {
59028
59055
  _inherits(MainView, _React$Component);
59029
59056
  var _super = _createSuper(MainView);
59030
59057
  function MainView() {
@@ -59076,7 +59103,7 @@
59076
59103
  var emailEditorWidget = createMultiViewWidget({
59077
59104
  initialView: 'main',
59078
59105
  views: {
59079
- main: MainView,
59106
+ main: MainView$1,
59080
59107
  success: SuccessView
59081
59108
  }
59082
59109
  });
@@ -59213,7 +59240,7 @@
59213
59240
  type: 'text'
59214
59241
  })]
59215
59242
  });
59216
- var MainView$1 = /*#__PURE__*/function (_React$Component) {
59243
+ var MainView$2 = /*#__PURE__*/function (_React$Component) {
59217
59244
  _inherits(MainView, _React$Component);
59218
59245
  var _super = _createSuper(MainView);
59219
59246
  function MainView() {
@@ -59295,12 +59322,12 @@
59295
59322
  var phoneNumberEditorWidget = createMultiViewWidget({
59296
59323
  initialView: 'main',
59297
59324
  views: {
59298
- main: MainView$1,
59325
+ main: MainView$2,
59299
59326
  verificationCode: VerificationCodeView$1
59300
59327
  }
59301
59328
  });
59302
59329
 
59303
- var MainView$2 = /*#__PURE__*/function (_React$Component) {
59330
+ var MainView$3 = /*#__PURE__*/function (_React$Component) {
59304
59331
  _inherits(MainView, _React$Component);
59305
59332
  var _super = _createSuper(MainView);
59306
59333
  function MainView() {
@@ -59334,7 +59361,7 @@
59334
59361
  }]);
59335
59362
  return MainView;
59336
59363
  }(react.Component);
59337
- _defineProperty(MainView$2, "defaultProps", {
59364
+ _defineProperty(MainView$3, "defaultProps", {
59338
59365
  onSuccess: function onSuccess() {},
59339
59366
  onError: function onError() {}
59340
59367
  });
@@ -59354,7 +59381,7 @@
59354
59381
  var passwordResetWidget = createMultiViewWidget({
59355
59382
  initialView: 'main',
59356
59383
  views: {
59357
- main: MainView$2,
59384
+ main: MainView$3,
59358
59385
  success: SuccessView$1
59359
59386
  },
59360
59387
  prepare: function prepare(options) {
@@ -59387,7 +59414,7 @@
59387
59414
  type: 'text'
59388
59415
  })]
59389
59416
  });
59390
- var MainView$3 = /*#__PURE__*/function (_React$Component) {
59417
+ var MainView$4 = /*#__PURE__*/function (_React$Component) {
59391
59418
  _inherits(MainView, _React$Component);
59392
59419
  var _super = _createSuper(MainView);
59393
59420
  function MainView() {
@@ -59485,7 +59512,7 @@
59485
59512
  var passwordlessWidget = createMultiViewWidget({
59486
59513
  initialView: 'main',
59487
59514
  views: {
59488
- main: MainView$3,
59515
+ main: MainView$4,
59489
59516
  emailSent: EmailSentView,
59490
59517
  verificationCode: VerificationCodeView$2
59491
59518
  },
@@ -59941,7 +59968,7 @@
59941
59968
  var DivCredentialBlock = withTheme(styled.div(_templateObject$h || (_templateObject$h = _taggedTemplateLiteral(["\n margin-left: ", "px;\n margin-bottom: 5em;\n"])), function (props) {
59942
59969
  return props.theme.get('_blockInnerHeight');
59943
59970
  }));
59944
- var MainView$4 = /*#__PURE__*/function (_React$Component) {
59971
+ var MainView$5 = /*#__PURE__*/function (_React$Component) {
59945
59972
  _inherits(MainView, _React$Component);
59946
59973
  var _super = _createSuper(MainView);
59947
59974
  function MainView() {
@@ -59983,7 +60010,8 @@
59983
60010
  showIntro = _this$props.showIntro,
59984
60011
  config = _this$props.config,
59985
60012
  showRemoveMfaCredentials = _this$props.showRemoveMfaCredentials,
59986
- credentials = _this$props.credentials;
60013
+ credentials = _this$props.credentials,
60014
+ requireMfaRegistration = _this$props.requireMfaRegistration;
59987
60015
  var PhoneNumberInputForm = PhoneNumberRegisteringCredentialForm(config);
59988
60016
  var phoneNumberCredentialRegistered = credentials.find(function (credential) {
59989
60017
  return credential.type === 'sms';
@@ -59991,7 +60019,9 @@
59991
60019
  var isEmailCredentialRegistered = credentials.some(function (credential) {
59992
60020
  return credential.type === 'email';
59993
60021
  });
59994
- return /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement(DivCredentialBlock, null, config.mfaEmailEnabled && /*#__PURE__*/react.createElement("div", null, showIntro && /*#__PURE__*/react.createElement(Intro, null, i18n('mfa.email.explain')), /*#__PURE__*/react.createElement(EmailRegisteringCredentialForm, {
60022
+ return /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement(DivCredentialBlock, null, config.mfaEmailEnabled && !credentials.map(function (credential) {
60023
+ return credential.type;
60024
+ }).includes('email') && /*#__PURE__*/react.createElement("div", null, showIntro && /*#__PURE__*/react.createElement(Intro, null, requireMfaRegistration ? i18n('mfa.email.explain.required') : i18n('mfa.email.explain')), /*#__PURE__*/react.createElement(EmailRegisteringCredentialForm, {
59995
60025
  handler: this.onEmailRegistering,
59996
60026
  onSuccess: function onSuccess(data) {
59997
60027
  return _this2.props.goTo('verification-code', _objectSpread2(_objectSpread2({}, data), {}, {
@@ -60092,7 +60122,7 @@
60092
60122
  var mfaCredentialsWidget = createMultiViewWidget({
60093
60123
  initialView: 'main',
60094
60124
  views: {
60095
- 'main': MainView$4,
60125
+ 'main': MainView$5,
60096
60126
  'credential-registered': CredentialRegisteredView,
60097
60127
  'verification-code': VerificationCodeView$3,
60098
60128
  'credential-removed': CredentialRemovedView
@@ -60104,6 +60134,7 @@
60104
60134
  }).then(function (credentials) {
60105
60135
  return deepDefaults(_objectSpread2(_objectSpread2({
60106
60136
  showIntro: true,
60137
+ requireMfaRegistration: false,
60107
60138
  showRemoveMfaCredentials: true
60108
60139
  }, options), credentials));
60109
60140
  });