@firebase/auth 1.3.0-canary.0ae010ef2 → 1.3.0-canary.12f25592c

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 (46) hide show
  1. package/dist/browser-cjs/{index-77c7acd1.js → index-b8d969af.js} +28 -82
  2. package/dist/browser-cjs/index-b8d969af.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 +3 -0
  6. package/dist/cordova/index.js +2 -2
  7. package/dist/cordova/internal.js +2 -2
  8. package/dist/cordova/{popup_redirect-378dee5d.js → popup_redirect-5e5f5325.js} +76 -166
  9. package/dist/cordova/popup_redirect-5e5f5325.js.map +1 -0
  10. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
  11. package/dist/esm2017/{index-8ae48e33.js → index-d416518f.js} +28 -82
  12. package/dist/esm2017/index-d416518f.js.map +1 -0
  13. package/dist/esm2017/index.js +1 -1
  14. package/dist/esm2017/internal.js +2 -2
  15. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
  16. package/dist/esm5/{index-24e45e55.js → index-3f5e864f.js} +76 -166
  17. package/dist/esm5/index-3f5e864f.js.map +1 -0
  18. package/dist/esm5/index.js +1 -1
  19. package/dist/esm5/internal.js +2 -2
  20. package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
  21. package/dist/index.webworker.esm5.js +75 -165
  22. package/dist/index.webworker.esm5.js.map +1 -1
  23. package/dist/node/index.js +1 -1
  24. package/dist/node/internal.js +1 -1
  25. package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
  26. package/dist/node/{totp-55649440.js → totp-1d922ce9.js} +76 -166
  27. package/dist/node/totp-1d922ce9.js.map +1 -0
  28. package/dist/node-esm/index.js +1 -1
  29. package/dist/node-esm/internal.js +2 -2
  30. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
  31. package/dist/node-esm/{totp-4aedda59.js → totp-ab4fe73d.js} +28 -82
  32. package/dist/node-esm/totp-ab4fe73d.js.map +1 -0
  33. package/dist/rn/{index-dad0301e.js → index-81668c87.js} +76 -166
  34. package/dist/rn/index-81668c87.js.map +1 -0
  35. package/dist/rn/index.js +1 -1
  36. package/dist/rn/internal.js +1 -1
  37. package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
  38. package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
  39. package/package.json +6 -6
  40. package/dist/browser-cjs/index-77c7acd1.js.map +0 -1
  41. package/dist/cordova/popup_redirect-378dee5d.js.map +0 -1
  42. package/dist/esm2017/index-8ae48e33.js.map +0 -1
  43. package/dist/esm5/index-24e45e55.js.map +0 -1
  44. package/dist/node/totp-55649440.js.map +0 -1
  45. package/dist/node-esm/totp-4aedda59.js.map +0 -1
  46. package/dist/rn/index-dad0301e.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-77c7acd1.js');
5
+ var index = require('./index-b8d969af.js');
6
6
  require('@firebase/util');
7
7
  require('@firebase/app');
8
8
  require('@firebase/logger');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-77c7acd1.js');
5
+ var index = require('./index-b8d969af.js');
6
6
  var util = require('@firebase/util');
7
7
  require('@firebase/app');
8
8
  require('@firebase/logger');
@@ -39,4 +39,7 @@ export declare class RecaptchaEnterpriseVerifier {
39
39
  verify(action?: string, forceRefresh?: boolean): Promise<string>;
40
40
  }
41
41
  export declare function injectRecaptchaFields<T>(auth: AuthInternal, request: T, action: RecaptchaActionName, captchaResp?: boolean): Promise<T>;
42
+ declare type ActionMethod<TRequest, TResponse> = (auth: Auth, request: TRequest) => Promise<TResponse>;
43
+ export declare function handleRecaptchaFlow<TRequest, TResponse>(authInstance: AuthInternal, request: TRequest, actionName: RecaptchaActionName, actionMethod: ActionMethod<TRequest, TResponse>): Promise<TResponse>;
42
44
  export declare function _initializeRecaptchaConfig(auth: Auth): Promise<void>;
45
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { getApp, _getProvider } from '@firebase/app';
2
- import { _ as _signInWithRedirect, a as _reauthenticateWithRedirect, b as _linkWithRedirect, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, d as cordovaPopupRedirectResolver } from './popup_redirect-378dee5d.js';
3
- export { A as ActionCodeOperation, a5 as ActionCodeURL, x as AuthCredential, t as AuthErrorCodes, E as EmailAuthCredential, C as EmailAuthProvider, D as FacebookAuthProvider, F as FactorId, H as GithubAuthProvider, G as GoogleAuthProvider, y as OAuthCredential, I as OAuthProvider, O as OperationType, z as PhoneAuthCredential, P as ProviderId, J as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, V as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, W as checkActionCode, U as confirmPasswordReset, w as connectAuthEmulator, d as cordovaPopupRedirectResolver, Y as createUserWithEmailAndPassword, p as debugErrorMap, n as deleteUser, a2 as fetchSignInMethodsForEmail, ad as getAdditionalUserInfo, aa as getIdToken, ab as getIdTokenResult, af as getMultiFactorResolver, g as getRedirectResult, B as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a0 as isSignInWithEmailLink, M as linkWithCredential, ag as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a6 as parseActionCodeURL, q as prodErrorMap, N as reauthenticateWithCredential, ae as reload, a3 as sendEmailVerification, R as sendPasswordResetEmail, $ as sendSignInLinkToEmail, s as setPersistence, K as signInAnonymously, L as signInWithCredential, Q as signInWithCustomToken, Z as signInWithEmailAndPassword, a1 as signInWithEmailLink, m as signOut, ac as unlink, l as updateCurrentUser, a8 as updateEmail, a9 as updatePassword, a7 as updateProfile, u as useDeviceLanguage, v as validatePassword, a4 as verifyBeforeUpdateEmail, X as verifyPasswordResetCode } from './popup_redirect-378dee5d.js';
2
+ import { _ as _signInWithRedirect, a as _reauthenticateWithRedirect, b as _linkWithRedirect, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, d as cordovaPopupRedirectResolver } from './popup_redirect-5e5f5325.js';
3
+ export { A as ActionCodeOperation, a5 as ActionCodeURL, x as AuthCredential, t as AuthErrorCodes, E as EmailAuthCredential, C as EmailAuthProvider, D as FacebookAuthProvider, F as FactorId, H as GithubAuthProvider, G as GoogleAuthProvider, y as OAuthCredential, I as OAuthProvider, O as OperationType, z as PhoneAuthCredential, P as ProviderId, J as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, V as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, W as checkActionCode, U as confirmPasswordReset, w as connectAuthEmulator, d as cordovaPopupRedirectResolver, Y as createUserWithEmailAndPassword, p as debugErrorMap, n as deleteUser, a2 as fetchSignInMethodsForEmail, ad as getAdditionalUserInfo, aa as getIdToken, ab as getIdTokenResult, af as getMultiFactorResolver, g as getRedirectResult, B as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a0 as isSignInWithEmailLink, M as linkWithCredential, ag as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a6 as parseActionCodeURL, q as prodErrorMap, N as reauthenticateWithCredential, ae as reload, a3 as sendEmailVerification, R as sendPasswordResetEmail, $ as sendSignInLinkToEmail, s as setPersistence, K as signInAnonymously, L as signInWithCredential, Q as signInWithCustomToken, Z as signInWithEmailAndPassword, a1 as signInWithEmailLink, m as signOut, ac as unlink, l as updateCurrentUser, a8 as updateEmail, a9 as updatePassword, a7 as updateProfile, u as useDeviceLanguage, v as validatePassword, a4 as verifyBeforeUpdateEmail, X as verifyPasswordResetCode } from './popup_redirect-5e5f5325.js';
4
4
  import 'tslib';
5
5
  import '@firebase/util';
6
6
  import '@firebase/component';
@@ -1,5 +1,5 @@
1
- import { ah as _performApiRequest, ai as _addTidIfNecessary, aj as _assert, ak as Delay, al as _window, am as isV2, an as _createError, ao as _loadJS, ap as _generateCallbackName, aq as getRecaptchaParams, ar as _isHttpOrHttps, as as _isWorker, at as _castAuth, L as signInWithCredential, M as linkWithCredential, au as _assertLinkedStatus, N as reauthenticateWithCredential, av as sendPhoneVerificationCode, aw as startEnrollPhoneMfa, ax as _link, z as PhoneAuthCredential, ay as debugAssert, az as _generateEventId, aA as AbstractPopupRedirectOperation, aB as _assertInstanceOf, aC as _withDefaultResolver, aD as FederatedAuthProvider, aE as _fail, aF as _getProjectConfig, aG as _getCurrentUrl, aH as _emulatorUrl, aI as _isChromeIOS, aJ as _isFirefox, aK as _isIOSStandalone, aL as _getRedirectUrl, aM as _setWindowLocation, aN as _isMobileBrowser, aO as _isSafari, aP as _isIOS, f as browserSessionPersistence, aQ as _getRedirectResult, aR as _overrideRedirectResult, aS as AuthEventManager, aT as debugFail, aU as finalizeEnrollPhoneMfa, aV as finalizeEnrollTotpMfa, aW as startEnrollTotpMfa, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, e as browserLocalPersistence, j as beforeAuthStateChanged, o as onIdTokenChanged, w as connectAuthEmulator } from './popup_redirect-378dee5d.js';
2
- export { A as ActionCodeOperation, a5 as ActionCodeURL, x as AuthCredential, t as AuthErrorCodes, a_ as AuthImpl, E as EmailAuthCredential, C as EmailAuthProvider, D as FacebookAuthProvider, F as FactorId, b0 as FetchProvider, H as GithubAuthProvider, G as GoogleAuthProvider, y as OAuthCredential, I as OAuthProvider, O as OperationType, z as PhoneAuthCredential, P as ProviderId, b1 as SAMLAuthCredential, J as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, aY as UserImpl, aj as _assert, at as _castAuth, aE as _fail, az as _generateEventId, a$ as _getClientVersion, aZ as _getInstance, aQ as _getRedirectResult, aR as _overrideRedirectResult, aX as _persistenceKeyName, V as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, W as checkActionCode, U as confirmPasswordReset, w as connectAuthEmulator, d as cordovaPopupRedirectResolver, Y as createUserWithEmailAndPassword, p as debugErrorMap, n as deleteUser, a2 as fetchSignInMethodsForEmail, ad as getAdditionalUserInfo, aa as getIdToken, ab as getIdTokenResult, af as getMultiFactorResolver, g as getRedirectResult, B as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a0 as isSignInWithEmailLink, M as linkWithCredential, b3 as linkWithRedirect, ag as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a6 as parseActionCodeURL, q as prodErrorMap, N as reauthenticateWithCredential, b4 as reauthenticateWithRedirect, ae as reload, a3 as sendEmailVerification, R as sendPasswordResetEmail, $ as sendSignInLinkToEmail, s as setPersistence, K as signInAnonymously, L as signInWithCredential, Q as signInWithCustomToken, Z as signInWithEmailAndPassword, a1 as signInWithEmailLink, b2 as signInWithRedirect, m as signOut, ac as unlink, l as updateCurrentUser, a8 as updateEmail, a9 as updatePassword, a7 as updateProfile, u as useDeviceLanguage, v as validatePassword, a4 as verifyBeforeUpdateEmail, X as verifyPasswordResetCode } from './popup_redirect-378dee5d.js';
1
+ import { ah as _performApiRequest, ai as _addTidIfNecessary, aj as _assert, ak as Delay, al as _window, am as isV2, an as _createError, ao as _loadJS, ap as _generateCallbackName, aq as getRecaptchaParams, ar as _isHttpOrHttps, as as _isWorker, at as _castAuth, L as signInWithCredential, M as linkWithCredential, au as _assertLinkedStatus, N as reauthenticateWithCredential, av as sendPhoneVerificationCode, aw as startEnrollPhoneMfa, ax as _link, z as PhoneAuthCredential, ay as debugAssert, az as _generateEventId, aA as AbstractPopupRedirectOperation, aB as _assertInstanceOf, aC as _withDefaultResolver, aD as FederatedAuthProvider, aE as _fail, aF as _getProjectConfig, aG as _getCurrentUrl, aH as _emulatorUrl, aI as _isChromeIOS, aJ as _isFirefox, aK as _isIOSStandalone, aL as _getRedirectUrl, aM as _setWindowLocation, aN as _isMobileBrowser, aO as _isSafari, aP as _isIOS, f as browserSessionPersistence, aQ as _getRedirectResult, aR as _overrideRedirectResult, aS as AuthEventManager, aT as debugFail, aU as finalizeEnrollPhoneMfa, aV as finalizeEnrollTotpMfa, aW as startEnrollTotpMfa, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, e as browserLocalPersistence, j as beforeAuthStateChanged, o as onIdTokenChanged, w as connectAuthEmulator } from './popup_redirect-5e5f5325.js';
2
+ export { A as ActionCodeOperation, a5 as ActionCodeURL, x as AuthCredential, t as AuthErrorCodes, a_ as AuthImpl, E as EmailAuthCredential, C as EmailAuthProvider, D as FacebookAuthProvider, F as FactorId, b0 as FetchProvider, H as GithubAuthProvider, G as GoogleAuthProvider, y as OAuthCredential, I as OAuthProvider, O as OperationType, z as PhoneAuthCredential, P as ProviderId, b1 as SAMLAuthCredential, J as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, aY as UserImpl, aj as _assert, at as _castAuth, aE as _fail, az as _generateEventId, a$ as _getClientVersion, aZ as _getInstance, aQ as _getRedirectResult, aR as _overrideRedirectResult, aX as _persistenceKeyName, V as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, W as checkActionCode, U as confirmPasswordReset, w as connectAuthEmulator, d as cordovaPopupRedirectResolver, Y as createUserWithEmailAndPassword, p as debugErrorMap, n as deleteUser, a2 as fetchSignInMethodsForEmail, ad as getAdditionalUserInfo, aa as getIdToken, ab as getIdTokenResult, af as getMultiFactorResolver, g as getRedirectResult, B as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a0 as isSignInWithEmailLink, M as linkWithCredential, b3 as linkWithRedirect, ag as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a6 as parseActionCodeURL, q as prodErrorMap, N as reauthenticateWithCredential, b4 as reauthenticateWithRedirect, ae as reload, a3 as sendEmailVerification, R as sendPasswordResetEmail, $ as sendSignInLinkToEmail, s as setPersistence, K as signInAnonymously, L as signInWithCredential, Q as signInWithCustomToken, Z as signInWithEmailAndPassword, a1 as signInWithEmailLink, b2 as signInWithRedirect, m as signOut, ac as unlink, l as updateCurrentUser, a8 as updateEmail, a9 as updatePassword, a7 as updateProfile, u as useDeviceLanguage, v as validatePassword, a4 as verifyBeforeUpdateEmail, X as verifyPasswordResetCode } from './popup_redirect-5e5f5325.js';
3
3
  import { __awaiter, __generator, __assign, __extends, __spreadArray } from 'tslib';
4
4
  import { querystring, getModularInstance, getUA, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';
5
5
  import { SDK_VERSION, getApp, _getProvider } from '@firebase/app';
@@ -4592,6 +4592,38 @@ function injectRecaptchaFields(auth, request, action, captchaResp) {
4592
4592
  });
4593
4593
  });
4594
4594
  }
4595
+ function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
4596
+ var _a;
4597
+ return __awaiter(this, void 0, void 0, function () {
4598
+ var requestWithRecaptcha;
4599
+ var _this = this;
4600
+ return __generator(this, function (_b) {
4601
+ switch (_b.label) {
4602
+ case 0:
4603
+ if (!((_a = authInstance._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 2];
4604
+ return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
4605
+ case 1:
4606
+ requestWithRecaptcha = _b.sent();
4607
+ return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
4608
+ case 2: return [2 /*return*/, actionMethod(authInstance, request).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
4609
+ var requestWithRecaptcha;
4610
+ return __generator(this, function (_a) {
4611
+ switch (_a.label) {
4612
+ case 0:
4613
+ if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
4614
+ console.log("".concat(actionName, " is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."));
4615
+ return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
4616
+ case 1:
4617
+ requestWithRecaptcha = _a.sent();
4618
+ return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
4619
+ case 2: return [2 /*return*/, Promise.reject(error)];
4620
+ }
4621
+ });
4622
+ }); })];
4623
+ }
4624
+ });
4625
+ });
4626
+ }
4595
4627
  function _initializeRecaptchaConfig(auth) {
4596
4628
  return __awaiter(this, void 0, void 0, function () {
4597
4629
  var authInternal, response, config, verifier;
@@ -5078,55 +5110,27 @@ var EmailAuthCredential = /** @class */ (function (_super) {
5078
5110
  };
5079
5111
  /** @internal */
5080
5112
  EmailAuthCredential.prototype._getIdTokenResponse = function (auth) {
5081
- var _a;
5082
5113
  return __awaiter(this, void 0, void 0, function () {
5083
- var _b, request_1, requestWithRecaptcha;
5084
- var _this = this;
5085
- return __generator(this, function (_c) {
5086
- switch (_c.label) {
5087
- case 0:
5088
- _b = this.signInMethod;
5089
- switch (_b) {
5090
- case "password" /* SignInMethod.EMAIL_PASSWORD */: return [3 /*break*/, 1];
5091
- case "emailLink" /* SignInMethod.EMAIL_LINK */: return [3 /*break*/, 4];
5092
- }
5093
- return [3 /*break*/, 5];
5094
- case 1:
5095
- request_1 = {
5114
+ var request;
5115
+ return __generator(this, function (_a) {
5116
+ switch (this.signInMethod) {
5117
+ case "password" /* SignInMethod.EMAIL_PASSWORD */:
5118
+ request = {
5096
5119
  returnSecureToken: true,
5097
5120
  email: this._email,
5098
5121
  password: this._password,
5099
5122
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
5100
5123
  };
5101
- if (!((_a = auth._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
5102
- return [4 /*yield*/, injectRecaptchaFields(auth, request_1, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */)];
5103
- case 2:
5104
- requestWithRecaptcha = _c.sent();
5105
- return [2 /*return*/, signInWithPassword(auth, requestWithRecaptcha)];
5106
- case 3: return [2 /*return*/, signInWithPassword(auth, request_1).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
5107
- var requestWithRecaptcha;
5108
- return __generator(this, function (_a) {
5109
- switch (_a.label) {
5110
- case 0:
5111
- if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
5112
- 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.');
5113
- return [4 /*yield*/, injectRecaptchaFields(auth, request_1, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */)];
5114
- case 1:
5115
- requestWithRecaptcha = _a.sent();
5116
- return [2 /*return*/, signInWithPassword(auth, requestWithRecaptcha)];
5117
- case 2: return [2 /*return*/, Promise.reject(error)];
5118
- }
5119
- });
5120
- }); })];
5121
- case 4: return [2 /*return*/, signInWithEmailLink$1(auth, {
5122
- email: this._email,
5123
- oobCode: this._password
5124
- })];
5125
- case 5:
5124
+ return [2 /*return*/, handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword)];
5125
+ case "emailLink" /* SignInMethod.EMAIL_LINK */:
5126
+ return [2 /*return*/, signInWithEmailLink$1(auth, {
5127
+ email: this._email,
5128
+ oobCode: this._password
5129
+ })];
5130
+ default:
5126
5131
  _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
5127
- _c.label = 6;
5128
- case 6: return [2 /*return*/];
5129
5132
  }
5133
+ return [2 /*return*/];
5130
5134
  });
5131
5135
  });
5132
5136
  };
@@ -7343,12 +7347,10 @@ function recachePasswordPolicy(auth) {
7343
7347
  * @public
7344
7348
  */
7345
7349
  function sendPasswordResetEmail(auth, email, actionCodeSettings) {
7346
- var _a;
7347
7350
  return __awaiter(this, void 0, void 0, function () {
7348
- var authInternal, request, requestWithRecaptcha;
7349
- var _this = this;
7350
- return __generator(this, function (_b) {
7351
- switch (_b.label) {
7351
+ var authInternal, request;
7352
+ return __generator(this, function (_a) {
7353
+ switch (_a.label) {
7352
7354
  case 0:
7353
7355
  authInternal = _castAuth(auth);
7354
7356
  request = {
@@ -7356,48 +7358,13 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
7356
7358
  email: email,
7357
7359
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
7358
7360
  };
7359
- if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
7360
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
7361
- case 1:
7362
- requestWithRecaptcha = _b.sent();
7363
- if (actionCodeSettings) {
7364
- _setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
7365
- }
7366
- return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, requestWithRecaptcha)];
7367
- case 2:
7368
- _b.sent();
7369
- return [3 /*break*/, 5];
7370
- case 3:
7371
7361
  if (actionCodeSettings) {
7372
7362
  _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
7373
7363
  }
7374
- return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, request)
7375
- .catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
7376
- var requestWithRecaptcha;
7377
- return __generator(this, function (_a) {
7378
- switch (_a.label) {
7379
- case 0:
7380
- if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 3];
7381
- console.log('Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.');
7382
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
7383
- case 1:
7384
- requestWithRecaptcha = _a.sent();
7385
- if (actionCodeSettings) {
7386
- _setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
7387
- }
7388
- return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, requestWithRecaptcha)];
7389
- case 2:
7390
- _a.sent();
7391
- return [3 /*break*/, 4];
7392
- case 3: return [2 /*return*/, Promise.reject(error)];
7393
- case 4: return [2 /*return*/];
7394
- }
7395
- });
7396
- }); })];
7397
- case 4:
7398
- _b.sent();
7399
- _b.label = 5;
7400
- case 5: return [2 /*return*/];
7364
+ return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1)];
7365
+ case 1:
7366
+ _a.sent();
7367
+ return [2 /*return*/];
7401
7368
  }
7402
7369
  });
7403
7370
  });
@@ -7552,12 +7519,10 @@ function verifyPasswordResetCode(auth, code) {
7552
7519
  * @public
7553
7520
  */
7554
7521
  function createUserWithEmailAndPassword(auth, email, password) {
7555
- var _a;
7556
7522
  return __awaiter(this, void 0, void 0, function () {
7557
- var authInternal, request, signUpResponse, requestWithRecaptcha, response, userCredential;
7558
- var _this = this;
7559
- return __generator(this, function (_b) {
7560
- switch (_b.label) {
7523
+ var authInternal, request, signUpResponse, response, userCredential;
7524
+ return __generator(this, function (_a) {
7525
+ switch (_a.label) {
7561
7526
  case 0:
7562
7527
  authInternal = _castAuth(auth);
7563
7528
  request = {
@@ -7566,43 +7531,21 @@ function createUserWithEmailAndPassword(auth, email, password) {
7566
7531
  password: password,
7567
7532
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
7568
7533
  };
7569
- if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 2];
7570
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */)];
7571
- case 1:
7572
- requestWithRecaptcha = _b.sent();
7573
- signUpResponse = signUp(authInternal, requestWithRecaptcha);
7574
- return [3 /*break*/, 3];
7575
- case 2:
7576
- signUpResponse = signUp(authInternal, request).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
7577
- var requestWithRecaptcha;
7578
- return __generator(this, function (_a) {
7579
- switch (_a.label) {
7580
- case 0:
7581
- if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
7582
- console.log('Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.');
7583
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */)];
7584
- case 1:
7585
- requestWithRecaptcha = _a.sent();
7586
- return [2 /*return*/, signUp(authInternal, requestWithRecaptcha)];
7587
- case 2: throw error;
7534
+ signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
7535
+ return [4 /*yield*/, signUpResponse.catch(function (error) {
7536
+ if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
7537
+ void recachePasswordPolicy(auth);
7588
7538
  }
7589
- });
7590
- }); });
7591
- _b.label = 3;
7592
- case 3: return [4 /*yield*/, signUpResponse.catch(function (error) {
7593
- if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
7594
- void recachePasswordPolicy(auth);
7595
- }
7596
- throw error;
7597
- })];
7598
- case 4:
7599
- response = _b.sent();
7539
+ throw error;
7540
+ })];
7541
+ case 1:
7542
+ response = _a.sent();
7600
7543
  return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
7601
- case 5:
7602
- userCredential = _b.sent();
7544
+ case 2:
7545
+ userCredential = _a.sent();
7603
7546
  return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
7604
- case 6:
7605
- _b.sent();
7547
+ case 3:
7548
+ _a.sent();
7606
7549
  return [2 /*return*/, userCredential];
7607
7550
  }
7608
7551
  });
@@ -7691,7 +7634,6 @@ function signInWithEmailAndPassword(auth, email, password) {
7691
7634
  * @public
7692
7635
  */
7693
7636
  function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
7694
- var _a;
7695
7637
  return __awaiter(this, void 0, void 0, function () {
7696
7638
  function setActionCodeSettings(request, actionCodeSettings) {
7697
7639
  _assert(actionCodeSettings.handleCodeInApp, authInternal, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
@@ -7699,10 +7641,9 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
7699
7641
  _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
7700
7642
  }
7701
7643
  }
7702
- var authInternal, request, requestWithRecaptcha;
7703
- var _this = this;
7704
- return __generator(this, function (_b) {
7705
- switch (_b.label) {
7644
+ var authInternal, request;
7645
+ return __generator(this, function (_a) {
7646
+ switch (_a.label) {
7706
7647
  case 0:
7707
7648
  authInternal = _castAuth(auth);
7708
7649
  request = {
@@ -7710,42 +7651,11 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
7710
7651
  email: email,
7711
7652
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
7712
7653
  };
7713
- if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
7714
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
7715
- case 1:
7716
- requestWithRecaptcha = _b.sent();
7717
- setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
7718
- return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha)];
7719
- case 2:
7720
- _b.sent();
7721
- return [3 /*break*/, 5];
7722
- case 3:
7723
7654
  setActionCodeSettings(request, actionCodeSettings);
7724
- return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, request)
7725
- .catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
7726
- var requestWithRecaptcha;
7727
- return __generator(this, function (_a) {
7728
- switch (_a.label) {
7729
- case 0:
7730
- if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 3];
7731
- console.log('Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
7732
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
7733
- case 1:
7734
- requestWithRecaptcha = _a.sent();
7735
- setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
7736
- return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha)];
7737
- case 2:
7738
- _a.sent();
7739
- return [3 /*break*/, 4];
7740
- case 3: return [2 /*return*/, Promise.reject(error)];
7741
- case 4: return [2 /*return*/];
7742
- }
7743
- });
7744
- }); })];
7745
- case 4:
7746
- _b.sent();
7747
- _b.label = 5;
7748
- case 5: return [2 /*return*/];
7655
+ return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1)];
7656
+ case 1:
7657
+ _a.sent();
7658
+ return [2 /*return*/];
7749
7659
  }
7750
7660
  });
7751
7661
  });
@@ -8825,7 +8735,7 @@ function multiFactor(user) {
8825
8735
  }
8826
8736
 
8827
8737
  var name = "@firebase/auth";
8828
- var version = "1.3.0-canary.0ae010ef2";
8738
+ var version = "1.3.0-canary.12f25592c";
8829
8739
 
8830
8740
  /**
8831
8741
  * @license
@@ -11029,4 +10939,4 @@ function generateNoEvent() {
11029
10939
  }
11030
10940
 
11031
10941
  export { sendSignInLinkToEmail as $, ActionCodeOperation as A, inMemoryPersistence as B, EmailAuthProvider as C, FacebookAuthProvider as D, EmailAuthCredential as E, FactorId as F, GoogleAuthProvider as G, GithubAuthProvider as H, OAuthProvider as I, SAMLAuthProvider as J, signInAnonymously as K, signInWithCredential as L, linkWithCredential as M, reauthenticateWithCredential as N, OperationType as O, ProviderId as P, signInWithCustomToken as Q, sendPasswordResetEmail as R, SignInMethod as S, TwitterAuthProvider as T, confirmPasswordReset as U, applyActionCode as V, checkActionCode as W, verifyPasswordResetCode as X, createUserWithEmailAndPassword as Y, signInWithEmailAndPassword as Z, _signInWithRedirect as _, _reauthenticateWithRedirect as a, _getClientVersion as a$, isSignInWithEmailLink as a0, signInWithEmailLink as a1, fetchSignInMethodsForEmail as a2, sendEmailVerification as a3, verifyBeforeUpdateEmail as a4, ActionCodeURL as a5, parseActionCodeURL as a6, updateProfile as a7, updateEmail as a8, updatePassword as a9, AbstractPopupRedirectOperation as aA, _assertInstanceOf as aB, _withDefaultResolver as aC, FederatedAuthProvider as aD, _fail as aE, _getProjectConfig as aF, _getCurrentUrl as aG, _emulatorUrl as aH, _isChromeIOS as aI, _isFirefox as aJ, _isIOSStandalone as aK, _getRedirectUrl as aL, _setWindowLocation as aM, _isMobileBrowser as aN, _isSafari as aO, _isIOS as aP, _getRedirectResult as aQ, _overrideRedirectResult as aR, AuthEventManager as aS, debugFail as aT, finalizeEnrollPhoneMfa as aU, finalizeEnrollTotpMfa as aV, startEnrollTotpMfa as aW, _persistenceKeyName as aX, UserImpl as aY, _getInstance as aZ, AuthImpl as a_, getIdToken as aa, getIdTokenResult as ab, unlink as ac, getAdditionalUserInfo as ad, reload as ae, getMultiFactorResolver as af, multiFactor as ag, _performApiRequest as ah, _addTidIfNecessary as ai, _assert as aj, Delay as ak, _window as al, isV2 as am, _createError as an, _loadJS as ao, _generateCallbackName as ap, getRecaptchaParams as aq, _isHttpOrHttps as ar, _isWorker as as, _castAuth as at, _assertLinkedStatus as au, sendPhoneVerificationCode as av, startEnrollPhoneMfa as aw, _link$1 as ax, debugAssert as ay, _generateEventId as az, _linkWithRedirect as b, FetchProvider as b0, SAMLAuthCredential as b1, signInWithRedirect as b2, linkWithRedirect as b3, reauthenticateWithRedirect as b4, indexedDBLocalPersistence as c, cordovaPopupRedirectResolver as d, browserLocalPersistence as e, browserSessionPersistence as f, getRedirectResult as g, initializeRecaptchaConfig as h, initializeAuth as i, beforeAuthStateChanged as j, onAuthStateChanged as k, updateCurrentUser as l, signOut as m, deleteUser as n, onIdTokenChanged as o, debugErrorMap as p, prodErrorMap as q, registerAuth as r, setPersistence as s, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as t, useDeviceLanguage as u, validatePassword as v, connectAuthEmulator as w, AuthCredential as x, OAuthCredential as y, PhoneAuthCredential as z };
11032
- //# sourceMappingURL=popup_redirect-378dee5d.js.map
10942
+ //# sourceMappingURL=popup_redirect-5e5f5325.js.map