@aws-amplify/ui-react 1.2.56-legacy-ui-tests.6 → 1.2.60-unstable.5

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