New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@firebase/auth-compat

Package Overview
Dependencies
Maintainers
5
Versions
1310
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firebase/auth-compat - npm Package Compare versions

Comparing version

to
0.0.900-exp.520ca39d0

dist/auth-compat-exp/index.d.ts

2

dist/firebase-auth.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/auth/internal"),require("@firebase/auth-types"),require("@firebase/app-types")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/auth/internal","@firebase/auth-types","@firebase/app-types"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.impl)}(this,function(K,Y){"use strict";try{(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=e(K),r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function u(e,u,s,a){return new(s=s||Promise)(function(r,t){function n(e){try{o(a.next(e))}catch(e){t(e)}}function i(e){try{o(a.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(n,i)}o((a=a.apply(e,u||[])).next())})}function s(r,n){var i,o,u,s={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(u=2&t[0]?o.return:t[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,t[1])).done)return u;switch(o=0,u&&(t=[2&t[0],u.value]),t[0]){case 0:case 1:u=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(u=0<(u=s.trys).length&&u[u.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!u||t[1]>u[0]&&t[1]<u[3])){s.label=t[1];break}if(6===t[0]&&s.label<u[1]){s.label=u[1],u=t;break}if(u&&s.label<u[2]){s.label=u[2],s.ops.push(t);break}u[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],o=0}finally{i=u=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function n(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function o(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function a(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function c(){return"indexedDB"in self&&null!=indexedDB}var p,t,h,d="FirebaseError",f=(p=Error,r(t=y,h=p),t.prototype=null===h?Object.create(h):(l.prototype=h.prototype,new l),y);function l(){this.constructor=t}function y(e,t,r){t=p.call(this,t)||this;return t.code=e,t.customData=r,t.name=d,Object.setPrototypeOf(t,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(t,v.prototype.create),t}var v=(m.prototype.create=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n,i=t[0]||{},o=this.service+"/"+e,e=this.errors[e],e=e?(n=i,e.replace(b,function(e,t){var r=n[t];return null!=r?String(r):"<"+t+"?>"})):"Error",e=this.serviceName+": "+e+" ("+o+").";return new f(o,e,i)},m);function m(e,t,r){this.service=e,this.serviceName=t,this.errors=r}var b=/\{\$([^}]+)}/g,g=(P.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},P.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},P.prototype.setServiceProps=function(e){return this.serviceProps=e,this},P);function P(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}function I(){var e;return(null===(e=null===self||void 0===self?void 0:self.location)||void 0===e?void 0:e.protocol)||null}function E(){return(0<=(e=n()).indexOf("MSIE ")||0<=e.indexOf("Trident/"))&&11===(null===document||void 0===document?void 0:document.documentMode);var e}function R(e){return void 0===e&&(e=n()),E()||(void 0===(e=e)&&(e=n()),/Edge\/\d+/.test(e))}function A(){try{var e=self.localStorage,t=Y._generateEventId();if(e)return e.setItem(t,"1"),e.removeItem(t),!R()||c()}catch(e){return w()&&c()}return!1}function w(){return"undefined"!=typeof global&&"WorkerGlobalScope"in global&&"importScripts"in global}function O(){return("http:"===I()||"https:"===I()||"object"==typeof(t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==t.id||(void 0===e&&(e=n()),!("file:"!==I()&&"ionic:"!==I()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))))&&!(a()||o())&&A()&&!w();var e,t}var N={LOCAL:"LOCAL",NONE:"NONE",SESSION:"SESSION"};function S(i,o){return u(this,void 0,void 0,function(){var t,r,n;return s(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,o];case 1:return t=e.sent(),[3,3];case 2:throw"auth/multi-factor-auth-required"===(r=e.sent()).code&&(r.resolver=Y.getMultiFactorResolver(i,r)),r;case 3:return[4,t];case 4:return n=e.sent(),r=n.operationType,n=n.user,[2,{operationType:r,credential:function(e){var t=e.providerId;if(!(o=e._tokenResponse))return null;if("temporaryProof"in o&&"phoneNumber"in o)return Y.PhoneAuthProvider.credentialFromResult(e);if(!t||"password"===t)return null;switch(t){case"google.com":return Y.GoogleAuthProvider.credentialFromResult(e);case"facebook.com":return Y.FacebookAuthProvider.credentialFromResult(e);case"github.com":return Y.GithubAuthProvider.credentialFromResult(e);case"twitter.com":return Y.TwitterAuthProvider.credentialFromResult(e);default:var r=o.oauthIdToken,n=o.oauthAccessToken,i=o.oauthTokenSecret,e=o.pendingToken,o=o.nonce;return n||i||r||e?new Y.OAuthProvider(t).credential({idToken:r,accessToken:n,rawNonce:o}):null}}(t),additionalUserInfo:Y.getAdditionalUserInfo(t),user:C.getOrCreate(n)}]}})})}function _(r,n){return u(this,void 0,void 0,function(){var t;return s(this,function(e){switch(e.label){case 0:return[4,n];case 1:return[2,{verificationId:(t=e.sent()).verificationId,confirm:function(e){return S(r,t.confirm(e))}}]}})})}function k(e){return e.unwrap()}var C=(W.getOrCreate=function(e){return W.USER_MAP.has(e)||W.USER_MAP.set(e,new W(e)),W.USER_MAP.get(e)},W.prototype.delete=function(){return this.user.delete()},W.prototype.reload=function(){return this.user.reload()},W.prototype.toJSON=function(){return this.user.toJSON()},W.prototype.getIdTokenResult=function(e){return this.user.getIdTokenResult(e)},W.prototype.getIdToken=function(e){return this.user.getIdToken(e)},W.prototype.linkAndRetrieveDataWithCredential=function(e){return this.linkWithCredential(e)},W.prototype.linkWithCredential=function(t){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,S(this.auth,Y.linkWithCredential(this.user,t))]})})},W.prototype.linkWithPhoneNumber=function(t,r){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,_(this.auth,Y.linkWithPhoneNumber(this.user,t,k(r)))]})})},W.prototype.linkWithPopup=function(t){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,S(this.auth,Y.linkWithPopup(this.user,t,Y.browserPopupRedirectResolver))]})})},W.prototype.linkWithRedirect=function(e){return Y.linkWithRedirect(this.user,e,Y.browserPopupRedirectResolver)},W.prototype.reauthenticateAndRetrieveDataWithCredential=function(e){return this.reauthenticateWithCredential(e)},W.prototype.reauthenticateWithCredential=function(t){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,S(this.auth,Y.reauthenticateWithCredential(this.user,t))]})})},W.prototype.reauthenticateWithPhoneNumber=function(e,t){return _(this.auth,Y.reauthenticateWithPhoneNumber(this.user,e,k(t)))},W.prototype.reauthenticateWithPopup=function(e){return S(this.auth,Y.reauthenticateWithPopup(this.user,e,Y.browserPopupRedirectResolver))},W.prototype.reauthenticateWithRedirect=function(e){return Y.reauthenticateWithRedirect(this.user,e,Y.browserPopupRedirectResolver)},W.prototype.sendEmailVerification=function(e){return Y.sendEmailVerification(this.user,e)},W.prototype.unlink=function(t){return u(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,Y.unlink(this.user,t)];case 1:return e.sent(),[2,this]}})})},W.prototype.updateEmail=function(e){return Y.updateEmail(this.user,e)},W.prototype.updatePassword=function(e){return Y.updatePassword(this.user,e)},W.prototype.updatePhoneNumber=function(e){return Y.updatePhoneNumber(this.user,e)},W.prototype.updateProfile=function(e){return Y.updateProfile(this.user,e)},W.prototype.verifyBeforeUpdateEmail=function(e,t){return Y.verifyBeforeUpdateEmail(this.user,e,t)},W.prototype.unwrap=function(){return this.user},Object.defineProperty(W.prototype,"emailVerified",{get:function(){return this.user.emailVerified},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isAnonymous",{get:function(){return this.user.isAnonymous},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"metadata",{get:function(){return this.user.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"phoneNumber",{get:function(){return this.user.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"providerData",{get:function(){return this.user.providerData},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"refreshToken",{get:function(){return this.user.refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"tenantId",{get:function(){return this.user.tenantId},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"displayName",{get:function(){return this.user.displayName},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"email",{get:function(){return this.user.email},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"photoURL",{get:function(){return this.user.photoURL},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"providerId",{get:function(){return this.user.providerId},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"uid",{get:function(){return this.user.uid},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"auth",{get:function(){return this.user.auth},enumerable:!1,configurable:!0}),W.USER_MAP=new WeakMap,W);function W(e){this.user=e,this.multiFactor=Y.multiFactor(e)}var T="persistence",L=Y._assert,M=(Object.defineProperty(j.prototype,"currentUser",{get:function(){return this.auth.currentUser?C.getOrCreate(this.auth.currentUser):null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"languageCode",{get:function(){return this.auth.languageCode},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"settings",{get:function(){return this.auth.settings},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"tenantId",{get:function(){return this.auth.tenantId},enumerable:!1,configurable:!0}),j.prototype.useDeviceLanguage=function(){this.auth.useDeviceLanguage()},j.prototype.signOut=function(){return this.auth.signOut()},j.prototype.useEmulator=function(e,t){this.auth.useEmulator(e,t)},j.prototype.applyActionCode=function(e){return Y.applyActionCode(this.auth,e)},j.prototype.checkActionCode=function(e){return Y.checkActionCode(this.auth,e)},j.prototype.confirmPasswordReset=function(e,t){return Y.confirmPasswordReset(this.auth,e,t)},j.prototype.createUserWithEmailAndPassword=function(t,r){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,S(this.auth,Y.createUserWithEmailAndPassword(this.auth,t,r))]})})},j.prototype.fetchProvidersForEmail=function(e){return this.fetchSignInMethodsForEmail(e)},j.prototype.fetchSignInMethodsForEmail=function(e){return Y.fetchSignInMethodsForEmail(this.auth,e)},j.prototype.isSignInWithEmailLink=function(e){return Y.isSignInWithEmailLink(this.auth,e)},j.prototype.getRedirectResult=function(){return u(this,void 0,void 0,function(){var t;return s(this,function(e){switch(e.label){case 0:return L(O(),this.auth,"operation-not-supported-in-this-environment"),[4,Y.getRedirectResult(this.auth,Y.browserPopupRedirectResolver)];case 1:return(t=e.sent())?[2,S(this.auth,Promise.resolve(t))]:[2,{credential:null,user:null}]}})})},j.prototype.onAuthStateChanged=function(e,t,r){e=F(e,t,r),t=e.next,r=e.error,e=e.complete;return this.auth.onAuthStateChanged(t,r,e)},j.prototype.onIdTokenChanged=function(e,t,r){e=F(e,t,r),t=e.next,r=e.error,e=e.complete;return this.auth.onIdTokenChanged(t,r,e)},j.prototype.sendSignInLinkToEmail=function(e,t){return Y.sendSignInLinkToEmail(this.auth,e,t)},j.prototype.sendPasswordResetEmail=function(e,t){return Y.sendPasswordResetEmail(this.auth,e,t||void 0)},j.prototype.setPersistence=function(i){return u(this,void 0,void 0,function(){function t(e,t){var r,n;switch(r=e,n=i,Y._assert(Object.values(N).includes(n),r,"invalid-persistence-type"),a()?Y._assert(n!==N.SESSION,r,"unsupported-persistence-type"):o()?Y._assert(n===N.NONE,r,"unsupported-persistence-type"):w()?Y._assert(n===N.NONE||n===N.LOCAL&&c(),r,"unsupported-persistence-type"):Y._assert(n===N.NONE||A(),r,"unsupported-persistence-type"),t){case N.SESSION:return Y.browserSessionPersistence;case N.LOCAL:return c()?Y.indexedDBLocalPersistence:Y.browserLocalPersistence;case N.NONE:return Y.inMemoryPersistence;default:return Y._fail("argument-error",{appName:e.name})}}return s(this,function(e){return[2,this.auth.setPersistence(t(this.auth,i))]})})},j.prototype.signInAndRetrieveDataWithCredential=function(e){return this.signInWithCredential(e)},j.prototype.signInAnonymously=function(){return S(this.auth,Y.signInAnonymously(this.auth))},j.prototype.signInWithCredential=function(e){return S(this.auth,Y.signInWithCredential(this.auth,e))},j.prototype.signInWithCustomToken=function(e){return S(this.auth,Y.signInWithCustomToken(this.auth,e))},j.prototype.signInWithEmailAndPassword=function(e,t){return S(this.auth,Y.signInWithEmailAndPassword(this.auth,e,t))},j.prototype.signInWithEmailLink=function(e,t){return S(this.auth,Y.signInWithEmailLink(this.auth,e,t))},j.prototype.signInWithPhoneNumber=function(e,t){return _(this.auth,Y.signInWithPhoneNumber(this.auth,e,k(t)))},j.prototype.signInWithPopup=function(t){return u(this,void 0,void 0,function(){return s(this,function(e){return L(O(),this.auth,"operation-not-supported-in-this-environment"),[2,S(this.auth,Y.signInWithPopup(this.auth,t,Y.browserPopupRedirectResolver))]})})},j.prototype.signInWithRedirect=function(t){return u(this,void 0,void 0,function(){return s(this,function(e){return L(O(),this.auth,"operation-not-supported-in-this-environment"),this.savePersistenceForRedirect(),[2,Y.signInWithRedirect(this.auth,t,Y.browserPopupRedirectResolver)]})})},j.prototype.updateCurrentUser=function(e){return this.auth.updateCurrentUser(k(e))},j.prototype.verifyPasswordResetCode=function(e){return Y.verifyPasswordResetCode(this.auth,e)},j.prototype.unwrap=function(){return this.auth},j.prototype._delete=function(){return this.auth._delete()},j.prototype.savePersistenceForRedirect=function(){var e=D(),t=Y._persistenceKeyName(T,this.auth.config.apiKey,this.auth.name);null!=e&&e.sessionStorage&&e.sessionStorage.setItem(t,this.auth._getPersistence())},j.prototype.getPersistenceFromRedirect=function(){var e=D();if(null==e||!e.sessionStorage)return null;var t=Y._persistenceKeyName(T,this.auth.config.apiKey,this.auth.name);switch(e.sessionStorage.getItem(t)){case Y.inMemoryPersistence.type:return Y.inMemoryPersistence;case Y.indexedDBLocalPersistence.type:return Y.indexedDBLocalPersistence;case Y.browserSessionPersistence.type:return Y.browserSessionPersistence;case Y.browserLocalPersistence.type:return Y.browserLocalPersistence;default:return null}},j);function j(e,t){this.app=e,this.auth=t;var r=e.options.apiKey;this.auth._deleted||((t=(t=this.getPersistenceFromRedirect())?[t]:[]).push(Y.indexedDBLocalPersistence),t=t.map(Y._getInstance),L(r,"invalid-api-key",{appName:e.name}),this.auth._updateErrorMap(Y.debugErrorMap),this.auth._initializeWithPersistence(t,Y.browserPopupRedirectResolver))}function D(){return"undefined"!=typeof window?window:null}function F(e,t,r){var n=e;"function"!=typeof e&&(n=e.next,t=e.error,r=e.complete);var i=n;return{next:function(e){return i(e&&C.getOrCreate(e))},error:t,complete:r}}var x=(U.credential=function(e,t){return Y.PhoneAuthProvider.credential(e,t)},U.prototype.verifyPhoneNumber=function(e,t){return this.phoneProvider.verifyPhoneNumber(e,k(t))},U.prototype.unwrap=function(){return this.phoneProvider},U.PHONE_SIGN_IN_METHOD=Y.PhoneAuthProvider.PHONE_SIGN_IN_METHOD,U.PROVIDER_ID=Y.PhoneAuthProvider.PROVIDER_ID,U);function U(){this.providerId="phone",this.phoneProvider=new Y.PhoneAuthProvider(k(i.default.auth()))}var V=Y._assert,G=(B.prototype.clear=function(){this.verifier.clear()},B.prototype.render=function(){return this.verifier.render()},B.prototype.verify=function(){return this.verifier.verify()},B.prototype.unwrap=function(){return this.verifier},B);function B(e,t,r){var n;void 0===r&&(r=i.default.app()),V(null===(n=r.options)||void 0===n?void 0:n.apiKey,"invalid-api-key",{appName:r.name}),this.verifier=new Y.RecaptchaVerifier(e,t,k(r.auth())),this.type=this.verifier.type}var H;Y.registerAuth(o()?"Node":a()?"ReactNative":w()?"Worker":"Browser"),(H=i.default).INTERNAL.registerComponent(new g("auth",function(e){var t=e.getProvider("app").getImmediate(),e=e.getProvider("auth-exp").getImmediate();return new M(t,e)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"}},EmailAuthProvider:Y.EmailAuthProvider,FacebookAuthProvider:Y.FacebookAuthProvider,GithubAuthProvider:Y.GithubAuthProvider,GoogleAuthProvider:Y.GoogleAuthProvider,OAuthProvider:Y.OAuthProvider,PhoneAuthProvider:x,PhoneMultiFactorGenerator:Y.PhoneMultiFactorGenerator,RecaptchaVerifier:G,TwitterAuthProvider:Y.TwitterAuthProvider,Auth:{Persistence:N},AuthCredential:Y.AuthCredential}).setInstantiationMode("LAZY").setMultipleInstances(!1)),H.registerVersion("auth","0.0.900")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-auth.js - be sure to load firebase-app.js first.")}});//# sourceMappingURL=firebase-auth.js.map
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/auth/internal")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/auth/internal"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.exp)}(this,function(ee,te){"use strict";try{!function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=e(ee),r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function u(e,u,a,s){return new(a=a||Promise)(function(n,t){function r(e){try{o(s.next(e))}catch(e){t(e)}}function i(e){try{o(s.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?n(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(r,i)}o((s=s.apply(e,u||[])).next())})}function c(n,r){var i,o,u,a={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,o&&(u=2&t[0]?o.return:t[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,t[1])).done)return u;switch(o=0,(t=u?[2&t[0],u.value]:t)[0]){case 0:case 1:u=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,o=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(u=0<(u=a.trys).length&&u[u.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!u||t[1]>u[0]&&t[1]<u[3])){a.label=t[1];break}if(6===t[0]&&a.label<u[1]){a.label=u[1],u=t;break}if(u&&a.label<u[2]){a.label=u[2],a.ops.push(t);break}u[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],o=0}finally{i=u=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function t(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function a(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function s(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function l(){return"indexedDB"in self&&null!=indexedDB}var o,d="FirebaseError",p=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(h,o=Error),h);function h(e,t,n){t=o.call(this,t)||this;return t.code=e,t.customData=n,t.name=d,Object.setPrototypeOf(t,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(t,f.prototype.create),t}var f=(n.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r,i=t[0]||{},o=this.service+"/"+e,e=this.errors[e],e=e?(r=i,e.replace(g,function(e,t){var n=r[t];return null!=n?String(n):"<"+t+"?>"})):"Error",e=this.serviceName+": "+e+" ("+o+").";return new p(o,e,i)},n);function n(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var g=/\{\$([^}]+)}/g,y=(v.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},v.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},v.prototype.setServiceProps=function(e){return this.serviceProps=e,this},v.prototype.setInstanceCreatedCallback=function(e){return this.onInstanceCreated=e,this},v);function v(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}function _(){var e;return(null===(e=null===self||void 0===self?void 0:self.location)||void 0===e?void 0:e.protocol)||null}function m(e){return void 0===e&&(e=t()),!("file:"!==_()&&"ionic:"!==_()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function b(){return(0<=(e=t()).indexOf("MSIE ")||0<=e.indexOf("Trident/"))&&11===(null===document||void 0===document?void 0:document.documentMode);var e}function P(e){return void 0===e&&(e=t()),b()||(void 0===(e=e)&&(e=t()),/Edge\/\d+/.test(e))}function I(){try{var e=self.localStorage,t=te._generateEventId();if(e)return e.setItem(t,"1"),e.removeItem(t),!P()||l()}catch(e){return E()&&l()}return!1}function E(){return"undefined"!=typeof global&&"WorkerGlobalScope"in global&&"importScripts"in global}function A(){return("http:"===_()||"https:"===_()||"object"==typeof(e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==e.id||m())&&!(s()||a())&&I()&&!E();var e}function w(){return m()&&"undefined"!=typeof document}var R={LOCAL:"local",NONE:"none",SESSION:"session"},O=te._assert,S="persistence";function N(r){return u(this,void 0,void 0,function(){var t,n;return c(this,function(e){switch(e.label){case 0:return[4,r._initializationPromise];case 1:return e.sent(),t=k(),n=te._persistenceKeyName(S,r.config.apiKey,r.name),null!=t&&t.sessionStorage&&t.sessionStorage.setItem(n,r._getPersistence()),[2]}})})}function k(){return"undefined"!=typeof window?window:null}var C=te._assert,W=te._getInstance(te.browserPopupRedirectResolver),T=te._getInstance(te.cordovaPopupRedirectResolver),L=(j.prototype._initialize=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._initialize(t)]}})})},j.prototype._openPopup=function(t,n,r,i){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._openPopup(t,n,r,i)]}})})},j.prototype._openRedirect=function(t,n,r,i){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._openRedirect(t,n,r,i)]}})})},j.prototype._isIframeWebStorageSupported=function(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)},j.prototype._originValidation=function(e){return this.assertedUnderlyingResolver._originValidation(e)},Object.defineProperty(j.prototype,"_shouldInitProactively",{get:function(){return w()||W._shouldInitProactively},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"assertedUnderlyingResolver",{get:function(){return C(this.underlyingResolver,"internal-error"),this.underlyingResolver},enumerable:!1,configurable:!0}),j.prototype.selectUnderlyingResolver=function(){return u(this,void 0,void 0,function(){var t;return c(this,function(e){switch(e.label){case 0:return this.underlyingResolver?[2]:[4,function(){return u(this,void 0,void 0,function(){return c(this,function(e){return w()?[2,new Promise(function(e){var t=setTimeout(function(){e(!1)},1e3);document.addEventListener("deviceready",function(){clearTimeout(t),e(!0)})})]:[2,!1]})})}()];case 1:return t=e.sent(),this.underlyingResolver=t?T:W,[2]}})})},j);function j(){this.underlyingResolver=null,this._redirectPersistence=te.browserSessionPersistence,this._completeRedirectFn=te._getRedirectResult}function M(e){return e.unwrap()}function D(e){var t=(e instanceof p?e.customData:e)._tokenResponse;if(!t)return null;if(!(e instanceof p)&&"temporaryProof"in t&&"phoneNumber"in t)return te.PhoneAuthProvider.credentialFromResult(e);var n,r=t.providerId;if(!r||"password"===r)return null;switch(r){case"google.com":n=te.GoogleAuthProvider;break;case"facebook.com":n=te.FacebookAuthProvider;break;case"github.com":n=te.GithubAuthProvider;break;case"twitter.com":n=te.TwitterAuthProvider;break;default:var i=t.oauthIdToken,o=t.oauthAccessToken,u=t.oauthTokenSecret,a=t.pendingToken,s=t.nonce;return o||u||i||a?a?r.startsWith("saml.")?te.SAMLAuthCredential._create(r,a):te.OAuthCredential._fromParams({providerId:r,signInMethod:r,pendingToken:a,idToken:i,accessToken:o}):new te.OAuthProvider(r).credential({idToken:i,accessToken:o,rawNonce:s}):null}return e instanceof p?n.credentialFromError(e):n.credentialFromResult(e)}function U(a,s){return u(this,void 0,void 0,function(){var i,o,u;return c(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,s];case 1:return i=e.sent(),[3,3];case 2:throw(u=e.sent())instanceof p&&(t=a,r=null===(r=(n=u).customData)||void 0===r?void 0:r._tokenResponse,"auth/multi-factor-auth-required"===n.code?n.resolver=new x(t,te.getMultiFactorResolver(t,n)):!r||(n=D(t=n))&&(t.credential=n,t.tenantId=r.tenantId||void 0,t.email=r.email||void 0,t.phoneNumber=r.phoneNumber||void 0)),u;case 3:return o=i.operationType,u=i.user,[2,{operationType:o,credential:D(i),additionalUserInfo:te.getAdditionalUserInfo(i),user:G.getOrCreate(u)}]}var t,n,r})})}function F(n,r){return u(this,void 0,void 0,function(){var t;return c(this,function(e){switch(e.label){case 0:return[4,r];case 1:return[2,{verificationId:(t=e.sent()).verificationId,confirm:function(e){return U(n,t.confirm(e))}}]}})})}var x=(Object.defineProperty(V.prototype,"session",{get:function(){return this.resolver.session},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"hints",{get:function(){return this.resolver.hints},enumerable:!1,configurable:!0}),V.prototype.resolveSignIn=function(e){return U(M(this.auth),this.resolver.resolveSignIn(e))},V);function V(e,t){this.resolver=t,this.auth=e.wrapped()}var G=(B.getOrCreate=function(e){return B.USER_MAP.has(e)||B.USER_MAP.set(e,new B(e)),B.USER_MAP.get(e)},B.prototype.delete=function(){return this._delegate.delete()},B.prototype.reload=function(){return this._delegate.reload()},B.prototype.toJSON=function(){return this._delegate.toJSON()},B.prototype.getIdTokenResult=function(e){return this._delegate.getIdTokenResult(e)},B.prototype.getIdToken=function(e){return this._delegate.getIdToken(e)},B.prototype.linkAndRetrieveDataWithCredential=function(e){return this.linkWithCredential(e)},B.prototype.linkWithCredential=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){return[2,U(this.auth,te.linkWithCredential(this._delegate,t))]})})},B.prototype.linkWithPhoneNumber=function(t,n){return u(this,void 0,void 0,function(){return c(this,function(e){return[2,F(this.auth,te.linkWithPhoneNumber(this._delegate,t,n))]})})},B.prototype.linkWithPopup=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){return[2,U(this.auth,te.linkWithPopup(this._delegate,t,L))]})})},B.prototype.linkWithRedirect=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return[4,N(te._castAuth(this.auth))];case 1:return e.sent(),[2,te.linkWithRedirect(this._delegate,t,L)]}})})},B.prototype.reauthenticateAndRetrieveDataWithCredential=function(e){return this.reauthenticateWithCredential(e)},B.prototype.reauthenticateWithCredential=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){return[2,U(this.auth,te.reauthenticateWithCredential(this._delegate,t))]})})},B.prototype.reauthenticateWithPhoneNumber=function(e,t){return F(this.auth,te.reauthenticateWithPhoneNumber(this._delegate,e,t))},B.prototype.reauthenticateWithPopup=function(e){return U(this.auth,te.reauthenticateWithPopup(this._delegate,e,L))},B.prototype.reauthenticateWithRedirect=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return[4,N(te._castAuth(this.auth))];case 1:return e.sent(),[2,te.reauthenticateWithRedirect(this._delegate,t,L)]}})})},B.prototype.sendEmailVerification=function(e){return te.sendEmailVerification(this._delegate,e)},B.prototype.unlink=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return[4,te.unlink(this._delegate,t)];case 1:return e.sent(),[2,this]}})})},B.prototype.updateEmail=function(e){return te.updateEmail(this._delegate,e)},B.prototype.updatePassword=function(e){return te.updatePassword(this._delegate,e)},B.prototype.updatePhoneNumber=function(e){return te.updatePhoneNumber(this._delegate,e)},B.prototype.updateProfile=function(e){return te.updateProfile(this._delegate,e)},B.prototype.verifyBeforeUpdateEmail=function(e,t){return te.verifyBeforeUpdateEmail(this._delegate,e,t)},Object.defineProperty(B.prototype,"emailVerified",{get:function(){return this._delegate.emailVerified},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isAnonymous",{get:function(){return this._delegate.isAnonymous},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"phoneNumber",{get:function(){return this._delegate.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"providerData",{get:function(){return this._delegate.providerData},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"refreshToken",{get:function(){return this._delegate.refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"tenantId",{get:function(){return this._delegate.tenantId},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"displayName",{get:function(){return this._delegate.displayName},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"email",{get:function(){return this._delegate.email},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"photoURL",{get:function(){return this._delegate.photoURL},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"providerId",{get:function(){return this._delegate.providerId},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"uid",{get:function(){return this._delegate.uid},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"auth",{get:function(){return this._delegate.auth},enumerable:!1,configurable:!0}),B.USER_MAP=new WeakMap,B);function B(e){this._delegate=e,this.multiFactor=te.multiFactor(e)}var H=te._assert,Y=(Object.defineProperty(z.prototype,"emulatorConfig",{get:function(){return this._delegate.emulatorConfig},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentUser",{get:function(){return this._delegate.currentUser?G.getOrCreate(this._delegate.currentUser):null},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"languageCode",{get:function(){return this._delegate.languageCode},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"settings",{get:function(){return this._delegate.settings},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"tenantId",{get:function(){return this._delegate.tenantId},enumerable:!1,configurable:!0}),z.prototype.useDeviceLanguage=function(){this._delegate.useDeviceLanguage()},z.prototype.signOut=function(){return this._delegate.signOut()},z.prototype.useEmulator=function(e,t){te.useAuthEmulator(this._delegate,e,t)},z.prototype.applyActionCode=function(e){return te.applyActionCode(this._delegate,e)},z.prototype.checkActionCode=function(e){return te.checkActionCode(this._delegate,e)},z.prototype.confirmPasswordReset=function(e,t){return te.confirmPasswordReset(this._delegate,e,t)},z.prototype.createUserWithEmailAndPassword=function(t,n){return u(this,void 0,void 0,function(){return c(this,function(e){return[2,U(this._delegate,te.createUserWithEmailAndPassword(this._delegate,t,n))]})})},z.prototype.fetchProvidersForEmail=function(e){return this.fetchSignInMethodsForEmail(e)},z.prototype.fetchSignInMethodsForEmail=function(e){return te.fetchSignInMethodsForEmail(this._delegate,e)},z.prototype.isSignInWithEmailLink=function(e){return te.isSignInWithEmailLink(this._delegate,e)},z.prototype.getRedirectResult=function(){return u(this,void 0,void 0,function(){var t;return c(this,function(e){switch(e.label){case 0:return H(A(),this._delegate,"operation-not-supported-in-this-environment"),[4,te.getRedirectResult(this._delegate,L)];case 1:return(t=e.sent())?[2,U(this._delegate,Promise.resolve(t))]:[2,{credential:null,user:null}]}})})},z.prototype.onAuthStateChanged=function(e,t,n){e=K(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onAuthStateChanged(t,n,e)},z.prototype.onIdTokenChanged=function(e,t,n){e=K(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onIdTokenChanged(t,n,e)},z.prototype.sendSignInLinkToEmail=function(e,t){return te.sendSignInLinkToEmail(this._delegate,e,t)},z.prototype.sendPasswordResetEmail=function(e,t){return te.sendPasswordResetEmail(this._delegate,e,t||void 0)},z.prototype.setPersistence=function(o){return u(this,void 0,void 0,function(){var r,i;return c(this,function(e){switch(e.label){case 0:switch(t=this._delegate,n=o,O(Object.values(R).includes(n),t,"invalid-persistence-type"),s()?O(n!==R.SESSION,t,"unsupported-persistence-type"):a()?O(n===R.NONE,t,"unsupported-persistence-type"):E()?O(n===R.NONE||n===R.LOCAL&&l(),t,"unsupported-persistence-type"):O(n===R.NONE||I(),t,"unsupported-persistence-type"),o){case R.SESSION:return[3,1];case R.LOCAL:return[3,2];case R.NONE:return[3,4]}return[3,5];case 1:return r=te.browserSessionPersistence,[3,6];case 2:return[4,te._getInstance(te.indexedDBLocalPersistence)._isAvailable()];case 3:return i=e.sent(),r=i?te.indexedDBLocalPersistence:te.browserLocalPersistence,[3,6];case 4:return r=te.inMemoryPersistence,[3,6];case 5:return[2,te._fail("argument-error",{appName:this._delegate.name})];case 6:return[2,this._delegate.setPersistence(r)]}var t,n})})},z.prototype.signInAndRetrieveDataWithCredential=function(e){return this.signInWithCredential(e)},z.prototype.signInAnonymously=function(){return U(this._delegate,te.signInAnonymously(this._delegate))},z.prototype.signInWithCredential=function(e){return U(this._delegate,te.signInWithCredential(this._delegate,e))},z.prototype.signInWithCustomToken=function(e){return U(this._delegate,te.signInWithCustomToken(this._delegate,e))},z.prototype.signInWithEmailAndPassword=function(e,t){return U(this._delegate,te.signInWithEmailAndPassword(this._delegate,e,t))},z.prototype.signInWithEmailLink=function(e,t){return U(this._delegate,te.signInWithEmailLink(this._delegate,e,t))},z.prototype.signInWithPhoneNumber=function(e,t){return F(this._delegate,te.signInWithPhoneNumber(this._delegate,e,M(t)))},z.prototype.signInWithPopup=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){return H(A(),this._delegate,"operation-not-supported-in-this-environment"),[2,U(this._delegate,te.signInWithPopup(this._delegate,t,L))]})})},z.prototype.signInWithRedirect=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return H(A(),this._delegate,"operation-not-supported-in-this-environment"),[4,N(this._delegate)];case 1:return e.sent(),[2,te.signInWithRedirect(this._delegate,t,L)]}})})},z.prototype.updateCurrentUser=function(e){return this._delegate.updateCurrentUser(M(e))},z.prototype.verifyPasswordResetCode=function(e){return te.verifyPasswordResetCode(this._delegate,e)},z.prototype.unwrap=function(){return this._delegate},z.prototype._delete=function(){return this._delegate._delete()},z.prototype.linkUnderlyingAuth=function(){var e=this;this._delegate.wrapped=function(){return e}},z);function z(e,t){if(this.app=e,t.isInitialized())return this._delegate=t.getImmediate(),void this.linkUnderlyingAuth();var n=e.options.apiKey;H(n,"invalid-api-key",{appName:e.name});var r=[te.inMemoryPersistence];if("undefined"!=typeof window)for(var r=function(e,t){var n=k();if(null==n||!n.sessionStorage)return[];switch(t=te._persistenceKeyName(S,e,t),n.sessionStorage.getItem(t)){case R.NONE:return[te.inMemoryPersistence];case R.LOCAL:return[te.indexedDBLocalPersistence,te.browserSessionPersistence];case R.SESSION:return[te.browserSessionPersistence];default:return[]}}(n,e.name),i=0,o=[te.indexedDBLocalPersistence,te.browserLocalPersistence];i<o.length;i++){var u=o[i];r.includes(u)||r.push(u)}H(n,"invalid-api-key",{appName:e.name});e="undefined"!=typeof window?L:void 0;this._delegate=t.initialize({options:{persistence:r,popupRedirectResolver:e}}),this._delegate._updateErrorMap(te.debugErrorMap),this.linkUnderlyingAuth()}function K(e,t,n){var r=e;"function"!=typeof e&&(r=e.next,t=e.error,n=e.complete);var i=r;return{next:function(e){return i(e&&G.getOrCreate(e))},error:t,complete:n}}var q=(J.credential=function(e,t){return te.PhoneAuthProvider.credential(e,t)},J.prototype.verifyPhoneNumber=function(e,t){return this._delegate.verifyPhoneNumber(e,t)},J.prototype.unwrap=function(){return this._delegate},J.PHONE_SIGN_IN_METHOD=te.PhoneAuthProvider.PHONE_SIGN_IN_METHOD,J.PROVIDER_ID=te.PhoneAuthProvider.PROVIDER_ID,J);function J(){this.providerId="phone",this._delegate=new te.PhoneAuthProvider(unwrap(i.default.auth()))}var Z=te._assert,$=(Q.prototype.clear=function(){this._delegate.clear()},Q.prototype.render=function(){return this._delegate.render()},Q.prototype.verify=function(){return this._delegate.verify()},Q);function Q(e,t,n){var r;void 0===n&&(n=i.default.app()),Z(null===(r=n.options)||void 0===r?void 0:r.apiKey,"invalid-api-key",{appName:n.name}),this._delegate=new te.RecaptchaVerifier(e,t,n.auth()),this.type=this._delegate.type}var X;(X=i.default).INTERNAL.registerComponent(new y("auth-compat",function(e){var t=e.getProvider("app-compat").getImmediate(),e=e.getProvider("auth-exp");return new Y(t,e)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"}},EmailAuthProvider:te.EmailAuthProvider,FacebookAuthProvider:te.FacebookAuthProvider,GithubAuthProvider:te.GithubAuthProvider,GoogleAuthProvider:te.GoogleAuthProvider,OAuthProvider:te.OAuthProvider,PhoneAuthProvider:q,PhoneMultiFactorGenerator:te.PhoneMultiFactorGenerator,RecaptchaVerifier:$,TwitterAuthProvider:te.TwitterAuthProvider,Auth:{Persistence:R},AuthCredential:te.AuthCredential}).setInstantiationMode("LAZY").setMultipleInstances(!1)),X.registerVersion("@firebase/auth-compat","0.0.900-exp.520ca39d0")}.apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-auth.js - be sure to load firebase-app.js first.")}});//# sourceMappingURL=firebase-auth.js.map
import firebase from '@firebase/app-compat';
import { _generateEventId, _assert as _assert$2, getAdditionalUserInfo, getMultiFactorResolver, PhoneAuthProvider as PhoneAuthProvider$1, OAuthProvider, TwitterAuthProvider, GithubAuthProvider, FacebookAuthProvider, GoogleAuthProvider, linkWithCredential, linkWithPhoneNumber, linkWithPopup, browserPopupRedirectResolver, linkWithRedirect, reauthenticateWithCredential, reauthenticateWithPhoneNumber, reauthenticateWithPopup, reauthenticateWithRedirect, sendEmailVerification, unlink, updateEmail, updatePassword, updatePhoneNumber, updateProfile, verifyBeforeUpdateEmail, multiFactor, applyActionCode, checkActionCode, confirmPasswordReset, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, isSignInWithEmailLink, getRedirectResult, sendSignInLinkToEmail, sendPasswordResetEmail, signInAnonymously, signInWithCredential, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signInWithPhoneNumber, signInWithPopup, signInWithRedirect, verifyPasswordResetCode, _persistenceKeyName, browserLocalPersistence, browserSessionPersistence, indexedDBLocalPersistence, inMemoryPersistence, _getInstance, debugErrorMap, _fail, RecaptchaVerifier as RecaptchaVerifier$1, registerAuth, EmailAuthProvider, PhoneMultiFactorGenerator, AuthCredential } from '@firebase/auth/internal';
import '@firebase/auth-types';
import { _generateEventId, _persistenceKeyName, _assert as _assert$4, browserSessionPersistence, indexedDBLocalPersistence, inMemoryPersistence, _getInstance, browserPopupRedirectResolver, cordovaPopupRedirectResolver, _getRedirectResult, getAdditionalUserInfo, getMultiFactorResolver, PhoneAuthProvider as PhoneAuthProvider$1, SAMLAuthCredential, OAuthCredential, OAuthProvider, TwitterAuthProvider, GithubAuthProvider, FacebookAuthProvider, GoogleAuthProvider, linkWithCredential, linkWithPhoneNumber, linkWithPopup, linkWithRedirect, _castAuth, reauthenticateWithCredential, reauthenticateWithPhoneNumber, reauthenticateWithPopup, reauthenticateWithRedirect, sendEmailVerification, unlink, updateEmail, updatePassword, updatePhoneNumber, updateProfile, verifyBeforeUpdateEmail, multiFactor, useAuthEmulator, applyActionCode, checkActionCode, confirmPasswordReset, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, isSignInWithEmailLink, getRedirectResult, sendSignInLinkToEmail, sendPasswordResetEmail, _fail, browserLocalPersistence, signInAnonymously, signInWithCredential, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signInWithPhoneNumber, signInWithPopup, signInWithRedirect, verifyPasswordResetCode, debugErrorMap, RecaptchaVerifier as RecaptchaVerifier$1, EmailAuthProvider, PhoneMultiFactorGenerator, AuthCredential } from '@firebase/auth/internal';
import { Component } from '@firebase/component';
import { __awaiter, __generator } from 'tslib';
import '@firebase/app-types';
import { isBrowserExtension, isReactNative, isNode, getUA, isIE, isIndexedDBAvailable } from '@firebase/util';
import { isBrowserExtension, isReactNative, isNode, getUA, isIE, isIndexedDBAvailable, FirebaseError } from '@firebase/util';
var version = "0.0.900";
var name = "@firebase/auth-compat";
var version = "0.0.900-exp.520ca39d0";

@@ -27,2 +26,3 @@ /**

*/
var CORDOVA_ONDEVICEREADY_TIMEOUT_MS = 1000;
function _getCurrentScheme() {

@@ -133,14 +133,25 @@ var _a;

}
function _getClientPlatform() {
if (isNode()) {
return "Node" /* NODE */;
}
if (isReactNative()) {
return "ReactNative" /* REACT_NATIVE */;
}
if (_isWorker()) {
return "Worker" /* WORKER */;
}
return "Browser" /* BROWSER */;
/** Quick check that indicates the platform *may* be Cordova */
function _isLikelyCordova() {
return _isAndroidOrIosCordovaScheme() && typeof document !== 'undefined';
}
function _isCordova() {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!_isLikelyCordova()) {
return [2 /*return*/, false];
}
return [2 /*return*/, new Promise(function (resolve) {
var timeoutId = setTimeout(function () {
// We've waited long enough; the telltale Cordova event didn't happen
resolve(false);
}, CORDOVA_ONDEVICEREADY_TIMEOUT_MS);
document.addEventListener('deviceready', function () {
clearTimeout(timeoutId);
resolve(true);
});
})];
});
});
}

@@ -164,6 +175,8 @@ /**

var Persistence = {
LOCAL: 'LOCAL',
NONE: 'NONE',
SESSION: 'SESSION'
LOCAL: 'local',
NONE: 'none',
SESSION: 'session'
};
var _assert = _assert$4;
var PERSISTENCE_KEY = 'persistence';
/**

@@ -174,7 +187,7 @@ * Validates that an argument is a valid persistence value. If an invalid type

function _validatePersistenceArgument(auth, persistence) {
_assert$2(Object.values(Persistence).includes(persistence), auth, "invalid-persistence-type" /* INVALID_PERSISTENCE */);
_assert(Object.values(Persistence).includes(persistence), auth, "invalid-persistence-type" /* INVALID_PERSISTENCE */);
// Validate if the specified type is supported in the current environment.
if (isReactNative()) {
// This is only supported in a browser.
_assert$2(persistence !== Persistence.SESSION, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence !== Persistence.SESSION, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
return;

@@ -184,3 +197,3 @@ }

// Only none is supported in Node.js.
_assert$2(persistence === Persistence.NONE, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence === Persistence.NONE, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
return;

@@ -191,3 +204,3 @@ }

// If indexedDB not supported and LOCAL provided, throw an error
_assert$2(persistence === Persistence.NONE ||
_assert(persistence === Persistence.NONE ||
(persistence === Persistence.LOCAL && isIndexedDBAvailable()), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);

@@ -197,4 +210,43 @@ return;

// This is restricted by what the browser supports.
_assert$2(persistence === Persistence.NONE || _isWebStorageSupported(), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence === Persistence.NONE || _isWebStorageSupported(), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
}
function _savePersistenceForRedirect(auth) {
return __awaiter(this, void 0, void 0, function () {
var win, key;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, auth._initializationPromise];
case 1:
_a.sent();
win = getSelfWindow();
key = _persistenceKeyName(PERSISTENCE_KEY, auth.config.apiKey, auth.name);
if (win === null || win === void 0 ? void 0 : win.sessionStorage) {
win.sessionStorage.setItem(key, auth._getPersistence());
}
return [2 /*return*/];
}
});
});
}
function _getPersistencesFromRedirect(apiKey, appName) {
var win = getSelfWindow();
if (!(win === null || win === void 0 ? void 0 : win.sessionStorage)) {
return [];
}
var key = _persistenceKeyName(PERSISTENCE_KEY, apiKey, appName);
var persistence = win.sessionStorage.getItem(key);
switch (persistence) {
case Persistence.NONE:
return [inMemoryPersistence];
case Persistence.LOCAL:
return [indexedDBLocalPersistence, browserSessionPersistence];
case Persistence.SESSION:
return [browserSessionPersistence];
default:
return [];
}
}
function getSelfWindow() {
return typeof window !== 'undefined' ? window : null;
}

@@ -217,4 +269,156 @@ /**

*/
var _assert$1 = _assert$4;
var BROWSER_RESOLVER = _getInstance(browserPopupRedirectResolver);
var CORDOVA_RESOLVER = _getInstance(cordovaPopupRedirectResolver);
/** Platform-agnostic popup-redirect resolver */
var CompatPopupRedirectResolver = /** @class */ (function () {
function CompatPopupRedirectResolver() {
this.underlyingResolver = null;
this._redirectPersistence = browserSessionPersistence;
this._completeRedirectFn = _getRedirectResult;
}
CompatPopupRedirectResolver.prototype._initialize = function (auth) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
case 1:
_a.sent();
return [2 /*return*/, this.assertedUnderlyingResolver._initialize(auth)];
}
});
});
};
CompatPopupRedirectResolver.prototype._openPopup = function (auth, provider, authType, eventId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
case 1:
_a.sent();
return [2 /*return*/, this.assertedUnderlyingResolver._openPopup(auth, provider, authType, eventId)];
}
});
});
};
CompatPopupRedirectResolver.prototype._openRedirect = function (auth, provider, authType, eventId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
case 1:
_a.sent();
return [2 /*return*/, this.assertedUnderlyingResolver._openRedirect(auth, provider, authType, eventId)];
}
});
});
};
CompatPopupRedirectResolver.prototype._isIframeWebStorageSupported = function (auth, cb) {
this.assertedUnderlyingResolver._isIframeWebStorageSupported(auth, cb);
};
CompatPopupRedirectResolver.prototype._originValidation = function (auth) {
return this.assertedUnderlyingResolver._originValidation(auth);
};
Object.defineProperty(CompatPopupRedirectResolver.prototype, "_shouldInitProactively", {
get: function () {
return _isLikelyCordova() || BROWSER_RESOLVER._shouldInitProactively;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CompatPopupRedirectResolver.prototype, "assertedUnderlyingResolver", {
get: function () {
_assert$1(this.underlyingResolver, "internal-error" /* INTERNAL_ERROR */);
return this.underlyingResolver;
},
enumerable: false,
configurable: true
});
CompatPopupRedirectResolver.prototype.selectUnderlyingResolver = function () {
return __awaiter(this, void 0, void 0, function () {
var isCordova;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.underlyingResolver) {
return [2 /*return*/];
}
return [4 /*yield*/, _isCordova()];
case 1:
isCordova = _a.sent();
this.underlyingResolver = isCordova ? CORDOVA_RESOLVER : BROWSER_RESOLVER;
return [2 /*return*/];
}
});
});
};
return CompatPopupRedirectResolver;
}());
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function unwrap$1(object) {
return object.unwrap();
}
function wrapped(object) {
return object.wrapped();
}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function credentialFromResponse(userCredential) {
var providerId = userCredential.providerId, _tokenResponse = userCredential._tokenResponse;
return credentialFromObject(userCredential);
}
function attachExtraErrorFields(auth, e) {
var _a;
// The response contains all fields from the server which may or may not
// actually match the underlying type
var response = (_a = e.customData) === null || _a === void 0 ? void 0 : _a._tokenResponse;
if (e.code === 'auth/multi-factor-auth-required') {
var mfaErr = e;
mfaErr.resolver = new MultiFactorResolver(auth, getMultiFactorResolver(auth, e));
}
else if (response) {
var credential = credentialFromObject(e);
var credErr = e;
if (credential) {
credErr.credential = credential;
credErr.tenantId = response.tenantId || undefined;
credErr.email = response.email || undefined;
credErr.phoneNumber = response.phoneNumber || undefined;
}
}
}
function credentialFromObject(object) {
var _tokenResponse = (object instanceof FirebaseError
? object.customData
: object)._tokenResponse;
if (!_tokenResponse) {

@@ -224,6 +428,10 @@ return null;

// Handle phone Auth credential responses, as they have a different format
// from other backend responses (i.e. no providerId).
if ('temporaryProof' in _tokenResponse && 'phoneNumber' in _tokenResponse) {
return PhoneAuthProvider$1.credentialFromResult(userCredential);
// from other backend responses (i.e. no providerId). This is also only the
// case for user credentials (does not work for errors).
if (!(object instanceof FirebaseError)) {
if ('temporaryProof' in _tokenResponse && 'phoneNumber' in _tokenResponse) {
return PhoneAuthProvider$1.credentialFromResult(object);
}
}
var providerId = _tokenResponse.providerId;
// Email and password is not supported as there is no situation where the

@@ -234,11 +442,16 @@ // server would return the password to the client.

}
var provider;
switch (providerId) {
case "google.com" /* GOOGLE */:
return GoogleAuthProvider.credentialFromResult(userCredential);
provider = GoogleAuthProvider;
break;
case "facebook.com" /* FACEBOOK */:
return FacebookAuthProvider.credentialFromResult(userCredential);
provider = FacebookAuthProvider;
break;
case "github.com" /* GITHUB */:
return GithubAuthProvider.credentialFromResult(userCredential);
provider = GithubAuthProvider;
break;
case "twitter.com" /* TWITTER */:
return TwitterAuthProvider.credentialFromResult(userCredential);
provider = TwitterAuthProvider;
break;
default:

@@ -253,17 +466,17 @@ var _a = _tokenResponse, oauthIdToken = _a.oauthIdToken, oauthAccessToken = _a.oauthAccessToken, oauthTokenSecret = _a.oauthTokenSecret, pendingToken = _a.pendingToken, nonce = _a.nonce;

// TODO(avolkovi): uncomment this and get it working with SAML & OIDC
// if (pendingToken) {
// if (providerId.indexOf(compat.constants.SAML_PREFIX) == 0) {
// return new impl.SAMLAuthCredential(providerId, pendingToken);
// } else {
// // OIDC and non-default providers excluding Twitter.
// return new impl.OAuthCredential(
// providerId,
// {
// pendingToken,
// idToken: oauthIdToken,
// accessToken: oauthAccessToken
// },
// providerId);
// }
// }
if (pendingToken) {
if (providerId.startsWith('saml.')) {
return SAMLAuthCredential._create(providerId, pendingToken);
}
else {
// OIDC and non-default providers excluding Twitter.
return OAuthCredential._fromParams({
providerId: providerId,
signInMethod: providerId,
pendingToken: pendingToken,
idToken: oauthIdToken,
accessToken: oauthAccessToken
});
}
}
return new OAuthProvider(providerId).credential({

@@ -275,23 +488,25 @@ idToken: oauthIdToken,

}
return object instanceof FirebaseError
? provider.credentialFromError(object)
: provider.credentialFromResult(object);
}
function convertCredential(auth, credentialPromise) {
return __awaiter(this, void 0, void 0, function () {
var credential, e_1, _a, operationType, user;
return __generator(this, function (_b) {
switch (_b.label) {
var credential, e_1, operationType, user;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_b.trys.push([0, 2, , 3]);
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, credentialPromise];
case 1:
credential = _b.sent();
credential = _a.sent();
return [3 /*break*/, 3];
case 2:
e_1 = _b.sent();
if (e_1.code === 'auth/multi-factor-auth-required') {
e_1.resolver = getMultiFactorResolver(auth, e_1);
e_1 = _a.sent();
if (e_1 instanceof FirebaseError) {
attachExtraErrorFields(auth, e_1);
}
throw e_1;
case 3: return [4 /*yield*/, credential];
case 4:
_a = _b.sent(), operationType = _a.operationType, user = _a.user;
case 3:
operationType = credential.operationType, user = credential.user;
return [2 /*return*/, {

@@ -325,2 +540,26 @@ operationType: operationType,

}
var MultiFactorResolver = /** @class */ (function () {
function MultiFactorResolver(auth, resolver) {
this.resolver = resolver;
this.auth = wrapped(auth);
}
Object.defineProperty(MultiFactorResolver.prototype, "session", {
get: function () {
return this.resolver.session;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MultiFactorResolver.prototype, "hints", {
get: function () {
return this.resolver.hints;
},
enumerable: false,
configurable: true
});
MultiFactorResolver.prototype.resolveSignIn = function (assertion) {
return convertCredential(unwrap$1(this.auth), this.resolver.resolveSignIn(assertion));
};
return MultiFactorResolver;
}());

@@ -343,26 +582,6 @@ /**

*/
function unwrap(object) {
return object.unwrap();
}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var User = /** @class */ (function () {
function User(user) {
this.user = user;
this.multiFactor = multiFactor(user);
function User(_delegate) {
this._delegate = _delegate;
this.multiFactor = multiFactor(_delegate);
}

@@ -376,15 +595,15 @@ User.getOrCreate = function (user) {

User.prototype.delete = function () {
return this.user.delete();
return this._delegate.delete();
};
User.prototype.reload = function () {
return this.user.reload();
return this._delegate.reload();
};
User.prototype.toJSON = function () {
return this.user.toJSON();
return this._delegate.toJSON();
};
User.prototype.getIdTokenResult = function (forceRefresh) {
return this.user.getIdTokenResult(forceRefresh);
return this._delegate.getIdTokenResult(forceRefresh);
};
User.prototype.getIdToken = function (forceRefresh) {
return this.user.getIdToken(forceRefresh);
return this._delegate.getIdToken(forceRefresh);
};

@@ -397,3 +616,3 @@ User.prototype.linkAndRetrieveDataWithCredential = function (credential) {

return __generator(this, function (_a) {
return [2 /*return*/, convertCredential(this.auth, linkWithCredential(this.user, credential))];
return [2 /*return*/, convertCredential(this.auth, linkWithCredential(this._delegate, credential))];
});

@@ -405,3 +624,3 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, convertConfirmationResult(this.auth, linkWithPhoneNumber(this.user, phoneNumber, unwrap(applicationVerifier)))];
return [2 /*return*/, convertConfirmationResult(this.auth, linkWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier))];
});

@@ -413,3 +632,3 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, convertCredential(this.auth, linkWithPopup(this.user, provider, browserPopupRedirectResolver))];
return [2 /*return*/, convertCredential(this.auth, linkWithPopup(this._delegate, provider, CompatPopupRedirectResolver))];
});

@@ -419,3 +638,12 @@ });

User.prototype.linkWithRedirect = function (provider) {
return linkWithRedirect(this.user, provider, browserPopupRedirectResolver);
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _savePersistenceForRedirect(_castAuth(this.auth))];
case 1:
_a.sent();
return [2 /*return*/, linkWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
}
});
});
};

@@ -428,3 +656,3 @@ User.prototype.reauthenticateAndRetrieveDataWithCredential = function (credential) {

return __generator(this, function (_a) {
return [2 /*return*/, convertCredential(this.auth, reauthenticateWithCredential(this.user, credential))];
return [2 /*return*/, convertCredential(this.auth, reauthenticateWithCredential(this._delegate, credential))];
});

@@ -434,12 +662,21 @@ });

User.prototype.reauthenticateWithPhoneNumber = function (phoneNumber, applicationVerifier) {
return convertConfirmationResult(this.auth, reauthenticateWithPhoneNumber(this.user, phoneNumber, unwrap(applicationVerifier)));
return convertConfirmationResult(this.auth, reauthenticateWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
};
User.prototype.reauthenticateWithPopup = function (provider) {
return convertCredential(this.auth, reauthenticateWithPopup(this.user, provider, browserPopupRedirectResolver));
return convertCredential(this.auth, reauthenticateWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
};
User.prototype.reauthenticateWithRedirect = function (provider) {
return reauthenticateWithRedirect(this.user, provider, browserPopupRedirectResolver);
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _savePersistenceForRedirect(_castAuth(this.auth))];
case 1:
_a.sent();
return [2 /*return*/, reauthenticateWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
}
});
});
};
User.prototype.sendEmailVerification = function (actionCodeSettings) {
return sendEmailVerification(this.user, actionCodeSettings);
return sendEmailVerification(this._delegate, actionCodeSettings);
};

@@ -450,3 +687,3 @@ User.prototype.unlink = function (providerId) {

switch (_a.label) {
case 0: return [4 /*yield*/, unlink(this.user, providerId)];
case 0: return [4 /*yield*/, unlink(this._delegate, providerId)];
case 1:

@@ -460,22 +697,19 @@ _a.sent();

User.prototype.updateEmail = function (newEmail) {
return updateEmail(this.user, newEmail);
return updateEmail(this._delegate, newEmail);
};
User.prototype.updatePassword = function (newPassword) {
return updatePassword(this.user, newPassword);
return updatePassword(this._delegate, newPassword);
};
User.prototype.updatePhoneNumber = function (phoneCredential) {
return updatePhoneNumber(this.user, phoneCredential);
return updatePhoneNumber(this._delegate, phoneCredential);
};
User.prototype.updateProfile = function (profile) {
return updateProfile(this.user, profile);
return updateProfile(this._delegate, profile);
};
User.prototype.verifyBeforeUpdateEmail = function (newEmail, actionCodeSettings) {
return verifyBeforeUpdateEmail(this.user, newEmail, actionCodeSettings);
return verifyBeforeUpdateEmail(this._delegate, newEmail, actionCodeSettings);
};
User.prototype.unwrap = function () {
return this.user;
};
Object.defineProperty(User.prototype, "emailVerified", {
get: function () {
return this.user.emailVerified;
return this._delegate.emailVerified;
},

@@ -487,3 +721,3 @@ enumerable: false,

get: function () {
return this.user.isAnonymous;
return this._delegate.isAnonymous;
},

@@ -495,3 +729,3 @@ enumerable: false,

get: function () {
return this.user.metadata;
return this._delegate.metadata;
},

@@ -503,3 +737,3 @@ enumerable: false,

get: function () {
return this.user.phoneNumber;
return this._delegate.phoneNumber;
},

@@ -511,3 +745,3 @@ enumerable: false,

get: function () {
return this.user.providerData;
return this._delegate.providerData;
},

@@ -519,3 +753,3 @@ enumerable: false,

get: function () {
return this.user.refreshToken;
return this._delegate.refreshToken;
},

@@ -527,3 +761,3 @@ enumerable: false,

get: function () {
return this.user.tenantId;
return this._delegate.tenantId;
},

@@ -535,3 +769,3 @@ enumerable: false,

get: function () {
return this.user.displayName;
return this._delegate.displayName;
},

@@ -543,3 +777,3 @@ enumerable: false,

get: function () {
return this.user.email;
return this._delegate.email;
},

@@ -551,3 +785,3 @@ enumerable: false,

get: function () {
return this.user.photoURL;
return this._delegate.photoURL;
},

@@ -559,3 +793,3 @@ enumerable: false,

get: function () {
return this.user.providerId;
return this._delegate.providerId;
},

@@ -567,3 +801,3 @@ enumerable: false,

get: function () {
return this.user.uid;
return this._delegate.uid;
},

@@ -575,3 +809,3 @@ enumerable: false,

get: function () {
return this.user.auth;
return this._delegate.auth;
},

@@ -603,37 +837,61 @@ enumerable: false,

*/
var PERSISTENCE_KEY = 'persistence';
var _assert = _assert$2;
var _assert$2 = _assert$4;
var Auth = /** @class */ (function () {
// private readonly auth: impl.AuthImpl;
function Auth(app, auth) {
function Auth(app, provider) {
this.app = app;
this.auth = auth;
var apiKey = app.options.apiKey;
if (this.auth._deleted) {
if (provider.isInitialized()) {
this._delegate = provider.getImmediate();
this.linkUnderlyingAuth();
return;
}
// Note this is slightly different behavior: in this case, the stored
// persistence is checked *first* rather than last. This is because we want
// the fallback (if no user is found) to be the stored persistence type
var storedPersistence = this.getPersistenceFromRedirect();
var persistences = storedPersistence ? [storedPersistence] : [];
persistences.push(indexedDBLocalPersistence);
// TODO(avolkovi): Implement proper persistence fallback
var hierarchy = persistences.map(_getInstance);
var apiKey = app.options.apiKey;
// TODO: platform needs to be determined using heuristics
_assert(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
_assert$2(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
this.auth._updateErrorMap(debugErrorMap);
// This promise is intended to float; auth initialization happens in the
// background, meanwhile the auth object may be used by the app.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.auth._initializeWithPersistence(hierarchy, browserPopupRedirectResolver);
var persistences = [inMemoryPersistence];
// Only deal with persistences in web environments
if (typeof window !== 'undefined') {
// Note this is slightly different behavior: in this case, the stored
// persistence is checked *first* rather than last. This is because we want
// to prefer stored persistence type in the hierarchy.
persistences = _getPersistencesFromRedirect(apiKey, app.name);
for (var _i = 0, _a = [
indexedDBLocalPersistence,
browserLocalPersistence
]; _i < _a.length; _i++) {
var persistence = _a[_i];
if (!persistences.includes(persistence)) {
persistences.push(persistence);
}
}
}
// TODO: platform needs to be determined using heuristics
_assert$2(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
// Only use a popup/redirect resolver in browser environments
var resolver = typeof window !== 'undefined' ? CompatPopupRedirectResolver : undefined;
this._delegate = provider.initialize({
options: {
persistence: persistences,
popupRedirectResolver: resolver
}
});
this._delegate._updateErrorMap(debugErrorMap);
this.linkUnderlyingAuth();
}
Object.defineProperty(Auth.prototype, "emulatorConfig", {
get: function () {
return this._delegate.emulatorConfig;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Auth.prototype, "currentUser", {
get: function () {
if (!this.auth.currentUser) {
if (!this._delegate.currentUser) {
return null;
}
return User.getOrCreate(this.auth.currentUser);
return User.getOrCreate(this._delegate.currentUser);
},

@@ -645,3 +903,3 @@ enumerable: false,

get: function () {
return this.auth.languageCode;
return this._delegate.languageCode;
},

@@ -653,3 +911,3 @@ enumerable: false,

get: function () {
return this.auth.settings;
return this._delegate.settings;
},

@@ -661,3 +919,3 @@ enumerable: false,

get: function () {
return this.auth.tenantId;
return this._delegate.tenantId;
},

@@ -668,18 +926,18 @@ enumerable: false,

Auth.prototype.useDeviceLanguage = function () {
this.auth.useDeviceLanguage();
this._delegate.useDeviceLanguage();
};
Auth.prototype.signOut = function () {
return this.auth.signOut();
return this._delegate.signOut();
};
Auth.prototype.useEmulator = function (url, options) {
this.auth.useEmulator(url, options);
useAuthEmulator(this._delegate, url, options);
};
Auth.prototype.applyActionCode = function (code) {
return applyActionCode(this.auth, code);
return applyActionCode(this._delegate, code);
};
Auth.prototype.checkActionCode = function (code) {
return checkActionCode(this.auth, code);
return checkActionCode(this._delegate, code);
};
Auth.prototype.confirmPasswordReset = function (code, newPassword) {
return confirmPasswordReset(this.auth, code, newPassword);
return confirmPasswordReset(this._delegate, code, newPassword);
};

@@ -689,3 +947,3 @@ Auth.prototype.createUserWithEmailAndPassword = function (email, password) {

return __generator(this, function (_a) {
return [2 /*return*/, convertCredential(this.auth, createUserWithEmailAndPassword(this.auth, email, password))];
return [2 /*return*/, convertCredential(this._delegate, createUserWithEmailAndPassword(this._delegate, email, password))];
});

@@ -698,6 +956,6 @@ });

Auth.prototype.fetchSignInMethodsForEmail = function (email) {
return fetchSignInMethodsForEmail(this.auth, email);
return fetchSignInMethodsForEmail(this._delegate, email);
};
Auth.prototype.isSignInWithEmailLink = function (emailLink) {
return isSignInWithEmailLink(this.auth, emailLink);
return isSignInWithEmailLink(this._delegate, emailLink);
};

@@ -710,4 +968,4 @@ Auth.prototype.getRedirectResult = function () {

case 0:
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [4 /*yield*/, getRedirectResult(this.auth, browserPopupRedirectResolver)];
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [4 /*yield*/, getRedirectResult(this._delegate, CompatPopupRedirectResolver)];
case 1:

@@ -721,3 +979,3 @@ credential = _a.sent();

}
return [2 /*return*/, convertCredential(this.auth, Promise.resolve(credential))];
return [2 /*return*/, convertCredential(this._delegate, Promise.resolve(credential))];
}

@@ -729,35 +987,47 @@ });

var _a = wrapObservers(nextOrObserver, errorFn, completed), next = _a.next, error = _a.error, complete = _a.complete;
return this.auth.onAuthStateChanged(next, error, complete);
return this._delegate.onAuthStateChanged(next, error, complete);
};
Auth.prototype.onIdTokenChanged = function (nextOrObserver, errorFn, completed) {
var _a = wrapObservers(nextOrObserver, errorFn, completed), next = _a.next, error = _a.error, complete = _a.complete;
return this.auth.onIdTokenChanged(next, error, complete);
return this._delegate.onIdTokenChanged(next, error, complete);
};
Auth.prototype.sendSignInLinkToEmail = function (email, actionCodeSettings) {
return sendSignInLinkToEmail(this.auth, email, actionCodeSettings);
return sendSignInLinkToEmail(this._delegate, email, actionCodeSettings);
};
Auth.prototype.sendPasswordResetEmail = function (email, actionCodeSettings) {
return sendPasswordResetEmail(this.auth, email, actionCodeSettings || undefined);
return sendPasswordResetEmail(this._delegate, email, actionCodeSettings || undefined);
};
Auth.prototype.setPersistence = function (persistence) {
return __awaiter(this, void 0, void 0, function () {
function convertPersistence(auth, persistenceCompat) {
_validatePersistenceArgument(auth, persistence);
switch (persistenceCompat) {
case Persistence.SESSION:
return browserSessionPersistence;
case Persistence.LOCAL:
return isIndexedDBAvailable()
var converted, _a, isIndexedDBFullySupported;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_validatePersistenceArgument(this._delegate, persistence);
_a = persistence;
switch (_a) {
case Persistence.SESSION: return [3 /*break*/, 1];
case Persistence.LOCAL: return [3 /*break*/, 2];
case Persistence.NONE: return [3 /*break*/, 4];
}
return [3 /*break*/, 5];
case 1:
converted = browserSessionPersistence;
return [3 /*break*/, 6];
case 2: return [4 /*yield*/, _getInstance(indexedDBLocalPersistence)
._isAvailable()];
case 3:
isIndexedDBFullySupported = _b.sent();
converted = isIndexedDBFullySupported
? indexedDBLocalPersistence
: browserLocalPersistence;
case Persistence.NONE:
return inMemoryPersistence;
default:
return _fail("argument-error" /* ARGUMENT_ERROR */, {
appName: auth.name
});
return [3 /*break*/, 6];
case 4:
converted = inMemoryPersistence;
return [3 /*break*/, 6];
case 5: return [2 /*return*/, _fail("argument-error" /* ARGUMENT_ERROR */, {
appName: this._delegate.name
})];
case 6: return [2 /*return*/, this._delegate.setPersistence(converted)];
}
}
return __generator(this, function (_a) {
return [2 /*return*/, this.auth.setPersistence(convertPersistence(this.auth, persistence))];
});

@@ -770,18 +1040,18 @@ });

Auth.prototype.signInAnonymously = function () {
return convertCredential(this.auth, signInAnonymously(this.auth));
return convertCredential(this._delegate, signInAnonymously(this._delegate));
};
Auth.prototype.signInWithCredential = function (credential) {
return convertCredential(this.auth, signInWithCredential(this.auth, credential));
return convertCredential(this._delegate, signInWithCredential(this._delegate, credential));
};
Auth.prototype.signInWithCustomToken = function (token) {
return convertCredential(this.auth, signInWithCustomToken(this.auth, token));
return convertCredential(this._delegate, signInWithCustomToken(this._delegate, token));
};
Auth.prototype.signInWithEmailAndPassword = function (email, password) {
return convertCredential(this.auth, signInWithEmailAndPassword(this.auth, email, password));
return convertCredential(this._delegate, signInWithEmailAndPassword(this._delegate, email, password));
};
Auth.prototype.signInWithEmailLink = function (email, emailLink) {
return convertCredential(this.auth, signInWithEmailLink(this.auth, email, emailLink));
return convertCredential(this._delegate, signInWithEmailLink(this._delegate, email, emailLink));
};
Auth.prototype.signInWithPhoneNumber = function (phoneNumber, applicationVerifier) {
return convertConfirmationResult(this.auth, signInWithPhoneNumber(this.auth, phoneNumber, unwrap(applicationVerifier)));
return convertConfirmationResult(this._delegate, signInWithPhoneNumber(this._delegate, phoneNumber, unwrap$1(applicationVerifier)));
};

@@ -791,4 +1061,4 @@ Auth.prototype.signInWithPopup = function (provider) {

return __generator(this, function (_a) {
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [2 /*return*/, convertCredential(this.auth, signInWithPopup(this.auth, provider, browserPopupRedirectResolver))];
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [2 /*return*/, convertCredential(this._delegate, signInWithPopup(this._delegate, provider, CompatPopupRedirectResolver))];
});

@@ -800,5 +1070,10 @@ });

return __generator(this, function (_a) {
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
this.savePersistenceForRedirect();
return [2 /*return*/, signInWithRedirect(this.auth, provider, browserPopupRedirectResolver)];
switch (_a.label) {
case 0:
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [4 /*yield*/, _savePersistenceForRedirect(this._delegate)];
case 1:
_a.sent();
return [2 /*return*/, signInWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
}
});

@@ -808,45 +1083,21 @@ });

Auth.prototype.updateCurrentUser = function (user) {
return this.auth.updateCurrentUser(unwrap(user));
// remove ts-ignore once overloads are defined for exp functions to accept compat objects
// @ts-ignore
return this._delegate.updateCurrentUser(unwrap$1(user));
};
Auth.prototype.verifyPasswordResetCode = function (code) {
return verifyPasswordResetCode(this.auth, code);
return verifyPasswordResetCode(this._delegate, code);
};
Auth.prototype.unwrap = function () {
return this.auth;
return this._delegate;
};
Auth.prototype._delete = function () {
return this.auth._delete();
return this._delegate._delete();
};
Auth.prototype.savePersistenceForRedirect = function () {
var win = getSelfWindow();
var key = _persistenceKeyName(PERSISTENCE_KEY, this.auth.config.apiKey, this.auth.name);
if (win === null || win === void 0 ? void 0 : win.sessionStorage) {
win.sessionStorage.setItem(key, this.auth._getPersistence());
}
Auth.prototype.linkUnderlyingAuth = function () {
var _this = this;
this._delegate.wrapped = function () { return _this; };
};
Auth.prototype.getPersistenceFromRedirect = function () {
var win = getSelfWindow();
if (!(win === null || win === void 0 ? void 0 : win.sessionStorage)) {
return null;
}
var key = _persistenceKeyName(PERSISTENCE_KEY, this.auth.config.apiKey, this.auth.name);
var persistence = win.sessionStorage.getItem(key);
switch (persistence) {
case inMemoryPersistence.type:
return inMemoryPersistence;
case indexedDBLocalPersistence.type:
return indexedDBLocalPersistence;
case browserSessionPersistence.type:
return browserSessionPersistence;
case browserLocalPersistence.type:
return browserLocalPersistence;
default:
return null;
}
};
return Auth;
}());
function getSelfWindow() {
return typeof window !== 'undefined' ? window : null;
}
function wrapObservers(nextOrObserver, error, complete) {

@@ -888,3 +1139,5 @@ var next = nextOrObserver;

this.providerId = 'phone';
this.phoneProvider = new PhoneAuthProvider$1(unwrap(firebase.auth()));
// TODO: remove ts-ignore when moving types from auth-types to auth-compat
// @ts-ignore
this._delegate = new PhoneAuthProvider$1(unwrap(firebase.auth()));
}

@@ -895,9 +1148,9 @@ PhoneAuthProvider.credential = function (verificationId, verificationCode) {

PhoneAuthProvider.prototype.verifyPhoneNumber = function (phoneInfoOptions, applicationVerifier) {
return this.phoneProvider.verifyPhoneNumber(
return this._delegate.verifyPhoneNumber(
// The implementation matches but the types are subtly incompatible
// eslint-disable-next-line @typescript-eslint/no-explicit-any
phoneInfoOptions, unwrap(applicationVerifier));
phoneInfoOptions, applicationVerifier);
};
PhoneAuthProvider.prototype.unwrap = function () {
return this.phoneProvider;
return this._delegate;
};

@@ -925,3 +1178,3 @@ PhoneAuthProvider.PHONE_SIGN_IN_METHOD = PhoneAuthProvider$1.PHONE_SIGN_IN_METHOD;

*/
var _assert$1 = _assert$2;
var _assert$3 = _assert$4;
var RecaptchaVerifier = /** @class */ (function () {

@@ -932,22 +1185,22 @@ function RecaptchaVerifier(container, parameters, app) {

// API key is required for web client RPC calls.
_assert$1((_a = app.options) === null || _a === void 0 ? void 0 : _a.apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
_assert$3((_a = app.options) === null || _a === void 0 ? void 0 : _a.apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
this.verifier = new RecaptchaVerifier$1(container,
this._delegate = new RecaptchaVerifier$1(container,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
parameters, unwrap(app.auth()));
this.type = this.verifier.type;
parameters,
// TODO: remove ts-ignore when moving types from auth-types to auth-compat
// @ts-ignore
app.auth());
this.type = this._delegate.type;
}
RecaptchaVerifier.prototype.clear = function () {
this.verifier.clear();
this._delegate.clear();
};
RecaptchaVerifier.prototype.render = function () {
return this.verifier.render();
return this._delegate.render();
};
RecaptchaVerifier.prototype.verify = function () {
return this.verifier.verify();
return this._delegate.verify();
};
RecaptchaVerifier.prototype.unwrap = function () {
return this.verifier;
};
return RecaptchaVerifier;

@@ -972,3 +1225,3 @@ }());

*/
var AUTH_TYPE = 'auth';
var AUTH_TYPE = 'auth-compat';
// Create auth components to register with firebase.

@@ -979,5 +1232,5 @@ // Provides Auth public APIs.

// getImmediate for FirebaseApp will always succeed
var app = container.getProvider('app').getImmediate();
var auth = container.getProvider('auth-exp').getImmediate();
return new Auth(app, auth);
var app = container.getProvider('app-compat').getImmediate();
var authProvider = container.getProvider('auth-exp');
return new Auth(app, authProvider);
}, "PUBLIC" /* PUBLIC */)

@@ -1013,6 +1266,5 @@ .setServiceProps({

.setMultipleInstances(false));
instance.registerVersion('auth', version);
instance.registerVersion(name, version);
}
registerAuth(_getClientPlatform());
registerAuthCompat(firebase);
//# sourceMappingURL=index.esm.js.map
import firebase from '@firebase/app-compat';
import { _generateEventId, _assert as _assert$2, getAdditionalUserInfo, PhoneAuthProvider as PhoneAuthProvider$1, OAuthProvider, TwitterAuthProvider, GithubAuthProvider, FacebookAuthProvider, GoogleAuthProvider, getMultiFactorResolver, multiFactor, linkWithCredential, linkWithPhoneNumber, linkWithPopup, browserPopupRedirectResolver, linkWithRedirect, reauthenticateWithCredential, reauthenticateWithPhoneNumber, reauthenticateWithPopup, reauthenticateWithRedirect, sendEmailVerification, unlink, updateEmail, updatePassword, updatePhoneNumber, updateProfile, verifyBeforeUpdateEmail, _getInstance, debugErrorMap, applyActionCode, checkActionCode, confirmPasswordReset, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, isSignInWithEmailLink, getRedirectResult, sendSignInLinkToEmail, sendPasswordResetEmail, signInAnonymously, signInWithCredential, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signInWithPhoneNumber, signInWithPopup, signInWithRedirect, verifyPasswordResetCode, _persistenceKeyName, browserLocalPersistence, browserSessionPersistence, indexedDBLocalPersistence, inMemoryPersistence, _fail, RecaptchaVerifier as RecaptchaVerifier$1, registerAuth, EmailAuthProvider, PhoneMultiFactorGenerator, AuthCredential } from '@firebase/auth/internal';
import '@firebase/auth-types';
import { _generateEventId, _persistenceKeyName, browserSessionPersistence, indexedDBLocalPersistence, inMemoryPersistence, _assert as _assert$4, _getInstance, browserPopupRedirectResolver, cordovaPopupRedirectResolver, _getRedirectResult, getAdditionalUserInfo, PhoneAuthProvider as PhoneAuthProvider$1, SAMLAuthCredential, OAuthCredential, OAuthProvider, getMultiFactorResolver, TwitterAuthProvider, GithubAuthProvider, FacebookAuthProvider, GoogleAuthProvider, multiFactor, linkWithCredential, linkWithPhoneNumber, linkWithPopup, _castAuth, linkWithRedirect, reauthenticateWithCredential, reauthenticateWithPhoneNumber, reauthenticateWithPopup, reauthenticateWithRedirect, sendEmailVerification, unlink, updateEmail, updatePassword, updatePhoneNumber, updateProfile, verifyBeforeUpdateEmail, browserLocalPersistence, debugErrorMap, useAuthEmulator, applyActionCode, checkActionCode, confirmPasswordReset, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, isSignInWithEmailLink, getRedirectResult, sendSignInLinkToEmail, sendPasswordResetEmail, _fail, signInAnonymously, signInWithCredential, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signInWithPhoneNumber, signInWithPopup, signInWithRedirect, verifyPasswordResetCode, RecaptchaVerifier as RecaptchaVerifier$1, EmailAuthProvider, PhoneMultiFactorGenerator, AuthCredential } from '@firebase/auth/internal';
import { Component } from '@firebase/component';
import '@firebase/app-types';
import { isNode, isReactNative, isBrowserExtension, getUA, isIE, isIndexedDBAvailable } from '@firebase/util';
import { isBrowserExtension, isReactNative, isNode, getUA, isIE, isIndexedDBAvailable, FirebaseError } from '@firebase/util';
var version = "0.0.900";
var name = "@firebase/auth-compat";
var version = "0.0.900-exp.520ca39d0";

@@ -26,2 +25,3 @@ /**

*/
const CORDOVA_ONDEVICEREADY_TIMEOUT_MS = 1000;
function _getCurrentScheme() {

@@ -129,13 +129,20 @@ var _a;

}
function _getClientPlatform() {
if (isNode()) {
return "Node" /* NODE */;
/** Quick check that indicates the platform *may* be Cordova */
function _isLikelyCordova() {
return _isAndroidOrIosCordovaScheme() && typeof document !== 'undefined';
}
async function _isCordova() {
if (!_isLikelyCordova()) {
return false;
}
if (isReactNative()) {
return "ReactNative" /* REACT_NATIVE */;
}
if (_isWorker()) {
return "Worker" /* WORKER */;
}
return "Browser" /* BROWSER */;
return new Promise(resolve => {
const timeoutId = setTimeout(() => {
// We've waited long enough; the telltale Cordova event didn't happen
resolve(false);
}, CORDOVA_ONDEVICEREADY_TIMEOUT_MS);
document.addEventListener('deviceready', () => {
clearTimeout(timeoutId);
resolve(true);
});
});
}

@@ -160,6 +167,8 @@

const Persistence = {
LOCAL: 'LOCAL',
NONE: 'NONE',
SESSION: 'SESSION'
LOCAL: 'local',
NONE: 'none',
SESSION: 'session'
};
const _assert = _assert$4;
const PERSISTENCE_KEY = 'persistence';
/**

@@ -170,7 +179,7 @@ * Validates that an argument is a valid persistence value. If an invalid type

function _validatePersistenceArgument(auth, persistence) {
_assert$2(Object.values(Persistence).includes(persistence), auth, "invalid-persistence-type" /* INVALID_PERSISTENCE */);
_assert(Object.values(Persistence).includes(persistence), auth, "invalid-persistence-type" /* INVALID_PERSISTENCE */);
// Validate if the specified type is supported in the current environment.
if (isReactNative()) {
// This is only supported in a browser.
_assert$2(persistence !== Persistence.SESSION, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence !== Persistence.SESSION, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
return;

@@ -180,3 +189,3 @@ }

// Only none is supported in Node.js.
_assert$2(persistence === Persistence.NONE, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence === Persistence.NONE, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
return;

@@ -187,3 +196,3 @@ }

// If indexedDB not supported and LOCAL provided, throw an error
_assert$2(persistence === Persistence.NONE ||
_assert(persistence === Persistence.NONE ||
(persistence === Persistence.LOCAL && isIndexedDBAvailable()), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);

@@ -193,4 +202,33 @@ return;

// This is restricted by what the browser supports.
_assert$2(persistence === Persistence.NONE || _isWebStorageSupported(), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence === Persistence.NONE || _isWebStorageSupported(), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
}
async function _savePersistenceForRedirect(auth) {
await auth._initializationPromise;
const win = getSelfWindow();
const key = _persistenceKeyName(PERSISTENCE_KEY, auth.config.apiKey, auth.name);
if (win === null || win === void 0 ? void 0 : win.sessionStorage) {
win.sessionStorage.setItem(key, auth._getPersistence());
}
}
function _getPersistencesFromRedirect(apiKey, appName) {
const win = getSelfWindow();
if (!(win === null || win === void 0 ? void 0 : win.sessionStorage)) {
return [];
}
const key = _persistenceKeyName(PERSISTENCE_KEY, apiKey, appName);
const persistence = win.sessionStorage.getItem(key);
switch (persistence) {
case Persistence.NONE:
return [inMemoryPersistence];
case Persistence.LOCAL:
return [indexedDBLocalPersistence, browserSessionPersistence];
case Persistence.SESSION:
return [browserSessionPersistence];
default:
return [];
}
}
function getSelfWindow() {
return typeof window !== 'undefined' ? window : null;
}

@@ -213,4 +251,114 @@ /**

*/
const _assert$1 = _assert$4;
const BROWSER_RESOLVER = _getInstance(browserPopupRedirectResolver);
const CORDOVA_RESOLVER = _getInstance(cordovaPopupRedirectResolver);
/** Platform-agnostic popup-redirect resolver */
class CompatPopupRedirectResolver {
constructor() {
this.underlyingResolver = null;
this._redirectPersistence = browserSessionPersistence;
this._completeRedirectFn = _getRedirectResult;
}
async _initialize(auth) {
await this.selectUnderlyingResolver();
return this.assertedUnderlyingResolver._initialize(auth);
}
async _openPopup(auth, provider, authType, eventId) {
await this.selectUnderlyingResolver();
return this.assertedUnderlyingResolver._openPopup(auth, provider, authType, eventId);
}
async _openRedirect(auth, provider, authType, eventId) {
await this.selectUnderlyingResolver();
return this.assertedUnderlyingResolver._openRedirect(auth, provider, authType, eventId);
}
_isIframeWebStorageSupported(auth, cb) {
this.assertedUnderlyingResolver._isIframeWebStorageSupported(auth, cb);
}
_originValidation(auth) {
return this.assertedUnderlyingResolver._originValidation(auth);
}
get _shouldInitProactively() {
return _isLikelyCordova() || BROWSER_RESOLVER._shouldInitProactively;
}
get assertedUnderlyingResolver() {
_assert$1(this.underlyingResolver, "internal-error" /* INTERNAL_ERROR */);
return this.underlyingResolver;
}
async selectUnderlyingResolver() {
if (this.underlyingResolver) {
return;
}
// We haven't yet determined whether or not we're in Cordova; go ahead
// and determine that state now.
const isCordova = await _isCordova();
this.underlyingResolver = isCordova ? CORDOVA_RESOLVER : BROWSER_RESOLVER;
}
}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function unwrap$1(object) {
return object.unwrap();
}
function wrapped(object) {
return object.wrapped();
}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function credentialFromResponse(userCredential) {
const { providerId, _tokenResponse } = userCredential;
return credentialFromObject(userCredential);
}
function attachExtraErrorFields(auth, e) {
var _a;
// The response contains all fields from the server which may or may not
// actually match the underlying type
const response = (_a = e.customData) === null || _a === void 0 ? void 0 : _a._tokenResponse;
if (e.code === 'auth/multi-factor-auth-required') {
const mfaErr = e;
mfaErr.resolver = new MultiFactorResolver(auth, getMultiFactorResolver(auth, e));
}
else if (response) {
const credential = credentialFromObject(e);
const credErr = e;
if (credential) {
credErr.credential = credential;
credErr.tenantId = response.tenantId || undefined;
credErr.email = response.email || undefined;
credErr.phoneNumber = response.phoneNumber || undefined;
}
}
}
function credentialFromObject(object) {
const { _tokenResponse } = (object instanceof FirebaseError
? object.customData
: object);
if (!_tokenResponse) {

@@ -220,6 +368,10 @@ return null;

// Handle phone Auth credential responses, as they have a different format
// from other backend responses (i.e. no providerId).
if ('temporaryProof' in _tokenResponse && 'phoneNumber' in _tokenResponse) {
return PhoneAuthProvider$1.credentialFromResult(userCredential);
// from other backend responses (i.e. no providerId). This is also only the
// case for user credentials (does not work for errors).
if (!(object instanceof FirebaseError)) {
if ('temporaryProof' in _tokenResponse && 'phoneNumber' in _tokenResponse) {
return PhoneAuthProvider$1.credentialFromResult(object);
}
}
const providerId = _tokenResponse.providerId;
// Email and password is not supported as there is no situation where the

@@ -230,11 +382,16 @@ // server would return the password to the client.

}
let provider;
switch (providerId) {
case "google.com" /* GOOGLE */:
return GoogleAuthProvider.credentialFromResult(userCredential);
provider = GoogleAuthProvider;
break;
case "facebook.com" /* FACEBOOK */:
return FacebookAuthProvider.credentialFromResult(userCredential);
provider = FacebookAuthProvider;
break;
case "github.com" /* GITHUB */:
return GithubAuthProvider.credentialFromResult(userCredential);
provider = GithubAuthProvider;
break;
case "twitter.com" /* TWITTER */:
return TwitterAuthProvider.credentialFromResult(userCredential);
provider = TwitterAuthProvider;
break;
default:

@@ -249,17 +406,17 @@ const { oauthIdToken, oauthAccessToken, oauthTokenSecret, pendingToken, nonce } = _tokenResponse;

// TODO(avolkovi): uncomment this and get it working with SAML & OIDC
// if (pendingToken) {
// if (providerId.indexOf(compat.constants.SAML_PREFIX) == 0) {
// return new impl.SAMLAuthCredential(providerId, pendingToken);
// } else {
// // OIDC and non-default providers excluding Twitter.
// return new impl.OAuthCredential(
// providerId,
// {
// pendingToken,
// idToken: oauthIdToken,
// accessToken: oauthAccessToken
// },
// providerId);
// }
// }
if (pendingToken) {
if (providerId.startsWith('saml.')) {
return SAMLAuthCredential._create(providerId, pendingToken);
}
else {
// OIDC and non-default providers excluding Twitter.
return OAuthCredential._fromParams({
providerId,
signInMethod: providerId,
pendingToken,
idToken: oauthIdToken,
accessToken: oauthAccessToken
});
}
}
return new OAuthProvider(providerId).credential({

@@ -271,2 +428,5 @@ idToken: oauthIdToken,

}
return object instanceof FirebaseError
? provider.credentialFromError(object)
: provider.credentialFromResult(object);
}

@@ -279,8 +439,8 @@ async function convertCredential(auth, credentialPromise) {

catch (e) {
if (e.code === 'auth/multi-factor-auth-required') {
e.resolver = getMultiFactorResolver(auth, e);
if (e instanceof FirebaseError) {
attachExtraErrorFields(auth, e);
}
throw e;
}
const { operationType, user } = await credential;
const { operationType, user } = credential;
return {

@@ -300,21 +460,16 @@ operationType,

}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function unwrap(object) {
return object.unwrap();
class MultiFactorResolver {
constructor(auth, resolver) {
this.resolver = resolver;
this.auth = wrapped(auth);
}
get session() {
return this.resolver.session;
}
get hints() {
return this.resolver.hints;
}
resolveSignIn(assertion) {
return convertCredential(unwrap$1(this.auth), this.resolver.resolveSignIn(assertion));
}
}

@@ -339,5 +494,5 @@

class User {
constructor(user) {
this.user = user;
this.multiFactor = multiFactor(user);
constructor(_delegate) {
this._delegate = _delegate;
this.multiFactor = multiFactor(_delegate);
}

@@ -351,15 +506,15 @@ static getOrCreate(user) {

delete() {
return this.user.delete();
return this._delegate.delete();
}
reload() {
return this.user.reload();
return this._delegate.reload();
}
toJSON() {
return this.user.toJSON();
return this._delegate.toJSON();
}
getIdTokenResult(forceRefresh) {
return this.user.getIdTokenResult(forceRefresh);
return this._delegate.getIdTokenResult(forceRefresh);
}
getIdToken(forceRefresh) {
return this.user.getIdToken(forceRefresh);
return this._delegate.getIdToken(forceRefresh);
}

@@ -370,12 +525,13 @@ linkAndRetrieveDataWithCredential(credential) {

async linkWithCredential(credential) {
return convertCredential(this.auth, linkWithCredential(this.user, credential));
return convertCredential(this.auth, linkWithCredential(this._delegate, credential));
}
async linkWithPhoneNumber(phoneNumber, applicationVerifier) {
return convertConfirmationResult(this.auth, linkWithPhoneNumber(this.user, phoneNumber, unwrap(applicationVerifier)));
return convertConfirmationResult(this.auth, linkWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
}
async linkWithPopup(provider) {
return convertCredential(this.auth, linkWithPopup(this.user, provider, browserPopupRedirectResolver));
return convertCredential(this.auth, linkWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
}
linkWithRedirect(provider) {
return linkWithRedirect(this.user, provider, browserPopupRedirectResolver);
async linkWithRedirect(provider) {
await _savePersistenceForRedirect(_castAuth(this.auth));
return linkWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
}

@@ -386,76 +542,74 @@ reauthenticateAndRetrieveDataWithCredential(credential) {

async reauthenticateWithCredential(credential) {
return convertCredential(this.auth, reauthenticateWithCredential(this.user, credential));
return convertCredential(this.auth, reauthenticateWithCredential(this._delegate, credential));
}
reauthenticateWithPhoneNumber(phoneNumber, applicationVerifier) {
return convertConfirmationResult(this.auth, reauthenticateWithPhoneNumber(this.user, phoneNumber, unwrap(applicationVerifier)));
return convertConfirmationResult(this.auth, reauthenticateWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
}
reauthenticateWithPopup(provider) {
return convertCredential(this.auth, reauthenticateWithPopup(this.user, provider, browserPopupRedirectResolver));
return convertCredential(this.auth, reauthenticateWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
}
reauthenticateWithRedirect(provider) {
return reauthenticateWithRedirect(this.user, provider, browserPopupRedirectResolver);
async reauthenticateWithRedirect(provider) {
await _savePersistenceForRedirect(_castAuth(this.auth));
return reauthenticateWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
}
sendEmailVerification(actionCodeSettings) {
return sendEmailVerification(this.user, actionCodeSettings);
return sendEmailVerification(this._delegate, actionCodeSettings);
}
async unlink(providerId) {
await unlink(this.user, providerId);
await unlink(this._delegate, providerId);
return this;
}
updateEmail(newEmail) {
return updateEmail(this.user, newEmail);
return updateEmail(this._delegate, newEmail);
}
updatePassword(newPassword) {
return updatePassword(this.user, newPassword);
return updatePassword(this._delegate, newPassword);
}
updatePhoneNumber(phoneCredential) {
return updatePhoneNumber(this.user, phoneCredential);
return updatePhoneNumber(this._delegate, phoneCredential);
}
updateProfile(profile) {
return updateProfile(this.user, profile);
return updateProfile(this._delegate, profile);
}
verifyBeforeUpdateEmail(newEmail, actionCodeSettings) {
return verifyBeforeUpdateEmail(this.user, newEmail, actionCodeSettings);
return verifyBeforeUpdateEmail(this._delegate, newEmail, actionCodeSettings);
}
unwrap() {
return this.user;
}
get emailVerified() {
return this.user.emailVerified;
return this._delegate.emailVerified;
}
get isAnonymous() {
return this.user.isAnonymous;
return this._delegate.isAnonymous;
}
get metadata() {
return this.user.metadata;
return this._delegate.metadata;
}
get phoneNumber() {
return this.user.phoneNumber;
return this._delegate.phoneNumber;
}
get providerData() {
return this.user.providerData;
return this._delegate.providerData;
}
get refreshToken() {
return this.user.refreshToken;
return this._delegate.refreshToken;
}
get tenantId() {
return this.user.tenantId;
return this._delegate.tenantId;
}
get displayName() {
return this.user.displayName;
return this._delegate.displayName;
}
get email() {
return this.user.email;
return this._delegate.email;
}
get photoURL() {
return this.user.photoURL;
return this._delegate.photoURL;
}
get providerId() {
return this.user.providerId;
return this._delegate.providerId;
}
get uid() {
return this.user.uid;
return this._delegate.uid;
}
get auth() {
return this.user.auth;
return this._delegate.auth;
}

@@ -483,66 +637,85 @@ }

*/
const PERSISTENCE_KEY = 'persistence';
const _assert = _assert$2;
const _assert$2 = _assert$4;
class Auth {
// private readonly auth: impl.AuthImpl;
constructor(app, auth) {
constructor(app, provider) {
this.app = app;
this.auth = auth;
const { apiKey } = app.options;
if (this.auth._deleted) {
if (provider.isInitialized()) {
this._delegate = provider.getImmediate();
this.linkUnderlyingAuth();
return;
}
// Note this is slightly different behavior: in this case, the stored
// persistence is checked *first* rather than last. This is because we want
// the fallback (if no user is found) to be the stored persistence type
const storedPersistence = this.getPersistenceFromRedirect();
const persistences = storedPersistence ? [storedPersistence] : [];
persistences.push(indexedDBLocalPersistence);
// TODO(avolkovi): Implement proper persistence fallback
const hierarchy = persistences.map(_getInstance);
const { apiKey } = app.options;
// TODO: platform needs to be determined using heuristics
_assert(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
_assert$2(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
this.auth._updateErrorMap(debugErrorMap);
// This promise is intended to float; auth initialization happens in the
// background, meanwhile the auth object may be used by the app.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.auth._initializeWithPersistence(hierarchy, browserPopupRedirectResolver);
let persistences = [inMemoryPersistence];
// Only deal with persistences in web environments
if (typeof window !== 'undefined') {
// Note this is slightly different behavior: in this case, the stored
// persistence is checked *first* rather than last. This is because we want
// to prefer stored persistence type in the hierarchy.
persistences = _getPersistencesFromRedirect(apiKey, app.name);
for (const persistence of [
indexedDBLocalPersistence,
browserLocalPersistence
]) {
if (!persistences.includes(persistence)) {
persistences.push(persistence);
}
}
}
// TODO: platform needs to be determined using heuristics
_assert$2(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
// Only use a popup/redirect resolver in browser environments
const resolver = typeof window !== 'undefined' ? CompatPopupRedirectResolver : undefined;
this._delegate = provider.initialize({
options: {
persistence: persistences,
popupRedirectResolver: resolver
}
});
this._delegate._updateErrorMap(debugErrorMap);
this.linkUnderlyingAuth();
}
get emulatorConfig() {
return this._delegate.emulatorConfig;
}
get currentUser() {
if (!this.auth.currentUser) {
if (!this._delegate.currentUser) {
return null;
}
return User.getOrCreate(this.auth.currentUser);
return User.getOrCreate(this._delegate.currentUser);
}
get languageCode() {
return this.auth.languageCode;
return this._delegate.languageCode;
}
get settings() {
return this.auth.settings;
return this._delegate.settings;
}
get tenantId() {
return this.auth.tenantId;
return this._delegate.tenantId;
}
useDeviceLanguage() {
this.auth.useDeviceLanguage();
this._delegate.useDeviceLanguage();
}
signOut() {
return this.auth.signOut();
return this._delegate.signOut();
}
useEmulator(url, options) {
this.auth.useEmulator(url, options);
useAuthEmulator(this._delegate, url, options);
}
applyActionCode(code) {
return applyActionCode(this.auth, code);
return applyActionCode(this._delegate, code);
}
checkActionCode(code) {
return checkActionCode(this.auth, code);
return checkActionCode(this._delegate, code);
}
confirmPasswordReset(code, newPassword) {
return confirmPasswordReset(this.auth, code, newPassword);
return confirmPasswordReset(this._delegate, code, newPassword);
}
async createUserWithEmailAndPassword(email, password) {
return convertCredential(this.auth, createUserWithEmailAndPassword(this.auth, email, password));
return convertCredential(this._delegate, createUserWithEmailAndPassword(this._delegate, email, password));
}

@@ -553,10 +726,10 @@ fetchProvidersForEmail(email) {

fetchSignInMethodsForEmail(email) {
return fetchSignInMethodsForEmail(this.auth, email);
return fetchSignInMethodsForEmail(this._delegate, email);
}
isSignInWithEmailLink(emailLink) {
return isSignInWithEmailLink(this.auth, emailLink);
return isSignInWithEmailLink(this._delegate, emailLink);
}
async getRedirectResult() {
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
const credential = await getRedirectResult(this.auth, browserPopupRedirectResolver);
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
const credential = await getRedirectResult(this._delegate, CompatPopupRedirectResolver);
if (!credential) {

@@ -568,37 +741,42 @@ return {

}
return convertCredential(this.auth, Promise.resolve(credential));
return convertCredential(this._delegate, Promise.resolve(credential));
}
onAuthStateChanged(nextOrObserver, errorFn, completed) {
const { next, error, complete } = wrapObservers(nextOrObserver, errorFn, completed);
return this.auth.onAuthStateChanged(next, error, complete);
return this._delegate.onAuthStateChanged(next, error, complete);
}
onIdTokenChanged(nextOrObserver, errorFn, completed) {
const { next, error, complete } = wrapObservers(nextOrObserver, errorFn, completed);
return this.auth.onIdTokenChanged(next, error, complete);
return this._delegate.onIdTokenChanged(next, error, complete);
}
sendSignInLinkToEmail(email, actionCodeSettings) {
return sendSignInLinkToEmail(this.auth, email, actionCodeSettings);
return sendSignInLinkToEmail(this._delegate, email, actionCodeSettings);
}
sendPasswordResetEmail(email, actionCodeSettings) {
return sendPasswordResetEmail(this.auth, email, actionCodeSettings || undefined);
return sendPasswordResetEmail(this._delegate, email, actionCodeSettings || undefined);
}
async setPersistence(persistence) {
function convertPersistence(auth, persistenceCompat) {
_validatePersistenceArgument(auth, persistence);
switch (persistenceCompat) {
case Persistence.SESSION:
return browserSessionPersistence;
case Persistence.LOCAL:
return isIndexedDBAvailable()
? indexedDBLocalPersistence
: browserLocalPersistence;
case Persistence.NONE:
return inMemoryPersistence;
default:
return _fail("argument-error" /* ARGUMENT_ERROR */, {
appName: auth.name
});
}
_validatePersistenceArgument(this._delegate, persistence);
let converted;
switch (persistence) {
case Persistence.SESSION:
converted = browserSessionPersistence;
break;
case Persistence.LOCAL:
// Not using isIndexedDBAvailable() since it only checks if indexedDB is defined.
const isIndexedDBFullySupported = await _getInstance(indexedDBLocalPersistence)
._isAvailable();
converted = isIndexedDBFullySupported
? indexedDBLocalPersistence
: browserLocalPersistence;
break;
case Persistence.NONE:
converted = inMemoryPersistence;
break;
default:
return _fail("argument-error" /* ARGUMENT_ERROR */, {
appName: this._delegate.name
});
}
return this.auth.setPersistence(convertPersistence(this.auth, persistence));
return this._delegate.setPersistence(converted);
}

@@ -609,71 +787,46 @@ signInAndRetrieveDataWithCredential(credential) {

signInAnonymously() {
return convertCredential(this.auth, signInAnonymously(this.auth));
return convertCredential(this._delegate, signInAnonymously(this._delegate));
}
signInWithCredential(credential) {
return convertCredential(this.auth, signInWithCredential(this.auth, credential));
return convertCredential(this._delegate, signInWithCredential(this._delegate, credential));
}
signInWithCustomToken(token) {
return convertCredential(this.auth, signInWithCustomToken(this.auth, token));
return convertCredential(this._delegate, signInWithCustomToken(this._delegate, token));
}
signInWithEmailAndPassword(email, password) {
return convertCredential(this.auth, signInWithEmailAndPassword(this.auth, email, password));
return convertCredential(this._delegate, signInWithEmailAndPassword(this._delegate, email, password));
}
signInWithEmailLink(email, emailLink) {
return convertCredential(this.auth, signInWithEmailLink(this.auth, email, emailLink));
return convertCredential(this._delegate, signInWithEmailLink(this._delegate, email, emailLink));
}
signInWithPhoneNumber(phoneNumber, applicationVerifier) {
return convertConfirmationResult(this.auth, signInWithPhoneNumber(this.auth, phoneNumber, unwrap(applicationVerifier)));
return convertConfirmationResult(this._delegate, signInWithPhoneNumber(this._delegate, phoneNumber, unwrap$1(applicationVerifier)));
}
async signInWithPopup(provider) {
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return convertCredential(this.auth, signInWithPopup(this.auth, provider, browserPopupRedirectResolver));
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return convertCredential(this._delegate, signInWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
}
async signInWithRedirect(provider) {
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
this.savePersistenceForRedirect();
return signInWithRedirect(this.auth, provider, browserPopupRedirectResolver);
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
await _savePersistenceForRedirect(this._delegate);
return signInWithRedirect(this._delegate, provider, CompatPopupRedirectResolver);
}
updateCurrentUser(user) {
return this.auth.updateCurrentUser(unwrap(user));
// remove ts-ignore once overloads are defined for exp functions to accept compat objects
// @ts-ignore
return this._delegate.updateCurrentUser(unwrap$1(user));
}
verifyPasswordResetCode(code) {
return verifyPasswordResetCode(this.auth, code);
return verifyPasswordResetCode(this._delegate, code);
}
unwrap() {
return this.auth;
return this._delegate;
}
_delete() {
return this.auth._delete();
return this._delegate._delete();
}
savePersistenceForRedirect() {
const win = getSelfWindow();
const key = _persistenceKeyName(PERSISTENCE_KEY, this.auth.config.apiKey, this.auth.name);
if (win === null || win === void 0 ? void 0 : win.sessionStorage) {
win.sessionStorage.setItem(key, this.auth._getPersistence());
}
linkUnderlyingAuth() {
this._delegate.wrapped = () => this;
}
getPersistenceFromRedirect() {
const win = getSelfWindow();
if (!(win === null || win === void 0 ? void 0 : win.sessionStorage)) {
return null;
}
const key = _persistenceKeyName(PERSISTENCE_KEY, this.auth.config.apiKey, this.auth.name);
const persistence = win.sessionStorage.getItem(key);
switch (persistence) {
case inMemoryPersistence.type:
return inMemoryPersistence;
case indexedDBLocalPersistence.type:
return indexedDBLocalPersistence;
case browserSessionPersistence.type:
return browserSessionPersistence;
case browserLocalPersistence.type:
return browserLocalPersistence;
default:
return null;
}
}
}
function getSelfWindow() {
return typeof window !== 'undefined' ? window : null;
}
function wrapObservers(nextOrObserver, error, complete) {

@@ -713,3 +866,5 @@ let next = nextOrObserver;

this.providerId = 'phone';
this.phoneProvider = new PhoneAuthProvider$1(unwrap(firebase.auth()));
// TODO: remove ts-ignore when moving types from auth-types to auth-compat
// @ts-ignore
this._delegate = new PhoneAuthProvider$1(unwrap(firebase.auth()));
}

@@ -720,9 +875,9 @@ static credential(verificationId, verificationCode) {

verifyPhoneNumber(phoneInfoOptions, applicationVerifier) {
return this.phoneProvider.verifyPhoneNumber(
return this._delegate.verifyPhoneNumber(
// The implementation matches but the types are subtly incompatible
// eslint-disable-next-line @typescript-eslint/no-explicit-any
phoneInfoOptions, unwrap(applicationVerifier));
phoneInfoOptions, applicationVerifier);
}
unwrap() {
return this.phoneProvider;
return this._delegate;
}

@@ -749,3 +904,3 @@ }

*/
const _assert$1 = _assert$2;
const _assert$3 = _assert$4;
class RecaptchaVerifier {

@@ -755,22 +910,22 @@ constructor(container, parameters, app = firebase.app()) {

// API key is required for web client RPC calls.
_assert$1((_a = app.options) === null || _a === void 0 ? void 0 : _a.apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
_assert$3((_a = app.options) === null || _a === void 0 ? void 0 : _a.apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
this.verifier = new RecaptchaVerifier$1(container,
this._delegate = new RecaptchaVerifier$1(container,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
parameters, unwrap(app.auth()));
this.type = this.verifier.type;
parameters,
// TODO: remove ts-ignore when moving types from auth-types to auth-compat
// @ts-ignore
app.auth());
this.type = this._delegate.type;
}
clear() {
this.verifier.clear();
this._delegate.clear();
}
render() {
return this.verifier.render();
return this._delegate.render();
}
verify() {
return this.verifier.verify();
return this._delegate.verify();
}
unwrap() {
return this.verifier;
}
}

@@ -794,3 +949,3 @@

*/
const AUTH_TYPE = 'auth';
const AUTH_TYPE = 'auth-compat';
// Create auth components to register with firebase.

@@ -801,5 +956,5 @@ // Provides Auth public APIs.

// getImmediate for FirebaseApp will always succeed
const app = container.getProvider('app').getImmediate();
const auth = container.getProvider('auth-exp').getImmediate();
return new Auth(app, auth);
const app = container.getProvider('app-compat').getImmediate();
const authProvider = container.getProvider('auth-exp');
return new Auth(app, authProvider);
}, "PUBLIC" /* PUBLIC */)

@@ -823,5 +978,5 @@ .setServiceProps({

// SAMLAuthProvider,
PhoneAuthProvider,
PhoneAuthProvider: PhoneAuthProvider,
PhoneMultiFactorGenerator: PhoneMultiFactorGenerator,
RecaptchaVerifier,
RecaptchaVerifier: RecaptchaVerifier,
TwitterAuthProvider: TwitterAuthProvider,

@@ -836,6 +991,5 @@ Auth: {

.setMultipleInstances(false));
instance.registerVersion('auth', version);
instance.registerVersion(name, version);
}
registerAuth(_getClientPlatform());
registerAuthCompat(firebase);
//# sourceMappingURL=index.esm2017.js.map
'use strict';
var firebase = require('@firebase/app-compat');
var impl = require('@firebase/auth/internal');
require('@firebase/auth-types');
var exp = require('@firebase/auth/internal');
var component = require('@firebase/component');
var tslib = require('tslib');
require('@firebase/app-types');
var util = require('@firebase/util');
var fetchImpl = require('node-fetch');

@@ -14,4 +13,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
var fetchImpl__default = /*#__PURE__*/_interopDefaultLegacy(fetchImpl);
var version = "0.0.900";
var name = "@firebase/auth-compat";
var version = "0.0.900-exp.520ca39d0";

@@ -34,2 +35,3 @@ /**

*/
var CORDOVA_ONDEVICEREADY_TIMEOUT_MS = 1000;
function _getCurrentScheme() {

@@ -91,3 +93,3 @@ var _a;

var storage = self.localStorage;
var key = impl._generateEventId();
var key = exp._generateEventId();
if (storage) {

@@ -141,14 +143,25 @@ // setItem will throw an exception if we cannot access WebStorage (e.g.,

}
function _getClientPlatform() {
if (util.isNode()) {
return "Node" /* NODE */;
}
if (util.isReactNative()) {
return "ReactNative" /* REACT_NATIVE */;
}
if (_isWorker()) {
return "Worker" /* WORKER */;
}
return "Browser" /* BROWSER */;
/** Quick check that indicates the platform *may* be Cordova */
function _isLikelyCordova() {
return _isAndroidOrIosCordovaScheme() && typeof document !== 'undefined';
}
function _isCordova() {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
if (!_isLikelyCordova()) {
return [2 /*return*/, false];
}
return [2 /*return*/, new Promise(function (resolve) {
var timeoutId = setTimeout(function () {
// We've waited long enough; the telltale Cordova event didn't happen
resolve(false);
}, CORDOVA_ONDEVICEREADY_TIMEOUT_MS);
document.addEventListener('deviceready', function () {
clearTimeout(timeoutId);
resolve(true);
});
})];
});
});
}

@@ -172,6 +185,8 @@ /**

var Persistence = {
LOCAL: 'LOCAL',
NONE: 'NONE',
SESSION: 'SESSION'
LOCAL: 'local',
NONE: 'none',
SESSION: 'session'
};
var _assert = exp._assert;
var PERSISTENCE_KEY = 'persistence';
/**

@@ -182,7 +197,7 @@ * Validates that an argument is a valid persistence value. If an invalid type

function _validatePersistenceArgument(auth, persistence) {
impl._assert(Object.values(Persistence).includes(persistence), auth, "invalid-persistence-type" /* INVALID_PERSISTENCE */);
_assert(Object.values(Persistence).includes(persistence), auth, "invalid-persistence-type" /* INVALID_PERSISTENCE */);
// Validate if the specified type is supported in the current environment.
if (util.isReactNative()) {
// This is only supported in a browser.
impl._assert(persistence !== Persistence.SESSION, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence !== Persistence.SESSION, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
return;

@@ -192,3 +207,3 @@ }

// Only none is supported in Node.js.
impl._assert(persistence === Persistence.NONE, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence === Persistence.NONE, auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
return;

@@ -199,3 +214,3 @@ }

// If indexedDB not supported and LOCAL provided, throw an error
impl._assert(persistence === Persistence.NONE ||
_assert(persistence === Persistence.NONE ||
(persistence === Persistence.LOCAL && util.isIndexedDBAvailable()), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);

@@ -205,4 +220,43 @@ return;

// This is restricted by what the browser supports.
impl._assert(persistence === Persistence.NONE || _isWebStorageSupported(), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
_assert(persistence === Persistence.NONE || _isWebStorageSupported(), auth, "unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */);
}
function _savePersistenceForRedirect(auth) {
return tslib.__awaiter(this, void 0, void 0, function () {
var win, key;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, auth._initializationPromise];
case 1:
_a.sent();
win = getSelfWindow();
key = exp._persistenceKeyName(PERSISTENCE_KEY, auth.config.apiKey, auth.name);
if (win === null || win === void 0 ? void 0 : win.sessionStorage) {
win.sessionStorage.setItem(key, auth._getPersistence());
}
return [2 /*return*/];
}
});
});
}
function _getPersistencesFromRedirect(apiKey, appName) {
var win = getSelfWindow();
if (!(win === null || win === void 0 ? void 0 : win.sessionStorage)) {
return [];
}
var key = exp._persistenceKeyName(PERSISTENCE_KEY, apiKey, appName);
var persistence = win.sessionStorage.getItem(key);
switch (persistence) {
case Persistence.NONE:
return [exp.inMemoryPersistence];
case Persistence.LOCAL:
return [exp.indexedDBLocalPersistence, exp.browserSessionPersistence];
case Persistence.SESSION:
return [exp.browserSessionPersistence];
default:
return [];
}
}
function getSelfWindow() {
return typeof window !== 'undefined' ? window : null;
}

@@ -225,4 +279,156 @@ /**

*/
var _assert$1 = exp._assert;
var BROWSER_RESOLVER = exp._getInstance(exp.browserPopupRedirectResolver);
var CORDOVA_RESOLVER = exp._getInstance(exp.cordovaPopupRedirectResolver);
/** Platform-agnostic popup-redirect resolver */
var CompatPopupRedirectResolver = /** @class */ (function () {
function CompatPopupRedirectResolver() {
this.underlyingResolver = null;
this._redirectPersistence = exp.browserSessionPersistence;
this._completeRedirectFn = exp._getRedirectResult;
}
CompatPopupRedirectResolver.prototype._initialize = function (auth) {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
case 1:
_a.sent();
return [2 /*return*/, this.assertedUnderlyingResolver._initialize(auth)];
}
});
});
};
CompatPopupRedirectResolver.prototype._openPopup = function (auth, provider, authType, eventId) {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
case 1:
_a.sent();
return [2 /*return*/, this.assertedUnderlyingResolver._openPopup(auth, provider, authType, eventId)];
}
});
});
};
CompatPopupRedirectResolver.prototype._openRedirect = function (auth, provider, authType, eventId) {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.selectUnderlyingResolver()];
case 1:
_a.sent();
return [2 /*return*/, this.assertedUnderlyingResolver._openRedirect(auth, provider, authType, eventId)];
}
});
});
};
CompatPopupRedirectResolver.prototype._isIframeWebStorageSupported = function (auth, cb) {
this.assertedUnderlyingResolver._isIframeWebStorageSupported(auth, cb);
};
CompatPopupRedirectResolver.prototype._originValidation = function (auth) {
return this.assertedUnderlyingResolver._originValidation(auth);
};
Object.defineProperty(CompatPopupRedirectResolver.prototype, "_shouldInitProactively", {
get: function () {
return _isLikelyCordova() || BROWSER_RESOLVER._shouldInitProactively;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CompatPopupRedirectResolver.prototype, "assertedUnderlyingResolver", {
get: function () {
_assert$1(this.underlyingResolver, "internal-error" /* INTERNAL_ERROR */);
return this.underlyingResolver;
},
enumerable: false,
configurable: true
});
CompatPopupRedirectResolver.prototype.selectUnderlyingResolver = function () {
return tslib.__awaiter(this, void 0, void 0, function () {
var isCordova;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.underlyingResolver) {
return [2 /*return*/];
}
return [4 /*yield*/, _isCordova()];
case 1:
isCordova = _a.sent();
this.underlyingResolver = isCordova ? CORDOVA_RESOLVER : BROWSER_RESOLVER;
return [2 /*return*/];
}
});
});
};
return CompatPopupRedirectResolver;
}());
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function unwrap$1(object) {
return object.unwrap();
}
function wrapped(object) {
return object.wrapped();
}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function credentialFromResponse(userCredential) {
var providerId = userCredential.providerId, _tokenResponse = userCredential._tokenResponse;
return credentialFromObject(userCredential);
}
function attachExtraErrorFields(auth, e) {
var _a;
// The response contains all fields from the server which may or may not
// actually match the underlying type
var response = (_a = e.customData) === null || _a === void 0 ? void 0 : _a._tokenResponse;
if (e.code === 'auth/multi-factor-auth-required') {
var mfaErr = e;
mfaErr.resolver = new MultiFactorResolver(auth, exp.getMultiFactorResolver(auth, e));
}
else if (response) {
var credential = credentialFromObject(e);
var credErr = e;
if (credential) {
credErr.credential = credential;
credErr.tenantId = response.tenantId || undefined;
credErr.email = response.email || undefined;
credErr.phoneNumber = response.phoneNumber || undefined;
}
}
}
function credentialFromObject(object) {
var _tokenResponse = (object instanceof util.FirebaseError
? object.customData
: object)._tokenResponse;
if (!_tokenResponse) {

@@ -232,6 +438,10 @@ return null;

// Handle phone Auth credential responses, as they have a different format
// from other backend responses (i.e. no providerId).
if ('temporaryProof' in _tokenResponse && 'phoneNumber' in _tokenResponse) {
return impl.PhoneAuthProvider.credentialFromResult(userCredential);
// from other backend responses (i.e. no providerId). This is also only the
// case for user credentials (does not work for errors).
if (!(object instanceof util.FirebaseError)) {
if ('temporaryProof' in _tokenResponse && 'phoneNumber' in _tokenResponse) {
return exp.PhoneAuthProvider.credentialFromResult(object);
}
}
var providerId = _tokenResponse.providerId;
// Email and password is not supported as there is no situation where the

@@ -242,11 +452,16 @@ // server would return the password to the client.

}
var provider;
switch (providerId) {
case "google.com" /* GOOGLE */:
return impl.GoogleAuthProvider.credentialFromResult(userCredential);
provider = exp.GoogleAuthProvider;
break;
case "facebook.com" /* FACEBOOK */:
return impl.FacebookAuthProvider.credentialFromResult(userCredential);
provider = exp.FacebookAuthProvider;
break;
case "github.com" /* GITHUB */:
return impl.GithubAuthProvider.credentialFromResult(userCredential);
provider = exp.GithubAuthProvider;
break;
case "twitter.com" /* TWITTER */:
return impl.TwitterAuthProvider.credentialFromResult(userCredential);
provider = exp.TwitterAuthProvider;
break;
default:

@@ -261,18 +476,18 @@ var _a = _tokenResponse, oauthIdToken = _a.oauthIdToken, oauthAccessToken = _a.oauthAccessToken, oauthTokenSecret = _a.oauthTokenSecret, pendingToken = _a.pendingToken, nonce = _a.nonce;

// TODO(avolkovi): uncomment this and get it working with SAML & OIDC
// if (pendingToken) {
// if (providerId.indexOf(compat.constants.SAML_PREFIX) == 0) {
// return new impl.SAMLAuthCredential(providerId, pendingToken);
// } else {
// // OIDC and non-default providers excluding Twitter.
// return new impl.OAuthCredential(
// providerId,
// {
// pendingToken,
// idToken: oauthIdToken,
// accessToken: oauthAccessToken
// },
// providerId);
// }
// }
return new impl.OAuthProvider(providerId).credential({
if (pendingToken) {
if (providerId.startsWith('saml.')) {
return exp.SAMLAuthCredential._create(providerId, pendingToken);
}
else {
// OIDC and non-default providers excluding Twitter.
return exp.OAuthCredential._fromParams({
providerId: providerId,
signInMethod: providerId,
pendingToken: pendingToken,
idToken: oauthIdToken,
accessToken: oauthAccessToken
});
}
}
return new exp.OAuthProvider(providerId).credential({
idToken: oauthIdToken,

@@ -283,27 +498,29 @@ accessToken: oauthAccessToken,

}
return object instanceof util.FirebaseError
? provider.credentialFromError(object)
: provider.credentialFromResult(object);
}
function convertCredential(auth, credentialPromise) {
return tslib.__awaiter(this, void 0, void 0, function () {
var credential, e_1, _a, operationType, user;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
var credential, e_1, operationType, user;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
_b.trys.push([0, 2, , 3]);
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, credentialPromise];
case 1:
credential = _b.sent();
credential = _a.sent();
return [3 /*break*/, 3];
case 2:
e_1 = _b.sent();
if (e_1.code === 'auth/multi-factor-auth-required') {
e_1.resolver = impl.getMultiFactorResolver(auth, e_1);
e_1 = _a.sent();
if (e_1 instanceof util.FirebaseError) {
attachExtraErrorFields(auth, e_1);
}
throw e_1;
case 3: return [4 /*yield*/, credential];
case 4:
_a = _b.sent(), operationType = _a.operationType, user = _a.user;
case 3:
operationType = credential.operationType, user = credential.user;
return [2 /*return*/, {
operationType: operationType,
credential: credentialFromResponse(credential),
additionalUserInfo: impl.getAdditionalUserInfo(credential),
additionalUserInfo: exp.getAdditionalUserInfo(credential),
user: User.getOrCreate(user)

@@ -333,2 +550,26 @@ }];

}
var MultiFactorResolver = /** @class */ (function () {
function MultiFactorResolver(auth, resolver) {
this.resolver = resolver;
this.auth = wrapped(auth);
}
Object.defineProperty(MultiFactorResolver.prototype, "session", {
get: function () {
return this.resolver.session;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MultiFactorResolver.prototype, "hints", {
get: function () {
return this.resolver.hints;
},
enumerable: false,
configurable: true
});
MultiFactorResolver.prototype.resolveSignIn = function (assertion) {
return convertCredential(unwrap$1(this.auth), this.resolver.resolveSignIn(assertion));
};
return MultiFactorResolver;
}());

@@ -351,26 +592,6 @@ /**

*/
function unwrap(object) {
return object.unwrap();
}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var User = /** @class */ (function () {
function User(user) {
this.user = user;
this.multiFactor = impl.multiFactor(user);
function User(_delegate) {
this._delegate = _delegate;
this.multiFactor = exp.multiFactor(_delegate);
}

@@ -384,15 +605,15 @@ User.getOrCreate = function (user) {

User.prototype.delete = function () {
return this.user.delete();
return this._delegate.delete();
};
User.prototype.reload = function () {
return this.user.reload();
return this._delegate.reload();
};
User.prototype.toJSON = function () {
return this.user.toJSON();
return this._delegate.toJSON();
};
User.prototype.getIdTokenResult = function (forceRefresh) {
return this.user.getIdTokenResult(forceRefresh);
return this._delegate.getIdTokenResult(forceRefresh);
};
User.prototype.getIdToken = function (forceRefresh) {
return this.user.getIdToken(forceRefresh);
return this._delegate.getIdToken(forceRefresh);
};

@@ -405,3 +626,3 @@ User.prototype.linkAndRetrieveDataWithCredential = function (credential) {

return tslib.__generator(this, function (_a) {
return [2 /*return*/, convertCredential(this.auth, impl.linkWithCredential(this.user, credential))];
return [2 /*return*/, convertCredential(this.auth, exp.linkWithCredential(this._delegate, credential))];
});

@@ -413,3 +634,3 @@ });

return tslib.__generator(this, function (_a) {
return [2 /*return*/, convertConfirmationResult(this.auth, impl.linkWithPhoneNumber(this.user, phoneNumber, unwrap(applicationVerifier)))];
return [2 /*return*/, convertConfirmationResult(this.auth, exp.linkWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier))];
});

@@ -421,3 +642,3 @@ });

return tslib.__generator(this, function (_a) {
return [2 /*return*/, convertCredential(this.auth, impl.linkWithPopup(this.user, provider, impl.browserPopupRedirectResolver))];
return [2 /*return*/, convertCredential(this.auth, exp.linkWithPopup(this._delegate, provider, CompatPopupRedirectResolver))];
});

@@ -427,3 +648,12 @@ });

User.prototype.linkWithRedirect = function (provider) {
return impl.linkWithRedirect(this.user, provider, impl.browserPopupRedirectResolver);
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _savePersistenceForRedirect(exp._castAuth(this.auth))];
case 1:
_a.sent();
return [2 /*return*/, exp.linkWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
}
});
});
};

@@ -436,3 +666,3 @@ User.prototype.reauthenticateAndRetrieveDataWithCredential = function (credential) {

return tslib.__generator(this, function (_a) {
return [2 /*return*/, convertCredential(this.auth, impl.reauthenticateWithCredential(this.user, credential))];
return [2 /*return*/, convertCredential(this.auth, exp.reauthenticateWithCredential(this._delegate, credential))];
});

@@ -442,12 +672,21 @@ });

User.prototype.reauthenticateWithPhoneNumber = function (phoneNumber, applicationVerifier) {
return convertConfirmationResult(this.auth, impl.reauthenticateWithPhoneNumber(this.user, phoneNumber, unwrap(applicationVerifier)));
return convertConfirmationResult(this.auth, exp.reauthenticateWithPhoneNumber(this._delegate, phoneNumber, applicationVerifier));
};
User.prototype.reauthenticateWithPopup = function (provider) {
return convertCredential(this.auth, impl.reauthenticateWithPopup(this.user, provider, impl.browserPopupRedirectResolver));
return convertCredential(this.auth, exp.reauthenticateWithPopup(this._delegate, provider, CompatPopupRedirectResolver));
};
User.prototype.reauthenticateWithRedirect = function (provider) {
return impl.reauthenticateWithRedirect(this.user, provider, impl.browserPopupRedirectResolver);
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _savePersistenceForRedirect(exp._castAuth(this.auth))];
case 1:
_a.sent();
return [2 /*return*/, exp.reauthenticateWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
}
});
});
};
User.prototype.sendEmailVerification = function (actionCodeSettings) {
return impl.sendEmailVerification(this.user, actionCodeSettings);
return exp.sendEmailVerification(this._delegate, actionCodeSettings);
};

@@ -458,3 +697,3 @@ User.prototype.unlink = function (providerId) {

switch (_a.label) {
case 0: return [4 /*yield*/, impl.unlink(this.user, providerId)];
case 0: return [4 /*yield*/, exp.unlink(this._delegate, providerId)];
case 1:

@@ -468,22 +707,19 @@ _a.sent();

User.prototype.updateEmail = function (newEmail) {
return impl.updateEmail(this.user, newEmail);
return exp.updateEmail(this._delegate, newEmail);
};
User.prototype.updatePassword = function (newPassword) {
return impl.updatePassword(this.user, newPassword);
return exp.updatePassword(this._delegate, newPassword);
};
User.prototype.updatePhoneNumber = function (phoneCredential) {
return impl.updatePhoneNumber(this.user, phoneCredential);
return exp.updatePhoneNumber(this._delegate, phoneCredential);
};
User.prototype.updateProfile = function (profile) {
return impl.updateProfile(this.user, profile);
return exp.updateProfile(this._delegate, profile);
};
User.prototype.verifyBeforeUpdateEmail = function (newEmail, actionCodeSettings) {
return impl.verifyBeforeUpdateEmail(this.user, newEmail, actionCodeSettings);
return exp.verifyBeforeUpdateEmail(this._delegate, newEmail, actionCodeSettings);
};
User.prototype.unwrap = function () {
return this.user;
};
Object.defineProperty(User.prototype, "emailVerified", {
get: function () {
return this.user.emailVerified;
return this._delegate.emailVerified;
},

@@ -495,3 +731,3 @@ enumerable: false,

get: function () {
return this.user.isAnonymous;
return this._delegate.isAnonymous;
},

@@ -503,3 +739,3 @@ enumerable: false,

get: function () {
return this.user.metadata;
return this._delegate.metadata;
},

@@ -511,3 +747,3 @@ enumerable: false,

get: function () {
return this.user.phoneNumber;
return this._delegate.phoneNumber;
},

@@ -519,3 +755,3 @@ enumerable: false,

get: function () {
return this.user.providerData;
return this._delegate.providerData;
},

@@ -527,3 +763,3 @@ enumerable: false,

get: function () {
return this.user.refreshToken;
return this._delegate.refreshToken;
},

@@ -535,3 +771,3 @@ enumerable: false,

get: function () {
return this.user.tenantId;
return this._delegate.tenantId;
},

@@ -543,3 +779,3 @@ enumerable: false,

get: function () {
return this.user.displayName;
return this._delegate.displayName;
},

@@ -551,3 +787,3 @@ enumerable: false,

get: function () {
return this.user.email;
return this._delegate.email;
},

@@ -559,3 +795,3 @@ enumerable: false,

get: function () {
return this.user.photoURL;
return this._delegate.photoURL;
},

@@ -567,3 +803,3 @@ enumerable: false,

get: function () {
return this.user.providerId;
return this._delegate.providerId;
},

@@ -575,3 +811,3 @@ enumerable: false,

get: function () {
return this.user.uid;
return this._delegate.uid;
},

@@ -583,3 +819,3 @@ enumerable: false,

get: function () {
return this.user.auth;
return this._delegate.auth;
},

@@ -611,37 +847,61 @@ enumerable: false,

*/
var PERSISTENCE_KEY = 'persistence';
var _assert = impl._assert;
var _assert$2 = exp._assert;
var Auth = /** @class */ (function () {
// private readonly auth: impl.AuthImpl;
function Auth(app, auth) {
function Auth(app, provider) {
this.app = app;
this.auth = auth;
var apiKey = app.options.apiKey;
if (this.auth._deleted) {
if (provider.isInitialized()) {
this._delegate = provider.getImmediate();
this.linkUnderlyingAuth();
return;
}
// Note this is slightly different behavior: in this case, the stored
// persistence is checked *first* rather than last. This is because we want
// the fallback (if no user is found) to be the stored persistence type
var storedPersistence = this.getPersistenceFromRedirect();
var persistences = storedPersistence ? [storedPersistence] : [];
persistences.push(impl.indexedDBLocalPersistence);
// TODO(avolkovi): Implement proper persistence fallback
var hierarchy = persistences.map(impl._getInstance);
var apiKey = app.options.apiKey;
// TODO: platform needs to be determined using heuristics
_assert(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
_assert$2(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
this.auth._updateErrorMap(impl.debugErrorMap);
// This promise is intended to float; auth initialization happens in the
// background, meanwhile the auth object may be used by the app.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.auth._initializeWithPersistence(hierarchy, impl.browserPopupRedirectResolver);
var persistences = [exp.inMemoryPersistence];
// Only deal with persistences in web environments
if (typeof window !== 'undefined') {
// Note this is slightly different behavior: in this case, the stored
// persistence is checked *first* rather than last. This is because we want
// to prefer stored persistence type in the hierarchy.
persistences = _getPersistencesFromRedirect(apiKey, app.name);
for (var _i = 0, _a = [
exp.indexedDBLocalPersistence,
exp.browserLocalPersistence
]; _i < _a.length; _i++) {
var persistence = _a[_i];
if (!persistences.includes(persistence)) {
persistences.push(persistence);
}
}
}
// TODO: platform needs to be determined using heuristics
_assert$2(apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
// Only use a popup/redirect resolver in browser environments
var resolver = typeof window !== 'undefined' ? CompatPopupRedirectResolver : undefined;
this._delegate = provider.initialize({
options: {
persistence: persistences,
popupRedirectResolver: resolver
}
});
this._delegate._updateErrorMap(exp.debugErrorMap);
this.linkUnderlyingAuth();
}
Object.defineProperty(Auth.prototype, "emulatorConfig", {
get: function () {
return this._delegate.emulatorConfig;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Auth.prototype, "currentUser", {
get: function () {
if (!this.auth.currentUser) {
if (!this._delegate.currentUser) {
return null;
}
return User.getOrCreate(this.auth.currentUser);
return User.getOrCreate(this._delegate.currentUser);
},

@@ -653,3 +913,3 @@ enumerable: false,

get: function () {
return this.auth.languageCode;
return this._delegate.languageCode;
},

@@ -661,3 +921,3 @@ enumerable: false,

get: function () {
return this.auth.settings;
return this._delegate.settings;
},

@@ -669,3 +929,3 @@ enumerable: false,

get: function () {
return this.auth.tenantId;
return this._delegate.tenantId;
},

@@ -676,18 +936,18 @@ enumerable: false,

Auth.prototype.useDeviceLanguage = function () {
this.auth.useDeviceLanguage();
this._delegate.useDeviceLanguage();
};
Auth.prototype.signOut = function () {
return this.auth.signOut();
return this._delegate.signOut();
};
Auth.prototype.useEmulator = function (url, options) {
this.auth.useEmulator(url, options);
exp.useAuthEmulator(this._delegate, url, options);
};
Auth.prototype.applyActionCode = function (code) {
return impl.applyActionCode(this.auth, code);
return exp.applyActionCode(this._delegate, code);
};
Auth.prototype.checkActionCode = function (code) {
return impl.checkActionCode(this.auth, code);
return exp.checkActionCode(this._delegate, code);
};
Auth.prototype.confirmPasswordReset = function (code, newPassword) {
return impl.confirmPasswordReset(this.auth, code, newPassword);
return exp.confirmPasswordReset(this._delegate, code, newPassword);
};

@@ -697,3 +957,3 @@ Auth.prototype.createUserWithEmailAndPassword = function (email, password) {

return tslib.__generator(this, function (_a) {
return [2 /*return*/, convertCredential(this.auth, impl.createUserWithEmailAndPassword(this.auth, email, password))];
return [2 /*return*/, convertCredential(this._delegate, exp.createUserWithEmailAndPassword(this._delegate, email, password))];
});

@@ -706,6 +966,6 @@ });

Auth.prototype.fetchSignInMethodsForEmail = function (email) {
return impl.fetchSignInMethodsForEmail(this.auth, email);
return exp.fetchSignInMethodsForEmail(this._delegate, email);
};
Auth.prototype.isSignInWithEmailLink = function (emailLink) {
return impl.isSignInWithEmailLink(this.auth, emailLink);
return exp.isSignInWithEmailLink(this._delegate, emailLink);
};

@@ -718,4 +978,4 @@ Auth.prototype.getRedirectResult = function () {

case 0:
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [4 /*yield*/, impl.getRedirectResult(this.auth, impl.browserPopupRedirectResolver)];
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [4 /*yield*/, exp.getRedirectResult(this._delegate, CompatPopupRedirectResolver)];
case 1:

@@ -729,3 +989,3 @@ credential = _a.sent();

}
return [2 /*return*/, convertCredential(this.auth, Promise.resolve(credential))];
return [2 /*return*/, convertCredential(this._delegate, Promise.resolve(credential))];
}

@@ -737,35 +997,47 @@ });

var _a = wrapObservers(nextOrObserver, errorFn, completed), next = _a.next, error = _a.error, complete = _a.complete;
return this.auth.onAuthStateChanged(next, error, complete);
return this._delegate.onAuthStateChanged(next, error, complete);
};
Auth.prototype.onIdTokenChanged = function (nextOrObserver, errorFn, completed) {
var _a = wrapObservers(nextOrObserver, errorFn, completed), next = _a.next, error = _a.error, complete = _a.complete;
return this.auth.onIdTokenChanged(next, error, complete);
return this._delegate.onIdTokenChanged(next, error, complete);
};
Auth.prototype.sendSignInLinkToEmail = function (email, actionCodeSettings) {
return impl.sendSignInLinkToEmail(this.auth, email, actionCodeSettings);
return exp.sendSignInLinkToEmail(this._delegate, email, actionCodeSettings);
};
Auth.prototype.sendPasswordResetEmail = function (email, actionCodeSettings) {
return impl.sendPasswordResetEmail(this.auth, email, actionCodeSettings || undefined);
return exp.sendPasswordResetEmail(this._delegate, email, actionCodeSettings || undefined);
};
Auth.prototype.setPersistence = function (persistence) {
return tslib.__awaiter(this, void 0, void 0, function () {
function convertPersistence(auth, persistenceCompat) {
_validatePersistenceArgument(auth, persistence);
switch (persistenceCompat) {
case Persistence.SESSION:
return impl.browserSessionPersistence;
case Persistence.LOCAL:
return util.isIndexedDBAvailable()
? impl.indexedDBLocalPersistence
: impl.browserLocalPersistence;
case Persistence.NONE:
return impl.inMemoryPersistence;
default:
return impl._fail("argument-error" /* ARGUMENT_ERROR */, {
appName: auth.name
});
var converted, _a, isIndexedDBFullySupported;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_validatePersistenceArgument(this._delegate, persistence);
_a = persistence;
switch (_a) {
case Persistence.SESSION: return [3 /*break*/, 1];
case Persistence.LOCAL: return [3 /*break*/, 2];
case Persistence.NONE: return [3 /*break*/, 4];
}
return [3 /*break*/, 5];
case 1:
converted = exp.browserSessionPersistence;
return [3 /*break*/, 6];
case 2: return [4 /*yield*/, exp._getInstance(exp.indexedDBLocalPersistence)
._isAvailable()];
case 3:
isIndexedDBFullySupported = _b.sent();
converted = isIndexedDBFullySupported
? exp.indexedDBLocalPersistence
: exp.browserLocalPersistence;
return [3 /*break*/, 6];
case 4:
converted = exp.inMemoryPersistence;
return [3 /*break*/, 6];
case 5: return [2 /*return*/, exp._fail("argument-error" /* ARGUMENT_ERROR */, {
appName: this._delegate.name
})];
case 6: return [2 /*return*/, this._delegate.setPersistence(converted)];
}
}
return tslib.__generator(this, function (_a) {
return [2 /*return*/, this.auth.setPersistence(convertPersistence(this.auth, persistence))];
});

@@ -778,18 +1050,18 @@ });

Auth.prototype.signInAnonymously = function () {
return convertCredential(this.auth, impl.signInAnonymously(this.auth));
return convertCredential(this._delegate, exp.signInAnonymously(this._delegate));
};
Auth.prototype.signInWithCredential = function (credential) {
return convertCredential(this.auth, impl.signInWithCredential(this.auth, credential));
return convertCredential(this._delegate, exp.signInWithCredential(this._delegate, credential));
};
Auth.prototype.signInWithCustomToken = function (token) {
return convertCredential(this.auth, impl.signInWithCustomToken(this.auth, token));
return convertCredential(this._delegate, exp.signInWithCustomToken(this._delegate, token));
};
Auth.prototype.signInWithEmailAndPassword = function (email, password) {
return convertCredential(this.auth, impl.signInWithEmailAndPassword(this.auth, email, password));
return convertCredential(this._delegate, exp.signInWithEmailAndPassword(this._delegate, email, password));
};
Auth.prototype.signInWithEmailLink = function (email, emailLink) {
return convertCredential(this.auth, impl.signInWithEmailLink(this.auth, email, emailLink));
return convertCredential(this._delegate, exp.signInWithEmailLink(this._delegate, email, emailLink));
};
Auth.prototype.signInWithPhoneNumber = function (phoneNumber, applicationVerifier) {
return convertConfirmationResult(this.auth, impl.signInWithPhoneNumber(this.auth, phoneNumber, unwrap(applicationVerifier)));
return convertConfirmationResult(this._delegate, exp.signInWithPhoneNumber(this._delegate, phoneNumber, unwrap$1(applicationVerifier)));
};

@@ -799,4 +1071,4 @@ Auth.prototype.signInWithPopup = function (provider) {

return tslib.__generator(this, function (_a) {
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [2 /*return*/, convertCredential(this.auth, impl.signInWithPopup(this.auth, provider, impl.browserPopupRedirectResolver))];
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [2 /*return*/, convertCredential(this._delegate, exp.signInWithPopup(this._delegate, provider, CompatPopupRedirectResolver))];
});

@@ -808,5 +1080,10 @@ });

return tslib.__generator(this, function (_a) {
_assert(_isPopupRedirectSupported(), this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
this.savePersistenceForRedirect();
return [2 /*return*/, impl.signInWithRedirect(this.auth, provider, impl.browserPopupRedirectResolver)];
switch (_a.label) {
case 0:
_assert$2(_isPopupRedirectSupported(), this._delegate, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
return [4 /*yield*/, _savePersistenceForRedirect(this._delegate)];
case 1:
_a.sent();
return [2 /*return*/, exp.signInWithRedirect(this._delegate, provider, CompatPopupRedirectResolver)];
}
});

@@ -816,45 +1093,21 @@ });

Auth.prototype.updateCurrentUser = function (user) {
return this.auth.updateCurrentUser(unwrap(user));
// remove ts-ignore once overloads are defined for exp functions to accept compat objects
// @ts-ignore
return this._delegate.updateCurrentUser(unwrap$1(user));
};
Auth.prototype.verifyPasswordResetCode = function (code) {
return impl.verifyPasswordResetCode(this.auth, code);
return exp.verifyPasswordResetCode(this._delegate, code);
};
Auth.prototype.unwrap = function () {
return this.auth;
return this._delegate;
};
Auth.prototype._delete = function () {
return this.auth._delete();
return this._delegate._delete();
};
Auth.prototype.savePersistenceForRedirect = function () {
var win = getSelfWindow();
var key = impl._persistenceKeyName(PERSISTENCE_KEY, this.auth.config.apiKey, this.auth.name);
if (win === null || win === void 0 ? void 0 : win.sessionStorage) {
win.sessionStorage.setItem(key, this.auth._getPersistence());
}
Auth.prototype.linkUnderlyingAuth = function () {
var _this = this;
this._delegate.wrapped = function () { return _this; };
};
Auth.prototype.getPersistenceFromRedirect = function () {
var win = getSelfWindow();
if (!(win === null || win === void 0 ? void 0 : win.sessionStorage)) {
return null;
}
var key = impl._persistenceKeyName(PERSISTENCE_KEY, this.auth.config.apiKey, this.auth.name);
var persistence = win.sessionStorage.getItem(key);
switch (persistence) {
case impl.inMemoryPersistence.type:
return impl.inMemoryPersistence;
case impl.indexedDBLocalPersistence.type:
return impl.indexedDBLocalPersistence;
case impl.browserSessionPersistence.type:
return impl.browserSessionPersistence;
case impl.browserLocalPersistence.type:
return impl.browserLocalPersistence;
default:
return null;
}
};
return Auth;
}());
function getSelfWindow() {
return typeof window !== 'undefined' ? window : null;
}
function wrapObservers(nextOrObserver, error, complete) {

@@ -896,18 +1149,20 @@ var next = nextOrObserver;

this.providerId = 'phone';
this.phoneProvider = new impl.PhoneAuthProvider(unwrap(firebase__default['default'].auth()));
// TODO: remove ts-ignore when moving types from auth-types to auth-compat
// @ts-ignore
this._delegate = new exp.PhoneAuthProvider(unwrap(firebase__default['default'].auth()));
}
PhoneAuthProvider.credential = function (verificationId, verificationCode) {
return impl.PhoneAuthProvider.credential(verificationId, verificationCode);
return exp.PhoneAuthProvider.credential(verificationId, verificationCode);
};
PhoneAuthProvider.prototype.verifyPhoneNumber = function (phoneInfoOptions, applicationVerifier) {
return this.phoneProvider.verifyPhoneNumber(
return this._delegate.verifyPhoneNumber(
// The implementation matches but the types are subtly incompatible
// eslint-disable-next-line @typescript-eslint/no-explicit-any
phoneInfoOptions, unwrap(applicationVerifier));
phoneInfoOptions, applicationVerifier);
};
PhoneAuthProvider.prototype.unwrap = function () {
return this.phoneProvider;
return this._delegate;
};
PhoneAuthProvider.PHONE_SIGN_IN_METHOD = impl.PhoneAuthProvider.PHONE_SIGN_IN_METHOD;
PhoneAuthProvider.PROVIDER_ID = impl.PhoneAuthProvider.PROVIDER_ID;
PhoneAuthProvider.PHONE_SIGN_IN_METHOD = exp.PhoneAuthProvider.PHONE_SIGN_IN_METHOD;
PhoneAuthProvider.PROVIDER_ID = exp.PhoneAuthProvider.PROVIDER_ID;
return PhoneAuthProvider;

@@ -932,3 +1187,3 @@ }());

*/
var _assert$1 = impl._assert;
var _assert$3 = exp._assert;
var RecaptchaVerifier = /** @class */ (function () {

@@ -939,22 +1194,22 @@ function RecaptchaVerifier(container, parameters, app) {

// API key is required for web client RPC calls.
_assert$1((_a = app.options) === null || _a === void 0 ? void 0 : _a.apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
_assert$3((_a = app.options) === null || _a === void 0 ? void 0 : _a.apiKey, "invalid-api-key" /* INVALID_API_KEY */, {
appName: app.name
});
this.verifier = new impl.RecaptchaVerifier(container,
this._delegate = new exp.RecaptchaVerifier(container,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
parameters, unwrap(app.auth()));
this.type = this.verifier.type;
parameters,
// TODO: remove ts-ignore when moving types from auth-types to auth-compat
// @ts-ignore
app.auth());
this.type = this._delegate.type;
}
RecaptchaVerifier.prototype.clear = function () {
this.verifier.clear();
this._delegate.clear();
};
RecaptchaVerifier.prototype.render = function () {
return this.verifier.render();
return this._delegate.render();
};
RecaptchaVerifier.prototype.verify = function () {
return this.verifier.verify();
return this._delegate.verify();
};
RecaptchaVerifier.prototype.unwrap = function () {
return this.verifier;
};
return RecaptchaVerifier;

@@ -979,3 +1234,3 @@ }());

*/
var AUTH_TYPE = 'auth';
var AUTH_TYPE = 'auth-compat';
// Create auth components to register with firebase.

@@ -986,5 +1241,5 @@ // Provides Auth public APIs.

// getImmediate for FirebaseApp will always succeed
var app = container.getProvider('app').getImmediate();
var auth = container.getProvider('auth-exp').getImmediate();
return new Auth(app, auth);
var app = container.getProvider('app-compat').getImmediate();
var authProvider = container.getProvider('auth-exp');
return new Auth(app, authProvider);
}, "PUBLIC" /* PUBLIC */)

@@ -1002,16 +1257,16 @@ .setServiceProps({

},
EmailAuthProvider: impl.EmailAuthProvider,
FacebookAuthProvider: impl.FacebookAuthProvider,
GithubAuthProvider: impl.GithubAuthProvider,
GoogleAuthProvider: impl.GoogleAuthProvider,
OAuthProvider: impl.OAuthProvider,
EmailAuthProvider: exp.EmailAuthProvider,
FacebookAuthProvider: exp.FacebookAuthProvider,
GithubAuthProvider: exp.GithubAuthProvider,
GoogleAuthProvider: exp.GoogleAuthProvider,
OAuthProvider: exp.OAuthProvider,
// SAMLAuthProvider,
PhoneAuthProvider: PhoneAuthProvider,
PhoneMultiFactorGenerator: impl.PhoneMultiFactorGenerator,
PhoneMultiFactorGenerator: exp.PhoneMultiFactorGenerator,
RecaptchaVerifier: RecaptchaVerifier,
TwitterAuthProvider: impl.TwitterAuthProvider,
TwitterAuthProvider: exp.TwitterAuthProvider,
Auth: {
Persistence: Persistence
},
AuthCredential: impl.AuthCredential
AuthCredential: exp.AuthCredential
// 'Error': fireauth.AuthError

@@ -1021,6 +1276,23 @@ })

.setMultipleInstances(false));
instance.registerVersion('auth', version);
instance.registerVersion(name, version);
}
impl.registerAuth(_getClientPlatform());
registerAuthCompat(firebase__default['default']);
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
exp.FetchProvider.initialize(fetchImpl__default['default'], fetchImpl.Headers, fetchImpl.Response);
//# sourceMappingURL=index.node.cjs.js.map
{
"name": "@firebase/auth-compat",
"version": "0.0.900-exp.4bb72b62a",
"version": "0.0.900-exp.520ca39d0",
"private": false,

@@ -19,3 +19,3 @@ "description": "FirebaseAuth compatibility package that uses API style compatible with Firebase@7 and prior versions",

"build:deps": "lerna run --scope @firebase/auth-compat --include-dependencies build",
"build:release": "rollup -c rollup.config.release.js",
"build:release": "rollup -c rollup.config.release.js && yarn add-compat-overloads",
"dev": "rollup -c -w",

@@ -26,14 +26,19 @@ "test": "run-p lint test:all",

"test:browser": "karma start --single-run",
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.* --config ../../config/mocharc.node.js"
"test:browser:integration": "karma start --single-run --integration",
"test:node": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts",
"test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration",
"test:webdriver": "rollup -c test/integration/webdriver/static/rollup.config.js && ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --webdriver",
"test:integration": "run-s test:browser:integration test:node:integration test:webdriver",
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../auth-exp/dist/auth-exp-public.d.ts -o dist/auth-compat-exp/index.d.ts -a -r Auth:types.FirebaseAuth -r User:types.User -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/auth"
},
"peerDependencies": {
"@firebase/app-compat": "0.0.900-exp.4bb72b62a",
"@firebase/app-types": "0.x"
"@firebase/app-compat": "0.0.900-exp.520ca39d0"
},
"dependencies": {
"@firebase/auth-types": "0.0.900-exp.4bb72b62a",
"@firebase/auth": "0.0.900-exp.4bb72b62a",
"@firebase/component": "0.1.21",
"@firebase/util": "0.3.4",
"tslib": "^1.11.1"
"@firebase/auth-types": "0.10.2",
"@firebase/auth": "0.0.900-exp.520ca39d0",
"@firebase/component": "0.4.0",
"@firebase/util": "0.4.1",
"node-fetch": "2.6.1",
"tslib": "^2.1.0"
},

@@ -43,7 +48,7 @@ "license": "Apache-2.0",

"@firebase/app-compat": "0.x",
"@rollup/plugin-json": "4.1.0",
"rollup": "2.35.1",
"@rollup/plugin-json": "4.1.0",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-typescript2": "0.29.0",
"typescript": "4.0.5"
"typescript": "4.2.2"
},

@@ -58,3 +63,3 @@ "repository": {

},
"typings": "dist/index.d.ts",
"typings": "dist/auth-compat-exp/index.d.ts",
"nyc": {

@@ -61,0 +66,0 @@ "extension": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet