@aws-amplify/ui-angular 2.1.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/aws-amplify-ui-angular.metadata.json +1 -1
  2. package/bundles/aws-amplify-ui-angular.umd.js +180 -45
  3. package/bundles/aws-amplify-ui-angular.umd.js.map +1 -1
  4. package/bundles/aws-amplify-ui-angular.umd.min.js +1 -1
  5. package/bundles/aws-amplify-ui-angular.umd.min.js.map +1 -1
  6. package/esm2015/lib/components/authenticator/components/authenticator/authenticator.component.js +4 -2
  7. package/esm2015/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.js +15 -3
  8. package/esm2015/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.js +13 -3
  9. package/esm2015/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.js +15 -3
  10. package/esm2015/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.js +15 -3
  11. package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password.component.js +15 -3
  12. package/esm2015/lib/components/authenticator/components/form-field/form-field.component.js +8 -5
  13. package/esm2015/lib/components/authenticator/components/reset-password/reset-password.component.js +13 -3
  14. package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +17 -5
  15. package/esm2015/lib/components/authenticator/components/sign-in/sign-in.component.js +22 -4
  16. package/esm2015/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.js +21 -3
  17. package/esm2015/lib/components/authenticator/components/user-name-alias/user-name-alias.component.js +13 -6
  18. package/esm2015/lib/primitives/phone-number-field/phone-number-field.component.js +7 -3
  19. package/esm2015/lib/services/authenticator.service.js +3 -2
  20. package/fesm2015/aws-amplify-ui-angular.js +158 -25
  21. package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
  22. package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +1 -0
  23. package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +7 -1
  24. package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +4 -0
  25. package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +7 -1
  26. package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +7 -1
  27. package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +7 -1
  28. package/lib/components/authenticator/components/form-field/form-field.component.d.ts +3 -1
  29. package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +4 -0
  30. package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +4 -0
  31. package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +10 -1
  32. package/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.d.ts +7 -1
  33. package/lib/components/authenticator/components/user-name-alias/user-name-alias.component.d.ts +7 -1
  34. package/lib/primitives/phone-number-field/phone-number-field.component.d.ts +5 -2
  35. package/lib/services/authenticator.service.d.ts +1 -1
  36. package/package.json +2 -2
@@ -87,7 +87,7 @@
87
87
  }
88
88
  AuthenticatorService.prototype.startMachine = function (_b) {
89
89
  var _this = this;
90
- var initialState = _b.initialState, loginMechanisms = _b.loginMechanisms, services = _b.services, signUpAttributes = _b.signUpAttributes, socialProviders = _b.socialProviders;
90
+ var initialState = _b.initialState, loginMechanisms = _b.loginMechanisms, services = _b.services, signUpAttributes = _b.signUpAttributes, socialProviders = _b.socialProviders, formFields = _b.formFields;
91
91
  var machine = ui.createAuthenticatorMachine();
92
92
  var authService = xstate.interpret(machine).start();
93
93
  authService.send({
@@ -98,6 +98,7 @@
98
98
  socialProviders: socialProviders,
99
99
  signUpAttributes: signUpAttributes,
100
100
  services: services,
101
+ formFields: formFields,
101
102
  },
102
103
  });
103
104
  this._machineSubscription = authService.subscribe(function (state) {
@@ -317,13 +318,14 @@
317
318
  this.signUpTitle = ui.translate('Create Account');
318
319
  }
319
320
  AuthenticatorComponent.prototype.ngOnInit = function () {
320
- var _a = this, initialState = _a.initialState, loginMechanisms = _a.loginMechanisms, services = _a.services, signUpAttributes = _a.signUpAttributes, socialProviders = _a.socialProviders;
321
+ var _a = this, initialState = _a.initialState, loginMechanisms = _a.loginMechanisms, services = _a.services, signUpAttributes = _a.signUpAttributes, socialProviders = _a.socialProviders, formFields = _a.formFields;
321
322
  this.authenticator.startMachine({
322
323
  initialState: initialState,
323
324
  loginMechanisms: loginMechanisms,
324
325
  services: services,
325
326
  signUpAttributes: signUpAttributes,
326
327
  socialProviders: socialProviders,
328
+ formFields: formFields,
327
329
  });
328
330
  /**
329
331
  * handling translations after content init, because authenticator and its
@@ -393,6 +395,7 @@
393
395
  { type: CustomComponentsService }
394
396
  ]; };
395
397
  AuthenticatorComponent.propDecorators = {
398
+ formFields: [{ type: i0.Input }],
396
399
  initialState: [{ type: i0.Input }],
397
400
  loginMechanisms: [{ type: i0.Input }],
398
401
  services: [{ type: i0.Input }],
@@ -413,6 +416,18 @@
413
416
  this.backToSignInText = ui.translate('Back to Sign In');
414
417
  this.resendCodeText = ui.translate('Resend Code');
415
418
  }
419
+ ConfirmResetPasswordComponent.prototype.ngOnInit = function () {
420
+ this.setFormFields();
421
+ };
422
+ ConfirmResetPasswordComponent.prototype.setFormFields = function () {
423
+ var _a, _b;
424
+ var _state = this.authenticator.authState;
425
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmResetPassword;
426
+ };
427
+ ConfirmResetPasswordComponent.prototype.grabField = function (name, field, defaultV) {
428
+ var _a, _b, _c;
429
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
430
+ };
416
431
  Object.defineProperty(ConfirmResetPasswordComponent.prototype, "context", {
417
432
  get: function () {
418
433
  return this.authenticator.slotContext;
@@ -422,7 +437,7 @@
422
437
  });
423
438
  ConfirmResetPasswordComponent.prototype.onInput = function (event) {
424
439
  event.preventDefault();
425
- var _a = event.target, name = _a.name, value = _a.value;
440
+ var _d = event.target, name = _d.name, value = _d.value;
426
441
  this.authenticator.updateForm({ name: name, value: value });
427
442
  };
428
443
  ConfirmResetPasswordComponent.prototype.onSubmit = function (event) {
@@ -434,7 +449,7 @@
434
449
  ConfirmResetPasswordComponent.decorators = [
435
450
  { type: i0.Component, args: [{
436
451
  selector: 'amplify-confirm-reset-password',
437
- template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-reset-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <amplify-form-field\n name=\"password\"\n label=\"New password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n type=\"button\"\n (click)=\"authenticator.resendCode()\"\n >\n {{ resendCodeText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"confirm-reset-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
452
+ template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-reset-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n [labelHidden]=\"grabField('confirmation_code', 'labelHidden', true)\"\n [placeholder]=\"grabField('confirmation_code', 'placeholder', null)\"\n [required]=\"grabField('confirmation_code', 'required', true)\"\n [label]=\"grabField('confirmation_code', 'label', null)\"\n ></amplify-form-field>\n <amplify-form-field\n name=\"password\"\n label=\"New password\"\n autocomplete=\"new-password\"\n [labelHidden]=\"grabField('password', 'labelHidden', true)\"\n [placeholder]=\"grabField('password', 'placeholder', null)\"\n [required]=\"grabField('password', 'required', true)\"\n [label]=\"grabField('password', 'label', 'New password')\"\n ></amplify-form-field>\n <amplify-form-field\n name=\"confirm_password\"\n type=\"password\"\n autocomplete=\"new-password\"\n [labelHidden]=\"grabField('confirm_password', 'labelHidden', true)\"\n [placeholder]=\"grabField('confirm_password', 'placeholder', null)\"\n [required]=\"grabField('confirm_password', 'required', true)\"\n [label]=\"grabField('confirm_password', 'label', 'Confirm Password')\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n type=\"button\"\n (click)=\"authenticator.resendCode()\"\n >\n {{ resendCodeText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"confirm-reset-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
438
453
  },] }
439
454
  ];
440
455
  ConfirmResetPasswordComponent.ctorParameters = function () { return [
@@ -455,6 +470,16 @@
455
470
  }
456
471
  ConfirmSignInComponent.prototype.ngOnInit = function () {
457
472
  this.setHeaderText();
473
+ this.setFormFields();
474
+ };
475
+ ConfirmSignInComponent.prototype.setFormFields = function () {
476
+ var _a, _b;
477
+ var _state = this.authenticator.authState;
478
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmSignIn;
479
+ };
480
+ ConfirmSignInComponent.prototype.grabField = function (name, field, defaultV) {
481
+ var _a, _b, _c;
482
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
458
483
  };
459
484
  Object.defineProperty(ConfirmSignInComponent.prototype, "context", {
460
485
  get: function () {
@@ -480,7 +505,7 @@
480
505
  };
481
506
  ConfirmSignInComponent.prototype.onInput = function (event) {
482
507
  event.preventDefault();
483
- var _a = event.target, name = _a.name, value = _a.value;
508
+ var _d = event.target, name = _d.name, value = _d.value;
484
509
  this.authenticator.updateForm({ name: name, value: value });
485
510
  };
486
511
  ConfirmSignInComponent.prototype.onSubmit = function (event) {
@@ -492,7 +517,7 @@
492
517
  ConfirmSignInComponent.decorators = [
493
518
  { type: i0.Component, args: [{
494
519
  selector: 'amplify-confirm-sign-in',
495
- template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-sign-in-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot\n name=\"confirm-sign-in-footer\"\n [context]=\"context\"\n ></amplify-slot>\n </form>\n</div>\n"
520
+ template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-sign-in-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n [labelHidden]=\"grabField('confirmation_code', 'labelHidden', true)\"\n [placeholder]=\"grabField('confirmation_code', 'placeholder', null)\"\n [required]=\"grabField('confirmation_code', 'required', true)\"\n [label]=\"grabField('confirmation_code', 'label', 'Code *')\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot\n name=\"confirm-sign-in-footer\"\n [context]=\"context\"\n ></amplify-slot>\n </form>\n</div>\n"
496
521
  },] }
497
522
  ];
498
523
  ConfirmSignInComponent.ctorParameters = function () { return [
@@ -515,6 +540,18 @@
515
540
  this.defaultMessage = ui.translate('Your code is on the way. To log in, enter the code we sent you. It may take a minute to arrive.');
516
541
  this.minutesMessage = ui.translate('It may take a minute to arrive.');
517
542
  }
543
+ ConfirmSignUpComponent.prototype.ngOnInit = function () {
544
+ this.setFormFields();
545
+ };
546
+ ConfirmSignUpComponent.prototype.setFormFields = function () {
547
+ var _a, _b;
548
+ var _state = this.authenticator.authState;
549
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmSignUp;
550
+ };
551
+ ConfirmSignUpComponent.prototype.grabField = function (name, field, defaultV) {
552
+ var _a, _b, _c;
553
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
554
+ };
518
555
  Object.defineProperty(ConfirmSignUpComponent.prototype, "context", {
519
556
  get: function () {
520
557
  return this.authenticator.slotContext;
@@ -524,7 +561,7 @@
524
561
  });
525
562
  Object.defineProperty(ConfirmSignUpComponent.prototype, "confirmSignUpHeading", {
526
563
  get: function () {
527
- var _a = this.authenticator.codeDeliveryDetails, _b = _a === void 0 ? {} : _a, DeliveryMedium = _b.DeliveryMedium;
564
+ var _d = this.authenticator.codeDeliveryDetails, _e = _d === void 0 ? {} : _d, DeliveryMedium = _e.DeliveryMedium;
528
565
  return DeliveryMedium === 'EMAIL'
529
566
  ? ui.translate('We Emailed You')
530
567
  : DeliveryMedium === 'SMS'
@@ -536,7 +573,7 @@
536
573
  });
537
574
  Object.defineProperty(ConfirmSignUpComponent.prototype, "subtitleText", {
538
575
  get: function () {
539
- var _a = this.authenticator.codeDeliveryDetails, _b = _a === void 0 ? {} : _a, DeliveryMedium = _b.DeliveryMedium, Destination = _b.Destination;
576
+ var _d = this.authenticator.codeDeliveryDetails, _e = _d === void 0 ? {} : _d, DeliveryMedium = _e.DeliveryMedium, Destination = _e.Destination;
540
577
  return DeliveryMedium === 'EMAIL'
541
578
  ? this.emailMessage + " " + Destination + ". " + this.minutesMessage
542
579
  : DeliveryMedium === 'SMS'
@@ -548,7 +585,7 @@
548
585
  });
549
586
  ConfirmSignUpComponent.prototype.onInput = function (event) {
550
587
  event.preventDefault();
551
- var _a = event.target, name = _a.name, value = _a.value;
588
+ var _d = event.target, name = _d.name, value = _d.value;
552
589
  this.authenticator.updateForm({ name: name, value: value });
553
590
  };
554
591
  ConfirmSignUpComponent.prototype.onSubmit = function (event) {
@@ -560,7 +597,7 @@
560
597
  ConfirmSignUpComponent.decorators = [
561
598
  { type: i0.Component, args: [{
562
599
  selector: 'amplify-confirm-sign-up',
563
- template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"context.isPending\"\n >\n <amplify-slot name=\"confirm-sign-up-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\" style=\"font-size: 1.5rem\">\n {{ confirmSignUpHeading }}\n </h3>\n </amplify-slot>\n <span style=\"margin-bottom: 1rem\">\n {{ subtitleText }}\n </span>\n <amplify-form-field\n name=\"confirmation_code\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n fontWeight=\"normal\"\n (click)=\"authenticator.resendCode()\"\n >\n {{ resendCodeText }}\n </button>\n </fieldset>\n\n <amplify-error *ngIf=\"context.error\">\n {{ authenticator.error }}\n </amplify-error>\n <amplify-slot\n name=\"confirm-sign-up-footer\"\n [context]=\"context\"\n ></amplify-slot>\n </form>\n</div>\n"
600
+ template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"context.isPending\"\n >\n <amplify-slot name=\"confirm-sign-up-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\" style=\"font-size: 1.5rem\">\n {{ confirmSignUpHeading }}\n </h3>\n </amplify-slot>\n <span style=\"margin-bottom: 1rem\">\n {{ subtitleText }}\n </span>\n <amplify-form-field\n name=\"confirmation_code\"\n autocomplete=\"one-time-code\"\n [labelHidden]=\"grabField('confirmation_code', 'labelHidden', true)\"\n [placeholder]=\"grabField('confirmation_code', 'placeholder', null)\"\n [required]=\"grabField('confirmation_code', 'required', true)\"\n [label]=\"grabField('confirmation_code', 'label', null)\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n fontWeight=\"normal\"\n (click)=\"authenticator.resendCode()\"\n >\n {{ resendCodeText }}\n </button>\n </fieldset>\n\n <amplify-error *ngIf=\"context.error\">\n {{ authenticator.error }}\n </amplify-error>\n <amplify-slot\n name=\"confirm-sign-up-footer\"\n [context]=\"context\"\n ></amplify-slot>\n </form>\n</div>\n"
564
601
  },] }
565
602
  ];
566
603
  ConfirmSignUpComponent.ctorParameters = function () { return [
@@ -580,6 +617,18 @@
580
617
  this.skipText = ui.translate('Skip');
581
618
  this.submitText = ui.translate('Submit');
582
619
  }
620
+ ConfirmVerifyUserComponent.prototype.ngOnInit = function () {
621
+ this.setFormFields();
622
+ };
623
+ ConfirmVerifyUserComponent.prototype.setFormFields = function () {
624
+ var _a, _b;
625
+ var _state = this.authenticator.authState;
626
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmVerifyUser;
627
+ };
628
+ ConfirmVerifyUserComponent.prototype.grabField = function (name, field, defaultV) {
629
+ var _a, _b, _c;
630
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
631
+ };
583
632
  Object.defineProperty(ConfirmVerifyUserComponent.prototype, "context", {
584
633
  get: function () {
585
634
  return this.authenticator.slotContext;
@@ -589,7 +638,7 @@
589
638
  });
590
639
  ConfirmVerifyUserComponent.prototype.onInput = function (event) {
591
640
  event.preventDefault();
592
- var _a = event.target, name = _a.name, value = _a.value;
641
+ var _d = event.target, name = _d.name, value = _d.value;
593
642
  this.authenticator.updateForm({ name: name, value: value });
594
643
  };
595
644
  ConfirmVerifyUserComponent.prototype.onSubmit = function (event) {
@@ -601,7 +650,7 @@
601
650
  ConfirmVerifyUserComponent.decorators = [
602
651
  { type: i0.Component, args: [{
603
652
  selector: 'amplify-confirm-verify-user',
604
- template: "<div data-amplify-container>\n <form data-amplify-form (input)=\"onInput($event)\" (submit)=\"onSubmit($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-verify-user-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ submitText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.skipVerification()\"\n >\n {{ skipText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"confirm-verify-user-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
653
+ template: "<div data-amplify-container>\n <form data-amplify-form (input)=\"onInput($event)\" (submit)=\"onSubmit($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-verify-user-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n [labelHidden]=\"grabField('confirmation_code', 'labelHidden', true)\"\n [placeholder]=\"grabField('confirmation_code', 'placeholder', null)\"\n [required]=\"grabField('confirmation_code', 'required', true)\"\n [label]=\"grabField('confirmation_code', 'label', null)\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ submitText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.skipVerification()\"\n >\n {{ skipText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"confirm-verify-user-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
605
654
  },] }
606
655
  ];
607
656
  ConfirmVerifyUserComponent.ctorParameters = function () { return [
@@ -692,6 +741,9 @@
692
741
  this.changePasswordText = ui.translate('Change Password');
693
742
  this.backToSignInText = ui.translate('Back to Sign In');
694
743
  }
744
+ ForceNewPasswordComponent.prototype.ngOnInit = function () {
745
+ this.setFormFields();
746
+ };
695
747
  Object.defineProperty(ForceNewPasswordComponent.prototype, "context", {
696
748
  get: function () {
697
749
  return this.authenticator.slotContext;
@@ -699,9 +751,18 @@
699
751
  enumerable: false,
700
752
  configurable: true
701
753
  });
754
+ ForceNewPasswordComponent.prototype.setFormFields = function () {
755
+ var _a, _b;
756
+ var _state = this.authenticator.authState;
757
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.forceNewPassword;
758
+ };
759
+ ForceNewPasswordComponent.prototype.grabField = function (name, field, defaultV) {
760
+ var _a, _b, _c;
761
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
762
+ };
702
763
  ForceNewPasswordComponent.prototype.onInput = function (event) {
703
764
  event.preventDefault();
704
- var _a = event.target, name = _a.name, value = _a.value;
765
+ var _d = event.target, name = _d.name, value = _d.value;
705
766
  this.authenticator.updateForm({ name: name, value: value });
706
767
  };
707
768
  ForceNewPasswordComponent.prototype.onSubmit = function (event) {
@@ -713,7 +774,7 @@
713
774
  ForceNewPasswordComponent.decorators = [
714
775
  { type: i0.Component, args: [{
715
776
  selector: 'amplify-force-new-password',
716
- template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"force-new-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n <amplify-slot name=\"force-new-form-fields\" [context]=\"context\">\n <amplify-force-new-password-form-fields></amplify-force-new-password-form-fields>\n </amplify-slot>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ changePasswordText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"force-new-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
777
+ template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"force-new-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n [labelHidden]=\"grabField('password', 'labelHidden', true)\"\n [placeholder]=\"grabField('password', 'placeholder', null)\"\n [required]=\"grabField('password', 'required', true)\"\n [label]=\"grabField('password', 'label', null)\"\n name=\"password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <amplify-form-field\n name=\"confirm_password\"\n type=\"password\"\n autocomplete=\"new-password\"\n [labelHidden]=\"grabField('confirm_password', 'labelHidden', true)\"\n [placeholder]=\"grabField('confirm_password', 'placeholder', null)\"\n [required]=\"grabField('confirm_password', 'required', true)\"\n [label]=\"grabField('confirm_password', 'label', 'Confirm Password')\"\n ></amplify-form-field>\n <amplify-slot name=\"force-new-form-fields\" [context]=\"context\">\n <amplify-force-new-password-form-fields></amplify-force-new-password-form-fields>\n </amplify-slot>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ changePasswordText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"force-new-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
717
778
  },] }
718
779
  ];
719
780
  ForceNewPasswordComponent.ctorParameters = function () { return [
@@ -771,14 +832,15 @@
771
832
  this.disabled = false;
772
833
  this.autocomplete = '';
773
834
  this.labelHidden = true;
774
- this.countryDialCodes = ui.countryDialCodes;
835
+ this.countryDialCodesValue = ui.countryDialCodes;
775
836
  }
776
837
  FormFieldComponent.prototype.ngOnInit = function () {
838
+ var _a;
777
839
  // TODO: consider better default handling mechanisms across frameworks
778
840
  if (this.isPhoneField()) {
779
841
  var state = this.authenticator.authState;
780
842
  var country_code = ui.getActorContext(state).country_code;
781
- this.defaultCountryCode = country_code;
843
+ this.defaultCountryCodeValue = (_a = this.defaultCountryCode) !== null && _a !== void 0 ? _a : country_code;
782
844
  }
783
845
  };
784
846
  Object.defineProperty(FormFieldComponent.prototype, "attributeMap", {
@@ -833,7 +895,7 @@
833
895
  FormFieldComponent.decorators = [
834
896
  { type: i0.Component, args: [{
835
897
  selector: 'amplify-form-field',
836
- template: "<div class=\"amplify-flex amplify-field\" style=\"flex-direction: column\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [defaultCountryCode]=\"defaultCountryCode\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-phone-number-field>\n\n <amplify-password-field\n *ngIf=\"isPasswordField()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n (setBlur)=\"onBlur($event)\"\n ></amplify-password-field>\n\n <amplify-text-field\n *ngIf=\"!isPasswordField() && !isPhoneField()\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-text-field>\n\n <amplify-error *ngIf=\"error\">\n {{ error }}\n </amplify-error>\n</div>\n"
898
+ template: "<div class=\"amplify-flex amplify-field\" style=\"flex-direction: column\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [defaultCountryCode]=\"defaultCountryCodeValue\"\n [dialCodeList]=\"dialCodeList\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-phone-number-field>\n\n <amplify-password-field\n *ngIf=\"isPasswordField()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n (setBlur)=\"onBlur($event)\"\n ></amplify-password-field>\n\n <amplify-text-field\n *ngIf=\"!isPasswordField() && !isPhoneField()\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-text-field>\n\n <amplify-error *ngIf=\"error\">\n {{ error }}\n </amplify-error>\n</div>\n"
837
899
  },] }
838
900
  ];
839
901
  FormFieldComponent.ctorParameters = function () { return [
@@ -848,7 +910,9 @@
848
910
  initialValue: [{ type: i0.Input }],
849
911
  disabled: [{ type: i0.Input }],
850
912
  autocomplete: [{ type: i0.Input }],
851
- labelHidden: [{ type: i0.Input }]
913
+ labelHidden: [{ type: i0.Input }],
914
+ defaultCountryCode: [{ type: i0.Input }],
915
+ dialCodeList: [{ type: i0.Input }]
852
916
  };
853
917
 
854
918
  var ResetPasswordComponent = /** @class */ (function () {
@@ -865,6 +929,16 @@
865
929
  var authState = this.authenticator.authState;
866
930
  var label = ui.getAliasInfoFromContext(authState.context).label;
867
931
  this.labelText = "Enter your " + label.toLowerCase();
932
+ this.setFormFields();
933
+ };
934
+ ResetPasswordComponent.prototype.setFormFields = function () {
935
+ var _a, _b;
936
+ var _state = this.authenticator.authState;
937
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.resetPassword;
938
+ };
939
+ ResetPasswordComponent.prototype.grabField = function (name, field, defaultV) {
940
+ var _a, _b, _c;
941
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
868
942
  };
869
943
  Object.defineProperty(ResetPasswordComponent.prototype, "context", {
870
944
  get: function () {
@@ -875,7 +949,7 @@
875
949
  });
876
950
  ResetPasswordComponent.prototype.onInput = function (event) {
877
951
  event.preventDefault();
878
- var _a = event.target, name = _a.name, value = _a.value;
952
+ var _d = event.target, name = _d.name, value = _d.value;
879
953
  this.authenticator.updateForm({ name: name, value: value });
880
954
  };
881
955
  ResetPasswordComponent.prototype.onSubmit = function (event) {
@@ -887,7 +961,7 @@
887
961
  ResetPasswordComponent.decorators = [
888
962
  { type: i0.Component, args: [{
889
963
  selector: 'amplify-reset-password',
890
- template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot\n class=\"amplify-flex\"\n name=\"reset-password-header\"\n [context]=\"context\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n\n <amplify-form-field\n name=\"username\"\n type=\"username\"\n autocomplete=\"username\"\n [placeholder]=\"labelText\"\n [label]=\"labelText\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n\n <amplify-slot name=\"reset-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
964
+ template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot\n class=\"amplify-flex\"\n name=\"reset-password-header\"\n [context]=\"context\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n\n <amplify-form-field\n name=\"username\"\n type=\"username\"\n autocomplete=\"username\"\n [labelHidden]=\"grabField('username', 'labelHidden', true)\"\n [required]=\"grabField('username', 'required', true)\"\n [label]=\"grabField('username', 'label', labelText)\"\n [placeholder]=\"grabField('username', 'placeholder', labelText)\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n\n <amplify-slot name=\"reset-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
891
965
  },] }
892
966
  ];
893
967
  ResetPasswordComponent.ctorParameters = function () { return [
@@ -1231,6 +1305,16 @@
1231
1305
  }
1232
1306
  SetupTotpComponent.prototype.ngOnInit = function () {
1233
1307
  this.generateQRCode();
1308
+ this.setFormFields();
1309
+ };
1310
+ SetupTotpComponent.prototype.setFormFields = function () {
1311
+ var _a, _b;
1312
+ var _state = this.authenticator.authState;
1313
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.setupTOTP;
1314
+ };
1315
+ SetupTotpComponent.prototype.grabField = function (name, field, defaultV) {
1316
+ var _a, _b, _c;
1317
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
1234
1318
  };
1235
1319
  Object.defineProperty(SetupTotpComponent.prototype, "context", {
1236
1320
  get: function () {
@@ -1240,31 +1324,33 @@
1240
1324
  configurable: true
1241
1325
  });
1242
1326
  SetupTotpComponent.prototype.generateQRCode = function () {
1327
+ var _a, _b, _c, _d, _e, _f;
1243
1328
  return __awaiter(this, void 0, void 0, function () {
1244
- var state, actorContext, user, _a, issuer, totpCode, _b, err_1;
1245
- return __generator(this, function (_c) {
1246
- switch (_c.label) {
1329
+ var state, actorContext, user, _g, issuer, username, totpCode, _h, err_1;
1330
+ return __generator(this, function (_j) {
1331
+ switch (_j.label) {
1247
1332
  case 0:
1248
1333
  state = this.authenticator.authState;
1249
1334
  actorContext = ui.getActorContext(state);
1250
1335
  user = actorContext.user;
1251
- _c.label = 1;
1336
+ _j.label = 1;
1252
1337
  case 1:
1253
- _c.trys.push([1, 4, , 5]);
1254
- _a = this;
1338
+ _j.trys.push([1, 4, , 5]);
1339
+ _g = this;
1255
1340
  return [4 /*yield*/, awsAmplify.Auth.setupTOTP(user)];
1256
1341
  case 2:
1257
- _a.secretKey = _c.sent();
1258
- issuer = 'AWSCognito';
1259
- totpCode = "otpauth://totp/" + issuer + ":" + user.username + "?secret=" + this.secretKey + "&issuer=" + issuer;
1342
+ _g.secretKey = _j.sent();
1343
+ issuer = (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a['QR']) === null || _b === void 0 ? void 0 : _b.totpIssuer) !== null && _c !== void 0 ? _c : 'AWSCognito';
1344
+ username = (_f = (_e = (_d = this.formOverrides) === null || _d === void 0 ? void 0 : _d['QR']) === null || _e === void 0 ? void 0 : _e.totpUsername) !== null && _f !== void 0 ? _f : user.username;
1345
+ totpCode = "otpauth://totp/" + issuer + ":" + username + "?secret=" + this.secretKey + "&issuer=" + issuer;
1260
1346
  logger.info('totp code was generated:', totpCode);
1261
- _b = this;
1347
+ _h = this;
1262
1348
  return [4 /*yield*/, QRCode__default["default"].toDataURL(totpCode)];
1263
1349
  case 3:
1264
- _b.qrCodeSource = _c.sent();
1350
+ _h.qrCodeSource = _j.sent();
1265
1351
  return [3 /*break*/, 5];
1266
1352
  case 4:
1267
- err_1 = _c.sent();
1353
+ err_1 = _j.sent();
1268
1354
  logger.error(err_1);
1269
1355
  return [3 /*break*/, 5];
1270
1356
  case 5: return [2 /*return*/];
@@ -1274,7 +1360,7 @@
1274
1360
  };
1275
1361
  SetupTotpComponent.prototype.onInput = function (event) {
1276
1362
  event.preventDefault();
1277
- var _a = event.target, name = _a.name, value = _a.value;
1363
+ var _g = event.target, name = _g.name, value = _g.value;
1278
1364
  this.authenticator.updateForm({ name: name, value: value });
1279
1365
  };
1280
1366
  SetupTotpComponent.prototype.onSubmit = function (event) {
@@ -1290,7 +1376,7 @@
1290
1376
  SetupTotpComponent.decorators = [
1291
1377
  { type: i0.Component, args: [{
1292
1378
  selector: 'amplify-setup-totp',
1293
- template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <div class=\"amplify-flex\" data-amplify-copy>\n <div>{{ secretKey }}</div>\n <div data-amplify-copy-svg (click)=\"copyText()\">\n <div data-amplify-copy-tooltip>{{ copyTextLabel }}</div>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM15 5H8C6.9 5 6.01 5.9 6.01 7L6 21C6 22.1 6.89 23 7.99 23H19C20.1 23 21 22.1 21 21V11L15 5ZM8 21V7H14V12H19V21H8Z\"\n fill=\"black\"\n />\n </svg>\n </div>\n </div>\n\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"setup-totp-footer\" [context]=\"context\"> </amplify-slot>\n </form>\n</div>\n"
1379
+ template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <div class=\"amplify-flex\" data-amplify-copy>\n <div>{{ secretKey }}</div>\n <div data-amplify-copy-svg (click)=\"copyText()\">\n <div data-amplify-copy-tooltip>{{ copyTextLabel }}</div>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM15 5H8C6.9 5 6.01 5.9 6.01 7L6 21C6 22.1 6.89 23 7.99 23H19C20.1 23 21 22.1 21 21V11L15 5ZM8 21V7H14V12H19V21H8Z\"\n fill=\"black\"\n />\n </svg>\n </div>\n </div>\n\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n [labelHidden]=\"grabField('confirmation_code', 'labelHidden', true)\"\n [placeholder]=\"grabField('confirmation_code', 'placeholder', null)\"\n [required]=\"grabField('confirmation_code', 'required', true)\"\n [label]=\"grabField('confirmation_code', 'label', 'Code *')\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"setup-totp-footer\" [context]=\"context\"> </amplify-slot>\n </form>\n</div>\n"
1294
1380
  },] }
1295
1381
  ];
1296
1382
  SetupTotpComponent.ctorParameters = function () { return [
@@ -1311,6 +1397,26 @@
1311
1397
  : ui.translate('Forgot your password? ');
1312
1398
  this.signInButtonText = ui.translate('Sign in');
1313
1399
  }
1400
+ SignInComponent.prototype.ngOnInit = function () {
1401
+ this.setFormFields();
1402
+ };
1403
+ SignInComponent.prototype.setFormFields = function () {
1404
+ var _a, _b, _c, _d;
1405
+ var _state = this.authenticator.authState;
1406
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.signIn;
1407
+ this.userOverrides = (_c = this.formOverrides) === null || _c === void 0 ? void 0 : _c['username'];
1408
+ this.passwordOR = (_d = this.formOverrides) === null || _d === void 0 ? void 0 : _d['password'];
1409
+ };
1410
+ SignInComponent.prototype.labelHidden = function (name, defaultV) {
1411
+ if (defaultV === void 0) { defaultV = true; }
1412
+ var _a, _b, _c;
1413
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.labelHidden) !== null && _c !== void 0 ? _c : defaultV;
1414
+ };
1415
+ SignInComponent.prototype.required = function (name, defaultV) {
1416
+ if (defaultV === void 0) { defaultV = true; }
1417
+ var _a, _b, _c;
1418
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.required) !== null && _c !== void 0 ? _c : defaultV;
1419
+ };
1314
1420
  Object.defineProperty(SignInComponent.prototype, "context", {
1315
1421
  get: function () {
1316
1422
  return this.authenticator.slotContext;
@@ -1320,7 +1426,7 @@
1320
1426
  });
1321
1427
  SignInComponent.prototype.onInput = function (event) {
1322
1428
  event.preventDefault();
1323
- var _a = event.target, name = _a.name, value = _a.value;
1429
+ var _e = event.target, name = _e.name, value = _e.value;
1324
1430
  this.authenticator.updateForm({ name: name, value: value });
1325
1431
  };
1326
1432
  SignInComponent.prototype.onSubmit = function (event) {
@@ -1332,7 +1438,7 @@
1332
1438
  SignInComponent.decorators = [
1333
1439
  { type: i0.Component, args: [{
1334
1440
  selector: 'amplify-sign-in',
1335
- template: "<div data-amplify-container>\n <amplify-slot name=\"sign-in-header\" [context]=\"context\"></amplify-slot>\n\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-user-name-alias></amplify-user-name-alias>\n <amplify-form-field\n data-amplify-password\n name=\"password\"\n type=\"password\"\n autocomplete=\"current-password\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ signInButtonText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n </form>\n\n <amplify-slot name=\"sign-in-footer\" [context]=\"context\">\n <div data-amplify-footer>\n <button\n amplify-button\n fontWeight=\"normal\"\n size=\"small\"\n variation=\"link\"\n fullWidth=\"true\"\n (click)=\"authenticator.toResetPassword()\"\n >\n {{ forgotPasswordText }}\n </button>\n </div>\n </amplify-slot>\n</div>\n",
1441
+ template: "<div data-amplify-container>\n <amplify-slot name=\"sign-in-header\" [context]=\"context\"></amplify-slot>\n\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-user-name-alias\n [labelHidden]=\"labelHidden('username')\"\n [placeholder]=\"userOverrides?.placeholder\"\n [required]=\"required('username')\"\n [label]=\"userOverrides?.label\"\n [dialCode]=\"userOverrides?.dialCode\"\n [dialCodeList]=\"userOverrides?.dialCodeList\"\n ></amplify-user-name-alias>\n <amplify-form-field\n [labelHidden]=\"labelHidden('password')\"\n [placeholder]=\"passwordOR?.placeholder\"\n [required]=\"required('password')\"\n [label]=\"passwordOR?.label\"\n data-amplify-password\n name=\"password\"\n type=\"password\"\n autocomplete=\"current-password\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ signInButtonText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n </form>\n\n <amplify-slot name=\"sign-in-footer\" [context]=\"context\">\n <div data-amplify-footer>\n <button\n amplify-button\n fontWeight=\"normal\"\n size=\"small\"\n variation=\"link\"\n fullWidth=\"true\"\n (click)=\"authenticator.toResetPassword()\"\n >\n {{ forgotPasswordText }}\n </button>\n </div>\n </amplify-slot>\n</div>\n",
1336
1442
  encapsulation: i0.ViewEncapsulation.None
1337
1443
  },] }
1338
1444
  ];
@@ -1390,7 +1496,7 @@
1390
1496
  }
1391
1497
  SignUpFormFieldsComponent.prototype.ngOnInit = function () {
1392
1498
  var context = this.authenticator.context;
1393
- var _a = context.config, loginMechanisms = _a.loginMechanisms, signUpAttributes = _a.signUpAttributes;
1499
+ var _d = context.config, loginMechanisms = _d.loginMechanisms, signUpAttributes = _d.signUpAttributes;
1394
1500
  this.fieldNames = Array.from(new Set(__spread(loginMechanisms, signUpAttributes)));
1395
1501
  this.fieldNames = this.fieldNames.filter(function (fieldName) {
1396
1502
  var hasDefaultField = !!ui.authInputAttributes[fieldName];
@@ -1401,13 +1507,31 @@
1401
1507
  });
1402
1508
  // Only 1 is supported, so `['email', 'phone_number']` will only show `email`
1403
1509
  this.loginMechanism = this.fieldNames.shift();
1510
+ var common = [
1511
+ this.loginMechanism,
1512
+ 'password',
1513
+ 'confirm_password',
1514
+ ];
1515
+ this.fieldNamesCombined = __spread(common, this.fieldNames);
1516
+ this.setFormFields();
1517
+ };
1518
+ SignUpFormFieldsComponent.prototype.setFormFields = function () {
1519
+ var _a, _b, _c;
1520
+ var _state = this.authenticator.authState;
1521
+ this.formOverrides = (_b = (_a = ui.getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.signUp;
1522
+ this.userOverrides = (_c = this.formOverrides) === null || _c === void 0 ? void 0 : _c[this.loginMechanism];
1523
+ this.order = ui.setFormOrder(this.formOverrides, this.fieldNamesCombined);
1524
+ };
1525
+ SignUpFormFieldsComponent.prototype.grabField = function (name, field, defaultV) {
1526
+ var _a, _b, _c;
1527
+ return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
1404
1528
  };
1405
1529
  return SignUpFormFieldsComponent;
1406
1530
  }());
1407
1531
  SignUpFormFieldsComponent.decorators = [
1408
1532
  { type: i0.Component, args: [{
1409
1533
  selector: 'amplify-sign-up-form-fields',
1410
- template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <amplify-user-name-alias [name]=\"loginMechanism\"></amplify-user-name-alias>\n <amplify-form-field\n name=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <ng-container *ngFor=\"let field of fieldNames\">\n <amplify-form-field\n [name]=\"field\"\n [labelHidden]=\"false\"\n ></amplify-form-field>\n </ng-container>\n</div>\n"
1534
+ template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <ng-container *ngFor=\"let field of order\">\n <ng-container [ngSwitch]=\"field\">\n <amplify-user-name-alias\n *ngSwitchCase=\"loginMechanism\"\n [name]=\"loginMechanism\"\n [labelHidden]=\"grabField(loginMechanism, 'labelHidden', true)\"\n [placeholder]=\"userOverrides?.placeholder\"\n [required]=\"grabField(loginMechanism, 'required', true)\"\n [label]=\"userOverrides?.label\"\n [dialCode]=\"userOverrides?.dialCode\"\n [dialCodeList]=\"userOverrides?.dialCodeList\"\n ></amplify-user-name-alias>\n <amplify-form-field\n *ngSwitchCase=\"'password'\"\n [labelHidden]=\"grabField('password', 'labelHidden', true)\"\n [placeholder]=\"grabField('password', 'placeholder', null)\"\n [required]=\"grabField('password', 'required', true)\"\n [label]=\"grabField('password', 'label', null)\"\n name=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n <amplify-form-field\n *ngSwitchCase=\"'confirm_password'\"\n [labelHidden]=\"grabField('confirm_password', 'labelHidden', true)\"\n [placeholder]=\"\n grabField('confirm_password', 'placeholder', 'Confirm Password')\n \"\n [required]=\"grabField('confirm_password', 'required', true)\"\n [label]=\"grabField('confirm_password', 'label', 'Confirm Password')\"\n name=\"confirm_password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <amplify-form-field\n *ngSwitchDefault\n [name]=\"field\"\n [labelHidden]=\"grabField(field, 'labelHidden', false)\"\n [placeholder]=\"grabField(field, 'placeholder', null)\"\n [required]=\"grabField(field, 'required', true)\"\n [label]=\"grabField(field, 'label', null)\"\n [defaultCountryCode]=\"grabField(field, 'dialCode', null)\"\n [dialCodeList]=\"grabField(field, 'dialCodeList', null)\"\n ></amplify-form-field>\n </ng-container>\n </ng-container>\n</div>\n"
1411
1535
  },] }
1412
1536
  ];
1413
1537
  SignUpFormFieldsComponent.ctorParameters = function () { return [
@@ -1423,18 +1547,20 @@
1423
1547
  this.required = true;
1424
1548
  }
1425
1549
  UserNameAliasComponent.prototype.ngOnInit = function () {
1550
+ var _a, _b, _c;
1426
1551
  var context = this.authenticator.context;
1427
- var _a = ui.getAliasInfoFromContext(context), label = _a.label, type = _a.type;
1428
- this.label = label;
1552
+ var _d = ui.getAliasInfoFromContext(context), lbl = _d.label, type = _d.type;
1553
+ this.labelValue = (_a = this.label) !== null && _a !== void 0 ? _a : lbl;
1429
1554
  this.type = type;
1430
- this.placeholder = label;
1555
+ this.placeholderValue = (_b = this.placeholder) !== null && _b !== void 0 ? _b : lbl;
1556
+ this.requiredValue = (_c = this.required) !== null && _c !== void 0 ? _c : true;
1431
1557
  };
1432
1558
  return UserNameAliasComponent;
1433
1559
  }());
1434
1560
  UserNameAliasComponent.decorators = [
1435
1561
  { type: i0.Component, args: [{
1436
1562
  selector: 'amplify-user-name-alias',
1437
- template: "<amplify-form-field\n data-amplify-usernamealias\n [name]=\"name\"\n [label]=\"label\"\n [type]=\"type\"\n [placeholder]=\"placeholder\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n autocomplete=\"username\"\n>\n</amplify-form-field>\n"
1563
+ template: "<amplify-form-field\n data-amplify-usernamealias\n [name]=\"name\"\n [labelHidden]=\"labelHidden\"\n [label]=\"labelValue\"\n [placeholder]=\"placeholderValue\"\n [required]=\"requiredValue\"\n [defaultCountryCode]=\"dialCode\"\n [dialCodeList]=\"dialCodeList\"\n [type]=\"type\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n autocomplete=\"username\"\n>\n</amplify-form-field>\n"
1438
1564
  },] }
1439
1565
  ];
1440
1566
  UserNameAliasComponent.ctorParameters = function () { return [
@@ -1444,7 +1570,12 @@
1444
1570
  name: [{ type: i0.Input }],
1445
1571
  disabled: [{ type: i0.Input }],
1446
1572
  initialValue: [{ type: i0.Input }],
1447
- required: [{ type: i0.Input }]
1573
+ required: [{ type: i0.Input }],
1574
+ labelHidden: [{ type: i0.Input }],
1575
+ label: [{ type: i0.Input }],
1576
+ placeholder: [{ type: i0.Input }],
1577
+ dialCode: [{ type: i0.Input }],
1578
+ dialCodeList: [{ type: i0.Input }]
1448
1579
  };
1449
1580
 
1450
1581
  var VerifyUserComponent = /** @class */ (function () {
@@ -1641,14 +1772,17 @@
1641
1772
  this.required = true;
1642
1773
  this.labelHidden = false;
1643
1774
  this.display = 'contents';
1644
- this.countryDialCodes = ui.countryDialCodes;
1645
1775
  }
1776
+ PhoneNumberFieldComponent.prototype.ngOnInit = function () {
1777
+ var _a;
1778
+ this.countryDialCodesValues = (_a = this.dialCodeList) !== null && _a !== void 0 ? _a : ui.countryDialCodes;
1779
+ };
1646
1780
  return PhoneNumberFieldComponent;
1647
1781
  }());
1648
1782
  PhoneNumberFieldComponent.decorators = [
1649
1783
  { type: i0.Component, args: [{
1650
1784
  selector: 'amplify-phone-number-field',
1651
- template: "<label\n class=\"amplify-label\"\n [class.amplify-visually-hidden]=\"labelHidden\"\n [for]=\"textFieldId\"\n>\n {{ label }}\n</label>\n<div\n class=\"amplify-flex amplify-phonenumberfield\"\n amplify-field-group\n style=\"gap: 0px\"\n>\n <div class=\"amplify-field-group__outer-start\">\n <div\n class=\"\n amplify-flex amplify-field amplify-selectfield amplify-countrycodeselect\n \"\n style=\"flex-direction: column\"\n >\n <amplify-form-select\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"selectFieldId\"\n [items]=\"countryDialCodes\"\n [defaultValue]=\"defaultCountryCode\"\n ></amplify-form-select>\n </div>\n </div>\n\n <input\n class=\"amplify-input\"\n [id]=\"textFieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\n</div>\n"
1785
+ template: "<label\n class=\"amplify-label\"\n [class.amplify-visually-hidden]=\"labelHidden\"\n [for]=\"textFieldId\"\n>\n {{ label }}\n</label>\n<div\n class=\"amplify-flex amplify-phonenumberfield\"\n amplify-field-group\n style=\"gap: 0px\"\n>\n <div class=\"amplify-field-group__outer-start\">\n <div\n class=\"\n amplify-flex amplify-field amplify-selectfield amplify-countrycodeselect\n \"\n style=\"flex-direction: column\"\n >\n <amplify-form-select\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"selectFieldId\"\n [items]=\"countryDialCodesValues\"\n [defaultValue]=\"defaultCountryCode\"\n ></amplify-form-select>\n </div>\n </div>\n\n <input\n class=\"amplify-input\"\n [id]=\"textFieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\n</div>\n"
1652
1786
  },] }
1653
1787
  ];
1654
1788
  PhoneNumberFieldComponent.propDecorators = {
@@ -1664,6 +1798,7 @@
1664
1798
  required: [{ type: i0.Input }],
1665
1799
  type: [{ type: i0.Input }],
1666
1800
  labelHidden: [{ type: i0.Input }],
1801
+ dialCodeList: [{ type: i0.Input }],
1667
1802
  display: [{ type: i0.HostBinding, args: ['style.display',] }]
1668
1803
  };
1669
1804