@firebase/auth 0.20.3 → 0.20.4-canary.13550089f

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 (51) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/auth-public.d.ts +1 -1
  3. package/dist/auth.d.ts +1 -1
  4. package/dist/cordova/index.js +2 -2
  5. package/dist/cordova/internal.js +12 -5
  6. package/dist/cordova/internal.js.map +1 -1
  7. package/dist/cordova/{popup_redirect-9ed330a1.js → popup_redirect-fcb18d0f.js} +40 -34
  8. package/dist/cordova/popup_redirect-fcb18d0f.js.map +1 -0
  9. package/dist/cordova/src/platform_browser/providers/phone.d.ts +1 -1
  10. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_loader.d.ts +5 -0
  11. package/dist/esm2017/{index-69ab4e3a.js → index-25da8a76.js} +24 -11
  12. package/dist/esm2017/index-25da8a76.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/providers/phone.d.ts +1 -1
  16. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_loader.d.ts +5 -0
  17. package/dist/esm5/{index-81005f8a.js → index-66b1cbdf.js} +50 -37
  18. package/dist/esm5/index-66b1cbdf.js.map +1 -0
  19. package/dist/esm5/index.js +1 -1
  20. package/dist/esm5/internal.js +2 -2
  21. package/dist/esm5/src/platform_browser/providers/phone.d.ts +1 -1
  22. package/dist/esm5/src/platform_browser/recaptcha/recaptcha_loader.d.ts +5 -0
  23. package/dist/index.webworker.esm5.js +37 -32
  24. package/dist/index.webworker.esm5.js.map +1 -1
  25. package/dist/node/{index-007f80f6.js → index-1d7eab4e.js} +40 -34
  26. package/dist/node/index-1d7eab4e.js.map +1 -0
  27. package/dist/node/index.js +1 -1
  28. package/dist/node/internal.js +1 -1
  29. package/dist/node/src/platform_browser/providers/phone.d.ts +1 -1
  30. package/dist/node/src/platform_browser/recaptcha/recaptcha_loader.d.ts +5 -0
  31. package/dist/node-esm/{index-b1f59f63.js → index-f6d42709.js} +14 -8
  32. package/dist/node-esm/index-f6d42709.js.map +1 -0
  33. package/dist/node-esm/index.js +1 -1
  34. package/dist/node-esm/internal.js +2 -2
  35. package/dist/node-esm/src/platform_browser/providers/phone.d.ts +1 -1
  36. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_loader.d.ts +5 -0
  37. package/dist/rn/index.js +1 -1
  38. package/dist/rn/internal.js +1 -1
  39. package/dist/rn/{phone-d791a05d.js → phone-3e5c3820.js} +50 -37
  40. package/dist/rn/phone-3e5c3820.js.map +1 -0
  41. package/dist/rn/src/platform_browser/providers/phone.d.ts +1 -1
  42. package/dist/rn/src/platform_browser/recaptcha/recaptcha_loader.d.ts +5 -0
  43. package/dist/src/platform_browser/providers/phone.d.ts +1 -1
  44. package/dist/src/platform_browser/recaptcha/recaptcha_loader.d.ts +5 -0
  45. package/package.json +6 -6
  46. package/dist/cordova/popup_redirect-9ed330a1.js.map +0 -1
  47. package/dist/esm2017/index-69ab4e3a.js.map +0 -1
  48. package/dist/esm5/index-81005f8a.js.map +0 -1
  49. package/dist/node/index-007f80f6.js.map +0 -1
  50. package/dist/node-esm/index-b1f59f63.js.map +0 -1
  51. package/dist/rn/phone-d791a05d.js.map +0 -1
@@ -133,7 +133,7 @@ export declare class PhoneAuthProvider {
133
133
  * auth.currentUser,
134
134
  * PhoneAuthProvider.credential(verificationId, code));
135
135
  * } catch (e) {
136
- * if (e.code === 'auth/account-exists-with-different-credential') {
136
+ * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') {
137
137
  * const cred = PhoneAuthProvider.credentialFromError(e);
138
138
  * await linkWithCredential(auth.currentUser, cred);
139
139
  * }
@@ -33,6 +33,11 @@ export interface ReCaptchaLoader {
33
33
  export declare class ReCaptchaLoaderImpl implements ReCaptchaLoader {
34
34
  private hostLanguage;
35
35
  private counter;
36
+ /**
37
+ * Check for `render()` method. `window.grecaptcha` will exist if the Enterprise
38
+ * version of the ReCAPTCHA script was loaded by someone else (e.g. App Check) but
39
+ * `window.grecaptcha.render()` will not. Another load will add it.
40
+ */
36
41
  private readonly librarySeparatelyLoaded;
37
42
  load(auth: AuthInternal, hl?: string): Promise<Recaptcha>;
38
43
  clearedOneInstance(): void;
@@ -1158,6 +1158,7 @@ function secondsStringToMilliseconds(seconds) {
1158
1158
  return Number(seconds) * 1000;
1159
1159
  }
1160
1160
  function _parseToken(token) {
1161
+ var _a;
1161
1162
  const [algorithm, payload, signature] = token.split('.');
1162
1163
  if (algorithm === undefined ||
1163
1164
  payload === undefined ||
@@ -1174,7 +1175,7 @@ function _parseToken(token) {
1174
1175
  return JSON.parse(decoded);
1175
1176
  }
1176
1177
  catch (e) {
1177
- _logError('Caught error parsing JWT payload as JSON', e);
1178
+ _logError('Caught error parsing JWT payload as JSON', (_a = e) === null || _a === void 0 ? void 0 : _a.toString());
1178
1179
  return null;
1179
1180
  }
1180
1181
  }
@@ -1295,12 +1296,13 @@ class ProactiveRefresh {
1295
1296
  }, interval);
1296
1297
  }
1297
1298
  async iteration() {
1299
+ var _a;
1298
1300
  try {
1299
1301
  await this.user.getIdToken(true);
1300
1302
  }
1301
1303
  catch (e) {
1302
1304
  // Only retry on network errors
1303
- if (e.code === `auth/${"network-request-failed" /* NETWORK_REQUEST_FAILED */}`) {
1305
+ if (((_a = e) === null || _a === void 0 ? void 0 : _a.code) === `auth/${"network-request-failed" /* NETWORK_REQUEST_FAILED */}`) {
1304
1306
  this.schedule(/* wasError */ true);
1305
1307
  }
1306
1308
  return;
@@ -2046,7 +2048,8 @@ function _isWebOS(ua = getUA()) {
2046
2048
  return /webos/i.test(ua);
2047
2049
  }
2048
2050
  function _isIOS(ua = getUA()) {
2049
- return /iphone|ipad|ipod/i.test(ua);
2051
+ return /iphone|ipad|ipod/i.test(ua) ||
2052
+ (/macintosh/i.test(ua) && /mobile/i.test(ua));
2050
2053
  }
2051
2054
  function _isIOS7Or8(ua = getUA()) {
2052
2055
  return (/(iPad|iPhone|iPod).*OS 7_\d/i.test(ua) ||
@@ -2391,11 +2394,12 @@ class AuthImpl {
2391
2394
  return result;
2392
2395
  }
2393
2396
  async reloadAndSetCurrentUserOrClear(user) {
2397
+ var _a;
2394
2398
  try {
2395
2399
  await _reloadWithoutSaving(user);
2396
2400
  }
2397
2401
  catch (e) {
2398
- if (e.code !== `auth/${"network-request-failed" /* NETWORK_REQUEST_FAILED */}`) {
2402
+ if (((_a = e) === null || _a === void 0 ? void 0 : _a.code) !== `auth/${"network-request-failed" /* NETWORK_REQUEST_FAILED */}`) {
2399
2403
  // Something's wrong with the user's token. Log them out and remove
2400
2404
  // them from storage
2401
2405
  return this.directlySetCurrentUser(null);
@@ -4667,6 +4671,7 @@ async function _assertLinkedStatus(expected, user, provider) {
4667
4671
  * limitations under the License.
4668
4672
  */
4669
4673
  async function _reauthenticate(user, credential, bypassAuthState = false) {
4674
+ var _a;
4670
4675
  const { auth } = user;
4671
4676
  const operationType = "reauthenticate" /* REAUTHENTICATE */;
4672
4677
  try {
@@ -4680,7 +4685,7 @@ async function _reauthenticate(user, credential, bypassAuthState = false) {
4680
4685
  }
4681
4686
  catch (e) {
4682
4687
  // Convert user deleted error into user mismatch
4683
- if ((e === null || e === void 0 ? void 0 : e.code) === `auth/${"user-not-found" /* USER_DELETED */}`) {
4688
+ if (((_a = e) === null || _a === void 0 ? void 0 : _a.code) === `auth/${"user-not-found" /* USER_DELETED */}`) {
4684
4689
  _fail(auth, "user-mismatch" /* USER_MISMATCH */);
4685
4690
  }
4686
4691
  throw e;
@@ -5927,6 +5932,7 @@ class MultiFactorUserImpl {
5927
5932
  return this.user.reload();
5928
5933
  }
5929
5934
  async unenroll(infoOrUid) {
5935
+ var _a;
5930
5936
  const mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
5931
5937
  const idToken = await this.user.getIdToken();
5932
5938
  const idTokenResponse = await _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
@@ -5944,7 +5950,7 @@ class MultiFactorUserImpl {
5944
5950
  await this.user.reload();
5945
5951
  }
5946
5952
  catch (e) {
5947
- if (e.code !== `auth/${"user-token-expired" /* TOKEN_EXPIRED */}`) {
5953
+ if (((_a = e) === null || _a === void 0 ? void 0 : _a.code) !== `auth/${"user-token-expired" /* TOKEN_EXPIRED */}`) {
5948
5954
  throw e;
5949
5955
  }
5950
5956
  }
@@ -7207,9 +7213,15 @@ const RECAPTCHA_BASE = 'https://www.google.com/recaptcha/api.js?';
7207
7213
  */
7208
7214
  class ReCaptchaLoaderImpl {
7209
7215
  constructor() {
7216
+ var _a;
7210
7217
  this.hostLanguage = '';
7211
7218
  this.counter = 0;
7212
- this.librarySeparatelyLoaded = !!_window().grecaptcha;
7219
+ /**
7220
+ * Check for `render()` method. `window.grecaptcha` will exist if the Enterprise
7221
+ * version of the ReCAPTCHA script was loaded by someone else (e.g. App Check) but
7222
+ * `window.grecaptcha.render()` will not. Another load will add it.
7223
+ */
7224
+ this.librarySeparatelyLoaded = !!((_a = _window().grecaptcha) === null || _a === void 0 ? void 0 : _a.render);
7213
7225
  }
7214
7226
  load(auth, hl = '') {
7215
7227
  _assert(isHostLanguageValid(hl), auth, "argument-error" /* ARGUMENT_ERROR */);
@@ -7254,6 +7266,7 @@ class ReCaptchaLoaderImpl {
7254
7266
  this.counter--;
7255
7267
  }
7256
7268
  shouldResolveImmediately(hl) {
7269
+ var _a;
7257
7270
  // We can resolve immediately if:
7258
7271
  // • grecaptcha is already defined AND (
7259
7272
  // 1. the requested language codes are the same OR
@@ -7261,7 +7274,7 @@ class ReCaptchaLoaderImpl {
7261
7274
  // 3. the library was already loaded by the app
7262
7275
  // In cases (2) and (3), we _can't_ reload as it would break the recaptchas
7263
7276
  // that are already in the page
7264
- return (!!_window().grecaptcha &&
7277
+ return (!!((_a = _window().grecaptcha) === null || _a === void 0 ? void 0 : _a.render) &&
7265
7278
  (hl === this.hostLanguage ||
7266
7279
  this.counter > 0 ||
7267
7280
  this.librarySeparatelyLoaded));
@@ -7805,7 +7818,7 @@ class PhoneAuthProvider {
7805
7818
  * auth.currentUser,
7806
7819
  * PhoneAuthProvider.credential(verificationId, code));
7807
7820
  * } catch (e) {
7808
- * if (e.code === 'auth/account-exists-with-different-credential') {
7821
+ * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') {
7809
7822
  * const cred = PhoneAuthProvider.credentialFromError(e);
7810
7823
  * await linkWithCredential(auth.currentUser, cred);
7811
7824
  * }
@@ -9277,7 +9290,7 @@ class PhoneMultiFactorGenerator {
9277
9290
  PhoneMultiFactorGenerator.FACTOR_ID = 'phone';
9278
9291
 
9279
9292
  var name = "@firebase/auth";
9280
- var version = "0.20.3";
9293
+ var version = "0.20.4-canary.13550089f";
9281
9294
 
9282
9295
  /**
9283
9296
  * @license
@@ -9468,4 +9481,4 @@ function getAuth(app = getApp()) {
9468
9481
  registerAuth("Browser" /* BROWSER */);
9469
9482
 
9470
9483
  export { signInWithCustomToken as $, ActionCodeOperation as A, debugErrorMap as B, prodErrorMap as C, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as D, initializeAuth as E, FactorId as F, connectAuthEmulator as G, AuthCredential as H, EmailAuthCredential as I, OAuthCredential as J, PhoneAuthCredential as K, inMemoryPersistence as L, EmailAuthProvider as M, FacebookAuthProvider as N, OperationType as O, PhoneAuthProvider as P, GoogleAuthProvider as Q, RecaptchaVerifier as R, SignInMethod as S, GithubAuthProvider as T, OAuthProvider as U, SAMLAuthProvider as V, TwitterAuthProvider as W, signInAnonymously as X, signInWithCredential as Y, linkWithCredential as Z, reauthenticateWithCredential as _, browserSessionPersistence as a, sendPasswordResetEmail as a0, confirmPasswordReset as a1, applyActionCode as a2, checkActionCode as a3, verifyPasswordResetCode as a4, createUserWithEmailAndPassword as a5, signInWithEmailAndPassword as a6, sendSignInLinkToEmail as a7, isSignInWithEmailLink as a8, signInWithEmailLink as a9, AuthEventManager as aA, _getRedirectResult as aB, _overrideRedirectResult as aC, _clearRedirectOutcomes as aD, _castAuth as aE, UserImpl as aF, AuthImpl as aG, _getClientVersion as aH, _generateEventId as aI, AuthPopup as aJ, FetchProvider as aK, SAMLAuthCredential as aL, fetchSignInMethodsForEmail as aa, sendEmailVerification as ab, verifyBeforeUpdateEmail as ac, ActionCodeURL as ad, parseActionCodeURL as ae, updateProfile as af, updateEmail as ag, updatePassword as ah, getIdToken as ai, getIdTokenResult as aj, unlink as ak, getAdditionalUserInfo as al, reload as am, getMultiFactorResolver as an, multiFactor as ao, _isIOS7Or8 as ap, debugAssert as aq, _isIOS as ar, _isAndroid as as, _fail as at, _getRedirectUrl as au, _getProjectConfig as av, _createError as aw, _assert as ax, _getInstance as ay, _persistenceKeyName 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, getAuth as n, ProviderId as o, setPersistence as p, onIdTokenChanged as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, beforeAuthStateChanged as t, updatePhoneNumber as u, onAuthStateChanged as v, useDeviceLanguage as w, updateCurrentUser as x, signOut as y, deleteUser as z };
9471
- //# sourceMappingURL=index-69ab4e3a.js.map
9484
+ //# sourceMappingURL=index-25da8a76.js.map