@aws-amplify/ui-angular 2.0.1-next.6 → 2.0.1

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.
Files changed (137) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +28 -0
  3. package/aws-amplify-ui-angular.d.ts +26 -24
  4. package/aws-amplify-ui-angular.metadata.json +1 -1
  5. package/bundles/aws-amplify-ui-angular-legacy.umd.js +2229 -0
  6. package/bundles/aws-amplify-ui-angular-legacy.umd.js.map +1 -0
  7. package/bundles/aws-amplify-ui-angular-legacy.umd.min.js +16 -0
  8. package/bundles/aws-amplify-ui-angular-legacy.umd.min.js.map +1 -0
  9. package/bundles/aws-amplify-ui-angular.umd.js +882 -2860
  10. package/bundles/aws-amplify-ui-angular.umd.js.map +1 -1
  11. package/bundles/aws-amplify-ui-angular.umd.min.js +1 -1
  12. package/bundles/aws-amplify-ui-angular.umd.min.js.map +1 -1
  13. package/esm2015/aws-amplify-ui-angular.js +27 -25
  14. package/esm2015/index.js +22 -8
  15. package/esm2015/legacy/aws-amplify-ui-angular-legacy.js +6 -0
  16. package/esm2015/legacy/index.js +3 -0
  17. package/esm2015/legacy/legacy-ui-angular.module.js +53 -0
  18. package/esm2015/legacy/proxies.js +1839 -0
  19. package/esm2015/lib/common/types/auth-types.js +1 -1
  20. package/esm2015/lib/components/authenticator/authenticator.module.js +79 -0
  21. package/esm2015/lib/components/authenticator/components/authenticator/authenticator.component.js +87 -0
  22. package/esm2015/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.js +40 -0
  23. package/esm2015/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.js +57 -0
  24. package/esm2015/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.js +39 -0
  25. package/esm2015/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.js +39 -0
  26. package/esm2015/lib/components/authenticator/components/federated-sign-in/federated-sign-in.component.js +47 -0
  27. package/esm2015/lib/components/authenticator/components/federated-sign-in-button/federated-sign-in-button.component.js +27 -0
  28. package/esm2015/lib/components/authenticator/components/force-new-password/force-new-password.component.js +39 -0
  29. package/esm2015/lib/components/authenticator/components/form-field/form-field.component.js +93 -0
  30. package/esm2015/lib/components/authenticator/components/index.js +17 -0
  31. package/esm2015/lib/components/authenticator/components/reset-password/reset-password.component.js +45 -0
  32. package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +65 -0
  33. package/esm2015/lib/components/authenticator/components/sign-in/sign-in.component.js +38 -0
  34. package/esm2015/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.js +34 -0
  35. package/esm2015/lib/components/authenticator/components/sign-up/sign-up.component.js +37 -0
  36. package/esm2015/lib/components/authenticator/components/user-name-alias/user-name-alias.component.js +35 -0
  37. package/esm2015/lib/components/authenticator/components/verify-user/verify-user.component.js +54 -0
  38. package/esm2015/lib/primitives/button/button.component.js +38 -0
  39. package/esm2015/lib/primitives/checkbox/checkbox.component.js +31 -0
  40. package/esm2015/lib/primitives/error/error.component.js +16 -0
  41. package/esm2015/lib/primitives/index.js +10 -3
  42. package/esm2015/lib/primitives/password-field/password-field.component.js +43 -0
  43. package/esm2015/lib/primitives/phone-number-field/phone-number-field.component.js +11 -4
  44. package/esm2015/lib/primitives/{amplify-select/amplify-select.component.js → select/select.component.js} +4 -4
  45. package/esm2015/lib/primitives/tabs/tabs.component.js +2 -2
  46. package/esm2015/lib/primitives/text-field/text-field.component.js +35 -0
  47. package/esm2015/lib/services/authenticator.service.js +133 -0
  48. package/esm2015/lib/services/custom-components.service.js +23 -0
  49. package/esm2015/lib/utilities/amplify-slot/amplify-slot.component.js +32 -0
  50. package/esm2015/lib/utilities/amplify-slot/amplify-slot.directive.js +21 -0
  51. package/fesm2015/aws-amplify-ui-angular-legacy.js +1846 -0
  52. package/fesm2015/aws-amplify-ui-angular-legacy.js.map +1 -0
  53. package/fesm2015/aws-amplify-ui-angular.js +661 -2617
  54. package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
  55. package/index.d.ts +21 -7
  56. package/legacy/aws-amplify-ui-angular-legacy.d.ts +5 -0
  57. package/legacy/aws-amplify-ui-angular-legacy.metadata.json +1 -0
  58. package/legacy/index.d.ts +2 -0
  59. package/legacy/legacy-ui-angular.module.d.ts +2 -0
  60. package/legacy/package.json +11 -0
  61. package/{lib → legacy}/proxies.d.ts +0 -0
  62. package/lib/common/types/auth-types.d.ts +2 -5
  63. package/lib/components/authenticator/authenticator.module.d.ts +2 -0
  64. package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +67 -0
  65. package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +50 -0
  66. package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +52 -0
  67. package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +49 -0
  68. package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +49 -0
  69. package/lib/components/{amplify-federated-sign-in/amplify-federated-sign-in.component.d.ts → authenticator/components/federated-sign-in/federated-sign-in.component.d.ts} +9 -6
  70. package/lib/components/authenticator/components/federated-sign-in-button/federated-sign-in-button.component.d.ts +9 -0
  71. package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +49 -0
  72. package/lib/{primitives/amplify-form-field/amplify-form-field.component.d.ts → components/authenticator/components/form-field/form-field.component.d.ts} +6 -4
  73. package/lib/components/authenticator/components/index.d.ts +16 -0
  74. package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +52 -0
  75. package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +53 -0
  76. package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +48 -0
  77. package/lib/components/authenticator/components/sign-up/sign-up-form-fields/sign-up-form-fields.component.d.ts +12 -0
  78. package/lib/components/authenticator/components/sign-up/sign-up.component.d.ts +47 -0
  79. package/lib/{primitives/amplify-user-name-alias/amplify-user-name-alias.component.d.ts → components/authenticator/components/user-name-alias/user-name-alias.component.d.ts} +4 -4
  80. package/lib/components/authenticator/components/verify-user/verify-user.component.d.ts +54 -0
  81. package/lib/primitives/{amplify-button/amplify-button.component.d.ts → button/button.component.d.ts} +1 -1
  82. package/lib/primitives/checkbox/checkbox.component.d.ts +12 -0
  83. package/lib/primitives/error/error.component.d.ts +4 -0
  84. package/lib/primitives/index.d.ts +9 -2
  85. package/lib/primitives/{amplify-password-field/amplify-password-field.component.d.ts → password-field/password-field.component.d.ts} +3 -2
  86. package/lib/primitives/phone-number-field/phone-number-field.component.d.ts +2 -0
  87. package/lib/primitives/{amplify-select/amplify-select.component.d.ts → select/select.component.d.ts} +1 -1
  88. package/lib/primitives/{amplify-text-field/amplify-text-field.component.d.ts → text-field/text-field.component.d.ts} +4 -2
  89. package/lib/services/authenticator.service.d.ts +94 -0
  90. package/lib/services/custom-components.service.d.ts +9 -0
  91. package/lib/utilities/amplify-slot/amplify-slot.component.d.ts +12 -0
  92. package/lib/{directives → utilities/amplify-slot}/amplify-slot.directive.d.ts +0 -0
  93. package/package.json +3 -4
  94. package/theme.css +0 -1
  95. package/esm2015/lib/components/amplify-authenticator/amplify-authenticator.component.js +0 -85
  96. package/esm2015/lib/components/amplify-confirm-sign-in/amplify-confirm-sign-in.component.js +0 -91
  97. package/esm2015/lib/components/amplify-confirm-sign-up/amplify-confirm-sign-up.component.js +0 -83
  98. package/esm2015/lib/components/amplify-federated-sign-in/amplify-federated-sign-in.component.js +0 -37
  99. package/esm2015/lib/components/amplify-federated-sign-in-button/amplify-federated-sign-in-button.component.js +0 -27
  100. package/esm2015/lib/components/amplify-force-new-password/amplify-force-new-password.component.js +0 -83
  101. package/esm2015/lib/components/amplify-reset-password/amplify-reset-password.component.js +0 -68
  102. package/esm2015/lib/components/amplify-setup-totp/amplify-setup-totp.component.js +0 -100
  103. package/esm2015/lib/components/amplify-sign-in/amplify-sign-in.component.js +0 -78
  104. package/esm2015/lib/components/amplify-sign-up/amplify-sign-up.component.js +0 -97
  105. package/esm2015/lib/components/amplify-verify-user/amplify-verify-user.component.js +0 -78
  106. package/esm2015/lib/components/confirm-reset-password/amplify-confirm-reset-password.component.js +0 -76
  107. package/esm2015/lib/components/confirm-verify-user/amplify-confirm-verify-user.component.js +0 -66
  108. package/esm2015/lib/components/index.js +0 -14
  109. package/esm2015/lib/directives/amplify-slot.directive.js +0 -21
  110. package/esm2015/lib/primitives/amplify-button/amplify-button.component.js +0 -38
  111. package/esm2015/lib/primitives/amplify-error/amplify-error.component.js +0 -10
  112. package/esm2015/lib/primitives/amplify-form-field/amplify-form-field.component.js +0 -91
  113. package/esm2015/lib/primitives/amplify-password-field/amplify-password-field.component.js +0 -39
  114. package/esm2015/lib/primitives/amplify-text-field/amplify-text-field.component.js +0 -29
  115. package/esm2015/lib/primitives/amplify-user-name-alias/amplify-user-name-alias.component.js +0 -35
  116. package/esm2015/lib/proxies.js +0 -1839
  117. package/esm2015/lib/services/authenticator-context.service.js +0 -28
  118. package/esm2015/lib/services/state-machine.service.js +0 -51
  119. package/esm2015/lib/ui-angular.module.js +0 -103
  120. package/lib/components/amplify-authenticator/amplify-authenticator.component.d.ts +0 -35
  121. package/lib/components/amplify-confirm-sign-in/amplify-confirm-sign-in.component.d.ts +0 -31
  122. package/lib/components/amplify-confirm-sign-up/amplify-confirm-sign-up.component.d.ts +0 -34
  123. package/lib/components/amplify-federated-sign-in-button/amplify-federated-sign-in-button.component.d.ts +0 -9
  124. package/lib/components/amplify-force-new-password/amplify-force-new-password.component.d.ts +0 -31
  125. package/lib/components/amplify-reset-password/amplify-reset-password.component.d.ts +0 -30
  126. package/lib/components/amplify-setup-totp/amplify-setup-totp.component.d.ts +0 -31
  127. package/lib/components/amplify-sign-in/amplify-sign-in.component.d.ts +0 -32
  128. package/lib/components/amplify-sign-up/amplify-sign-up.component.d.ts +0 -32
  129. package/lib/components/amplify-verify-user/amplify-verify-user.component.d.ts +0 -32
  130. package/lib/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +0 -34
  131. package/lib/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +0 -28
  132. package/lib/components/index.d.ts +0 -13
  133. package/lib/primitives/amplify-error/amplify-error.component.d.ts +0 -2
  134. package/lib/services/authenticator-context.service.d.ts +0 -10
  135. package/lib/services/state-machine.service.d.ts +0 -29
  136. package/lib/ui-angular.module.d.ts +0 -2
  137. package/styles/component.css +0 -169
@@ -1,15 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, ContentChildren, HostBinding, EventEmitter, Output, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef, NgZone, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import { Directive, TemplateRef, Input, Injectable, Component, ViewEncapsulation, ContentChildren, HostBinding, EventEmitter, Output, NgModule } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
- import { createAuthenticatorMachine, getSendEventAliases, translate, translations, getActorState, getActorContext, AuthChallengeNames, FederatedIdentityProviders, getConfiguredAliases, authInputAttributes, countryDialCodes, getAliasInfoFromContext } from '@aws-amplify/ui';
5
- import { I18n, Logger, Auth } from 'aws-amplify';
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';
6
7
  import { interpret } from 'xstate';
7
- import { __awaiter, __decorate } from 'tslib';
8
+ import { Logger as Logger$1, Auth } from 'aws-amplify';
9
+ import { __awaiter } from 'tslib';
8
10
  import QRCode from 'qrcode';
9
- import { isEmpty } from 'lodash';
10
11
  import { nanoid } from 'nanoid';
11
- import { fromEvent } from 'rxjs';
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';
13
12
 
14
13
  class AmplifySlotDirective {
15
14
  constructor(template) {
@@ -31,10 +30,12 @@ AmplifySlotDirective.propDecorators = {
31
30
  amplifySlot: [{ type: Input }]
32
31
  };
33
32
 
34
- class AuthPropService {
33
+ /**
34
+ * Stores and provides custom components that users provide with `amplify-slot`.
35
+ */
36
+ class CustomComponentsService {
35
37
  constructor() {
36
38
  this._customComponents = {};
37
- this._props = {};
38
39
  }
39
40
  get customComponents() {
40
41
  return this._customComponents;
@@ -42,86 +43,164 @@ class AuthPropService {
42
43
  set customComponents(customComponents) {
43
44
  this._customComponents = Object.assign(Object.assign({}, this._customComponents), customComponents);
44
45
  }
45
- get props() {
46
- return this._props;
47
- }
48
- set props(props) {
49
- this._props = Object.assign(Object.assign({}, this._props), props);
50
- }
51
46
  }
52
- AuthPropService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AuthPropService_Factory() { return new AuthPropService(); }, token: AuthPropService, providedIn: "root" });
53
- AuthPropService.decorators = [
47
+ CustomComponentsService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CustomComponentsService_Factory() { return new CustomComponentsService(); }, token: CustomComponentsService, providedIn: "root" });
48
+ CustomComponentsService.decorators = [
54
49
  { type: Injectable, args: [{
55
50
  providedIn: 'root',
56
51
  },] }
57
52
  ];
58
- AuthPropService.ctorParameters = () => [];
59
53
 
54
+ const logger$2 = new Logger('state-machine');
60
55
  /**
61
- * AmplifyContextService contains access to the xstate machine
62
- * and custom components passed by the user.
56
+ * AuthenticatorService provides access to the authenticator state and context.
63
57
  */
64
- class StateMachineService {
65
- startMachine({ initialState, loginMechanisms, }) {
58
+ class AuthenticatorService {
59
+ startMachine({ initialState, loginMechanisms, services, signUpAttributes, socialProviders, }) {
66
60
  const machine = createAuthenticatorMachine({
67
61
  initialState,
68
62
  loginMechanisms,
63
+ services,
64
+ signUpAttributes,
65
+ socialProviders,
69
66
  });
70
67
  const authService = interpret(machine, {
71
68
  devTools: process.env.NODE_ENV === 'development',
72
- })
73
- .onTransition((state) => {
74
- this._user = state.context.user;
69
+ }).start();
70
+ this._subscription = authService.subscribe((state) => {
75
71
  this._authState = state;
76
- })
77
- .start();
78
- this._services = getSendEventAliases(authService.send);
72
+ this._facade = getServiceContextFacade(state);
73
+ });
74
+ this._sendEventAliases = getSendEventAliases(authService.send);
79
75
  this._authService = authService;
80
76
  }
81
- get services() {
82
- return this._services;
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;
83
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 */
84
145
  get authState() {
85
146
  return this._authState;
86
147
  }
148
+ /** @deprecated For internal use only */
87
149
  get authService() {
88
150
  return this._authService;
89
151
  }
90
- get user() {
91
- return this._user;
92
- }
152
+ /** @deprecated For internal use only */
93
153
  get context() {
94
154
  return this._authState.context;
95
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 */
96
171
  send(event) {
97
172
  this.authService.send(event);
98
173
  }
99
174
  }
100
- StateMachineService.ɵprov = i0.ɵɵdefineInjectable({ factory: function StateMachineService_Factory() { return new StateMachineService(); }, token: StateMachineService, providedIn: "root" });
101
- StateMachineService.decorators = [
175
+ AuthenticatorService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AuthenticatorService_Factory() { return new AuthenticatorService(); }, token: AuthenticatorService, providedIn: "root" });
176
+ AuthenticatorService.decorators = [
102
177
  { type: Injectable, args: [{
103
178
  providedIn: 'root',
104
179
  },] }
105
180
  ];
106
181
 
107
- class AmplifyAuthenticatorComponent {
108
- constructor(stateMachine, contextService) {
109
- this.stateMachine = stateMachine;
182
+ class AuthenticatorComponent {
183
+ constructor(authenticator, contextService) {
184
+ this.authenticator = authenticator;
110
185
  this.contextService = contextService;
111
186
  this.customComponentQuery = null;
112
- this.customComponents = {};
113
187
  // translated texts
114
188
  this.signInTitle = translate('Sign In');
115
189
  this.signUpTitle = translate('Create Account');
116
190
  }
117
191
  ngOnInit() {
118
- I18n.putVocabularies(translations);
119
- const { initialState, loginMechanisms } = this;
120
- this.stateMachine.startMachine({ initialState, loginMechanisms });
192
+ const { initialState, loginMechanisms, services, signUpAttributes, socialProviders, } = this;
193
+ this.authenticator.startMachine({
194
+ initialState,
195
+ loginMechanisms,
196
+ services,
197
+ signUpAttributes,
198
+ socialProviders,
199
+ });
121
200
  /**
122
201
  * handling translations after content init, because authenticator and its
123
202
  * translations might be initialized before the main app's `ngOnInit` is run.
124
- **/
203
+ */
125
204
  this.signInTitle = translate('Sign In');
126
205
  this.signUpTitle = translate('Create Account');
127
206
  }
@@ -130,29 +209,24 @@ class AmplifyAuthenticatorComponent {
130
209
  */
131
210
  ngAfterContentInit() {
132
211
  this.contextService.customComponents = this.mapCustomComponents(this.customComponentQuery);
133
- this.customComponents = this.contextService.customComponents;
134
212
  }
135
213
  /**
136
214
  * Class Functions
137
215
  */
216
+ // context passed to "authenticated" slot
138
217
  get context() {
139
- const { signOut } = this.stateMachine.services;
140
- const user = this.stateMachine.user;
141
- return { signOut, user };
218
+ return this.authenticator.slotContext;
142
219
  }
143
- get actorState() {
144
- return getActorState(this.stateMachine.authState);
145
- }
146
- get authenticatorState() {
147
- return this.stateMachine.authState;
220
+ get route() {
221
+ return this.authenticator.route;
148
222
  }
149
223
  onTabChange() {
150
- const currentState = this.stateMachine.authState.value;
151
- if (currentState === 'signIn') {
152
- this.stateMachine.send('SIGN_UP');
224
+ const route = this.authenticator.route;
225
+ if (route === 'signIn') {
226
+ this.authenticator.toSignUp();
153
227
  }
154
228
  else {
155
- this.stateMachine.send('SIGN_IN');
229
+ this.authenticator.toSignIn();
156
230
  }
157
231
  }
158
232
  mapCustomComponents(componentQuery) {
@@ -165,393 +239,431 @@ class AmplifyAuthenticatorComponent {
165
239
  return customComponents;
166
240
  }
167
241
  }
168
- AmplifyAuthenticatorComponent.decorators = [
242
+ AuthenticatorComponent.decorators = [
169
243
  { type: Component, args: [{
170
244
  selector: 'amplify-authenticator',
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",
172
- providers: [AuthPropService],
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],
173
247
  encapsulation: ViewEncapsulation.None
174
248
  },] }
175
249
  ];
176
- AmplifyAuthenticatorComponent.ctorParameters = () => [
177
- { type: StateMachineService },
178
- { type: AuthPropService }
250
+ AuthenticatorComponent.ctorParameters = () => [
251
+ { type: AuthenticatorService },
252
+ { type: CustomComponentsService }
179
253
  ];
180
- AmplifyAuthenticatorComponent.propDecorators = {
254
+ AuthenticatorComponent.propDecorators = {
181
255
  initialState: [{ type: Input }],
182
256
  loginMechanisms: [{ type: Input }],
257
+ services: [{ type: Input }],
258
+ signUpAttributes: [{ type: Input }],
259
+ socialProviders: [{ type: Input }],
260
+ variation: [{ type: Input }],
183
261
  customComponentQuery: [{ type: ContentChildren, args: [AmplifySlotDirective,] }]
184
262
  };
185
263
 
186
- const logger$3 = new Logger('ConfirmSignIn');
187
- class AmplifyConfirmSignInComponent {
188
- constructor(stateMachine, contextService) {
189
- this.stateMachine = stateMachine;
190
- this.contextService = contextService;
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;
191
305
  this.dataAttr = '';
192
- this.customComponents = {};
193
- this.remoteError = '';
194
- this.isPending = false;
195
306
  this.confirmText = translate('Confirm');
196
307
  this.backToSignInText = translate('Back to Sign In');
197
308
  }
198
309
  ngOnInit() {
199
- this.authSubscription = this.stateMachine.authService.subscribe((state) => {
200
- this.onStateUpdate(state);
201
- });
202
310
  this.setHeaderText();
203
311
  }
204
- ngAfterContentInit() {
205
- this.customComponents = this.contextService.customComponents;
206
- }
207
- ngOnDestroy() {
208
- this.authSubscription.unsubscribe();
209
- }
210
312
  get context() {
211
- const { change, signIn, submit } = this.stateMachine.services;
212
- const remoteError = this.remoteError;
213
- return { change, remoteError, signIn, submit };
313
+ return this.authenticator.slotContext;
214
314
  }
215
315
  setHeaderText() {
216
- const state = this.stateMachine.authState;
316
+ const state = this.authenticator.authState;
217
317
  const actorContext = getActorContext(state);
218
318
  const { challengeName } = actorContext;
219
319
  switch (challengeName) {
220
320
  case AuthChallengeNames.SOFTWARE_TOKEN_MFA:
221
- // TODO: this string should be centralized and translated from ui.
222
321
  this.headerText = translate('Confirm TOTP Code');
223
322
  break;
224
323
  case AuthChallengeNames.SMS_MFA:
225
324
  this.headerText = translate('Confirm SMS Code');
226
325
  break;
227
326
  default:
228
- logger$3.error('Unexpected challengeName', challengeName);
327
+ logger$1.error('Unexpected challengeName', challengeName);
229
328
  }
230
329
  }
231
- onStateUpdate(state) {
232
- const actorState = getActorState(state);
233
- this.remoteError = actorState.context.remoteError;
234
- this.isPending = !actorState.matches('confirmSignIn.edit');
235
- }
236
330
  onInput(event) {
237
331
  event.preventDefault();
238
332
  const { name, value } = event.target;
239
- this.stateMachine.send({
240
- type: 'CHANGE',
241
- data: { name, value },
242
- });
333
+ this.authenticator.updateForm({ name, value });
243
334
  }
244
335
  onSubmit(event) {
245
336
  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),
251
- });
252
- }
253
- toSignIn() {
254
- this.stateMachine.send('SIGN_IN');
337
+ this.authenticator.submitForm();
255
338
  }
256
339
  }
257
- AmplifyConfirmSignInComponent.decorators = [
340
+ ConfirmSignInComponent.decorators = [
258
341
  { type: Component, args: [{
259
342
  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"
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"
261
344
  },] }
262
345
  ];
263
- AmplifyConfirmSignInComponent.ctorParameters = () => [
264
- { type: StateMachineService },
265
- { type: AuthPropService }
346
+ ConfirmSignInComponent.ctorParameters = () => [
347
+ { type: AuthenticatorService }
266
348
  ];
267
- AmplifyConfirmSignInComponent.propDecorators = {
349
+ ConfirmSignInComponent.propDecorators = {
268
350
  dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignin',] }]
269
351
  };
270
352
 
271
- class AmplifyConfirmSignUpComponent {
272
- constructor(stateMachine, contextService) {
273
- this.stateMachine = stateMachine;
274
- this.contextService = contextService;
275
- this.dataAttr = '';
353
+ class ConfirmSignUpComponent {
354
+ constructor(authenticator) {
355
+ this.authenticator = authenticator;
276
356
  this.headerText = translate('Confirm Sign Up');
277
- this.customComponents = {};
278
- this.remoteError = '';
279
- this.isPending = false;
357
+ this.dataAttr = '';
280
358
  // translated texts
281
359
  this.resendCodeText = translate('Resend Code');
282
- this.lostCodeText = translate('Lost your code? ');
283
360
  this.confirmText = translate('Confirm');
284
361
  }
285
- ngOnInit() {
286
- // TODO: alias for subscribe
287
- this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
362
+ get context() {
363
+ return this.authenticator.slotContext;
288
364
  }
289
- ngAfterContentInit() {
290
- this.customComponents = this.contextService.customComponents;
365
+ onInput(event) {
366
+ event.preventDefault();
367
+ const { name, value } = event.target;
368
+ this.authenticator.updateForm({ name, value });
291
369
  }
292
- ngOnDestroy() {
293
- this.authSubscription.unsubscribe();
370
+ onSubmit(event) {
371
+ event.preventDefault();
372
+ this.authenticator.submitForm();
294
373
  }
295
- onStateUpdate(state) {
296
- const actorState = getActorState(state);
297
- this.remoteError = actorState.context.remoteError;
298
- this.isPending = !actorState.matches('confirmSignUp.edit');
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');
299
397
  }
300
398
  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
- },
312
- });
399
+ return this.authenticator.slotContext;
313
400
  }
314
- onInput($event) {
315
- $event.preventDefault();
316
- const { name, value } = $event.target;
317
- this.stateMachine.send({
318
- type: 'CHANGE',
319
- data: { name, value },
320
- });
401
+ onInput(event) {
402
+ event.preventDefault();
403
+ const { name, value } = event.target;
404
+ this.authenticator.updateForm({ name, value });
321
405
  }
322
406
  onSubmit(event) {
323
407
  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
- });
408
+ this.authenticator.submitForm();
332
409
  }
333
410
  }
334
- AmplifyConfirmSignUpComponent.decorators = [
411
+ ConfirmVerifyUserComponent.decorators = [
335
412
  { type: Component, args: [{
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"
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"
338
415
  },] }
339
416
  ];
340
- AmplifyConfirmSignUpComponent.ctorParameters = () => [
341
- { type: StateMachineService },
342
- { type: AuthPropService }
417
+ ConfirmVerifyUserComponent.ctorParameters = () => [
418
+ { type: AuthenticatorService }
343
419
  ];
344
- AmplifyConfirmSignUpComponent.propDecorators = {
345
- dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignup',] }],
420
+ ConfirmVerifyUserComponent.propDecorators = {
421
+ dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmverifyuser',] }],
346
422
  headerText: [{ type: Input }]
347
423
  };
348
424
 
349
- class AmplifyFederatedSignInButtonComponent {
350
- constructor(stateMachine) {
351
- this.stateMachine = stateMachine;
425
+ class FederatedSignInButtonComponent {
426
+ constructor(authenticator) {
427
+ this.authenticator = authenticator;
352
428
  this.onClick = () => {
353
- this.stateMachine.send({
429
+ this.authenticator.send({
354
430
  type: 'FEDERATED_SIGN_IN',
355
431
  data: { provider: this.provider },
356
432
  });
357
433
  };
358
434
  }
359
435
  }
360
- AmplifyFederatedSignInButtonComponent.decorators = [
436
+ FederatedSignInButtonComponent.decorators = [
361
437
  { type: Component, args: [{
362
438
  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"
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"
364
440
  },] }
365
441
  ];
366
- AmplifyFederatedSignInButtonComponent.ctorParameters = () => [
367
- { type: StateMachineService }
442
+ FederatedSignInButtonComponent.ctorParameters = () => [
443
+ { type: AuthenticatorService }
368
444
  ];
369
- AmplifyFederatedSignInButtonComponent.propDecorators = {
445
+ FederatedSignInButtonComponent.propDecorators = {
370
446
  provider: [{ type: Input }],
371
447
  text: [{ type: Input }]
372
448
  };
373
449
 
374
- class AmplifyFederatedSignInComponent {
375
- constructor(stateMachine) {
376
- this.stateMachine = stateMachine;
450
+ class FederatedSignInComponent {
451
+ constructor(authenticator) {
452
+ this.authenticator = authenticator;
377
453
  this.FederatedProviders = FederatedIdentityProviders;
454
+ this.includeAmazon = false;
455
+ this.includeApple = false;
378
456
  this.includeFacebook = false;
379
457
  this.includeGoogle = false;
380
- this.includeAmazon = false;
381
458
  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
459
  }
387
460
  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');
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');
393
468
  this.shouldShowFederatedSignIn =
394
- this.includeFacebook || this.includeGoogle || this.includeAmazon;
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`);
395
481
  }
396
482
  }
397
- AmplifyFederatedSignInComponent.decorators = [
483
+ FederatedSignInComponent.decorators = [
398
484
  { type: Component, args: [{
399
485
  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"
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"
401
487
  },] }
402
488
  ];
403
- AmplifyFederatedSignInComponent.ctorParameters = () => [
404
- { type: StateMachineService }
489
+ FederatedSignInComponent.ctorParameters = () => [
490
+ { type: AuthenticatorService }
405
491
  ];
406
492
 
407
- const logger$2 = new Logger('ForceNewPassword');
408
- class AmplifyForceNewPasswordComponent {
409
- constructor(stateMachine, contextService) {
410
- this.stateMachine = stateMachine;
411
- this.contextService = contextService;
493
+ class ForceNewPasswordComponent {
494
+ constructor(authenticator) {
495
+ this.authenticator = authenticator;
412
496
  this.dataAttr = '';
413
497
  this.headerText = translate('Change Password');
414
- this.customComponents = {};
415
- this.remoteError = '';
416
- this.isPending = false;
417
498
  // translated texts
418
499
  this.changePasswordText = translate('Change Password');
419
500
  this.backToSignInText = translate('Back to Sign In');
420
501
  }
421
- ngOnInit() {
422
- this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
423
- }
424
- ngAfterContentInit() {
425
- this.customComponents = this.contextService.customComponents;
426
- }
427
- ngOnDestroy() {
428
- logger$2.log('sign in destroyed, unsubscribing from state machine...');
429
- this.authSubscription.unsubscribe();
430
- }
431
- onStateUpdate(state) {
432
- const actorState = getActorState(state);
433
- this.remoteError = actorState.context.remoteError;
434
- this.isPending = actorState.matches({
435
- signUp: {
436
- submission: 'idle',
437
- },
438
- });
439
- }
440
502
  get context() {
441
- const { change, signIn, submit } = this.stateMachine.services;
442
- const user = this.stateMachine.user;
443
- const remoteError = this.remoteError;
444
- return { change, remoteError, signIn, submit, user };
445
- }
446
- toSignIn() {
447
- this.stateMachine.send('SIGN_IN');
503
+ return this.authenticator.slotContext;
448
504
  }
449
505
  onInput(event) {
450
506
  event.preventDefault();
451
507
  const { name, value } = event.target;
452
- this.stateMachine.send({
453
- type: 'CHANGE',
454
- data: { name, value },
455
- });
508
+ this.authenticator.updateForm({ name, value });
456
509
  }
457
510
  onSubmit(event) {
458
511
  event.preventDefault();
459
- // consider stateMachine directly providing actorState / actorContext
460
- const state = this.stateMachine.authState;
461
- const actorState = getActorContext(state);
462
- const { formValues } = actorState;
463
- this.stateMachine.send({
464
- type: 'SUBMIT',
465
- data: formValues,
466
- });
512
+ this.authenticator.submitForm();
467
513
  }
468
514
  }
469
- AmplifyForceNewPasswordComponent.decorators = [
515
+ ForceNewPasswordComponent.decorators = [
470
516
  { type: Component, args: [{
471
517
  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"
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"
473
519
  },] }
474
520
  ];
475
- AmplifyForceNewPasswordComponent.ctorParameters = () => [
476
- { type: StateMachineService },
477
- { type: AuthPropService }
521
+ ForceNewPasswordComponent.ctorParameters = () => [
522
+ { type: AuthenticatorService }
478
523
  ];
479
- AmplifyForceNewPasswordComponent.propDecorators = {
524
+ ForceNewPasswordComponent.propDecorators = {
480
525
  dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-forcenewpassword',] }],
481
526
  headerText: [{ type: Input }]
482
527
  };
483
528
 
484
- class AmplifyResetPasswordComponent {
485
- constructor(stateMachine, contextService) {
486
- this.stateMachine = stateMachine;
487
- this.contextService = contextService;
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;
488
623
  this.dataAttr = '';
489
624
  this.headerText = translate('Reset your password');
490
- this.customComponents = {};
491
- this.remoteError = '';
492
- this.isPending = false;
493
625
  // translated texts
494
626
  this.sendCodeText = translate('Send Code');
495
627
  this.backToSignInText = translate('Back to Sign In');
628
+ this.labelText = translate('Username');
496
629
  }
497
630
  ngOnInit() {
498
- this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
499
- }
500
- ngAfterContentInit() {
501
- this.customComponents = this.contextService.customComponents;
502
- }
503
- ngOnDestroy() {
504
- this.authSubscription.unsubscribe();
505
- }
506
- onStateUpdate(state) {
507
- const actorState = getActorState(state);
508
- this.remoteError = actorState.context.remoteError;
509
- this.isPending = !actorState.matches('resetPassword.edit');
631
+ const { authState } = this.authenticator;
632
+ const { label } = getAliasInfoFromContext(authState.context);
633
+ this.labelText = `Enter your ${label.toLowerCase()}`;
510
634
  }
511
635
  get context() {
512
- const { change, signIn, submit } = this.stateMachine.services;
513
- const remoteError = this.remoteError;
514
- return { change, remoteError, signIn, submit };
515
- }
516
- toSignIn() {
517
- this.stateMachine.send('SIGN_IN');
636
+ return this.authenticator.slotContext;
518
637
  }
519
638
  onInput(event) {
520
639
  event.preventDefault();
521
640
  const { name, value } = event.target;
522
- this.stateMachine.send({
523
- type: 'CHANGE',
524
- data: { name, value },
525
- });
641
+ this.authenticator.updateForm({ name, value });
526
642
  }
527
643
  onSubmit(event) {
528
644
  event.preventDefault();
529
- this.stateMachine.send('SUBMIT');
645
+ this.authenticator.submitForm();
530
646
  }
531
647
  }
532
- AmplifyResetPasswordComponent.decorators = [
648
+ ResetPasswordComponent.decorators = [
533
649
  { type: Component, args: [{
534
650
  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"
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"
536
652
  },] }
537
653
  ];
538
- AmplifyResetPasswordComponent.ctorParameters = () => [
539
- { type: StateMachineService },
540
- { type: AuthPropService }
654
+ ResetPasswordComponent.ctorParameters = () => [
655
+ { type: AuthenticatorService }
541
656
  ];
542
- AmplifyResetPasswordComponent.propDecorators = {
657
+ ResetPasswordComponent.propDecorators = {
543
658
  dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-resetPassword',] }],
544
659
  headerText: [{ type: Input }]
545
660
  };
546
661
 
547
- const logger$1 = new Logger('SetupTotp');
548
- class AmplifySetupTotpComponent {
549
- constructor(stateMachine, contextService) {
550
- this.stateMachine = stateMachine;
551
- this.contextService = contextService;
552
- this.customComponents = {};
553
- this.remoteError = '';
554
- this.isPending = false;
662
+ const logger = new Logger$1('SetupTotp');
663
+ class SetupTotpComponent {
664
+ constructor(authenticator) {
665
+ this.authenticator = authenticator;
666
+ this.dataAttr = '';
555
667
  this.headerText = translate('Setup TOTP');
556
668
  this.qrCodeSource = '';
557
669
  // translated texts
@@ -559,448 +671,234 @@ class AmplifySetupTotpComponent {
559
671
  this.confirmText = translate('Confirm');
560
672
  }
561
673
  ngOnInit() {
562
- this.authSubscription = this.stateMachine.authService.subscribe((state) => {
563
- this.onStateUpdate(state);
564
- });
565
674
  this.generateQRCode();
566
675
  }
567
- ngAfterContentInit() {
568
- this.customComponents = this.contextService.customComponents;
569
- }
570
- ngOnDestroy() {
571
- this.authSubscription.unsubscribe();
572
- }
573
- onStateUpdate(state) {
574
- const actorState = getActorState(state);
575
- this.remoteError = actorState.context.remoteError;
576
- this.isPending = !actorState.matches('setupTOTP.edit');
577
- }
578
676
  get context() {
579
- const { change, submit } = this.stateMachine.services;
580
- const remoteError = this.remoteError;
581
- const user = this.stateMachine.user;
582
- return { change, remoteError, submit, user };
677
+ return this.authenticator.slotContext;
583
678
  }
584
679
  generateQRCode() {
585
- var _a;
586
680
  return __awaiter(this, void 0, void 0, function* () {
587
681
  // TODO: This should be handled in core.
588
- const state = this.stateMachine.authState;
682
+ const state = this.authenticator.authState;
589
683
  const actorContext = getActorContext(state);
590
684
  const { user } = actorContext;
591
685
  try {
592
686
  const secretKey = yield Auth.setupTOTP(user);
593
687
  const issuer = 'AWSCognito';
594
688
  const totpCode = `otpauth://totp/${issuer}:${user.username}?secret=${secretKey}&issuer=${issuer}`;
595
- logger$1.info('totp code was generated:', totpCode);
689
+ logger.info('totp code was generated:', totpCode);
596
690
  this.qrCodeSource = yield QRCode.toDataURL(totpCode);
597
691
  }
598
692
  catch (err) {
599
- this.remoteError = (_a = err.message) !== null && _a !== void 0 ? _a : err;
600
- logger$1.error(err);
693
+ logger.error(err);
601
694
  }
602
695
  });
603
696
  }
604
697
  onInput(event) {
605
698
  event.preventDefault();
606
699
  const { name, value } = event.target;
607
- this.stateMachine.send({
608
- type: 'CHANGE',
609
- data: { name, value },
610
- });
700
+ this.authenticator.updateForm({ name, value });
611
701
  }
612
702
  onSubmit(event) {
613
703
  event.preventDefault();
614
- // TODO: handle form data within the state machine
615
- const formData = new FormData(event.target);
616
- this.stateMachine.send({
617
- type: 'SUBMIT',
618
- data: Object.fromEntries(formData),
619
- });
620
- }
621
- toSignIn() {
622
- this.stateMachine.send('SIGN_IN');
704
+ this.authenticator.submitForm();
623
705
  }
624
706
  }
625
- AmplifySetupTotpComponent.decorators = [
707
+ SetupTotpComponent.decorators = [
626
708
  { type: Component, args: [{
627
709
  selector: 'amplify-setup-totp',
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"
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"
629
711
  },] }
630
712
  ];
631
- AmplifySetupTotpComponent.ctorParameters = () => [
632
- { type: StateMachineService },
633
- { type: AuthPropService }
713
+ SetupTotpComponent.ctorParameters = () => [
714
+ { type: AuthenticatorService }
634
715
  ];
635
- AmplifySetupTotpComponent.propDecorators = {
636
- customComponents: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-setup-totp',] }]
716
+ SetupTotpComponent.propDecorators = {
717
+ dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-setup-totp',] }]
637
718
  };
638
719
 
639
- const logger = new Logger('SignIn');
640
- class AmplifySignInComponent {
641
- constructor(stateMachine, contextService) {
642
- this.stateMachine = stateMachine;
643
- this.contextService = contextService;
720
+ class SignInComponent {
721
+ constructor(authenticator) {
722
+ this.authenticator = authenticator;
644
723
  this.dataAttr = '';
645
- this.headerText = translate('Sign in to your account');
646
- this.customComponents = {};
647
- this.remoteError = '';
648
- this.isPending = false;
649
724
  // translated phrases
650
725
  this.forgotPasswordText = translate('Forgot your password? ');
651
726
  this.signInButtonText = translate('Sign in');
652
- this.noAccountText = translate('No account? ');
653
- }
654
- ngOnInit() {
655
- this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
656
- }
657
- ngAfterContentInit() {
658
- this.customComponents = this.contextService.customComponents;
659
- }
660
- ngOnDestroy() {
661
- logger.log('sign in destroyed, unsubscribing from state machine...');
662
- this.authSubscription.unsubscribe();
663
- }
664
- onStateUpdate(state) {
665
- const actorState = getActorState(state);
666
- this.remoteError = actorState.context.remoteError;
667
- this.isPending = !actorState.matches('signIn.edit');
668
727
  }
669
728
  get context() {
670
- const { change, resetPassword, signUp, submit } = this.stateMachine.services;
671
- const remoteError = this.remoteError;
672
- return { change, remoteError, resetPassword, signUp, submit };
673
- }
674
- toResetPassword() {
675
- this.stateMachine.send('RESET_PASSWORD');
729
+ return this.authenticator.slotContext;
676
730
  }
677
731
  onInput(event) {
678
732
  event.preventDefault();
679
733
  const { name, value } = event.target;
680
- this.stateMachine.send({
681
- type: 'CHANGE',
682
- data: { name, value },
683
- });
734
+ this.authenticator.updateForm({ name, value });
684
735
  }
685
736
  onSubmit(event) {
686
- return __awaiter(this, void 0, void 0, function* () {
687
- event.preventDefault();
688
- this.stateMachine.send({
689
- type: 'SUBMIT',
690
- });
691
- });
737
+ event.preventDefault();
738
+ this.authenticator.submitForm();
692
739
  }
693
740
  }
694
- AmplifySignInComponent.decorators = [
741
+ SignInComponent.decorators = [
695
742
  { type: Component, args: [{
696
743
  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",
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",
698
745
  encapsulation: ViewEncapsulation.None
699
746
  },] }
700
747
  ];
701
- AmplifySignInComponent.ctorParameters = () => [
702
- { type: StateMachineService },
703
- { type: AuthPropService }
748
+ SignInComponent.ctorParameters = () => [
749
+ { type: AuthenticatorService }
704
750
  ];
705
- AmplifySignInComponent.propDecorators = {
706
- dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-signin',] }],
707
- headerText: [{ type: Input }]
751
+ SignInComponent.propDecorators = {
752
+ dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-signin',] }]
708
753
  };
709
754
 
710
- class AmplifySignUpComponent {
711
- constructor(stateMachine, contextService) {
712
- this.stateMachine = stateMachine;
713
- this.contextService = contextService;
755
+ class SignUpComponent {
756
+ constructor(authenticator) {
757
+ this.authenticator = authenticator;
714
758
  this.dataAttr = '';
715
- this.headerText = translate('Create a new account');
716
- this.remoteError = '';
717
- this.isPending = false;
718
- this.primaryAlias = '';
719
- this.secondaryAliases = [];
720
- this.validationError = {};
721
759
  // translated texts
722
760
  this.createAccountText = translate('Create Account');
723
761
  }
724
762
  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
- };
735
- }
736
- ngOnInit() {
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;
751
- }
752
- ngAfterContentInit() {
753
- this.customComponents = this.contextService.customComponents;
754
- }
755
- ngOnDestroy() {
756
- this.authSubscription.unsubscribe();
757
- }
758
- onStateUpdate(state) {
759
- const actorState = getActorState(state);
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
- });
768
- }
769
- onSubmit($event) {
770
- return __awaiter(this, void 0, void 0, function* () {
771
- $event.preventDefault();
772
- this.stateMachine.send('SUBMIT');
773
- });
763
+ return this.authenticator.slotContext;
774
764
  }
775
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) {
776
772
  event.preventDefault();
777
- const { name, value } = event.target;
778
- this.stateMachine.send({
779
- type: 'CHANGE',
780
- data: { name, value },
781
- });
773
+ this.authenticator.submitForm();
782
774
  }
783
775
  }
784
- AmplifySignUpComponent.decorators = [
776
+ SignUpComponent.decorators = [
785
777
  { type: Component, args: [{
786
778
  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"
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"
788
780
  },] }
789
781
  ];
790
- AmplifySignUpComponent.ctorParameters = () => [
791
- { type: StateMachineService },
792
- { type: AuthPropService }
782
+ SignUpComponent.ctorParameters = () => [
783
+ { type: AuthenticatorService }
793
784
  ];
794
- AmplifySignUpComponent.propDecorators = {
795
- dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-signup',] }],
796
- headerText: [{ type: Input }]
785
+ SignUpComponent.propDecorators = {
786
+ dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-signup',] }]
797
787
  };
798
788
 
799
- const getAttributeMap = () => authInputAttributes;
800
-
801
- class AmplifyVerifyUserComponent {
802
- constructor(stateMachine, contextService) {
803
- this.stateMachine = stateMachine;
804
- this.contextService = contextService;
805
- this.dataAttr = '';
806
- this.headerText = translate('Account recovery requires verified contact information');
807
- this.customComponents = {};
808
- this.unverifiedAttributes = {};
809
- this.remoteError = '';
810
- this.isPending = false;
811
- this.labelId = nanoid(12);
812
- // translated texts
813
- this.skipText = translate('Skip');
814
- this.verifyText = translate('Verify');
789
+ class SignUpFormFieldsComponent {
790
+ constructor(authenticator) {
791
+ this.authenticator = authenticator;
792
+ this.primaryAlias = '';
793
+ this.secondaryAliases = [];
815
794
  }
816
795
  ngOnInit() {
817
- this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
818
- }
819
- ngAfterContentInit() {
820
- this.customComponents = this.contextService.customComponents;
821
- }
822
- ngOnDestroy() {
823
- this.authSubscription.unsubscribe();
824
- }
825
- onStateUpdate(state) {
826
- const actorState = getActorState(state);
827
- this.unverifiedAttributes = actorState.context.unverifiedAttributes;
828
- this.remoteError = actorState.context.remoteError;
829
- this.isPending = !actorState.matches('verifyUser.edit');
830
- }
831
- get context() {
832
- const { change, skip, submit } = this.stateMachine.services;
833
- const remoteError = this.remoteError;
834
- return { change, remoteError, skip, submit };
835
- }
836
- skipVerify() {
837
- this.stateMachine.send('SKIP');
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
- }
845
- onSubmit(event) {
846
- return __awaiter(this, void 0, void 0, function* () {
847
- event.preventDefault();
848
- const formData = new FormData(event.target);
849
- this.stateMachine.send({
850
- type: 'SUBMIT',
851
- data: Object.fromEntries(formData),
852
- });
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;
853
805
  });
806
+ // Only 1 is supported, so `['email', 'phone_number']` will only show `email`
807
+ this.loginMechanism = this.fieldNames.shift();
854
808
  }
855
809
  }
856
- AmplifyVerifyUserComponent.decorators = [
810
+ SignUpFormFieldsComponent.decorators = [
857
811
  { type: Component, args: [{
858
- selector: 'amplify-verify-user',
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",
860
- encapsulation: ViewEncapsulation.None
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"
861
814
  },] }
862
815
  ];
863
- AmplifyVerifyUserComponent.ctorParameters = () => [
864
- { type: StateMachineService },
865
- { type: AuthPropService }
816
+ SignUpFormFieldsComponent.ctorParameters = () => [
817
+ { type: AuthenticatorService }
866
818
  ];
867
- AmplifyVerifyUserComponent.propDecorators = {
868
- dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-verifyuser',] }],
869
- headerText: [{ type: Input }]
870
- };
871
819
 
872
- class ConfirmResetPasswordComponent {
873
- constructor(stateMachine, contextService) {
874
- this.stateMachine = stateMachine;
875
- this.contextService = contextService;
876
- this.dataAttr = '';
877
- this.headerText = translate('Reset your password');
878
- this.customComponents = {};
879
- this.remoteError = '';
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');
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;
886
827
  }
887
828
  ngOnInit() {
888
- this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
889
- }
890
- ngAfterContentInit() {
891
- this.customComponents = this.contextService.customComponents;
892
- }
893
- ngOnDestroy() {
894
- this.authSubscription.unsubscribe();
895
- }
896
- onStateUpdate(state) {
897
- const actorState = getActorState(state);
898
- this.remoteError = actorState.context.remoteError;
899
- this.isPending = !actorState.matches('confirmResetPassword.edit');
900
- }
901
- get context() {
902
- const { change, resend, signIn, submit } = this.stateMachine.services;
903
- const remoteError = this.remoteError;
904
- return { change, resend, remoteError, signIn, submit };
905
- }
906
- toSignIn() {
907
- this.stateMachine.send('SIGN_IN');
908
- }
909
- resend() {
910
- this.stateMachine.send('RESEND');
911
- }
912
- onInput(event) {
913
- event.preventDefault();
914
- const { name, value } = event.target;
915
- this.stateMachine.send({
916
- type: 'CHANGE',
917
- data: { name, value },
918
- });
919
- }
920
- onSubmit(event) {
921
- return __awaiter(this, void 0, void 0, function* () {
922
- event.preventDefault();
923
- this.stateMachine.send('SUBMIT');
924
- });
829
+ const context = this.authenticator.context;
830
+ const { label, type } = getAliasInfoFromContext(context);
831
+ this.label = label;
832
+ this.type = type;
833
+ this.placeholder = label;
925
834
  }
926
835
  }
927
- ConfirmResetPasswordComponent.decorators = [
836
+ UserNameAliasComponent.decorators = [
928
837
  { type: Component, args: [{
929
- selector: 'amplify-confirm-reset-password',
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"
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"
931
840
  },] }
932
841
  ];
933
- ConfirmResetPasswordComponent.ctorParameters = () => [
934
- { type: StateMachineService },
935
- { type: AuthPropService }
842
+ UserNameAliasComponent.ctorParameters = () => [
843
+ { type: AuthenticatorService }
936
844
  ];
937
- ConfirmResetPasswordComponent.propDecorators = {
938
- dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmsignin',] }],
939
- headerText: [{ type: Input }]
845
+ UserNameAliasComponent.propDecorators = {
846
+ name: [{ type: Input }],
847
+ disabled: [{ type: Input }],
848
+ initialValue: [{ type: Input }],
849
+ required: [{ type: Input }]
940
850
  };
941
851
 
942
- class ConfirmVerifyUserComponent {
943
- constructor(stateMachine, contextService) {
944
- this.stateMachine = stateMachine;
945
- this.contextService = contextService;
852
+ class VerifyUserComponent {
853
+ constructor(authenticator) {
854
+ this.authenticator = authenticator;
946
855
  this.dataAttr = '';
947
856
  this.headerText = translate('Account recovery requires verified contact information');
948
- this.customComponents = {};
949
- this.remoteError = '';
950
- this.isPending = false;
857
+ this.unverifiedAttributes = {};
858
+ this.labelId = nanoid(12);
951
859
  // translated texts
952
860
  this.skipText = translate('Skip');
953
- this.submitText = translate('Submit');
861
+ this.verifyText = translate('Verify');
954
862
  }
955
863
  ngOnInit() {
956
- this.authSubscription = this.stateMachine.authService.subscribe((state) => this.onStateUpdate(state));
957
- }
958
- ngAfterContentInit() {
959
- this.customComponents = this.contextService.customComponents;
960
- }
961
- ngOnDestroy() {
962
- this.authSubscription.unsubscribe();
963
- }
964
- onStateUpdate(state) {
965
- const actorState = getActorState(state);
966
- this.remoteError = actorState.context.remoteError;
967
- this.isPending = !actorState.matches('confirmVerifyUser.edit');
864
+ const actorState = getActorState(this.authenticator.authState);
865
+ this.unverifiedAttributes = actorState.context.unverifiedAttributes;
968
866
  }
969
867
  get context() {
970
- const { skip, submit } = this.stateMachine.services;
971
- const remoteError = this.remoteError;
972
- return { remoteError, skip, submit };
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);
973
875
  }
974
- skipVerify() {
975
- this.stateMachine.send('SKIP');
876
+ onInput(event) {
877
+ event.preventDefault();
878
+ const { name, value } = event.target;
879
+ this.authenticator.updateForm({ name, value });
976
880
  }
977
881
  onSubmit(event) {
978
- return __awaiter(this, void 0, void 0, function* () {
979
- event.preventDefault();
980
- const formData = new FormData(event.target);
981
- this.stateMachine.send({
982
- type: 'SUBMIT',
983
- data: Object.fromEntries(formData),
984
- });
985
- });
882
+ event.preventDefault();
883
+ this.authenticator.submitForm();
986
884
  }
987
885
  }
988
- ConfirmVerifyUserComponent.decorators = [
886
+ VerifyUserComponent.decorators = [
989
887
  { type: Component, args: [{
990
- selector: 'amplify-confirm-verify-user',
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"
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
992
891
  },] }
993
892
  ];
994
- ConfirmVerifyUserComponent.ctorParameters = () => [
995
- { type: StateMachineService },
996
- { type: AuthPropService }
893
+ VerifyUserComponent.ctorParameters = () => [
894
+ { type: AuthenticatorService }
997
895
  ];
998
- ConfirmVerifyUserComponent.propDecorators = {
999
- dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-confirmverifyuser',] }],
896
+ VerifyUserComponent.propDecorators = {
897
+ dataAttr: [{ type: HostBinding, args: ['attr.data-amplify-authenticator-verifyuser',] }],
1000
898
  headerText: [{ type: Input }]
1001
899
  };
1002
900
 
1003
- class AmplifyButtonComponent {
901
+ class ButtonComponent {
1004
902
  constructor() {
1005
903
  this.type = 'button';
1006
904
  this.fullWidth = false;
@@ -1017,13 +915,13 @@ class AmplifyButtonComponent {
1017
915
  this.fontWeightAttr = this.fontWeight;
1018
916
  }
1019
917
  }
1020
- AmplifyButtonComponent.decorators = [
918
+ ButtonComponent.decorators = [
1021
919
  { type: Component, args: [{
1022
920
  selector: 'button[amplify-button]',
1023
921
  template: "<ng-content></ng-content>\n"
1024
922
  },] }
1025
923
  ];
1026
- AmplifyButtonComponent.propDecorators = {
924
+ ButtonComponent.propDecorators = {
1027
925
  type: [{ type: Input }],
1028
926
  fullWidth: [{ type: Input }],
1029
927
  size: [{ type: Input }],
@@ -1037,109 +935,61 @@ AmplifyButtonComponent.propDecorators = {
1037
935
  fontWeightAttr: [{ type: HostBinding, args: ['style.font-weight',] }]
1038
936
  };
1039
937
 
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;
938
+ class CheckboxComponent {
939
+ constructor() {
940
+ this.defaultChecked = false;
941
+ this.hasError = false;
942
+ this.isChecked = false;
1066
943
  }
1067
944
  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
- });
945
+ if (this.defaultChecked) {
946
+ this.isChecked = true;
1081
947
  }
1082
948
  }
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';
949
+ handleClick() {
950
+ this.isChecked = !this.isChecked;
1113
951
  }
1114
952
  }
1115
- AmplifyFormFieldComponent.decorators = [
953
+ CheckboxComponent.decorators = [
1116
954
  { 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"
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"
1119
957
  },] }
1120
958
  ];
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 }],
959
+ CheckboxComponent.propDecorators = {
960
+ defaultChecked: [{ type: Input }],
961
+ errorMessage: [{ type: Input }],
962
+ hasError: [{ type: Input }],
1129
963
  label: [{ type: Input }],
1130
- initialValue: [{ type: Input }],
1131
- disabled: [{ type: Input }],
1132
- autocomplete: [{ type: Input }]
964
+ name: [{ type: Input }],
965
+ value: [{ type: Input }]
1133
966
  };
1134
967
 
1135
- class AmplifyPasswordFieldComponent {
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 {
1136
984
  constructor() {
1137
985
  this.autocomplete = 'new-password';
1138
986
  this.disabled = false;
987
+ this.fieldId = `amplify-field-${nanoid(12)}`;
1139
988
  this.initialValue = '';
1140
989
  this.label = '';
1141
990
  this.placeholder = '';
1142
991
  this.required = true;
992
+ this.labelHidden = false;
1143
993
  this.type = 'password';
1144
994
  this.showPassword = false;
1145
995
  this.showPasswordButtonlabel = translate('Show password');
@@ -1152,32 +1002,70 @@ class AmplifyPasswordFieldComponent {
1152
1002
  this.type = this.showPassword ? 'text' : 'password';
1153
1003
  }
1154
1004
  }
1155
- AmplifyPasswordFieldComponent.decorators = [
1005
+ PasswordFieldComponent.decorators = [
1156
1006
  { type: Component, args: [{
1157
1007
  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"
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"
1159
1009
  },] }
1160
1010
  ];
1161
- AmplifyPasswordFieldComponent.propDecorators = {
1011
+ PasswordFieldComponent.propDecorators = {
1162
1012
  autocomplete: [{ type: Input }],
1163
1013
  disabled: [{ type: Input }],
1164
- id: [{ type: Input }],
1014
+ fieldId: [{ type: Input }],
1165
1015
  initialValue: [{ type: Input }],
1166
1016
  label: [{ type: Input }],
1167
1017
  name: [{ type: Input }],
1168
1018
  placeholder: [{ type: Input }],
1169
- required: [{ 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',] }]
1170
1058
  };
1171
1059
 
1172
- class AmplifySelectComponent {
1060
+ class SelectComponent {
1173
1061
  }
1174
- AmplifySelectComponent.decorators = [
1062
+ SelectComponent.decorators = [
1175
1063
  { type: Component, args: [{
1176
1064
  selector: 'amplify-form-select',
1177
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"
1178
1066
  },] }
1179
1067
  ];
1180
- AmplifySelectComponent.propDecorators = {
1068
+ SelectComponent.propDecorators = {
1181
1069
  items: [{ type: Input }],
1182
1070
  name: [{ type: Input }],
1183
1071
  label: [{ type: Input }],
@@ -1238,7 +1126,7 @@ class TabsComponent {
1238
1126
  TabsComponent.decorators = [
1239
1127
  { type: Component, args: [{
1240
1128
  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"
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"
1242
1130
  },] }
1243
1131
  ];
1244
1132
  TabsComponent.propDecorators = {
@@ -1246,1954 +1134,110 @@ TabsComponent.propDecorators = {
1246
1134
  tabChange: [{ type: Output }]
1247
1135
  };
1248
1136
 
1249
- class AmplifyTextFieldComponent {
1137
+ class TextFieldComponent {
1250
1138
  constructor() {
1251
1139
  this.autocomplete = 'new-password';
1252
1140
  this.disabled = false;
1141
+ this.fieldId = `amplify-field-${nanoid(12)}`;
1253
1142
  this.initialValue = '';
1254
1143
  this.label = '';
1255
1144
  this.placeholder = '';
1256
1145
  this.required = true;
1146
+ this.labelHidden = false;
1147
+ this.display = 'contents';
1257
1148
  }
1258
1149
  }
1259
- AmplifyTextFieldComponent.decorators = [
1150
+ TextFieldComponent.decorators = [
1260
1151
  { type: Component, args: [{
1261
1152
  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"
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"
1263
1154
  },] }
1264
1155
  ];
1265
- AmplifyTextFieldComponent.propDecorators = {
1156
+ TextFieldComponent.propDecorators = {
1266
1157
  autocomplete: [{ type: Input }],
1267
1158
  disabled: [{ type: Input }],
1268
- id: [{ type: Input }],
1159
+ fieldId: [{ type: Input }],
1269
1160
  initialValue: [{ type: Input }],
1270
1161
  label: [{ type: Input }],
1271
1162
  name: [{ type: Input }],
1272
1163
  placeholder: [{ type: Input }],
1273
1164
  required: [{ type: Input }],
1274
- type: [{ type: Input }]
1165
+ type: [{ type: Input }],
1166
+ labelHidden: [{ type: Input }],
1167
+ display: [{ type: HostBinding, args: ['style.display',] }]
1275
1168
  };
1276
1169
 
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;
1170
+ class AmplifySlotComponent {
1171
+ constructor(propService) {
1172
+ this.propService = propService;
1173
+ this.display = 'contents';
1174
+ this.isOverriden = false;
1284
1175
  }
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
-
1309
- const proxyInputs = (Cmp, inputs) => {
1310
- const Prototype = Cmp.prototype;
1311
- inputs.forEach((item) => {
1312
- Object.defineProperty(Prototype, item, {
1313
- get() {
1314
- return this.el[item];
1315
- },
1316
- set(val) {
1317
- this.z.runOutsideAngular(() => (this.el[item] = val));
1318
- },
1319
- });
1320
- });
1321
- };
1322
- const proxyMethods = (Cmp, methods) => {
1323
- const Prototype = Cmp.prototype;
1324
- methods.forEach((methodName) => {
1325
- Prototype[methodName] = function () {
1326
- const args = arguments;
1327
- return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
1328
- };
1329
- });
1330
- };
1331
- const proxyOutputs = (instance, el, events) => {
1332
- events.forEach((eventName) => (instance[eventName] = fromEvent(el, eventName)));
1333
- };
1334
- // tslint:disable-next-line: only-arrow-functions
1335
- function ProxyCmp(opts) {
1336
- const decorator = function (cls) {
1337
- if (opts.inputs) {
1338
- proxyInputs(cls, opts.inputs);
1339
- }
1340
- if (opts.methods) {
1341
- proxyMethods(cls, opts.methods);
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;
1342
1182
  }
1343
- return cls;
1344
- };
1345
- return decorator;
1346
- }
1347
- let AmplifyAmazonButton = class AmplifyAmazonButton {
1348
- constructor(c, r, z) {
1349
- this.z = z;
1350
- c.detach();
1351
- this.el = r.nativeElement;
1352
- }
1353
- };
1354
- AmplifyAmazonButton.decorators = [
1355
- { type: Component, args: [{
1356
- selector: 'amplify-amazon-button',
1357
- changeDetection: ChangeDetectionStrategy.OnPush,
1358
- template: '<ng-content></ng-content>',
1359
- inputs: ['clientId', 'handleAuthStateChange']
1360
- },] }
1361
- ];
1362
- AmplifyAmazonButton.ctorParameters = () => [
1363
- { type: ChangeDetectorRef },
1364
- { type: ElementRef },
1365
- { type: NgZone }
1366
- ];
1367
- AmplifyAmazonButton = __decorate([
1368
- ProxyCmp({ inputs: ['clientId', 'handleAuthStateChange'] })
1369
- ], AmplifyAmazonButton);
1370
- class AmplifyAuthContainer {
1371
- constructor(c, r, z) {
1372
- this.z = z;
1373
- c.detach();
1374
- this.el = r.nativeElement;
1375
- }
1376
- }
1377
- AmplifyAuthContainer.decorators = [
1378
- { type: Component, args: [{
1379
- selector: 'amplify-auth-container',
1380
- changeDetection: ChangeDetectionStrategy.OnPush,
1381
- template: '<ng-content></ng-content>'
1382
- },] }
1383
- ];
1384
- AmplifyAuthContainer.ctorParameters = () => [
1385
- { type: ChangeDetectorRef },
1386
- { type: ElementRef },
1387
- { type: NgZone }
1388
- ];
1389
- let AmplifyAuthFields = class AmplifyAuthFields {
1390
- constructor(c, r, z) {
1391
- this.z = z;
1392
- c.detach();
1393
- this.el = r.nativeElement;
1394
- }
1395
- };
1396
- AmplifyAuthFields.decorators = [
1397
- { type: Component, args: [{
1398
- selector: 'amplify-auth-fields',
1399
- changeDetection: ChangeDetectionStrategy.OnPush,
1400
- template: '<ng-content></ng-content>',
1401
- inputs: ['formFields']
1402
- },] }
1403
- ];
1404
- AmplifyAuthFields.ctorParameters = () => [
1405
- { type: ChangeDetectorRef },
1406
- { type: ElementRef },
1407
- { type: NgZone }
1408
- ];
1409
- AmplifyAuthFields = __decorate([
1410
- ProxyCmp({ inputs: ['formFields'] })
1411
- ], AmplifyAuthFields);
1412
- let AmplifyAuth0Button = class AmplifyAuth0Button {
1413
- constructor(c, r, z) {
1414
- this.z = z;
1415
- c.detach();
1416
- this.el = r.nativeElement;
1417
- }
1418
- };
1419
- AmplifyAuth0Button.decorators = [
1420
- { type: Component, args: [{
1421
- selector: 'amplify-auth0-button',
1422
- changeDetection: ChangeDetectionStrategy.OnPush,
1423
- template: '<ng-content></ng-content>',
1424
- inputs: ['config', 'handleAuthStateChange']
1425
- },] }
1426
- ];
1427
- AmplifyAuth0Button.ctorParameters = () => [
1428
- { type: ChangeDetectorRef },
1429
- { type: ElementRef },
1430
- { type: NgZone }
1431
- ];
1432
- AmplifyAuth0Button = __decorate([
1433
- ProxyCmp({ inputs: ['config', 'handleAuthStateChange'] })
1434
- ], AmplifyAuth0Button);
1435
- let AmplifyAuthenticator = class AmplifyAuthenticator {
1436
- constructor(c, r, z) {
1437
- this.z = z;
1438
- c.detach();
1439
- this.el = r.nativeElement;
1440
- }
1441
- };
1442
- AmplifyAuthenticator.decorators = [
1443
- { type: Component, args: [{
1444
- selector: 'amplify-authenticator',
1445
- changeDetection: ChangeDetectionStrategy.OnPush,
1446
- template: '<ng-content></ng-content>',
1447
- inputs: [
1448
- 'federated',
1449
- 'handleAuthStateChange',
1450
- 'hideToast',
1451
- 'initialAuthState',
1452
- 'usernameAlias',
1453
- ]
1454
- },] }
1455
- ];
1456
- AmplifyAuthenticator.ctorParameters = () => [
1457
- { type: ChangeDetectorRef },
1458
- { type: ElementRef },
1459
- { type: NgZone }
1460
- ];
1461
- AmplifyAuthenticator = __decorate([
1462
- ProxyCmp({
1463
- inputs: [
1464
- 'federated',
1465
- 'handleAuthStateChange',
1466
- 'hideToast',
1467
- 'initialAuthState',
1468
- 'usernameAlias',
1469
- ],
1470
- })
1471
- ], AmplifyAuthenticator);
1472
- let AmplifyButton = class AmplifyButton {
1473
- constructor(c, r, z) {
1474
- this.z = z;
1475
- c.detach();
1476
- this.el = r.nativeElement;
1477
- }
1478
- };
1479
- AmplifyButton.decorators = [
1480
- { type: Component, args: [{
1481
- selector: 'amplify-button',
1482
- changeDetection: ChangeDetectionStrategy.OnPush,
1483
- template: '<ng-content></ng-content>',
1484
- inputs: ['disabled', 'handleButtonClick', 'icon', 'type', 'variant']
1485
- },] }
1486
- ];
1487
- AmplifyButton.ctorParameters = () => [
1488
- { type: ChangeDetectorRef },
1489
- { type: ElementRef },
1490
- { type: NgZone }
1491
- ];
1492
- AmplifyButton = __decorate([
1493
- ProxyCmp({
1494
- inputs: ['disabled', 'handleButtonClick', 'icon', 'type', 'variant'],
1495
- })
1496
- ], AmplifyButton);
1497
- let AmplifyChatbot = class AmplifyChatbot {
1498
- constructor(c, r, z) {
1499
- this.z = z;
1500
- c.detach();
1501
- this.el = r.nativeElement;
1502
- proxyOutputs(this, this.el, ['chatCompleted']);
1503
- }
1504
- };
1505
- AmplifyChatbot.decorators = [
1506
- { type: Component, args: [{
1507
- selector: 'amplify-chatbot',
1508
- changeDetection: ChangeDetectionStrategy.OnPush,
1509
- template: '<ng-content></ng-content>',
1510
- inputs: [
1511
- 'botName',
1512
- 'botTitle',
1513
- 'clearOnComplete',
1514
- 'conversationModeOn',
1515
- 'silenceThreshold',
1516
- 'silenceTime',
1517
- 'textEnabled',
1518
- 'voiceEnabled',
1519
- 'welcomeMessage',
1520
- ]
1521
- },] }
1522
- ];
1523
- AmplifyChatbot.ctorParameters = () => [
1524
- { type: ChangeDetectorRef },
1525
- { type: ElementRef },
1526
- { type: NgZone }
1527
- ];
1528
- AmplifyChatbot = __decorate([
1529
- ProxyCmp({
1530
- inputs: [
1531
- 'botName',
1532
- 'botTitle',
1533
- 'clearOnComplete',
1534
- 'conversationModeOn',
1535
- 'silenceThreshold',
1536
- 'silenceTime',
1537
- 'textEnabled',
1538
- 'voiceEnabled',
1539
- 'welcomeMessage',
1540
- ],
1541
- })
1542
- ], AmplifyChatbot);
1543
- let AmplifyCheckbox = class AmplifyCheckbox {
1544
- constructor(c, r, z) {
1545
- this.z = z;
1546
- c.detach();
1547
- this.el = r.nativeElement;
1548
- }
1549
- };
1550
- AmplifyCheckbox.decorators = [
1551
- { type: Component, args: [{
1552
- selector: 'amplify-checkbox',
1553
- changeDetection: ChangeDetectionStrategy.OnPush,
1554
- template: '<ng-content></ng-content>',
1555
- inputs: ['checked', 'disabled', 'fieldId', 'label', 'name', 'value']
1556
- },] }
1557
- ];
1558
- AmplifyCheckbox.ctorParameters = () => [
1559
- { type: ChangeDetectorRef },
1560
- { type: ElementRef },
1561
- { type: NgZone }
1562
- ];
1563
- AmplifyCheckbox = __decorate([
1564
- ProxyCmp({
1565
- inputs: ['checked', 'disabled', 'fieldId', 'label', 'name', 'value'],
1566
- })
1567
- ], AmplifyCheckbox);
1568
- let AmplifyCodeField = class AmplifyCodeField {
1569
- constructor(c, r, z) {
1570
- this.z = z;
1571
- c.detach();
1572
- this.el = r.nativeElement;
1573
- }
1574
- };
1575
- AmplifyCodeField.decorators = [
1576
- { type: Component, args: [{
1577
- selector: 'amplify-code-field',
1578
- changeDetection: ChangeDetectionStrategy.OnPush,
1579
- template: '<ng-content></ng-content>',
1580
- inputs: [
1581
- 'disabled',
1582
- 'fieldId',
1583
- 'handleInputChange',
1584
- 'hint',
1585
- 'inputProps',
1586
- 'label',
1587
- 'placeholder',
1588
- 'required',
1589
- 'value',
1590
- ]
1591
- },] }
1592
- ];
1593
- AmplifyCodeField.ctorParameters = () => [
1594
- { type: ChangeDetectorRef },
1595
- { type: ElementRef },
1596
- { type: NgZone }
1597
- ];
1598
- AmplifyCodeField = __decorate([
1599
- ProxyCmp({
1600
- inputs: [
1601
- 'disabled',
1602
- 'fieldId',
1603
- 'handleInputChange',
1604
- 'hint',
1605
- 'inputProps',
1606
- 'label',
1607
- 'placeholder',
1608
- 'required',
1609
- 'value',
1610
- ],
1611
- })
1612
- ], AmplifyCodeField);
1613
- let AmplifyConfirmSignIn = class AmplifyConfirmSignIn {
1614
- constructor(c, r, z) {
1615
- this.z = z;
1616
- c.detach();
1617
- this.el = r.nativeElement;
1618
- }
1619
- };
1620
- AmplifyConfirmSignIn.decorators = [
1621
- { type: Component, args: [{
1622
- selector: 'amplify-confirm-sign-in',
1623
- changeDetection: ChangeDetectionStrategy.OnPush,
1624
- template: '<ng-content></ng-content>',
1625
- inputs: [
1626
- 'formFields',
1627
- 'handleAuthStateChange',
1628
- 'handleSubmit',
1629
- 'headerText',
1630
- 'submitButtonText',
1631
- 'user',
1632
- ]
1633
- },] }
1634
- ];
1635
- AmplifyConfirmSignIn.ctorParameters = () => [
1636
- { type: ChangeDetectorRef },
1637
- { type: ElementRef },
1638
- { type: NgZone }
1639
- ];
1640
- AmplifyConfirmSignIn = __decorate([
1641
- ProxyCmp({
1642
- inputs: [
1643
- 'formFields',
1644
- 'handleAuthStateChange',
1645
- 'handleSubmit',
1646
- 'headerText',
1647
- 'submitButtonText',
1648
- 'user',
1649
- ],
1650
- })
1651
- ], AmplifyConfirmSignIn);
1652
- let AmplifyConfirmSignUp = class AmplifyConfirmSignUp {
1653
- constructor(c, r, z) {
1654
- this.z = z;
1655
- c.detach();
1656
- this.el = r.nativeElement;
1657
- }
1658
- };
1659
- AmplifyConfirmSignUp.decorators = [
1660
- { type: Component, args: [{
1661
- selector: 'amplify-confirm-sign-up',
1662
- changeDetection: ChangeDetectionStrategy.OnPush,
1663
- template: '<ng-content></ng-content>',
1664
- inputs: [
1665
- 'formFields',
1666
- 'handleAuthStateChange',
1667
- 'handleSubmit',
1668
- 'headerText',
1669
- 'submitButtonText',
1670
- 'user',
1671
- 'usernameAlias',
1672
- ]
1673
- },] }
1674
- ];
1675
- AmplifyConfirmSignUp.ctorParameters = () => [
1676
- { type: ChangeDetectorRef },
1677
- { type: ElementRef },
1678
- { type: NgZone }
1679
- ];
1680
- AmplifyConfirmSignUp = __decorate([
1681
- ProxyCmp({
1682
- inputs: [
1683
- 'formFields',
1684
- 'handleAuthStateChange',
1685
- 'handleSubmit',
1686
- 'headerText',
1687
- 'submitButtonText',
1688
- 'user',
1689
- 'usernameAlias',
1690
- ],
1691
- })
1692
- ], AmplifyConfirmSignUp);
1693
- class AmplifyContainer {
1694
- constructor(c, r, z) {
1695
- this.z = z;
1696
- c.detach();
1697
- this.el = r.nativeElement;
1698
- }
1699
- }
1700
- AmplifyContainer.decorators = [
1701
- { type: Component, args: [{
1702
- selector: 'amplify-container',
1703
- changeDetection: ChangeDetectionStrategy.OnPush,
1704
- template: '<ng-content></ng-content>'
1705
- },] }
1706
- ];
1707
- AmplifyContainer.ctorParameters = () => [
1708
- { type: ChangeDetectorRef },
1709
- { type: ElementRef },
1710
- { type: NgZone }
1711
- ];
1712
- let AmplifyCountryDialCode = class AmplifyCountryDialCode {
1713
- constructor(c, r, z) {
1714
- this.z = z;
1715
- c.detach();
1716
- this.el = r.nativeElement;
1717
- }
1718
- };
1719
- AmplifyCountryDialCode.decorators = [
1720
- { type: Component, args: [{
1721
- selector: 'amplify-country-dial-code',
1722
- changeDetection: ChangeDetectionStrategy.OnPush,
1723
- template: '<ng-content></ng-content>',
1724
- inputs: ['dialCode', 'fieldId', 'handleInputChange', 'options']
1725
- },] }
1726
- ];
1727
- AmplifyCountryDialCode.ctorParameters = () => [
1728
- { type: ChangeDetectorRef },
1729
- { type: ElementRef },
1730
- { type: NgZone }
1731
- ];
1732
- AmplifyCountryDialCode = __decorate([
1733
- ProxyCmp({ inputs: ['dialCode', 'fieldId', 'handleInputChange', 'options'] })
1734
- ], AmplifyCountryDialCode);
1735
- let AmplifyEmailField = class AmplifyEmailField {
1736
- constructor(c, r, z) {
1737
- this.z = z;
1738
- c.detach();
1739
- this.el = r.nativeElement;
1740
- }
1741
- };
1742
- AmplifyEmailField.decorators = [
1743
- { type: Component, args: [{
1744
- selector: 'amplify-email-field',
1745
- changeDetection: ChangeDetectionStrategy.OnPush,
1746
- template: '<ng-content></ng-content>',
1747
- inputs: [
1748
- 'disabled',
1749
- 'fieldId',
1750
- 'handleInputChange',
1751
- 'hint',
1752
- 'inputProps',
1753
- 'label',
1754
- 'placeholder',
1755
- 'required',
1756
- 'value',
1757
- ]
1758
- },] }
1759
- ];
1760
- AmplifyEmailField.ctorParameters = () => [
1761
- { type: ChangeDetectorRef },
1762
- { type: ElementRef },
1763
- { type: NgZone }
1764
- ];
1765
- AmplifyEmailField = __decorate([
1766
- ProxyCmp({
1767
- inputs: [
1768
- 'disabled',
1769
- 'fieldId',
1770
- 'handleInputChange',
1771
- 'hint',
1772
- 'inputProps',
1773
- 'label',
1774
- 'placeholder',
1775
- 'required',
1776
- 'value',
1777
- ],
1778
- })
1779
- ], AmplifyEmailField);
1780
- let AmplifyFacebookButton = class AmplifyFacebookButton {
1781
- constructor(c, r, z) {
1782
- this.z = z;
1783
- c.detach();
1784
- this.el = r.nativeElement;
1785
- }
1786
- };
1787
- AmplifyFacebookButton.decorators = [
1788
- { type: Component, args: [{
1789
- selector: 'amplify-facebook-button',
1790
- changeDetection: ChangeDetectionStrategy.OnPush,
1791
- template: '<ng-content></ng-content>',
1792
- inputs: ['appId', 'handleAuthStateChange']
1793
- },] }
1794
- ];
1795
- AmplifyFacebookButton.ctorParameters = () => [
1796
- { type: ChangeDetectorRef },
1797
- { type: ElementRef },
1798
- { type: NgZone }
1799
- ];
1800
- AmplifyFacebookButton = __decorate([
1801
- ProxyCmp({ inputs: ['appId', 'handleAuthStateChange'] })
1802
- ], AmplifyFacebookButton);
1803
- let AmplifyFederatedButtons = class AmplifyFederatedButtons {
1804
- constructor(c, r, z) {
1805
- this.z = z;
1806
- c.detach();
1807
- this.el = r.nativeElement;
1808
- }
1809
- };
1810
- AmplifyFederatedButtons.decorators = [
1811
- { type: Component, args: [{
1812
- selector: 'amplify-federated-buttons',
1813
- changeDetection: ChangeDetectionStrategy.OnPush,
1814
- template: '<ng-content></ng-content>',
1815
- inputs: ['authState', 'federated', 'handleAuthStateChange']
1816
- },] }
1817
- ];
1818
- AmplifyFederatedButtons.ctorParameters = () => [
1819
- { type: ChangeDetectorRef },
1820
- { type: ElementRef },
1821
- { type: NgZone }
1822
- ];
1823
- AmplifyFederatedButtons = __decorate([
1824
- ProxyCmp({ inputs: ['authState', 'federated', 'handleAuthStateChange'] })
1825
- ], AmplifyFederatedButtons);
1826
- let AmplifyFederatedSignIn = class AmplifyFederatedSignIn {
1827
- constructor(c, r, z) {
1828
- this.z = z;
1829
- c.detach();
1830
- this.el = r.nativeElement;
1831
- }
1832
- };
1833
- AmplifyFederatedSignIn.decorators = [
1834
- { type: Component, args: [{
1835
- selector: 'amplify-federated-sign-in',
1836
- changeDetection: ChangeDetectionStrategy.OnPush,
1837
- template: '<ng-content></ng-content>',
1838
- inputs: ['authState', 'federated']
1839
- },] }
1840
- ];
1841
- AmplifyFederatedSignIn.ctorParameters = () => [
1842
- { type: ChangeDetectorRef },
1843
- { type: ElementRef },
1844
- { type: NgZone }
1845
- ];
1846
- AmplifyFederatedSignIn = __decorate([
1847
- ProxyCmp({ inputs: ['authState', 'federated'] })
1848
- ], AmplifyFederatedSignIn);
1849
- let AmplifyForgotPassword = class AmplifyForgotPassword {
1850
- constructor(c, r, z) {
1851
- this.z = z;
1852
- c.detach();
1853
- this.el = r.nativeElement;
1854
- }
1855
- };
1856
- AmplifyForgotPassword.decorators = [
1857
- { type: Component, args: [{
1858
- selector: 'amplify-forgot-password',
1859
- changeDetection: ChangeDetectionStrategy.OnPush,
1860
- template: '<ng-content></ng-content>',
1861
- inputs: [
1862
- 'formFields',
1863
- 'handleAuthStateChange',
1864
- 'handleSend',
1865
- 'handleSubmit',
1866
- 'headerText',
1867
- 'sendButtonText',
1868
- 'submitButtonText',
1869
- 'usernameAlias',
1870
- ]
1871
- },] }
1872
- ];
1873
- AmplifyForgotPassword.ctorParameters = () => [
1874
- { type: ChangeDetectorRef },
1875
- { type: ElementRef },
1876
- { type: NgZone }
1877
- ];
1878
- AmplifyForgotPassword = __decorate([
1879
- ProxyCmp({
1880
- inputs: [
1881
- 'formFields',
1882
- 'handleAuthStateChange',
1883
- 'handleSend',
1884
- 'handleSubmit',
1885
- 'headerText',
1886
- 'sendButtonText',
1887
- 'submitButtonText',
1888
- 'usernameAlias',
1889
- ],
1890
- })
1891
- ], AmplifyForgotPassword);
1892
- let AmplifyFormField = class AmplifyFormField {
1893
- constructor(c, r, z) {
1894
- this.z = z;
1895
- c.detach();
1896
- this.el = r.nativeElement;
1897
- }
1898
- };
1899
- AmplifyFormField.decorators = [
1900
- { type: Component, args: [{
1901
- selector: 'amplify-form-field',
1902
- changeDetection: ChangeDetectionStrategy.OnPush,
1903
- template: '<ng-content></ng-content>',
1904
- inputs: [
1905
- 'description',
1906
- 'disabled',
1907
- 'fieldId',
1908
- 'handleInputChange',
1909
- 'hint',
1910
- 'inputProps',
1911
- 'label',
1912
- 'name',
1913
- 'placeholder',
1914
- 'required',
1915
- 'type',
1916
- 'value',
1917
- ]
1918
- },] }
1919
- ];
1920
- AmplifyFormField.ctorParameters = () => [
1921
- { type: ChangeDetectorRef },
1922
- { type: ElementRef },
1923
- { type: NgZone }
1924
- ];
1925
- AmplifyFormField = __decorate([
1926
- ProxyCmp({
1927
- inputs: [
1928
- 'description',
1929
- 'disabled',
1930
- 'fieldId',
1931
- 'handleInputChange',
1932
- 'hint',
1933
- 'inputProps',
1934
- 'label',
1935
- 'name',
1936
- 'placeholder',
1937
- 'required',
1938
- 'type',
1939
- 'value',
1940
- ],
1941
- })
1942
- ], AmplifyFormField);
1943
- let AmplifyFormSection = class AmplifyFormSection {
1944
- constructor(c, r, z) {
1945
- this.z = z;
1946
- c.detach();
1947
- this.el = r.nativeElement;
1948
- }
1949
- };
1950
- AmplifyFormSection.decorators = [
1951
- { type: Component, args: [{
1952
- selector: 'amplify-form-section',
1953
- changeDetection: ChangeDetectionStrategy.OnPush,
1954
- template: '<ng-content></ng-content>',
1955
- inputs: [
1956
- 'handleSubmit',
1957
- 'headerText',
1958
- 'loading',
1959
- 'secondaryFooterContent',
1960
- 'submitButtonText',
1961
- 'testDataPrefix',
1962
- ]
1963
- },] }
1964
- ];
1965
- AmplifyFormSection.ctorParameters = () => [
1966
- { type: ChangeDetectorRef },
1967
- { type: ElementRef },
1968
- { type: NgZone }
1969
- ];
1970
- AmplifyFormSection = __decorate([
1971
- ProxyCmp({
1972
- inputs: [
1973
- 'handleSubmit',
1974
- 'headerText',
1975
- 'loading',
1976
- 'secondaryFooterContent',
1977
- 'submitButtonText',
1978
- 'testDataPrefix',
1979
- ],
1980
- })
1981
- ], AmplifyFormSection);
1982
- let AmplifyGoogleButton = class AmplifyGoogleButton {
1983
- constructor(c, r, z) {
1984
- this.z = z;
1985
- c.detach();
1986
- this.el = r.nativeElement;
1987
- }
1988
- };
1989
- AmplifyGoogleButton.decorators = [
1990
- { type: Component, args: [{
1991
- selector: 'amplify-google-button',
1992
- changeDetection: ChangeDetectionStrategy.OnPush,
1993
- template: '<ng-content></ng-content>',
1994
- inputs: ['clientId', 'handleAuthStateChange']
1995
- },] }
1996
- ];
1997
- AmplifyGoogleButton.ctorParameters = () => [
1998
- { type: ChangeDetectorRef },
1999
- { type: ElementRef },
2000
- { type: NgZone }
2001
- ];
2002
- AmplifyGoogleButton = __decorate([
2003
- ProxyCmp({ inputs: ['clientId', 'handleAuthStateChange'] })
2004
- ], AmplifyGoogleButton);
2005
- let AmplifyGreetings = class AmplifyGreetings {
2006
- constructor(c, r, z) {
2007
- this.z = z;
2008
- c.detach();
2009
- this.el = r.nativeElement;
2010
- }
2011
- };
2012
- AmplifyGreetings.decorators = [
2013
- { type: Component, args: [{
2014
- selector: 'amplify-greetings',
2015
- changeDetection: ChangeDetectionStrategy.OnPush,
2016
- template: '<ng-content></ng-content>',
2017
- inputs: ['handleAuthStateChange', 'logo', 'username']
2018
- },] }
2019
- ];
2020
- AmplifyGreetings.ctorParameters = () => [
2021
- { type: ChangeDetectorRef },
2022
- { type: ElementRef },
2023
- { type: NgZone }
2024
- ];
2025
- AmplifyGreetings = __decorate([
2026
- ProxyCmp({ inputs: ['handleAuthStateChange', 'logo', 'username'] })
2027
- ], AmplifyGreetings);
2028
- class AmplifyHint {
2029
- constructor(c, r, z) {
2030
- this.z = z;
2031
- c.detach();
2032
- this.el = r.nativeElement;
2033
- }
2034
- }
2035
- AmplifyHint.decorators = [
2036
- { type: Component, args: [{
2037
- selector: 'amplify-hint',
2038
- changeDetection: ChangeDetectionStrategy.OnPush,
2039
- template: '<ng-content></ng-content>'
2040
- },] }
2041
- ];
2042
- AmplifyHint.ctorParameters = () => [
2043
- { type: ChangeDetectorRef },
2044
- { type: ElementRef },
2045
- { type: NgZone }
2046
- ];
2047
- let AmplifyIcon = class AmplifyIcon {
2048
- constructor(c, r, z) {
2049
- this.z = z;
2050
- c.detach();
2051
- this.el = r.nativeElement;
2052
- }
2053
- };
2054
- AmplifyIcon.decorators = [
2055
- { type: Component, args: [{
2056
- selector: 'amplify-icon',
2057
- changeDetection: ChangeDetectionStrategy.OnPush,
2058
- template: '<ng-content></ng-content>',
2059
- inputs: ['name']
2060
- },] }
2061
- ];
2062
- AmplifyIcon.ctorParameters = () => [
2063
- { type: ChangeDetectorRef },
2064
- { type: ElementRef },
2065
- { type: NgZone }
2066
- ];
2067
- AmplifyIcon = __decorate([
2068
- ProxyCmp({ inputs: ['name'] })
2069
- ], AmplifyIcon);
2070
- let AmplifyIconButton = class AmplifyIconButton {
2071
- constructor(c, r, z) {
2072
- this.z = z;
2073
- c.detach();
2074
- this.el = r.nativeElement;
2075
- }
2076
- };
2077
- AmplifyIconButton.decorators = [
2078
- { type: Component, args: [{
2079
- selector: 'amplify-icon-button',
2080
- changeDetection: ChangeDetectionStrategy.OnPush,
2081
- template: '<ng-content></ng-content>',
2082
- inputs: ['autoShowTooltip', 'name', 'tooltip']
2083
- },] }
2084
- ];
2085
- AmplifyIconButton.ctorParameters = () => [
2086
- { type: ChangeDetectorRef },
2087
- { type: ElementRef },
2088
- { type: NgZone }
2089
- ];
2090
- AmplifyIconButton = __decorate([
2091
- ProxyCmp({ inputs: ['autoShowTooltip', 'name', 'tooltip'] })
2092
- ], AmplifyIconButton);
2093
- let AmplifyInput = class AmplifyInput {
2094
- constructor(c, r, z) {
2095
- this.z = z;
2096
- c.detach();
2097
- this.el = r.nativeElement;
2098
- }
2099
- };
2100
- AmplifyInput.decorators = [
2101
- { type: Component, args: [{
2102
- selector: 'amplify-input',
2103
- changeDetection: ChangeDetectionStrategy.OnPush,
2104
- template: '<ng-content></ng-content>',
2105
- inputs: [
2106
- 'description',
2107
- 'disabled',
2108
- 'fieldId',
2109
- 'handleInputChange',
2110
- 'inputProps',
2111
- 'name',
2112
- 'placeholder',
2113
- 'required',
2114
- 'type',
2115
- 'value',
2116
- ]
2117
- },] }
2118
- ];
2119
- AmplifyInput.ctorParameters = () => [
2120
- { type: ChangeDetectorRef },
2121
- { type: ElementRef },
2122
- { type: NgZone }
2123
- ];
2124
- AmplifyInput = __decorate([
2125
- ProxyCmp({
2126
- inputs: [
2127
- 'description',
2128
- 'disabled',
2129
- 'fieldId',
2130
- 'handleInputChange',
2131
- 'inputProps',
2132
- 'name',
2133
- 'placeholder',
2134
- 'required',
2135
- 'type',
2136
- 'value',
2137
- ],
2138
- })
2139
- ], AmplifyInput);
2140
- let AmplifyLabel = class AmplifyLabel {
2141
- constructor(c, r, z) {
2142
- this.z = z;
2143
- c.detach();
2144
- this.el = r.nativeElement;
2145
- }
2146
- };
2147
- AmplifyLabel.decorators = [
2148
- { type: Component, args: [{
2149
- selector: 'amplify-label',
2150
- changeDetection: ChangeDetectionStrategy.OnPush,
2151
- template: '<ng-content></ng-content>',
2152
- inputs: ['htmlFor']
2153
- },] }
2154
- ];
2155
- AmplifyLabel.ctorParameters = () => [
2156
- { type: ChangeDetectorRef },
2157
- { type: ElementRef },
2158
- { type: NgZone }
2159
- ];
2160
- AmplifyLabel = __decorate([
2161
- ProxyCmp({ inputs: ['htmlFor'] })
2162
- ], AmplifyLabel);
2163
- let AmplifyLink = class AmplifyLink {
2164
- constructor(c, r, z) {
2165
- this.z = z;
2166
- c.detach();
2167
- this.el = r.nativeElement;
2168
- }
2169
- };
2170
- AmplifyLink.decorators = [
2171
- { type: Component, args: [{
2172
- selector: 'amplify-link',
2173
- changeDetection: ChangeDetectionStrategy.OnPush,
2174
- template: '<ng-content></ng-content>',
2175
- inputs: ['role']
2176
- },] }
2177
- ];
2178
- AmplifyLink.ctorParameters = () => [
2179
- { type: ChangeDetectorRef },
2180
- { type: ElementRef },
2181
- { type: NgZone }
2182
- ];
2183
- AmplifyLink = __decorate([
2184
- ProxyCmp({ inputs: ['role'] })
2185
- ], AmplifyLink);
2186
- class AmplifyLoadingSpinner {
2187
- constructor(c, r, z) {
2188
- this.z = z;
2189
- c.detach();
2190
- this.el = r.nativeElement;
2191
1183
  }
2192
1184
  }
2193
- AmplifyLoadingSpinner.decorators = [
2194
- { type: Component, args: [{
2195
- selector: 'amplify-loading-spinner',
2196
- changeDetection: ChangeDetectionStrategy.OnPush,
2197
- template: '<ng-content></ng-content>'
2198
- },] }
2199
- ];
2200
- AmplifyLoadingSpinner.ctorParameters = () => [
2201
- { type: ChangeDetectorRef },
2202
- { type: ElementRef },
2203
- { type: NgZone }
2204
- ];
2205
- class AmplifyNav {
2206
- constructor(c, r, z) {
2207
- this.z = z;
2208
- c.detach();
2209
- this.el = r.nativeElement;
2210
- }
2211
- }
2212
- AmplifyNav.decorators = [
2213
- { type: Component, args: [{
2214
- selector: 'amplify-nav',
2215
- changeDetection: ChangeDetectionStrategy.OnPush,
2216
- template: '<ng-content></ng-content>'
2217
- },] }
2218
- ];
2219
- AmplifyNav.ctorParameters = () => [
2220
- { type: ChangeDetectorRef },
2221
- { type: ElementRef },
2222
- { type: NgZone }
2223
- ];
2224
- let AmplifyOauthButton = class AmplifyOauthButton {
2225
- constructor(c, r, z) {
2226
- this.z = z;
2227
- c.detach();
2228
- this.el = r.nativeElement;
2229
- }
2230
- };
2231
- AmplifyOauthButton.decorators = [
2232
- { type: Component, args: [{
2233
- selector: 'amplify-oauth-button',
2234
- changeDetection: ChangeDetectionStrategy.OnPush,
2235
- template: '<ng-content></ng-content>',
2236
- inputs: ['config']
2237
- },] }
2238
- ];
2239
- AmplifyOauthButton.ctorParameters = () => [
2240
- { type: ChangeDetectorRef },
2241
- { type: ElementRef },
2242
- { type: NgZone }
2243
- ];
2244
- AmplifyOauthButton = __decorate([
2245
- ProxyCmp({ inputs: ['config'] })
2246
- ], AmplifyOauthButton);
2247
- let AmplifyPasswordField = class AmplifyPasswordField {
2248
- constructor(c, r, z) {
2249
- this.z = z;
2250
- c.detach();
2251
- this.el = r.nativeElement;
2252
- }
2253
- };
2254
- AmplifyPasswordField.decorators = [
2255
- { type: Component, args: [{
2256
- selector: 'amplify-password-field',
2257
- changeDetection: ChangeDetectionStrategy.OnPush,
2258
- template: '<ng-content></ng-content>',
2259
- inputs: [
2260
- 'disabled',
2261
- 'fieldId',
2262
- 'handleInputChange',
2263
- 'hint',
2264
- 'inputProps',
2265
- 'label',
2266
- 'placeholder',
2267
- 'required',
2268
- 'value',
2269
- ]
2270
- },] }
2271
- ];
2272
- AmplifyPasswordField.ctorParameters = () => [
2273
- { type: ChangeDetectorRef },
2274
- { type: ElementRef },
2275
- { type: NgZone }
2276
- ];
2277
- AmplifyPasswordField = __decorate([
2278
- ProxyCmp({
2279
- inputs: [
2280
- 'disabled',
2281
- 'fieldId',
2282
- 'handleInputChange',
2283
- 'hint',
2284
- 'inputProps',
2285
- 'label',
2286
- 'placeholder',
2287
- 'required',
2288
- 'value',
2289
- ],
2290
- })
2291
- ], AmplifyPasswordField);
2292
- let AmplifyPhoneField = class AmplifyPhoneField {
2293
- constructor(c, r, z) {
2294
- this.z = z;
2295
- c.detach();
2296
- this.el = r.nativeElement;
2297
- }
2298
- };
2299
- AmplifyPhoneField.decorators = [
2300
- { type: Component, args: [{
2301
- selector: 'amplify-phone-field',
2302
- changeDetection: ChangeDetectionStrategy.OnPush,
2303
- template: '<ng-content></ng-content>',
2304
- inputs: [
2305
- 'dialCode',
2306
- 'disabled',
2307
- 'fieldId',
2308
- 'handleInputChange',
2309
- 'hint',
2310
- 'inputProps',
2311
- 'label',
2312
- 'placeholder',
2313
- 'required',
2314
- 'value',
2315
- ]
2316
- },] }
2317
- ];
2318
- AmplifyPhoneField.ctorParameters = () => [
2319
- { type: ChangeDetectorRef },
2320
- { type: ElementRef },
2321
- { type: NgZone }
2322
- ];
2323
- AmplifyPhoneField = __decorate([
2324
- ProxyCmp({
2325
- inputs: [
2326
- 'dialCode',
2327
- 'disabled',
2328
- 'fieldId',
2329
- 'handleInputChange',
2330
- 'hint',
2331
- 'inputProps',
2332
- 'label',
2333
- 'placeholder',
2334
- 'required',
2335
- 'value',
2336
- ],
2337
- })
2338
- ], AmplifyPhoneField);
2339
- let AmplifyPhotoPicker = class AmplifyPhotoPicker {
2340
- constructor(c, r, z) {
2341
- this.z = z;
2342
- c.detach();
2343
- this.el = r.nativeElement;
2344
- }
2345
- };
2346
- AmplifyPhotoPicker.decorators = [
2347
- { type: Component, args: [{
2348
- selector: 'amplify-photo-picker',
2349
- changeDetection: ChangeDetectionStrategy.OnPush,
2350
- template: '<ng-content></ng-content>',
2351
- inputs: [
2352
- 'buttonText',
2353
- 'handleClick',
2354
- 'headerHint',
2355
- 'headerTitle',
2356
- 'placeholderHint',
2357
- 'previewSrc',
2358
- ]
2359
- },] }
2360
- ];
2361
- AmplifyPhotoPicker.ctorParameters = () => [
2362
- { type: ChangeDetectorRef },
2363
- { type: ElementRef },
2364
- { type: NgZone }
2365
- ];
2366
- AmplifyPhotoPicker = __decorate([
2367
- ProxyCmp({
2368
- inputs: [
2369
- 'buttonText',
2370
- 'handleClick',
2371
- 'headerHint',
2372
- 'headerTitle',
2373
- 'placeholderHint',
2374
- 'previewSrc',
2375
- ],
2376
- })
2377
- ], AmplifyPhotoPicker);
2378
- let AmplifyPicker = class AmplifyPicker {
2379
- constructor(c, r, z) {
2380
- this.z = z;
2381
- c.detach();
2382
- this.el = r.nativeElement;
2383
- }
2384
- };
2385
- AmplifyPicker.decorators = [
2386
- { type: Component, args: [{
2387
- selector: 'amplify-picker',
2388
- changeDetection: ChangeDetectionStrategy.OnPush,
2389
- template: '<ng-content></ng-content>',
2390
- inputs: ['acceptValue', 'inputHandler', 'pickerText']
2391
- },] }
2392
- ];
2393
- AmplifyPicker.ctorParameters = () => [
2394
- { type: ChangeDetectorRef },
2395
- { type: ElementRef },
2396
- { type: NgZone }
2397
- ];
2398
- AmplifyPicker = __decorate([
2399
- ProxyCmp({ inputs: ['acceptValue', 'inputHandler', 'pickerText'] })
2400
- ], AmplifyPicker);
2401
- let AmplifyRadioButton = class AmplifyRadioButton {
2402
- constructor(c, r, z) {
2403
- this.z = z;
2404
- c.detach();
2405
- this.el = r.nativeElement;
2406
- }
2407
- };
2408
- AmplifyRadioButton.decorators = [
2409
- { type: Component, args: [{
2410
- selector: 'amplify-radio-button',
2411
- changeDetection: ChangeDetectionStrategy.OnPush,
2412
- template: '<ng-content></ng-content>',
2413
- inputs: [
2414
- 'checked',
2415
- 'disabled',
2416
- 'fieldId',
2417
- 'handleInputChange',
2418
- 'inputProps',
2419
- 'label',
2420
- 'name',
2421
- 'placeholder',
2422
- 'value',
2423
- ]
2424
- },] }
2425
- ];
2426
- AmplifyRadioButton.ctorParameters = () => [
2427
- { type: ChangeDetectorRef },
2428
- { type: ElementRef },
2429
- { type: NgZone }
2430
- ];
2431
- AmplifyRadioButton = __decorate([
2432
- ProxyCmp({
2433
- inputs: [
2434
- 'checked',
2435
- 'disabled',
2436
- 'fieldId',
2437
- 'handleInputChange',
2438
- 'inputProps',
2439
- 'label',
2440
- 'name',
2441
- 'placeholder',
2442
- 'value',
2443
- ],
2444
- })
2445
- ], AmplifyRadioButton);
2446
- let AmplifyRequireNewPassword = class AmplifyRequireNewPassword {
2447
- constructor(c, r, z) {
2448
- this.z = z;
2449
- c.detach();
2450
- this.el = r.nativeElement;
2451
- }
2452
- };
2453
- AmplifyRequireNewPassword.decorators = [
1185
+ AmplifySlotComponent.decorators = [
2454
1186
  { type: Component, args: [{
2455
- selector: 'amplify-require-new-password',
2456
- changeDetection: ChangeDetectionStrategy.OnPush,
2457
- template: '<ng-content></ng-content>',
2458
- inputs: [
2459
- 'formFields',
2460
- 'handleAuthStateChange',
2461
- 'handleSubmit',
2462
- 'headerText',
2463
- 'submitButtonText',
2464
- 'user',
2465
- ]
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"
2466
1189
  },] }
2467
1190
  ];
2468
- AmplifyRequireNewPassword.ctorParameters = () => [
2469
- { type: ChangeDetectorRef },
2470
- { type: ElementRef },
2471
- { type: NgZone }
1191
+ AmplifySlotComponent.ctorParameters = () => [
1192
+ { type: CustomComponentsService }
2472
1193
  ];
2473
- AmplifyRequireNewPassword = __decorate([
2474
- ProxyCmp({
2475
- inputs: [
2476
- 'formFields',
2477
- 'handleAuthStateChange',
2478
- 'handleSubmit',
2479
- 'headerText',
2480
- 'submitButtonText',
2481
- 'user',
2482
- ],
2483
- })
2484
- ], AmplifyRequireNewPassword);
2485
- let AmplifyS3Album = class AmplifyS3Album {
2486
- constructor(c, r, z) {
2487
- this.z = z;
2488
- c.detach();
2489
- this.el = r.nativeElement;
2490
- }
2491
- };
2492
- AmplifyS3Album.decorators = [
2493
- { type: Component, args: [{
2494
- selector: 'amplify-s3-album',
2495
- changeDetection: ChangeDetectionStrategy.OnPush,
2496
- template: '<ng-content></ng-content>',
2497
- inputs: [
2498
- 'contentType',
2499
- 'fileToKey',
2500
- 'filter',
2501
- 'handleOnError',
2502
- 'handleOnLoad',
2503
- 'identityId',
2504
- 'level',
2505
- 'path',
2506
- 'picker',
2507
- 'pickerText',
2508
- 'sort',
2509
- 'track',
2510
- ]
2511
- },] }
2512
- ];
2513
- AmplifyS3Album.ctorParameters = () => [
2514
- { type: ChangeDetectorRef },
2515
- { type: ElementRef },
2516
- { type: NgZone }
2517
- ];
2518
- AmplifyS3Album = __decorate([
2519
- ProxyCmp({
2520
- inputs: [
2521
- 'contentType',
2522
- 'fileToKey',
2523
- 'filter',
2524
- 'handleOnError',
2525
- 'handleOnLoad',
2526
- 'identityId',
2527
- 'level',
2528
- 'path',
2529
- 'picker',
2530
- 'pickerText',
2531
- 'sort',
2532
- 'track',
2533
- ],
2534
- })
2535
- ], AmplifyS3Album);
2536
- let AmplifyS3Image = class AmplifyS3Image {
2537
- constructor(c, r, z) {
2538
- this.z = z;
2539
- c.detach();
2540
- this.el = r.nativeElement;
2541
- }
2542
- };
2543
- AmplifyS3Image.decorators = [
2544
- { type: Component, args: [{
2545
- selector: 'amplify-s3-image',
2546
- changeDetection: ChangeDetectionStrategy.OnPush,
2547
- template: '<ng-content></ng-content>',
2548
- inputs: [
2549
- 'alt',
2550
- 'body',
2551
- 'contentType',
2552
- 'handleOnError',
2553
- 'handleOnLoad',
2554
- 'identityId',
2555
- 'imgKey',
2556
- 'imgProps',
2557
- 'level',
2558
- 'path',
2559
- 'track',
2560
- ]
2561
- },] }
2562
- ];
2563
- AmplifyS3Image.ctorParameters = () => [
2564
- { type: ChangeDetectorRef },
2565
- { type: ElementRef },
2566
- { type: NgZone }
2567
- ];
2568
- AmplifyS3Image = __decorate([
2569
- ProxyCmp({
2570
- inputs: [
2571
- 'alt',
2572
- 'body',
2573
- 'contentType',
2574
- 'handleOnError',
2575
- 'handleOnLoad',
2576
- 'identityId',
2577
- 'imgKey',
2578
- 'imgProps',
2579
- 'level',
2580
- 'path',
2581
- 'track',
2582
- ],
2583
- })
2584
- ], AmplifyS3Image);
2585
- let AmplifyS3ImagePicker = class AmplifyS3ImagePicker {
2586
- constructor(c, r, z) {
2587
- this.z = z;
2588
- c.detach();
2589
- this.el = r.nativeElement;
2590
- }
2591
- };
2592
- AmplifyS3ImagePicker.decorators = [
2593
- { type: Component, args: [{
2594
- selector: 'amplify-s3-image-picker',
2595
- changeDetection: ChangeDetectionStrategy.OnPush,
2596
- template: '<ng-content></ng-content>',
2597
- inputs: [
2598
- 'buttonText',
2599
- 'contentType',
2600
- 'fileToKey',
2601
- 'headerHint',
2602
- 'headerTitle',
2603
- 'identityId',
2604
- 'level',
2605
- 'path',
2606
- 'placeholderHint',
2607
- 'track',
2608
- ]
2609
- },] }
2610
- ];
2611
- AmplifyS3ImagePicker.ctorParameters = () => [
2612
- { type: ChangeDetectorRef },
2613
- { type: ElementRef },
2614
- { type: NgZone }
2615
- ];
2616
- AmplifyS3ImagePicker = __decorate([
2617
- ProxyCmp({
2618
- inputs: [
2619
- 'buttonText',
2620
- 'contentType',
2621
- 'fileToKey',
2622
- 'headerHint',
2623
- 'headerTitle',
2624
- 'identityId',
2625
- 'level',
2626
- 'path',
2627
- 'placeholderHint',
2628
- 'track',
2629
- ],
2630
- })
2631
- ], AmplifyS3ImagePicker);
2632
- let AmplifyS3Text = class AmplifyS3Text {
2633
- constructor(c, r, z) {
2634
- this.z = z;
2635
- c.detach();
2636
- this.el = r.nativeElement;
2637
- }
2638
- };
2639
- AmplifyS3Text.decorators = [
2640
- { type: Component, args: [{
2641
- selector: 'amplify-s3-text',
2642
- changeDetection: ChangeDetectionStrategy.OnPush,
2643
- template: '<ng-content></ng-content>',
2644
- inputs: [
2645
- 'body',
2646
- 'contentType',
2647
- 'fallbackText',
2648
- 'identityId',
2649
- 'level',
2650
- 'path',
2651
- 'textKey',
2652
- 'track',
2653
- ]
2654
- },] }
2655
- ];
2656
- AmplifyS3Text.ctorParameters = () => [
2657
- { type: ChangeDetectorRef },
2658
- { type: ElementRef },
2659
- { type: NgZone }
2660
- ];
2661
- AmplifyS3Text = __decorate([
2662
- ProxyCmp({
2663
- inputs: [
2664
- 'body',
2665
- 'contentType',
2666
- 'fallbackText',
2667
- 'identityId',
2668
- 'level',
2669
- 'path',
2670
- 'textKey',
2671
- 'track',
2672
- ],
2673
- })
2674
- ], AmplifyS3Text);
2675
- let AmplifyS3TextPicker = class AmplifyS3TextPicker {
2676
- constructor(c, r, z) {
2677
- this.z = z;
2678
- c.detach();
2679
- this.el = r.nativeElement;
2680
- }
2681
- };
2682
- AmplifyS3TextPicker.decorators = [
2683
- { type: Component, args: [{
2684
- selector: 'amplify-s3-text-picker',
2685
- changeDetection: ChangeDetectionStrategy.OnPush,
2686
- template: '<ng-content></ng-content>',
2687
- inputs: [
2688
- 'contentType',
2689
- 'fallbackText',
2690
- 'fileToKey',
2691
- 'identityId',
2692
- 'level',
2693
- 'path',
2694
- 'track',
2695
- ]
2696
- },] }
2697
- ];
2698
- AmplifyS3TextPicker.ctorParameters = () => [
2699
- { type: ChangeDetectorRef },
2700
- { type: ElementRef },
2701
- { type: NgZone }
2702
- ];
2703
- AmplifyS3TextPicker = __decorate([
2704
- ProxyCmp({
2705
- inputs: [
2706
- 'contentType',
2707
- 'fallbackText',
2708
- 'fileToKey',
2709
- 'identityId',
2710
- 'level',
2711
- 'path',
2712
- 'track',
2713
- ],
2714
- })
2715
- ], AmplifyS3TextPicker);
2716
- let AmplifySection = class AmplifySection {
2717
- constructor(c, r, z) {
2718
- this.z = z;
2719
- c.detach();
2720
- this.el = r.nativeElement;
2721
- }
2722
- };
2723
- AmplifySection.decorators = [
2724
- { type: Component, args: [{
2725
- selector: 'amplify-section',
2726
- changeDetection: ChangeDetectionStrategy.OnPush,
2727
- template: '<ng-content></ng-content>',
2728
- inputs: ['role']
2729
- },] }
2730
- ];
2731
- AmplifySection.ctorParameters = () => [
2732
- { type: ChangeDetectorRef },
2733
- { type: ElementRef },
2734
- { type: NgZone }
2735
- ];
2736
- AmplifySection = __decorate([
2737
- ProxyCmp({ inputs: ['role'] })
2738
- ], AmplifySection);
2739
- let AmplifySelect = class AmplifySelect {
2740
- constructor(c, r, z) {
2741
- this.z = z;
2742
- c.detach();
2743
- this.el = r.nativeElement;
2744
- }
2745
- };
2746
- AmplifySelect.decorators = [
2747
- { type: Component, args: [{
2748
- selector: 'amplify-select',
2749
- changeDetection: ChangeDetectionStrategy.OnPush,
2750
- template: '<ng-content></ng-content>',
2751
- inputs: ['fieldId', 'handleInputChange', 'options', 'selected']
2752
- },] }
2753
- ];
2754
- AmplifySelect.ctorParameters = () => [
2755
- { type: ChangeDetectorRef },
2756
- { type: ElementRef },
2757
- { type: NgZone }
2758
- ];
2759
- AmplifySelect = __decorate([
2760
- ProxyCmp({ inputs: ['fieldId', 'handleInputChange', 'options', 'selected'] })
2761
- ], AmplifySelect);
2762
- let AmplifySelectMfaType = class AmplifySelectMfaType {
2763
- constructor(c, r, z) {
2764
- this.z = z;
2765
- c.detach();
2766
- this.el = r.nativeElement;
2767
- }
2768
- };
2769
- AmplifySelectMfaType.decorators = [
2770
- { type: Component, args: [{
2771
- selector: 'amplify-select-mfa-type',
2772
- changeDetection: ChangeDetectionStrategy.OnPush,
2773
- template: '<ng-content></ng-content>',
2774
- inputs: ['MFATypes', 'authData', 'handleSubmit']
2775
- },] }
2776
- ];
2777
- AmplifySelectMfaType.ctorParameters = () => [
2778
- { type: ChangeDetectorRef },
2779
- { type: ElementRef },
2780
- { type: NgZone }
2781
- ];
2782
- AmplifySelectMfaType = __decorate([
2783
- ProxyCmp({ inputs: ['MFATypes', 'authData', 'handleSubmit'] })
2784
- ], AmplifySelectMfaType);
2785
- let AmplifySignIn = class AmplifySignIn {
2786
- constructor(c, r, z) {
2787
- this.z = z;
2788
- c.detach();
2789
- this.el = r.nativeElement;
2790
- }
2791
- };
2792
- AmplifySignIn.decorators = [
2793
- { type: Component, args: [{
2794
- selector: 'amplify-sign-in',
2795
- changeDetection: ChangeDetectionStrategy.OnPush,
2796
- template: '<ng-content></ng-content>',
2797
- inputs: [
2798
- 'federated',
2799
- 'formFields',
2800
- 'handleAuthStateChange',
2801
- 'handleSubmit',
2802
- 'headerText',
2803
- 'hideSignUp',
2804
- 'submitButtonText',
2805
- 'usernameAlias',
2806
- ]
2807
- },] }
2808
- ];
2809
- AmplifySignIn.ctorParameters = () => [
2810
- { type: ChangeDetectorRef },
2811
- { type: ElementRef },
2812
- { type: NgZone }
2813
- ];
2814
- AmplifySignIn = __decorate([
2815
- ProxyCmp({
2816
- inputs: [
2817
- 'federated',
2818
- 'formFields',
2819
- 'handleAuthStateChange',
2820
- 'handleSubmit',
2821
- 'headerText',
2822
- 'hideSignUp',
2823
- 'submitButtonText',
2824
- 'usernameAlias',
2825
- ],
2826
- })
2827
- ], AmplifySignIn);
2828
- let AmplifySignInButton = class AmplifySignInButton {
2829
- constructor(c, r, z) {
2830
- this.z = z;
2831
- c.detach();
2832
- this.el = r.nativeElement;
2833
- }
2834
- };
2835
- AmplifySignInButton.decorators = [
2836
- { type: Component, args: [{
2837
- selector: 'amplify-sign-in-button',
2838
- changeDetection: ChangeDetectionStrategy.OnPush,
2839
- template: '<ng-content></ng-content>',
2840
- inputs: ['provider']
2841
- },] }
2842
- ];
2843
- AmplifySignInButton.ctorParameters = () => [
2844
- { type: ChangeDetectorRef },
2845
- { type: ElementRef },
2846
- { type: NgZone }
2847
- ];
2848
- AmplifySignInButton = __decorate([
2849
- ProxyCmp({ inputs: ['provider'] })
2850
- ], AmplifySignInButton);
2851
- let AmplifySignOut = class AmplifySignOut {
2852
- constructor(c, r, z) {
2853
- this.z = z;
2854
- c.detach();
2855
- this.el = r.nativeElement;
2856
- }
2857
- };
2858
- AmplifySignOut.decorators = [
2859
- { type: Component, args: [{
2860
- selector: 'amplify-sign-out',
2861
- changeDetection: ChangeDetectionStrategy.OnPush,
2862
- template: '<ng-content></ng-content>',
2863
- inputs: ['buttonText', 'handleAuthStateChange']
2864
- },] }
2865
- ];
2866
- AmplifySignOut.ctorParameters = () => [
2867
- { type: ChangeDetectorRef },
2868
- { type: ElementRef },
2869
- { type: NgZone }
2870
- ];
2871
- AmplifySignOut = __decorate([
2872
- ProxyCmp({ inputs: ['buttonText', 'handleAuthStateChange'] })
2873
- ], AmplifySignOut);
2874
- let AmplifySignUp = class AmplifySignUp {
2875
- constructor(c, r, z) {
2876
- this.z = z;
2877
- c.detach();
2878
- this.el = r.nativeElement;
2879
- }
2880
- };
2881
- AmplifySignUp.decorators = [
2882
- { type: Component, args: [{
2883
- selector: 'amplify-sign-up',
2884
- changeDetection: ChangeDetectionStrategy.OnPush,
2885
- template: '<ng-content></ng-content>',
2886
- inputs: [
2887
- 'formFields',
2888
- 'handleAuthStateChange',
2889
- 'handleSignUp',
2890
- 'handleSubmit',
2891
- 'haveAccountText',
2892
- 'headerText',
2893
- 'signInText',
2894
- 'submitButtonText',
2895
- 'usernameAlias',
2896
- 'validationErrors',
2897
- ]
2898
- },] }
2899
- ];
2900
- AmplifySignUp.ctorParameters = () => [
2901
- { type: ChangeDetectorRef },
2902
- { type: ElementRef },
2903
- { type: NgZone }
2904
- ];
2905
- AmplifySignUp = __decorate([
2906
- ProxyCmp({
2907
- inputs: [
2908
- 'formFields',
2909
- 'handleAuthStateChange',
2910
- 'handleSignUp',
2911
- 'handleSubmit',
2912
- 'haveAccountText',
2913
- 'headerText',
2914
- 'signInText',
2915
- 'submitButtonText',
2916
- 'usernameAlias',
2917
- 'validationErrors',
2918
- ],
2919
- })
2920
- ], AmplifySignUp);
2921
- class AmplifyStrike {
2922
- constructor(c, r, z) {
2923
- this.z = z;
2924
- c.detach();
2925
- this.el = r.nativeElement;
2926
- }
2927
- }
2928
- AmplifyStrike.decorators = [
2929
- { type: Component, args: [{
2930
- selector: 'amplify-strike',
2931
- changeDetection: ChangeDetectionStrategy.OnPush,
2932
- template: '<ng-content></ng-content>'
2933
- },] }
2934
- ];
2935
- AmplifyStrike.ctorParameters = () => [
2936
- { type: ChangeDetectorRef },
2937
- { type: ElementRef },
2938
- { type: NgZone }
2939
- ];
2940
- let AmplifyToast = class AmplifyToast {
2941
- constructor(c, r, z) {
2942
- this.z = z;
2943
- c.detach();
2944
- this.el = r.nativeElement;
2945
- }
2946
- };
2947
- AmplifyToast.decorators = [
2948
- { type: Component, args: [{
2949
- selector: 'amplify-toast',
2950
- changeDetection: ChangeDetectionStrategy.OnPush,
2951
- template: '<ng-content></ng-content>',
2952
- inputs: ['handleClose', 'message']
2953
- },] }
2954
- ];
2955
- AmplifyToast.ctorParameters = () => [
2956
- { type: ChangeDetectorRef },
2957
- { type: ElementRef },
2958
- { type: NgZone }
2959
- ];
2960
- AmplifyToast = __decorate([
2961
- ProxyCmp({ inputs: ['handleClose', 'message'] })
2962
- ], AmplifyToast);
2963
- let AmplifyTooltip = class AmplifyTooltip {
2964
- constructor(c, r, z) {
2965
- this.z = z;
2966
- c.detach();
2967
- this.el = r.nativeElement;
2968
- }
2969
- };
2970
- AmplifyTooltip.decorators = [
2971
- { type: Component, args: [{
2972
- selector: 'amplify-tooltip',
2973
- changeDetection: ChangeDetectionStrategy.OnPush,
2974
- template: '<ng-content></ng-content>',
2975
- inputs: ['shouldAutoShow', 'text']
2976
- },] }
2977
- ];
2978
- AmplifyTooltip.ctorParameters = () => [
2979
- { type: ChangeDetectorRef },
2980
- { type: ElementRef },
2981
- { type: NgZone }
2982
- ];
2983
- AmplifyTooltip = __decorate([
2984
- ProxyCmp({ inputs: ['shouldAutoShow', 'text'] })
2985
- ], AmplifyTooltip);
2986
- let AmplifyTotpSetup = class AmplifyTotpSetup {
2987
- constructor(c, r, z) {
2988
- this.z = z;
2989
- c.detach();
2990
- this.el = r.nativeElement;
2991
- }
2992
- };
2993
- AmplifyTotpSetup.decorators = [
2994
- { type: Component, args: [{
2995
- selector: 'amplify-totp-setup',
2996
- changeDetection: ChangeDetectionStrategy.OnPush,
2997
- template: '<ng-content></ng-content>',
2998
- inputs: [
2999
- 'handleAuthStateChange',
3000
- 'handleComplete',
3001
- 'headerText',
3002
- 'issuer',
3003
- 'standalone',
3004
- 'user',
3005
- ]
3006
- },] }
3007
- ];
3008
- AmplifyTotpSetup.ctorParameters = () => [
3009
- { type: ChangeDetectorRef },
3010
- { type: ElementRef },
3011
- { type: NgZone }
3012
- ];
3013
- AmplifyTotpSetup = __decorate([
3014
- ProxyCmp({
3015
- inputs: [
3016
- 'handleAuthStateChange',
3017
- 'handleComplete',
3018
- 'headerText',
3019
- 'issuer',
3020
- 'standalone',
3021
- 'user',
3022
- ],
3023
- })
3024
- ], AmplifyTotpSetup);
3025
- let AmplifyUsernameField = class AmplifyUsernameField {
3026
- constructor(c, r, z) {
3027
- this.z = z;
3028
- c.detach();
3029
- this.el = r.nativeElement;
3030
- }
3031
- };
3032
- AmplifyUsernameField.decorators = [
3033
- { type: Component, args: [{
3034
- selector: 'amplify-username-field',
3035
- changeDetection: ChangeDetectionStrategy.OnPush,
3036
- template: '<ng-content></ng-content>',
3037
- inputs: [
3038
- 'disabled',
3039
- 'fieldId',
3040
- 'handleInputChange',
3041
- 'hint',
3042
- 'inputProps',
3043
- 'label',
3044
- 'placeholder',
3045
- 'required',
3046
- 'value',
3047
- ]
3048
- },] }
3049
- ];
3050
- AmplifyUsernameField.ctorParameters = () => [
3051
- { type: ChangeDetectorRef },
3052
- { type: ElementRef },
3053
- { type: NgZone }
3054
- ];
3055
- AmplifyUsernameField = __decorate([
3056
- ProxyCmp({
3057
- inputs: [
3058
- 'disabled',
3059
- 'fieldId',
3060
- 'handleInputChange',
3061
- 'hint',
3062
- 'inputProps',
3063
- 'label',
3064
- 'placeholder',
3065
- 'required',
3066
- 'value',
3067
- ],
3068
- })
3069
- ], AmplifyUsernameField);
3070
- let AmplifyVerifyContact = class AmplifyVerifyContact {
3071
- constructor(c, r, z) {
3072
- this.z = z;
3073
- c.detach();
3074
- this.el = r.nativeElement;
3075
- }
3076
- };
3077
- AmplifyVerifyContact.decorators = [
3078
- { type: Component, args: [{
3079
- selector: 'amplify-verify-contact',
3080
- changeDetection: ChangeDetectionStrategy.OnPush,
3081
- template: '<ng-content></ng-content>',
3082
- inputs: ['handleAuthStateChange', 'user']
3083
- },] }
3084
- ];
3085
- AmplifyVerifyContact.ctorParameters = () => [
3086
- { type: ChangeDetectorRef },
3087
- { type: ElementRef },
3088
- { type: NgZone }
3089
- ];
3090
- AmplifyVerifyContact = __decorate([
3091
- ProxyCmp({ inputs: ['handleAuthStateChange', 'user'] })
3092
- ], AmplifyVerifyContact);
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 }],
1194
+ AmplifySlotComponent.propDecorators = {
3119
1195
  name: [{ type: Input }],
3120
- placeholder: [{ type: Input }],
3121
- required: [{ type: Input }],
3122
- type: [{ type: Input }]
1196
+ context: [{ type: Input }],
1197
+ display: [{ type: HostBinding, args: ['style.display',] }]
3123
1198
  };
3124
1199
 
3125
- customElements.define('amplify-button', AmplifyButton$1);
3126
- customElements.define('amplify-input', AmplifyInput$1);
3127
- customElements.define('amplify-toast', AmplifyToast$1);
3128
- customElements.define('amplify-chatbot', AmplifyChatbot$1);
3129
- customElements.define('amplify-s3-album', AmplifyS3Album$1);
3130
- customElements.define('amplify-s3-image-picker', AmplifyS3ImagePicker$1);
3131
- customElements.define('amplify-s3-text', AmplifyS3Text$1);
3132
- customElements.define('amplify-s3-text-picker', AmplifyS3TextPicker$1);
3133
- customElements.define('amplify-s3-image', AmplifyS3Image$1);
3134
- customElements.define('amplify-picker', AmplifyPicker$1);
3135
- customElements.define('amplify-photo-picker', AmplifyPhotoPicker$1);
3136
- class UiAngularModule {
1200
+ class AmplifyAuthenticatorModule {
3137
1201
  }
3138
- UiAngularModule.decorators = [
1202
+ AmplifyAuthenticatorModule.decorators = [
3139
1203
  { type: NgModule, args: [{
3140
1204
  declarations: [
3141
- AmplifyChatbot,
3142
- AmplifyToast,
3143
- AmplifyInput,
3144
- AmplifyButton,
3145
- AmplifyS3Album,
3146
- AmplifyS3ImagePicker,
3147
- AmplifyS3Text,
3148
- AmplifyS3TextPicker,
3149
- AmplifyS3Image,
3150
- AmplifyPicker,
3151
- AmplifyPhotoPicker,
3152
- AmplifyAuthenticatorComponent,
3153
- AmplifySignInComponent,
3154
- AmplifySignUpComponent,
3155
- AmplifyFormFieldComponent,
3156
- AmplifyErrorComponent,
1205
+ AmplifySlotComponent,
3157
1206
  AmplifySlotDirective,
3158
- AmplifyConfirmSignUpComponent,
3159
- AmplifyUserNameAliasComponent,
3160
- AmplifyConfirmSignInComponent,
3161
- AmplifySetupTotpComponent,
3162
- AmplifyForceNewPasswordComponent,
3163
- AmplifyFederatedSignInComponent,
3164
- AmplifyFederatedSignInButtonComponent,
3165
- AmplifyResetPasswordComponent,
3166
- AmplifyVerifyUserComponent,
1207
+ AuthenticatorComponent,
1208
+ ButtonComponent,
1209
+ CheckboxComponent,
3167
1210
  ConfirmResetPasswordComponent,
1211
+ ConfirmSignInComponent,
1212
+ ConfirmSignUpComponent,
3168
1213
  ConfirmVerifyUserComponent,
3169
- AmplifySelectComponent,
3170
- AmplifyButtonComponent,
3171
- AmplifyPasswordFieldComponent,
3172
- AmplifyTextFieldComponent,
3173
- TabsComponent,
3174
- TabItemComponent,
1214
+ ErrorComponent,
1215
+ FederatedSignInButtonComponent,
1216
+ FederatedSignInComponent,
1217
+ ForceNewPasswordComponent,
1218
+ FormFieldComponent,
1219
+ PasswordFieldComponent,
3175
1220
  PhoneNumberFieldComponent,
1221
+ ResetPasswordComponent,
1222
+ SelectComponent,
1223
+ SetupTotpComponent,
1224
+ SignInComponent,
1225
+ SignUpComponent,
1226
+ SignUpFormFieldsComponent,
1227
+ TabItemComponent,
1228
+ TabsComponent,
1229
+ TextFieldComponent,
1230
+ UserNameAliasComponent,
1231
+ VerifyUserComponent,
3176
1232
  ],
3177
- imports: [CommonModule],
1233
+ imports: [CommonModule, BrowserModule],
3178
1234
  exports: [
3179
- AmplifyChatbot,
3180
- AmplifyToast,
3181
- AmplifyInput,
3182
- AmplifyButton,
3183
- AmplifyS3Album,
3184
- AmplifyS3ImagePicker,
3185
- AmplifyS3Text,
3186
- AmplifyS3TextPicker,
3187
- AmplifyS3Image,
3188
- AmplifyPicker,
3189
- AmplifyPhotoPicker,
3190
- AmplifyAuthenticatorComponent,
3191
- AmplifySignInComponent,
3192
- AmplifyFormFieldComponent,
3193
- AmplifyErrorComponent,
3194
1235
  AmplifySlotDirective,
1236
+ AuthenticatorComponent,
1237
+ CheckboxComponent,
1238
+ SignUpFormFieldsComponent,
1239
+ TextFieldComponent,
3195
1240
  ],
3196
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
3197
1241
  },] }
3198
1242
  ];
3199
1243
 
@@ -3205,5 +1249,5 @@ UiAngularModule.decorators = [
3205
1249
  * Generated bundle index. Do not edit.
3206
1250
  */
3207
1251
 
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 };
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 };
3209
1253
  //# sourceMappingURL=aws-amplify-ui-angular.js.map