@firebase/auth 0.20.3 → 0.20.4-20220621210445

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 +9 -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-9ed330a1.js → popup_redirect-afabf63c.js} +38 -33
  8. package/dist/cordova/popup_redirect-afabf63c.js.map +1 -0
  9. package/dist/cordova/src/platform_browser/providers/phone.d.ts +1 -1
  10. package/dist/esm2017/{index-69ab4e3a.js → index-9e3ee486.js} +13 -8
  11. package/dist/esm2017/index-9e3ee486.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-81005f8a.js → index-95f20717.js} +39 -34
  16. package/dist/esm5/index-95f20717.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 +37 -32
  21. package/dist/index.webworker.esm5.js.map +1 -1
  22. package/dist/node/{index-007f80f6.js → index-26342bb1.js} +38 -33
  23. package/dist/node/index-26342bb1.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-b1f59f63.js → index-6f071fc8.js} +12 -7
  28. package/dist/node-esm/index-6f071fc8.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-d791a05d.js → phone-d23325d1.js} +39 -34
  35. package/dist/rn/phone-d23325d1.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 +5 -5
  39. package/dist/cordova/popup_redirect-9ed330a1.js.map +0 -1
  40. package/dist/esm2017/index-69ab4e3a.js.map +0 -1
  41. package/dist/esm5/index-81005f8a.js.map +0 -1
  42. package/dist/node/index-007f80f6.js.map +0 -1
  43. package/dist/node-esm/index-b1f59f63.js.map +0 -1
  44. package/dist/rn/phone-d791a05d.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*/];
@@ -2820,19 +2822,20 @@ var AuthImpl = /** @class */ (function () {
2820
2822
  });
2821
2823
  };
2822
2824
  AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
2825
+ var _a;
2823
2826
  return tslib.__awaiter(this, void 0, void 0, function () {
2824
2827
  var e_4;
2825
- return tslib.__generator(this, function (_a) {
2826
- switch (_a.label) {
2828
+ return tslib.__generator(this, function (_b) {
2829
+ switch (_b.label) {
2827
2830
  case 0:
2828
- _a.trys.push([0, 2, , 3]);
2831
+ _b.trys.push([0, 2, , 3]);
2829
2832
  return [4 /*yield*/, _reloadWithoutSaving(user)];
2830
2833
  case 1:
2831
- _a.sent();
2834
+ _b.sent();
2832
2835
  return [3 /*break*/, 3];
2833
2836
  case 2:
2834
- e_4 = _a.sent();
2835
- 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 */) {
2836
2839
  // Something's wrong with the user's token. Log them out and remove
2837
2840
  // them from storage
2838
2841
  return [2 /*return*/, this.directlySetCurrentUser(null)];
@@ -5442,20 +5445,21 @@ function _assertLinkedStatus(expected, user, provider) {
5442
5445
  * limitations under the License.
5443
5446
  */
5444
5447
  function _reauthenticate(user, credential, bypassAuthState) {
5448
+ var _a;
5445
5449
  if (bypassAuthState === void 0) { bypassAuthState = false; }
5446
5450
  return tslib.__awaiter(this, void 0, void 0, function () {
5447
5451
  var auth, operationType, response, parsed, localId, e_1;
5448
- return tslib.__generator(this, function (_a) {
5449
- switch (_a.label) {
5452
+ return tslib.__generator(this, function (_b) {
5453
+ switch (_b.label) {
5450
5454
  case 0:
5451
5455
  auth = user.auth;
5452
5456
  operationType = "reauthenticate" /* REAUTHENTICATE */;
5453
- _a.label = 1;
5457
+ _b.label = 1;
5454
5458
  case 1:
5455
- _a.trys.push([1, 3, , 4]);
5459
+ _b.trys.push([1, 3, , 4]);
5456
5460
  return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
5457
5461
  case 2:
5458
- response = _a.sent();
5462
+ response = _b.sent();
5459
5463
  _assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
5460
5464
  parsed = _parseToken(response.idToken);
5461
5465
  _assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
@@ -5463,9 +5467,9 @@ function _reauthenticate(user, credential, bypassAuthState) {
5463
5467
  _assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
5464
5468
  return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
5465
5469
  case 3:
5466
- e_1 = _a.sent();
5470
+ e_1 = _b.sent();
5467
5471
  // Convert user deleted error into user mismatch
5468
- 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 */) {
5469
5473
  _fail(auth, "user-mismatch" /* USER_MISMATCH */);
5470
5474
  }
5471
5475
  throw e_1;
@@ -6985,21 +6989,22 @@ var MultiFactorUserImpl = /** @class */ (function () {
6985
6989
  });
6986
6990
  };
6987
6991
  MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
6992
+ var _a;
6988
6993
  return tslib.__awaiter(this, void 0, void 0, function () {
6989
6994
  var mfaEnrollmentId, idToken, idTokenResponse, e_1;
6990
- return tslib.__generator(this, function (_a) {
6991
- switch (_a.label) {
6995
+ return tslib.__generator(this, function (_b) {
6996
+ switch (_b.label) {
6992
6997
  case 0:
6993
6998
  mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
6994
6999
  return [4 /*yield*/, this.user.getIdToken()];
6995
7000
  case 1:
6996
- idToken = _a.sent();
7001
+ idToken = _b.sent();
6997
7002
  return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
6998
7003
  idToken: idToken,
6999
7004
  mfaEnrollmentId: mfaEnrollmentId
7000
7005
  }))];
7001
7006
  case 2:
7002
- idTokenResponse = _a.sent();
7007
+ idTokenResponse = _b.sent();
7003
7008
  // Remove the second factor from the user's list.
7004
7009
  this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
7005
7010
  var uid = _a.uid;
@@ -7015,17 +7020,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
7015
7020
  // the tokenResponse may be empty. If the tokens were not updated (and they
7016
7021
  // are now invalid), reloading the user will discover this and invalidate
7017
7022
  // the user's state accordingly.
7018
- _a.sent();
7019
- _a.label = 4;
7023
+ _b.sent();
7024
+ _b.label = 4;
7020
7025
  case 4:
7021
- _a.trys.push([4, 6, , 7]);
7026
+ _b.trys.push([4, 6, , 7]);
7022
7027
  return [4 /*yield*/, this.user.reload()];
7023
7028
  case 5:
7024
- _a.sent();
7029
+ _b.sent();
7025
7030
  return [3 /*break*/, 7];
7026
7031
  case 6:
7027
- e_1 = _a.sent();
7028
- 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 */) {
7029
7034
  throw e_1;
7030
7035
  }
7031
7036
  return [3 /*break*/, 7];
@@ -7056,7 +7061,7 @@ function multiFactor(user) {
7056
7061
  }
7057
7062
 
7058
7063
  var name = "@firebase/auth";
7059
- var version = "0.20.3";
7064
+ var version = "0.20.4-20220621210445";
7060
7065
 
7061
7066
  /**
7062
7067
  * @license
@@ -7413,4 +7418,4 @@ exports.updateProfile = updateProfile;
7413
7418
  exports.useDeviceLanguage = useDeviceLanguage;
7414
7419
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
7415
7420
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
7416
- //# sourceMappingURL=index-007f80f6.js.map
7421
+ //# sourceMappingURL=index-26342bb1.js.map