@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/9.js CHANGED
@@ -29,7 +29,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
29
29
  resolve(value);
30
30
  });
31
31
  }
32
-
33
32
  return new (P || (P = Promise))(function (resolve, reject) {
34
33
  function fulfilled(value) {
35
34
  try {
@@ -38,7 +37,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
38
37
  reject(e);
39
38
  }
40
39
  }
41
-
42
40
  function rejected(value) {
43
41
  try {
44
42
  step(generator["throw"](value));
@@ -46,29 +44,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
46
44
  reject(e);
47
45
  }
48
46
  }
49
-
50
47
  function step(result) {
51
48
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
52
49
  }
53
-
54
50
  step((generator = generator.apply(thisArg, _arguments || [])).next());
55
51
  });
56
52
  };
57
-
58
53
  var __generator = undefined && undefined.__generator || function (thisArg, body) {
59
54
  var _ = {
60
- label: 0,
61
- sent: function sent() {
62
- if (t[0] & 1) throw t[1];
63
- return t[1];
55
+ label: 0,
56
+ sent: function sent() {
57
+ if (t[0] & 1) throw t[1];
58
+ return t[1];
59
+ },
60
+ trys: [],
61
+ ops: []
64
62
  },
65
- trys: [],
66
- ops: []
67
- },
68
- f,
69
- y,
70
- t,
71
- g;
63
+ f,
64
+ y,
65
+ t,
66
+ g;
72
67
  return g = {
73
68
  next: verb(0),
74
69
  "throw": verb(1),
@@ -76,79 +71,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
76
71
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
77
72
  return this;
78
73
  }), g;
79
-
80
74
  function verb(n) {
81
75
  return function (v) {
82
76
  return step([n, v]);
83
77
  };
84
78
  }
85
-
86
79
  function step(op) {
87
80
  if (f) throw new TypeError("Generator is already executing.");
88
-
89
81
  while (_) {
90
82
  try {
91
83
  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;
92
84
  if (y = 0, t) op = [op[0] & 2, t.value];
93
-
94
85
  switch (op[0]) {
95
86
  case 0:
96
87
  case 1:
97
88
  t = op;
98
89
  break;
99
-
100
90
  case 4:
101
91
  _.label++;
102
92
  return {
103
93
  value: op[1],
104
94
  done: false
105
95
  };
106
-
107
96
  case 5:
108
97
  _.label++;
109
98
  y = op[1];
110
99
  op = [0];
111
100
  continue;
112
-
113
101
  case 7:
114
102
  op = _.ops.pop();
115
-
116
103
  _.trys.pop();
117
-
118
104
  continue;
119
-
120
105
  default:
121
106
  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
122
107
  _ = 0;
123
108
  continue;
124
109
  }
125
-
126
110
  if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
127
111
  _.label = op[1];
128
112
  break;
129
113
  }
130
-
131
114
  if (op[0] === 6 && _.label < t[1]) {
132
115
  _.label = t[1];
133
116
  t = op;
134
117
  break;
135
118
  }
136
-
137
119
  if (t && _.label < t[2]) {
138
120
  _.label = t[2];
139
-
140
121
  _.ops.push(op);
141
-
142
122
  break;
143
123
  }
144
-
145
124
  if (t[2]) _.ops.pop();
146
-
147
125
  _.trys.pop();
148
-
149
126
  continue;
150
127
  }
151
-
152
128
  op = body.call(thisArg, _);
153
129
  } catch (e) {
154
130
  op = [6, e];
@@ -157,7 +133,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
157
133
  f = t = 0;
158
134
  }
159
135
  }
160
-
161
136
  if (op[0] & 5) throw op[1];
162
137
  return {
163
138
  value: op[0] ? op[1] : void 0,
@@ -172,34 +147,24 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
172
147
 
173
148
 
174
149
 
175
-
176
150
  var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-amazon-button');
177
-
178
- var AmplifyAmazonButton =
179
- /** @class */
180
- function () {
151
+ var AmplifyAmazonButton = /** @class */function () {
181
152
  function class_1(hostRef) {
182
153
  var _this = this;
183
-
184
154
  Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
185
155
  /** Auth state change handler for this component
186
156
  * e.g. SignIn -> 'Create Account' link -> SignUp
187
157
  */
188
-
189
158
  this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
190
-
191
159
  this.federatedSignIn = function (response) {
192
160
  var access_token = response.access_token,
193
- expires_in = response.expires_in;
194
-
161
+ expires_in = response.expires_in;
195
162
  if (!access_token) {
196
163
  return;
197
164
  }
198
-
199
165
  if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn !== 'function' || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser !== 'function') {
200
166
  throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
201
167
  }
202
-
203
168
  var date = new Date();
204
169
  var expires_at = expires_in * 1000 + date.getTime();
205
170
  window['amazon'].Login.retrieveProfile(function (userInfo) {
@@ -209,35 +174,23 @@ function () {
209
174
  switch (_a.label) {
210
175
  case 0:
211
176
  if (!userInfo.success) {
212
- return [2
213
- /*return*/
214
- , logger.debug('Get user Info failed')];
177
+ return [2 /*return*/, logger.debug('Get user Info failed')];
215
178
  }
216
-
217
179
  user = {
218
180
  name: userInfo.profile.Name,
219
181
  email: userInfo.profile.PrimaryEmail
220
182
  };
221
- return [4
222
- /*yield*/
223
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('amazon', {
183
+ return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('amazon', {
224
184
  token: access_token,
225
185
  expires_at: expires_at
226
186
  }, user)];
227
-
228
187
  case 1:
229
188
  _a.sent();
230
-
231
- return [4
232
- /*yield*/
233
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
234
-
189
+ return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
235
190
  case 2:
236
191
  authenticatedUser = _a.sent();
237
192
  this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, authenticatedUser);
238
- return [2
239
- /*return*/
240
- ];
193
+ return [2 /*return*/];
241
194
  }
242
195
  });
243
196
  });
@@ -251,11 +204,8 @@ function () {
251
204
  /**
252
205
  * @see https://developer.amazon.com/docs/login-with-amazon/install-sdk-javascript.html
253
206
  */
254
-
255
-
256
207
  class_1.prototype.signInWithAmazon = function (event) {
257
208
  var _this = this;
258
-
259
209
  event.preventDefault();
260
210
  window['amazon'].Login.setClientId(this.clientId);
261
211
  window['amazon'].Login.authorize({
@@ -264,7 +214,6 @@ function () {
264
214
  if (response.error) {
265
215
  return logger.debug('Failed to login with amazon: ' + response.error);
266
216
  }
267
-
268
217
  try {
269
218
  window.localStorage.setItem(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["h"], JSON.stringify({
270
219
  provider: 'amazon'
@@ -272,14 +221,11 @@ function () {
272
221
  } catch (e) {
273
222
  logger.debug('Failed to cache auth source into localStorage', e);
274
223
  }
275
-
276
224
  _this.federatedSignIn(response);
277
225
  });
278
226
  };
279
-
280
227
  class_1.prototype.render = function () {
281
228
  var _this = this;
282
-
283
229
  return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
284
230
  onClick: function onClick(event) {
285
231
  return _this.signInWithAmazon(event);
@@ -289,53 +235,39 @@ function () {
289
235
  src: "https://assets.loginwithamazon.com/sdk/na/login1.js"
290
236
  }), _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_AMAZON));
291
237
  };
292
-
293
238
  return class_1;
294
239
  }();
295
-
296
240
  var logger$1 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-auth0-button');
297
-
298
- var AmplifyAuth0Button =
299
- /** @class */
300
- function () {
241
+ var AmplifyAuth0Button = /** @class */function () {
301
242
  function class_2(hostRef) {
302
243
  var _this = this;
303
-
304
244
  Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
305
245
  /** Auth state change handler for this component */
306
-
307
246
  this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
308
-
309
247
  this.handleLoad = function () {
310
248
  // @ts-ignore Property 'auth0' does not exist on type '{}'.
311
249
  var _a = _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].configure().oauth,
312
- oauth = _a === void 0 ? {} : _a; // @ts-ignore Property 'auth0' does not exist on type '{}'.
313
-
250
+ oauth = _a === void 0 ? {} : _a;
251
+ // @ts-ignore Property 'auth0' does not exist on type '{}'.
314
252
  var _b = _this.config,
315
- config = _b === void 0 ? oauth.auth0 : _b;
316
-
253
+ config = _b === void 0 ? oauth.auth0 : _b;
317
254
  if (!config) {
318
255
  logger$1.debug('Auth0 is not configured');
319
256
  return;
320
257
  }
321
-
322
258
  logger$1.debug('auth0 configuration', config);
323
-
324
259
  if (!_this._auth0) {
325
260
  _this._auth0 = new window['auth0'].WebAuth(config);
326
261
  }
327
-
328
262
  _this._auth0.parseHash(function (err, authResult) {
329
263
  if (err) {
330
264
  logger$1.debug('Failed to parse the url for Auth0', err);
331
265
  return;
332
266
  }
333
-
334
267
  if (!authResult) {
335
268
  logger$1.debug('Auth0 found no authResult in hash');
336
269
  return;
337
270
  }
338
-
339
271
  var payload = {
340
272
  provider: 'auth0',
341
273
  opts: {
@@ -344,13 +276,11 @@ function () {
344
276
  federated: config.federated
345
277
  }
346
278
  };
347
-
348
279
  try {
349
280
  localStorage.setItem(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["h"], JSON.stringify(payload));
350
281
  } catch (e) {
351
282
  logger$1.debug('Failed to cache auth source into localStorage', e);
352
283
  }
353
-
354
284
  _this._auth0.client.userInfo(authResult.accessToken, function (err, user) {
355
285
  return __awaiter(_this, void 0, void 0, function () {
356
286
  var username, email, authenticatedUser;
@@ -359,37 +289,26 @@ function () {
359
289
  case 0:
360
290
  username = undefined;
361
291
  email = undefined;
362
-
363
292
  if (err) {
364
293
  logger$1.debug('Failed to get the user info', err);
365
294
  } else {
366
295
  username = user.name;
367
296
  email = user.email;
368
297
  }
369
-
370
- return [4
371
- /*yield*/
372
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn(config.domain, {
298
+ return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn(config.domain, {
373
299
  token: authResult.idToken,
374
300
  expires_at: authResult.expiresIn * 1000 + new Date().getTime()
375
301
  }, {
376
302
  name: username,
377
303
  email: email
378
304
  })];
379
-
380
305
  case 1:
381
306
  _a.sent();
382
-
383
- return [4
384
- /*yield*/
385
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
386
-
307
+ return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
387
308
  case 2:
388
309
  authenticatedUser = _a.sent();
389
310
  this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, authenticatedUser);
390
- return [2
391
- /*return*/
392
- ];
311
+ return [2 /*return*/];
393
312
  }
394
313
  });
395
314
  });
@@ -401,20 +320,15 @@ function () {
401
320
  class_2.prototype.componentWillLoad = function () {
402
321
  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.');
403
322
  };
404
-
405
323
  class_2.prototype.signInWithAuth0 = function (event) {
406
324
  event.preventDefault();
407
-
408
325
  if (!this._auth0) {
409
326
  throw new Error('the auth0 client is not configured');
410
327
  }
411
-
412
328
  this._auth0.authorize();
413
329
  };
414
-
415
330
  class_2.prototype.render = function () {
416
331
  var _this = this;
417
-
418
332
  return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
419
333
  onClick: function onClick(event) {
420
334
  return _this.signInWithAuth0(event);
@@ -425,37 +339,26 @@ function () {
425
339
  src: "https://cdn.auth0.com/js/auth0/9.11/auth0.min.js"
426
340
  }), _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_AUTH0));
427
341
  };
428
-
429
342
  return class_2;
430
343
  }();
431
-
432
344
  var logger$2 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-facebook-button');
433
-
434
- var AmplifyFacebookButton =
435
- /** @class */
436
- function () {
345
+ var AmplifyFacebookButton = /** @class */function () {
437
346
  function class_3(hostRef) {
438
347
  var _this = this;
439
-
440
348
  Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
441
349
  /** Auth state change handler for this component
442
350
  * e.g. SignIn -> 'Create Account' link -> SignUp
443
351
  */
444
-
445
352
  this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
446
-
447
353
  this.federatedSignIn = function (authResponse) {
448
354
  var accessToken = authResponse.accessToken,
449
- expiresIn = authResponse.expiresIn;
450
-
355
+ expiresIn = authResponse.expiresIn;
451
356
  if (!accessToken) {
452
357
  return;
453
358
  }
454
-
455
359
  if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn !== 'function' || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser !== 'function') {
456
360
  throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
457
361
  }
458
-
459
362
  var date = new Date();
460
363
  var expires_at = expiresIn * 1000 + date.getTime();
461
364
  var fields = 'name,email';
@@ -471,26 +374,17 @@ function () {
471
374
  name: response.name,
472
375
  email: response.email
473
376
  };
474
- return [4
475
- /*yield*/
476
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('facebook', {
377
+ return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('facebook', {
477
378
  token: accessToken,
478
379
  expires_at: expires_at
479
380
  }, user)];
480
-
481
381
  case 1:
482
382
  _a.sent();
483
-
484
- return [4
485
- /*yield*/
486
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
487
-
383
+ return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
488
384
  case 2:
489
385
  authenticatedUser = _a.sent();
490
386
  this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, authenticatedUser);
491
- return [2
492
- /*return*/
493
- ];
387
+ return [2 /*return*/];
494
388
  }
495
389
  });
496
390
  });
@@ -506,15 +400,12 @@ function () {
506
400
  } catch (e) {
507
401
  logger$2.debug('Failed to cache auth source into localStorage', e);
508
402
  }
509
-
510
403
  if (response.status === 'connected') {
511
404
  return _this.federatedSignIn(response.authResponse);
512
405
  }
513
-
514
406
  _this.login();
515
407
  });
516
408
  };
517
-
518
409
  this.login = function () {
519
410
  var scope = 'public_profile,email';
520
411
  window['FB'].login(function (response) {
@@ -526,15 +417,12 @@ function () {
526
417
  });
527
418
  };
528
419
  }
529
-
530
420
  class_3.prototype.componentWillLoad = function () {
531
421
  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.');
532
422
  };
533
423
  /**
534
424
  * @see https://developers.facebook.com/docs/javascript/reference/FB.init/v5.0
535
425
  */
536
-
537
-
538
426
  class_3.prototype.signInWithFacebook = function (event) {
539
427
  event.preventDefault();
540
428
  window['FB'].init({
@@ -545,10 +433,8 @@ function () {
545
433
  });
546
434
  this.getLoginStatus();
547
435
  };
548
-
549
436
  class_3.prototype.render = function () {
550
437
  var _this = this;
551
-
552
438
  return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
553
439
  onClick: function onClick(event) {
554
440
  return _this.signInWithFacebook(event);
@@ -560,48 +446,35 @@ function () {
560
446
  src: "https://connect.facebook.net/en_US/sdk.js"
561
447
  }), _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_FACEBOOK));
562
448
  };
563
-
564
449
  return class_3;
565
450
  }();
566
-
567
451
  var logger$3 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-google-button');
568
-
569
- var AmplifyGoogleButton =
570
- /** @class */
571
- function () {
452
+ var AmplifyGoogleButton = /** @class */function () {
572
453
  function class_4(hostRef) {
573
454
  var _this = this;
574
-
575
455
  Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
576
456
  /** Auth state change handler for this component
577
457
  * e.g. SignIn -> 'Create Account' link -> SignUp
578
458
  */
579
-
580
459
  this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
581
-
582
460
  this.handleError = function (error) {
583
461
  console.error(error);
584
462
  };
585
463
  /**
586
464
  * @see https://developers.google.com/identity/sign-in/web/build-button#building_a_button_with_a_custom_graphic
587
465
  */
588
-
589
-
590
466
  this.handleLoad = function () {
591
467
  window['gapi'].load('auth2');
592
468
  };
593
-
594
469
  this.handleUser = function (user) {
595
470
  return __awaiter(_this, void 0, void 0, function () {
596
471
  var _a, id_token, expires_at, profile, authenticatedUser;
597
-
598
472
  return __generator(this, function (_b) {
599
473
  switch (_b.label) {
600
474
  case 0:
601
475
  if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn !== 'function' || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser !== 'function') {
602
476
  throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
603
477
  }
604
-
605
478
  try {
606
479
  window.localStorage.setItem(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["h"], JSON.stringify({
607
480
  provider: 'google'
@@ -609,12 +482,9 @@ function () {
609
482
  } catch (e) {
610
483
  logger$3.debug('Failed to cache auth source into localStorage', e);
611
484
  }
612
-
613
485
  _a = user.getAuthResponse(), id_token = _a.id_token, expires_at = _a.expires_at;
614
486
  profile = user.getBasicProfile();
615
- return [4
616
- /*yield*/
617
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('google', {
487
+ return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('google', {
618
488
  token: id_token,
619
489
  expires_at: expires_at
620
490
  }, {
@@ -622,26 +492,17 @@ function () {
622
492
  name: profile.getName(),
623
493
  picture: profile.getImageUrl()
624
494
  })];
625
-
626
495
  case 1:
627
496
  _b.sent();
628
-
629
- return [4
630
- /*yield*/
631
- , _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
632
-
497
+ return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
633
498
  case 2:
634
499
  authenticatedUser = _b.sent();
635
-
636
500
  try {
637
501
  this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, authenticatedUser);
638
502
  } catch (error) {
639
503
  this.handleError(error);
640
504
  }
641
-
642
- return [2
643
- /*return*/
644
- ];
505
+ return [2 /*return*/];
645
506
  }
646
507
  });
647
508
  });
@@ -651,7 +512,6 @@ function () {
651
512
  class_4.prototype.componentWillLoad = function () {
652
513
  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.');
653
514
  };
654
-
655
515
  class_4.prototype.getAuthInstance = function () {
656
516
  if (window['gapi'] && window['gapi'].auth2) {
657
517
  return window['gapi'].auth2.getAuthInstance() || window['gapi'].auth2.init({
@@ -660,18 +520,14 @@ function () {
660
520
  scope: 'profile email openid'
661
521
  });
662
522
  }
663
-
664
523
  return null;
665
524
  };
666
-
667
525
  class_4.prototype.signInWithGoogle = function (event) {
668
526
  event.preventDefault();
669
527
  this.getAuthInstance().signIn().then(this.handleUser)["catch"](this.handleError);
670
528
  };
671
-
672
529
  class_4.prototype.render = function () {
673
530
  var _this = this;
674
-
675
531
  return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
676
532
  onClick: function onClick(event) {
677
533
  return _this.signInWithGoogle(event);
@@ -682,32 +538,23 @@ function () {
682
538
  src: "https://apis.google.com/js/api:client.js"
683
539
  }), _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_GOOGLE));
684
540
  };
685
-
686
541
  return class_4;
687
542
  }();
688
-
689
- var AmplifyOAuthButton =
690
- /** @class */
691
- function () {
543
+ var AmplifyOAuthButton = /** @class */function () {
692
544
  function AmplifyOAuthButton(hostRef) {
693
545
  Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
694
546
  /** Federated credentials & configuration. */
695
-
696
547
  this.config = {};
697
548
  }
698
-
699
549
  AmplifyOAuthButton.prototype.signInWithOAuth = function (event) {
700
550
  event.preventDefault();
701
551
  _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn();
702
552
  };
703
-
704
553
  AmplifyOAuthButton.prototype.componentWillLoad = function () {
705
554
  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.');
706
555
  };
707
-
708
556
  AmplifyOAuthButton.prototype.render = function () {
709
557
  var _this = this;
710
-
711
558
  return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
712
559
  onClick: function onClick(event) {
713
560
  return _this.signInWithOAuth(event);
@@ -715,12 +562,10 @@ function () {
715
562
  provider: "oauth"
716
563
  }, this.config.label || _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_AWS));
717
564
  };
718
-
719
565
  return AmplifyOAuthButton;
720
566
  }();
721
567
 
722
568
 
723
-
724
569
  /***/ })
725
570
 
726
571
  }]);