@firebase/auth 1.13.5 → 1.13.6

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 (62) hide show
  1. package/dist/auth-public.d.ts +4 -1
  2. package/dist/auth.d.ts +5 -1
  3. package/dist/browser-cjs/{index-DY73Er5u.js → index-DBOuNQej.js} +75 -24
  4. package/dist/browser-cjs/index-DBOuNQej.js.map +1 -0
  5. package/dist/browser-cjs/index.js +1 -1
  6. package/dist/browser-cjs/internal.js +1 -1
  7. package/dist/browser-cjs/src/core/user/account_info.d.ts +1 -1
  8. package/dist/cordova/auth-cordova-public.d.ts +4 -1
  9. package/dist/cordova/auth-cordova.d.ts +5 -1
  10. package/dist/cordova/index.js +2 -2
  11. package/dist/cordova/internal.js +2 -2
  12. package/dist/cordova/{popup_redirect-D_ZWtJhY.js → popup_redirect-CHQiJtfZ.js} +75 -24
  13. package/dist/cordova/popup_redirect-CHQiJtfZ.js.map +1 -0
  14. package/dist/cordova/src/core/user/account_info.d.ts +1 -1
  15. package/dist/cordova/tsdoc-metadata.json +1 -1
  16. package/dist/esm/{index-CvXU3_1x.js → index-4NFEPWkC.js} +75 -24
  17. package/dist/esm/index-4NFEPWkC.js.map +1 -0
  18. package/dist/esm/index.js +1 -1
  19. package/dist/esm/internal.js +2 -2
  20. package/dist/esm/src/core/user/account_info.d.ts +1 -1
  21. package/dist/index.webworker.js +74 -23
  22. package/dist/index.webworker.js.map +1 -1
  23. package/dist/node/index.js +1 -1
  24. package/dist/node/internal.js +1 -1
  25. package/dist/node/src/core/user/account_info.d.ts +1 -1
  26. package/dist/node/{totp-B19JzI52.js → totp-C8DKrPQi.js} +69 -16
  27. package/dist/node/totp-C8DKrPQi.js.map +1 -0
  28. package/dist/node-esm/index.js +1 -1
  29. package/dist/node-esm/internal.js +2 -2
  30. package/dist/node-esm/src/core/user/account_info.d.ts +1 -1
  31. package/dist/node-esm/{totp-C24pd8aS.js → totp-BU9AvxK8.js} +69 -16
  32. package/dist/node-esm/totp-BU9AvxK8.js.map +1 -0
  33. package/dist/rn/{index-CiDS6PaG.js → index-DSVEw5ju.js} +69 -16
  34. package/dist/rn/index-DSVEw5ju.js.map +1 -0
  35. package/dist/rn/index.js +1 -1
  36. package/dist/rn/internal.js +7 -9
  37. package/dist/rn/internal.js.map +1 -1
  38. package/dist/rn/src/core/user/account_info.d.ts +1 -1
  39. package/dist/src/core/user/account_info.d.ts +1 -1
  40. package/dist/tsdoc-metadata.json +1 -1
  41. package/dist/web-extension-cjs/index.js +1 -1
  42. package/dist/web-extension-cjs/internal.js +1 -1
  43. package/dist/web-extension-cjs/{register-dQ43sygv.js → register-eaUKtaNP.js} +75 -24
  44. package/dist/web-extension-cjs/register-eaUKtaNP.js.map +1 -0
  45. package/dist/web-extension-cjs/src/core/user/account_info.d.ts +1 -1
  46. package/dist/web-extension-esm/auth-web-extension-public.d.ts +1 -1
  47. package/dist/web-extension-esm/auth-web-extension.d.ts +1 -1
  48. package/dist/web-extension-esm/index.js +2 -2
  49. package/dist/web-extension-esm/internal.js +2 -2
  50. package/dist/web-extension-esm/{register-DN05P0kB.js → register-CPcgXhGD.js} +75 -24
  51. package/dist/web-extension-esm/register-CPcgXhGD.js.map +1 -0
  52. package/dist/web-extension-esm/src/core/user/account_info.d.ts +1 -1
  53. package/dist/web-extension-esm/tsdoc-metadata.json +1 -1
  54. package/package.json +3 -3
  55. package/dist/browser-cjs/index-DY73Er5u.js.map +0 -1
  56. package/dist/cordova/popup_redirect-D_ZWtJhY.js.map +0 -1
  57. package/dist/esm/index-CvXU3_1x.js.map +0 -1
  58. package/dist/node/totp-B19JzI52.js.map +0 -1
  59. package/dist/node-esm/totp-C24pd8aS.js.map +0 -1
  60. package/dist/rn/index-CiDS6PaG.js.map +0 -1
  61. package/dist/web-extension-cjs/register-dQ43sygv.js.map +0 -1
  62. package/dist/web-extension-esm/register-DN05P0kB.js.map +0 -1
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ActionCodeOperation, a as ActionCodeURL, b as AuthCredential, c as AuthErrorCodes, E as EmailAuthCredential, d as EmailAuthProvider, F as FacebookAuthProvider, e as FactorId, G as GithubAuthProvider, f as GoogleAuthProvider, O as OAuthCredential, g as OAuthProvider, h as OperationType, P as PhoneAuthCredential, i as PhoneAuthProvider, j as PhoneMultiFactorGenerator, k as ProviderId, R as RecaptchaVerifier, S as SAMLAuthProvider, l as SignInMethod, T as TotpMultiFactorGenerator, m as TotpSecret, n as TwitterAuthProvider, o as applyActionCode, p as beforeAuthStateChanged, q as browserCookiePersistence, r as browserLocalPersistence, s as browserPopupRedirectResolver, t as browserSessionPersistence, u as checkActionCode, v as confirmPasswordReset, w as connectAuthEmulator, x as createUserWithEmailAndPassword, y as debugErrorMap, z as deleteUser, B as fetchSignInMethodsForEmail, C as getAdditionalUserInfo, D as getAuth, H as getIdToken, I as getIdTokenResult, J as getMultiFactorResolver, K as getRedirectResult, L as inMemoryPersistence, M as indexedDBLocalPersistence, N as initializeAuth, Q as initializeRecaptchaConfig, U as isSignInWithEmailLink, V as linkWithCredential, W as linkWithPhoneNumber, X as linkWithPopup, Y as linkWithRedirect, Z as multiFactor, _ as onAuthStateChanged, $ as onIdTokenChanged, a0 as parseActionCodeURL, a1 as prodErrorMap, a2 as reauthenticateWithCredential, a3 as reauthenticateWithPhoneNumber, a4 as reauthenticateWithPopup, a5 as reauthenticateWithRedirect, a6 as reload, a7 as revokeAccessToken, a8 as sendEmailVerification, a9 as sendPasswordResetEmail, aa as sendSignInLinkToEmail, ab as setPersistence, ac as signInAnonymously, ad as signInWithCredential, ae as signInWithCustomToken, af as signInWithEmailAndPassword, ag as signInWithEmailLink, ah as signInWithPhoneNumber, ai as signInWithPopup, aj as signInWithRedirect, ak as signOut, al as unlink, am as updateCurrentUser, an as updateEmail, ao as updatePassword, ap as updatePhoneNumber, aq as updateProfile, ar as useDeviceLanguage, as as validatePassword, at as verifyBeforeUpdateEmail, au as verifyPasswordResetCode } from './index-CvXU3_1x.js';
1
+ export { A as ActionCodeOperation, a as ActionCodeURL, b as AuthCredential, c as AuthErrorCodes, E as EmailAuthCredential, d as EmailAuthProvider, F as FacebookAuthProvider, e as FactorId, G as GithubAuthProvider, f as GoogleAuthProvider, O as OAuthCredential, g as OAuthProvider, h as OperationType, P as PhoneAuthCredential, i as PhoneAuthProvider, j as PhoneMultiFactorGenerator, k as ProviderId, R as RecaptchaVerifier, S as SAMLAuthProvider, l as SignInMethod, T as TotpMultiFactorGenerator, m as TotpSecret, n as TwitterAuthProvider, o as applyActionCode, p as beforeAuthStateChanged, q as browserCookiePersistence, r as browserLocalPersistence, s as browserPopupRedirectResolver, t as browserSessionPersistence, u as checkActionCode, v as confirmPasswordReset, w as connectAuthEmulator, x as createUserWithEmailAndPassword, y as debugErrorMap, z as deleteUser, B as fetchSignInMethodsForEmail, C as getAdditionalUserInfo, D as getAuth, H as getIdToken, I as getIdTokenResult, J as getMultiFactorResolver, K as getRedirectResult, L as inMemoryPersistence, M as indexedDBLocalPersistence, N as initializeAuth, Q as initializeRecaptchaConfig, U as isSignInWithEmailLink, V as linkWithCredential, W as linkWithPhoneNumber, X as linkWithPopup, Y as linkWithRedirect, Z as multiFactor, _ as onAuthStateChanged, $ as onIdTokenChanged, a0 as parseActionCodeURL, a1 as prodErrorMap, a2 as reauthenticateWithCredential, a3 as reauthenticateWithPhoneNumber, a4 as reauthenticateWithPopup, a5 as reauthenticateWithRedirect, a6 as reload, a7 as revokeAccessToken, a8 as sendEmailVerification, a9 as sendPasswordResetEmail, aa as sendSignInLinkToEmail, ab as setPersistence, ac as signInAnonymously, ad as signInWithCredential, ae as signInWithCustomToken, af as signInWithEmailAndPassword, ag as signInWithEmailLink, ah as signInWithPhoneNumber, ai as signInWithPopup, aj as signInWithRedirect, ak as signOut, al as unlink, am as updateCurrentUser, an as updateEmail, ao as updatePassword, ap as updatePhoneNumber, aq as updateProfile, ar as useDeviceLanguage, as as validatePassword, at as verifyBeforeUpdateEmail, au as verifyPasswordResetCode } from './index-4NFEPWkC.js';
2
2
  import '@firebase/app';
3
3
  import '@firebase/util';
4
4
  import '@firebase/logger';
@@ -1,5 +1,5 @@
1
- import { av as _assert, aw as debugAssert, ax as _isIOS, ay as _isAndroid, az as _fail, aA as _getRedirectUrl, aB as _isIOS7Or8, aC as _createError, aD as _getProjectConfig, aE as AuthEventManager, aF as _getInstance, r as browserLocalPersistence, aG as _persistenceKeyName, t as browserSessionPersistence, aH as _getRedirectResult, aI as _overrideRedirectResult, aJ as _clearRedirectOutcomes, aK as _castAuth } from './index-CvXU3_1x.js';
2
- export { A as ActionCodeOperation, a as ActionCodeURL, b as AuthCredential, c as AuthErrorCodes, aL as AuthImpl, aM as AuthPopup, E as EmailAuthCredential, d as EmailAuthProvider, F as FacebookAuthProvider, e as FactorId, aN as FetchProvider, G as GithubAuthProvider, f as GoogleAuthProvider, O as OAuthCredential, g as OAuthProvider, h as OperationType, P as PhoneAuthCredential, i as PhoneAuthProvider, j as PhoneMultiFactorGenerator, k as ProviderId, R as RecaptchaVerifier, aO as SAMLAuthCredential, S as SAMLAuthProvider, l as SignInMethod, T as TotpMultiFactorGenerator, m as TotpSecret, n as TwitterAuthProvider, aP as UserImpl, aQ as _generateEventId, aR as _getClientVersion, o as applyActionCode, p as beforeAuthStateChanged, q as browserCookiePersistence, s as browserPopupRedirectResolver, u as checkActionCode, v as confirmPasswordReset, w as connectAuthEmulator, x as createUserWithEmailAndPassword, y as debugErrorMap, z as deleteUser, B as fetchSignInMethodsForEmail, C as getAdditionalUserInfo, D as getAuth, H as getIdToken, I as getIdTokenResult, J as getMultiFactorResolver, K as getRedirectResult, L as inMemoryPersistence, M as indexedDBLocalPersistence, N as initializeAuth, Q as initializeRecaptchaConfig, U as isSignInWithEmailLink, V as linkWithCredential, W as linkWithPhoneNumber, X as linkWithPopup, Y as linkWithRedirect, Z as multiFactor, _ as onAuthStateChanged, $ as onIdTokenChanged, a0 as parseActionCodeURL, a1 as prodErrorMap, a2 as reauthenticateWithCredential, a3 as reauthenticateWithPhoneNumber, a4 as reauthenticateWithPopup, a5 as reauthenticateWithRedirect, a6 as reload, a7 as revokeAccessToken, a8 as sendEmailVerification, a9 as sendPasswordResetEmail, aa as sendSignInLinkToEmail, ab as setPersistence, ac as signInAnonymously, ad as signInWithCredential, ae as signInWithCustomToken, af as signInWithEmailAndPassword, ag as signInWithEmailLink, ah as signInWithPhoneNumber, ai as signInWithPopup, aj as signInWithRedirect, ak as signOut, al as unlink, am as updateCurrentUser, an as updateEmail, ao as updatePassword, ap as updatePhoneNumber, aq as updateProfile, ar as useDeviceLanguage, as as validatePassword, at as verifyBeforeUpdateEmail, au as verifyPasswordResetCode } from './index-CvXU3_1x.js';
1
+ import { av as _assert, aw as debugAssert, ax as _isIOS, ay as _isAndroid, az as _fail, aA as _getRedirectUrl, aB as _isIOS7Or8, aC as _createError, aD as _getProjectConfig, aE as AuthEventManager, aF as _getInstance, r as browserLocalPersistence, aG as _persistenceKeyName, t as browserSessionPersistence, aH as _getRedirectResult, aI as _overrideRedirectResult, aJ as _clearRedirectOutcomes, aK as _castAuth } from './index-4NFEPWkC.js';
2
+ export { A as ActionCodeOperation, a as ActionCodeURL, b as AuthCredential, c as AuthErrorCodes, aL as AuthImpl, aM as AuthPopup, E as EmailAuthCredential, d as EmailAuthProvider, F as FacebookAuthProvider, e as FactorId, aN as FetchProvider, G as GithubAuthProvider, f as GoogleAuthProvider, O as OAuthCredential, g as OAuthProvider, h as OperationType, P as PhoneAuthCredential, i as PhoneAuthProvider, j as PhoneMultiFactorGenerator, k as ProviderId, R as RecaptchaVerifier, aO as SAMLAuthCredential, S as SAMLAuthProvider, l as SignInMethod, T as TotpMultiFactorGenerator, m as TotpSecret, n as TwitterAuthProvider, aP as UserImpl, aQ as _generateEventId, aR as _getClientVersion, o as applyActionCode, p as beforeAuthStateChanged, q as browserCookiePersistence, s as browserPopupRedirectResolver, u as checkActionCode, v as confirmPasswordReset, w as connectAuthEmulator, x as createUserWithEmailAndPassword, y as debugErrorMap, z as deleteUser, B as fetchSignInMethodsForEmail, C as getAdditionalUserInfo, D as getAuth, H as getIdToken, I as getIdTokenResult, J as getMultiFactorResolver, K as getRedirectResult, L as inMemoryPersistence, M as indexedDBLocalPersistence, N as initializeAuth, Q as initializeRecaptchaConfig, U as isSignInWithEmailLink, V as linkWithCredential, W as linkWithPhoneNumber, X as linkWithPopup, Y as linkWithRedirect, Z as multiFactor, _ as onAuthStateChanged, $ as onIdTokenChanged, a0 as parseActionCodeURL, a1 as prodErrorMap, a2 as reauthenticateWithCredential, a3 as reauthenticateWithPhoneNumber, a4 as reauthenticateWithPopup, a5 as reauthenticateWithRedirect, a6 as reload, a7 as revokeAccessToken, a8 as sendEmailVerification, a9 as sendPasswordResetEmail, aa as sendSignInLinkToEmail, ab as setPersistence, ac as signInAnonymously, ad as signInWithCredential, ae as signInWithCustomToken, af as signInWithEmailAndPassword, ag as signInWithEmailLink, ah as signInWithPhoneNumber, ai as signInWithPopup, aj as signInWithRedirect, ak as signOut, al as unlink, am as updateCurrentUser, an as updateEmail, ao as updatePassword, ap as updatePhoneNumber, aq as updateProfile, ar as useDeviceLanguage, as as validatePassword, at as verifyBeforeUpdateEmail, au as verifyPasswordResetCode } from './index-4NFEPWkC.js';
3
3
  import { querystringDecode } from '@firebase/util';
4
4
  import '@firebase/app';
5
5
  import '@firebase/logger';
@@ -23,7 +23,7 @@ import { User } from '../../model/public_types';
23
23
  *
24
24
  * @public
25
25
  */
26
- export declare function updateProfile(user: User, { displayName, photoURL: photoUrl }: {
26
+ export declare function updateProfile(user: User, profile: {
27
27
  displayName?: string | null;
28
28
  photoURL?: string | null;
29
29
  }): Promise<void>;
@@ -533,7 +533,7 @@ function _initializeAuthInstance(auth, deps) {
533
533
  }
534
534
 
535
535
  var name = "@firebase/auth";
536
- var version = "1.13.5";
536
+ var version = "1.13.6";
537
537
 
538
538
  /**
539
539
  * @license
@@ -2081,7 +2081,12 @@ class PersistenceUserManager {
2081
2081
  this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
2082
2082
  this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
2083
2083
  this.boundEventHandler = auth._onStorageEvent.bind(auth);
2084
- this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
2084
+ try {
2085
+ this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
2086
+ }
2087
+ catch {
2088
+ // Best effort; ignore errors if addListener throws
2089
+ }
2085
2090
  }
2086
2091
  setCurrentUser(user) {
2087
2092
  return this.persistence._set(this.fullUserKey, user.toJSON());
@@ -2118,7 +2123,10 @@ class PersistenceUserManager {
2118
2123
  }
2119
2124
  }
2120
2125
  delete() {
2121
- this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
2126
+ try {
2127
+ this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
2128
+ }
2129
+ catch { }
2122
2130
  }
2123
2131
  static async create(auth, persistenceHierarchy, userKey = "authUser" /* KeyName.AUTH_USER */) {
2124
2132
  if (!persistenceHierarchy.length) {
@@ -2126,8 +2134,13 @@ class PersistenceUserManager {
2126
2134
  }
2127
2135
  // Eliminate any persistences that are not available
2128
2136
  const availablePersistences = (await Promise.all(persistenceHierarchy.map(async (persistence) => {
2129
- if (await persistence._isAvailable()) {
2130
- return persistence;
2137
+ try {
2138
+ if (await persistence._isAvailable()) {
2139
+ return persistence;
2140
+ }
2141
+ }
2142
+ catch {
2143
+ return undefined;
2131
2144
  }
2132
2145
  return undefined;
2133
2146
  }))).filter(persistence => persistence);
@@ -2518,8 +2531,16 @@ class AuthImpl {
2518
2531
  if (this._deleted) {
2519
2532
  return;
2520
2533
  }
2521
- this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);
2522
- this._resolvePersistenceManagerAvailable?.();
2534
+ try {
2535
+ this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);
2536
+ }
2537
+ catch (e) {
2538
+ _logWarn(`Failed to initialize persistence: ${e}`);
2539
+ this.persistenceManager = await PersistenceUserManager.create(this, []);
2540
+ }
2541
+ finally {
2542
+ this._resolvePersistenceManagerAvailable?.();
2543
+ }
2523
2544
  if (this._deleted) {
2524
2545
  return;
2525
2546
  }
@@ -2534,7 +2555,13 @@ class AuthImpl {
2534
2555
  /* Ignore the error */
2535
2556
  }
2536
2557
  }
2537
- await this.initializeCurrentUser(popupRedirectResolver);
2558
+ try {
2559
+ await this.initializeCurrentUser(popupRedirectResolver);
2560
+ }
2561
+ catch (e) {
2562
+ _logWarn(`Failed to initialize current user: ${e}`);
2563
+ await this.directlySetCurrentUser(null).catch(() => { });
2564
+ }
2538
2565
  this.lastNotifiedUid = this.currentUser?.uid || null;
2539
2566
  if (this._deleted) {
2540
2567
  return;
@@ -2932,11 +2959,26 @@ class AuthImpl {
2932
2959
  _assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
2933
2960
  // The callback needs to be called asynchronously per the spec.
2934
2961
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
2935
- promise.then(() => {
2962
+ promise
2963
+ .then(() => {
2936
2964
  if (isUnsubscribed) {
2937
2965
  return;
2938
2966
  }
2939
2967
  cb(this.currentUser);
2968
+ })
2969
+ .catch(err => {
2970
+ if (isUnsubscribed) {
2971
+ return;
2972
+ }
2973
+ if (typeof nextOrObserver !== 'function' && nextOrObserver.error) {
2974
+ nextOrObserver.error(err);
2975
+ }
2976
+ else if (error) {
2977
+ error(err);
2978
+ }
2979
+ else {
2980
+ throw err;
2981
+ }
2940
2982
  });
2941
2983
  if (typeof nextOrObserver === 'function') {
2942
2984
  const unsubscribe = subscription.addObserver(nextOrObserver, error, completed);
@@ -2966,11 +3008,21 @@ class AuthImpl {
2966
3008
  user._startProactiveRefresh();
2967
3009
  }
2968
3010
  this.currentUser = user;
2969
- if (user) {
2970
- await this.assertedPersistence.setCurrentUser(user);
2971
- }
2972
- else {
2973
- await this.assertedPersistence.removeCurrentUser();
3011
+ if (this.persistenceManager) {
3012
+ try {
3013
+ if (user) {
3014
+ await this.persistenceManager.setCurrentUser(user);
3015
+ }
3016
+ else {
3017
+ await this.persistenceManager.removeCurrentUser();
3018
+ }
3019
+ }
3020
+ catch (e) {
3021
+ const originalMessage = e?.message || String(e);
3022
+ const error = _errorWithCustomMessage(this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, `An internal AuthError has occurred: ${originalMessage}`);
3023
+ error.customData = { originalError: e };
3024
+ throw error;
3025
+ }
2974
3026
  }
2975
3027
  }
2976
3028
  queue(action) {
@@ -3707,9 +3759,6 @@ class IndexedDBLocalPersistence {
3707
3759
  this.initializeServiceWorkerMessaging().then(() => { }, () => { });
3708
3760
  }
3709
3761
  async _openDb() {
3710
- if (this.isClosing) {
3711
- throw new Error('Database is closing');
3712
- }
3713
3762
  if (this.dbPromise) {
3714
3763
  return this.dbPromise;
3715
3764
  }
@@ -3727,16 +3776,17 @@ class IndexedDBLocalPersistence {
3727
3776
  return await op(db);
3728
3777
  }
3729
3778
  catch (e) {
3730
- if (this.isClosing) {
3731
- throw e;
3732
- }
3733
3779
  if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {
3734
3780
  throw e;
3735
3781
  }
3736
3782
  if (this.dbPromise) {
3737
- const db = await this.dbPromise;
3738
- db.close();
3783
+ const dbPromise = this.dbPromise;
3739
3784
  this.dbPromise = null;
3785
+ try {
3786
+ const db = await dbPromise;
3787
+ db.close();
3788
+ }
3789
+ catch { }
3740
3790
  }
3741
3791
  // TODO: consider adding exponential backoff
3742
3792
  }
@@ -7414,7 +7464,8 @@ async function updateProfile$1(auth, request) {
7414
7464
  *
7415
7465
  * @public
7416
7466
  */
7417
- async function updateProfile(user, { displayName, photoURL: photoUrl }) {
7467
+ async function updateProfile(user, profile) {
7468
+ const { displayName, photoURL: photoUrl } = profile;
7418
7469
  if (displayName === undefined && photoUrl === undefined) {
7419
7470
  return;
7420
7471
  }