UNPKG

80.5 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5var index = require('./index-ab3e8e37.js');
6var tslib = require('tslib');
7var util = require('@firebase/util');
8var app = require('@firebase/app');
9require('@firebase/logger');
10require('@firebase/component');
11require('node-fetch');
12
13/**
14 * @license
15 * Copyright 2020 Google LLC
16 *
17 * Licensed under the Apache License, Version 2.0 (the "License");
18 * you may not use this file except in compliance with the License.
19 * You may obtain a copy of the License at
20 *
21 * http://www.apache.org/licenses/LICENSE-2.0
22 *
23 * Unless required by applicable law or agreed to in writing, software
24 * distributed under the License is distributed on an "AS IS" BASIS,
25 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 * See the License for the specific language governing permissions and
27 * limitations under the License.
28 */
29function _generateEventId(prefix, digits) {
30 if (prefix === void 0) { prefix = ''; }
31 if (digits === void 0) { digits = 10; }
32 var random = '';
33 for (var i = 0; i < digits; i++) {
34 random += Math.floor(Math.random() * 10);
35 }
36 return prefix + random;
37}
38
39/**
40 * @license
41 * Copyright 2020 Google LLC.
42 *
43 * Licensed under the Apache License, Version 2.0 (the "License");
44 * you may not use this file except in compliance with the License.
45 * You may obtain a copy of the License at
46 *
47 * http://www.apache.org/licenses/LICENSE-2.0
48 *
49 * Unless required by applicable law or agreed to in writing, software
50 * distributed under the License is distributed on an "AS IS" BASIS,
51 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52 * See the License for the specific language governing permissions and
53 * limitations under the License.
54 */
55var AuthPopup = /** @class */ (function () {
56 function AuthPopup(window) {
57 this.window = window;
58 this.associatedEvent = null;
59 }
60 AuthPopup.prototype.close = function () {
61 if (this.window) {
62 try {
63 this.window.close();
64 }
65 catch (e) { }
66 }
67 };
68 return AuthPopup;
69}());
70
71/**
72 * @license
73 * Copyright 2021 Google LLC
74 *
75 * Licensed under the Apache License, Version 2.0 (the "License");
76 * you may not use this file except in compliance with the License.
77 * You may obtain a copy of the License at
78 *
79 * http://www.apache.org/licenses/LICENSE-2.0
80 *
81 * Unless required by applicable law or agreed to in writing, software
82 * distributed under the License is distributed on an "AS IS" BASIS,
83 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84 * See the License for the specific language governing permissions and
85 * limitations under the License.
86 */
87/**
88 * Chooses a popup/redirect resolver to use. This prefers the override (which
89 * is directly passed in), and falls back to the property set on the auth
90 * object. If neither are available, this function errors w/ an argument error.
91 */
92function _withDefaultResolver(auth, resolverOverride) {
93 if (resolverOverride) {
94 return index._getInstance(resolverOverride);
95 }
96 index._assert(auth._popupRedirectResolver, auth, "argument-error" /* ARGUMENT_ERROR */);
97 return auth._popupRedirectResolver;
98}
99
100/**
101 * @license
102 * Copyright 2019 Google LLC
103 *
104 * Licensed under the Apache License, Version 2.0 (the "License");
105 * you may not use this file except in compliance with the License.
106 * You may obtain a copy of the License at
107 *
108 * http://www.apache.org/licenses/LICENSE-2.0
109 *
110 * Unless required by applicable law or agreed to in writing, software
111 * distributed under the License is distributed on an "AS IS" BASIS,
112 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113 * See the License for the specific language governing permissions and
114 * limitations under the License.
115 */
116var IdpCredential = /** @class */ (function (_super) {
117 tslib.__extends(IdpCredential, _super);
118 function IdpCredential(params) {
119 var _this = _super.call(this, "custom" /* CUSTOM */, "custom" /* CUSTOM */) || this;
120 _this.params = params;
121 return _this;
122 }
123 IdpCredential.prototype._getIdTokenResponse = function (auth) {
124 return index.signInWithIdp(auth, this._buildIdpRequest());
125 };
126 IdpCredential.prototype._linkToIdToken = function (auth, idToken) {
127 return index.signInWithIdp(auth, this._buildIdpRequest(idToken));
128 };
129 IdpCredential.prototype._getReauthenticationResolver = function (auth) {
130 return index.signInWithIdp(auth, this._buildIdpRequest());
131 };
132 IdpCredential.prototype._buildIdpRequest = function (idToken) {
133 var request = {
134 requestUri: this.params.requestUri,
135 sessionId: this.params.sessionId,
136 postBody: this.params.postBody,
137 tenantId: this.params.tenantId,
138 pendingToken: this.params.pendingToken,
139 returnSecureToken: true,
140 returnIdpCredential: true
141 };
142 if (idToken) {
143 request.idToken = idToken;
144 }
145 return request;
146 };
147 return IdpCredential;
148}(index.AuthCredential));
149function _signIn(params) {
150 return index._signInWithCredential(params.auth, new IdpCredential(params), params.bypassAuthState);
151}
152function _reauth(params) {
153 var auth = params.auth, user = params.user;
154 index._assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
155 return index._reauthenticate(user, new IdpCredential(params), params.bypassAuthState);
156}
157function _link(params) {
158 return tslib.__awaiter(this, void 0, void 0, function () {
159 var auth, user;
160 return tslib.__generator(this, function (_a) {
161 auth = params.auth, user = params.user;
162 index._assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
163 return [2 /*return*/, index._link(user, new IdpCredential(params), params.bypassAuthState)];
164 });
165 });
166}
167
168/**
169 * @license
170 * Copyright 2020 Google LLC
171 *
172 * Licensed under the Apache License, Version 2.0 (the "License");
173 * you may not use this file except in compliance with the License.
174 * You may obtain a copy of the License at
175 *
176 * http://www.apache.org/licenses/LICENSE-2.0
177 *
178 * Unless required by applicable law or agreed to in writing, software
179 * distributed under the License is distributed on an "AS IS" BASIS,
180 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
181 * See the License for the specific language governing permissions and
182 * limitations under the License.
183 */
184/**
185 * Popup event manager. Handles the popup's entire lifecycle; listens to auth
186 * events
187 */
188var AbstractPopupRedirectOperation = /** @class */ (function () {
189 function AbstractPopupRedirectOperation(auth, filter, resolver, user, bypassAuthState) {
190 if (bypassAuthState === void 0) { bypassAuthState = false; }
191 this.auth = auth;
192 this.resolver = resolver;
193 this.user = user;
194 this.bypassAuthState = bypassAuthState;
195 this.pendingPromise = null;
196 this.eventManager = null;
197 this.filter = Array.isArray(filter) ? filter : [filter];
198 }
199 AbstractPopupRedirectOperation.prototype.execute = function () {
200 var _this = this;
201 return new Promise(function (resolve, reject) { return tslib.__awaiter(_this, void 0, void 0, function () {
202 var _a, e_1;
203 return tslib.__generator(this, function (_b) {
204 switch (_b.label) {
205 case 0:
206 this.pendingPromise = { resolve: resolve, reject: reject };
207 _b.label = 1;
208 case 1:
209 _b.trys.push([1, 4, , 5]);
210 _a = this;
211 return [4 /*yield*/, this.resolver._initialize(this.auth)];
212 case 2:
213 _a.eventManager = _b.sent();
214 return [4 /*yield*/, this.onExecution()];
215 case 3:
216 _b.sent();
217 this.eventManager.registerConsumer(this);
218 return [3 /*break*/, 5];
219 case 4:
220 e_1 = _b.sent();
221 this.reject(e_1);
222 return [3 /*break*/, 5];
223 case 5: return [2 /*return*/];
224 }
225 });
226 }); });
227 };
228 AbstractPopupRedirectOperation.prototype.onAuthEvent = function (event) {
229 return tslib.__awaiter(this, void 0, void 0, function () {
230 var urlResponse, sessionId, postBody, tenantId, error, type, params, _a, e_2;
231 return tslib.__generator(this, function (_b) {
232 switch (_b.label) {
233 case 0:
234 urlResponse = event.urlResponse, sessionId = event.sessionId, postBody = event.postBody, tenantId = event.tenantId, error = event.error, type = event.type;
235 if (error) {
236 this.reject(error);
237 return [2 /*return*/];
238 }
239 params = {
240 auth: this.auth,
241 requestUri: urlResponse,
242 sessionId: sessionId,
243 tenantId: tenantId || undefined,
244 postBody: postBody || undefined,
245 user: this.user,
246 bypassAuthState: this.bypassAuthState
247 };
248 _b.label = 1;
249 case 1:
250 _b.trys.push([1, 3, , 4]);
251 _a = this.resolve;
252 return [4 /*yield*/, this.getIdpTask(type)(params)];
253 case 2:
254 _a.apply(this, [_b.sent()]);
255 return [3 /*break*/, 4];
256 case 3:
257 e_2 = _b.sent();
258 this.reject(e_2);
259 return [3 /*break*/, 4];
260 case 4: return [2 /*return*/];
261 }
262 });
263 });
264 };
265 AbstractPopupRedirectOperation.prototype.onError = function (error) {
266 this.reject(error);
267 };
268 AbstractPopupRedirectOperation.prototype.getIdpTask = function (type) {
269 switch (type) {
270 case "signInViaPopup" /* SIGN_IN_VIA_POPUP */:
271 case "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */:
272 return _signIn;
273 case "linkViaPopup" /* LINK_VIA_POPUP */:
274 case "linkViaRedirect" /* LINK_VIA_REDIRECT */:
275 return _link;
276 case "reauthViaPopup" /* REAUTH_VIA_POPUP */:
277 case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
278 return _reauth;
279 default:
280 index._fail(this.auth, "internal-error" /* INTERNAL_ERROR */);
281 }
282 };
283 AbstractPopupRedirectOperation.prototype.resolve = function (cred) {
284 index.debugAssert(this.pendingPromise, 'Pending promise was never set');
285 this.pendingPromise.resolve(cred);
286 this.unregisterAndCleanUp();
287 };
288 AbstractPopupRedirectOperation.prototype.reject = function (error) {
289 index.debugAssert(this.pendingPromise, 'Pending promise was never set');
290 this.pendingPromise.reject(error);
291 this.unregisterAndCleanUp();
292 };
293 AbstractPopupRedirectOperation.prototype.unregisterAndCleanUp = function () {
294 if (this.eventManager) {
295 this.eventManager.unregisterConsumer(this);
296 }
297 this.pendingPromise = null;
298 this.cleanUp();
299 };
300 return AbstractPopupRedirectOperation;
301}());
302
303/**
304 * @license
305 * Copyright 2020 Google LLC
306 *
307 * Licensed under the Apache License, Version 2.0 (the "License");
308 * you may not use this file except in compliance with the License.
309 * You may obtain a copy of the License at
310 *
311 * http://www.apache.org/licenses/LICENSE-2.0
312 *
313 * Unless required by applicable law or agreed to in writing, software
314 * distributed under the License is distributed on an "AS IS" BASIS,
315 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
316 * See the License for the specific language governing permissions and
317 * limitations under the License.
318 */
319var PENDING_REDIRECT_KEY = 'pendingRedirect';
320// We only get one redirect outcome for any one auth, so just store it
321// in here.
322var redirectOutcomeMap = new Map();
323var RedirectAction = /** @class */ (function (_super) {
324 tslib.__extends(RedirectAction, _super);
325 function RedirectAction(auth, resolver, bypassAuthState) {
326 if (bypassAuthState === void 0) { bypassAuthState = false; }
327 var _this = _super.call(this, auth, [
328 "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */,
329 "linkViaRedirect" /* LINK_VIA_REDIRECT */,
330 "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */,
331 "unknown" /* UNKNOWN */
332 ], resolver, undefined, bypassAuthState) || this;
333 _this.eventId = null;
334 return _this;
335 }
336 /**
337 * Override the execute function; if we already have a redirect result, then
338 * just return it.
339 */
340 RedirectAction.prototype.execute = function () {
341 return tslib.__awaiter(this, void 0, void 0, function () {
342 var readyOutcome, hasPendingRedirect, result_1, _a, e_1;
343 return tslib.__generator(this, function (_b) {
344 switch (_b.label) {
345 case 0:
346 readyOutcome = redirectOutcomeMap.get(this.auth._key());
347 if (!!readyOutcome) return [3 /*break*/, 8];
348 _b.label = 1;
349 case 1:
350 _b.trys.push([1, 6, , 7]);
351 return [4 /*yield*/, _getAndClearPendingRedirectStatus(this.resolver, this.auth)];
352 case 2:
353 hasPendingRedirect = _b.sent();
354 if (!hasPendingRedirect) return [3 /*break*/, 4];
355 return [4 /*yield*/, _super.prototype.execute.call(this)];
356 case 3:
357 _a = _b.sent();
358 return [3 /*break*/, 5];
359 case 4:
360 _a = null;
361 _b.label = 5;
362 case 5:
363 result_1 = _a;
364 readyOutcome = function () { return Promise.resolve(result_1); };
365 return [3 /*break*/, 7];
366 case 6:
367 e_1 = _b.sent();
368 readyOutcome = function () { return Promise.reject(e_1); };
369 return [3 /*break*/, 7];
370 case 7:
371 redirectOutcomeMap.set(this.auth._key(), readyOutcome);
372 _b.label = 8;
373 case 8:
374 // If we're not bypassing auth state, the ready outcome should be set to
375 // null.
376 if (!this.bypassAuthState) {
377 redirectOutcomeMap.set(this.auth._key(), function () { return Promise.resolve(null); });
378 }
379 return [2 /*return*/, readyOutcome()];
380 }
381 });
382 });
383 };
384 RedirectAction.prototype.onAuthEvent = function (event) {
385 return tslib.__awaiter(this, void 0, void 0, function () {
386 var user;
387 return tslib.__generator(this, function (_a) {
388 switch (_a.label) {
389 case 0:
390 if (event.type === "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */) {
391 return [2 /*return*/, _super.prototype.onAuthEvent.call(this, event)];
392 }
393 else if (event.type === "unknown" /* UNKNOWN */) {
394 // This is a sentinel value indicating there's no pending redirect
395 this.resolve(null);
396 return [2 /*return*/];
397 }
398 if (!event.eventId) return [3 /*break*/, 2];
399 return [4 /*yield*/, this.auth._redirectUserForId(event.eventId)];
400 case 1:
401 user = _a.sent();
402 if (user) {
403 this.user = user;
404 return [2 /*return*/, _super.prototype.onAuthEvent.call(this, event)];
405 }
406 else {
407 this.resolve(null);
408 }
409 _a.label = 2;
410 case 2: return [2 /*return*/];
411 }
412 });
413 });
414 };
415 RedirectAction.prototype.onExecution = function () {
416 return tslib.__awaiter(this, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
417 return [2 /*return*/];
418 }); });
419 };
420 RedirectAction.prototype.cleanUp = function () { };
421 return RedirectAction;
422}(AbstractPopupRedirectOperation));
423function _getAndClearPendingRedirectStatus(resolver, auth) {
424 return tslib.__awaiter(this, void 0, void 0, function () {
425 var key, persistence, hasPendingRedirect;
426 return tslib.__generator(this, function (_a) {
427 switch (_a.label) {
428 case 0:
429 key = pendingRedirectKey(auth);
430 persistence = resolverPersistence(resolver);
431 return [4 /*yield*/, persistence._isAvailable()];
432 case 1:
433 if (!(_a.sent())) {
434 return [2 /*return*/, false];
435 }
436 return [4 /*yield*/, persistence._get(key)];
437 case 2:
438 hasPendingRedirect = (_a.sent()) === 'true';
439 return [4 /*yield*/, persistence._remove(key)];
440 case 3:
441 _a.sent();
442 return [2 /*return*/, hasPendingRedirect];
443 }
444 });
445 });
446}
447function _clearRedirectOutcomes() {
448 redirectOutcomeMap.clear();
449}
450function _overrideRedirectResult(auth, result) {
451 redirectOutcomeMap.set(auth._key(), result);
452}
453function resolverPersistence(resolver) {
454 return index._getInstance(resolver._redirectPersistence);
455}
456function pendingRedirectKey(auth) {
457 return index._persistenceKeyName(PENDING_REDIRECT_KEY, auth.config.apiKey, auth.name);
458}
459
460/**
461 * @license
462 * Copyright 2020 Google LLC
463 *
464 * Licensed under the Apache License, Version 2.0 (the "License");
465 * you may not use this file except in compliance with the License.
466 * You may obtain a copy of the License at
467 *
468 * http://www.apache.org/licenses/LICENSE-2.0
469 *
470 * Unless required by applicable law or agreed to in writing, software
471 * distributed under the License is distributed on an "AS IS" BASIS,
472 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
473 * See the License for the specific language governing permissions and
474 * limitations under the License.
475 */
476function _getRedirectResult(auth, resolverExtern, bypassAuthState) {
477 if (bypassAuthState === void 0) { bypassAuthState = false; }
478 return tslib.__awaiter(this, void 0, void 0, function () {
479 var authInternal, resolver, action, result;
480 return tslib.__generator(this, function (_a) {
481 switch (_a.label) {
482 case 0:
483 authInternal = index._castAuth(auth);
484 resolver = _withDefaultResolver(authInternal, resolverExtern);
485 action = new RedirectAction(authInternal, resolver, bypassAuthState);
486 return [4 /*yield*/, action.execute()];
487 case 1:
488 result = _a.sent();
489 if (!(result && !bypassAuthState)) return [3 /*break*/, 4];
490 delete result.user._redirectEventId;
491 return [4 /*yield*/, authInternal._persistUserIfCurrent(result.user)];
492 case 2:
493 _a.sent();
494 return [4 /*yield*/, authInternal._setRedirectUser(null, resolverExtern)];
495 case 3:
496 _a.sent();
497 _a.label = 4;
498 case 4: return [2 /*return*/, result];
499 }
500 });
501 });
502}
503
504var STORAGE_AVAILABLE_KEY = '__sak';
505
506/**
507 * @license
508 * Copyright 2019 Google LLC
509 *
510 * Licensed under the Apache License, Version 2.0 (the "License");
511 * you may not use this file except in compliance with the License.
512 * You may obtain a copy of the License at
513 *
514 * http://www.apache.org/licenses/LICENSE-2.0
515 *
516 * Unless required by applicable law or agreed to in writing, software
517 * distributed under the License is distributed on an "AS IS" BASIS,
518 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
519 * See the License for the specific language governing permissions and
520 * limitations under the License.
521 */
522// There are two different browser persistence types: local and session.
523// Both have the same implementation but use a different underlying storage
524// object.
525var BrowserPersistenceClass = /** @class */ (function () {
526 function BrowserPersistenceClass(storageRetriever, type) {
527 this.storageRetriever = storageRetriever;
528 this.type = type;
529 }
530 BrowserPersistenceClass.prototype._isAvailable = function () {
531 try {
532 if (!this.storage) {
533 return Promise.resolve(false);
534 }
535 this.storage.setItem(STORAGE_AVAILABLE_KEY, '1');
536 this.storage.removeItem(STORAGE_AVAILABLE_KEY);
537 return Promise.resolve(true);
538 }
539 catch (_a) {
540 return Promise.resolve(false);
541 }
542 };
543 BrowserPersistenceClass.prototype._set = function (key, value) {
544 this.storage.setItem(key, JSON.stringify(value));
545 return Promise.resolve();
546 };
547 BrowserPersistenceClass.prototype._get = function (key) {
548 var json = this.storage.getItem(key);
549 return Promise.resolve(json ? JSON.parse(json) : null);
550 };
551 BrowserPersistenceClass.prototype._remove = function (key) {
552 this.storage.removeItem(key);
553 return Promise.resolve();
554 };
555 Object.defineProperty(BrowserPersistenceClass.prototype, "storage", {
556 get: function () {
557 return this.storageRetriever();
558 },
559 enumerable: false,
560 configurable: true
561 });
562 return BrowserPersistenceClass;
563}());
564
565/**
566 * @license
567 * Copyright 2020 Google LLC
568 *
569 * Licensed under the Apache License, Version 2.0 (the "License");
570 * you may not use this file except in compliance with the License.
571 * You may obtain a copy of the License at
572 *
573 * http://www.apache.org/licenses/LICENSE-2.0
574 *
575 * Unless required by applicable law or agreed to in writing, software
576 * distributed under the License is distributed on an "AS IS" BASIS,
577 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
578 * See the License for the specific language governing permissions and
579 * limitations under the License.
580 */
581var BrowserSessionPersistence = /** @class */ (function (_super) {
582 tslib.__extends(BrowserSessionPersistence, _super);
583 function BrowserSessionPersistence() {
584 return _super.call(this, function () { return window.sessionStorage; }, "SESSION" /* SESSION */) || this;
585 }
586 BrowserSessionPersistence.prototype._addListener = function (_key, _listener) {
587 // Listeners are not supported for session storage since it cannot be shared across windows
588 return;
589 };
590 BrowserSessionPersistence.prototype._removeListener = function (_key, _listener) {
591 // Listeners are not supported for session storage since it cannot be shared across windows
592 return;
593 };
594 BrowserSessionPersistence.type = 'SESSION';
595 return BrowserSessionPersistence;
596}(BrowserPersistenceClass));
597/**
598 * An implementation of {@link Persistence} of `SESSION` using `sessionStorage`
599 * for the underlying storage.
600 *
601 * @public
602 */
603var browserSessionPersistence = BrowserSessionPersistence;
604
605/**
606 * @license
607 * Copyright 2021 Google LLC
608 *
609 * Licensed under the Apache License, Version 2.0 (the "License");
610 * you may not use this file except in compliance with the License.
611 * You may obtain a copy of the License at
612 *
613 * http://www.apache.org/licenses/LICENSE-2.0
614 *
615 * Unless required by applicable law or agreed to in writing, software
616 * distributed under the License is distributed on an "AS IS" BASIS,
617 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
618 * See the License for the specific language governing permissions and
619 * limitations under the License.
620 */
621/**
622 * URL for Authentication widget which will initiate the OAuth handshake
623 *
624 * @internal
625 */
626var WIDGET_PATH = '__/auth/handler';
627/**
628 * URL for emulated environment
629 *
630 * @internal
631 */
632var EMULATOR_WIDGET_PATH = 'emulator/auth/handler';
633function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
634 index._assert(auth.config.authDomain, auth, "auth-domain-config-required" /* MISSING_AUTH_DOMAIN */);
635 index._assert(auth.config.apiKey, auth, "invalid-api-key" /* INVALID_API_KEY */);
636 var params = {
637 apiKey: auth.config.apiKey,
638 appName: auth.name,
639 authType: authType,
640 redirectUrl: redirectUrl,
641 v: app.SDK_VERSION,
642 eventId: eventId
643 };
644 if (provider instanceof index.FederatedAuthProvider) {
645 provider.setDefaultLanguage(auth.languageCode);
646 params.providerId = provider.providerId || '';
647 if (!util.isEmpty(provider.getCustomParameters())) {
648 params.customParameters = JSON.stringify(provider.getCustomParameters());
649 }
650 // TODO set additionalParams from the provider as well?
651 for (var _i = 0, _a = Object.entries(additionalParams || {}); _i < _a.length; _i++) {
652 var _b = _a[_i], key = _b[0], value = _b[1];
653 params[key] = value;
654 }
655 }
656 if (provider instanceof index.BaseOAuthProvider) {
657 var scopes = provider.getScopes().filter(function (scope) { return scope !== ''; });
658 if (scopes.length > 0) {
659 params.scopes = scopes.join(',');
660 }
661 }
662 if (auth.tenantId) {
663 params.tid = auth.tenantId;
664 }
665 // TODO: maybe set eid as endipointId
666 // TODO: maybe set fw as Frameworks.join(",")
667 var paramsDict = params;
668 for (var _c = 0, _d = Object.keys(paramsDict); _c < _d.length; _c++) {
669 var key = _d[_c];
670 if (paramsDict[key] === undefined) {
671 delete paramsDict[key];
672 }
673 }
674 return getHandlerBase(auth) + "?" + util.querystring(paramsDict).slice(1);
675}
676function getHandlerBase(_a) {
677 var config = _a.config;
678 if (!config.emulator) {
679 return "https://" + config.authDomain + "/" + WIDGET_PATH;
680 }
681 return index._emulatorUrl(config, EMULATOR_WIDGET_PATH);
682}
683
684/**
685 * @license
686 * Copyright 2021 Google LLC
687 *
688 * Licensed under the Apache License, Version 2.0 (the "License");
689 * you may not use this file except in compliance with the License.
690 * You may obtain a copy of the License at
691 *
692 * http://www.apache.org/licenses/LICENSE-2.0
693 *
694 * Unless required by applicable law or agreed to in writing, software
695 * distributed under the License is distributed on an "AS IS" BASIS,
696 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
697 * See the License for the specific language governing permissions and
698 * limitations under the License.
699 */
700function _cordovaWindow() {
701 return window;
702}
703
704/**
705 * @license
706 * Copyright 2020 Google LLC
707 *
708 * Licensed under the Apache License, Version 2.0 (the "License");
709 * you may not use this file except in compliance with the License.
710 * You may obtain a copy of the License at
711 *
712 * http://www.apache.org/licenses/LICENSE-2.0
713 *
714 * Unless required by applicable law or agreed to in writing, software
715 * distributed under the License is distributed on an "AS IS" BASIS,
716 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
717 * See the License for the specific language governing permissions and
718 * limitations under the License.
719 */
720function _getProjectConfig(auth, request) {
721 if (request === void 0) { request = {}; }
722 return tslib.__awaiter(this, void 0, void 0, function () {
723 return tslib.__generator(this, function (_a) {
724 return [2 /*return*/, index._performApiRequest(auth, "GET" /* GET */, "/v1/projects" /* GET_PROJECT_CONFIG */, request)];
725 });
726 });
727}
728
729/**
730 * @license
731 * Copyright 2020 Google LLC
732 *
733 * Licensed under the Apache License, Version 2.0 (the "License");
734 * you may not use this file except in compliance with the License.
735 * You may obtain a copy of the License at
736 *
737 * http://www.apache.org/licenses/LICENSE-2.0
738 *
739 * Unless required by applicable law or agreed to in writing, software
740 * distributed under the License is distributed on an "AS IS" BASIS,
741 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
742 * See the License for the specific language governing permissions and
743 * limitations under the License.
744 */
745/**
746 * How long to wait after the app comes back into focus before concluding that
747 * the user closed the sign in tab.
748 */
749var REDIRECT_TIMEOUT_MS = 2000;
750/**
751 * Generates the URL for the OAuth handler.
752 */
753function _generateHandlerUrl(auth, event, provider) {
754 var _a;
755 return tslib.__awaiter(this, void 0, void 0, function () {
756 var BuildInfo, sessionDigest, additionalParams;
757 return tslib.__generator(this, function (_b) {
758 switch (_b.label) {
759 case 0:
760 BuildInfo = _cordovaWindow().BuildInfo;
761 index.debugAssert(event.sessionId, 'AuthEvent did not contain a session ID');
762 return [4 /*yield*/, computeSha256(event.sessionId)];
763 case 1:
764 sessionDigest = _b.sent();
765 additionalParams = {};
766 if (index._isIOS()) {
767 // iOS app identifier
768 additionalParams['ibi'] = BuildInfo.packageName;
769 }
770 else if (index._isAndroid()) {
771 // Android app identifier
772 additionalParams['apn'] = BuildInfo.packageName;
773 }
774 else {
775 index._fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
776 }
777 // Add the display name if available
778 if (BuildInfo.displayName) {
779 additionalParams['appDisplayName'] = BuildInfo.displayName;
780 }
781 // Attached the hashed session ID
782 additionalParams['sessionId'] = sessionDigest;
783 return [2 /*return*/, _getRedirectUrl(auth, provider, event.type, undefined, (_a = event.eventId) !== null && _a !== void 0 ? _a : undefined, additionalParams)];
784 }
785 });
786 });
787}
788/**
789 * Validates that this app is valid for this project configuration
790 */
791function _validateOrigin(auth) {
792 return tslib.__awaiter(this, void 0, void 0, function () {
793 var BuildInfo, request;
794 return tslib.__generator(this, function (_a) {
795 switch (_a.label) {
796 case 0:
797 BuildInfo = _cordovaWindow().BuildInfo;
798 request = {};
799 if (index._isIOS()) {
800 request.iosBundleId = BuildInfo.packageName;
801 }
802 else if (index._isAndroid()) {
803 request.androidPackageName = BuildInfo.packageName;
804 }
805 else {
806 index._fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
807 }
808 // Will fail automatically if package name is not authorized
809 return [4 /*yield*/, _getProjectConfig(auth, request)];
810 case 1:
811 // Will fail automatically if package name is not authorized
812 _a.sent();
813 return [2 /*return*/];
814 }
815 });
816 });
817}
818function _performRedirect(handlerUrl) {
819 // Get the cordova plugins
820 var cordova = _cordovaWindow().cordova;
821 return new Promise(function (resolve) {
822 cordova.plugins.browsertab.isAvailable(function (browserTabIsAvailable) {
823 var iabRef = null;
824 if (browserTabIsAvailable) {
825 cordova.plugins.browsertab.openUrl(handlerUrl);
826 }
827 else {
828 // TODO: Return the inappbrowser ref that's returned from the open call
829 iabRef = cordova.InAppBrowser.open(handlerUrl, index._isIOS7Or8() ? '_blank' : '_system', 'location=yes');
830 }
831 resolve(iabRef);
832 });
833 });
834}
835/**
836 * This function waits for app activity to be seen before resolving. It does
837 * this by attaching listeners to various dom events. Once the app is determined
838 * to be visible, this promise resolves. AFTER that resolution, the listeners
839 * are detached and any browser tabs left open will be closed.
840 */
841function _waitForAppResume(auth, eventListener, iabRef) {
842 return tslib.__awaiter(this, void 0, void 0, function () {
843 var cordova, cleanup;
844 return tslib.__generator(this, function (_a) {
845 switch (_a.label) {
846 case 0:
847 cordova = _cordovaWindow().cordova;
848 cleanup = function () { };
849 _a.label = 1;
850 case 1:
851 _a.trys.push([1, , 3, 4]);
852 return [4 /*yield*/, new Promise(function (resolve, reject) {
853 var onCloseTimer = null;
854 // DEFINE ALL THE CALLBACKS =====
855 function authEventSeen() {
856 var _a;
857 // Auth event was detected. Resolve this promise and close the extra
858 // window if it's still open.
859 resolve();
860 var closeBrowserTab = (_a = cordova.plugins.browsertab) === null || _a === void 0 ? void 0 : _a.close;
861 if (typeof closeBrowserTab === 'function') {
862 closeBrowserTab();
863 }
864 // Close inappbrowser emebedded webview in iOS7 and 8 case if still
865 // open.
866 if (typeof (iabRef === null || iabRef === void 0 ? void 0 : iabRef.close) === 'function') {
867 iabRef.close();
868 }
869 }
870 function resumed() {
871 if (onCloseTimer) {
872 // This code already ran; do not rerun.
873 return;
874 }
875 onCloseTimer = window.setTimeout(function () {
876 // Wait two seeconds after resume then reject.
877 reject(index._createError(auth, "redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */));
878 }, REDIRECT_TIMEOUT_MS);
879 }
880 function visibilityChanged() {
881 if ((document === null || document === void 0 ? void 0 : document.visibilityState) === 'visible') {
882 resumed();
883 }
884 }
885 // ATTACH ALL THE LISTENERS =====
886 // Listen for the auth event
887 eventListener.addPassiveListener(authEventSeen);
888 // Listen for resume and visibility events
889 document.addEventListener('resume', resumed, false);
890 if (index._isAndroid()) {
891 document.addEventListener('visibilitychange', visibilityChanged, false);
892 }
893 // SETUP THE CLEANUP FUNCTION =====
894 cleanup = function () {
895 eventListener.removePassiveListener(authEventSeen);
896 document.removeEventListener('resume', resumed, false);
897 document.removeEventListener('visibilitychange', visibilityChanged, false);
898 if (onCloseTimer) {
899 window.clearTimeout(onCloseTimer);
900 }
901 };
902 })];
903 case 2:
904 _a.sent();
905 return [3 /*break*/, 4];
906 case 3:
907 cleanup();
908 return [7 /*endfinally*/];
909 case 4: return [2 /*return*/];
910 }
911 });
912 });
913}
914/**
915 * Checks the configuration of the Cordova environment. This has no side effect
916 * if the configuration is correct; otherwise it throws an error with the
917 * missing plugin.
918 */
919function _checkCordovaConfiguration(auth) {
920 var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
921 var win = _cordovaWindow();
922 // Check all dependencies installed.
923 // https://github.com/nordnet/cordova-universal-links-plugin
924 // Note that cordova-universal-links-plugin has been abandoned.
925 // A fork with latest fixes is available at:
926 // https://www.npmjs.com/package/cordova-universal-links-plugin-fix
927 index._assert(typeof ((_a = win === null || win === void 0 ? void 0 : win.universalLinks) === null || _a === void 0 ? void 0 : _a.subscribe) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
928 missingPlugin: 'cordova-universal-links-plugin-fix'
929 });
930 // https://www.npmjs.com/package/cordova-plugin-buildinfo
931 index._assert(typeof ((_b = win === null || win === void 0 ? void 0 : win.BuildInfo) === null || _b === void 0 ? void 0 : _b.packageName) !== 'undefined', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
932 missingPlugin: 'cordova-plugin-buildInfo'
933 });
934 // https://github.com/google/cordova-plugin-browsertab
935 index._assert(typeof ((_e = (_d = (_c = win === null || win === void 0 ? void 0 : win.cordova) === null || _c === void 0 ? void 0 : _c.plugins) === null || _d === void 0 ? void 0 : _d.browsertab) === null || _e === void 0 ? void 0 : _e.openUrl) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
936 missingPlugin: 'cordova-plugin-browsertab'
937 });
938 index._assert(typeof ((_h = (_g = (_f = win === null || win === void 0 ? void 0 : win.cordova) === null || _f === void 0 ? void 0 : _f.plugins) === null || _g === void 0 ? void 0 : _g.browsertab) === null || _h === void 0 ? void 0 : _h.isAvailable) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
939 missingPlugin: 'cordova-plugin-browsertab'
940 });
941 // https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
942 index._assert(typeof ((_k = (_j = win === null || win === void 0 ? void 0 : win.cordova) === null || _j === void 0 ? void 0 : _j.InAppBrowser) === null || _k === void 0 ? void 0 : _k.open) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
943 missingPlugin: 'cordova-plugin-inappbrowser'
944 });
945}
946/**
947 * Computes the SHA-256 of a session ID. The SubtleCrypto interface is only
948 * available in "secure" contexts, which covers Cordova (which is served on a file
949 * protocol).
950 */
951function computeSha256(sessionId) {
952 return tslib.__awaiter(this, void 0, void 0, function () {
953 var bytes, buf, arr;
954 return tslib.__generator(this, function (_a) {
955 switch (_a.label) {
956 case 0:
957 bytes = stringToArrayBuffer(sessionId);
958 return [4 /*yield*/, crypto.subtle.digest('SHA-256', bytes)];
959 case 1:
960 buf = _a.sent();
961 arr = Array.from(new Uint8Array(buf));
962 return [2 /*return*/, arr.map(function (num) { return num.toString(16).padStart(2, '0'); }).join('')];
963 }
964 });
965 });
966}
967function stringToArrayBuffer(str) {
968 // This function is only meant to deal with an ASCII charset and makes
969 // certain simplifying assumptions.
970 index.debugAssert(/[0-9a-zA-Z]+/.test(str), 'Can only convert alpha-numeric strings');
971 if (typeof TextEncoder !== 'undefined') {
972 return new TextEncoder().encode(str);
973 }
974 var buff = new ArrayBuffer(str.length);
975 var view = new Uint8Array(buff);
976 for (var i = 0; i < str.length; i++) {
977 view[i] = str.charCodeAt(i);
978 }
979 return view;
980}
981
982/**
983 * @license
984 * Copyright 2020 Google LLC
985 *
986 * Licensed under the Apache License, Version 2.0 (the "License");
987 * you may not use this file except in compliance with the License.
988 * You may obtain a copy of the License at
989 *
990 * http://www.apache.org/licenses/LICENSE-2.0
991 *
992 * Unless required by applicable law or agreed to in writing, software
993 * distributed under the License is distributed on an "AS IS" BASIS,
994 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
995 * See the License for the specific language governing permissions and
996 * limitations under the License.
997 */
998// The amount of time to store the UIDs of seen events; this is
999// set to 10 min by default
1000var EVENT_DUPLICATION_CACHE_DURATION_MS = 10 * 60 * 1000;
1001var AuthEventManager = /** @class */ (function () {
1002 function AuthEventManager(auth) {
1003 this.auth = auth;
1004 this.cachedEventUids = new Set();
1005 this.consumers = new Set();
1006 this.queuedRedirectEvent = null;
1007 this.hasHandledPotentialRedirect = false;
1008 this.lastProcessedEventTime = Date.now();
1009 }
1010 AuthEventManager.prototype.registerConsumer = function (authEventConsumer) {
1011 this.consumers.add(authEventConsumer);
1012 if (this.queuedRedirectEvent &&
1013 this.isEventForConsumer(this.queuedRedirectEvent, authEventConsumer)) {
1014 this.sendToConsumer(this.queuedRedirectEvent, authEventConsumer);
1015 this.saveEventToCache(this.queuedRedirectEvent);
1016 this.queuedRedirectEvent = null;
1017 }
1018 };
1019 AuthEventManager.prototype.unregisterConsumer = function (authEventConsumer) {
1020 this.consumers.delete(authEventConsumer);
1021 };
1022 AuthEventManager.prototype.onEvent = function (event) {
1023 var _this = this;
1024 // Check if the event has already been handled
1025 if (this.hasEventBeenHandled(event)) {
1026 return false;
1027 }
1028 var handled = false;
1029 this.consumers.forEach(function (consumer) {
1030 if (_this.isEventForConsumer(event, consumer)) {
1031 handled = true;
1032 _this.sendToConsumer(event, consumer);
1033 _this.saveEventToCache(event);
1034 }
1035 });
1036 if (this.hasHandledPotentialRedirect || !isRedirectEvent(event)) {
1037 // If we've already seen a redirect before, or this is a popup event,
1038 // bail now
1039 return handled;
1040 }
1041 this.hasHandledPotentialRedirect = true;
1042 // If the redirect wasn't handled, hang on to it
1043 if (!handled) {
1044 this.queuedRedirectEvent = event;
1045 handled = true;
1046 }
1047 return handled;
1048 };
1049 AuthEventManager.prototype.sendToConsumer = function (event, consumer) {
1050 var _a;
1051 if (event.error && !isNullRedirectEvent(event)) {
1052 var code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) ||
1053 "internal-error" /* INTERNAL_ERROR */;
1054 consumer.onError(index._createError(this.auth, code));
1055 }
1056 else {
1057 consumer.onAuthEvent(event);
1058 }
1059 };
1060 AuthEventManager.prototype.isEventForConsumer = function (event, consumer) {
1061 var eventIdMatches = consumer.eventId === null ||
1062 (!!event.eventId && event.eventId === consumer.eventId);
1063 return consumer.filter.includes(event.type) && eventIdMatches;
1064 };
1065 AuthEventManager.prototype.hasEventBeenHandled = function (event) {
1066 if (Date.now() - this.lastProcessedEventTime >=
1067 EVENT_DUPLICATION_CACHE_DURATION_MS) {
1068 this.cachedEventUids.clear();
1069 }
1070 return this.cachedEventUids.has(eventUid(event));
1071 };
1072 AuthEventManager.prototype.saveEventToCache = function (event) {
1073 this.cachedEventUids.add(eventUid(event));
1074 this.lastProcessedEventTime = Date.now();
1075 };
1076 return AuthEventManager;
1077}());
1078function eventUid(e) {
1079 return [e.type, e.eventId, e.sessionId, e.tenantId].filter(function (v) { return v; }).join('-');
1080}
1081function isNullRedirectEvent(_a) {
1082 var type = _a.type, error = _a.error;
1083 return (type === "unknown" /* UNKNOWN */ &&
1084 (error === null || error === void 0 ? void 0 : error.code) === "auth/" + "no-auth-event" /* NO_AUTH_EVENT */);
1085}
1086function isRedirectEvent(event) {
1087 switch (event.type) {
1088 case "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */:
1089 case "linkViaRedirect" /* LINK_VIA_REDIRECT */:
1090 case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
1091 return true;
1092 case "unknown" /* UNKNOWN */:
1093 return isNullRedirectEvent(event);
1094 default:
1095 return false;
1096 }
1097}
1098
1099/**
1100 * @license
1101 * Copyright 2020 Google LLC
1102 *
1103 * Licensed under the Apache License, Version 2.0 (the "License");
1104 * you may not use this file except in compliance with the License.
1105 * You may obtain a copy of the License at
1106 *
1107 * http://www.apache.org/licenses/LICENSE-2.0
1108 *
1109 * Unless required by applicable law or agreed to in writing, software
1110 * distributed under the License is distributed on an "AS IS" BASIS,
1111 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1112 * See the License for the specific language governing permissions and
1113 * limitations under the License.
1114 */
1115function _iframeCannotSyncWebStorage() {
1116 var ua = util.getUA();
1117 return index._isSafari(ua) || index._isIOS(ua);
1118}
1119// The polling period in case events are not supported
1120var _POLLING_INTERVAL_MS = 1000;
1121// The IE 10 localStorage cross tab synchronization delay in milliseconds
1122var IE10_LOCAL_STORAGE_SYNC_DELAY = 10;
1123var BrowserLocalPersistence = /** @class */ (function (_super) {
1124 tslib.__extends(BrowserLocalPersistence, _super);
1125 function BrowserLocalPersistence() {
1126 var _this = _super.call(this, function () { return window.localStorage; }, "LOCAL" /* LOCAL */) || this;
1127 _this.boundEventHandler = function (event, poll) { return _this.onStorageEvent(event, poll); };
1128 _this.listeners = {};
1129 _this.localCache = {};
1130 // setTimeout return value is platform specific
1131 // eslint-disable-next-line @typescript-eslint/no-explicit-any
1132 _this.pollTimer = null;
1133 // Safari or iOS browser and embedded in an iframe.
1134 _this.safariLocalStorageNotSynced = _iframeCannotSyncWebStorage() && index._isIframe();
1135 // Whether to use polling instead of depending on window events
1136 _this.fallbackToPolling = index._isMobileBrowser();
1137 _this._shouldAllowMigration = true;
1138 return _this;
1139 }
1140 BrowserLocalPersistence.prototype.forAllChangedKeys = function (cb) {
1141 // Check all keys with listeners on them.
1142 for (var _i = 0, _a = Object.keys(this.listeners); _i < _a.length; _i++) {
1143 var key = _a[_i];
1144 // Get value from localStorage.
1145 var newValue = this.storage.getItem(key);
1146 var oldValue = this.localCache[key];
1147 // If local map value does not match, trigger listener with storage event.
1148 // Differentiate this simulated event from the real storage event.
1149 if (newValue !== oldValue) {
1150 cb(key, oldValue, newValue);
1151 }
1152 }
1153 };
1154 BrowserLocalPersistence.prototype.onStorageEvent = function (event, poll) {
1155 var _this = this;
1156 if (poll === void 0) { poll = false; }
1157 // Key would be null in some situations, like when localStorage is cleared
1158 if (!event.key) {
1159 this.forAllChangedKeys(function (key, _oldValue, newValue) {
1160 _this.notifyListeners(key, newValue);
1161 });
1162 return;
1163 }
1164 var key = event.key;
1165 // Check the mechanism how this event was detected.
1166 // The first event will dictate the mechanism to be used.
1167 if (poll) {
1168 // Environment detects storage changes via polling.
1169 // Remove storage event listener to prevent possible event duplication.
1170 this.detachListener();
1171 }
1172 else {
1173 // Environment detects storage changes via storage event listener.
1174 // Remove polling listener to prevent possible event duplication.
1175 this.stopPolling();
1176 }
1177 // Safari embedded iframe. Storage event will trigger with the delta
1178 // changes but no changes will be applied to the iframe localStorage.
1179 if (this.safariLocalStorageNotSynced) {
1180 // Get current iframe page value.
1181 var storedValue_1 = this.storage.getItem(key);
1182 // Value not synchronized, synchronize manually.
1183 if (event.newValue !== storedValue_1) {
1184 if (event.newValue !== null) {
1185 // Value changed from current value.
1186 this.storage.setItem(key, event.newValue);
1187 }
1188 else {
1189 // Current value deleted.
1190 this.storage.removeItem(key);
1191 }
1192 }
1193 else if (this.localCache[key] === event.newValue && !poll) {
1194 // Already detected and processed, do not trigger listeners again.
1195 return;
1196 }
1197 }
1198 var triggerListeners = function () {
1199 // Keep local map up to date in case storage event is triggered before
1200 // poll.
1201 var storedValue = _this.storage.getItem(key);
1202 if (!poll && _this.localCache[key] === storedValue) {
1203 // Real storage event which has already been detected, do nothing.
1204 // This seems to trigger in some IE browsers for some reason.
1205 return;
1206 }
1207 _this.notifyListeners(key, storedValue);
1208 };
1209 var storedValue = this.storage.getItem(key);
1210 if (index._isIE10() &&
1211 storedValue !== event.newValue &&
1212 event.newValue !== event.oldValue) {
1213 // IE 10 has this weird bug where a storage event would trigger with the
1214 // correct key, oldValue and newValue but localStorage.getItem(key) does
1215 // not yield the updated value until a few milliseconds. This ensures
1216 // this recovers from that situation.
1217 setTimeout(triggerListeners, IE10_LOCAL_STORAGE_SYNC_DELAY);
1218 }
1219 else {
1220 triggerListeners();
1221 }
1222 };
1223 BrowserLocalPersistence.prototype.notifyListeners = function (key, value) {
1224 this.localCache[key] = value;
1225 var listeners = this.listeners[key];
1226 if (listeners) {
1227 for (var _i = 0, _a = Array.from(listeners); _i < _a.length; _i++) {
1228 var listener = _a[_i];
1229 listener(value ? JSON.parse(value) : value);
1230 }
1231 }
1232 };
1233 BrowserLocalPersistence.prototype.startPolling = function () {
1234 var _this = this;
1235 this.stopPolling();
1236 this.pollTimer = setInterval(function () {
1237 _this.forAllChangedKeys(function (key, oldValue, newValue) {
1238 _this.onStorageEvent(new StorageEvent('storage', {
1239 key: key,
1240 oldValue: oldValue,
1241 newValue: newValue
1242 }),
1243 /* poll */ true);
1244 });
1245 }, _POLLING_INTERVAL_MS);
1246 };
1247 BrowserLocalPersistence.prototype.stopPolling = function () {
1248 if (this.pollTimer) {
1249 clearInterval(this.pollTimer);
1250 this.pollTimer = null;
1251 }
1252 };
1253 BrowserLocalPersistence.prototype.attachListener = function () {
1254 window.addEventListener('storage', this.boundEventHandler);
1255 };
1256 BrowserLocalPersistence.prototype.detachListener = function () {
1257 window.removeEventListener('storage', this.boundEventHandler);
1258 };
1259 BrowserLocalPersistence.prototype._addListener = function (key, listener) {
1260 if (Object.keys(this.listeners).length === 0) {
1261 // Whether browser can detect storage event when it had already been pushed to the background.
1262 // This may happen in some mobile browsers. A localStorage change in the foreground window
1263 // will not be detected in the background window via the storage event.
1264 // This was detected in iOS 7.x mobile browsers
1265 if (this.fallbackToPolling) {
1266 this.startPolling();
1267 }
1268 else {
1269 this.attachListener();
1270 }
1271 }
1272 if (!this.listeners[key]) {
1273 this.listeners[key] = new Set();
1274 // Populate the cache to avoid spuriously triggering on first poll.
1275 this.localCache[key] = this.storage.getItem(key);
1276 }
1277 this.listeners[key].add(listener);
1278 };
1279 BrowserLocalPersistence.prototype._removeListener = function (key, listener) {
1280 if (this.listeners[key]) {
1281 this.listeners[key].delete(listener);
1282 if (this.listeners[key].size === 0) {
1283 delete this.listeners[key];
1284 }
1285 }
1286 if (Object.keys(this.listeners).length === 0) {
1287 this.detachListener();
1288 this.stopPolling();
1289 }
1290 };
1291 // Update local cache on base operations:
1292 BrowserLocalPersistence.prototype._set = function (key, value) {
1293 return tslib.__awaiter(this, void 0, void 0, function () {
1294 return tslib.__generator(this, function (_a) {
1295 switch (_a.label) {
1296 case 0: return [4 /*yield*/, _super.prototype._set.call(this, key, value)];
1297 case 1:
1298 _a.sent();
1299 this.localCache[key] = JSON.stringify(value);
1300 return [2 /*return*/];
1301 }
1302 });
1303 });
1304 };
1305 BrowserLocalPersistence.prototype._get = function (key) {
1306 return tslib.__awaiter(this, void 0, void 0, function () {
1307 var value;
1308 return tslib.__generator(this, function (_a) {
1309 switch (_a.label) {
1310 case 0: return [4 /*yield*/, _super.prototype._get.call(this, key)];
1311 case 1:
1312 value = _a.sent();
1313 this.localCache[key] = JSON.stringify(value);
1314 return [2 /*return*/, value];
1315 }
1316 });
1317 });
1318 };
1319 BrowserLocalPersistence.prototype._remove = function (key) {
1320 return tslib.__awaiter(this, void 0, void 0, function () {
1321 return tslib.__generator(this, function (_a) {
1322 switch (_a.label) {
1323 case 0: return [4 /*yield*/, _super.prototype._remove.call(this, key)];
1324 case 1:
1325 _a.sent();
1326 delete this.localCache[key];
1327 return [2 /*return*/];
1328 }
1329 });
1330 });
1331 };
1332 BrowserLocalPersistence.type = 'LOCAL';
1333 return BrowserLocalPersistence;
1334}(BrowserPersistenceClass));
1335/**
1336 * An implementation of {@link Persistence} of type `LOCAL` using `localStorage`
1337 * for the underlying storage.
1338 *
1339 * @public
1340 */
1341var browserLocalPersistence = BrowserLocalPersistence;
1342
1343/**
1344 * @license
1345 * Copyright 2020 Google LLC
1346 *
1347 * Licensed under the Apache License, Version 2.0 (the "License");
1348 * you may not use this file except in compliance with the License.
1349 * You may obtain a copy of the License at
1350 *
1351 * http://www.apache.org/licenses/LICENSE-2.0
1352 *
1353 * Unless required by applicable law or agreed to in writing, software
1354 * distributed under the License is distributed on an "AS IS" BASIS,
1355 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1356 * See the License for the specific language governing permissions and
1357 * limitations under the License.
1358 */
1359var SESSION_ID_LENGTH = 20;
1360/** Custom AuthEventManager that adds passive listeners to events */
1361var CordovaAuthEventManager = /** @class */ (function (_super) {
1362 tslib.__extends(CordovaAuthEventManager, _super);
1363 function CordovaAuthEventManager() {
1364 var _this = _super !== null && _super.apply(this, arguments) || this;
1365 _this.passiveListeners = new Set();
1366 _this.initPromise = new Promise(function (resolve) {
1367 _this.resolveInialized = resolve;
1368 });
1369 return _this;
1370 }
1371 CordovaAuthEventManager.prototype.addPassiveListener = function (cb) {
1372 this.passiveListeners.add(cb);
1373 };
1374 CordovaAuthEventManager.prototype.removePassiveListener = function (cb) {
1375 this.passiveListeners.delete(cb);
1376 };
1377 // In a Cordova environment, this manager can live through multiple redirect
1378 // operations
1379 CordovaAuthEventManager.prototype.resetRedirect = function () {
1380 this.queuedRedirectEvent = null;
1381 this.hasHandledPotentialRedirect = false;
1382 };
1383 /** Override the onEvent method */
1384 CordovaAuthEventManager.prototype.onEvent = function (event) {
1385 this.resolveInialized();
1386 this.passiveListeners.forEach(function (cb) { return cb(event); });
1387 return _super.prototype.onEvent.call(this, event);
1388 };
1389 CordovaAuthEventManager.prototype.initialized = function () {
1390 return tslib.__awaiter(this, void 0, void 0, function () {
1391 return tslib.__generator(this, function (_a) {
1392 switch (_a.label) {
1393 case 0: return [4 /*yield*/, this.initPromise];
1394 case 1:
1395 _a.sent();
1396 return [2 /*return*/];
1397 }
1398 });
1399 });
1400 };
1401 return CordovaAuthEventManager;
1402}(AuthEventManager));
1403/**
1404 * Generates a (partial) {@link AuthEvent}.
1405 */
1406function _generateNewEvent(auth, type, eventId) {
1407 if (eventId === void 0) { eventId = null; }
1408 return {
1409 type: type,
1410 eventId: eventId,
1411 urlResponse: null,
1412 sessionId: generateSessionId(),
1413 postBody: null,
1414 tenantId: auth.tenantId,
1415 error: index._createError(auth, "no-auth-event" /* NO_AUTH_EVENT */)
1416 };
1417}
1418function _savePartialEvent(auth, event) {
1419 return storage()._set(persistenceKey(auth), event);
1420}
1421function _getAndRemoveEvent(auth) {
1422 return tslib.__awaiter(this, void 0, void 0, function () {
1423 var event;
1424 return tslib.__generator(this, function (_a) {
1425 switch (_a.label) {
1426 case 0: return [4 /*yield*/, storage()._get(persistenceKey(auth))];
1427 case 1:
1428 event = (_a.sent());
1429 if (!event) return [3 /*break*/, 3];
1430 return [4 /*yield*/, storage()._remove(persistenceKey(auth))];
1431 case 2:
1432 _a.sent();
1433 _a.label = 3;
1434 case 3: return [2 /*return*/, event];
1435 }
1436 });
1437 });
1438}
1439function _eventFromPartialAndUrl(partialEvent, url) {
1440 var _a, _b;
1441 // Parse the deep link within the dynamic link URL.
1442 var callbackUrl = _getDeepLinkFromCallback(url);
1443 // Confirm it is actually a callback URL.
1444 // Currently the universal link will be of this format:
1445 // https://<AUTH_DOMAIN>/__/auth/callback<OAUTH_RESPONSE>
1446 // This is a fake URL but is not intended to take the user anywhere
1447 // and just redirect to the app.
1448 if (callbackUrl.includes('/__/auth/callback')) {
1449 // Check if there is an error in the URL.
1450 // This mechanism is also used to pass errors back to the app:
1451 // https://<AUTH_DOMAIN>/__/auth/callback?firebaseError=<STRINGIFIED_ERROR>
1452 var params = searchParamsOrEmpty(callbackUrl);
1453 // Get the error object corresponding to the stringified error if found.
1454 var errorObject = params['firebaseError']
1455 ? parseJsonOrNull(decodeURIComponent(params['firebaseError']))
1456 : null;
1457 var code = (_b = (_a = errorObject === null || errorObject === void 0 ? void 0 : errorObject['code']) === null || _a === void 0 ? void 0 : _a.split('auth/')) === null || _b === void 0 ? void 0 : _b[1];
1458 var error = code ? index._createError(code) : null;
1459 if (error) {
1460 return {
1461 type: partialEvent.type,
1462 eventId: partialEvent.eventId,
1463 tenantId: partialEvent.tenantId,
1464 error: error,
1465 urlResponse: null,
1466 sessionId: null,
1467 postBody: null
1468 };
1469 }
1470 else {
1471 return {
1472 type: partialEvent.type,
1473 eventId: partialEvent.eventId,
1474 tenantId: partialEvent.tenantId,
1475 sessionId: partialEvent.sessionId,
1476 urlResponse: callbackUrl,
1477 postBody: null
1478 };
1479 }
1480 }
1481 return null;
1482}
1483function generateSessionId() {
1484 var chars = [];
1485 var allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
1486 for (var i = 0; i < SESSION_ID_LENGTH; i++) {
1487 var idx = Math.floor(Math.random() * allowedChars.length);
1488 chars.push(allowedChars.charAt(idx));
1489 }
1490 return chars.join('');
1491}
1492function storage() {
1493 return index._getInstance(browserLocalPersistence);
1494}
1495function persistenceKey(auth) {
1496 return index._persistenceKeyName("authEvent" /* AUTH_EVENT */, auth.config.apiKey, auth.name);
1497}
1498function parseJsonOrNull(json) {
1499 try {
1500 return JSON.parse(json);
1501 }
1502 catch (e) {
1503 return null;
1504 }
1505}
1506// Exported for testing
1507function _getDeepLinkFromCallback(url) {
1508 var params = searchParamsOrEmpty(url);
1509 var link = params['link'] ? decodeURIComponent(params['link']) : undefined;
1510 // Double link case (automatic redirect)
1511 var doubleDeepLink = searchParamsOrEmpty(link)['link'];
1512 // iOS custom scheme links.
1513 var iOSDeepLink = params['deep_link_id']
1514 ? decodeURIComponent(params['deep_link_id'])
1515 : undefined;
1516 var iOSDoubleDeepLink = searchParamsOrEmpty(iOSDeepLink)['link'];
1517 return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;
1518}
1519/**
1520 * Optimistically tries to get search params from a string, or else returns an
1521 * empty search params object.
1522 */
1523function searchParamsOrEmpty(url) {
1524 if (!(url === null || url === void 0 ? void 0 : url.includes('?'))) {
1525 return {};
1526 }
1527 var _a = url.split('?'); _a[0]; var rest = _a.slice(1);
1528 return util.querystringDecode(rest.join('?'));
1529}
1530
1531/**
1532 * @license
1533 * Copyright 2021 Google LLC
1534 *
1535 * Licensed under the Apache License, Version 2.0 (the "License");
1536 * you may not use this file except in compliance with the License.
1537 * You may obtain a copy of the License at
1538 *
1539 * http://www.apache.org/licenses/LICENSE-2.0
1540 *
1541 * Unless required by applicable law or agreed to in writing, software
1542 * distributed under the License is distributed on an "AS IS" BASIS,
1543 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1544 * See the License for the specific language governing permissions and
1545 * limitations under the License.
1546 */
1547/**
1548 * How long to wait for the initial auth event before concluding no
1549 * redirect pending
1550 */
1551var INITIAL_EVENT_TIMEOUT_MS = 500;
1552var CordovaPopupRedirectResolver = /** @class */ (function () {
1553 function CordovaPopupRedirectResolver() {
1554 this._redirectPersistence = browserSessionPersistence;
1555 this._shouldInitProactively = true; // This is lightweight for Cordova
1556 this.eventManagers = new Map();
1557 this.originValidationPromises = {};
1558 this._completeRedirectFn = _getRedirectResult;
1559 this._overrideRedirectResult = _overrideRedirectResult;
1560 }
1561 CordovaPopupRedirectResolver.prototype._initialize = function (auth) {
1562 return tslib.__awaiter(this, void 0, void 0, function () {
1563 var key, manager;
1564 return tslib.__generator(this, function (_a) {
1565 key = auth._key();
1566 manager = this.eventManagers.get(key);
1567 if (!manager) {
1568 manager = new CordovaAuthEventManager(auth);
1569 this.eventManagers.set(key, manager);
1570 this.attachCallbackListeners(auth, manager);
1571 }
1572 return [2 /*return*/, manager];
1573 });
1574 });
1575 };
1576 CordovaPopupRedirectResolver.prototype._openPopup = function (auth) {
1577 index._fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
1578 };
1579 CordovaPopupRedirectResolver.prototype._openRedirect = function (auth, provider, authType, eventId) {
1580 return tslib.__awaiter(this, void 0, void 0, function () {
1581 var manager, event, url, iabRef;
1582 return tslib.__generator(this, function (_a) {
1583 switch (_a.label) {
1584 case 0:
1585 _checkCordovaConfiguration(auth);
1586 return [4 /*yield*/, this._initialize(auth)];
1587 case 1:
1588 manager = _a.sent();
1589 return [4 /*yield*/, manager.initialized()];
1590 case 2:
1591 _a.sent();
1592 // Reset the persisted redirect states. This does not matter on Web where
1593 // the redirect always blows away application state entirely. On Cordova,
1594 // the app maintains control flow through the redirect.
1595 manager.resetRedirect();
1596 _clearRedirectOutcomes();
1597 return [4 /*yield*/, this._originValidation(auth)];
1598 case 3:
1599 _a.sent();
1600 event = _generateNewEvent(auth, authType, eventId);
1601 return [4 /*yield*/, _savePartialEvent(auth, event)];
1602 case 4:
1603 _a.sent();
1604 return [4 /*yield*/, _generateHandlerUrl(auth, event, provider)];
1605 case 5:
1606 url = _a.sent();
1607 return [4 /*yield*/, _performRedirect(url)];
1608 case 6:
1609 iabRef = _a.sent();
1610 return [2 /*return*/, _waitForAppResume(auth, manager, iabRef)];
1611 }
1612 });
1613 });
1614 };
1615 CordovaPopupRedirectResolver.prototype._isIframeWebStorageSupported = function (_auth, _cb) {
1616 throw new Error('Method not implemented.');
1617 };
1618 CordovaPopupRedirectResolver.prototype._originValidation = function (auth) {
1619 var key = auth._key();
1620 if (!this.originValidationPromises[key]) {
1621 this.originValidationPromises[key] = _validateOrigin(auth);
1622 }
1623 return this.originValidationPromises[key];
1624 };
1625 CordovaPopupRedirectResolver.prototype.attachCallbackListeners = function (auth, manager) {
1626 var _this = this;
1627 // Get the global plugins
1628 var _a = _cordovaWindow(), universalLinks = _a.universalLinks, handleOpenURL = _a.handleOpenURL, BuildInfo = _a.BuildInfo;
1629 var noEventTimeout = setTimeout(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
1630 return tslib.__generator(this, function (_a) {
1631 switch (_a.label) {
1632 case 0:
1633 // We didn't see that initial event. Clear any pending object and
1634 // dispatch no event
1635 return [4 /*yield*/, _getAndRemoveEvent(auth)];
1636 case 1:
1637 // We didn't see that initial event. Clear any pending object and
1638 // dispatch no event
1639 _a.sent();
1640 manager.onEvent(generateNoEvent());
1641 return [2 /*return*/];
1642 }
1643 });
1644 }); }, INITIAL_EVENT_TIMEOUT_MS);
1645 var universalLinksCb = function (eventData) { return tslib.__awaiter(_this, void 0, void 0, function () {
1646 var partialEvent, finalEvent;
1647 return tslib.__generator(this, function (_a) {
1648 switch (_a.label) {
1649 case 0:
1650 // We have an event so we can clear the no event timeout
1651 clearTimeout(noEventTimeout);
1652 return [4 /*yield*/, _getAndRemoveEvent(auth)];
1653 case 1:
1654 partialEvent = _a.sent();
1655 finalEvent = null;
1656 if (partialEvent && (eventData === null || eventData === void 0 ? void 0 : eventData['url'])) {
1657 finalEvent = _eventFromPartialAndUrl(partialEvent, eventData['url']);
1658 }
1659 // If finalEvent is never filled, trigger with no event
1660 manager.onEvent(finalEvent || generateNoEvent());
1661 return [2 /*return*/];
1662 }
1663 });
1664 }); };
1665 // Universal links subscriber doesn't exist for iOS, so we need to check
1666 if (typeof universalLinks !== 'undefined' &&
1667 typeof universalLinks.subscribe === 'function') {
1668 universalLinks.subscribe(null, universalLinksCb);
1669 }
1670 // iOS 7 or 8 custom URL schemes.
1671 // This is also the current default behavior for iOS 9+.
1672 // For this to work, cordova-plugin-customurlscheme needs to be installed.
1673 // https://github.com/EddyVerbruggen/Custom-URL-scheme
1674 // Do not overwrite the existing developer's URL handler.
1675 var existingHandleOpenURL = handleOpenURL;
1676 var packagePrefix = BuildInfo.packageName.toLowerCase() + "://";
1677 _cordovaWindow().handleOpenURL = function (url) { return tslib.__awaiter(_this, void 0, void 0, function () {
1678 return tslib.__generator(this, function (_a) {
1679 if (url.toLowerCase().startsWith(packagePrefix)) {
1680 // We want this intentionally to float
1681 // eslint-disable-next-line @typescript-eslint/no-floating-promises
1682 universalLinksCb({ url: url });
1683 }
1684 // Call the developer's handler if it is present.
1685 if (typeof existingHandleOpenURL === 'function') {
1686 try {
1687 existingHandleOpenURL(url);
1688 }
1689 catch (e) {
1690 // This is a developer error. Don't stop the flow of the SDK.
1691 console.error(e);
1692 }
1693 }
1694 return [2 /*return*/];
1695 });
1696 }); };
1697 };
1698 return CordovaPopupRedirectResolver;
1699}());
1700/**
1701 * An implementation of {@link PopupRedirectResolver} suitable for Cordova
1702 * based applications.
1703 *
1704 * @public
1705 */
1706var cordovaPopupRedirectResolver = CordovaPopupRedirectResolver;
1707function generateNoEvent() {
1708 return {
1709 type: "unknown" /* UNKNOWN */,
1710 eventId: null,
1711 sessionId: null,
1712 urlResponse: null,
1713 postBody: null,
1714 tenantId: null,
1715 error: index._createError("no-auth-event" /* NO_AUTH_EVENT */)
1716 };
1717}
1718
1719/**
1720 * @license
1721 * Copyright 2017 Google LLC
1722 *
1723 * Licensed under the Apache License, Version 2.0 (the "License");
1724 * you may not use this file except in compliance with the License.
1725 * You may obtain a copy of the License at
1726 *
1727 * http://www.apache.org/licenses/LICENSE-2.0
1728 *
1729 * Unless required by applicable law or agreed to in writing, software
1730 * distributed under the License is distributed on an "AS IS" BASIS,
1731 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1732 * See the License for the specific language governing permissions and
1733 * limitations under the License.
1734 */
1735// This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage.
1736// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it out
1737// of autogenerated documentation pages to reduce accidental misuse.
1738function addFrameworkForLogging(auth, framework) {
1739 index._castAuth(auth)._logFramework(framework);
1740}
1741
1742exports.ActionCodeOperation = index.ActionCodeOperation;
1743exports.ActionCodeURL = index.ActionCodeURL;
1744exports.AuthCredential = index.AuthCredential;
1745exports.AuthErrorCodes = index.AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY;
1746exports.AuthImpl = index.AuthImpl;
1747exports.EmailAuthCredential = index.EmailAuthCredential;
1748exports.EmailAuthProvider = index.EmailAuthProvider;
1749exports.FacebookAuthProvider = index.FacebookAuthProvider;
1750exports.FactorId = index.FactorId;
1751exports.FetchProvider = index.FetchProvider;
1752exports.GithubAuthProvider = index.GithubAuthProvider;
1753exports.GoogleAuthProvider = index.GoogleAuthProvider;
1754exports.OAuthCredential = index.OAuthCredential;
1755exports.OAuthProvider = index.OAuthProvider;
1756exports.OperationType = index.OperationType;
1757exports.PhoneAuthCredential = index.PhoneAuthCredential;
1758exports.PhoneAuthProvider = index.PhoneAuthProvider;
1759exports.PhoneMultiFactorGenerator = index.PhoneMultiFactorGenerator;
1760exports.ProviderId = index.ProviderId;
1761exports.RecaptchaVerifier = index.RecaptchaVerifier;
1762exports.SAMLAuthCredential = index.SAMLAuthCredential;
1763exports.SAMLAuthProvider = index.SAMLAuthProvider;
1764exports.SignInMethod = index.SignInMethod;
1765exports.TwitterAuthProvider = index.TwitterAuthProvider;
1766exports.UserImpl = index.UserImpl;
1767exports._assert = index._assert;
1768exports._castAuth = index._castAuth;
1769exports._fail = index._fail;
1770exports._getClientVersion = index._getClientVersion;
1771exports._getInstance = index._getInstance;
1772exports._persistenceKeyName = index._persistenceKeyName;
1773exports.applyActionCode = index.applyActionCode;
1774exports.beforeAuthStateChanged = index.beforeAuthStateChanged;
1775exports.browserLocalPersistence = index.browserLocalPersistence;
1776exports.browserPopupRedirectResolver = index.browserPopupRedirectResolver;
1777exports.browserSessionPersistence = index.browserSessionPersistence;
1778exports.checkActionCode = index.checkActionCode;
1779exports.confirmPasswordReset = index.confirmPasswordReset;
1780exports.connectAuthEmulator = index.connectAuthEmulator;
1781exports.createUserWithEmailAndPassword = index.createUserWithEmailAndPassword;
1782exports.debugErrorMap = index.debugErrorMap;
1783exports.deleteUser = index.deleteUser;
1784exports.fetchSignInMethodsForEmail = index.fetchSignInMethodsForEmail;
1785exports.getAdditionalUserInfo = index.getAdditionalUserInfo;
1786exports.getAuth = index.getAuth;
1787exports.getIdToken = index.getIdToken;
1788exports.getIdTokenResult = index.getIdTokenResult;
1789exports.getMultiFactorResolver = index.getMultiFactorResolver;
1790exports.getRedirectResult = index.getRedirectResult;
1791exports.inMemoryPersistence = index.inMemoryPersistence;
1792exports.indexedDBLocalPersistence = index.indexedDBLocalPersistence;
1793exports.initializeAuth = index.initializeAuth;
1794exports.isSignInWithEmailLink = index.isSignInWithEmailLink;
1795exports.linkWithCredential = index.linkWithCredential;
1796exports.linkWithPhoneNumber = index.linkWithPhoneNumber;
1797exports.linkWithPopup = index.linkWithPopup;
1798exports.linkWithRedirect = index.linkWithRedirect;
1799exports.multiFactor = index.multiFactor;
1800exports.onAuthStateChanged = index.onAuthStateChanged;
1801exports.onIdTokenChanged = index.onIdTokenChanged;
1802exports.parseActionCodeURL = index.parseActionCodeURL;
1803exports.prodErrorMap = index.prodErrorMap;
1804exports.reauthenticateWithCredential = index.reauthenticateWithCredential;
1805exports.reauthenticateWithPhoneNumber = index.reauthenticateWithPhoneNumber;
1806exports.reauthenticateWithPopup = index.reauthenticateWithPopup;
1807exports.reauthenticateWithRedirect = index.reauthenticateWithRedirect;
1808exports.reload = index.reload;
1809exports.sendEmailVerification = index.sendEmailVerification;
1810exports.sendPasswordResetEmail = index.sendPasswordResetEmail;
1811exports.sendSignInLinkToEmail = index.sendSignInLinkToEmail;
1812exports.setPersistence = index.setPersistence;
1813exports.signInAnonymously = index.signInAnonymously;
1814exports.signInWithCredential = index.signInWithCredential;
1815exports.signInWithCustomToken = index.signInWithCustomToken;
1816exports.signInWithEmailAndPassword = index.signInWithEmailAndPassword;
1817exports.signInWithEmailLink = index.signInWithEmailLink;
1818exports.signInWithPhoneNumber = index.signInWithPhoneNumber;
1819exports.signInWithPopup = index.signInWithPopup;
1820exports.signInWithRedirect = index.signInWithRedirect;
1821exports.signOut = index.signOut;
1822exports.unlink = index.unlink;
1823exports.updateCurrentUser = index.updateCurrentUser;
1824exports.updateEmail = index.updateEmail;
1825exports.updatePassword = index.updatePassword;
1826exports.updatePhoneNumber = index.updatePhoneNumber;
1827exports.updateProfile = index.updateProfile;
1828exports.useDeviceLanguage = index.useDeviceLanguage;
1829exports.verifyBeforeUpdateEmail = index.verifyBeforeUpdateEmail;
1830exports.verifyPasswordResetCode = index.verifyPasswordResetCode;
1831exports.AuthPopup = AuthPopup;
1832exports._generateEventId = _generateEventId;
1833exports._getRedirectResult = _getRedirectResult;
1834exports._overrideRedirectResult = _overrideRedirectResult;
1835exports.addFrameworkForLogging = addFrameworkForLogging;
1836exports.cordovaPopupRedirectResolver = cordovaPopupRedirectResolver;
1837//# sourceMappingURL=internal.js.map