UNPKG

26.6 kBJavaScriptView Raw
1import { ap as _isIOS7Or8, aq as debugAssert, ar as _isIOS, as as _isAndroid, at as _fail, au as _getRedirectUrl, av as _getProjectConfig, aw as _createError, ax as _assert, ay as _getInstance, b as browserLocalPersistence, az as _persistenceKeyName, aA as AuthEventManager, a as browserSessionPersistence, aB as _getRedirectResult, aC as _overrideRedirectResult, aD as _clearRedirectOutcomes, aE as _castAuth } from './index-3b632d0b.js';
2export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, aG as AuthImpl, aJ as AuthPopup, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, aK as FetchProvider, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aL as SAMLAuthCredential, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, aF as UserImpl, ax as _assert, aE as _castAuth, at as _fail, aI as _generateEventId, aH as _getClientVersion, ay as _getInstance, aB as _getRedirectResult, aC as _overrideRedirectResult, az as _persistenceKeyName, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-3b632d0b.js';
3import { querystringDecode } from '@firebase/util';
4import '@firebase/app';
5import 'tslib';
6import '@firebase/logger';
7import '@firebase/component';
8
9/**
10 * @license
11 * Copyright 2021 Google LLC
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 */
25function _cordovaWindow() {
26 return window;
27}
28
29/**
30 * @license
31 * Copyright 2020 Google LLC
32 *
33 * Licensed under the Apache License, Version 2.0 (the "License");
34 * you may not use this file except in compliance with the License.
35 * You may obtain a copy of the License at
36 *
37 * http://www.apache.org/licenses/LICENSE-2.0
38 *
39 * Unless required by applicable law or agreed to in writing, software
40 * distributed under the License is distributed on an "AS IS" BASIS,
41 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42 * See the License for the specific language governing permissions and
43 * limitations under the License.
44 */
45/**
46 * How long to wait after the app comes back into focus before concluding that
47 * the user closed the sign in tab.
48 */
49const REDIRECT_TIMEOUT_MS = 2000;
50/**
51 * Generates the URL for the OAuth handler.
52 */
53async function _generateHandlerUrl(auth, event, provider) {
54 var _a;
55 // Get the cordova plugins
56 const { BuildInfo } = _cordovaWindow();
57 debugAssert(event.sessionId, 'AuthEvent did not contain a session ID');
58 const sessionDigest = await computeSha256(event.sessionId);
59 const additionalParams = {};
60 if (_isIOS()) {
61 // iOS app identifier
62 additionalParams['ibi'] = BuildInfo.packageName;
63 }
64 else if (_isAndroid()) {
65 // Android app identifier
66 additionalParams['apn'] = BuildInfo.packageName;
67 }
68 else {
69 _fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
70 }
71 // Add the display name if available
72 if (BuildInfo.displayName) {
73 additionalParams['appDisplayName'] = BuildInfo.displayName;
74 }
75 // Attached the hashed session ID
76 additionalParams['sessionId'] = sessionDigest;
77 return _getRedirectUrl(auth, provider, event.type, undefined, (_a = event.eventId) !== null && _a !== void 0 ? _a : undefined, additionalParams);
78}
79/**
80 * Validates that this app is valid for this project configuration
81 */
82async function _validateOrigin(auth) {
83 const { BuildInfo } = _cordovaWindow();
84 const request = {};
85 if (_isIOS()) {
86 request.iosBundleId = BuildInfo.packageName;
87 }
88 else if (_isAndroid()) {
89 request.androidPackageName = BuildInfo.packageName;
90 }
91 else {
92 _fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
93 }
94 // Will fail automatically if package name is not authorized
95 await _getProjectConfig(auth, request);
96}
97function _performRedirect(handlerUrl) {
98 // Get the cordova plugins
99 const { cordova } = _cordovaWindow();
100 return new Promise(resolve => {
101 cordova.plugins.browsertab.isAvailable(browserTabIsAvailable => {
102 let iabRef = null;
103 if (browserTabIsAvailable) {
104 cordova.plugins.browsertab.openUrl(handlerUrl);
105 }
106 else {
107 // TODO: Return the inappbrowser ref that's returned from the open call
108 iabRef = cordova.InAppBrowser.open(handlerUrl, _isIOS7Or8() ? '_blank' : '_system', 'location=yes');
109 }
110 resolve(iabRef);
111 });
112 });
113}
114/**
115 * This function waits for app activity to be seen before resolving. It does
116 * this by attaching listeners to various dom events. Once the app is determined
117 * to be visible, this promise resolves. AFTER that resolution, the listeners
118 * are detached and any browser tabs left open will be closed.
119 */
120async function _waitForAppResume(auth, eventListener, iabRef) {
121 // Get the cordova plugins
122 const { cordova } = _cordovaWindow();
123 let cleanup = () => { };
124 try {
125 await new Promise((resolve, reject) => {
126 let onCloseTimer = null;
127 // DEFINE ALL THE CALLBACKS =====
128 function authEventSeen() {
129 var _a;
130 // Auth event was detected. Resolve this promise and close the extra
131 // window if it's still open.
132 resolve();
133 const closeBrowserTab = (_a = cordova.plugins.browsertab) === null || _a === void 0 ? void 0 : _a.close;
134 if (typeof closeBrowserTab === 'function') {
135 closeBrowserTab();
136 }
137 // Close inappbrowser emebedded webview in iOS7 and 8 case if still
138 // open.
139 if (typeof (iabRef === null || iabRef === void 0 ? void 0 : iabRef.close) === 'function') {
140 iabRef.close();
141 }
142 }
143 function resumed() {
144 if (onCloseTimer) {
145 // This code already ran; do not rerun.
146 return;
147 }
148 onCloseTimer = window.setTimeout(() => {
149 // Wait two seeconds after resume then reject.
150 reject(_createError(auth, "redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */));
151 }, REDIRECT_TIMEOUT_MS);
152 }
153 function visibilityChanged() {
154 if ((document === null || document === void 0 ? void 0 : document.visibilityState) === 'visible') {
155 resumed();
156 }
157 }
158 // ATTACH ALL THE LISTENERS =====
159 // Listen for the auth event
160 eventListener.addPassiveListener(authEventSeen);
161 // Listen for resume and visibility events
162 document.addEventListener('resume', resumed, false);
163 if (_isAndroid()) {
164 document.addEventListener('visibilitychange', visibilityChanged, false);
165 }
166 // SETUP THE CLEANUP FUNCTION =====
167 cleanup = () => {
168 eventListener.removePassiveListener(authEventSeen);
169 document.removeEventListener('resume', resumed, false);
170 document.removeEventListener('visibilitychange', visibilityChanged, false);
171 if (onCloseTimer) {
172 window.clearTimeout(onCloseTimer);
173 }
174 };
175 });
176 }
177 finally {
178 cleanup();
179 }
180}
181/**
182 * Checks the configuration of the Cordova environment. This has no side effect
183 * if the configuration is correct; otherwise it throws an error with the
184 * missing plugin.
185 */
186function _checkCordovaConfiguration(auth) {
187 var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
188 const win = _cordovaWindow();
189 // Check all dependencies installed.
190 // https://github.com/nordnet/cordova-universal-links-plugin
191 // Note that cordova-universal-links-plugin has been abandoned.
192 // A fork with latest fixes is available at:
193 // https://www.npmjs.com/package/cordova-universal-links-plugin-fix
194 _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 */, {
195 missingPlugin: 'cordova-universal-links-plugin-fix'
196 });
197 // https://www.npmjs.com/package/cordova-plugin-buildinfo
198 _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 */, {
199 missingPlugin: 'cordova-plugin-buildInfo'
200 });
201 // https://github.com/google/cordova-plugin-browsertab
202 _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 */, {
203 missingPlugin: 'cordova-plugin-browsertab'
204 });
205 _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 */, {
206 missingPlugin: 'cordova-plugin-browsertab'
207 });
208 // https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
209 _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 */, {
210 missingPlugin: 'cordova-plugin-inappbrowser'
211 });
212}
213/**
214 * Computes the SHA-256 of a session ID. The SubtleCrypto interface is only
215 * available in "secure" contexts, which covers Cordova (which is served on a file
216 * protocol).
217 */
218async function computeSha256(sessionId) {
219 const bytes = stringToArrayBuffer(sessionId);
220 // TODO: For IE11 crypto has a different name and this operation comes back
221 // as an object, not a promise. This is the old proposed standard that
222 // is used by IE11:
223 // https://www.w3.org/TR/2013/WD-WebCryptoAPI-20130108/#cryptooperation-interface
224 const buf = await crypto.subtle.digest('SHA-256', bytes);
225 const arr = Array.from(new Uint8Array(buf));
226 return arr.map(num => num.toString(16).padStart(2, '0')).join('');
227}
228function stringToArrayBuffer(str) {
229 // This function is only meant to deal with an ASCII charset and makes
230 // certain simplifying assumptions.
231 debugAssert(/[0-9a-zA-Z]+/.test(str), 'Can only convert alpha-numeric strings');
232 if (typeof TextEncoder !== 'undefined') {
233 return new TextEncoder().encode(str);
234 }
235 const buff = new ArrayBuffer(str.length);
236 const view = new Uint8Array(buff);
237 for (let i = 0; i < str.length; i++) {
238 view[i] = str.charCodeAt(i);
239 }
240 return view;
241}
242
243/**
244 * @license
245 * Copyright 2020 Google LLC
246 *
247 * Licensed under the Apache License, Version 2.0 (the "License");
248 * you may not use this file except in compliance with the License.
249 * You may obtain a copy of the License at
250 *
251 * http://www.apache.org/licenses/LICENSE-2.0
252 *
253 * Unless required by applicable law or agreed to in writing, software
254 * distributed under the License is distributed on an "AS IS" BASIS,
255 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
256 * See the License for the specific language governing permissions and
257 * limitations under the License.
258 */
259const SESSION_ID_LENGTH = 20;
260/** Custom AuthEventManager that adds passive listeners to events */
261class CordovaAuthEventManager extends AuthEventManager {
262 constructor() {
263 super(...arguments);
264 this.passiveListeners = new Set();
265 this.initPromise = new Promise(resolve => {
266 this.resolveInialized = resolve;
267 });
268 }
269 addPassiveListener(cb) {
270 this.passiveListeners.add(cb);
271 }
272 removePassiveListener(cb) {
273 this.passiveListeners.delete(cb);
274 }
275 // In a Cordova environment, this manager can live through multiple redirect
276 // operations
277 resetRedirect() {
278 this.queuedRedirectEvent = null;
279 this.hasHandledPotentialRedirect = false;
280 }
281 /** Override the onEvent method */
282 onEvent(event) {
283 this.resolveInialized();
284 this.passiveListeners.forEach(cb => cb(event));
285 return super.onEvent(event);
286 }
287 async initialized() {
288 await this.initPromise;
289 }
290}
291/**
292 * Generates a (partial) {@link AuthEvent}.
293 */
294function _generateNewEvent(auth, type, eventId = null) {
295 return {
296 type,
297 eventId,
298 urlResponse: null,
299 sessionId: generateSessionId(),
300 postBody: null,
301 tenantId: auth.tenantId,
302 error: _createError(auth, "no-auth-event" /* NO_AUTH_EVENT */)
303 };
304}
305function _savePartialEvent(auth, event) {
306 return storage()._set(persistenceKey(auth), event);
307}
308async function _getAndRemoveEvent(auth) {
309 const event = (await storage()._get(persistenceKey(auth)));
310 if (event) {
311 await storage()._remove(persistenceKey(auth));
312 }
313 return event;
314}
315function _eventFromPartialAndUrl(partialEvent, url) {
316 var _a, _b;
317 // Parse the deep link within the dynamic link URL.
318 const callbackUrl = _getDeepLinkFromCallback(url);
319 // Confirm it is actually a callback URL.
320 // Currently the universal link will be of this format:
321 // https://<AUTH_DOMAIN>/__/auth/callback<OAUTH_RESPONSE>
322 // This is a fake URL but is not intended to take the user anywhere
323 // and just redirect to the app.
324 if (callbackUrl.includes('/__/auth/callback')) {
325 // Check if there is an error in the URL.
326 // This mechanism is also used to pass errors back to the app:
327 // https://<AUTH_DOMAIN>/__/auth/callback?firebaseError=<STRINGIFIED_ERROR>
328 const params = searchParamsOrEmpty(callbackUrl);
329 // Get the error object corresponding to the stringified error if found.
330 const errorObject = params['firebaseError']
331 ? parseJsonOrNull(decodeURIComponent(params['firebaseError']))
332 : null;
333 const 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];
334 const error = code ? _createError(code) : null;
335 if (error) {
336 return {
337 type: partialEvent.type,
338 eventId: partialEvent.eventId,
339 tenantId: partialEvent.tenantId,
340 error,
341 urlResponse: null,
342 sessionId: null,
343 postBody: null
344 };
345 }
346 else {
347 return {
348 type: partialEvent.type,
349 eventId: partialEvent.eventId,
350 tenantId: partialEvent.tenantId,
351 sessionId: partialEvent.sessionId,
352 urlResponse: callbackUrl,
353 postBody: null
354 };
355 }
356 }
357 return null;
358}
359function generateSessionId() {
360 const chars = [];
361 const allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
362 for (let i = 0; i < SESSION_ID_LENGTH; i++) {
363 const idx = Math.floor(Math.random() * allowedChars.length);
364 chars.push(allowedChars.charAt(idx));
365 }
366 return chars.join('');
367}
368function storage() {
369 return _getInstance(browserLocalPersistence);
370}
371function persistenceKey(auth) {
372 return _persistenceKeyName("authEvent" /* AUTH_EVENT */, auth.config.apiKey, auth.name);
373}
374function parseJsonOrNull(json) {
375 try {
376 return JSON.parse(json);
377 }
378 catch (e) {
379 return null;
380 }
381}
382// Exported for testing
383function _getDeepLinkFromCallback(url) {
384 const params = searchParamsOrEmpty(url);
385 const link = params['link'] ? decodeURIComponent(params['link']) : undefined;
386 // Double link case (automatic redirect)
387 const doubleDeepLink = searchParamsOrEmpty(link)['link'];
388 // iOS custom scheme links.
389 const iOSDeepLink = params['deep_link_id']
390 ? decodeURIComponent(params['deep_link_id'])
391 : undefined;
392 const iOSDoubleDeepLink = searchParamsOrEmpty(iOSDeepLink)['link'];
393 return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;
394}
395/**
396 * Optimistically tries to get search params from a string, or else returns an
397 * empty search params object.
398 */
399function searchParamsOrEmpty(url) {
400 if (!(url === null || url === void 0 ? void 0 : url.includes('?'))) {
401 return {};
402 }
403 const [_, ...rest] = url.split('?');
404 return querystringDecode(rest.join('?'));
405}
406
407/**
408 * @license
409 * Copyright 2021 Google LLC
410 *
411 * Licensed under the Apache License, Version 2.0 (the "License");
412 * you may not use this file except in compliance with the License.
413 * You may obtain a copy of the License at
414 *
415 * http://www.apache.org/licenses/LICENSE-2.0
416 *
417 * Unless required by applicable law or agreed to in writing, software
418 * distributed under the License is distributed on an "AS IS" BASIS,
419 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
420 * See the License for the specific language governing permissions and
421 * limitations under the License.
422 */
423/**
424 * How long to wait for the initial auth event before concluding no
425 * redirect pending
426 */
427const INITIAL_EVENT_TIMEOUT_MS = 500;
428class CordovaPopupRedirectResolver {
429 constructor() {
430 this._redirectPersistence = browserSessionPersistence;
431 this._shouldInitProactively = true; // This is lightweight for Cordova
432 this.eventManagers = new Map();
433 this.originValidationPromises = {};
434 this._completeRedirectFn = _getRedirectResult;
435 this._overrideRedirectResult = _overrideRedirectResult;
436 }
437 async _initialize(auth) {
438 const key = auth._key();
439 let manager = this.eventManagers.get(key);
440 if (!manager) {
441 manager = new CordovaAuthEventManager(auth);
442 this.eventManagers.set(key, manager);
443 this.attachCallbackListeners(auth, manager);
444 }
445 return manager;
446 }
447 _openPopup(auth) {
448 _fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
449 }
450 async _openRedirect(auth, provider, authType, eventId) {
451 _checkCordovaConfiguration(auth);
452 const manager = await this._initialize(auth);
453 await manager.initialized();
454 // Reset the persisted redirect states. This does not matter on Web where
455 // the redirect always blows away application state entirely. On Cordova,
456 // the app maintains control flow through the redirect.
457 manager.resetRedirect();
458 _clearRedirectOutcomes();
459 await this._originValidation(auth);
460 const event = _generateNewEvent(auth, authType, eventId);
461 await _savePartialEvent(auth, event);
462 const url = await _generateHandlerUrl(auth, event, provider);
463 const iabRef = await _performRedirect(url);
464 return _waitForAppResume(auth, manager, iabRef);
465 }
466 _isIframeWebStorageSupported(_auth, _cb) {
467 throw new Error('Method not implemented.');
468 }
469 _originValidation(auth) {
470 const key = auth._key();
471 if (!this.originValidationPromises[key]) {
472 this.originValidationPromises[key] = _validateOrigin(auth);
473 }
474 return this.originValidationPromises[key];
475 }
476 attachCallbackListeners(auth, manager) {
477 // Get the global plugins
478 const { universalLinks, handleOpenURL, BuildInfo } = _cordovaWindow();
479 const noEventTimeout = setTimeout(async () => {
480 // We didn't see that initial event. Clear any pending object and
481 // dispatch no event
482 await _getAndRemoveEvent(auth);
483 manager.onEvent(generateNoEvent());
484 }, INITIAL_EVENT_TIMEOUT_MS);
485 const universalLinksCb = async (eventData) => {
486 // We have an event so we can clear the no event timeout
487 clearTimeout(noEventTimeout);
488 const partialEvent = await _getAndRemoveEvent(auth);
489 let finalEvent = null;
490 if (partialEvent && (eventData === null || eventData === void 0 ? void 0 : eventData['url'])) {
491 finalEvent = _eventFromPartialAndUrl(partialEvent, eventData['url']);
492 }
493 // If finalEvent is never filled, trigger with no event
494 manager.onEvent(finalEvent || generateNoEvent());
495 };
496 // Universal links subscriber doesn't exist for iOS, so we need to check
497 if (typeof universalLinks !== 'undefined' &&
498 typeof universalLinks.subscribe === 'function') {
499 universalLinks.subscribe(null, universalLinksCb);
500 }
501 // iOS 7 or 8 custom URL schemes.
502 // This is also the current default behavior for iOS 9+.
503 // For this to work, cordova-plugin-customurlscheme needs to be installed.
504 // https://github.com/EddyVerbruggen/Custom-URL-scheme
505 // Do not overwrite the existing developer's URL handler.
506 const existingHandleOpenURL = handleOpenURL;
507 const packagePrefix = `${BuildInfo.packageName.toLowerCase()}://`;
508 _cordovaWindow().handleOpenURL = async (url) => {
509 if (url.toLowerCase().startsWith(packagePrefix)) {
510 // We want this intentionally to float
511 // eslint-disable-next-line @typescript-eslint/no-floating-promises
512 universalLinksCb({ url });
513 }
514 // Call the developer's handler if it is present.
515 if (typeof existingHandleOpenURL === 'function') {
516 try {
517 existingHandleOpenURL(url);
518 }
519 catch (e) {
520 // This is a developer error. Don't stop the flow of the SDK.
521 console.error(e);
522 }
523 }
524 };
525 }
526}
527/**
528 * An implementation of {@link PopupRedirectResolver} suitable for Cordova
529 * based applications.
530 *
531 * @public
532 */
533const cordovaPopupRedirectResolver = CordovaPopupRedirectResolver;
534function generateNoEvent() {
535 return {
536 type: "unknown" /* UNKNOWN */,
537 eventId: null,
538 sessionId: null,
539 urlResponse: null,
540 postBody: null,
541 tenantId: null,
542 error: _createError("no-auth-event" /* NO_AUTH_EVENT */)
543 };
544}
545
546/**
547 * @license
548 * Copyright 2017 Google LLC
549 *
550 * Licensed under the Apache License, Version 2.0 (the "License");
551 * you may not use this file except in compliance with the License.
552 * You may obtain a copy of the License at
553 *
554 * http://www.apache.org/licenses/LICENSE-2.0
555 *
556 * Unless required by applicable law or agreed to in writing, software
557 * distributed under the License is distributed on an "AS IS" BASIS,
558 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
559 * See the License for the specific language governing permissions and
560 * limitations under the License.
561 */
562// This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage.
563// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it out
564// of autogenerated documentation pages to reduce accidental misuse.
565function addFrameworkForLogging(auth, framework) {
566 _castAuth(auth)._logFramework(framework);
567}
568
569export { addFrameworkForLogging, cordovaPopupRedirectResolver };
570//# sourceMappingURL=internal.js.map