@firebase/auth 0.20.2 → 0.20.3-canary.8e952e2ee

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 (44) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/auth-public.d.ts +1 -1
  3. package/dist/auth.d.ts +1 -1
  4. package/dist/cordova/index.js +2 -2
  5. package/dist/cordova/internal.js +3 -3
  6. package/dist/cordova/internal.js.map +1 -1
  7. package/dist/cordova/{popup_redirect-e449cb08.js → popup_redirect-4884fc1f.js} +54 -48
  8. package/dist/cordova/popup_redirect-4884fc1f.js.map +1 -0
  9. package/dist/cordova/src/platform_browser/providers/phone.d.ts +1 -1
  10. package/dist/esm2017/{index-ccf9d100.js → index-73de905c.js} +15 -9
  11. package/dist/esm2017/index-73de905c.js.map +1 -0
  12. package/dist/esm2017/index.js +1 -1
  13. package/dist/esm2017/internal.js +2 -2
  14. package/dist/esm2017/src/platform_browser/providers/phone.d.ts +1 -1
  15. package/dist/esm5/{index-ea3c621a.js → index-34ff6623.js} +55 -49
  16. package/dist/esm5/index-34ff6623.js.map +1 -0
  17. package/dist/esm5/index.js +1 -1
  18. package/dist/esm5/internal.js +2 -2
  19. package/dist/esm5/src/platform_browser/providers/phone.d.ts +1 -1
  20. package/dist/index.webworker.esm5.js +53 -47
  21. package/dist/index.webworker.esm5.js.map +1 -1
  22. package/dist/node/{index-cc504aa1.js → index-845bb23f.js} +54 -48
  23. package/dist/node/index-845bb23f.js.map +1 -0
  24. package/dist/node/index.js +1 -1
  25. package/dist/node/internal.js +1 -1
  26. package/dist/node/src/platform_browser/providers/phone.d.ts +1 -1
  27. package/dist/node-esm/{index-14ee511d.js → index-20c7e2dd.js} +14 -8
  28. package/dist/node-esm/index-20c7e2dd.js.map +1 -0
  29. package/dist/node-esm/index.js +1 -1
  30. package/dist/node-esm/internal.js +2 -2
  31. package/dist/node-esm/src/platform_browser/providers/phone.d.ts +1 -1
  32. package/dist/rn/index.js +1 -1
  33. package/dist/rn/internal.js +1 -1
  34. package/dist/rn/{phone-dd9c6425.js → phone-cb586eb5.js} +55 -49
  35. package/dist/rn/phone-cb586eb5.js.map +1 -0
  36. package/dist/rn/src/platform_browser/providers/phone.d.ts +1 -1
  37. package/dist/src/platform_browser/providers/phone.d.ts +1 -1
  38. package/package.json +39 -14
  39. package/dist/cordova/popup_redirect-e449cb08.js.map +0 -1
  40. package/dist/esm2017/index-ccf9d100.js.map +0 -1
  41. package/dist/esm5/index-ea3c621a.js.map +0 -1
  42. package/dist/node/index-cc504aa1.js.map +0 -1
  43. package/dist/node-esm/index-14ee511d.js.map +0 -1
  44. package/dist/rn/phone-dd9c6425.js.map +0 -1
@@ -1266,7 +1266,8 @@ function secondsStringToMilliseconds(seconds) {
1266
1266
  return Number(seconds) * 1000;
1267
1267
  }
1268
1268
  function _parseToken(token) {
1269
- var _a = token.split('.'), algorithm = _a[0], payload = _a[1], signature = _a[2];
1269
+ var _a;
1270
+ var _b = token.split('.'), algorithm = _b[0], payload = _b[1], signature = _b[2];
1270
1271
  if (algorithm === undefined ||
1271
1272
  payload === undefined ||
1272
1273
  signature === undefined) {
@@ -1282,7 +1283,7 @@ function _parseToken(token) {
1282
1283
  return JSON.parse(decoded);
1283
1284
  }
1284
1285
  catch (e) {
1285
- _logError('Caught error parsing JWT payload as JSON', e);
1286
+ _logError('Caught error parsing JWT payload as JSON', (_a = e) === null || _a === void 0 ? void 0 : _a.toString());
1286
1287
  return null;
1287
1288
  }
1288
1289
  }
@@ -1426,20 +1427,21 @@ var ProactiveRefresh = /** @class */ (function () {
1426
1427
  }); }, interval);
1427
1428
  };
1428
1429
  ProactiveRefresh.prototype.iteration = function () {
1430
+ var _a;
1429
1431
  return tslib.__awaiter(this, void 0, void 0, function () {
1430
1432
  var e_1;
1431
- return tslib.__generator(this, function (_a) {
1432
- switch (_a.label) {
1433
+ return tslib.__generator(this, function (_b) {
1434
+ switch (_b.label) {
1433
1435
  case 0:
1434
- _a.trys.push([0, 2, , 3]);
1436
+ _b.trys.push([0, 2, , 3]);
1435
1437
  return [4 /*yield*/, this.user.getIdToken(true)];
1436
1438
  case 1:
1437
- _a.sent();
1439
+ _b.sent();
1438
1440
  return [3 /*break*/, 3];
1439
1441
  case 2:
1440
- e_1 = _a.sent();
1442
+ e_1 = _b.sent();
1441
1443
  // Only retry on network errors
1442
- if (e_1.code === "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
1444
+ if (((_a = e_1) === null || _a === void 0 ? void 0 : _a.code) === "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
1443
1445
  this.schedule(/* wasError */ true);
1444
1446
  }
1445
1447
  return [2 /*return*/];
@@ -2523,48 +2525,49 @@ var AuthMiddlewareQueue = /** @class */ (function () {
2523
2525
  };
2524
2526
  };
2525
2527
  AuthMiddlewareQueue.prototype.runMiddleware = function (nextUser) {
2528
+ var _a;
2526
2529
  return tslib.__awaiter(this, void 0, void 0, function () {
2527
- var onAbortStack, _i, _a, beforeStateCallback, e_1, _b, onAbortStack_1, onAbort;
2528
- return tslib.__generator(this, function (_c) {
2529
- switch (_c.label) {
2530
+ var onAbortStack, _i, _b, beforeStateCallback, e_1, _c, onAbortStack_1, onAbort;
2531
+ return tslib.__generator(this, function (_d) {
2532
+ switch (_d.label) {
2530
2533
  case 0:
2531
2534
  if (this.auth.currentUser === nextUser) {
2532
2535
  return [2 /*return*/];
2533
2536
  }
2534
2537
  onAbortStack = [];
2535
- _c.label = 1;
2538
+ _d.label = 1;
2536
2539
  case 1:
2537
- _c.trys.push([1, 6, , 7]);
2538
- _i = 0, _a = this.queue;
2539
- _c.label = 2;
2540
+ _d.trys.push([1, 6, , 7]);
2541
+ _i = 0, _b = this.queue;
2542
+ _d.label = 2;
2540
2543
  case 2:
2541
- if (!(_i < _a.length)) return [3 /*break*/, 5];
2542
- beforeStateCallback = _a[_i];
2544
+ if (!(_i < _b.length)) return [3 /*break*/, 5];
2545
+ beforeStateCallback = _b[_i];
2543
2546
  return [4 /*yield*/, beforeStateCallback(nextUser)];
2544
2547
  case 3:
2545
- _c.sent();
2548
+ _d.sent();
2546
2549
  // Only push the onAbort if the callback succeeds
2547
2550
  if (beforeStateCallback.onAbort) {
2548
2551
  onAbortStack.push(beforeStateCallback.onAbort);
2549
2552
  }
2550
- _c.label = 4;
2553
+ _d.label = 4;
2551
2554
  case 4:
2552
2555
  _i++;
2553
2556
  return [3 /*break*/, 2];
2554
2557
  case 5: return [3 /*break*/, 7];
2555
2558
  case 6:
2556
- e_1 = _c.sent();
2559
+ e_1 = _d.sent();
2557
2560
  // Run all onAbort, with separate try/catch to ignore any errors and
2558
2561
  // continue
2559
2562
  onAbortStack.reverse();
2560
- for (_b = 0, onAbortStack_1 = onAbortStack; _b < onAbortStack_1.length; _b++) {
2561
- onAbort = onAbortStack_1[_b];
2563
+ for (_c = 0, onAbortStack_1 = onAbortStack; _c < onAbortStack_1.length; _c++) {
2564
+ onAbort = onAbortStack_1[_c];
2562
2565
  try {
2563
2566
  onAbort();
2564
2567
  }
2565
2568
  catch (_) { /* swallow error */ }
2566
2569
  }
2567
- throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, { originalMessage: e_1.message });
2570
+ throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, { originalMessage: (_a = e_1) === null || _a === void 0 ? void 0 : _a.message });
2568
2571
  case 7: return [2 /*return*/];
2569
2572
  }
2570
2573
  });
@@ -2819,19 +2822,20 @@ var AuthImpl = /** @class */ (function () {
2819
2822
  });
2820
2823
  };
2821
2824
  AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
2825
+ var _a;
2822
2826
  return tslib.__awaiter(this, void 0, void 0, function () {
2823
2827
  var e_4;
2824
- return tslib.__generator(this, function (_a) {
2825
- switch (_a.label) {
2828
+ return tslib.__generator(this, function (_b) {
2829
+ switch (_b.label) {
2826
2830
  case 0:
2827
- _a.trys.push([0, 2, , 3]);
2831
+ _b.trys.push([0, 2, , 3]);
2828
2832
  return [4 /*yield*/, _reloadWithoutSaving(user)];
2829
2833
  case 1:
2830
- _a.sent();
2834
+ _b.sent();
2831
2835
  return [3 /*break*/, 3];
2832
2836
  case 2:
2833
- e_4 = _a.sent();
2834
- if (e_4.code !== "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
2837
+ e_4 = _b.sent();
2838
+ if (((_a = e_4) === null || _a === void 0 ? void 0 : _a.code) !== "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
2835
2839
  // Something's wrong with the user's token. Log them out and remove
2836
2840
  // them from storage
2837
2841
  return [2 /*return*/, this.directlySetCurrentUser(null)];
@@ -5441,20 +5445,21 @@ function _assertLinkedStatus(expected, user, provider) {
5441
5445
  * limitations under the License.
5442
5446
  */
5443
5447
  function _reauthenticate(user, credential, bypassAuthState) {
5448
+ var _a;
5444
5449
  if (bypassAuthState === void 0) { bypassAuthState = false; }
5445
5450
  return tslib.__awaiter(this, void 0, void 0, function () {
5446
5451
  var auth, operationType, response, parsed, localId, e_1;
5447
- return tslib.__generator(this, function (_a) {
5448
- switch (_a.label) {
5452
+ return tslib.__generator(this, function (_b) {
5453
+ switch (_b.label) {
5449
5454
  case 0:
5450
5455
  auth = user.auth;
5451
5456
  operationType = "reauthenticate" /* REAUTHENTICATE */;
5452
- _a.label = 1;
5457
+ _b.label = 1;
5453
5458
  case 1:
5454
- _a.trys.push([1, 3, , 4]);
5459
+ _b.trys.push([1, 3, , 4]);
5455
5460
  return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
5456
5461
  case 2:
5457
- response = _a.sent();
5462
+ response = _b.sent();
5458
5463
  _assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
5459
5464
  parsed = _parseToken(response.idToken);
5460
5465
  _assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
@@ -5462,9 +5467,9 @@ function _reauthenticate(user, credential, bypassAuthState) {
5462
5467
  _assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
5463
5468
  return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
5464
5469
  case 3:
5465
- e_1 = _a.sent();
5470
+ e_1 = _b.sent();
5466
5471
  // Convert user deleted error into user mismatch
5467
- if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) === "auth/" + "user-not-found" /* USER_DELETED */) {
5472
+ if (((_a = e_1) === null || _a === void 0 ? void 0 : _a.code) === "auth/" + "user-not-found" /* USER_DELETED */) {
5468
5473
  _fail(auth, "user-mismatch" /* USER_MISMATCH */);
5469
5474
  }
5470
5475
  throw e_1;
@@ -6984,21 +6989,22 @@ var MultiFactorUserImpl = /** @class */ (function () {
6984
6989
  });
6985
6990
  };
6986
6991
  MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
6992
+ var _a;
6987
6993
  return tslib.__awaiter(this, void 0, void 0, function () {
6988
6994
  var mfaEnrollmentId, idToken, idTokenResponse, e_1;
6989
- return tslib.__generator(this, function (_a) {
6990
- switch (_a.label) {
6995
+ return tslib.__generator(this, function (_b) {
6996
+ switch (_b.label) {
6991
6997
  case 0:
6992
6998
  mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
6993
6999
  return [4 /*yield*/, this.user.getIdToken()];
6994
7000
  case 1:
6995
- idToken = _a.sent();
7001
+ idToken = _b.sent();
6996
7002
  return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
6997
7003
  idToken: idToken,
6998
7004
  mfaEnrollmentId: mfaEnrollmentId
6999
7005
  }))];
7000
7006
  case 2:
7001
- idTokenResponse = _a.sent();
7007
+ idTokenResponse = _b.sent();
7002
7008
  // Remove the second factor from the user's list.
7003
7009
  this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
7004
7010
  var uid = _a.uid;
@@ -7014,17 +7020,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
7014
7020
  // the tokenResponse may be empty. If the tokens were not updated (and they
7015
7021
  // are now invalid), reloading the user will discover this and invalidate
7016
7022
  // the user's state accordingly.
7017
- _a.sent();
7018
- _a.label = 4;
7023
+ _b.sent();
7024
+ _b.label = 4;
7019
7025
  case 4:
7020
- _a.trys.push([4, 6, , 7]);
7026
+ _b.trys.push([4, 6, , 7]);
7021
7027
  return [4 /*yield*/, this.user.reload()];
7022
7028
  case 5:
7023
- _a.sent();
7029
+ _b.sent();
7024
7030
  return [3 /*break*/, 7];
7025
7031
  case 6:
7026
- e_1 = _a.sent();
7027
- if (e_1.code !== "auth/" + "user-token-expired" /* TOKEN_EXPIRED */) {
7032
+ e_1 = _b.sent();
7033
+ if (((_a = e_1) === null || _a === void 0 ? void 0 : _a.code) !== "auth/" + "user-token-expired" /* TOKEN_EXPIRED */) {
7028
7034
  throw e_1;
7029
7035
  }
7030
7036
  return [3 /*break*/, 7];
@@ -7055,7 +7061,7 @@ function multiFactor(user) {
7055
7061
  }
7056
7062
 
7057
7063
  var name = "@firebase/auth";
7058
- var version = "0.20.2";
7064
+ var version = "0.20.3-canary.8e952e2ee";
7059
7065
 
7060
7066
  /**
7061
7067
  * @license
@@ -7412,4 +7418,4 @@ exports.updateProfile = updateProfile;
7412
7418
  exports.useDeviceLanguage = useDeviceLanguage;
7413
7419
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
7414
7420
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
7415
- //# sourceMappingURL=index-cc504aa1.js.map
7421
+ //# sourceMappingURL=index-845bb23f.js.map