@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
@@ -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>;
@@ -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>;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var register = require('./register-410eef86.js');
5
+ var register = require('./register-6a93d6fa.js');
6
6
  var app = require('@firebase/app');
7
7
  var util = require('@firebase/util');
8
8
  require('@firebase/component');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var register = require('./register-410eef86.js');
5
+ var register = require('./register-6a93d6fa.js');
6
6
  var util = require('@firebase/util');
7
7
  var app = require('@firebase/app');
8
8
  require('@firebase/component');
@@ -3332,6 +3332,7 @@ function generateRandomAlphaNumericString(len) {
3332
3332
  /* eslint-disable @typescript-eslint/no-require-imports */
3333
3333
  const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';
3334
3334
  const FAKE_TOKEN = 'NO_RECAPTCHA';
3335
+ const RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME = 'onFirebaseAuthREInstanceReady';
3335
3336
  class RecaptchaEnterpriseVerifier {
3336
3337
  /**
3337
3338
  *
@@ -3411,8 +3412,13 @@ class RecaptchaEnterpriseVerifier {
3411
3412
  }
3412
3413
  return new Promise((resolve, reject) => {
3413
3414
  retrieveSiteKey(this.auth)
3414
- .then(siteKey => {
3415
- if (!forceRefresh && isEnterprise(window.grecaptcha)) {
3415
+ .then(async (siteKey) => {
3416
+ if (!forceRefresh &&
3417
+ isEnterprise(window.grecaptcha) &&
3418
+ // If download has already been initiated, do not trigger another
3419
+ // download, await the promise here.
3420
+ RecaptchaEnterpriseVerifier.scriptInjectionDeferred) {
3421
+ await RecaptchaEnterpriseVerifier.scriptInjectionDeferred.promise;
3416
3422
  retrieveRecaptchaToken(siteKey, resolve, reject);
3417
3423
  }
3418
3424
  else {
@@ -3422,9 +3428,25 @@ class RecaptchaEnterpriseVerifier {
3422
3428
  }
3423
3429
  let url = _recaptchaEnterpriseScriptUrl();
3424
3430
  if (url.length !== 0) {
3425
- url += siteKey;
3431
+ url +=
3432
+ siteKey +
3433
+ `&onload=${RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME}`;
3426
3434
  }
3435
+ // Existence of deferred indicates download has been initiated.
3436
+ RecaptchaEnterpriseVerifier.scriptInjectionDeferred =
3437
+ new util.Deferred();
3438
+ /**
3439
+ * Script attached to global window object that will be called
3440
+ * when the ReCAPTCHA Enterprise instance is ready.
3441
+ * grecaptcha.ready() is not reliable when there are multiple
3442
+ * scripts on the page, and script.onload only indicates the
3443
+ * script has downloaded, not that it has initialized.
3444
+ */
3445
+ window[RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME] = () => {
3446
+ RecaptchaEnterpriseVerifier.scriptInjectionDeferred?.resolve();
3447
+ };
3427
3448
  _loadJS(url)
3449
+ .then(() => RecaptchaEnterpriseVerifier.scriptInjectionDeferred?.promise)
3428
3450
  .then(() => {
3429
3451
  retrieveRecaptchaToken(siteKey, resolve, reject);
3430
3452
  })
@@ -3439,6 +3461,18 @@ class RecaptchaEnterpriseVerifier {
3439
3461
  });
3440
3462
  }
3441
3463
  }
3464
+ /**
3465
+ * Deferred that resolves when script tag has been injected onto the page
3466
+ * and the script is ready (grecaptcha.ready() and script.onload are not
3467
+ * reliable indicators, so this resolves when the global
3468
+ * `window[RECAPTCHA_ENTERPRISE_ONLOAD_CALLBACK_NAME]()` callback provided to the recaptcha url param "onload"
3469
+ * is triggered).
3470
+ * As a static variable this is applied to all instances of the class.
3471
+ * This will cause an error if users try to create multiple RecaptchaVerifiers
3472
+ * with different Recaptcha Enterprise sitekeys, which should be an
3473
+ * unuspported use case.
3474
+ */
3475
+ RecaptchaEnterpriseVerifier.scriptInjectionDeferred = null;
3442
3476
  async function injectRecaptchaFields(auth, request, action, isCaptchaResp = false, isFakeToken = false) {
3443
3477
  const verifier = new RecaptchaEnterpriseVerifier(auth);
3444
3478
  let captchaResponse;
@@ -7678,6 +7712,7 @@ const _TRANSACTION_RETRY_COUNT = 3;
7678
7712
  class IndexedDBLocalPersistence {
7679
7713
  constructor() {
7680
7714
  this.type = "LOCAL" /* PersistenceType.LOCAL */;
7715
+ this.dbPromise = null;
7681
7716
  this._shouldAllowMigration = true;
7682
7717
  this.listeners = {};
7683
7718
  this.localCache = {};
@@ -7694,11 +7729,14 @@ class IndexedDBLocalPersistence {
7694
7729
  this.initializeServiceWorkerMessaging().then(() => { }, () => { });
7695
7730
  }
7696
7731
  async _openDb() {
7697
- if (this.db) {
7698
- return this.db;
7732
+ if (this.dbPromise) {
7733
+ return this.dbPromise;
7699
7734
  }
7700
- this.db = await _openDatabase();
7701
- return this.db;
7735
+ this.dbPromise = _openDatabase();
7736
+ this.dbPromise.catch(() => {
7737
+ this.dbPromise = null;
7738
+ });
7739
+ return this.dbPromise;
7702
7740
  }
7703
7741
  async _withRetries(op) {
7704
7742
  let numAttempts = 0;
@@ -7711,9 +7749,10 @@ class IndexedDBLocalPersistence {
7711
7749
  if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {
7712
7750
  throw e;
7713
7751
  }
7714
- if (this.db) {
7715
- this.db.close();
7716
- this.db = undefined;
7752
+ if (this.dbPromise) {
7753
+ const db = await this.dbPromise;
7754
+ db.close();
7755
+ this.dbPromise = null;
7717
7756
  }
7718
7757
  // TODO: consider adding exponential backoff
7719
7758
  }
@@ -7798,9 +7837,10 @@ class IndexedDBLocalPersistence {
7798
7837
  if (!indexedDB) {
7799
7838
  return false;
7800
7839
  }
7801
- const db = await _openDatabase();
7802
- await _putObject(db, STORAGE_AVAILABLE_KEY, '1');
7803
- await _deleteObject(db, STORAGE_AVAILABLE_KEY);
7840
+ await this._withRetries(async (db) => {
7841
+ await _putObject(db, STORAGE_AVAILABLE_KEY, '1');
7842
+ await _deleteObject(db, STORAGE_AVAILABLE_KEY);
7843
+ });
7804
7844
  return true;
7805
7845
  }
7806
7846
  catch { }
@@ -8107,7 +8147,7 @@ function _isEmptyString(input) {
8107
8147
  }
8108
8148
 
8109
8149
  var name = "@firebase/auth";
8110
- var version = "1.13.1";
8150
+ var version = "1.13.2-eap-crashlytics.558ee841d";
8111
8151
 
8112
8152
  /**
8113
8153
  * @license
@@ -8371,4 +8411,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
8371
8411
  exports.validatePassword = validatePassword;
8372
8412
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
8373
8413
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
8374
- //# sourceMappingURL=register-410eef86.js.map
8414
+ //# sourceMappingURL=register-6a93d6fa.js.map