@aws-amplify/ui-angular 2.2.1 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/aws-amplify-ui-angular.d.ts +24 -24
- package/aws-amplify-ui-angular.metadata.json +1 -1
- package/bundles/aws-amplify-ui-angular.umd.js +110 -314
- package/bundles/aws-amplify-ui-angular.umd.js.map +1 -1
- package/bundles/aws-amplify-ui-angular.umd.min.js +1 -1
- package/bundles/aws-amplify-ui-angular.umd.min.js.map +1 -1
- package/esm2015/aws-amplify-ui-angular.js +25 -25
- package/esm2015/lib/common/helpers.js +3 -3
- package/esm2015/lib/common/types/auth-types.js +1 -1
- package/esm2015/lib/components/authenticator/authenticator.module.js +3 -3
- package/esm2015/lib/components/authenticator/components/base-form-fields/base-form-fields.component.js +54 -0
- package/esm2015/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.js +3 -15
- package/esm2015/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.js +3 -13
- package/esm2015/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.js +3 -15
- package/esm2015/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.js +3 -15
- package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password-form-fields/force-new-password-form-fields.component.js +2 -22
- package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password.component.js +3 -15
- package/esm2015/lib/components/authenticator/components/form-field/form-field.component.js +12 -67
- package/esm2015/lib/components/authenticator/components/index.js +2 -2
- package/esm2015/lib/components/authenticator/components/reset-password/reset-password.component.js +3 -19
- package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +3 -13
- package/esm2015/lib/components/authenticator/components/sign-in/sign-in.component.js +3 -21
- package/esm2015/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.js +2 -44
- package/fesm2015/aws-amplify-ui-angular.js +75 -277
- package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
- package/lib/common/types/auth-types.d.ts +2 -2
- package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +2 -2
- package/lib/components/authenticator/components/base-form-fields/base-form-fields.component.d.ts +15 -0
- package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +5 -9
- package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +4 -6
- package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +5 -9
- package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +5 -9
- package/lib/components/authenticator/components/force-new-password/force-new-password-form-fields/force-new-password-form-fields.component.d.ts +1 -7
- package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +3 -9
- package/lib/components/authenticator/components/form-field/form-field.component.d.ts +5 -29
- package/lib/components/authenticator/components/index.d.ts +1 -1
- package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +5 -10
- package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +5 -6
- package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +5 -12
- package/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.d.ts +1 -17
- package/lib/components/authenticator/components/sign-up/sign-up.component.d.ts +2 -2
- package/lib/components/authenticator/components/verify-user/verify-user.component.d.ts +2 -2
- package/lib/services/authenticator.service.d.ts +3 -3
- package/package.json +7 -2
- package/esm2015/lib/components/authenticator/components/user-name-alias/user-name-alias.component.js +0 -42
- package/lib/components/authenticator/components/user-name-alias/user-name-alias.component.d.ts +0 -21
|
@@ -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,
|
|
4
|
+
import { createAuthenticatorMachine, getServiceContextFacade, listenToAuthHub, getSendEventAliases, translate, getFormDataFromEvent, getActorContext, AuthChallengeNames, FederatedIdentityProviders, countryDialCodes, getErrors, hasTranslation, defaultFormFieldOptions, getActorState, getSortedFormFields, getDefaultFormFields, applyDefaults, sortFormFields } 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';
|
|
@@ -291,18 +291,6 @@ class ConfirmResetPasswordComponent {
|
|
|
291
291
|
this.backToSignInText = translate('Back to Sign In');
|
|
292
292
|
this.resendCodeText = translate('Resend Code');
|
|
293
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
|
-
}
|
|
306
294
|
get context() {
|
|
307
295
|
return this.authenticator.slotContext;
|
|
308
296
|
}
|
|
@@ -319,7 +307,7 @@ class ConfirmResetPasswordComponent {
|
|
|
319
307
|
ConfirmResetPasswordComponent.decorators = [
|
|
320
308
|
{ type: Component, args: [{
|
|
321
309
|
selector: 'amplify-confirm-reset-password',
|
|
322
|
-
template: "<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
|
|
310
|
+
template: "<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\n <amplify-base-form-fields\n route=\"confirmResetPassword\"\n ></amplify-base-form-fields>\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"
|
|
323
311
|
},] }
|
|
324
312
|
];
|
|
325
313
|
ConfirmResetPasswordComponent.ctorParameters = () => [
|
|
@@ -340,16 +328,6 @@ class ConfirmSignInComponent {
|
|
|
340
328
|
}
|
|
341
329
|
ngOnInit() {
|
|
342
330
|
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;
|
|
353
331
|
}
|
|
354
332
|
get context() {
|
|
355
333
|
return this.authenticator.slotContext;
|
|
@@ -382,7 +360,7 @@ class ConfirmSignInComponent {
|
|
|
382
360
|
ConfirmSignInComponent.decorators = [
|
|
383
361
|
{ type: Component, args: [{
|
|
384
362
|
selector: 'amplify-confirm-sign-in',
|
|
385
|
-
template: "<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-
|
|
363
|
+
template: "<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-base-form-fields route=\"confirmSignIn\"></amplify-base-form-fields>\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"
|
|
386
364
|
},] }
|
|
387
365
|
];
|
|
388
366
|
ConfirmSignInComponent.ctorParameters = () => [
|
|
@@ -405,18 +383,6 @@ class ConfirmSignUpComponent {
|
|
|
405
383
|
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.');
|
|
406
384
|
this.minutesMessage = translate('It may take a minute to arrive.');
|
|
407
385
|
}
|
|
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
|
-
}
|
|
420
386
|
get context() {
|
|
421
387
|
return this.authenticator.slotContext;
|
|
422
388
|
}
|
|
@@ -449,7 +415,7 @@ class ConfirmSignUpComponent {
|
|
|
449
415
|
ConfirmSignUpComponent.decorators = [
|
|
450
416
|
{ type: Component, args: [{
|
|
451
417
|
selector: 'amplify-confirm-sign-up',
|
|
452
|
-
template: "<ng-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-
|
|
418
|
+
template: "<ng-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-base-form-fields\n route=\"confirmSignUp\"\n ></amplify-base-form-fields>\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</ng-container>\n"
|
|
453
419
|
},] }
|
|
454
420
|
];
|
|
455
421
|
ConfirmSignUpComponent.ctorParameters = () => [
|
|
@@ -469,18 +435,6 @@ class ConfirmVerifyUserComponent {
|
|
|
469
435
|
this.skipText = translate('Skip');
|
|
470
436
|
this.submitText = translate('Submit');
|
|
471
437
|
}
|
|
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
|
-
}
|
|
484
438
|
get context() {
|
|
485
439
|
return this.authenticator.slotContext;
|
|
486
440
|
}
|
|
@@ -497,7 +451,7 @@ class ConfirmVerifyUserComponent {
|
|
|
497
451
|
ConfirmVerifyUserComponent.decorators = [
|
|
498
452
|
{ type: Component, args: [{
|
|
499
453
|
selector: 'amplify-confirm-verify-user',
|
|
500
|
-
template: "<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-
|
|
454
|
+
template: "<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-base-form-fields\n route=\"confirmVerifyUser\"\n ></amplify-base-form-fields>\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"
|
|
501
455
|
},] }
|
|
502
456
|
];
|
|
503
457
|
ConfirmVerifyUserComponent.ctorParameters = () => [
|
|
@@ -585,21 +539,9 @@ class ForceNewPasswordComponent {
|
|
|
585
539
|
this.changePasswordText = translate('Change Password');
|
|
586
540
|
this.backToSignInText = translate('Back to Sign In');
|
|
587
541
|
}
|
|
588
|
-
ngOnInit() {
|
|
589
|
-
this.setFormFields();
|
|
590
|
-
}
|
|
591
542
|
get context() {
|
|
592
543
|
return this.authenticator.slotContext;
|
|
593
544
|
}
|
|
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
|
-
}
|
|
603
545
|
onInput(event) {
|
|
604
546
|
event.preventDefault();
|
|
605
547
|
const { name, value } = event.target;
|
|
@@ -613,7 +555,7 @@ class ForceNewPasswordComponent {
|
|
|
613
555
|
ForceNewPasswordComponent.decorators = [
|
|
614
556
|
{ type: Component, args: [{
|
|
615
557
|
selector: 'amplify-force-new-password',
|
|
616
|
-
template: "<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
|
|
558
|
+
template: "<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\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"
|
|
617
559
|
},] }
|
|
618
560
|
];
|
|
619
561
|
ForceNewPasswordComponent.ctorParameters = () => [
|
|
@@ -625,106 +567,41 @@ ForceNewPasswordComponent.propDecorators = {
|
|
|
625
567
|
};
|
|
626
568
|
|
|
627
569
|
class ForceNewPasswordFormFieldsComponent {
|
|
628
|
-
constructor(authenticator) {
|
|
629
|
-
this.authenticator = authenticator;
|
|
630
|
-
}
|
|
631
|
-
ngOnInit() {
|
|
632
|
-
const state = this.authenticator.authState;
|
|
633
|
-
const actorContext = getActorContext(state);
|
|
634
|
-
const { requiredAttributes } = actorContext;
|
|
635
|
-
this.fieldNames = requiredAttributes.filter((fieldName) => {
|
|
636
|
-
const hasDefaultField = !!authInputAttributes[fieldName];
|
|
637
|
-
if (!hasDefaultField) {
|
|
638
|
-
console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize Authenticator.SignUp.FormFields to add your own.`);
|
|
639
|
-
}
|
|
640
|
-
return hasDefaultField;
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
570
|
}
|
|
644
571
|
ForceNewPasswordFormFieldsComponent.decorators = [
|
|
645
572
|
{ type: Component, args: [{
|
|
646
573
|
selector: 'amplify-force-new-password-form-fields',
|
|
647
|
-
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <
|
|
574
|
+
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <amplify-base-form-fields route=\"forceNewPassword\"></amplify-base-form-fields>\n</div>\n"
|
|
648
575
|
},] }
|
|
649
576
|
];
|
|
650
|
-
ForceNewPasswordFormFieldsComponent.ctorParameters = () => [
|
|
651
|
-
{ type: AuthenticatorService }
|
|
652
|
-
];
|
|
653
577
|
|
|
654
|
-
const getAttributeMap = () => authInputAttributes;
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* Input interface opinionated for authenticator usage.
|
|
658
|
-
*
|
|
659
|
-
* TODO: Separate this component out to two parts -- 1) amplify-auth-input that
|
|
660
|
-
* contains authenticator opinionated logic and 2) amplify-text-field primitive
|
|
661
|
-
* that does not make any auth-related inference.
|
|
662
|
-
*/
|
|
663
578
|
class FormFieldComponent {
|
|
664
579
|
constructor(authenticator) {
|
|
665
580
|
this.authenticator = authenticator;
|
|
666
|
-
this.required = true;
|
|
667
|
-
this.placeholder = '';
|
|
668
|
-
this.label = '';
|
|
669
|
-
this.initialValue = '';
|
|
670
|
-
this.disabled = false;
|
|
671
|
-
this.autocomplete = '';
|
|
672
|
-
this.labelHidden = true;
|
|
673
581
|
this.countryDialCodesValue = countryDialCodes;
|
|
674
582
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
if (this.isPhoneField()) {
|
|
679
|
-
const state = this.authenticator.authState;
|
|
680
|
-
const { country_code } = getActorContext(state);
|
|
681
|
-
this.defaultCountryCodeValue = (_a = this.defaultCountryCode) !== null && _a !== void 0 ? _a : country_code;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
get attributeMap() {
|
|
685
|
-
return getAttributeMap();
|
|
686
|
-
}
|
|
687
|
-
get error() {
|
|
688
|
-
const formContext = getActorContext(this.authenticator.authState);
|
|
689
|
-
const { validationError } = formContext;
|
|
690
|
-
return translate(validationError[this.name]);
|
|
583
|
+
get errors() {
|
|
584
|
+
const { validationErrors } = this.authenticator;
|
|
585
|
+
return getErrors(validationErrors[this.name]);
|
|
691
586
|
}
|
|
692
587
|
onBlur($event) {
|
|
693
588
|
let { name } = $event.target;
|
|
694
589
|
this.authenticator.updateBlur({ name });
|
|
695
590
|
}
|
|
696
|
-
inferLabel() {
|
|
697
|
-
var _a;
|
|
698
|
-
const label = this.label || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.label);
|
|
699
|
-
return translate(label);
|
|
700
|
-
}
|
|
701
|
-
inferPlaceholder() {
|
|
702
|
-
var _a;
|
|
703
|
-
const placeholder = this.placeholder || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.placeholder) ||
|
|
704
|
-
this.inferLabel();
|
|
705
|
-
return translate(placeholder);
|
|
706
|
-
}
|
|
707
|
-
// infers what the `type` of underlying input element should be.
|
|
708
|
-
inferType() {
|
|
709
|
-
var _a, _b, _c;
|
|
710
|
-
return (_c = (_a = this.type) !== null && _a !== void 0 ? _a : (_b = this.attributeMap[this.name]) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : 'text';
|
|
711
|
-
}
|
|
712
|
-
inferAutocomplete() {
|
|
713
|
-
var _a;
|
|
714
|
-
return this.autocomplete || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.autocomplete);
|
|
715
|
-
}
|
|
716
|
-
// TODO(enhancement): use enum to differentiate special field types
|
|
717
591
|
isPasswordField() {
|
|
718
|
-
return this.
|
|
592
|
+
return this.formField.type === 'password';
|
|
719
593
|
}
|
|
720
594
|
isPhoneField() {
|
|
721
|
-
return this.
|
|
595
|
+
return this.formField.type === 'tel';
|
|
596
|
+
}
|
|
597
|
+
translate(phrase) {
|
|
598
|
+
return translate(phrase);
|
|
722
599
|
}
|
|
723
600
|
}
|
|
724
601
|
FormFieldComponent.decorators = [
|
|
725
602
|
{ type: Component, args: [{
|
|
726
603
|
selector: 'amplify-form-field',
|
|
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 [
|
|
604
|
+
template: "<div class=\"amplify-flex amplify-field\" style=\"flex-direction: column\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [name]=\"name\"\n [label]=\"formField.label\"\n [defaultCountryCode]=\"formField.dialCode\"\n [dialCodeList]=\"formField.dialCodeList\"\n [placeholder]=\"formField.placeholder\"\n [required]=\"formField.isRequired\"\n [labelHidden]=\"formField.labelHidden\"\n [autocomplete]=\"formField.autocomplete\"\n type=\"tel\"\n ></amplify-phone-number-field>\n\n <amplify-password-field\n *ngIf=\"isPasswordField()\"\n [name]=\"name\"\n [label]=\"formField.label\"\n [placeholder]=\"formField.placeholder\"\n [required]=\"formField.isRequired\"\n [labelHidden]=\"formField.labelHidden\"\n [autocomplete]=\"formField.autocomplete\"\n (setBlur)=\"onBlur($event)\"\n ></amplify-password-field>\n\n <amplify-text-field\n *ngIf=\"!isPasswordField() && !isPhoneField()\"\n [name]=\"name\"\n [label]=\"formField.label\"\n [placeholder]=\"formField.placeholder\"\n [required]=\"formField.isRequired\"\n [labelHidden]=\"formField.labelHidden\"\n [autocomplete]=\"formField.autocomplete\"\n [type]=\"formField.type\"\n ></amplify-text-field>\n <div data-amplify-sign-up-errors *ngIf=\"errors?.length > 0\">\n <div\n class=\"amplify-text\"\n data-variation=\"error\"\n *ngFor=\"let error of errors\"\n >\n {{ translate(error) }}\n </div>\n </div>\n</div>\n"
|
|
728
605
|
},] }
|
|
729
606
|
];
|
|
730
607
|
FormFieldComponent.ctorParameters = () => [
|
|
@@ -732,16 +609,7 @@ FormFieldComponent.ctorParameters = () => [
|
|
|
732
609
|
];
|
|
733
610
|
FormFieldComponent.propDecorators = {
|
|
734
611
|
name: [{ type: Input }],
|
|
735
|
-
|
|
736
|
-
required: [{ type: Input }],
|
|
737
|
-
placeholder: [{ type: Input }],
|
|
738
|
-
label: [{ type: Input }],
|
|
739
|
-
initialValue: [{ type: Input }],
|
|
740
|
-
disabled: [{ type: Input }],
|
|
741
|
-
autocomplete: [{ type: Input }],
|
|
742
|
-
labelHidden: [{ type: Input }],
|
|
743
|
-
defaultCountryCode: [{ type: Input }],
|
|
744
|
-
dialCodeList: [{ type: Input }]
|
|
612
|
+
formField: [{ type: Input }]
|
|
745
613
|
};
|
|
746
614
|
|
|
747
615
|
class ResetPasswordComponent {
|
|
@@ -752,22 +620,6 @@ class ResetPasswordComponent {
|
|
|
752
620
|
// translated texts
|
|
753
621
|
this.sendCodeText = translate('Send Code');
|
|
754
622
|
this.backToSignInText = translate('Back to Sign In');
|
|
755
|
-
this.labelText = translate('Username');
|
|
756
|
-
}
|
|
757
|
-
ngOnInit() {
|
|
758
|
-
const { authState } = this.authenticator;
|
|
759
|
-
const { label } = getAliasInfoFromContext(authState.context);
|
|
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;
|
|
771
623
|
}
|
|
772
624
|
get context() {
|
|
773
625
|
return this.authenticator.slotContext;
|
|
@@ -785,7 +637,7 @@ class ResetPasswordComponent {
|
|
|
785
637
|
ResetPasswordComponent.decorators = [
|
|
786
638
|
{ type: Component, args: [{
|
|
787
639
|
selector: 'amplify-reset-password',
|
|
788
|
-
template: "<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-
|
|
640
|
+
template: "<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-base-form-fields route=\"resetPassword\"></amplify-base-form-fields>\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"
|
|
789
641
|
},] }
|
|
790
642
|
];
|
|
791
643
|
ResetPasswordComponent.ctorParameters = () => [
|
|
@@ -811,16 +663,6 @@ class SetupTotpComponent {
|
|
|
811
663
|
}
|
|
812
664
|
ngOnInit() {
|
|
813
665
|
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;
|
|
824
666
|
}
|
|
825
667
|
get context() {
|
|
826
668
|
return this.authenticator.slotContext;
|
|
@@ -862,7 +704,7 @@ class SetupTotpComponent {
|
|
|
862
704
|
SetupTotpComponent.decorators = [
|
|
863
705
|
{ type: Component, args: [{
|
|
864
706
|
selector: 'amplify-setup-totp',
|
|
865
|
-
template: "<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 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 />\n </svg>\n </div>\n </div>\n\n <amplify-form-
|
|
707
|
+
template: "<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 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 />\n </svg>\n </div>\n </div>\n\n <amplify-base-form-fields route=\"setupTOTP\"></amplify-base-form-fields>\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"
|
|
866
708
|
},] }
|
|
867
709
|
];
|
|
868
710
|
SetupTotpComponent.ctorParameters = () => [
|
|
@@ -883,24 +725,6 @@ class SignInComponent {
|
|
|
883
725
|
: translate('Forgot your password? ');
|
|
884
726
|
this.signInButtonText = translate('Sign in');
|
|
885
727
|
}
|
|
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
|
-
}
|
|
904
728
|
get context() {
|
|
905
729
|
return this.authenticator.slotContext;
|
|
906
730
|
}
|
|
@@ -917,7 +741,7 @@ class SignInComponent {
|
|
|
917
741
|
SignInComponent.decorators = [
|
|
918
742
|
{ type: Component, args: [{
|
|
919
743
|
selector: 'amplify-sign-in',
|
|
920
|
-
template: "<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
|
|
744
|
+
template: "<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 class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset\n [disabled]=\"authenticator.isPending\">\n <legend class=\"amplify-visually-hidden\">Sign in</legend>\n <amplify-base-form-fields route=\"signIn\"></amplify-base-form-fields>\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 amplify-button fontWeight=\"normal\" size=\"small\" variation=\"link\" fullWidth=\"true\"\n (click)=\"authenticator.toResetPassword()\">\n {{ forgotPasswordText }}\n </button>\n </div>\n</amplify-slot>\n",
|
|
921
745
|
encapsulation: ViewEncapsulation.None
|
|
922
746
|
},] }
|
|
923
747
|
];
|
|
@@ -963,92 +787,15 @@ SignUpComponent.propDecorators = {
|
|
|
963
787
|
};
|
|
964
788
|
|
|
965
789
|
class SignUpFormFieldsComponent {
|
|
966
|
-
constructor(authenticator) {
|
|
967
|
-
this.authenticator = authenticator;
|
|
968
|
-
this.primaryAlias = '';
|
|
969
|
-
this.secondaryAliases = [];
|
|
970
|
-
}
|
|
971
|
-
ngOnInit() {
|
|
972
|
-
const context = this.authenticator.context;
|
|
973
|
-
const { loginMechanisms, signUpAttributes } = context.config;
|
|
974
|
-
this.fieldNames = Array.from(new Set([...loginMechanisms, ...signUpAttributes]));
|
|
975
|
-
this.fieldNames = this.fieldNames.filter((fieldName) => {
|
|
976
|
-
const hasDefaultField = !!authInputAttributes[fieldName];
|
|
977
|
-
if (!hasDefaultField) {
|
|
978
|
-
console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize Authenticator.SignUp.FormFields to add your own.`);
|
|
979
|
-
}
|
|
980
|
-
return hasDefaultField;
|
|
981
|
-
});
|
|
982
|
-
// Only 1 is supported, so `['email', 'phone_number']` will only show `email`
|
|
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;
|
|
1002
|
-
}
|
|
1003
790
|
}
|
|
1004
791
|
SignUpFormFieldsComponent.decorators = [
|
|
1005
792
|
{ type: Component, args: [{
|
|
1006
793
|
selector: 'amplify-sign-up-form-fields',
|
|
1007
|
-
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <
|
|
794
|
+
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <amplify-base-form-fields route=\"signUp\"></amplify-base-form-fields>\n</div>\n"
|
|
1008
795
|
},] }
|
|
1009
796
|
];
|
|
1010
|
-
SignUpFormFieldsComponent.ctorParameters = () => [
|
|
1011
|
-
{ type: AuthenticatorService }
|
|
1012
|
-
];
|
|
1013
797
|
|
|
1014
|
-
|
|
1015
|
-
constructor(authenticator) {
|
|
1016
|
-
this.authenticator = authenticator;
|
|
1017
|
-
this.name = 'username';
|
|
1018
|
-
this.disabled = false;
|
|
1019
|
-
this.initialValue = '';
|
|
1020
|
-
this.required = true;
|
|
1021
|
-
}
|
|
1022
|
-
ngOnInit() {
|
|
1023
|
-
var _a, _b, _c;
|
|
1024
|
-
const context = this.authenticator.context;
|
|
1025
|
-
const { label: lbl, type } = getAliasInfoFromContext(context);
|
|
1026
|
-
this.labelValue = (_a = this.label) !== null && _a !== void 0 ? _a : lbl;
|
|
1027
|
-
this.type = type;
|
|
1028
|
-
this.placeholderValue = (_b = this.placeholder) !== null && _b !== void 0 ? _b : lbl;
|
|
1029
|
-
this.requiredValue = (_c = this.required) !== null && _c !== void 0 ? _c : true;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
UserNameAliasComponent.decorators = [
|
|
1033
|
-
{ type: Component, args: [{
|
|
1034
|
-
selector: 'amplify-user-name-alias',
|
|
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"
|
|
1036
|
-
},] }
|
|
1037
|
-
];
|
|
1038
|
-
UserNameAliasComponent.ctorParameters = () => [
|
|
1039
|
-
{ type: AuthenticatorService }
|
|
1040
|
-
];
|
|
1041
|
-
UserNameAliasComponent.propDecorators = {
|
|
1042
|
-
name: [{ type: Input }],
|
|
1043
|
-
disabled: [{ type: Input }],
|
|
1044
|
-
initialValue: [{ 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 }]
|
|
1051
|
-
};
|
|
798
|
+
const getAttributeMap = () => defaultFormFieldOptions;
|
|
1052
799
|
|
|
1053
800
|
class VerifyUserComponent {
|
|
1054
801
|
constructor(authenticator) {
|
|
@@ -1099,6 +846,57 @@ VerifyUserComponent.propDecorators = {
|
|
|
1099
846
|
headerText: [{ type: Input }]
|
|
1100
847
|
};
|
|
1101
848
|
|
|
849
|
+
/**
|
|
850
|
+
* Sorts the given formFields, then renders them in order.
|
|
851
|
+
*/
|
|
852
|
+
class BaseFormFieldsComponent {
|
|
853
|
+
constructor(authenticator) {
|
|
854
|
+
this.authenticator = authenticator;
|
|
855
|
+
this.display = 'contents';
|
|
856
|
+
this.formFields = [];
|
|
857
|
+
}
|
|
858
|
+
ngOnInit() {
|
|
859
|
+
const state = this.authenticator.authState;
|
|
860
|
+
this.formFields = getSortedFormFields(this.route, state);
|
|
861
|
+
if (this.route === 'confirmSignUp') {
|
|
862
|
+
this.handleConfirmSignUp();
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
handleConfirmSignUp() {
|
|
866
|
+
/**
|
|
867
|
+
* @todo(breaking): Angular `confirmSignUp` has different placholder here from other frameworks.
|
|
868
|
+
*
|
|
869
|
+
* Translating here in a backwards-compatible manner, but should be resolved in next major version.
|
|
870
|
+
*/
|
|
871
|
+
var _a;
|
|
872
|
+
const state = this.authenticator.authState;
|
|
873
|
+
// backwards compatible placeholder text
|
|
874
|
+
const placeholder = !hasTranslation('Confirmation Code')
|
|
875
|
+
? translate('Enter your code') // prioritize new placeholder
|
|
876
|
+
: translate('Confirmation Code'); // legacy placeholder
|
|
877
|
+
let defaultFormFields = getDefaultFormFields(this.route, state);
|
|
878
|
+
if (defaultFormFields.confirmation_code.placeholder) {
|
|
879
|
+
defaultFormFields.confirmation_code.placeholder = placeholder;
|
|
880
|
+
}
|
|
881
|
+
const customFormFields = ((_a = getActorContext(state).formFields) === null || _a === void 0 ? void 0 : _a.confirmSignUp) || {};
|
|
882
|
+
const newFormFields = applyDefaults(defaultFormFields, customFormFields);
|
|
883
|
+
this.formFields = sortFormFields(newFormFields);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
BaseFormFieldsComponent.decorators = [
|
|
887
|
+
{ type: Component, args: [{
|
|
888
|
+
selector: 'amplify-base-form-fields',
|
|
889
|
+
template: "<ng-container *ngFor=\"let formField of formFields\">\n <amplify-form-field\n [name]=\"formField[0]\"\n [formField]=\"formField[1]\"\n ></amplify-form-field>\n</ng-container>\n"
|
|
890
|
+
},] }
|
|
891
|
+
];
|
|
892
|
+
BaseFormFieldsComponent.ctorParameters = () => [
|
|
893
|
+
{ type: AuthenticatorService }
|
|
894
|
+
];
|
|
895
|
+
BaseFormFieldsComponent.propDecorators = {
|
|
896
|
+
route: [{ type: Input }],
|
|
897
|
+
display: [{ type: HostBinding, args: ['style.display',] }]
|
|
898
|
+
};
|
|
899
|
+
|
|
1102
900
|
class ButtonComponent {
|
|
1103
901
|
constructor() {
|
|
1104
902
|
this.type = 'button';
|
|
@@ -1414,6 +1212,7 @@ AmplifyAuthenticatorModule.decorators = [
|
|
|
1414
1212
|
AmplifySlotComponent,
|
|
1415
1213
|
AmplifySlotDirective,
|
|
1416
1214
|
AuthenticatorComponent,
|
|
1215
|
+
BaseFormFieldsComponent,
|
|
1417
1216
|
ButtonComponent,
|
|
1418
1217
|
CheckboxComponent,
|
|
1419
1218
|
ConfirmResetPasswordComponent,
|
|
@@ -1437,7 +1236,6 @@ AmplifyAuthenticatorModule.decorators = [
|
|
|
1437
1236
|
TabItemComponent,
|
|
1438
1237
|
TabsComponent,
|
|
1439
1238
|
TextFieldComponent,
|
|
1440
|
-
UserNameAliasComponent,
|
|
1441
1239
|
VerifyUserComponent,
|
|
1442
1240
|
],
|
|
1443
1241
|
imports: [CommonModule],
|
|
@@ -1460,5 +1258,5 @@ AmplifyAuthenticatorModule.decorators = [
|
|
|
1460
1258
|
* Generated bundle index. Do not edit.
|
|
1461
1259
|
*/
|
|
1462
1260
|
|
|
1463
|
-
export { AmplifyAuthenticatorModule, AmplifySlotDirective, AuthenticatorComponent, AuthenticatorService, ButtonComponent, CheckboxComponent, ConfirmResetPasswordComponent, ConfirmSignInComponent, ConfirmSignUpComponent, ConfirmVerifyUserComponent, CustomComponentsService, ErrorComponent, FederatedSignInButtonComponent, FederatedSignInComponent, ForceNewPasswordComponent, ForceNewPasswordFormFieldsComponent, FormFieldComponent, PasswordFieldComponent, PhoneNumberFieldComponent, ResetPasswordComponent, SelectComponent, SetupTotpComponent, SignInComponent, SignUpComponent, SignUpFormFieldsComponent, TabItemComponent, TabsComponent, TextFieldComponent,
|
|
1261
|
+
export { AmplifyAuthenticatorModule, AmplifySlotDirective, AuthenticatorComponent, AuthenticatorService, BaseFormFieldsComponent, ButtonComponent, CheckboxComponent, ConfirmResetPasswordComponent, ConfirmSignInComponent, ConfirmSignUpComponent, ConfirmVerifyUserComponent, CustomComponentsService, ErrorComponent, FederatedSignInButtonComponent, FederatedSignInComponent, ForceNewPasswordComponent, ForceNewPasswordFormFieldsComponent, FormFieldComponent, PasswordFieldComponent, PhoneNumberFieldComponent, ResetPasswordComponent, SelectComponent, SetupTotpComponent, SignInComponent, SignUpComponent, SignUpFormFieldsComponent, TabItemComponent, TabsComponent, TextFieldComponent, VerifyUserComponent, getAttributeMap, AmplifySlotComponent as ɵa, AuthenticatorComponent as ɵb, VerifyUserComponent as ɵba, BaseFormFieldsComponent as ɵc, ButtonComponent as ɵd, CheckboxComponent as ɵe, ConfirmResetPasswordComponent as ɵf, ConfirmSignInComponent as ɵg, ConfirmSignUpComponent as ɵh, ConfirmVerifyUserComponent as ɵi, ErrorComponent as ɵj, FederatedSignInButtonComponent as ɵk, FederatedSignInComponent as ɵl, ForceNewPasswordComponent as ɵm, ForceNewPasswordFormFieldsComponent as ɵn, FormFieldComponent as ɵo, PasswordFieldComponent as ɵp, PhoneNumberFieldComponent as ɵq, ResetPasswordComponent as ɵr, SelectComponent as ɵs, SetupTotpComponent as ɵt, SignInComponent as ɵu, SignUpComponent as ɵv, SignUpFormFieldsComponent as ɵw, TabItemComponent as ɵx, TabsComponent as ɵy, TextFieldComponent as ɵz };
|
|
1464
1262
|
//# sourceMappingURL=aws-amplify-ui-angular.js.map
|