@depup/firebase__auth-compat 0.6.3-depup.0

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 (56) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/auth-compat/index.d.ts +112 -0
  4. package/dist/auth-compat/index.node.d.ts +24 -0
  5. package/dist/auth-compat/scripts/run_node_tests.d.ts +17 -0
  6. package/dist/auth-compat/src/auth.d.ts +72 -0
  7. package/dist/auth-compat/src/auth.test.d.ts +17 -0
  8. package/dist/auth-compat/src/persistence.d.ts +29 -0
  9. package/dist/auth-compat/src/phone_auth_provider.d.ts +29 -0
  10. package/dist/auth-compat/src/platform.d.ts +39 -0
  11. package/dist/auth-compat/src/popup_redirect.d.ts +34 -0
  12. package/dist/auth-compat/src/popup_redirect.test.d.ts +17 -0
  13. package/dist/auth-compat/src/recaptcha_verifier.d.ts +28 -0
  14. package/dist/auth-compat/src/user.d.ts +64 -0
  15. package/dist/auth-compat/src/user_credential.d.ts +20 -0
  16. package/dist/auth-compat/src/wrap.d.ts +26 -0
  17. package/dist/auth-compat/test/helpers/helpers.d.ts +24 -0
  18. package/dist/auth-compat/test/integration/flows/anonymous.test.d.ts +17 -0
  19. package/dist/auth-compat/test/integration/flows/custom.test.d.ts +17 -0
  20. package/dist/auth-compat/test/integration/flows/email.test.d.ts +17 -0
  21. package/dist/auth-compat/test/integration/flows/idp.test.d.ts +17 -0
  22. package/dist/auth-compat/test/integration/flows/oob.test.d.ts +17 -0
  23. package/dist/auth-compat/test/integration/flows/phone.test.d.ts +17 -0
  24. package/dist/esm/auth-compat/index.d.ts +50 -0
  25. package/dist/esm/auth-compat/index.node.d.ts +24 -0
  26. package/dist/esm/auth-compat/scripts/run_node_tests.d.ts +17 -0
  27. package/dist/esm/auth-compat/src/auth.d.ts +72 -0
  28. package/dist/esm/auth-compat/src/auth.test.d.ts +17 -0
  29. package/dist/esm/auth-compat/src/persistence.d.ts +29 -0
  30. package/dist/esm/auth-compat/src/phone_auth_provider.d.ts +29 -0
  31. package/dist/esm/auth-compat/src/platform.d.ts +39 -0
  32. package/dist/esm/auth-compat/src/popup_redirect.d.ts +34 -0
  33. package/dist/esm/auth-compat/src/popup_redirect.test.d.ts +17 -0
  34. package/dist/esm/auth-compat/src/recaptcha_verifier.d.ts +28 -0
  35. package/dist/esm/auth-compat/src/user.d.ts +64 -0
  36. package/dist/esm/auth-compat/src/user_credential.d.ts +20 -0
  37. package/dist/esm/auth-compat/src/wrap.d.ts +26 -0
  38. package/dist/esm/auth-compat/test/helpers/helpers.d.ts +24 -0
  39. package/dist/esm/auth-compat/test/integration/flows/anonymous.test.d.ts +17 -0
  40. package/dist/esm/auth-compat/test/integration/flows/custom.test.d.ts +17 -0
  41. package/dist/esm/auth-compat/test/integration/flows/email.test.d.ts +17 -0
  42. package/dist/esm/auth-compat/test/integration/flows/idp.test.d.ts +17 -0
  43. package/dist/esm/auth-compat/test/integration/flows/oob.test.d.ts +17 -0
  44. package/dist/esm/auth-compat/test/integration/flows/phone.test.d.ts +17 -0
  45. package/dist/esm/index.node.esm.js +1020 -0
  46. package/dist/esm/index.node.esm.js.map +1 -0
  47. package/dist/esm/package.json +1 -0
  48. package/dist/firebase-auth.js +15 -0
  49. package/dist/firebase-auth.js.map +1 -0
  50. package/dist/index.cjs.js +1026 -0
  51. package/dist/index.cjs.js.map +1 -0
  52. package/dist/index.esm.js +1001 -0
  53. package/dist/index.esm.js.map +1 -0
  54. package/dist/index.node.cjs.js +1044 -0
  55. package/dist/index.node.cjs.js.map +1 -0
  56. package/package.json +107 -0
@@ -0,0 +1,1044 @@
1
+ 'use strict';
2
+
3
+ var firebase = require('@firebase/app-compat');
4
+ var exp = require('@firebase/auth/internal');
5
+ var component = require('@firebase/component');
6
+ var util = require('@firebase/util');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n["default"] = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
29
+ var exp__namespace = /*#__PURE__*/_interopNamespace(exp);
30
+
31
+ var name = "@firebase/auth-compat";
32
+ var version = "0.6.3";
33
+
34
+ /**
35
+ * @license
36
+ * Copyright 2020 Google LLC
37
+ *
38
+ * Licensed under the Apache License, Version 2.0 (the "License");
39
+ * you may not use this file except in compliance with the License.
40
+ * You may obtain a copy of the License at
41
+ *
42
+ * http://www.apache.org/licenses/LICENSE-2.0
43
+ *
44
+ * Unless required by applicable law or agreed to in writing, software
45
+ * distributed under the License is distributed on an "AS IS" BASIS,
46
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47
+ * See the License for the specific language governing permissions and
48
+ * limitations under the License.
49
+ */
50
+ const CORDOVA_ONDEVICEREADY_TIMEOUT_MS = 1000;
51
+ function _getCurrentScheme() {
52
+ return self?.location?.protocol || null;
53
+ }
54
+ /**
55
+ * @return {boolean} Whether the current environment is http or https.
56
+ */
57
+ function _isHttpOrHttps() {
58
+ return _getCurrentScheme() === 'http:' || _getCurrentScheme() === 'https:';
59
+ }
60
+ /**
61
+ * @param {?string=} ua The user agent.
62
+ * @return {boolean} Whether the app is rendered in a mobile iOS or Android
63
+ * Cordova environment.
64
+ */
65
+ function _isAndroidOrIosCordovaScheme(ua = util.getUA()) {
66
+ return !!((_getCurrentScheme() === 'file:' ||
67
+ _getCurrentScheme() === 'ionic:' ||
68
+ _getCurrentScheme() === 'capacitor:') &&
69
+ ua.toLowerCase().match(/iphone|ipad|ipod|android/));
70
+ }
71
+ /**
72
+ * @return {boolean} Whether the environment is a native environment, where
73
+ * CORS checks do not apply.
74
+ */
75
+ function _isNativeEnvironment() {
76
+ return util.isReactNative() || util.isNode();
77
+ }
78
+ /**
79
+ * Checks whether the user agent is IE11.
80
+ * @return {boolean} True if it is IE11.
81
+ */
82
+ function _isIe11() {
83
+ return util.isIE() && document?.documentMode === 11;
84
+ }
85
+ /**
86
+ * Checks whether the user agent is Edge.
87
+ * @param {string} userAgent The browser user agent string.
88
+ * @return {boolean} True if it is Edge.
89
+ */
90
+ function _isEdge(ua = util.getUA()) {
91
+ return /Edge\/\d+/.test(ua);
92
+ }
93
+ /**
94
+ * @param {?string=} opt_userAgent The navigator user agent.
95
+ * @return {boolean} Whether local storage is not synchronized between an iframe
96
+ * and a popup of the same domain.
97
+ */
98
+ function _isLocalStorageNotSynchronized(ua = util.getUA()) {
99
+ return _isIe11() || _isEdge(ua);
100
+ }
101
+ /** @return {boolean} Whether web storage is supported. */
102
+ function _isWebStorageSupported() {
103
+ try {
104
+ const storage = self.localStorage;
105
+ const key = exp__namespace._generateEventId();
106
+ if (storage) {
107
+ // setItem will throw an exception if we cannot access WebStorage (e.g.,
108
+ // Safari in private mode).
109
+ storage['setItem'](key, '1');
110
+ storage['removeItem'](key);
111
+ // For browsers where iframe web storage does not synchronize with a popup
112
+ // of the same domain, indexedDB is used for persistent storage. These
113
+ // browsers include IE11 and Edge.
114
+ // Make sure it is supported (IE11 and Edge private mode does not support
115
+ // that).
116
+ if (_isLocalStorageNotSynchronized()) {
117
+ // In such browsers, if indexedDB is not supported, an iframe cannot be
118
+ // notified of the popup sign in result.
119
+ return util.isIndexedDBAvailable();
120
+ }
121
+ return true;
122
+ }
123
+ }
124
+ catch (e) {
125
+ // localStorage is not available from a worker. Test availability of
126
+ // indexedDB.
127
+ return _isWorker() && util.isIndexedDBAvailable();
128
+ }
129
+ return false;
130
+ }
131
+ /**
132
+ * @param {?Object=} global The optional global scope.
133
+ * @return {boolean} Whether current environment is a worker.
134
+ */
135
+ function _isWorker() {
136
+ // WorkerGlobalScope only defined in worker environment.
137
+ return (typeof global !== 'undefined' &&
138
+ 'WorkerGlobalScope' in global &&
139
+ 'importScripts' in global);
140
+ }
141
+ function _isPopupRedirectSupported() {
142
+ return ((_isHttpOrHttps() ||
143
+ util.isBrowserExtension() ||
144
+ _isAndroidOrIosCordovaScheme()) &&
145
+ // React Native with remote debugging reports its location.protocol as
146
+ // http.
147
+ !_isNativeEnvironment() &&
148
+ // Local storage has to be supported for browser popup and redirect
149
+ // operations to work.
150
+ _isWebStorageSupported() &&
151
+ // DOM, popups and redirects are not supported within a worker.
152
+ !_isWorker());
153
+ }
154
+ /** Quick check that indicates the platform *may* be Cordova */
155
+ function _isLikelyCordova() {
156
+ return _isAndroidOrIosCordovaScheme() && typeof document !== 'undefined';
157
+ }
158
+ async function _isCordova() {
159
+ if (!_isLikelyCordova()) {
160
+ return false;
161
+ }
162
+ return new Promise(resolve => {
163
+ const timeoutId = setTimeout(() => {
164
+ // We've waited long enough; the telltale Cordova event didn't happen
165
+ resolve(false);
166
+ }, CORDOVA_ONDEVICEREADY_TIMEOUT_MS);
167
+ document.addEventListener('deviceready', () => {
168
+ clearTimeout(timeoutId);
169
+ resolve(true);
170
+ });
171
+ });
172
+ }
173
+ function _getSelfWindow() {
174
+ return typeof window !== 'undefined' ? window : null;
175
+ }
176
+
177
+ /**
178
+ * @license
179
+ * Copyright 2020 Google LLC
180
+ *
181
+ * Licensed under the Apache License, Version 2.0 (the "License");
182
+ * you may not use this file except in compliance with the License.
183
+ * You may obtain a copy of the License at
184
+ *
185
+ * http://www.apache.org/licenses/LICENSE-2.0
186
+ *
187
+ * Unless required by applicable law or agreed to in writing, software
188
+ * distributed under the License is distributed on an "AS IS" BASIS,
189
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ * See the License for the specific language governing permissions and
191
+ * limitations under the License.
192
+ */
193
+ const Persistence = {
194
+ LOCAL: 'local',
195
+ NONE: 'none',
196
+ SESSION: 'session'
197
+ };
198
+ const _assert$3 = exp__namespace._assert;
199
+ const PERSISTENCE_KEY = 'persistence';
200
+ /**
201
+ * Validates that an argument is a valid persistence value. If an invalid type
202
+ * is specified, an error is thrown synchronously.
203
+ */
204
+ function _validatePersistenceArgument(auth, persistence) {
205
+ _assert$3(Object.values(Persistence).includes(persistence), auth, "invalid-persistence-type" /* exp.AuthErrorCode.INVALID_PERSISTENCE */);
206
+ // Validate if the specified type is supported in the current environment.
207
+ if (util.isReactNative()) {
208
+ // This is only supported in a browser.
209
+ _assert$3(persistence !== Persistence.SESSION, auth, "unsupported-persistence-type" /* exp.AuthErrorCode.UNSUPPORTED_PERSISTENCE */);
210
+ return;
211
+ }
212
+ if (util.isNode()) {
213
+ // Only none is supported in Node.js.
214
+ _assert$3(persistence === Persistence.NONE, auth, "unsupported-persistence-type" /* exp.AuthErrorCode.UNSUPPORTED_PERSISTENCE */);
215
+ return;
216
+ }
217
+ if (_isWorker()) {
218
+ // In a worker environment, either LOCAL or NONE are supported.
219
+ // If indexedDB not supported and LOCAL provided, throw an error
220
+ _assert$3(persistence === Persistence.NONE ||
221
+ (persistence === Persistence.LOCAL && util.isIndexedDBAvailable()), auth, "unsupported-persistence-type" /* exp.AuthErrorCode.UNSUPPORTED_PERSISTENCE */);
222
+ return;
223
+ }
224
+ // This is restricted by what the browser supports.
225
+ _assert$3(persistence === Persistence.NONE || _isWebStorageSupported(), auth, "unsupported-persistence-type" /* exp.AuthErrorCode.UNSUPPORTED_PERSISTENCE */);
226
+ }
227
+ async function _savePersistenceForRedirect(auth) {
228
+ await auth._initializationPromise;
229
+ const session = getSessionStorageIfAvailable();
230
+ const key = exp__namespace._persistenceKeyName(PERSISTENCE_KEY, auth.config.apiKey, auth.name);
231
+ if (session) {
232
+ session.setItem(key, auth._getPersistenceType());
233
+ }
234
+ }
235
+ function _getPersistencesFromRedirect(apiKey, appName) {
236
+ const session = getSessionStorageIfAvailable();
237
+ if (!session) {
238
+ return [];
239
+ }
240
+ const key = exp__namespace._persistenceKeyName(PERSISTENCE_KEY, apiKey, appName);
241
+ const persistence = session.getItem(key);
242
+ switch (persistence) {
243
+ case Persistence.NONE:
244
+ return [exp__namespace.inMemoryPersistence];
245
+ case Persistence.LOCAL:
246
+ return [exp__namespace.indexedDBLocalPersistence, exp__namespace.browserSessionPersistence];
247
+ case Persistence.SESSION:
248
+ return [exp__namespace.browserSessionPersistence];
249
+ default:
250
+ return [];
251
+ }
252
+ }
253
+ /** Returns session storage, or null if the property access errors */
254
+ function getSessionStorageIfAvailable() {
255
+ try {
256
+ return _getSelfWindow()?.sessionStorage || null;
257
+ }
258
+ catch (e) {
259
+ return null;
260
+ }
261
+ }
262
+
263
+ /**
264
+ * @license
265
+ * Copyright 2020 Google LLC
266
+ *
267
+ * Licensed under the Apache License, Version 2.0 (the "License");
268
+ * you may not use this file except in compliance with the License.
269
+ * You may obtain a copy of the License at
270
+ *
271
+ * http://www.apache.org/licenses/LICENSE-2.0
272
+ *
273
+ * Unless required by applicable law or agreed to in writing, software
274
+ * distributed under the License is distributed on an "AS IS" BASIS,
275
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
276
+ * See the License for the specific language governing permissions and
277
+ * limitations under the License.
278
+ */
279
+ const _assert$2 = exp__namespace._assert;
280
+ /** Platform-agnostic popup-redirect resolver */
281
+ class CompatPopupRedirectResolver {
282
+ constructor() {
283
+ // Create both resolvers for dynamic resolution later
284
+ this.browserResolver = exp__namespace._getInstance(exp__namespace.browserPopupRedirectResolver);
285
+ this.cordovaResolver = exp__namespace._getInstance(exp__namespace.cordovaPopupRedirectResolver);
286
+ // The actual resolver in use: either browserResolver or cordovaResolver.
287
+ this.underlyingResolver = null;
288
+ this._redirectPersistence = exp__namespace.browserSessionPersistence;
289
+ this._completeRedirectFn = exp__namespace._getRedirectResult;
290
+ this._overrideRedirectResult = exp__namespace._overrideRedirectResult;
291
+ }
292
+ async _initialize(auth) {
293
+ await this.selectUnderlyingResolver();
294
+ return this.assertedUnderlyingResolver._initialize(auth);
295
+ }
296
+ async _openPopup(auth, provider, authType, eventId) {
297
+ await this.selectUnderlyingResolver();
298
+ return this.assertedUnderlyingResolver._openPopup(auth, provider, authType, eventId);
299
+ }
300
+ async _openRedirect(auth, provider, authType, eventId) {
301
+ await this.selectUnderlyingResolver();
302
+ return this.assertedUnderlyingResolver._openRedirect(auth, provider, authType, eventId);
303
+ }
304
+ _isIframeWebStorageSupported(auth, cb) {
305
+ this.assertedUnderlyingResolver._isIframeWebStorageSupported(auth, cb);
306
+ }
307
+ _originValidation(auth) {
308
+ return this.assertedUnderlyingResolver._originValidation(auth);
309
+ }
310
+ get _shouldInitProactively() {
311
+ return _isLikelyCordova() || this.browserResolver._shouldInitProactively;
312
+ }
313
+ get assertedUnderlyingResolver() {
314
+ _assert$2(this.underlyingResolver, "internal-error" /* exp.AuthErrorCode.INTERNAL_ERROR */);
315
+ return this.underlyingResolver;
316
+ }
317
+ async selectUnderlyingResolver() {
318
+ if (this.underlyingResolver) {
319
+ return;
320
+ }
321
+ // We haven't yet determined whether or not we're in Cordova; go ahead
322
+ // and determine that state now.
323
+ const isCordova = await _isCordova();
324
+ this.underlyingResolver = isCordova
325
+ ? this.cordovaResolver
326
+ : this.browserResolver;
327
+ }
328
+ }
329
+
330
+ /**
331
+ * @license
332
+ * Copyright 2020 Google LLC
333
+ *
334
+ * Licensed under the Apache License, Version 2.0 (the "License");
335
+ * you may not use this file except in compliance with the License.
336
+ * You may obtain a copy of the License at
337
+ *
338
+ * http://www.apache.org/licenses/LICENSE-2.0
339
+ *
340
+ * Unless required by applicable law or agreed to in writing, software
341
+ * distributed under the License is distributed on an "AS IS" BASIS,
342
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
343
+ * See the License for the specific language governing permissions and
344
+ * limitations under the License.
345
+ */
346
+ function unwrap(object) {
347
+ return object.unwrap();
348
+ }
349
+ function wrapped(object) {
350
+ return object.wrapped();
351
+ }
352
+
353
+ /**
354
+ * @license
355
+ * Copyright 2020 Google LLC
356
+ *
357
+ * Licensed under the Apache License, Version 2.0 (the "License");
358
+ * you may not use this file except in compliance with the License.
359
+ * You may obtain a copy of the License at
360
+ *
361
+ * http://www.apache.org/licenses/LICENSE-2.0
362
+ *
363
+ * Unless required by applicable law or agreed to in writing, software
364
+ * distributed under the License is distributed on an "AS IS" BASIS,
365
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
366
+ * See the License for the specific language governing permissions and
367
+ * limitations under the License.
368
+ */
369
+ function credentialFromResponse(userCredential) {
370
+ return credentialFromObject(userCredential);
371
+ }
372
+ function attachExtraErrorFields(auth, e) {
373
+ // The response contains all fields from the server which may or may not
374
+ // actually match the underlying type
375
+ const response = e.customData
376
+ ?._tokenResponse;
377
+ if (e?.code === 'auth/multi-factor-auth-required') {
378
+ const mfaErr = e;
379
+ mfaErr.resolver = new MultiFactorResolver(auth, exp__namespace.getMultiFactorResolver(auth, e));
380
+ }
381
+ else if (response) {
382
+ const credential = credentialFromObject(e);
383
+ const credErr = e;
384
+ if (credential) {
385
+ credErr.credential = credential;
386
+ credErr.tenantId = response.tenantId || undefined;
387
+ credErr.email = response.email || undefined;
388
+ credErr.phoneNumber = response.phoneNumber || undefined;
389
+ }
390
+ }
391
+ }
392
+ function credentialFromObject(object) {
393
+ const { _tokenResponse } = (object instanceof util.FirebaseError ? object.customData : object);
394
+ if (!_tokenResponse) {
395
+ return null;
396
+ }
397
+ // Handle phone Auth credential responses, as they have a different format
398
+ // from other backend responses (i.e. no providerId). This is also only the
399
+ // case for user credentials (does not work for errors).
400
+ if (!(object instanceof util.FirebaseError)) {
401
+ if ('temporaryProof' in _tokenResponse && 'phoneNumber' in _tokenResponse) {
402
+ return exp__namespace.PhoneAuthProvider.credentialFromResult(object);
403
+ }
404
+ }
405
+ const providerId = _tokenResponse.providerId;
406
+ // Email and password is not supported as there is no situation where the
407
+ // server would return the password to the client.
408
+ if (!providerId || providerId === exp__namespace.ProviderId.PASSWORD) {
409
+ return null;
410
+ }
411
+ let provider;
412
+ switch (providerId) {
413
+ case exp__namespace.ProviderId.GOOGLE:
414
+ provider = exp__namespace.GoogleAuthProvider;
415
+ break;
416
+ case exp__namespace.ProviderId.FACEBOOK:
417
+ provider = exp__namespace.FacebookAuthProvider;
418
+ break;
419
+ case exp__namespace.ProviderId.GITHUB:
420
+ provider = exp__namespace.GithubAuthProvider;
421
+ break;
422
+ case exp__namespace.ProviderId.TWITTER:
423
+ provider = exp__namespace.TwitterAuthProvider;
424
+ break;
425
+ default:
426
+ const { oauthIdToken, oauthAccessToken, oauthTokenSecret, pendingToken, nonce } = _tokenResponse;
427
+ if (!oauthAccessToken &&
428
+ !oauthTokenSecret &&
429
+ !oauthIdToken &&
430
+ !pendingToken) {
431
+ return null;
432
+ }
433
+ // TODO(avolkovi): uncomment this and get it working with SAML & OIDC
434
+ if (pendingToken) {
435
+ if (providerId.startsWith('saml.')) {
436
+ return exp__namespace.SAMLAuthCredential._create(providerId, pendingToken);
437
+ }
438
+ else {
439
+ // OIDC and non-default providers excluding Twitter.
440
+ return exp__namespace.OAuthCredential._fromParams({
441
+ providerId,
442
+ signInMethod: providerId,
443
+ pendingToken,
444
+ idToken: oauthIdToken,
445
+ accessToken: oauthAccessToken
446
+ });
447
+ }
448
+ }
449
+ return new exp__namespace.OAuthProvider(providerId).credential({
450
+ idToken: oauthIdToken,
451
+ accessToken: oauthAccessToken,
452
+ rawNonce: nonce
453
+ });
454
+ }
455
+ return object instanceof util.FirebaseError
456
+ ? provider.credentialFromError(object)
457
+ : provider.credentialFromResult(object);
458
+ }
459
+ function convertCredential(auth, credentialPromise) {
460
+ return credentialPromise
461
+ .catch(e => {
462
+ if (e instanceof util.FirebaseError) {
463
+ attachExtraErrorFields(auth, e);
464
+ }
465
+ throw e;
466
+ })
467
+ .then(credential => {
468
+ const operationType = credential.operationType;
469
+ const user = credential.user;
470
+ return {
471
+ operationType,
472
+ credential: credentialFromResponse(credential),
473
+ additionalUserInfo: exp__namespace.getAdditionalUserInfo(credential),
474
+ user: User.getOrCreate(user)
475
+ };
476
+ });
477
+ }
478
+ async function convertConfirmationResult(auth, confirmationResultPromise) {
479
+ const confirmationResultExp = await confirmationResultPromise;
480
+ return {
481
+ verificationId: confirmationResultExp.verificationId,
482
+ confirm: (verificationCode) => convertCredential(auth, confirmationResultExp.confirm(verificationCode))
483
+ };
484
+ }
485
+ class MultiFactorResolver {
486
+ constructor(auth, resolver) {
487
+ this.resolver = resolver;
488
+ this.auth = wrapped(auth);
489
+ }
490
+ get session() {
491
+ return this.resolver.session;
492
+ }
493
+ get hints() {
494
+ return this.resolver.hints;
495
+ }
496
+ resolveSignIn(assertion) {
497
+ return convertCredential(unwrap(this.auth), this.resolver.resolveSignIn(assertion));
498
+ }
499
+ }
500
+
501
+ /**
502
+ * @license
503
+ * Copyright 2020 Google LLC
504
+ *
505
+ * Licensed under the Apache License, Version 2.0 (the "License");
506
+ * you may not use this file except in compliance with the License.
507
+ * You may obtain a copy of the License at
508
+ *
509
+ * http://www.apache.org/licenses/LICENSE-2.0
510
+ *
511
+ * Unless required by applicable law or agreed to in writing, software
512
+ * distributed under the License is distributed on an "AS IS" BASIS,
513
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
514
+ * See the License for the specific language governing permissions and
515
+ * limitations under the License.
516
+ */
517
+ class User {
518
+ constructor(_delegate) {
519
+ this._delegate = _delegate;
520
+ this.multiFactor = exp__namespace.multiFactor(_delegate);
521
+ }
522
+ static getOrCreate(user) {
523
+ if (!User.USER_MAP.has(user)) {
524
+ User.USER_MAP.set(user, new User(user));
525
+ }
526
+ return User.USER_MAP.get(user);
527
+ }
528
+ delete() {
529
+ return this._delegate.delete();
530
+ }
531
+ reload() {
532
+ return this._delegate.reload();
533
+ }
534
+ toJSON() {
535
+ return this._delegate.toJSON();
536
+ }
537
+ getIdTokenResult(forceRefresh) {
538
+ return this._delegate.getIdTokenResult(forceRefresh);
539
+ }
540
+ getIdToken(forceRefresh) {
541
+ return this._delegate.getIdToken(forceRefresh);
542
+ }
543
+ linkAndRetrieveDataWithCredential(credential) {
544
+ return this.linkWithCredential(credential);
545
+ }
546
+ async linkWithCredential(credential) {
547
+ return convertCredential(this.auth, exp__namespace.linkWithCredential(this._delegate, credential));
548
+ }
549
+ async linkWithPhoneNumber(phoneNumber, applicationVerifier) {
550
+ return convertConfirmationResult(this.auth, exp__namespace.linkWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
551
+ }
552
+ async linkWithPopup(provider) {
553
+ return convertCredential(this.auth, exp__namespace.linkWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
554
+ }
555
+ async linkWithRedirect(provider) {
556
+ await _savePersistenceForRedirect(exp__namespace._castAuth(this.auth));
557
+ return exp__namespace.linkWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
558
+ }
559
+ reauthenticateAndRetrieveDataWithCredential(credential) {
560
+ return this.reauthenticateWithCredential(credential);
561
+ }
562
+ async reauthenticateWithCredential(credential) {
563
+ return convertCredential(this.auth, exp__namespace.reauthenticateWithCredential(this._delegate, credential));
564
+ }
565
+ reauthenticateWithPhoneNumber(phoneNumber, applicationVerifier) {
566
+ return convertConfirmationResult(this.auth, exp__namespace.reauthenticateWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
567
+ }
568
+ reauthenticateWithPopup(provider) {
569
+ return convertCredential(this.auth, exp__namespace.reauthenticateWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
570
+ }
571
+ async reauthenticateWithRedirect(provider) {
572
+ await _savePersistenceForRedirect(exp__namespace._castAuth(this.auth));
573
+ return exp__namespace.reauthenticateWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
574
+ }
575
+ sendEmailVerification(actionCodeSettings) {
576
+ return exp__namespace.sendEmailVerification(this._delegate, actionCodeSettings);
577
+ }
578
+ async unlink(providerId) {
579
+ await exp__namespace.unlink(this._delegate, providerId);
580
+ return this;
581
+ }
582
+ updateEmail(newEmail) {
583
+ return exp__namespace.updateEmail(this._delegate, newEmail);
584
+ }
585
+ updatePassword(newPassword) {
586
+ return exp__namespace.updatePassword(this._delegate, newPassword);
587
+ }
588
+ updatePhoneNumber(phoneCredential) {
589
+ return exp__namespace.updatePhoneNumber(this._delegate, phoneCredential);
590
+ }
591
+ updateProfile(profile) {
592
+ return exp__namespace.updateProfile(this._delegate, profile);
593
+ }
594
+ verifyBeforeUpdateEmail(newEmail, actionCodeSettings) {
595
+ return exp__namespace.verifyBeforeUpdateEmail(this._delegate, newEmail, actionCodeSettings);
596
+ }
597
+ get emailVerified() {
598
+ return this._delegate.emailVerified;
599
+ }
600
+ get isAnonymous() {
601
+ return this._delegate.isAnonymous;
602
+ }
603
+ get metadata() {
604
+ return this._delegate.metadata;
605
+ }
606
+ get phoneNumber() {
607
+ return this._delegate.phoneNumber;
608
+ }
609
+ get providerData() {
610
+ return this._delegate.providerData;
611
+ }
612
+ get refreshToken() {
613
+ return this._delegate.refreshToken;
614
+ }
615
+ get tenantId() {
616
+ return this._delegate.tenantId;
617
+ }
618
+ get displayName() {
619
+ return this._delegate.displayName;
620
+ }
621
+ get email() {
622
+ return this._delegate.email;
623
+ }
624
+ get photoURL() {
625
+ return this._delegate.photoURL;
626
+ }
627
+ get providerId() {
628
+ return this._delegate.providerId;
629
+ }
630
+ get uid() {
631
+ return this._delegate.uid;
632
+ }
633
+ get auth() {
634
+ return this._delegate.auth;
635
+ }
636
+ }
637
+ // Maintain a map so that there's always a 1:1 mapping between new User and
638
+ // legacy compat users
639
+ User.USER_MAP = new WeakMap();
640
+
641
+ /**
642
+ * @license
643
+ * Copyright 2020 Google LLC
644
+ *
645
+ * Licensed under the Apache License, Version 2.0 (the "License");
646
+ * you may not use this file except in compliance with the License.
647
+ * You may obtain a copy of the License at
648
+ *
649
+ * http://www.apache.org/licenses/LICENSE-2.0
650
+ *
651
+ * Unless required by applicable law or agreed to in writing, software
652
+ * distributed under the License is distributed on an "AS IS" BASIS,
653
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
654
+ * See the License for the specific language governing permissions and
655
+ * limitations under the License.
656
+ */
657
+ const _assert$1 = exp__namespace._assert;
658
+ class Auth {
659
+ constructor(app, provider) {
660
+ this.app = app;
661
+ if (provider.isInitialized()) {
662
+ this._delegate = provider.getImmediate();
663
+ this.linkUnderlyingAuth();
664
+ return;
665
+ }
666
+ const { apiKey } = app.options;
667
+ // TODO: platform needs to be determined using heuristics
668
+ _assert$1(apiKey, "invalid-api-key" /* exp.AuthErrorCode.INVALID_API_KEY */, {
669
+ appName: app.name
670
+ });
671
+ // TODO: platform needs to be determined using heuristics
672
+ _assert$1(apiKey, "invalid-api-key" /* exp.AuthErrorCode.INVALID_API_KEY */, {
673
+ appName: app.name
674
+ });
675
+ // Only use a popup/redirect resolver in browser environments
676
+ const resolver = typeof window !== 'undefined' ? CompatPopupRedirectResolver : undefined;
677
+ this._delegate = provider.initialize({
678
+ options: {
679
+ persistence: buildPersistenceHierarchy(apiKey, app.name),
680
+ popupRedirectResolver: resolver
681
+ }
682
+ });
683
+ this._delegate._updateErrorMap(exp__namespace.debugErrorMap);
684
+ this.linkUnderlyingAuth();
685
+ }
686
+ get emulatorConfig() {
687
+ return this._delegate.emulatorConfig;
688
+ }
689
+ get currentUser() {
690
+ if (!this._delegate.currentUser) {
691
+ return null;
692
+ }
693
+ return User.getOrCreate(this._delegate.currentUser);
694
+ }
695
+ get languageCode() {
696
+ return this._delegate.languageCode;
697
+ }
698
+ set languageCode(languageCode) {
699
+ this._delegate.languageCode = languageCode;
700
+ }
701
+ get settings() {
702
+ return this._delegate.settings;
703
+ }
704
+ get tenantId() {
705
+ return this._delegate.tenantId;
706
+ }
707
+ set tenantId(tid) {
708
+ this._delegate.tenantId = tid;
709
+ }
710
+ useDeviceLanguage() {
711
+ this._delegate.useDeviceLanguage();
712
+ }
713
+ signOut() {
714
+ return this._delegate.signOut();
715
+ }
716
+ useEmulator(url, options) {
717
+ exp__namespace.connectAuthEmulator(this._delegate, url, options);
718
+ }
719
+ applyActionCode(code) {
720
+ return exp__namespace.applyActionCode(this._delegate, code);
721
+ }
722
+ checkActionCode(code) {
723
+ return exp__namespace.checkActionCode(this._delegate, code);
724
+ }
725
+ confirmPasswordReset(code, newPassword) {
726
+ return exp__namespace.confirmPasswordReset(this._delegate, code, newPassword);
727
+ }
728
+ async createUserWithEmailAndPassword(email, password) {
729
+ return convertCredential(this._delegate, exp__namespace.createUserWithEmailAndPassword(this._delegate, email, password));
730
+ }
731
+ fetchProvidersForEmail(email) {
732
+ return this.fetchSignInMethodsForEmail(email);
733
+ }
734
+ fetchSignInMethodsForEmail(email) {
735
+ return exp__namespace.fetchSignInMethodsForEmail(this._delegate, email);
736
+ }
737
+ isSignInWithEmailLink(emailLink) {
738
+ return exp__namespace.isSignInWithEmailLink(this._delegate, emailLink);
739
+ }
740
+ async getRedirectResult() {
741
+ _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
742
+ const credential = await exp__namespace.getRedirectResult(this._delegate, CompatPopupRedirectResolver);
743
+ if (!credential) {
744
+ return {
745
+ credential: null,
746
+ user: null
747
+ };
748
+ }
749
+ return convertCredential(this._delegate, Promise.resolve(credential));
750
+ }
751
+ // This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage.
752
+ // It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it
753
+ // out of autogenerated documentation pages to reduce accidental misuse.
754
+ addFrameworkForLogging(framework) {
755
+ exp__namespace.addFrameworkForLogging(this._delegate, framework);
756
+ }
757
+ onAuthStateChanged(nextOrObserver, errorFn, completed) {
758
+ const { next, error, complete } = wrapObservers(nextOrObserver, errorFn, completed);
759
+ return this._delegate.onAuthStateChanged(next, error, complete);
760
+ }
761
+ onIdTokenChanged(nextOrObserver, errorFn, completed) {
762
+ const { next, error, complete } = wrapObservers(nextOrObserver, errorFn, completed);
763
+ return this._delegate.onIdTokenChanged(next, error, complete);
764
+ }
765
+ sendSignInLinkToEmail(email, actionCodeSettings) {
766
+ return exp__namespace.sendSignInLinkToEmail(this._delegate, email, actionCodeSettings);
767
+ }
768
+ sendPasswordResetEmail(email, actionCodeSettings) {
769
+ return exp__namespace.sendPasswordResetEmail(this._delegate, email, actionCodeSettings || undefined);
770
+ }
771
+ async setPersistence(persistence) {
772
+ _validatePersistenceArgument(this._delegate, persistence);
773
+ let converted;
774
+ switch (persistence) {
775
+ case Persistence.SESSION:
776
+ converted = exp__namespace.browserSessionPersistence;
777
+ break;
778
+ case Persistence.LOCAL:
779
+ // Not using isIndexedDBAvailable() since it only checks if indexedDB is defined.
780
+ const isIndexedDBFullySupported = await exp__namespace
781
+ ._getInstance(exp__namespace.indexedDBLocalPersistence)
782
+ ._isAvailable();
783
+ converted = isIndexedDBFullySupported
784
+ ? exp__namespace.indexedDBLocalPersistence
785
+ : exp__namespace.browserLocalPersistence;
786
+ break;
787
+ case Persistence.NONE:
788
+ converted = exp__namespace.inMemoryPersistence;
789
+ break;
790
+ default:
791
+ return exp__namespace._fail("argument-error" /* exp.AuthErrorCode.ARGUMENT_ERROR */, {
792
+ appName: this._delegate.name
793
+ });
794
+ }
795
+ return this._delegate.setPersistence(converted);
796
+ }
797
+ signInAndRetrieveDataWithCredential(credential) {
798
+ return this.signInWithCredential(credential);
799
+ }
800
+ signInAnonymously() {
801
+ return convertCredential(this._delegate, exp__namespace.signInAnonymously(this._delegate));
802
+ }
803
+ signInWithCredential(credential) {
804
+ return convertCredential(this._delegate, exp__namespace.signInWithCredential(this._delegate, credential));
805
+ }
806
+ signInWithCustomToken(token) {
807
+ return convertCredential(this._delegate, exp__namespace.signInWithCustomToken(this._delegate, token));
808
+ }
809
+ signInWithEmailAndPassword(email, password) {
810
+ return convertCredential(this._delegate, exp__namespace.signInWithEmailAndPassword(this._delegate, email, password));
811
+ }
812
+ signInWithEmailLink(email, emailLink) {
813
+ return convertCredential(this._delegate, exp__namespace.signInWithEmailLink(this._delegate, email, emailLink));
814
+ }
815
+ signInWithPhoneNumber(phoneNumber, applicationVerifier) {
816
+ return convertConfirmationResult(this._delegate, exp__namespace.signInWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
817
+ }
818
+ async signInWithPopup(provider) {
819
+ _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
820
+ return convertCredential(this._delegate, exp__namespace.signInWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
821
+ }
822
+ async signInWithRedirect(provider) {
823
+ _assert$1(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* exp.AuthErrorCode.OPERATION_NOT_SUPPORTED */);
824
+ await _savePersistenceForRedirect(this._delegate);
825
+ return exp__namespace.signInWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
826
+ }
827
+ updateCurrentUser(user) {
828
+ // remove ts-ignore once overloads are defined for exp functions to accept compat objects
829
+ // @ts-ignore
830
+ return this._delegate.updateCurrentUser(user);
831
+ }
832
+ verifyPasswordResetCode(code) {
833
+ return exp__namespace.verifyPasswordResetCode(this._delegate, code);
834
+ }
835
+ unwrap() {
836
+ return this._delegate;
837
+ }
838
+ _delete() {
839
+ return this._delegate._delete();
840
+ }
841
+ linkUnderlyingAuth() {
842
+ this._delegate.wrapped = () => this;
843
+ }
844
+ }
845
+ Auth.Persistence = Persistence;
846
+ function wrapObservers(nextOrObserver, error, complete) {
847
+ let next = nextOrObserver;
848
+ if (typeof nextOrObserver !== 'function') {
849
+ ({ next, error, complete } = nextOrObserver);
850
+ }
851
+ // We know 'next' is now a function
852
+ const oldNext = next;
853
+ const newNext = (user) => oldNext(user && User.getOrCreate(user));
854
+ return {
855
+ next: newNext,
856
+ error: error,
857
+ complete
858
+ };
859
+ }
860
+ function buildPersistenceHierarchy(apiKey, appName) {
861
+ // Note this is slightly different behavior: in this case, the stored
862
+ // persistence is checked *first* rather than last. This is because we want
863
+ // to prefer stored persistence type in the hierarchy. This is an empty
864
+ // array if window is not available or there is no pending redirect
865
+ const persistences = _getPersistencesFromRedirect(apiKey, appName);
866
+ // If "self" is available, add indexedDB
867
+ if (typeof self !== 'undefined' &&
868
+ !persistences.includes(exp__namespace.indexedDBLocalPersistence)) {
869
+ persistences.push(exp__namespace.indexedDBLocalPersistence);
870
+ }
871
+ // If "window" is available, add HTML Storage persistences
872
+ if (typeof window !== 'undefined') {
873
+ for (const persistence of [
874
+ exp__namespace.browserLocalPersistence,
875
+ exp__namespace.browserSessionPersistence
876
+ ]) {
877
+ if (!persistences.includes(persistence)) {
878
+ persistences.push(persistence);
879
+ }
880
+ }
881
+ }
882
+ // Add in-memory as a final fallback
883
+ if (!persistences.includes(exp__namespace.inMemoryPersistence)) {
884
+ persistences.push(exp__namespace.inMemoryPersistence);
885
+ }
886
+ return persistences;
887
+ }
888
+
889
+ /**
890
+ * @license
891
+ * Copyright 2020 Google LLC
892
+ *
893
+ * Licensed under the Apache License, Version 2.0 (the "License");
894
+ * you may not use this file except in compliance with the License.
895
+ * You may obtain a copy of the License at
896
+ *
897
+ * http://www.apache.org/licenses/LICENSE-2.0
898
+ *
899
+ * Unless required by applicable law or agreed to in writing, software
900
+ * distributed under the License is distributed on an "AS IS" BASIS,
901
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
902
+ * See the License for the specific language governing permissions and
903
+ * limitations under the License.
904
+ */
905
+ class PhoneAuthProvider {
906
+ static credential(verificationId, verificationCode) {
907
+ return exp__namespace.PhoneAuthProvider.credential(verificationId, verificationCode);
908
+ }
909
+ constructor() {
910
+ this.providerId = 'phone';
911
+ // TODO: remove ts-ignore when moving types from auth-types to auth-compat
912
+ // @ts-ignore
913
+ this._delegate = new exp__namespace.PhoneAuthProvider(unwrap(firebase__default["default"].auth()));
914
+ }
915
+ verifyPhoneNumber(phoneInfoOptions, applicationVerifier) {
916
+ return this._delegate.verifyPhoneNumber(
917
+ // The implementation matches but the types are subtly incompatible
918
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
919
+ phoneInfoOptions, applicationVerifier);
920
+ }
921
+ unwrap() {
922
+ return this._delegate;
923
+ }
924
+ }
925
+ PhoneAuthProvider.PHONE_SIGN_IN_METHOD = exp__namespace.PhoneAuthProvider.PHONE_SIGN_IN_METHOD;
926
+ PhoneAuthProvider.PROVIDER_ID = exp__namespace.PhoneAuthProvider.PROVIDER_ID;
927
+
928
+ /**
929
+ * @license
930
+ * Copyright 2020 Google LLC
931
+ *
932
+ * Licensed under the Apache License, Version 2.0 (the "License");
933
+ * you may not use this file except in compliance with the License.
934
+ * You may obtain a copy of the License at
935
+ *
936
+ * http://www.apache.org/licenses/LICENSE-2.0
937
+ *
938
+ * Unless required by applicable law or agreed to in writing, software
939
+ * distributed under the License is distributed on an "AS IS" BASIS,
940
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
941
+ * See the License for the specific language governing permissions and
942
+ * limitations under the License.
943
+ */
944
+ const _assert = exp__namespace._assert;
945
+ class RecaptchaVerifier {
946
+ constructor(container, parameters, app = firebase__default["default"].app()) {
947
+ // API key is required for web client RPC calls.
948
+ _assert(app.options?.apiKey, "invalid-api-key" /* exp.AuthErrorCode.INVALID_API_KEY */, {
949
+ appName: app.name
950
+ });
951
+ this._delegate = new exp__namespace.RecaptchaVerifier(
952
+ // TODO: remove ts-ignore when moving types from auth-types to auth-compat
953
+ // @ts-ignore
954
+ app.auth(), container,
955
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
956
+ parameters);
957
+ this.type = this._delegate.type;
958
+ }
959
+ clear() {
960
+ this._delegate.clear();
961
+ }
962
+ render() {
963
+ return this._delegate.render();
964
+ }
965
+ verify() {
966
+ return this._delegate.verify();
967
+ }
968
+ }
969
+
970
+ /**
971
+ * @license
972
+ * Copyright 2020 Google LLC
973
+ *
974
+ * Licensed under the Apache License, Version 2.0 (the "License");
975
+ * you may not use this file except in compliance with the License.
976
+ * You may obtain a copy of the License at
977
+ *
978
+ * http://www.apache.org/licenses/LICENSE-2.0
979
+ *
980
+ * Unless required by applicable law or agreed to in writing, software
981
+ * distributed under the License is distributed on an "AS IS" BASIS,
982
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
983
+ * See the License for the specific language governing permissions and
984
+ * limitations under the License.
985
+ */
986
+ const AUTH_TYPE = 'auth-compat';
987
+ // Create auth components to register with firebase.
988
+ // Provides Auth public APIs.
989
+ function registerAuthCompat(instance) {
990
+ instance.INTERNAL.registerComponent(new component.Component(AUTH_TYPE, container => {
991
+ // getImmediate for FirebaseApp will always succeed
992
+ const app = container.getProvider('app-compat').getImmediate();
993
+ const authProvider = container.getProvider('auth');
994
+ return new Auth(app, authProvider);
995
+ }, "PUBLIC" /* ComponentType.PUBLIC */)
996
+ .setServiceProps({
997
+ ActionCodeInfo: {
998
+ Operation: {
999
+ EMAIL_SIGNIN: exp__namespace.ActionCodeOperation.EMAIL_SIGNIN,
1000
+ PASSWORD_RESET: exp__namespace.ActionCodeOperation.PASSWORD_RESET,
1001
+ RECOVER_EMAIL: exp__namespace.ActionCodeOperation.RECOVER_EMAIL,
1002
+ REVERT_SECOND_FACTOR_ADDITION: exp__namespace.ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION,
1003
+ VERIFY_AND_CHANGE_EMAIL: exp__namespace.ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL,
1004
+ VERIFY_EMAIL: exp__namespace.ActionCodeOperation.VERIFY_EMAIL
1005
+ }
1006
+ },
1007
+ EmailAuthProvider: exp__namespace.EmailAuthProvider,
1008
+ FacebookAuthProvider: exp__namespace.FacebookAuthProvider,
1009
+ GithubAuthProvider: exp__namespace.GithubAuthProvider,
1010
+ GoogleAuthProvider: exp__namespace.GoogleAuthProvider,
1011
+ OAuthProvider: exp__namespace.OAuthProvider,
1012
+ SAMLAuthProvider: exp__namespace.SAMLAuthProvider,
1013
+ PhoneAuthProvider: PhoneAuthProvider,
1014
+ PhoneMultiFactorGenerator: exp__namespace.PhoneMultiFactorGenerator,
1015
+ RecaptchaVerifier: RecaptchaVerifier,
1016
+ TwitterAuthProvider: exp__namespace.TwitterAuthProvider,
1017
+ Auth,
1018
+ AuthCredential: exp__namespace.AuthCredential,
1019
+ Error: util.FirebaseError
1020
+ })
1021
+ .setInstantiationMode("LAZY" /* InstantiationMode.LAZY */)
1022
+ .setMultipleInstances(false));
1023
+ instance.registerVersion(name, version);
1024
+ }
1025
+ registerAuthCompat(firebase__default["default"]);
1026
+
1027
+ /**
1028
+ * @license
1029
+ * Copyright 2017 Google LLC
1030
+ *
1031
+ * Licensed under the Apache License, Version 2.0 (the "License");
1032
+ * you may not use this file except in compliance with the License.
1033
+ * You may obtain a copy of the License at
1034
+ *
1035
+ * http://www.apache.org/licenses/LICENSE-2.0
1036
+ *
1037
+ * Unless required by applicable law or agreed to in writing, software
1038
+ * distributed under the License is distributed on an "AS IS" BASIS,
1039
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1040
+ * See the License for the specific language governing permissions and
1041
+ * limitations under the License.
1042
+ */
1043
+ exp.FetchProvider.initialize(fetch, Headers, Response);
1044
+ //# sourceMappingURL=index.node.cjs.js.map