@firebase/auth 1.3.0-canary.320e58cc5 → 1.3.0-canary.3533b32b1

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-d99af397.js → index-b307b714.js} +28 -82
  2. package/dist/browser-cjs/index-b307b714.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-916d0fbe.js → popup_redirect-4839de8e.js} +76 -166
  9. package/dist/cordova/popup_redirect-4839de8e.js.map +1 -0
  10. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
  11. package/dist/esm2017/{index-c252646d.js → index-be7e4b8e.js} +28 -82
  12. package/dist/esm2017/index-be7e4b8e.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-ed836b28.js → index-573d9edf.js} +76 -166
  17. package/dist/esm5/index-573d9edf.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-7b78dce5.js → totp-875b7ace.js} +76 -166
  27. package/dist/node/totp-875b7ace.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-c677c59f.js → totp-28dfaa72.js} +28 -82
  32. package/dist/node-esm/totp-28dfaa72.js.map +1 -0
  33. package/dist/rn/{index-c6a05ba9.js → index-85a65bfb.js} +76 -166
  34. package/dist/rn/index-85a65bfb.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 +12 -12
  40. package/dist/browser-cjs/index-d99af397.js.map +0 -1
  41. package/dist/cordova/popup_redirect-916d0fbe.js.map +0 -1
  42. package/dist/esm2017/index-c252646d.js.map +0 -1
  43. package/dist/esm5/index-ed836b28.js.map +0 -1
  44. package/dist/node/totp-7b78dce5.js.map +0 -1
  45. package/dist/node-esm/totp-c677c59f.js.map +0 -1
  46. package/dist/rn/index-c6a05ba9.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { A as ActionCodeOperation, ah as ActionCodeURL, K as AuthCredential, H as AuthErrorCodes, L as EmailAuthCredential, U as EmailAuthProvider, V as FacebookAuthProvider, F as FactorId, X as GithubAuthProvider, W as GoogleAuthProvider, M as OAuthCredential, Y as OAuthProvider, O as OperationType, N as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, p as ProviderId, R as RecaptchaVerifier, Z as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, _ as TwitterAuthProvider, a6 as applyActionCode, x as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a7 as checkActionCode, a5 as confirmPasswordReset, J as connectAuthEmulator, a9 as createUserWithEmailAndPassword, E as debugErrorMap, D as deleteUser, ae as fetchSignInMethodsForEmail, ap as getAdditionalUserInfo, o as getAuth, am as getIdToken, an as getIdTokenResult, ar as getMultiFactorResolver, j as getRedirectResult, Q as inMemoryPersistence, i as indexedDBLocalPersistence, I as initializeAuth, t as initializeRecaptchaConfig, ac as isSignInWithEmailLink, a1 as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, as as multiFactor, y as onAuthStateChanged, w as onIdTokenChanged, ai as parseActionCodeURL, G as prodErrorMap, a2 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, aq as reload, af as sendEmailVerification, a4 as sendPasswordResetEmail, ab as sendSignInLinkToEmail, q as setPersistence, $ as signInAnonymously, a0 as signInWithCredential, a3 as signInWithCustomToken, aa as signInWithEmailAndPassword, ad as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, C as signOut, ao as unlink, B as updateCurrentUser, ak as updateEmail, al as updatePassword, u as updatePhoneNumber, aj as updateProfile, z as useDeviceLanguage, v as validatePassword, ag as verifyBeforeUpdateEmail, a8 as verifyPasswordResetCode } from './index-c252646d.js';
1
+ export { A as ActionCodeOperation, ah as ActionCodeURL, K as AuthCredential, H as AuthErrorCodes, L as EmailAuthCredential, U as EmailAuthProvider, V as FacebookAuthProvider, F as FactorId, X as GithubAuthProvider, W as GoogleAuthProvider, M as OAuthCredential, Y as OAuthProvider, O as OperationType, N as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, p as ProviderId, R as RecaptchaVerifier, Z as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, _ as TwitterAuthProvider, a6 as applyActionCode, x as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a7 as checkActionCode, a5 as confirmPasswordReset, J as connectAuthEmulator, a9 as createUserWithEmailAndPassword, E as debugErrorMap, D as deleteUser, ae as fetchSignInMethodsForEmail, ap as getAdditionalUserInfo, o as getAuth, am as getIdToken, an as getIdTokenResult, ar as getMultiFactorResolver, j as getRedirectResult, Q as inMemoryPersistence, i as indexedDBLocalPersistence, I as initializeAuth, t as initializeRecaptchaConfig, ac as isSignInWithEmailLink, a1 as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, as as multiFactor, y as onAuthStateChanged, w as onIdTokenChanged, ai as parseActionCodeURL, G as prodErrorMap, a2 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, aq as reload, af as sendEmailVerification, a4 as sendPasswordResetEmail, ab as sendSignInLinkToEmail, q as setPersistence, $ as signInAnonymously, a0 as signInWithCredential, a3 as signInWithCustomToken, aa as signInWithEmailAndPassword, ad as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, C as signOut, ao as unlink, B as updateCurrentUser, ak as updateEmail, al as updatePassword, u as updatePhoneNumber, aj as updateProfile, z as useDeviceLanguage, v as validatePassword, ag as verifyBeforeUpdateEmail, a8 as verifyPasswordResetCode } from './index-be7e4b8e.js';
2
2
  import '@firebase/util';
3
3
  import '@firebase/app';
4
4
  import '@firebase/logger';
@@ -1,5 +1,5 @@
1
- import { at as debugAssert, au as _isIOS, av as _isAndroid, aw as _fail, ax as _getRedirectUrl, ay as _getProjectConfig, az as _isIOS7Or8, aA as _createError, aB as _assert, aC as AuthEventManager, aD as _getInstance, b as browserLocalPersistence, aE as _persistenceKeyName, a as browserSessionPersistence, aF as _getRedirectResult, aG as _overrideRedirectResult, aH as _clearRedirectOutcomes, aI as _castAuth } from './index-c252646d.js';
2
- export { A as ActionCodeOperation, ah as ActionCodeURL, K as AuthCredential, H as AuthErrorCodes, aK as AuthImpl, aN as AuthPopup, L as EmailAuthCredential, U as EmailAuthProvider, V as FacebookAuthProvider, F as FactorId, aO as FetchProvider, X as GithubAuthProvider, W as GoogleAuthProvider, M as OAuthCredential, Y as OAuthProvider, O as OperationType, N as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, p as ProviderId, R as RecaptchaVerifier, aP as SAMLAuthCredential, Z as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, _ as TwitterAuthProvider, aJ as UserImpl, aB as _assert, aI as _castAuth, aw as _fail, aM as _generateEventId, aL as _getClientVersion, aD as _getInstance, aF as _getRedirectResult, aG as _overrideRedirectResult, aE as _persistenceKeyName, a6 as applyActionCode, x as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a7 as checkActionCode, a5 as confirmPasswordReset, J as connectAuthEmulator, a9 as createUserWithEmailAndPassword, E as debugErrorMap, D as deleteUser, ae as fetchSignInMethodsForEmail, ap as getAdditionalUserInfo, o as getAuth, am as getIdToken, an as getIdTokenResult, ar as getMultiFactorResolver, j as getRedirectResult, Q as inMemoryPersistence, i as indexedDBLocalPersistence, I as initializeAuth, t as initializeRecaptchaConfig, ac as isSignInWithEmailLink, a1 as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, as as multiFactor, y as onAuthStateChanged, w as onIdTokenChanged, ai as parseActionCodeURL, G as prodErrorMap, a2 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, aq as reload, af as sendEmailVerification, a4 as sendPasswordResetEmail, ab as sendSignInLinkToEmail, q as setPersistence, $ as signInAnonymously, a0 as signInWithCredential, a3 as signInWithCustomToken, aa as signInWithEmailAndPassword, ad as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, C as signOut, ao as unlink, B as updateCurrentUser, ak as updateEmail, al as updatePassword, u as updatePhoneNumber, aj as updateProfile, z as useDeviceLanguage, v as validatePassword, ag as verifyBeforeUpdateEmail, a8 as verifyPasswordResetCode } from './index-c252646d.js';
1
+ import { at as debugAssert, au as _isIOS, av as _isAndroid, aw as _fail, ax as _getRedirectUrl, ay as _getProjectConfig, az as _isIOS7Or8, aA as _createError, aB as _assert, aC as AuthEventManager, aD as _getInstance, b as browserLocalPersistence, aE as _persistenceKeyName, a as browserSessionPersistence, aF as _getRedirectResult, aG as _overrideRedirectResult, aH as _clearRedirectOutcomes, aI as _castAuth } from './index-be7e4b8e.js';
2
+ export { A as ActionCodeOperation, ah as ActionCodeURL, K as AuthCredential, H as AuthErrorCodes, aK as AuthImpl, aN as AuthPopup, L as EmailAuthCredential, U as EmailAuthProvider, V as FacebookAuthProvider, F as FactorId, aO as FetchProvider, X as GithubAuthProvider, W as GoogleAuthProvider, M as OAuthCredential, Y as OAuthProvider, O as OperationType, N as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, p as ProviderId, R as RecaptchaVerifier, aP as SAMLAuthCredential, Z as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, _ as TwitterAuthProvider, aJ as UserImpl, aB as _assert, aI as _castAuth, aw as _fail, aM as _generateEventId, aL as _getClientVersion, aD as _getInstance, aF as _getRedirectResult, aG as _overrideRedirectResult, aE as _persistenceKeyName, a6 as applyActionCode, x as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a7 as checkActionCode, a5 as confirmPasswordReset, J as connectAuthEmulator, a9 as createUserWithEmailAndPassword, E as debugErrorMap, D as deleteUser, ae as fetchSignInMethodsForEmail, ap as getAdditionalUserInfo, o as getAuth, am as getIdToken, an as getIdTokenResult, ar as getMultiFactorResolver, j as getRedirectResult, Q as inMemoryPersistence, i as indexedDBLocalPersistence, I as initializeAuth, t as initializeRecaptchaConfig, ac as isSignInWithEmailLink, a1 as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, as as multiFactor, y as onAuthStateChanged, w as onIdTokenChanged, ai as parseActionCodeURL, G as prodErrorMap, a2 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, aq as reload, af as sendEmailVerification, a4 as sendPasswordResetEmail, ab as sendSignInLinkToEmail, q as setPersistence, $ as signInAnonymously, a0 as signInWithCredential, a3 as signInWithCustomToken, aa as signInWithEmailAndPassword, ad as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, C as signOut, ao as unlink, B as updateCurrentUser, ak as updateEmail, al as updatePassword, u as updatePhoneNumber, aj as updateProfile, z as useDeviceLanguage, v as validatePassword, ag as verifyBeforeUpdateEmail, a8 as verifyPasswordResetCode } from './index-be7e4b8e.js';
3
3
  import { querystringDecode } from '@firebase/util';
4
4
  import '@firebase/app';
5
5
  import '@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 {};
@@ -3777,6 +3777,38 @@ function injectRecaptchaFields(auth, request, action, captchaResp) {
3777
3777
  });
3778
3778
  });
3779
3779
  }
3780
+ function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
3781
+ var _a;
3782
+ return __awaiter(this, void 0, void 0, function () {
3783
+ var requestWithRecaptcha;
3784
+ var _this = this;
3785
+ return __generator(this, function (_b) {
3786
+ switch (_b.label) {
3787
+ case 0:
3788
+ if (!((_a = authInstance._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 2];
3789
+ return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
3790
+ case 1:
3791
+ requestWithRecaptcha = _b.sent();
3792
+ return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
3793
+ case 2: return [2 /*return*/, actionMethod(authInstance, request).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
3794
+ var requestWithRecaptcha;
3795
+ return __generator(this, function (_a) {
3796
+ switch (_a.label) {
3797
+ case 0:
3798
+ if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
3799
+ console.log("".concat(actionName, " is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."));
3800
+ return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
3801
+ case 1:
3802
+ requestWithRecaptcha = _a.sent();
3803
+ return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
3804
+ case 2: return [2 /*return*/, Promise.reject(error)];
3805
+ }
3806
+ });
3807
+ }); })];
3808
+ }
3809
+ });
3810
+ });
3811
+ }
3780
3812
  function _initializeRecaptchaConfig(auth) {
3781
3813
  return __awaiter(this, void 0, void 0, function () {
3782
3814
  var authInternal, response, config, verifier;
@@ -4263,55 +4295,27 @@ var EmailAuthCredential = /** @class */ (function (_super) {
4263
4295
  };
4264
4296
  /** @internal */
4265
4297
  EmailAuthCredential.prototype._getIdTokenResponse = function (auth) {
4266
- var _a;
4267
4298
  return __awaiter(this, void 0, void 0, function () {
4268
- var _b, request_1, requestWithRecaptcha;
4269
- var _this = this;
4270
- return __generator(this, function (_c) {
4271
- switch (_c.label) {
4272
- case 0:
4273
- _b = this.signInMethod;
4274
- switch (_b) {
4275
- case "password" /* SignInMethod.EMAIL_PASSWORD */: return [3 /*break*/, 1];
4276
- case "emailLink" /* SignInMethod.EMAIL_LINK */: return [3 /*break*/, 4];
4277
- }
4278
- return [3 /*break*/, 5];
4279
- case 1:
4280
- request_1 = {
4299
+ var request;
4300
+ return __generator(this, function (_a) {
4301
+ switch (this.signInMethod) {
4302
+ case "password" /* SignInMethod.EMAIL_PASSWORD */:
4303
+ request = {
4281
4304
  returnSecureToken: true,
4282
4305
  email: this._email,
4283
4306
  password: this._password,
4284
4307
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
4285
4308
  };
4286
- if (!((_a = auth._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
4287
- return [4 /*yield*/, injectRecaptchaFields(auth, request_1, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */)];
4288
- case 2:
4289
- requestWithRecaptcha = _c.sent();
4290
- return [2 /*return*/, signInWithPassword(auth, requestWithRecaptcha)];
4291
- case 3: return [2 /*return*/, signInWithPassword(auth, request_1).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
4292
- var requestWithRecaptcha;
4293
- return __generator(this, function (_a) {
4294
- switch (_a.label) {
4295
- case 0:
4296
- if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
4297
- 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.');
4298
- return [4 /*yield*/, injectRecaptchaFields(auth, request_1, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */)];
4299
- case 1:
4300
- requestWithRecaptcha = _a.sent();
4301
- return [2 /*return*/, signInWithPassword(auth, requestWithRecaptcha)];
4302
- case 2: return [2 /*return*/, Promise.reject(error)];
4303
- }
4304
- });
4305
- }); })];
4306
- case 4: return [2 /*return*/, signInWithEmailLink$1(auth, {
4307
- email: this._email,
4308
- oobCode: this._password
4309
- })];
4310
- case 5:
4309
+ return [2 /*return*/, handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword)];
4310
+ case "emailLink" /* SignInMethod.EMAIL_LINK */:
4311
+ return [2 /*return*/, signInWithEmailLink$1(auth, {
4312
+ email: this._email,
4313
+ oobCode: this._password
4314
+ })];
4315
+ default:
4311
4316
  _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
4312
- _c.label = 6;
4313
- case 6: return [2 /*return*/];
4314
4317
  }
4318
+ return [2 /*return*/];
4315
4319
  });
4316
4320
  });
4317
4321
  };
@@ -6528,12 +6532,10 @@ function recachePasswordPolicy(auth) {
6528
6532
  * @public
6529
6533
  */
6530
6534
  function sendPasswordResetEmail(auth, email, actionCodeSettings) {
6531
- var _a;
6532
6535
  return __awaiter(this, void 0, void 0, function () {
6533
- var authInternal, request, requestWithRecaptcha;
6534
- var _this = this;
6535
- return __generator(this, function (_b) {
6536
- switch (_b.label) {
6536
+ var authInternal, request;
6537
+ return __generator(this, function (_a) {
6538
+ switch (_a.label) {
6537
6539
  case 0:
6538
6540
  authInternal = _castAuth(auth);
6539
6541
  request = {
@@ -6541,48 +6543,13 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
6541
6543
  email: email,
6542
6544
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
6543
6545
  };
6544
- if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
6545
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
6546
- case 1:
6547
- requestWithRecaptcha = _b.sent();
6548
- if (actionCodeSettings) {
6549
- _setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
6550
- }
6551
- return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, requestWithRecaptcha)];
6552
- case 2:
6553
- _b.sent();
6554
- return [3 /*break*/, 5];
6555
- case 3:
6556
6546
  if (actionCodeSettings) {
6557
6547
  _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
6558
6548
  }
6559
- return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, request)
6560
- .catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
6561
- var requestWithRecaptcha;
6562
- return __generator(this, function (_a) {
6563
- switch (_a.label) {
6564
- case 0:
6565
- if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 3];
6566
- console.log('Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.');
6567
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
6568
- case 1:
6569
- requestWithRecaptcha = _a.sent();
6570
- if (actionCodeSettings) {
6571
- _setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
6572
- }
6573
- return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, requestWithRecaptcha)];
6574
- case 2:
6575
- _a.sent();
6576
- return [3 /*break*/, 4];
6577
- case 3: return [2 /*return*/, Promise.reject(error)];
6578
- case 4: return [2 /*return*/];
6579
- }
6580
- });
6581
- }); })];
6582
- case 4:
6583
- _b.sent();
6584
- _b.label = 5;
6585
- case 5: return [2 /*return*/];
6549
+ return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1)];
6550
+ case 1:
6551
+ _a.sent();
6552
+ return [2 /*return*/];
6586
6553
  }
6587
6554
  });
6588
6555
  });
@@ -6737,12 +6704,10 @@ function verifyPasswordResetCode(auth, code) {
6737
6704
  * @public
6738
6705
  */
6739
6706
  function createUserWithEmailAndPassword(auth, email, password) {
6740
- var _a;
6741
6707
  return __awaiter(this, void 0, void 0, function () {
6742
- var authInternal, request, signUpResponse, requestWithRecaptcha, response, userCredential;
6743
- var _this = this;
6744
- return __generator(this, function (_b) {
6745
- switch (_b.label) {
6708
+ var authInternal, request, signUpResponse, response, userCredential;
6709
+ return __generator(this, function (_a) {
6710
+ switch (_a.label) {
6746
6711
  case 0:
6747
6712
  authInternal = _castAuth(auth);
6748
6713
  request = {
@@ -6751,43 +6716,21 @@ function createUserWithEmailAndPassword(auth, email, password) {
6751
6716
  password: password,
6752
6717
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
6753
6718
  };
6754
- if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 2];
6755
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */)];
6756
- case 1:
6757
- requestWithRecaptcha = _b.sent();
6758
- signUpResponse = signUp(authInternal, requestWithRecaptcha);
6759
- return [3 /*break*/, 3];
6760
- case 2:
6761
- signUpResponse = signUp(authInternal, request).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
6762
- var requestWithRecaptcha;
6763
- return __generator(this, function (_a) {
6764
- switch (_a.label) {
6765
- case 0:
6766
- if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
6767
- console.log('Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.');
6768
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */)];
6769
- case 1:
6770
- requestWithRecaptcha = _a.sent();
6771
- return [2 /*return*/, signUp(authInternal, requestWithRecaptcha)];
6772
- case 2: throw error;
6719
+ signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
6720
+ return [4 /*yield*/, signUpResponse.catch(function (error) {
6721
+ if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
6722
+ void recachePasswordPolicy(auth);
6773
6723
  }
6774
- });
6775
- }); });
6776
- _b.label = 3;
6777
- case 3: return [4 /*yield*/, signUpResponse.catch(function (error) {
6778
- if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
6779
- void recachePasswordPolicy(auth);
6780
- }
6781
- throw error;
6782
- })];
6783
- case 4:
6784
- response = _b.sent();
6724
+ throw error;
6725
+ })];
6726
+ case 1:
6727
+ response = _a.sent();
6785
6728
  return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
6786
- case 5:
6787
- userCredential = _b.sent();
6729
+ case 2:
6730
+ userCredential = _a.sent();
6788
6731
  return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
6789
- case 6:
6790
- _b.sent();
6732
+ case 3:
6733
+ _a.sent();
6791
6734
  return [2 /*return*/, userCredential];
6792
6735
  }
6793
6736
  });
@@ -6876,7 +6819,6 @@ function signInWithEmailAndPassword(auth, email, password) {
6876
6819
  * @public
6877
6820
  */
6878
6821
  function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
6879
- var _a;
6880
6822
  return __awaiter(this, void 0, void 0, function () {
6881
6823
  function setActionCodeSettings(request, actionCodeSettings) {
6882
6824
  _assert(actionCodeSettings.handleCodeInApp, authInternal, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
@@ -6884,10 +6826,9 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
6884
6826
  _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
6885
6827
  }
6886
6828
  }
6887
- var authInternal, request, requestWithRecaptcha;
6888
- var _this = this;
6889
- return __generator(this, function (_b) {
6890
- switch (_b.label) {
6829
+ var authInternal, request;
6830
+ return __generator(this, function (_a) {
6831
+ switch (_a.label) {
6891
6832
  case 0:
6892
6833
  authInternal = _castAuth(auth);
6893
6834
  request = {
@@ -6895,42 +6836,11 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
6895
6836
  email: email,
6896
6837
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
6897
6838
  };
6898
- if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
6899
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
6900
- case 1:
6901
- requestWithRecaptcha = _b.sent();
6902
- setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
6903
- return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha)];
6904
- case 2:
6905
- _b.sent();
6906
- return [3 /*break*/, 5];
6907
- case 3:
6908
6839
  setActionCodeSettings(request, actionCodeSettings);
6909
- return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, request)
6910
- .catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
6911
- var requestWithRecaptcha;
6912
- return __generator(this, function (_a) {
6913
- switch (_a.label) {
6914
- case 0:
6915
- if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 3];
6916
- console.log('Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
6917
- return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
6918
- case 1:
6919
- requestWithRecaptcha = _a.sent();
6920
- setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
6921
- return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha)];
6922
- case 2:
6923
- _a.sent();
6924
- return [3 /*break*/, 4];
6925
- case 3: return [2 /*return*/, Promise.reject(error)];
6926
- case 4: return [2 /*return*/];
6927
- }
6928
- });
6929
- }); })];
6930
- case 4:
6931
- _b.sent();
6932
- _b.label = 5;
6933
- case 5: return [2 /*return*/];
6840
+ return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1)];
6841
+ case 1:
6842
+ _a.sent();
6843
+ return [2 /*return*/];
6934
6844
  }
6935
6845
  });
6936
6846
  });
@@ -12214,7 +12124,7 @@ function _isEmptyString(input) {
12214
12124
  }
12215
12125
 
12216
12126
  var name = "@firebase/auth";
12217
- var version = "1.3.0-canary.320e58cc5";
12127
+ var version = "1.3.0-canary.3533b32b1";
12218
12128
 
12219
12129
  /**
12220
12130
  * @license
@@ -12467,4 +12377,4 @@ function getAuth(app) {
12467
12377
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
12468
12378
 
12469
12379
  export { signInAnonymously as $, ActionCodeOperation as A, updateCurrentUser as B, signOut as C, deleteUser as D, debugErrorMap as E, FactorId as F, prodErrorMap as G, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as H, initializeAuth as I, connectAuthEmulator as J, AuthCredential as K, EmailAuthCredential as L, OAuthCredential as M, PhoneAuthCredential as N, OperationType as O, PhoneAuthProvider as P, inMemoryPersistence as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, EmailAuthProvider as U, FacebookAuthProvider as V, GoogleAuthProvider as W, GithubAuthProvider as X, OAuthProvider as Y, SAMLAuthProvider as Z, TwitterAuthProvider as _, browserSessionPersistence as a, signInWithCredential as a0, linkWithCredential as a1, reauthenticateWithCredential as a2, signInWithCustomToken as a3, sendPasswordResetEmail as a4, confirmPasswordReset as a5, applyActionCode as a6, checkActionCode as a7, verifyPasswordResetCode as a8, createUserWithEmailAndPassword as a9, _assert as aA, _createError as aB, AuthEventManager as aC, _getInstance as aD, _persistenceKeyName as aE, _clearRedirectOutcomes as aF, _getRedirectResult as aG, _overrideRedirectResult as aH, _castAuth as aI, UserImpl as aJ, AuthImpl as aK, _getClientVersion as aL, _generateEventId as aM, AuthPopup as aN, FetchProvider as aO, SAMLAuthCredential as aP, signInWithEmailAndPassword as aa, sendSignInLinkToEmail as ab, isSignInWithEmailLink as ac, signInWithEmailLink as ad, fetchSignInMethodsForEmail as ae, sendEmailVerification as af, verifyBeforeUpdateEmail as ag, ActionCodeURL as ah, parseActionCodeURL as ai, updateProfile as aj, updateEmail as ak, updatePassword as al, getIdToken as am, getIdTokenResult as an, unlink as ao, getAdditionalUserInfo as ap, reload as aq, getMultiFactorResolver as ar, multiFactor as as, _isIOS as at, _isAndroid as au, _fail as av, _getRedirectUrl as aw, debugAssert as ax, _getProjectConfig as ay, _isIOS7Or8 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, validatePassword as v, onIdTokenChanged as w, beforeAuthStateChanged as x, onAuthStateChanged as y, useDeviceLanguage as z };
12470
- //# sourceMappingURL=index-ed836b28.js.map
12380
+ //# sourceMappingURL=index-573d9edf.js.map