@aws-amplify/ui-angular 2.1.1 → 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.
- package/aws-amplify-ui-angular.metadata.json +1 -1
- package/bundles/aws-amplify-ui-angular.umd.js +204 -61
- 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/index.js +5 -1
- package/esm2015/lib/components/authenticator/components/authenticator/authenticator.component.js +4 -2
- package/esm2015/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.js +16 -4
- package/esm2015/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.js +14 -4
- package/esm2015/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.js +23 -7
- package/esm2015/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.js +16 -4
- package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password.component.js +16 -4
- package/esm2015/lib/components/authenticator/components/form-field/form-field.component.js +8 -5
- package/esm2015/lib/components/authenticator/components/reset-password/reset-password.component.js +14 -4
- package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +18 -6
- package/esm2015/lib/components/authenticator/components/sign-in/sign-in.component.js +23 -5
- package/esm2015/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.js +21 -3
- package/esm2015/lib/components/authenticator/components/sign-up/sign-up.component.js +3 -3
- package/esm2015/lib/components/authenticator/components/user-name-alias/user-name-alias.component.js +13 -6
- package/esm2015/lib/components/authenticator/components/verify-user/verify-user.component.js +3 -3
- package/esm2015/lib/primitives/password-field/password-field.component.js +2 -2
- package/esm2015/lib/primitives/phone-number-field/phone-number-field.component.js +7 -3
- package/esm2015/lib/primitives/select/select.component.js +2 -2
- package/esm2015/lib/primitives/text-field/text-field.component.js +2 -2
- package/esm2015/lib/services/authenticator.service.js +3 -2
- package/fesm2015/aws-amplify-ui-angular.js +179 -41
- package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
- package/index.d.ts +4 -0
- package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +1 -0
- package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +7 -1
- package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +4 -0
- package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +11 -1
- package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +7 -1
- package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +7 -1
- package/lib/components/authenticator/components/form-field/form-field.component.d.ts +3 -1
- package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +4 -0
- package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +4 -0
- package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +10 -1
- package/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.d.ts +7 -1
- package/lib/components/authenticator/components/user-name-alias/user-name-alias.component.d.ts +7 -1
- package/lib/primitives/phone-number-field/phone-number-field.component.d.ts +5 -2
- package/lib/services/authenticator.service.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
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, getActorContext, AuthChallengeNames, FederatedIdentityProviders, authInputAttributes, countryDialCodes, getAliasInfoFromContext, hasTranslation,
|
|
4
|
+
import { createAuthenticatorMachine, getServiceContextFacade, listenToAuthHub, getSendEventAliases, translate, getActorState, getFormDataFromEvent, getActorContext, AuthChallengeNames, FederatedIdentityProviders, authInputAttributes, countryDialCodes, getAliasInfoFromContext, hasTranslation, setFormOrder } from '@aws-amplify/ui';
|
|
5
|
+
export { translations } from '@aws-amplify/ui';
|
|
5
6
|
import { Logger } from '@aws-amplify/core';
|
|
6
7
|
import { interpret } from 'xstate';
|
|
7
8
|
import { Logger as Logger$1, Auth } from 'aws-amplify';
|
|
@@ -55,7 +56,7 @@ const logger$2 = new Logger('state-machine');
|
|
|
55
56
|
* AuthenticatorService provides access to the authenticator state and context.
|
|
56
57
|
*/
|
|
57
58
|
class AuthenticatorService {
|
|
58
|
-
startMachine({ initialState, loginMechanisms, services, signUpAttributes, socialProviders, }) {
|
|
59
|
+
startMachine({ initialState, loginMechanisms, services, signUpAttributes, socialProviders, formFields, }) {
|
|
59
60
|
const machine = createAuthenticatorMachine();
|
|
60
61
|
const authService = interpret(machine).start();
|
|
61
62
|
authService.send({
|
|
@@ -66,6 +67,7 @@ class AuthenticatorService {
|
|
|
66
67
|
socialProviders,
|
|
67
68
|
signUpAttributes,
|
|
68
69
|
services,
|
|
70
|
+
formFields,
|
|
69
71
|
},
|
|
70
72
|
});
|
|
71
73
|
this._machineSubscription = authService.subscribe((state) => {
|
|
@@ -200,13 +202,14 @@ class AuthenticatorComponent {
|
|
|
200
202
|
this.signUpTitle = translate('Create Account');
|
|
201
203
|
}
|
|
202
204
|
ngOnInit() {
|
|
203
|
-
const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, } = this;
|
|
205
|
+
const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, formFields, } = this;
|
|
204
206
|
this.authenticator.startMachine({
|
|
205
207
|
initialState,
|
|
206
208
|
loginMechanisms,
|
|
207
209
|
services,
|
|
208
210
|
signUpAttributes,
|
|
209
211
|
socialProviders,
|
|
212
|
+
formFields,
|
|
210
213
|
});
|
|
211
214
|
/**
|
|
212
215
|
* handling translations after content init, because authenticator and its
|
|
@@ -267,6 +270,7 @@ AuthenticatorComponent.ctorParameters = () => [
|
|
|
267
270
|
{ type: CustomComponentsService }
|
|
268
271
|
];
|
|
269
272
|
AuthenticatorComponent.propDecorators = {
|
|
273
|
+
formFields: [{ type: Input }],
|
|
270
274
|
initialState: [{ type: Input }],
|
|
271
275
|
loginMechanisms: [{ type: Input }],
|
|
272
276
|
services: [{ type: Input }],
|
|
@@ -287,6 +291,18 @@ class ConfirmResetPasswordComponent {
|
|
|
287
291
|
this.backToSignInText = translate('Back to Sign In');
|
|
288
292
|
this.resendCodeText = translate('Resend Code');
|
|
289
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
|
+
}
|
|
290
306
|
get context() {
|
|
291
307
|
return this.authenticator.slotContext;
|
|
292
308
|
}
|
|
@@ -297,13 +313,13 @@ class ConfirmResetPasswordComponent {
|
|
|
297
313
|
}
|
|
298
314
|
onSubmit(event) {
|
|
299
315
|
event.preventDefault();
|
|
300
|
-
this.authenticator.submitForm();
|
|
316
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
301
317
|
}
|
|
302
318
|
}
|
|
303
319
|
ConfirmResetPasswordComponent.decorators = [
|
|
304
320
|
{ type: Component, args: [{
|
|
305
321
|
selector: 'amplify-confirm-reset-password',
|
|
306
|
-
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
|
|
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"
|
|
307
323
|
},] }
|
|
308
324
|
];
|
|
309
325
|
ConfirmResetPasswordComponent.ctorParameters = () => [
|
|
@@ -324,6 +340,16 @@ class ConfirmSignInComponent {
|
|
|
324
340
|
}
|
|
325
341
|
ngOnInit() {
|
|
326
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;
|
|
327
353
|
}
|
|
328
354
|
get context() {
|
|
329
355
|
return this.authenticator.slotContext;
|
|
@@ -350,13 +376,13 @@ class ConfirmSignInComponent {
|
|
|
350
376
|
}
|
|
351
377
|
onSubmit(event) {
|
|
352
378
|
event.preventDefault();
|
|
353
|
-
this.authenticator.submitForm();
|
|
379
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
354
380
|
}
|
|
355
381
|
}
|
|
356
382
|
ConfirmSignInComponent.decorators = [
|
|
357
383
|
{ type: Component, args: [{
|
|
358
384
|
selector: 'amplify-confirm-sign-in',
|
|
359
|
-
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"
|
|
360
386
|
},] }
|
|
361
387
|
];
|
|
362
388
|
ConfirmSignInComponent.ctorParameters = () => [
|
|
@@ -374,6 +400,22 @@ class ConfirmSignUpComponent {
|
|
|
374
400
|
// translated texts
|
|
375
401
|
this.resendCodeText = translate('Resend Code');
|
|
376
402
|
this.confirmText = translate('Confirm');
|
|
403
|
+
this.emailMessage = translate('Your code is on the way. To log in, enter the code we emailed to');
|
|
404
|
+
this.textedMessage = translate('Your code is on the way. To log in, enter the code we texted to');
|
|
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.');
|
|
406
|
+
this.minutesMessage = translate('It may take a minute to arrive.');
|
|
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;
|
|
377
419
|
}
|
|
378
420
|
get context() {
|
|
379
421
|
return this.authenticator.slotContext;
|
|
@@ -389,10 +431,10 @@ class ConfirmSignUpComponent {
|
|
|
389
431
|
get subtitleText() {
|
|
390
432
|
const { codeDeliveryDetails: { DeliveryMedium, Destination } = {} } = this.authenticator;
|
|
391
433
|
return DeliveryMedium === 'EMAIL'
|
|
392
|
-
?
|
|
434
|
+
? `${this.emailMessage} ${Destination}. ${this.minutesMessage}`
|
|
393
435
|
: DeliveryMedium === 'SMS'
|
|
394
|
-
?
|
|
395
|
-
: translate(`
|
|
436
|
+
? `${this.textedMessage} ${Destination}. ${this.minutesMessage}`
|
|
437
|
+
: translate(`${this.defaultMessage}`);
|
|
396
438
|
}
|
|
397
439
|
onInput(event) {
|
|
398
440
|
event.preventDefault();
|
|
@@ -401,13 +443,13 @@ class ConfirmSignUpComponent {
|
|
|
401
443
|
}
|
|
402
444
|
onSubmit(event) {
|
|
403
445
|
event.preventDefault();
|
|
404
|
-
this.authenticator.submitForm();
|
|
446
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
405
447
|
}
|
|
406
448
|
}
|
|
407
449
|
ConfirmSignUpComponent.decorators = [
|
|
408
450
|
{ type: Component, args: [{
|
|
409
451
|
selector: 'amplify-confirm-sign-up',
|
|
410
|
-
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"
|
|
411
453
|
},] }
|
|
412
454
|
];
|
|
413
455
|
ConfirmSignUpComponent.ctorParameters = () => [
|
|
@@ -427,6 +469,18 @@ class ConfirmVerifyUserComponent {
|
|
|
427
469
|
this.skipText = translate('Skip');
|
|
428
470
|
this.submitText = translate('Submit');
|
|
429
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
|
+
}
|
|
430
484
|
get context() {
|
|
431
485
|
return this.authenticator.slotContext;
|
|
432
486
|
}
|
|
@@ -437,13 +491,13 @@ class ConfirmVerifyUserComponent {
|
|
|
437
491
|
}
|
|
438
492
|
onSubmit(event) {
|
|
439
493
|
event.preventDefault();
|
|
440
|
-
this.authenticator.submitForm();
|
|
494
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
441
495
|
}
|
|
442
496
|
}
|
|
443
497
|
ConfirmVerifyUserComponent.decorators = [
|
|
444
498
|
{ type: Component, args: [{
|
|
445
499
|
selector: 'amplify-confirm-verify-user',
|
|
446
|
-
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"
|
|
447
501
|
},] }
|
|
448
502
|
];
|
|
449
503
|
ConfirmVerifyUserComponent.ctorParameters = () => [
|
|
@@ -531,9 +585,21 @@ class ForceNewPasswordComponent {
|
|
|
531
585
|
this.changePasswordText = translate('Change Password');
|
|
532
586
|
this.backToSignInText = translate('Back to Sign In');
|
|
533
587
|
}
|
|
588
|
+
ngOnInit() {
|
|
589
|
+
this.setFormFields();
|
|
590
|
+
}
|
|
534
591
|
get context() {
|
|
535
592
|
return this.authenticator.slotContext;
|
|
536
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
|
+
}
|
|
537
603
|
onInput(event) {
|
|
538
604
|
event.preventDefault();
|
|
539
605
|
const { name, value } = event.target;
|
|
@@ -541,13 +607,13 @@ class ForceNewPasswordComponent {
|
|
|
541
607
|
}
|
|
542
608
|
onSubmit(event) {
|
|
543
609
|
event.preventDefault();
|
|
544
|
-
this.authenticator.submitForm();
|
|
610
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
545
611
|
}
|
|
546
612
|
}
|
|
547
613
|
ForceNewPasswordComponent.decorators = [
|
|
548
614
|
{ type: Component, args: [{
|
|
549
615
|
selector: 'amplify-force-new-password',
|
|
550
|
-
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
|
|
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"
|
|
551
617
|
},] }
|
|
552
618
|
];
|
|
553
619
|
ForceNewPasswordComponent.ctorParameters = () => [
|
|
@@ -604,14 +670,15 @@ class FormFieldComponent {
|
|
|
604
670
|
this.disabled = false;
|
|
605
671
|
this.autocomplete = '';
|
|
606
672
|
this.labelHidden = true;
|
|
607
|
-
this.
|
|
673
|
+
this.countryDialCodesValue = countryDialCodes;
|
|
608
674
|
}
|
|
609
675
|
ngOnInit() {
|
|
676
|
+
var _a;
|
|
610
677
|
// TODO: consider better default handling mechanisms across frameworks
|
|
611
678
|
if (this.isPhoneField()) {
|
|
612
679
|
const state = this.authenticator.authState;
|
|
613
680
|
const { country_code } = getActorContext(state);
|
|
614
|
-
this.
|
|
681
|
+
this.defaultCountryCodeValue = (_a = this.defaultCountryCode) !== null && _a !== void 0 ? _a : country_code;
|
|
615
682
|
}
|
|
616
683
|
}
|
|
617
684
|
get attributeMap() {
|
|
@@ -657,7 +724,7 @@ class FormFieldComponent {
|
|
|
657
724
|
FormFieldComponent.decorators = [
|
|
658
725
|
{ type: Component, args: [{
|
|
659
726
|
selector: 'amplify-form-field',
|
|
660
|
-
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]=\"
|
|
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"
|
|
661
728
|
},] }
|
|
662
729
|
];
|
|
663
730
|
FormFieldComponent.ctorParameters = () => [
|
|
@@ -672,7 +739,9 @@ FormFieldComponent.propDecorators = {
|
|
|
672
739
|
initialValue: [{ type: Input }],
|
|
673
740
|
disabled: [{ type: Input }],
|
|
674
741
|
autocomplete: [{ type: Input }],
|
|
675
|
-
labelHidden: [{ type: Input }]
|
|
742
|
+
labelHidden: [{ type: Input }],
|
|
743
|
+
defaultCountryCode: [{ type: Input }],
|
|
744
|
+
dialCodeList: [{ type: Input }]
|
|
676
745
|
};
|
|
677
746
|
|
|
678
747
|
class ResetPasswordComponent {
|
|
@@ -689,6 +758,16 @@ class ResetPasswordComponent {
|
|
|
689
758
|
const { authState } = this.authenticator;
|
|
690
759
|
const { label } = getAliasInfoFromContext(authState.context);
|
|
691
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;
|
|
692
771
|
}
|
|
693
772
|
get context() {
|
|
694
773
|
return this.authenticator.slotContext;
|
|
@@ -700,13 +779,13 @@ class ResetPasswordComponent {
|
|
|
700
779
|
}
|
|
701
780
|
onSubmit(event) {
|
|
702
781
|
event.preventDefault();
|
|
703
|
-
this.authenticator.submitForm();
|
|
782
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
704
783
|
}
|
|
705
784
|
}
|
|
706
785
|
ResetPasswordComponent.decorators = [
|
|
707
786
|
{ type: Component, args: [{
|
|
708
787
|
selector: 'amplify-reset-password',
|
|
709
|
-
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 [
|
|
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"
|
|
710
789
|
},] }
|
|
711
790
|
];
|
|
712
791
|
ResetPasswordComponent.ctorParameters = () => [
|
|
@@ -732,11 +811,22 @@ class SetupTotpComponent {
|
|
|
732
811
|
}
|
|
733
812
|
ngOnInit() {
|
|
734
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;
|
|
735
824
|
}
|
|
736
825
|
get context() {
|
|
737
826
|
return this.authenticator.slotContext;
|
|
738
827
|
}
|
|
739
828
|
generateQRCode() {
|
|
829
|
+
var _a, _b, _c, _d, _e, _f;
|
|
740
830
|
return __awaiter(this, void 0, void 0, function* () {
|
|
741
831
|
// TODO: This should be handled in core.
|
|
742
832
|
const state = this.authenticator.authState;
|
|
@@ -744,8 +834,9 @@ class SetupTotpComponent {
|
|
|
744
834
|
const { user } = actorContext;
|
|
745
835
|
try {
|
|
746
836
|
this.secretKey = yield Auth.setupTOTP(user);
|
|
747
|
-
const issuer = 'AWSCognito';
|
|
748
|
-
const
|
|
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}`;
|
|
749
840
|
logger.info('totp code was generated:', totpCode);
|
|
750
841
|
this.qrCodeSource = yield QRCode.toDataURL(totpCode);
|
|
751
842
|
}
|
|
@@ -761,7 +852,7 @@ class SetupTotpComponent {
|
|
|
761
852
|
}
|
|
762
853
|
onSubmit(event) {
|
|
763
854
|
event.preventDefault();
|
|
764
|
-
this.authenticator.submitForm();
|
|
855
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
765
856
|
}
|
|
766
857
|
copyText() {
|
|
767
858
|
navigator.clipboard.writeText(this.secretKey);
|
|
@@ -771,7 +862,7 @@ class SetupTotpComponent {
|
|
|
771
862
|
SetupTotpComponent.decorators = [
|
|
772
863
|
{ type: Component, args: [{
|
|
773
864
|
selector: 'amplify-setup-totp',
|
|
774
|
-
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
|
|
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"
|
|
775
866
|
},] }
|
|
776
867
|
];
|
|
777
868
|
SetupTotpComponent.ctorParameters = () => [
|
|
@@ -792,6 +883,24 @@ class SignInComponent {
|
|
|
792
883
|
: translate('Forgot your password? ');
|
|
793
884
|
this.signInButtonText = translate('Sign in');
|
|
794
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
|
+
}
|
|
795
904
|
get context() {
|
|
796
905
|
return this.authenticator.slotContext;
|
|
797
906
|
}
|
|
@@ -802,13 +911,13 @@ class SignInComponent {
|
|
|
802
911
|
}
|
|
803
912
|
onSubmit(event) {
|
|
804
913
|
event.preventDefault();
|
|
805
|
-
this.authenticator.submitForm();
|
|
914
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
806
915
|
}
|
|
807
916
|
}
|
|
808
917
|
SignInComponent.decorators = [
|
|
809
918
|
{ type: Component, args: [{
|
|
810
919
|
selector: 'amplify-sign-in',
|
|
811
|
-
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",
|
|
812
921
|
encapsulation: ViewEncapsulation.None
|
|
813
922
|
},] }
|
|
814
923
|
];
|
|
@@ -837,7 +946,7 @@ class SignUpComponent {
|
|
|
837
946
|
}
|
|
838
947
|
onSubmit(event) {
|
|
839
948
|
event.preventDefault();
|
|
840
|
-
this.authenticator.submitForm();
|
|
949
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
841
950
|
}
|
|
842
951
|
}
|
|
843
952
|
SignUpComponent.decorators = [
|
|
@@ -872,12 +981,30 @@ class SignUpFormFieldsComponent {
|
|
|
872
981
|
});
|
|
873
982
|
// Only 1 is supported, so `['email', 'phone_number']` will only show `email`
|
|
874
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;
|
|
875
1002
|
}
|
|
876
1003
|
}
|
|
877
1004
|
SignUpFormFieldsComponent.decorators = [
|
|
878
1005
|
{ type: Component, args: [{
|
|
879
1006
|
selector: 'amplify-sign-up-form-fields',
|
|
880
|
-
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <amplify-user-name-alias
|
|
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"
|
|
881
1008
|
},] }
|
|
882
1009
|
];
|
|
883
1010
|
SignUpFormFieldsComponent.ctorParameters = () => [
|
|
@@ -893,17 +1020,19 @@ class UserNameAliasComponent {
|
|
|
893
1020
|
this.required = true;
|
|
894
1021
|
}
|
|
895
1022
|
ngOnInit() {
|
|
1023
|
+
var _a, _b, _c;
|
|
896
1024
|
const context = this.authenticator.context;
|
|
897
|
-
const { label, type } = getAliasInfoFromContext(context);
|
|
898
|
-
this.
|
|
1025
|
+
const { label: lbl, type } = getAliasInfoFromContext(context);
|
|
1026
|
+
this.labelValue = (_a = this.label) !== null && _a !== void 0 ? _a : lbl;
|
|
899
1027
|
this.type = type;
|
|
900
|
-
this.
|
|
1028
|
+
this.placeholderValue = (_b = this.placeholder) !== null && _b !== void 0 ? _b : lbl;
|
|
1029
|
+
this.requiredValue = (_c = this.required) !== null && _c !== void 0 ? _c : true;
|
|
901
1030
|
}
|
|
902
1031
|
}
|
|
903
1032
|
UserNameAliasComponent.decorators = [
|
|
904
1033
|
{ type: Component, args: [{
|
|
905
1034
|
selector: 'amplify-user-name-alias',
|
|
906
|
-
template: "<amplify-form-field\n data-amplify-usernamealias\n [name]=\"name\"\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"
|
|
907
1036
|
},] }
|
|
908
1037
|
];
|
|
909
1038
|
UserNameAliasComponent.ctorParameters = () => [
|
|
@@ -913,7 +1042,12 @@ UserNameAliasComponent.propDecorators = {
|
|
|
913
1042
|
name: [{ type: Input }],
|
|
914
1043
|
disabled: [{ type: Input }],
|
|
915
1044
|
initialValue: [{ type: Input }],
|
|
916
|
-
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 }]
|
|
917
1051
|
};
|
|
918
1052
|
|
|
919
1053
|
class VerifyUserComponent {
|
|
@@ -947,7 +1081,7 @@ class VerifyUserComponent {
|
|
|
947
1081
|
}
|
|
948
1082
|
onSubmit(event) {
|
|
949
1083
|
event.preventDefault();
|
|
950
|
-
this.authenticator.submitForm();
|
|
1084
|
+
this.authenticator.submitForm(getFormDataFromEvent(event));
|
|
951
1085
|
}
|
|
952
1086
|
}
|
|
953
1087
|
VerifyUserComponent.decorators = [
|
|
@@ -1073,7 +1207,7 @@ class PasswordFieldComponent {
|
|
|
1073
1207
|
PasswordFieldComponent.decorators = [
|
|
1074
1208
|
{ type: Component, args: [{
|
|
1075
1209
|
selector: 'amplify-password-field',
|
|
1076
|
-
template: "<label
|
|
1210
|
+
template: "<label\n class=\"amplify-label\"\n [class.amplify-visually-hidden]=\"labelHidden\"\n [for]=\"fieldId\"\n>\n {{ label }}\n</label>\n<div class=\"amplify-flex amplify-field-group\">\n <input\n class=\"amplify-input amplify-field-group__control\"\n [id]=\"fieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n (blur)=\"setBlur.emit($event)\"\n />\n <div class=\"amplify-field-group__outer-end\">\n <button\n amplify-button\n [attr.aria-label]=\"showPasswordButtonlabel\"\n class=\"amplify-field-group__control amplify-field__show-password\"\n (click)=\"togglePasswordText()\"\n >\n <svg\n *ngIf=\"!showPassword\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n class=\"amplify-icon\"\n >\n <path\n d=\"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z\"\n ></path>\n </svg>\n <svg\n *ngIf=\"showPassword\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n class=\"amplify-icon\"\n >\n <path\n d=\"M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z\"\n fill=\"none\"\n ></path>\n <path\n d=\"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z\"\n ></path>\n </svg>\n </button>\n </div>\n</div>\n"
|
|
1077
1211
|
},] }
|
|
1078
1212
|
];
|
|
1079
1213
|
PasswordFieldComponent.propDecorators = {
|
|
@@ -1101,13 +1235,16 @@ class PhoneNumberFieldComponent {
|
|
|
1101
1235
|
this.required = true;
|
|
1102
1236
|
this.labelHidden = false;
|
|
1103
1237
|
this.display = 'contents';
|
|
1104
|
-
|
|
1238
|
+
}
|
|
1239
|
+
ngOnInit() {
|
|
1240
|
+
var _a;
|
|
1241
|
+
this.countryDialCodesValues = (_a = this.dialCodeList) !== null && _a !== void 0 ? _a : countryDialCodes;
|
|
1105
1242
|
}
|
|
1106
1243
|
}
|
|
1107
1244
|
PhoneNumberFieldComponent.decorators = [
|
|
1108
1245
|
{ type: Component, args: [{
|
|
1109
1246
|
selector: 'amplify-phone-number-field',
|
|
1110
|
-
template: "<label
|
|
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"
|
|
1111
1248
|
},] }
|
|
1112
1249
|
];
|
|
1113
1250
|
PhoneNumberFieldComponent.propDecorators = {
|
|
@@ -1123,6 +1260,7 @@ PhoneNumberFieldComponent.propDecorators = {
|
|
|
1123
1260
|
required: [{ type: Input }],
|
|
1124
1261
|
type: [{ type: Input }],
|
|
1125
1262
|
labelHidden: [{ type: Input }],
|
|
1263
|
+
dialCodeList: [{ type: Input }],
|
|
1126
1264
|
display: [{ type: HostBinding, args: ['style.display',] }]
|
|
1127
1265
|
};
|
|
1128
1266
|
|
|
@@ -1131,7 +1269,7 @@ class SelectComponent {
|
|
|
1131
1269
|
SelectComponent.decorators = [
|
|
1132
1270
|
{ type: Component, args: [{
|
|
1133
1271
|
selector: 'amplify-form-select',
|
|
1134
|
-
template: "<label class=\"amplify-label
|
|
1272
|
+
template: "<label class=\"amplify-label amplify-visually-hidden\" [for]=\"id\">{{\n label\n}}</label>\n<div class=\"amplify-select__wrapper\">\n <select\n class=\"amplify-select amplify-field-group__control\"\n autocomplete=\"tel-country-code\"\n [id]=\"id\"\n [name]=\"name\"\n >\n <option\n *ngFor=\"let item of items\"\n [value]=\"item\"\n [selected]=\"item === defaultValue\"\n >\n {{ item }}\n </option>\n </select>\n <div\n class=\"amplify-flex amplify-select__icon-wrapper\"\n style=\"align-items: center; justify-content: center\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon\"\n viewBox=\"0 0 24 24\"\n data-size=\"large\"\n fill=\"currentColor\"\n >\n <path d=\"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z\"></path>\n </svg>\n </div>\n</div>\n"
|
|
1135
1273
|
},] }
|
|
1136
1274
|
];
|
|
1137
1275
|
SelectComponent.propDecorators = {
|
|
@@ -1221,7 +1359,7 @@ class TextFieldComponent {
|
|
|
1221
1359
|
TextFieldComponent.decorators = [
|
|
1222
1360
|
{ type: Component, args: [{
|
|
1223
1361
|
selector: 'amplify-text-field',
|
|
1224
|
-
template: "<label
|
|
1362
|
+
template: "<label\n class=\"amplify-label\"\n [class.amplify-visually-hidden]=\"labelHidden\"\n [for]=\"fieldId\"\n>\n {{ label }}\n</label>\n<input\n class=\"amplify-input\"\n [id]=\"fieldId\"\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"
|
|
1225
1363
|
},] }
|
|
1226
1364
|
];
|
|
1227
1365
|
TextFieldComponent.propDecorators = {
|