@aws-amplify/ui-react 1.2.26-unstable.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/esm/index.css +1 -0
  2. package/dist/esm/index.css.map +7 -0
  3. package/dist/esm/index.js +1 -0
  4. package/dist/esm/index.js.map +7 -0
  5. package/dist/esm/legacy.js +1 -0
  6. package/dist/esm/legacy.js.map +7 -0
  7. package/dist/index.css +1 -0
  8. package/dist/index.css.map +7 -0
  9. package/dist/index.d.ts +7533 -0
  10. package/dist/index.js +1 -0
  11. package/dist/index.js.map +7 -0
  12. package/dist/legacy.d.ts +1 -0
  13. package/dist/legacy.js +1 -0
  14. package/dist/legacy.js.map +7 -0
  15. package/dist/primitives.json +22168 -0
  16. package/legacy/package.json +7 -0
  17. package/package.json +82 -40
  18. package/CHANGELOG.md +0 -339
  19. package/README.md +0 -1
  20. package/build.js +0 -5
  21. package/dist/0.js +0 -269
  22. package/dist/0.js.map +0 -1
  23. package/dist/1.js +0 -2111
  24. package/dist/1.js.map +0 -1
  25. package/dist/10.js +0 -707
  26. package/dist/10.js.map +0 -1
  27. package/dist/11.js +0 -45
  28. package/dist/11.js.map +0 -1
  29. package/dist/12.js +0 -1152
  30. package/dist/12.js.map +0 -1
  31. package/dist/13.js +0 -114
  32. package/dist/13.js.map +0 -1
  33. package/dist/14.js +0 -1194
  34. package/dist/14.js.map +0 -1
  35. package/dist/15.js +0 -61
  36. package/dist/15.js.map +0 -1
  37. package/dist/16.js +0 -37
  38. package/dist/16.js.map +0 -1
  39. package/dist/17.js +0 -127
  40. package/dist/17.js.map +0 -1
  41. package/dist/18.js +0 -90
  42. package/dist/18.js.map +0 -1
  43. package/dist/19.js +0 -267
  44. package/dist/19.js.map +0 -1
  45. package/dist/2.js +0 -766
  46. package/dist/2.js.map +0 -1
  47. package/dist/20.js +0 -74
  48. package/dist/20.js.map +0 -1
  49. package/dist/21.js +0 -50
  50. package/dist/21.js.map +0 -1
  51. package/dist/22.js +0 -57
  52. package/dist/22.js.map +0 -1
  53. package/dist/23.js +0 -50
  54. package/dist/23.js.map +0 -1
  55. package/dist/24.js +0 -271
  56. package/dist/24.js.map +0 -1
  57. package/dist/25.js +0 -102
  58. package/dist/25.js.map +0 -1
  59. package/dist/26.js +0 -64
  60. package/dist/26.js.map +0 -1
  61. package/dist/27.js +0 -379
  62. package/dist/27.js.map +0 -1
  63. package/dist/28.js +0 -47
  64. package/dist/28.js.map +0 -1
  65. package/dist/29.js +0 -46
  66. package/dist/29.js.map +0 -1
  67. package/dist/3.js +0 -2787
  68. package/dist/3.js.map +0 -1
  69. package/dist/30.js +0 -503
  70. package/dist/30.js.map +0 -1
  71. package/dist/31.js +0 -2
  72. package/dist/31.js.map +0 -1
  73. package/dist/32.js +0 -2
  74. package/dist/32.js.map +0 -1
  75. package/dist/33.js +0 -13
  76. package/dist/33.js.map +0 -1
  77. package/dist/4.js +0 -4126
  78. package/dist/4.js.map +0 -1
  79. package/dist/5.js +0 -817
  80. package/dist/5.js.map +0 -1
  81. package/dist/6.js +0 -619
  82. package/dist/6.js.map +0 -1
  83. package/dist/7.js +0 -662
  84. package/dist/7.js.map +0 -1
  85. package/dist/8.js +0 -614
  86. package/dist/8.js.map +0 -1
  87. package/dist/9.js +0 -665
  88. package/dist/9.js.map +0 -1
  89. package/dist/@aws-amplify/ui-react.js +0 -31875
  90. package/dist/@aws-amplify/ui-react.js.map +0 -1
  91. package/dist/aws-amplify-react.min.js +0 -28
  92. package/dist/aws-amplify-react.min.js.map +0 -1
  93. package/dist/polyfills-core-js.js +0 -5211
  94. package/dist/polyfills-core-js.js.map +0 -1
  95. package/dist/polyfills-css-shim.js +0 -467
  96. package/dist/polyfills-css-shim.js.map +0 -1
  97. package/dist/polyfills-dom.js +0 -2098
  98. package/dist/polyfills-dom.js.map +0 -1
  99. package/jest.config.js +0 -12
  100. package/lib/components.d.ts +0 -56
  101. package/lib/components.js +0 -64
  102. package/lib/components.js.map +0 -1
  103. package/lib/index.d.ts +0 -2
  104. package/lib/index.js +0 -9
  105. package/lib/index.js.map +0 -1
  106. package/lib/react-component-lib/createComponent.d.ts +0 -2
  107. package/lib/react-component-lib/createComponent.js +0 -91
  108. package/lib/react-component-lib/createComponent.js.map +0 -1
  109. package/lib/react-component-lib/createControllerComponent.d.ts +0 -43
  110. package/lib/react-component-lib/createControllerComponent.js +0 -152
  111. package/lib/react-component-lib/createControllerComponent.js.map +0 -1
  112. package/lib/react-component-lib/createOverlayComponent.d.ts +0 -45
  113. package/lib/react-component-lib/createOverlayComponent.js +0 -148
  114. package/lib/react-component-lib/createOverlayComponent.js.map +0 -1
  115. package/lib/react-component-lib/index.d.ts +0 -3
  116. package/lib/react-component-lib/index.js +0 -9
  117. package/lib/react-component-lib/index.js.map +0 -1
  118. package/lib/react-component-lib/utils/attachEventProps.d.ts +0 -8
  119. package/lib/react-component-lib/utils/attachEventProps.js +0 -85
  120. package/lib/react-component-lib/utils/attachEventProps.js.map +0 -1
  121. package/lib/react-component-lib/utils/index.d.ts +0 -8
  122. package/lib/react-component-lib/utils/index.js +0 -36
  123. package/lib/react-component-lib/utils/index.js.map +0 -1
  124. package/lib/withAuthenticator.d.ts +0 -3
  125. package/lib/withAuthenticator.js +0 -127
  126. package/lib/withAuthenticator.js.map +0 -1
  127. package/lib-esm/components.d.ts +0 -56
  128. package/lib-esm/components.js +0 -62
  129. package/lib-esm/components.js.map +0 -1
  130. package/lib-esm/index.d.ts +0 -2
  131. package/lib-esm/index.js +0 -3
  132. package/lib-esm/index.js.map +0 -1
  133. package/lib-esm/react-component-lib/createComponent.d.ts +0 -2
  134. package/lib-esm/react-component-lib/createComponent.js +0 -86
  135. package/lib-esm/react-component-lib/createComponent.js.map +0 -1
  136. package/lib-esm/react-component-lib/createControllerComponent.d.ts +0 -43
  137. package/lib-esm/react-component-lib/createControllerComponent.js +0 -146
  138. package/lib-esm/react-component-lib/createControllerComponent.js.map +0 -1
  139. package/lib-esm/react-component-lib/createOverlayComponent.d.ts +0 -45
  140. package/lib-esm/react-component-lib/createOverlayComponent.js +0 -142
  141. package/lib-esm/react-component-lib/createOverlayComponent.js.map +0 -1
  142. package/lib-esm/react-component-lib/index.d.ts +0 -3
  143. package/lib-esm/react-component-lib/index.js +0 -4
  144. package/lib-esm/react-component-lib/index.js.map +0 -1
  145. package/lib-esm/react-component-lib/utils/attachEventProps.d.ts +0 -8
  146. package/lib-esm/react-component-lib/utils/attachEventProps.js +0 -79
  147. package/lib-esm/react-component-lib/utils/attachEventProps.js.map +0 -1
  148. package/lib-esm/react-component-lib/utils/index.d.ts +0 -8
  149. package/lib-esm/react-component-lib/utils/index.js +0 -28
  150. package/lib-esm/react-component-lib/utils/index.js.map +0 -1
  151. package/lib-esm/withAuthenticator.d.ts +0 -3
  152. package/lib-esm/withAuthenticator.js +0 -121
  153. package/lib-esm/withAuthenticator.js.map +0 -1
  154. package/src/components.ts +0 -65
  155. package/src/index.ts +0 -3
  156. package/src/react-component-lib/createComponent.tsx +0 -69
  157. package/src/react-component-lib/createControllerComponent.tsx +0 -71
  158. package/src/react-component-lib/createOverlayComponent.tsx +0 -79
  159. package/src/react-component-lib/index.ts +0 -3
  160. package/src/react-component-lib/utils/attachEventProps.ts +0 -87
  161. package/src/react-component-lib/utils/index.tsx +0 -31
  162. package/src/withAuthenticator.tsx +0 -62
  163. package/webpack.config.dev.js +0 -6
  164. package/webpack.config.js +0 -56
package/dist/2.js DELETED
@@ -1,766 +0,0 @@
1
- (this["webpackJsonpaws_amplify_react"] = this["webpackJsonpaws_amplify_react"] || []).push([[2],{
2
-
3
- /***/ "../amplify-ui-components/dist/esm-es5/amplify-authenticator.entry.js":
4
- /*!****************************************************************************!*\
5
- !*** ../amplify-ui-components/dist/esm-es5/amplify-authenticator.entry.js ***!
6
- \****************************************************************************/
7
- /*! exports provided: amplify_authenticator */
8
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
9
-
10
- "use strict";
11
- __webpack_require__.r(__webpack_exports__);
12
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_authenticator", function() { return AmplifyAuthenticator; });
13
- /* harmony import */ var _index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index-83f2275b.js */ "../amplify-ui-components/dist/esm-es5/index-83f2275b.js");
14
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
15
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
16
- /* harmony import */ var _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./auth-types-78df304e.js */ "../amplify-ui-components/dist/esm-es5/auth-types-78df304e.js");
17
- /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
18
- /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__);
19
- /* harmony import */ var _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Translations-108d469f.js */ "../amplify-ui-components/dist/esm-es5/Translations-108d469f.js");
20
- /* harmony import */ var _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants-c8ecaa24.js */ "../amplify-ui-components/dist/esm-es5/constants-c8ecaa24.js");
21
- /* harmony import */ var _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers-14fcb50c.js */ "../amplify-ui-components/dist/esm-es5/helpers-14fcb50c.js");
22
- /* harmony import */ var _auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./auth-helpers-557b83fc.js */ "../amplify-ui-components/dist/esm-es5/auth-helpers-557b83fc.js");
23
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
24
- function adopt(value) {
25
- return value instanceof P ? value : new P(function (resolve) {
26
- resolve(value);
27
- });
28
- }
29
-
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) {
32
- try {
33
- step(generator.next(value));
34
- } catch (e) {
35
- reject(e);
36
- }
37
- }
38
-
39
- function rejected(value) {
40
- try {
41
- step(generator["throw"](value));
42
- } catch (e) {
43
- reject(e);
44
- }
45
- }
46
-
47
- function step(result) {
48
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
49
- }
50
-
51
- step((generator = generator.apply(thisArg, _arguments || [])).next());
52
- });
53
- };
54
-
55
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
56
- var _ = {
57
- label: 0,
58
- sent: function sent() {
59
- if (t[0] & 1) throw t[1];
60
- return t[1];
61
- },
62
- trys: [],
63
- ops: []
64
- },
65
- f,
66
- y,
67
- t,
68
- g;
69
- return g = {
70
- next: verb(0),
71
- "throw": verb(1),
72
- "return": verb(2)
73
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
74
- return this;
75
- }), g;
76
-
77
- function verb(n) {
78
- return function (v) {
79
- return step([n, v]);
80
- };
81
- }
82
-
83
- function step(op) {
84
- if (f) throw new TypeError("Generator is already executing.");
85
-
86
- while (_) {
87
- try {
88
- 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) return t;
89
- if (y = 0, t) op = [op[0] & 2, t.value];
90
-
91
- switch (op[0]) {
92
- case 0:
93
- case 1:
94
- t = op;
95
- break;
96
-
97
- case 4:
98
- _.label++;
99
- return {
100
- value: op[1],
101
- done: false
102
- };
103
-
104
- case 5:
105
- _.label++;
106
- y = op[1];
107
- op = [0];
108
- continue;
109
-
110
- case 7:
111
- op = _.ops.pop();
112
-
113
- _.trys.pop();
114
-
115
- continue;
116
-
117
- default:
118
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
119
- _ = 0;
120
- continue;
121
- }
122
-
123
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
124
- _.label = op[1];
125
- break;
126
- }
127
-
128
- if (op[0] === 6 && _.label < t[1]) {
129
- _.label = t[1];
130
- t = op;
131
- break;
132
- }
133
-
134
- if (t && _.label < t[2]) {
135
- _.label = t[2];
136
-
137
- _.ops.push(op);
138
-
139
- break;
140
- }
141
-
142
- if (t[2]) _.ops.pop();
143
-
144
- _.trys.pop();
145
-
146
- continue;
147
- }
148
-
149
- op = body.call(thisArg, _);
150
- } catch (e) {
151
- op = [6, e];
152
- y = 0;
153
- } finally {
154
- f = t = 0;
155
- }
156
- }
157
-
158
- if (op[0] & 5) throw op[1];
159
- return {
160
- value: op[0] ? op[1] : void 0,
161
- done: true
162
- };
163
- }
164
- };
165
-
166
- var _a;
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
- var authSlotNames = (_a = {}, _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn] = 'sign-in', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignIn] = 'confirm-sign-in', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignUp] = 'sign-up', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignUp] = 'confirm-sign-up', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ForgotPassword] = 'forgot-password', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ResetPassword] = 'require-new-password', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].VerifyContact] = 'verify-contact', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].TOTPSetup] = 'totp-setup', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].Loading] = 'loading', _a);
177
- var amplifyAuthenticatorCss = ":host{--background-color:var(--amplify-background-color);--width:28.75rem;--min-width:20rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--box-shadow:1px 1px 4px 0 rgba(0, 0, 0, 0.15);--border-radius:6px;--padding:35px 40px;--margin-bottom:20px;--container-height:100vh;--container-display:flex;--container-justify:center;--container-align:center}.auth-container{display:var(--container-display);-ms-flex-pack:var(--container-justify);justify-content:var(--container-justify);-ms-flex-align:var(--container-align);align-items:var(--container-align);min-height:var(--container-height)}";
178
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('Authenticator');
179
-
180
- var AmplifyAuthenticator =
181
- /** @class */
182
- function () {
183
- function class_1(hostRef) {
184
- var _this = this;
185
-
186
- Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
187
- /** Initial starting state of the Authenticator component. E.g. If `signup` is passed the default component is set to AmplifySignUp */
188
-
189
- this.initialAuthState = _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn;
190
- /** Callback for Authenticator state machine changes */
191
-
192
- this.handleAuthStateChange = function () {};
193
- /** Hide amplify-toast for auth errors */
194
-
195
-
196
- this.hideToast = false;
197
- this.authState = _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].Loading;
198
- this.toastMessage = '';
199
-
200
- this.handleExternalAuthEvent = function (_a) {
201
- var payload = _a.payload;
202
-
203
- switch (payload.event) {
204
- case 'cognitoHostedUI':
205
- case 'signIn':
206
- Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(payload.data, _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"]);
207
- break;
208
-
209
- case 'cognitoHostedUI_failure':
210
- case 'parsingUrl_failure':
211
- case 'signOut':
212
- case 'customGreetingSignOut':
213
- return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"])(_this.initialAuthState);
214
- }
215
- };
216
-
217
- this.handleToastEvent = function (_a) {
218
- var payload = _a.payload;
219
-
220
- switch (payload.event) {
221
- case _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["T"]:
222
- if (payload.message) _this.toastMessage = payload.message;
223
- break;
224
- }
225
- };
226
- }
227
-
228
- class_1.prototype.componentWillLoad = function () {
229
- return __awaiter(this, void 0, void 0, function () {
230
- var _this = this;
231
-
232
- return __generator(this, function (_a) {
233
- switch (_a.label) {
234
- case 0:
235
- Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["o"])(function (authState, authData) {
236
- _this.onAuthStateChange(authState, authData);
237
-
238
- _this.toastMessage = '';
239
- });
240
- if (!this.hideToast) _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].listen(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["U"], this.handleToastEvent);
241
- _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].listen(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["A"], this.handleExternalAuthEvent);
242
- Object(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["appendToCognitoUserAgent"])('amplify-authenticator');
243
- return [4
244
- /*yield*/
245
- , this.checkUser()];
246
-
247
- case 1:
248
- _a.sent();
249
-
250
- return [2
251
- /*return*/
252
- ];
253
- }
254
- });
255
- });
256
- };
257
-
258
- class_1.prototype.checkUser = function () {
259
- return __awaiter(this, void 0, void 0, function () {
260
- var _this = this;
261
-
262
- return __generator(this, function (_a) {
263
- if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser !== 'function') {
264
- throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
265
- }
266
-
267
- return [2
268
- /*return*/
269
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser().then(function (user) {
270
- Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"])(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, user);
271
- })["catch"](function () {
272
- Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"])(_this.initialAuthState);
273
- })];
274
- });
275
- });
276
- };
277
-
278
- class_1.prototype.onAuthStateChange = function (nextAuthState, data) {
279
- return __awaiter(this, void 0, void 0, function () {
280
- return __generator(this, function (_a) {
281
- if (nextAuthState === undefined) return [2
282
- /*return*/
283
- , logger.error('nextAuthState cannot be undefined')];
284
- logger.info('Inside onAuthStateChange Method current authState:', this.authState);
285
-
286
- if (nextAuthState === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedOut) {
287
- this.authState = this.initialAuthState;
288
- } else {
289
- this.authState = nextAuthState;
290
- }
291
-
292
- this.authData = data;
293
- if (this.authData) logger.log('Auth Data was set:', this.authData);
294
-
295
- if (this.authState === nextAuthState) {
296
- this.handleAuthStateChange(this.authState, this.authData);
297
- logger.info("authState has been updated to " + this.authState);
298
- }
299
-
300
- return [2
301
- /*return*/
302
- ];
303
- });
304
- });
305
- }; // Returns the auth component corresponding to the given authState.
306
-
307
-
308
- class_1.prototype.getAuthComponent = function (authState) {
309
- switch (authState) {
310
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn:
311
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in", {
312
- federated: this.federated,
313
- usernameAlias: this.usernameAlias
314
- });
315
-
316
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignIn:
317
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-confirm-sign-in", {
318
- user: this.authData
319
- });
320
-
321
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignUp:
322
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-up", {
323
- usernameAlias: this.usernameAlias
324
- });
325
-
326
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignUp:
327
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-confirm-sign-up", {
328
- user: this.authData,
329
- usernameAlias: this.usernameAlias
330
- });
331
-
332
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ForgotPassword:
333
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-forgot-password", {
334
- usernameAlias: this.usernameAlias
335
- });
336
-
337
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ResetPassword:
338
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-require-new-password", {
339
- user: this.authData
340
- });
341
-
342
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].VerifyContact:
343
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-verify-contact", {
344
- user: this.authData
345
- });
346
-
347
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].TOTPSetup:
348
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-totp-setup", {
349
- user: this.authData
350
- });
351
-
352
- case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].Loading:
353
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, "Loading...");
354
-
355
- default:
356
- throw new Error("Unhandled auth state: " + authState);
357
- }
358
- }; // Returns a slot containing the Auth component corresponding to the given authState
359
-
360
-
361
- class_1.prototype.getSlotWithAuthComponent = function (authState) {
362
- var authComponent = this.getAuthComponent(authState);
363
- var slotName = authSlotNames[authState];
364
- var slotIsEmpty = this.el.querySelector("[slot=\"" + slotName + "\"]") === null; // true if no element has been inserted to the slot
365
-
366
- /**
367
- * Connect the inner auth component to DOM only if the slot hasn't been overwritten. This prevents
368
- * the overwritten component from calling its lifecycle methods.
369
- */
370
-
371
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
372
- name: slotName
373
- }, slotIsEmpty && authComponent);
374
- };
375
-
376
- class_1.prototype.disconnectedCallback = function () {
377
- _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].remove(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["A"], this.handleExternalAuthEvent);
378
- if (!this.hideToast) _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].remove(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["U"], this.handleToastEvent);
379
- return _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["o"];
380
- };
381
-
382
- class_1.prototype.render = function () {
383
- var _this = this;
384
-
385
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, !this.hideToast && this.toastMessage && Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-toast", {
386
- message: this.toastMessage,
387
- handleClose: function handleClose() {
388
- _this.toastMessage = '';
389
- },
390
- "data-test": "authenticator-error"
391
- }), this.authState === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn ? [Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
392
- name: "greetings"
393
- }), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", null)] : Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
394
- "class": "auth-container"
395
- }, this.getSlotWithAuthComponent(this.authState)));
396
- };
397
-
398
- Object.defineProperty(class_1.prototype, "el", {
399
- get: function get() {
400
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["g"])(this);
401
- },
402
- enumerable: false,
403
- configurable: true
404
- });
405
- return class_1;
406
- }();
407
-
408
- AmplifyAuthenticator.style = amplifyAuthenticatorCss;
409
-
410
-
411
- /***/ }),
412
-
413
- /***/ "../amplify-ui-components/dist/esm-es5/auth-helpers-557b83fc.js":
414
- /*!**********************************************************************!*\
415
- !*** ../amplify-ui-components/dist/esm-es5/auth-helpers-557b83fc.js ***!
416
- \**********************************************************************/
417
- /*! exports provided: c, h */
418
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
419
-
420
- "use strict";
421
- __webpack_require__.r(__webpack_exports__);
422
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return checkContact; });
423
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return handleSignIn; });
424
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
425
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
426
- /* harmony import */ var _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./auth-types-78df304e.js */ "../amplify-ui-components/dist/esm-es5/auth-types-78df304e.js");
427
- /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
428
- /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__);
429
- /* harmony import */ var _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Translations-108d469f.js */ "../amplify-ui-components/dist/esm-es5/Translations-108d469f.js");
430
- /* harmony import */ var _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants-c8ecaa24.js */ "../amplify-ui-components/dist/esm-es5/constants-c8ecaa24.js");
431
- /* harmony import */ var _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers-14fcb50c.js */ "../amplify-ui-components/dist/esm-es5/helpers-14fcb50c.js");
432
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
433
- function adopt(value) {
434
- return value instanceof P ? value : new P(function (resolve) {
435
- resolve(value);
436
- });
437
- }
438
-
439
- return new (P || (P = Promise))(function (resolve, reject) {
440
- function fulfilled(value) {
441
- try {
442
- step(generator.next(value));
443
- } catch (e) {
444
- reject(e);
445
- }
446
- }
447
-
448
- function rejected(value) {
449
- try {
450
- step(generator["throw"](value));
451
- } catch (e) {
452
- reject(e);
453
- }
454
- }
455
-
456
- function step(result) {
457
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
458
- }
459
-
460
- step((generator = generator.apply(thisArg, _arguments || [])).next());
461
- });
462
- };
463
-
464
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
465
- var _ = {
466
- label: 0,
467
- sent: function sent() {
468
- if (t[0] & 1) throw t[1];
469
- return t[1];
470
- },
471
- trys: [],
472
- ops: []
473
- },
474
- f,
475
- y,
476
- t,
477
- g;
478
- return g = {
479
- next: verb(0),
480
- "throw": verb(1),
481
- "return": verb(2)
482
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
483
- return this;
484
- }), g;
485
-
486
- function verb(n) {
487
- return function (v) {
488
- return step([n, v]);
489
- };
490
- }
491
-
492
- function step(op) {
493
- if (f) throw new TypeError("Generator is already executing.");
494
-
495
- while (_) {
496
- try {
497
- 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) return t;
498
- if (y = 0, t) op = [op[0] & 2, t.value];
499
-
500
- switch (op[0]) {
501
- case 0:
502
- case 1:
503
- t = op;
504
- break;
505
-
506
- case 4:
507
- _.label++;
508
- return {
509
- value: op[1],
510
- done: false
511
- };
512
-
513
- case 5:
514
- _.label++;
515
- y = op[1];
516
- op = [0];
517
- continue;
518
-
519
- case 7:
520
- op = _.ops.pop();
521
-
522
- _.trys.pop();
523
-
524
- continue;
525
-
526
- default:
527
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
528
- _ = 0;
529
- continue;
530
- }
531
-
532
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
533
- _.label = op[1];
534
- break;
535
- }
536
-
537
- if (op[0] === 6 && _.label < t[1]) {
538
- _.label = t[1];
539
- t = op;
540
- break;
541
- }
542
-
543
- if (t && _.label < t[2]) {
544
- _.label = t[2];
545
-
546
- _.ops.push(op);
547
-
548
- break;
549
- }
550
-
551
- if (t[2]) _.ops.pop();
552
-
553
- _.trys.pop();
554
-
555
- continue;
556
- }
557
-
558
- op = body.call(thisArg, _);
559
- } catch (e) {
560
- op = [6, e];
561
- y = 0;
562
- } finally {
563
- f = t = 0;
564
- }
565
- }
566
-
567
- if (op[0] & 5) throw op[1];
568
- return {
569
- value: op[0] ? op[1] : void 0,
570
- done: true
571
- };
572
- }
573
- };
574
-
575
-
576
-
577
-
578
-
579
-
580
-
581
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Logger"]('auth-helpers');
582
-
583
- function checkContact(user, handleAuthStateChange) {
584
- return __awaiter(this, void 0, void 0, function () {
585
- var data, newUser, error_1;
586
- return __generator(this, function (_a) {
587
- switch (_a.label) {
588
- case 0:
589
- if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].verifiedContact !== 'function') {
590
- throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__["N"]);
591
- } // If `user` is a federated user, we shouldn't call `verifiedContact`
592
- // since `user` isn't `CognitoUser`
593
-
594
-
595
- if (!isCognitoUser(user)) {
596
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].SignedIn, user);
597
- return [2
598
- /*return*/
599
- ];
600
- }
601
-
602
- _a.label = 1;
603
-
604
- case 1:
605
- _a.trys.push([1, 3,, 4]);
606
-
607
- return [4
608
- /*yield*/
609
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].verifiedContact(user)];
610
-
611
- case 2:
612
- data = _a.sent();
613
-
614
- if (!Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(data.verified) || Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(data.unverified)) {
615
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].SignedIn, user);
616
- } else {
617
- newUser = Object.assign(user, data);
618
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].VerifyContact, newUser);
619
- }
620
-
621
- return [3
622
- /*break*/
623
- , 4];
624
-
625
- case 3:
626
- error_1 = _a.sent();
627
- Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_5__["a"])(error_1);
628
- return [3
629
- /*break*/
630
- , 4];
631
-
632
- case 4:
633
- return [2
634
- /*return*/
635
- ];
636
- }
637
- });
638
- });
639
- }
640
-
641
- var handleSignIn = function handleSignIn(username, password, handleAuthStateChange, usernameAlias) {
642
- return __awaiter(void 0, void 0, void 0, function () {
643
- var user, error_2;
644
- return __generator(this, function (_a) {
645
- switch (_a.label) {
646
- case 0:
647
- if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].signIn !== 'function') {
648
- throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__["N"]);
649
- }
650
-
651
- _a.label = 1;
652
-
653
- case 1:
654
- _a.trys.push([1, 9,, 10]);
655
-
656
- return [4
657
- /*yield*/
658
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].signIn(username, password)];
659
-
660
- case 2:
661
- user = _a.sent();
662
- logger.debug(user);
663
- if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].SMSMFA || user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].SoftwareTokenMFA)) return [3
664
- /*break*/
665
- , 3];
666
- logger.debug('confirm user with ' + user.challengeName);
667
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ConfirmSignIn, user);
668
- return [3
669
- /*break*/
670
- , 8];
671
-
672
- case 3:
673
- if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].NewPasswordRequired)) return [3
674
- /*break*/
675
- , 4];
676
- logger.debug('require new password', user.challengeParam);
677
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ResetPassword, user);
678
- return [3
679
- /*break*/
680
- , 8];
681
-
682
- case 4:
683
- if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].MFASetup)) return [3
684
- /*break*/
685
- , 5];
686
- logger.debug('TOTP setup', user.challengeParam);
687
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].TOTPSetup, user);
688
- return [3
689
- /*break*/
690
- , 8];
691
-
692
- case 5:
693
- if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].CustomChallenge && user.challengeParam && user.challengeParam.trigger === 'true')) return [3
694
- /*break*/
695
- , 6];
696
- logger.debug('custom challenge', user.challengeParam);
697
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].CustomConfirmSignIn, user);
698
- return [3
699
- /*break*/
700
- , 8];
701
-
702
- case 6:
703
- return [4
704
- /*yield*/
705
- , checkContact(user, handleAuthStateChange)];
706
-
707
- case 7:
708
- _a.sent();
709
-
710
- _a.label = 8;
711
-
712
- case 8:
713
- return [3
714
- /*break*/
715
- , 10];
716
-
717
- case 9:
718
- error_2 = _a.sent();
719
-
720
- if (error_2.code === 'UserNotConfirmedException') {
721
- logger.debug('the user is not confirmed');
722
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ConfirmSignUp, {
723
- username: username
724
- });
725
- } else if (error_2.code === 'PasswordResetRequiredException') {
726
- logger.debug('the user requires a new password');
727
- handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ForgotPassword, {
728
- username: username
729
- });
730
- } else if (error_2.code === 'InvalidParameterException' && password === '') {
731
- logger.debug('Password cannot be empty');
732
- error_2.message = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_PASSWORD;
733
- } else if (error_2.message === _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_USERNAME) {
734
- if (usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["U"].email) {
735
- error_2.message = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_EMAIL;
736
- }
737
-
738
- if (usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["U"].phone_number) {
739
- error_2.message = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_PHONE;
740
- }
741
- }
742
-
743
- Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_5__["a"])(error_2);
744
- return [3
745
- /*break*/
746
- , 10];
747
-
748
- case 10:
749
- return [2
750
- /*return*/
751
- ];
752
- }
753
- });
754
- });
755
- };
756
-
757
- var isCognitoUser = function isCognitoUser(user) {
758
- return user instanceof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["CognitoUser"];
759
- };
760
-
761
-
762
-
763
- /***/ })
764
-
765
- }]);
766
- //# sourceMappingURL=2.js.map