@firebase/auth 0.21.6 → 0.22.0-canary.1d6771eb3

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 (218) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +5 -0
  3. package/dist/auth-public.d.ts +59 -3
  4. package/dist/auth.d.ts +74 -13
  5. package/dist/browser-cjs/{index-39443020.js → index-7393ca6a.js} +593 -208
  6. package/dist/browser-cjs/index-7393ca6a.js.map +1 -0
  7. package/dist/browser-cjs/index.js +3 -2
  8. package/dist/browser-cjs/index.js.map +1 -1
  9. package/dist/browser-cjs/internal.js +3 -2
  10. package/dist/browser-cjs/internal.js.map +1 -1
  11. package/dist/browser-cjs/src/api/authentication/email_and_password.d.ts +9 -0
  12. package/dist/browser-cjs/src/api/authentication/recaptcha.d.ts +16 -0
  13. package/dist/browser-cjs/src/api/authentication/sign_up.d.ts +4 -0
  14. package/dist/browser-cjs/src/api/errors.d.ts +9 -1
  15. package/dist/browser-cjs/src/api/index.d.ts +17 -2
  16. package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +9 -1
  17. package/dist/browser-cjs/src/core/errors.d.ts +18 -1
  18. package/dist/browser-cjs/src/core/index.d.ts +27 -0
  19. package/dist/browser-cjs/src/core/util/handler.d.ts +1 -1
  20. package/dist/browser-cjs/src/core/util/log.d.ts +1 -0
  21. package/dist/browser-cjs/src/mfa/assertions/totp.d.ts +2 -2
  22. package/dist/browser-cjs/src/model/auth.d.ts +6 -0
  23. package/dist/browser-cjs/src/platform_browser/auth_window.d.ts +2 -2
  24. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
  25. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
  26. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
  27. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
  28. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
  29. package/dist/browser-cjs/src/platform_browser/strategies/popup.d.ts +1 -1
  30. package/dist/browser-cjs/test/helpers/api/helper.d.ts +2 -0
  31. package/dist/browser-cjs/test/helpers/mock_auth.d.ts +5 -0
  32. package/dist/cordova/index.js +2 -2
  33. package/dist/cordova/internal.js +21 -77
  34. package/dist/cordova/internal.js.map +1 -1
  35. package/dist/cordova/{popup_redirect-8b388294.js → popup_redirect-eae95465.js} +781 -215
  36. package/dist/cordova/popup_redirect-eae95465.js.map +1 -0
  37. package/dist/cordova/src/api/authentication/email_and_password.d.ts +9 -0
  38. package/dist/cordova/src/api/authentication/recaptcha.d.ts +16 -0
  39. package/dist/cordova/src/api/authentication/sign_up.d.ts +4 -0
  40. package/dist/cordova/src/api/errors.d.ts +9 -1
  41. package/dist/cordova/src/api/index.d.ts +17 -2
  42. package/dist/cordova/src/core/auth/auth_impl.d.ts +9 -1
  43. package/dist/cordova/src/core/errors.d.ts +18 -1
  44. package/dist/cordova/src/core/index.d.ts +27 -0
  45. package/dist/cordova/src/core/util/handler.d.ts +1 -1
  46. package/dist/cordova/src/core/util/log.d.ts +1 -0
  47. package/dist/cordova/src/mfa/assertions/totp.d.ts +2 -2
  48. package/dist/cordova/src/model/auth.d.ts +6 -0
  49. package/dist/cordova/src/platform_browser/auth_window.d.ts +2 -2
  50. package/dist/cordova/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
  51. package/dist/cordova/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
  52. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
  53. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
  54. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
  55. package/dist/cordova/src/platform_browser/strategies/popup.d.ts +1 -1
  56. package/dist/cordova/test/helpers/api/helper.d.ts +2 -0
  57. package/dist/cordova/test/helpers/mock_auth.d.ts +5 -0
  58. package/dist/esm2017/{index-2d01563f.js → index-1124980d.js} +594 -210
  59. package/dist/esm2017/index-1124980d.js.map +1 -0
  60. package/dist/esm2017/index.js +2 -2
  61. package/dist/esm2017/internal.js +3 -3
  62. package/dist/esm2017/src/api/authentication/email_and_password.d.ts +9 -0
  63. package/dist/esm2017/src/api/authentication/recaptcha.d.ts +16 -0
  64. package/dist/esm2017/src/api/authentication/sign_up.d.ts +4 -0
  65. package/dist/esm2017/src/api/errors.d.ts +9 -1
  66. package/dist/esm2017/src/api/index.d.ts +17 -2
  67. package/dist/esm2017/src/core/auth/auth_impl.d.ts +9 -1
  68. package/dist/esm2017/src/core/errors.d.ts +18 -1
  69. package/dist/esm2017/src/core/index.d.ts +27 -0
  70. package/dist/esm2017/src/core/util/handler.d.ts +1 -1
  71. package/dist/esm2017/src/core/util/log.d.ts +1 -0
  72. package/dist/esm2017/src/mfa/assertions/totp.d.ts +2 -2
  73. package/dist/esm2017/src/model/auth.d.ts +6 -0
  74. package/dist/esm2017/src/platform_browser/auth_window.d.ts +2 -2
  75. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
  76. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
  77. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
  78. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
  79. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
  80. package/dist/esm2017/src/platform_browser/strategies/popup.d.ts +1 -1
  81. package/dist/esm2017/test/helpers/api/helper.d.ts +2 -0
  82. package/dist/esm2017/test/helpers/mock_auth.d.ts +5 -0
  83. package/dist/esm5/{index-44fc929c.js → index-169fb84f.js} +800 -290
  84. package/dist/esm5/index-169fb84f.js.map +1 -0
  85. package/dist/esm5/index.js +1 -1
  86. package/dist/esm5/internal.js +2 -2
  87. package/dist/esm5/src/api/authentication/email_and_password.d.ts +9 -0
  88. package/dist/esm5/src/api/authentication/recaptcha.d.ts +16 -0
  89. package/dist/esm5/src/api/authentication/sign_up.d.ts +4 -0
  90. package/dist/esm5/src/api/errors.d.ts +9 -1
  91. package/dist/esm5/src/api/index.d.ts +17 -2
  92. package/dist/esm5/src/core/auth/auth_impl.d.ts +9 -1
  93. package/dist/esm5/src/core/errors.d.ts +18 -1
  94. package/dist/esm5/src/core/index.d.ts +27 -0
  95. package/dist/esm5/src/core/util/handler.d.ts +1 -1
  96. package/dist/esm5/src/core/util/log.d.ts +1 -0
  97. package/dist/esm5/src/mfa/assertions/totp.d.ts +2 -2
  98. package/dist/esm5/src/model/auth.d.ts +6 -0
  99. package/dist/esm5/src/platform_browser/auth_window.d.ts +2 -2
  100. package/dist/esm5/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
  101. package/dist/esm5/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
  102. package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
  103. package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
  104. package/dist/esm5/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
  105. package/dist/esm5/src/platform_browser/strategies/popup.d.ts +1 -1
  106. package/dist/esm5/test/helpers/api/helper.d.ts +2 -0
  107. package/dist/esm5/test/helpers/mock_auth.d.ts +5 -0
  108. package/dist/index.webworker.esm5.js +605 -75
  109. package/dist/index.webworker.esm5.js.map +1 -1
  110. package/dist/node/index.js +2 -1
  111. package/dist/node/index.js.map +1 -1
  112. package/dist/node/internal.js +62 -42
  113. package/dist/node/internal.js.map +1 -1
  114. package/dist/node/src/api/authentication/email_and_password.d.ts +9 -0
  115. package/dist/node/src/api/authentication/recaptcha.d.ts +16 -0
  116. package/dist/node/src/api/authentication/sign_up.d.ts +4 -0
  117. package/dist/node/src/api/errors.d.ts +9 -1
  118. package/dist/node/src/api/index.d.ts +17 -2
  119. package/dist/node/src/core/auth/auth_impl.d.ts +9 -1
  120. package/dist/node/src/core/errors.d.ts +18 -1
  121. package/dist/node/src/core/index.d.ts +27 -0
  122. package/dist/node/src/core/util/handler.d.ts +1 -1
  123. package/dist/node/src/core/util/log.d.ts +1 -0
  124. package/dist/node/src/mfa/assertions/totp.d.ts +2 -2
  125. package/dist/node/src/model/auth.d.ts +6 -0
  126. package/dist/node/src/platform_browser/auth_window.d.ts +2 -2
  127. package/dist/node/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
  128. package/dist/node/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
  129. package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
  130. package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
  131. package/dist/node/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
  132. package/dist/node/src/platform_browser/strategies/popup.d.ts +1 -1
  133. package/dist/node/test/helpers/api/helper.d.ts +2 -0
  134. package/dist/node/test/helpers/mock_auth.d.ts +5 -0
  135. package/dist/node/{totp-5e73d8e7.js → totp-13fce87f.js} +703 -172
  136. package/dist/node/totp-13fce87f.js.map +1 -0
  137. package/dist/node-esm/index.js +1 -1
  138. package/dist/node-esm/internal.js +16 -4
  139. package/dist/node-esm/internal.js.map +1 -1
  140. package/dist/node-esm/src/api/authentication/email_and_password.d.ts +9 -0
  141. package/dist/node-esm/src/api/authentication/recaptcha.d.ts +16 -0
  142. package/dist/node-esm/src/api/authentication/sign_up.d.ts +4 -0
  143. package/dist/node-esm/src/api/errors.d.ts +9 -1
  144. package/dist/node-esm/src/api/index.d.ts +17 -2
  145. package/dist/node-esm/src/core/auth/auth_impl.d.ts +9 -1
  146. package/dist/node-esm/src/core/errors.d.ts +18 -1
  147. package/dist/node-esm/src/core/index.d.ts +27 -0
  148. package/dist/node-esm/src/core/util/handler.d.ts +1 -1
  149. package/dist/node-esm/src/core/util/log.d.ts +1 -0
  150. package/dist/node-esm/src/mfa/assertions/totp.d.ts +2 -2
  151. package/dist/node-esm/src/model/auth.d.ts +6 -0
  152. package/dist/node-esm/src/platform_browser/auth_window.d.ts +2 -2
  153. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
  154. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
  155. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
  156. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
  157. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
  158. package/dist/node-esm/src/platform_browser/strategies/popup.d.ts +1 -1
  159. package/dist/node-esm/test/helpers/api/helper.d.ts +2 -0
  160. package/dist/node-esm/test/helpers/mock_auth.d.ts +5 -0
  161. package/dist/node-esm/{totp-7b645f19.js → totp-aee19ee4.js} +560 -141
  162. package/dist/node-esm/totp-aee19ee4.js.map +1 -0
  163. package/dist/rn/index.js +2 -1
  164. package/dist/rn/index.js.map +1 -1
  165. package/dist/rn/internal.js +79 -48
  166. package/dist/rn/internal.js.map +1 -1
  167. package/dist/rn/{phone-ec210006.js → phone-26700494.js} +741 -260
  168. package/dist/rn/phone-26700494.js.map +1 -0
  169. package/dist/rn/src/api/authentication/email_and_password.d.ts +9 -0
  170. package/dist/rn/src/api/authentication/recaptcha.d.ts +16 -0
  171. package/dist/rn/src/api/authentication/sign_up.d.ts +4 -0
  172. package/dist/rn/src/api/errors.d.ts +9 -1
  173. package/dist/rn/src/api/index.d.ts +17 -2
  174. package/dist/rn/src/core/auth/auth_impl.d.ts +9 -1
  175. package/dist/rn/src/core/errors.d.ts +18 -1
  176. package/dist/rn/src/core/index.d.ts +27 -0
  177. package/dist/rn/src/core/util/handler.d.ts +1 -1
  178. package/dist/rn/src/core/util/log.d.ts +1 -0
  179. package/dist/rn/src/mfa/assertions/totp.d.ts +2 -2
  180. package/dist/rn/src/model/auth.d.ts +6 -0
  181. package/dist/rn/src/platform_browser/auth_window.d.ts +2 -2
  182. package/dist/rn/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
  183. package/dist/rn/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
  184. package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
  185. package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
  186. package/dist/rn/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
  187. package/dist/rn/src/platform_browser/strategies/popup.d.ts +1 -1
  188. package/dist/rn/test/helpers/api/helper.d.ts +2 -0
  189. package/dist/rn/test/helpers/mock_auth.d.ts +5 -0
  190. package/dist/src/api/authentication/email_and_password.d.ts +9 -0
  191. package/dist/src/api/authentication/recaptcha.d.ts +16 -0
  192. package/dist/src/api/authentication/sign_up.d.ts +4 -0
  193. package/dist/src/api/errors.d.ts +9 -1
  194. package/dist/src/api/index.d.ts +17 -2
  195. package/dist/src/core/auth/auth_impl.d.ts +9 -1
  196. package/dist/src/core/errors.d.ts +18 -1
  197. package/dist/src/core/index.d.ts +27 -0
  198. package/dist/src/core/util/handler.d.ts +1 -1
  199. package/dist/src/core/util/log.d.ts +1 -0
  200. package/dist/src/mfa/assertions/totp.d.ts +2 -2
  201. package/dist/src/model/auth.d.ts +6 -0
  202. package/dist/src/platform_browser/auth_window.d.ts +2 -2
  203. package/dist/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
  204. package/dist/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
  205. package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
  206. package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
  207. package/dist/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
  208. package/dist/src/platform_browser/strategies/popup.d.ts +1 -1
  209. package/dist/test/helpers/api/helper.d.ts +2 -0
  210. package/dist/test/helpers/mock_auth.d.ts +5 -0
  211. package/package.json +6 -6
  212. package/dist/browser-cjs/index-39443020.js.map +0 -1
  213. package/dist/cordova/popup_redirect-8b388294.js.map +0 -1
  214. package/dist/esm2017/index-2d01563f.js.map +0 -1
  215. package/dist/esm5/index-44fc929c.js.map +0 -1
  216. package/dist/node/totp-5e73d8e7.js.map +0 -1
  217. package/dist/node-esm/totp-7b645f19.js.map +0 -1
  218. package/dist/rn/phone-ec210006.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { ErrorFactory, deepEqual, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, getModularInstance, base64Decode, getUA, isIE, createSubscribe, querystringDecode, extractQuerystring, isEmpty, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';
1
+ import { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, getModularInstance, base64Decode, getUA, isIE, createSubscribe, deepEqual, querystringDecode, extractQuerystring, isEmpty, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';
2
2
  import { SDK_VERSION, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';
3
- import { Logger, LogLevel } from '@firebase/logger';
4
3
  import { __rest } from 'tslib';
4
+ import { Logger, LogLevel } from '@firebase/logger';
5
5
  import { Component } from '@firebase/component';
6
6
 
7
7
  /**
@@ -212,6 +212,7 @@ function _debugErrorMap() {
212
212
  ["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */]: 'The request does not contain a valid nonce. This can occur if the ' +
213
213
  'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
214
214
  'in the ID token payload.',
215
+ ["missing-password" /* AuthErrorCode.MISSING_PASSWORD */]: 'A non-empty password must be provided',
215
216
  ["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */]: 'No second factor identifier is provided.',
216
217
  ["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */]: 'The request is missing proof of first factor successful sign-in.',
217
218
  ["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */]: 'To send verification codes, provide a phone number for the recipient.',
@@ -264,7 +265,15 @@ function _debugErrorMap() {
264
265
  ["already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */]: 'initializeAuth() has already been called with ' +
265
266
  'different options. To avoid this error, call initializeAuth() with the ' +
266
267
  'same options as when it was originally called, or call getAuth() to return the' +
267
- ' already initialized instance.'
268
+ ' already initialized instance.',
269
+ ["missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */]: 'The reCAPTCHA token is missing when sending request to the backend.',
270
+ ["invalid-recaptcha-token" /* AuthErrorCode.INVALID_RECAPTCHA_TOKEN */]: 'The reCAPTCHA token is invalid when sending request to the backend.',
271
+ ["invalid-recaptcha-action" /* AuthErrorCode.INVALID_RECAPTCHA_ACTION */]: 'The reCAPTCHA action is invalid when sending request to the backend.',
272
+ ["recaptcha-not-enabled" /* AuthErrorCode.RECAPTCHA_NOT_ENABLED */]: 'reCAPTCHA Enterprise integration is not enabled for this project.',
273
+ ["missing-client-type" /* AuthErrorCode.MISSING_CLIENT_TYPE */]: 'The reCAPTCHA client type is missing when sending request to the backend.',
274
+ ["missing-recaptcha-version" /* AuthErrorCode.MISSING_RECAPTCHA_VERSION */]: 'The reCAPTCHA version is missing when sending request to the backend.',
275
+ ["invalid-req-type" /* AuthErrorCode.INVALID_REQ_TYPE */]: 'Invalid request parameters.',
276
+ ["invalid-recaptcha-version" /* AuthErrorCode.INVALID_RECAPTCHA_VERSION */]: 'The reCAPTCHA version is invalid when sending request to the backend.'
268
277
  };
269
278
  }
270
279
  function _prodErrorMap() {
@@ -400,7 +409,15 @@ const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {
400
409
  USER_SIGNED_OUT: 'auth/user-signed-out',
401
410
  WEAK_PASSWORD: 'auth/weak-password',
402
411
  WEB_STORAGE_UNSUPPORTED: 'auth/web-storage-unsupported',
403
- ALREADY_INITIALIZED: 'auth/already-initialized'
412
+ ALREADY_INITIALIZED: 'auth/already-initialized',
413
+ RECAPTCHA_NOT_ENABLED: 'auth/recaptcha-not-enabled',
414
+ MISSING_RECAPTCHA_TOKEN: 'auth/missing-recaptcha-token',
415
+ INVALID_RECAPTCHA_TOKEN: 'auth/invalid-recaptcha-token',
416
+ INVALID_RECAPTCHA_ACTION: 'auth/invalid-recaptcha-action',
417
+ MISSING_CLIENT_TYPE: 'auth/missing-client-type',
418
+ MISSING_RECAPTCHA_VERSION: 'auth/missing-recaptcha-version',
419
+ INVALID_RECAPTCHA_VERSION: 'auth/invalid-recaptcha-version',
420
+ INVALID_REQ_TYPE: 'auth/invalid-req-type'
404
421
  };
405
422
 
406
423
  /**
@@ -420,6 +437,11 @@ const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {
420
437
  * limitations under the License.
421
438
  */
422
439
  const logClient = new Logger('@firebase/auth');
440
+ function _logWarn(msg, ...args) {
441
+ if (logClient.logLevel <= LogLevel.WARN) {
442
+ logClient.warn(`Auth (${SDK_VERSION}): ${msg}`, ...args);
443
+ }
444
+ }
423
445
  function _logError(msg, ...args) {
424
446
  if (logClient.logLevel <= LogLevel.ERROR) {
425
447
  logClient.error(`Auth (${SDK_VERSION}): ${msg}`, ...args);
@@ -510,103 +532,6 @@ function debugAssert(assertion, message) {
510
532
  }
511
533
  }
512
534
 
513
- /**
514
- * @license
515
- * Copyright 2020 Google LLC
516
- *
517
- * Licensed under the Apache License, Version 2.0 (the "License");
518
- * you may not use this file except in compliance with the License.
519
- * You may obtain a copy of the License at
520
- *
521
- * http://www.apache.org/licenses/LICENSE-2.0
522
- *
523
- * Unless required by applicable law or agreed to in writing, software
524
- * distributed under the License is distributed on an "AS IS" BASIS,
525
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
526
- * See the License for the specific language governing permissions and
527
- * limitations under the License.
528
- */
529
- const instanceCache = new Map();
530
- function _getInstance(cls) {
531
- debugAssert(cls instanceof Function, 'Expected a class definition');
532
- let instance = instanceCache.get(cls);
533
- if (instance) {
534
- debugAssert(instance instanceof cls, 'Instance stored in cache mismatched with class');
535
- return instance;
536
- }
537
- instance = new cls();
538
- instanceCache.set(cls, instance);
539
- return instance;
540
- }
541
-
542
- /**
543
- * @license
544
- * Copyright 2020 Google LLC
545
- *
546
- * Licensed under the Apache License, Version 2.0 (the "License");
547
- * you may not use this file except in compliance with the License.
548
- * You may obtain a copy of the License at
549
- *
550
- * http://www.apache.org/licenses/LICENSE-2.0
551
- *
552
- * Unless required by applicable law or agreed to in writing, software
553
- * distributed under the License is distributed on an "AS IS" BASIS,
554
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
555
- * See the License for the specific language governing permissions and
556
- * limitations under the License.
557
- */
558
- /**
559
- * Initializes an {@link Auth} instance with fine-grained control over
560
- * {@link Dependencies}.
561
- *
562
- * @remarks
563
- *
564
- * This function allows more control over the {@link Auth} instance than
565
- * {@link getAuth}. `getAuth` uses platform-specific defaults to supply
566
- * the {@link Dependencies}. In general, `getAuth` is the easiest way to
567
- * initialize Auth and works for most use cases. Use `initializeAuth` if you
568
- * need control over which persistence layer is used, or to minimize bundle
569
- * size if you're not using either `signInWithPopup` or `signInWithRedirect`.
570
- *
571
- * For example, if your app only uses anonymous accounts and you only want
572
- * accounts saved for the current session, initialize `Auth` with:
573
- *
574
- * ```js
575
- * const auth = initializeAuth(app, {
576
- * persistence: browserSessionPersistence,
577
- * popupRedirectResolver: undefined,
578
- * });
579
- * ```
580
- *
581
- * @public
582
- */
583
- function initializeAuth(app, deps) {
584
- const provider = _getProvider(app, 'auth');
585
- if (provider.isInitialized()) {
586
- const auth = provider.getImmediate();
587
- const initialOptions = provider.getOptions();
588
- if (deepEqual(initialOptions, deps !== null && deps !== void 0 ? deps : {})) {
589
- return auth;
590
- }
591
- else {
592
- _fail(auth, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
593
- }
594
- }
595
- const auth = provider.initialize({ options: deps });
596
- return auth;
597
- }
598
- function _initializeAuthInstance(auth, deps) {
599
- const persistence = (deps === null || deps === void 0 ? void 0 : deps.persistence) || [];
600
- const hierarchy = (Array.isArray(persistence) ? persistence : [persistence]).map(_getInstance);
601
- if (deps === null || deps === void 0 ? void 0 : deps.errorMap) {
602
- auth._updateErrorMap(deps.errorMap);
603
- }
604
- // This promise is intended to float; auth initialization happens in the
605
- // background, meanwhile the auth object may be used by the app.
606
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
607
- auth._initializeWithPersistence(hierarchy, deps === null || deps === void 0 ? void 0 : deps.popupRedirectResolver);
608
- }
609
-
610
535
  /**
611
536
  * @license
612
537
  * Copyright 2020 Google LLC
@@ -838,7 +763,7 @@ const SERVER_ERROR_MAP = {
838
763
  // Sign in with email and password errors (some apply to sign up too).
839
764
  ["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */]: "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
840
765
  // This can only happen if the SDK sends a bad request.
841
- ["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
766
+ ["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */]: "missing-password" /* AuthErrorCode.MISSING_PASSWORD */,
842
767
  // Sign up with email and password errors.
843
768
  ["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */]: "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
844
769
  ["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */]: "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
@@ -885,7 +810,16 @@ const SERVER_ERROR_MAP = {
885
810
  ["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */]: "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,
886
811
  ["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */]: "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,
887
812
  // Blocking functions related errors.
888
- ["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */
813
+ ["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
814
+ // Recaptcha related errors.
815
+ ["RECAPTCHA_NOT_ENABLED" /* ServerError.RECAPTCHA_NOT_ENABLED */]: "recaptcha-not-enabled" /* AuthErrorCode.RECAPTCHA_NOT_ENABLED */,
816
+ ["MISSING_RECAPTCHA_TOKEN" /* ServerError.MISSING_RECAPTCHA_TOKEN */]: "missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */,
817
+ ["INVALID_RECAPTCHA_TOKEN" /* ServerError.INVALID_RECAPTCHA_TOKEN */]: "invalid-recaptcha-token" /* AuthErrorCode.INVALID_RECAPTCHA_TOKEN */,
818
+ ["INVALID_RECAPTCHA_ACTION" /* ServerError.INVALID_RECAPTCHA_ACTION */]: "invalid-recaptcha-action" /* AuthErrorCode.INVALID_RECAPTCHA_ACTION */,
819
+ ["MISSING_CLIENT_TYPE" /* ServerError.MISSING_CLIENT_TYPE */]: "missing-client-type" /* AuthErrorCode.MISSING_CLIENT_TYPE */,
820
+ ["MISSING_RECAPTCHA_VERSION" /* ServerError.MISSING_RECAPTCHA_VERSION */]: "missing-recaptcha-version" /* AuthErrorCode.MISSING_RECAPTCHA_VERSION */,
821
+ ["INVALID_RECAPTCHA_VERSION" /* ServerError.INVALID_RECAPTCHA_VERSION */]: "invalid-recaptcha-version" /* AuthErrorCode.INVALID_RECAPTCHA_VERSION */,
822
+ ["INVALID_REQ_TYPE" /* ServerError.INVALID_REQ_TYPE */]: "invalid-req-type" /* AuthErrorCode.INVALID_REQ_TYPE */
889
823
  };
890
824
 
891
825
  /**
@@ -1787,6 +1721,35 @@ class UserImpl {
1787
1721
  }
1788
1722
  }
1789
1723
 
1724
+ /**
1725
+ * @license
1726
+ * Copyright 2020 Google LLC
1727
+ *
1728
+ * Licensed under the Apache License, Version 2.0 (the "License");
1729
+ * you may not use this file except in compliance with the License.
1730
+ * You may obtain a copy of the License at
1731
+ *
1732
+ * http://www.apache.org/licenses/LICENSE-2.0
1733
+ *
1734
+ * Unless required by applicable law or agreed to in writing, software
1735
+ * distributed under the License is distributed on an "AS IS" BASIS,
1736
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1737
+ * See the License for the specific language governing permissions and
1738
+ * limitations under the License.
1739
+ */
1740
+ const instanceCache = new Map();
1741
+ function _getInstance(cls) {
1742
+ debugAssert(cls instanceof Function, 'Expected a class definition');
1743
+ let instance = instanceCache.get(cls);
1744
+ if (instance) {
1745
+ debugAssert(instance instanceof cls, 'Instance stored in cache mismatched with class');
1746
+ return instance;
1747
+ }
1748
+ instance = new cls();
1749
+ instanceCache.set(cls, instance);
1750
+ return instance;
1751
+ }
1752
+
1790
1753
  /**
1791
1754
  * @license
1792
1755
  * Copyright 2019 Google LLC
@@ -2128,6 +2091,242 @@ function _getClientVersion(clientPlatform, frameworks = []) {
2128
2091
  return `${reportedPlatform}/${"JsCore" /* ClientImplementation.CORE */}/${SDK_VERSION}/${reportedFrameworks}`;
2129
2092
  }
2130
2093
 
2094
+ /**
2095
+ * @license
2096
+ * Copyright 2020 Google LLC
2097
+ *
2098
+ * Licensed under the Apache License, Version 2.0 (the "License");
2099
+ * you may not use this file except in compliance with the License.
2100
+ * You may obtain a copy of the License at
2101
+ *
2102
+ * http://www.apache.org/licenses/LICENSE-2.0
2103
+ *
2104
+ * Unless required by applicable law or agreed to in writing, software
2105
+ * distributed under the License is distributed on an "AS IS" BASIS,
2106
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2107
+ * See the License for the specific language governing permissions and
2108
+ * limitations under the License.
2109
+ */
2110
+ async function getRecaptchaParams(auth) {
2111
+ return ((await _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/recaptchaParams" /* Endpoint.GET_RECAPTCHA_PARAM */)).recaptchaSiteKey || '');
2112
+ }
2113
+ async function getRecaptchaConfig(auth, request) {
2114
+ return _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v2/recaptchaConfig" /* Endpoint.GET_RECAPTCHA_CONFIG */, _addTidIfNecessary(auth, request));
2115
+ }
2116
+
2117
+ /**
2118
+ * @license
2119
+ * Copyright 2020 Google LLC
2120
+ *
2121
+ * Licensed under the Apache License, Version 2.0 (the "License");
2122
+ * you may not use this file except in compliance with the License.
2123
+ * You may obtain a copy of the License at
2124
+ *
2125
+ * http://www.apache.org/licenses/LICENSE-2.0
2126
+ *
2127
+ * Unless required by applicable law or agreed to in writing, software
2128
+ * distributed under the License is distributed on an "AS IS" BASIS,
2129
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2130
+ * See the License for the specific language governing permissions and
2131
+ * limitations under the License.
2132
+ */
2133
+ function isV2(grecaptcha) {
2134
+ return (grecaptcha !== undefined &&
2135
+ grecaptcha.getResponse !== undefined);
2136
+ }
2137
+ function isEnterprise(grecaptcha) {
2138
+ return (grecaptcha !== undefined &&
2139
+ grecaptcha.enterprise !== undefined);
2140
+ }
2141
+ class RecaptchaConfig {
2142
+ constructor(response) {
2143
+ /**
2144
+ * The reCAPTCHA site key.
2145
+ */
2146
+ this.siteKey = '';
2147
+ /**
2148
+ * The reCAPTCHA enablement status of the {@link EmailAuthProvider} for the current tenant.
2149
+ */
2150
+ this.emailPasswordEnabled = false;
2151
+ if (response.recaptchaKey === undefined) {
2152
+ throw new Error('recaptchaKey undefined');
2153
+ }
2154
+ // Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
2155
+ this.siteKey = response.recaptchaKey.split('/')[3];
2156
+ this.emailPasswordEnabled = response.recaptchaEnforcementState.some(enforcementState => enforcementState.provider === 'EMAIL_PASSWORD_PROVIDER' &&
2157
+ enforcementState.enforcementState !== 'OFF');
2158
+ }
2159
+ }
2160
+
2161
+ /**
2162
+ * @license
2163
+ * Copyright 2020 Google LLC
2164
+ *
2165
+ * Licensed under the Apache License, Version 2.0 (the "License");
2166
+ * you may not use this file except in compliance with the License.
2167
+ * You may obtain a copy of the License at
2168
+ *
2169
+ * http://www.apache.org/licenses/LICENSE-2.0
2170
+ *
2171
+ * Unless required by applicable law or agreed to in writing, software
2172
+ * distributed under the License is distributed on an "AS IS" BASIS,
2173
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2174
+ * See the License for the specific language governing permissions and
2175
+ * limitations under the License.
2176
+ */
2177
+ function getScriptParentElement() {
2178
+ var _a, _b;
2179
+ return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document;
2180
+ }
2181
+ function _loadJS(url) {
2182
+ // TODO: consider adding timeout support & cancellation
2183
+ return new Promise((resolve, reject) => {
2184
+ const el = document.createElement('script');
2185
+ el.setAttribute('src', url);
2186
+ el.onload = resolve;
2187
+ el.onerror = e => {
2188
+ const error = _createError("internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
2189
+ error.customData = e;
2190
+ reject(error);
2191
+ };
2192
+ el.type = 'text/javascript';
2193
+ el.charset = 'UTF-8';
2194
+ getScriptParentElement().appendChild(el);
2195
+ });
2196
+ }
2197
+ function _generateCallbackName(prefix) {
2198
+ return `__${prefix}${Math.floor(Math.random() * 1000000)}`;
2199
+ }
2200
+
2201
+ /* eslint-disable @typescript-eslint/no-require-imports */
2202
+ const RECAPTCHA_ENTERPRISE_URL = 'https://www.google.com/recaptcha/enterprise.js?render=';
2203
+ const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';
2204
+ class RecaptchaEnterpriseVerifier {
2205
+ /**
2206
+ *
2207
+ * @param authExtern - The corresponding Firebase {@link Auth} instance.
2208
+ *
2209
+ */
2210
+ constructor(authExtern) {
2211
+ /**
2212
+ * Identifies the type of application verifier (e.g. "recaptcha-enterprise").
2213
+ */
2214
+ this.type = RECAPTCHA_ENTERPRISE_VERIFIER_TYPE;
2215
+ this.auth = _castAuth(authExtern);
2216
+ }
2217
+ /**
2218
+ * Executes the verification process.
2219
+ *
2220
+ * @returns A Promise for a token that can be used to assert the validity of a request.
2221
+ */
2222
+ async verify(action = 'verify', forceRefresh = false) {
2223
+ async function retrieveSiteKey(auth) {
2224
+ if (!forceRefresh) {
2225
+ if (auth.tenantId == null && auth._agentRecaptchaConfig != null) {
2226
+ return auth._agentRecaptchaConfig.siteKey;
2227
+ }
2228
+ if (auth.tenantId != null &&
2229
+ auth._tenantRecaptchaConfigs[auth.tenantId] !== undefined) {
2230
+ return auth._tenantRecaptchaConfigs[auth.tenantId].siteKey;
2231
+ }
2232
+ }
2233
+ return new Promise(async (resolve, reject) => {
2234
+ getRecaptchaConfig(auth, {
2235
+ clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
2236
+ version: "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
2237
+ })
2238
+ .then(response => {
2239
+ if (response.recaptchaKey === undefined) {
2240
+ reject(new Error('recaptcha Enterprise site key undefined'));
2241
+ }
2242
+ else {
2243
+ const config = new RecaptchaConfig(response);
2244
+ if (auth.tenantId == null) {
2245
+ auth._agentRecaptchaConfig = config;
2246
+ }
2247
+ else {
2248
+ auth._tenantRecaptchaConfigs[auth.tenantId] = config;
2249
+ }
2250
+ return resolve(config.siteKey);
2251
+ }
2252
+ })
2253
+ .catch(error => {
2254
+ reject(error);
2255
+ });
2256
+ });
2257
+ }
2258
+ function retrieveRecaptchaToken(siteKey, resolve, reject) {
2259
+ const grecaptcha = window.grecaptcha;
2260
+ if (isEnterprise(grecaptcha)) {
2261
+ grecaptcha.enterprise.ready(() => {
2262
+ try {
2263
+ grecaptcha.enterprise
2264
+ .execute(siteKey, { action })
2265
+ .then(token => {
2266
+ resolve(token);
2267
+ })
2268
+ .catch(error => {
2269
+ reject(error);
2270
+ });
2271
+ }
2272
+ catch (error) {
2273
+ reject(error);
2274
+ }
2275
+ });
2276
+ }
2277
+ else {
2278
+ reject(Error('No reCAPTCHA enterprise script loaded.'));
2279
+ }
2280
+ }
2281
+ return new Promise((resolve, reject) => {
2282
+ retrieveSiteKey(this.auth)
2283
+ .then(siteKey => {
2284
+ if (!forceRefresh && isEnterprise(window.grecaptcha)) {
2285
+ retrieveRecaptchaToken(siteKey, resolve, reject);
2286
+ }
2287
+ else {
2288
+ if (typeof window === 'undefined') {
2289
+ reject(new Error('RecaptchaVerifier is only supported in browser'));
2290
+ return;
2291
+ }
2292
+ _loadJS(RECAPTCHA_ENTERPRISE_URL + siteKey)
2293
+ .then(() => {
2294
+ retrieveRecaptchaToken(siteKey, resolve, reject);
2295
+ })
2296
+ .catch(error => {
2297
+ reject(error);
2298
+ });
2299
+ }
2300
+ })
2301
+ .catch(error => {
2302
+ reject(error);
2303
+ });
2304
+ });
2305
+ }
2306
+ }
2307
+ async function injectRecaptchaFields(auth, request, action, captchaResp = false) {
2308
+ const verifier = new RecaptchaEnterpriseVerifier(auth);
2309
+ let captchaResponse;
2310
+ try {
2311
+ captchaResponse = await verifier.verify(action);
2312
+ }
2313
+ catch (error) {
2314
+ captchaResponse = await verifier.verify(action, true);
2315
+ }
2316
+ const newRequest = Object.assign({}, request);
2317
+ if (!captchaResp) {
2318
+ Object.assign(newRequest, { captchaResponse });
2319
+ }
2320
+ else {
2321
+ Object.assign(newRequest, { 'captchaResp': captchaResponse });
2322
+ }
2323
+ Object.assign(newRequest, { 'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ });
2324
+ Object.assign(newRequest, {
2325
+ 'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
2326
+ });
2327
+ return newRequest;
2328
+ }
2329
+
2131
2330
  /**
2132
2331
  * @license
2133
2332
  * Copyright 2022 Google LLC
@@ -2226,9 +2425,10 @@ class AuthMiddlewareQueue {
2226
2425
  * limitations under the License.
2227
2426
  */
2228
2427
  class AuthImpl {
2229
- constructor(app, heartbeatServiceProvider, config) {
2428
+ constructor(app, heartbeatServiceProvider, appCheckServiceProvider, config) {
2230
2429
  this.app = app;
2231
2430
  this.heartbeatServiceProvider = heartbeatServiceProvider;
2431
+ this.appCheckServiceProvider = appCheckServiceProvider;
2232
2432
  this.config = config;
2233
2433
  this.currentUser = null;
2234
2434
  this.emulatorConfig = null;
@@ -2246,6 +2446,8 @@ class AuthImpl {
2246
2446
  this._initializationPromise = null;
2247
2447
  this._popupRedirectResolver = null;
2248
2448
  this._errorFactory = _DEFAULT_AUTH_ERROR_FACTORY;
2449
+ this._agentRecaptchaConfig = null;
2450
+ this._tenantRecaptchaConfigs = {};
2249
2451
  // Tracks the last notified UID for state change listeners to prevent
2250
2452
  // repeated calls to the callbacks. Undefined means it's never been
2251
2453
  // called, whereas null means it's been called with a signed out user
@@ -2465,6 +2667,31 @@ class AuthImpl {
2465
2667
  await this.assertedPersistence.setPersistence(_getInstance(persistence));
2466
2668
  });
2467
2669
  }
2670
+ async initializeRecaptchaConfig() {
2671
+ const response = await getRecaptchaConfig(this, {
2672
+ clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
2673
+ version: "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
2674
+ });
2675
+ const config = new RecaptchaConfig(response);
2676
+ if (this.tenantId == null) {
2677
+ this._agentRecaptchaConfig = config;
2678
+ }
2679
+ else {
2680
+ this._tenantRecaptchaConfigs[this.tenantId] = config;
2681
+ }
2682
+ if (config.emailPasswordEnabled) {
2683
+ const verifier = new RecaptchaEnterpriseVerifier(this);
2684
+ void verifier.verify();
2685
+ }
2686
+ }
2687
+ _getRecaptchaConfig() {
2688
+ if (this.tenantId == null) {
2689
+ return this._agentRecaptchaConfig;
2690
+ }
2691
+ else {
2692
+ return this._tenantRecaptchaConfigs[this.tenantId];
2693
+ }
2694
+ }
2468
2695
  _getPersistence() {
2469
2696
  return this.assertedPersistence.persistence.type;
2470
2697
  }
@@ -2644,8 +2871,26 @@ class AuthImpl {
2644
2871
  if (heartbeatsHeader) {
2645
2872
  headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
2646
2873
  }
2874
+ // If the App Check service exists, add the App Check token in the headers
2875
+ const appCheckToken = await this._getAppCheckToken();
2876
+ if (appCheckToken) {
2877
+ headers["X-Firebase-AppCheck" /* HttpHeader.X_FIREBASE_APP_CHECK */] = appCheckToken;
2878
+ }
2647
2879
  return headers;
2648
2880
  }
2881
+ async _getAppCheckToken() {
2882
+ var _a;
2883
+ const appCheckTokenResult = await ((_a = this.appCheckServiceProvider
2884
+ .getImmediate({ optional: true })) === null || _a === void 0 ? void 0 : _a.getToken());
2885
+ if (appCheckTokenResult === null || appCheckTokenResult === void 0 ? void 0 : appCheckTokenResult.error) {
2886
+ // Context: appCheck.getToken() will never throw even if an error happened.
2887
+ // In the error case, a dummy token will be returned along with an error field describing
2888
+ // the error. In general, we shouldn't care about the error condition and just use
2889
+ // the token (actual or dummy) to send requests.
2890
+ _logWarn(`Error while retrieving App Check token: ${appCheckTokenResult.error}`);
2891
+ }
2892
+ return appCheckTokenResult === null || appCheckTokenResult === void 0 ? void 0 : appCheckTokenResult.token;
2893
+ }
2649
2894
  }
2650
2895
  /**
2651
2896
  * Method to be used to cast down to our private implmentation of Auth.
@@ -2669,6 +2914,74 @@ class Subscription {
2669
2914
  }
2670
2915
  }
2671
2916
 
2917
+ /**
2918
+ * @license
2919
+ * Copyright 2020 Google LLC
2920
+ *
2921
+ * Licensed under the Apache License, Version 2.0 (the "License");
2922
+ * you may not use this file except in compliance with the License.
2923
+ * You may obtain a copy of the License at
2924
+ *
2925
+ * http://www.apache.org/licenses/LICENSE-2.0
2926
+ *
2927
+ * Unless required by applicable law or agreed to in writing, software
2928
+ * distributed under the License is distributed on an "AS IS" BASIS,
2929
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2930
+ * See the License for the specific language governing permissions and
2931
+ * limitations under the License.
2932
+ */
2933
+ /**
2934
+ * Initializes an {@link Auth} instance with fine-grained control over
2935
+ * {@link Dependencies}.
2936
+ *
2937
+ * @remarks
2938
+ *
2939
+ * This function allows more control over the {@link Auth} instance than
2940
+ * {@link getAuth}. `getAuth` uses platform-specific defaults to supply
2941
+ * the {@link Dependencies}. In general, `getAuth` is the easiest way to
2942
+ * initialize Auth and works for most use cases. Use `initializeAuth` if you
2943
+ * need control over which persistence layer is used, or to minimize bundle
2944
+ * size if you're not using either `signInWithPopup` or `signInWithRedirect`.
2945
+ *
2946
+ * For example, if your app only uses anonymous accounts and you only want
2947
+ * accounts saved for the current session, initialize `Auth` with:
2948
+ *
2949
+ * ```js
2950
+ * const auth = initializeAuth(app, {
2951
+ * persistence: browserSessionPersistence,
2952
+ * popupRedirectResolver: undefined,
2953
+ * });
2954
+ * ```
2955
+ *
2956
+ * @public
2957
+ */
2958
+ function initializeAuth(app, deps) {
2959
+ const provider = _getProvider(app, 'auth');
2960
+ if (provider.isInitialized()) {
2961
+ const auth = provider.getImmediate();
2962
+ const initialOptions = provider.getOptions();
2963
+ if (deepEqual(initialOptions, deps !== null && deps !== void 0 ? deps : {})) {
2964
+ return auth;
2965
+ }
2966
+ else {
2967
+ _fail(auth, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
2968
+ }
2969
+ }
2970
+ const auth = provider.initialize({ options: deps });
2971
+ return auth;
2972
+ }
2973
+ function _initializeAuthInstance(auth, deps) {
2974
+ const persistence = (deps === null || deps === void 0 ? void 0 : deps.persistence) || [];
2975
+ const hierarchy = (Array.isArray(persistence) ? persistence : [persistence]).map(_getInstance);
2976
+ if (deps === null || deps === void 0 ? void 0 : deps.errorMap) {
2977
+ auth._updateErrorMap(deps.errorMap);
2978
+ }
2979
+ // This promise is intended to float; auth initialization happens in the
2980
+ // background, meanwhile the auth object may be used by the app.
2981
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
2982
+ auth._initializeWithPersistence(hierarchy, deps === null || deps === void 0 ? void 0 : deps.popupRedirectResolver);
2983
+ }
2984
+
2672
2985
  /**
2673
2986
  * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
2674
2987
  * Firebase Auth services.
@@ -3008,13 +3321,31 @@ class EmailAuthCredential extends AuthCredential {
3008
3321
  }
3009
3322
  /** @internal */
3010
3323
  async _getIdTokenResponse(auth) {
3324
+ var _a;
3011
3325
  switch (this.signInMethod) {
3012
3326
  case "password" /* SignInMethod.EMAIL_PASSWORD */:
3013
- return signInWithPassword(auth, {
3327
+ const request = {
3014
3328
  returnSecureToken: true,
3015
3329
  email: this._email,
3016
- password: this._password
3017
- });
3330
+ password: this._password,
3331
+ clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
3332
+ };
3333
+ if ((_a = auth._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled) {
3334
+ const requestWithRecaptcha = await injectRecaptchaFields(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */);
3335
+ return signInWithPassword(auth, requestWithRecaptcha);
3336
+ }
3337
+ else {
3338
+ return signInWithPassword(auth, request).catch(async (error) => {
3339
+ if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
3340
+ console.log('Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
3341
+ const requestWithRecaptcha = await injectRecaptchaFields(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */);
3342
+ return signInWithPassword(auth, requestWithRecaptcha);
3343
+ }
3344
+ else {
3345
+ return Promise.reject(error);
3346
+ }
3347
+ });
3348
+ }
3018
3349
  case "emailLink" /* SignInMethod.EMAIL_LINK */:
3019
3350
  return signInWithEmailLink$1(auth, {
3020
3351
  email: this._email,
@@ -4973,15 +5304,39 @@ function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
4973
5304
  * @public
4974
5305
  */
4975
5306
  async function sendPasswordResetEmail(auth, email, actionCodeSettings) {
4976
- const authModular = getModularInstance(auth);
5307
+ var _a;
5308
+ const authInternal = _castAuth(auth);
4977
5309
  const request = {
4978
5310
  requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
4979
- email
5311
+ email,
5312
+ clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
4980
5313
  };
4981
- if (actionCodeSettings) {
4982
- _setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
5314
+ if ((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled) {
5315
+ const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true);
5316
+ if (actionCodeSettings) {
5317
+ _setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
5318
+ }
5319
+ await sendPasswordResetEmail$1(authInternal, requestWithRecaptcha);
5320
+ }
5321
+ else {
5322
+ if (actionCodeSettings) {
5323
+ _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
5324
+ }
5325
+ await sendPasswordResetEmail$1(authInternal, request)
5326
+ .catch(async (error) => {
5327
+ if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
5328
+ console.log('Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.');
5329
+ const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true);
5330
+ if (actionCodeSettings) {
5331
+ _setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
5332
+ }
5333
+ await sendPasswordResetEmail$1(authInternal, requestWithRecaptcha);
5334
+ }
5335
+ else {
5336
+ return Promise.reject(error);
5337
+ }
5338
+ });
4983
5339
  }
4984
- await sendPasswordResetEmail$1(authModular, request);
4985
5340
  }
4986
5341
  /**
4987
5342
  * Completes the password reset process, given a confirmation code and new password.
@@ -5094,11 +5449,33 @@ async function verifyPasswordResetCode(auth, code) {
5094
5449
  * @public
5095
5450
  */
5096
5451
  async function createUserWithEmailAndPassword(auth, email, password) {
5452
+ var _a;
5097
5453
  const authInternal = _castAuth(auth);
5098
- const response = await signUp(authInternal, {
5454
+ const request = {
5099
5455
  returnSecureToken: true,
5100
5456
  email,
5101
- password
5457
+ password,
5458
+ clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
5459
+ };
5460
+ let signUpResponse;
5461
+ if ((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled) {
5462
+ const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */);
5463
+ signUpResponse = signUp(authInternal, requestWithRecaptcha);
5464
+ }
5465
+ else {
5466
+ signUpResponse = signUp(authInternal, request).catch(async (error) => {
5467
+ if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
5468
+ console.log('Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.');
5469
+ const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */);
5470
+ return signUp(authInternal, requestWithRecaptcha);
5471
+ }
5472
+ else {
5473
+ return Promise.reject(error);
5474
+ }
5475
+ });
5476
+ }
5477
+ const response = await signUpResponse.catch(error => {
5478
+ return Promise.reject(error);
5102
5479
  });
5103
5480
  const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response);
5104
5481
  await authInternal._updateCurrentUser(userCredential.user);
@@ -5179,16 +5556,39 @@ function signInWithEmailAndPassword(auth, email, password) {
5179
5556
  * @public
5180
5557
  */
5181
5558
  async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
5182
- const authModular = getModularInstance(auth);
5559
+ var _a;
5560
+ const authInternal = _castAuth(auth);
5183
5561
  const request = {
5184
5562
  requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
5185
- email
5563
+ email,
5564
+ clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
5186
5565
  };
5187
- _assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
5188
- if (actionCodeSettings) {
5189
- _setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
5566
+ function setActionCodeSettings(request, actionCodeSettings) {
5567
+ _assert(actionCodeSettings.handleCodeInApp, authInternal, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
5568
+ if (actionCodeSettings) {
5569
+ _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
5570
+ }
5571
+ }
5572
+ if ((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled) {
5573
+ const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true);
5574
+ setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
5575
+ await sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha);
5576
+ }
5577
+ else {
5578
+ setActionCodeSettings(request, actionCodeSettings);
5579
+ await sendSignInLinkToEmail$1(authInternal, request)
5580
+ .catch(async (error) => {
5581
+ if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
5582
+ console.log('Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
5583
+ const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true);
5584
+ setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
5585
+ await sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha);
5586
+ }
5587
+ else {
5588
+ return Promise.reject(error);
5589
+ }
5590
+ });
5190
5591
  }
5191
- await sendSignInLinkToEmail$1(authModular, request);
5192
5592
  }
5193
5593
  /**
5194
5594
  * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.
@@ -5683,11 +6083,41 @@ function getAdditionalUserInfo(userCredential) {
5683
6083
  function setPersistence(auth, persistence) {
5684
6084
  return getModularInstance(auth).setPersistence(persistence);
5685
6085
  }
6086
+ /**
6087
+ * Loads the reCAPTCHA configuration into the `Auth` instance.
6088
+ *
6089
+ * @remarks
6090
+ * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA
6091
+ * verification flow should be triggered for each auth provider, into the
6092
+ * current Auth session.
6093
+ *
6094
+ * If initializeRecaptchaConfig() is not invoked, the auth flow will always start
6095
+ * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA
6096
+ * verification, the SDK will transparently load the reCAPTCHA config and restart the
6097
+ * auth flows.
6098
+ *
6099
+ * Thus, by calling this optional method, you will reduce the latency of future auth flows.
6100
+ * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.
6101
+ *
6102
+ * @example
6103
+ * ```javascript
6104
+ * initializeRecaptchaConfig(auth);
6105
+ * ```
6106
+ *
6107
+ * @param auth - The {@link Auth} instance.
6108
+ *
6109
+ * @public
6110
+ */
6111
+ function initializeRecaptchaConfig(auth) {
6112
+ const authInternal = _castAuth(auth);
6113
+ return authInternal.initializeRecaptchaConfig();
6114
+ }
5686
6115
  /**
5687
6116
  * Adds an observer for changes to the signed-in user's ID token.
5688
6117
  *
5689
6118
  * @remarks
5690
6119
  * This includes sign-in, sign-out, and token refresh events.
6120
+ * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.
5691
6121
  *
5692
6122
  * @param auth - The {@link Auth} instance.
5693
6123
  * @param nextOrObserver - callback triggered on change.
@@ -7027,66 +7457,6 @@ function finalizeSignInTotpMfa(auth, request) {
7027
7457
  return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
7028
7458
  }
7029
7459
 
7030
- /**
7031
- * @license
7032
- * Copyright 2020 Google LLC
7033
- *
7034
- * Licensed under the Apache License, Version 2.0 (the "License");
7035
- * you may not use this file except in compliance with the License.
7036
- * You may obtain a copy of the License at
7037
- *
7038
- * http://www.apache.org/licenses/LICENSE-2.0
7039
- *
7040
- * Unless required by applicable law or agreed to in writing, software
7041
- * distributed under the License is distributed on an "AS IS" BASIS,
7042
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7043
- * See the License for the specific language governing permissions and
7044
- * limitations under the License.
7045
- */
7046
- async function getRecaptchaParams(auth) {
7047
- return ((await _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/recaptchaParams" /* Endpoint.GET_RECAPTCHA_PARAM */)).recaptchaSiteKey || '');
7048
- }
7049
-
7050
- /**
7051
- * @license
7052
- * Copyright 2020 Google LLC
7053
- *
7054
- * Licensed under the Apache License, Version 2.0 (the "License");
7055
- * you may not use this file except in compliance with the License.
7056
- * You may obtain a copy of the License at
7057
- *
7058
- * http://www.apache.org/licenses/LICENSE-2.0
7059
- *
7060
- * Unless required by applicable law or agreed to in writing, software
7061
- * distributed under the License is distributed on an "AS IS" BASIS,
7062
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7063
- * See the License for the specific language governing permissions and
7064
- * limitations under the License.
7065
- */
7066
- function getScriptParentElement() {
7067
- var _a, _b;
7068
- return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document;
7069
- }
7070
- function _loadJS(url) {
7071
- // TODO: consider adding timeout support & cancellation
7072
- return new Promise((resolve, reject) => {
7073
- const el = document.createElement('script');
7074
- el.setAttribute('src', url);
7075
- el.onload = resolve;
7076
- el.onerror = e => {
7077
- const error = _createError("internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
7078
- error.customData = e;
7079
- reject(error);
7080
- };
7081
- el.type = 'text/javascript';
7082
- el.charset = 'UTF-8';
7083
- getScriptParentElement().appendChild(el);
7084
- });
7085
- }
7086
- function _generateCallbackName(prefix) {
7087
- return `__${prefix}${Math.floor(Math.random() * 1000000)}`;
7088
- }
7089
-
7090
7460
  /**
7091
7461
  * @license
7092
7462
  * Copyright 2020 Google LLC
@@ -7253,7 +7623,7 @@ class ReCaptchaLoaderImpl {
7253
7623
  }
7254
7624
  load(auth, hl = '') {
7255
7625
  _assert(isHostLanguageValid(hl), auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
7256
- if (this.shouldResolveImmediately(hl)) {
7626
+ if (this.shouldResolveImmediately(hl) && isV2(_window().grecaptcha)) {
7257
7627
  return Promise.resolve(_window().grecaptcha);
7258
7628
  }
7259
7629
  return new Promise((resolve, reject) => {
@@ -7264,7 +7634,7 @@ class ReCaptchaLoaderImpl {
7264
7634
  _window().clearTimeout(networkTimeout);
7265
7635
  delete _window()[_JSLOAD_CALLBACK];
7266
7636
  const recaptcha = _window().grecaptcha;
7267
- if (!recaptcha) {
7637
+ if (!recaptcha || !isV2(recaptcha)) {
7268
7638
  reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */));
7269
7639
  return;
7270
7640
  }
@@ -8248,11 +8618,13 @@ class PopupOperation extends AbstractPopupRedirectOperation {
8248
8618
  if ((_b = (_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.window) === null || _b === void 0 ? void 0 : _b.closed) {
8249
8619
  // Make sure that there is sufficient time for whatever action to
8250
8620
  // complete. The window could have closed but the sign in network
8251
- // call could still be in flight.
8621
+ // call could still be in flight. This is specifically true for
8622
+ // Firefox or if the opener is in an iframe, in which case the oauth
8623
+ // helper closes the popup.
8252
8624
  this.pollId = window.setTimeout(() => {
8253
8625
  this.pollId = null;
8254
8626
  this.reject(_createError(this.auth, "popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */));
8255
- }, 2000 /* _Timeout.AUTH_EVENT */);
8627
+ }, 8000 /* _Timeout.AUTH_EVENT */);
8256
8628
  return;
8257
8629
  }
8258
8630
  this.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get());
@@ -9110,7 +9482,13 @@ const WIDGET_PATH = '__/auth/handler';
9110
9482
  * @internal
9111
9483
  */
9112
9484
  const EMULATOR_WIDGET_PATH = 'emulator/auth/handler';
9113
- function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
9485
+ /**
9486
+ * Fragment name for the App Check token that gets passed to the widget
9487
+ *
9488
+ * @internal
9489
+ */
9490
+ const FIREBASE_APP_CHECK_FRAGMENT_ID = encodeURIComponent('fac');
9491
+ async function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
9114
9492
  _assert(auth.config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
9115
9493
  _assert(auth.config.apiKey, auth, "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */);
9116
9494
  const params = {
@@ -9149,7 +9527,13 @@ function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additio
9149
9527
  delete paramsDict[key];
9150
9528
  }
9151
9529
  }
9152
- return `${getHandlerBase(auth)}?${querystring(paramsDict).slice(1)}`;
9530
+ // Sets the App Check token to pass to the widget
9531
+ const appCheckToken = await auth._getAppCheckToken();
9532
+ const appCheckTokenFragment = appCheckToken
9533
+ ? `#${FIREBASE_APP_CHECK_FRAGMENT_ID}=${encodeURIComponent(appCheckToken)}`
9534
+ : '';
9535
+ // Start at index 1 to skip the leading '&' in the query string
9536
+ return `${getHandlerBase(auth)}?${querystring(paramsDict).slice(1)}${appCheckTokenFragment}`;
9153
9537
  }
9154
9538
  function getHandlerBase({ config }) {
9155
9539
  if (!config.emulator) {
@@ -9193,12 +9577,13 @@ class BrowserPopupRedirectResolver {
9193
9577
  async _openPopup(auth, provider, authType, eventId) {
9194
9578
  var _a;
9195
9579
  debugAssert((_a = this.eventManagers[auth._key()]) === null || _a === void 0 ? void 0 : _a.manager, '_initialize() not called before _openPopup()');
9196
- const url = _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId);
9580
+ const url = await _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId);
9197
9581
  return _open(auth, url, _generateEventId());
9198
9582
  }
9199
9583
  async _openRedirect(auth, provider, authType, eventId) {
9200
9584
  await this._originValidation(auth);
9201
- _setWindowLocation(_getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId));
9585
+ const url = await _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId);
9586
+ _setWindowLocation(url);
9202
9587
  return new Promise(() => { });
9203
9588
  }
9204
9589
  _initialize(auth) {
@@ -9483,7 +9868,7 @@ function _isEmptyString(input) {
9483
9868
  }
9484
9869
 
9485
9870
  var name = "@firebase/auth";
9486
- var version = "0.21.6";
9871
+ var version = "0.22.0-canary.1d6771eb3";
9487
9872
 
9488
9873
  /**
9489
9874
  * @license
@@ -9589,26 +9974,25 @@ function registerAuth(clientPlatform) {
9589
9974
  _registerComponent(new Component("auth" /* _ComponentName.AUTH */, (container, { options: deps }) => {
9590
9975
  const app = container.getProvider('app').getImmediate();
9591
9976
  const heartbeatServiceProvider = container.getProvider('heartbeat');
9977
+ const appCheckServiceProvider = container.getProvider('app-check-internal');
9592
9978
  const { apiKey, authDomain } = app.options;
9593
- return ((app, heartbeatServiceProvider) => {
9594
- _assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
9595
- // Auth domain is optional if IdP sign in isn't being used
9596
- _assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
9597
- appName: app.name
9598
- });
9599
- const config = {
9600
- apiKey,
9601
- authDomain,
9602
- clientPlatform,
9603
- apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
9604
- tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
9605
- apiScheme: "https" /* DefaultConfig.API_SCHEME */,
9606
- sdkClientVersion: _getClientVersion(clientPlatform)
9607
- };
9608
- const authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
9609
- _initializeAuthInstance(authInstance, deps);
9610
- return authInstance;
9611
- })(app, heartbeatServiceProvider);
9979
+ _assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
9980
+ // Auth domain is optional if IdP sign in isn't being used
9981
+ _assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
9982
+ appName: app.name
9983
+ });
9984
+ const config = {
9985
+ apiKey,
9986
+ authDomain,
9987
+ clientPlatform,
9988
+ apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
9989
+ tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
9990
+ apiScheme: "https" /* DefaultConfig.API_SCHEME */,
9991
+ sdkClientVersion: _getClientVersion(clientPlatform)
9992
+ };
9993
+ const authInstance = new AuthImpl(app, heartbeatServiceProvider, appCheckServiceProvider, config);
9994
+ _initializeAuthInstance(authInstance, deps);
9995
+ return authInstance;
9612
9996
  }, "PUBLIC" /* ComponentType.PUBLIC */)
9613
9997
  /**
9614
9998
  * Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
@@ -9708,5 +10092,5 @@ function getAuth(app = getApp()) {
9708
10092
  }
9709
10093
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
9710
10094
 
9711
- export { linkWithCredential as $, ActionCodeOperation as A, deleteUser as B, debugErrorMap as C, prodErrorMap as D, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as E, FactorId as F, initializeAuth as G, connectAuthEmulator as H, AuthCredential as I, EmailAuthCredential as J, OAuthCredential as K, PhoneAuthCredential as L, inMemoryPersistence as M, EmailAuthProvider as N, OperationType as O, PhoneAuthProvider as P, FacebookAuthProvider as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, GoogleAuthProvider as U, GithubAuthProvider as V, OAuthProvider as W, SAMLAuthProvider as X, TwitterAuthProvider as Y, signInAnonymously as Z, signInWithCredential as _, browserSessionPersistence as a, reauthenticateWithCredential as a0, signInWithCustomToken as a1, sendPasswordResetEmail as a2, confirmPasswordReset as a3, applyActionCode as a4, checkActionCode as a5, verifyPasswordResetCode as a6, createUserWithEmailAndPassword as a7, signInWithEmailAndPassword as a8, sendSignInLinkToEmail as a9, AuthEventManager as aA, _getInstance as aB, _persistenceKeyName as aC, _getRedirectResult as aD, _overrideRedirectResult as aE, _clearRedirectOutcomes as aF, _castAuth as aG, UserImpl as aH, AuthImpl as aI, _getClientVersion as aJ, _generateEventId as aK, AuthPopup as aL, FetchProvider as aM, SAMLAuthCredential as aN, isSignInWithEmailLink as aa, signInWithEmailLink as ab, fetchSignInMethodsForEmail as ac, sendEmailVerification as ad, verifyBeforeUpdateEmail as ae, ActionCodeURL as af, parseActionCodeURL as ag, updateProfile as ah, updateEmail as ai, updatePassword as aj, getIdToken as ak, getIdTokenResult as al, unlink as am, getAdditionalUserInfo as an, reload as ao, getMultiFactorResolver as ap, multiFactor as aq, debugAssert as ar, _isIOS as as, _isAndroid as at, _fail as au, _getRedirectUrl as av, _getProjectConfig as aw, _isIOS7Or8 as ax, _createError as ay, _assert as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, onIdTokenChanged as t, updatePhoneNumber as u, beforeAuthStateChanged as v, onAuthStateChanged as w, useDeviceLanguage as x, updateCurrentUser as y, signOut as z };
9712
- //# sourceMappingURL=index-2d01563f.js.map
10095
+ export { signInWithCredential as $, ActionCodeOperation as A, signOut as B, deleteUser as C, debugErrorMap as D, prodErrorMap as E, FactorId as F, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as G, initializeAuth as H, connectAuthEmulator as I, AuthCredential as J, EmailAuthCredential as K, OAuthCredential as L, PhoneAuthCredential as M, inMemoryPersistence as N, OperationType as O, PhoneAuthProvider as P, EmailAuthProvider as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, FacebookAuthProvider as U, GoogleAuthProvider as V, GithubAuthProvider as W, OAuthProvider as X, SAMLAuthProvider as Y, TwitterAuthProvider as Z, signInAnonymously as _, browserSessionPersistence as a, linkWithCredential as a0, reauthenticateWithCredential as a1, signInWithCustomToken as a2, sendPasswordResetEmail as a3, confirmPasswordReset as a4, applyActionCode as a5, checkActionCode as a6, verifyPasswordResetCode as a7, createUserWithEmailAndPassword as a8, signInWithEmailAndPassword as a9, _assert as aA, AuthEventManager as aB, _getInstance as aC, _persistenceKeyName as aD, _getRedirectResult as aE, _overrideRedirectResult as aF, _clearRedirectOutcomes as aG, _castAuth as aH, UserImpl as aI, AuthImpl as aJ, _getClientVersion as aK, _generateEventId as aL, AuthPopup as aM, FetchProvider as aN, SAMLAuthCredential as aO, sendSignInLinkToEmail as aa, isSignInWithEmailLink as ab, signInWithEmailLink as ac, fetchSignInMethodsForEmail as ad, sendEmailVerification as ae, verifyBeforeUpdateEmail as af, ActionCodeURL as ag, parseActionCodeURL as ah, updateProfile as ai, updateEmail as aj, updatePassword as ak, getIdToken as al, getIdTokenResult as am, unlink as an, getAdditionalUserInfo as ao, reload as ap, getMultiFactorResolver as aq, multiFactor as ar, debugAssert as as, _isIOS as at, _isAndroid as au, _fail as av, _getRedirectUrl as aw, _getProjectConfig as ax, _isIOS7Or8 as ay, _createError as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, initializeRecaptchaConfig as t, updatePhoneNumber as u, onIdTokenChanged as v, beforeAuthStateChanged as w, onAuthStateChanged as x, useDeviceLanguage as y, updateCurrentUser as z };
10096
+ //# sourceMappingURL=index-1124980d.js.map