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

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