@aws-amplify/ui-angular 2.3.0 → 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/aws-amplify-ui-angular.d.ts +24 -24
- package/aws-amplify-ui-angular.metadata.json +1 -1
- package/bundles/aws-amplify-ui-angular-legacy.umd.js.map +1 -1
- package/bundles/aws-amplify-ui-angular-legacy.umd.min.js.map +1 -1
- package/bundles/aws-amplify-ui-angular.umd.js +139 -347
- package/bundles/aws-amplify-ui-angular.umd.js.map +1 -1
- package/bundles/aws-amplify-ui-angular.umd.min.js +1 -1
- package/bundles/aws-amplify-ui-angular.umd.min.js.map +1 -1
- package/esm2015/aws-amplify-ui-angular.js +25 -25
- package/esm2015/lib/common/helpers.js +3 -3
- package/esm2015/lib/common/types/auth-types.js +1 -1
- package/esm2015/lib/components/authenticator/authenticator.module.js +3 -3
- package/esm2015/lib/components/authenticator/components/authenticator/authenticator.component.js +27 -9
- package/esm2015/lib/components/authenticator/components/base-form-fields/base-form-fields.component.js +54 -0
- package/esm2015/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.js +3 -15
- package/esm2015/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.js +3 -13
- package/esm2015/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.js +3 -15
- package/esm2015/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.js +3 -15
- package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password-form-fields/force-new-password-form-fields.component.js +2 -22
- package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password.component.js +3 -15
- package/esm2015/lib/components/authenticator/components/form-field/form-field.component.js +12 -67
- package/esm2015/lib/components/authenticator/components/index.js +2 -2
- package/esm2015/lib/components/authenticator/components/reset-password/reset-password.component.js +3 -19
- package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +3 -13
- package/esm2015/lib/components/authenticator/components/sign-in/sign-in.component.js +3 -21
- package/esm2015/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.js +2 -50
- package/esm2015/lib/services/authenticator.service.js +3 -13
- package/fesm2015/aws-amplify-ui-angular-legacy.js.map +1 -1
- package/fesm2015/aws-amplify-ui-angular.js +103 -303
- package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
- package/lib/common/types/auth-types.d.ts +2 -2
- package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +5 -2
- package/lib/components/authenticator/components/base-form-fields/base-form-fields.component.d.ts +15 -0
- package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +3 -7
- package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +2 -4
- package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +3 -7
- package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +3 -7
- package/lib/components/authenticator/components/force-new-password/force-new-password-form-fields/force-new-password-form-fields.component.d.ts +1 -7
- package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +1 -7
- package/lib/components/authenticator/components/form-field/form-field.component.d.ts +5 -29
- package/lib/components/authenticator/components/index.d.ts +1 -1
- package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +3 -8
- package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +3 -4
- package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +3 -10
- package/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.d.ts +1 -19
- package/lib/services/authenticator.service.d.ts +2 -2
- package/package.json +8 -3
- package/esm2015/lib/components/authenticator/components/user-name-alias/user-name-alias.component.js +0 -42
- package/lib/components/authenticator/components/user-name-alias/user-name-alias.component.d.ts +0 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, ContentChildren, HostBinding, EventEmitter, Output, NgModule } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { createAuthenticatorMachine, getServiceContextFacade, listenToAuthHub, getSendEventAliases, translate,
|
|
4
|
+
import { createAuthenticatorMachine, getServiceContextFacade, listenToAuthHub, getSendEventAliases, translate, getFormDataFromEvent, getActorContext, AuthChallengeNames, FederatedIdentityProviders, countryDialCodes, getErrors, hasTranslation, defaultFormFieldOptions, getActorState, getSortedFormFields, getDefaultFormFields, applyDefaults, sortFormFields } from '@aws-amplify/ui';
|
|
5
5
|
export { translations } from '@aws-amplify/ui';
|
|
6
6
|
import { Logger } from '@aws-amplify/core';
|
|
7
7
|
import { interpret } from 'xstate';
|
|
@@ -56,20 +56,9 @@ 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
|
-
|
|
59
|
+
constructor() {
|
|
60
60
|
const machine = createAuthenticatorMachine();
|
|
61
61
|
const authService = interpret(machine).start();
|
|
62
|
-
authService.send({
|
|
63
|
-
type: 'INIT',
|
|
64
|
-
data: {
|
|
65
|
-
initialState,
|
|
66
|
-
loginMechanisms,
|
|
67
|
-
socialProviders,
|
|
68
|
-
signUpAttributes,
|
|
69
|
-
services,
|
|
70
|
-
formFields,
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
62
|
this._machineSubscription = authService.subscribe((state) => {
|
|
74
63
|
this._authState = state;
|
|
75
64
|
this._facade = getServiceContextFacade(state);
|
|
@@ -191,6 +180,7 @@ AuthenticatorService.decorators = [
|
|
|
191
180
|
providedIn: 'root',
|
|
192
181
|
},] }
|
|
193
182
|
];
|
|
183
|
+
AuthenticatorService.ctorParameters = () => [];
|
|
194
184
|
|
|
195
185
|
class AuthenticatorComponent {
|
|
196
186
|
constructor(authenticator, contextService) {
|
|
@@ -200,17 +190,31 @@ class AuthenticatorComponent {
|
|
|
200
190
|
// translated texts
|
|
201
191
|
this.signInTitle = translate('Sign In');
|
|
202
192
|
this.signUpTitle = translate('Create Account');
|
|
193
|
+
this.hasInitialized = false;
|
|
203
194
|
}
|
|
204
195
|
ngOnInit() {
|
|
205
196
|
const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, formFields, } = this;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Subscribes to state machine changes and sends INIT event
|
|
199
|
+
* once machine reaches 'setup' state.
|
|
200
|
+
*/
|
|
201
|
+
this.unsubscribeMachine = this.authenticator.subscribe(() => {
|
|
202
|
+
const { route } = this.authenticator;
|
|
203
|
+
if (!this.hasInitialized && route === 'setup') {
|
|
204
|
+
this.authenticator.send({
|
|
205
|
+
type: 'INIT',
|
|
206
|
+
data: {
|
|
207
|
+
initialState,
|
|
208
|
+
loginMechanisms,
|
|
209
|
+
services,
|
|
210
|
+
signUpAttributes,
|
|
211
|
+
socialProviders,
|
|
212
|
+
formFields,
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
this.hasInitialized = true;
|
|
216
|
+
}
|
|
217
|
+
}).unsubscribe;
|
|
214
218
|
/**
|
|
215
219
|
* handling translations after content init, because authenticator and its
|
|
216
220
|
* translations might be initialized before the main app's `ngOnInit` is run.
|
|
@@ -224,6 +228,10 @@ class AuthenticatorComponent {
|
|
|
224
228
|
ngAfterContentInit() {
|
|
225
229
|
this.contextService.customComponents = this.mapCustomComponents(this.customComponentQuery);
|
|
226
230
|
}
|
|
231
|
+
ngOnDestroy() {
|
|
232
|
+
if (this.unsubscribeMachine)
|
|
233
|
+
this.unsubscribeMachine();
|
|
234
|
+
}
|
|
227
235
|
/**
|
|
228
236
|
* Class Functions
|
|
229
237
|
*/
|
|
@@ -291,18 +299,6 @@ class ConfirmResetPasswordComponent {
|
|
|
291
299
|
this.backToSignInText = translate('Back to Sign In');
|
|
292
300
|
this.resendCodeText = translate('Resend Code');
|
|
293
301
|
}
|
|
294
|
-
ngOnInit() {
|
|
295
|
-
this.setFormFields();
|
|
296
|
-
}
|
|
297
|
-
setFormFields() {
|
|
298
|
-
var _a, _b;
|
|
299
|
-
const _state = this.authenticator.authState;
|
|
300
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmResetPassword;
|
|
301
|
-
}
|
|
302
|
-
grabField(name, field, defaultV) {
|
|
303
|
-
var _a, _b, _c;
|
|
304
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
305
|
-
}
|
|
306
302
|
get context() {
|
|
307
303
|
return this.authenticator.slotContext;
|
|
308
304
|
}
|
|
@@ -319,7 +315,7 @@ class ConfirmResetPasswordComponent {
|
|
|
319
315
|
ConfirmResetPasswordComponent.decorators = [
|
|
320
316
|
{ type: Component, args: [{
|
|
321
317
|
selector: 'amplify-confirm-reset-password',
|
|
322
|
-
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-reset-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n
|
|
318
|
+
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-reset-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n\n <amplify-base-form-fields\n route=\"confirmResetPassword\"\n ></amplify-base-form-fields>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n type=\"button\"\n (click)=\"authenticator.resendCode()\"\n >\n {{ resendCodeText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"confirm-reset-password-footer\" [context]=\"context\">\n </amplify-slot>\n</form>\n"
|
|
323
319
|
},] }
|
|
324
320
|
];
|
|
325
321
|
ConfirmResetPasswordComponent.ctorParameters = () => [
|
|
@@ -340,16 +336,6 @@ class ConfirmSignInComponent {
|
|
|
340
336
|
}
|
|
341
337
|
ngOnInit() {
|
|
342
338
|
this.setHeaderText();
|
|
343
|
-
this.setFormFields();
|
|
344
|
-
}
|
|
345
|
-
setFormFields() {
|
|
346
|
-
var _a, _b;
|
|
347
|
-
const _state = this.authenticator.authState;
|
|
348
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmSignIn;
|
|
349
|
-
}
|
|
350
|
-
grabField(name, field, defaultV) {
|
|
351
|
-
var _a, _b, _c;
|
|
352
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
353
339
|
}
|
|
354
340
|
get context() {
|
|
355
341
|
return this.authenticator.slotContext;
|
|
@@ -382,7 +368,7 @@ class ConfirmSignInComponent {
|
|
|
382
368
|
ConfirmSignInComponent.decorators = [
|
|
383
369
|
{ type: Component, args: [{
|
|
384
370
|
selector: 'amplify-confirm-sign-in',
|
|
385
|
-
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-sign-in-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n <amplify-form-
|
|
371
|
+
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-sign-in-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n <amplify-base-form-fields route=\"confirmSignIn\"></amplify-base-form-fields>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot\n name=\"confirm-sign-in-footer\"\n [context]=\"context\"\n ></amplify-slot>\n</form>\n"
|
|
386
372
|
},] }
|
|
387
373
|
];
|
|
388
374
|
ConfirmSignInComponent.ctorParameters = () => [
|
|
@@ -405,18 +391,6 @@ class ConfirmSignUpComponent {
|
|
|
405
391
|
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
392
|
this.minutesMessage = translate('It may take a minute to arrive.');
|
|
407
393
|
}
|
|
408
|
-
ngOnInit() {
|
|
409
|
-
this.setFormFields();
|
|
410
|
-
}
|
|
411
|
-
setFormFields() {
|
|
412
|
-
var _a, _b;
|
|
413
|
-
const _state = this.authenticator.authState;
|
|
414
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmSignUp;
|
|
415
|
-
}
|
|
416
|
-
grabField(name, field, defaultV) {
|
|
417
|
-
var _a, _b, _c;
|
|
418
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
419
|
-
}
|
|
420
394
|
get context() {
|
|
421
395
|
return this.authenticator.slotContext;
|
|
422
396
|
}
|
|
@@ -449,7 +423,7 @@ class ConfirmSignUpComponent {
|
|
|
449
423
|
ConfirmSignUpComponent.decorators = [
|
|
450
424
|
{ type: Component, args: [{
|
|
451
425
|
selector: 'amplify-confirm-sign-up',
|
|
452
|
-
template: "<ng-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"context.isPending\"\n >\n <amplify-slot name=\"confirm-sign-up-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\" style=\"font-size: 1.5rem\">\n {{ confirmSignUpHeading }}\n </h3>\n </amplify-slot>\n <span style=\"margin-bottom: 1rem\">\n {{ subtitleText }}\n </span>\n <amplify-form-
|
|
426
|
+
template: "<ng-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"context.isPending\"\n >\n <amplify-slot name=\"confirm-sign-up-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\" style=\"font-size: 1.5rem\">\n {{ confirmSignUpHeading }}\n </h3>\n </amplify-slot>\n <span style=\"margin-bottom: 1rem\">\n {{ subtitleText }}\n </span>\n <amplify-base-form-fields\n route=\"confirmSignUp\"\n ></amplify-base-form-fields>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n fontWeight=\"normal\"\n (click)=\"authenticator.resendCode()\"\n >\n {{ resendCodeText }}\n </button>\n </fieldset>\n\n <amplify-error *ngIf=\"context.error\">\n {{ authenticator.error }}\n </amplify-error>\n <amplify-slot\n name=\"confirm-sign-up-footer\"\n [context]=\"context\"\n ></amplify-slot>\n </form>\n</ng-container>\n"
|
|
453
427
|
},] }
|
|
454
428
|
];
|
|
455
429
|
ConfirmSignUpComponent.ctorParameters = () => [
|
|
@@ -469,18 +443,6 @@ class ConfirmVerifyUserComponent {
|
|
|
469
443
|
this.skipText = translate('Skip');
|
|
470
444
|
this.submitText = translate('Submit');
|
|
471
445
|
}
|
|
472
|
-
ngOnInit() {
|
|
473
|
-
this.setFormFields();
|
|
474
|
-
}
|
|
475
|
-
setFormFields() {
|
|
476
|
-
var _a, _b;
|
|
477
|
-
const _state = this.authenticator.authState;
|
|
478
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.confirmVerifyUser;
|
|
479
|
-
}
|
|
480
|
-
grabField(name, field, defaultV) {
|
|
481
|
-
var _a, _b, _c;
|
|
482
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
483
|
-
}
|
|
484
446
|
get context() {
|
|
485
447
|
return this.authenticator.slotContext;
|
|
486
448
|
}
|
|
@@ -497,7 +459,7 @@ class ConfirmVerifyUserComponent {
|
|
|
497
459
|
ConfirmVerifyUserComponent.decorators = [
|
|
498
460
|
{ type: Component, args: [{
|
|
499
461
|
selector: 'amplify-confirm-verify-user',
|
|
500
|
-
template: "<form data-amplify-form (input)=\"onInput($event)\" (submit)=\"onSubmit($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-verify-user-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-
|
|
462
|
+
template: "<form data-amplify-form (input)=\"onInput($event)\" (submit)=\"onSubmit($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-verify-user-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-base-form-fields\n route=\"confirmVerifyUser\"\n ></amplify-base-form-fields>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ submitText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.skipVerification()\"\n >\n {{ skipText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"confirm-verify-user-footer\" [context]=\"context\">\n </amplify-slot>\n</form>\n"
|
|
501
463
|
},] }
|
|
502
464
|
];
|
|
503
465
|
ConfirmVerifyUserComponent.ctorParameters = () => [
|
|
@@ -585,21 +547,9 @@ class ForceNewPasswordComponent {
|
|
|
585
547
|
this.changePasswordText = translate('Change Password');
|
|
586
548
|
this.backToSignInText = translate('Back to Sign In');
|
|
587
549
|
}
|
|
588
|
-
ngOnInit() {
|
|
589
|
-
this.setFormFields();
|
|
590
|
-
}
|
|
591
550
|
get context() {
|
|
592
551
|
return this.authenticator.slotContext;
|
|
593
552
|
}
|
|
594
|
-
setFormFields() {
|
|
595
|
-
var _a, _b;
|
|
596
|
-
const _state = this.authenticator.authState;
|
|
597
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.forceNewPassword;
|
|
598
|
-
}
|
|
599
|
-
grabField(name, field, defaultV) {
|
|
600
|
-
var _a, _b, _c;
|
|
601
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
602
|
-
}
|
|
603
553
|
onInput(event) {
|
|
604
554
|
event.preventDefault();
|
|
605
555
|
const { name, value } = event.target;
|
|
@@ -613,7 +563,7 @@ class ForceNewPasswordComponent {
|
|
|
613
563
|
ForceNewPasswordComponent.decorators = [
|
|
614
564
|
{ type: Component, args: [{
|
|
615
565
|
selector: 'amplify-force-new-password',
|
|
616
|
-
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"force-new-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n
|
|
566
|
+
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"force-new-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n\n <amplify-slot name=\"force-new-form-fields\" [context]=\"context\">\n <amplify-force-new-password-form-fields></amplify-force-new-password-form-fields>\n </amplify-slot>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ changePasswordText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"force-new-password-footer\" [context]=\"context\">\n </amplify-slot>\n</form>\n"
|
|
617
567
|
},] }
|
|
618
568
|
];
|
|
619
569
|
ForceNewPasswordComponent.ctorParameters = () => [
|
|
@@ -625,106 +575,41 @@ ForceNewPasswordComponent.propDecorators = {
|
|
|
625
575
|
};
|
|
626
576
|
|
|
627
577
|
class ForceNewPasswordFormFieldsComponent {
|
|
628
|
-
constructor(authenticator) {
|
|
629
|
-
this.authenticator = authenticator;
|
|
630
|
-
}
|
|
631
|
-
ngOnInit() {
|
|
632
|
-
const state = this.authenticator.authState;
|
|
633
|
-
const actorContext = getActorContext(state);
|
|
634
|
-
const { requiredAttributes } = actorContext;
|
|
635
|
-
this.fieldNames = requiredAttributes.filter((fieldName) => {
|
|
636
|
-
const hasDefaultField = !!authInputAttributes[fieldName];
|
|
637
|
-
if (!hasDefaultField) {
|
|
638
|
-
console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize Authenticator.SignUp.FormFields to add your own.`);
|
|
639
|
-
}
|
|
640
|
-
return hasDefaultField;
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
578
|
}
|
|
644
579
|
ForceNewPasswordFormFieldsComponent.decorators = [
|
|
645
580
|
{ type: Component, args: [{
|
|
646
581
|
selector: 'amplify-force-new-password-form-fields',
|
|
647
|
-
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <
|
|
582
|
+
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <amplify-base-form-fields route=\"forceNewPassword\"></amplify-base-form-fields>\n</div>\n"
|
|
648
583
|
},] }
|
|
649
584
|
];
|
|
650
|
-
ForceNewPasswordFormFieldsComponent.ctorParameters = () => [
|
|
651
|
-
{ type: AuthenticatorService }
|
|
652
|
-
];
|
|
653
|
-
|
|
654
|
-
const getAttributeMap = () => authInputAttributes;
|
|
655
585
|
|
|
656
|
-
/**
|
|
657
|
-
* Input interface opinionated for authenticator usage.
|
|
658
|
-
*
|
|
659
|
-
* TODO: Separate this component out to two parts -- 1) amplify-auth-input that
|
|
660
|
-
* contains authenticator opinionated logic and 2) amplify-text-field primitive
|
|
661
|
-
* that does not make any auth-related inference.
|
|
662
|
-
*/
|
|
663
586
|
class FormFieldComponent {
|
|
664
587
|
constructor(authenticator) {
|
|
665
588
|
this.authenticator = authenticator;
|
|
666
|
-
this.required = true;
|
|
667
|
-
this.placeholder = '';
|
|
668
|
-
this.label = '';
|
|
669
|
-
this.initialValue = '';
|
|
670
|
-
this.disabled = false;
|
|
671
|
-
this.autocomplete = '';
|
|
672
|
-
this.labelHidden = true;
|
|
673
589
|
this.countryDialCodesValue = countryDialCodes;
|
|
674
590
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
if (this.isPhoneField()) {
|
|
679
|
-
const state = this.authenticator.authState;
|
|
680
|
-
const { country_code } = getActorContext(state);
|
|
681
|
-
this.defaultCountryCodeValue = (_a = this.defaultCountryCode) !== null && _a !== void 0 ? _a : country_code;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
get attributeMap() {
|
|
685
|
-
return getAttributeMap();
|
|
686
|
-
}
|
|
687
|
-
get error() {
|
|
688
|
-
const formContext = getActorContext(this.authenticator.authState);
|
|
689
|
-
const { validationError } = formContext;
|
|
690
|
-
return translate(validationError[this.name]);
|
|
591
|
+
get errors() {
|
|
592
|
+
const { validationErrors } = this.authenticator;
|
|
593
|
+
return getErrors(validationErrors[this.name]);
|
|
691
594
|
}
|
|
692
595
|
onBlur($event) {
|
|
693
596
|
let { name } = $event.target;
|
|
694
597
|
this.authenticator.updateBlur({ name });
|
|
695
598
|
}
|
|
696
|
-
inferLabel() {
|
|
697
|
-
var _a;
|
|
698
|
-
const label = this.label || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.label);
|
|
699
|
-
return translate(label);
|
|
700
|
-
}
|
|
701
|
-
inferPlaceholder() {
|
|
702
|
-
var _a;
|
|
703
|
-
const placeholder = this.placeholder || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.placeholder) ||
|
|
704
|
-
this.inferLabel();
|
|
705
|
-
return translate(placeholder);
|
|
706
|
-
}
|
|
707
|
-
// infers what the `type` of underlying input element should be.
|
|
708
|
-
inferType() {
|
|
709
|
-
var _a, _b, _c;
|
|
710
|
-
return (_c = (_a = this.type) !== null && _a !== void 0 ? _a : (_b = this.attributeMap[this.name]) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : 'text';
|
|
711
|
-
}
|
|
712
|
-
inferAutocomplete() {
|
|
713
|
-
var _a;
|
|
714
|
-
return this.autocomplete || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.autocomplete);
|
|
715
|
-
}
|
|
716
|
-
// TODO(enhancement): use enum to differentiate special field types
|
|
717
599
|
isPasswordField() {
|
|
718
|
-
return this.
|
|
600
|
+
return this.formField.type === 'password';
|
|
719
601
|
}
|
|
720
602
|
isPhoneField() {
|
|
721
|
-
return this.
|
|
603
|
+
return this.formField.type === 'tel';
|
|
604
|
+
}
|
|
605
|
+
translate(phrase) {
|
|
606
|
+
return translate(phrase);
|
|
722
607
|
}
|
|
723
608
|
}
|
|
724
609
|
FormFieldComponent.decorators = [
|
|
725
610
|
{ type: Component, args: [{
|
|
726
611
|
selector: 'amplify-form-field',
|
|
727
|
-
template: "<div class=\"amplify-flex amplify-field\" style=\"flex-direction: column\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [
|
|
612
|
+
template: "<div class=\"amplify-flex amplify-field\" style=\"flex-direction: column\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [name]=\"name\"\n [label]=\"formField.label\"\n [defaultCountryCode]=\"formField.dialCode\"\n [dialCodeList]=\"formField.dialCodeList\"\n [placeholder]=\"formField.placeholder\"\n [required]=\"formField.isRequired\"\n [labelHidden]=\"formField.labelHidden\"\n [autocomplete]=\"formField.autocomplete\"\n type=\"tel\"\n ></amplify-phone-number-field>\n\n <amplify-password-field\n *ngIf=\"isPasswordField()\"\n [name]=\"name\"\n [label]=\"formField.label\"\n [placeholder]=\"formField.placeholder\"\n [required]=\"formField.isRequired\"\n [labelHidden]=\"formField.labelHidden\"\n [autocomplete]=\"formField.autocomplete\"\n (setBlur)=\"onBlur($event)\"\n ></amplify-password-field>\n\n <amplify-text-field\n *ngIf=\"!isPasswordField() && !isPhoneField()\"\n [name]=\"name\"\n [label]=\"formField.label\"\n [placeholder]=\"formField.placeholder\"\n [required]=\"formField.isRequired\"\n [labelHidden]=\"formField.labelHidden\"\n [autocomplete]=\"formField.autocomplete\"\n [type]=\"formField.type\"\n ></amplify-text-field>\n <div data-amplify-sign-up-errors *ngIf=\"errors?.length > 0\">\n <div\n class=\"amplify-text\"\n data-variation=\"error\"\n *ngFor=\"let error of errors\"\n >\n {{ translate(error) }}\n </div>\n </div>\n</div>\n"
|
|
728
613
|
},] }
|
|
729
614
|
];
|
|
730
615
|
FormFieldComponent.ctorParameters = () => [
|
|
@@ -732,16 +617,7 @@ FormFieldComponent.ctorParameters = () => [
|
|
|
732
617
|
];
|
|
733
618
|
FormFieldComponent.propDecorators = {
|
|
734
619
|
name: [{ type: Input }],
|
|
735
|
-
|
|
736
|
-
required: [{ type: Input }],
|
|
737
|
-
placeholder: [{ type: Input }],
|
|
738
|
-
label: [{ type: Input }],
|
|
739
|
-
initialValue: [{ type: Input }],
|
|
740
|
-
disabled: [{ type: Input }],
|
|
741
|
-
autocomplete: [{ type: Input }],
|
|
742
|
-
labelHidden: [{ type: Input }],
|
|
743
|
-
defaultCountryCode: [{ type: Input }],
|
|
744
|
-
dialCodeList: [{ type: Input }]
|
|
620
|
+
formField: [{ type: Input }]
|
|
745
621
|
};
|
|
746
622
|
|
|
747
623
|
class ResetPasswordComponent {
|
|
@@ -752,22 +628,6 @@ class ResetPasswordComponent {
|
|
|
752
628
|
// translated texts
|
|
753
629
|
this.sendCodeText = translate('Send Code');
|
|
754
630
|
this.backToSignInText = translate('Back to Sign In');
|
|
755
|
-
this.labelText = translate('Username');
|
|
756
|
-
}
|
|
757
|
-
ngOnInit() {
|
|
758
|
-
const { authState } = this.authenticator;
|
|
759
|
-
const { label } = getAliasInfoFromContext(authState.context);
|
|
760
|
-
this.labelText = `Enter your ${label.toLowerCase()}`;
|
|
761
|
-
this.setFormFields();
|
|
762
|
-
}
|
|
763
|
-
setFormFields() {
|
|
764
|
-
var _a, _b;
|
|
765
|
-
const _state = this.authenticator.authState;
|
|
766
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.resetPassword;
|
|
767
|
-
}
|
|
768
|
-
grabField(name, field, defaultV) {
|
|
769
|
-
var _a, _b, _c;
|
|
770
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
771
631
|
}
|
|
772
632
|
get context() {
|
|
773
633
|
return this.authenticator.slotContext;
|
|
@@ -785,7 +645,7 @@ class ResetPasswordComponent {
|
|
|
785
645
|
ResetPasswordComponent.decorators = [
|
|
786
646
|
{ type: Component, args: [{
|
|
787
647
|
selector: 'amplify-reset-password',
|
|
788
|
-
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot\n class=\"amplify-flex\"\n name=\"reset-password-header\"\n [context]=\"context\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n\n <amplify-form-
|
|
648
|
+
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot\n class=\"amplify-flex\"\n name=\"reset-password-header\"\n [context]=\"context\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n\n <amplify-base-form-fields route=\"resetPassword\"></amplify-base-form-fields>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n\n <amplify-slot name=\"reset-password-footer\" [context]=\"context\">\n </amplify-slot>\n</form>\n"
|
|
789
649
|
},] }
|
|
790
650
|
];
|
|
791
651
|
ResetPasswordComponent.ctorParameters = () => [
|
|
@@ -811,16 +671,6 @@ class SetupTotpComponent {
|
|
|
811
671
|
}
|
|
812
672
|
ngOnInit() {
|
|
813
673
|
this.generateQRCode();
|
|
814
|
-
this.setFormFields();
|
|
815
|
-
}
|
|
816
|
-
setFormFields() {
|
|
817
|
-
var _a, _b;
|
|
818
|
-
const _state = this.authenticator.authState;
|
|
819
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.setupTOTP;
|
|
820
|
-
}
|
|
821
|
-
grabField(name, field, defaultV) {
|
|
822
|
-
var _a, _b, _c;
|
|
823
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b[field]) !== null && _c !== void 0 ? _c : defaultV;
|
|
824
674
|
}
|
|
825
675
|
get context() {
|
|
826
676
|
return this.authenticator.slotContext;
|
|
@@ -862,7 +712,7 @@ class SetupTotpComponent {
|
|
|
862
712
|
SetupTotpComponent.decorators = [
|
|
863
713
|
{ type: Component, args: [{
|
|
864
714
|
selector: 'amplify-setup-totp',
|
|
865
|
-
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <div class=\"amplify-flex\" data-amplify-copy>\n <div>{{ secretKey }}</div>\n <div data-amplify-copy-svg (click)=\"copyText()\">\n <div data-amplify-copy-tooltip>{{ copyTextLabel }}</div>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM15 5H8C6.9 5 6.01 5.9 6.01 7L6 21C6 22.1 6.89 23 7.99 23H19C20.1 23 21 22.1 21 21V11L15 5ZM8 21V7H14V12H19V21H8Z\"\n />\n </svg>\n </div>\n </div>\n\n <amplify-form-
|
|
715
|
+
template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <div class=\"amplify-flex\" data-amplify-copy>\n <div>{{ secretKey }}</div>\n <div data-amplify-copy-svg (click)=\"copyText()\">\n <div data-amplify-copy-tooltip>{{ copyTextLabel }}</div>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM15 5H8C6.9 5 6.01 5.9 6.01 7L6 21C6 22.1 6.89 23 7.99 23H19C20.1 23 21 22.1 21 21V11L15 5ZM8 21V7H14V12H19V21H8Z\"\n />\n </svg>\n </div>\n </div>\n\n <amplify-base-form-fields route=\"setupTOTP\"></amplify-base-form-fields>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"setup-totp-footer\" [context]=\"context\"> </amplify-slot>\n</form>\n"
|
|
866
716
|
},] }
|
|
867
717
|
];
|
|
868
718
|
SetupTotpComponent.ctorParameters = () => [
|
|
@@ -883,24 +733,6 @@ class SignInComponent {
|
|
|
883
733
|
: translate('Forgot your password? ');
|
|
884
734
|
this.signInButtonText = translate('Sign in');
|
|
885
735
|
}
|
|
886
|
-
ngOnInit() {
|
|
887
|
-
this.setFormFields();
|
|
888
|
-
}
|
|
889
|
-
setFormFields() {
|
|
890
|
-
var _a, _b, _c, _d;
|
|
891
|
-
const _state = this.authenticator.authState;
|
|
892
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.signIn;
|
|
893
|
-
this.userOverrides = (_c = this.formOverrides) === null || _c === void 0 ? void 0 : _c['username'];
|
|
894
|
-
this.passwordOR = (_d = this.formOverrides) === null || _d === void 0 ? void 0 : _d['password'];
|
|
895
|
-
}
|
|
896
|
-
labelHidden(name, defaultV = true) {
|
|
897
|
-
var _a, _b, _c;
|
|
898
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.labelHidden) !== null && _c !== void 0 ? _c : defaultV;
|
|
899
|
-
}
|
|
900
|
-
required(name, defaultV = true) {
|
|
901
|
-
var _a, _b, _c;
|
|
902
|
-
return (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.required) !== null && _c !== void 0 ? _c : defaultV;
|
|
903
|
-
}
|
|
904
736
|
get context() {
|
|
905
737
|
return this.authenticator.slotContext;
|
|
906
738
|
}
|
|
@@ -917,7 +749,7 @@ class SignInComponent {
|
|
|
917
749
|
SignInComponent.decorators = [
|
|
918
750
|
{ type: Component, args: [{
|
|
919
751
|
selector: 'amplify-sign-in',
|
|
920
|
-
template: "<amplify-slot name=\"sign-in-header\" [context]=\"context\"></amplify-slot>\n\n<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <fieldset
|
|
752
|
+
template: "<amplify-slot name=\"sign-in-header\" [context]=\"context\"></amplify-slot>\n\n<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <fieldset class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset\n [disabled]=\"authenticator.isPending\">\n <legend class=\"amplify-visually-hidden\">Sign in</legend>\n <amplify-base-form-fields route=\"signIn\"></amplify-base-form-fields>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ signInButtonText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n</form>\n\n<amplify-slot name=\"sign-in-footer\" [context]=\"context\">\n <div data-amplify-footer>\n <button amplify-button fontWeight=\"normal\" size=\"small\" variation=\"link\" fullWidth=\"true\"\n (click)=\"authenticator.toResetPassword()\">\n {{ forgotPasswordText }}\n </button>\n </div>\n</amplify-slot>\n",
|
|
921
753
|
encapsulation: ViewEncapsulation.None
|
|
922
754
|
},] }
|
|
923
755
|
];
|
|
@@ -963,98 +795,15 @@ SignUpComponent.propDecorators = {
|
|
|
963
795
|
};
|
|
964
796
|
|
|
965
797
|
class SignUpFormFieldsComponent {
|
|
966
|
-
constructor(authenticator) {
|
|
967
|
-
this.authenticator = authenticator;
|
|
968
|
-
this.primaryAlias = '';
|
|
969
|
-
this.secondaryAliases = [];
|
|
970
|
-
this.translate = translate;
|
|
971
|
-
}
|
|
972
|
-
ngOnInit() {
|
|
973
|
-
const context = this.authenticator.context;
|
|
974
|
-
const { loginMechanisms, signUpAttributes } = context.config;
|
|
975
|
-
this.fieldNames = Array.from(new Set([...loginMechanisms, ...signUpAttributes]));
|
|
976
|
-
this.fieldNames = this.fieldNames.filter((fieldName) => {
|
|
977
|
-
const hasDefaultField = !!authInputAttributes[fieldName];
|
|
978
|
-
if (!hasDefaultField) {
|
|
979
|
-
console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize Authenticator.SignUp.FormFields to add your own.`);
|
|
980
|
-
}
|
|
981
|
-
return hasDefaultField;
|
|
982
|
-
});
|
|
983
|
-
// Only 1 is supported, so `['email', 'phone_number']` will only show `email`
|
|
984
|
-
this.loginMechanism = this.fieldNames.shift();
|
|
985
|
-
const common = [
|
|
986
|
-
this.loginMechanism,
|
|
987
|
-
'password',
|
|
988
|
-
'confirm_password',
|
|
989
|
-
];
|
|
990
|
-
this.fieldNamesCombined = [...common, ...this.fieldNames];
|
|
991
|
-
this.setFormFields();
|
|
992
|
-
}
|
|
993
|
-
get errors() {
|
|
994
|
-
const formContext = getActorContext(this.authenticator.authState);
|
|
995
|
-
const { validationError } = formContext;
|
|
996
|
-
return validationError['password'];
|
|
997
|
-
}
|
|
998
|
-
setFormFields() {
|
|
999
|
-
var _a, _b, _c;
|
|
1000
|
-
const _state = this.authenticator.authState;
|
|
1001
|
-
this.formOverrides = (_b = (_a = getActorState(_state).context) === null || _a === void 0 ? void 0 : _a.formFields) === null || _b === void 0 ? void 0 : _b.signUp;
|
|
1002
|
-
this.userOverrides = (_c = this.formOverrides) === null || _c === void 0 ? void 0 : _c[this.loginMechanism];
|
|
1003
|
-
this.order = setFormOrder(this.formOverrides, this.fieldNamesCombined);
|
|
1004
|
-
}
|
|
1005
|
-
grabField(name, field, defaultV) {
|
|
1006
|
-
var _a, _b, _c;
|
|
1007
|
-
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;
|
|
1008
|
-
}
|
|
1009
798
|
}
|
|
1010
799
|
SignUpFormFieldsComponent.decorators = [
|
|
1011
800
|
{ type: Component, args: [{
|
|
1012
801
|
selector: 'amplify-sign-up-form-fields',
|
|
1013
|
-
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <
|
|
802
|
+
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <amplify-base-form-fields route=\"signUp\"></amplify-base-form-fields>\n</div>\n"
|
|
1014
803
|
},] }
|
|
1015
804
|
];
|
|
1016
|
-
SignUpFormFieldsComponent.ctorParameters = () => [
|
|
1017
|
-
{ type: AuthenticatorService }
|
|
1018
|
-
];
|
|
1019
805
|
|
|
1020
|
-
|
|
1021
|
-
constructor(authenticator) {
|
|
1022
|
-
this.authenticator = authenticator;
|
|
1023
|
-
this.name = 'username';
|
|
1024
|
-
this.disabled = false;
|
|
1025
|
-
this.initialValue = '';
|
|
1026
|
-
this.required = true;
|
|
1027
|
-
}
|
|
1028
|
-
ngOnInit() {
|
|
1029
|
-
var _a, _b, _c;
|
|
1030
|
-
const context = this.authenticator.context;
|
|
1031
|
-
const { label: lbl, type } = getAliasInfoFromContext(context);
|
|
1032
|
-
this.labelValue = (_a = this.label) !== null && _a !== void 0 ? _a : lbl;
|
|
1033
|
-
this.type = type;
|
|
1034
|
-
this.placeholderValue = (_b = this.placeholder) !== null && _b !== void 0 ? _b : lbl;
|
|
1035
|
-
this.requiredValue = (_c = this.required) !== null && _c !== void 0 ? _c : true;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
UserNameAliasComponent.decorators = [
|
|
1039
|
-
{ type: Component, args: [{
|
|
1040
|
-
selector: 'amplify-user-name-alias',
|
|
1041
|
-
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"
|
|
1042
|
-
},] }
|
|
1043
|
-
];
|
|
1044
|
-
UserNameAliasComponent.ctorParameters = () => [
|
|
1045
|
-
{ type: AuthenticatorService }
|
|
1046
|
-
];
|
|
1047
|
-
UserNameAliasComponent.propDecorators = {
|
|
1048
|
-
name: [{ type: Input }],
|
|
1049
|
-
disabled: [{ type: Input }],
|
|
1050
|
-
initialValue: [{ type: Input }],
|
|
1051
|
-
required: [{ type: Input }],
|
|
1052
|
-
labelHidden: [{ type: Input }],
|
|
1053
|
-
label: [{ type: Input }],
|
|
1054
|
-
placeholder: [{ type: Input }],
|
|
1055
|
-
dialCode: [{ type: Input }],
|
|
1056
|
-
dialCodeList: [{ type: Input }]
|
|
1057
|
-
};
|
|
806
|
+
const getAttributeMap = () => defaultFormFieldOptions;
|
|
1058
807
|
|
|
1059
808
|
class VerifyUserComponent {
|
|
1060
809
|
constructor(authenticator) {
|
|
@@ -1105,6 +854,57 @@ VerifyUserComponent.propDecorators = {
|
|
|
1105
854
|
headerText: [{ type: Input }]
|
|
1106
855
|
};
|
|
1107
856
|
|
|
857
|
+
/**
|
|
858
|
+
* Sorts the given formFields, then renders them in order.
|
|
859
|
+
*/
|
|
860
|
+
class BaseFormFieldsComponent {
|
|
861
|
+
constructor(authenticator) {
|
|
862
|
+
this.authenticator = authenticator;
|
|
863
|
+
this.display = 'contents';
|
|
864
|
+
this.formFields = [];
|
|
865
|
+
}
|
|
866
|
+
ngOnInit() {
|
|
867
|
+
const state = this.authenticator.authState;
|
|
868
|
+
this.formFields = getSortedFormFields(this.route, state);
|
|
869
|
+
if (this.route === 'confirmSignUp') {
|
|
870
|
+
this.handleConfirmSignUp();
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
handleConfirmSignUp() {
|
|
874
|
+
/**
|
|
875
|
+
* @todo(breaking): Angular `confirmSignUp` has different placholder here from other frameworks.
|
|
876
|
+
*
|
|
877
|
+
* Translating here in a backwards-compatible manner, but should be resolved in next major version.
|
|
878
|
+
*/
|
|
879
|
+
var _a;
|
|
880
|
+
const state = this.authenticator.authState;
|
|
881
|
+
// backwards compatible placeholder text
|
|
882
|
+
const placeholder = !hasTranslation('Confirmation Code')
|
|
883
|
+
? translate('Enter your code') // prioritize new placeholder
|
|
884
|
+
: translate('Confirmation Code'); // legacy placeholder
|
|
885
|
+
let defaultFormFields = getDefaultFormFields(this.route, state);
|
|
886
|
+
if (defaultFormFields.confirmation_code.placeholder) {
|
|
887
|
+
defaultFormFields.confirmation_code.placeholder = placeholder;
|
|
888
|
+
}
|
|
889
|
+
const customFormFields = ((_a = getActorContext(state).formFields) === null || _a === void 0 ? void 0 : _a.confirmSignUp) || {};
|
|
890
|
+
const newFormFields = applyDefaults(defaultFormFields, customFormFields);
|
|
891
|
+
this.formFields = sortFormFields(newFormFields);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
BaseFormFieldsComponent.decorators = [
|
|
895
|
+
{ type: Component, args: [{
|
|
896
|
+
selector: 'amplify-base-form-fields',
|
|
897
|
+
template: "<ng-container *ngFor=\"let formField of formFields\">\n <amplify-form-field\n [name]=\"formField[0]\"\n [formField]=\"formField[1]\"\n ></amplify-form-field>\n</ng-container>\n"
|
|
898
|
+
},] }
|
|
899
|
+
];
|
|
900
|
+
BaseFormFieldsComponent.ctorParameters = () => [
|
|
901
|
+
{ type: AuthenticatorService }
|
|
902
|
+
];
|
|
903
|
+
BaseFormFieldsComponent.propDecorators = {
|
|
904
|
+
route: [{ type: Input }],
|
|
905
|
+
display: [{ type: HostBinding, args: ['style.display',] }]
|
|
906
|
+
};
|
|
907
|
+
|
|
1108
908
|
class ButtonComponent {
|
|
1109
909
|
constructor() {
|
|
1110
910
|
this.type = 'button';
|
|
@@ -1420,6 +1220,7 @@ AmplifyAuthenticatorModule.decorators = [
|
|
|
1420
1220
|
AmplifySlotComponent,
|
|
1421
1221
|
AmplifySlotDirective,
|
|
1422
1222
|
AuthenticatorComponent,
|
|
1223
|
+
BaseFormFieldsComponent,
|
|
1423
1224
|
ButtonComponent,
|
|
1424
1225
|
CheckboxComponent,
|
|
1425
1226
|
ConfirmResetPasswordComponent,
|
|
@@ -1443,7 +1244,6 @@ AmplifyAuthenticatorModule.decorators = [
|
|
|
1443
1244
|
TabItemComponent,
|
|
1444
1245
|
TabsComponent,
|
|
1445
1246
|
TextFieldComponent,
|
|
1446
|
-
UserNameAliasComponent,
|
|
1447
1247
|
VerifyUserComponent,
|
|
1448
1248
|
],
|
|
1449
1249
|
imports: [CommonModule],
|
|
@@ -1466,5 +1266,5 @@ AmplifyAuthenticatorModule.decorators = [
|
|
|
1466
1266
|
* Generated bundle index. Do not edit.
|
|
1467
1267
|
*/
|
|
1468
1268
|
|
|
1469
|
-
export { AmplifyAuthenticatorModule, AmplifySlotDirective, AuthenticatorComponent, AuthenticatorService, ButtonComponent, CheckboxComponent, ConfirmResetPasswordComponent, ConfirmSignInComponent, ConfirmSignUpComponent, ConfirmVerifyUserComponent, CustomComponentsService, ErrorComponent, FederatedSignInButtonComponent, FederatedSignInComponent, ForceNewPasswordComponent, ForceNewPasswordFormFieldsComponent, FormFieldComponent, PasswordFieldComponent, PhoneNumberFieldComponent, ResetPasswordComponent, SelectComponent, SetupTotpComponent, SignInComponent, SignUpComponent, SignUpFormFieldsComponent, TabItemComponent, TabsComponent, TextFieldComponent,
|
|
1269
|
+
export { AmplifyAuthenticatorModule, AmplifySlotDirective, AuthenticatorComponent, AuthenticatorService, BaseFormFieldsComponent, ButtonComponent, CheckboxComponent, ConfirmResetPasswordComponent, ConfirmSignInComponent, ConfirmSignUpComponent, ConfirmVerifyUserComponent, CustomComponentsService, ErrorComponent, FederatedSignInButtonComponent, FederatedSignInComponent, ForceNewPasswordComponent, ForceNewPasswordFormFieldsComponent, FormFieldComponent, PasswordFieldComponent, PhoneNumberFieldComponent, ResetPasswordComponent, SelectComponent, SetupTotpComponent, SignInComponent, SignUpComponent, SignUpFormFieldsComponent, TabItemComponent, TabsComponent, TextFieldComponent, VerifyUserComponent, getAttributeMap, AmplifySlotComponent as ɵa, AuthenticatorComponent as ɵb, VerifyUserComponent as ɵba, BaseFormFieldsComponent as ɵc, ButtonComponent as ɵd, CheckboxComponent as ɵe, ConfirmResetPasswordComponent as ɵf, ConfirmSignInComponent as ɵg, ConfirmSignUpComponent as ɵh, ConfirmVerifyUserComponent as ɵi, ErrorComponent as ɵj, FederatedSignInButtonComponent as ɵk, FederatedSignInComponent as ɵl, ForceNewPasswordComponent as ɵm, ForceNewPasswordFormFieldsComponent as ɵn, FormFieldComponent as ɵo, PasswordFieldComponent as ɵp, PhoneNumberFieldComponent as ɵq, ResetPasswordComponent as ɵr, SelectComponent as ɵs, SetupTotpComponent as ɵt, SignInComponent as ɵu, SignUpComponent as ɵv, SignUpFormFieldsComponent as ɵw, TabItemComponent as ɵx, TabsComponent as ɵy, TextFieldComponent as ɵz };
|
|
1470
1270
|
//# sourceMappingURL=aws-amplify-ui-angular.js.map
|