@firebase/auth 0.20.3 → 0.20.4-canary.69e2ee064

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 +8 -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-cef46317.js} +40 -34
  8. package/dist/cordova/popup_redirect-cef46317.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-4e4ecfae.js} +15 -9
  11. package/dist/esm2017/index-4e4ecfae.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-0c90d444.js} +41 -35
  16. package/dist/esm5/index-0c90d444.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-1efe9231.js} +40 -34
  23. package/dist/node/index-1efe9231.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-12b5c7c8.js} +14 -8
  28. package/dist/node-esm/index-12b5c7c8.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-679bf220.js} +41 -35
  35. package/dist/rn/phone-679bf220.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 +6 -6
  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*/];
@@ -2402,7 +2404,8 @@ function _isWebOS(ua) {
2402
2404
  }
2403
2405
  function _isIOS(ua) {
2404
2406
  if (ua === void 0) { ua = util.getUA(); }
2405
- return /iphone|ipad|ipod/i.test(ua);
2407
+ return /iphone|ipad|ipod/i.test(ua) ||
2408
+ (/macintosh/i.test(ua) && /mobile/i.test(ua));
2406
2409
  }
2407
2410
  function _isIOS7Or8(ua) {
2408
2411
  if (ua === void 0) { ua = util.getUA(); }
@@ -2820,19 +2823,20 @@ var AuthImpl = /** @class */ (function () {
2820
2823
  });
2821
2824
  };
2822
2825
  AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
2826
+ var _a;
2823
2827
  return tslib.__awaiter(this, void 0, void 0, function () {
2824
2828
  var e_4;
2825
- return tslib.__generator(this, function (_a) {
2826
- switch (_a.label) {
2829
+ return tslib.__generator(this, function (_b) {
2830
+ switch (_b.label) {
2827
2831
  case 0:
2828
- _a.trys.push([0, 2, , 3]);
2832
+ _b.trys.push([0, 2, , 3]);
2829
2833
  return [4 /*yield*/, _reloadWithoutSaving(user)];
2830
2834
  case 1:
2831
- _a.sent();
2835
+ _b.sent();
2832
2836
  return [3 /*break*/, 3];
2833
2837
  case 2:
2834
- e_4 = _a.sent();
2835
- if (e_4.code !== "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
2838
+ e_4 = _b.sent();
2839
+ if (((_a = e_4) === null || _a === void 0 ? void 0 : _a.code) !== "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
2836
2840
  // Something's wrong with the user's token. Log them out and remove
2837
2841
  // them from storage
2838
2842
  return [2 /*return*/, this.directlySetCurrentUser(null)];
@@ -5442,20 +5446,21 @@ function _assertLinkedStatus(expected, user, provider) {
5442
5446
  * limitations under the License.
5443
5447
  */
5444
5448
  function _reauthenticate(user, credential, bypassAuthState) {
5449
+ var _a;
5445
5450
  if (bypassAuthState === void 0) { bypassAuthState = false; }
5446
5451
  return tslib.__awaiter(this, void 0, void 0, function () {
5447
5452
  var auth, operationType, response, parsed, localId, e_1;
5448
- return tslib.__generator(this, function (_a) {
5449
- switch (_a.label) {
5453
+ return tslib.__generator(this, function (_b) {
5454
+ switch (_b.label) {
5450
5455
  case 0:
5451
5456
  auth = user.auth;
5452
5457
  operationType = "reauthenticate" /* REAUTHENTICATE */;
5453
- _a.label = 1;
5458
+ _b.label = 1;
5454
5459
  case 1:
5455
- _a.trys.push([1, 3, , 4]);
5460
+ _b.trys.push([1, 3, , 4]);
5456
5461
  return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
5457
5462
  case 2:
5458
- response = _a.sent();
5463
+ response = _b.sent();
5459
5464
  _assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
5460
5465
  parsed = _parseToken(response.idToken);
5461
5466
  _assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
@@ -5463,9 +5468,9 @@ function _reauthenticate(user, credential, bypassAuthState) {
5463
5468
  _assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
5464
5469
  return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
5465
5470
  case 3:
5466
- e_1 = _a.sent();
5471
+ e_1 = _b.sent();
5467
5472
  // 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 */) {
5473
+ if (((_a = e_1) === null || _a === void 0 ? void 0 : _a.code) === "auth/" + "user-not-found" /* USER_DELETED */) {
5469
5474
  _fail(auth, "user-mismatch" /* USER_MISMATCH */);
5470
5475
  }
5471
5476
  throw e_1;
@@ -6985,21 +6990,22 @@ var MultiFactorUserImpl = /** @class */ (function () {
6985
6990
  });
6986
6991
  };
6987
6992
  MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
6993
+ var _a;
6988
6994
  return tslib.__awaiter(this, void 0, void 0, function () {
6989
6995
  var mfaEnrollmentId, idToken, idTokenResponse, e_1;
6990
- return tslib.__generator(this, function (_a) {
6991
- switch (_a.label) {
6996
+ return tslib.__generator(this, function (_b) {
6997
+ switch (_b.label) {
6992
6998
  case 0:
6993
6999
  mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
6994
7000
  return [4 /*yield*/, this.user.getIdToken()];
6995
7001
  case 1:
6996
- idToken = _a.sent();
7002
+ idToken = _b.sent();
6997
7003
  return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
6998
7004
  idToken: idToken,
6999
7005
  mfaEnrollmentId: mfaEnrollmentId
7000
7006
  }))];
7001
7007
  case 2:
7002
- idTokenResponse = _a.sent();
7008
+ idTokenResponse = _b.sent();
7003
7009
  // Remove the second factor from the user's list.
7004
7010
  this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
7005
7011
  var uid = _a.uid;
@@ -7015,17 +7021,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
7015
7021
  // the tokenResponse may be empty. If the tokens were not updated (and they
7016
7022
  // are now invalid), reloading the user will discover this and invalidate
7017
7023
  // the user's state accordingly.
7018
- _a.sent();
7019
- _a.label = 4;
7024
+ _b.sent();
7025
+ _b.label = 4;
7020
7026
  case 4:
7021
- _a.trys.push([4, 6, , 7]);
7027
+ _b.trys.push([4, 6, , 7]);
7022
7028
  return [4 /*yield*/, this.user.reload()];
7023
7029
  case 5:
7024
- _a.sent();
7030
+ _b.sent();
7025
7031
  return [3 /*break*/, 7];
7026
7032
  case 6:
7027
- e_1 = _a.sent();
7028
- if (e_1.code !== "auth/" + "user-token-expired" /* TOKEN_EXPIRED */) {
7033
+ e_1 = _b.sent();
7034
+ if (((_a = e_1) === null || _a === void 0 ? void 0 : _a.code) !== "auth/" + "user-token-expired" /* TOKEN_EXPIRED */) {
7029
7035
  throw e_1;
7030
7036
  }
7031
7037
  return [3 /*break*/, 7];
@@ -7056,7 +7062,7 @@ function multiFactor(user) {
7056
7062
  }
7057
7063
 
7058
7064
  var name = "@firebase/auth";
7059
- var version = "0.20.3";
7065
+ var version = "0.20.4-canary.69e2ee064";
7060
7066
 
7061
7067
  /**
7062
7068
  * @license
@@ -7413,4 +7419,4 @@ exports.updateProfile = updateProfile;
7413
7419
  exports.useDeviceLanguage = useDeviceLanguage;
7414
7420
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
7415
7421
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
7416
- //# sourceMappingURL=index-007f80f6.js.map
7422
+ //# sourceMappingURL=index-1efe9231.js.map