@firebase/auth-compat 0.5.14 → 0.5.15

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.
@@ -4,8 +4,6 @@ var firebase = require('@firebase/app-compat');
4
4
  var exp = require('@firebase/auth/internal');
5
5
  var component = require('@firebase/component');
6
6
  var util = require('@firebase/util');
7
- var tslib = require('tslib');
8
- var undici = require('undici');
9
7
 
10
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
9
 
@@ -31,7 +29,7 @@ var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
31
29
  var exp__namespace = /*#__PURE__*/_interopNamespace(exp);
32
30
 
33
31
  var name = "@firebase/auth-compat";
34
- var version = "0.5.14";
32
+ var version = "0.5.15";
35
33
 
36
34
  /**
37
35
  * @license
@@ -49,7 +47,7 @@ var version = "0.5.14";
49
47
  * See the License for the specific language governing permissions and
50
48
  * limitations under the License.
51
49
  */
52
- var CORDOVA_ONDEVICEREADY_TIMEOUT_MS = 1000;
50
+ const CORDOVA_ONDEVICEREADY_TIMEOUT_MS = 1000;
53
51
  function _getCurrentScheme() {
54
52
  var _a;
55
53
  return ((_a = self === null || self === void 0 ? void 0 : self.location) === null || _a === void 0 ? void 0 : _a.protocol) || null;
@@ -65,8 +63,7 @@ function _isHttpOrHttps() {
65
63
  * @return {boolean} Whether the app is rendered in a mobile iOS or Android
66
64
  * Cordova environment.
67
65
  */
68
- function _isAndroidOrIosCordovaScheme(ua) {
69
- if (ua === void 0) { ua = util.getUA(); }
66
+ function _isAndroidOrIosCordovaScheme(ua = util.getUA()) {
70
67
  return !!((_getCurrentScheme() === 'file:' ||
71
68
  _getCurrentScheme() === 'ionic:' ||
72
69
  _getCurrentScheme() === 'capacitor:') &&
@@ -91,8 +88,7 @@ function _isIe11() {
91
88
  * @param {string} userAgent The browser user agent string.
92
89
  * @return {boolean} True if it is Edge.
93
90
  */
94
- function _isEdge(ua) {
95
- if (ua === void 0) { ua = util.getUA(); }
91
+ function _isEdge(ua = util.getUA()) {
96
92
  return /Edge\/\d+/.test(ua);
97
93
  }
98
94
  /**
@@ -100,15 +96,14 @@ function _isEdge(ua) {
100
96
  * @return {boolean} Whether local storage is not synchronized between an iframe
101
97
  * and a popup of the same domain.
102
98
  */
103
- function _isLocalStorageNotSynchronized(ua) {
104
- if (ua === void 0) { ua = util.getUA(); }
99
+ function _isLocalStorageNotSynchronized(ua = util.getUA()) {
105
100
  return _isIe11() || _isEdge(ua);
106
101
  }
107
102
  /** @return {boolean} Whether web storage is supported. */
108
103
  function _isWebStorageSupported() {
109
104
  try {
110
- var storage = self.localStorage;
111
- var key = exp__namespace._generateEventId();
105
+ const storage = self.localStorage;
106
+ const key = exp__namespace._generateEventId();
112
107
  if (storage) {
113
108
  // setItem will throw an exception if we cannot access WebStorage (e.g.,
114
109
  // Safari in private mode).
@@ -161,22 +156,18 @@ function _isPopupRedirectSupported() {
161
156
  function _isLikelyCordova() {
162
157
  return _isAndroidOrIosCordovaScheme() && typeof document !== 'undefined';
163
158
  }
164
- function _isCordova() {
165
- return tslib.__awaiter(this, void 0, void 0, function () {
166
- return tslib.__generator(this, function (_a) {
167
- if (!_isLikelyCordova()) {
168
- return [2 /*return*/, false];
169
- }
170
- return [2 /*return*/, new Promise(function (resolve) {
171
- var timeoutId = setTimeout(function () {
172
- // We've waited long enough; the telltale Cordova event didn't happen
173
- resolve(false);
174
- }, CORDOVA_ONDEVICEREADY_TIMEOUT_MS);
175
- document.addEventListener('deviceready', function () {
176
- clearTimeout(timeoutId);
177
- resolve(true);
178
- });
179
- })];
159
+ async function _isCordova() {
160
+ if (!_isLikelyCordova()) {
161
+ return false;
162
+ }
163
+ return new Promise(resolve => {
164
+ const timeoutId = setTimeout(() => {
165
+ // We've waited long enough; the telltale Cordova event didn't happen
166
+ resolve(false);
167
+ }, CORDOVA_ONDEVICEREADY_TIMEOUT_MS);
168
+ document.addEventListener('deviceready', () => {
169
+ clearTimeout(timeoutId);
170
+ resolve(true);
180
171
  });
181
172
  });
182
173
  }
@@ -200,13 +191,13 @@ function _getSelfWindow() {
200
191
  * See the License for the specific language governing permissions and
201
192
  * limitations under the License.
202
193
  */
203
- var Persistence = {
194
+ const Persistence = {
204
195
  LOCAL: 'local',
205
196
  NONE: 'none',
206
197
  SESSION: 'session'
207
198
  };
208
- var _assert$3 = exp__namespace._assert;
209
- var PERSISTENCE_KEY = 'persistence';
199
+ const _assert$3 = exp__namespace._assert;
200
+ const PERSISTENCE_KEY = 'persistence';
210
201
  /**
211
202
  * Validates that an argument is a valid persistence value. If an invalid type
212
203
  * is specified, an error is thrown synchronously.
@@ -234,31 +225,21 @@ function _validatePersistenceArgument(auth, persistence) {
234
225
  // This is restricted by what the browser supports.
235
226
  _assert$3(persistence === Persistence.NONE || _isWebStorageSupported(), auth, "unsupported-persistence-type" /* exp.AuthErrorCode.UNSUPPORTED_PERSISTENCE */);
236
227
  }
237
- function _savePersistenceForRedirect(auth) {
238
- return tslib.__awaiter(this, void 0, void 0, function () {
239
- var session, key;
240
- return tslib.__generator(this, function (_a) {
241
- switch (_a.label) {
242
- case 0: return [4 /*yield*/, auth._initializationPromise];
243
- case 1:
244
- _a.sent();
245
- session = getSessionStorageIfAvailable();
246
- key = exp__namespace._persistenceKeyName(PERSISTENCE_KEY, auth.config.apiKey, auth.name);
247
- if (session) {
248
- session.setItem(key, auth._getPersistence());
249
- }
250
- return [2 /*return*/];
251
- }
252
- });
253
- });
228
+ async function _savePersistenceForRedirect(auth) {
229
+ await auth._initializationPromise;
230
+ const session = getSessionStorageIfAvailable();
231
+ const key = exp__namespace._persistenceKeyName(PERSISTENCE_KEY, auth.config.apiKey, auth.name);
232
+ if (session) {
233
+ session.setItem(key, auth._getPersistence());
234
+ }
254
235
  }
255
236
  function _getPersistencesFromRedirect(apiKey, appName) {
256
- var session = getSessionStorageIfAvailable();
237
+ const session = getSessionStorageIfAvailable();
257
238
  if (!session) {
258
239
  return [];
259
240
  }
260
- var key = exp__namespace._persistenceKeyName(PERSISTENCE_KEY, apiKey, appName);
261
- var persistence = session.getItem(key);
241
+ const key = exp__namespace._persistenceKeyName(PERSISTENCE_KEY, apiKey, appName);
242
+ const persistence = session.getItem(key);
262
243
  switch (persistence) {
263
244
  case Persistence.NONE:
264
245
  return [exp__namespace.inMemoryPersistence];
@@ -297,10 +278,10 @@ function getSessionStorageIfAvailable() {
297
278
  * See the License for the specific language governing permissions and
298
279
  * limitations under the License.
299
280
  */
300
- var _assert$2 = exp__namespace._assert;
281
+ const _assert$2 = exp__namespace._assert;
301
282
  /** Platform-agnostic popup-redirect resolver */
302
- var CompatPopupRedirectResolver = /** @class */ (function () {
303
- function CompatPopupRedirectResolver() {
283
+ class CompatPopupRedirectResolver {
284
+ constructor() {
304
285
  // Create both resolvers for dynamic resolution later
305
286
  this.browserResolver = exp__namespace._getInstance(exp__namespace.browserPopupRedirectResolver);
306
287
  this.cordovaResolver = exp__namespace._getInstance(exp__namespace.cordovaPopupRedirectResolver);
@@ -310,85 +291,43 @@ var CompatPopupRedirectResolver = /** @class */ (function () {
310
291
  this._completeRedirectFn = exp__namespace._getRedirectResult;
311
292
  this._overrideRedirectResult = exp__namespace._overrideRedirectResult;
312
293
  }
313
- CompatPopupRedirectResolver.prototype._initialize = function (auth) {
314
- return tslib.__awaiter(this, void 0, void 0, function () {
315
- return tslib.__generator(this, function (_a) {
316
- switch (_a.label) {
317
- case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
318
- case 1:
319
- _a.sent();
320
- return [2 /*return*/, this.assertedUnderlyingResolver._initialize(auth)];
321
- }
322
- });
323
- });
324
- };
325
- CompatPopupRedirectResolver.prototype._openPopup = function (auth, provider, authType, eventId) {
326
- return tslib.__awaiter(this, void 0, void 0, function () {
327
- return tslib.__generator(this, function (_a) {
328
- switch (_a.label) {
329
- case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
330
- case 1:
331
- _a.sent();
332
- return [2 /*return*/, this.assertedUnderlyingResolver._openPopup(auth, provider, authType, eventId)];
333
- }
334
- });
335
- });
336
- };
337
- CompatPopupRedirectResolver.prototype._openRedirect = function (auth, provider, authType, eventId) {
338
- return tslib.__awaiter(this, void 0, void 0, function () {
339
- return tslib.__generator(this, function (_a) {
340
- switch (_a.label) {
341
- case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
342
- case 1:
343
- _a.sent();
344
- return [2 /*return*/, this.assertedUnderlyingResolver._openRedirect(auth, provider, authType, eventId)];
345
- }
346
- });
347
- });
348
- };
349
- CompatPopupRedirectResolver.prototype._isIframeWebStorageSupported = function (auth, cb) {
294
+ async _initialize(auth) {
295
+ await this.selectUnderlyingResolver();
296
+ return this.assertedUnderlyingResolver._initialize(auth);
297
+ }
298
+ async _openPopup(auth, provider, authType, eventId) {
299
+ await this.selectUnderlyingResolver();
300
+ return this.assertedUnderlyingResolver._openPopup(auth, provider, authType, eventId);
301
+ }
302
+ async _openRedirect(auth, provider, authType, eventId) {
303
+ await this.selectUnderlyingResolver();
304
+ return this.assertedUnderlyingResolver._openRedirect(auth, provider, authType, eventId);
305
+ }
306
+ _isIframeWebStorageSupported(auth, cb) {
350
307
  this.assertedUnderlyingResolver._isIframeWebStorageSupported(auth, cb);
351
- };
352
- CompatPopupRedirectResolver.prototype._originValidation = function (auth) {
308
+ }
309
+ _originValidation(auth) {
353
310
  return this.assertedUnderlyingResolver._originValidation(auth);
354
- };
355
- Object.defineProperty(CompatPopupRedirectResolver.prototype, "_shouldInitProactively", {
356
- get: function () {
357
- return _isLikelyCordova() || this.browserResolver._shouldInitProactively;
358
- },
359
- enumerable: false,
360
- configurable: true
361
- });
362
- Object.defineProperty(CompatPopupRedirectResolver.prototype, "assertedUnderlyingResolver", {
363
- get: function () {
364
- _assert$2(this.underlyingResolver, "internal-error" /* exp.AuthErrorCode.INTERNAL_ERROR */);
365
- return this.underlyingResolver;
366
- },
367
- enumerable: false,
368
- configurable: true
369
- });
370
- CompatPopupRedirectResolver.prototype.selectUnderlyingResolver = function () {
371
- return tslib.__awaiter(this, void 0, void 0, function () {
372
- var isCordova;
373
- return tslib.__generator(this, function (_a) {
374
- switch (_a.label) {
375
- case 0:
376
- if (this.underlyingResolver) {
377
- return [2 /*return*/];
378
- }
379
- return [4 /*yield*/, _isCordova()];
380
- case 1:
381
- isCordova = _a.sent();
382
- this.underlyingResolver = isCordova
383
- ? this.cordovaResolver
384
- : this.browserResolver;
385
- return [2 /*return*/];
386
- }
387
- });
388
- });
389
- };
390
- return CompatPopupRedirectResolver;
391
- }());
311
+ }
312
+ get _shouldInitProactively() {
313
+ return _isLikelyCordova() || this.browserResolver._shouldInitProactively;
314
+ }
315
+ get assertedUnderlyingResolver() {
316
+ _assert$2(this.underlyingResolver, "internal-error" /* exp.AuthErrorCode.INTERNAL_ERROR */);
317
+ return this.underlyingResolver;
318
+ }
319
+ async selectUnderlyingResolver() {
320
+ if (this.underlyingResolver) {
321
+ return;
322
+ }
323
+ // We haven't yet determined whether or not we're in Cordova; go ahead
324
+ // and determine that state now.
325
+ const isCordova = await _isCordova();
326
+ this.underlyingResolver = isCordova
327
+ ? this.cordovaResolver
328
+ : this.browserResolver;
329
+ }
330
+ }
392
331
 
393
332
  /**
394
333
  * @license
@@ -436,14 +375,14 @@ function attachExtraErrorFields(auth, e) {
436
375
  var _a;
437
376
  // The response contains all fields from the server which may or may not
438
377
  // actually match the underlying type
439
- var response = (_a = e.customData) === null || _a === void 0 ? void 0 : _a._tokenResponse;
378
+ const response = (_a = e.customData) === null || _a === void 0 ? void 0 : _a._tokenResponse;
440
379
  if ((e === null || e === void 0 ? void 0 : e.code) === 'auth/multi-factor-auth-required') {
441
- var mfaErr = e;
380
+ const mfaErr = e;
442
381
  mfaErr.resolver = new MultiFactorResolver(auth, exp__namespace.getMultiFactorResolver(auth, e));
443
382
  }
444
383
  else if (response) {
445
- var credential = credentialFromObject(e);
446
- var credErr = e;
384
+ const credential = credentialFromObject(e);
385
+ const credErr = e;
447
386
  if (credential) {
448
387
  credErr.credential = credential;
449
388
  credErr.tenantId = response.tenantId || undefined;
@@ -453,7 +392,7 @@ function attachExtraErrorFields(auth, e) {
453
392
  }
454
393
  }
455
394
  function credentialFromObject(object) {
456
- var _tokenResponse = (object instanceof util.FirebaseError ? object.customData : object)._tokenResponse;
395
+ const { _tokenResponse } = (object instanceof util.FirebaseError ? object.customData : object);
457
396
  if (!_tokenResponse) {
458
397
  return null;
459
398
  }
@@ -465,13 +404,13 @@ function credentialFromObject(object) {
465
404
  return exp__namespace.PhoneAuthProvider.credentialFromResult(object);
466
405
  }
467
406
  }
468
- var providerId = _tokenResponse.providerId;
407
+ const providerId = _tokenResponse.providerId;
469
408
  // Email and password is not supported as there is no situation where the
470
409
  // server would return the password to the client.
471
410
  if (!providerId || providerId === exp__namespace.ProviderId.PASSWORD) {
472
411
  return null;
473
412
  }
474
- var provider;
413
+ let provider;
475
414
  switch (providerId) {
476
415
  case exp__namespace.ProviderId.GOOGLE:
477
416
  provider = exp__namespace.GoogleAuthProvider;
@@ -486,7 +425,7 @@ function credentialFromObject(object) {
486
425
  provider = exp__namespace.TwitterAuthProvider;
487
426
  break;
488
427
  default:
489
- var _a = _tokenResponse, oauthIdToken = _a.oauthIdToken, oauthAccessToken = _a.oauthAccessToken, oauthTokenSecret = _a.oauthTokenSecret, pendingToken = _a.pendingToken, nonce = _a.nonce;
428
+ const { oauthIdToken, oauthAccessToken, oauthTokenSecret, pendingToken, nonce } = _tokenResponse;
490
429
  if (!oauthAccessToken &&
491
430
  !oauthTokenSecret &&
492
431
  !oauthIdToken &&
@@ -501,9 +440,9 @@ function credentialFromObject(object) {
501
440
  else {
502
441
  // OIDC and non-default providers excluding Twitter.
503
442
  return exp__namespace.OAuthCredential._fromParams({
504
- providerId: providerId,
443
+ providerId,
505
444
  signInMethod: providerId,
506
- pendingToken: pendingToken,
445
+ pendingToken,
507
446
  idToken: oauthIdToken,
508
447
  accessToken: oauthAccessToken
509
448
  });
@@ -521,65 +460,45 @@ function credentialFromObject(object) {
521
460
  }
522
461
  function convertCredential(auth, credentialPromise) {
523
462
  return credentialPromise
524
- .catch(function (e) {
463
+ .catch(e => {
525
464
  if (e instanceof util.FirebaseError) {
526
465
  attachExtraErrorFields(auth, e);
527
466
  }
528
467
  throw e;
529
468
  })
530
- .then(function (credential) {
531
- var operationType = credential.operationType;
532
- var user = credential.user;
469
+ .then(credential => {
470
+ const operationType = credential.operationType;
471
+ const user = credential.user;
533
472
  return {
534
- operationType: operationType,
473
+ operationType,
535
474
  credential: credentialFromResponse(credential),
536
475
  additionalUserInfo: exp__namespace.getAdditionalUserInfo(credential),
537
476
  user: User.getOrCreate(user)
538
477
  };
539
478
  });
540
479
  }
541
- function convertConfirmationResult(auth, confirmationResultPromise) {
542
- return tslib.__awaiter(this, void 0, void 0, function () {
543
- var confirmationResultExp;
544
- return tslib.__generator(this, function (_a) {
545
- switch (_a.label) {
546
- case 0: return [4 /*yield*/, confirmationResultPromise];
547
- case 1:
548
- confirmationResultExp = _a.sent();
549
- return [2 /*return*/, {
550
- verificationId: confirmationResultExp.verificationId,
551
- confirm: function (verificationCode) {
552
- return convertCredential(auth, confirmationResultExp.confirm(verificationCode));
553
- }
554
- }];
555
- }
556
- });
557
- });
480
+ async function convertConfirmationResult(auth, confirmationResultPromise) {
481
+ const confirmationResultExp = await confirmationResultPromise;
482
+ return {
483
+ verificationId: confirmationResultExp.verificationId,
484
+ confirm: (verificationCode) => convertCredential(auth, confirmationResultExp.confirm(verificationCode))
485
+ };
558
486
  }
559
- var MultiFactorResolver = /** @class */ (function () {
560
- function MultiFactorResolver(auth, resolver) {
487
+ class MultiFactorResolver {
488
+ constructor(auth, resolver) {
561
489
  this.resolver = resolver;
562
490
  this.auth = wrapped(auth);
563
491
  }
564
- Object.defineProperty(MultiFactorResolver.prototype, "session", {
565
- get: function () {
566
- return this.resolver.session;
567
- },
568
- enumerable: false,
569
- configurable: true
570
- });
571
- Object.defineProperty(MultiFactorResolver.prototype, "hints", {
572
- get: function () {
573
- return this.resolver.hints;
574
- },
575
- enumerable: false,
576
- configurable: true
577
- });
578
- MultiFactorResolver.prototype.resolveSignIn = function (assertion) {
492
+ get session() {
493
+ return this.resolver.session;
494
+ }
495
+ get hints() {
496
+ return this.resolver.hints;
497
+ }
498
+ resolveSignIn(assertion) {
579
499
  return convertCredential(unwrap(this.auth), this.resolver.resolveSignIn(assertion));
580
- };
581
- return MultiFactorResolver;
582
- }());
500
+ }
501
+ }
583
502
 
584
503
  /**
585
504
  * @license
@@ -597,222 +516,129 @@ var MultiFactorResolver = /** @class */ (function () {
597
516
  * See the License for the specific language governing permissions and
598
517
  * limitations under the License.
599
518
  */
600
- var User = /** @class */ (function () {
601
- function User(_delegate) {
519
+ class User {
520
+ constructor(_delegate) {
602
521
  this._delegate = _delegate;
603
522
  this.multiFactor = exp__namespace.multiFactor(_delegate);
604
523
  }
605
- User.getOrCreate = function (user) {
524
+ static getOrCreate(user) {
606
525
  if (!User.USER_MAP.has(user)) {
607
526
  User.USER_MAP.set(user, new User(user));
608
527
  }
609
528
  return User.USER_MAP.get(user);
610
- };
611
- User.prototype.delete = function () {
529
+ }
530
+ delete() {
612
531
  return this._delegate.delete();
613
- };
614
- User.prototype.reload = function () {
532
+ }
533
+ reload() {
615
534
  return this._delegate.reload();
616
- };
617
- User.prototype.toJSON = function () {
535
+ }
536
+ toJSON() {
618
537
  return this._delegate.toJSON();
619
- };
620
- User.prototype.getIdTokenResult = function (forceRefresh) {
538
+ }
539
+ getIdTokenResult(forceRefresh) {
621
540
  return this._delegate.getIdTokenResult(forceRefresh);
622
- };
623
- User.prototype.getIdToken = function (forceRefresh) {
541
+ }
542
+ getIdToken(forceRefresh) {
624
543
  return this._delegate.getIdToken(forceRefresh);
625
- };
626
- User.prototype.linkAndRetrieveDataWithCredential = function (credential) {
544
+ }
545
+ linkAndRetrieveDataWithCredential(credential) {
627
546
  return this.linkWithCredential(credential);
628
- };
629
- User.prototype.linkWithCredential = function (credential) {
630
- return tslib.__awaiter(this, void 0, void 0, function () {
631
- return tslib.__generator(this, function (_a) {
632
- return [2 /*return*/, convertCredential(this.auth, exp__namespace.linkWithCredential(this._delegate, credential))];
633
- });
634
- });
635
- };
636
- User.prototype.linkWithPhoneNumber = function (phoneNumber, applicationVerifier) {
637
- return tslib.__awaiter(this, void 0, void 0, function () {
638
- return tslib.__generator(this, function (_a) {
639
- return [2 /*return*/, convertConfirmationResult(this.auth, exp__namespace.linkWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier))];
640
- });
641
- });
642
- };
643
- User.prototype.linkWithPopup = function (provider) {
644
- return tslib.__awaiter(this, void 0, void 0, function () {
645
- return tslib.__generator(this, function (_a) {
646
- return [2 /*return*/, convertCredential(this.auth, exp__namespace.linkWithPopup(this._delegate, provider, CompatPopupRedirectResolver))];
647
- });
648
- });
649
- };
650
- User.prototype.linkWithRedirect = function (provider) {
651
- return tslib.__awaiter(this, void 0, void 0, function () {
652
- return tslib.__generator(this, function (_a) {
653
- switch (_a.label) {
654
- case 0: return [4 /*yield*/, _savePersistenceForRedirect(exp__namespace._castAuth(this.auth))];
655
- case 1:
656
- _a.sent();
657
- return [2 /*return*/, exp__namespace.linkWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
658
- }
659
- });
660
- });
661
- };
662
- User.prototype.reauthenticateAndRetrieveDataWithCredential = function (credential) {
547
+ }
548
+ async linkWithCredential(credential) {
549
+ return convertCredential(this.auth, exp__namespace.linkWithCredential(this._delegate, credential));
550
+ }
551
+ async linkWithPhoneNumber(phoneNumber, applicationVerifier) {
552
+ return convertConfirmationResult(this.auth, exp__namespace.linkWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
553
+ }
554
+ async linkWithPopup(provider) {
555
+ return convertCredential(this.auth, exp__namespace.linkWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
556
+ }
557
+ async linkWithRedirect(provider) {
558
+ await _savePersistenceForRedirect(exp__namespace._castAuth(this.auth));
559
+ return exp__namespace.linkWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
560
+ }
561
+ reauthenticateAndRetrieveDataWithCredential(credential) {
663
562
  return this.reauthenticateWithCredential(credential);
664
- };
665
- User.prototype.reauthenticateWithCredential = function (credential) {
666
- return tslib.__awaiter(this, void 0, void 0, function () {
667
- return tslib.__generator(this, function (_a) {
668
- return [2 /*return*/, convertCredential(this.auth, exp__namespace.reauthenticateWithCredential(this._delegate, credential))];
669
- });
670
- });
671
- };
672
- User.prototype.reauthenticateWithPhoneNumber = function (phoneNumber, applicationVerifier) {
563
+ }
564
+ async reauthenticateWithCredential(credential) {
565
+ return convertCredential(this.auth, exp__namespace.reauthenticateWithCredential(this._delegate, credential));
566
+ }
567
+ reauthenticateWithPhoneNumber(phoneNumber, applicationVerifier) {
673
568
  return convertConfirmationResult(this.auth, exp__namespace.reauthenticateWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
674
- };
675
- User.prototype.reauthenticateWithPopup = function (provider) {
569
+ }
570
+ reauthenticateWithPopup(provider) {
676
571
  return convertCredential(this.auth, exp__namespace.reauthenticateWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
677
- };
678
- User.prototype.reauthenticateWithRedirect = function (provider) {
679
- return tslib.__awaiter(this, void 0, void 0, function () {
680
- return tslib.__generator(this, function (_a) {
681
- switch (_a.label) {
682
- case 0: return [4 /*yield*/, _savePersistenceForRedirect(exp__namespace._castAuth(this.auth))];
683
- case 1:
684
- _a.sent();
685
- return [2 /*return*/, exp__namespace.reauthenticateWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
686
- }
687
- });
688
- });
689
- };
690
- User.prototype.sendEmailVerification = function (actionCodeSettings) {
572
+ }
573
+ async reauthenticateWithRedirect(provider) {
574
+ await _savePersistenceForRedirect(exp__namespace._castAuth(this.auth));
575
+ return exp__namespace.reauthenticateWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
576
+ }
577
+ sendEmailVerification(actionCodeSettings) {
691
578
  return exp__namespace.sendEmailVerification(this._delegate, actionCodeSettings);
692
- };
693
- User.prototype.unlink = function (providerId) {
694
- return tslib.__awaiter(this, void 0, void 0, function () {
695
- return tslib.__generator(this, function (_a) {
696
- switch (_a.label) {
697
- case 0: return [4 /*yield*/, exp__namespace.unlink(this._delegate, providerId)];
698
- case 1:
699
- _a.sent();
700
- return [2 /*return*/, this];
701
- }
702
- });
703
- });
704
- };
705
- User.prototype.updateEmail = function (newEmail) {
579
+ }
580
+ async unlink(providerId) {
581
+ await exp__namespace.unlink(this._delegate, providerId);
582
+ return this;
583
+ }
584
+ updateEmail(newEmail) {
706
585
  return exp__namespace.updateEmail(this._delegate, newEmail);
707
- };
708
- User.prototype.updatePassword = function (newPassword) {
586
+ }
587
+ updatePassword(newPassword) {
709
588
  return exp__namespace.updatePassword(this._delegate, newPassword);
710
- };
711
- User.prototype.updatePhoneNumber = function (phoneCredential) {
589
+ }
590
+ updatePhoneNumber(phoneCredential) {
712
591
  return exp__namespace.updatePhoneNumber(this._delegate, phoneCredential);
713
- };
714
- User.prototype.updateProfile = function (profile) {
592
+ }
593
+ updateProfile(profile) {
715
594
  return exp__namespace.updateProfile(this._delegate, profile);
716
- };
717
- User.prototype.verifyBeforeUpdateEmail = function (newEmail, actionCodeSettings) {
595
+ }
596
+ verifyBeforeUpdateEmail(newEmail, actionCodeSettings) {
718
597
  return exp__namespace.verifyBeforeUpdateEmail(this._delegate, newEmail, actionCodeSettings);
719
- };
720
- Object.defineProperty(User.prototype, "emailVerified", {
721
- get: function () {
722
- return this._delegate.emailVerified;
723
- },
724
- enumerable: false,
725
- configurable: true
726
- });
727
- Object.defineProperty(User.prototype, "isAnonymous", {
728
- get: function () {
729
- return this._delegate.isAnonymous;
730
- },
731
- enumerable: false,
732
- configurable: true
733
- });
734
- Object.defineProperty(User.prototype, "metadata", {
735
- get: function () {
736
- return this._delegate.metadata;
737
- },
738
- enumerable: false,
739
- configurable: true
740
- });
741
- Object.defineProperty(User.prototype, "phoneNumber", {
742
- get: function () {
743
- return this._delegate.phoneNumber;
744
- },
745
- enumerable: false,
746
- configurable: true
747
- });
748
- Object.defineProperty(User.prototype, "providerData", {
749
- get: function () {
750
- return this._delegate.providerData;
751
- },
752
- enumerable: false,
753
- configurable: true
754
- });
755
- Object.defineProperty(User.prototype, "refreshToken", {
756
- get: function () {
757
- return this._delegate.refreshToken;
758
- },
759
- enumerable: false,
760
- configurable: true
761
- });
762
- Object.defineProperty(User.prototype, "tenantId", {
763
- get: function () {
764
- return this._delegate.tenantId;
765
- },
766
- enumerable: false,
767
- configurable: true
768
- });
769
- Object.defineProperty(User.prototype, "displayName", {
770
- get: function () {
771
- return this._delegate.displayName;
772
- },
773
- enumerable: false,
774
- configurable: true
775
- });
776
- Object.defineProperty(User.prototype, "email", {
777
- get: function () {
778
- return this._delegate.email;
779
- },
780
- enumerable: false,
781
- configurable: true
782
- });
783
- Object.defineProperty(User.prototype, "photoURL", {
784
- get: function () {
785
- return this._delegate.photoURL;
786
- },
787
- enumerable: false,
788
- configurable: true
789
- });
790
- Object.defineProperty(User.prototype, "providerId", {
791
- get: function () {
792
- return this._delegate.providerId;
793
- },
794
- enumerable: false,
795
- configurable: true
796
- });
797
- Object.defineProperty(User.prototype, "uid", {
798
- get: function () {
799
- return this._delegate.uid;
800
- },
801
- enumerable: false,
802
- configurable: true
803
- });
804
- Object.defineProperty(User.prototype, "auth", {
805
- get: function () {
806
- return this._delegate.auth;
807
- },
808
- enumerable: false,
809
- configurable: true
810
- });
811
- // Maintain a map so that there's always a 1:1 mapping between new User and
812
- // legacy compat users
813
- User.USER_MAP = new WeakMap();
814
- return User;
815
- }());
598
+ }
599
+ get emailVerified() {
600
+ return this._delegate.emailVerified;
601
+ }
602
+ get isAnonymous() {
603
+ return this._delegate.isAnonymous;
604
+ }
605
+ get metadata() {
606
+ return this._delegate.metadata;
607
+ }
608
+ get phoneNumber() {
609
+ return this._delegate.phoneNumber;
610
+ }
611
+ get providerData() {
612
+ return this._delegate.providerData;
613
+ }
614
+ get refreshToken() {
615
+ return this._delegate.refreshToken;
616
+ }
617
+ get tenantId() {
618
+ return this._delegate.tenantId;
619
+ }
620
+ get displayName() {
621
+ return this._delegate.displayName;
622
+ }
623
+ get email() {
624
+ return this._delegate.email;
625
+ }
626
+ get photoURL() {
627
+ return this._delegate.photoURL;
628
+ }
629
+ get providerId() {
630
+ return this._delegate.providerId;
631
+ }
632
+ get uid() {
633
+ return this._delegate.uid;
634
+ }
635
+ get auth() {
636
+ return this._delegate.auth;
637
+ }
638
+ }
639
+ // Maintain a map so that there's always a 1:1 mapping between new User and
640
+ // legacy compat users
641
+ User.USER_MAP = new WeakMap();
816
642
 
817
643
  /**
818
644
  * @license
@@ -830,16 +656,16 @@ var User = /** @class */ (function () {
830
656
  * See the License for the specific language governing permissions and
831
657
  * limitations under the License.
832
658
  */
833
- var _assert$1 = exp__namespace._assert;
834
- var Auth = /** @class */ (function () {
835
- function Auth(app, provider) {
659
+ const _assert$1 = exp__namespace._assert;
660
+ class Auth {
661
+ constructor(app, provider) {
836
662
  this.app = app;
837
663
  if (provider.isInitialized()) {
838
664
  this._delegate = provider.getImmediate();
839
665
  this.linkUnderlyingAuth();
840
666
  return;
841
667
  }
842
- var apiKey = app.options.apiKey;
668
+ const { apiKey } = app.options;
843
669
  // TODO: platform needs to be determined using heuristics
844
670
  _assert$1(apiKey, "invalid-api-key" /* exp.AuthErrorCode.INVALID_API_KEY */, {
845
671
  appName: app.name
@@ -849,7 +675,7 @@ var Auth = /** @class */ (function () {
849
675
  appName: app.name
850
676
  });
851
677
  // Only use a popup/redirect resolver in browser environments
852
- var resolver = typeof window !== 'undefined' ? CompatPopupRedirectResolver : undefined;
678
+ const resolver = typeof window !== 'undefined' ? CompatPopupRedirectResolver : undefined;
853
679
  this._delegate = provider.initialize({
854
680
  options: {
855
681
  persistence: buildPersistenceHierarchy(apiKey, app.name),
@@ -859,240 +685,178 @@ var Auth = /** @class */ (function () {
859
685
  this._delegate._updateErrorMap(exp__namespace.debugErrorMap);
860
686
  this.linkUnderlyingAuth();
861
687
  }
862
- Object.defineProperty(Auth.prototype, "emulatorConfig", {
863
- get: function () {
864
- return this._delegate.emulatorConfig;
865
- },
866
- enumerable: false,
867
- configurable: true
868
- });
869
- Object.defineProperty(Auth.prototype, "currentUser", {
870
- get: function () {
871
- if (!this._delegate.currentUser) {
872
- return null;
873
- }
874
- return User.getOrCreate(this._delegate.currentUser);
875
- },
876
- enumerable: false,
877
- configurable: true
878
- });
879
- Object.defineProperty(Auth.prototype, "languageCode", {
880
- get: function () {
881
- return this._delegate.languageCode;
882
- },
883
- set: function (languageCode) {
884
- this._delegate.languageCode = languageCode;
885
- },
886
- enumerable: false,
887
- configurable: true
888
- });
889
- Object.defineProperty(Auth.prototype, "settings", {
890
- get: function () {
891
- return this._delegate.settings;
892
- },
893
- enumerable: false,
894
- configurable: true
895
- });
896
- Object.defineProperty(Auth.prototype, "tenantId", {
897
- get: function () {
898
- return this._delegate.tenantId;
899
- },
900
- set: function (tid) {
901
- this._delegate.tenantId = tid;
902
- },
903
- enumerable: false,
904
- configurable: true
905
- });
906
- Auth.prototype.useDeviceLanguage = function () {
688
+ get emulatorConfig() {
689
+ return this._delegate.emulatorConfig;
690
+ }
691
+ get currentUser() {
692
+ if (!this._delegate.currentUser) {
693
+ return null;
694
+ }
695
+ return User.getOrCreate(this._delegate.currentUser);
696
+ }
697
+ get languageCode() {
698
+ return this._delegate.languageCode;
699
+ }
700
+ set languageCode(languageCode) {
701
+ this._delegate.languageCode = languageCode;
702
+ }
703
+ get settings() {
704
+ return this._delegate.settings;
705
+ }
706
+ get tenantId() {
707
+ return this._delegate.tenantId;
708
+ }
709
+ set tenantId(tid) {
710
+ this._delegate.tenantId = tid;
711
+ }
712
+ useDeviceLanguage() {
907
713
  this._delegate.useDeviceLanguage();
908
- };
909
- Auth.prototype.signOut = function () {
714
+ }
715
+ signOut() {
910
716
  return this._delegate.signOut();
911
- };
912
- Auth.prototype.useEmulator = function (url, options) {
717
+ }
718
+ useEmulator(url, options) {
913
719
  exp__namespace.connectAuthEmulator(this._delegate, url, options);
914
- };
915
- Auth.prototype.applyActionCode = function (code) {
720
+ }
721
+ applyActionCode(code) {
916
722
  return exp__namespace.applyActionCode(this._delegate, code);
917
- };
918
- Auth.prototype.checkActionCode = function (code) {
723
+ }
724
+ checkActionCode(code) {
919
725
  return exp__namespace.checkActionCode(this._delegate, code);
920
- };
921
- Auth.prototype.confirmPasswordReset = function (code, newPassword) {
726
+ }
727
+ confirmPasswordReset(code, newPassword) {
922
728
  return exp__namespace.confirmPasswordReset(this._delegate, code, newPassword);
923
- };
924
- Auth.prototype.createUserWithEmailAndPassword = function (email, password) {
925
- return tslib.__awaiter(this, void 0, void 0, function () {
926
- return tslib.__generator(this, function (_a) {
927
- return [2 /*return*/, convertCredential(this._delegate, exp__namespace.createUserWithEmailAndPassword(this._delegate, email, password))];
928
- });
929
- });
930
- };
931
- Auth.prototype.fetchProvidersForEmail = function (email) {
729
+ }
730
+ async createUserWithEmailAndPassword(email, password) {
731
+ return convertCredential(this._delegate, exp__namespace.createUserWithEmailAndPassword(this._delegate, email, password));
732
+ }
733
+ fetchProvidersForEmail(email) {
932
734
  return this.fetchSignInMethodsForEmail(email);
933
- };
934
- Auth.prototype.fetchSignInMethodsForEmail = function (email) {
735
+ }
736
+ fetchSignInMethodsForEmail(email) {
935
737
  return exp__namespace.fetchSignInMethodsForEmail(this._delegate, email);
936
- };
937
- Auth.prototype.isSignInWithEmailLink = function (emailLink) {
738
+ }
739
+ isSignInWithEmailLink(emailLink) {
938
740
  return exp__namespace.isSignInWithEmailLink(this._delegate, emailLink);
939
- };
940
- Auth.prototype.getRedirectResult = function () {
941
- return tslib.__awaiter(this, void 0, void 0, function () {
942
- var credential;
943
- return tslib.__generator(this, function (_a) {
944
- switch (_a.label) {
945
- case 0:
946
- _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
947
- return [4 /*yield*/, exp__namespace.getRedirectResult(this._delegate, CompatPopupRedirectResolver)];
948
- case 1:
949
- credential = _a.sent();
950
- if (!credential) {
951
- return [2 /*return*/, {
952
- credential: null,
953
- user: null
954
- }];
955
- }
956
- return [2 /*return*/, convertCredential(this._delegate, Promise.resolve(credential))];
957
- }
958
- });
959
- });
960
- };
741
+ }
742
+ async getRedirectResult() {
743
+ _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
744
+ const credential = await exp__namespace.getRedirectResult(this._delegate, CompatPopupRedirectResolver);
745
+ if (!credential) {
746
+ return {
747
+ credential: null,
748
+ user: null
749
+ };
750
+ }
751
+ return convertCredential(this._delegate, Promise.resolve(credential));
752
+ }
961
753
  // This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage.
962
754
  // It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it
963
755
  // out of autogenerated documentation pages to reduce accidental misuse.
964
- Auth.prototype.addFrameworkForLogging = function (framework) {
756
+ addFrameworkForLogging(framework) {
965
757
  exp__namespace.addFrameworkForLogging(this._delegate, framework);
966
- };
967
- Auth.prototype.onAuthStateChanged = function (nextOrObserver, errorFn, completed) {
968
- var _a = wrapObservers(nextOrObserver, errorFn, completed), next = _a.next, error = _a.error, complete = _a.complete;
758
+ }
759
+ onAuthStateChanged(nextOrObserver, errorFn, completed) {
760
+ const { next, error, complete } = wrapObservers(nextOrObserver, errorFn, completed);
969
761
  return this._delegate.onAuthStateChanged(next, error, complete);
970
- };
971
- Auth.prototype.onIdTokenChanged = function (nextOrObserver, errorFn, completed) {
972
- var _a = wrapObservers(nextOrObserver, errorFn, completed), next = _a.next, error = _a.error, complete = _a.complete;
762
+ }
763
+ onIdTokenChanged(nextOrObserver, errorFn, completed) {
764
+ const { next, error, complete } = wrapObservers(nextOrObserver, errorFn, completed);
973
765
  return this._delegate.onIdTokenChanged(next, error, complete);
974
- };
975
- Auth.prototype.sendSignInLinkToEmail = function (email, actionCodeSettings) {
766
+ }
767
+ sendSignInLinkToEmail(email, actionCodeSettings) {
976
768
  return exp__namespace.sendSignInLinkToEmail(this._delegate, email, actionCodeSettings);
977
- };
978
- Auth.prototype.sendPasswordResetEmail = function (email, actionCodeSettings) {
769
+ }
770
+ sendPasswordResetEmail(email, actionCodeSettings) {
979
771
  return exp__namespace.sendPasswordResetEmail(this._delegate, email, actionCodeSettings || undefined);
980
- };
981
- Auth.prototype.setPersistence = function (persistence) {
982
- return tslib.__awaiter(this, void 0, void 0, function () {
983
- var converted, _a, isIndexedDBFullySupported;
984
- return tslib.__generator(this, function (_b) {
985
- switch (_b.label) {
986
- case 0:
987
- _validatePersistenceArgument(this._delegate, persistence);
988
- _a = persistence;
989
- switch (_a) {
990
- case Persistence.SESSION: return [3 /*break*/, 1];
991
- case Persistence.LOCAL: return [3 /*break*/, 2];
992
- case Persistence.NONE: return [3 /*break*/, 4];
993
- }
994
- return [3 /*break*/, 5];
995
- case 1:
996
- converted = exp__namespace.browserSessionPersistence;
997
- return [3 /*break*/, 6];
998
- case 2: return [4 /*yield*/, exp__namespace
999
- ._getInstance(exp__namespace.indexedDBLocalPersistence)
1000
- ._isAvailable()];
1001
- case 3:
1002
- isIndexedDBFullySupported = _b.sent();
1003
- converted = isIndexedDBFullySupported
1004
- ? exp__namespace.indexedDBLocalPersistence
1005
- : exp__namespace.browserLocalPersistence;
1006
- return [3 /*break*/, 6];
1007
- case 4:
1008
- converted = exp__namespace.inMemoryPersistence;
1009
- return [3 /*break*/, 6];
1010
- case 5: return [2 /*return*/, exp__namespace._fail("argument-error" /* exp.AuthErrorCode.ARGUMENT_ERROR */, {
1011
- appName: this._delegate.name
1012
- })];
1013
- case 6: return [2 /*return*/, this._delegate.setPersistence(converted)];
1014
- }
1015
- });
1016
- });
1017
- };
1018
- Auth.prototype.signInAndRetrieveDataWithCredential = function (credential) {
772
+ }
773
+ async setPersistence(persistence) {
774
+ _validatePersistenceArgument(this._delegate, persistence);
775
+ let converted;
776
+ switch (persistence) {
777
+ case Persistence.SESSION:
778
+ converted = exp__namespace.browserSessionPersistence;
779
+ break;
780
+ case Persistence.LOCAL:
781
+ // Not using isIndexedDBAvailable() since it only checks if indexedDB is defined.
782
+ const isIndexedDBFullySupported = await exp__namespace
783
+ ._getInstance(exp__namespace.indexedDBLocalPersistence)
784
+ ._isAvailable();
785
+ converted = isIndexedDBFullySupported
786
+ ? exp__namespace.indexedDBLocalPersistence
787
+ : exp__namespace.browserLocalPersistence;
788
+ break;
789
+ case Persistence.NONE:
790
+ converted = exp__namespace.inMemoryPersistence;
791
+ break;
792
+ default:
793
+ return exp__namespace._fail("argument-error" /* exp.AuthErrorCode.ARGUMENT_ERROR */, {
794
+ appName: this._delegate.name
795
+ });
796
+ }
797
+ return this._delegate.setPersistence(converted);
798
+ }
799
+ signInAndRetrieveDataWithCredential(credential) {
1019
800
  return this.signInWithCredential(credential);
1020
- };
1021
- Auth.prototype.signInAnonymously = function () {
801
+ }
802
+ signInAnonymously() {
1022
803
  return convertCredential(this._delegate, exp__namespace.signInAnonymously(this._delegate));
1023
- };
1024
- Auth.prototype.signInWithCredential = function (credential) {
804
+ }
805
+ signInWithCredential(credential) {
1025
806
  return convertCredential(this._delegate, exp__namespace.signInWithCredential(this._delegate, credential));
1026
- };
1027
- Auth.prototype.signInWithCustomToken = function (token) {
807
+ }
808
+ signInWithCustomToken(token) {
1028
809
  return convertCredential(this._delegate, exp__namespace.signInWithCustomToken(this._delegate, token));
1029
- };
1030
- Auth.prototype.signInWithEmailAndPassword = function (email, password) {
810
+ }
811
+ signInWithEmailAndPassword(email, password) {
1031
812
  return convertCredential(this._delegate, exp__namespace.signInWithEmailAndPassword(this._delegate, email, password));
1032
- };
1033
- Auth.prototype.signInWithEmailLink = function (email, emailLink) {
813
+ }
814
+ signInWithEmailLink(email, emailLink) {
1034
815
  return convertCredential(this._delegate, exp__namespace.signInWithEmailLink(this._delegate, email, emailLink));
1035
- };
1036
- Auth.prototype.signInWithPhoneNumber = function (phoneNumber, applicationVerifier) {
816
+ }
817
+ signInWithPhoneNumber(phoneNumber, applicationVerifier) {
1037
818
  return convertConfirmationResult(this._delegate, exp__namespace.signInWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
1038
- };
1039
- Auth.prototype.signInWithPopup = function (provider) {
1040
- return tslib.__awaiter(this, void 0, void 0, function () {
1041
- return tslib.__generator(this, function (_a) {
1042
- _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
1043
- return [2 /*return*/, convertCredential(this._delegate, exp__namespace.signInWithPopup(this._delegate, provider, CompatPopupRedirectResolver))];
1044
- });
1045
- });
1046
- };
1047
- Auth.prototype.signInWithRedirect = function (provider) {
1048
- return tslib.__awaiter(this, void 0, void 0, function () {
1049
- return tslib.__generator(this, function (_a) {
1050
- switch (_a.label) {
1051
- case 0:
1052
- _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
1053
- return [4 /*yield*/, _savePersistenceForRedirect(this._delegate)];
1054
- case 1:
1055
- _a.sent();
1056
- return [2 /*return*/, exp__namespace.signInWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
1057
- }
1058
- });
1059
- });
1060
- };
1061
- Auth.prototype.updateCurrentUser = function (user) {
819
+ }
820
+ async signInWithPopup(provider) {
821
+ _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
822
+ return convertCredential(this._delegate, exp__namespace.signInWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
823
+ }
824
+ async signInWithRedirect(provider) {
825
+ _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
826
+ await _savePersistenceForRedirect(this._delegate);
827
+ return exp__namespace.signInWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
828
+ }
829
+ updateCurrentUser(user) {
1062
830
  // remove ts-ignore once overloads are defined for exp functions to accept compat objects
1063
831
  // @ts-ignore
1064
832
  return this._delegate.updateCurrentUser(user);
1065
- };
1066
- Auth.prototype.verifyPasswordResetCode = function (code) {
833
+ }
834
+ verifyPasswordResetCode(code) {
1067
835
  return exp__namespace.verifyPasswordResetCode(this._delegate, code);
1068
- };
1069
- Auth.prototype.unwrap = function () {
836
+ }
837
+ unwrap() {
1070
838
  return this._delegate;
1071
- };
1072
- Auth.prototype._delete = function () {
839
+ }
840
+ _delete() {
1073
841
  return this._delegate._delete();
1074
- };
1075
- Auth.prototype.linkUnderlyingAuth = function () {
1076
- var _this = this;
1077
- this._delegate.wrapped = function () { return _this; };
1078
- };
1079
- Auth.Persistence = Persistence;
1080
- return Auth;
1081
- }());
842
+ }
843
+ linkUnderlyingAuth() {
844
+ this._delegate.wrapped = () => this;
845
+ }
846
+ }
847
+ Auth.Persistence = Persistence;
1082
848
  function wrapObservers(nextOrObserver, error, complete) {
1083
- var next = nextOrObserver;
849
+ let next = nextOrObserver;
1084
850
  if (typeof nextOrObserver !== 'function') {
1085
- (next = nextOrObserver.next, error = nextOrObserver.error, complete = nextOrObserver.complete);
851
+ ({ next, error, complete } = nextOrObserver);
1086
852
  }
1087
853
  // We know 'next' is now a function
1088
- var oldNext = next;
1089
- var newNext = function (user) {
1090
- return oldNext(user && User.getOrCreate(user));
1091
- };
854
+ const oldNext = next;
855
+ const newNext = (user) => oldNext(user && User.getOrCreate(user));
1092
856
  return {
1093
857
  next: newNext,
1094
858
  error: error,
1095
- complete: complete
859
+ complete
1096
860
  };
1097
861
  }
1098
862
  function buildPersistenceHierarchy(apiKey, appName) {
@@ -1100,7 +864,7 @@ function buildPersistenceHierarchy(apiKey, appName) {
1100
864
  // persistence is checked *first* rather than last. This is because we want
1101
865
  // to prefer stored persistence type in the hierarchy. This is an empty
1102
866
  // array if window is not available or there is no pending redirect
1103
- var persistences = _getPersistencesFromRedirect(apiKey, appName);
867
+ const persistences = _getPersistencesFromRedirect(apiKey, appName);
1104
868
  // If "self" is available, add indexedDB
1105
869
  if (typeof self !== 'undefined' &&
1106
870
  !persistences.includes(exp__namespace.indexedDBLocalPersistence)) {
@@ -1108,11 +872,10 @@ function buildPersistenceHierarchy(apiKey, appName) {
1108
872
  }
1109
873
  // If "window" is available, add HTML Storage persistences
1110
874
  if (typeof window !== 'undefined') {
1111
- for (var _i = 0, _a = [
875
+ for (const persistence of [
1112
876
  exp__namespace.browserLocalPersistence,
1113
877
  exp__namespace.browserSessionPersistence
1114
- ]; _i < _a.length; _i++) {
1115
- var persistence = _a[_i];
878
+ ]) {
1116
879
  if (!persistences.includes(persistence)) {
1117
880
  persistences.push(persistence);
1118
881
  }
@@ -1141,29 +904,28 @@ function buildPersistenceHierarchy(apiKey, appName) {
1141
904
  * See the License for the specific language governing permissions and
1142
905
  * limitations under the License.
1143
906
  */
1144
- var PhoneAuthProvider = /** @class */ (function () {
1145
- function PhoneAuthProvider() {
907
+ class PhoneAuthProvider {
908
+ constructor() {
1146
909
  this.providerId = 'phone';
1147
910
  // TODO: remove ts-ignore when moving types from auth-types to auth-compat
1148
911
  // @ts-ignore
1149
912
  this._delegate = new exp__namespace.PhoneAuthProvider(unwrap(firebase__default["default"].auth()));
1150
913
  }
1151
- PhoneAuthProvider.credential = function (verificationId, verificationCode) {
914
+ static credential(verificationId, verificationCode) {
1152
915
  return exp__namespace.PhoneAuthProvider.credential(verificationId, verificationCode);
1153
- };
1154
- PhoneAuthProvider.prototype.verifyPhoneNumber = function (phoneInfoOptions, applicationVerifier) {
916
+ }
917
+ verifyPhoneNumber(phoneInfoOptions, applicationVerifier) {
1155
918
  return this._delegate.verifyPhoneNumber(
1156
919
  // The implementation matches but the types are subtly incompatible
1157
920
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1158
921
  phoneInfoOptions, applicationVerifier);
1159
- };
1160
- PhoneAuthProvider.prototype.unwrap = function () {
922
+ }
923
+ unwrap() {
1161
924
  return this._delegate;
1162
- };
1163
- PhoneAuthProvider.PHONE_SIGN_IN_METHOD = exp__namespace.PhoneAuthProvider.PHONE_SIGN_IN_METHOD;
1164
- PhoneAuthProvider.PROVIDER_ID = exp__namespace.PhoneAuthProvider.PROVIDER_ID;
1165
- return PhoneAuthProvider;
1166
- }());
925
+ }
926
+ }
927
+ PhoneAuthProvider.PHONE_SIGN_IN_METHOD = exp__namespace.PhoneAuthProvider.PHONE_SIGN_IN_METHOD;
928
+ PhoneAuthProvider.PROVIDER_ID = exp__namespace.PhoneAuthProvider.PROVIDER_ID;
1167
929
 
1168
930
  /**
1169
931
  * @license
@@ -1181,10 +943,9 @@ var PhoneAuthProvider = /** @class */ (function () {
1181
943
  * See the License for the specific language governing permissions and
1182
944
  * limitations under the License.
1183
945
  */
1184
- var _assert = exp__namespace._assert;
1185
- var RecaptchaVerifier = /** @class */ (function () {
1186
- function RecaptchaVerifier(container, parameters, app) {
1187
- if (app === void 0) { app = firebase__default["default"].app(); }
946
+ const _assert = exp__namespace._assert;
947
+ class RecaptchaVerifier {
948
+ constructor(container, parameters, app = firebase__default["default"].app()) {
1188
949
  var _a;
1189
950
  // API key is required for web client RPC calls.
1190
951
  _assert((_a = app.options) === null || _a === void 0 ? void 0 : _a.apiKey, "invalid-api-key" /* exp.AuthErrorCode.INVALID_API_KEY */, {
@@ -1198,17 +959,16 @@ var RecaptchaVerifier = /** @class */ (function () {
1198
959
  parameters);
1199
960
  this.type = this._delegate.type;
1200
961
  }
1201
- RecaptchaVerifier.prototype.clear = function () {
962
+ clear() {
1202
963
  this._delegate.clear();
1203
- };
1204
- RecaptchaVerifier.prototype.render = function () {
964
+ }
965
+ render() {
1205
966
  return this._delegate.render();
1206
- };
1207
- RecaptchaVerifier.prototype.verify = function () {
967
+ }
968
+ verify() {
1208
969
  return this._delegate.verify();
1209
- };
1210
- return RecaptchaVerifier;
1211
- }());
970
+ }
971
+ }
1212
972
 
1213
973
  /**
1214
974
  * @license
@@ -1226,14 +986,14 @@ var RecaptchaVerifier = /** @class */ (function () {
1226
986
  * See the License for the specific language governing permissions and
1227
987
  * limitations under the License.
1228
988
  */
1229
- var AUTH_TYPE = 'auth-compat';
989
+ const AUTH_TYPE = 'auth-compat';
1230
990
  // Create auth components to register with firebase.
1231
991
  // Provides Auth public APIs.
1232
992
  function registerAuthCompat(instance) {
1233
- instance.INTERNAL.registerComponent(new component.Component(AUTH_TYPE, function (container) {
993
+ instance.INTERNAL.registerComponent(new component.Component(AUTH_TYPE, container => {
1234
994
  // getImmediate for FirebaseApp will always succeed
1235
- var app = container.getProvider('app-compat').getImmediate();
1236
- var authProvider = container.getProvider('auth');
995
+ const app = container.getProvider('app-compat').getImmediate();
996
+ const authProvider = container.getProvider('auth');
1237
997
  return new Auth(app, authProvider);
1238
998
  }, "PUBLIC" /* ComponentType.PUBLIC */)
1239
999
  .setServiceProps({
@@ -1257,7 +1017,7 @@ function registerAuthCompat(instance) {
1257
1017
  PhoneMultiFactorGenerator: exp__namespace.PhoneMultiFactorGenerator,
1258
1018
  RecaptchaVerifier: RecaptchaVerifier,
1259
1019
  TwitterAuthProvider: exp__namespace.TwitterAuthProvider,
1260
- Auth: Auth,
1020
+ Auth,
1261
1021
  AuthCredential: exp__namespace.AuthCredential,
1262
1022
  Error: util.FirebaseError
1263
1023
  })
@@ -1283,5 +1043,5 @@ registerAuthCompat(firebase__default["default"]);
1283
1043
  * See the License for the specific language governing permissions and
1284
1044
  * limitations under the License.
1285
1045
  */
1286
- exp.FetchProvider.initialize(undici.fetch, undici.Headers, undici.Response);
1046
+ exp.FetchProvider.initialize(fetch, Headers, Response);
1287
1047
  //# sourceMappingURL=index.node.cjs.js.map