@aws-amplify/ui-angular 2.0.1-next.2 → 2.0.1-next.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 +15 -15
- package/aws-amplify-ui-angular.metadata.json +1 -1
- package/bundles/aws-amplify-ui-angular.umd.js +162 -92
- 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 +16 -16
- package/esm2015/index.js +2 -2
- package/esm2015/lib/components/amplify-authenticator/amplify-authenticator.component.js +2 -2
- package/esm2015/lib/components/amplify-confirm-sign-in/amplify-confirm-sign-in.component.js +8 -6
- package/esm2015/lib/components/amplify-confirm-sign-up/amplify-confirm-sign-up.component.js +12 -7
- package/esm2015/lib/components/amplify-federated-sign-in/amplify-federated-sign-in.component.js +9 -4
- package/esm2015/lib/components/amplify-force-new-password/amplify-force-new-password.component.js +12 -4
- package/esm2015/lib/components/amplify-reset-password/amplify-reset-password.component.js +7 -3
- package/esm2015/lib/components/amplify-setup-totp/amplify-setup-totp.component.js +14 -5
- package/esm2015/lib/components/amplify-sign-in/amplify-sign-in.component.js +9 -3
- package/esm2015/lib/components/amplify-sign-up/amplify-sign-up.component.js +8 -3
- package/esm2015/lib/components/amplify-verify-user/amplify-verify-user.component.js +11 -4
- package/esm2015/lib/components/confirm-reset-password/amplify-confirm-reset-password.component.js +9 -3
- package/esm2015/lib/components/confirm-verify-user/amplify-confirm-verify-user.component.js +2 -2
- package/esm2015/lib/components/index.js +14 -6
- package/esm2015/lib/primitives/amplify-input/amplify-input.component.js +30 -9
- package/esm2015/lib/primitives/amplify-select/amplify-select.component.js +17 -0
- package/esm2015/lib/primitives/amplify-user-name-alias/amplify-user-name-alias.component.js +6 -4
- package/esm2015/lib/ui-angular.module.js +4 -6
- package/fesm2015/aws-amplify-ui-angular.js +131 -70
- package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
- package/index.d.ts +1 -1
- package/lib/components/amplify-confirm-sign-in/amplify-confirm-sign-in.component.d.ts +4 -2
- package/lib/components/amplify-confirm-sign-up/amplify-confirm-sign-up.component.d.ts +5 -0
- package/lib/components/amplify-federated-sign-in/amplify-federated-sign-in.component.d.ts +4 -1
- package/lib/components/amplify-force-new-password/amplify-force-new-password.component.d.ts +2 -0
- package/lib/components/amplify-reset-password/amplify-reset-password.component.d.ts +2 -0
- package/lib/components/amplify-setup-totp/amplify-setup-totp.component.d.ts +3 -0
- package/lib/components/amplify-sign-in/amplify-sign-in.component.d.ts +4 -0
- package/lib/components/amplify-sign-up/amplify-sign-up.component.d.ts +3 -0
- package/lib/components/amplify-verify-user/amplify-verify-user.component.d.ts +4 -1
- package/lib/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +4 -0
- package/lib/components/index.d.ts +13 -5
- package/lib/primitives/amplify-input/amplify-input.component.d.ts +11 -3
- package/lib/primitives/amplify-select/amplify-select.component.d.ts +7 -0
- package/lib/primitives/amplify-user-name-alias/amplify-user-name-alias.component.d.ts +1 -0
- package/package.json +2 -2
- package/esm2015/lib/components/amplify-sign-out/amplify-sign-out.component.js +0 -28
- package/lib/components/amplify-sign-out/amplify-sign-out.component.d.ts +0 -6
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, HostBinding, ContentChildren, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef, NgZone, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
|
-
import {
|
|
5
|
-
import { authMachine, getSendEventAliases, getActorState, getConfiguredAliases, getActorContext, authInputAttributes, getAliasInfoFromContext, AuthChallengeNames, FederatedIdentityProviders } from '@aws-amplify/ui';
|
|
4
|
+
import { authMachine, getSendEventAliases, getActorState, translate, getConfiguredAliases, getActorContext, authInputAttributes, countryDialCodes, getAliasInfoFromContext, AuthChallengeNames, FederatedIdentityProviders } from '@aws-amplify/ui';
|
|
6
5
|
import { interpret } from 'xstate';
|
|
7
6
|
import { __awaiter, __decorate } from 'tslib';
|
|
8
7
|
import { Logger, Auth } from 'aws-amplify';
|
|
@@ -144,7 +143,7 @@ class AmplifyAuthenticatorComponent {
|
|
|
144
143
|
AmplifyAuthenticatorComponent.decorators = [
|
|
145
144
|
{ type: Component, args: [{
|
|
146
145
|
selector: 'amplify-authenticator',
|
|
147
|
-
template: "<!-- \n Define default contents here.\n-->\n<ng-template #signIn>\n <amplify-sign-in></amplify-sign-in>\n</ng-template>\n<ng-template #signUp>\n <amplify-sign-up></amplify-sign-up>\n</ng-template>\n<ng-template #confirmSignUp>\n <amplify-confirm-sign-up></amplify-confirm-sign-up>\n</ng-template>\n<ng-template #confirmSignIn>\n <amplify-confirm-sign-in></amplify-confirm-sign-in>\n</ng-template>\n<ng-template #authenticated
|
|
146
|
+
template: "<!-- \n Define default contents here.\n-->\n<ng-template #signIn>\n <amplify-sign-in></amplify-sign-in>\n</ng-template>\n<ng-template #signUp>\n <amplify-sign-up></amplify-sign-up>\n</ng-template>\n<ng-template #confirmSignUp>\n <amplify-confirm-sign-up></amplify-confirm-sign-up>\n</ng-template>\n<ng-template #confirmSignIn>\n <amplify-confirm-sign-in></amplify-confirm-sign-in>\n</ng-template>\n<ng-template #authenticated> <ng-content></ng-content> </ng-template>\n<ng-template #setupTOTP>\n <amplify-setup-totp></amplify-setup-totp>\n</ng-template>\n<ng-template #forceNewPassword>\n <amplify-force-new-password></amplify-force-new-password>\n</ng-template>\n<ng-template #resetPassword>\n <amplify-reset-password></amplify-reset-password>\n</ng-template>\n<ng-template #confirmResetPassword>\n <amplify-confirm-reset-password></amplify-confirm-reset-password>\n</ng-template>\n<ng-template #verifyUser>\n <amplify-verify-user></amplify-verify-user>\n</ng-template>\n<ng-template #confirmVerifyUser>\n <amplify-confirm-verify-user></amplify-confirm-verify-user>\n</ng-template>\n\n<!-- \n Next, we render respective auth subcomponent respective to the current authState.\n If customer is overriding that component, we render customer's template instead.\n-->\n\n<!-- signIn component -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.signIn || signIn\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('signIn')\"\n>\n</ng-container>\n\n<!-- signUp component -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.signUp || signUp\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('signUp')\"\n>\n</ng-container>\n\n<!-- confirmSignUp content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.confirmSignUp || confirmSignUp\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmSignUp')\"\n>\n</ng-container>\n\n<!-- confirmSignIn content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.confirmSignIn || confirmSignIn\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmSignIn')\"\n>\n</ng-container>\n\n<!-- setupTotp content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.setupTOTP || setupTOTP\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('setupTOTP')\"\n>\n</ng-container>\n\n<!-- forceNewPassword content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.forceNewPassword || forceNewPassword\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('forceNewPassword')\"\n>\n</ng-container>\n\n<!-- resetPassword content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.resetPassword || resetPassword\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('resetPassword')\"\n>\n</ng-container>\n\n<!-- confirmResetPassword content -->\n<ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPassword || confirmResetPassword\n \"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmResetPassword')\"\n>\n</ng-container>\n\n<!-- verifyUser content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.verifyUser || verifyUser\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('verifyUser')\"\n>\n</ng-container>\n\n<!-- confirmVerifyUser content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.confirmVerifyUser || confirmVerifyUser\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmVerifyUser')\"\n>\n</ng-container>\n\n<!-- signedIn content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.authenticated || authenticated\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"authenticatorState.matches('authenticated')\"\n>\n</ng-container>\n",
|
|
148
147
|
providers: [AuthPropService],
|
|
149
148
|
encapsulation: ViewEncapsulation.None
|
|
150
149
|
},] }
|
|
@@ -159,16 +158,21 @@ AmplifyAuthenticatorComponent.propDecorators = {
|
|
|
159
158
|
customComponentQuery: [{ type: ContentChildren, args: [AmplifyOverrideDirective,] }]
|
|
160
159
|
};
|
|
161
160
|
|
|
162
|
-
const logger$
|
|
161
|
+
const logger$3 = new Logger('SignIn');
|
|
163
162
|
class AmplifySignInComponent {
|
|
164
163
|
constructor(stateMachine, contextService) {
|
|
165
164
|
this.stateMachine = stateMachine;
|
|
166
165
|
this.contextService = contextService;
|
|
167
166
|
this.dataAttr = '';
|
|
168
|
-
this.headerText = 'Sign in to your account';
|
|
167
|
+
this.headerText = translate('Sign in to your account');
|
|
169
168
|
this.customComponents = {};
|
|
170
169
|
this.remoteError = '';
|
|
171
170
|
this.isPending = false;
|
|
171
|
+
// translated phrases
|
|
172
|
+
this.forgotPasswordText = translate('Forgot your password? ');
|
|
173
|
+
this.signInButtonText = translate('Sign in');
|
|
174
|
+
this.noAccountText = translate('No account? ');
|
|
175
|
+
this.createAccountText = translate('Create account');
|
|
172
176
|
}
|
|
173
177
|
ngOnInit() {
|
|
174
178
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -177,7 +181,7 @@ class AmplifySignInComponent {
|
|
|
177
181
|
this.customComponents = this.contextService.customComponents;
|
|
178
182
|
}
|
|
179
183
|
ngOnDestroy() {
|
|
180
|
-
logger$
|
|
184
|
+
logger$3.log('sign in destroyed, unsubscribing from state machine...');
|
|
181
185
|
this.authSubscription.unsubscribe();
|
|
182
186
|
}
|
|
183
187
|
onStateUpdate(state) {
|
|
@@ -216,7 +220,7 @@ class AmplifySignInComponent {
|
|
|
216
220
|
AmplifySignInComponent.decorators = [
|
|
217
221
|
{ type: Component, args: [{
|
|
218
222
|
selector: 'amplify-sign-in',
|
|
219
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #signInButton>\n <button data-amplify-button type=\"submit\">
|
|
223
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #signInButton>\n <button data-amplify-button type=\"submit\">{{ signInButtonText }}</button>\n</ng-template>\n\n<ng-template #signInForm>\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-user-name-alias></amplify-user-name-alias>\n <amplify-form-input\n data-amplify-password\n name=\"password\"\n type=\"password\"\n autocomplete=\"current-password\"\n ></amplify-form-input>\n <button type=\"button\" (click)=\"toResetPassword()\">\n {{ forgotPasswordText }}\n </button>\n <div data-amplify-footer>\n <div>\n {{ noAccountText }}\n <button type=\"button\" (click)=\"toSignUp()\">\n {{ createAccountText }}\n </button>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInButton || signInButton\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || signInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n",
|
|
220
224
|
encapsulation: ViewEncapsulation.None
|
|
221
225
|
},] }
|
|
222
226
|
];
|
|
@@ -229,42 +233,21 @@ AmplifySignInComponent.propDecorators = {
|
|
|
229
233
|
headerText: [{ type: Input }]
|
|
230
234
|
};
|
|
231
235
|
|
|
232
|
-
class AmplifySignOutComponent {
|
|
233
|
-
constructor(stateMachine) {
|
|
234
|
-
this.stateMachine = stateMachine;
|
|
235
|
-
}
|
|
236
|
-
signOut() {
|
|
237
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
238
|
-
try {
|
|
239
|
-
this.stateMachine.authService.send('SIGN_OUT');
|
|
240
|
-
}
|
|
241
|
-
catch (err) {
|
|
242
|
-
console.error(err);
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
AmplifySignOutComponent.decorators = [
|
|
248
|
-
{ type: Component, args: [{
|
|
249
|
-
selector: 'amplify-sign-out',
|
|
250
|
-
template: "<div [ngStyle]=\"{ height: '24rem' }\">\n <button (click)=\"signOut()\">Sign Out</button>\n</div>\n"
|
|
251
|
-
},] }
|
|
252
|
-
];
|
|
253
|
-
AmplifySignOutComponent.ctorParameters = () => [
|
|
254
|
-
{ type: StateMachineService }
|
|
255
|
-
];
|
|
256
|
-
|
|
257
236
|
class AmplifySignUpComponent {
|
|
258
237
|
constructor(stateMachine, contextService) {
|
|
259
238
|
this.stateMachine = stateMachine;
|
|
260
239
|
this.contextService = contextService;
|
|
261
240
|
this.dataAttr = '';
|
|
262
|
-
this.headerText = 'Create a new account';
|
|
241
|
+
this.headerText = translate('Create a new account');
|
|
263
242
|
this.remoteError = '';
|
|
264
243
|
this.isPending = false;
|
|
265
244
|
this.primaryAlias = '';
|
|
266
245
|
this.secondaryAliases = [];
|
|
267
246
|
this.validationError = {};
|
|
247
|
+
// translated texts
|
|
248
|
+
this.createAccountText = translate('Back to Sign In');
|
|
249
|
+
this.haveAccountText = translate('Have an account? ');
|
|
250
|
+
this.signInText = translate('Sign in');
|
|
268
251
|
}
|
|
269
252
|
get context() {
|
|
270
253
|
const { change, signIn, submit } = this.stateMachine.services;
|
|
@@ -323,7 +306,7 @@ class AmplifySignUpComponent {
|
|
|
323
306
|
AmplifySignUpComponent.decorators = [
|
|
324
307
|
{ type: Component, args: [{
|
|
325
308
|
selector: 'amplify-sign-up',
|
|
326
|
-
template: "<ng-template #signUpButton>\n <button data-amplify-button type=\"submit\">
|
|
309
|
+
template: "<ng-template #signUpButton>\n <button data-amplify-button type=\"submit\">{{ createAccountText }}</button>\n</ng-template>\n\n<ng-template #signUpUsername>\n <amplify-user-name-alias [name]=\"primaryAlias\"></amplify-user-name-alias>\n</ng-template>\n\n<ng-template #signUpPassword>\n <amplify-form-input\n name=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-input>\n</ng-template>\n\n<ng-template #signUpConfirmPassword>\n <amplify-form-input\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-input>\n</ng-template>\n\n<ng-template #signUpFieldset>\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signUpUsername || signUpUsername\"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signUpPassword || signUpPassword\"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.signUpConfirmPassword || signUpConfirmPassword\n \"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n\n <ng-container *ngFor=\"let secondaryAlias of secondaryAliases\">\n <amplify-form-input [name]=\"secondaryAlias\"></amplify-form-input>\n </ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n</ng-template>\n\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signUpFieldset || signUpFieldset\"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n\n <div data-amplify-footer>\n <div>\n {{ haveAccountText }}\n <button type=\"button\" (click)=\"toSignIn()\">{{ signInText }}</button>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signUpButton || signUpButton\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </form>\n</div>\n"
|
|
327
310
|
},] }
|
|
328
311
|
];
|
|
329
312
|
AmplifySignUpComponent.ctorParameters = () => [
|
|
@@ -338,18 +321,34 @@ AmplifySignUpComponent.propDecorators = {
|
|
|
338
321
|
const getAttributeMap = () => authInputAttributes;
|
|
339
322
|
|
|
340
323
|
/**
|
|
341
|
-
*
|
|
342
|
-
*
|
|
324
|
+
* Input interface opinionated for authenticator usage.
|
|
325
|
+
*
|
|
326
|
+
* TODO: Separate this component out to two parts -- 1) amplify-auth-input that
|
|
327
|
+
* contains authenticator opinionated logic and 2) amplify-text-field primitive
|
|
328
|
+
* that does not make any auth-related inference.
|
|
343
329
|
*/
|
|
344
330
|
class AmplifyInputComponent {
|
|
345
331
|
constructor(stateMachine) {
|
|
346
332
|
this.stateMachine = stateMachine;
|
|
347
|
-
this.required =
|
|
333
|
+
this.required = true;
|
|
348
334
|
this.placeholder = '';
|
|
349
335
|
this.label = '';
|
|
350
336
|
this.initialValue = '';
|
|
351
337
|
this.disabled = false;
|
|
352
338
|
this.autocomplete = '';
|
|
339
|
+
this.countryDialCodes = countryDialCodes;
|
|
340
|
+
}
|
|
341
|
+
ngOnInit() {
|
|
342
|
+
const state = this.stateMachine.authState;
|
|
343
|
+
const { country_code } = getActorContext(state);
|
|
344
|
+
this.defaultCountryCode = country_code;
|
|
345
|
+
// TODO: consider better default handling mechanisms across frameworks
|
|
346
|
+
if (this.isTelInput()) {
|
|
347
|
+
this.stateMachine.send({
|
|
348
|
+
type: 'CHANGE',
|
|
349
|
+
data: { name: 'country_code', value: country_code },
|
|
350
|
+
});
|
|
351
|
+
}
|
|
353
352
|
}
|
|
354
353
|
get attributeMap() {
|
|
355
354
|
return getAttributeMap();
|
|
@@ -359,14 +358,19 @@ class AmplifyInputComponent {
|
|
|
359
358
|
const { validationError } = formContext;
|
|
360
359
|
return validationError[this.name];
|
|
361
360
|
}
|
|
361
|
+
isTelInput() {
|
|
362
|
+
return this.inferType() === 'tel';
|
|
363
|
+
}
|
|
362
364
|
inferLabel() {
|
|
363
365
|
var _a;
|
|
364
|
-
|
|
366
|
+
const label = this.label || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.label);
|
|
367
|
+
return translate(label);
|
|
365
368
|
}
|
|
366
369
|
inferPlaceholder() {
|
|
367
370
|
var _a;
|
|
368
|
-
|
|
369
|
-
this.inferLabel()
|
|
371
|
+
const placeholder = this.placeholder || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.placeholder) ||
|
|
372
|
+
this.inferLabel();
|
|
373
|
+
return translate(placeholder);
|
|
370
374
|
}
|
|
371
375
|
// infers what the `type` of underlying input element should be.
|
|
372
376
|
inferType() {
|
|
@@ -377,7 +381,7 @@ class AmplifyInputComponent {
|
|
|
377
381
|
AmplifyInputComponent.decorators = [
|
|
378
382
|
{ type: Component, args: [{
|
|
379
383
|
selector: 'amplify-form-input',
|
|
380
|
-
template: "<label>\n <div data-amplify-label>{{ inferLabel() }}</div>\n <input\n data-amplify-form-input\n [type]=\"inferType()\"\n [name]=\"name\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required
|
|
384
|
+
template: "<!-- Country code field -->\n<amplify-form-select\n *ngIf=\"isTelInput()\"\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"'country-code'\"\n [items]=\"countryDialCodes\"\n [initialValue]=\"defaultCountryCode\"\n></amplify-form-select>\n<!-- Textbox field -->\n<label>\n <div data-amplify-label>{{ inferLabel() }}</div>\n <input\n data-amplify-form-input\n [type]=\"inferType()\"\n [name]=\"name\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\n <amplify-error *ngIf=\"error\">\n {{ error }}\n </amplify-error>\n</label>\n"
|
|
381
385
|
},] }
|
|
382
386
|
];
|
|
383
387
|
AmplifyInputComponent.ctorParameters = () => [
|
|
@@ -403,15 +407,20 @@ AmplifyErrorComponent.decorators = [
|
|
|
403
407
|
},] }
|
|
404
408
|
];
|
|
405
409
|
|
|
406
|
-
const logger$3 = new Logger('ConfirmSignUp');
|
|
407
410
|
class AmplifyConfirmSignUpComponent {
|
|
408
411
|
constructor(stateMachine, contextService) {
|
|
409
412
|
this.stateMachine = stateMachine;
|
|
410
413
|
this.contextService = contextService;
|
|
411
414
|
this.dataAttr = '';
|
|
415
|
+
this.headerText = translate('Confirm Sign Up');
|
|
412
416
|
this.customComponents = {};
|
|
413
417
|
this.remoteError = '';
|
|
414
418
|
this.isPending = false;
|
|
419
|
+
// translated texts
|
|
420
|
+
this.signInText = translate('Sign in');
|
|
421
|
+
this.resendCodeText = translate('Resend Code');
|
|
422
|
+
this.lostCodeText = translate('Lost your code? ');
|
|
423
|
+
this.confirmText = translate('Confirm');
|
|
415
424
|
}
|
|
416
425
|
ngOnInit() {
|
|
417
426
|
// TODO: alias for subscribe
|
|
@@ -436,7 +445,6 @@ class AmplifyConfirmSignUpComponent {
|
|
|
436
445
|
this.customComponents = this.contextService.customComponents;
|
|
437
446
|
}
|
|
438
447
|
ngOnDestroy() {
|
|
439
|
-
logger$3.log('confirm sign up destroyed, unsubscribing from state machine...');
|
|
440
448
|
this.authSubscription.unsubscribe();
|
|
441
449
|
}
|
|
442
450
|
onStateUpdate(state) {
|
|
@@ -484,7 +492,7 @@ class AmplifyConfirmSignUpComponent {
|
|
|
484
492
|
AmplifyConfirmSignUpComponent.decorators = [
|
|
485
493
|
{ type: Component, args: [{
|
|
486
494
|
selector: 'amplify-confirm-sign-up',
|
|
487
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmSignUpButton>\n <button data-amplify-button type=\"submit\">
|
|
495
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmSignUpButton>\n <button data-amplify-button type=\"submit\">{{ confirmText }}</button>\n</ng-template>\n\n<ng-template #confirmSignUpForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"username\"\n [initialValue]=\"username ? username : null\"\n [disabled]=\"!!username\"\n ></amplify-form-input>\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-input>\n\n <div data-amplify-resend>\n {{ lostCodeText }}\n <a data-amplify-link (click)=\"resend()\">{{ resendCodeText }}</a>\n </div>\n\n <div data-amplify-footer>\n <div>\n Back to{{ ' ' }}\n <a data-amplify-link (click)=\"toSignIn()\">{{ signInText }}</a>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmSignUpButton || confirmSignUpButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render confirm sign up component\n-->\n\n<div data-amplify-container>\n <h2 data-amplify-header>{{ headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.confirmSignUpForm || confirmSignUpForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
488
496
|
},] }
|
|
489
497
|
];
|
|
490
498
|
AmplifyConfirmSignUpComponent.ctorParameters = () => [
|
|
@@ -492,7 +500,8 @@ AmplifyConfirmSignUpComponent.ctorParameters = () => [
|
|
|
492
500
|
{ type: AuthPropService }
|
|
493
501
|
];
|
|
494
502
|
AmplifyConfirmSignUpComponent.propDecorators = {
|
|
495
|
-
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignup',] }]
|
|
503
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignup',] }],
|
|
504
|
+
headerText: [{ type: Input }]
|
|
496
505
|
};
|
|
497
506
|
|
|
498
507
|
class AmplifyUserNameAliasComponent {
|
|
@@ -501,19 +510,20 @@ class AmplifyUserNameAliasComponent {
|
|
|
501
510
|
this.name = 'username';
|
|
502
511
|
this.disabled = false;
|
|
503
512
|
this.initialValue = '';
|
|
513
|
+
this.required = true;
|
|
504
514
|
}
|
|
505
515
|
ngOnInit() {
|
|
506
516
|
const context = this.stateMachine.context;
|
|
507
517
|
const { label, type } = getAliasInfoFromContext(context);
|
|
508
518
|
this.label = label;
|
|
509
519
|
this.type = type;
|
|
510
|
-
this.placeholder =
|
|
520
|
+
this.placeholder = label;
|
|
511
521
|
}
|
|
512
522
|
}
|
|
513
523
|
AmplifyUserNameAliasComponent.decorators = [
|
|
514
524
|
{ type: Component, args: [{
|
|
515
525
|
selector: 'amplify-user-name-alias',
|
|
516
|
-
template: "<amplify-form-input\n data-amplify-usernamealias\n [name]=\"name\"\n [label]=\"label\"\n [type]=\"type\"\n [placeholder]=\"placeholder\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n autocomplete=\"username\"\n>\n</amplify-form-input>\n"
|
|
526
|
+
template: "<amplify-form-input\n data-amplify-usernamealias\n [name]=\"name\"\n [label]=\"label\"\n [type]=\"type\"\n [placeholder]=\"placeholder\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n autocomplete=\"username\"\n>\n</amplify-form-input>\n"
|
|
517
527
|
},] }
|
|
518
528
|
];
|
|
519
529
|
AmplifyUserNameAliasComponent.ctorParameters = () => [
|
|
@@ -522,7 +532,8 @@ AmplifyUserNameAliasComponent.ctorParameters = () => [
|
|
|
522
532
|
AmplifyUserNameAliasComponent.propDecorators = {
|
|
523
533
|
name: [{ type: Input }],
|
|
524
534
|
disabled: [{ type: Input }],
|
|
525
|
-
initialValue: [{ type: Input }]
|
|
535
|
+
initialValue: [{ type: Input }],
|
|
536
|
+
required: [{ type: Input }]
|
|
526
537
|
};
|
|
527
538
|
|
|
528
539
|
const logger$2 = new Logger('ConfirmSignIn');
|
|
@@ -534,7 +545,8 @@ class AmplifyConfirmSignInComponent {
|
|
|
534
545
|
this.customComponents = {};
|
|
535
546
|
this.remoteError = '';
|
|
536
547
|
this.isPending = false;
|
|
537
|
-
this.
|
|
548
|
+
this.confirmText = translate('Confirm');
|
|
549
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
538
550
|
}
|
|
539
551
|
ngOnInit() {
|
|
540
552
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => {
|
|
@@ -560,10 +572,10 @@ class AmplifyConfirmSignInComponent {
|
|
|
560
572
|
switch (challengeName) {
|
|
561
573
|
case AuthChallengeNames.SOFTWARE_TOKEN_MFA:
|
|
562
574
|
// TODO: this string should be centralized and translated from ui.
|
|
563
|
-
this.headerText = 'Confirm TOTP Code';
|
|
575
|
+
this.headerText = translate('Confirm TOTP Code');
|
|
564
576
|
break;
|
|
565
577
|
case AuthChallengeNames.SMS_MFA:
|
|
566
|
-
this.headerText = 'Confirm SMS Code';
|
|
578
|
+
this.headerText = translate('Confirm SMS Code');
|
|
567
579
|
break;
|
|
568
580
|
default:
|
|
569
581
|
logger$2.error('Unexpected challengeName', challengeName);
|
|
@@ -598,7 +610,7 @@ class AmplifyConfirmSignInComponent {
|
|
|
598
610
|
AmplifyConfirmSignInComponent.decorators = [
|
|
599
611
|
{ type: Component, args: [{
|
|
600
612
|
selector: 'amplify-confirm-sign-in',
|
|
601
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmSignInButton>\n <button data-amplify-button type=\"submit\">
|
|
613
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmSignInButton>\n <button data-amplify-button type=\"submit\">{{ confirmText }}</button>\n</ng-template>\n\n<ng-template #confirmSignInForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-input>\n\n <div data-amplify-footer>\n <button type=\"button\" (click)=\"toSignIn()\">\n {{ backToSignInText }}\n </button>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmSignInButton || confirmSignInButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n\n<div data-amplify-container>\n <h2 data-amplify-header>{{ headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || confirmSignInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
602
614
|
},] }
|
|
603
615
|
];
|
|
604
616
|
AmplifyConfirmSignInComponent.ctorParameters = () => [
|
|
@@ -617,8 +629,11 @@ class AmplifySetupTotpComponent {
|
|
|
617
629
|
this.customComponents = {};
|
|
618
630
|
this.remoteError = '';
|
|
619
631
|
this.isPending = false;
|
|
620
|
-
this.headerText = 'Setup TOTP';
|
|
632
|
+
this.headerText = translate('Setup TOTP');
|
|
621
633
|
this.qrCodeSource = '';
|
|
634
|
+
// translated texts
|
|
635
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
636
|
+
this.confirmText = translate('Confirm');
|
|
622
637
|
}
|
|
623
638
|
ngOnInit() {
|
|
624
639
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => {
|
|
@@ -647,7 +662,9 @@ class AmplifySetupTotpComponent {
|
|
|
647
662
|
var _a;
|
|
648
663
|
return __awaiter(this, void 0, void 0, function* () {
|
|
649
664
|
// TODO: This should be handled in core.
|
|
650
|
-
const
|
|
665
|
+
const state = this.stateMachine.authState;
|
|
666
|
+
const actorContext = getActorContext(state);
|
|
667
|
+
const { user } = actorContext;
|
|
651
668
|
try {
|
|
652
669
|
const secretKey = yield Auth.setupTOTP(user);
|
|
653
670
|
const issuer = 'AWSCognito';
|
|
@@ -678,11 +695,14 @@ class AmplifySetupTotpComponent {
|
|
|
678
695
|
data: Object.fromEntries(formData),
|
|
679
696
|
});
|
|
680
697
|
}
|
|
698
|
+
toSignIn() {
|
|
699
|
+
this.stateMachine.send('SIGN_IN');
|
|
700
|
+
}
|
|
681
701
|
}
|
|
682
702
|
AmplifySetupTotpComponent.decorators = [
|
|
683
703
|
{ type: Component, args: [{
|
|
684
704
|
selector: 'amplify-setup-totp',
|
|
685
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #setupTotpButton>\n <button data-amplify-button type=\"submit\">
|
|
705
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #setupTotpButton>\n <button data-amplify-button type=\"submit\">{{ confirmText }}</button>\n</ng-template>\n\n<ng-template #setupTotpForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img *ngIf=\"qrCodeSource\" [src]=\"qrCodeSource\" alt=\"qr code\" />\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-input>\n\n <div data-amplify-footer>\n <button (click)=\"toSignIn()\">{{ backToSignInText }}</button>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.setupTotpButton || setupTotpButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.setupTotpForm || setupTotpForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
686
706
|
},] }
|
|
687
707
|
];
|
|
688
708
|
AmplifySetupTotpComponent.ctorParameters = () => [
|
|
@@ -699,10 +719,13 @@ class AmplifyForceNewPasswordComponent {
|
|
|
699
719
|
this.stateMachine = stateMachine;
|
|
700
720
|
this.contextService = contextService;
|
|
701
721
|
this.dataAttr = '';
|
|
702
|
-
this.headerText = '
|
|
722
|
+
this.headerText = translate('Reset your password');
|
|
703
723
|
this.customComponents = {};
|
|
704
724
|
this.remoteError = '';
|
|
705
725
|
this.isPending = false;
|
|
726
|
+
// translated texts
|
|
727
|
+
this.changePasswordText = translate('Change Password');
|
|
728
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
706
729
|
}
|
|
707
730
|
ngOnInit() {
|
|
708
731
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -717,7 +740,11 @@ class AmplifyForceNewPasswordComponent {
|
|
|
717
740
|
onStateUpdate(state) {
|
|
718
741
|
const actorState = getActorState(state);
|
|
719
742
|
this.remoteError = actorState.context.remoteError;
|
|
720
|
-
this.isPending =
|
|
743
|
+
this.isPending = actorState.matches({
|
|
744
|
+
signUp: {
|
|
745
|
+
submission: 'idle',
|
|
746
|
+
},
|
|
747
|
+
});
|
|
721
748
|
}
|
|
722
749
|
get context() {
|
|
723
750
|
const { change, signIn, submit } = this.stateMachine.services;
|
|
@@ -751,7 +778,7 @@ class AmplifyForceNewPasswordComponent {
|
|
|
751
778
|
AmplifyForceNewPasswordComponent.decorators = [
|
|
752
779
|
{ type: Component, args: [{
|
|
753
780
|
selector: 'amplify-force-new-password',
|
|
754
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #forceNewPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">
|
|
781
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #forceNewPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">{{ changePasswordText }}</button>\n</ng-template>\n\n<ng-template #signInForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-input>\n\n <amplify-form-input\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-input>\n\n <div data-amplify-footer>\n <button type=\"button\" (click)=\"toSignIn()\">\n {{ backToSignInText }}\n </button>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.forceNewPasswordSubmitButton ||\n forceNewPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || signInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
755
782
|
},] }
|
|
756
783
|
];
|
|
757
784
|
AmplifyForceNewPasswordComponent.ctorParameters = () => [
|
|
@@ -771,6 +798,10 @@ class AmplifyFederatedSignInComponent {
|
|
|
771
798
|
this.includeGoogle = false;
|
|
772
799
|
this.includeAmazon = false;
|
|
773
800
|
this.shouldShowFederatedSignIn = false;
|
|
801
|
+
// translated texts
|
|
802
|
+
this.signInFacebookText = translate('Sign In with Facebook');
|
|
803
|
+
this.signInGoogleText = translate('Sign In with Google');
|
|
804
|
+
this.signInAmazonText = translate('Sign In with Amazon');
|
|
774
805
|
}
|
|
775
806
|
ngOnInit() {
|
|
776
807
|
var _a, _b;
|
|
@@ -785,7 +816,7 @@ class AmplifyFederatedSignInComponent {
|
|
|
785
816
|
AmplifyFederatedSignInComponent.decorators = [
|
|
786
817
|
{ type: Component, args: [{
|
|
787
818
|
selector: 'amplify-federated-sign-in',
|
|
788
|
-
template: "<div data-amplify-federated>\n <amplify-federated-sign-in-button\n *ngIf=\"includeFacebook\"\n text=\"
|
|
819
|
+
template: "<div data-amplify-federated>\n <amplify-federated-sign-in-button\n *ngIf=\"includeFacebook\"\n [text]=\"signInFacebookText\"\n [provider]=\"FederatedProviders.Facebook\"\n ></amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeGoogle\"\n [text]=\"signInGoogleText\"\n [provider]=\"FederatedProviders.Google\"\n ></amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeAmazon\"\n [text]=\"signInAmazonText\"\n [provider]=\"FederatedProviders.Amazon\"\n ></amplify-federated-sign-in-button>\n</div>\n"
|
|
789
820
|
},] }
|
|
790
821
|
];
|
|
791
822
|
AmplifyFederatedSignInComponent.ctorParameters = () => [
|
|
@@ -822,10 +853,13 @@ class AmplifyResetPasswordComponent {
|
|
|
822
853
|
this.stateMachine = stateMachine;
|
|
823
854
|
this.contextService = contextService;
|
|
824
855
|
this.dataAttr = '';
|
|
825
|
-
this.headerText = 'Reset your password';
|
|
856
|
+
this.headerText = translate('Reset your password');
|
|
826
857
|
this.customComponents = {};
|
|
827
858
|
this.remoteError = '';
|
|
828
859
|
this.isPending = false;
|
|
860
|
+
// translated texts
|
|
861
|
+
this.sendCodeText = translate('Send Code');
|
|
862
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
829
863
|
}
|
|
830
864
|
ngOnInit() {
|
|
831
865
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -865,7 +899,7 @@ class AmplifyResetPasswordComponent {
|
|
|
865
899
|
AmplifyResetPasswordComponent.decorators = [
|
|
866
900
|
{ type: Component, args: [{
|
|
867
901
|
selector: 'amplify-reset-password',
|
|
868
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #resetPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">
|
|
902
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #resetPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">{{ sendCodeText }}</button>\n</ng-template>\n\n<ng-template #resetPasswordFooter>\n <div data-amplify-footer>\n <button type=\"button\" (click)=\"toSignIn()\">{{ backToSignInText }}</button>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.resetPasswordSubmitButton || resetPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #resetPasswordForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"username\"\n type=\"username\"\n autocomplete=\"username\"\n ></amplify-form-input>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.resetPasswordFooter || resetPasswordFooter\n \"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render reset passsword component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.resetPasswordForm || resetPasswordForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
869
903
|
},] }
|
|
870
904
|
];
|
|
871
905
|
AmplifyResetPasswordComponent.ctorParameters = () => [
|
|
@@ -882,11 +916,14 @@ class AmplifyVerifyUserComponent {
|
|
|
882
916
|
this.stateMachine = stateMachine;
|
|
883
917
|
this.contextService = contextService;
|
|
884
918
|
this.dataAttr = '';
|
|
885
|
-
this.headerText = 'Account recovery requires verified contact information';
|
|
919
|
+
this.headerText = translate('Account recovery requires verified contact information');
|
|
886
920
|
this.customComponents = {};
|
|
887
921
|
this.unverifiedAttributes = {};
|
|
888
922
|
this.remoteError = '';
|
|
889
923
|
this.isPending = false;
|
|
924
|
+
// translated texts
|
|
925
|
+
this.skipText = translate('Skip');
|
|
926
|
+
this.verifyText = translate('Verify');
|
|
890
927
|
}
|
|
891
928
|
ngOnInit() {
|
|
892
929
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -911,6 +948,10 @@ class AmplifyVerifyUserComponent {
|
|
|
911
948
|
skipVerify() {
|
|
912
949
|
this.stateMachine.send('SKIP');
|
|
913
950
|
}
|
|
951
|
+
// enable translate to be used inside the template
|
|
952
|
+
translate(phrase) {
|
|
953
|
+
return translate(phrase);
|
|
954
|
+
}
|
|
914
955
|
onSubmit(event) {
|
|
915
956
|
return __awaiter(this, void 0, void 0, function* () {
|
|
916
957
|
event.preventDefault();
|
|
@@ -925,7 +966,7 @@ class AmplifyVerifyUserComponent {
|
|
|
925
966
|
AmplifyVerifyUserComponent.decorators = [
|
|
926
967
|
{ type: Component, args: [{
|
|
927
968
|
selector: 'amplify-verify-user',
|
|
928
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #verifyUserFooter>\n <div data-amplify-footer>\n <button data-amplify-button (click)=\"skipVerify()\">
|
|
969
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #verifyUserFooter>\n <div data-amplify-footer>\n <button data-amplify-button (click)=\"skipVerify()\">{{ skipText }}</button>\n <button data-amplify-button type=\"submit\">{{ verifyText }}</button>\n </div>\n</ng-template>\n\n<ng-template #verifyUserForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <ng-container\n *ngFor=\"let unverifiedAttribute of unverifiedAttributes | keyvalue\"\n >\n <input\n name=\"unverifiedAttr\"\n type=\"radio\"\n [value]=\"unverifiedAttribute.key\"\n />\n <span>{{ translate(unverifiedAttribute.key) }}</span>\n </ng-container>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.verifyUserFooter || verifyUserFooter\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render verify user component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.verifyUserForm || verifyUserForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n",
|
|
929
970
|
encapsulation: ViewEncapsulation.None
|
|
930
971
|
},] }
|
|
931
972
|
];
|
|
@@ -943,10 +984,15 @@ class ConfirmResetPasswordComponent {
|
|
|
943
984
|
this.stateMachine = stateMachine;
|
|
944
985
|
this.contextService = contextService;
|
|
945
986
|
this.dataAttr = '';
|
|
946
|
-
this.headerText = 'Reset your password';
|
|
987
|
+
this.headerText = translate('Reset your password');
|
|
947
988
|
this.customComponents = {};
|
|
948
989
|
this.remoteError = '';
|
|
949
990
|
this.isPending = false;
|
|
991
|
+
// translated strings
|
|
992
|
+
this.sendCodeText = translate('Send Code');
|
|
993
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
994
|
+
this.lostCodeText = translate('Lost your code? ');
|
|
995
|
+
this.resendCodeText = translate('Resend Code');
|
|
950
996
|
}
|
|
951
997
|
ngOnInit() {
|
|
952
998
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -991,7 +1037,7 @@ class ConfirmResetPasswordComponent {
|
|
|
991
1037
|
ConfirmResetPasswordComponent.decorators = [
|
|
992
1038
|
{ type: Component, args: [{
|
|
993
1039
|
selector: 'amplify-confirm-reset-password',
|
|
994
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmResetPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">
|
|
1040
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmResetPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">{{ sendCodeText }}</button>\n</ng-template>\n\n<ng-template #confirmResetPasswordFooter>\n <div data-amplify-footer>\n <div>\n <button type=\"button\" (click)=\"toSignIn()\">{{ backToSignInText }}</button>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPasswordSubmitButton ||\n confirmResetPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #confirmResetPasswordForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-input>\n <amplify-form-input\n name=\"password\"\n label=\"New password\"\n autocomplete=\"new-password\"\n ></amplify-form-input>\n\n <div data-amplify-resend>\n {{ lostCodeText }}\n <button type=\"button\" (click)=\"resend()\">{{ resendCodeText }}</button>\n </div>\n\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPasswordFooter ||\n confirmResetPasswordFooter\n \"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render confirm reset password component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPasswordForm || confirmResetPasswordForm\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
995
1041
|
},] }
|
|
996
1042
|
];
|
|
997
1043
|
ConfirmResetPasswordComponent.ctorParameters = () => [
|
|
@@ -1049,7 +1095,7 @@ class ConfirmVerifyUserComponent {
|
|
|
1049
1095
|
ConfirmVerifyUserComponent.decorators = [
|
|
1050
1096
|
{ type: Component, args: [{
|
|
1051
1097
|
selector: 'amplify-confirm-verify-user',
|
|
1052
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #verifyUserFooter>\n <div data-amplify-footer>\n <button data-amplify-button (click)=\"skipVerify()\">Skip</button>\n <button data-amplify-button type=\"submit\">Submit</button>\n </div>\n</ng-template>\n\n<ng-template #confirmVerifyUserForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n
|
|
1098
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #verifyUserFooter>\n <div data-amplify-footer>\n <button data-amplify-button (click)=\"skipVerify()\">Skip</button>\n <button data-amplify-button type=\"submit\">Submit</button>\n </div>\n</ng-template>\n\n<ng-template #confirmVerifyUserForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-input>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.verifyUserFooter || verifyUserFooter\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render confirm reset password component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmVerifyUserForm || confirmVerifyUserForm\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
1053
1099
|
},] }
|
|
1054
1100
|
];
|
|
1055
1101
|
ConfirmVerifyUserComponent.ctorParameters = () => [
|
|
@@ -1061,6 +1107,22 @@ ConfirmVerifyUserComponent.propDecorators = {
|
|
|
1061
1107
|
headerText: [{ type: Input }]
|
|
1062
1108
|
};
|
|
1063
1109
|
|
|
1110
|
+
class AmplifySelectComponent {
|
|
1111
|
+
}
|
|
1112
|
+
AmplifySelectComponent.decorators = [
|
|
1113
|
+
{ type: Component, args: [{
|
|
1114
|
+
selector: 'amplify-form-select',
|
|
1115
|
+
template: "<select [id]=\"id\" [name]=\"name\" [attr.aria-label]=\"label\">\n <option\n *ngFor=\"let item of items\"\n [value]=\"item\"\n [selected]=\"item === initialValue\"\n >\n {{ item }}\n </option>\n</select>\n"
|
|
1116
|
+
},] }
|
|
1117
|
+
];
|
|
1118
|
+
AmplifySelectComponent.propDecorators = {
|
|
1119
|
+
items: [{ type: Input }],
|
|
1120
|
+
name: [{ type: Input }],
|
|
1121
|
+
label: [{ type: Input }],
|
|
1122
|
+
id: [{ type: Input }],
|
|
1123
|
+
initialValue: [{ type: Input }]
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1064
1126
|
const proxyInputs = (Cmp, inputs) => {
|
|
1065
1127
|
const Prototype = Cmp.prototype;
|
|
1066
1128
|
inputs.forEach((item) => {
|
|
@@ -2875,7 +2937,6 @@ UiAngularModule.decorators = [
|
|
|
2875
2937
|
AmplifyPhotoPicker,
|
|
2876
2938
|
AmplifyAuthenticatorComponent,
|
|
2877
2939
|
AmplifySignInComponent,
|
|
2878
|
-
AmplifySignOutComponent,
|
|
2879
2940
|
AmplifySignUpComponent,
|
|
2880
2941
|
AmplifyInputComponent,
|
|
2881
2942
|
AmplifyErrorComponent,
|
|
@@ -2891,8 +2952,9 @@ UiAngularModule.decorators = [
|
|
|
2891
2952
|
AmplifyVerifyUserComponent,
|
|
2892
2953
|
ConfirmResetPasswordComponent,
|
|
2893
2954
|
ConfirmVerifyUserComponent,
|
|
2955
|
+
AmplifySelectComponent,
|
|
2894
2956
|
],
|
|
2895
|
-
imports: [CommonModule
|
|
2957
|
+
imports: [CommonModule],
|
|
2896
2958
|
exports: [
|
|
2897
2959
|
AmplifyChatbot,
|
|
2898
2960
|
AmplifyToast,
|
|
@@ -2907,7 +2969,6 @@ UiAngularModule.decorators = [
|
|
|
2907
2969
|
AmplifyPhotoPicker,
|
|
2908
2970
|
AmplifyAuthenticatorComponent,
|
|
2909
2971
|
AmplifySignInComponent,
|
|
2910
|
-
AmplifySignOutComponent,
|
|
2911
2972
|
AmplifyInputComponent,
|
|
2912
2973
|
AmplifyErrorComponent,
|
|
2913
2974
|
AmplifyOverrideDirective,
|
|
@@ -2924,5 +2985,5 @@ UiAngularModule.decorators = [
|
|
|
2924
2985
|
* Generated bundle index. Do not edit.
|
|
2925
2986
|
*/
|
|
2926
2987
|
|
|
2927
|
-
export { AmplifyAuthenticatorComponent, AmplifyButton, AmplifyChatbot, AmplifyConfirmSignUpComponent, AmplifyErrorComponent, AmplifyInput, AmplifyInputComponent, AmplifyOverrideDirective, AmplifyPhotoPicker, AmplifyPicker, AmplifyS3Album, AmplifyS3Image, AmplifyS3ImagePicker, AmplifyS3Text, AmplifyS3TextPicker,
|
|
2988
|
+
export { AmplifyAuthenticatorComponent, AmplifyButton, AmplifyChatbot, AmplifyConfirmSignInComponent, AmplifyConfirmSignUpComponent, AmplifyErrorComponent, AmplifyFederatedSignInButtonComponent, AmplifyFederatedSignInComponent, AmplifyForceNewPasswordComponent, AmplifyInput, AmplifyInputComponent, AmplifyOverrideDirective, AmplifyPhotoPicker, AmplifyPicker, AmplifyResetPasswordComponent, AmplifyS3Album, AmplifyS3Image, AmplifyS3ImagePicker, AmplifyS3Text, AmplifyS3TextPicker, AmplifySetupTotpComponent, AmplifySignInComponent, AmplifySignUpComponent, AmplifyToast, AmplifyVerifyUserComponent, AuthPropService, ConfirmResetPasswordComponent, ConfirmVerifyUserComponent, StateMachineService, UiAngularModule, getAttributeMap, ProxyCmp as ɵa, AmplifyAuthenticatorComponent as ɵb, AmplifySignInComponent as ɵc, AmplifySignUpComponent as ɵd, AmplifyInputComponent as ɵe, AmplifyErrorComponent as ɵf, AmplifyConfirmSignUpComponent as ɵg, AmplifyUserNameAliasComponent as ɵh, AmplifyConfirmSignInComponent as ɵi, AmplifySetupTotpComponent as ɵj, AmplifyForceNewPasswordComponent as ɵk, AmplifyFederatedSignInComponent as ɵl, AmplifyFederatedSignInButtonComponent as ɵm, AmplifyResetPasswordComponent as ɵn, AmplifyVerifyUserComponent as ɵo, ConfirmResetPasswordComponent as ɵp, ConfirmVerifyUserComponent as ɵq, AmplifySelectComponent as ɵr };
|
|
2928
2989
|
//# sourceMappingURL=aws-amplify-ui-angular.js.map
|