@firebase/auth 1.13.1 → 1.13.2-eap-crashlytics.558ee841d

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/browser-cjs/{index-58b444b9.js → index-223cb6d8.js} +55 -15
  2. package/dist/browser-cjs/index-223cb6d8.js.map +1 -0
  3. package/dist/browser-cjs/index.js +1 -1
  4. package/dist/browser-cjs/internal.js +1 -1
  5. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  6. package/dist/browser-cjs/test/helpers/mock_loadjs.d.ts +17 -0
  7. package/dist/cordova/index.js +2 -2
  8. package/dist/cordova/internal.js +2 -2
  9. package/dist/cordova/{popup_redirect-e90e6597.js → popup_redirect-8f954bab.js} +56 -16
  10. package/dist/cordova/popup_redirect-8f954bab.js.map +1 -0
  11. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  12. package/dist/cordova/test/helpers/mock_loadjs.d.ts +17 -0
  13. package/dist/esm/{index-907e9a1a.js → index-42b2f63a.js} +56 -16
  14. package/dist/esm/index-42b2f63a.js.map +1 -0
  15. package/dist/esm/index.js +1 -1
  16. package/dist/esm/internal.js +2 -2
  17. package/dist/esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  18. package/dist/esm/test/helpers/mock_loadjs.d.ts +17 -0
  19. package/dist/index.webworker.js +55 -15
  20. package/dist/index.webworker.js.map +1 -1
  21. package/dist/node/index.js +1 -1
  22. package/dist/node/internal.js +1 -1
  23. package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  24. package/dist/node/test/helpers/mock_loadjs.d.ts +17 -0
  25. package/dist/node/{totp-ec1dc837.js → totp-1de3d98e.js} +39 -5
  26. package/dist/node/totp-1de3d98e.js.map +1 -0
  27. package/dist/node-esm/index.js +1 -1
  28. package/dist/node-esm/internal.js +2 -2
  29. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  30. package/dist/node-esm/test/helpers/mock_loadjs.d.ts +17 -0
  31. package/dist/node-esm/{totp-97daafa8.js → totp-16b08ec9.js} +40 -6
  32. package/dist/node-esm/totp-16b08ec9.js.map +1 -0
  33. package/dist/rn/{index-ec5272bc.js → index-3c01bc90.js} +39 -5
  34. package/dist/rn/index-3c01bc90.js.map +1 -0
  35. package/dist/rn/index.js +1 -1
  36. package/dist/rn/internal.js +18 -12
  37. package/dist/rn/internal.js.map +1 -1
  38. package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  39. package/dist/rn/test/helpers/mock_loadjs.d.ts +17 -0
  40. package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  41. package/dist/test/helpers/mock_loadjs.d.ts +17 -0
  42. package/dist/web-extension-cjs/index.js +1 -1
  43. package/dist/web-extension-cjs/internal.js +1 -1
  44. package/dist/web-extension-cjs/{register-410eef86.js → register-6a93d6fa.js} +55 -15
  45. package/dist/web-extension-cjs/register-6a93d6fa.js.map +1 -0
  46. package/dist/web-extension-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  47. package/dist/web-extension-cjs/test/helpers/mock_loadjs.d.ts +17 -0
  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-4207f7c7.js → register-6e13f5d2.js} +56 -16
  51. package/dist/web-extension-esm/register-6e13f5d2.js.map +1 -0
  52. package/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  53. package/dist/web-extension-esm/test/helpers/mock_loadjs.d.ts +17 -0
  54. package/package.json +6 -6
  55. package/dist/browser-cjs/index-58b444b9.js.map +0 -1
  56. package/dist/cordova/popup_redirect-e90e6597.js.map +0 -1
  57. package/dist/esm/index-907e9a1a.js.map +0 -1
  58. package/dist/node/totp-ec1dc837.js.map +0 -1
  59. package/dist/node-esm/totp-97daafa8.js.map +0 -1
  60. package/dist/rn/index-ec5272bc.js.map +0 -1
  61. package/dist/web-extension-cjs/register-410eef86.js.map +0 -1
  62. package/dist/web-extension-esm/register-4207f7c7.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-58b444b9.js');
5
+ var index = require('./index-223cb6d8.js');
6
6
  require('@firebase/app');
7
7
  require('@firebase/util');
8
8
  require('@firebase/logger');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-58b444b9.js');
5
+ var index = require('./index-223cb6d8.js');
6
6
  var util = require('@firebase/util');
7
7
  require('@firebase/app');
8
8
  require('@firebase/logger');
@@ -19,12 +19,30 @@ import { Auth } from '../../model/public_types';
19
19
  import { AuthInternal } from '../../model/auth';
20
20
  export declare const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = "recaptcha-enterprise";
21
21
  export declare const FAKE_TOKEN = "NO_RECAPTCHA";
22
+ export declare const RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME = "onFirebaseAuthREInstanceReady";
23
+ declare global {
24
+ interface Window {
25
+ [RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME]: () => void;
26
+ }
27
+ }
22
28
  export declare class RecaptchaEnterpriseVerifier {
23
29
  /**
24
30
  * Identifies the type of application verifier (e.g. "recaptcha-enterprise").
25
31
  */
26
32
  readonly type = "recaptcha-enterprise";
27
33
  private readonly auth;
34
+ /**
35
+ * Deferred that resolves when script tag has been injected onto the page
36
+ * and the script is ready (grecaptcha.ready() and script.onload are not
37
+ * reliable indicators, so this resolves when the global
38
+ * `window[RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME]()` callback provided to the recaptcha url param "onload"
39
+ * is triggered).
40
+ * As a static variable this is applied to all instances of the class.
41
+ * This will cause an error if users try to create multiple RecaptchaVerifiers
42
+ * with different Recaptcha Enterprise sitekeys, which should be an
43
+ * unuspported use case.
44
+ */
45
+ private static scriptInjectionDeferred;
28
46
  /**
29
47
  *
30
48
  * @param authExtern - The corresponding Firebase {@link Auth} instance.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export declare const mockLoadJS: () => Promise<Event>;
@@ -1,6 +1,6 @@
1
1
  import { _getProvider, getApp } from '@firebase/app';
2
- import { _ as _signInWithRedirect, a as _reauthenticateWithRedirect, b as _linkWithRedirect, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, d as cordovaPopupRedirectResolver } from './popup_redirect-e90e6597.js';
3
- export { A as ActionCodeOperation, a6 as ActionCodeURL, y as AuthCredential, w as AuthErrorCodes, E as EmailAuthCredential, D as EmailAuthProvider, G as FacebookAuthProvider, F as FactorId, I as GithubAuthProvider, H as GoogleAuthProvider, z as OAuthCredential, J as OAuthProvider, O as OperationType, B as PhoneAuthCredential, P as ProviderId, K as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, W as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, X as checkActionCode, V as confirmPasswordReset, x as connectAuthEmulator, d as cordovaPopupRedirectResolver, Z as createUserWithEmailAndPassword, q as debugErrorMap, p as deleteUser, a3 as fetchSignInMethodsForEmail, ae as getAdditionalUserInfo, ab as getIdToken, ac as getIdTokenResult, ag as getMultiFactorResolver, g as getRedirectResult, C as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a1 as isSignInWithEmailLink, N as linkWithCredential, ah as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a7 as parseActionCodeURL, t as prodErrorMap, Q as reauthenticateWithCredential, af as reload, n as revokeAccessToken, a4 as sendEmailVerification, U as sendPasswordResetEmail, a0 as sendSignInLinkToEmail, s as setPersistence, L as signInAnonymously, M as signInWithCredential, R as signInWithCustomToken, $ as signInWithEmailAndPassword, a2 as signInWithEmailLink, m as signOut, ad as unlink, l as updateCurrentUser, a9 as updateEmail, aa as updatePassword, a8 as updateProfile, u as useDeviceLanguage, v as validatePassword, a5 as verifyBeforeUpdateEmail, Y as verifyPasswordResetCode } from './popup_redirect-e90e6597.js';
2
+ import { _ as _signInWithRedirect, a as _reauthenticateWithRedirect, b as _linkWithRedirect, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, d as cordovaPopupRedirectResolver } from './popup_redirect-8f954bab.js';
3
+ export { A as ActionCodeOperation, a6 as ActionCodeURL, y as AuthCredential, w as AuthErrorCodes, E as EmailAuthCredential, D as EmailAuthProvider, G as FacebookAuthProvider, F as FactorId, I as GithubAuthProvider, H as GoogleAuthProvider, z as OAuthCredential, J as OAuthProvider, O as OperationType, B as PhoneAuthCredential, P as ProviderId, K as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, W as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, X as checkActionCode, V as confirmPasswordReset, x as connectAuthEmulator, d as cordovaPopupRedirectResolver, Z as createUserWithEmailAndPassword, q as debugErrorMap, p as deleteUser, a3 as fetchSignInMethodsForEmail, ae as getAdditionalUserInfo, ab as getIdToken, ac as getIdTokenResult, ag as getMultiFactorResolver, g as getRedirectResult, C as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a1 as isSignInWithEmailLink, N as linkWithCredential, ah as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a7 as parseActionCodeURL, t as prodErrorMap, Q as reauthenticateWithCredential, af as reload, n as revokeAccessToken, a4 as sendEmailVerification, U as sendPasswordResetEmail, a0 as sendSignInLinkToEmail, s as setPersistence, L as signInAnonymously, M as signInWithCredential, R as signInWithCustomToken, $ as signInWithEmailAndPassword, a2 as signInWithEmailLink, m as signOut, ad as unlink, l as updateCurrentUser, a9 as updateEmail, aa as updatePassword, a8 as updateProfile, u as useDeviceLanguage, v as validatePassword, a5 as verifyBeforeUpdateEmail, Y as verifyPasswordResetCode } from './popup_redirect-8f954bab.js';
4
4
  import '@firebase/util';
5
5
  import '@firebase/component';
6
6
  import '@firebase/logger';
@@ -1,5 +1,5 @@
1
- import { ai as _performApiRequest, aj as _addTidIfNecessary, ak as Delay, al as _window, am as _assert, an as isV2, ao as _createError, ap as _recaptchaV2ScriptUrl, aq as _loadJS, ar as MockReCaptcha, as as _generateCallbackName, at as _castAuth, au as _isHttpOrHttps, av as _isWorker, aw as getRecaptchaParams, ax as _serverAppCurrentUserOperationNotSupportedError, M as signInWithCredential, ay as _assertLinkedStatus, N as linkWithCredential, Q as reauthenticateWithCredential, az as _initializeRecaptchaConfig, aA as FAKE_TOKEN, aB as startEnrollPhoneMfa, aC as handleRecaptchaFlow, aD as sendPhoneVerificationCode, aE as _link, B as PhoneAuthCredential, aF as _assertInstanceOf, aG as _withDefaultResolver, aH as AbstractPopupRedirectOperation, aI as debugAssert, aJ as _generateEventId, aK as FederatedAuthProvider, aL as _getProjectConfig, aM as _fail, aN as _getCurrentUrl, aO as _gapiScriptUrl, aP as _emulatorUrl, aQ as _isChromeIOS, aR as _isFirefox, aS as _isIOSStandalone, f as browserSessionPersistence, aT as _getRedirectResult, aU as _overrideRedirectResult, aV as _getRedirectUrl, aW as _setWindowLocation, aX as _isMobileBrowser, aY as _isSafari, aZ as _isIOS, a_ as AuthEventManager, a$ as debugFail, b0 as finalizeEnrollPhoneMfa, b1 as startEnrollTotpMfa, b2 as finalizeEnrollTotpMfa, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, e as browserLocalPersistence, j as beforeAuthStateChanged, o as onIdTokenChanged, x as connectAuthEmulator, b3 as _setExternalJSProvider } from './popup_redirect-e90e6597.js';
2
- export { A as ActionCodeOperation, a6 as ActionCodeURL, y as AuthCredential, w as AuthErrorCodes, b7 as AuthImpl, E as EmailAuthCredential, D as EmailAuthProvider, G as FacebookAuthProvider, F as FactorId, b9 as FetchProvider, I as GithubAuthProvider, H as GoogleAuthProvider, z as OAuthCredential, J as OAuthProvider, O as OperationType, B as PhoneAuthCredential, P as ProviderId, ba as SAMLAuthCredential, K as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, b5 as UserImpl, am as _assert, at as _castAuth, aM as _fail, aJ as _generateEventId, b8 as _getClientVersion, b6 as _getInstance, aT as _getRedirectResult, aU as _overrideRedirectResult, b4 as _persistenceKeyName, W as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, X as checkActionCode, V as confirmPasswordReset, x as connectAuthEmulator, d as cordovaPopupRedirectResolver, Z as createUserWithEmailAndPassword, q as debugErrorMap, p as deleteUser, a3 as fetchSignInMethodsForEmail, ae as getAdditionalUserInfo, ab as getIdToken, ac as getIdTokenResult, ag as getMultiFactorResolver, g as getRedirectResult, C as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a1 as isSignInWithEmailLink, N as linkWithCredential, bc as linkWithRedirect, ah as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a7 as parseActionCodeURL, t as prodErrorMap, Q as reauthenticateWithCredential, bd as reauthenticateWithRedirect, af as reload, n as revokeAccessToken, a4 as sendEmailVerification, U as sendPasswordResetEmail, a0 as sendSignInLinkToEmail, s as setPersistence, L as signInAnonymously, M as signInWithCredential, R as signInWithCustomToken, $ as signInWithEmailAndPassword, a2 as signInWithEmailLink, bb as signInWithRedirect, m as signOut, ad as unlink, l as updateCurrentUser, a9 as updateEmail, aa as updatePassword, a8 as updateProfile, u as useDeviceLanguage, v as validatePassword, a5 as verifyBeforeUpdateEmail, Y as verifyPasswordResetCode } from './popup_redirect-e90e6597.js';
1
+ import { ai as _performApiRequest, aj as _addTidIfNecessary, ak as Delay, al as _window, am as _assert, an as isV2, ao as _createError, ap as _recaptchaV2ScriptUrl, aq as _loadJS, ar as MockReCaptcha, as as _generateCallbackName, at as _castAuth, au as _isHttpOrHttps, av as _isWorker, aw as getRecaptchaParams, ax as _serverAppCurrentUserOperationNotSupportedError, M as signInWithCredential, ay as _assertLinkedStatus, N as linkWithCredential, Q as reauthenticateWithCredential, az as _initializeRecaptchaConfig, aA as FAKE_TOKEN, aB as startEnrollPhoneMfa, aC as handleRecaptchaFlow, aD as sendPhoneVerificationCode, aE as _link, B as PhoneAuthCredential, aF as _assertInstanceOf, aG as _withDefaultResolver, aH as AbstractPopupRedirectOperation, aI as debugAssert, aJ as _generateEventId, aK as FederatedAuthProvider, aL as _getProjectConfig, aM as _fail, aN as _getCurrentUrl, aO as _gapiScriptUrl, aP as _emulatorUrl, aQ as _isChromeIOS, aR as _isFirefox, aS as _isIOSStandalone, f as browserSessionPersistence, aT as _getRedirectResult, aU as _overrideRedirectResult, aV as _getRedirectUrl, aW as _setWindowLocation, aX as _isMobileBrowser, aY as _isSafari, aZ as _isIOS, a_ as AuthEventManager, a$ as debugFail, b0 as finalizeEnrollPhoneMfa, b1 as startEnrollTotpMfa, b2 as finalizeEnrollTotpMfa, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, e as browserLocalPersistence, j as beforeAuthStateChanged, o as onIdTokenChanged, x as connectAuthEmulator, b3 as _setExternalJSProvider } from './popup_redirect-8f954bab.js';
2
+ export { A as ActionCodeOperation, a6 as ActionCodeURL, y as AuthCredential, w as AuthErrorCodes, b7 as AuthImpl, E as EmailAuthCredential, D as EmailAuthProvider, G as FacebookAuthProvider, F as FactorId, b9 as FetchProvider, I as GithubAuthProvider, H as GoogleAuthProvider, z as OAuthCredential, J as OAuthProvider, O as OperationType, B as PhoneAuthCredential, P as ProviderId, ba as SAMLAuthCredential, K as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, b5 as UserImpl, am as _assert, at as _castAuth, aM as _fail, aJ as _generateEventId, b8 as _getClientVersion, b6 as _getInstance, aT as _getRedirectResult, aU as _overrideRedirectResult, b4 as _persistenceKeyName, W as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, X as checkActionCode, V as confirmPasswordReset, x as connectAuthEmulator, d as cordovaPopupRedirectResolver, Z as createUserWithEmailAndPassword, q as debugErrorMap, p as deleteUser, a3 as fetchSignInMethodsForEmail, ae as getAdditionalUserInfo, ab as getIdToken, ac as getIdTokenResult, ag as getMultiFactorResolver, g as getRedirectResult, C as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a1 as isSignInWithEmailLink, N as linkWithCredential, bc as linkWithRedirect, ah as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a7 as parseActionCodeURL, t as prodErrorMap, Q as reauthenticateWithCredential, bd as reauthenticateWithRedirect, af as reload, n as revokeAccessToken, a4 as sendEmailVerification, U as sendPasswordResetEmail, a0 as sendSignInLinkToEmail, s as setPersistence, L as signInAnonymously, M as signInWithCredential, R as signInWithCustomToken, $ as signInWithEmailAndPassword, a2 as signInWithEmailLink, bb as signInWithRedirect, m as signOut, ad as unlink, l as updateCurrentUser, a9 as updateEmail, aa as updatePassword, a8 as updateProfile, u as useDeviceLanguage, v as validatePassword, a5 as verifyBeforeUpdateEmail, Y as verifyPasswordResetCode } from './popup_redirect-8f954bab.js';
3
3
  import { querystring, getModularInstance, getUA, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';
4
4
  import { _isFirebaseServerApp, SDK_VERSION, _getProvider, getApp } from '@firebase/app';
5
5
  import '@firebase/component';
@@ -1,4 +1,4 @@
1
- import { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, isCloudflareWorker, isCloudWorkstation, getModularInstance, base64Decode, getUA, isIE, createSubscribe, deepEqual, pingServer, querystringDecode, extractQuerystring, isEmpty } from '@firebase/util';
1
+ import { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, isCloudflareWorker, isCloudWorkstation, getModularInstance, base64Decode, getUA, isIE, createSubscribe, Deferred, deepEqual, pingServer, querystringDecode, extractQuerystring, isEmpty } from '@firebase/util';
2
2
  import { SDK_VERSION, _isFirebaseServerApp, _getProvider, _registerComponent, registerVersion } from '@firebase/app';
3
3
  import { Component } from '@firebase/component';
4
4
  import { Logger, LogLevel } from '@firebase/logger';
@@ -463,6 +463,7 @@ const _TRANSACTION_RETRY_COUNT = 3;
463
463
  class IndexedDBLocalPersistence {
464
464
  constructor() {
465
465
  this.type = "LOCAL" /* PersistenceType.LOCAL */;
466
+ this.dbPromise = null;
466
467
  this._shouldAllowMigration = true;
467
468
  this.listeners = {};
468
469
  this.localCache = {};
@@ -479,11 +480,14 @@ class IndexedDBLocalPersistence {
479
480
  this.initializeServiceWorkerMessaging().then(() => { }, () => { });
480
481
  }
481
482
  async _openDb() {
482
- if (this.db) {
483
- return this.db;
483
+ if (this.dbPromise) {
484
+ return this.dbPromise;
484
485
  }
485
- this.db = await _openDatabase();
486
- return this.db;
486
+ this.dbPromise = _openDatabase();
487
+ this.dbPromise.catch(() => {
488
+ this.dbPromise = null;
489
+ });
490
+ return this.dbPromise;
487
491
  }
488
492
  async _withRetries(op) {
489
493
  let numAttempts = 0;
@@ -496,9 +500,10 @@ class IndexedDBLocalPersistence {
496
500
  if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {
497
501
  throw e;
498
502
  }
499
- if (this.db) {
500
- this.db.close();
501
- this.db = undefined;
503
+ if (this.dbPromise) {
504
+ const db = await this.dbPromise;
505
+ db.close();
506
+ this.dbPromise = null;
502
507
  }
503
508
  // TODO: consider adding exponential backoff
504
509
  }
@@ -583,9 +588,10 @@ class IndexedDBLocalPersistence {
583
588
  if (!indexedDB) {
584
589
  return false;
585
590
  }
586
- const db = await _openDatabase();
587
- await _putObject(db, STORAGE_AVAILABLE_KEY, '1');
588
- await _deleteObject(db, STORAGE_AVAILABLE_KEY);
591
+ await this._withRetries(async (db) => {
592
+ await _putObject(db, STORAGE_AVAILABLE_KEY, '1');
593
+ await _deleteObject(db, STORAGE_AVAILABLE_KEY);
594
+ });
589
595
  return true;
590
596
  }
591
597
  catch { }
@@ -4030,6 +4036,7 @@ function generateRandomAlphaNumericString(len) {
4030
4036
  /* eslint-disable @typescript-eslint/no-require-imports */
4031
4037
  const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';
4032
4038
  const FAKE_TOKEN = 'NO_RECAPTCHA';
4039
+ const RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME = 'onFirebaseAuthREInstanceReady';
4033
4040
  class RecaptchaEnterpriseVerifier {
4034
4041
  /**
4035
4042
  *
@@ -4109,8 +4116,13 @@ class RecaptchaEnterpriseVerifier {
4109
4116
  }
4110
4117
  return new Promise((resolve, reject) => {
4111
4118
  retrieveSiteKey(this.auth)
4112
- .then(siteKey => {
4113
- if (!forceRefresh && isEnterprise(window.grecaptcha)) {
4119
+ .then(async (siteKey) => {
4120
+ if (!forceRefresh &&
4121
+ isEnterprise(window.grecaptcha) &&
4122
+ // If download has already been initiated, do not trigger another
4123
+ // download, await the promise here.
4124
+ RecaptchaEnterpriseVerifier.scriptInjectionDeferred) {
4125
+ await RecaptchaEnterpriseVerifier.scriptInjectionDeferred.promise;
4114
4126
  retrieveRecaptchaToken(siteKey, resolve, reject);
4115
4127
  }
4116
4128
  else {
@@ -4120,9 +4132,25 @@ class RecaptchaEnterpriseVerifier {
4120
4132
  }
4121
4133
  let url = _recaptchaEnterpriseScriptUrl();
4122
4134
  if (url.length !== 0) {
4123
- url += siteKey;
4135
+ url +=
4136
+ siteKey +
4137
+ `&onload=${RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME}`;
4124
4138
  }
4139
+ // Existence of deferred indicates download has been initiated.
4140
+ RecaptchaEnterpriseVerifier.scriptInjectionDeferred =
4141
+ new Deferred();
4142
+ /**
4143
+ * Script attached to global window object that will be called
4144
+ * when the ReCAPTCHA Enterprise instance is ready.
4145
+ * grecaptcha.ready() is not reliable when there are multiple
4146
+ * scripts on the page, and script.onload only indicates the
4147
+ * script has downloaded, not that it has initialized.
4148
+ */
4149
+ window[RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME] = () => {
4150
+ RecaptchaEnterpriseVerifier.scriptInjectionDeferred?.resolve();
4151
+ };
4125
4152
  _loadJS(url)
4153
+ .then(() => RecaptchaEnterpriseVerifier.scriptInjectionDeferred?.promise)
4126
4154
  .then(() => {
4127
4155
  retrieveRecaptchaToken(siteKey, resolve, reject);
4128
4156
  })
@@ -4137,6 +4165,18 @@ class RecaptchaEnterpriseVerifier {
4137
4165
  });
4138
4166
  }
4139
4167
  }
4168
+ /**
4169
+ * Deferred that resolves when script tag has been injected onto the page
4170
+ * and the script is ready (grecaptcha.ready() and script.onload are not
4171
+ * reliable indicators, so this resolves when the global
4172
+ * `window[RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME]()` callback provided to the recaptcha url param "onload"
4173
+ * is triggered).
4174
+ * As a static variable this is applied to all instances of the class.
4175
+ * This will cause an error if users try to create multiple RecaptchaVerifiers
4176
+ * with different Recaptcha Enterprise sitekeys, which should be an
4177
+ * unuspported use case.
4178
+ */
4179
+ RecaptchaEnterpriseVerifier.scriptInjectionDeferred = null;
4140
4180
  async function injectRecaptchaFields(auth, request, action, isCaptchaResp = false, isFakeToken = false) {
4141
4181
  const verifier = new RecaptchaEnterpriseVerifier(auth);
4142
4182
  let captchaResponse;
@@ -7917,7 +7957,7 @@ function multiFactor(user) {
7917
7957
  }
7918
7958
 
7919
7959
  var name = "@firebase/auth";
7920
- var version = "1.13.1";
7960
+ var version = "1.13.2-eap-crashlytics.558ee841d";
7921
7961
 
7922
7962
  /**
7923
7963
  * @license
@@ -9731,4 +9771,4 @@ function generateNoEvent() {
9731
9771
  }
9732
9772
 
9733
9773
  export { signInWithEmailAndPassword as $, ActionCodeOperation as A, PhoneAuthCredential as B, inMemoryPersistence as C, EmailAuthProvider as D, EmailAuthCredential as E, FactorId as F, FacebookAuthProvider as G, GoogleAuthProvider as H, GithubAuthProvider as I, OAuthProvider as J, SAMLAuthProvider as K, signInAnonymously as L, signInWithCredential as M, linkWithCredential as N, OperationType as O, ProviderId as P, reauthenticateWithCredential as Q, signInWithCustomToken as R, SignInMethod as S, TwitterAuthProvider as T, sendPasswordResetEmail as U, confirmPasswordReset as V, applyActionCode as W, checkActionCode as X, verifyPasswordResetCode as Y, createUserWithEmailAndPassword as Z, _signInWithRedirect as _, _reauthenticateWithRedirect as a, debugFail as a$, sendSignInLinkToEmail as a0, isSignInWithEmailLink as a1, signInWithEmailLink as a2, fetchSignInMethodsForEmail as a3, sendEmailVerification as a4, verifyBeforeUpdateEmail as a5, ActionCodeURL as a6, parseActionCodeURL as a7, updateProfile as a8, updateEmail as a9, FAKE_TOKEN as aA, startEnrollPhoneMfa as aB, handleRecaptchaFlow as aC, sendPhoneVerificationCode as aD, _link$1 as aE, _assertInstanceOf as aF, _withDefaultResolver as aG, AbstractPopupRedirectOperation as aH, debugAssert as aI, _generateEventId as aJ, FederatedAuthProvider as aK, _getProjectConfig as aL, _fail as aM, _getCurrentUrl as aN, _gapiScriptUrl as aO, _emulatorUrl as aP, _isChromeIOS as aQ, _isFirefox as aR, _isIOSStandalone as aS, _getRedirectResult as aT, _overrideRedirectResult as aU, _getRedirectUrl as aV, _setWindowLocation as aW, _isMobileBrowser as aX, _isSafari as aY, _isIOS as aZ, AuthEventManager as a_, updatePassword as aa, getIdToken as ab, getIdTokenResult as ac, unlink as ad, getAdditionalUserInfo as ae, reload as af, getMultiFactorResolver as ag, multiFactor as ah, _performApiRequest as ai, _addTidIfNecessary as aj, Delay as ak, _window as al, _assert as am, isV2 as an, _createError as ao, _recaptchaV2ScriptUrl as ap, _loadJS as aq, MockReCaptcha as ar, _generateCallbackName as as, _castAuth as at, _isHttpOrHttps as au, _isWorker as av, getRecaptchaParams as aw, _serverAppCurrentUserOperationNotSupportedError as ax, _assertLinkedStatus as ay, _initializeRecaptchaConfig as az, _linkWithRedirect as b, finalizeEnrollPhoneMfa as b0, startEnrollTotpMfa as b1, finalizeEnrollTotpMfa as b2, _setExternalJSProvider as b3, _persistenceKeyName as b4, UserImpl as b5, _getInstance as b6, AuthImpl as b7, _getClientVersion as b8, FetchProvider as b9, SAMLAuthCredential as ba, signInWithRedirect as bb, linkWithRedirect as bc, reauthenticateWithRedirect as bd, indexedDBLocalPersistence as c, cordovaPopupRedirectResolver as d, browserLocalPersistence as e, browserSessionPersistence as f, getRedirectResult as g, initializeRecaptchaConfig as h, initializeAuth as i, beforeAuthStateChanged as j, onAuthStateChanged as k, updateCurrentUser as l, signOut as m, revokeAccessToken as n, onIdTokenChanged as o, deleteUser as p, debugErrorMap as q, registerAuth as r, setPersistence as s, prodErrorMap as t, useDeviceLanguage as u, validatePassword as v, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as w, connectAuthEmulator as x, AuthCredential as y, OAuthCredential as z };
9734
- //# sourceMappingURL=popup_redirect-e90e6597.js.map
9774
+ //# sourceMappingURL=popup_redirect-8f954bab.js.map