@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
@@ -1,4 +1,4 @@
1
- export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-81005f8a.js';
1
+ export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-95f20717.js';
2
2
  import 'tslib';
3
3
  import '@firebase/util';
4
4
  import '@firebase/app';
@@ -1,5 +1,5 @@
1
- import { ap as _isAndroid, aq as _isIOS7Or8, ar as _isIOS, as as _fail, at as _getRedirectUrl, au as debugAssert, av as _getProjectConfig, aw as _createError, ax as _assert, ay as AuthEventManager, az as _getInstance, b as browserLocalPersistence, aA as _persistenceKeyName, aB as _clearRedirectOutcomes, a as browserSessionPersistence, aC as _getRedirectResult, aD as _overrideRedirectResult, aE as _castAuth } from './index-81005f8a.js';
2
- export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, aG as AuthImpl, aJ as AuthPopup, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, aK as FetchProvider, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aL as SAMLAuthCredential, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, aF as UserImpl, ax as _assert, aE as _castAuth, as as _fail, aI as _generateEventId, aH as _getClientVersion, az as _getInstance, aC as _getRedirectResult, aD as _overrideRedirectResult, aA as _persistenceKeyName, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-81005f8a.js';
1
+ import { ap as _isAndroid, aq as _isIOS7Or8, ar as _isIOS, as as _fail, at as _getRedirectUrl, au as debugAssert, av as _getProjectConfig, aw as _createError, ax as _assert, ay as AuthEventManager, az as _getInstance, b as browserLocalPersistence, aA as _persistenceKeyName, aB as _clearRedirectOutcomes, a as browserSessionPersistence, aC as _getRedirectResult, aD as _overrideRedirectResult, aE as _castAuth } from './index-95f20717.js';
2
+ export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, aG as AuthImpl, aJ as AuthPopup, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, aK as FetchProvider, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aL as SAMLAuthCredential, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, aF as UserImpl, ax as _assert, aE as _castAuth, as as _fail, aI as _generateEventId, aH as _getClientVersion, az as _getInstance, aC as _getRedirectResult, aD as _overrideRedirectResult, aA as _persistenceKeyName, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-95f20717.js';
3
3
  import { __awaiter, __generator, __extends } from 'tslib';
4
4
  import { querystringDecode } from '@firebase/util';
5
5
  import '@firebase/app';
@@ -133,7 +133,7 @@ export declare class PhoneAuthProvider {
133
133
  * auth.currentUser,
134
134
  * PhoneAuthProvider.credential(verificationId, code));
135
135
  * } catch (e) {
136
- * if (e.code === 'auth/account-exists-with-different-credential') {
136
+ * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') {
137
137
  * const cred = PhoneAuthProvider.credentialFromError(e);
138
138
  * await linkWithCredential(auth.currentUser, cred);
139
139
  * }
@@ -523,7 +523,7 @@ function _initializeAuthInstance(auth, deps) {
523
523
  }
524
524
 
525
525
  var name = "@firebase/auth";
526
- var version = "0.20.3";
526
+ var version = "0.20.4-20220621210445";
527
527
 
528
528
  /**
529
529
  * @license
@@ -1292,7 +1292,8 @@ function secondsStringToMilliseconds(seconds) {
1292
1292
  return Number(seconds) * 1000;
1293
1293
  }
1294
1294
  function _parseToken(token) {
1295
- var _a = token.split('.'), algorithm = _a[0], payload = _a[1], signature = _a[2];
1295
+ var _a;
1296
+ var _b = token.split('.'), algorithm = _b[0], payload = _b[1], signature = _b[2];
1296
1297
  if (algorithm === undefined ||
1297
1298
  payload === undefined ||
1298
1299
  signature === undefined) {
@@ -1308,7 +1309,7 @@ function _parseToken(token) {
1308
1309
  return JSON.parse(decoded);
1309
1310
  }
1310
1311
  catch (e) {
1311
- _logError('Caught error parsing JWT payload as JSON', e);
1312
+ _logError('Caught error parsing JWT payload as JSON', (_a = e) === null || _a === void 0 ? void 0 : _a.toString());
1312
1313
  return null;
1313
1314
  }
1314
1315
  }
@@ -1452,20 +1453,21 @@ var ProactiveRefresh = /** @class */ (function () {
1452
1453
  }); }, interval);
1453
1454
  };
1454
1455
  ProactiveRefresh.prototype.iteration = function () {
1456
+ var _a;
1455
1457
  return __awaiter(this, void 0, void 0, function () {
1456
1458
  var e_1;
1457
- return __generator(this, function (_a) {
1458
- switch (_a.label) {
1459
+ return __generator(this, function (_b) {
1460
+ switch (_b.label) {
1459
1461
  case 0:
1460
- _a.trys.push([0, 2, , 3]);
1462
+ _b.trys.push([0, 2, , 3]);
1461
1463
  return [4 /*yield*/, this.user.getIdToken(true)];
1462
1464
  case 1:
1463
- _a.sent();
1465
+ _b.sent();
1464
1466
  return [3 /*break*/, 3];
1465
1467
  case 2:
1466
- e_1 = _a.sent();
1468
+ e_1 = _b.sent();
1467
1469
  // Only retry on network errors
1468
- if (e_1.code === "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
1470
+ if (((_a = e_1) === null || _a === void 0 ? void 0 : _a.code) === "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
1469
1471
  this.schedule(/* wasError */ true);
1470
1472
  }
1471
1473
  return [2 /*return*/];
@@ -2670,19 +2672,20 @@ var AuthImpl = /** @class */ (function () {
2670
2672
  });
2671
2673
  };
2672
2674
  AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
2675
+ var _a;
2673
2676
  return __awaiter(this, void 0, void 0, function () {
2674
2677
  var e_4;
2675
- return __generator(this, function (_a) {
2676
- switch (_a.label) {
2678
+ return __generator(this, function (_b) {
2679
+ switch (_b.label) {
2677
2680
  case 0:
2678
- _a.trys.push([0, 2, , 3]);
2681
+ _b.trys.push([0, 2, , 3]);
2679
2682
  return [4 /*yield*/, _reloadWithoutSaving(user)];
2680
2683
  case 1:
2681
- _a.sent();
2684
+ _b.sent();
2682
2685
  return [3 /*break*/, 3];
2683
2686
  case 2:
2684
- e_4 = _a.sent();
2685
- if (e_4.code !== "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
2687
+ e_4 = _b.sent();
2688
+ if (((_a = e_4) === null || _a === void 0 ? void 0 : _a.code) !== "auth/" + "network-request-failed" /* NETWORK_REQUEST_FAILED */) {
2686
2689
  // Something's wrong with the user's token. Log them out and remove
2687
2690
  // them from storage
2688
2691
  return [2 /*return*/, this.directlySetCurrentUser(null)];
@@ -6463,20 +6466,21 @@ function _assertLinkedStatus(expected, user, provider) {
6463
6466
  * limitations under the License.
6464
6467
  */
6465
6468
  function _reauthenticate(user, credential, bypassAuthState) {
6469
+ var _a;
6466
6470
  if (bypassAuthState === void 0) { bypassAuthState = false; }
6467
6471
  return __awaiter(this, void 0, void 0, function () {
6468
6472
  var auth, operationType, response, parsed, localId, e_1;
6469
- return __generator(this, function (_a) {
6470
- switch (_a.label) {
6473
+ return __generator(this, function (_b) {
6474
+ switch (_b.label) {
6471
6475
  case 0:
6472
6476
  auth = user.auth;
6473
6477
  operationType = "reauthenticate" /* REAUTHENTICATE */;
6474
- _a.label = 1;
6478
+ _b.label = 1;
6475
6479
  case 1:
6476
- _a.trys.push([1, 3, , 4]);
6480
+ _b.trys.push([1, 3, , 4]);
6477
6481
  return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
6478
6482
  case 2:
6479
- response = _a.sent();
6483
+ response = _b.sent();
6480
6484
  _assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
6481
6485
  parsed = _parseToken(response.idToken);
6482
6486
  _assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
@@ -6484,9 +6488,9 @@ function _reauthenticate(user, credential, bypassAuthState) {
6484
6488
  _assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
6485
6489
  return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
6486
6490
  case 3:
6487
- e_1 = _a.sent();
6491
+ e_1 = _b.sent();
6488
6492
  // Convert user deleted error into user mismatch
6489
- if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) === "auth/" + "user-not-found" /* USER_DELETED */) {
6493
+ if (((_a = e_1) === null || _a === void 0 ? void 0 : _a.code) === "auth/" + "user-not-found" /* USER_DELETED */) {
6490
6494
  _fail(auth, "user-mismatch" /* USER_MISMATCH */);
6491
6495
  }
6492
6496
  throw e_1;
@@ -8006,21 +8010,22 @@ var MultiFactorUserImpl = /** @class */ (function () {
8006
8010
  });
8007
8011
  };
8008
8012
  MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
8013
+ var _a;
8009
8014
  return __awaiter(this, void 0, void 0, function () {
8010
8015
  var mfaEnrollmentId, idToken, idTokenResponse, e_1;
8011
- return __generator(this, function (_a) {
8012
- switch (_a.label) {
8016
+ return __generator(this, function (_b) {
8017
+ switch (_b.label) {
8013
8018
  case 0:
8014
8019
  mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
8015
8020
  return [4 /*yield*/, this.user.getIdToken()];
8016
8021
  case 1:
8017
- idToken = _a.sent();
8022
+ idToken = _b.sent();
8018
8023
  return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
8019
8024
  idToken: idToken,
8020
8025
  mfaEnrollmentId: mfaEnrollmentId
8021
8026
  }))];
8022
8027
  case 2:
8023
- idTokenResponse = _a.sent();
8028
+ idTokenResponse = _b.sent();
8024
8029
  // Remove the second factor from the user's list.
8025
8030
  this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
8026
8031
  var uid = _a.uid;
@@ -8036,17 +8041,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
8036
8041
  // the tokenResponse may be empty. If the tokens were not updated (and they
8037
8042
  // are now invalid), reloading the user will discover this and invalidate
8038
8043
  // the user's state accordingly.
8039
- _a.sent();
8040
- _a.label = 4;
8044
+ _b.sent();
8045
+ _b.label = 4;
8041
8046
  case 4:
8042
- _a.trys.push([4, 6, , 7]);
8047
+ _b.trys.push([4, 6, , 7]);
8043
8048
  return [4 /*yield*/, this.user.reload()];
8044
8049
  case 5:
8045
- _a.sent();
8050
+ _b.sent();
8046
8051
  return [3 /*break*/, 7];
8047
8052
  case 6:
8048
- e_1 = _a.sent();
8049
- if (e_1.code !== "auth/" + "user-token-expired" /* TOKEN_EXPIRED */) {
8053
+ e_1 = _b.sent();
8054
+ if (((_a = e_1) === null || _a === void 0 ? void 0 : _a.code) !== "auth/" + "user-token-expired" /* TOKEN_EXPIRED */) {
8050
8055
  throw e_1;
8051
8056
  }
8052
8057
  return [3 /*break*/, 7];