@firebase/auth 1.13.2 → 1.13.3-20260615181107

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 (61) hide show
  1. package/dist/browser-cjs/{index-cb4d4017.js → index-1f558345.js} +42 -8
  2. package/dist/browser-cjs/index-1f558345.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-66dd494e.js → popup_redirect-c0dec4fb.js} +43 -9
  10. package/dist/cordova/popup_redirect-c0dec4fb.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-9d184c40.js → index-139892c1.js} +43 -9
  14. package/dist/esm/index-139892c1.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 +42 -8
  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-90def736.js → totp-4803792f.js} +42 -8
  26. package/dist/node/totp-4803792f.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-5d40279f.js → totp-2a4487f1.js} +43 -9
  32. package/dist/node-esm/totp-2a4487f1.js.map +1 -0
  33. package/dist/rn/{index-d963ed8d.js → index-a4f26c54.js} +42 -8
  34. package/dist/rn/index-a4f26c54.js.map +1 -0
  35. package/dist/rn/index.js +1 -1
  36. package/dist/rn/internal.js +2 -2
  37. package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  38. package/dist/rn/test/helpers/mock_loadjs.d.ts +17 -0
  39. package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  40. package/dist/test/helpers/mock_loadjs.d.ts +17 -0
  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-5aa6f443.js → register-d3246200.js} +42 -8
  44. package/dist/web-extension-cjs/register-d3246200.js.map +1 -0
  45. package/dist/web-extension-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  46. package/dist/web-extension-cjs/test/helpers/mock_loadjs.d.ts +17 -0
  47. package/dist/web-extension-esm/index.js +2 -2
  48. package/dist/web-extension-esm/internal.js +2 -2
  49. package/dist/web-extension-esm/{register-01796967.js → register-afae00a4.js} +43 -9
  50. package/dist/web-extension-esm/register-afae00a4.js.map +1 -0
  51. package/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +18 -0
  52. package/dist/web-extension-esm/test/helpers/mock_loadjs.d.ts +17 -0
  53. package/package.json +3 -3
  54. package/dist/browser-cjs/index-cb4d4017.js.map +0 -1
  55. package/dist/cordova/popup_redirect-66dd494e.js.map +0 -1
  56. package/dist/esm/index-9d184c40.js.map +0 -1
  57. package/dist/node/totp-90def736.js.map +0 -1
  58. package/dist/node-esm/totp-5d40279f.js.map +0 -1
  59. package/dist/rn/index-d963ed8d.js.map +0 -1
  60. package/dist/web-extension-cjs/register-5aa6f443.js.map +0 -1
  61. package/dist/web-extension-esm/register-01796967.js.map +0 -1
package/dist/rn/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var app = require('@firebase/app');
6
- var index = require('./index-d963ed8d.js');
6
+ var index = require('./index-a4f26c54.js');
7
7
  require('@firebase/util');
8
8
  require('@firebase/component');
9
9
  require('@firebase/logger');
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-d963ed8d.js');
6
- var app = require('@firebase/app');
5
+ var index = require('./index-a4f26c54.js');
7
6
  var util = require('@firebase/util');
7
+ var app = require('@firebase/app');
8
8
  require('@firebase/component');
9
9
  require('@firebase/logger');
10
10
 
@@ -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-5aa6f443.js');
5
+ var register = require('./register-d3246200.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-5aa6f443.js');
5
+ var register = require('./register-d3246200.js');
6
6
  var util = require('@firebase/util');
7
7
  var app = require('@firebase/app');
8
8
  require('@firebase/component');
@@ -806,8 +806,8 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
806
806
  }
807
807
  }
808
808
  const query = util.querystring({
809
- key: auth.config.apiKey,
810
- ...params
809
+ ...params,
810
+ key: auth.config.apiKey
811
811
  }).slice(1);
812
812
  const headers = await auth._getAdditionalHeaders();
813
813
  headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json';
@@ -824,7 +824,7 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
824
824
  'RequestInitializerDict' is not implemented."
825
825
  https://github.com/cloudflare/next-on-pages/issues/487 */
826
826
  if (!util.isCloudflareWorker()) {
827
- fetchArgs.referrerPolicy = 'no-referrer';
827
+ fetchArgs.referrerPolicy = 'strict-origin-when-cross-origin';
828
828
  }
829
829
  if (auth.emulatorConfig && util.isCloudWorkstation(auth.emulatorConfig.host)) {
830
830
  fetchArgs.credentials = 'include';
@@ -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;
@@ -8113,7 +8147,7 @@ function _isEmptyString(input) {
8113
8147
  }
8114
8148
 
8115
8149
  var name = "@firebase/auth";
8116
- var version = "1.13.2";
8150
+ var version = "1.13.3-20260615181107";
8117
8151
 
8118
8152
  /**
8119
8153
  * @license
@@ -8377,4 +8411,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
8377
8411
  exports.validatePassword = validatePassword;
8378
8412
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
8379
8413
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
8380
- //# sourceMappingURL=register-5aa6f443.js.map
8414
+ //# sourceMappingURL=register-d3246200.js.map