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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/aws-amplify-ui-angular.d.ts +21 -15
  2. package/aws-amplify-ui-angular.metadata.json +1 -1
  3. package/bundles/aws-amplify-ui-angular.umd.js +1233 -932
  4. package/bundles/aws-amplify-ui-angular.umd.js.map +1 -1
  5. package/bundles/aws-amplify-ui-angular.umd.min.js +1 -1
  6. package/bundles/aws-amplify-ui-angular.umd.min.js.map +1 -1
  7. package/esm2015/aws-amplify-ui-angular.js +22 -16
  8. package/esm2015/index.js +3 -3
  9. package/esm2015/lib/components/amplify-authenticator/amplify-authenticator.component.js +33 -14
  10. package/esm2015/lib/components/amplify-confirm-sign-in/amplify-confirm-sign-in.component.js +8 -6
  11. package/esm2015/lib/components/amplify-confirm-sign-up/amplify-confirm-sign-up.component.js +11 -25
  12. package/esm2015/lib/components/amplify-federated-sign-in/amplify-federated-sign-in.component.js +9 -4
  13. package/esm2015/lib/components/amplify-federated-sign-in-button/amplify-federated-sign-in-button.component.js +2 -2
  14. package/esm2015/lib/components/amplify-force-new-password/amplify-force-new-password.component.js +12 -4
  15. package/esm2015/lib/components/amplify-reset-password/amplify-reset-password.component.js +7 -3
  16. package/esm2015/lib/components/amplify-setup-totp/amplify-setup-totp.component.js +14 -5
  17. package/esm2015/lib/components/amplify-sign-in/amplify-sign-in.component.js +8 -6
  18. package/esm2015/lib/components/amplify-sign-up/amplify-sign-up.component.js +16 -6
  19. package/esm2015/lib/components/amplify-verify-user/amplify-verify-user.component.js +16 -4
  20. package/esm2015/lib/components/confirm-reset-password/amplify-confirm-reset-password.component.js +9 -3
  21. package/esm2015/lib/components/confirm-verify-user/amplify-confirm-verify-user.component.js +7 -4
  22. package/esm2015/lib/components/index.js +14 -6
  23. package/esm2015/lib/directives/amplify-slot.directive.js +21 -0
  24. package/esm2015/lib/primitives/amplify-button/amplify-button.component.js +38 -0
  25. package/esm2015/lib/primitives/amplify-error/amplify-error.component.js +2 -2
  26. package/esm2015/lib/primitives/amplify-form-field/amplify-form-field.component.js +91 -0
  27. package/esm2015/lib/primitives/amplify-password-field/amplify-password-field.component.js +39 -0
  28. package/esm2015/lib/primitives/amplify-select/amplify-select.component.js +17 -0
  29. package/esm2015/lib/primitives/amplify-text-field/amplify-text-field.component.js +29 -0
  30. package/esm2015/lib/primitives/amplify-user-name-alias/amplify-user-name-alias.component.js +6 -4
  31. package/esm2015/lib/primitives/index.js +2 -2
  32. package/esm2015/lib/primitives/phone-number-field/phone-number-field.component.js +33 -0
  33. package/esm2015/lib/primitives/tab-item/tab-item.component.js +20 -0
  34. package/esm2015/lib/primitives/tabs/tabs.component.js +45 -0
  35. package/esm2015/lib/services/state-machine.service.js +12 -7
  36. package/esm2015/lib/ui-angular.module.js +30 -20
  37. package/fesm2015/aws-amplify-ui-angular.js +722 -441
  38. package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
  39. package/index.d.ts +2 -2
  40. package/lib/components/amplify-authenticator/amplify-authenticator.component.d.ts +11 -7
  41. package/lib/components/amplify-confirm-sign-in/amplify-confirm-sign-in.component.d.ts +4 -2
  42. package/lib/components/amplify-confirm-sign-up/amplify-confirm-sign-up.component.d.ts +4 -2
  43. package/lib/components/amplify-federated-sign-in/amplify-federated-sign-in.component.d.ts +4 -1
  44. package/lib/components/amplify-force-new-password/amplify-force-new-password.component.d.ts +2 -0
  45. package/lib/components/amplify-reset-password/amplify-reset-password.component.d.ts +2 -0
  46. package/lib/components/amplify-setup-totp/amplify-setup-totp.component.d.ts +3 -0
  47. package/lib/components/amplify-sign-in/amplify-sign-in.component.d.ts +3 -1
  48. package/lib/components/amplify-sign-up/amplify-sign-up.component.d.ts +1 -1
  49. package/lib/components/amplify-verify-user/amplify-verify-user.component.d.ts +5 -1
  50. package/lib/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +4 -0
  51. package/lib/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +2 -0
  52. package/lib/components/index.d.ts +13 -5
  53. package/lib/directives/{amplify-override.directive.d.ts → amplify-slot.directive.d.ts} +2 -2
  54. package/lib/primitives/amplify-button/amplify-button.component.d.ts +15 -0
  55. package/lib/primitives/amplify-form-field/amplify-form-field.component.d.ts +34 -0
  56. package/lib/primitives/amplify-password-field/amplify-password-field.component.d.ts +14 -0
  57. package/lib/primitives/amplify-select/amplify-select.component.d.ts +7 -0
  58. package/lib/primitives/amplify-text-field/amplify-text-field.component.d.ts +11 -0
  59. package/lib/primitives/amplify-user-name-alias/amplify-user-name-alias.component.d.ts +1 -0
  60. package/lib/primitives/index.d.ts +1 -1
  61. package/lib/primitives/phone-number-field/phone-number-field.component.d.ts +14 -0
  62. package/lib/primitives/tab-item/tab-item.component.d.ts +7 -0
  63. package/lib/primitives/tabs/tabs.component.d.ts +9 -0
  64. package/lib/services/state-machine.service.d.ts +2 -2
  65. package/package.json +4 -3
  66. package/styles/component.css +169 -0
  67. package/theme.css +2 -99
  68. package/esm2015/lib/components/amplify-sign-out/amplify-sign-out.component.js +0 -28
  69. package/esm2015/lib/directives/amplify-override.directive.js +0 -21
  70. package/esm2015/lib/primitives/amplify-input/amplify-input.component.js +0 -61
  71. package/lib/components/amplify-sign-out/amplify-sign-out.component.d.ts +0 -6
  72. package/lib/primitives/amplify-input/amplify-input.component.d.ts +0 -23
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@aws-amplify/ui'), require('xstate'), require('aws-amplify'), require('qrcode'), require('rxjs'), require('@aws-amplify/ui-components/dist/components')) :
3
- typeof define === 'function' && define.amd ? define('@aws-amplify/ui-angular', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@aws-amplify/ui', 'xstate', 'aws-amplify', 'qrcode', 'rxjs', '@aws-amplify/ui-components/dist/components'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['aws-amplify'] = global['aws-amplify'] || {}, global['aws-amplify']['ui-angular'] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ui, global.xstate, global['aws-amplify'], global.QRCode, global.rxjs, global.components));
5
- }(this, (function (exports, i0, common, forms, ui, xstate, awsAmplify, QRCode, rxjs, components) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@aws-amplify/ui'), require('aws-amplify'), require('xstate'), require('qrcode'), require('lodash'), require('nanoid'), require('rxjs'), require('@aws-amplify/ui-components/dist/components')) :
3
+ typeof define === 'function' && define.amd ? define('@aws-amplify/ui-angular', ['exports', '@angular/core', '@angular/common', '@aws-amplify/ui', 'aws-amplify', 'xstate', 'qrcode', 'lodash', 'nanoid', 'rxjs', '@aws-amplify/ui-components/dist/components'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["aws-amplify"] = global["aws-amplify"] || {}, global["aws-amplify"]["ui-angular"] = {}), global.ng.core, global.ng.common, global.ui, global["aws-amplify"], global.xstate, global.QRCode, global.lodash, global.nanoid, global.rxjs, global.components));
5
+ })(this, (function (exports, i0, common, ui, awsAmplify, xstate, QRCode, lodash, nanoid, rxjs, components) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -15,61 +15,103 @@
15
15
  var d = Object.getOwnPropertyDescriptor(e, k);
16
16
  Object.defineProperty(n, k, d.get ? d : {
17
17
  enumerable: true,
18
- get: function () {
19
- return e[k];
20
- }
18
+ get: function () { return e[k]; }
21
19
  });
22
20
  }
23
21
  });
24
22
  }
25
- n['default'] = e;
23
+ n["default"] = e;
26
24
  return Object.freeze(n);
27
25
  }
28
26
 
29
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
28
  var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode);
31
29
 
32
- var AmplifyOverrideDirective = /** @class */ (function () {
33
- function AmplifyOverrideDirective(template) {
30
+ var AmplifySlotDirective = /** @class */ (function () {
31
+ function AmplifySlotDirective(template) {
34
32
  this.template = template;
35
33
  }
36
- Object.defineProperty(AmplifyOverrideDirective.prototype, "amplifyOverride", {
34
+ Object.defineProperty(AmplifySlotDirective.prototype, "amplifySlot", {
37
35
  set: function (component) {
38
36
  this.name = component;
39
37
  },
40
38
  enumerable: false,
41
39
  configurable: true
42
40
  });
43
- return AmplifyOverrideDirective;
41
+ return AmplifySlotDirective;
44
42
  }());
45
- AmplifyOverrideDirective.decorators = [
43
+ AmplifySlotDirective.decorators = [
46
44
  { type: i0.Directive, args: [{
47
- selector: '[amplifyOverride]',
45
+ selector: '[amplifySlot]',
48
46
  },] }
49
47
  ];
50
- AmplifyOverrideDirective.ctorParameters = function () { return [
48
+ AmplifySlotDirective.ctorParameters = function () { return [
51
49
  { type: i0.TemplateRef }
52
50
  ]; };
53
- AmplifyOverrideDirective.propDecorators = {
54
- amplifyOverride: [{ type: i0.Input }]
51
+ AmplifySlotDirective.propDecorators = {
52
+ amplifySlot: [{ type: i0.Input }]
55
53
  };
56
54
 
55
+ var AuthPropService = /** @class */ (function () {
56
+ function AuthPropService() {
57
+ this._customComponents = {};
58
+ this._props = {};
59
+ }
60
+ Object.defineProperty(AuthPropService.prototype, "customComponents", {
61
+ get: function () {
62
+ return this._customComponents;
63
+ },
64
+ set: function (customComponents) {
65
+ this._customComponents = Object.assign(Object.assign({}, this._customComponents), customComponents);
66
+ },
67
+ enumerable: false,
68
+ configurable: true
69
+ });
70
+ Object.defineProperty(AuthPropService.prototype, "props", {
71
+ get: function () {
72
+ return this._props;
73
+ },
74
+ set: function (props) {
75
+ this._props = Object.assign(Object.assign({}, this._props), props);
76
+ },
77
+ enumerable: false,
78
+ configurable: true
79
+ });
80
+ return AuthPropService;
81
+ }());
82
+ AuthPropService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function AuthPropService_Factory() { return new AuthPropService(); }, token: AuthPropService, providedIn: "root" });
83
+ AuthPropService.decorators = [
84
+ { type: i0.Injectable, args: [{
85
+ providedIn: 'root',
86
+ },] }
87
+ ];
88
+ AuthPropService.ctorParameters = function () { return []; };
89
+
57
90
  /**
58
91
  * AmplifyContextService contains access to the xstate machine
59
92
  * and custom components passed by the user.
60
93
  */
61
94
  var StateMachineService = /** @class */ (function () {
62
95
  function StateMachineService() {
96
+ }
97
+ StateMachineService.prototype.startMachine = function (_a) {
63
98
  var _this = this;
64
- var interpreter = xstate.interpret(ui.authMachine, { devTools: true })
99
+ var initialState = _a.initialState, loginMechanisms = _a.loginMechanisms;
100
+ var machine = ui.createAuthenticatorMachine({
101
+ initialState: initialState,
102
+ loginMechanisms: loginMechanisms,
103
+ });
104
+ var authService = xstate.interpret(machine, {
105
+ devTools: process.env.NODE_ENV === 'development',
106
+ })
65
107
  .onTransition(function (state) {
66
108
  _this._user = state.context.user;
67
109
  _this._authState = state;
68
110
  })
69
111
  .start();
70
- this._services = ui.getSendEventAliases(interpreter.send);
71
- this._authService = interpreter;
72
- }
112
+ this._services = ui.getSendEventAliases(authService.send);
113
+ this._authService = authService;
114
+ };
73
115
  Object.defineProperty(StateMachineService.prototype, "services", {
74
116
  get: function () {
75
117
  return this._services;
@@ -116,55 +158,28 @@
116
158
  providedIn: 'root',
117
159
  },] }
118
160
  ];
119
- StateMachineService.ctorParameters = function () { return []; };
120
-
121
- var AuthPropService = /** @class */ (function () {
122
- function AuthPropService() {
123
- this._customComponents = {};
124
- this._props = {};
125
- }
126
- Object.defineProperty(AuthPropService.prototype, "customComponents", {
127
- get: function () {
128
- return this._customComponents;
129
- },
130
- set: function (customComponents) {
131
- this._customComponents = Object.assign(Object.assign({}, this._customComponents), customComponents);
132
- },
133
- enumerable: false,
134
- configurable: true
135
- });
136
- Object.defineProperty(AuthPropService.prototype, "props", {
137
- get: function () {
138
- return this._props;
139
- },
140
- set: function (props) {
141
- this._props = Object.assign(Object.assign({}, this._props), props);
142
- },
143
- enumerable: false,
144
- configurable: true
145
- });
146
- return AuthPropService;
147
- }());
148
- AuthPropService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function AuthPropService_Factory() { return new AuthPropService(); }, token: AuthPropService, providedIn: "root" });
149
- AuthPropService.decorators = [
150
- { type: i0.Injectable, args: [{
151
- providedIn: 'root',
152
- },] }
153
- ];
154
- AuthPropService.ctorParameters = function () { return []; };
155
161
 
156
162
  var AmplifyAuthenticatorComponent = /** @class */ (function () {
157
163
  function AmplifyAuthenticatorComponent(stateMachine, contextService) {
158
164
  this.stateMachine = stateMachine;
159
165
  this.contextService = contextService;
160
- /**
161
- * TODO: Add back custom events
162
- */
163
- this.initialAuthState = 'signIn';
164
- this.dataAttr = '';
165
166
  this.customComponentQuery = null;
166
167
  this.customComponents = {};
167
- }
168
+ // translated texts
169
+ this.signInTitle = ui.translate('Sign In');
170
+ this.signUpTitle = ui.translate('Create Account');
171
+ }
172
+ AmplifyAuthenticatorComponent.prototype.ngOnInit = function () {
173
+ awsAmplify.I18n.putVocabularies(ui.translations);
174
+ var _a = this, initialState = _a.initialState, loginMechanisms = _a.loginMechanisms;
175
+ this.stateMachine.startMachine({ initialState: initialState, loginMechanisms: loginMechanisms });
176
+ /**
177
+ * handling translations after content init, because authenticator and its
178
+ * translations might be initialized before the main app's `ngOnInit` is run.
179
+ **/
180
+ this.signInTitle = ui.translate('Sign In');
181
+ this.signUpTitle = ui.translate('Create Account');
182
+ };
168
183
  /**
169
184
  * Lifecycle Methods
170
185
  */
@@ -198,6 +213,15 @@
198
213
  enumerable: false,
199
214
  configurable: true
200
215
  });
216
+ AmplifyAuthenticatorComponent.prototype.onTabChange = function () {
217
+ var currentState = this.stateMachine.authState.value;
218
+ if (currentState === 'signIn') {
219
+ this.stateMachine.send('SIGN_UP');
220
+ }
221
+ else {
222
+ this.stateMachine.send('SIGN_IN');
223
+ }
224
+ };
201
225
  AmplifyAuthenticatorComponent.prototype.mapCustomComponents = function (componentQuery) {
202
226
  if (!componentQuery)
203
227
  return {};
@@ -212,7 +236,7 @@
212
236
  AmplifyAuthenticatorComponent.decorators = [
213
237
  { type: i0.Component, args: [{
214
238
  selector: 'amplify-authenticator',
215
- 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>\n <p>You've signed In.</p>\n <amplify-sign-out></amplify-sign-out>\n</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<!-- signIn component -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.signIn || signIn\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('signIn')\"\n>\n</ng-container>\n\n<!-- signUp component -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.signUp || signUp\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('signUp')\"\n>\n</ng-container>\n\n<!-- confirmSignUp content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.confirmSignUp || confirmSignUp\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmSignUp')\"\n>\n</ng-container>\n\n<!-- confirmSignIn content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.confirmSignIn || confirmSignIn\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmSignIn')\"\n>\n</ng-container>\n\n<!-- setupTotp content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.setupTOTP || setupTOTP\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('setupTOTP')\"\n>\n</ng-container>\n\n<!-- forceNewPassword content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.forceNewPassword || forceNewPassword\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('forceNewPassword')\"\n>\n</ng-container>\n\n<!-- resetPassword content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.resetPassword || resetPassword\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('resetPassword')\"\n>\n</ng-container>\n\n<!-- confirmResetPassword content -->\n<ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPassword || confirmResetPassword\n \"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmResetPassword')\"\n>\n</ng-container>\n\n<!-- verifyUser content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.verifyUser || verifyUser\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('verifyUser')\"\n>\n</ng-container>\n\n<!-- confirmVerifyUser content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.confirmVerifyUser || confirmVerifyUser\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"actorState?.matches('confirmVerifyUser')\"\n>\n</ng-container>\n\n<!-- signedIn content -->\n<ng-container\n [ngTemplateOutlet]=\"customComponents.authenticated || authenticated\"\n [ngTemplateOutletContext]=\"context\"\n *ngIf=\"authenticatorState.matches('authenticated')\"\n>\n</ng-container>\n",
239
+ 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",
216
240
  providers: [AuthPropService],
217
241
  encapsulation: i0.ViewEncapsulation.None
218
242
  },] }
@@ -222,500 +246,295 @@
222
246
  { type: AuthPropService }
223
247
  ]; };
224
248
  AmplifyAuthenticatorComponent.propDecorators = {
225
- initialAuthState: [{ type: i0.Input }],
226
- dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator',] }],
227
- customComponentQuery: [{ type: i0.ContentChildren, args: [AmplifyOverrideDirective,] }]
249
+ initialState: [{ type: i0.Input }],
250
+ loginMechanisms: [{ type: i0.Input }],
251
+ customComponentQuery: [{ type: i0.ContentChildren, args: [AmplifySlotDirective,] }]
228
252
  };
229
253
 
230
- /*! *****************************************************************************
231
- Copyright (c) Microsoft Corporation.
232
-
233
- Permission to use, copy, modify, and/or distribute this software for any
234
- purpose with or without fee is hereby granted.
235
-
236
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
237
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
238
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
239
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
240
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
241
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
242
- PERFORMANCE OF THIS SOFTWARE.
243
- ***************************************************************************** */
244
- /* global Reflect, Promise */
245
- var extendStatics = function (d, b) {
246
- extendStatics = Object.setPrototypeOf ||
247
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
248
- function (d, b) { for (var p in b)
249
- if (Object.prototype.hasOwnProperty.call(b, p))
250
- d[p] = b[p]; };
251
- return extendStatics(d, b);
252
- };
253
- function __extends(d, b) {
254
- if (typeof b !== "function" && b !== null)
255
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
256
- extendStatics(d, b);
257
- function __() { this.constructor = d; }
258
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
259
- }
260
- var __assign = function () {
261
- __assign = Object.assign || function __assign(t) {
262
- for (var s, i = 1, n = arguments.length; i < n; i++) {
263
- s = arguments[i];
264
- for (var p in s)
265
- if (Object.prototype.hasOwnProperty.call(s, p))
266
- t[p] = s[p];
254
+ var logger$3 = new awsAmplify.Logger('ConfirmSignIn');
255
+ var AmplifyConfirmSignInComponent = /** @class */ (function () {
256
+ function AmplifyConfirmSignInComponent(stateMachine, contextService) {
257
+ this.stateMachine = stateMachine;
258
+ this.contextService = contextService;
259
+ this.dataAttr = '';
260
+ this.customComponents = {};
261
+ this.remoteError = '';
262
+ this.isPending = false;
263
+ this.confirmText = ui.translate('Confirm');
264
+ this.backToSignInText = ui.translate('Back to Sign In');
265
+ }
266
+ AmplifyConfirmSignInComponent.prototype.ngOnInit = function () {
267
+ var _this = this;
268
+ this.authSubscription = this.stateMachine.authService.subscribe(function (state) {
269
+ _this.onStateUpdate(state);
270
+ });
271
+ this.setHeaderText();
272
+ };
273
+ AmplifyConfirmSignInComponent.prototype.ngAfterContentInit = function () {
274
+ this.customComponents = this.contextService.customComponents;
275
+ };
276
+ AmplifyConfirmSignInComponent.prototype.ngOnDestroy = function () {
277
+ this.authSubscription.unsubscribe();
278
+ };
279
+ Object.defineProperty(AmplifyConfirmSignInComponent.prototype, "context", {
280
+ get: function () {
281
+ var _a = this.stateMachine.services, change = _a.change, signIn = _a.signIn, submit = _a.submit;
282
+ var remoteError = this.remoteError;
283
+ return { change: change, remoteError: remoteError, signIn: signIn, submit: submit };
284
+ },
285
+ enumerable: false,
286
+ configurable: true
287
+ });
288
+ AmplifyConfirmSignInComponent.prototype.setHeaderText = function () {
289
+ var state = this.stateMachine.authState;
290
+ var actorContext = ui.getActorContext(state);
291
+ var challengeName = actorContext.challengeName;
292
+ switch (challengeName) {
293
+ case ui.AuthChallengeNames.SOFTWARE_TOKEN_MFA:
294
+ // TODO: this string should be centralized and translated from ui.
295
+ this.headerText = ui.translate('Confirm TOTP Code');
296
+ break;
297
+ case ui.AuthChallengeNames.SMS_MFA:
298
+ this.headerText = ui.translate('Confirm SMS Code');
299
+ break;
300
+ default:
301
+ logger$3.error('Unexpected challengeName', challengeName);
267
302
  }
268
- return t;
269
303
  };
270
- return __assign.apply(this, arguments);
304
+ AmplifyConfirmSignInComponent.prototype.onStateUpdate = function (state) {
305
+ var actorState = ui.getActorState(state);
306
+ this.remoteError = actorState.context.remoteError;
307
+ this.isPending = !actorState.matches('confirmSignIn.edit');
308
+ };
309
+ AmplifyConfirmSignInComponent.prototype.onInput = function (event) {
310
+ event.preventDefault();
311
+ var _a = event.target, name = _a.name, value = _a.value;
312
+ this.stateMachine.send({
313
+ type: 'CHANGE',
314
+ data: { name: name, value: value },
315
+ });
316
+ };
317
+ AmplifyConfirmSignInComponent.prototype.onSubmit = function (event) {
318
+ event.preventDefault();
319
+ // TODO: handle form data within the state machine
320
+ var formData = new FormData(event.target);
321
+ this.stateMachine.send({
322
+ type: 'SUBMIT',
323
+ data: Object.fromEntries(formData),
324
+ });
325
+ };
326
+ AmplifyConfirmSignInComponent.prototype.toSignIn = function () {
327
+ this.stateMachine.send('SIGN_IN');
328
+ };
329
+ return AmplifyConfirmSignInComponent;
330
+ }());
331
+ AmplifyConfirmSignInComponent.decorators = [
332
+ { type: i0.Component, args: [{
333
+ selector: 'amplify-confirm-sign-in',
334
+ 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"
335
+ },] }
336
+ ];
337
+ AmplifyConfirmSignInComponent.ctorParameters = function () { return [
338
+ { type: StateMachineService },
339
+ { type: AuthPropService }
340
+ ]; };
341
+ AmplifyConfirmSignInComponent.propDecorators = {
342
+ dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-confirmsignin',] }]
271
343
  };
272
- function __rest(s, e) {
273
- var t = {};
274
- for (var p in s)
275
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
276
- t[p] = s[p];
277
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
278
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
279
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
280
- t[p[i]] = s[p[i]];
281
- }
282
- return t;
283
- }
284
- function __decorate(decorators, target, key, desc) {
285
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
286
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
287
- r = Reflect.decorate(decorators, target, key, desc);
288
- else
289
- for (var i = decorators.length - 1; i >= 0; i--)
290
- if (d = decorators[i])
291
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
292
- return c > 3 && r && Object.defineProperty(target, key, r), r;
293
- }
294
- function __param(paramIndex, decorator) {
295
- return function (target, key) { decorator(target, key, paramIndex); };
296
- }
297
- function __metadata(metadataKey, metadataValue) {
298
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
299
- return Reflect.metadata(metadataKey, metadataValue);
300
- }
301
- function __awaiter(thisArg, _arguments, P, generator) {
302
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
303
- return new (P || (P = Promise))(function (resolve, reject) {
304
- function fulfilled(value) { try {
305
- step(generator.next(value));
306
- }
307
- catch (e) {
308
- reject(e);
309
- } }
310
- function rejected(value) { try {
311
- step(generator["throw"](value));
312
- }
313
- catch (e) {
314
- reject(e);
315
- } }
316
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
317
- step((generator = generator.apply(thisArg, _arguments || [])).next());
318
- });
319
- }
320
- function __generator(thisArg, body) {
321
- var _ = { label: 0, sent: function () { if (t[0] & 1)
322
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
323
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
324
- function verb(n) { return function (v) { return step([n, v]); }; }
325
- function step(op) {
326
- if (f)
327
- throw new TypeError("Generator is already executing.");
328
- while (_)
329
- try {
330
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
331
- return t;
332
- if (y = 0, t)
333
- op = [op[0] & 2, t.value];
334
- switch (op[0]) {
335
- case 0:
336
- case 1:
337
- t = op;
338
- break;
339
- case 4:
340
- _.label++;
341
- return { value: op[1], done: false };
342
- case 5:
343
- _.label++;
344
- y = op[1];
345
- op = [0];
346
- continue;
347
- case 7:
348
- op = _.ops.pop();
349
- _.trys.pop();
350
- continue;
351
- default:
352
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
353
- _ = 0;
354
- continue;
355
- }
356
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
357
- _.label = op[1];
358
- break;
359
- }
360
- if (op[0] === 6 && _.label < t[1]) {
361
- _.label = t[1];
362
- t = op;
363
- break;
364
- }
365
- if (t && _.label < t[2]) {
366
- _.label = t[2];
367
- _.ops.push(op);
368
- break;
369
- }
370
- if (t[2])
371
- _.ops.pop();
372
- _.trys.pop();
373
- continue;
374
- }
375
- op = body.call(thisArg, _);
376
- }
377
- catch (e) {
378
- op = [6, e];
379
- y = 0;
380
- }
381
- finally {
382
- f = t = 0;
383
- }
384
- if (op[0] & 5)
385
- throw op[1];
386
- return { value: op[0] ? op[1] : void 0, done: true };
387
- }
388
- }
389
- var __createBinding = Object.create ? (function (o, m, k, k2) {
390
- if (k2 === undefined)
391
- k2 = k;
392
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
393
- }) : (function (o, m, k, k2) {
394
- if (k2 === undefined)
395
- k2 = k;
396
- o[k2] = m[k];
397
- });
398
- function __exportStar(m, o) {
399
- for (var p in m)
400
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
401
- __createBinding(o, m, p);
402
- }
403
- function __values(o) {
404
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
405
- if (m)
406
- return m.call(o);
407
- if (o && typeof o.length === "number")
408
- return {
409
- next: function () {
410
- if (o && i >= o.length)
411
- o = void 0;
412
- return { value: o && o[i++], done: !o };
413
- }
414
- };
415
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
416
- }
417
- function __read(o, n) {
418
- var m = typeof Symbol === "function" && o[Symbol.iterator];
419
- if (!m)
420
- return o;
421
- var i = m.call(o), r, ar = [], e;
422
- try {
423
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
424
- ar.push(r.value);
425
- }
426
- catch (error) {
427
- e = { error: error };
428
- }
429
- finally {
430
- try {
431
- if (r && !r.done && (m = i["return"]))
432
- m.call(i);
433
- }
434
- finally {
435
- if (e)
436
- throw e.error;
437
- }
438
- }
439
- return ar;
440
- }
441
- /** @deprecated */
442
- function __spread() {
443
- for (var ar = [], i = 0; i < arguments.length; i++)
444
- ar = ar.concat(__read(arguments[i]));
445
- return ar;
446
- }
447
- /** @deprecated */
448
- function __spreadArrays() {
449
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
450
- s += arguments[i].length;
451
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
452
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
453
- r[k] = a[j];
454
- return r;
455
- }
456
- function __spreadArray(to, from, pack) {
457
- if (pack || arguments.length === 2)
458
- for (var i = 0, l = from.length, ar; i < l; i++) {
459
- if (ar || !(i in from)) {
460
- if (!ar)
461
- ar = Array.prototype.slice.call(from, 0, i);
462
- ar[i] = from[i];
463
- }
464
- }
465
- return to.concat(ar || Array.prototype.slice.call(from));
466
- }
467
- function __await(v) {
468
- return this instanceof __await ? (this.v = v, this) : new __await(v);
469
- }
470
- function __asyncGenerator(thisArg, _arguments, generator) {
471
- if (!Symbol.asyncIterator)
472
- throw new TypeError("Symbol.asyncIterator is not defined.");
473
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
474
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
475
- function verb(n) { if (g[n])
476
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
477
- function resume(n, v) { try {
478
- step(g[n](v));
479
- }
480
- catch (e) {
481
- settle(q[0][3], e);
482
- } }
483
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
484
- function fulfill(value) { resume("next", value); }
485
- function reject(value) { resume("throw", value); }
486
- function settle(f, v) { if (f(v), q.shift(), q.length)
487
- resume(q[0][0], q[0][1]); }
488
- }
489
- function __asyncDelegator(o) {
490
- var i, p;
491
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
492
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
493
- }
494
- function __asyncValues(o) {
495
- if (!Symbol.asyncIterator)
496
- throw new TypeError("Symbol.asyncIterator is not defined.");
497
- var m = o[Symbol.asyncIterator], i;
498
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
499
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
500
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
501
- }
502
- function __makeTemplateObject(cooked, raw) {
503
- if (Object.defineProperty) {
504
- Object.defineProperty(cooked, "raw", { value: raw });
505
- }
506
- else {
507
- cooked.raw = raw;
508
- }
509
- return cooked;
510
- }
511
- ;
512
- var __setModuleDefault = Object.create ? (function (o, v) {
513
- Object.defineProperty(o, "default", { enumerable: true, value: v });
514
- }) : function (o, v) {
515
- o["default"] = v;
516
- };
517
- function __importStar(mod) {
518
- if (mod && mod.__esModule)
519
- return mod;
520
- var result = {};
521
- if (mod != null)
522
- for (var k in mod)
523
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
524
- __createBinding(result, mod, k);
525
- __setModuleDefault(result, mod);
526
- return result;
527
- }
528
- function __importDefault(mod) {
529
- return (mod && mod.__esModule) ? mod : { default: mod };
530
- }
531
- function __classPrivateFieldGet(receiver, state, kind, f) {
532
- if (kind === "a" && !f)
533
- throw new TypeError("Private accessor was defined without a getter");
534
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
535
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
536
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
537
- }
538
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
539
- if (kind === "m")
540
- throw new TypeError("Private method is not writable");
541
- if (kind === "a" && !f)
542
- throw new TypeError("Private accessor was defined without a setter");
543
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
544
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
545
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
546
- }
547
344
 
548
- var logger$4 = new awsAmplify.Logger('SignIn');
549
- var AmplifySignInComponent = /** @class */ (function () {
550
- function AmplifySignInComponent(stateMachine, contextService) {
345
+ var AmplifyConfirmSignUpComponent = /** @class */ (function () {
346
+ function AmplifyConfirmSignUpComponent(stateMachine, contextService) {
551
347
  this.stateMachine = stateMachine;
552
348
  this.contextService = contextService;
553
349
  this.dataAttr = '';
554
- this.headerText = 'Sign in to your account';
350
+ this.headerText = ui.translate('Confirm Sign Up');
555
351
  this.customComponents = {};
556
352
  this.remoteError = '';
557
353
  this.isPending = false;
354
+ // translated texts
355
+ this.resendCodeText = ui.translate('Resend Code');
356
+ this.lostCodeText = ui.translate('Lost your code? ');
357
+ this.confirmText = ui.translate('Confirm');
558
358
  }
559
- AmplifySignInComponent.prototype.ngOnInit = function () {
359
+ AmplifyConfirmSignUpComponent.prototype.ngOnInit = function () {
560
360
  var _this = this;
361
+ // TODO: alias for subscribe
561
362
  this.authSubscription = this.stateMachine.authService.subscribe(function (state) { return _this.onStateUpdate(state); });
562
363
  };
563
- AmplifySignInComponent.prototype.ngAfterContentInit = function () {
364
+ AmplifyConfirmSignUpComponent.prototype.ngAfterContentInit = function () {
564
365
  this.customComponents = this.contextService.customComponents;
565
366
  };
566
- AmplifySignInComponent.prototype.ngOnDestroy = function () {
567
- logger$4.log('sign in destroyed, unsubscribing from state machine...');
367
+ AmplifyConfirmSignUpComponent.prototype.ngOnDestroy = function () {
568
368
  this.authSubscription.unsubscribe();
569
369
  };
570
- AmplifySignInComponent.prototype.onStateUpdate = function (state) {
370
+ AmplifyConfirmSignUpComponent.prototype.onStateUpdate = function (state) {
571
371
  var actorState = ui.getActorState(state);
572
372
  this.remoteError = actorState.context.remoteError;
573
- this.isPending = !actorState.matches('signIn.edit');
373
+ this.isPending = !actorState.matches('confirmSignUp.edit');
574
374
  };
575
- Object.defineProperty(AmplifySignInComponent.prototype, "context", {
375
+ Object.defineProperty(AmplifyConfirmSignUpComponent.prototype, "context", {
576
376
  get: function () {
577
- var _a = this.stateMachine.services, change = _a.change, resetPassword = _a.resetPassword, signUp = _a.signUp, submit = _a.submit;
377
+ var _a = this.stateMachine.services, change = _a.change, resend = _a.resend, signIn = _a.signIn, submit = _a.submit;
578
378
  var remoteError = this.remoteError;
579
- return { change: change, remoteError: remoteError, resetPassword: resetPassword, signUp: signUp, submit: submit };
379
+ var username = this.username;
380
+ return { change: change, remoteError: remoteError, resend: resend, signIn: signIn, submit: submit, username: username };
580
381
  },
581
382
  enumerable: false,
582
383
  configurable: true
583
384
  });
584
- AmplifySignInComponent.prototype.toSignUp = function () {
585
- this.stateMachine.send('SIGN_UP');
586
- };
587
- AmplifySignInComponent.prototype.toResetPassword = function () {
588
- this.stateMachine.send('RESET_PASSWORD');
589
- };
590
- AmplifySignInComponent.prototype.onInput = function (event) {
591
- event.preventDefault();
592
- var _a = event.target, name = _a.name, value = _a.value;
385
+ AmplifyConfirmSignUpComponent.prototype.resend = function () {
593
386
  this.stateMachine.send({
594
- type: 'CHANGE',
595
- data: { name: name, value: value },
596
- });
597
- };
598
- AmplifySignInComponent.prototype.onSubmit = function (event) {
599
- return __awaiter(this, void 0, void 0, function () {
600
- return __generator(this, function (_a) {
601
- event.preventDefault();
602
- this.stateMachine.send({
603
- type: 'SUBMIT',
604
- });
605
- return [2 /*return*/];
606
- });
387
+ type: 'RESEND',
388
+ data: {
389
+ username: this.username,
390
+ },
607
391
  });
608
392
  };
609
- return AmplifySignInComponent;
393
+ AmplifyConfirmSignUpComponent.prototype.onInput = function ($event) {
394
+ $event.preventDefault();
395
+ var _a = $event.target, name = _a.name, value = _a.value;
396
+ this.stateMachine.send({
397
+ type: 'CHANGE',
398
+ data: { name: name, value: value },
399
+ });
400
+ };
401
+ AmplifyConfirmSignUpComponent.prototype.onSubmit = function (event) {
402
+ event.preventDefault();
403
+ var state = this.stateMachine.authState;
404
+ var actorContext = ui.getActorContext(state);
405
+ var formValues = actorContext.formValues;
406
+ var username = formValues.username, confirmation_code = formValues.confirmation_code;
407
+ this.stateMachine.send({
408
+ type: 'SUBMIT',
409
+ data: { username: username, confirmation_code: confirmation_code },
410
+ });
411
+ };
412
+ return AmplifyConfirmSignUpComponent;
610
413
  }());
611
- AmplifySignInComponent.decorators = [
414
+ AmplifyConfirmSignUpComponent.decorators = [
612
415
  { type: i0.Component, args: [{
613
- selector: 'amplify-sign-in',
614
- template: "<!-- \n Define default contents here\n-->\n<ng-template #signInButton>\n <button data-amplify-button type=\"submit\">Sign In</button>\n</ng-template>\n\n<ng-template #signInForm>\n <amplify-federated-sign-in></amplify-federated-sign-in>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-user-name-alias></amplify-user-name-alias>\n <amplify-form-input\n data-amplify-password\n name=\"password\"\n type=\"password\"\n autocomplete=\"current-password\"\n ></amplify-form-input>\n <button type=\"button\" (click)=\"toResetPassword()\">\n Forgot your password?\n </button>\n <div data-amplify-footer>\n <div>\n No account?{{ ' ' }}\n <a data-amplify-link (click)=\"toSignUp()\">Create account</a>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInButton || signInButton\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || signInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n",
615
- encapsulation: i0.ViewEncapsulation.None
416
+ selector: 'amplify-confirm-sign-up',
417
+ 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"
616
418
  },] }
617
419
  ];
618
- AmplifySignInComponent.ctorParameters = function () { return [
420
+ AmplifyConfirmSignUpComponent.ctorParameters = function () { return [
619
421
  { type: StateMachineService },
620
422
  { type: AuthPropService }
621
423
  ]; };
622
- AmplifySignInComponent.propDecorators = {
623
- dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-signin',] }],
424
+ AmplifyConfirmSignUpComponent.propDecorators = {
425
+ dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-confirmsignup',] }],
624
426
  headerText: [{ type: i0.Input }]
625
427
  };
626
428
 
627
- var AmplifySignOutComponent = /** @class */ (function () {
628
- function AmplifySignOutComponent(stateMachine) {
429
+ var AmplifyFederatedSignInButtonComponent = /** @class */ (function () {
430
+ function AmplifyFederatedSignInButtonComponent(stateMachine) {
431
+ var _this = this;
629
432
  this.stateMachine = stateMachine;
630
- }
631
- AmplifySignOutComponent.prototype.signOut = function () {
632
- return __awaiter(this, void 0, void 0, function () {
633
- return __generator(this, function (_a) {
634
- try {
635
- this.stateMachine.authService.send('SIGN_OUT');
636
- }
637
- catch (err) {
638
- console.error(err);
639
- }
640
- return [2 /*return*/];
433
+ this.onClick = function () {
434
+ _this.stateMachine.send({
435
+ type: 'FEDERATED_SIGN_IN',
436
+ data: { provider: _this.provider },
641
437
  });
642
- });
438
+ };
439
+ }
440
+ return AmplifyFederatedSignInButtonComponent;
441
+ }());
442
+ AmplifyFederatedSignInButtonComponent.decorators = [
443
+ { type: i0.Component, args: [{
444
+ selector: 'amplify-federated-sign-in-button',
445
+ 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"
446
+ },] }
447
+ ];
448
+ AmplifyFederatedSignInButtonComponent.ctorParameters = function () { return [
449
+ { type: StateMachineService }
450
+ ]; };
451
+ AmplifyFederatedSignInButtonComponent.propDecorators = {
452
+ provider: [{ type: i0.Input }],
453
+ text: [{ type: i0.Input }]
454
+ };
455
+
456
+ var AmplifyFederatedSignInComponent = /** @class */ (function () {
457
+ function AmplifyFederatedSignInComponent(stateMachine) {
458
+ this.stateMachine = stateMachine;
459
+ this.FederatedProviders = ui.FederatedIdentityProviders;
460
+ this.includeFacebook = false;
461
+ this.includeGoogle = false;
462
+ this.includeAmazon = false;
463
+ this.shouldShowFederatedSignIn = false;
464
+ // translated texts
465
+ this.signInFacebookText = ui.translate('Sign In with Facebook');
466
+ this.signInGoogleText = ui.translate('Sign In with Google');
467
+ this.signInAmazonText = ui.translate('Sign In with Amazon');
468
+ }
469
+ AmplifyFederatedSignInComponent.prototype.ngOnInit = function () {
470
+ var _a, _b;
471
+ var loginMechanisms = (_b = (_a = this.stateMachine.context) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.login_mechanisms;
472
+ this.includeFacebook = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('facebook');
473
+ this.includeGoogle = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('google');
474
+ this.includeAmazon = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('amazon');
475
+ this.shouldShowFederatedSignIn =
476
+ this.includeFacebook || this.includeGoogle || this.includeAmazon;
643
477
  };
644
- return AmplifySignOutComponent;
478
+ return AmplifyFederatedSignInComponent;
645
479
  }());
646
- AmplifySignOutComponent.decorators = [
480
+ AmplifyFederatedSignInComponent.decorators = [
647
481
  { type: i0.Component, args: [{
648
- selector: 'amplify-sign-out',
649
- template: "<div [ngStyle]=\"{ height: '24rem' }\">\n <button (click)=\"signOut()\">Sign Out</button>\n</div>\n"
482
+ selector: 'amplify-federated-sign-in',
483
+ 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"
650
484
  },] }
651
485
  ];
652
- AmplifySignOutComponent.ctorParameters = function () { return [
486
+ AmplifyFederatedSignInComponent.ctorParameters = function () { return [
653
487
  { type: StateMachineService }
654
488
  ]; };
655
489
 
656
- var AmplifySignUpComponent = /** @class */ (function () {
657
- function AmplifySignUpComponent(stateMachine, contextService) {
490
+ var logger$2 = new awsAmplify.Logger('ForceNewPassword');
491
+ var AmplifyForceNewPasswordComponent = /** @class */ (function () {
492
+ function AmplifyForceNewPasswordComponent(stateMachine, contextService) {
658
493
  this.stateMachine = stateMachine;
659
494
  this.contextService = contextService;
660
495
  this.dataAttr = '';
661
- this.headerText = 'Create a new account';
496
+ this.headerText = ui.translate('Change Password');
497
+ this.customComponents = {};
662
498
  this.remoteError = '';
663
499
  this.isPending = false;
664
- this.primaryAlias = '';
665
- this.secondaryAliases = [];
666
- this.validationError = {};
500
+ // translated texts
501
+ this.changePasswordText = ui.translate('Change Password');
502
+ this.backToSignInText = ui.translate('Back to Sign In');
667
503
  }
668
- Object.defineProperty(AmplifySignUpComponent.prototype, "context", {
669
- get: function () {
670
- var _a = this.stateMachine.services, change = _a.change, signIn = _a.signIn, submit = _a.submit;
671
- var remoteError = this.remoteError;
672
- var validationError = this.validationError;
673
- return {
674
- change: change,
675
- remoteError: remoteError,
676
- signIn: signIn,
677
- submit: submit,
678
- validationError: validationError,
679
- };
680
- },
681
- enumerable: false,
682
- configurable: true
683
- });
684
- AmplifySignUpComponent.prototype.ngOnInit = function () {
504
+ AmplifyForceNewPasswordComponent.prototype.ngOnInit = function () {
685
505
  var _this = this;
686
506
  this.authSubscription = this.stateMachine.authService.subscribe(function (state) { return _this.onStateUpdate(state); });
687
- var context = this.stateMachine.context;
688
- var _a = ui.getConfiguredAliases(context), primaryAlias = _a.primaryAlias, secondaryAliases = _a.secondaryAliases;
689
- this.primaryAlias = primaryAlias;
690
- this.secondaryAliases = secondaryAliases;
691
507
  };
692
- AmplifySignUpComponent.prototype.ngAfterContentInit = function () {
508
+ AmplifyForceNewPasswordComponent.prototype.ngAfterContentInit = function () {
693
509
  this.customComponents = this.contextService.customComponents;
694
510
  };
695
- AmplifySignUpComponent.prototype.ngOnDestroy = function () {
511
+ AmplifyForceNewPasswordComponent.prototype.ngOnDestroy = function () {
512
+ logger$2.log('sign in destroyed, unsubscribing from state machine...');
696
513
  this.authSubscription.unsubscribe();
697
514
  };
698
- AmplifySignUpComponent.prototype.onStateUpdate = function (state) {
515
+ AmplifyForceNewPasswordComponent.prototype.onStateUpdate = function (state) {
699
516
  var actorState = ui.getActorState(state);
700
- var actorContext = ui.getActorContext(state);
701
- this.remoteError = actorContext.remoteError;
702
- this.validationError = actorContext.validationError;
703
- this.isPending = !actorState.matches({
517
+ this.remoteError = actorState.context.remoteError;
518
+ this.isPending = actorState.matches({
704
519
  signUp: {
705
520
  submission: 'idle',
706
521
  },
707
522
  });
708
523
  };
709
- AmplifySignUpComponent.prototype.onSubmit = function ($event) {
710
- return __awaiter(this, void 0, void 0, function () {
711
- return __generator(this, function (_a) {
712
- $event.preventDefault();
713
- this.stateMachine.send('SUBMIT');
714
- return [2 /*return*/];
715
- });
716
- });
524
+ Object.defineProperty(AmplifyForceNewPasswordComponent.prototype, "context", {
525
+ get: function () {
526
+ var _a = this.stateMachine.services, change = _a.change, signIn = _a.signIn, submit = _a.submit;
527
+ var user = this.stateMachine.user;
528
+ var remoteError = this.remoteError;
529
+ return { change: change, remoteError: remoteError, signIn: signIn, submit: submit, user: user };
530
+ },
531
+ enumerable: false,
532
+ configurable: true
533
+ });
534
+ AmplifyForceNewPasswordComponent.prototype.toSignIn = function () {
535
+ this.stateMachine.send('SIGN_IN');
717
536
  };
718
- AmplifySignUpComponent.prototype.onInput = function (event) {
537
+ AmplifyForceNewPasswordComponent.prototype.onInput = function (event) {
719
538
  event.preventDefault();
720
539
  var _a = event.target, name = _a.name, value = _a.value;
721
540
  this.stateMachine.send({
@@ -723,324 +542,420 @@
723
542
  data: { name: name, value: value },
724
543
  });
725
544
  };
726
- AmplifySignUpComponent.prototype.toSignIn = function () {
727
- this.stateMachine.send('SIGN_IN');
545
+ AmplifyForceNewPasswordComponent.prototype.onSubmit = function (event) {
546
+ event.preventDefault();
547
+ // consider stateMachine directly providing actorState / actorContext
548
+ var state = this.stateMachine.authState;
549
+ var actorState = ui.getActorContext(state);
550
+ var formValues = actorState.formValues;
551
+ this.stateMachine.send({
552
+ type: 'SUBMIT',
553
+ data: formValues,
554
+ });
728
555
  };
729
- return AmplifySignUpComponent;
556
+ return AmplifyForceNewPasswordComponent;
730
557
  }());
731
- AmplifySignUpComponent.decorators = [
558
+ AmplifyForceNewPasswordComponent.decorators = [
732
559
  { type: i0.Component, args: [{
733
- selector: 'amplify-sign-up',
734
- template: "<ng-template #signUpButton>\n <button data-amplify-button type=\"submit\">Create Account</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-input\n name=\"password\"\n [required]=\"true\"\n autocomplete=\"new-password\"\n ></amplify-form-input>\n</ng-template>\n\n<ng-template #signUpConfirmPassword>\n <amplify-form-input\n name=\"confirm_password\"\n label=\"Confirm Password\"\n [required]=\"true\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-input>\n</ng-template>\n\n<ng-template #signUpFieldset>\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\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-input [name]=\"secondaryAlias\"></amplify-form-input>\n </ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n</ng-template>\n\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <form\n data-amplify-form\n (submit)=\"onSubmit($event)\"\n (input)=\"onInput($event)\"\n ngNativeValidate\n >\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signUpFieldset || signUpFieldset\"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n\n <div data-amplify-footer>\n <div>\n Have an account?{{ ' ' }}\n <span data-amplify-link (click)=\"toSignIn()\">Sign In</span>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signUpButton || signUpButton\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </form>\n</div>\n"
560
+ selector: 'amplify-force-new-password',
561
+ 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"
735
562
  },] }
736
563
  ];
737
- AmplifySignUpComponent.ctorParameters = function () { return [
564
+ AmplifyForceNewPasswordComponent.ctorParameters = function () { return [
738
565
  { type: StateMachineService },
739
566
  { type: AuthPropService }
740
567
  ]; };
741
- AmplifySignUpComponent.propDecorators = {
742
- dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-signup',] }],
568
+ AmplifyForceNewPasswordComponent.propDecorators = {
569
+ dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-forcenewpassword',] }],
743
570
  headerText: [{ type: i0.Input }]
744
571
  };
745
572
 
746
- var getAttributeMap = function () { return ui.authInputAttributes; };
747
-
748
- /**
749
- * Contains an input element and its label. Intended to be used with
750
- * Angular Reactive Form
751
- */
752
- var AmplifyInputComponent = /** @class */ (function () {
753
- function AmplifyInputComponent(stateMachine) {
573
+ var AmplifyResetPasswordComponent = /** @class */ (function () {
574
+ function AmplifyResetPasswordComponent(stateMachine, contextService) {
754
575
  this.stateMachine = stateMachine;
755
- this.required = false;
756
- this.placeholder = '';
757
- this.label = '';
758
- this.initialValue = '';
759
- this.disabled = false;
760
- this.autocomplete = '';
576
+ this.contextService = contextService;
577
+ this.dataAttr = '';
578
+ this.headerText = ui.translate('Reset your password');
579
+ this.customComponents = {};
580
+ this.remoteError = '';
581
+ this.isPending = false;
582
+ // translated texts
583
+ this.sendCodeText = ui.translate('Send Code');
584
+ this.backToSignInText = ui.translate('Back to Sign In');
761
585
  }
762
- Object.defineProperty(AmplifyInputComponent.prototype, "attributeMap", {
763
- get: function () {
764
- return getAttributeMap();
765
- },
766
- enumerable: false,
767
- configurable: true
768
- });
769
- Object.defineProperty(AmplifyInputComponent.prototype, "error", {
586
+ AmplifyResetPasswordComponent.prototype.ngOnInit = function () {
587
+ var _this = this;
588
+ this.authSubscription = this.stateMachine.authService.subscribe(function (state) { return _this.onStateUpdate(state); });
589
+ };
590
+ AmplifyResetPasswordComponent.prototype.ngAfterContentInit = function () {
591
+ this.customComponents = this.contextService.customComponents;
592
+ };
593
+ AmplifyResetPasswordComponent.prototype.ngOnDestroy = function () {
594
+ this.authSubscription.unsubscribe();
595
+ };
596
+ AmplifyResetPasswordComponent.prototype.onStateUpdate = function (state) {
597
+ var actorState = ui.getActorState(state);
598
+ this.remoteError = actorState.context.remoteError;
599
+ this.isPending = !actorState.matches('resetPassword.edit');
600
+ };
601
+ Object.defineProperty(AmplifyResetPasswordComponent.prototype, "context", {
770
602
  get: function () {
771
- var formContext = ui.getActorContext(this.stateMachine.authState);
772
- var validationError = formContext.validationError;
773
- return validationError[this.name];
603
+ var _a = this.stateMachine.services, change = _a.change, signIn = _a.signIn, submit = _a.submit;
604
+ var remoteError = this.remoteError;
605
+ return { change: change, remoteError: remoteError, signIn: signIn, submit: submit };
774
606
  },
775
607
  enumerable: false,
776
608
  configurable: true
777
609
  });
778
- AmplifyInputComponent.prototype.inferLabel = function () {
779
- var _a;
780
- return this.label || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.label);
610
+ AmplifyResetPasswordComponent.prototype.toSignIn = function () {
611
+ this.stateMachine.send('SIGN_IN');
781
612
  };
782
- AmplifyInputComponent.prototype.inferPlaceholder = function () {
783
- var _a;
784
- return (this.placeholder || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.placeholder) ||
785
- this.inferLabel());
613
+ AmplifyResetPasswordComponent.prototype.onInput = function (event) {
614
+ event.preventDefault();
615
+ var _a = event.target, name = _a.name, value = _a.value;
616
+ this.stateMachine.send({
617
+ type: 'CHANGE',
618
+ data: { name: name, value: value },
619
+ });
786
620
  };
787
- // infers what the `type` of underlying input element should be.
788
- AmplifyInputComponent.prototype.inferType = function () {
789
- var _a, _b, _c;
790
- 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';
621
+ AmplifyResetPasswordComponent.prototype.onSubmit = function (event) {
622
+ event.preventDefault();
623
+ this.stateMachine.send('SUBMIT');
791
624
  };
792
- return AmplifyInputComponent;
625
+ return AmplifyResetPasswordComponent;
793
626
  }());
794
- AmplifyInputComponent.decorators = [
627
+ AmplifyResetPasswordComponent.decorators = [
795
628
  { type: i0.Component, args: [{
796
- selector: 'amplify-form-input',
797
- template: "<label>\n <div data-amplify-label>{{ inferLabel() }}</div>\n <input\n data-amplify-form-input\n [type]=\"inferType()\"\n [name]=\"name\"\n [placeholder]=\"inferPlaceholder()\"\n [required]=\"required ? true : false\"\n [value]=\"this.initialValue\"\n [attr.disabled]=\"disabled ? '' : null\"\n [autocomplete]=\"autocomplete\"\n />\n <amplify-error *ngIf=\"error\">\n {{ error }}\n </amplify-error>\n</label>\n"
629
+ selector: 'amplify-reset-password',
630
+ 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"
798
631
  },] }
799
632
  ];
800
- AmplifyInputComponent.ctorParameters = function () { return [
801
- { type: StateMachineService }
633
+ AmplifyResetPasswordComponent.ctorParameters = function () { return [
634
+ { type: StateMachineService },
635
+ { type: AuthPropService }
802
636
  ]; };
803
- AmplifyInputComponent.propDecorators = {
804
- name: [{ type: i0.Input }],
805
- type: [{ type: i0.Input }],
806
- required: [{ type: i0.Input }],
807
- placeholder: [{ type: i0.Input }],
808
- label: [{ type: i0.Input }],
809
- initialValue: [{ type: i0.Input }],
810
- disabled: [{ type: i0.Input }],
811
- autocomplete: [{ type: i0.Input }]
637
+ AmplifyResetPasswordComponent.propDecorators = {
638
+ dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-resetPassword',] }],
639
+ headerText: [{ type: i0.Input }]
812
640
  };
813
641
 
814
- var AmplifyErrorComponent = /** @class */ (function () {
815
- function AmplifyErrorComponent() {
816
- }
817
- return AmplifyErrorComponent;
818
- }());
819
- AmplifyErrorComponent.decorators = [
820
- { type: i0.Component, args: [{
821
- selector: 'amplify-error',
822
- template: "<span data-amplify-error>\n <ng-content></ng-content>\n</span>\n"
823
- },] }
824
- ];
642
+ /*! *****************************************************************************
643
+ Copyright (c) Microsoft Corporation.
825
644
 
826
- var logger$3 = new awsAmplify.Logger('ConfirmSignUp');
827
- var AmplifyConfirmSignUpComponent = /** @class */ (function () {
828
- function AmplifyConfirmSignUpComponent(stateMachine, contextService) {
829
- this.stateMachine = stateMachine;
830
- this.contextService = contextService;
831
- this.dataAttr = '';
832
- this.customComponents = {};
833
- this.remoteError = '';
834
- this.isPending = false;
835
- }
836
- AmplifyConfirmSignUpComponent.prototype.ngOnInit = function () {
837
- var _this = this;
838
- // TODO: alias for subscribe
839
- this.authSubscription = this.stateMachine.authService.subscribe(function (state) { return _this.onStateUpdate(state); });
840
- this.setUsername();
841
- };
842
- AmplifyConfirmSignUpComponent.prototype.setUsername = function () {
843
- var _a;
844
- var state = this.stateMachine.authState;
845
- var actorContext = ui.getActorContext(state);
846
- var user = actorContext.user, authAttributes = actorContext.authAttributes;
847
- var username = (_a = user === null || user === void 0 ? void 0 : user.username) !== null && _a !== void 0 ? _a : authAttributes === null || authAttributes === void 0 ? void 0 : authAttributes.username;
848
- if (username) {
849
- this.username = username;
850
- this.stateMachine.send({
851
- type: 'CHANGE',
852
- data: { name: 'username', value: this.username },
853
- });
645
+ Permission to use, copy, modify, and/or distribute this software for any
646
+ purpose with or without fee is hereby granted.
647
+
648
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
649
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
650
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
651
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
652
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
653
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
654
+ PERFORMANCE OF THIS SOFTWARE.
655
+ ***************************************************************************** */
656
+ /* global Reflect, Promise */
657
+ var extendStatics = function (d, b) {
658
+ extendStatics = Object.setPrototypeOf ||
659
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
660
+ function (d, b) { for (var p in b)
661
+ if (Object.prototype.hasOwnProperty.call(b, p))
662
+ d[p] = b[p]; };
663
+ return extendStatics(d, b);
664
+ };
665
+ function __extends(d, b) {
666
+ if (typeof b !== "function" && b !== null)
667
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
668
+ extendStatics(d, b);
669
+ function __() { this.constructor = d; }
670
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
671
+ }
672
+ var __assign = function () {
673
+ __assign = Object.assign || function __assign(t) {
674
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
675
+ s = arguments[i];
676
+ for (var p in s)
677
+ if (Object.prototype.hasOwnProperty.call(s, p))
678
+ t[p] = s[p];
854
679
  }
680
+ return t;
855
681
  };
856
- AmplifyConfirmSignUpComponent.prototype.ngAfterContentInit = function () {
857
- this.customComponents = this.contextService.customComponents;
858
- };
859
- AmplifyConfirmSignUpComponent.prototype.ngOnDestroy = function () {
860
- logger$3.log('confirm sign up destroyed, unsubscribing from state machine...');
861
- this.authSubscription.unsubscribe();
862
- };
863
- AmplifyConfirmSignUpComponent.prototype.onStateUpdate = function (state) {
864
- var actorState = ui.getActorState(state);
865
- this.remoteError = actorState.context.remoteError;
866
- this.isPending = !actorState.matches('confirmSignUp.edit');
867
- };
868
- Object.defineProperty(AmplifyConfirmSignUpComponent.prototype, "context", {
869
- get: function () {
870
- var _b = this.stateMachine.services, change = _b.change, resend = _b.resend, signIn = _b.signIn, submit = _b.submit;
871
- var remoteError = this.remoteError;
872
- var username = this.username;
873
- return { change: change, remoteError: remoteError, resend: resend, signIn: signIn, submit: submit, username: username };
874
- },
875
- enumerable: false,
876
- configurable: true
877
- });
878
- AmplifyConfirmSignUpComponent.prototype.toSignIn = function () {
879
- this.stateMachine.send('SIGN_IN');
880
- };
881
- AmplifyConfirmSignUpComponent.prototype.resend = function () {
882
- this.stateMachine.send({
883
- type: 'RESEND',
884
- data: {
885
- username: this.username,
886
- },
887
- });
888
- };
889
- AmplifyConfirmSignUpComponent.prototype.onInput = function ($event) {
890
- $event.preventDefault();
891
- var _b = $event.target, name = _b.name, value = _b.value;
892
- this.stateMachine.send({
893
- type: 'CHANGE',
894
- data: { name: name, value: value },
895
- });
896
- };
897
- AmplifyConfirmSignUpComponent.prototype.onSubmit = function (event) {
898
- event.preventDefault();
899
- var state = this.stateMachine.authState;
900
- var actorContext = ui.getActorContext(state);
901
- var formValues = actorContext.formValues;
902
- var username = formValues.username, confirmation_code = formValues.confirmation_code;
903
- this.stateMachine.send({
904
- type: 'SUBMIT',
905
- data: { username: username, confirmation_code: confirmation_code },
906
- });
907
- };
908
- return AmplifyConfirmSignUpComponent;
909
- }());
910
- AmplifyConfirmSignUpComponent.decorators = [
911
- { type: i0.Component, args: [{
912
- selector: 'amplify-confirm-sign-up',
913
- template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmSignUpButton>\n <button data-amplify-button type=\"submit\">Confirm</button>\n</ng-template>\n\n<ng-template #confirmSignUpForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-user-name-alias\n [initialValue]=\"username ? username : null\"\n [disabled]=\"!!username\"\n ></amplify-user-name-alias>\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-input>\n\n <div data-amplify-resend>\n Lost your code? {{ ' ' }}\n <a data-amplify-link (click)=\"resend()\">Resend Code</a>\n </div>\n\n <div data-amplify-footer>\n <div>\n Back to{{ ' ' }}\n <a data-amplify-link (click)=\"toSignIn()\">Sign In</a>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmSignUpButton || confirmSignUpButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render confirm sign up component\n-->\n\n<div data-amplify-container>\n <h2 data-amplify-header>Confirm Your Account</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.confirmSignUpForm || confirmSignUpForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
914
- },] }
915
- ];
916
- AmplifyConfirmSignUpComponent.ctorParameters = function () { return [
917
- { type: StateMachineService },
918
- { type: AuthPropService }
919
- ]; };
920
- AmplifyConfirmSignUpComponent.propDecorators = {
921
- dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-confirmsignup',] }]
682
+ return __assign.apply(this, arguments);
922
683
  };
923
-
924
- var AmplifyUserNameAliasComponent = /** @class */ (function () {
925
- function AmplifyUserNameAliasComponent(stateMachine) {
926
- this.stateMachine = stateMachine;
927
- this.name = 'username';
928
- this.disabled = false;
929
- this.initialValue = '';
684
+ function __rest(s, e) {
685
+ var t = {};
686
+ for (var p in s)
687
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
688
+ t[p] = s[p];
689
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
690
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
691
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
692
+ t[p[i]] = s[p[i]];
693
+ }
694
+ return t;
695
+ }
696
+ function __decorate(decorators, target, key, desc) {
697
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
698
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
699
+ r = Reflect.decorate(decorators, target, key, desc);
700
+ else
701
+ for (var i = decorators.length - 1; i >= 0; i--)
702
+ if (d = decorators[i])
703
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
704
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
705
+ }
706
+ function __param(paramIndex, decorator) {
707
+ return function (target, key) { decorator(target, key, paramIndex); };
708
+ }
709
+ function __metadata(metadataKey, metadataValue) {
710
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
711
+ return Reflect.metadata(metadataKey, metadataValue);
712
+ }
713
+ function __awaiter(thisArg, _arguments, P, generator) {
714
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
715
+ return new (P || (P = Promise))(function (resolve, reject) {
716
+ function fulfilled(value) { try {
717
+ step(generator.next(value));
718
+ }
719
+ catch (e) {
720
+ reject(e);
721
+ } }
722
+ function rejected(value) { try {
723
+ step(generator["throw"](value));
724
+ }
725
+ catch (e) {
726
+ reject(e);
727
+ } }
728
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
729
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
730
+ });
731
+ }
732
+ function __generator(thisArg, body) {
733
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
734
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
735
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
736
+ function verb(n) { return function (v) { return step([n, v]); }; }
737
+ function step(op) {
738
+ if (f)
739
+ throw new TypeError("Generator is already executing.");
740
+ while (_)
741
+ try {
742
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
743
+ return t;
744
+ if (y = 0, t)
745
+ op = [op[0] & 2, t.value];
746
+ switch (op[0]) {
747
+ case 0:
748
+ case 1:
749
+ t = op;
750
+ break;
751
+ case 4:
752
+ _.label++;
753
+ return { value: op[1], done: false };
754
+ case 5:
755
+ _.label++;
756
+ y = op[1];
757
+ op = [0];
758
+ continue;
759
+ case 7:
760
+ op = _.ops.pop();
761
+ _.trys.pop();
762
+ continue;
763
+ default:
764
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
765
+ _ = 0;
766
+ continue;
767
+ }
768
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
769
+ _.label = op[1];
770
+ break;
771
+ }
772
+ if (op[0] === 6 && _.label < t[1]) {
773
+ _.label = t[1];
774
+ t = op;
775
+ break;
776
+ }
777
+ if (t && _.label < t[2]) {
778
+ _.label = t[2];
779
+ _.ops.push(op);
780
+ break;
781
+ }
782
+ if (t[2])
783
+ _.ops.pop();
784
+ _.trys.pop();
785
+ continue;
786
+ }
787
+ op = body.call(thisArg, _);
788
+ }
789
+ catch (e) {
790
+ op = [6, e];
791
+ y = 0;
792
+ }
793
+ finally {
794
+ f = t = 0;
795
+ }
796
+ if (op[0] & 5)
797
+ throw op[1];
798
+ return { value: op[0] ? op[1] : void 0, done: true };
930
799
  }
931
- AmplifyUserNameAliasComponent.prototype.ngOnInit = function () {
932
- var context = this.stateMachine.context;
933
- var _a = ui.getAliasInfoFromContext(context), label = _a.label, type = _a.type;
934
- this.label = label;
935
- this.type = type;
936
- this.placeholder = "Enter your " + label.toLowerCase();
937
- };
938
- return AmplifyUserNameAliasComponent;
939
- }());
940
- AmplifyUserNameAliasComponent.decorators = [
941
- { type: i0.Component, args: [{
942
- selector: 'amplify-user-name-alias',
943
- template: "<amplify-form-input\n data-amplify-usernamealias\n [name]=\"name\"\n [label]=\"label\"\n [type]=\"type\"\n [placeholder]=\"placeholder\"\n [initialValue]=\"initialValue\"\n [disabled]=\"disabled\"\n autocomplete=\"username\"\n>\n</amplify-form-input>\n"
944
- },] }
945
- ];
946
- AmplifyUserNameAliasComponent.ctorParameters = function () { return [
947
- { type: StateMachineService }
948
- ]; };
949
- AmplifyUserNameAliasComponent.propDecorators = {
950
- name: [{ type: i0.Input }],
951
- disabled: [{ type: i0.Input }],
952
- initialValue: [{ type: i0.Input }]
953
- };
954
-
955
- var logger$2 = new awsAmplify.Logger('ConfirmSignIn');
956
- var AmplifyConfirmSignInComponent = /** @class */ (function () {
957
- function AmplifyConfirmSignInComponent(stateMachine, contextService) {
958
- this.stateMachine = stateMachine;
959
- this.contextService = contextService;
960
- this.dataAttr = '';
961
- this.customComponents = {};
962
- this.remoteError = '';
963
- this.isPending = false;
964
- this.headerText = '';
800
+ }
801
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
802
+ if (k2 === undefined)
803
+ k2 = k;
804
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
805
+ }) : (function (o, m, k, k2) {
806
+ if (k2 === undefined)
807
+ k2 = k;
808
+ o[k2] = m[k];
809
+ });
810
+ function __exportStar(m, o) {
811
+ for (var p in m)
812
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
813
+ __createBinding(o, m, p);
814
+ }
815
+ function __values(o) {
816
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
817
+ if (m)
818
+ return m.call(o);
819
+ if (o && typeof o.length === "number")
820
+ return {
821
+ next: function () {
822
+ if (o && i >= o.length)
823
+ o = void 0;
824
+ return { value: o && o[i++], done: !o };
825
+ }
826
+ };
827
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
828
+ }
829
+ function __read(o, n) {
830
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
831
+ if (!m)
832
+ return o;
833
+ var i = m.call(o), r, ar = [], e;
834
+ try {
835
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
836
+ ar.push(r.value);
965
837
  }
966
- AmplifyConfirmSignInComponent.prototype.ngOnInit = function () {
967
- var _this = this;
968
- this.authSubscription = this.stateMachine.authService.subscribe(function (state) {
969
- _this.onStateUpdate(state);
970
- });
971
- this.setHeaderText();
972
- };
973
- AmplifyConfirmSignInComponent.prototype.ngAfterContentInit = function () {
974
- this.customComponents = this.contextService.customComponents;
975
- };
976
- AmplifyConfirmSignInComponent.prototype.ngOnDestroy = function () {
977
- this.authSubscription.unsubscribe();
978
- };
979
- Object.defineProperty(AmplifyConfirmSignInComponent.prototype, "context", {
980
- get: function () {
981
- var _a = this.stateMachine.services, change = _a.change, signIn = _a.signIn, submit = _a.submit;
982
- var remoteError = this.remoteError;
983
- return { change: change, remoteError: remoteError, signIn: signIn, submit: submit };
984
- },
985
- enumerable: false,
986
- configurable: true
987
- });
988
- AmplifyConfirmSignInComponent.prototype.setHeaderText = function () {
989
- var state = this.stateMachine.authState;
990
- var actorContext = ui.getActorContext(state);
991
- var challengeName = actorContext.challengeName;
992
- switch (challengeName) {
993
- case ui.AuthChallengeNames.SOFTWARE_TOKEN_MFA:
994
- // TODO: this string should be centralized and translated from ui.
995
- this.headerText = 'Confirm TOTP Code';
996
- break;
997
- case ui.AuthChallengeNames.SMS_MFA:
998
- this.headerText = 'Confirm SMS Code';
999
- break;
1000
- default:
1001
- logger$2.error('Unexpected challengeName', challengeName);
838
+ catch (error) {
839
+ e = { error: error };
840
+ }
841
+ finally {
842
+ try {
843
+ if (r && !r.done && (m = i["return"]))
844
+ m.call(i);
845
+ }
846
+ finally {
847
+ if (e)
848
+ throw e.error;
849
+ }
850
+ }
851
+ return ar;
852
+ }
853
+ /** @deprecated */
854
+ function __spread() {
855
+ for (var ar = [], i = 0; i < arguments.length; i++)
856
+ ar = ar.concat(__read(arguments[i]));
857
+ return ar;
858
+ }
859
+ /** @deprecated */
860
+ function __spreadArrays() {
861
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
862
+ s += arguments[i].length;
863
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
864
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
865
+ r[k] = a[j];
866
+ return r;
867
+ }
868
+ function __spreadArray(to, from, pack) {
869
+ if (pack || arguments.length === 2)
870
+ for (var i = 0, l = from.length, ar; i < l; i++) {
871
+ if (ar || !(i in from)) {
872
+ if (!ar)
873
+ ar = Array.prototype.slice.call(from, 0, i);
874
+ ar[i] = from[i];
875
+ }
1002
876
  }
1003
- };
1004
- AmplifyConfirmSignInComponent.prototype.onStateUpdate = function (state) {
1005
- var actorState = ui.getActorState(state);
1006
- this.remoteError = actorState.context.remoteError;
1007
- this.isPending = !actorState.matches('confirmSignIn.edit');
1008
- };
1009
- AmplifyConfirmSignInComponent.prototype.onInput = function (event) {
1010
- event.preventDefault();
1011
- var _a = event.target, name = _a.name, value = _a.value;
1012
- this.stateMachine.send({
1013
- type: 'CHANGE',
1014
- data: { name: name, value: value },
1015
- });
1016
- };
1017
- AmplifyConfirmSignInComponent.prototype.onSubmit = function (event) {
1018
- event.preventDefault();
1019
- // TODO: handle form data within the state machine
1020
- var formData = new FormData(event.target);
1021
- this.stateMachine.send({
1022
- type: 'SUBMIT',
1023
- data: Object.fromEntries(formData),
1024
- });
1025
- };
1026
- AmplifyConfirmSignInComponent.prototype.toSignIn = function () {
1027
- this.stateMachine.send('SIGN_IN');
1028
- };
1029
- return AmplifyConfirmSignInComponent;
1030
- }());
1031
- AmplifyConfirmSignInComponent.decorators = [
1032
- { type: i0.Component, args: [{
1033
- selector: 'amplify-confirm-sign-in',
1034
- template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmSignInButton>\n <button data-amplify-button type=\"submit\">Confirm</button>\n</ng-template>\n\n<ng-template #confirmSignInForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-input>\n\n <div data-amplify-footer>\n <a data-amplify-link (click)=\"toSignIn()\">Back to Sign In</a>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmSignInButton || confirmSignInButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || confirmSignInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
1035
- },] }
1036
- ];
1037
- AmplifyConfirmSignInComponent.ctorParameters = function () { return [
1038
- { type: StateMachineService },
1039
- { type: AuthPropService }
1040
- ]; };
1041
- AmplifyConfirmSignInComponent.propDecorators = {
1042
- dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-confirmsignin',] }]
877
+ return to.concat(ar || Array.prototype.slice.call(from));
878
+ }
879
+ function __await(v) {
880
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
881
+ }
882
+ function __asyncGenerator(thisArg, _arguments, generator) {
883
+ if (!Symbol.asyncIterator)
884
+ throw new TypeError("Symbol.asyncIterator is not defined.");
885
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
886
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
887
+ function verb(n) { if (g[n])
888
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
889
+ function resume(n, v) { try {
890
+ step(g[n](v));
891
+ }
892
+ catch (e) {
893
+ settle(q[0][3], e);
894
+ } }
895
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
896
+ function fulfill(value) { resume("next", value); }
897
+ function reject(value) { resume("throw", value); }
898
+ function settle(f, v) { if (f(v), q.shift(), q.length)
899
+ resume(q[0][0], q[0][1]); }
900
+ }
901
+ function __asyncDelegator(o) {
902
+ var i, p;
903
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
904
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
905
+ }
906
+ function __asyncValues(o) {
907
+ if (!Symbol.asyncIterator)
908
+ throw new TypeError("Symbol.asyncIterator is not defined.");
909
+ var m = o[Symbol.asyncIterator], i;
910
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
911
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
912
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
913
+ }
914
+ function __makeTemplateObject(cooked, raw) {
915
+ if (Object.defineProperty) {
916
+ Object.defineProperty(cooked, "raw", { value: raw });
917
+ }
918
+ else {
919
+ cooked.raw = raw;
920
+ }
921
+ return cooked;
922
+ }
923
+ ;
924
+ var __setModuleDefault = Object.create ? (function (o, v) {
925
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
926
+ }) : function (o, v) {
927
+ o["default"] = v;
1043
928
  };
929
+ function __importStar(mod) {
930
+ if (mod && mod.__esModule)
931
+ return mod;
932
+ var result = {};
933
+ if (mod != null)
934
+ for (var k in mod)
935
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
936
+ __createBinding(result, mod, k);
937
+ __setModuleDefault(result, mod);
938
+ return result;
939
+ }
940
+ function __importDefault(mod) {
941
+ return (mod && mod.__esModule) ? mod : { default: mod };
942
+ }
943
+ function __classPrivateFieldGet(receiver, state, kind, f) {
944
+ if (kind === "a" && !f)
945
+ throw new TypeError("Private accessor was defined without a getter");
946
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
947
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
948
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
949
+ }
950
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
951
+ if (kind === "m")
952
+ throw new TypeError("Private method is not writable");
953
+ if (kind === "a" && !f)
954
+ throw new TypeError("Private accessor was defined without a setter");
955
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
956
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
957
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
958
+ }
1044
959
 
1045
960
  var logger$1 = new awsAmplify.Logger('SetupTotp');
1046
961
  var AmplifySetupTotpComponent = /** @class */ (function () {
@@ -1050,8 +965,11 @@
1050
965
  this.customComponents = {};
1051
966
  this.remoteError = '';
1052
967
  this.isPending = false;
1053
- this.headerText = 'Setup TOTP';
968
+ this.headerText = ui.translate('Setup TOTP');
1054
969
  this.qrCodeSource = '';
970
+ // translated texts
971
+ this.backToSignInText = ui.translate('Back to Sign In');
972
+ this.confirmText = ui.translate('Confirm');
1055
973
  }
1056
974
  AmplifySetupTotpComponent.prototype.ngOnInit = function () {
1057
975
  var _this = this;
@@ -1084,11 +1002,13 @@
1084
1002
  AmplifySetupTotpComponent.prototype.generateQRCode = function () {
1085
1003
  var _a;
1086
1004
  return __awaiter(this, void 0, void 0, function () {
1087
- var user, secretKey, issuer, totpCode, _b, err_1;
1005
+ var state, actorContext, user, secretKey, issuer, totpCode, _b, err_1;
1088
1006
  return __generator(this, function (_c) {
1089
1007
  switch (_c.label) {
1090
1008
  case 0:
1091
- user = this.stateMachine.context.user;
1009
+ state = this.stateMachine.authState;
1010
+ actorContext = ui.getActorContext(state);
1011
+ user = actorContext.user;
1092
1012
  _c.label = 1;
1093
1013
  case 1:
1094
1014
  _c.trys.push([1, 4, , 5]);
@@ -1099,7 +1019,7 @@
1099
1019
  totpCode = "otpauth://totp/" + issuer + ":" + user.username + "?secret=" + secretKey + "&issuer=" + issuer;
1100
1020
  logger$1.info('totp code was generated:', totpCode);
1101
1021
  _b = this;
1102
- return [4 /*yield*/, QRCode__default['default'].toDataURL(totpCode)];
1022
+ return [4 /*yield*/, QRCode__default["default"].toDataURL(totpCode)];
1103
1023
  case 3:
1104
1024
  _b.qrCodeSource = _c.sent();
1105
1025
  return [3 /*break*/, 5];
@@ -1130,12 +1050,15 @@
1130
1050
  data: Object.fromEntries(formData),
1131
1051
  });
1132
1052
  };
1053
+ AmplifySetupTotpComponent.prototype.toSignIn = function () {
1054
+ this.stateMachine.send('SIGN_IN');
1055
+ };
1133
1056
  return AmplifySetupTotpComponent;
1134
1057
  }());
1135
1058
  AmplifySetupTotpComponent.decorators = [
1136
1059
  { type: i0.Component, args: [{
1137
1060
  selector: 'amplify-setup-totp',
1138
- template: "<!-- \n Define default contents here\n-->\n<ng-template #setupTotpButton>\n <button data-amplify-button type=\"submit\">Confirm</button>\n</ng-template>\n\n<ng-template #setupTotpForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img *ngIf=\"qrCodeSource\" [src]=\"qrCodeSource\" alt=\"qr code\" />\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n ></amplify-form-input>\n\n <div data-amplify-footer>\n <a data-amplify-link (click)=\"toSignIn()\">Back to Sign In</a>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.setupTotpButton || setupTotpButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.setupTotpForm || setupTotpForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
1061
+ 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"
1139
1062
  },] }
1140
1063
  ];
1141
1064
  AmplifySetupTotpComponent.ctorParameters = function () { return [
@@ -1146,47 +1069,50 @@
1146
1069
  customComponents: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-setup-totp',] }]
1147
1070
  };
1148
1071
 
1149
- var logger = new awsAmplify.Logger('ForceNewPassword');
1150
- var AmplifyForceNewPasswordComponent = /** @class */ (function () {
1151
- function AmplifyForceNewPasswordComponent(stateMachine, contextService) {
1072
+ var logger = new awsAmplify.Logger('SignIn');
1073
+ var AmplifySignInComponent = /** @class */ (function () {
1074
+ function AmplifySignInComponent(stateMachine, contextService) {
1152
1075
  this.stateMachine = stateMachine;
1153
1076
  this.contextService = contextService;
1154
1077
  this.dataAttr = '';
1155
- this.headerText = 'Change Password';
1078
+ this.headerText = ui.translate('Sign in to your account');
1156
1079
  this.customComponents = {};
1157
1080
  this.remoteError = '';
1158
1081
  this.isPending = false;
1082
+ // translated phrases
1083
+ this.forgotPasswordText = ui.translate('Forgot your password? ');
1084
+ this.signInButtonText = ui.translate('Sign in');
1085
+ this.noAccountText = ui.translate('No account? ');
1159
1086
  }
1160
- AmplifyForceNewPasswordComponent.prototype.ngOnInit = function () {
1087
+ AmplifySignInComponent.prototype.ngOnInit = function () {
1161
1088
  var _this = this;
1162
1089
  this.authSubscription = this.stateMachine.authService.subscribe(function (state) { return _this.onStateUpdate(state); });
1163
1090
  };
1164
- AmplifyForceNewPasswordComponent.prototype.ngAfterContentInit = function () {
1091
+ AmplifySignInComponent.prototype.ngAfterContentInit = function () {
1165
1092
  this.customComponents = this.contextService.customComponents;
1166
1093
  };
1167
- AmplifyForceNewPasswordComponent.prototype.ngOnDestroy = function () {
1094
+ AmplifySignInComponent.prototype.ngOnDestroy = function () {
1168
1095
  logger.log('sign in destroyed, unsubscribing from state machine...');
1169
1096
  this.authSubscription.unsubscribe();
1170
1097
  };
1171
- AmplifyForceNewPasswordComponent.prototype.onStateUpdate = function (state) {
1098
+ AmplifySignInComponent.prototype.onStateUpdate = function (state) {
1172
1099
  var actorState = ui.getActorState(state);
1173
1100
  this.remoteError = actorState.context.remoteError;
1174
- this.isPending = !actorState.matches('forceNewPassword.edit');
1101
+ this.isPending = !actorState.matches('signIn.edit');
1175
1102
  };
1176
- Object.defineProperty(AmplifyForceNewPasswordComponent.prototype, "context", {
1103
+ Object.defineProperty(AmplifySignInComponent.prototype, "context", {
1177
1104
  get: function () {
1178
- var _a = this.stateMachine.services, change = _a.change, signIn = _a.signIn, submit = _a.submit;
1179
- var user = this.stateMachine.user;
1105
+ var _a = this.stateMachine.services, change = _a.change, resetPassword = _a.resetPassword, signUp = _a.signUp, submit = _a.submit;
1180
1106
  var remoteError = this.remoteError;
1181
- return { change: change, remoteError: remoteError, signIn: signIn, submit: submit, user: user };
1107
+ return { change: change, remoteError: remoteError, resetPassword: resetPassword, signUp: signUp, submit: submit };
1182
1108
  },
1183
1109
  enumerable: false,
1184
1110
  configurable: true
1185
1111
  });
1186
- AmplifyForceNewPasswordComponent.prototype.toSignIn = function () {
1187
- this.stateMachine.send('SIGN_IN');
1112
+ AmplifySignInComponent.prototype.toResetPassword = function () {
1113
+ this.stateMachine.send('RESET_PASSWORD');
1188
1114
  };
1189
- AmplifyForceNewPasswordComponent.prototype.onInput = function (event) {
1115
+ AmplifySignInComponent.prototype.onInput = function (event) {
1190
1116
  event.preventDefault();
1191
1117
  var _a = event.target, name = _a.name, value = _a.value;
1192
1118
  this.stateMachine.send({
@@ -1194,129 +1120,109 @@
1194
1120
  data: { name: name, value: value },
1195
1121
  });
1196
1122
  };
1197
- AmplifyForceNewPasswordComponent.prototype.onSubmit = function (event) {
1198
- event.preventDefault();
1199
- // consider stateMachine directly providing actorState / actorContext
1200
- var state = this.stateMachine.authState;
1201
- var actorState = ui.getActorContext(state);
1202
- var formValues = actorState.formValues;
1203
- this.stateMachine.send({
1204
- type: 'SUBMIT',
1205
- data: formValues,
1123
+ AmplifySignInComponent.prototype.onSubmit = function (event) {
1124
+ return __awaiter(this, void 0, void 0, function () {
1125
+ return __generator(this, function (_a) {
1126
+ event.preventDefault();
1127
+ this.stateMachine.send({
1128
+ type: 'SUBMIT',
1129
+ });
1130
+ return [2 /*return*/];
1131
+ });
1206
1132
  });
1207
1133
  };
1208
- return AmplifyForceNewPasswordComponent;
1134
+ return AmplifySignInComponent;
1209
1135
  }());
1210
- AmplifyForceNewPasswordComponent.decorators = [
1136
+ AmplifySignInComponent.decorators = [
1211
1137
  { type: i0.Component, args: [{
1212
- selector: 'amplify-force-new-password',
1213
- template: "<!-- \n Define default contents here\n-->\n<ng-template #forceNewPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">Change Password</button>\n</ng-template>\n\n<ng-template #signInForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"password\"\n type=\"password\"\n label=\"Change password\"\n autocomplete=\"password\"\n [required]=\"true\"\n ></amplify-form-input>\n\n <div data-amplify-footer>\n <div>\n Back to{{ ' ' }}\n <a data-amplify-link (click)=\"toSignIn()\">Sign In</a>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.forceNewPasswordSubmitButton ||\n forceNewPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render sign in component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.signInForm || signInForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
1138
+ selector: 'amplify-sign-in',
1139
+ 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",
1140
+ encapsulation: i0.ViewEncapsulation.None
1214
1141
  },] }
1215
1142
  ];
1216
- AmplifyForceNewPasswordComponent.ctorParameters = function () { return [
1143
+ AmplifySignInComponent.ctorParameters = function () { return [
1217
1144
  { type: StateMachineService },
1218
1145
  { type: AuthPropService }
1219
1146
  ]; };
1220
- AmplifyForceNewPasswordComponent.propDecorators = {
1221
- dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-forcenewpassword',] }],
1147
+ AmplifySignInComponent.propDecorators = {
1148
+ dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-signin',] }],
1222
1149
  headerText: [{ type: i0.Input }]
1223
1150
  };
1224
1151
 
1225
- var AmplifyFederatedSignInComponent = /** @class */ (function () {
1226
- function AmplifyFederatedSignInComponent(stateMachine) {
1227
- this.stateMachine = stateMachine;
1228
- this.FederatedProviders = ui.FederatedIdentityProviders;
1229
- this.includeFacebook = false;
1230
- this.includeGoogle = false;
1231
- this.includeAmazon = false;
1232
- this.shouldShowFederatedSignIn = false;
1233
- }
1234
- AmplifyFederatedSignInComponent.prototype.ngOnInit = function () {
1235
- var _a, _b;
1236
- var loginMechanisms = (_b = (_a = this.stateMachine.context) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.login_mechanisms;
1237
- this.includeFacebook = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('facebook');
1238
- this.includeGoogle = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('google');
1239
- this.includeAmazon = loginMechanisms === null || loginMechanisms === void 0 ? void 0 : loginMechanisms.includes('amazon');
1240
- this.shouldShowFederatedSignIn =
1241
- this.includeFacebook || this.includeGoogle || this.includeAmazon;
1242
- };
1243
- return AmplifyFederatedSignInComponent;
1244
- }());
1245
- AmplifyFederatedSignInComponent.decorators = [
1246
- { type: i0.Component, args: [{
1247
- selector: 'amplify-federated-sign-in',
1248
- template: "<div data-amplify-federated>\n <amplify-federated-sign-in-button\n *ngIf=\"includeFacebook\"\n text=\"Sign in with Facebook\"\n [provider]=\"FederatedProviders.Facebook\"\n ></amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeGoogle\"\n text=\"Sign in with Google\"\n [provider]=\"FederatedProviders.Google\"\n ></amplify-federated-sign-in-button>\n\n <amplify-federated-sign-in-button\n *ngIf=\"includeAmazon\"\n text=\"Sign in with Amazon\"\n [provider]=\"FederatedProviders.Amazon\"\n ></amplify-federated-sign-in-button>\n</div>\n"
1249
- },] }
1250
- ];
1251
- AmplifyFederatedSignInComponent.ctorParameters = function () { return [
1252
- { type: StateMachineService }
1253
- ]; };
1254
-
1255
- var AmplifyFederatedSignInButtonComponent = /** @class */ (function () {
1256
- function AmplifyFederatedSignInButtonComponent(stateMachine) {
1257
- var _this = this;
1258
- this.stateMachine = stateMachine;
1259
- this.onClick = function () {
1260
- _this.stateMachine.send({
1261
- type: 'FEDERATED_SIGN_IN',
1262
- data: { provider: _this.provider },
1263
- });
1264
- };
1265
- }
1266
- return AmplifyFederatedSignInButtonComponent;
1267
- }());
1268
- AmplifyFederatedSignInButtonComponent.decorators = [
1269
- { type: i0.Component, args: [{
1270
- selector: 'amplify-federated-sign-in-button',
1271
- template: "<button data-amplify-button (click)=\"onClick()\">{{ text }}</button>\n"
1272
- },] }
1273
- ];
1274
- AmplifyFederatedSignInButtonComponent.ctorParameters = function () { return [
1275
- { type: StateMachineService }
1276
- ]; };
1277
- AmplifyFederatedSignInButtonComponent.propDecorators = {
1278
- provider: [{ type: i0.Input }],
1279
- text: [{ type: i0.Input }]
1280
- };
1281
-
1282
- var AmplifyResetPasswordComponent = /** @class */ (function () {
1283
- function AmplifyResetPasswordComponent(stateMachine, contextService) {
1152
+ var AmplifySignUpComponent = /** @class */ (function () {
1153
+ function AmplifySignUpComponent(stateMachine, contextService) {
1284
1154
  this.stateMachine = stateMachine;
1285
1155
  this.contextService = contextService;
1286
1156
  this.dataAttr = '';
1287
- this.headerText = 'Reset your password';
1288
- this.customComponents = {};
1157
+ this.headerText = ui.translate('Create a new account');
1289
1158
  this.remoteError = '';
1290
1159
  this.isPending = false;
1160
+ this.primaryAlias = '';
1161
+ this.secondaryAliases = [];
1162
+ this.validationError = {};
1163
+ // translated texts
1164
+ this.createAccountText = ui.translate('Create Account');
1291
1165
  }
1292
- AmplifyResetPasswordComponent.prototype.ngOnInit = function () {
1166
+ Object.defineProperty(AmplifySignUpComponent.prototype, "context", {
1167
+ get: function () {
1168
+ var _a = this.stateMachine.services, change = _a.change, signIn = _a.signIn, submit = _a.submit;
1169
+ var remoteError = this.remoteError;
1170
+ var validationError = this.validationError;
1171
+ return {
1172
+ change: change,
1173
+ remoteError: remoteError,
1174
+ signIn: signIn,
1175
+ submit: submit,
1176
+ validationError: validationError,
1177
+ };
1178
+ },
1179
+ enumerable: false,
1180
+ configurable: true
1181
+ });
1182
+ AmplifySignUpComponent.prototype.ngOnInit = function () {
1293
1183
  var _this = this;
1294
1184
  this.authSubscription = this.stateMachine.authService.subscribe(function (state) { return _this.onStateUpdate(state); });
1185
+ var context = this.stateMachine.context;
1186
+ var _a = ui.getConfiguredAliases(context), primaryAlias = _a.primaryAlias, secondaryAliases = _a.secondaryAliases;
1187
+ /**
1188
+ * If the login_mechanisms are configured to use ONLY username, we need
1189
+ * to ask for some sort of secondary contact information in order to
1190
+ * verify the user for Cognito. Currently matching this to how Vue is
1191
+ * set up.
1192
+ */
1193
+ if (primaryAlias === 'username' && lodash.isEmpty(secondaryAliases)) {
1194
+ secondaryAliases.push('email', 'phone_number');
1195
+ }
1196
+ this.primaryAlias = primaryAlias;
1197
+ this.secondaryAliases = secondaryAliases;
1295
1198
  };
1296
- AmplifyResetPasswordComponent.prototype.ngAfterContentInit = function () {
1199
+ AmplifySignUpComponent.prototype.ngAfterContentInit = function () {
1297
1200
  this.customComponents = this.contextService.customComponents;
1298
1201
  };
1299
- AmplifyResetPasswordComponent.prototype.ngOnDestroy = function () {
1202
+ AmplifySignUpComponent.prototype.ngOnDestroy = function () {
1300
1203
  this.authSubscription.unsubscribe();
1301
1204
  };
1302
- AmplifyResetPasswordComponent.prototype.onStateUpdate = function (state) {
1205
+ AmplifySignUpComponent.prototype.onStateUpdate = function (state) {
1303
1206
  var actorState = ui.getActorState(state);
1304
- this.remoteError = actorState.context.remoteError;
1305
- this.isPending = !actorState.matches('resetPassword.edit');
1207
+ var actorContext = ui.getActorContext(state);
1208
+ this.remoteError = actorContext.remoteError;
1209
+ this.validationError = actorContext.validationError;
1210
+ this.isPending = !actorState.matches({
1211
+ signUp: {
1212
+ submission: 'idle',
1213
+ },
1214
+ });
1306
1215
  };
1307
- Object.defineProperty(AmplifyResetPasswordComponent.prototype, "context", {
1308
- get: function () {
1309
- var _a = this.stateMachine.services, change = _a.change, signIn = _a.signIn, submit = _a.submit;
1310
- var remoteError = this.remoteError;
1311
- return { change: change, remoteError: remoteError, signIn: signIn, submit: submit };
1312
- },
1313
- enumerable: false,
1314
- configurable: true
1315
- });
1316
- AmplifyResetPasswordComponent.prototype.toSignIn = function () {
1317
- this.stateMachine.send('SIGN_IN');
1216
+ AmplifySignUpComponent.prototype.onSubmit = function ($event) {
1217
+ return __awaiter(this, void 0, void 0, function () {
1218
+ return __generator(this, function (_a) {
1219
+ $event.preventDefault();
1220
+ this.stateMachine.send('SUBMIT');
1221
+ return [2 /*return*/];
1222
+ });
1223
+ });
1318
1224
  };
1319
- AmplifyResetPasswordComponent.prototype.onInput = function (event) {
1225
+ AmplifySignUpComponent.prototype.onInput = function (event) {
1320
1226
  event.preventDefault();
1321
1227
  var _a = event.target, name = _a.name, value = _a.value;
1322
1228
  this.stateMachine.send({
@@ -1324,37 +1230,39 @@
1324
1230
  data: { name: name, value: value },
1325
1231
  });
1326
1232
  };
1327
- AmplifyResetPasswordComponent.prototype.onSubmit = function (event) {
1328
- event.preventDefault();
1329
- this.stateMachine.send('SUBMIT');
1330
- };
1331
- return AmplifyResetPasswordComponent;
1233
+ return AmplifySignUpComponent;
1332
1234
  }());
1333
- AmplifyResetPasswordComponent.decorators = [
1235
+ AmplifySignUpComponent.decorators = [
1334
1236
  { type: i0.Component, args: [{
1335
- selector: 'amplify-reset-password',
1336
- template: "<!-- \n Define default contents here\n-->\n<ng-template #resetPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">Send Code</button>\n</ng-template>\n\n<ng-template #resetPasswordFooter>\n <div data-amplify-footer>\n <div>\n Back to{{ ' ' }}\n <a data-amplify-link (click)=\"toSignIn()\">Sign In</a>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.resetPasswordSubmitButton || resetPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #resetPasswordForm>\n <form\n data-amplify-form\n ngNativeValidate\n (submit)=\"onSubmit($event)\"\n (input)=\"onInput($event)\"\n >\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"username\"\n type=\"username\"\n autocomplete=\"username\"\n [required]=\"true\"\n ></amplify-form-input>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.resetPasswordFooter || resetPasswordFooter\n \"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render reset passsword component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.resetPasswordForm || resetPasswordForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
1237
+ selector: 'amplify-sign-up',
1238
+ 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"
1337
1239
  },] }
1338
1240
  ];
1339
- AmplifyResetPasswordComponent.ctorParameters = function () { return [
1241
+ AmplifySignUpComponent.ctorParameters = function () { return [
1340
1242
  { type: StateMachineService },
1341
1243
  { type: AuthPropService }
1342
1244
  ]; };
1343
- AmplifyResetPasswordComponent.propDecorators = {
1344
- dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-resetPassword',] }],
1245
+ AmplifySignUpComponent.propDecorators = {
1246
+ dataAttr: [{ type: i0.HostBinding, args: ['attr.data-amplify-authenticator-signup',] }],
1345
1247
  headerText: [{ type: i0.Input }]
1346
1248
  };
1347
1249
 
1250
+ var getAttributeMap = function () { return ui.authInputAttributes; };
1251
+
1348
1252
  var AmplifyVerifyUserComponent = /** @class */ (function () {
1349
1253
  function AmplifyVerifyUserComponent(stateMachine, contextService) {
1350
1254
  this.stateMachine = stateMachine;
1351
1255
  this.contextService = contextService;
1352
1256
  this.dataAttr = '';
1353
- this.headerText = 'Account recovery requires verified contact information';
1257
+ this.headerText = ui.translate('Account recovery requires verified contact information');
1354
1258
  this.customComponents = {};
1355
1259
  this.unverifiedAttributes = {};
1356
1260
  this.remoteError = '';
1357
1261
  this.isPending = false;
1262
+ this.labelId = nanoid.nanoid(12);
1263
+ // translated texts
1264
+ this.skipText = ui.translate('Skip');
1265
+ this.verifyText = ui.translate('Verify');
1358
1266
  }
1359
1267
  AmplifyVerifyUserComponent.prototype.ngOnInit = function () {
1360
1268
  var _this = this;
@@ -1374,7 +1282,7 @@
1374
1282
  };
1375
1283
  Object.defineProperty(AmplifyVerifyUserComponent.prototype, "context", {
1376
1284
  get: function () {
1377
- var _a = this.stateMachine.services, change = _a.change, skip = _a.skip, submit = _a.submit;
1285
+ var _b = this.stateMachine.services, change = _b.change, skip = _b.skip, submit = _b.submit;
1378
1286
  var remoteError = this.remoteError;
1379
1287
  return { change: change, remoteError: remoteError, skip: skip, submit: submit };
1380
1288
  },
@@ -1384,10 +1292,16 @@
1384
1292
  AmplifyVerifyUserComponent.prototype.skipVerify = function () {
1385
1293
  this.stateMachine.send('SKIP');
1386
1294
  };
1295
+ AmplifyVerifyUserComponent.prototype.getLabelForAttr = function (authAttr) {
1296
+ var _a;
1297
+ var attributeMap = getAttributeMap();
1298
+ var label = (_a = attributeMap[authAttr]) === null || _a === void 0 ? void 0 : _a.label;
1299
+ return ui.translate(label);
1300
+ };
1387
1301
  AmplifyVerifyUserComponent.prototype.onSubmit = function (event) {
1388
1302
  return __awaiter(this, void 0, void 0, function () {
1389
1303
  var formData;
1390
- return __generator(this, function (_a) {
1304
+ return __generator(this, function (_b) {
1391
1305
  event.preventDefault();
1392
1306
  formData = new FormData(event.target);
1393
1307
  this.stateMachine.send({
@@ -1403,7 +1317,7 @@
1403
1317
  AmplifyVerifyUserComponent.decorators = [
1404
1318
  { type: i0.Component, args: [{
1405
1319
  selector: 'amplify-verify-user',
1406
- template: "<!-- \n Define default contents here\n-->\n<ng-template #verifyUserFooter>\n <div data-amplify-footer>\n <button data-amplify-button (click)=\"skipVerify()\">Skip</button>\n <button data-amplify-button type=\"submit\">Verify</button>\n </div>\n</ng-template>\n\n<ng-template #verifyUserForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <ng-container\n *ngFor=\"let unverifiedAttribute of unverifiedAttributes | keyvalue\"\n >\n <input\n name=\"unverifiedAttr\"\n type=\"radio\"\n [value]=\"unverifiedAttribute.key\"\n />\n <amplify-label>{{ unverifiedAttribute.key }}</amplify-label>\n </ng-container>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.verifyUserFooter || verifyUserFooter\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render verify user component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"customComponents.verifyUserForm || verifyUserForm\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n",
1320
+ 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",
1407
1321
  encapsulation: i0.ViewEncapsulation.None
1408
1322
  },] }
1409
1323
  ];
@@ -1421,10 +1335,15 @@
1421
1335
  this.stateMachine = stateMachine;
1422
1336
  this.contextService = contextService;
1423
1337
  this.dataAttr = '';
1424
- this.headerText = 'Reset your password';
1338
+ this.headerText = ui.translate('Reset your password');
1425
1339
  this.customComponents = {};
1426
1340
  this.remoteError = '';
1427
1341
  this.isPending = false;
1342
+ // translated strings
1343
+ this.sendCodeText = ui.translate('Send Code');
1344
+ this.backToSignInText = ui.translate('Back to Sign In');
1345
+ this.lostCodeText = ui.translate('Lost your code? ');
1346
+ this.resendCodeText = ui.translate('Resend Code');
1428
1347
  }
1429
1348
  ConfirmResetPasswordComponent.prototype.ngOnInit = function () {
1430
1349
  var _this = this;
@@ -1478,7 +1397,7 @@
1478
1397
  ConfirmResetPasswordComponent.decorators = [
1479
1398
  { type: i0.Component, args: [{
1480
1399
  selector: 'amplify-confirm-reset-password',
1481
- template: "<!-- \n Define default contents here\n-->\n<ng-template #confirmResetPasswordSubmitButton>\n <button data-amplify-button type=\"submit\">Send Code</button>\n</ng-template>\n\n<ng-template #confirmResetPasswordFooter>\n <div data-amplify-footer>\n <div>\n Back to{{ ' ' }}\n <a data-amplify-link (click)=\"toSignIn()\">Sign In</a>\n </div>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPasswordSubmitButton ||\n confirmResetPasswordSubmitButton\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #confirmResetPasswordForm>\n <form\n data-amplify-form\n ngNativeValidate\n (submit)=\"onSubmit($event)\"\n (input)=\"onInput($event)\"\n >\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n [required]=\"true\"\n ></amplify-form-input>\n <amplify-form-input\n name=\"password\"\n label=\"New password\"\n autocomplete=\"new-password\"\n [required]=\"true\"\n ></amplify-form-input>\n\n <div data-amplify-resend>\n Lost your code? {{ ' ' }}\n <a data-amplify-link (click)=\"resend()\">Resend Code</a>\n </div>\n\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPasswordFooter ||\n confirmResetPasswordFooter\n \"\n [ngTemplateOutletContext]=\"context\"\n ></ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render confirm reset password component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmResetPasswordForm || confirmResetPasswordForm\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
1400
+ 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"
1482
1401
  },] }
1483
1402
  ];
1484
1403
  ConfirmResetPasswordComponent.ctorParameters = function () { return [
@@ -1495,10 +1414,13 @@
1495
1414
  this.stateMachine = stateMachine;
1496
1415
  this.contextService = contextService;
1497
1416
  this.dataAttr = '';
1498
- this.headerText = 'Account recovery requires verified contact information';
1417
+ this.headerText = ui.translate('Account recovery requires verified contact information');
1499
1418
  this.customComponents = {};
1500
1419
  this.remoteError = '';
1501
1420
  this.isPending = false;
1421
+ // translated texts
1422
+ this.skipText = ui.translate('Skip');
1423
+ this.submitText = ui.translate('Submit');
1502
1424
  }
1503
1425
  ConfirmVerifyUserComponent.prototype.ngOnInit = function () {
1504
1426
  var _this = this;
@@ -1546,7 +1468,7 @@
1546
1468
  ConfirmVerifyUserComponent.decorators = [
1547
1469
  { type: i0.Component, args: [{
1548
1470
  selector: 'amplify-confirm-verify-user',
1549
- template: "<!-- \n Define default contents here\n-->\n<ng-template #verifyUserFooter>\n <div data-amplify-footer>\n <button data-amplify-button (click)=\"skipVerify()\">Skip</button>\n <button data-amplify-button type=\"submit\">Submit</button>\n </div>\n</ng-template>\n\n<ng-template #confirmVerifyUserForm>\n <form data-amplify-form (submit)=\"onSubmit($event)\">\n <fieldset data-amplify-fieldset [disabled]=\"isPending\">\n <amplify-form-input\n name=\"confirmation_code\"\n type=\"number\"\n autocomplete=\"one-time-code\"\n [required]=\"true\"\n ></amplify-form-input>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.verifyUserFooter || verifyUserFooter\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n </fieldset>\n\n <amplify-error *ngIf=\"remoteError\">\n {{ remoteError }}\n </amplify-error>\n </form>\n</ng-template>\n\n<!-- \n Render confirm reset password component\n-->\n<div data-amplify-container>\n <h2 data-amplify-header>{{ this.headerText }}</h2>\n <ng-container\n [ngTemplateOutlet]=\"\n customComponents.confirmVerifyUserForm || confirmVerifyUserForm\n \"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-container>\n</div>\n"
1471
+ 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"
1550
1472
  },] }
1551
1473
  ];
1552
1474
  ConfirmVerifyUserComponent.ctorParameters = function () { return [
@@ -1558,6 +1480,333 @@
1558
1480
  headerText: [{ type: i0.Input }]
1559
1481
  };
1560
1482
 
1483
+ var AmplifyButtonComponent = /** @class */ (function () {
1484
+ function AmplifyButtonComponent() {
1485
+ this.type = 'button';
1486
+ this.fullWidth = false;
1487
+ this.size = 'medium';
1488
+ this.variation = 'default';
1489
+ this.fontWeight = 'normal';
1490
+ this.defaultClass = true;
1491
+ }
1492
+ AmplifyButtonComponent.prototype.ngOnInit = function () {
1493
+ this.typeAttr = this.type;
1494
+ this.fullWidthAttr = this.fullWidth;
1495
+ this.sizeAttr = this.size;
1496
+ this.variationAttr = this.variation;
1497
+ this.fontWeightAttr = this.fontWeight;
1498
+ };
1499
+ return AmplifyButtonComponent;
1500
+ }());
1501
+ AmplifyButtonComponent.decorators = [
1502
+ { type: i0.Component, args: [{
1503
+ selector: 'button[amplify-button]',
1504
+ template: "<ng-content></ng-content>\n"
1505
+ },] }
1506
+ ];
1507
+ AmplifyButtonComponent.propDecorators = {
1508
+ type: [{ type: i0.Input }],
1509
+ fullWidth: [{ type: i0.Input }],
1510
+ size: [{ type: i0.Input }],
1511
+ variation: [{ type: i0.Input }],
1512
+ fontWeight: [{ type: i0.Input }],
1513
+ typeAttr: [{ type: i0.HostBinding, args: ['type',] }],
1514
+ fullWidthAttr: [{ type: i0.HostBinding, args: ['attr.data-fullwidth',] }],
1515
+ sizeAttr: [{ type: i0.HostBinding, args: ['attr.data-size',] }],
1516
+ variationAttr: [{ type: i0.HostBinding, args: ['attr.data-variation',] }],
1517
+ defaultClass: [{ type: i0.HostBinding, args: ['class.amplify-button',] }],
1518
+ fontWeightAttr: [{ type: i0.HostBinding, args: ['style.font-weight',] }]
1519
+ };
1520
+
1521
+ var AmplifyErrorComponent = /** @class */ (function () {
1522
+ function AmplifyErrorComponent() {
1523
+ }
1524
+ return AmplifyErrorComponent;
1525
+ }());
1526
+ AmplifyErrorComponent.decorators = [
1527
+ { type: i0.Component, args: [{
1528
+ selector: 'amplify-error',
1529
+ template: "<span data-ui-error>\n <ng-content></ng-content>\n</span>\n"
1530
+ },] }
1531
+ ];
1532
+
1533
+ /**
1534
+ * Input interface opinionated for authenticator usage.
1535
+ *
1536
+ * TODO: Separate this component out to two parts -- 1) amplify-auth-input that
1537
+ * contains authenticator opinionated logic and 2) amplify-text-field primitive
1538
+ * that does not make any auth-related inference.
1539
+ */
1540
+ var AmplifyFormFieldComponent = /** @class */ (function () {
1541
+ function AmplifyFormFieldComponent(stateMachine) {
1542
+ this.stateMachine = stateMachine;
1543
+ this.required = true;
1544
+ this.placeholder = '';
1545
+ this.label = '';
1546
+ this.initialValue = '';
1547
+ this.disabled = false;
1548
+ this.autocomplete = '';
1549
+ this.countryDialCodes = ui.countryDialCodes;
1550
+ }
1551
+ AmplifyFormFieldComponent.prototype.ngOnInit = function () {
1552
+ // TODO: field primtiives should have generate these by default.
1553
+ this.textFieldId = "amplify-field-" + nanoid.nanoid(12);
1554
+ this.selectFieldId = "amplify-field-" + nanoid.nanoid(12);
1555
+ // TODO: consider better default handling mechanisms across frameworks
1556
+ if (this.isPhoneField()) {
1557
+ var state = this.stateMachine.authState;
1558
+ var country_code = ui.getActorContext(state).country_code;
1559
+ this.defaultCountryCode = country_code;
1560
+ // TODO: remove this side-effect
1561
+ this.stateMachine.send({
1562
+ type: 'CHANGE',
1563
+ data: { name: 'country_code', value: country_code },
1564
+ });
1565
+ }
1566
+ };
1567
+ Object.defineProperty(AmplifyFormFieldComponent.prototype, "attributeMap", {
1568
+ get: function () {
1569
+ return getAttributeMap();
1570
+ },
1571
+ enumerable: false,
1572
+ configurable: true
1573
+ });
1574
+ Object.defineProperty(AmplifyFormFieldComponent.prototype, "error", {
1575
+ get: function () {
1576
+ var formContext = ui.getActorContext(this.stateMachine.authState);
1577
+ var validationError = formContext.validationError;
1578
+ return validationError[this.name];
1579
+ },
1580
+ enumerable: false,
1581
+ configurable: true
1582
+ });
1583
+ AmplifyFormFieldComponent.prototype.inferLabel = function () {
1584
+ var _a;
1585
+ var label = this.label || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.label);
1586
+ return ui.translate(label);
1587
+ };
1588
+ AmplifyFormFieldComponent.prototype.inferPlaceholder = function () {
1589
+ var _a;
1590
+ var placeholder = this.placeholder || ((_a = this.attributeMap[this.name]) === null || _a === void 0 ? void 0 : _a.placeholder) ||
1591
+ this.inferLabel();
1592
+ return ui.translate(placeholder);
1593
+ };
1594
+ // infers what the `type` of underlying input element should be.
1595
+ AmplifyFormFieldComponent.prototype.inferType = function () {
1596
+ var _a, _b, _c;
1597
+ 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';
1598
+ };
1599
+ // TODO(enhancement): use enum to differentiate special field types
1600
+ AmplifyFormFieldComponent.prototype.isPasswordField = function () {
1601
+ return this.inferType() === 'password';
1602
+ };
1603
+ AmplifyFormFieldComponent.prototype.isPhoneField = function () {
1604
+ return this.inferType() === 'tel';
1605
+ };
1606
+ return AmplifyFormFieldComponent;
1607
+ }());
1608
+ AmplifyFormFieldComponent.decorators = [
1609
+ { type: i0.Component, args: [{
1610
+ selector: 'amplify-form-field',
1611
+ 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"
1612
+ },] }
1613
+ ];
1614
+ AmplifyFormFieldComponent.ctorParameters = function () { return [
1615
+ { type: StateMachineService }
1616
+ ]; };
1617
+ AmplifyFormFieldComponent.propDecorators = {
1618
+ name: [{ type: i0.Input }],
1619
+ type: [{ type: i0.Input }],
1620
+ required: [{ type: i0.Input }],
1621
+ placeholder: [{ type: i0.Input }],
1622
+ label: [{ type: i0.Input }],
1623
+ initialValue: [{ type: i0.Input }],
1624
+ disabled: [{ type: i0.Input }],
1625
+ autocomplete: [{ type: i0.Input }]
1626
+ };
1627
+
1628
+ var AmplifyPasswordFieldComponent = /** @class */ (function () {
1629
+ function AmplifyPasswordFieldComponent() {
1630
+ this.autocomplete = 'new-password';
1631
+ this.disabled = false;
1632
+ this.initialValue = '';
1633
+ this.label = '';
1634
+ this.placeholder = '';
1635
+ this.required = true;
1636
+ this.type = 'password';
1637
+ this.showPassword = false;
1638
+ this.showPasswordButtonlabel = ui.translate('Show password');
1639
+ }
1640
+ AmplifyPasswordFieldComponent.prototype.togglePasswordText = function () {
1641
+ this.showPassword = !this.showPassword;
1642
+ this.showPasswordButtonlabel = this.showPassword
1643
+ ? ui.translate('Show password')
1644
+ : ui.translate('Hide password');
1645
+ this.type = this.showPassword ? 'text' : 'password';
1646
+ };
1647
+ return AmplifyPasswordFieldComponent;
1648
+ }());
1649
+ AmplifyPasswordFieldComponent.decorators = [
1650
+ { type: i0.Component, args: [{
1651
+ selector: 'amplify-password-field',
1652
+ 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"
1653
+ },] }
1654
+ ];
1655
+ AmplifyPasswordFieldComponent.propDecorators = {
1656
+ autocomplete: [{ type: i0.Input }],
1657
+ disabled: [{ type: i0.Input }],
1658
+ id: [{ type: i0.Input }],
1659
+ initialValue: [{ type: i0.Input }],
1660
+ label: [{ type: i0.Input }],
1661
+ name: [{ type: i0.Input }],
1662
+ placeholder: [{ type: i0.Input }],
1663
+ required: [{ type: i0.Input }]
1664
+ };
1665
+
1666
+ var AmplifySelectComponent = /** @class */ (function () {
1667
+ function AmplifySelectComponent() {
1668
+ }
1669
+ return AmplifySelectComponent;
1670
+ }());
1671
+ AmplifySelectComponent.decorators = [
1672
+ { type: i0.Component, args: [{
1673
+ selector: 'amplify-form-select',
1674
+ 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"
1675
+ },] }
1676
+ ];
1677
+ AmplifySelectComponent.propDecorators = {
1678
+ items: [{ type: i0.Input }],
1679
+ name: [{ type: i0.Input }],
1680
+ label: [{ type: i0.Input }],
1681
+ id: [{ type: i0.Input }],
1682
+ defaultValue: [{ type: i0.Input }]
1683
+ };
1684
+
1685
+ var TabItemComponent = /** @class */ (function () {
1686
+ function TabItemComponent() {
1687
+ this.active = false;
1688
+ }
1689
+ return TabItemComponent;
1690
+ }());
1691
+ TabItemComponent.decorators = [
1692
+ { type: i0.Component, args: [{
1693
+ selector: 'amplify-tab-item',
1694
+ template: "<div\n data-orientation=\"horizontal\"\n role=\"tabpanel\"\n [id]=\"id\"\n [attr.aria-labelledby]=\"labelledById\"\n [attr.data-state]=\"active ? 'active' : 'inactive'\"\n [attr.tabindex]=\"tabIndex\"\n>\n <ng-content *ngIf=\"active\"></ng-content>\n</div>\n"
1695
+ },] }
1696
+ ];
1697
+ TabItemComponent.propDecorators = {
1698
+ title: [{ type: i0.Input }],
1699
+ active: [{ type: i0.Input }],
1700
+ id: [{ type: i0.Input }],
1701
+ labelledById: [{ type: i0.Input }],
1702
+ tabIndex: [{ type: i0.Input }]
1703
+ };
1704
+
1705
+ var TabsComponent = /** @class */ (function () {
1706
+ function TabsComponent() {
1707
+ this.tabChange = new i0.EventEmitter();
1708
+ }
1709
+ TabsComponent.prototype.ngAfterContentInit = function () {
1710
+ // assign ids
1711
+ this.tabs.forEach(function (tab, index) {
1712
+ tab.id = "radix-id-" + nanoid.nanoid(12) + "-1-content-" + index;
1713
+ tab.labelledById = "radix-id-" + nanoid.nanoid(12) + "-1-trigger-" + index;
1714
+ });
1715
+ // find active tab
1716
+ // TODO(enhancement): more declarative way for choosing the initial tab to render
1717
+ var activeTabs = this.tabs.filter(function (tab) { return tab.active; });
1718
+ // set active tab
1719
+ if (activeTabs.length !== 1) {
1720
+ this.selectTab(this.tabs.first);
1721
+ }
1722
+ };
1723
+ TabsComponent.prototype.selectTab = function (tab) {
1724
+ this.tabs.forEach(function (tab) {
1725
+ tab.active = false;
1726
+ });
1727
+ tab.active = true;
1728
+ };
1729
+ TabsComponent.prototype.handleTabClick = function (tab) {
1730
+ if (tab.active)
1731
+ return; // don't do anything if clicks the current active tab
1732
+ this.tabChange.emit();
1733
+ this.selectTab(tab);
1734
+ };
1735
+ return TabsComponent;
1736
+ }());
1737
+ TabsComponent.decorators = [
1738
+ { type: i0.Component, args: [{
1739
+ selector: 'amplify-tabs',
1740
+ 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"
1741
+ },] }
1742
+ ];
1743
+ TabsComponent.propDecorators = {
1744
+ tabs: [{ type: i0.ContentChildren, args: [TabItemComponent,] }],
1745
+ tabChange: [{ type: i0.Output }]
1746
+ };
1747
+
1748
+ var AmplifyTextFieldComponent = /** @class */ (function () {
1749
+ function AmplifyTextFieldComponent() {
1750
+ this.autocomplete = 'new-password';
1751
+ this.disabled = false;
1752
+ this.initialValue = '';
1753
+ this.label = '';
1754
+ this.placeholder = '';
1755
+ this.required = true;
1756
+ }
1757
+ return AmplifyTextFieldComponent;
1758
+ }());
1759
+ AmplifyTextFieldComponent.decorators = [
1760
+ { type: i0.Component, args: [{
1761
+ selector: 'amplify-text-field',
1762
+ 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"
1763
+ },] }
1764
+ ];
1765
+ AmplifyTextFieldComponent.propDecorators = {
1766
+ autocomplete: [{ type: i0.Input }],
1767
+ disabled: [{ type: i0.Input }],
1768
+ id: [{ type: i0.Input }],
1769
+ initialValue: [{ type: i0.Input }],
1770
+ label: [{ type: i0.Input }],
1771
+ name: [{ type: i0.Input }],
1772
+ placeholder: [{ type: i0.Input }],
1773
+ required: [{ type: i0.Input }],
1774
+ type: [{ type: i0.Input }]
1775
+ };
1776
+
1777
+ var AmplifyUserNameAliasComponent = /** @class */ (function () {
1778
+ function AmplifyUserNameAliasComponent(stateMachine) {
1779
+ this.stateMachine = stateMachine;
1780
+ this.name = 'username';
1781
+ this.disabled = false;
1782
+ this.initialValue = '';
1783
+ this.required = true;
1784
+ }
1785
+ AmplifyUserNameAliasComponent.prototype.ngOnInit = function () {
1786
+ var context = this.stateMachine.context;
1787
+ var _a = ui.getAliasInfoFromContext(context), label = _a.label, type = _a.type;
1788
+ this.label = label;
1789
+ this.type = type;
1790
+ this.placeholder = label;
1791
+ };
1792
+ return AmplifyUserNameAliasComponent;
1793
+ }());
1794
+ AmplifyUserNameAliasComponent.decorators = [
1795
+ { type: i0.Component, args: [{
1796
+ selector: 'amplify-user-name-alias',
1797
+ 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"
1798
+ },] }
1799
+ ];
1800
+ AmplifyUserNameAliasComponent.ctorParameters = function () { return [
1801
+ { type: StateMachineService }
1802
+ ]; };
1803
+ AmplifyUserNameAliasComponent.propDecorators = {
1804
+ name: [{ type: i0.Input }],
1805
+ disabled: [{ type: i0.Input }],
1806
+ initialValue: [{ type: i0.Input }],
1807
+ required: [{ type: i0.Input }]
1808
+ };
1809
+
1561
1810
  var proxyInputs = function (Cmp, inputs) {
1562
1811
  var Prototype = Cmp.prototype;
1563
1812
  inputs.forEach(function (item) {
@@ -3400,6 +3649,38 @@
3400
3649
  ProxyCmp({ inputs: ['handleAuthStateChange', 'user'] })
3401
3650
  ], AmplifyVerifyContact);
3402
3651
 
3652
+ var PhoneNumberFieldComponent = /** @class */ (function () {
3653
+ function PhoneNumberFieldComponent() {
3654
+ this.autocomplete = 'new-password';
3655
+ this.disabled = false;
3656
+ this.initialValue = '';
3657
+ this.label = '';
3658
+ this.placeholder = '';
3659
+ this.required = true;
3660
+ this.countryDialCodes = ui.countryDialCodes;
3661
+ }
3662
+ return PhoneNumberFieldComponent;
3663
+ }());
3664
+ PhoneNumberFieldComponent.decorators = [
3665
+ { type: i0.Component, args: [{
3666
+ selector: 'amplify-phone-number-field',
3667
+ 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"
3668
+ },] }
3669
+ ];
3670
+ PhoneNumberFieldComponent.propDecorators = {
3671
+ autocomplete: [{ type: i0.Input }],
3672
+ disabled: [{ type: i0.Input }],
3673
+ defaultCountryCode: [{ type: i0.Input }],
3674
+ selectFieldId: [{ type: i0.Input }],
3675
+ textFieldId: [{ type: i0.Input }],
3676
+ initialValue: [{ type: i0.Input }],
3677
+ label: [{ type: i0.Input }],
3678
+ name: [{ type: i0.Input }],
3679
+ placeholder: [{ type: i0.Input }],
3680
+ required: [{ type: i0.Input }],
3681
+ type: [{ type: i0.Input }]
3682
+ };
3683
+
3403
3684
  customElements.define('amplify-button', components.AmplifyButton);
3404
3685
  customElements.define('amplify-input', components.AmplifyInput);
3405
3686
  customElements.define('amplify-toast', components.AmplifyToast);
@@ -3432,11 +3713,10 @@
3432
3713
  exports.AmplifyPhotoPicker,
3433
3714
  AmplifyAuthenticatorComponent,
3434
3715
  AmplifySignInComponent,
3435
- AmplifySignOutComponent,
3436
3716
  AmplifySignUpComponent,
3437
- AmplifyInputComponent,
3717
+ AmplifyFormFieldComponent,
3438
3718
  AmplifyErrorComponent,
3439
- AmplifyOverrideDirective,
3719
+ AmplifySlotDirective,
3440
3720
  AmplifyConfirmSignUpComponent,
3441
3721
  AmplifyUserNameAliasComponent,
3442
3722
  AmplifyConfirmSignInComponent,
@@ -3448,8 +3728,15 @@
3448
3728
  AmplifyVerifyUserComponent,
3449
3729
  ConfirmResetPasswordComponent,
3450
3730
  ConfirmVerifyUserComponent,
3731
+ AmplifySelectComponent,
3732
+ AmplifyButtonComponent,
3733
+ AmplifyPasswordFieldComponent,
3734
+ AmplifyTextFieldComponent,
3735
+ TabsComponent,
3736
+ TabItemComponent,
3737
+ PhoneNumberFieldComponent,
3451
3738
  ],
3452
- imports: [common.CommonModule, forms.ReactiveFormsModule],
3739
+ imports: [common.CommonModule],
3453
3740
  exports: [
3454
3741
  exports.AmplifyChatbot,
3455
3742
  exports.AmplifyToast,
@@ -3464,10 +3751,9 @@
3464
3751
  exports.AmplifyPhotoPicker,
3465
3752
  AmplifyAuthenticatorComponent,
3466
3753
  AmplifySignInComponent,
3467
- AmplifySignOutComponent,
3468
- AmplifyInputComponent,
3754
+ AmplifyFormFieldComponent,
3469
3755
  AmplifyErrorComponent,
3470
- AmplifyOverrideDirective,
3756
+ AmplifySlotDirective,
3471
3757
  ],
3472
3758
  schemas: [i0.CUSTOM_ELEMENTS_SCHEMA],
3473
3759
  },] }
@@ -3482,36 +3768,51 @@
3482
3768
  */
3483
3769
 
3484
3770
  exports.AmplifyAuthenticatorComponent = AmplifyAuthenticatorComponent;
3771
+ exports.AmplifyConfirmSignInComponent = AmplifyConfirmSignInComponent;
3485
3772
  exports.AmplifyConfirmSignUpComponent = AmplifyConfirmSignUpComponent;
3486
3773
  exports.AmplifyErrorComponent = AmplifyErrorComponent;
3487
- exports.AmplifyInputComponent = AmplifyInputComponent;
3488
- exports.AmplifyOverrideDirective = AmplifyOverrideDirective;
3774
+ exports.AmplifyFederatedSignInButtonComponent = AmplifyFederatedSignInButtonComponent;
3775
+ exports.AmplifyFederatedSignInComponent = AmplifyFederatedSignInComponent;
3776
+ exports.AmplifyForceNewPasswordComponent = AmplifyForceNewPasswordComponent;
3777
+ exports.AmplifyFormFieldComponent = AmplifyFormFieldComponent;
3778
+ exports.AmplifyResetPasswordComponent = AmplifyResetPasswordComponent;
3779
+ exports.AmplifySetupTotpComponent = AmplifySetupTotpComponent;
3489
3780
  exports.AmplifySignInComponent = AmplifySignInComponent;
3490
- exports.AmplifySignOutComponent = AmplifySignOutComponent;
3491
3781
  exports.AmplifySignUpComponent = AmplifySignUpComponent;
3782
+ exports.AmplifySlotDirective = AmplifySlotDirective;
3783
+ exports.AmplifyVerifyUserComponent = AmplifyVerifyUserComponent;
3492
3784
  exports.AuthPropService = AuthPropService;
3785
+ exports.ConfirmResetPasswordComponent = ConfirmResetPasswordComponent;
3786
+ exports.ConfirmVerifyUserComponent = ConfirmVerifyUserComponent;
3493
3787
  exports.StateMachineService = StateMachineService;
3494
3788
  exports.UiAngularModule = UiAngularModule;
3495
- exports.ɵa = ProxyCmp;
3496
- exports.ɵb = AmplifyAuthenticatorComponent;
3497
- exports.ɵc = AmplifySignInComponent;
3498
- exports.ɵd = AmplifySignOutComponent;
3499
- exports.ɵe = AmplifySignUpComponent;
3500
- exports.ɵf = AmplifyInputComponent;
3501
- exports.ɵg = AmplifyErrorComponent;
3502
- exports.ɵh = AmplifyConfirmSignUpComponent;
3503
- exports.ɵi = AmplifyUserNameAliasComponent;
3504
- exports.ɵj = AmplifyConfirmSignInComponent;
3505
- exports.ɵk = AmplifySetupTotpComponent;
3506
- exports.ɵl = AmplifyForceNewPasswordComponent;
3507
- exports.ɵm = AmplifyFederatedSignInComponent;
3508
- exports.ɵn = AmplifyFederatedSignInButtonComponent;
3509
- exports.ɵo = AmplifyResetPasswordComponent;
3510
- exports.ɵp = AmplifyVerifyUserComponent;
3511
- exports.ɵq = ConfirmResetPasswordComponent;
3512
- exports.ɵr = ConfirmVerifyUserComponent;
3789
+ exports.getAttributeMap = getAttributeMap;
3790
+ exports["ɵa"] = ProxyCmp;
3791
+ exports["ɵb"] = AmplifyAuthenticatorComponent;
3792
+ exports["ɵc"] = AmplifySignInComponent;
3793
+ exports["ɵd"] = AmplifySignUpComponent;
3794
+ exports["ɵe"] = AmplifyFormFieldComponent;
3795
+ exports["ɵf"] = AmplifyErrorComponent;
3796
+ exports["ɵg"] = AmplifyConfirmSignUpComponent;
3797
+ exports["ɵh"] = AmplifyUserNameAliasComponent;
3798
+ exports["ɵi"] = AmplifyConfirmSignInComponent;
3799
+ exports["ɵj"] = AmplifySetupTotpComponent;
3800
+ exports["ɵk"] = AmplifyForceNewPasswordComponent;
3801
+ exports["ɵl"] = AmplifyFederatedSignInComponent;
3802
+ exports["ɵm"] = AmplifyFederatedSignInButtonComponent;
3803
+ exports["ɵn"] = AmplifyResetPasswordComponent;
3804
+ exports["ɵo"] = AmplifyVerifyUserComponent;
3805
+ exports["ɵp"] = ConfirmResetPasswordComponent;
3806
+ exports["ɵq"] = ConfirmVerifyUserComponent;
3807
+ exports["ɵr"] = AmplifySelectComponent;
3808
+ exports["ɵs"] = AmplifyButtonComponent;
3809
+ exports["ɵt"] = AmplifyPasswordFieldComponent;
3810
+ exports["ɵu"] = AmplifyTextFieldComponent;
3811
+ exports["ɵv"] = TabsComponent;
3812
+ exports["ɵw"] = TabItemComponent;
3813
+ exports["ɵx"] = PhoneNumberFieldComponent;
3513
3814
 
3514
3815
  Object.defineProperty(exports, '__esModule', { value: true });
3515
3816
 
3516
- })));
3817
+ }));
3517
3818
  //# sourceMappingURL=aws-amplify-ui-angular.umd.js.map