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