@angular/fire 7.1.0-rc.5 → 7.2.0-canary.390691b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/analytics/analytics.module.d.ts +3 -5
  2. package/analytics/firebase.d.ts +2 -2
  3. package/analytics/overrides.d.ts +1 -0
  4. package/analytics/screen-tracking.service.d.ts +2 -4
  5. package/analytics/user-tracking.service.d.ts +2 -4
  6. package/auth-guard/angular-fire-auth-guard.d.ts +5 -0
  7. package/auth-guard/auth-guard.d.ts +29 -0
  8. package/auth-guard/auth-guard.module.d.ts +7 -0
  9. package/auth-guard/package.json +11 -0
  10. package/auth-guard/public_api.d.ts +2 -0
  11. package/bundles/angular-fire-analytics.umd.js +63 -84
  12. package/bundles/angular-fire-analytics.umd.js.map +1 -1
  13. package/bundles/angular-fire-auth-guard.umd.js +109 -0
  14. package/bundles/angular-fire-auth-guard.umd.js.map +1 -0
  15. package/bundles/angular-fire-firestore-lite.umd.js +323 -6
  16. package/bundles/angular-fire-firestore-lite.umd.js.map +1 -1
  17. package/bundles/angular-fire-firestore.umd.js.map +1 -1
  18. package/bundles/angular-fire-messaging.umd.js +12 -18
  19. package/bundles/angular-fire-messaging.umd.js.map +1 -1
  20. package/bundles/angular-fire-remote-config.umd.js +12 -18
  21. package/bundles/angular-fire-remote-config.umd.js.map +1 -1
  22. package/bundles/angular-fire.umd.js +49 -6
  23. package/bundles/angular-fire.umd.js.map +1 -1
  24. package/core.d.ts +12 -0
  25. package/docs/version-7-upgrade.md +2 -2
  26. package/esm2015/analytics/analytics.module.js +9 -24
  27. package/esm2015/analytics/firebase.js +3 -3
  28. package/esm2015/analytics/overrides.js +3 -0
  29. package/esm2015/analytics/screen-tracking.service.js +22 -30
  30. package/esm2015/analytics/user-tracking.service.js +24 -23
  31. package/esm2015/auth-guard/angular-fire-auth-guard.js +5 -0
  32. package/esm2015/auth-guard/auth-guard.js +49 -0
  33. package/esm2015/auth-guard/auth-guard.module.js +20 -0
  34. package/esm2015/auth-guard/public_api.js +3 -0
  35. package/esm2015/core.js +47 -2
  36. package/esm2015/firestore/firestore.module.js +1 -1
  37. package/esm2015/firestore/lite/lite.module.js +5 -2
  38. package/esm2015/messaging/firebase.js +3 -3
  39. package/esm2015/messaging/messaging.module.js +9 -17
  40. package/esm2015/messaging/overrides.js +3 -0
  41. package/esm2015/remote-config/firebase.js +3 -3
  42. package/esm2015/remote-config/overrides.js +3 -0
  43. package/esm2015/remote-config/remote-config.module.js +8 -16
  44. package/esm2015/zones.js +3 -2
  45. package/fesm2015/angular-fire-analytics.js +53 -70
  46. package/fesm2015/angular-fire-analytics.js.map +1 -1
  47. package/fesm2015/angular-fire-auth-guard.js +72 -0
  48. package/fesm2015/angular-fire-auth-guard.js.map +1 -0
  49. package/fesm2015/angular-fire-firestore-lite.js +4 -1
  50. package/fesm2015/angular-fire-firestore-lite.js.map +1 -1
  51. package/fesm2015/angular-fire-firestore.js.map +1 -1
  52. package/fesm2015/angular-fire-messaging.js +11 -17
  53. package/fesm2015/angular-fire-messaging.js.map +1 -1
  54. package/fesm2015/angular-fire-remote-config.js +11 -17
  55. package/fesm2015/angular-fire-remote-config.js.map +1 -1
  56. package/fesm2015/angular-fire.js +49 -3
  57. package/fesm2015/angular-fire.js.map +1 -1
  58. package/firestore/firestore.module.d.ts +1 -1
  59. package/firestore/lite/lite.module.d.ts +1 -1
  60. package/messaging/firebase.d.ts +2 -2
  61. package/messaging/messaging.module.d.ts +2 -2
  62. package/messaging/overrides.d.ts +1 -0
  63. package/package.json +9 -10
  64. package/remote-config/firebase.d.ts +2 -2
  65. package/remote-config/overrides.d.ts +1 -0
  66. package/remote-config/remote-config.module.d.ts +2 -2
  67. package/schematics/deploy/actions.js +21 -13
  68. package/schematics/firebaseTools.js +22 -2
  69. package/schematics/setup/index.js +11 -3
  70. package/schematics/setup/prompts.js +1 -1
  71. package/schematics/utils.js +1 -1
  72. package/schematics/versions.json +1 -1
@@ -5,13 +5,11 @@ import { FirebaseApp } from '@angular/fire/app';
5
5
  import { ScreenTrackingService } from './screen-tracking.service';
6
6
  import { UserTrackingService } from './user-tracking.service';
7
7
  import * as i0 from "@angular/core";
8
- export declare const PROVIDED_ANALYTICS_INSTANCE_FACTORIES: InjectionToken<((injector: Injector) => Analytics)[]>;
9
8
  export declare const PROVIDED_ANALYTICS_INSTANCES: InjectionToken<Analytics[]>;
10
- export declare const isSupportedPromiseSymbol: unique symbol;
11
- export declare function defaultAnalyticsInstanceFactory(isSupported: boolean, provided: FirebaseAnalytics[] | undefined, defaultApp: FirebaseApp): Analytics;
12
- export declare function analyticsInstanceFactory(fn: (injector: Injector) => FirebaseAnalytics): (zone: NgZone, isSupported: boolean, injector: Injector) => Analytics;
9
+ export declare function defaultAnalyticsInstanceFactory(provided: FirebaseAnalytics[] | undefined, defaultApp: FirebaseApp): Analytics;
10
+ export declare function analyticsInstanceFactory(fn: (injector: Injector) => FirebaseAnalytics): (zone: NgZone, injector: Injector) => Analytics;
13
11
  export declare class AnalyticsModule {
14
- constructor(_screenTracking: ScreenTrackingService, _userTracking: UserTrackingService);
12
+ constructor(_screenTrackingService: ScreenTrackingService, _userTrackingService: UserTrackingService);
15
13
  static ɵfac: i0.ɵɵFactoryDeclaration<AnalyticsModule, [{ optional: true; }, { optional: true; }]>;
16
14
  static ɵmod: i0.ɵɵNgModuleDeclaration<AnalyticsModule, never, never, never>;
17
15
  static ɵinj: i0.ɵɵInjectorDeclaration<AnalyticsModule>;
@@ -1,8 +1,8 @@
1
1
  export * from 'firebase/analytics';
2
- import { getAnalytics as _getAnalytics, initializeAnalytics as _initializeAnalytics, isSupported as _isSupported, logEvent as _logEvent, setAnalyticsCollectionEnabled as _setAnalyticsCollectionEnabled, setCurrentScreen as _setCurrentScreen, settings as _settings, setUserId as _setUserId, setUserProperties as _setUserProperties } from 'firebase/analytics';
2
+ import { getAnalytics as _getAnalytics, initializeAnalytics as _initializeAnalytics, logEvent as _logEvent, setAnalyticsCollectionEnabled as _setAnalyticsCollectionEnabled, setCurrentScreen as _setCurrentScreen, settings as _settings, setUserId as _setUserId, setUserProperties as _setUserProperties } from 'firebase/analytics';
3
+ export { isSupported } from './overrides';
3
4
  export declare const getAnalytics: typeof _getAnalytics;
4
5
  export declare const initializeAnalytics: typeof _initializeAnalytics;
5
- export declare const isSupported: typeof _isSupported;
6
6
  export declare const logEvent: typeof _logEvent;
7
7
  export declare const setAnalyticsCollectionEnabled: typeof _setAnalyticsCollectionEnabled;
8
8
  export declare const setCurrentScreen: typeof _setCurrentScreen;
@@ -0,0 +1 @@
1
+ export declare const isSupported: () => any;
@@ -2,8 +2,6 @@ import { ComponentFactoryResolver, NgZone, OnDestroy, Injector } from '@angular/
2
2
  import { Observable } from 'rxjs';
3
3
  import { Router } from '@angular/router';
4
4
  import { Title } from '@angular/platform-browser';
5
- import { FirebaseApp } from '@angular/fire/app';
6
- import { Analytics } from './analytics';
7
5
  import { UserTrackingService } from './user-tracking.service';
8
6
  import * as i0 from "@angular/core";
9
7
  declare const FIREBASE_EVENT_ORIGIN_KEY = "firebase_event_origin";
@@ -34,9 +32,9 @@ export declare const ɵscreenViewEvent: (router: Router, title: Title | null, co
34
32
  }>;
35
33
  export declare class ScreenTrackingService implements OnDestroy {
36
34
  private disposable;
37
- constructor(router: Router, title: Title, componentFactoryResolver: ComponentFactoryResolver, zone: NgZone, userTrackingService: UserTrackingService, firebaseApp: FirebaseApp, analyticsInstanceFactories: Array<(injector: Injector) => Analytics>, injector: Injector);
35
+ constructor(router: Router, title: Title, componentFactoryResolver: ComponentFactoryResolver, zone: NgZone, userTrackingService: UserTrackingService, injector: Injector);
38
36
  ngOnDestroy(): void;
39
- static ɵfac: i0.ɵɵFactoryDeclaration<ScreenTrackingService, [{ optional: true; }, { optional: true; }, null, null, { optional: true; }, null, null, null]>;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScreenTrackingService, [{ optional: true; }, { optional: true; }, null, null, { optional: true; }, null]>;
40
38
  static ɵprov: i0.ɵɵInjectableDeclaration<ScreenTrackingService>;
41
39
  }
42
40
  export {};
@@ -1,12 +1,10 @@
1
1
  import { Injector, NgZone, OnDestroy } from '@angular/core';
2
- import { Analytics } from './analytics';
3
2
  import { Auth } from '@angular/fire/auth';
4
- import { FirebaseApp } from '@angular/fire/app';
5
3
  import * as i0 from "@angular/core";
6
4
  export declare class UserTrackingService implements OnDestroy {
7
5
  readonly initialized: Promise<void>;
8
- private readonly disposables;
9
- constructor(auth: Auth, zone: NgZone, analyticsInstanceFactories: Array<(injector: Injector) => Analytics>, injector: Injector, firebaseApp: FirebaseApp);
6
+ private disposables;
7
+ constructor(auth: Auth, zone: NgZone, injector: Injector);
10
8
  ngOnDestroy(): void;
11
9
  static ɵfac: i0.ɵɵFactoryDeclaration<UserTrackingService, never>;
12
10
  static ɵprov: i0.ɵɵInjectableDeclaration<UserTrackingService>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@angular/fire/auth-guard" />
5
+ export * from './public_api';
@@ -0,0 +1,29 @@
1
+ import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
2
+ import { Observable, UnaryFunction } from 'rxjs';
3
+ import { Auth } from '@angular/fire/auth';
4
+ import { User } from 'firebase/auth';
5
+ import * as i0 from "@angular/core";
6
+ export declare type AuthPipeGenerator = (next: ActivatedRouteSnapshot, state: RouterStateSnapshot) => AuthPipe;
7
+ export declare type AuthPipe = UnaryFunction<Observable<User | null>, Observable<boolean | string | any[]>>;
8
+ export declare const loggedIn: AuthPipe;
9
+ export declare class AuthGuard implements CanActivate {
10
+ private router;
11
+ private auth;
12
+ constructor(router: Router, auth: Auth);
13
+ canActivate: (next: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<boolean | import("@angular/router").UrlTree>;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthGuard, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthGuard>;
16
+ }
17
+ export declare const canActivate: (pipe: AuthPipeGenerator) => {
18
+ canActivate: (typeof AuthGuard)[];
19
+ data: {
20
+ authGuardPipe: AuthPipeGenerator;
21
+ };
22
+ };
23
+ export declare const isNotAnonymous: AuthPipe;
24
+ export declare const idTokenResult: import("rxjs").OperatorFunction<User, any>;
25
+ export declare const emailVerified: AuthPipe;
26
+ export declare const customClaims: UnaryFunction<Observable<User>, Observable<any>>;
27
+ export declare const hasCustomClaim: (claim: string) => AuthPipe;
28
+ export declare const redirectUnauthorizedTo: (redirect: string | any[]) => AuthPipe;
29
+ export declare const redirectLoggedInTo: (redirect: string | any[]) => AuthPipe;
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class AuthGuardModule {
3
+ constructor();
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthGuardModule, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AuthGuardModule, never, never, never>;
6
+ static ɵinj: i0.ɵɵInjectorDeclaration<AuthGuardModule>;
7
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/package.schema.json",
3
+ "main": "../bundles/angular-fire-auth-guard.umd.js",
4
+ "module": "../fesm2015/angular-fire-auth-guard.js",
5
+ "es2015": "../fesm2015/angular-fire-auth-guard.js",
6
+ "esm2015": "../esm2015/auth-guard/angular-fire-auth-guard.js",
7
+ "fesm2015": "../fesm2015/angular-fire-auth-guard.js",
8
+ "typings": "angular-fire-auth-guard.d.ts",
9
+ "sideEffects": false,
10
+ "name": "@angular/fire/auth-guard"
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from './auth-guard';
2
+ export * from './auth-guard.module';
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/fire'), require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('firebase/analytics'), require('@angular/fire/app'), require('firebase/app'), require('@angular/router'), require('@angular/platform-browser'), require('@angular/fire/auth')) :
3
- typeof define === 'function' && define.amd ? define('@angular/fire/analytics', ['exports', '@angular/fire', 'rxjs', 'rxjs/operators', '@angular/core', 'firebase/analytics', '@angular/fire/app', 'firebase/app', '@angular/router', '@angular/platform-browser', '@angular/fire/auth'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.angular = global.angular || {}, global.angular.fire = global.angular.fire || {}, global.angular.fire.analytics = {}), global.angular.fire, global.rxjs, global.rxjs.operators, global.ng.core, global['firebase-analytics'], global.angular.fire.app, global.app, global.ng.router, global.ng.platformBrowser, global.angular.fire.auth));
5
- }(this, (function (exports, fire, rxjs, operators, i0, analytics, i2, app, i1$1, i2$1, i1) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/fire'), require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@angular/fire/app'), require('firebase/app'), require('@angular/router'), require('firebase/analytics'), require('@angular/platform-browser'), require('@angular/fire/auth')) :
3
+ typeof define === 'function' && define.amd ? define('@angular/fire/analytics', ['exports', '@angular/fire', 'rxjs', 'rxjs/operators', '@angular/core', '@angular/fire/app', 'firebase/app', '@angular/router', 'firebase/analytics', '@angular/platform-browser', '@angular/fire/auth'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.angular = global.angular || {}, global.angular.fire = global.angular.fire || {}, global.angular.fire.analytics = {}), global.angular.fire, global.rxjs, global.rxjs.operators, global.ng.core, global.angular.fire.app, global.app, global.ng.router, global['firebase-analytics'], global.ng.platformBrowser, global.angular.fire.auth));
5
+ }(this, (function (exports, fire, rxjs, operators, i0, app$1, app, i1$1, analytics, i2, i1) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -25,9 +25,8 @@
25
25
  }
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
29
28
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
30
- var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
29
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
30
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
32
31
 
33
32
  var Analytics = /** @class */ (function () {
@@ -357,10 +356,11 @@
357
356
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
358
357
  }
359
358
 
359
+ var isSupported = fire.ɵisAnalyticsSupportedFactory.async;
360
+
360
361
  // DO NOT MODIFY, this file is autogenerated by tools/build.ts
361
362
  var getAnalytics = fire.ɵzoneWrap(analytics.getAnalytics, true);
362
363
  var initializeAnalytics = fire.ɵzoneWrap(analytics.initializeAnalytics, true);
363
- var isSupported = fire.ɵzoneWrap(analytics.isSupported, true);
364
364
  var logEvent = fire.ɵzoneWrap(analytics.logEvent, true);
365
365
  var setAnalyticsCollectionEnabled = fire.ɵzoneWrap(analytics.setAnalyticsCollectionEnabled, true);
366
366
  var setCurrentScreen = fire.ɵzoneWrap(analytics.setCurrentScreen, true);
@@ -369,39 +369,41 @@
369
369
  var setUserProperties = fire.ɵzoneWrap(analytics.setUserProperties, true);
370
370
 
371
371
  var UserTrackingService = /** @class */ (function () {
372
- function UserTrackingService(auth, zone, analyticsInstanceFactories, injector, firebaseApp) {
372
+ function UserTrackingService(auth, zone, injector) {
373
+ var _this = this;
373
374
  this.disposables = [];
374
375
  app.registerVersion('angularfire', fire.VERSION.full, 'user-tracking');
375
- // Analytics is not ready to be injected yet, as the APP_INITIALIZER hasn't evulated yet, do this the hard way
376
- var analyticsInstance = globalThis[isSupportedPromiseSymbol].then(function (isSupported) {
377
- var analyticsInstances = analyticsInstanceFactories.map(function (fn) { return analyticsInstanceFactory(fn)(zone, isSupported, injector); });
378
- return defaultAnalyticsInstanceFactory(isSupported, analyticsInstances, firebaseApp);
379
- });
380
376
  var resolveInitialized;
381
377
  this.initialized = zone.runOutsideAngular(function () { return new Promise(function (resolve) { resolveInitialized = resolve; }); });
382
- this.disposables = [
383
- // TODO add credential tracking back in
384
- i1.authState(auth).subscribe(function (user) {
385
- analyticsInstance.then(function (analytics) { return analytics && setUserId(analytics, user === null || user === void 0 ? void 0 : user.uid); });
378
+ // The APP_INITIALIZER that is making isSupported() sync for the sake of convenient DI
379
+ // may not be done when services are initialized. Guard the functionality by first ensuring
380
+ // that the (global) promise has resolved, then get Analytics from the injector.
381
+ isSupported().then(function () {
382
+ var analytics = injector.get(Analytics);
383
+ if (analytics) {
384
+ _this.disposables = [
385
+ // TODO add credential tracking back in
386
+ i1.authState(auth).subscribe(function (user) {
387
+ setUserId(analytics, user === null || user === void 0 ? void 0 : user.uid);
388
+ resolveInitialized();
389
+ }),
390
+ ];
391
+ }
392
+ else {
386
393
  resolveInitialized();
387
- }),
388
- ];
394
+ }
395
+ });
389
396
  }
390
397
  UserTrackingService.prototype.ngOnDestroy = function () {
391
398
  this.disposables.forEach(function (it) { return it.unsubscribe(); });
392
399
  };
393
400
  return UserTrackingService;
394
401
  }());
395
- UserTrackingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: UserTrackingService, deps: [{ token: i1__namespace.Auth }, { token: i0__namespace.NgZone }, { token: PROVIDED_ANALYTICS_INSTANCE_FACTORIES }, { token: i0__namespace.Injector }, { token: i2__namespace.FirebaseApp }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
402
+ UserTrackingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: UserTrackingService, deps: [{ token: i1__namespace.Auth }, { token: i0__namespace.NgZone }, { token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
396
403
  UserTrackingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: UserTrackingService });
397
404
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: UserTrackingService, decorators: [{
398
405
  type: i0.Injectable
399
- }], ctorParameters: function () {
400
- return [{ type: i1__namespace.Auth }, { type: i0__namespace.NgZone }, { type: Array, decorators: [{
401
- type: i0.Inject,
402
- args: [PROVIDED_ANALYTICS_INSTANCE_FACTORIES]
403
- }] }, { type: i0__namespace.Injector }, { type: i2__namespace.FirebaseApp }];
404
- } });
406
+ }], ctorParameters: function () { return [{ type: i1__namespace.Auth }, { type: i0__namespace.NgZone }, { type: i0__namespace.Injector }]; } });
405
407
 
406
408
  var FIREBASE_EVENT_ORIGIN_KEY = 'firebase_event_origin';
407
409
  var FIREBASE_PREVIOUS_SCREEN_CLASS_KEY = 'firebase_previous_class';
@@ -497,38 +499,32 @@
497
499
  })); }));
498
500
  };
499
501
  var ScreenTrackingService = /** @class */ (function () {
500
- function ScreenTrackingService(router, title, componentFactoryResolver, zone, userTrackingService, firebaseApp, analyticsInstanceFactories, injector) {
502
+ function ScreenTrackingService(router, title, componentFactoryResolver, zone, userTrackingService, injector) {
501
503
  var _this = this;
502
504
  app.registerVersion('angularfire', fire.VERSION.full, 'screen-tracking');
503
- if (!router) {
504
- return this;
505
- }
506
- // Analytics is not ready to be injected yet, as the APP_INITIALIZER hasn't evulated yet, do this the hard way
507
- var analyticsInstance = globalThis[isSupportedPromiseSymbol].then(function (isSupported) {
508
- var analyticsInstances = analyticsInstanceFactories.map(function (fn) { return analyticsInstanceFactory(fn)(zone, isSupported, injector); });
509
- return defaultAnalyticsInstanceFactory(isSupported, analyticsInstances, firebaseApp);
510
- });
511
- zone.runOutsideAngular(function () {
512
- _this.disposable = ɵscreenViewEvent(router, title, componentFactoryResolver).pipe(operators.switchMap(function (params) { return __awaiter(_this, void 0, void 0, function () {
513
- var analytics;
514
- return __generator(this, function (_b) {
515
- switch (_b.label) {
516
- case 0:
517
- if (!userTrackingService) return [3 /*break*/, 2];
518
- return [4 /*yield*/, userTrackingService.initialized];
519
- case 1:
520
- _b.sent();
521
- _b.label = 2;
522
- case 2: return [4 /*yield*/, analyticsInstance];
523
- case 3:
524
- analytics = _b.sent();
525
- if (!analytics) {
526
- return [2 /*return*/];
527
- }
528
- return [2 /*return*/, logEvent(analytics, SCREEN_VIEW_EVENT, params)];
529
- }
530
- });
531
- }); })).subscribe();
505
+ // The APP_INITIALIZER that is making isSupported() sync for the sake of convenient DI
506
+ // may not be done when services are initialized. Guard the functionality by first ensuring
507
+ // that the (global) promise has resolved, then get Analytics from the injector.
508
+ isSupported().then(function () {
509
+ var analytics = injector.get(Analytics);
510
+ if (!router || !analytics) {
511
+ return;
512
+ }
513
+ zone.runOutsideAngular(function () {
514
+ _this.disposable = ɵscreenViewEvent(router, title, componentFactoryResolver).pipe(operators.switchMap(function (params) { return __awaiter(_this, void 0, void 0, function () {
515
+ return __generator(this, function (_b) {
516
+ switch (_b.label) {
517
+ case 0:
518
+ if (!userTrackingService) return [3 /*break*/, 2];
519
+ return [4 /*yield*/, userTrackingService.initialized];
520
+ case 1:
521
+ _b.sent();
522
+ _b.label = 2;
523
+ case 2: return [2 /*return*/, logEvent(analytics, SCREEN_VIEW_EVENT, params)];
524
+ }
525
+ });
526
+ }); })).subscribe();
527
+ });
532
528
  });
533
529
  }
534
530
  ScreenTrackingService.prototype.ngOnDestroy = function () {
@@ -538,39 +534,31 @@
538
534
  };
539
535
  return ScreenTrackingService;
540
536
  }());
541
- ScreenTrackingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: ScreenTrackingService, deps: [{ token: i1__namespace$1.Router, optional: true }, { token: i2__namespace$1.Title, optional: true }, { token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.NgZone }, { token: UserTrackingService, optional: true }, { token: i2__namespace.FirebaseApp }, { token: PROVIDED_ANALYTICS_INSTANCE_FACTORIES }, { token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
537
+ ScreenTrackingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: ScreenTrackingService, deps: [{ token: i1__namespace$1.Router, optional: true }, { token: i2__namespace.Title, optional: true }, { token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.NgZone }, { token: UserTrackingService, optional: true }, { token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
542
538
  ScreenTrackingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: ScreenTrackingService });
543
539
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: ScreenTrackingService, decorators: [{
544
540
  type: i0.Injectable
545
541
  }], ctorParameters: function () {
546
542
  return [{ type: i1__namespace$1.Router, decorators: [{
547
543
  type: i0.Optional
548
- }] }, { type: i2__namespace$1.Title, decorators: [{
544
+ }] }, { type: i2__namespace.Title, decorators: [{
549
545
  type: i0.Optional
550
546
  }] }, { type: i0__namespace.ComponentFactoryResolver }, { type: i0__namespace.NgZone }, { type: UserTrackingService, decorators: [{
551
547
  type: i0.Optional
552
- }] }, { type: i2__namespace.FirebaseApp }, { type: Array, decorators: [{
553
- type: i0.Inject,
554
- args: [PROVIDED_ANALYTICS_INSTANCE_FACTORIES]
555
548
  }] }, { type: i0__namespace.Injector }];
556
549
  } });
557
550
 
558
- var PROVIDED_ANALYTICS_INSTANCE_FACTORIES = new i0.InjectionToken('angularfire2.analytics-instances.factory');
559
551
  var PROVIDED_ANALYTICS_INSTANCES = new i0.InjectionToken('angularfire2.analytics-instances');
560
- var IS_SUPPORTED = new i0.InjectionToken('angularfire2.analytics.isSupported');
561
- var isSupportedValueSymbol = Symbol('angularfire2.analytics.isSupported.value');
562
- var isSupportedPromiseSymbol = Symbol('angularfire2.analytics.isSupported');
563
- globalThis[isSupportedPromiseSymbol] || (globalThis[isSupportedPromiseSymbol] = analytics.isSupported().then(function (it) { return globalThis[isSupportedValueSymbol] = it; }));
564
- function defaultAnalyticsInstanceFactory(isSupported, provided, defaultApp) {
565
- if (!isSupported) {
552
+ function defaultAnalyticsInstanceFactory(provided, defaultApp) {
553
+ if (!fire.ɵisAnalyticsSupportedFactory.sync()) {
566
554
  return null;
567
555
  }
568
556
  var defaultAnalytics = fire.ɵgetDefaultInstanceOf(ANALYTICS_PROVIDER_NAME, provided, defaultApp);
569
557
  return defaultAnalytics && new Analytics(defaultAnalytics);
570
558
  }
571
559
  function analyticsInstanceFactory(fn) {
572
- return function (zone, isSupported, injector) {
573
- if (!isSupported) {
560
+ return function (zone, injector) {
561
+ if (!fire.ɵisAnalyticsSupportedFactory.sync()) {
574
562
  return null;
575
563
  }
576
564
  var analytics = zone.runOutsideAngular(function () { return fn(injector); });
@@ -587,13 +575,12 @@
587
575
  provide: Analytics,
588
576
  useFactory: defaultAnalyticsInstanceFactory,
589
577
  deps: [
590
- IS_SUPPORTED,
591
578
  [new i0.Optional(), PROVIDED_ANALYTICS_INSTANCES],
592
- i2.FirebaseApp,
579
+ app$1.FirebaseApp,
593
580
  ]
594
581
  };
595
582
  var AnalyticsModule = /** @class */ (function () {
596
- function AnalyticsModule(_screenTracking, _userTracking) {
583
+ function AnalyticsModule(_screenTrackingService, _userTrackingService) {
597
584
  app.registerVersion('angularfire', fire.VERSION.full, 'analytics');
598
585
  }
599
586
  return AnalyticsModule;
@@ -605,7 +592,7 @@
605
592
  ANALYTICS_INSTANCES_PROVIDER,
606
593
  {
607
594
  provide: i0.APP_INITIALIZER,
608
- useValue: function () { return globalThis[isSupportedPromiseSymbol]; },
595
+ useValue: fire.ɵisAnalyticsSupportedFactory.async,
609
596
  multi: true,
610
597
  }
611
598
  ] });
@@ -617,7 +604,7 @@
617
604
  ANALYTICS_INSTANCES_PROVIDER,
618
605
  {
619
606
  provide: i0.APP_INITIALIZER,
620
- useValue: function () { return globalThis[isSupportedPromiseSymbol]; },
607
+ useValue: fire.ɵisAnalyticsSupportedFactory.async,
621
608
  multi: true,
622
609
  }
623
610
  ]
@@ -637,22 +624,14 @@
637
624
  return {
638
625
  ngModule: AnalyticsModule,
639
626
  providers: [{
640
- provide: IS_SUPPORTED,
641
- useFactory: function () { return globalThis[isSupportedValueSymbol]; },
642
- }, {
643
- provide: PROVIDED_ANALYTICS_INSTANCE_FACTORIES,
644
- useValue: fn,
645
- multi: true,
646
- }, {
647
627
  provide: PROVIDED_ANALYTICS_INSTANCES,
648
628
  useFactory: analyticsInstanceFactory(fn),
649
629
  multi: true,
650
630
  deps: __spreadArray([
651
631
  i0.NgZone,
652
- IS_SUPPORTED,
653
632
  i0.Injector,
654
633
  fire.ɵAngularFireSchedulers,
655
- i2.FirebaseApps
634
+ app$1.FirebaseApps
656
635
  ], __read(deps))
657
636
  }]
658
637
  };