@aws-amplify/ui-angular 1.0.34-unstable.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/aws-amplify-ui-angular.d.ts +30 -0
- package/aws-amplify-ui-angular.metadata.json +1 -0
- package/bundles/aws-amplify-ui-angular-legacy.umd.js +2229 -0
- package/bundles/aws-amplify-ui-angular-legacy.umd.js.map +1 -0
- package/bundles/aws-amplify-ui-angular-legacy.umd.min.js +16 -0
- package/bundles/aws-amplify-ui-angular-legacy.umd.min.js.map +1 -0
- package/bundles/aws-amplify-ui-angular.umd.js +1840 -0
- package/bundles/aws-amplify-ui-angular.umd.js.map +1 -0
- package/bundles/aws-amplify-ui-angular.umd.min.js +2 -0
- package/bundles/aws-amplify-ui-angular.umd.min.js.map +1 -0
- package/esm2015/aws-amplify-ui-angular.js +31 -0
- package/esm2015/index.js +26 -0
- package/esm2015/legacy/aws-amplify-ui-angular-legacy.js +6 -0
- package/esm2015/legacy/index.js +3 -0
- package/esm2015/legacy/legacy-ui-angular.module.js +53 -0
- package/esm2015/legacy/proxies.js +1839 -0
- package/esm2015/lib/common/helpers.js +3 -0
- package/esm2015/lib/common/index.js +3 -0
- package/esm2015/lib/common/types/auth-types.js +2 -0
- package/esm2015/lib/common/types/component-types.js +2 -0
- package/esm2015/lib/common/types/index.js +3 -0
- package/esm2015/lib/components/authenticator/authenticator.module.js +79 -0
- package/esm2015/lib/components/authenticator/components/authenticator/authenticator.component.js +87 -0
- package/esm2015/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.js +40 -0
- package/esm2015/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.js +57 -0
- package/esm2015/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.js +39 -0
- package/esm2015/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.js +39 -0
- package/esm2015/lib/components/authenticator/components/federated-sign-in/federated-sign-in.component.js +47 -0
- package/esm2015/lib/components/authenticator/components/federated-sign-in-button/federated-sign-in-button.component.js +27 -0
- package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password.component.js +39 -0
- package/esm2015/lib/components/authenticator/components/form-field/form-field.component.js +93 -0
- package/esm2015/lib/components/authenticator/components/index.js +17 -0
- package/esm2015/lib/components/authenticator/components/reset-password/reset-password.component.js +45 -0
- package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +65 -0
- package/esm2015/lib/components/authenticator/components/sign-in/sign-in.component.js +38 -0
- package/esm2015/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.js +34 -0
- package/esm2015/lib/components/authenticator/components/sign-up/sign-up.component.js +37 -0
- package/esm2015/lib/components/authenticator/components/user-name-alias/user-name-alias.component.js +35 -0
- package/esm2015/lib/components/authenticator/components/verify-user/verify-user.component.js +54 -0
- package/esm2015/lib/primitives/button/button.component.js +38 -0
- package/esm2015/lib/primitives/checkbox/checkbox.component.js +31 -0
- package/esm2015/lib/primitives/error/error.component.js +16 -0
- package/esm2015/lib/primitives/index.js +10 -0
- package/esm2015/lib/primitives/password-field/password-field.component.js +43 -0
- package/esm2015/lib/primitives/phone-number-field/phone-number-field.component.js +40 -0
- package/esm2015/lib/primitives/select/select.component.js +17 -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/primitives/text-field/text-field.component.js +35 -0
- package/esm2015/lib/services/authenticator.service.js +133 -0
- package/esm2015/lib/services/custom-components.service.js +23 -0
- package/esm2015/lib/utilities/amplify-slot/amplify-slot.component.js +32 -0
- package/esm2015/lib/utilities/amplify-slot/amplify-slot.directive.js +21 -0
- package/fesm2015/aws-amplify-ui-angular-legacy.js +1846 -0
- package/fesm2015/aws-amplify-ui-angular-legacy.js.map +1 -0
- package/fesm2015/aws-amplify-ui-angular.js +1253 -0
- package/fesm2015/aws-amplify-ui-angular.js.map +1 -0
- package/index.d.ts +22 -0
- package/{dist/core.d.ts → legacy/aws-amplify-ui-angular-legacy.d.ts} +1 -0
- package/legacy/aws-amplify-ui-angular-legacy.metadata.json +1 -0
- package/legacy/index.d.ts +2 -0
- package/legacy/legacy-ui-angular.module.d.ts +2 -0
- package/legacy/package.json +11 -0
- package/{dist/directives → legacy}/proxies.d.ts +0 -0
- package/lib/common/helpers.d.ts +2 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/types/auth-types.d.ts +3 -0
- package/lib/common/types/component-types.d.ts +23 -0
- package/lib/common/types/index.d.ts +2 -0
- package/lib/components/authenticator/authenticator.module.d.ts +2 -0
- package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +67 -0
- package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +50 -0
- package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +52 -0
- package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +49 -0
- package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +49 -0
- package/lib/components/authenticator/components/federated-sign-in/federated-sign-in.component.d.ts +19 -0
- package/lib/components/authenticator/components/federated-sign-in-button/federated-sign-in-button.component.d.ts +9 -0
- package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +49 -0
- package/lib/components/authenticator/components/form-field/form-field.component.d.ts +36 -0
- package/lib/components/authenticator/components/index.d.ts +16 -0
- package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +52 -0
- package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +53 -0
- package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +48 -0
- package/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.d.ts +12 -0
- package/lib/components/authenticator/components/sign-up/sign-up.component.d.ts +47 -0
- package/lib/components/authenticator/components/user-name-alias/user-name-alias.component.d.ts +15 -0
- package/lib/components/authenticator/components/verify-user/verify-user.component.d.ts +54 -0
- package/lib/primitives/button/button.component.d.ts +15 -0
- package/lib/primitives/checkbox/checkbox.component.d.ts +12 -0
- package/lib/primitives/error/error.component.d.ts +4 -0
- package/lib/primitives/index.d.ts +9 -0
- package/lib/primitives/password-field/password-field.component.d.ts +15 -0
- package/lib/primitives/phone-number-field/phone-number-field.component.d.ts +16 -0
- package/lib/primitives/select/select.component.d.ts +7 -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/primitives/text-field/text-field.component.d.ts +13 -0
- package/lib/services/authenticator.service.d.ts +94 -0
- package/lib/services/custom-components.service.d.ts +9 -0
- package/lib/utilities/amplify-slot/amplify-slot.component.d.ts +12 -0
- package/lib/utilities/amplify-slot/amplify-slot.directive.d.ts +7 -0
- package/package.json +29 -49
- package/theme.css +1 -0
- package/CHANGELOG.md +0 -320
- package/dist/amplify-module.d.ts +0 -2
- package/dist/core.metadata.json +0 -1
- package/dist/fesm2015.js +0 -1532
- package/dist/fesm5.js +0 -1319
- package/dist/index.d.ts +0 -2
|
@@ -0,0 +1,1253 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, ContentChildren, HostBinding, EventEmitter, Output, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
5
|
+
import { createAuthenticatorMachine, getServiceContextFacade, getSendEventAliases, translate, getActorContext, AuthChallengeNames, FederatedIdentityProviders, authInputAttributes, countryDialCodes, getAliasInfoFromContext, getActorState } from '@aws-amplify/ui';
|
|
6
|
+
import { Logger } from '@aws-amplify/core';
|
|
7
|
+
import { interpret } from 'xstate';
|
|
8
|
+
import { Logger as Logger$1, Auth } from 'aws-amplify';
|
|
9
|
+
import { __awaiter } from 'tslib';
|
|
10
|
+
import QRCode from 'qrcode';
|
|
11
|
+
import { nanoid } from 'nanoid';
|
|
12
|
+
|
|
13
|
+
class AmplifySlotDirective {
|
|
14
|
+
constructor(template) {
|
|
15
|
+
this.template = template;
|
|
16
|
+
}
|
|
17
|
+
set amplifySlot(component) {
|
|
18
|
+
this.name = component;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
AmplifySlotDirective.decorators = [
|
|
22
|
+
{ type: Directive, args: [{
|
|
23
|
+
selector: '[amplifySlot]',
|
|
24
|
+
},] }
|
|
25
|
+
];
|
|
26
|
+
AmplifySlotDirective.ctorParameters = () => [
|
|
27
|
+
{ type: TemplateRef }
|
|
28
|
+
];
|
|
29
|
+
AmplifySlotDirective.propDecorators = {
|
|
30
|
+
amplifySlot: [{ type: Input }]
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Stores and provides custom components that users provide with `amplify-slot`.
|
|
35
|
+
*/
|
|
36
|
+
class CustomComponentsService {
|
|
37
|
+
constructor() {
|
|
38
|
+
this._customComponents = {};
|
|
39
|
+
}
|
|
40
|
+
get customComponents() {
|
|
41
|
+
return this._customComponents;
|
|
42
|
+
}
|
|
43
|
+
set customComponents(customComponents) {
|
|
44
|
+
this._customComponents = Object.assign(Object.assign({}, this._customComponents), customComponents);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
CustomComponentsService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CustomComponentsService_Factory() { return new CustomComponentsService(); }, token: CustomComponentsService, providedIn: "root" });
|
|
48
|
+
CustomComponentsService.decorators = [
|
|
49
|
+
{ type: Injectable, args: [{
|
|
50
|
+
providedIn: 'root',
|
|
51
|
+
},] }
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const logger$2 = new Logger('state-machine');
|
|
55
|
+
/**
|
|
56
|
+
* AuthenticatorService provides access to the authenticator state and context.
|
|
57
|
+
*/
|
|
58
|
+
class AuthenticatorService {
|
|
59
|
+
startMachine({ initialState, loginMechanisms, services, signUpAttributes, socialProviders, }) {
|
|
60
|
+
const machine = createAuthenticatorMachine({
|
|
61
|
+
initialState,
|
|
62
|
+
loginMechanisms,
|
|
63
|
+
services,
|
|
64
|
+
signUpAttributes,
|
|
65
|
+
socialProviders,
|
|
66
|
+
});
|
|
67
|
+
const authService = interpret(machine, {
|
|
68
|
+
devTools: process.env.NODE_ENV === 'development',
|
|
69
|
+
}).start();
|
|
70
|
+
this._subscription = authService.subscribe((state) => {
|
|
71
|
+
this._authState = state;
|
|
72
|
+
this._facade = getServiceContextFacade(state);
|
|
73
|
+
});
|
|
74
|
+
this._sendEventAliases = getSendEventAliases(authService.send);
|
|
75
|
+
this._authService = authService;
|
|
76
|
+
}
|
|
77
|
+
ngOnDestroy() {
|
|
78
|
+
if (this._subscription)
|
|
79
|
+
this._subscription.unsubscribe();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Context facades
|
|
83
|
+
*/
|
|
84
|
+
get error() {
|
|
85
|
+
var _a;
|
|
86
|
+
return (_a = this._facade) === null || _a === void 0 ? void 0 : _a.error;
|
|
87
|
+
}
|
|
88
|
+
get hasValidationErrors() {
|
|
89
|
+
var _a;
|
|
90
|
+
return (_a = this._facade) === null || _a === void 0 ? void 0 : _a.hasValidationErrors;
|
|
91
|
+
}
|
|
92
|
+
get isPending() {
|
|
93
|
+
var _a;
|
|
94
|
+
return (_a = this._facade) === null || _a === void 0 ? void 0 : _a.isPending;
|
|
95
|
+
}
|
|
96
|
+
get route() {
|
|
97
|
+
var _a;
|
|
98
|
+
return (_a = this._facade) === null || _a === void 0 ? void 0 : _a.route;
|
|
99
|
+
}
|
|
100
|
+
get user() {
|
|
101
|
+
var _a;
|
|
102
|
+
return (_a = this._facade) === null || _a === void 0 ? void 0 : _a.user;
|
|
103
|
+
}
|
|
104
|
+
get validationErrors() {
|
|
105
|
+
var _a;
|
|
106
|
+
return (_a = this._facade) === null || _a === void 0 ? void 0 : _a.validationErrors;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Service facades
|
|
110
|
+
*/
|
|
111
|
+
get updateForm() {
|
|
112
|
+
return this._sendEventAliases.updateForm;
|
|
113
|
+
}
|
|
114
|
+
get resendCode() {
|
|
115
|
+
return this._sendEventAliases.resendCode;
|
|
116
|
+
}
|
|
117
|
+
get signOut() {
|
|
118
|
+
return this._sendEventAliases.signOut;
|
|
119
|
+
}
|
|
120
|
+
get submitForm() {
|
|
121
|
+
return this._sendEventAliases.submitForm;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Transition facades
|
|
125
|
+
*/
|
|
126
|
+
get toFederatedSignIn() {
|
|
127
|
+
return this._sendEventAliases.toFederatedSignIn;
|
|
128
|
+
}
|
|
129
|
+
get toResetPassword() {
|
|
130
|
+
return this._sendEventAliases.toResetPassword;
|
|
131
|
+
}
|
|
132
|
+
get toSignIn() {
|
|
133
|
+
return this._sendEventAliases.toSignIn;
|
|
134
|
+
}
|
|
135
|
+
get toSignUp() {
|
|
136
|
+
return this._sendEventAliases.toSignUp;
|
|
137
|
+
}
|
|
138
|
+
get skipVerification() {
|
|
139
|
+
return this._sendEventAliases.skipVerification;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Internal utility functions
|
|
143
|
+
*/
|
|
144
|
+
/** @deprecated For internal use only */
|
|
145
|
+
get authState() {
|
|
146
|
+
return this._authState;
|
|
147
|
+
}
|
|
148
|
+
/** @deprecated For internal use only */
|
|
149
|
+
get authService() {
|
|
150
|
+
return this._authService;
|
|
151
|
+
}
|
|
152
|
+
/** @deprecated For internal use only */
|
|
153
|
+
get context() {
|
|
154
|
+
return this._authState.context;
|
|
155
|
+
}
|
|
156
|
+
/** @deprecated For internal use only */
|
|
157
|
+
get slotContext() {
|
|
158
|
+
const slotContext = Object.assign(Object.assign({}, this._facade), this._sendEventAliases);
|
|
159
|
+
return Object.assign(Object.assign({}, slotContext), { $implicit: Object.assign({}, slotContext) });
|
|
160
|
+
}
|
|
161
|
+
/** @deprecated For internal use only */
|
|
162
|
+
subscribe(callback) {
|
|
163
|
+
if (this._authService) {
|
|
164
|
+
return this._authService.subscribe(callback);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
logger$2.error('Subscription attempted before machine was created. This is likely a bug on the library, please consider filing a bug.');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** @deprecated For internal use only */
|
|
171
|
+
send(event) {
|
|
172
|
+
this.authService.send(event);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
AuthenticatorService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AuthenticatorService_Factory() { return new AuthenticatorService(); }, token: AuthenticatorService, providedIn: "root" });
|
|
176
|
+
AuthenticatorService.decorators = [
|
|
177
|
+
{ type: Injectable, args: [{
|
|
178
|
+
providedIn: 'root',
|
|
179
|
+
},] }
|
|
180
|
+
];
|
|
181
|
+
|
|
182
|
+
class AuthenticatorComponent {
|
|
183
|
+
constructor(authenticator, contextService) {
|
|
184
|
+
this.authenticator = authenticator;
|
|
185
|
+
this.contextService = contextService;
|
|
186
|
+
this.customComponentQuery = null;
|
|
187
|
+
// translated texts
|
|
188
|
+
this.signInTitle = translate('Sign In');
|
|
189
|
+
this.signUpTitle = translate('Create Account');
|
|
190
|
+
}
|
|
191
|
+
ngOnInit() {
|
|
192
|
+
const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, } = this;
|
|
193
|
+
this.authenticator.startMachine({
|
|
194
|
+
initialState,
|
|
195
|
+
loginMechanisms,
|
|
196
|
+
services,
|
|
197
|
+
signUpAttributes,
|
|
198
|
+
socialProviders,
|
|
199
|
+
});
|
|
200
|
+
/**
|
|
201
|
+
* handling translations after content init, because authenticator and its
|
|
202
|
+
* translations might be initialized before the main app's `ngOnInit` is run.
|
|
203
|
+
*/
|
|
204
|
+
this.signInTitle = translate('Sign In');
|
|
205
|
+
this.signUpTitle = translate('Create Account');
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Lifecycle Methods
|
|
209
|
+
*/
|
|
210
|
+
ngAfterContentInit() {
|
|
211
|
+
this.contextService.customComponents = this.mapCustomComponents(this.customComponentQuery);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Class Functions
|
|
215
|
+
*/
|
|
216
|
+
// context passed to "authenticated" slot
|
|
217
|
+
get context() {
|
|
218
|
+
return this.authenticator.slotContext;
|
|
219
|
+
}
|
|
220
|
+
get route() {
|
|
221
|
+
return this.authenticator.route;
|
|
222
|
+
}
|
|
223
|
+
onTabChange() {
|
|
224
|
+
const route = this.authenticator.route;
|
|
225
|
+
if (route === 'signIn') {
|
|
226
|
+
this.authenticator.toSignUp();
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
this.authenticator.toSignIn();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
mapCustomComponents(componentQuery) {
|
|
233
|
+
if (!componentQuery)
|
|
234
|
+
return {};
|
|
235
|
+
const customComponents = {};
|
|
236
|
+
componentQuery.forEach((component) => {
|
|
237
|
+
customComponents[component.name] = component.template;
|
|
238
|
+
});
|
|
239
|
+
return customComponents;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
AuthenticatorComponent.decorators = [
|
|
243
|
+
{ type: Component, args: [{
|
|
244
|
+
selector: 'amplify-authenticator',
|
|
245
|
+
template: "<div data-amplify-authenticator [attr.data-variation]=\"variation\">\n <div data-amplify-container>\n <amplify-slot name=\"header\" [context]=\"context\"></amplify-slot>\n <div data-amplify-router>\n <amplify-tabs\n (tabChange)=\"onTabChange()\"\n *ngIf=\"route === 'signIn' || route === 'signUp'\"\n >\n <amplify-tab-item [title]=\"signInTitle\" [active]=\"route === 'signIn'\">\n <!-- signIn component -->\n <amplify-slot\n name=\"sign-in\"\n [context]=\"context\"\n *ngIf=\"route === 'signIn'\"\n >\n <amplify-sign-in></amplify-sign-in>\n </amplify-slot>\n </amplify-tab-item>\n <amplify-tab-item [title]=\"signUpTitle\" [active]=\"route === 'signUp'\">\n <!-- signUp component -->\n <amplify-slot\n name=\"sign-up\"\n [context]=\"context\"\n *ngIf=\"route === 'signUp'\"\n >\n <amplify-sign-up></amplify-sign-up>\n </amplify-slot>\n </amplify-tab-item>\n </amplify-tabs>\n\n <!-- confirmSignUp content -->\n <amplify-slot\n name=\"confirm-sign-up\"\n [context]=\"context\"\n *ngIf=\"route === 'confirmSignUp'\"\n >\n <amplify-confirm-sign-up></amplify-confirm-sign-up>\n </amplify-slot>\n\n <!-- confirmSignIn content -->\n <amplify-slot\n name=\"confirm-sign-in\"\n [context]=\"context\"\n *ngIf=\"route === 'confirmSignIn'\"\n >\n <amplify-confirm-sign-in></amplify-confirm-sign-in>\n </amplify-slot>\n\n <!-- setupTotp content -->\n <amplify-slot\n name=\"setup-totp\"\n [context]=\"context\"\n *ngIf=\"route === 'setupTOTP'\"\n >\n <amplify-setup-totp></amplify-setup-totp>\n </amplify-slot>\n\n <!-- forceNewPassword content -->\n <amplify-slot\n name=\"force-new-password\"\n [context]=\"context\"\n *ngIf=\"route === 'forceNewPassword'\"\n >\n <amplify-force-new-password></amplify-force-new-password>\n </amplify-slot>\n\n <!-- resetPassword content -->\n <amplify-slot\n name=\"reset-password\"\n [context]=\"context\"\n *ngIf=\"route === 'resetPassword'\"\n >\n <amplify-reset-password></amplify-reset-password>\n </amplify-slot>\n\n <!-- confirmResetPassword content -->\n <amplify-slot\n name=\"confirm-reset-password\"\n [context]=\"context\"\n *ngIf=\"route === 'confirmResetPassword'\"\n >\n <amplify-confirm-reset-password></amplify-confirm-reset-password>\n </amplify-slot>\n\n <!-- verifyUser content -->\n <amplify-slot\n name=\"verify-user\"\n [context]=\"context\"\n *ngIf=\"route === 'verifyUser'\"\n >\n <amplify-verify-user></amplify-verify-user>\n </amplify-slot>\n\n <!-- confirmVerifyUser content -->\n <amplify-slot\n name=\"confirm-verify-user\"\n [context]=\"context\"\n *ngIf=\"route === 'confirmVerifyUser'\"\n >\n <amplify-confirm-verify-user></amplify-confirm-verify-user>\n </amplify-slot>\n </div>\n\n <amplify-slot name=\"footer\" [context]=\"context\"></amplify-slot>\n </div>\n</div>\n\n<!-- signedIn content is rendered outside authenticator so it's not styled by authenticator -->\n<amplify-slot\n name=\"authenticated\"\n [context]=\"context\"\n *ngIf=\"route === 'authenticated'\"\n>\n <ng-content></ng-content>\n</amplify-slot>\n",
|
|
246
|
+
providers: [CustomComponentsService],
|
|
247
|
+
encapsulation: ViewEncapsulation.None
|
|
248
|
+
},] }
|
|
249
|
+
];
|
|
250
|
+
AuthenticatorComponent.ctorParameters = () => [
|
|
251
|
+
{ type: AuthenticatorService },
|
|
252
|
+
{ type: CustomComponentsService }
|
|
253
|
+
];
|
|
254
|
+
AuthenticatorComponent.propDecorators = {
|
|
255
|
+
initialState: [{ type: Input }],
|
|
256
|
+
loginMechanisms: [{ type: Input }],
|
|
257
|
+
services: [{ type: Input }],
|
|
258
|
+
signUpAttributes: [{ type: Input }],
|
|
259
|
+
socialProviders: [{ type: Input }],
|
|
260
|
+
variation: [{ type: Input }],
|
|
261
|
+
customComponentQuery: [{ type: ContentChildren, args: [AmplifySlotDirective,] }]
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
class ConfirmResetPasswordComponent {
|
|
265
|
+
constructor(authenticator) {
|
|
266
|
+
this.authenticator = authenticator;
|
|
267
|
+
this.dataAttr = '';
|
|
268
|
+
this.headerText = translate('Reset your password');
|
|
269
|
+
// translated strings
|
|
270
|
+
this.sendCodeText = translate('Send Code');
|
|
271
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
272
|
+
this.resendCodeText = translate('Resend Code');
|
|
273
|
+
}
|
|
274
|
+
get context() {
|
|
275
|
+
return this.authenticator.slotContext;
|
|
276
|
+
}
|
|
277
|
+
onInput(event) {
|
|
278
|
+
event.preventDefault();
|
|
279
|
+
const { name, value } = event.target;
|
|
280
|
+
this.authenticator.updateForm({ name, value });
|
|
281
|
+
}
|
|
282
|
+
onSubmit(event) {
|
|
283
|
+
event.preventDefault();
|
|
284
|
+
this.authenticator.submitForm();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
ConfirmResetPasswordComponent.decorators = [
|
|
288
|
+
{ type: Component, args: [{
|
|
289
|
+
selector: 'amplify-confirm-reset-password',
|
|
290
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-reset-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <amplify-form-field\n name=\"password\"\n label=\"New password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n type=\"button\"\n (click)=\"authenticator.resendCode()\"\n >\n {{ resendCodeText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"confirm-reset-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
|
|
291
|
+
},] }
|
|
292
|
+
];
|
|
293
|
+
ConfirmResetPasswordComponent.ctorParameters = () => [
|
|
294
|
+
{ type: AuthenticatorService }
|
|
295
|
+
];
|
|
296
|
+
ConfirmResetPasswordComponent.propDecorators = {
|
|
297
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignin',] }],
|
|
298
|
+
headerText: [{ type: Input }]
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const logger$1 = new Logger$1('ConfirmSignIn');
|
|
302
|
+
class ConfirmSignInComponent {
|
|
303
|
+
constructor(authenticator) {
|
|
304
|
+
this.authenticator = authenticator;
|
|
305
|
+
this.dataAttr = '';
|
|
306
|
+
this.confirmText = translate('Confirm');
|
|
307
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
308
|
+
}
|
|
309
|
+
ngOnInit() {
|
|
310
|
+
this.setHeaderText();
|
|
311
|
+
}
|
|
312
|
+
get context() {
|
|
313
|
+
return this.authenticator.slotContext;
|
|
314
|
+
}
|
|
315
|
+
setHeaderText() {
|
|
316
|
+
const state = this.authenticator.authState;
|
|
317
|
+
const actorContext = getActorContext(state);
|
|
318
|
+
const { challengeName } = actorContext;
|
|
319
|
+
switch (challengeName) {
|
|
320
|
+
case AuthChallengeNames.SOFTWARE_TOKEN_MFA:
|
|
321
|
+
this.headerText = translate('Confirm TOTP Code');
|
|
322
|
+
break;
|
|
323
|
+
case AuthChallengeNames.SMS_MFA:
|
|
324
|
+
this.headerText = translate('Confirm SMS Code');
|
|
325
|
+
break;
|
|
326
|
+
default:
|
|
327
|
+
logger$1.error('Unexpected challengeName', challengeName);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
onInput(event) {
|
|
331
|
+
event.preventDefault();
|
|
332
|
+
const { name, value } = event.target;
|
|
333
|
+
this.authenticator.updateForm({ name, value });
|
|
334
|
+
}
|
|
335
|
+
onSubmit(event) {
|
|
336
|
+
event.preventDefault();
|
|
337
|
+
this.authenticator.submitForm();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
ConfirmSignInComponent.decorators = [
|
|
341
|
+
{ type: Component, args: [{
|
|
342
|
+
selector: 'amplify-confirm-sign-in',
|
|
343
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-sign-in-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot\n name=\"confirm-sign-in-footer\"\n [context]=\"context\"\n ></amplify-slot>\n </form>\n</div>\n"
|
|
344
|
+
},] }
|
|
345
|
+
];
|
|
346
|
+
ConfirmSignInComponent.ctorParameters = () => [
|
|
347
|
+
{ type: AuthenticatorService }
|
|
348
|
+
];
|
|
349
|
+
ConfirmSignInComponent.propDecorators = {
|
|
350
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignin',] }]
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
class ConfirmSignUpComponent {
|
|
354
|
+
constructor(authenticator) {
|
|
355
|
+
this.authenticator = authenticator;
|
|
356
|
+
this.headerText = translate('Confirm Sign Up');
|
|
357
|
+
this.dataAttr = '';
|
|
358
|
+
// translated texts
|
|
359
|
+
this.resendCodeText = translate('Resend Code');
|
|
360
|
+
this.confirmText = translate('Confirm');
|
|
361
|
+
}
|
|
362
|
+
get context() {
|
|
363
|
+
return this.authenticator.slotContext;
|
|
364
|
+
}
|
|
365
|
+
onInput(event) {
|
|
366
|
+
event.preventDefault();
|
|
367
|
+
const { name, value } = event.target;
|
|
368
|
+
this.authenticator.updateForm({ name, value });
|
|
369
|
+
}
|
|
370
|
+
onSubmit(event) {
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
this.authenticator.submitForm();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
ConfirmSignUpComponent.decorators = [
|
|
376
|
+
{ type: Component, args: [{
|
|
377
|
+
selector: 'amplify-confirm-sign-up',
|
|
378
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"context.isPending\"\n >\n <amplify-slot name=\"confirm-sign-up-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n fontWeight=\"normal\"\n (click)=\"authenticator.resendCode()\"\n >\n {{ resendCodeText }}\n </button>\n </fieldset>\n\n <amplify-error *ngIf=\"context.error\">\n {{ authenticator.error }}\n </amplify-error>\n <amplify-slot\n name=\"confirm-sign-up-footer\"\n [context]=\"context\"\n ></amplify-slot>\n </form>\n</div>\n"
|
|
379
|
+
},] }
|
|
380
|
+
];
|
|
381
|
+
ConfirmSignUpComponent.ctorParameters = () => [
|
|
382
|
+
{ type: AuthenticatorService }
|
|
383
|
+
];
|
|
384
|
+
ConfirmSignUpComponent.propDecorators = {
|
|
385
|
+
headerText: [{ type: Input }],
|
|
386
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignup',] }]
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
class ConfirmVerifyUserComponent {
|
|
390
|
+
constructor(authenticator) {
|
|
391
|
+
this.authenticator = authenticator;
|
|
392
|
+
this.dataAttr = '';
|
|
393
|
+
this.headerText = translate('Account recovery requires verified contact information');
|
|
394
|
+
// translated texts
|
|
395
|
+
this.skipText = translate('Skip');
|
|
396
|
+
this.submitText = translate('Submit');
|
|
397
|
+
}
|
|
398
|
+
get context() {
|
|
399
|
+
return this.authenticator.slotContext;
|
|
400
|
+
}
|
|
401
|
+
onInput(event) {
|
|
402
|
+
event.preventDefault();
|
|
403
|
+
const { name, value } = event.target;
|
|
404
|
+
this.authenticator.updateForm({ name, value });
|
|
405
|
+
}
|
|
406
|
+
onSubmit(event) {
|
|
407
|
+
event.preventDefault();
|
|
408
|
+
this.authenticator.submitForm();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
ConfirmVerifyUserComponent.decorators = [
|
|
412
|
+
{ type: Component, args: [{
|
|
413
|
+
selector: 'amplify-confirm-verify-user',
|
|
414
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (input)=\"onInput($event)\" (submit)=\"onSubmit($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"confirm-verify-user-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ submitText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.skipVerification()\"\n >\n {{ skipText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"confirm-verify-user-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
|
|
415
|
+
},] }
|
|
416
|
+
];
|
|
417
|
+
ConfirmVerifyUserComponent.ctorParameters = () => [
|
|
418
|
+
{ type: AuthenticatorService }
|
|
419
|
+
];
|
|
420
|
+
ConfirmVerifyUserComponent.propDecorators = {
|
|
421
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmverifyuser',] }],
|
|
422
|
+
headerText: [{ type: Input }]
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
class FederatedSignInButtonComponent {
|
|
426
|
+
constructor(authenticator) {
|
|
427
|
+
this.authenticator = authenticator;
|
|
428
|
+
this.onClick = () => {
|
|
429
|
+
this.authenticator.send({
|
|
430
|
+
type: 'FEDERATED_SIGN_IN',
|
|
431
|
+
data: { provider: this.provider },
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
FederatedSignInButtonComponent.decorators = [
|
|
437
|
+
{ type: Component, args: [{
|
|
438
|
+
selector: 'amplify-federated-sign-in-button',
|
|
439
|
+
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; align-items: center\"\n >\n <ng-content></ng-content>\n </div>\n</button>\n"
|
|
440
|
+
},] }
|
|
441
|
+
];
|
|
442
|
+
FederatedSignInButtonComponent.ctorParameters = () => [
|
|
443
|
+
{ type: AuthenticatorService }
|
|
444
|
+
];
|
|
445
|
+
FederatedSignInButtonComponent.propDecorators = {
|
|
446
|
+
provider: [{ type: Input }],
|
|
447
|
+
text: [{ type: Input }]
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
class FederatedSignInComponent {
|
|
451
|
+
constructor(authenticator) {
|
|
452
|
+
this.authenticator = authenticator;
|
|
453
|
+
this.FederatedProviders = FederatedIdentityProviders;
|
|
454
|
+
this.includeAmazon = false;
|
|
455
|
+
this.includeApple = false;
|
|
456
|
+
this.includeFacebook = false;
|
|
457
|
+
this.includeGoogle = false;
|
|
458
|
+
this.shouldShowFederatedSignIn = false;
|
|
459
|
+
}
|
|
460
|
+
ngOnInit() {
|
|
461
|
+
var _a;
|
|
462
|
+
const { socialProviders } = (_a = this.authenticator.context) === null || _a === void 0 ? void 0 : _a.config;
|
|
463
|
+
this.setFederatedTexts();
|
|
464
|
+
this.includeAmazon = socialProviders === null || socialProviders === void 0 ? void 0 : socialProviders.includes('amazon');
|
|
465
|
+
this.includeApple = socialProviders === null || socialProviders === void 0 ? void 0 : socialProviders.includes('apple');
|
|
466
|
+
this.includeGoogle = socialProviders === null || socialProviders === void 0 ? void 0 : socialProviders.includes('google');
|
|
467
|
+
this.includeFacebook = socialProviders === null || socialProviders === void 0 ? void 0 : socialProviders.includes('facebook');
|
|
468
|
+
this.shouldShowFederatedSignIn =
|
|
469
|
+
this.includeAmazon ||
|
|
470
|
+
this.includeApple ||
|
|
471
|
+
this.includeFacebook ||
|
|
472
|
+
this.includeGoogle;
|
|
473
|
+
}
|
|
474
|
+
setFederatedTexts() {
|
|
475
|
+
const { route } = this.authenticator;
|
|
476
|
+
const federatedText = route === 'signUp' ? 'Up' : 'In';
|
|
477
|
+
this.signInAmazonText = translate(`Sign ${federatedText} with Amazon`);
|
|
478
|
+
this.signInAppleText = translate(`Sign ${federatedText} with Apple`);
|
|
479
|
+
this.signInFacebookText = translate(`Sign ${federatedText} with Facebook`);
|
|
480
|
+
this.signInGoogleText = translate(`Sign ${federatedText} with Google`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
FederatedSignInComponent.decorators = [
|
|
484
|
+
{ type: Component, args: [{
|
|
485
|
+
selector: 'amplify-federated-sign-in',
|
|
486
|
+
template: "<div\n class=\"amplify-flex federated-sign-in-container\"\n style=\"flex-direction: column; padding: 0 0 1rem 0\"\n *ngIf=\"shouldShowFederatedSignIn\"\n data-orientation=\"horizontal\"\n data-size=\"small\"\n>\n <amplify-federated-sign-in-button\n *ngIf=\"includeAmazon\"\n [text]=\"signInAmazonText\"\n [provider]=\"FederatedProviders.Amazon\"\n >\n <svg\n aria-label=\"Amazon icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 248 268\"\n >\n <path\n d=\"M139.056521,147.024612 C133.548808,156.744524 124.782731,162.726926 115.087401,162.726926 C101.790721,162.726926 93.9937779,152.612964 93.9937779,137.68681 C93.9937779,108.224571 120.447551,102.879017 145.533369,102.879017 L145.533369,110.365976 C145.533369,123.831358 145.876354,135.063787 139.056521,147.024612 M207.206992,162.579655 C209.400505,165.692256 209.887066,169.437725 207.063416,171.770186 C199.996315,177.653081 187.429476,188.590967 180.513926,194.716661 L180.46208,194.621133 C178.176838,196.663031 174.862638,196.810303 172.27828,195.445057 C160.780281,185.9162 158.686473,181.494078 152.405048,172.403055 C133.405233,191.751331 119.909143,197.534719 95.309886,197.534719 C66.1281801,197.534719 43.4791563,179.599451 43.4791563,143.669212 C43.4791563,115.616003 58.6782107,96.5105248 80.4019706,87.1727225 C99.2063636,78.9096034 125.464714,77.4528107 145.533369,75.1641337 L145.533369,70.694248 C145.533369,62.4749122 146.167493,52.7510201 141.297893,45.6541312 C137.110277,39.2856386 129.018206,36.6586354 121.859376,36.6586354 C108.658413,36.6586354 96.9171331,43.4171982 94.0416364,57.4199213 C93.4593582,60.532522 91.1701278,63.5933787 88.003492,63.7406501 L54.4387473,60.1424518 C51.6150972,59.5095829 48.4484614,57.2248862 49.2740201,52.8982915 C56.9712583,12.2553679 93.7983558,0 126.732964,0 C143.587124,0 165.606011,4.47386604 178.902691,17.2148315 C195.760839,32.917146 194.149604,53.8694866 194.149604,76.6726704 L194.149604,130.542157 C194.149604,146.734049 200.87372,153.830938 207.206992,162.579655 Z M233.826346,208.038962 C230.467669,203.683255 211.550709,205.9821 203.056405,206.998432 C200.470662,207.321077 200.076227,205.042397 202.406981,203.404973 C217.475208,192.664928 242.201125,195.766353 245.081698,199.363845 C247.966255,202.981502 244.336653,228.071183 230.172839,240.049379 C228.001452,241.888455 225.929671,240.904388 226.89783,238.468418 C230.077218,230.430525 237.204944,212.418868 233.826346,208.038962 Z M126.768855,264 C74.0234043,264 42.0764048,241.955028 17.7852554,217.541992 C12.9733903,212.705982 6.71799208,206.295994 3.31151296,200.690918 C1.90227474,198.372135 5.59096074,195.021875 8.0442063,196.84375 C38.2390146,219.267578 82.1011654,239.538304 125.529506,239.538304 C154.819967,239.538304 191.046475,227.469543 220.66851,214.867659 C225.146771,212.966167 225.146771,219.180222 224.511585,221.060516 C224.183264,222.03242 209.514625,236.221149 189.247207,247.047411 C170.304273,257.166172 146.397132,264 126.768855,264 Z\"\n fill=\"#FF9900\"\n ></path>\n </svg>\n\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInAmazonText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeApple\"\n [provider]=\"FederatedProviders.Apple\"\n >\n <svg\n aria-label=\"Apple icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n fill=\"#000\"\n preserveAspectRatio=\"xMidYMid\"\n stroke=\"#000\"\n strokeWidth=\"0\"\n viewBox=\"0 0 1024 1024\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M747.4 535.7c-.4-68.2 30.5-119.6 92.9-157.5-34.9-50-87.7-77.5-157.3-82.8-65.9-5.2-138 38.4-164.4 38.4-27.9 0-91.7-36.6-141.9-36.6C273.1 298.8 163 379.8 163 544.6c0 48.7 8.9 99 26.7 150.8 23.8 68.2 109.6 235.3 199.1 232.6 46.8-1.1 79.9-33.2 140.8-33.2 59.1 0 89.7 33.2 141.9 33.2 90.3-1.3 167.9-153.2 190.5-221.6-121.1-57.1-114.6-167.2-114.6-170.7zm-105.1-305c50.7-60.2 46.1-115 44.6-134.7-44.8 2.6-96.6 30.5-126.1 64.8-32.5 36.8-51.6 82.3-47.5 133.6 48.4 3.7 92.6-21.2 129-63.7z\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInAppleText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeFacebook\"\n [text]=\"signInFacebookText\"\n [provider]=\"FederatedProviders.Facebook\"\n >\n <svg\n aria-label=\"Facebook icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 279 538\"\n >\n <path\n d=\"M82.3409742,538 L82.3409742,292.936652 L0,292.936652 L0,196.990154 L82.2410458,196.990154 L82.2410458,126.4295 C82.2410458,44.575144 132.205229,0 205.252865,0 C240.227794,0 270.306232,2.59855099 279,3.79788222 L279,89.2502322 L228.536175,89.2502322 C188.964542,89.2502322 181.270057,108.139699 181.270057,135.824262 L181.270057,196.89021 L276.202006,196.89021 L263.810888,292.836708 L181.16913,292.836708 L181.16913,538 L82.3409742,538 Z\"\n fill=\"#1877F2\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInFacebookText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeGoogle\"\n [provider]=\"FederatedProviders.Google\"\n >\n <svg\n aria-label=\"Google icon\"\n class=\"amplify-icon federated-sign-in-icon\"\n viewBox=\"0 0 256 262\"\n xmlns=\"http://www.w3.org/2000/svg\"\n preserveAspectRatio=\"xMidYMid\"\n >\n <path\n d=\"M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027\"\n fill=\"#4285F4\"\n ></path>\n <path\n d=\"M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1\"\n fill=\"#34A853\"\n ></path>\n <path\n d=\"M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782\"\n fill=\"#FBBC05\"\n ></path>\n <path\n d=\"M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251\"\n fill=\"#EB4335\"\n ></path>\n </svg>\n <p class=\"amplify-text\" style=\"align-self: center\">\n {{ signInGoogleText }}\n </p>\n </amplify-federated-sign-in-button>\n\n <div class=\"amplify-flex\" data-or-container>\n <div data-or-line>or</div>\n <hr\n class=\"amplify-divider\"\n aria-orientation=\"horizontal\"\n data-size=\"small\"\n />\n </div>\n</div>\n"
|
|
487
|
+
},] }
|
|
488
|
+
];
|
|
489
|
+
FederatedSignInComponent.ctorParameters = () => [
|
|
490
|
+
{ type: AuthenticatorService }
|
|
491
|
+
];
|
|
492
|
+
|
|
493
|
+
class ForceNewPasswordComponent {
|
|
494
|
+
constructor(authenticator) {
|
|
495
|
+
this.authenticator = authenticator;
|
|
496
|
+
this.dataAttr = '';
|
|
497
|
+
this.headerText = translate('Change Password');
|
|
498
|
+
// translated texts
|
|
499
|
+
this.changePasswordText = translate('Change Password');
|
|
500
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
501
|
+
}
|
|
502
|
+
get context() {
|
|
503
|
+
return this.authenticator.slotContext;
|
|
504
|
+
}
|
|
505
|
+
onInput(event) {
|
|
506
|
+
event.preventDefault();
|
|
507
|
+
const { name, value } = event.target;
|
|
508
|
+
this.authenticator.updateForm({ name, value });
|
|
509
|
+
}
|
|
510
|
+
onSubmit(event) {
|
|
511
|
+
event.preventDefault();
|
|
512
|
+
this.authenticator.submitForm();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
ForceNewPasswordComponent.decorators = [
|
|
516
|
+
{ type: Component, args: [{
|
|
517
|
+
selector: 'amplify-force-new-password',
|
|
518
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"force-new-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ changePasswordText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"force-new-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
|
|
519
|
+
},] }
|
|
520
|
+
];
|
|
521
|
+
ForceNewPasswordComponent.ctorParameters = () => [
|
|
522
|
+
{ type: AuthenticatorService }
|
|
523
|
+
];
|
|
524
|
+
ForceNewPasswordComponent.propDecorators = {
|
|
525
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-forcenewpassword',] }],
|
|
526
|
+
headerText: [{ type: Input }]
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
const getAttributeMap = () => authInputAttributes;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Input interface opinionated for authenticator usage.
|
|
533
|
+
*
|
|
534
|
+
* TODO: Separate this component out to two parts -- 1) amplify-auth-input that
|
|
535
|
+
* contains authenticator opinionated logic and 2) amplify-text-field primitive
|
|
536
|
+
* that does not make any auth-related inference.
|
|
537
|
+
*/
|
|
538
|
+
class FormFieldComponent {
|
|
539
|
+
constructor(authenticator) {
|
|
540
|
+
this.authenticator = authenticator;
|
|
541
|
+
this.required = true;
|
|
542
|
+
this.placeholder = '';
|
|
543
|
+
this.label = '';
|
|
544
|
+
this.initialValue = '';
|
|
545
|
+
this.disabled = false;
|
|
546
|
+
this.autocomplete = '';
|
|
547
|
+
this.labelHidden = true;
|
|
548
|
+
this.countryDialCodes = countryDialCodes;
|
|
549
|
+
}
|
|
550
|
+
ngOnInit() {
|
|
551
|
+
// TODO: consider better default handling mechanisms across frameworks
|
|
552
|
+
if (this.isPhoneField()) {
|
|
553
|
+
const state = this.authenticator.authState;
|
|
554
|
+
const { country_code } = getActorContext(state);
|
|
555
|
+
this.defaultCountryCode = country_code;
|
|
556
|
+
// TODO: remove this side-effect
|
|
557
|
+
this.authenticator.updateForm({
|
|
558
|
+
name: 'country_code',
|
|
559
|
+
value: country_code,
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
get attributeMap() {
|
|
564
|
+
return getAttributeMap();
|
|
565
|
+
}
|
|
566
|
+
get error() {
|
|
567
|
+
const formContext = getActorContext(this.authenticator.authState);
|
|
568
|
+
const { validationError } = formContext;
|
|
569
|
+
return validationError[this.name];
|
|
570
|
+
}
|
|
571
|
+
inferLabel() {
|
|
572
|
+
var _a;
|
|
573
|
+
const label = this.label || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.label);
|
|
574
|
+
return translate(label);
|
|
575
|
+
}
|
|
576
|
+
inferPlaceholder() {
|
|
577
|
+
var _a;
|
|
578
|
+
const placeholder = this.placeholder || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.placeholder) ||
|
|
579
|
+
this.inferLabel();
|
|
580
|
+
return translate(placeholder);
|
|
581
|
+
}
|
|
582
|
+
// infers what the `type` of underlying input element should be.
|
|
583
|
+
inferType() {
|
|
584
|
+
var _a, _b, _c;
|
|
585
|
+
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';
|
|
586
|
+
}
|
|
587
|
+
inferAutocomplete() {
|
|
588
|
+
var _a;
|
|
589
|
+
return this.autocomplete || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.autocomplete);
|
|
590
|
+
}
|
|
591
|
+
// TODO(enhancement): use enum to differentiate special field types
|
|
592
|
+
isPasswordField() {
|
|
593
|
+
return this.inferType() === 'password';
|
|
594
|
+
}
|
|
595
|
+
isPhoneField() {
|
|
596
|
+
return this.inferType() === 'tel';
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
FormFieldComponent.decorators = [
|
|
600
|
+
{ type: Component, args: [{
|
|
601
|
+
selector: 'amplify-form-field',
|
|
602
|
+
template: "<div class=\"amplify-flex amplify-field\" style=\"flex-direction: column\">\n <!-- Country code field -->\n <amplify-phone-number-field\n *ngIf=\"isPhoneField()\"\n [defaultCountryCode]=\"defaultCountryCode\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-phone-number-field>\n\n <amplify-password-field\n *ngIf=\"isPasswordField()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-password-field>\n\n <amplify-text-field\n *ngIf=\"!isPasswordField() && !isPhoneField()\"\n [type]=\"inferType()\"\n [name]=\"name\"\n [label]=\"inferLabel()\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n [labelHidden]=\"labelHidden\"\n [autocomplete]=\"inferAutocomplete()\"\n ></amplify-text-field>\n\n <amplify-error *ngIf=\"error\">\n {{ error }}\n </amplify-error>\n</div>\n"
|
|
603
|
+
},] }
|
|
604
|
+
];
|
|
605
|
+
FormFieldComponent.ctorParameters = () => [
|
|
606
|
+
{ type: AuthenticatorService }
|
|
607
|
+
];
|
|
608
|
+
FormFieldComponent.propDecorators = {
|
|
609
|
+
name: [{ type: Input }],
|
|
610
|
+
type: [{ type: Input }],
|
|
611
|
+
required: [{ type: Input }],
|
|
612
|
+
placeholder: [{ type: Input }],
|
|
613
|
+
label: [{ type: Input }],
|
|
614
|
+
initialValue: [{ type: Input }],
|
|
615
|
+
disabled: [{ type: Input }],
|
|
616
|
+
autocomplete: [{ type: Input }],
|
|
617
|
+
labelHidden: [{ type: Input }]
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
class ResetPasswordComponent {
|
|
621
|
+
constructor(authenticator) {
|
|
622
|
+
this.authenticator = authenticator;
|
|
623
|
+
this.dataAttr = '';
|
|
624
|
+
this.headerText = translate('Reset your password');
|
|
625
|
+
// translated texts
|
|
626
|
+
this.sendCodeText = translate('Send Code');
|
|
627
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
628
|
+
this.labelText = translate('Username');
|
|
629
|
+
}
|
|
630
|
+
ngOnInit() {
|
|
631
|
+
const { authState } = this.authenticator;
|
|
632
|
+
const { label } = getAliasInfoFromContext(authState.context);
|
|
633
|
+
this.labelText = `Enter your ${label.toLowerCase()}`;
|
|
634
|
+
}
|
|
635
|
+
get context() {
|
|
636
|
+
return this.authenticator.slotContext;
|
|
637
|
+
}
|
|
638
|
+
onInput(event) {
|
|
639
|
+
event.preventDefault();
|
|
640
|
+
const { name, value } = event.target;
|
|
641
|
+
this.authenticator.updateForm({ name, value });
|
|
642
|
+
}
|
|
643
|
+
onSubmit(event) {
|
|
644
|
+
event.preventDefault();
|
|
645
|
+
this.authenticator.submitForm();
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
ResetPasswordComponent.decorators = [
|
|
649
|
+
{ type: Component, args: [{
|
|
650
|
+
selector: 'amplify-reset-password',
|
|
651
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot\n class=\"amplify-flex\"\n name=\"reset-password-header\"\n [context]=\"context\"\n >\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n\n <amplify-form-field\n name=\"username\"\n type=\"username\"\n autocomplete=\"username\"\n [placeholder]=\"labelText\"\n [label]=\"labelText\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ sendCodeText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n\n <amplify-slot name=\"reset-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
|
|
652
|
+
},] }
|
|
653
|
+
];
|
|
654
|
+
ResetPasswordComponent.ctorParameters = () => [
|
|
655
|
+
{ type: AuthenticatorService }
|
|
656
|
+
];
|
|
657
|
+
ResetPasswordComponent.propDecorators = {
|
|
658
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-resetPassword',] }],
|
|
659
|
+
headerText: [{ type: Input }]
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
const logger = new Logger$1('SetupTotp');
|
|
663
|
+
class SetupTotpComponent {
|
|
664
|
+
constructor(authenticator) {
|
|
665
|
+
this.authenticator = authenticator;
|
|
666
|
+
this.dataAttr = '';
|
|
667
|
+
this.headerText = translate('Setup TOTP');
|
|
668
|
+
this.qrCodeSource = '';
|
|
669
|
+
// translated texts
|
|
670
|
+
this.backToSignInText = translate('Back to Sign In');
|
|
671
|
+
this.confirmText = translate('Confirm');
|
|
672
|
+
}
|
|
673
|
+
ngOnInit() {
|
|
674
|
+
this.generateQRCode();
|
|
675
|
+
}
|
|
676
|
+
get context() {
|
|
677
|
+
return this.authenticator.slotContext;
|
|
678
|
+
}
|
|
679
|
+
generateQRCode() {
|
|
680
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
681
|
+
// TODO: This should be handled in core.
|
|
682
|
+
const state = this.authenticator.authState;
|
|
683
|
+
const actorContext = getActorContext(state);
|
|
684
|
+
const { user } = actorContext;
|
|
685
|
+
try {
|
|
686
|
+
const secretKey = yield Auth.setupTOTP(user);
|
|
687
|
+
const issuer = 'AWSCognito';
|
|
688
|
+
const totpCode = `otpauth://totp/${issuer}:${user.username}?secret=${secretKey}&issuer=${issuer}`;
|
|
689
|
+
logger.info('totp code was generated:', totpCode);
|
|
690
|
+
this.qrCodeSource = yield QRCode.toDataURL(totpCode);
|
|
691
|
+
}
|
|
692
|
+
catch (err) {
|
|
693
|
+
logger.error(err);
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
onInput(event) {
|
|
698
|
+
event.preventDefault();
|
|
699
|
+
const { name, value } = event.target;
|
|
700
|
+
this.authenticator.updateForm({ name, value });
|
|
701
|
+
}
|
|
702
|
+
onSubmit(event) {
|
|
703
|
+
event.preventDefault();
|
|
704
|
+
this.authenticator.submitForm();
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
SetupTotpComponent.decorators = [
|
|
708
|
+
{ type: Component, args: [{
|
|
709
|
+
selector: 'amplify-setup-totp',
|
|
710
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"setup-totp-footer\" [context]=\"context\"> </amplify-slot>\n </form>\n</div>\n"
|
|
711
|
+
},] }
|
|
712
|
+
];
|
|
713
|
+
SetupTotpComponent.ctorParameters = () => [
|
|
714
|
+
{ type: AuthenticatorService }
|
|
715
|
+
];
|
|
716
|
+
SetupTotpComponent.propDecorators = {
|
|
717
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-setup-totp',] }]
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
class SignInComponent {
|
|
721
|
+
constructor(authenticator) {
|
|
722
|
+
this.authenticator = authenticator;
|
|
723
|
+
this.dataAttr = '';
|
|
724
|
+
// translated phrases
|
|
725
|
+
this.forgotPasswordText = translate('Forgot your password? ');
|
|
726
|
+
this.signInButtonText = translate('Sign in');
|
|
727
|
+
}
|
|
728
|
+
get context() {
|
|
729
|
+
return this.authenticator.slotContext;
|
|
730
|
+
}
|
|
731
|
+
onInput(event) {
|
|
732
|
+
event.preventDefault();
|
|
733
|
+
const { name, value } = event.target;
|
|
734
|
+
this.authenticator.updateForm({ name, value });
|
|
735
|
+
}
|
|
736
|
+
onSubmit(event) {
|
|
737
|
+
event.preventDefault();
|
|
738
|
+
this.authenticator.submitForm();
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
SignInComponent.decorators = [
|
|
742
|
+
{ type: Component, args: [{
|
|
743
|
+
selector: 'amplify-sign-in',
|
|
744
|
+
template: "<div data-amplify-container>\n <amplify-slot name=\"sign-in-header\" [context]=\"context\"></amplify-slot>\n\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-user-name-alias></amplify-user-name-alias>\n <amplify-form-field\n data-amplify-password\n name=\"password\"\n type=\"password\"\n autocomplete=\"current-password\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ signInButtonText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n </form>\n\n <amplify-slot name=\"sign-in-footer\" [context]=\"context\">\n <div data-amplify-footer>\n <button\n amplify-button\n fontWeight=\"normal\"\n size=\"small\"\n variation=\"link\"\n fullWidth=\"true\"\n (click)=\"authenticator.toResetPassword()\"\n >\n {{ forgotPasswordText }}\n </button>\n </div>\n </amplify-slot>\n</div>\n",
|
|
745
|
+
encapsulation: ViewEncapsulation.None
|
|
746
|
+
},] }
|
|
747
|
+
];
|
|
748
|
+
SignInComponent.ctorParameters = () => [
|
|
749
|
+
{ type: AuthenticatorService }
|
|
750
|
+
];
|
|
751
|
+
SignInComponent.propDecorators = {
|
|
752
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-signin',] }]
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
class SignUpComponent {
|
|
756
|
+
constructor(authenticator) {
|
|
757
|
+
this.authenticator = authenticator;
|
|
758
|
+
this.dataAttr = '';
|
|
759
|
+
// translated texts
|
|
760
|
+
this.createAccountText = translate('Create Account');
|
|
761
|
+
}
|
|
762
|
+
get context() {
|
|
763
|
+
return this.authenticator.slotContext;
|
|
764
|
+
}
|
|
765
|
+
onInput(event) {
|
|
766
|
+
let { checked, name, type, value } = event.target;
|
|
767
|
+
if (type === 'checkbox' && !checked)
|
|
768
|
+
value = undefined;
|
|
769
|
+
this.authenticator.updateForm({ name, value });
|
|
770
|
+
}
|
|
771
|
+
onSubmit(event) {
|
|
772
|
+
event.preventDefault();
|
|
773
|
+
this.authenticator.submitForm();
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
SignUpComponent.decorators = [
|
|
777
|
+
{ type: Component, args: [{
|
|
778
|
+
selector: 'amplify-sign-up',
|
|
779
|
+
template: "<amplify-slot name=\"sign-up-header\" [context]=\"context\"></amplify-slot>\n\n<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <div class=\"amplify-flex\" style=\"flex-direction: column\">\n <div class=\"amplify-flex\" style=\"flex-direction: column\">\n <amplify-slot name=\"sign-up-form-fields\" [context]=\"context\">\n <amplify-sign-up-form-fields></amplify-sign-up-form-fields>\n </amplify-slot>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </div>\n\n <amplify-slot name=\"sign-up-button\" [context]=\"context\">\n <button\n [disabled]=\"\n authenticator.isPending || authenticator.hasValidationErrors\n \"\n amplify-button\n variation=\"primary\"\n fullWidth=\"true\"\n type=\"submit\"\n >\n {{ createAccountText }}\n </button>\n </amplify-slot>\n </div>\n</form>\n\n<amplify-slot name=\"sign-up-footer\" [context]=\"context\"> </amplify-slot>\n"
|
|
780
|
+
},] }
|
|
781
|
+
];
|
|
782
|
+
SignUpComponent.ctorParameters = () => [
|
|
783
|
+
{ type: AuthenticatorService }
|
|
784
|
+
];
|
|
785
|
+
SignUpComponent.propDecorators = {
|
|
786
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-signup',] }]
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
class SignUpFormFieldsComponent {
|
|
790
|
+
constructor(authenticator) {
|
|
791
|
+
this.authenticator = authenticator;
|
|
792
|
+
this.primaryAlias = '';
|
|
793
|
+
this.secondaryAliases = [];
|
|
794
|
+
}
|
|
795
|
+
ngOnInit() {
|
|
796
|
+
const context = this.authenticator.context;
|
|
797
|
+
const { loginMechanisms, signUpAttributes } = context.config;
|
|
798
|
+
this.fieldNames = Array.from(new Set([...loginMechanisms, ...signUpAttributes]));
|
|
799
|
+
this.fieldNames = this.fieldNames.filter((fieldName) => {
|
|
800
|
+
const hasDefaultField = !!authInputAttributes[fieldName];
|
|
801
|
+
if (!hasDefaultField) {
|
|
802
|
+
console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize Authenticator.SignUp.FormFields to add your own.`);
|
|
803
|
+
}
|
|
804
|
+
return hasDefaultField;
|
|
805
|
+
});
|
|
806
|
+
// Only 1 is supported, so `['email', 'phone_number']` will only show `email`
|
|
807
|
+
this.loginMechanism = this.fieldNames.shift();
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
SignUpFormFieldsComponent.decorators = [
|
|
811
|
+
{ type: Component, args: [{
|
|
812
|
+
selector: 'amplify-sign-up-form-fields',
|
|
813
|
+
template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <amplify-user-name-alias [name]=\"loginMechanism\"></amplify-user-name-alias>\n <amplify-form-field\n name=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\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 *ngFor=\"let field of fieldNames\">\n <amplify-form-field\n [name]=\"field\"\n [labelHidden]=\"false\"\n ></amplify-form-field>\n </ng-container>\n</div>\n"
|
|
814
|
+
},] }
|
|
815
|
+
];
|
|
816
|
+
SignUpFormFieldsComponent.ctorParameters = () => [
|
|
817
|
+
{ type: AuthenticatorService }
|
|
818
|
+
];
|
|
819
|
+
|
|
820
|
+
class UserNameAliasComponent {
|
|
821
|
+
constructor(authenticator) {
|
|
822
|
+
this.authenticator = authenticator;
|
|
823
|
+
this.name = 'username';
|
|
824
|
+
this.disabled = false;
|
|
825
|
+
this.initialValue = '';
|
|
826
|
+
this.required = true;
|
|
827
|
+
}
|
|
828
|
+
ngOnInit() {
|
|
829
|
+
const context = this.authenticator.context;
|
|
830
|
+
const { label, type } = getAliasInfoFromContext(context);
|
|
831
|
+
this.label = label;
|
|
832
|
+
this.type = type;
|
|
833
|
+
this.placeholder = label;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
UserNameAliasComponent.decorators = [
|
|
837
|
+
{ type: Component, args: [{
|
|
838
|
+
selector: 'amplify-user-name-alias',
|
|
839
|
+
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"
|
|
840
|
+
},] }
|
|
841
|
+
];
|
|
842
|
+
UserNameAliasComponent.ctorParameters = () => [
|
|
843
|
+
{ type: AuthenticatorService }
|
|
844
|
+
];
|
|
845
|
+
UserNameAliasComponent.propDecorators = {
|
|
846
|
+
name: [{ type: Input }],
|
|
847
|
+
disabled: [{ type: Input }],
|
|
848
|
+
initialValue: [{ type: Input }],
|
|
849
|
+
required: [{ type: Input }]
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
class VerifyUserComponent {
|
|
853
|
+
constructor(authenticator) {
|
|
854
|
+
this.authenticator = authenticator;
|
|
855
|
+
this.dataAttr = '';
|
|
856
|
+
this.headerText = translate('Account recovery requires verified contact information');
|
|
857
|
+
this.unverifiedAttributes = {};
|
|
858
|
+
this.labelId = nanoid(12);
|
|
859
|
+
// translated texts
|
|
860
|
+
this.skipText = translate('Skip');
|
|
861
|
+
this.verifyText = translate('Verify');
|
|
862
|
+
}
|
|
863
|
+
ngOnInit() {
|
|
864
|
+
const actorState = getActorState(this.authenticator.authState);
|
|
865
|
+
this.unverifiedAttributes = actorState.context.unverifiedAttributes;
|
|
866
|
+
}
|
|
867
|
+
get context() {
|
|
868
|
+
return this.authenticator.slotContext;
|
|
869
|
+
}
|
|
870
|
+
getLabelForAttr(authAttr) {
|
|
871
|
+
var _a;
|
|
872
|
+
const attributeMap = getAttributeMap();
|
|
873
|
+
const label = (_a = attributeMap[authAttr]) === null || _a === void 0 ? void 0 : _a.label;
|
|
874
|
+
return translate(label);
|
|
875
|
+
}
|
|
876
|
+
onInput(event) {
|
|
877
|
+
event.preventDefault();
|
|
878
|
+
const { name, value } = event.target;
|
|
879
|
+
this.authenticator.updateForm({ name, value });
|
|
880
|
+
}
|
|
881
|
+
onSubmit(event) {
|
|
882
|
+
event.preventDefault();
|
|
883
|
+
this.authenticator.submitForm();
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
VerifyUserComponent.decorators = [
|
|
887
|
+
{ type: Component, args: [{
|
|
888
|
+
selector: 'amplify-verify-user',
|
|
889
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (input)=\"onInput($event)\" (submit)=\"onSubmit($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"verify-user-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n\n <div *ngFor=\"let unverifiedAttribute of unverifiedAttributes | keyvalue\">\n <input\n name=\"unverifiedAttr\"\n type=\"radio\"\n [value]=\"unverifiedAttribute.key\"\n [id]=\"labelId\"\n />\n <label [for]=\"labelId\">{{\n getLabelForAttr(unverifiedAttribute.key)\n }}</label>\n </div>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ verifyText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.skipVerification()\"\n >\n {{ skipText }}\n </button>\n\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"verify-user-footer\" [context]=\"context\"> </amplify-slot>\n </form>\n</div>\n",
|
|
890
|
+
encapsulation: ViewEncapsulation.None
|
|
891
|
+
},] }
|
|
892
|
+
];
|
|
893
|
+
VerifyUserComponent.ctorParameters = () => [
|
|
894
|
+
{ type: AuthenticatorService }
|
|
895
|
+
];
|
|
896
|
+
VerifyUserComponent.propDecorators = {
|
|
897
|
+
dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-verifyuser',] }],
|
|
898
|
+
headerText: [{ type: Input }]
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
class ButtonComponent {
|
|
902
|
+
constructor() {
|
|
903
|
+
this.type = 'button';
|
|
904
|
+
this.fullWidth = false;
|
|
905
|
+
this.size = 'medium';
|
|
906
|
+
this.variation = 'default';
|
|
907
|
+
this.fontWeight = 'normal';
|
|
908
|
+
this.defaultClass = true;
|
|
909
|
+
}
|
|
910
|
+
ngOnInit() {
|
|
911
|
+
this.typeAttr = this.type;
|
|
912
|
+
this.fullWidthAttr = this.fullWidth;
|
|
913
|
+
this.sizeAttr = this.size;
|
|
914
|
+
this.variationAttr = this.variation;
|
|
915
|
+
this.fontWeightAttr = this.fontWeight;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
ButtonComponent.decorators = [
|
|
919
|
+
{ type: Component, args: [{
|
|
920
|
+
selector: 'button[amplify-button]',
|
|
921
|
+
template: "<ng-content></ng-content>\n"
|
|
922
|
+
},] }
|
|
923
|
+
];
|
|
924
|
+
ButtonComponent.propDecorators = {
|
|
925
|
+
type: [{ type: Input }],
|
|
926
|
+
fullWidth: [{ type: Input }],
|
|
927
|
+
size: [{ type: Input }],
|
|
928
|
+
variation: [{ type: Input }],
|
|
929
|
+
fontWeight: [{ type: Input }],
|
|
930
|
+
typeAttr: [{ type: HostBinding, args: ['type',] }],
|
|
931
|
+
fullWidthAttr: [{ type: HostBinding, args: ['attr.data-fullwidth',] }],
|
|
932
|
+
sizeAttr: [{ type: HostBinding, args: ['attr.data-size',] }],
|
|
933
|
+
variationAttr: [{ type: HostBinding, args: ['attr.data-variation',] }],
|
|
934
|
+
defaultClass: [{ type: HostBinding, args: ['class.amplify-button',] }],
|
|
935
|
+
fontWeightAttr: [{ type: HostBinding, args: ['style.font-weight',] }]
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
class CheckboxComponent {
|
|
939
|
+
constructor() {
|
|
940
|
+
this.defaultChecked = false;
|
|
941
|
+
this.hasError = false;
|
|
942
|
+
this.isChecked = false;
|
|
943
|
+
}
|
|
944
|
+
ngOnInit() {
|
|
945
|
+
if (this.defaultChecked) {
|
|
946
|
+
this.isChecked = true;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
handleClick() {
|
|
950
|
+
this.isChecked = !this.isChecked;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
CheckboxComponent.decorators = [
|
|
954
|
+
{ type: Component, args: [{
|
|
955
|
+
selector: 'amplify-checkbox',
|
|
956
|
+
template: "<div class=\"amplify-flex amplify-field amplify-checkboxfield\">\n <label class=\"amplify-flex amplify-checkbox\">\n <span class=\"amplify-visually-hidden\">\n <input\n (click)=\"handleClick()\"\n class=\"\n amplify-input\n amplify-field-group__control\n amplify-checkbox__input\n \"\n aria-invalid=\"false\"\n type=\"checkbox\"\n [name]=\"name\"\n [value]=\"value\"\n />\n </span>\n <span\n class=\"amplify-flex amplify-checkbox__button\"\n aria-hidden=\"true\"\n data-focus=\"false\"\n [attr.data-error]=\"hasError\"\n [attr.data-checked]=\"isChecked\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon amplify-checkbox__icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n [attr.data-checked]=\"isChecked\"\n >\n <path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z\"></path>\n </svg>\n </span>\n <span class=\"amplify-text amplify-checkbox__label\">\n <ng-content></ng-content>\n </span>\n </label>\n <p *ngIf=\"hasError\" class=\"amplify-text amplify-field__error-message\">\n {{ errorMessage }}\n </p>\n</div>\n"
|
|
957
|
+
},] }
|
|
958
|
+
];
|
|
959
|
+
CheckboxComponent.propDecorators = {
|
|
960
|
+
defaultChecked: [{ type: Input }],
|
|
961
|
+
errorMessage: [{ type: Input }],
|
|
962
|
+
hasError: [{ type: Input }],
|
|
963
|
+
label: [{ type: Input }],
|
|
964
|
+
name: [{ type: Input }],
|
|
965
|
+
value: [{ type: Input }]
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
class ErrorComponent {
|
|
969
|
+
constructor() {
|
|
970
|
+
this.isVisible = true;
|
|
971
|
+
}
|
|
972
|
+
close() {
|
|
973
|
+
this.isVisible = false;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
ErrorComponent.decorators = [
|
|
977
|
+
{ type: Component, args: [{
|
|
978
|
+
selector: 'amplify-error',
|
|
979
|
+
template: "<div\n class=\"amplify-flex amplify-alert\"\n data-variation=\"error\"\n style=\"align-items: center; justify-content: space-between\"\n *ngIf=\"isVisible\"\n role=\"alert\"\n>\n <div class=\"amplify-flex\" style=\"align-items: center\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n >\n <path\n d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"\n ></path>\n </svg>\n <div><ng-content></ng-content></div>\n </div>\n <button\n amplify-button\n class=\"amplify-field-group__control\"\n variation=\"link\"\n [fullWidth]=\"false\"\n (click)=\"close()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n >\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"\n ></path>\n </svg>\n </button>\n</div>\n"
|
|
980
|
+
},] }
|
|
981
|
+
];
|
|
982
|
+
|
|
983
|
+
class PasswordFieldComponent {
|
|
984
|
+
constructor() {
|
|
985
|
+
this.autocomplete = 'new-password';
|
|
986
|
+
this.disabled = false;
|
|
987
|
+
this.fieldId = `amplify-field-${nanoid(12)}`;
|
|
988
|
+
this.initialValue = '';
|
|
989
|
+
this.label = '';
|
|
990
|
+
this.placeholder = '';
|
|
991
|
+
this.required = true;
|
|
992
|
+
this.labelHidden = false;
|
|
993
|
+
this.type = 'password';
|
|
994
|
+
this.showPassword = false;
|
|
995
|
+
this.showPasswordButtonlabel = translate('Show password');
|
|
996
|
+
}
|
|
997
|
+
togglePasswordText() {
|
|
998
|
+
this.showPassword = !this.showPassword;
|
|
999
|
+
this.showPasswordButtonlabel = this.showPassword
|
|
1000
|
+
? translate('Show password')
|
|
1001
|
+
: translate('Hide password');
|
|
1002
|
+
this.type = this.showPassword ? 'text' : 'password';
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
PasswordFieldComponent.decorators = [
|
|
1006
|
+
{ type: Component, args: [{
|
|
1007
|
+
selector: 'amplify-password-field',
|
|
1008
|
+
template: "<label class=\"amplify-label\" [class.sr-only]=\"labelHidden\" [for]=\"fieldId\">\n {{ label }}\n</label>\n<div class=\"amplify-flex amplify-field-group\">\n <input\n class=\"amplify-input amplify-field-group__control\"\n [id]=\"fieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\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"
|
|
1009
|
+
},] }
|
|
1010
|
+
];
|
|
1011
|
+
PasswordFieldComponent.propDecorators = {
|
|
1012
|
+
autocomplete: [{ type: Input }],
|
|
1013
|
+
disabled: [{ type: Input }],
|
|
1014
|
+
fieldId: [{ type: Input }],
|
|
1015
|
+
initialValue: [{ type: Input }],
|
|
1016
|
+
label: [{ type: Input }],
|
|
1017
|
+
name: [{ type: Input }],
|
|
1018
|
+
placeholder: [{ type: Input }],
|
|
1019
|
+
required: [{ type: Input }],
|
|
1020
|
+
labelHidden: [{ type: Input }]
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
class PhoneNumberFieldComponent {
|
|
1024
|
+
constructor() {
|
|
1025
|
+
this.autocomplete = 'new-password';
|
|
1026
|
+
this.disabled = false;
|
|
1027
|
+
this.selectFieldId = `amplify-field-${nanoid(12)}`;
|
|
1028
|
+
this.textFieldId = `amplify-field-${nanoid(12)}`;
|
|
1029
|
+
this.initialValue = '';
|
|
1030
|
+
this.label = '';
|
|
1031
|
+
this.placeholder = '';
|
|
1032
|
+
this.required = true;
|
|
1033
|
+
this.labelHidden = false;
|
|
1034
|
+
this.display = 'contents';
|
|
1035
|
+
this.countryDialCodes = countryDialCodes;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
PhoneNumberFieldComponent.decorators = [
|
|
1039
|
+
{ type: Component, args: [{
|
|
1040
|
+
selector: 'amplify-phone-number-field',
|
|
1041
|
+
template: "<label class=\"amplify-label\" [class.sr-only]=\"labelHidden\" [for]=\"textFieldId\">\n {{ label }}\n</label>\n<div\n class=\"amplify-flex amplify-phonenumberfield\"\n amplify-field-group\n style=\"gap: 0px\"\n>\n <div class=\"amplify-field-group__outer-start\">\n <div\n class=\"\n amplify-flex amplify-field amplify-selectfield amplify-countrycodeselect\n \"\n style=\"flex-direction: column\"\n >\n <amplify-form-select\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"selectFieldId\"\n [items]=\"countryDialCodes\"\n [defaultValue]=\"defaultCountryCode\"\n ></amplify-form-select>\n </div>\n </div>\n\n <input\n class=\"amplify-input\"\n [id]=\"textFieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\n</div>\n"
|
|
1042
|
+
},] }
|
|
1043
|
+
];
|
|
1044
|
+
PhoneNumberFieldComponent.propDecorators = {
|
|
1045
|
+
autocomplete: [{ type: Input }],
|
|
1046
|
+
disabled: [{ type: Input }],
|
|
1047
|
+
defaultCountryCode: [{ type: Input }],
|
|
1048
|
+
selectFieldId: [{ type: Input }],
|
|
1049
|
+
textFieldId: [{ type: Input }],
|
|
1050
|
+
initialValue: [{ type: Input }],
|
|
1051
|
+
label: [{ type: Input }],
|
|
1052
|
+
name: [{ type: Input }],
|
|
1053
|
+
placeholder: [{ type: Input }],
|
|
1054
|
+
required: [{ type: Input }],
|
|
1055
|
+
type: [{ type: Input }],
|
|
1056
|
+
labelHidden: [{ type: Input }],
|
|
1057
|
+
display: [{ type: HostBinding, args: ['style.display',] }]
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
class SelectComponent {
|
|
1061
|
+
}
|
|
1062
|
+
SelectComponent.decorators = [
|
|
1063
|
+
{ type: Component, args: [{
|
|
1064
|
+
selector: 'amplify-form-select',
|
|
1065
|
+
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"
|
|
1066
|
+
},] }
|
|
1067
|
+
];
|
|
1068
|
+
SelectComponent.propDecorators = {
|
|
1069
|
+
items: [{ type: Input }],
|
|
1070
|
+
name: [{ type: Input }],
|
|
1071
|
+
label: [{ type: Input }],
|
|
1072
|
+
id: [{ type: Input }],
|
|
1073
|
+
defaultValue: [{ type: Input }]
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1076
|
+
class TabItemComponent {
|
|
1077
|
+
constructor() {
|
|
1078
|
+
this.active = false;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
TabItemComponent.decorators = [
|
|
1082
|
+
{ type: Component, args: [{
|
|
1083
|
+
selector: 'amplify-tab-item',
|
|
1084
|
+
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"
|
|
1085
|
+
},] }
|
|
1086
|
+
];
|
|
1087
|
+
TabItemComponent.propDecorators = {
|
|
1088
|
+
title: [{ type: Input }],
|
|
1089
|
+
active: [{ type: Input }],
|
|
1090
|
+
id: [{ type: Input }],
|
|
1091
|
+
labelledById: [{ type: Input }],
|
|
1092
|
+
tabIndex: [{ type: Input }]
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
class TabsComponent {
|
|
1096
|
+
constructor() {
|
|
1097
|
+
this.tabChange = new EventEmitter();
|
|
1098
|
+
}
|
|
1099
|
+
ngAfterContentInit() {
|
|
1100
|
+
// assign ids
|
|
1101
|
+
this.tabs.forEach((tab, index) => {
|
|
1102
|
+
tab.id = `radix-id-${nanoid(12)}-1-content-${index}`;
|
|
1103
|
+
tab.labelledById = `radix-id-${nanoid(12)}-1-trigger-${index}`;
|
|
1104
|
+
});
|
|
1105
|
+
// find active tab
|
|
1106
|
+
// TODO(enhancement): more declarative way for choosing the initial tab to render
|
|
1107
|
+
const activeTabs = this.tabs.filter((tab) => tab.active);
|
|
1108
|
+
// set active tab
|
|
1109
|
+
if (activeTabs.length !== 1) {
|
|
1110
|
+
this.selectTab(this.tabs.first);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
selectTab(tab) {
|
|
1114
|
+
this.tabs.forEach((tab) => {
|
|
1115
|
+
tab.active = false;
|
|
1116
|
+
});
|
|
1117
|
+
tab.active = true;
|
|
1118
|
+
}
|
|
1119
|
+
handleTabClick(tab) {
|
|
1120
|
+
if (tab.active)
|
|
1121
|
+
return; // don't do anything if clicks the current active tab
|
|
1122
|
+
this.tabChange.emit();
|
|
1123
|
+
this.selectTab(tab);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
TabsComponent.decorators = [
|
|
1127
|
+
{ type: Component, args: [{
|
|
1128
|
+
selector: 'amplify-tabs',
|
|
1129
|
+
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-spacing=\"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"
|
|
1130
|
+
},] }
|
|
1131
|
+
];
|
|
1132
|
+
TabsComponent.propDecorators = {
|
|
1133
|
+
tabs: [{ type: ContentChildren, args: [TabItemComponent,] }],
|
|
1134
|
+
tabChange: [{ type: Output }]
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
class TextFieldComponent {
|
|
1138
|
+
constructor() {
|
|
1139
|
+
this.autocomplete = 'new-password';
|
|
1140
|
+
this.disabled = false;
|
|
1141
|
+
this.fieldId = `amplify-field-${nanoid(12)}`;
|
|
1142
|
+
this.initialValue = '';
|
|
1143
|
+
this.label = '';
|
|
1144
|
+
this.placeholder = '';
|
|
1145
|
+
this.required = true;
|
|
1146
|
+
this.labelHidden = false;
|
|
1147
|
+
this.display = 'contents';
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
TextFieldComponent.decorators = [
|
|
1151
|
+
{ type: Component, args: [{
|
|
1152
|
+
selector: 'amplify-text-field',
|
|
1153
|
+
template: "<label class=\"amplify-label\" [class.sr-only]=\"labelHidden\" [for]=\"fieldId\">\n {{ label }}\n</label>\n<input\n class=\"amplify-input\"\n [id]=\"fieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n/>\n"
|
|
1154
|
+
},] }
|
|
1155
|
+
];
|
|
1156
|
+
TextFieldComponent.propDecorators = {
|
|
1157
|
+
autocomplete: [{ type: Input }],
|
|
1158
|
+
disabled: [{ type: Input }],
|
|
1159
|
+
fieldId: [{ type: Input }],
|
|
1160
|
+
initialValue: [{ type: Input }],
|
|
1161
|
+
label: [{ type: Input }],
|
|
1162
|
+
name: [{ type: Input }],
|
|
1163
|
+
placeholder: [{ type: Input }],
|
|
1164
|
+
required: [{ type: Input }],
|
|
1165
|
+
type: [{ type: Input }],
|
|
1166
|
+
labelHidden: [{ type: Input }],
|
|
1167
|
+
display: [{ type: HostBinding, args: ['style.display',] }]
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
class AmplifySlotComponent {
|
|
1171
|
+
constructor(propService) {
|
|
1172
|
+
this.propService = propService;
|
|
1173
|
+
this.display = 'contents';
|
|
1174
|
+
this.isOverriden = false;
|
|
1175
|
+
}
|
|
1176
|
+
ngAfterContentInit() {
|
|
1177
|
+
const customComponents = this.propService.customComponents;
|
|
1178
|
+
const overridingComponent = customComponents[this.name];
|
|
1179
|
+
if (overridingComponent) {
|
|
1180
|
+
this.overridingComponent = overridingComponent;
|
|
1181
|
+
this.isOverriden = true;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
AmplifySlotComponent.decorators = [
|
|
1186
|
+
{ type: Component, args: [{
|
|
1187
|
+
selector: 'amplify-slot',
|
|
1188
|
+
template: "<!-- \n if slot isn't overwritten, we display the the default coponent, which is the \n children passed onto this component.\n-->\n<ng-content *ngIf=\"!isOverriden\"></ng-content>\n\n<!-- If slot is overwritten, we render that instead. -->\n<ng-container\n *ngIf=\"isOverriden\"\n [ngTemplateOutlet]=\"overridingComponent\"\n [ngTemplateOutletContext]=\"context\"\n></ng-container>\n"
|
|
1189
|
+
},] }
|
|
1190
|
+
];
|
|
1191
|
+
AmplifySlotComponent.ctorParameters = () => [
|
|
1192
|
+
{ type: CustomComponentsService }
|
|
1193
|
+
];
|
|
1194
|
+
AmplifySlotComponent.propDecorators = {
|
|
1195
|
+
name: [{ type: Input }],
|
|
1196
|
+
context: [{ type: Input }],
|
|
1197
|
+
display: [{ type: HostBinding, args: ['style.display',] }]
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
class AmplifyAuthenticatorModule {
|
|
1201
|
+
}
|
|
1202
|
+
AmplifyAuthenticatorModule.decorators = [
|
|
1203
|
+
{ type: NgModule, args: [{
|
|
1204
|
+
declarations: [
|
|
1205
|
+
AmplifySlotComponent,
|
|
1206
|
+
AmplifySlotDirective,
|
|
1207
|
+
AuthenticatorComponent,
|
|
1208
|
+
ButtonComponent,
|
|
1209
|
+
CheckboxComponent,
|
|
1210
|
+
ConfirmResetPasswordComponent,
|
|
1211
|
+
ConfirmSignInComponent,
|
|
1212
|
+
ConfirmSignUpComponent,
|
|
1213
|
+
ConfirmVerifyUserComponent,
|
|
1214
|
+
ErrorComponent,
|
|
1215
|
+
FederatedSignInButtonComponent,
|
|
1216
|
+
FederatedSignInComponent,
|
|
1217
|
+
ForceNewPasswordComponent,
|
|
1218
|
+
FormFieldComponent,
|
|
1219
|
+
PasswordFieldComponent,
|
|
1220
|
+
PhoneNumberFieldComponent,
|
|
1221
|
+
ResetPasswordComponent,
|
|
1222
|
+
SelectComponent,
|
|
1223
|
+
SetupTotpComponent,
|
|
1224
|
+
SignInComponent,
|
|
1225
|
+
SignUpComponent,
|
|
1226
|
+
SignUpFormFieldsComponent,
|
|
1227
|
+
TabItemComponent,
|
|
1228
|
+
TabsComponent,
|
|
1229
|
+
TextFieldComponent,
|
|
1230
|
+
UserNameAliasComponent,
|
|
1231
|
+
VerifyUserComponent,
|
|
1232
|
+
],
|
|
1233
|
+
imports: [CommonModule, BrowserModule],
|
|
1234
|
+
exports: [
|
|
1235
|
+
AmplifySlotDirective,
|
|
1236
|
+
AuthenticatorComponent,
|
|
1237
|
+
CheckboxComponent,
|
|
1238
|
+
SignUpFormFieldsComponent,
|
|
1239
|
+
TextFieldComponent,
|
|
1240
|
+
],
|
|
1241
|
+
},] }
|
|
1242
|
+
];
|
|
1243
|
+
|
|
1244
|
+
/*
|
|
1245
|
+
* Public API Surface of ui-angular
|
|
1246
|
+
*/
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Generated bundle index. Do not edit.
|
|
1250
|
+
*/
|
|
1251
|
+
|
|
1252
|
+
export { AmplifyAuthenticatorModule, AmplifySlotDirective, AuthenticatorComponent, AuthenticatorService, ButtonComponent, CheckboxComponent, ConfirmResetPasswordComponent, ConfirmSignInComponent, ConfirmSignUpComponent, ConfirmVerifyUserComponent, CustomComponentsService, ErrorComponent, FederatedSignInButtonComponent, FederatedSignInComponent, ForceNewPasswordComponent, FormFieldComponent, PasswordFieldComponent, PhoneNumberFieldComponent, ResetPasswordComponent, SelectComponent, SetupTotpComponent, SignInComponent, SignUpComponent, SignUpFormFieldsComponent, TabItemComponent, TabsComponent, TextFieldComponent, UserNameAliasComponent, VerifyUserComponent, getAttributeMap, AmplifySlotComponent as ɵa, AuthenticatorComponent as ɵb, ButtonComponent as ɵc, CheckboxComponent as ɵd, ConfirmResetPasswordComponent as ɵe, ConfirmSignInComponent as ɵf, ConfirmSignUpComponent as ɵg, ConfirmVerifyUserComponent as ɵh, ErrorComponent as ɵi, FederatedSignInButtonComponent as ɵj, FederatedSignInComponent as ɵk, ForceNewPasswordComponent as ɵl, FormFieldComponent as ɵm, PasswordFieldComponent as ɵn, PhoneNumberFieldComponent as ɵo, ResetPasswordComponent as ɵp, SelectComponent as ɵq, SetupTotpComponent as ɵr, SignInComponent as ɵs, SignUpComponent as ɵt, SignUpFormFieldsComponent as ɵu, TabItemComponent as ɵv, TabsComponent as ɵw, TextFieldComponent as ɵx, UserNameAliasComponent as ɵy, VerifyUserComponent as ɵz };
|
|
1253
|
+
//# sourceMappingURL=aws-amplify-ui-angular.js.map
|