@aws-amplify/ui-angular 2.0.1-next.2 → 2.0.1-next.6
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 +21 -15
- package/aws-amplify-ui-angular.metadata.json +1 -1
- package/bundles/aws-amplify-ui-angular.umd.js +1233 -932
- 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 +22 -16
- package/esm2015/index.js +3 -3
- package/esm2015/lib/components/amplify-authenticator/amplify-authenticator.component.js +33 -14
- 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 +11 -25
- package/esm2015/lib/components/amplify-federated-sign-in/amplify-federated-sign-in.component.js +9 -4
- package/esm2015/lib/components/amplify-federated-sign-in-button/amplify-federated-sign-in-button.component.js +2 -2
- 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 +8 -6
- package/esm2015/lib/components/amplify-sign-up/amplify-sign-up.component.js +16 -6
- package/esm2015/lib/components/amplify-verify-user/amplify-verify-user.component.js +16 -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 +7 -4
- package/esm2015/lib/components/index.js +14 -6
- package/esm2015/lib/directives/amplify-slot.directive.js +21 -0
- package/esm2015/lib/primitives/amplify-button/amplify-button.component.js +38 -0
- package/esm2015/lib/primitives/amplify-error/amplify-error.component.js +2 -2
- package/esm2015/lib/primitives/amplify-form-field/amplify-form-field.component.js +91 -0
- package/esm2015/lib/primitives/amplify-password-field/amplify-password-field.component.js +39 -0
- package/esm2015/lib/primitives/amplify-select/amplify-select.component.js +17 -0
- package/esm2015/lib/primitives/amplify-text-field/amplify-text-field.component.js +29 -0
- package/esm2015/lib/primitives/amplify-user-name-alias/amplify-user-name-alias.component.js +6 -4
- package/esm2015/lib/primitives/index.js +2 -2
- package/esm2015/lib/primitives/phone-number-field/phone-number-field.component.js +33 -0
- package/esm2015/lib/primitives/tab-item/tab-item.component.js +20 -0
- package/esm2015/lib/primitives/tabs/tabs.component.js +45 -0
- package/esm2015/lib/services/state-machine.service.js +12 -7
- package/esm2015/lib/ui-angular.module.js +30 -20
- package/fesm2015/aws-amplify-ui-angular.js +722 -441
- package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
- package/index.d.ts +2 -2
- package/lib/components/amplify-authenticator/amplify-authenticator.component.d.ts +11 -7
- 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 +4 -2
- 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 +3 -1
- package/lib/components/amplify-sign-up/amplify-sign-up.component.d.ts +1 -1
- package/lib/components/amplify-verify-user/amplify-verify-user.component.d.ts +5 -1
- package/lib/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +4 -0
- package/lib/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +2 -0
- package/lib/components/index.d.ts +13 -5
- package/lib/directives/{amplify-override.directive.d.ts → amplify-slot.directive.d.ts} +2 -2
- package/lib/primitives/amplify-button/amplify-button.component.d.ts +15 -0
- package/lib/primitives/amplify-form-field/amplify-form-field.component.d.ts +34 -0
- package/lib/primitives/amplify-password-field/amplify-password-field.component.d.ts +14 -0
- package/lib/primitives/amplify-select/amplify-select.component.d.ts +7 -0
- package/lib/primitives/amplify-text-field/amplify-text-field.component.d.ts +11 -0
- package/lib/primitives/amplify-user-name-alias/amplify-user-name-alias.component.d.ts +1 -0
- package/lib/primitives/index.d.ts +1 -1
- package/lib/primitives/phone-number-field/phone-number-field.component.d.ts +14 -0
- package/lib/primitives/tab-item/tab-item.component.d.ts +7 -0
- package/lib/primitives/tabs/tabs.component.d.ts +9 -0
- package/lib/services/state-machine.service.d.ts +2 -2
- package/package.json +4 -3
- package/styles/component.css +169 -0
- package/theme.css +2 -99
- package/esm2015/lib/components/amplify-sign-out/amplify-sign-out.component.js +0 -28
- package/esm2015/lib/directives/amplify-override.directive.js +0 -21
- package/esm2015/lib/primitives/amplify-input/amplify-input.component.js +0 -61
- package/lib/components/amplify-sign-out/amplify-sign-out.component.d.ts +0 -6
- package/lib/primitives/amplify-input/amplify-input.component.d.ts +0 -23
|
@@ -1,49 +1,82 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, HostBinding,
|
|
2
|
+
import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, ContentChildren, HostBinding, EventEmitter, Output, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef, NgZone, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { createAuthenticatorMachine, getSendEventAliases, translate, translations, getActorState, getActorContext, AuthChallengeNames, FederatedIdentityProviders, getConfiguredAliases, authInputAttributes, countryDialCodes, getAliasInfoFromContext } from '@aws-amplify/ui';
|
|
5
|
+
import { I18n, Logger, Auth } from 'aws-amplify';
|
|
6
6
|
import { interpret } from 'xstate';
|
|
7
7
|
import { __awaiter, __decorate } from 'tslib';
|
|
8
|
-
import { Logger, Auth } from 'aws-amplify';
|
|
9
8
|
import QRCode from 'qrcode';
|
|
9
|
+
import { isEmpty } from 'lodash';
|
|
10
|
+
import { nanoid } from 'nanoid';
|
|
10
11
|
import { fromEvent } from 'rxjs';
|
|
11
12
|
import { AmplifyButton as AmplifyButton$1, AmplifyInput as AmplifyInput$1, AmplifyToast as AmplifyToast$1, AmplifyChatbot as AmplifyChatbot$1, AmplifyS3Album as AmplifyS3Album$1, AmplifyS3ImagePicker as AmplifyS3ImagePicker$1, AmplifyS3Text as AmplifyS3Text$1, AmplifyS3TextPicker as AmplifyS3TextPicker$1, AmplifyS3Image as AmplifyS3Image$1, AmplifyPicker as AmplifyPicker$1, AmplifyPhotoPicker as AmplifyPhotoPicker$1 } from '@aws-amplify/ui-components/dist/components';
|
|
12
13
|
|
|
13
|
-
class
|
|
14
|
+
class AmplifySlotDirective {
|
|
14
15
|
constructor(template) {
|
|
15
16
|
this.template = template;
|
|
16
17
|
}
|
|
17
|
-
set
|
|
18
|
+
set amplifySlot(component) {
|
|
18
19
|
this.name = component;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
AmplifySlotDirective.decorators = [
|
|
22
23
|
{ type: Directive, args: [{
|
|
23
|
-
selector: '[
|
|
24
|
+
selector: '[amplifySlot]',
|
|
24
25
|
},] }
|
|
25
26
|
];
|
|
26
|
-
|
|
27
|
+
AmplifySlotDirective.ctorParameters = () => [
|
|
27
28
|
{ type: TemplateRef }
|
|
28
29
|
];
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
AmplifySlotDirective.propDecorators = {
|
|
31
|
+
amplifySlot: [{ type: Input }]
|
|
31
32
|
};
|
|
32
33
|
|
|
34
|
+
class AuthPropService {
|
|
35
|
+
constructor() {
|
|
36
|
+
this._customComponents = {};
|
|
37
|
+
this._props = {};
|
|
38
|
+
}
|
|
39
|
+
get customComponents() {
|
|
40
|
+
return this._customComponents;
|
|
41
|
+
}
|
|
42
|
+
set customComponents(customComponents) {
|
|
43
|
+
this._customComponents = Object.assign(Object.assign({}, this._customComponents), customComponents);
|
|
44
|
+
}
|
|
45
|
+
get props() {
|
|
46
|
+
return this._props;
|
|
47
|
+
}
|
|
48
|
+
set props(props) {
|
|
49
|
+
this._props = Object.assign(Object.assign({}, this._props), props);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
AuthPropService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AuthPropService_Factory() { return new AuthPropService(); }, token: AuthPropService, providedIn: "root" });
|
|
53
|
+
AuthPropService.decorators = [
|
|
54
|
+
{ type: Injectable, args: [{
|
|
55
|
+
providedIn: 'root',
|
|
56
|
+
},] }
|
|
57
|
+
];
|
|
58
|
+
AuthPropService.ctorParameters = () => [];
|
|
59
|
+
|
|
33
60
|
/**
|
|
34
61
|
* AmplifyContextService contains access to the xstate machine
|
|
35
62
|
* and custom components passed by the user.
|
|
36
63
|
*/
|
|
37
64
|
class StateMachineService {
|
|
38
|
-
|
|
39
|
-
const
|
|
65
|
+
startMachine({ initialState, loginMechanisms, }) {
|
|
66
|
+
const machine = createAuthenticatorMachine({
|
|
67
|
+
initialState,
|
|
68
|
+
loginMechanisms,
|
|
69
|
+
});
|
|
70
|
+
const authService = interpret(machine, {
|
|
71
|
+
devTools: process.env.NODE_ENV === 'development',
|
|
72
|
+
})
|
|
40
73
|
.onTransition((state) => {
|
|
41
74
|
this._user = state.context.user;
|
|
42
75
|
this._authState = state;
|
|
43
76
|
})
|
|
44
77
|
.start();
|
|
45
|
-
this._services = getSendEventAliases(
|
|
46
|
-
this._authService =
|
|
78
|
+
this._services = getSendEventAliases(authService.send);
|
|
79
|
+
this._authService = authService;
|
|
47
80
|
}
|
|
48
81
|
get services() {
|
|
49
82
|
return this._services;
|
|
@@ -70,45 +103,27 @@ StateMachineService.decorators = [
|
|
|
70
103
|
providedIn: 'root',
|
|
71
104
|
},] }
|
|
72
105
|
];
|
|
73
|
-
StateMachineService.ctorParameters = () => [];
|
|
74
|
-
|
|
75
|
-
class AuthPropService {
|
|
76
|
-
constructor() {
|
|
77
|
-
this._customComponents = {};
|
|
78
|
-
this._props = {};
|
|
79
|
-
}
|
|
80
|
-
get customComponents() {
|
|
81
|
-
return this._customComponents;
|
|
82
|
-
}
|
|
83
|
-
set customComponents(customComponents) {
|
|
84
|
-
this._customComponents = Object.assign(Object.assign({}, this._customComponents), customComponents);
|
|
85
|
-
}
|
|
86
|
-
get props() {
|
|
87
|
-
return this._props;
|
|
88
|
-
}
|
|
89
|
-
set props(props) {
|
|
90
|
-
this._props = Object.assign(Object.assign({}, this._props), props);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
AuthPropService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AuthPropService_Factory() { return new AuthPropService(); }, token: AuthPropService, providedIn: "root" });
|
|
94
|
-
AuthPropService.decorators = [
|
|
95
|
-
{ type: Injectable, args: [{
|
|
96
|
-
providedIn: 'root',
|
|
97
|
-
},] }
|
|
98
|
-
];
|
|
99
|
-
AuthPropService.ctorParameters = () => [];
|
|
100
106
|
|
|
101
107
|
class AmplifyAuthenticatorComponent {
|
|
102
108
|
constructor(stateMachine, contextService) {
|
|
103
109
|
this.stateMachine = stateMachine;
|
|
104
110
|
this.contextService = contextService;
|
|
105
|
-
/**
|
|
106
|
-
* TODO: Add back custom events
|
|
107
|
-
*/
|
|
108
|
-
this.initialAuthState = 'signIn';
|
|
109
|
-
this.dataAttr = '';
|
|
110
111
|
this.customComponentQuery = null;
|
|
111
112
|
this.customComponents = {};
|
|
113
|
+
// translated texts
|
|
114
|
+
this.signInTitle = translate('Sign In');
|
|
115
|
+
this.signUpTitle = translate('Create Account');
|
|
116
|
+
}
|
|
117
|
+
ngOnInit() {
|
|
118
|
+
I18n.putVocabularies(translations);
|
|
119
|
+
const { initialState, loginMechanisms } = this;
|
|
120
|
+
this.stateMachine.startMachine({ initialState, loginMechanisms });
|
|
121
|
+
/**
|
|
122
|
+
* handling translations after content init, because authenticator and its
|
|
123
|
+
* translations might be initialized before the main app's `ngOnInit` is run.
|
|
124
|
+
**/
|
|
125
|
+
this.signInTitle = translate('Sign In');
|
|
126
|
+
this.signUpTitle = translate('Create Account');
|
|
112
127
|
}
|
|
113
128
|
/**
|
|
114
129
|
* Lifecycle Methods
|
|
@@ -131,6 +146,15 @@ class AmplifyAuthenticatorComponent {
|
|
|
131
146
|
get authenticatorState() {
|
|
132
147
|
return this.stateMachine.authState;
|
|
133
148
|
}
|
|
149
|
+
onTabChange() {
|
|
150
|
+
const currentState = this.stateMachine.authState.value;
|
|
151
|
+
if (currentState === 'signIn') {
|
|
152
|
+
this.stateMachine.send('SIGN_UP');
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.stateMachine.send('SIGN_IN');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
134
158
|
mapCustomComponents(componentQuery) {
|
|
135
159
|
if (!componentQuery)
|
|
136
160
|
return {};
|
|
@@ -144,7 +168,7 @@ class AmplifyAuthenticatorComponent {
|
|
|
144
168
|
AmplifyAuthenticatorComponent.decorators = [
|
|
145
169
|
{ type: Component, args: [{
|
|
146
170
|
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
|
|
171
|
+
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<div data-amplify-authenticator>\n <div data-amplify-modal></div>\n\n <div data-amplify-container>\n <amplify-tabs\n (tabChange)=\"onTabChange()\"\n *ngIf=\"actorState?.matches('signIn') || actorState?.matches('signUp')\"\n >\n <amplify-tab-item\n [title]=\"signInTitle\"\n [active]=\"actorState?.matches('signIn')\"\n >\n <!-- signIn component -->\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signIn || signIn\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('signIn')\"\n ></ng-container>\n </amplify-tab-item>\n <amplify-tab-item\n [title]=\"signUpTitle\"\n [active]=\"actorState?.matches('signUp')\"\n >\n <!-- signUp component -->\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signUp || signUp\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('signUp')\"\n ></ng-container>\n </amplify-tab-item>\n </amplify-tabs>\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]=\"\n customComponents.confirmVerifyUser || confirmVerifyUser\n \"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmVerifyUser')\"\n >\n </ng-container>\n </div>\n</div>\n\n<!-- signedIn content is rendered outside authenticator so it's not styled by authenticator -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.authenticated || authenticated\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"authenticatorState.matches('authenticated')\"\n>\n</ng-container>\n",
|
|
148
172
|
providers: [AuthPropService],
|
|
149
173
|
encapsulation: ViewEncapsulation.None
|
|
150
174
|
},] }
|
|
@@ -154,47 +178,60 @@ AmplifyAuthenticatorComponent.ctorParameters = () => [
|
|
|
154
178
|
{ type: AuthPropService }
|
|
155
179
|
];
|
|
156
180
|
AmplifyAuthenticatorComponent.propDecorators = {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
customComponentQuery: [{ type: ContentChildren, args: [
|
|
181
|
+
initialState: [{ type: Input }],
|
|
182
|
+
loginMechanisms: [{ type: Input }],
|
|
183
|
+
customComponentQuery: [{ type: ContentChildren, args: [AmplifySlotDirective,] }]
|
|
160
184
|
};
|
|
161
185
|
|
|
162
|
-
const logger$
|
|
163
|
-
class
|
|
186
|
+
const logger$3 = new Logger('ConfirmSignIn');
|
|
187
|
+
class AmplifyConfirmSignInComponent {
|
|
164
188
|
constructor(stateMachine, contextService) {
|
|
165
189
|
this.stateMachine = stateMachine;
|
|
166
190
|
this.contextService = contextService;
|
|
167
191
|
this.dataAttr = '';
|
|
168
|
-
this.headerText = 'Sign in to your account';
|
|
169
192
|
this.customComponents = {};
|
|
170
193
|
this.remoteError = '';
|
|
171
194
|
this.isPending = false;
|
|
195
|
+
this.confirmText = translate('Confirm');
|
|
196
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
172
197
|
}
|
|
173
198
|
ngOnInit() {
|
|
174
|
-
this.authSubscription = this.stateMachine.authService.subscribe((state) =>
|
|
199
|
+
this.authSubscription = this.stateMachine.authService.subscribe((state) => {
|
|
200
|
+
this.onStateUpdate(state);
|
|
201
|
+
});
|
|
202
|
+
this.setHeaderText();
|
|
175
203
|
}
|
|
176
204
|
ngAfterContentInit() {
|
|
177
205
|
this.customComponents = this.contextService.customComponents;
|
|
178
206
|
}
|
|
179
207
|
ngOnDestroy() {
|
|
180
|
-
logger$4.log('sign in destroyed, unsubscribing from state machine...');
|
|
181
208
|
this.authSubscription.unsubscribe();
|
|
182
209
|
}
|
|
183
|
-
onStateUpdate(state) {
|
|
184
|
-
const actorState = getActorState(state);
|
|
185
|
-
this.remoteError = actorState.context.remoteError;
|
|
186
|
-
this.isPending = !actorState.matches('signIn.edit');
|
|
187
|
-
}
|
|
188
210
|
get context() {
|
|
189
|
-
const { change,
|
|
211
|
+
const { change, signIn, submit } = this.stateMachine.services;
|
|
190
212
|
const remoteError = this.remoteError;
|
|
191
|
-
return { change, remoteError,
|
|
213
|
+
return { change, remoteError, signIn, submit };
|
|
192
214
|
}
|
|
193
|
-
|
|
194
|
-
this.stateMachine.
|
|
215
|
+
setHeaderText() {
|
|
216
|
+
const state = this.stateMachine.authState;
|
|
217
|
+
const actorContext = getActorContext(state);
|
|
218
|
+
const { challengeName } = actorContext;
|
|
219
|
+
switch (challengeName) {
|
|
220
|
+
case AuthChallengeNames.SOFTWARE_TOKEN_MFA:
|
|
221
|
+
// TODO: this string should be centralized and translated from ui.
|
|
222
|
+
this.headerText = translate('Confirm TOTP Code');
|
|
223
|
+
break;
|
|
224
|
+
case AuthChallengeNames.SMS_MFA:
|
|
225
|
+
this.headerText = translate('Confirm SMS Code');
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
logger$3.error('Unexpected challengeName', challengeName);
|
|
229
|
+
}
|
|
195
230
|
}
|
|
196
|
-
|
|
197
|
-
|
|
231
|
+
onStateUpdate(state) {
|
|
232
|
+
const actorState = getActorState(state);
|
|
233
|
+
this.remoteError = actorState.context.remoteError;
|
|
234
|
+
this.isPending = !actorState.matches('confirmSignIn.edit');
|
|
198
235
|
}
|
|
199
236
|
onInput(event) {
|
|
200
237
|
event.preventDefault();
|
|
@@ -205,85 +242,49 @@ class AmplifySignInComponent {
|
|
|
205
242
|
});
|
|
206
243
|
}
|
|
207
244
|
onSubmit(event) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
245
|
+
event.preventDefault();
|
|
246
|
+
// TODO: handle form data within the state machine
|
|
247
|
+
const formData = new FormData(event.target);
|
|
248
|
+
this.stateMachine.send({
|
|
249
|
+
type: 'SUBMIT',
|
|
250
|
+
data: Object.fromEntries(formData),
|
|
213
251
|
});
|
|
214
252
|
}
|
|
253
|
+
toSignIn() {
|
|
254
|
+
this.stateMachine.send('SIGN_IN');
|
|
255
|
+
}
|
|
215
256
|
}
|
|
216
|
-
|
|
257
|
+
AmplifyConfirmSignInComponent.decorators = [
|
|
217
258
|
{ type: Component, args: [{
|
|
218
|
-
selector: 'amplify-sign-in',
|
|
219
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #
|
|
220
|
-
encapsulation: ViewEncapsulation.None
|
|
259
|
+
selector: 'amplify-confirm-sign-in',
|
|
260
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmSignInButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n</ng-template>\n\n<ng-template #confirmSignInForm>\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]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmSignInButton || confirmSignInButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n\n<div data-amplify-container>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || confirmSignInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
221
261
|
},] }
|
|
222
262
|
];
|
|
223
|
-
|
|
263
|
+
AmplifyConfirmSignInComponent.ctorParameters = () => [
|
|
224
264
|
{ type: StateMachineService },
|
|
225
265
|
{ type: AuthPropService }
|
|
226
266
|
];
|
|
227
|
-
|
|
228
|
-
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-
|
|
229
|
-
headerText: [{ type: Input }]
|
|
267
|
+
AmplifyConfirmSignInComponent.propDecorators = {
|
|
268
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignin',] }]
|
|
230
269
|
};
|
|
231
270
|
|
|
232
|
-
class
|
|
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
|
-
class AmplifySignUpComponent {
|
|
271
|
+
class AmplifyConfirmSignUpComponent {
|
|
258
272
|
constructor(stateMachine, contextService) {
|
|
259
273
|
this.stateMachine = stateMachine;
|
|
260
274
|
this.contextService = contextService;
|
|
261
275
|
this.dataAttr = '';
|
|
262
|
-
this.headerText = '
|
|
276
|
+
this.headerText = translate('Confirm Sign Up');
|
|
277
|
+
this.customComponents = {};
|
|
263
278
|
this.remoteError = '';
|
|
264
279
|
this.isPending = false;
|
|
265
|
-
|
|
266
|
-
this.
|
|
267
|
-
this.
|
|
268
|
-
|
|
269
|
-
get context() {
|
|
270
|
-
const { change, signIn, submit } = this.stateMachine.services;
|
|
271
|
-
const remoteError = this.remoteError;
|
|
272
|
-
const validationError = this.validationError;
|
|
273
|
-
return {
|
|
274
|
-
change,
|
|
275
|
-
remoteError,
|
|
276
|
-
signIn,
|
|
277
|
-
submit,
|
|
278
|
-
validationError,
|
|
279
|
-
};
|
|
280
|
+
// translated texts
|
|
281
|
+
this.resendCodeText = translate('Resend Code');
|
|
282
|
+
this.lostCodeText = translate('Lost your code? ');
|
|
283
|
+
this.confirmText = translate('Confirm');
|
|
280
284
|
}
|
|
281
285
|
ngOnInit() {
|
|
286
|
+
// TODO: alias for subscribe
|
|
282
287
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
283
|
-
const context = this.stateMachine.context;
|
|
284
|
-
const { primaryAlias, secondaryAliases } = getConfiguredAliases(context);
|
|
285
|
-
this.primaryAlias = primaryAlias;
|
|
286
|
-
this.secondaryAliases = secondaryAliases;
|
|
287
288
|
}
|
|
288
289
|
ngAfterContentInit() {
|
|
289
290
|
this.customComponents = this.contextService.customComponents;
|
|
@@ -293,177 +294,161 @@ class AmplifySignUpComponent {
|
|
|
293
294
|
}
|
|
294
295
|
onStateUpdate(state) {
|
|
295
296
|
const actorState = getActorState(state);
|
|
296
|
-
|
|
297
|
-
this.
|
|
298
|
-
this.validationError = actorContext.validationError;
|
|
299
|
-
this.isPending = !actorState.matches({
|
|
300
|
-
signUp: {
|
|
301
|
-
submission: 'idle',
|
|
302
|
-
},
|
|
303
|
-
});
|
|
297
|
+
this.remoteError = actorState.context.remoteError;
|
|
298
|
+
this.isPending = !actorState.matches('confirmSignUp.edit');
|
|
304
299
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
300
|
+
get context() {
|
|
301
|
+
const { change, resend, signIn, submit } = this.stateMachine.services;
|
|
302
|
+
const remoteError = this.remoteError;
|
|
303
|
+
const username = this.username;
|
|
304
|
+
return { change, remoteError, resend, signIn, submit, username };
|
|
305
|
+
}
|
|
306
|
+
resend() {
|
|
307
|
+
this.stateMachine.send({
|
|
308
|
+
type: 'RESEND',
|
|
309
|
+
data: {
|
|
310
|
+
username: this.username,
|
|
311
|
+
},
|
|
309
312
|
});
|
|
310
313
|
}
|
|
311
|
-
onInput(event) {
|
|
312
|
-
event.preventDefault();
|
|
313
|
-
const { name, value } = event.target;
|
|
314
|
+
onInput($event) {
|
|
315
|
+
$event.preventDefault();
|
|
316
|
+
const { name, value } = $event.target;
|
|
314
317
|
this.stateMachine.send({
|
|
315
318
|
type: 'CHANGE',
|
|
316
319
|
data: { name, value },
|
|
317
320
|
});
|
|
318
321
|
}
|
|
319
|
-
|
|
320
|
-
|
|
322
|
+
onSubmit(event) {
|
|
323
|
+
event.preventDefault();
|
|
324
|
+
const state = this.stateMachine.authState;
|
|
325
|
+
const actorContext = getActorContext(state);
|
|
326
|
+
const { formValues } = actorContext;
|
|
327
|
+
const { username, confirmation_code } = formValues;
|
|
328
|
+
this.stateMachine.send({
|
|
329
|
+
type: 'SUBMIT',
|
|
330
|
+
data: { username, confirmation_code },
|
|
331
|
+
});
|
|
321
332
|
}
|
|
322
333
|
}
|
|
323
|
-
|
|
334
|
+
AmplifyConfirmSignUpComponent.decorators = [
|
|
324
335
|
{ type: Component, args: [{
|
|
325
|
-
selector: 'amplify-sign-up',
|
|
326
|
-
template: "
|
|
336
|
+
selector: 'amplify-confirm-sign-up',
|
|
337
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmSignUpButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n</ng-template>\n\n<ng-template #confirmSignUpForm>\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]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmSignUpButton || confirmSignUpButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n <button amplify-button fontWeight=\"normal\" (click)=\"resend()\">\n {{ resendCodeText }}\n </button>\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 <ng-container\n [ngTemplateOutlet]=\"customComponents.confirmSignUpForm || confirmSignUpForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
327
338
|
},] }
|
|
328
339
|
];
|
|
329
|
-
|
|
340
|
+
AmplifyConfirmSignUpComponent.ctorParameters = () => [
|
|
330
341
|
{ type: StateMachineService },
|
|
331
342
|
{ type: AuthPropService }
|
|
332
343
|
];
|
|
333
|
-
|
|
334
|
-
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-
|
|
344
|
+
AmplifyConfirmSignUpComponent.propDecorators = {
|
|
345
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignup',] }],
|
|
335
346
|
headerText: [{ type: Input }]
|
|
336
347
|
};
|
|
337
348
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Contains an input element and its label. Intended to be used with
|
|
342
|
-
* Angular Reactive Form
|
|
343
|
-
*/
|
|
344
|
-
class AmplifyInputComponent {
|
|
349
|
+
class AmplifyFederatedSignInButtonComponent {
|
|
345
350
|
constructor(stateMachine) {
|
|
346
351
|
this.stateMachine = stateMachine;
|
|
347
|
-
this.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
get attributeMap() {
|
|
355
|
-
return getAttributeMap();
|
|
356
|
-
}
|
|
357
|
-
get error() {
|
|
358
|
-
const formContext = getActorContext(this.stateMachine.authState);
|
|
359
|
-
const { validationError } = formContext;
|
|
360
|
-
return validationError[this.name];
|
|
361
|
-
}
|
|
362
|
-
inferLabel() {
|
|
363
|
-
var _a;
|
|
364
|
-
return this.label || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.label);
|
|
365
|
-
}
|
|
366
|
-
inferPlaceholder() {
|
|
367
|
-
var _a;
|
|
368
|
-
return (this.placeholder || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.placeholder) ||
|
|
369
|
-
this.inferLabel());
|
|
352
|
+
this.onClick = () => {
|
|
353
|
+
this.stateMachine.send({
|
|
354
|
+
type: 'FEDERATED_SIGN_IN',
|
|
355
|
+
data: { provider: this.provider },
|
|
356
|
+
});
|
|
357
|
+
};
|
|
370
358
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
359
|
+
}
|
|
360
|
+
AmplifyFederatedSignInButtonComponent.decorators = [
|
|
361
|
+
{ type: Component, args: [{
|
|
362
|
+
selector: 'amplify-federated-sign-in-button',
|
|
363
|
+
template: "<button\n amplify-button\n class=\"amplify-field-group__control federated-sign-in-button\"\n fullWidth=\"true\"\n fontWeight=\"normal\"\n style=\"display: block\"\n (click)=\"onClick()\"\n>\n <div\n class=\"amplify-flex federated-sign-in-button-row\"\n style=\"flex-direction: row; justify-content: center\"\n >\n <ng-content></ng-content>\n </div>\n</button>\n"
|
|
364
|
+
},] }
|
|
365
|
+
];
|
|
366
|
+
AmplifyFederatedSignInButtonComponent.ctorParameters = () => [
|
|
367
|
+
{ type: StateMachineService }
|
|
368
|
+
];
|
|
369
|
+
AmplifyFederatedSignInButtonComponent.propDecorators = {
|
|
370
|
+
provider: [{ type: Input }],
|
|
371
|
+
text: [{ type: Input }]
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
class AmplifyFederatedSignInComponent {
|
|
375
|
+
constructor(stateMachine) {
|
|
376
|
+
this.stateMachine = stateMachine;
|
|
377
|
+
this.FederatedProviders = FederatedIdentityProviders;
|
|
378
|
+
this.includeFacebook = false;
|
|
379
|
+
this.includeGoogle = false;
|
|
380
|
+
this.includeAmazon = false;
|
|
381
|
+
this.shouldShowFederatedSignIn = false;
|
|
382
|
+
// translated texts
|
|
383
|
+
this.signInFacebookText = translate('Sign In with Facebook');
|
|
384
|
+
this.signInGoogleText = translate('Sign In with Google');
|
|
385
|
+
this.signInAmazonText = translate('Sign In with Amazon');
|
|
386
|
+
}
|
|
387
|
+
ngOnInit() {
|
|
388
|
+
var _a, _b;
|
|
389
|
+
const loginMechanisms = (_b = (_a = this.stateMachine.context) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.login_mechanisms;
|
|
390
|
+
this.includeFacebook = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('facebook');
|
|
391
|
+
this.includeGoogle = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('google');
|
|
392
|
+
this.includeAmazon = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('amazon');
|
|
393
|
+
this.shouldShowFederatedSignIn =
|
|
394
|
+
this.includeFacebook || this.includeGoogle || this.includeAmazon;
|
|
375
395
|
}
|
|
376
396
|
}
|
|
377
|
-
|
|
397
|
+
AmplifyFederatedSignInComponent.decorators = [
|
|
378
398
|
{ type: Component, args: [{
|
|
379
|
-
selector: 'amplify-
|
|
380
|
-
template: "<
|
|
399
|
+
selector: 'amplify-federated-sign-in',
|
|
400
|
+
template: "<div\n class=\"amplify-flex federated-sign-in-container\"\n style=\"flex-direction: column\"\n *ngIf=\"shouldShowFederatedSignIn\"\n data-orientation=\"horizontal\"\n data-size=\"small\"\n>\n <hr\n class=\"amplify-divider\"\n aria-orientation=\"horizontal\"\n data-size=\"small\"\n style=\"margin: '1rem 0'\"\n />\n <amplify-federated-sign-in-button\n *ngIf=\"includeGoogle\"\n [provider]=\"FederatedProviders.Google\"\n >\n <svg\n aria-label=\"Google icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 256 262\"\n xmlns=\"http://www.w3.org/2000/svg\"\n preserveAspectRatio=\"xMidYMid\"\n >\n <path\n d=\"M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027\"\n fill=\"#4285F4\"\n ></path>\n <path\n d=\"M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1\"\n fill=\"#34A853\"\n ></path>\n <path\n d=\"M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782\"\n fill=\"#FBBC05\"\n ></path>\n <path\n d=\"M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251\"\n fill=\"#EB4335\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInGoogleText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeFacebook\"\n [text]=\"signInFacebookText\"\n [provider]=\"FederatedProviders.Facebook\"\n >\n <svg\n aria-label=\"Facebook icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 279 538\"\n >\n <path\n d=\"M82.3409742,538 L82.3409742,292.936652 L0,292.936652 L0,196.990154 L82.2410458,196.990154 L82.2410458,126.4295 C82.2410458,44.575144 132.205229,0 205.252865,0 C240.227794,0 270.306232,2.59855099 279,3.79788222 L279,89.2502322 L228.536175,89.2502322 C188.964542,89.2502322 181.270057,108.139699 181.270057,135.824262 L181.270057,196.89021 L276.202006,196.89021 L263.810888,292.836708 L181.16913,292.836708 L181.16913,538 L82.3409742,538 Z\"\n fill=\"#1877F2\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInFacebookText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeAmazon\"\n [text]=\"signInAmazonText\"\n [provider]=\"FederatedProviders.Amazon\"\n >\n <svg\n aria-label=\"Amazon icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 248 268\"\n >\n <path\n d=\"M139.056521,147.024612 C133.548808,156.744524 124.782731,162.726926 115.087401,162.726926 C101.790721,162.726926 93.9937779,152.612964 93.9937779,137.68681 C93.9937779,108.224571 120.447551,102.879017 145.533369,102.879017 L145.533369,110.365976 C145.533369,123.831358 145.876354,135.063787 139.056521,147.024612 M207.206992,162.579655 C209.400505,165.692256 209.887066,169.437725 207.063416,171.770186 C199.996315,177.653081 187.429476,188.590967 180.513926,194.716661 L180.46208,194.621133 C178.176838,196.663031 174.862638,196.810303 172.27828,195.445057 C160.780281,185.9162 158.686473,181.494078 152.405048,172.403055 C133.405233,191.751331 119.909143,197.534719 95.309886,197.534719 C66.1281801,197.534719 43.4791563,179.599451 43.4791563,143.669212 C43.4791563,115.616003 58.6782107,96.5105248 80.4019706,87.1727225 C99.2063636,78.9096034 125.464714,77.4528107 145.533369,75.1641337 L145.533369,70.694248 C145.533369,62.4749122 146.167493,52.7510201 141.297893,45.6541312 C137.110277,39.2856386 129.018206,36.6586354 121.859376,36.6586354 C108.658413,36.6586354 96.9171331,43.4171982 94.0416364,57.4199213 C93.4593582,60.532522 91.1701278,63.5933787 88.003492,63.7406501 L54.4387473,60.1424518 C51.6150972,59.5095829 48.4484614,57.2248862 49.2740201,52.8982915 C56.9712583,12.2553679 93.7983558,0 126.732964,0 C143.587124,0 165.606011,4.47386604 178.902691,17.2148315 C195.760839,32.917146 194.149604,53.8694866 194.149604,76.6726704 L194.149604,130.542157 C194.149604,146.734049 200.87372,153.830938 207.206992,162.579655 Z M233.826346,208.038962 C230.467669,203.683255 211.550709,205.9821 203.056405,206.998432 C200.470662,207.321077 200.076227,205.042397 202.406981,203.404973 C217.475208,192.664928 242.201125,195.766353 245.081698,199.363845 C247.966255,202.981502 244.336653,228.071183 230.172839,240.049379 C228.001452,241.888455 225.929671,240.904388 226.89783,238.468418 C230.077218,230.430525 237.204944,212.418868 233.826346,208.038962 Z M126.768855,264 C74.0234043,264 42.0764048,241.955028 17.7852554,217.541992 C12.9733903,212.705982 6.71799208,206.295994 3.31151296,200.690918 C1.90227474,198.372135 5.59096074,195.021875 8.0442063,196.84375 C38.2390146,219.267578 82.1011654,239.538304 125.529506,239.538304 C154.819967,239.538304 191.046475,227.469543 220.66851,214.867659 C225.146771,212.966167 225.146771,219.180222 224.511585,221.060516 C224.183264,222.03242 209.514625,236.221149 189.247207,247.047411 C170.304273,257.166172 146.397132,264 126.768855,264 Z\"\n fill=\"#FF9900\"\n ></path>\n </svg>\n\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInAmazonText }}\n </p>\n </amplify-federated-sign-in-button>\n</div>\n"
|
|
381
401
|
},] }
|
|
382
402
|
];
|
|
383
|
-
|
|
403
|
+
AmplifyFederatedSignInComponent.ctorParameters = () => [
|
|
384
404
|
{ type: StateMachineService }
|
|
385
405
|
];
|
|
386
|
-
AmplifyInputComponent.propDecorators = {
|
|
387
|
-
name: [{ type: Input }],
|
|
388
|
-
type: [{ type: Input }],
|
|
389
|
-
required: [{ type: Input }],
|
|
390
|
-
placeholder: [{ type: Input }],
|
|
391
|
-
label: [{ type: Input }],
|
|
392
|
-
initialValue: [{ type: Input }],
|
|
393
|
-
disabled: [{ type: Input }],
|
|
394
|
-
autocomplete: [{ type: Input }]
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
class AmplifyErrorComponent {
|
|
398
|
-
}
|
|
399
|
-
AmplifyErrorComponent.decorators = [
|
|
400
|
-
{ type: Component, args: [{
|
|
401
|
-
selector: 'amplify-error',
|
|
402
|
-
template: "<span data-amplify-error>\n <ng-content></ng-content>\n</span>\n"
|
|
403
|
-
},] }
|
|
404
|
-
];
|
|
405
406
|
|
|
406
|
-
const logger$
|
|
407
|
-
class
|
|
407
|
+
const logger$2 = new Logger('ForceNewPassword');
|
|
408
|
+
class AmplifyForceNewPasswordComponent {
|
|
408
409
|
constructor(stateMachine, contextService) {
|
|
409
410
|
this.stateMachine = stateMachine;
|
|
410
411
|
this.contextService = contextService;
|
|
411
412
|
this.dataAttr = '';
|
|
413
|
+
this.headerText = translate('Change Password');
|
|
412
414
|
this.customComponents = {};
|
|
413
415
|
this.remoteError = '';
|
|
414
416
|
this.isPending = false;
|
|
417
|
+
// translated texts
|
|
418
|
+
this.changePasswordText = translate('Change Password');
|
|
419
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
415
420
|
}
|
|
416
421
|
ngOnInit() {
|
|
417
|
-
// TODO: alias for subscribe
|
|
418
422
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
419
|
-
this.setUsername();
|
|
420
|
-
}
|
|
421
|
-
setUsername() {
|
|
422
|
-
var _a;
|
|
423
|
-
const state = this.stateMachine.authState;
|
|
424
|
-
const actorContext = getActorContext(state);
|
|
425
|
-
const { user, authAttributes } = actorContext;
|
|
426
|
-
const username = (_a = user === null || user === void 0 ? void 0 : user.username) !== null && _a !== void 0 ? _a : authAttributes === null || authAttributes === void 0 ? void 0 : authAttributes.username;
|
|
427
|
-
if (username) {
|
|
428
|
-
this.username = username;
|
|
429
|
-
this.stateMachine.send({
|
|
430
|
-
type: 'CHANGE',
|
|
431
|
-
data: { name: 'username', value: this.username },
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
423
|
}
|
|
435
424
|
ngAfterContentInit() {
|
|
436
425
|
this.customComponents = this.contextService.customComponents;
|
|
437
426
|
}
|
|
438
427
|
ngOnDestroy() {
|
|
439
|
-
logger$
|
|
428
|
+
logger$2.log('sign in destroyed, unsubscribing from state machine...');
|
|
440
429
|
this.authSubscription.unsubscribe();
|
|
441
430
|
}
|
|
442
431
|
onStateUpdate(state) {
|
|
443
432
|
const actorState = getActorState(state);
|
|
444
433
|
this.remoteError = actorState.context.remoteError;
|
|
445
|
-
this.isPending =
|
|
434
|
+
this.isPending = actorState.matches({
|
|
435
|
+
signUp: {
|
|
436
|
+
submission: 'idle',
|
|
437
|
+
},
|
|
438
|
+
});
|
|
446
439
|
}
|
|
447
440
|
get context() {
|
|
448
|
-
const { change,
|
|
441
|
+
const { change, signIn, submit } = this.stateMachine.services;
|
|
442
|
+
const user = this.stateMachine.user;
|
|
449
443
|
const remoteError = this.remoteError;
|
|
450
|
-
|
|
451
|
-
return { change, remoteError, resend, signIn, submit, username };
|
|
444
|
+
return { change, remoteError, signIn, submit, user };
|
|
452
445
|
}
|
|
453
446
|
toSignIn() {
|
|
454
447
|
this.stateMachine.send('SIGN_IN');
|
|
455
448
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
data: {
|
|
460
|
-
username: this.username,
|
|
461
|
-
},
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
onInput($event) {
|
|
465
|
-
$event.preventDefault();
|
|
466
|
-
const { name, value } = $event.target;
|
|
449
|
+
onInput(event) {
|
|
450
|
+
event.preventDefault();
|
|
451
|
+
const { name, value } = event.target;
|
|
467
452
|
this.stateMachine.send({
|
|
468
453
|
type: 'CHANGE',
|
|
469
454
|
data: { name, value },
|
|
@@ -471,76 +456,46 @@ class AmplifyConfirmSignUpComponent {
|
|
|
471
456
|
}
|
|
472
457
|
onSubmit(event) {
|
|
473
458
|
event.preventDefault();
|
|
459
|
+
// consider stateMachine directly providing actorState / actorContext
|
|
474
460
|
const state = this.stateMachine.authState;
|
|
475
|
-
const
|
|
476
|
-
const { formValues } =
|
|
477
|
-
const { username, confirmation_code } = formValues;
|
|
461
|
+
const actorState = getActorContext(state);
|
|
462
|
+
const { formValues } = actorState;
|
|
478
463
|
this.stateMachine.send({
|
|
479
464
|
type: 'SUBMIT',
|
|
480
|
-
data:
|
|
465
|
+
data: formValues,
|
|
481
466
|
});
|
|
482
467
|
}
|
|
483
468
|
}
|
|
484
|
-
|
|
469
|
+
AmplifyForceNewPasswordComponent.decorators = [
|
|
485
470
|
{ type: Component, args: [{
|
|
486
|
-
selector: 'amplify-
|
|
487
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #
|
|
471
|
+
selector: 'amplify-force-new-password',
|
|
472
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #forceNewPasswordSubmitButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ changePasswordText }}\n </button>\n</ng-template>\n\n<ng-template #signInForm>\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]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n <amplify-form-field\n name=\"password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.forceNewPasswordSubmitButton ||\n forceNewPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n </form>\n</ng-template>\n\n<!-- \n Render force new password component\n-->\n<div data-amplify-container>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || signInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
488
473
|
},] }
|
|
489
474
|
];
|
|
490
|
-
|
|
475
|
+
AmplifyForceNewPasswordComponent.ctorParameters = () => [
|
|
491
476
|
{ type: StateMachineService },
|
|
492
477
|
{ type: AuthPropService }
|
|
493
478
|
];
|
|
494
|
-
|
|
495
|
-
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
class AmplifyUserNameAliasComponent {
|
|
499
|
-
constructor(stateMachine) {
|
|
500
|
-
this.stateMachine = stateMachine;
|
|
501
|
-
this.name = 'username';
|
|
502
|
-
this.disabled = false;
|
|
503
|
-
this.initialValue = '';
|
|
504
|
-
}
|
|
505
|
-
ngOnInit() {
|
|
506
|
-
const context = this.stateMachine.context;
|
|
507
|
-
const { label, type } = getAliasInfoFromContext(context);
|
|
508
|
-
this.label = label;
|
|
509
|
-
this.type = type;
|
|
510
|
-
this.placeholder = `Enter your ${label.toLowerCase()}`;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
AmplifyUserNameAliasComponent.decorators = [
|
|
514
|
-
{ type: Component, args: [{
|
|
515
|
-
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"
|
|
517
|
-
},] }
|
|
518
|
-
];
|
|
519
|
-
AmplifyUserNameAliasComponent.ctorParameters = () => [
|
|
520
|
-
{ type: StateMachineService }
|
|
521
|
-
];
|
|
522
|
-
AmplifyUserNameAliasComponent.propDecorators = {
|
|
523
|
-
name: [{ type: Input }],
|
|
524
|
-
disabled: [{ type: Input }],
|
|
525
|
-
initialValue: [{ type: Input }]
|
|
479
|
+
AmplifyForceNewPasswordComponent.propDecorators = {
|
|
480
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-forcenewpassword',] }],
|
|
481
|
+
headerText: [{ type: Input }]
|
|
526
482
|
};
|
|
527
483
|
|
|
528
|
-
|
|
529
|
-
class AmplifyConfirmSignInComponent {
|
|
484
|
+
class AmplifyResetPasswordComponent {
|
|
530
485
|
constructor(stateMachine, contextService) {
|
|
531
486
|
this.stateMachine = stateMachine;
|
|
532
487
|
this.contextService = contextService;
|
|
533
488
|
this.dataAttr = '';
|
|
489
|
+
this.headerText = translate('Reset your password');
|
|
534
490
|
this.customComponents = {};
|
|
535
491
|
this.remoteError = '';
|
|
536
492
|
this.isPending = false;
|
|
537
|
-
|
|
493
|
+
// translated texts
|
|
494
|
+
this.sendCodeText = translate('Send Code');
|
|
495
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
538
496
|
}
|
|
539
497
|
ngOnInit() {
|
|
540
|
-
this.authSubscription = this.stateMachine.authService.subscribe((state) =>
|
|
541
|
-
this.onStateUpdate(state);
|
|
542
|
-
});
|
|
543
|
-
this.setHeaderText();
|
|
498
|
+
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
544
499
|
}
|
|
545
500
|
ngAfterContentInit() {
|
|
546
501
|
this.customComponents = this.contextService.customComponents;
|
|
@@ -548,31 +503,18 @@ class AmplifyConfirmSignInComponent {
|
|
|
548
503
|
ngOnDestroy() {
|
|
549
504
|
this.authSubscription.unsubscribe();
|
|
550
505
|
}
|
|
506
|
+
onStateUpdate(state) {
|
|
507
|
+
const actorState = getActorState(state);
|
|
508
|
+
this.remoteError = actorState.context.remoteError;
|
|
509
|
+
this.isPending = !actorState.matches('resetPassword.edit');
|
|
510
|
+
}
|
|
551
511
|
get context() {
|
|
552
512
|
const { change, signIn, submit } = this.stateMachine.services;
|
|
553
513
|
const remoteError = this.remoteError;
|
|
554
514
|
return { change, remoteError, signIn, submit };
|
|
555
515
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
const actorContext = getActorContext(state);
|
|
559
|
-
const { challengeName } = actorContext;
|
|
560
|
-
switch (challengeName) {
|
|
561
|
-
case AuthChallengeNames.SOFTWARE_TOKEN_MFA:
|
|
562
|
-
// TODO: this string should be centralized and translated from ui.
|
|
563
|
-
this.headerText = 'Confirm TOTP Code';
|
|
564
|
-
break;
|
|
565
|
-
case AuthChallengeNames.SMS_MFA:
|
|
566
|
-
this.headerText = 'Confirm SMS Code';
|
|
567
|
-
break;
|
|
568
|
-
default:
|
|
569
|
-
logger$2.error('Unexpected challengeName', challengeName);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
onStateUpdate(state) {
|
|
573
|
-
const actorState = getActorState(state);
|
|
574
|
-
this.remoteError = actorState.context.remoteError;
|
|
575
|
-
this.isPending = !actorState.matches('confirmSignIn.edit');
|
|
516
|
+
toSignIn() {
|
|
517
|
+
this.stateMachine.send('SIGN_IN');
|
|
576
518
|
}
|
|
577
519
|
onInput(event) {
|
|
578
520
|
event.preventDefault();
|
|
@@ -584,29 +526,22 @@ class AmplifyConfirmSignInComponent {
|
|
|
584
526
|
}
|
|
585
527
|
onSubmit(event) {
|
|
586
528
|
event.preventDefault();
|
|
587
|
-
|
|
588
|
-
const formData = new FormData(event.target);
|
|
589
|
-
this.stateMachine.send({
|
|
590
|
-
type: 'SUBMIT',
|
|
591
|
-
data: Object.fromEntries(formData),
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
toSignIn() {
|
|
595
|
-
this.stateMachine.send('SIGN_IN');
|
|
529
|
+
this.stateMachine.send('SUBMIT');
|
|
596
530
|
}
|
|
597
531
|
}
|
|
598
|
-
|
|
532
|
+
AmplifyResetPasswordComponent.decorators = [
|
|
599
533
|
{ type: Component, args: [{
|
|
600
|
-
selector: 'amplify-
|
|
601
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #
|
|
534
|
+
selector: 'amplify-reset-password',
|
|
535
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #resetPasswordSubmitButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n</ng-template>\n\n<ng-template #resetPasswordForm>\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]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n <amplify-form-field\n name=\"username\"\n type=\"username\"\n autocomplete=\"username\"\n ></amplify-form-field>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.resetPasswordSubmitButton ||\n resetPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n </form>\n</ng-template>\n\n<!-- \n Render reset passsword component\n-->\n<div data-amplify-container>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.resetPasswordForm || resetPasswordForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
602
536
|
},] }
|
|
603
537
|
];
|
|
604
|
-
|
|
538
|
+
AmplifyResetPasswordComponent.ctorParameters = () => [
|
|
605
539
|
{ type: StateMachineService },
|
|
606
540
|
{ type: AuthPropService }
|
|
607
541
|
];
|
|
608
|
-
|
|
609
|
-
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-
|
|
542
|
+
AmplifyResetPasswordComponent.propDecorators = {
|
|
543
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-resetPassword',] }],
|
|
544
|
+
headerText: [{ type: Input }]
|
|
610
545
|
};
|
|
611
546
|
|
|
612
547
|
const logger$1 = new Logger('SetupTotp');
|
|
@@ -617,8 +552,11 @@ class AmplifySetupTotpComponent {
|
|
|
617
552
|
this.customComponents = {};
|
|
618
553
|
this.remoteError = '';
|
|
619
554
|
this.isPending = false;
|
|
620
|
-
this.headerText = 'Setup TOTP';
|
|
555
|
+
this.headerText = translate('Setup TOTP');
|
|
621
556
|
this.qrCodeSource = '';
|
|
557
|
+
// translated texts
|
|
558
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
559
|
+
this.confirmText = translate('Confirm');
|
|
622
560
|
}
|
|
623
561
|
ngOnInit() {
|
|
624
562
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => {
|
|
@@ -647,7 +585,9 @@ class AmplifySetupTotpComponent {
|
|
|
647
585
|
var _a;
|
|
648
586
|
return __awaiter(this, void 0, void 0, function* () {
|
|
649
587
|
// TODO: This should be handled in core.
|
|
650
|
-
const
|
|
588
|
+
const state = this.stateMachine.authState;
|
|
589
|
+
const actorContext = getActorContext(state);
|
|
590
|
+
const { user } = actorContext;
|
|
651
591
|
try {
|
|
652
592
|
const secretKey = yield Auth.setupTOTP(user);
|
|
653
593
|
const issuer = 'AWSCognito';
|
|
@@ -678,11 +618,14 @@ class AmplifySetupTotpComponent {
|
|
|
678
618
|
data: Object.fromEntries(formData),
|
|
679
619
|
});
|
|
680
620
|
}
|
|
621
|
+
toSignIn() {
|
|
622
|
+
this.stateMachine.send('SIGN_IN');
|
|
623
|
+
}
|
|
681
624
|
}
|
|
682
625
|
AmplifySetupTotpComponent.decorators = [
|
|
683
626
|
{ type: Component, args: [{
|
|
684
627
|
selector: 'amplify-setup-totp',
|
|
685
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #setupTotpButton>\n <button
|
|
628
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #setupTotpButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n</ng-template>\n\n<ng-template #setupTotpForm>\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]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n />\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.setupTotpButton || setupTotpButton\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n<div data-amplify-container>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.setupTotpForm || setupTotpForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
686
629
|
},] }
|
|
687
630
|
];
|
|
688
631
|
AmplifySetupTotpComponent.ctorParameters = () => [
|
|
@@ -693,16 +636,20 @@ AmplifySetupTotpComponent.propDecorators = {
|
|
|
693
636
|
customComponents: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-setup-totp',] }]
|
|
694
637
|
};
|
|
695
638
|
|
|
696
|
-
const logger = new Logger('
|
|
697
|
-
class
|
|
639
|
+
const logger = new Logger('SignIn');
|
|
640
|
+
class AmplifySignInComponent {
|
|
698
641
|
constructor(stateMachine, contextService) {
|
|
699
642
|
this.stateMachine = stateMachine;
|
|
700
643
|
this.contextService = contextService;
|
|
701
644
|
this.dataAttr = '';
|
|
702
|
-
this.headerText = '
|
|
645
|
+
this.headerText = translate('Sign in to your account');
|
|
703
646
|
this.customComponents = {};
|
|
704
647
|
this.remoteError = '';
|
|
705
648
|
this.isPending = false;
|
|
649
|
+
// translated phrases
|
|
650
|
+
this.forgotPasswordText = translate('Forgot your password? ');
|
|
651
|
+
this.signInButtonText = translate('Sign in');
|
|
652
|
+
this.noAccountText = translate('No account? ');
|
|
706
653
|
}
|
|
707
654
|
ngOnInit() {
|
|
708
655
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -717,16 +664,15 @@ class AmplifyForceNewPasswordComponent {
|
|
|
717
664
|
onStateUpdate(state) {
|
|
718
665
|
const actorState = getActorState(state);
|
|
719
666
|
this.remoteError = actorState.context.remoteError;
|
|
720
|
-
this.isPending = !actorState.matches('
|
|
667
|
+
this.isPending = !actorState.matches('signIn.edit');
|
|
721
668
|
}
|
|
722
669
|
get context() {
|
|
723
|
-
const { change,
|
|
724
|
-
const user = this.stateMachine.user;
|
|
670
|
+
const { change, resetPassword, signUp, submit } = this.stateMachine.services;
|
|
725
671
|
const remoteError = this.remoteError;
|
|
726
|
-
return { change, remoteError,
|
|
672
|
+
return { change, remoteError, resetPassword, signUp, submit };
|
|
727
673
|
}
|
|
728
|
-
|
|
729
|
-
this.stateMachine.send('
|
|
674
|
+
toResetPassword() {
|
|
675
|
+
this.stateMachine.send('RESET_PASSWORD');
|
|
730
676
|
}
|
|
731
677
|
onInput(event) {
|
|
732
678
|
event.preventDefault();
|
|
@@ -737,98 +683,71 @@ class AmplifyForceNewPasswordComponent {
|
|
|
737
683
|
});
|
|
738
684
|
}
|
|
739
685
|
onSubmit(event) {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
const state = this.stateMachine.authState;
|
|
743
|
-
const actorState = getActorContext(state);
|
|
744
|
-
const { formValues } = actorState;
|
|
745
|
-
this.stateMachine.send({
|
|
746
|
-
type: 'SUBMIT',
|
|
747
|
-
data: formValues,
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
AmplifyForceNewPasswordComponent.decorators = [
|
|
752
|
-
{ type: Component, args: [{
|
|
753
|
-
selector: 'amplify-force-new-password',
|
|
754
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #forceNewPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">Change Password</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 label=\"Change password\"\n autocomplete=\"password\"\n [required]=\"true\"\n ></amplify-form-input>\n\n <div data-amplify-footer>\n <div>\n Back to{{ ' ' }}\n <a data-amplify-link (click)=\"toSignIn()\">Sign In</a>\n </div>\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
|
-
},] }
|
|
756
|
-
];
|
|
757
|
-
AmplifyForceNewPasswordComponent.ctorParameters = () => [
|
|
758
|
-
{ type: StateMachineService },
|
|
759
|
-
{ type: AuthPropService }
|
|
760
|
-
];
|
|
761
|
-
AmplifyForceNewPasswordComponent.propDecorators = {
|
|
762
|
-
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-forcenewpassword',] }],
|
|
763
|
-
headerText: [{ type: Input }]
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
class AmplifyFederatedSignInComponent {
|
|
767
|
-
constructor(stateMachine) {
|
|
768
|
-
this.stateMachine = stateMachine;
|
|
769
|
-
this.FederatedProviders = FederatedIdentityProviders;
|
|
770
|
-
this.includeFacebook = false;
|
|
771
|
-
this.includeGoogle = false;
|
|
772
|
-
this.includeAmazon = false;
|
|
773
|
-
this.shouldShowFederatedSignIn = false;
|
|
774
|
-
}
|
|
775
|
-
ngOnInit() {
|
|
776
|
-
var _a, _b;
|
|
777
|
-
const loginMechanisms = (_b = (_a = this.stateMachine.context) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.login_mechanisms;
|
|
778
|
-
this.includeFacebook = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('facebook');
|
|
779
|
-
this.includeGoogle = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('google');
|
|
780
|
-
this.includeAmazon = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('amazon');
|
|
781
|
-
this.shouldShowFederatedSignIn =
|
|
782
|
-
this.includeFacebook || this.includeGoogle || this.includeAmazon;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
AmplifyFederatedSignInComponent.decorators = [
|
|
786
|
-
{ type: Component, args: [{
|
|
787
|
-
selector: 'amplify-federated-sign-in',
|
|
788
|
-
template: "<div data-amplify-federated>\n <amplify-federated-sign-in-button\n *ngIf=\"includeFacebook\"\n text=\"Sign in with Facebook\"\n [provider]=\"FederatedProviders.Facebook\"\n ></amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeGoogle\"\n text=\"Sign in with Google\"\n [provider]=\"FederatedProviders.Google\"\n ></amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeAmazon\"\n text=\"Sign in with Amazon\"\n [provider]=\"FederatedProviders.Amazon\"\n ></amplify-federated-sign-in-button>\n</div>\n"
|
|
789
|
-
},] }
|
|
790
|
-
];
|
|
791
|
-
AmplifyFederatedSignInComponent.ctorParameters = () => [
|
|
792
|
-
{ type: StateMachineService }
|
|
793
|
-
];
|
|
794
|
-
|
|
795
|
-
class AmplifyFederatedSignInButtonComponent {
|
|
796
|
-
constructor(stateMachine) {
|
|
797
|
-
this.stateMachine = stateMachine;
|
|
798
|
-
this.onClick = () => {
|
|
686
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
687
|
+
event.preventDefault();
|
|
799
688
|
this.stateMachine.send({
|
|
800
|
-
type: '
|
|
801
|
-
data: { provider: this.provider },
|
|
689
|
+
type: 'SUBMIT',
|
|
802
690
|
});
|
|
803
|
-
};
|
|
691
|
+
});
|
|
804
692
|
}
|
|
805
693
|
}
|
|
806
|
-
|
|
694
|
+
AmplifySignInComponent.decorators = [
|
|
807
695
|
{ type: Component, args: [{
|
|
808
|
-
selector: 'amplify-
|
|
809
|
-
template: "<button data-amplify-
|
|
696
|
+
selector: 'amplify-sign-in',
|
|
697
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #signInButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ signInButtonText }}\n </button>\n</ng-template>\n\n<ng-template #signInForm>\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]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n <amplify-user-name-alias></amplify-user-name-alias>\n <amplify-form-field\n data-amplify-password\n name=\"password\"\n type=\"password\"\n autocomplete=\"current-password\"\n ></amplify-form-field>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInButton || signInButton\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n <button\n amplify-button\n fontWeight=\"normal\"\n size=\"small\"\n variation=\"link\"\n (click)=\"toResetPassword()\"\n >\n {{ forgotPasswordText }}\n </button>\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n <amplify-federated-sign-in></amplify-federated-sign-in>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n\n<div data-amplify-container>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || signInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n",
|
|
698
|
+
encapsulation: ViewEncapsulation.None
|
|
810
699
|
},] }
|
|
811
700
|
];
|
|
812
|
-
|
|
813
|
-
{ type: StateMachineService }
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
701
|
+
AmplifySignInComponent.ctorParameters = () => [
|
|
702
|
+
{ type: StateMachineService },
|
|
703
|
+
{ type: AuthPropService }
|
|
704
|
+
];
|
|
705
|
+
AmplifySignInComponent.propDecorators = {
|
|
706
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-signin',] }],
|
|
707
|
+
headerText: [{ type: Input }]
|
|
818
708
|
};
|
|
819
709
|
|
|
820
|
-
class
|
|
710
|
+
class AmplifySignUpComponent {
|
|
821
711
|
constructor(stateMachine, contextService) {
|
|
822
712
|
this.stateMachine = stateMachine;
|
|
823
713
|
this.contextService = contextService;
|
|
824
714
|
this.dataAttr = '';
|
|
825
|
-
this.headerText = '
|
|
826
|
-
this.customComponents = {};
|
|
715
|
+
this.headerText = translate('Create a new account');
|
|
827
716
|
this.remoteError = '';
|
|
828
717
|
this.isPending = false;
|
|
718
|
+
this.primaryAlias = '';
|
|
719
|
+
this.secondaryAliases = [];
|
|
720
|
+
this.validationError = {};
|
|
721
|
+
// translated texts
|
|
722
|
+
this.createAccountText = translate('Create Account');
|
|
723
|
+
}
|
|
724
|
+
get context() {
|
|
725
|
+
const { change, signIn, submit } = this.stateMachine.services;
|
|
726
|
+
const remoteError = this.remoteError;
|
|
727
|
+
const validationError = this.validationError;
|
|
728
|
+
return {
|
|
729
|
+
change,
|
|
730
|
+
remoteError,
|
|
731
|
+
signIn,
|
|
732
|
+
submit,
|
|
733
|
+
validationError,
|
|
734
|
+
};
|
|
829
735
|
}
|
|
830
736
|
ngOnInit() {
|
|
831
737
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
738
|
+
const context = this.stateMachine.context;
|
|
739
|
+
const { primaryAlias, secondaryAliases } = getConfiguredAliases(context);
|
|
740
|
+
/**
|
|
741
|
+
* If the login_mechanisms are configured to use ONLY username, we need
|
|
742
|
+
* to ask for some sort of secondary contact information in order to
|
|
743
|
+
* verify the user for Cognito. Currently matching this to how Vue is
|
|
744
|
+
* set up.
|
|
745
|
+
*/
|
|
746
|
+
if (primaryAlias === 'username' && isEmpty(secondaryAliases)) {
|
|
747
|
+
secondaryAliases.push('email', 'phone_number');
|
|
748
|
+
}
|
|
749
|
+
this.primaryAlias = primaryAlias;
|
|
750
|
+
this.secondaryAliases = secondaryAliases;
|
|
832
751
|
}
|
|
833
752
|
ngAfterContentInit() {
|
|
834
753
|
this.customComponents = this.contextService.customComponents;
|
|
@@ -838,16 +757,20 @@ class AmplifyResetPasswordComponent {
|
|
|
838
757
|
}
|
|
839
758
|
onStateUpdate(state) {
|
|
840
759
|
const actorState = getActorState(state);
|
|
841
|
-
|
|
842
|
-
this.
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
760
|
+
const actorContext = getActorContext(state);
|
|
761
|
+
this.remoteError = actorContext.remoteError;
|
|
762
|
+
this.validationError = actorContext.validationError;
|
|
763
|
+
this.isPending = !actorState.matches({
|
|
764
|
+
signUp: {
|
|
765
|
+
submission: 'idle',
|
|
766
|
+
},
|
|
767
|
+
});
|
|
848
768
|
}
|
|
849
|
-
|
|
850
|
-
this
|
|
769
|
+
onSubmit($event) {
|
|
770
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
771
|
+
$event.preventDefault();
|
|
772
|
+
this.stateMachine.send('SUBMIT');
|
|
773
|
+
});
|
|
851
774
|
}
|
|
852
775
|
onInput(event) {
|
|
853
776
|
event.preventDefault();
|
|
@@ -857,36 +780,38 @@ class AmplifyResetPasswordComponent {
|
|
|
857
780
|
data: { name, value },
|
|
858
781
|
});
|
|
859
782
|
}
|
|
860
|
-
onSubmit(event) {
|
|
861
|
-
event.preventDefault();
|
|
862
|
-
this.stateMachine.send('SUBMIT');
|
|
863
|
-
}
|
|
864
783
|
}
|
|
865
|
-
|
|
784
|
+
AmplifySignUpComponent.decorators = [
|
|
866
785
|
{ type: Component, args: [{
|
|
867
|
-
selector: 'amplify-
|
|
868
|
-
template: "
|
|
786
|
+
selector: 'amplify-sign-up',
|
|
787
|
+
template: "<ng-template #signUpButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ createAccountText }}\n </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-field\n name=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n</ng-template>\n\n<ng-template #signUpConfirmPassword>\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n</ng-template>\n\n<ng-template #signUpFieldset>\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\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-field [name]=\"secondaryAlias\"></amplify-form-field>\n </ng-container>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signUpButton || signUpButton\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n <amplify-federated-sign-in></amplify-federated-sign-in>\n</ng-template>\n\n<div data-amplify-container>\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 </form>\n</div>\n"
|
|
869
788
|
},] }
|
|
870
789
|
];
|
|
871
|
-
|
|
790
|
+
AmplifySignUpComponent.ctorParameters = () => [
|
|
872
791
|
{ type: StateMachineService },
|
|
873
792
|
{ type: AuthPropService }
|
|
874
793
|
];
|
|
875
|
-
|
|
876
|
-
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-
|
|
794
|
+
AmplifySignUpComponent.propDecorators = {
|
|
795
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-signup',] }],
|
|
877
796
|
headerText: [{ type: Input }]
|
|
878
797
|
};
|
|
879
798
|
|
|
799
|
+
const getAttributeMap = () => authInputAttributes;
|
|
800
|
+
|
|
880
801
|
class AmplifyVerifyUserComponent {
|
|
881
802
|
constructor(stateMachine, contextService) {
|
|
882
803
|
this.stateMachine = stateMachine;
|
|
883
804
|
this.contextService = contextService;
|
|
884
805
|
this.dataAttr = '';
|
|
885
|
-
this.headerText = 'Account recovery requires verified contact information';
|
|
806
|
+
this.headerText = translate('Account recovery requires verified contact information');
|
|
886
807
|
this.customComponents = {};
|
|
887
808
|
this.unverifiedAttributes = {};
|
|
888
809
|
this.remoteError = '';
|
|
889
810
|
this.isPending = false;
|
|
811
|
+
this.labelId = nanoid(12);
|
|
812
|
+
// translated texts
|
|
813
|
+
this.skipText = translate('Skip');
|
|
814
|
+
this.verifyText = translate('Verify');
|
|
890
815
|
}
|
|
891
816
|
ngOnInit() {
|
|
892
817
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -911,6 +836,12 @@ class AmplifyVerifyUserComponent {
|
|
|
911
836
|
skipVerify() {
|
|
912
837
|
this.stateMachine.send('SKIP');
|
|
913
838
|
}
|
|
839
|
+
getLabelForAttr(authAttr) {
|
|
840
|
+
var _a;
|
|
841
|
+
const attributeMap = getAttributeMap();
|
|
842
|
+
const label = (_a = attributeMap[authAttr]) === null || _a === void 0 ? void 0 : _a.label;
|
|
843
|
+
return translate(label);
|
|
844
|
+
}
|
|
914
845
|
onSubmit(event) {
|
|
915
846
|
return __awaiter(this, void 0, void 0, function* () {
|
|
916
847
|
event.preventDefault();
|
|
@@ -925,7 +856,7 @@ class AmplifyVerifyUserComponent {
|
|
|
925
856
|
AmplifyVerifyUserComponent.decorators = [
|
|
926
857
|
{ type: Component, args: [{
|
|
927
858
|
selector: 'amplify-verify-user',
|
|
928
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #
|
|
859
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #verifyButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ verifyText }}\n </button>\n</ng-template>\n\n<ng-template #verifyUserForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n\n <div *ngFor=\"let unverifiedAttribute of unverifiedAttributes | keyvalue\">\n <!-- TODO: match React implementation -->\n <input\n name=\"unverifiedAttr\"\n type=\"radio\"\n [value]=\"unverifiedAttribute.key\"\n [id]=\"labelId\"\n />\n <label [for]=\"labelId\">{{\n getLabelForAttr(unverifiedAttribute.key)\n }}</label>\n </div>\n\n <ng-container\n [ngTemplateOutlet]=\"customComponents.verifyButton || verifyButton\"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"skipVerify()\"\n >\n {{ skipText }}\n </button>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n </form>\n</ng-template>\n\n<!-- \n Render verify user component\n-->\n<div data-amplify-container>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.verifyUserForm || verifyUserForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n",
|
|
929
860
|
encapsulation: ViewEncapsulation.None
|
|
930
861
|
},] }
|
|
931
862
|
];
|
|
@@ -943,10 +874,15 @@ class ConfirmResetPasswordComponent {
|
|
|
943
874
|
this.stateMachine = stateMachine;
|
|
944
875
|
this.contextService = contextService;
|
|
945
876
|
this.dataAttr = '';
|
|
946
|
-
this.headerText = 'Reset your password';
|
|
877
|
+
this.headerText = translate('Reset your password');
|
|
947
878
|
this.customComponents = {};
|
|
948
879
|
this.remoteError = '';
|
|
949
880
|
this.isPending = false;
|
|
881
|
+
// translated strings
|
|
882
|
+
this.sendCodeText = translate('Send Code');
|
|
883
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
884
|
+
this.lostCodeText = translate('Lost your code? ');
|
|
885
|
+
this.resendCodeText = translate('Resend Code');
|
|
950
886
|
}
|
|
951
887
|
ngOnInit() {
|
|
952
888
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -991,7 +927,7 @@ class ConfirmResetPasswordComponent {
|
|
|
991
927
|
ConfirmResetPasswordComponent.decorators = [
|
|
992
928
|
{ type: Component, args: [{
|
|
993
929
|
selector: 'amplify-confirm-reset-password',
|
|
994
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmResetPasswordSubmitButton>\n <button
|
|
930
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmResetPasswordSubmitButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n</ng-template>\n<ng-template #confirmResetPasswordForm>\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]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <amplify-form-field\n name=\"password\"\n label=\"New password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPasswordSubmitButton ||\n confirmResetPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n type=\"button\"\n (click)=\"resend()\"\n >\n {{ resendCodeText }}\n </button>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n </form>\n</ng-template>\n\n<!-- \n Render confirm reset password component\n-->\n<div data-amplify-container>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPasswordForm || confirmResetPasswordForm\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
995
931
|
},] }
|
|
996
932
|
];
|
|
997
933
|
ConfirmResetPasswordComponent.ctorParameters = () => [
|
|
@@ -1008,10 +944,13 @@ class ConfirmVerifyUserComponent {
|
|
|
1008
944
|
this.stateMachine = stateMachine;
|
|
1009
945
|
this.contextService = contextService;
|
|
1010
946
|
this.dataAttr = '';
|
|
1011
|
-
this.headerText = 'Account recovery requires verified contact information';
|
|
947
|
+
this.headerText = translate('Account recovery requires verified contact information');
|
|
1012
948
|
this.customComponents = {};
|
|
1013
949
|
this.remoteError = '';
|
|
1014
950
|
this.isPending = false;
|
|
951
|
+
// translated texts
|
|
952
|
+
this.skipText = translate('Skip');
|
|
953
|
+
this.submitText = translate('Submit');
|
|
1015
954
|
}
|
|
1016
955
|
ngOnInit() {
|
|
1017
956
|
this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
|
|
@@ -1049,7 +988,7 @@ class ConfirmVerifyUserComponent {
|
|
|
1049
988
|
ConfirmVerifyUserComponent.decorators = [
|
|
1050
989
|
{ type: Component, args: [{
|
|
1051
990
|
selector: 'amplify-confirm-verify-user',
|
|
1052
|
-
template: "<!-- \n Define default contents here\n-->\n<ng-template #
|
|
991
|
+
template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmVerifyButton>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ submitText }}\n </button>\n</ng-template>\n\n<ng-template #confirmVerifyUserForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"isPending\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmVerifyButton || confirmVerifyButton\n \"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"skipVerify()\"\n >\n {{ skipText }}\n </button>\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </fieldset>\n </form>\n</ng-template>\n\n<!-- \n Render confirm reset password component\n-->\n<div data-amplify-container>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmVerifyUserForm || confirmVerifyUserForm\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
|
|
1053
992
|
},] }
|
|
1054
993
|
];
|
|
1055
994
|
ConfirmVerifyUserComponent.ctorParameters = () => [
|
|
@@ -1061,6 +1000,312 @@ ConfirmVerifyUserComponent.propDecorators = {
|
|
|
1061
1000
|
headerText: [{ type: Input }]
|
|
1062
1001
|
};
|
|
1063
1002
|
|
|
1003
|
+
class AmplifyButtonComponent {
|
|
1004
|
+
constructor() {
|
|
1005
|
+
this.type = 'button';
|
|
1006
|
+
this.fullWidth = false;
|
|
1007
|
+
this.size = 'medium';
|
|
1008
|
+
this.variation = 'default';
|
|
1009
|
+
this.fontWeight = 'normal';
|
|
1010
|
+
this.defaultClass = true;
|
|
1011
|
+
}
|
|
1012
|
+
ngOnInit() {
|
|
1013
|
+
this.typeAttr = this.type;
|
|
1014
|
+
this.fullWidthAttr = this.fullWidth;
|
|
1015
|
+
this.sizeAttr = this.size;
|
|
1016
|
+
this.variationAttr = this.variation;
|
|
1017
|
+
this.fontWeightAttr = this.fontWeight;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
AmplifyButtonComponent.decorators = [
|
|
1021
|
+
{ type: Component, args: [{
|
|
1022
|
+
selector: 'button[amplify-button]',
|
|
1023
|
+
template: "<ng-content></ng-content>\n"
|
|
1024
|
+
},] }
|
|
1025
|
+
];
|
|
1026
|
+
AmplifyButtonComponent.propDecorators = {
|
|
1027
|
+
type: [{ type: Input }],
|
|
1028
|
+
fullWidth: [{ type: Input }],
|
|
1029
|
+
size: [{ type: Input }],
|
|
1030
|
+
variation: [{ type: Input }],
|
|
1031
|
+
fontWeight: [{ type: Input }],
|
|
1032
|
+
typeAttr: [{ type: HostBinding, args: ['type',] }],
|
|
1033
|
+
fullWidthAttr: [{ type: HostBinding, args: ['attr.data-fullwidth',] }],
|
|
1034
|
+
sizeAttr: [{ type: HostBinding, args: ['attr.data-size',] }],
|
|
1035
|
+
variationAttr: [{ type: HostBinding, args: ['attr.data-variation',] }],
|
|
1036
|
+
defaultClass: [{ type: HostBinding, args: ['class.amplify-button',] }],
|
|
1037
|
+
fontWeightAttr: [{ type: HostBinding, args: ['style.font-weight',] }]
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
class AmplifyErrorComponent {
|
|
1041
|
+
}
|
|
1042
|
+
AmplifyErrorComponent.decorators = [
|
|
1043
|
+
{ type: Component, args: [{
|
|
1044
|
+
selector: 'amplify-error',
|
|
1045
|
+
template: "<span data-ui-error>\n <ng-content></ng-content>\n</span>\n"
|
|
1046
|
+
},] }
|
|
1047
|
+
];
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Input interface opinionated for authenticator usage.
|
|
1051
|
+
*
|
|
1052
|
+
* TODO: Separate this component out to two parts -- 1) amplify-auth-input that
|
|
1053
|
+
* contains authenticator opinionated logic and 2) amplify-text-field primitive
|
|
1054
|
+
* that does not make any auth-related inference.
|
|
1055
|
+
*/
|
|
1056
|
+
class AmplifyFormFieldComponent {
|
|
1057
|
+
constructor(stateMachine) {
|
|
1058
|
+
this.stateMachine = stateMachine;
|
|
1059
|
+
this.required = true;
|
|
1060
|
+
this.placeholder = '';
|
|
1061
|
+
this.label = '';
|
|
1062
|
+
this.initialValue = '';
|
|
1063
|
+
this.disabled = false;
|
|
1064
|
+
this.autocomplete = '';
|
|
1065
|
+
this.countryDialCodes = countryDialCodes;
|
|
1066
|
+
}
|
|
1067
|
+
ngOnInit() {
|
|
1068
|
+
// TODO: field primtiives should have generate these by default.
|
|
1069
|
+
this.textFieldId = `amplify-field-${nanoid(12)}`;
|
|
1070
|
+
this.selectFieldId = `amplify-field-${nanoid(12)}`;
|
|
1071
|
+
// TODO: consider better default handling mechanisms across frameworks
|
|
1072
|
+
if (this.isPhoneField()) {
|
|
1073
|
+
const state = this.stateMachine.authState;
|
|
1074
|
+
const { country_code } = getActorContext(state);
|
|
1075
|
+
this.defaultCountryCode = country_code;
|
|
1076
|
+
// TODO: remove this side-effect
|
|
1077
|
+
this.stateMachine.send({
|
|
1078
|
+
type: 'CHANGE',
|
|
1079
|
+
data: { name: 'country_code', value: country_code },
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
get attributeMap() {
|
|
1084
|
+
return getAttributeMap();
|
|
1085
|
+
}
|
|
1086
|
+
get error() {
|
|
1087
|
+
const formContext = getActorContext(this.stateMachine.authState);
|
|
1088
|
+
const { validationError } = formContext;
|
|
1089
|
+
return validationError[this.name];
|
|
1090
|
+
}
|
|
1091
|
+
inferLabel() {
|
|
1092
|
+
var _a;
|
|
1093
|
+
const label = this.label || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.label);
|
|
1094
|
+
return translate(label);
|
|
1095
|
+
}
|
|
1096
|
+
inferPlaceholder() {
|
|
1097
|
+
var _a;
|
|
1098
|
+
const placeholder = this.placeholder || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.placeholder) ||
|
|
1099
|
+
this.inferLabel();
|
|
1100
|
+
return translate(placeholder);
|
|
1101
|
+
}
|
|
1102
|
+
// infers what the `type` of underlying input element should be.
|
|
1103
|
+
inferType() {
|
|
1104
|
+
var _a, _b, _c;
|
|
1105
|
+
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';
|
|
1106
|
+
}
|
|
1107
|
+
// TODO(enhancement): use enum to differentiate special field types
|
|
1108
|
+
isPasswordField() {
|
|
1109
|
+
return this.inferType() === 'password';
|
|
1110
|
+
}
|
|
1111
|
+
isPhoneField() {
|
|
1112
|
+
return this.inferType() === 'tel';
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
AmplifyFormFieldComponent.decorators = [
|
|
1116
|
+
{ type: Component, args: [{
|
|
1117
|
+
selector: 'amplify-form-field',
|
|
1118
|
+
template: "<div class=\"amplify-flex\" style=\"flex-direction: column; gap: 0\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [selectFieldId]=\"selectFieldId\"\n [defaultCountryCode]=\"defaultCountryCode\"\n [textFieldId]=\"textFieldId\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [autocomplete]=\"autocomplete\"\n ></amplify-phone-number-field>\n\n <amplify-password-field\n *ngIf=\"isPasswordField()\"\n [id]=\"textFieldId\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [disabled]=\"disabled\"\n [autocomplete]=\"autocomplete\"\n ></amplify-password-field>\n\n <amplify-text-field\n *ngIf=\"!isPasswordField() && !isPhoneField()\"\n [id]=\"textFieldId\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [disabled]=\"disabled\"\n [autocomplete]=\"autocomplete\"\n ></amplify-text-field>\n\n <amplify-error *ngIf=\"error\">\n {{ error }}\n </amplify-error>\n</div>\n"
|
|
1119
|
+
},] }
|
|
1120
|
+
];
|
|
1121
|
+
AmplifyFormFieldComponent.ctorParameters = () => [
|
|
1122
|
+
{ type: StateMachineService }
|
|
1123
|
+
];
|
|
1124
|
+
AmplifyFormFieldComponent.propDecorators = {
|
|
1125
|
+
name: [{ type: Input }],
|
|
1126
|
+
type: [{ type: Input }],
|
|
1127
|
+
required: [{ type: Input }],
|
|
1128
|
+
placeholder: [{ type: Input }],
|
|
1129
|
+
label: [{ type: Input }],
|
|
1130
|
+
initialValue: [{ type: Input }],
|
|
1131
|
+
disabled: [{ type: Input }],
|
|
1132
|
+
autocomplete: [{ type: Input }]
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
class AmplifyPasswordFieldComponent {
|
|
1136
|
+
constructor() {
|
|
1137
|
+
this.autocomplete = 'new-password';
|
|
1138
|
+
this.disabled = false;
|
|
1139
|
+
this.initialValue = '';
|
|
1140
|
+
this.label = '';
|
|
1141
|
+
this.placeholder = '';
|
|
1142
|
+
this.required = true;
|
|
1143
|
+
this.type = 'password';
|
|
1144
|
+
this.showPassword = false;
|
|
1145
|
+
this.showPasswordButtonlabel = translate('Show password');
|
|
1146
|
+
}
|
|
1147
|
+
togglePasswordText() {
|
|
1148
|
+
this.showPassword = !this.showPassword;
|
|
1149
|
+
this.showPasswordButtonlabel = this.showPassword
|
|
1150
|
+
? translate('Show password')
|
|
1151
|
+
: translate('Hide password');
|
|
1152
|
+
this.type = this.showPassword ? 'text' : 'password';
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
AmplifyPasswordFieldComponent.decorators = [
|
|
1156
|
+
{ type: Component, args: [{
|
|
1157
|
+
selector: 'amplify-password-field',
|
|
1158
|
+
template: "<label class=\"amplify-label sr-only\" [for]=\"id\">\n {{ label }}\n</label>\n<div class=\"amplify-flex amplify-field-group\">\n <input\n class=\"amplify-input amplify-field-group__control\"\n [id]=\"id\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\n <div class=\"amplify-field-group__outer-end\">\n <button\n amplify-button\n [attr.aria-label]=\"showPasswordButtonlabel\"\n class=\"amplify-field-group__control amplify-field__show-password\"\n (click)=\"togglePasswordText()\"\n >\n <svg\n *ngIf=\"!showPassword\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n class=\"amplify-icon\"\n >\n <path\n d=\"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z\"\n ></path>\n </svg>\n <svg\n *ngIf=\"showPassword\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n class=\"amplify-icon\"\n >\n <path\n d=\"M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z\"\n fill=\"none\"\n ></path>\n <path\n d=\"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z\"\n ></path>\n </svg>\n </button>\n </div>\n</div>\n"
|
|
1159
|
+
},] }
|
|
1160
|
+
];
|
|
1161
|
+
AmplifyPasswordFieldComponent.propDecorators = {
|
|
1162
|
+
autocomplete: [{ type: Input }],
|
|
1163
|
+
disabled: [{ type: Input }],
|
|
1164
|
+
id: [{ type: Input }],
|
|
1165
|
+
initialValue: [{ type: Input }],
|
|
1166
|
+
label: [{ type: Input }],
|
|
1167
|
+
name: [{ type: Input }],
|
|
1168
|
+
placeholder: [{ type: Input }],
|
|
1169
|
+
required: [{ type: Input }]
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
class AmplifySelectComponent {
|
|
1173
|
+
}
|
|
1174
|
+
AmplifySelectComponent.decorators = [
|
|
1175
|
+
{ type: Component, args: [{
|
|
1176
|
+
selector: 'amplify-form-select',
|
|
1177
|
+
template: "<label class=\"amplify-label sr-only\" [for]=\"id\">{{ label }}</label>\n<div class=\"amplify-select__wrapper\">\n <select\n class=\"amplify-select amplify-field-group__control\"\n autocomplete=\"tel-country-code\"\n [id]=\"id\"\n [name]=\"name\"\n >\n <option\n *ngFor=\"let item of items\"\n [value]=\"item\"\n [selected]=\"item === defaultValue\"\n >\n {{ item }}\n </option>\n </select>\n <div\n class=\"amplify-flex amplify-select__icon-wrapper\"\n style=\"align-items: center; justify-content: center\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon\"\n viewBox=\"0 0 24 24\"\n data-size=\"large\"\n fill=\"currentColor\"\n >\n <path d=\"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z\"></path>\n </svg>\n </div>\n</div>\n"
|
|
1178
|
+
},] }
|
|
1179
|
+
];
|
|
1180
|
+
AmplifySelectComponent.propDecorators = {
|
|
1181
|
+
items: [{ type: Input }],
|
|
1182
|
+
name: [{ type: Input }],
|
|
1183
|
+
label: [{ type: Input }],
|
|
1184
|
+
id: [{ type: Input }],
|
|
1185
|
+
defaultValue: [{ type: Input }]
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
class TabItemComponent {
|
|
1189
|
+
constructor() {
|
|
1190
|
+
this.active = false;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
TabItemComponent.decorators = [
|
|
1194
|
+
{ type: Component, args: [{
|
|
1195
|
+
selector: 'amplify-tab-item',
|
|
1196
|
+
template: "<div\n data-orientation=\"horizontal\"\n role=\"tabpanel\"\n [id]=\"id\"\n [attr.aria-labelledby]=\"labelledById\"\n [attr.data-state]=\"active ? 'active' : 'inactive'\"\n [attr.tabindex]=\"tabIndex\"\n>\n <ng-content *ngIf=\"active\"></ng-content>\n</div>\n"
|
|
1197
|
+
},] }
|
|
1198
|
+
];
|
|
1199
|
+
TabItemComponent.propDecorators = {
|
|
1200
|
+
title: [{ type: Input }],
|
|
1201
|
+
active: [{ type: Input }],
|
|
1202
|
+
id: [{ type: Input }],
|
|
1203
|
+
labelledById: [{ type: Input }],
|
|
1204
|
+
tabIndex: [{ type: Input }]
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
class TabsComponent {
|
|
1208
|
+
constructor() {
|
|
1209
|
+
this.tabChange = new EventEmitter();
|
|
1210
|
+
}
|
|
1211
|
+
ngAfterContentInit() {
|
|
1212
|
+
// assign ids
|
|
1213
|
+
this.tabs.forEach((tab, index) => {
|
|
1214
|
+
tab.id = `radix-id-${nanoid(12)}-1-content-${index}`;
|
|
1215
|
+
tab.labelledById = `radix-id-${nanoid(12)}-1-trigger-${index}`;
|
|
1216
|
+
});
|
|
1217
|
+
// find active tab
|
|
1218
|
+
// TODO(enhancement): more declarative way for choosing the initial tab to render
|
|
1219
|
+
const activeTabs = this.tabs.filter((tab) => tab.active);
|
|
1220
|
+
// set active tab
|
|
1221
|
+
if (activeTabs.length !== 1) {
|
|
1222
|
+
this.selectTab(this.tabs.first);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
selectTab(tab) {
|
|
1226
|
+
this.tabs.forEach((tab) => {
|
|
1227
|
+
tab.active = false;
|
|
1228
|
+
});
|
|
1229
|
+
tab.active = true;
|
|
1230
|
+
}
|
|
1231
|
+
handleTabClick(tab) {
|
|
1232
|
+
if (tab.active)
|
|
1233
|
+
return; // don't do anything if clicks the current active tab
|
|
1234
|
+
this.tabChange.emit();
|
|
1235
|
+
this.selectTab(tab);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
TabsComponent.decorators = [
|
|
1239
|
+
{ type: Component, args: [{
|
|
1240
|
+
selector: 'amplify-tabs',
|
|
1241
|
+
template: "<div\n tabindex=\"0\"\n aria-orientation=\"horizontal\"\n data-orientation=\"horizontal\"\n role=\"tablist\"\n style=\"outline: none\"\n>\n <div\n class=\"amplify-flex amplify-tabs\"\n data-indicator-position=\"top\"\n style=\"gap: 0px; justify-content: center\"\n >\n <div\n *ngFor=\"let tab of tabs\"\n class=\"amplify-tabs-item\"\n data-grow=\"equal\"\n data-orientation=\"horizontal\"\n role=\"tab\"\n [id]=\"tab.labelledById\"\n [tabindex]=\"tab.active ? '0' : '1'\"\n [attr.aria-selected]=\"tab.active\"\n [attr.aria-controls]=\"tab.id\"\n [attr.data-state]=\"tab.active ? 'active' : 'inactive'\"\n (click)=\"handleTabClick(tab)\"\n >\n {{ tab.title }}\n </div>\n </div>\n</div>\n\n<ng-content></ng-content>\n"
|
|
1242
|
+
},] }
|
|
1243
|
+
];
|
|
1244
|
+
TabsComponent.propDecorators = {
|
|
1245
|
+
tabs: [{ type: ContentChildren, args: [TabItemComponent,] }],
|
|
1246
|
+
tabChange: [{ type: Output }]
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
class AmplifyTextFieldComponent {
|
|
1250
|
+
constructor() {
|
|
1251
|
+
this.autocomplete = 'new-password';
|
|
1252
|
+
this.disabled = false;
|
|
1253
|
+
this.initialValue = '';
|
|
1254
|
+
this.label = '';
|
|
1255
|
+
this.placeholder = '';
|
|
1256
|
+
this.required = true;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
AmplifyTextFieldComponent.decorators = [
|
|
1260
|
+
{ type: Component, args: [{
|
|
1261
|
+
selector: 'amplify-text-field',
|
|
1262
|
+
template: "<label class=\"amplify-label sr-only\" [for]=\"id\">\n {{ label }}\n</label>\n<input\n class=\"amplify-input\"\n [id]=\"id\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n/>\n"
|
|
1263
|
+
},] }
|
|
1264
|
+
];
|
|
1265
|
+
AmplifyTextFieldComponent.propDecorators = {
|
|
1266
|
+
autocomplete: [{ type: Input }],
|
|
1267
|
+
disabled: [{ type: Input }],
|
|
1268
|
+
id: [{ type: Input }],
|
|
1269
|
+
initialValue: [{ type: Input }],
|
|
1270
|
+
label: [{ type: Input }],
|
|
1271
|
+
name: [{ type: Input }],
|
|
1272
|
+
placeholder: [{ type: Input }],
|
|
1273
|
+
required: [{ type: Input }],
|
|
1274
|
+
type: [{ type: Input }]
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
class AmplifyUserNameAliasComponent {
|
|
1278
|
+
constructor(stateMachine) {
|
|
1279
|
+
this.stateMachine = stateMachine;
|
|
1280
|
+
this.name = 'username';
|
|
1281
|
+
this.disabled = false;
|
|
1282
|
+
this.initialValue = '';
|
|
1283
|
+
this.required = true;
|
|
1284
|
+
}
|
|
1285
|
+
ngOnInit() {
|
|
1286
|
+
const context = this.stateMachine.context;
|
|
1287
|
+
const { label, type } = getAliasInfoFromContext(context);
|
|
1288
|
+
this.label = label;
|
|
1289
|
+
this.type = type;
|
|
1290
|
+
this.placeholder = label;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
AmplifyUserNameAliasComponent.decorators = [
|
|
1294
|
+
{ type: Component, args: [{
|
|
1295
|
+
selector: 'amplify-user-name-alias',
|
|
1296
|
+
template: "<amplify-form-field\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-field>\n"
|
|
1297
|
+
},] }
|
|
1298
|
+
];
|
|
1299
|
+
AmplifyUserNameAliasComponent.ctorParameters = () => [
|
|
1300
|
+
{ type: StateMachineService }
|
|
1301
|
+
];
|
|
1302
|
+
AmplifyUserNameAliasComponent.propDecorators = {
|
|
1303
|
+
name: [{ type: Input }],
|
|
1304
|
+
disabled: [{ type: Input }],
|
|
1305
|
+
initialValue: [{ type: Input }],
|
|
1306
|
+
required: [{ type: Input }]
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1064
1309
|
const proxyInputs = (Cmp, inputs) => {
|
|
1065
1310
|
const Prototype = Cmp.prototype;
|
|
1066
1311
|
inputs.forEach((item) => {
|
|
@@ -2846,6 +3091,37 @@ AmplifyVerifyContact = __decorate([
|
|
|
2846
3091
|
ProxyCmp({ inputs: ['handleAuthStateChange', 'user'] })
|
|
2847
3092
|
], AmplifyVerifyContact);
|
|
2848
3093
|
|
|
3094
|
+
class PhoneNumberFieldComponent {
|
|
3095
|
+
constructor() {
|
|
3096
|
+
this.autocomplete = 'new-password';
|
|
3097
|
+
this.disabled = false;
|
|
3098
|
+
this.initialValue = '';
|
|
3099
|
+
this.label = '';
|
|
3100
|
+
this.placeholder = '';
|
|
3101
|
+
this.required = true;
|
|
3102
|
+
this.countryDialCodes = countryDialCodes;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
PhoneNumberFieldComponent.decorators = [
|
|
3106
|
+
{ type: Component, args: [{
|
|
3107
|
+
selector: 'amplify-phone-number-field',
|
|
3108
|
+
template: "<div\n class=\"amplify-flex amplify-phonenumberfield\"\n amplify-field-group\n style=\"gap: 0px\"\n>\n <div class=\"amplify-field-group__outer-start\">\n <div\n class=\" amplify-flex amplify-field amplify-selectfield amplify-countrycodeselect\"\n style=\"flex-direction: column\"\n >\n <amplify-form-select\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"selectFieldId\"\n [items]=\"countryDialCodes\"\n [defaultValue]=\"defaultCountryCode\"\n ></amplify-form-select>\n </div>\n </div>\n\n <label class=\"sr-only amplify-label\" [for]=\"textFieldId\">\n {{ label }}\n </label>\n <input\n class=\"amplify-input\"\n [id]=\"textFieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\n</div>\n"
|
|
3109
|
+
},] }
|
|
3110
|
+
];
|
|
3111
|
+
PhoneNumberFieldComponent.propDecorators = {
|
|
3112
|
+
autocomplete: [{ type: Input }],
|
|
3113
|
+
disabled: [{ type: Input }],
|
|
3114
|
+
defaultCountryCode: [{ type: Input }],
|
|
3115
|
+
selectFieldId: [{ type: Input }],
|
|
3116
|
+
textFieldId: [{ type: Input }],
|
|
3117
|
+
initialValue: [{ type: Input }],
|
|
3118
|
+
label: [{ type: Input }],
|
|
3119
|
+
name: [{ type: Input }],
|
|
3120
|
+
placeholder: [{ type: Input }],
|
|
3121
|
+
required: [{ type: Input }],
|
|
3122
|
+
type: [{ type: Input }]
|
|
3123
|
+
};
|
|
3124
|
+
|
|
2849
3125
|
customElements.define('amplify-button', AmplifyButton$1);
|
|
2850
3126
|
customElements.define('amplify-input', AmplifyInput$1);
|
|
2851
3127
|
customElements.define('amplify-toast', AmplifyToast$1);
|
|
@@ -2875,11 +3151,10 @@ UiAngularModule.decorators = [
|
|
|
2875
3151
|
AmplifyPhotoPicker,
|
|
2876
3152
|
AmplifyAuthenticatorComponent,
|
|
2877
3153
|
AmplifySignInComponent,
|
|
2878
|
-
AmplifySignOutComponent,
|
|
2879
3154
|
AmplifySignUpComponent,
|
|
2880
|
-
|
|
3155
|
+
AmplifyFormFieldComponent,
|
|
2881
3156
|
AmplifyErrorComponent,
|
|
2882
|
-
|
|
3157
|
+
AmplifySlotDirective,
|
|
2883
3158
|
AmplifyConfirmSignUpComponent,
|
|
2884
3159
|
AmplifyUserNameAliasComponent,
|
|
2885
3160
|
AmplifyConfirmSignInComponent,
|
|
@@ -2891,8 +3166,15 @@ UiAngularModule.decorators = [
|
|
|
2891
3166
|
AmplifyVerifyUserComponent,
|
|
2892
3167
|
ConfirmResetPasswordComponent,
|
|
2893
3168
|
ConfirmVerifyUserComponent,
|
|
3169
|
+
AmplifySelectComponent,
|
|
3170
|
+
AmplifyButtonComponent,
|
|
3171
|
+
AmplifyPasswordFieldComponent,
|
|
3172
|
+
AmplifyTextFieldComponent,
|
|
3173
|
+
TabsComponent,
|
|
3174
|
+
TabItemComponent,
|
|
3175
|
+
PhoneNumberFieldComponent,
|
|
2894
3176
|
],
|
|
2895
|
-
imports: [CommonModule
|
|
3177
|
+
imports: [CommonModule],
|
|
2896
3178
|
exports: [
|
|
2897
3179
|
AmplifyChatbot,
|
|
2898
3180
|
AmplifyToast,
|
|
@@ -2907,10 +3189,9 @@ UiAngularModule.decorators = [
|
|
|
2907
3189
|
AmplifyPhotoPicker,
|
|
2908
3190
|
AmplifyAuthenticatorComponent,
|
|
2909
3191
|
AmplifySignInComponent,
|
|
2910
|
-
|
|
2911
|
-
AmplifyInputComponent,
|
|
3192
|
+
AmplifyFormFieldComponent,
|
|
2912
3193
|
AmplifyErrorComponent,
|
|
2913
|
-
|
|
3194
|
+
AmplifySlotDirective,
|
|
2914
3195
|
],
|
|
2915
3196
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
2916
3197
|
},] }
|
|
@@ -2924,5 +3205,5 @@ UiAngularModule.decorators = [
|
|
|
2924
3205
|
* Generated bundle index. Do not edit.
|
|
2925
3206
|
*/
|
|
2926
3207
|
|
|
2927
|
-
export { AmplifyAuthenticatorComponent, AmplifyButton, AmplifyChatbot, AmplifyConfirmSignUpComponent, AmplifyErrorComponent,
|
|
3208
|
+
export { AmplifyAuthenticatorComponent, AmplifyButton, AmplifyChatbot, AmplifyConfirmSignInComponent, AmplifyConfirmSignUpComponent, AmplifyErrorComponent, AmplifyFederatedSignInButtonComponent, AmplifyFederatedSignInComponent, AmplifyForceNewPasswordComponent, AmplifyFormFieldComponent, AmplifyInput, AmplifyPhotoPicker, AmplifyPicker, AmplifyResetPasswordComponent, AmplifyS3Album, AmplifyS3Image, AmplifyS3ImagePicker, AmplifyS3Text, AmplifyS3TextPicker, AmplifySetupTotpComponent, AmplifySignInComponent, AmplifySignUpComponent, AmplifySlotDirective, AmplifyToast, AmplifyVerifyUserComponent, AuthPropService, ConfirmResetPasswordComponent, ConfirmVerifyUserComponent, StateMachineService, UiAngularModule, getAttributeMap, ProxyCmp as ɵa, AmplifyAuthenticatorComponent as ɵb, AmplifySignInComponent as ɵc, AmplifySignUpComponent as ɵd, AmplifyFormFieldComponent 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, AmplifyButtonComponent as ɵs, AmplifyPasswordFieldComponent as ɵt, AmplifyTextFieldComponent as ɵu, TabsComponent as ɵv, TabItemComponent as ɵw, PhoneNumberFieldComponent as ɵx };
|
|
2928
3209
|
//# sourceMappingURL=aws-amplify-ui-angular.js.map
|