@aws-amplify/ui-angular 2.1.3 → 2.2.2
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 +182 -47
- 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/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 +15 -3
- package/esm2015/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.js +13 -3
- package/esm2015/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.js +15 -3
- package/esm2015/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.js +15 -3
- package/esm2015/lib/components/authenticator/components/federated-sign-in/federated-sign-in.component.js +2 -2
- package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password.component.js +15 -3
- 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 +13 -3
- package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +17 -5
- package/esm2015/lib/components/authenticator/components/sign-in/sign-in.component.js +22 -4
- 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/user-name-alias/user-name-alias.component.js +13 -6
- package/esm2015/lib/components/authenticator/components/verify-user/verify-user.component.js +2 -2
- package/esm2015/lib/primitives/phone-number-field/phone-number-field.component.js +7 -3
- package/esm2015/lib/services/authenticator.service.js +3 -2
- package/fesm2015/aws-amplify-ui-angular.js +160 -27
- package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
- 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 +7 -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,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, ContentChildren, HostBinding, EventEmitter, Output, NgModule } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { createAuthenticatorMachine, getServiceContextFacade, listenToAuthHub, getSendEventAliases, translate, getFormDataFromEvent, getActorContext, AuthChallengeNames, FederatedIdentityProviders, authInputAttributes, countryDialCodes, getAliasInfoFromContext, hasTranslation,
|
|
4
|
+
import { createAuthenticatorMachine, getServiceContextFacade, listenToAuthHub, getSendEventAliases, translate, getActorState, getFormDataFromEvent, getActorContext, AuthChallengeNames, FederatedIdentityProviders, authInputAttributes, countryDialCodes, getAliasInfoFromContext, hasTranslation, setFormOrder } from '@aws-amplify/ui';
|
|
5
5
|
export { translations } from '@aws-amplify/ui';
|
|
6
6
|
import { Logger } from '@aws-amplify/core';
|
|
7
7
|
import { interpret } from 'xstate';
|
|
@@ -56,7 +56,7 @@ const logger$2 = new Logger('state-machine');
|
|
|
56
56
|
* AuthenticatorService provides access to the authenticator state and context.
|
|
57
57
|
*/
|
|
58
58
|
class AuthenticatorService {
|
|
59
|
-
startMachine({ initialState, loginMechanisms, services, signUpAttributes, socialProviders, }) {
|
|
59
|
+
startMachine({ initialState, loginMechanisms, services, signUpAttributes, socialProviders, formFields, }) {
|
|
60
60
|
const machine = createAuthenticatorMachine();
|
|
61
61
|
const authService = interpret(machine).start();
|
|
62
62
|
authService.send({
|
|
@@ -67,6 +67,7 @@ class AuthenticatorService {
|
|
|
67
67
|
socialProviders,
|
|
68
68
|
signUpAttributes,
|
|
69
69
|
services,
|
|
70
|
+
formFields,
|
|
70
71
|
},
|
|
71
72
|
});
|
|
72
73
|
this._machineSubscription = authService.subscribe((state) => {
|
|
@@ -201,13 +202,14 @@ class AuthenticatorComponent {
|
|
|
201
202
|
this.signUpTitle = translate('Create Account');
|
|
202
203
|
}
|
|
203
204
|
ngOnInit() {
|
|
204
|
-
const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, } = this;
|
|
205
|
+
const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, formFields, } = this;
|
|
205
206
|
this.authenticator.startMachine({
|
|
206
207
|
initialState,
|
|
207
208
|
loginMechanisms,
|
|
208
209
|
services,
|
|
209
210
|
signUpAttributes,
|
|
210
211
|
socialProviders,
|
|
212
|
+
formFields,
|
|
211
213
|
});
|
|
212
214
|
/**
|
|
213
215
|
* handling translations after content init, because authenticator and its
|
|
@@ -268,6 +270,7 @@ AuthenticatorComponent.ctorParameters = () => [
|
|
|
268
270
|
{ type: CustomComponentsService }
|
|
269
271
|
];
|
|
270
272
|
AuthenticatorComponent.propDecorators = {
|
|
273
|
+
formFields: [{ type: Input }],
|
|
271
274
|
initialState: [{ type: Input }],
|
|
272
275
|
loginMechanisms: [{ type: Input }],
|
|
273
276
|
services: [{ type: Input }],
|
|
@@ -288,6 +291,18 @@ class ConfirmResetPasswordComponent {
|
|
|
288
291
|
this.backToSignInText = translate('Back to Sign In');
|
|
289
292
|
this.resendCodeText = translate('Resend Code');
|
|
290
293
|
}
|
|
294
|
+
ngOnInit() {
|
|
295
|
+
this.setFormFields();
|
|
296
|
+
}
|
|
297
|
+
setFormFields() {
|
|
298
|
+
var _a, _b;
|
|
299
|
+
const _state = this.authenticator.authState;
|
|
300
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmResetPassword;
|
|
301
|
+
}
|
|
302
|
+
grabField(name, field, defaultV) {
|
|
303
|
+
var _a, _b, _c;
|
|
304
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
305
|
+
}
|
|
291
306
|
get context() {
|
|
292
307
|
return this.authenticator.slotContext;
|
|
293
308
|
}
|
|
@@ -304,7 +319,7 @@ class ConfirmResetPasswordComponent {
|
|
|
304
319
|
ConfirmResetPasswordComponent.decorators = [
|
|
305
320
|
{ type: Component, args: [{
|
|
306
321
|
selector: 'amplify-confirm-reset-password',
|
|
307
|
-
template: "<
|
|
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 <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 <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"
|
|
308
323
|
},] }
|
|
309
324
|
];
|
|
310
325
|
ConfirmResetPasswordComponent.ctorParameters = () => [
|
|
@@ -325,6 +340,16 @@ class ConfirmSignInComponent {
|
|
|
325
340
|
}
|
|
326
341
|
ngOnInit() {
|
|
327
342
|
this.setHeaderText();
|
|
343
|
+
this.setFormFields();
|
|
344
|
+
}
|
|
345
|
+
setFormFields() {
|
|
346
|
+
var _a, _b;
|
|
347
|
+
const _state = this.authenticator.authState;
|
|
348
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmSignIn;
|
|
349
|
+
}
|
|
350
|
+
grabField(name, field, defaultV) {
|
|
351
|
+
var _a, _b, _c;
|
|
352
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
328
353
|
}
|
|
329
354
|
get context() {
|
|
330
355
|
return this.authenticator.slotContext;
|
|
@@ -357,7 +382,7 @@ class ConfirmSignInComponent {
|
|
|
357
382
|
ConfirmSignInComponent.decorators = [
|
|
358
383
|
{ type: Component, args: [{
|
|
359
384
|
selector: 'amplify-confirm-sign-in',
|
|
360
|
-
template: "<
|
|
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-field\n name=\"confirmation_code\"\n label=\"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', '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"
|
|
361
386
|
},] }
|
|
362
387
|
];
|
|
363
388
|
ConfirmSignInComponent.ctorParameters = () => [
|
|
@@ -380,6 +405,18 @@ class ConfirmSignUpComponent {
|
|
|
380
405
|
this.defaultMessage = translate('Your code is on the way. To log in, enter the code we sent you. It may take a minute to arrive.');
|
|
381
406
|
this.minutesMessage = translate('It may take a minute to arrive.');
|
|
382
407
|
}
|
|
408
|
+
ngOnInit() {
|
|
409
|
+
this.setFormFields();
|
|
410
|
+
}
|
|
411
|
+
setFormFields() {
|
|
412
|
+
var _a, _b;
|
|
413
|
+
const _state = this.authenticator.authState;
|
|
414
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmSignUp;
|
|
415
|
+
}
|
|
416
|
+
grabField(name, field, defaultV) {
|
|
417
|
+
var _a, _b, _c;
|
|
418
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
419
|
+
}
|
|
383
420
|
get context() {
|
|
384
421
|
return this.authenticator.slotContext;
|
|
385
422
|
}
|
|
@@ -412,7 +449,7 @@ class ConfirmSignUpComponent {
|
|
|
412
449
|
ConfirmSignUpComponent.decorators = [
|
|
413
450
|
{ type: Component, args: [{
|
|
414
451
|
selector: 'amplify-confirm-sign-up',
|
|
415
|
-
template: "<
|
|
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-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</ng-container>\n"
|
|
416
453
|
},] }
|
|
417
454
|
];
|
|
418
455
|
ConfirmSignUpComponent.ctorParameters = () => [
|
|
@@ -432,6 +469,18 @@ class ConfirmVerifyUserComponent {
|
|
|
432
469
|
this.skipText = translate('Skip');
|
|
433
470
|
this.submitText = translate('Submit');
|
|
434
471
|
}
|
|
472
|
+
ngOnInit() {
|
|
473
|
+
this.setFormFields();
|
|
474
|
+
}
|
|
475
|
+
setFormFields() {
|
|
476
|
+
var _a, _b;
|
|
477
|
+
const _state = this.authenticator.authState;
|
|
478
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmVerifyUser;
|
|
479
|
+
}
|
|
480
|
+
grabField(name, field, defaultV) {
|
|
481
|
+
var _a, _b, _c;
|
|
482
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
483
|
+
}
|
|
435
484
|
get context() {
|
|
436
485
|
return this.authenticator.slotContext;
|
|
437
486
|
}
|
|
@@ -448,7 +497,7 @@ class ConfirmVerifyUserComponent {
|
|
|
448
497
|
ConfirmVerifyUserComponent.decorators = [
|
|
449
498
|
{ type: Component, args: [{
|
|
450
499
|
selector: 'amplify-confirm-verify-user',
|
|
451
|
-
template: "<
|
|
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-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 <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"
|
|
452
501
|
},] }
|
|
453
502
|
];
|
|
454
503
|
ConfirmVerifyUserComponent.ctorParameters = () => [
|
|
@@ -520,7 +569,7 @@ class FederatedSignInComponent {
|
|
|
520
569
|
FederatedSignInComponent.decorators = [
|
|
521
570
|
{ type: Component, args: [{
|
|
522
571
|
selector: 'amplify-federated-sign-in',
|
|
523
|
-
template: "<div\n class=\"amplify-flex federated-sign-in-container\"\n style=\"flex-direction: column; padding: 0 0 1rem 0\"\n *ngIf=\"shouldShowFederatedSignIn\"\n data-orientation=\"horizontal\"\n data-size=\"small\"\n>\n <amplify-federated-sign-in-button\n *ngIf=\"includeAmazon\"\n [text]=\"signInAmazonText\"\n [provider]=\"FederatedProviders.Amazon\"\n >\n <svg\n aria-label=\"Amazon icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 248 268\"\n >\n <path\n d=\"M139.056521,147.024612 C133.548808,156.744524 124.782731,162.726926 115.087401,162.726926 C101.790721,162.726926 93.9937779,152.612964 93.9937779,137.68681 C93.9937779,108.224571 120.447551,102.879017 145.533369,102.879017 L145.533369,110.365976 C145.533369,123.831358 145.876354,135.063787 139.056521,147.024612 M207.206992,162.579655 C209.400505,165.692256 209.887066,169.437725 207.063416,171.770186 C199.996315,177.653081 187.429476,188.590967 180.513926,194.716661 L180.46208,194.621133 C178.176838,196.663031 174.862638,196.810303 172.27828,195.445057 C160.780281,185.9162 158.686473,181.494078 152.405048,172.403055 C133.405233,191.751331 119.909143,197.534719 95.309886,197.534719 C66.1281801,197.534719 43.4791563,179.599451 43.4791563,143.669212 C43.4791563,115.616003 58.6782107,96.5105248 80.4019706,87.1727225 C99.2063636,78.9096034 125.464714,77.4528107 145.533369,75.1641337 L145.533369,70.694248 C145.533369,62.4749122 146.167493,52.7510201 141.297893,45.6541312 C137.110277,39.2856386 129.018206,36.6586354 121.859376,36.6586354 C108.658413,36.6586354 96.9171331,43.4171982 94.0416364,57.4199213 C93.4593582,60.532522 91.1701278,63.5933787 88.003492,63.7406501 L54.4387473,60.1424518 C51.6150972,59.5095829 48.4484614,57.2248862 49.2740201,52.8982915 C56.9712583,12.2553679 93.7983558,0 126.732964,0 C143.587124,0 165.606011,4.47386604 178.902691,17.2148315 C195.760839,32.917146 194.149604,53.8694866 194.149604,76.6726704 L194.149604,130.542157 C194.149604,146.734049 200.87372,153.830938 207.206992,162.579655 Z M233.826346,208.038962 C230.467669,203.683255 211.550709,205.9821 203.056405,206.998432 C200.470662,207.321077 200.076227,205.042397 202.406981,203.404973 C217.475208,192.664928 242.201125,195.766353 245.081698,199.363845 C247.966255,202.981502 244.336653,228.071183 230.172839,240.049379 C228.001452,241.888455 225.929671,240.904388 226.89783,238.468418 C230.077218,230.430525 237.204944,212.418868 233.826346,208.038962 Z M126.768855,264 C74.0234043,264 42.0764048,241.955028 17.7852554,217.541992 C12.9733903,212.705982 6.71799208,206.295994 3.31151296,200.690918 C1.90227474,198.372135 5.59096074,195.021875 8.0442063,196.84375 C38.2390146,219.267578 82.1011654,239.538304 125.529506,239.538304 C154.819967,239.538304 191.046475,227.469543 220.66851,214.867659 C225.146771,212.966167 225.146771,219.180222 224.511585,221.060516 C224.183264,222.03242 209.514625,236.221149 189.247207,247.047411 C170.304273,257.166172 146.397132,264 126.768855,264 Z\"\n fill=\"#FF9900\"\n ></path>\n </svg>\n\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInAmazonText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeApple\"\n [provider]=\"FederatedProviders.Apple\"\n >\n <svg\n aria-label=\"Apple icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n fill=\"#000\"\n preserveAspectRatio=\"xMidYMid\"\n stroke=\"#000\"\n strokeWidth=\"0\"\n viewBox=\"0 0 1024 1024\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M747.4 535.7c-.4-68.2 30.5-119.6 92.9-157.5-34.9-50-87.7-77.5-157.3-82.8-65.9-5.2-138 38.4-164.4 38.4-27.9 0-91.7-36.6-141.9-36.6C273.1 298.8 163 379.8 163 544.6c0 48.7 8.9 99 26.7 150.8 23.8 68.2 109.6 235.3 199.1 232.6 46.8-1.1 79.9-33.2 140.8-33.2 59.1 0 89.7 33.2 141.9 33.2 90.3-1.3 167.9-153.2 190.5-221.6-121.1-57.1-114.6-167.2-114.6-170.7zm-105.1-305c50.7-60.2 46.1-115 44.6-134.7-44.8 2.6-96.6 30.5-126.1 64.8-32.5 36.8-51.6 82.3-47.5 133.6 48.4 3.7 92.6-21.2 129-63.7z\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInAppleText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeFacebook\"\n [text]=\"signInFacebookText\"\n [provider]=\"FederatedProviders.Facebook\"\n >\n <svg\n aria-label=\"Facebook icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 279 538\"\n >\n <path\n d=\"M82.3409742,538 L82.3409742,292.936652 L0,292.936652 L0,196.990154 L82.2410458,196.990154 L82.2410458,126.4295 C82.2410458,44.575144 132.205229,0 205.252865,0 C240.227794,0 270.306232,2.59855099 279,3.79788222 L279,89.2502322 L228.536175,89.2502322 C188.964542,89.2502322 181.270057,108.139699 181.270057,135.824262 L181.270057,196.89021 L276.202006,196.89021 L263.810888,292.836708 L181.16913,292.836708 L181.16913,538 L82.3409742,538 Z\"\n fill=\"#1877F2\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInFacebookText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeGoogle\"\n [provider]=\"FederatedProviders.Google\"\n >\n <svg\n aria-label=\"Google icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 256 262\"\n xmlns=\"http://www.w3.org/2000/svg\"\n preserveAspectRatio=\"xMidYMid\"\n >\n <path\n d=\"M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027\"\n fill=\"#4285F4\"\n ></path>\n <path\n d=\"M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1\"\n fill=\"#34A853\"\n ></path>\n <path\n d=\"M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782\"\n fill=\"#FBBC05\"\n ></path>\n <path\n d=\"M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251\"\n fill=\"#EB4335\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInGoogleText }}\n </p>\n </amplify-federated-sign-in-button>\n\n
|
|
572
|
+
template: "<div\n class=\"amplify-flex federated-sign-in-container\"\n style=\"flex-direction: column; padding: 0 0 1rem 0\"\n *ngIf=\"shouldShowFederatedSignIn\"\n data-orientation=\"horizontal\"\n data-size=\"small\"\n>\n <amplify-federated-sign-in-button\n *ngIf=\"includeAmazon\"\n [text]=\"signInAmazonText\"\n [provider]=\"FederatedProviders.Amazon\"\n >\n <svg\n aria-label=\"Amazon icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 248 268\"\n >\n <path\n d=\"M139.056521,147.024612 C133.548808,156.744524 124.782731,162.726926 115.087401,162.726926 C101.790721,162.726926 93.9937779,152.612964 93.9937779,137.68681 C93.9937779,108.224571 120.447551,102.879017 145.533369,102.879017 L145.533369,110.365976 C145.533369,123.831358 145.876354,135.063787 139.056521,147.024612 M207.206992,162.579655 C209.400505,165.692256 209.887066,169.437725 207.063416,171.770186 C199.996315,177.653081 187.429476,188.590967 180.513926,194.716661 L180.46208,194.621133 C178.176838,196.663031 174.862638,196.810303 172.27828,195.445057 C160.780281,185.9162 158.686473,181.494078 152.405048,172.403055 C133.405233,191.751331 119.909143,197.534719 95.309886,197.534719 C66.1281801,197.534719 43.4791563,179.599451 43.4791563,143.669212 C43.4791563,115.616003 58.6782107,96.5105248 80.4019706,87.1727225 C99.2063636,78.9096034 125.464714,77.4528107 145.533369,75.1641337 L145.533369,70.694248 C145.533369,62.4749122 146.167493,52.7510201 141.297893,45.6541312 C137.110277,39.2856386 129.018206,36.6586354 121.859376,36.6586354 C108.658413,36.6586354 96.9171331,43.4171982 94.0416364,57.4199213 C93.4593582,60.532522 91.1701278,63.5933787 88.003492,63.7406501 L54.4387473,60.1424518 C51.6150972,59.5095829 48.4484614,57.2248862 49.2740201,52.8982915 C56.9712583,12.2553679 93.7983558,0 126.732964,0 C143.587124,0 165.606011,4.47386604 178.902691,17.2148315 C195.760839,32.917146 194.149604,53.8694866 194.149604,76.6726704 L194.149604,130.542157 C194.149604,146.734049 200.87372,153.830938 207.206992,162.579655 Z M233.826346,208.038962 C230.467669,203.683255 211.550709,205.9821 203.056405,206.998432 C200.470662,207.321077 200.076227,205.042397 202.406981,203.404973 C217.475208,192.664928 242.201125,195.766353 245.081698,199.363845 C247.966255,202.981502 244.336653,228.071183 230.172839,240.049379 C228.001452,241.888455 225.929671,240.904388 226.89783,238.468418 C230.077218,230.430525 237.204944,212.418868 233.826346,208.038962 Z M126.768855,264 C74.0234043,264 42.0764048,241.955028 17.7852554,217.541992 C12.9733903,212.705982 6.71799208,206.295994 3.31151296,200.690918 C1.90227474,198.372135 5.59096074,195.021875 8.0442063,196.84375 C38.2390146,219.267578 82.1011654,239.538304 125.529506,239.538304 C154.819967,239.538304 191.046475,227.469543 220.66851,214.867659 C225.146771,212.966167 225.146771,219.180222 224.511585,221.060516 C224.183264,222.03242 209.514625,236.221149 189.247207,247.047411 C170.304273,257.166172 146.397132,264 126.768855,264 Z\"\n fill=\"#FF9900\"\n ></path>\n </svg>\n\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInAmazonText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeApple\"\n [provider]=\"FederatedProviders.Apple\"\n >\n <svg\n aria-label=\"Apple icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n fill=\"#000\"\n preserveAspectRatio=\"xMidYMid\"\n stroke=\"#000\"\n strokeWidth=\"0\"\n viewBox=\"0 0 1024 1024\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M747.4 535.7c-.4-68.2 30.5-119.6 92.9-157.5-34.9-50-87.7-77.5-157.3-82.8-65.9-5.2-138 38.4-164.4 38.4-27.9 0-91.7-36.6-141.9-36.6C273.1 298.8 163 379.8 163 544.6c0 48.7 8.9 99 26.7 150.8 23.8 68.2 109.6 235.3 199.1 232.6 46.8-1.1 79.9-33.2 140.8-33.2 59.1 0 89.7 33.2 141.9 33.2 90.3-1.3 167.9-153.2 190.5-221.6-121.1-57.1-114.6-167.2-114.6-170.7zm-105.1-305c50.7-60.2 46.1-115 44.6-134.7-44.8 2.6-96.6 30.5-126.1 64.8-32.5 36.8-51.6 82.3-47.5 133.6 48.4 3.7 92.6-21.2 129-63.7z\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInAppleText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeFacebook\"\n [text]=\"signInFacebookText\"\n [provider]=\"FederatedProviders.Facebook\"\n >\n <svg\n aria-label=\"Facebook icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 279 538\"\n >\n <path\n d=\"M82.3409742,538 L82.3409742,292.936652 L0,292.936652 L0,196.990154 L82.2410458,196.990154 L82.2410458,126.4295 C82.2410458,44.575144 132.205229,0 205.252865,0 C240.227794,0 270.306232,2.59855099 279,3.79788222 L279,89.2502322 L228.536175,89.2502322 C188.964542,89.2502322 181.270057,108.139699 181.270057,135.824262 L181.270057,196.89021 L276.202006,196.89021 L263.810888,292.836708 L181.16913,292.836708 L181.16913,538 L82.3409742,538 Z\"\n fill=\"#1877F2\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInFacebookText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeGoogle\"\n [provider]=\"FederatedProviders.Google\"\n >\n <svg\n aria-label=\"Google icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 256 262\"\n xmlns=\"http://www.w3.org/2000/svg\"\n preserveAspectRatio=\"xMidYMid\"\n >\n <path\n d=\"M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027\"\n fill=\"#4285F4\"\n ></path>\n <path\n d=\"M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1\"\n fill=\"#34A853\"\n ></path>\n <path\n d=\"M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782\"\n fill=\"#FBBC05\"\n ></path>\n <path\n d=\"M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251\"\n fill=\"#EB4335\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInGoogleText }}\n </p>\n </amplify-federated-sign-in-button>\n\n\n <hr\n class=\"amplify-divider amplify-divider--label\"\n aria-orientation=\"horizontal\"\n data-size=\"small\"\n data-label=\"or\"\n />\n</div>\n"
|
|
524
573
|
},] }
|
|
525
574
|
];
|
|
526
575
|
FederatedSignInComponent.ctorParameters = () => [
|
|
@@ -536,9 +585,21 @@ class ForceNewPasswordComponent {
|
|
|
536
585
|
this.changePasswordText = translate('Change Password');
|
|
537
586
|
this.backToSignInText = translate('Back to Sign In');
|
|
538
587
|
}
|
|
588
|
+
ngOnInit() {
|
|
589
|
+
this.setFormFields();
|
|
590
|
+
}
|
|
539
591
|
get context() {
|
|
540
592
|
return this.authenticator.slotContext;
|
|
541
593
|
}
|
|
594
|
+
setFormFields() {
|
|
595
|
+
var _a, _b;
|
|
596
|
+
const _state = this.authenticator.authState;
|
|
597
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.forceNewPassword;
|
|
598
|
+
}
|
|
599
|
+
grabField(name, field, defaultV) {
|
|
600
|
+
var _a, _b, _c;
|
|
601
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
602
|
+
}
|
|
542
603
|
onInput(event) {
|
|
543
604
|
event.preventDefault();
|
|
544
605
|
const { name, value } = event.target;
|
|
@@ -552,7 +613,7 @@ class ForceNewPasswordComponent {
|
|
|
552
613
|
ForceNewPasswordComponent.decorators = [
|
|
553
614
|
{ type: Component, args: [{
|
|
554
615
|
selector: 'amplify-force-new-password',
|
|
555
|
-
template: "<
|
|
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 <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"
|
|
556
617
|
},] }
|
|
557
618
|
];
|
|
558
619
|
ForceNewPasswordComponent.ctorParameters = () => [
|
|
@@ -609,14 +670,15 @@ class FormFieldComponent {
|
|
|
609
670
|
this.disabled = false;
|
|
610
671
|
this.autocomplete = '';
|
|
611
672
|
this.labelHidden = true;
|
|
612
|
-
this.
|
|
673
|
+
this.countryDialCodesValue = countryDialCodes;
|
|
613
674
|
}
|
|
614
675
|
ngOnInit() {
|
|
676
|
+
var _a;
|
|
615
677
|
// TODO: consider better default handling mechanisms across frameworks
|
|
616
678
|
if (this.isPhoneField()) {
|
|
617
679
|
const state = this.authenticator.authState;
|
|
618
680
|
const { country_code } = getActorContext(state);
|
|
619
|
-
this.
|
|
681
|
+
this.defaultCountryCodeValue = (_a = this.defaultCountryCode) !== null && _a !== void 0 ? _a : country_code;
|
|
620
682
|
}
|
|
621
683
|
}
|
|
622
684
|
get attributeMap() {
|
|
@@ -662,7 +724,7 @@ class FormFieldComponent {
|
|
|
662
724
|
FormFieldComponent.decorators = [
|
|
663
725
|
{ type: Component, args: [{
|
|
664
726
|
selector: 'amplify-form-field',
|
|
665
|
-
template: "<div class=\"amplify-flex amplify-field\" style=\"flex-direction: column\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [defaultCountryCode]=\"
|
|
727
|
+
template: "<div class=\"amplify-flex amplify-field\" style=\"flex-direction: column\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [defaultCountryCode]=\"defaultCountryCodeValue\"\n [dialCodeList]=\"dialCodeList\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-phone-number-field>\n\n <amplify-password-field\n *ngIf=\"isPasswordField()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n (setBlur)=\"onBlur($event)\"\n ></amplify-password-field>\n\n <amplify-text-field\n *ngIf=\"!isPasswordField() && !isPhoneField()\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-text-field>\n\n <amplify-error *ngIf=\"error\">\n {{ error }}\n </amplify-error>\n</div>\n"
|
|
666
728
|
},] }
|
|
667
729
|
];
|
|
668
730
|
FormFieldComponent.ctorParameters = () => [
|
|
@@ -677,7 +739,9 @@ FormFieldComponent.propDecorators = {
|
|
|
677
739
|
initialValue: [{ type: Input }],
|
|
678
740
|
disabled: [{ type: Input }],
|
|
679
741
|
autocomplete: [{ type: Input }],
|
|
680
|
-
labelHidden: [{ type: Input }]
|
|
742
|
+
labelHidden: [{ type: Input }],
|
|
743
|
+
defaultCountryCode: [{ type: Input }],
|
|
744
|
+
dialCodeList: [{ type: Input }]
|
|
681
745
|
};
|
|
682
746
|
|
|
683
747
|
class ResetPasswordComponent {
|
|
@@ -694,6 +758,16 @@ class ResetPasswordComponent {
|
|
|
694
758
|
const { authState } = this.authenticator;
|
|
695
759
|
const { label } = getAliasInfoFromContext(authState.context);
|
|
696
760
|
this.labelText = `Enter your ${label.toLowerCase()}`;
|
|
761
|
+
this.setFormFields();
|
|
762
|
+
}
|
|
763
|
+
setFormFields() {
|
|
764
|
+
var _a, _b;
|
|
765
|
+
const _state = this.authenticator.authState;
|
|
766
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.resetPassword;
|
|
767
|
+
}
|
|
768
|
+
grabField(name, field, defaultV) {
|
|
769
|
+
var _a, _b, _c;
|
|
770
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
697
771
|
}
|
|
698
772
|
get context() {
|
|
699
773
|
return this.authenticator.slotContext;
|
|
@@ -711,7 +785,7 @@ class ResetPasswordComponent {
|
|
|
711
785
|
ResetPasswordComponent.decorators = [
|
|
712
786
|
{ type: Component, args: [{
|
|
713
787
|
selector: 'amplify-reset-password',
|
|
714
|
-
template: "<
|
|
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-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"
|
|
715
789
|
},] }
|
|
716
790
|
];
|
|
717
791
|
ResetPasswordComponent.ctorParameters = () => [
|
|
@@ -737,11 +811,22 @@ class SetupTotpComponent {
|
|
|
737
811
|
}
|
|
738
812
|
ngOnInit() {
|
|
739
813
|
this.generateQRCode();
|
|
814
|
+
this.setFormFields();
|
|
815
|
+
}
|
|
816
|
+
setFormFields() {
|
|
817
|
+
var _a, _b;
|
|
818
|
+
const _state = this.authenticator.authState;
|
|
819
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.setupTOTP;
|
|
820
|
+
}
|
|
821
|
+
grabField(name, field, defaultV) {
|
|
822
|
+
var _a, _b, _c;
|
|
823
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
740
824
|
}
|
|
741
825
|
get context() {
|
|
742
826
|
return this.authenticator.slotContext;
|
|
743
827
|
}
|
|
744
828
|
generateQRCode() {
|
|
829
|
+
var _a, _b, _c, _d, _e, _f;
|
|
745
830
|
return __awaiter(this, void 0, void 0, function* () {
|
|
746
831
|
// TODO: This should be handled in core.
|
|
747
832
|
const state = this.authenticator.authState;
|
|
@@ -749,8 +834,9 @@ class SetupTotpComponent {
|
|
|
749
834
|
const { user } = actorContext;
|
|
750
835
|
try {
|
|
751
836
|
this.secretKey = yield Auth.setupTOTP(user);
|
|
752
|
-
const issuer = 'AWSCognito';
|
|
753
|
-
const
|
|
837
|
+
const issuer = (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a['QR']) === null || _b === void 0 ? void 0 : _b.totpIssuer) !== null && _c !== void 0 ? _c : 'AWSCognito';
|
|
838
|
+
const username = (_f = (_e = (_d = this.formOverrides) === null || _d === void 0 ? void 0 : _d['QR']) === null || _e === void 0 ? void 0 : _e.totpUsername) !== null && _f !== void 0 ? _f : user.username;
|
|
839
|
+
const totpCode = `otpauth://totp/${issuer}:${username}?secret=${this.secretKey}&issuer=${issuer}`;
|
|
754
840
|
logger.info('totp code was generated:', totpCode);
|
|
755
841
|
this.qrCodeSource = yield QRCode.toDataURL(totpCode);
|
|
756
842
|
}
|
|
@@ -776,7 +862,7 @@ class SetupTotpComponent {
|
|
|
776
862
|
SetupTotpComponent.decorators = [
|
|
777
863
|
{ type: Component, args: [{
|
|
778
864
|
selector: 'amplify-setup-totp',
|
|
779
|
-
template: "<
|
|
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-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', '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"
|
|
780
866
|
},] }
|
|
781
867
|
];
|
|
782
868
|
SetupTotpComponent.ctorParameters = () => [
|
|
@@ -797,6 +883,24 @@ class SignInComponent {
|
|
|
797
883
|
: translate('Forgot your password? ');
|
|
798
884
|
this.signInButtonText = translate('Sign in');
|
|
799
885
|
}
|
|
886
|
+
ngOnInit() {
|
|
887
|
+
this.setFormFields();
|
|
888
|
+
}
|
|
889
|
+
setFormFields() {
|
|
890
|
+
var _a, _b, _c, _d;
|
|
891
|
+
const _state = this.authenticator.authState;
|
|
892
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.signIn;
|
|
893
|
+
this.userOverrides = (_c = this.formOverrides) === null || _c === void 0 ? void 0 : _c['username'];
|
|
894
|
+
this.passwordOR = (_d = this.formOverrides) === null || _d === void 0 ? void 0 : _d['password'];
|
|
895
|
+
}
|
|
896
|
+
labelHidden(name, defaultV = true) {
|
|
897
|
+
var _a, _b, _c;
|
|
898
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.labelHidden) !== null && _c !== void 0 ? _c : defaultV;
|
|
899
|
+
}
|
|
900
|
+
required(name, defaultV = true) {
|
|
901
|
+
var _a, _b, _c;
|
|
902
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.required) !== null && _c !== void 0 ? _c : defaultV;
|
|
903
|
+
}
|
|
800
904
|
get context() {
|
|
801
905
|
return this.authenticator.slotContext;
|
|
802
906
|
}
|
|
@@ -813,7 +917,7 @@ class SignInComponent {
|
|
|
813
917
|
SignInComponent.decorators = [
|
|
814
918
|
{ type: Component, args: [{
|
|
815
919
|
selector: 'amplify-sign-in',
|
|
816
|
-
template: "<
|
|
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\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",
|
|
817
921
|
encapsulation: ViewEncapsulation.None
|
|
818
922
|
},] }
|
|
819
923
|
];
|
|
@@ -877,12 +981,30 @@ class SignUpFormFieldsComponent {
|
|
|
877
981
|
});
|
|
878
982
|
// Only 1 is supported, so `['email', 'phone_number']` will only show `email`
|
|
879
983
|
this.loginMechanism = this.fieldNames.shift();
|
|
984
|
+
const common = [
|
|
985
|
+
this.loginMechanism,
|
|
986
|
+
'password',
|
|
987
|
+
'confirm_password',
|
|
988
|
+
];
|
|
989
|
+
this.fieldNamesCombined = [...common, ...this.fieldNames];
|
|
990
|
+
this.setFormFields();
|
|
991
|
+
}
|
|
992
|
+
setFormFields() {
|
|
993
|
+
var _a, _b, _c;
|
|
994
|
+
const _state = this.authenticator.authState;
|
|
995
|
+
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.signUp;
|
|
996
|
+
this.userOverrides = (_c = this.formOverrides) === null || _c === void 0 ? void 0 : _c[this.loginMechanism];
|
|
997
|
+
this.order = setFormOrder(this.formOverrides, this.fieldNamesCombined);
|
|
998
|
+
}
|
|
999
|
+
grabField(name, field, defaultV) {
|
|
1000
|
+
var _a, _b, _c;
|
|
1001
|
+
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
880
1002
|
}
|
|
881
1003
|
}
|
|
882
1004
|
SignUpFormFieldsComponent.decorators = [
|
|
883
1005
|
{ type: Component, args: [{
|
|
884
1006
|
selector: 'amplify-sign-up-form-fields',
|
|
885
|
-
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <amplify-user-name-alias
|
|
1007
|
+
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <ng-container *ngFor=\"let field of order\">\n <ng-container [ngSwitch]=\"field\">\n <amplify-user-name-alias\n *ngSwitchCase=\"loginMechanism\"\n [name]=\"loginMechanism\"\n [labelHidden]=\"grabField(loginMechanism, 'labelHidden', true)\"\n [placeholder]=\"userOverrides?.placeholder\"\n [required]=\"grabField(loginMechanism, 'required', true)\"\n [label]=\"userOverrides?.label\"\n [dialCode]=\"userOverrides?.dialCode\"\n [dialCodeList]=\"userOverrides?.dialCodeList\"\n ></amplify-user-name-alias>\n <amplify-form-field\n *ngSwitchCase=\"'password'\"\n [labelHidden]=\"grabField('password', 'labelHidden', true)\"\n [placeholder]=\"grabField('password', 'placeholder', null)\"\n [required]=\"grabField('password', 'required', true)\"\n [label]=\"grabField('password', 'label', null)\"\n name=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n <amplify-form-field\n *ngSwitchCase=\"'confirm_password'\"\n [labelHidden]=\"grabField('confirm_password', 'labelHidden', true)\"\n [placeholder]=\"\n grabField('confirm_password', 'placeholder', 'Confirm Password')\n \"\n [required]=\"grabField('confirm_password', 'required', true)\"\n [label]=\"grabField('confirm_password', 'label', 'Confirm Password')\"\n name=\"confirm_password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <amplify-form-field\n *ngSwitchDefault\n [name]=\"field\"\n [labelHidden]=\"grabField(field, 'labelHidden', false)\"\n [placeholder]=\"grabField(field, 'placeholder', null)\"\n [required]=\"grabField(field, 'required', true)\"\n [label]=\"grabField(field, 'label', null)\"\n [defaultCountryCode]=\"grabField(field, 'dialCode', null)\"\n [dialCodeList]=\"grabField(field, 'dialCodeList', null)\"\n ></amplify-form-field>\n </ng-container>\n </ng-container>\n</div>\n"
|
|
886
1008
|
},] }
|
|
887
1009
|
];
|
|
888
1010
|
SignUpFormFieldsComponent.ctorParameters = () => [
|
|
@@ -898,17 +1020,19 @@ class UserNameAliasComponent {
|
|
|
898
1020
|
this.required = true;
|
|
899
1021
|
}
|
|
900
1022
|
ngOnInit() {
|
|
1023
|
+
var _a, _b, _c;
|
|
901
1024
|
const context = this.authenticator.context;
|
|
902
|
-
const { label, type } = getAliasInfoFromContext(context);
|
|
903
|
-
this.
|
|
1025
|
+
const { label: lbl, type } = getAliasInfoFromContext(context);
|
|
1026
|
+
this.labelValue = (_a = this.label) !== null && _a !== void 0 ? _a : lbl;
|
|
904
1027
|
this.type = type;
|
|
905
|
-
this.
|
|
1028
|
+
this.placeholderValue = (_b = this.placeholder) !== null && _b !== void 0 ? _b : lbl;
|
|
1029
|
+
this.requiredValue = (_c = this.required) !== null && _c !== void 0 ? _c : true;
|
|
906
1030
|
}
|
|
907
1031
|
}
|
|
908
1032
|
UserNameAliasComponent.decorators = [
|
|
909
1033
|
{ type: Component, args: [{
|
|
910
1034
|
selector: 'amplify-user-name-alias',
|
|
911
|
-
template: "<amplify-form-field\n data-amplify-usernamealias\n [name]=\"name\"\n [
|
|
1035
|
+
template: "<amplify-form-field\n data-amplify-usernamealias\n [name]=\"name\"\n [labelHidden]=\"labelHidden\"\n [label]=\"labelValue\"\n [placeholder]=\"placeholderValue\"\n [required]=\"requiredValue\"\n [defaultCountryCode]=\"dialCode\"\n [dialCodeList]=\"dialCodeList\"\n [type]=\"type\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n autocomplete=\"username\"\n>\n</amplify-form-field>\n"
|
|
912
1036
|
},] }
|
|
913
1037
|
];
|
|
914
1038
|
UserNameAliasComponent.ctorParameters = () => [
|
|
@@ -918,7 +1042,12 @@ UserNameAliasComponent.propDecorators = {
|
|
|
918
1042
|
name: [{ type: Input }],
|
|
919
1043
|
disabled: [{ type: Input }],
|
|
920
1044
|
initialValue: [{ type: Input }],
|
|
921
|
-
required: [{ type: Input }]
|
|
1045
|
+
required: [{ type: Input }],
|
|
1046
|
+
labelHidden: [{ type: Input }],
|
|
1047
|
+
label: [{ type: Input }],
|
|
1048
|
+
placeholder: [{ type: Input }],
|
|
1049
|
+
dialCode: [{ type: Input }],
|
|
1050
|
+
dialCodeList: [{ type: Input }]
|
|
922
1051
|
};
|
|
923
1052
|
|
|
924
1053
|
class VerifyUserComponent {
|
|
@@ -958,7 +1087,7 @@ class VerifyUserComponent {
|
|
|
958
1087
|
VerifyUserComponent.decorators = [
|
|
959
1088
|
{ type: Component, args: [{
|
|
960
1089
|
selector: 'amplify-verify-user',
|
|
961
|
-
template: "<
|
|
1090
|
+
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=\"verify-user-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n\n <div *ngFor=\"let unverifiedAttribute of unverifiedAttributes | keyvalue\">\n <input\n name=\"unverifiedAttr\"\n type=\"radio\"\n [value]=\"unverifiedAttribute.key\"\n [id]=\"labelId\"\n />\n <label [for]=\"labelId\">{{\n getLabelForAttr(unverifiedAttribute.key)\n }}</label>\n </div>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ verifyText }}\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\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"verify-user-footer\" [context]=\"context\"> </amplify-slot>\n</form>\n",
|
|
962
1091
|
encapsulation: ViewEncapsulation.None
|
|
963
1092
|
},] }
|
|
964
1093
|
];
|
|
@@ -1106,13 +1235,16 @@ class PhoneNumberFieldComponent {
|
|
|
1106
1235
|
this.required = true;
|
|
1107
1236
|
this.labelHidden = false;
|
|
1108
1237
|
this.display = 'contents';
|
|
1109
|
-
|
|
1238
|
+
}
|
|
1239
|
+
ngOnInit() {
|
|
1240
|
+
var _a;
|
|
1241
|
+
this.countryDialCodesValues = (_a = this.dialCodeList) !== null && _a !== void 0 ? _a : countryDialCodes;
|
|
1110
1242
|
}
|
|
1111
1243
|
}
|
|
1112
1244
|
PhoneNumberFieldComponent.decorators = [
|
|
1113
1245
|
{ type: Component, args: [{
|
|
1114
1246
|
selector: 'amplify-phone-number-field',
|
|
1115
|
-
template: "<label\n class=\"amplify-label\"\n [class.amplify-visually-hidden]=\"labelHidden\"\n [for]=\"textFieldId\"\n>\n {{ label }}\n</label>\n<div\n class=\"amplify-flex amplify-phonenumberfield\"\n amplify-field-group\n style=\"gap: 0px\"\n>\n <div class=\"amplify-field-group__outer-start\">\n <div\n class=\"\n amplify-flex amplify-field amplify-selectfield amplify-countrycodeselect\n \"\n style=\"flex-direction: column\"\n >\n <amplify-form-select\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"selectFieldId\"\n [items]=\"
|
|
1247
|
+
template: "<label\n class=\"amplify-label\"\n [class.amplify-visually-hidden]=\"labelHidden\"\n [for]=\"textFieldId\"\n>\n {{ label }}\n</label>\n<div\n class=\"amplify-flex amplify-phonenumberfield\"\n amplify-field-group\n style=\"gap: 0px\"\n>\n <div class=\"amplify-field-group__outer-start\">\n <div\n class=\"\n amplify-flex amplify-field amplify-selectfield amplify-countrycodeselect\n \"\n style=\"flex-direction: column\"\n >\n <amplify-form-select\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"selectFieldId\"\n [items]=\"countryDialCodesValues\"\n [defaultValue]=\"defaultCountryCode\"\n ></amplify-form-select>\n </div>\n </div>\n\n <input\n class=\"amplify-input\"\n [id]=\"textFieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\n</div>\n"
|
|
1116
1248
|
},] }
|
|
1117
1249
|
];
|
|
1118
1250
|
PhoneNumberFieldComponent.propDecorators = {
|
|
@@ -1128,6 +1260,7 @@ PhoneNumberFieldComponent.propDecorators = {
|
|
|
1128
1260
|
required: [{ type: Input }],
|
|
1129
1261
|
type: [{ type: Input }],
|
|
1130
1262
|
labelHidden: [{ type: Input }],
|
|
1263
|
+
dialCodeList: [{ type: Input }],
|
|
1131
1264
|
display: [{ type: HostBinding, args: ['style.display',] }]
|
|
1132
1265
|
};
|
|
1133
1266
|
|