@firebase/auth 1.13.3 → 1.13.4-20260728185501

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 (48) hide show
  1. package/dist/browser-cjs/{index-80e3689c.js → index-TiyvRZm6.js} +119 -26
  2. package/dist/browser-cjs/{index-80e3689c.js.map → index-TiyvRZm6.js.map} +1 -1
  3. package/dist/browser-cjs/index.js +1 -1
  4. package/dist/browser-cjs/internal.js +1 -1
  5. package/dist/browser-cjs/internal.js.map +1 -1
  6. package/dist/cordova/index.js +9 -3
  7. package/dist/cordova/index.js.map +1 -1
  8. package/dist/cordova/internal.js +3 -3
  9. package/dist/cordova/internal.js.map +1 -1
  10. package/dist/cordova/{popup_redirect-167cbb8f.js → popup_redirect-Be0Melsy.js} +148 -55
  11. package/dist/cordova/popup_redirect-Be0Melsy.js.map +1 -0
  12. package/dist/esm/{index-d90d2ee5.js → index-DqtyKhzu.js} +120 -27
  13. package/dist/esm/{index-d90d2ee5.js.map → index-DqtyKhzu.js.map} +1 -1
  14. package/dist/esm/index.js +1 -1
  15. package/dist/esm/internal.js +3 -3
  16. package/dist/esm/internal.js.map +1 -1
  17. package/dist/index.webworker.js +124 -70
  18. package/dist/index.webworker.js.map +1 -1
  19. package/dist/node/index.js +1 -1
  20. package/dist/node/internal.js +1 -1
  21. package/dist/node/internal.js.map +1 -1
  22. package/dist/node/{totp-9e84e53d.js → totp-D8cjDKiH.js} +30 -47
  23. package/dist/node/{totp-9e84e53d.js.map → totp-D8cjDKiH.js.map} +1 -1
  24. package/dist/node-esm/index.js +1 -1
  25. package/dist/node-esm/internal.js +3 -3
  26. package/dist/node-esm/internal.js.map +1 -1
  27. package/dist/node-esm/{totp-65577477.js → totp-BkwAJFrn.js} +31 -48
  28. package/dist/node-esm/{totp-65577477.js.map → totp-BkwAJFrn.js.map} +1 -1
  29. package/dist/rn/{index-7d302f10.js → index-BzcHGbdh.js} +24 -2
  30. package/dist/rn/{index-7d302f10.js.map → index-BzcHGbdh.js.map} +1 -1
  31. package/dist/rn/index.js +7 -1
  32. package/dist/rn/index.js.map +1 -1
  33. package/dist/rn/internal.js +96 -25
  34. package/dist/rn/internal.js.map +1 -1
  35. package/dist/web-extension-cjs/index.js +2 -1
  36. package/dist/web-extension-cjs/index.js.map +1 -1
  37. package/dist/web-extension-cjs/internal.js +1 -1
  38. package/dist/web-extension-cjs/internal.js.map +1 -1
  39. package/dist/web-extension-cjs/{register-1fdfc769.js → register-Bk5zU3vt.js} +119 -26
  40. package/dist/{web-extension-esm/register-293ebff1.js.map → web-extension-cjs/register-Bk5zU3vt.js.map} +1 -1
  41. package/dist/web-extension-esm/index.js +4 -3
  42. package/dist/web-extension-esm/index.js.map +1 -1
  43. package/dist/web-extension-esm/internal.js +3 -3
  44. package/dist/web-extension-esm/internal.js.map +1 -1
  45. package/dist/web-extension-esm/{register-293ebff1.js → register-CGKCII54.js} +120 -27
  46. package/dist/{web-extension-cjs/register-1fdfc769.js.map → web-extension-esm/register-CGKCII54.js.map} +1 -1
  47. package/package.json +13 -12
  48. package/dist/cordova/popup_redirect-167cbb8f.js.map +0 -1
@@ -1476,6 +1476,7 @@ function extractProviderData(providers) {
1476
1476
  * See the License for the specific language governing permissions and
1477
1477
  * limitations under the License.
1478
1478
  */
1479
+ /* eslint-disable camelcase */
1479
1480
  async function requestStsToken(auth, refreshToken) {
1480
1481
  const response = await _performFetchWithErrorHandling(auth, {}, async () => {
1481
1482
  const body = querystring({
@@ -3328,6 +3329,22 @@ function generateRandomAlphaNumericString(len) {
3328
3329
  }
3329
3330
 
3330
3331
  /* eslint-disable @typescript-eslint/no-require-imports */
3332
+ /**
3333
+ * @license
3334
+ * Copyright 2022 Google LLC
3335
+ *
3336
+ * Licensed under the Apache License, Version 2.0 (the "License");
3337
+ * you may not use this file except in compliance with the License.
3338
+ * You may obtain a copy of the License at
3339
+ *
3340
+ * http://www.apache.org/licenses/LICENSE-2.0
3341
+ *
3342
+ * Unless required by applicable law or agreed to in writing, software
3343
+ * distributed under the License is distributed on an "AS IS" BASIS,
3344
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3345
+ * See the License for the specific language governing permissions and
3346
+ * limitations under the License.
3347
+ */
3331
3348
  const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';
3332
3349
  const FAKE_TOKEN = 'NO_RECAPTCHA';
3333
3350
  const RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME = 'onFirebaseAuthREInstanceReady';
@@ -5191,6 +5208,11 @@ GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */;
5191
5208
  * See the License for the specific language governing permissions and
5192
5209
  * limitations under the License.
5193
5210
  */
5211
+ /**
5212
+ * Represents the SAML credentials returned by an {@link SAMLAuthProvider}.
5213
+ *
5214
+ * @public
5215
+ */
5194
5216
  const IDP_REQUEST_URI = 'http://localhost';
5195
5217
  /**
5196
5218
  * @public
@@ -7708,6 +7730,28 @@ function _deleteObject(db, key) {
7708
7730
  const _POLLING_INTERVAL_MS = 800;
7709
7731
  const _TRANSACTION_RETRY_COUNT = 3;
7710
7732
  class IndexedDBLocalPersistence {
7733
+ registerLifecycleListeners() {
7734
+ if (typeof window !== 'undefined' &&
7735
+ typeof window.addEventListener === 'function') {
7736
+ window.addEventListener('pagehide', this.onPageHide);
7737
+ window.addEventListener('pageshow', this.onPageShow);
7738
+ }
7739
+ if (typeof document !== 'undefined' &&
7740
+ typeof document.addEventListener === 'function') {
7741
+ document.addEventListener('visibilitychange', this.onVisibilityChange);
7742
+ }
7743
+ }
7744
+ unregisterLifecycleListeners() {
7745
+ if (typeof window !== 'undefined' &&
7746
+ typeof window.removeEventListener === 'function') {
7747
+ window.removeEventListener('pagehide', this.onPageHide);
7748
+ window.removeEventListener('pageshow', this.onPageShow);
7749
+ }
7750
+ if (typeof document !== 'undefined' &&
7751
+ typeof document.removeEventListener === 'function') {
7752
+ document.removeEventListener('visibilitychange', this.onVisibilityChange);
7753
+ }
7754
+ }
7711
7755
  constructor() {
7712
7756
  this.type = "LOCAL" /* PersistenceType.LOCAL */;
7713
7757
  this.dbPromise = null;
@@ -7717,16 +7761,46 @@ class IndexedDBLocalPersistence {
7717
7761
  // setTimeout return value is platform specific
7718
7762
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7719
7763
  this.pollTimer = null;
7764
+ this.isHiding = false;
7720
7765
  this.pendingWrites = 0;
7721
7766
  this.receiver = null;
7722
7767
  this.sender = null;
7723
7768
  this.serviceWorkerReceiverAvailable = false;
7724
7769
  this.activeServiceWorker = null;
7770
+ this.onPageHide = () => {
7771
+ this.isHiding = true;
7772
+ this.stopPolling();
7773
+ if (this.dbPromise) {
7774
+ this.dbPromise.then(db => db.close()).catch(() => { });
7775
+ this.dbPromise = null;
7776
+ }
7777
+ };
7778
+ this.onPageShow = () => {
7779
+ if (this.isHiding) {
7780
+ this.isHiding = false;
7781
+ if (Object.keys(this.listeners).length > 0) {
7782
+ this.startPolling();
7783
+ }
7784
+ }
7785
+ };
7786
+ this.onVisibilityChange = () => {
7787
+ if (typeof document !== 'undefined') {
7788
+ if (document.visibilityState === 'hidden') {
7789
+ this.onPageHide();
7790
+ }
7791
+ else if (document.visibilityState === 'visible') {
7792
+ this.onPageShow();
7793
+ }
7794
+ }
7795
+ };
7725
7796
  // Fire & forget the service worker registration as it may never resolve
7726
7797
  this._workerInitializationPromise =
7727
7798
  this.initializeServiceWorkerMessaging().then(() => { }, () => { });
7728
7799
  }
7729
7800
  async _openDb() {
7801
+ if (this.isHiding) {
7802
+ throw new Error('Database is closing/hidden');
7803
+ }
7730
7804
  if (this.dbPromise) {
7731
7805
  return this.dbPromise;
7732
7806
  }
@@ -7744,6 +7818,9 @@ class IndexedDBLocalPersistence {
7744
7818
  return await op(db);
7745
7819
  }
7746
7820
  catch (e) {
7821
+ if (this.isHiding) {
7822
+ throw e;
7823
+ }
7747
7824
  if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {
7748
7825
  throw e;
7749
7826
  }
@@ -7873,37 +7950,51 @@ class IndexedDBLocalPersistence {
7873
7950
  });
7874
7951
  }
7875
7952
  async _poll() {
7876
- // TODO: check if we need to fallback if getAll is not supported
7877
- const result = await this._withRetries((db) => {
7878
- const getAllRequest = getObjectStore(db, false).getAll();
7879
- return new DBPromise(getAllRequest).toPromise();
7880
- });
7881
- if (!result) {
7882
- return [];
7883
- }
7884
- // If we have pending writes in progress abort, we'll get picked up on the next poll
7885
- if (this.pendingWrites !== 0) {
7953
+ if (this.isHiding) {
7886
7954
  return [];
7887
7955
  }
7888
- const keys = [];
7889
- const keysInResult = new Set();
7890
- if (result.length !== 0) {
7891
- for (const { fbase_key: key, value } of result) {
7892
- keysInResult.add(key);
7893
- if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {
7894
- this.notifyListeners(key, value);
7895
- keys.push(key);
7956
+ try {
7957
+ // TODO: check if we need to fallback if getAll is not supported
7958
+ const result = await this._withRetries((db) => {
7959
+ const getAllRequest = getObjectStore(db, false).getAll();
7960
+ return new DBPromise(getAllRequest).toPromise();
7961
+ });
7962
+ if (this.isHiding) {
7963
+ return [];
7964
+ }
7965
+ if (!result) {
7966
+ return [];
7967
+ }
7968
+ // If we have pending writes in progress abort, we'll get picked up on the next poll
7969
+ if (this.pendingWrites !== 0) {
7970
+ return [];
7971
+ }
7972
+ const keys = [];
7973
+ const keysInResult = new Set();
7974
+ if (result.length !== 0) {
7975
+ for (const { fbase_key: key, value } of result) {
7976
+ keysInResult.add(key);
7977
+ if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {
7978
+ this.notifyListeners(key, value);
7979
+ keys.push(key);
7980
+ }
7981
+ }
7982
+ }
7983
+ for (const localKey of Object.keys(this.localCache)) {
7984
+ if (this.localCache[localKey] && !keysInResult.has(localKey)) {
7985
+ // Deleted
7986
+ this.notifyListeners(localKey, null);
7987
+ keys.push(localKey);
7896
7988
  }
7897
7989
  }
7990
+ return keys;
7898
7991
  }
7899
- for (const localKey of Object.keys(this.localCache)) {
7900
- if (this.localCache[localKey] && !keysInResult.has(localKey)) {
7901
- // Deleted
7902
- this.notifyListeners(localKey, null);
7903
- keys.push(localKey);
7992
+ catch (e) {
7993
+ if (!this.isHiding) {
7994
+ _logWarn(`Firebase Auth cross-tab polling failed with error: ${e}`);
7904
7995
  }
7996
+ return [];
7905
7997
  }
7906
- return keys;
7907
7998
  }
7908
7999
  notifyListeners(key, newValue) {
7909
8000
  this.localCache[key] = newValue;
@@ -7927,6 +8018,7 @@ class IndexedDBLocalPersistence {
7927
8018
  _addListener(key, listener) {
7928
8019
  if (Object.keys(this.listeners).length === 0) {
7929
8020
  this.startPolling();
8021
+ this.registerLifecycleListeners();
7930
8022
  }
7931
8023
  if (!this.listeners[key]) {
7932
8024
  this.listeners[key] = new Set();
@@ -7944,6 +8036,7 @@ class IndexedDBLocalPersistence {
7944
8036
  }
7945
8037
  if (Object.keys(this.listeners).length === 0) {
7946
8038
  this.stopPolling();
8039
+ this.unregisterLifecycleListeners();
7947
8040
  }
7948
8041
  }
7949
8042
  }
@@ -8145,7 +8238,7 @@ function _isEmptyString(input) {
8145
8238
  }
8146
8239
 
8147
8240
  var name = "@firebase/auth";
8148
- var version = "1.13.3";
8241
+ var version = "1.13.4-20260728185501";
8149
8242
 
8150
8243
  /**
8151
8244
  * @license
@@ -8290,5 +8383,5 @@ function registerAuth(clientPlatform) {
8290
8383
  registerVersion(name, version, 'esm2020');
8291
8384
  }
8292
8385
 
8293
- export { updateEmail as $, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as A, linkWithCredential as B, reauthenticateWithCredential as C, signInWithCustomToken as D, EmailAuthCredential as E, FacebookAuthProvider as F, GoogleAuthProvider as G, sendPasswordResetEmail as H, confirmPasswordReset as I, applyActionCode as J, checkActionCode as K, verifyPasswordResetCode as L, createUserWithEmailAndPassword as M, signInWithEmailAndPassword as N, OAuthCredential as O, PhoneAuthCredential as P, sendSignInLinkToEmail as Q, isSignInWithEmailLink as R, SAMLAuthProvider as S, TotpMultiFactorGenerator as T, signInWithEmailLink as U, fetchSignInMethodsForEmail as V, sendEmailVerification as W, verifyBeforeUpdateEmail as X, ActionCodeURL as Y, parseActionCodeURL as Z, updateProfile as _, indexedDBLocalPersistence as a, FetchProvider as a$, updatePassword as a0, getIdToken as a1, getIdTokenResult as a2, unlink as a3, getAdditionalUserInfo as a4, reload as a5, getMultiFactorResolver as a6, multiFactor as a7, STORAGE_AVAILABLE_KEY as a8, _isMobileBrowser as a9, signInWithIdp as aA, _fail as aB, debugAssert as aC, _assertInstanceOf as aD, _generateEventId as aE, FederatedAuthProvider as aF, _persistenceKeyName as aG, _performApiRequest as aH, _getCurrentUrl as aI, _gapiScriptUrl as aJ, _emulatorUrl as aK, _isChromeIOS as aL, _isFirefox as aM, _isIOSStandalone as aN, BaseOAuthProvider as aO, _setWindowLocation as aP, _isSafari as aQ, _isIOS as aR, MultiFactorAssertionImpl as aS, finalizeEnrollPhoneMfa as aT, finalizeSignInPhoneMfa as aU, _setExternalJSProvider as aV, _isAndroid as aW, _isIOS7Or8 as aX, UserImpl as aY, AuthImpl as aZ, _getClientVersion as a_, _isIE10 as aa, Delay as ab, _window as ac, _assert as ad, isV2 as ae, _createError as af, _recaptchaV2ScriptUrl as ag, _loadJS as ah, MockReCaptcha as ai, _generateCallbackName as aj, _castAuth as ak, _isHttpOrHttps as al, _isWorker as am, getRecaptchaParams as an, _serverAppCurrentUserOperationNotSupportedError as ao, _assertLinkedStatus as ap, _initializeRecaptchaConfig as aq, FAKE_TOKEN as ar, startEnrollPhoneMfa as as, handleRecaptchaFlow as at, startSignInPhoneMfa as au, sendPhoneVerificationCode as av, _link as aw, _getInstance as ax, _signInWithCredential as ay, _reauthenticate as az, TotpSecret as b, SAMLAuthCredential as b0, connectAuthEmulator as c, initializeRecaptchaConfig as d, beforeAuthStateChanged as e, onAuthStateChanged as f, updateCurrentUser as g, signOut as h, initializeAuth as i, revokeAccessToken as j, deleteUser as k, debugErrorMap as l, AuthCredential as m, inMemoryPersistence as n, onIdTokenChanged as o, prodErrorMap as p, EmailAuthProvider as q, registerAuth as r, setPersistence as s, GithubAuthProvider as t, useDeviceLanguage as u, validatePassword as v, OAuthProvider as w, TwitterAuthProvider as x, signInAnonymously as y, signInWithCredential as z };
8294
- //# sourceMappingURL=register-293ebff1.js.map
8386
+ export { unlink as $, ActionCodeURL as A, linkWithCredential as B, multiFactor as C, onAuthStateChanged as D, EmailAuthCredential as E, FacebookAuthProvider as F, GithubAuthProvider as G, onIdTokenChanged as H, parseActionCodeURL as I, prodErrorMap as J, reauthenticateWithCredential as K, reload as L, revokeAccessToken as M, sendEmailVerification as N, OAuthCredential as O, PhoneAuthCredential as P, sendPasswordResetEmail as Q, sendSignInLinkToEmail as R, SAMLAuthProvider as S, TotpMultiFactorGenerator as T, setPersistence as U, signInAnonymously as V, signInWithCredential as W, signInWithCustomToken as X, signInWithEmailAndPassword as Y, signInWithEmailLink as Z, signOut as _, indexedDBLocalPersistence as a, UserImpl as a$, updateCurrentUser as a0, updateEmail as a1, updatePassword as a2, updateProfile as a3, useDeviceLanguage as a4, validatePassword as a5, verifyBeforeUpdateEmail as a6, verifyPasswordResetCode as a7, STORAGE_AVAILABLE_KEY as a8, _isMobileBrowser as a9, signInWithIdp as aA, _fail as aB, debugAssert as aC, _assertInstanceOf as aD, _generateEventId as aE, FederatedAuthProvider as aF, _persistenceKeyName as aG, _performApiRequest as aH, _getCurrentUrl as aI, _gapiScriptUrl as aJ, _emulatorUrl as aK, _isChromeIOS as aL, _isFirefox as aM, _isIOSStandalone as aN, BaseOAuthProvider as aO, _setWindowLocation as aP, _isSafari as aQ, _isIOS as aR, MultiFactorAssertionImpl as aS, finalizeEnrollPhoneMfa as aT, finalizeSignInPhoneMfa as aU, _setExternalJSProvider as aV, _isAndroid as aW, _isIOS7Or8 as aX, AuthImpl as aY, FetchProvider as aZ, SAMLAuthCredential as a_, _isIE10 as aa, Delay as ab, MockReCaptcha as ac, _window as ad, _assert as ae, isV2 as af, _createError as ag, _recaptchaV2ScriptUrl as ah, _loadJS as ai, _generateCallbackName as aj, _castAuth as ak, _isHttpOrHttps as al, _isWorker as am, getRecaptchaParams as an, _assertLinkedStatus as ao, _serverAppCurrentUserOperationNotSupportedError as ap, _link as aq, _initializeRecaptchaConfig as ar, FAKE_TOKEN as as, startEnrollPhoneMfa as at, handleRecaptchaFlow as au, startSignInPhoneMfa as av, sendPhoneVerificationCode as aw, _getInstance as ax, _reauthenticate as ay, _signInWithCredential as az, AuthCredential as b, _getClientVersion as b0, connectAuthEmulator as c, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as d, EmailAuthProvider as e, GoogleAuthProvider as f, OAuthProvider as g, TotpSecret as h, initializeAuth as i, TwitterAuthProvider as j, applyActionCode as k, beforeAuthStateChanged as l, checkActionCode as m, confirmPasswordReset as n, createUserWithEmailAndPassword as o, debugErrorMap as p, deleteUser as q, registerAuth as r, fetchSignInMethodsForEmail as s, getAdditionalUserInfo as t, getIdToken as u, getIdTokenResult as v, getMultiFactorResolver as w, inMemoryPersistence as x, initializeRecaptchaConfig as y, isSignInWithEmailLink as z };
8387
+ //# sourceMappingURL=register-CGKCII54.js.map