@aws-amplify/ui-angular 2.0.1-next.5 → 2.0.3

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