@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
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, ContentChildren, HostBinding, EventEmitter, Output, NgModule } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
- import { createAuthenticatorMachine, getServiceContextFacade, listenToAuthHub, getSendEventAliases, translate, getFormDataFromEvent, getActorContext, AuthChallengeNames, FederatedIdentityProviders, authInputAttributes, countryDialCodes, getAliasInfoFromContext, hasTranslation, getActorState } from '@aws-amplify/ui';
4
+ import { createAuthenticatorMachine, getServiceContextFacade, listenToAuthHub, getSendEventAliases, translate, getActorState, getFormDataFromEvent, getActorContext, AuthChallengeNames, FederatedIdentityProviders, authInputAttributes, countryDialCodes, getAliasInfoFromContext, hasTranslation, setFormOrder } from '@aws-amplify/ui';
5
5
  export { translations } from '@aws-amplify/ui';
6
6
  import { Logger } from '@aws-amplify/core';
7
7
  import { interpret } from 'xstate';
@@ -56,7 +56,7 @@ const logger$2 = new Logger('state-machine');
56
56
  * AuthenticatorService provides access to the authenticator state and context.
57
57
  */
58
58
  class AuthenticatorService {
59
- startMachine({ initialState, loginMechanisms, services, signUpAttributes, socialProviders, }) {
59
+ startMachine({ initialState, loginMechanisms, services, signUpAttributes, socialProviders, formFields, }) {
60
60
  const machine = createAuthenticatorMachine();
61
61
  const authService = interpret(machine).start();
62
62
  authService.send({
@@ -67,6 +67,7 @@ class AuthenticatorService {
67
67
  socialProviders,
68
68
  signUpAttributes,
69
69
  services,
70
+ formFields,
70
71
  },
71
72
  });
72
73
  this._machineSubscription = authService.subscribe((state) => {
@@ -201,13 +202,14 @@ class AuthenticatorComponent {
201
202
  this.signUpTitle = translate('Create Account');
202
203
  }
203
204
  ngOnInit() {
204
- const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, } = this;
205
+ const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, formFields, } = this;
205
206
  this.authenticator.startMachine({
206
207
  initialState,
207
208
  loginMechanisms,
208
209
  services,
209
210
  signUpAttributes,
210
211
  socialProviders,
212
+ formFields,
211
213
  });
212
214
  /**
213
215
  * handling translations after content init, because authenticator and its
@@ -268,6 +270,7 @@ AuthenticatorComponent.ctorParameters = () => [
268
270
  { type: CustomComponentsService }
269
271
  ];
270
272
  AuthenticatorComponent.propDecorators = {
273
+ formFields: [{ type: Input }],
271
274
  initialState: [{ type: Input }],
272
275
  loginMechanisms: [{ type: Input }],
273
276
  services: [{ type: Input }],
@@ -288,6 +291,18 @@ class ConfirmResetPasswordComponent {
288
291
  this.backToSignInText = translate('Back to Sign In');
289
292
  this.resendCodeText = translate('Resend Code');
290
293
  }
294
+ ngOnInit() {
295
+ this.setFormFields();
296
+ }
297
+ setFormFields() {
298
+ var _a, _b;
299
+ const _state = this.authenticator.authState;
300
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmResetPassword;
301
+ }
302
+ grabField(name, field, defaultV) {
303
+ var _a, _b, _c;
304
+ 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;
305
+ }
291
306
  get context() {
292
307
  return this.authenticator.slotContext;
293
308
  }
@@ -304,7 +319,7 @@ class ConfirmResetPasswordComponent {
304
319
  ConfirmResetPasswordComponent.decorators = [
305
320
  { type: Component, args: [{
306
321
  selector: 'amplify-confirm-reset-password',
307
- 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"
322
+ 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"
308
323
  },] }
309
324
  ];
310
325
  ConfirmResetPasswordComponent.ctorParameters = () => [
@@ -325,6 +340,16 @@ class ConfirmSignInComponent {
325
340
  }
326
341
  ngOnInit() {
327
342
  this.setHeaderText();
343
+ this.setFormFields();
344
+ }
345
+ setFormFields() {
346
+ var _a, _b;
347
+ const _state = this.authenticator.authState;
348
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmSignIn;
349
+ }
350
+ grabField(name, field, defaultV) {
351
+ var _a, _b, _c;
352
+ 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;
328
353
  }
329
354
  get context() {
330
355
  return this.authenticator.slotContext;
@@ -357,7 +382,7 @@ class ConfirmSignInComponent {
357
382
  ConfirmSignInComponent.decorators = [
358
383
  { type: Component, args: [{
359
384
  selector: 'amplify-confirm-sign-in',
360
- 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"
385
+ 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"
361
386
  },] }
362
387
  ];
363
388
  ConfirmSignInComponent.ctorParameters = () => [
@@ -380,6 +405,18 @@ class ConfirmSignUpComponent {
380
405
  this.defaultMessage = translate('Your code is on the way. To log in, enter the code we sent you. It may take a minute to arrive.');
381
406
  this.minutesMessage = translate('It may take a minute to arrive.');
382
407
  }
408
+ ngOnInit() {
409
+ this.setFormFields();
410
+ }
411
+ setFormFields() {
412
+ var _a, _b;
413
+ const _state = this.authenticator.authState;
414
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmSignUp;
415
+ }
416
+ grabField(name, field, defaultV) {
417
+ var _a, _b, _c;
418
+ 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;
419
+ }
383
420
  get context() {
384
421
  return this.authenticator.slotContext;
385
422
  }
@@ -412,7 +449,7 @@ class ConfirmSignUpComponent {
412
449
  ConfirmSignUpComponent.decorators = [
413
450
  { type: Component, args: [{
414
451
  selector: 'amplify-confirm-sign-up',
415
- 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"
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]=\"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"
416
453
  },] }
417
454
  ];
418
455
  ConfirmSignUpComponent.ctorParameters = () => [
@@ -432,6 +469,18 @@ class ConfirmVerifyUserComponent {
432
469
  this.skipText = translate('Skip');
433
470
  this.submitText = translate('Submit');
434
471
  }
472
+ ngOnInit() {
473
+ this.setFormFields();
474
+ }
475
+ setFormFields() {
476
+ var _a, _b;
477
+ const _state = this.authenticator.authState;
478
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmVerifyUser;
479
+ }
480
+ grabField(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;
483
+ }
435
484
  get context() {
436
485
  return this.authenticator.slotContext;
437
486
  }
@@ -448,7 +497,7 @@ class ConfirmVerifyUserComponent {
448
497
  ConfirmVerifyUserComponent.decorators = [
449
498
  { type: Component, args: [{
450
499
  selector: 'amplify-confirm-verify-user',
451
- 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"
500
+ 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"
452
501
  },] }
453
502
  ];
454
503
  ConfirmVerifyUserComponent.ctorParameters = () => [
@@ -536,9 +585,21 @@ class ForceNewPasswordComponent {
536
585
  this.changePasswordText = translate('Change Password');
537
586
  this.backToSignInText = translate('Back to Sign In');
538
587
  }
588
+ ngOnInit() {
589
+ this.setFormFields();
590
+ }
539
591
  get context() {
540
592
  return this.authenticator.slotContext;
541
593
  }
594
+ setFormFields() {
595
+ var _a, _b;
596
+ const _state = this.authenticator.authState;
597
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.forceNewPassword;
598
+ }
599
+ grabField(name, field, defaultV) {
600
+ var _a, _b, _c;
601
+ 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;
602
+ }
542
603
  onInput(event) {
543
604
  event.preventDefault();
544
605
  const { name, value } = event.target;
@@ -552,7 +613,7 @@ class ForceNewPasswordComponent {
552
613
  ForceNewPasswordComponent.decorators = [
553
614
  { type: Component, args: [{
554
615
  selector: 'amplify-force-new-password',
555
- 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"
616
+ 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"
556
617
  },] }
557
618
  ];
558
619
  ForceNewPasswordComponent.ctorParameters = () => [
@@ -609,14 +670,15 @@ class FormFieldComponent {
609
670
  this.disabled = false;
610
671
  this.autocomplete = '';
611
672
  this.labelHidden = true;
612
- this.countryDialCodes = countryDialCodes;
673
+ this.countryDialCodesValue = countryDialCodes;
613
674
  }
614
675
  ngOnInit() {
676
+ var _a;
615
677
  // TODO: consider better default handling mechanisms across frameworks
616
678
  if (this.isPhoneField()) {
617
679
  const state = this.authenticator.authState;
618
680
  const { country_code } = getActorContext(state);
619
- this.defaultCountryCode = country_code;
681
+ this.defaultCountryCodeValue = (_a = this.defaultCountryCode) !== null && _a !== void 0 ? _a : country_code;
620
682
  }
621
683
  }
622
684
  get attributeMap() {
@@ -662,7 +724,7 @@ class FormFieldComponent {
662
724
  FormFieldComponent.decorators = [
663
725
  { type: Component, args: [{
664
726
  selector: 'amplify-form-field',
665
- 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"
727
+ 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"
666
728
  },] }
667
729
  ];
668
730
  FormFieldComponent.ctorParameters = () => [
@@ -677,7 +739,9 @@ FormFieldComponent.propDecorators = {
677
739
  initialValue: [{ type: Input }],
678
740
  disabled: [{ type: Input }],
679
741
  autocomplete: [{ type: Input }],
680
- labelHidden: [{ type: Input }]
742
+ labelHidden: [{ type: Input }],
743
+ defaultCountryCode: [{ type: Input }],
744
+ dialCodeList: [{ type: Input }]
681
745
  };
682
746
 
683
747
  class ResetPasswordComponent {
@@ -694,6 +758,16 @@ class ResetPasswordComponent {
694
758
  const { authState } = this.authenticator;
695
759
  const { label } = getAliasInfoFromContext(authState.context);
696
760
  this.labelText = `Enter your ${label.toLowerCase()}`;
761
+ this.setFormFields();
762
+ }
763
+ setFormFields() {
764
+ var _a, _b;
765
+ const _state = this.authenticator.authState;
766
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.resetPassword;
767
+ }
768
+ grabField(name, field, defaultV) {
769
+ var _a, _b, _c;
770
+ 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;
697
771
  }
698
772
  get context() {
699
773
  return this.authenticator.slotContext;
@@ -711,7 +785,7 @@ class ResetPasswordComponent {
711
785
  ResetPasswordComponent.decorators = [
712
786
  { type: Component, args: [{
713
787
  selector: 'amplify-reset-password',
714
- 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"
788
+ 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"
715
789
  },] }
716
790
  ];
717
791
  ResetPasswordComponent.ctorParameters = () => [
@@ -737,11 +811,22 @@ class SetupTotpComponent {
737
811
  }
738
812
  ngOnInit() {
739
813
  this.generateQRCode();
814
+ this.setFormFields();
815
+ }
816
+ setFormFields() {
817
+ var _a, _b;
818
+ const _state = this.authenticator.authState;
819
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.setupTOTP;
820
+ }
821
+ grabField(name, field, defaultV) {
822
+ var _a, _b, _c;
823
+ 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;
740
824
  }
741
825
  get context() {
742
826
  return this.authenticator.slotContext;
743
827
  }
744
828
  generateQRCode() {
829
+ var _a, _b, _c, _d, _e, _f;
745
830
  return __awaiter(this, void 0, void 0, function* () {
746
831
  // TODO: This should be handled in core.
747
832
  const state = this.authenticator.authState;
@@ -749,8 +834,9 @@ class SetupTotpComponent {
749
834
  const { user } = actorContext;
750
835
  try {
751
836
  this.secretKey = yield Auth.setupTOTP(user);
752
- const issuer = 'AWSCognito';
753
- const totpCode = `otpauth://totp/${issuer}:${user.username}?secret=${this.secretKey}&issuer=${issuer}`;
837
+ const 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';
838
+ const 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;
839
+ const totpCode = `otpauth://totp/${issuer}:${username}?secret=${this.secretKey}&issuer=${issuer}`;
754
840
  logger.info('totp code was generated:', totpCode);
755
841
  this.qrCodeSource = yield QRCode.toDataURL(totpCode);
756
842
  }
@@ -776,7 +862,7 @@ class SetupTotpComponent {
776
862
  SetupTotpComponent.decorators = [
777
863
  { type: Component, args: [{
778
864
  selector: 'amplify-setup-totp',
779
- 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"
865
+ 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"
780
866
  },] }
781
867
  ];
782
868
  SetupTotpComponent.ctorParameters = () => [
@@ -797,6 +883,24 @@ class SignInComponent {
797
883
  : translate('Forgot your password? ');
798
884
  this.signInButtonText = translate('Sign in');
799
885
  }
886
+ ngOnInit() {
887
+ this.setFormFields();
888
+ }
889
+ setFormFields() {
890
+ var _a, _b, _c, _d;
891
+ const _state = this.authenticator.authState;
892
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.signIn;
893
+ this.userOverrides = (_c = this.formOverrides) === null || _c === void 0 ? void 0 : _c['username'];
894
+ this.passwordOR = (_d = this.formOverrides) === null || _d === void 0 ? void 0 : _d['password'];
895
+ }
896
+ labelHidden(name, defaultV = true) {
897
+ var _a, _b, _c;
898
+ 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;
899
+ }
900
+ required(name, defaultV = true) {
901
+ var _a, _b, _c;
902
+ 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;
903
+ }
800
904
  get context() {
801
905
  return this.authenticator.slotContext;
802
906
  }
@@ -813,7 +917,7 @@ class SignInComponent {
813
917
  SignInComponent.decorators = [
814
918
  { type: Component, args: [{
815
919
  selector: 'amplify-sign-in',
816
- 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",
920
+ 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",
817
921
  encapsulation: ViewEncapsulation.None
818
922
  },] }
819
923
  ];
@@ -877,12 +981,30 @@ class SignUpFormFieldsComponent {
877
981
  });
878
982
  // Only 1 is supported, so `['email', 'phone_number']` will only show `email`
879
983
  this.loginMechanism = this.fieldNames.shift();
984
+ const common = [
985
+ this.loginMechanism,
986
+ 'password',
987
+ 'confirm_password',
988
+ ];
989
+ this.fieldNamesCombined = [...common, ...this.fieldNames];
990
+ this.setFormFields();
991
+ }
992
+ setFormFields() {
993
+ var _a, _b, _c;
994
+ const _state = this.authenticator.authState;
995
+ this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.signUp;
996
+ this.userOverrides = (_c = this.formOverrides) === null || _c === void 0 ? void 0 : _c[this.loginMechanism];
997
+ this.order = setFormOrder(this.formOverrides, this.fieldNamesCombined);
998
+ }
999
+ grabField(name, field, defaultV) {
1000
+ var _a, _b, _c;
1001
+ 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;
880
1002
  }
881
1003
  }
882
1004
  SignUpFormFieldsComponent.decorators = [
883
1005
  { type: Component, args: [{
884
1006
  selector: 'amplify-sign-up-form-fields',
885
- 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"
1007
+ 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"
886
1008
  },] }
887
1009
  ];
888
1010
  SignUpFormFieldsComponent.ctorParameters = () => [
@@ -898,17 +1020,19 @@ class UserNameAliasComponent {
898
1020
  this.required = true;
899
1021
  }
900
1022
  ngOnInit() {
1023
+ var _a, _b, _c;
901
1024
  const context = this.authenticator.context;
902
- const { label, type } = getAliasInfoFromContext(context);
903
- this.label = label;
1025
+ const { label: lbl, type } = getAliasInfoFromContext(context);
1026
+ this.labelValue = (_a = this.label) !== null && _a !== void 0 ? _a : lbl;
904
1027
  this.type = type;
905
- this.placeholder = label;
1028
+ this.placeholderValue = (_b = this.placeholder) !== null && _b !== void 0 ? _b : lbl;
1029
+ this.requiredValue = (_c = this.required) !== null && _c !== void 0 ? _c : true;
906
1030
  }
907
1031
  }
908
1032
  UserNameAliasComponent.decorators = [
909
1033
  { type: Component, args: [{
910
1034
  selector: 'amplify-user-name-alias',
911
- 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"
1035
+ 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"
912
1036
  },] }
913
1037
  ];
914
1038
  UserNameAliasComponent.ctorParameters = () => [
@@ -918,7 +1042,12 @@ UserNameAliasComponent.propDecorators = {
918
1042
  name: [{ type: Input }],
919
1043
  disabled: [{ type: Input }],
920
1044
  initialValue: [{ type: Input }],
921
- required: [{ type: Input }]
1045
+ required: [{ type: Input }],
1046
+ labelHidden: [{ type: Input }],
1047
+ label: [{ type: Input }],
1048
+ placeholder: [{ type: Input }],
1049
+ dialCode: [{ type: Input }],
1050
+ dialCodeList: [{ type: Input }]
922
1051
  };
923
1052
 
924
1053
  class VerifyUserComponent {
@@ -1106,13 +1235,16 @@ class PhoneNumberFieldComponent {
1106
1235
  this.required = true;
1107
1236
  this.labelHidden = false;
1108
1237
  this.display = 'contents';
1109
- this.countryDialCodes = countryDialCodes;
1238
+ }
1239
+ ngOnInit() {
1240
+ var _a;
1241
+ this.countryDialCodesValues = (_a = this.dialCodeList) !== null && _a !== void 0 ? _a : countryDialCodes;
1110
1242
  }
1111
1243
  }
1112
1244
  PhoneNumberFieldComponent.decorators = [
1113
1245
  { type: Component, args: [{
1114
1246
  selector: 'amplify-phone-number-field',
1115
- 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"
1247
+ 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"
1116
1248
  },] }
1117
1249
  ];
1118
1250
  PhoneNumberFieldComponent.propDecorators = {
@@ -1128,6 +1260,7 @@ PhoneNumberFieldComponent.propDecorators = {
1128
1260
  required: [{ type: Input }],
1129
1261
  type: [{ type: Input }],
1130
1262
  labelHidden: [{ type: Input }],
1263
+ dialCodeList: [{ type: Input }],
1131
1264
  display: [{ type: HostBinding, args: ['style.display',] }]
1132
1265
  };
1133
1266