@angular/fire 18.0.0-rc.0 → 18.0.1-canary.3639e41

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 (96) hide show
  1. package/esm2022/analytics/analytics.module.mjs +5 -5
  2. package/esm2022/analytics/screen-tracking.service.mjs +4 -4
  3. package/esm2022/analytics/user-tracking.service.mjs +4 -4
  4. package/esm2022/app/app.module.mjs +5 -5
  5. package/esm2022/app-check/app-check.module.mjs +5 -5
  6. package/esm2022/auth/auth.module.mjs +5 -5
  7. package/esm2022/auth-guard/auth-guard.mjs +4 -4
  8. package/esm2022/auth-guard/auth-guard.module.mjs +5 -5
  9. package/esm2022/compat/analytics/analytics.mjs +4 -4
  10. package/esm2022/compat/analytics/analytics.module.mjs +5 -5
  11. package/esm2022/compat/analytics/screen-tracking.service.mjs +4 -4
  12. package/esm2022/compat/analytics/user-tracking.service.mjs +4 -4
  13. package/esm2022/compat/auth/auth.mjs +4 -4
  14. package/esm2022/compat/auth/auth.module.mjs +5 -5
  15. package/esm2022/compat/auth-guard/auth-guard.mjs +4 -4
  16. package/esm2022/compat/auth-guard/auth-guard.module.mjs +5 -5
  17. package/esm2022/compat/database/database.mjs +4 -4
  18. package/esm2022/compat/database/database.module.mjs +5 -5
  19. package/esm2022/compat/firebase.app.module.mjs +5 -5
  20. package/esm2022/compat/firestore/firestore.mjs +4 -4
  21. package/esm2022/compat/firestore/firestore.module.mjs +5 -5
  22. package/esm2022/compat/functions/functions.mjs +4 -4
  23. package/esm2022/compat/functions/functions.module.mjs +5 -5
  24. package/esm2022/compat/messaging/messaging.mjs +4 -4
  25. package/esm2022/compat/messaging/messaging.module.mjs +5 -5
  26. package/esm2022/compat/performance/performance.mjs +4 -4
  27. package/esm2022/compat/performance/performance.module.mjs +5 -5
  28. package/esm2022/compat/performance/performance.service.mjs +4 -4
  29. package/esm2022/compat/remote-config/remote-config.mjs +4 -4
  30. package/esm2022/compat/remote-config/remote-config.module.mjs +5 -5
  31. package/esm2022/compat/storage/pipes/storageUrl.pipe.mjs +8 -8
  32. package/esm2022/compat/storage/storage.mjs +4 -4
  33. package/esm2022/compat/storage/storage.module.mjs +5 -5
  34. package/esm2022/database/database.module.mjs +5 -5
  35. package/esm2022/firestore/firestore.module.mjs +5 -5
  36. package/esm2022/firestore/lite/lite.module.mjs +5 -5
  37. package/esm2022/functions/functions.module.mjs +5 -5
  38. package/esm2022/messaging/messaging.module.mjs +5 -5
  39. package/esm2022/performance/performance.module.mjs +5 -5
  40. package/esm2022/remote-config/remote-config.module.mjs +5 -5
  41. package/esm2022/storage/storage.module.mjs +5 -5
  42. package/esm2022/vertexai-preview/vertexai.module.mjs +5 -5
  43. package/esm2022/zones.mjs +4 -4
  44. package/fesm2022/angular-fire-analytics.mjs +297 -410
  45. package/fesm2022/angular-fire-analytics.mjs.map +1 -7
  46. package/fesm2022/angular-fire-app-check.mjs +91 -162
  47. package/fesm2022/angular-fire-app-check.mjs.map +1 -7
  48. package/fesm2022/angular-fire-app.mjs +108 -181
  49. package/fesm2022/angular-fire-app.mjs.map +1 -7
  50. package/fesm2022/angular-fire-auth-guard.mjs +73 -83
  51. package/fesm2022/angular-fire-auth-guard.mjs.map +1 -7
  52. package/fesm2022/angular-fire-auth.mjs +142 -421
  53. package/fesm2022/angular-fire-auth.mjs.map +1 -7
  54. package/fesm2022/angular-fire-compat-analytics.mjs +271 -262
  55. package/fesm2022/angular-fire-compat-analytics.mjs.map +1 -7
  56. package/fesm2022/angular-fire-compat-auth-guard.mjs +72 -83
  57. package/fesm2022/angular-fire-compat-auth-guard.mjs.map +1 -7
  58. package/fesm2022/angular-fire-compat-auth.mjs +214 -215
  59. package/fesm2022/angular-fire-compat-auth.mjs.map +1 -7
  60. package/fesm2022/angular-fire-compat-database.mjs +378 -375
  61. package/fesm2022/angular-fire-compat-database.mjs.map +1 -7
  62. package/fesm2022/angular-fire-compat-firestore.mjs +677 -537
  63. package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -7
  64. package/fesm2022/angular-fire-compat-functions.mjs +94 -98
  65. package/fesm2022/angular-fire-compat-functions.mjs.map +1 -7
  66. package/fesm2022/angular-fire-compat-messaging.mjs +107 -107
  67. package/fesm2022/angular-fire-compat-messaging.mjs.map +1 -7
  68. package/fesm2022/angular-fire-compat-performance.mjs +152 -158
  69. package/fesm2022/angular-fire-compat-performance.mjs.map +1 -7
  70. package/fesm2022/angular-fire-compat-remote-config.mjs +232 -216
  71. package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -7
  72. package/fesm2022/angular-fire-compat-storage.mjs +231 -226
  73. package/fesm2022/angular-fire-compat-storage.mjs.map +1 -7
  74. package/fesm2022/angular-fire-compat.mjs +153 -140
  75. package/fesm2022/angular-fire-compat.mjs.map +1 -7
  76. package/fesm2022/angular-fire-database.mjs +136 -376
  77. package/fesm2022/angular-fire-database.mjs.map +1 -7
  78. package/fesm2022/angular-fire-firestore-lite.mjs +139 -388
  79. package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -7
  80. package/fesm2022/angular-fire-firestore.mjs +167 -526
  81. package/fesm2022/angular-fire-firestore.mjs.map +1 -7
  82. package/fesm2022/angular-fire-functions.mjs +93 -166
  83. package/fesm2022/angular-fire-functions.mjs.map +1 -7
  84. package/fesm2022/angular-fire-messaging.mjs +118 -196
  85. package/fesm2022/angular-fire-messaging.mjs.map +1 -7
  86. package/fesm2022/angular-fire-performance.mjs +104 -178
  87. package/fesm2022/angular-fire-performance.mjs.map +1 -7
  88. package/fesm2022/angular-fire-remote-config.mjs +132 -254
  89. package/fesm2022/angular-fire-remote-config.mjs.map +1 -7
  90. package/fesm2022/angular-fire-storage.mjs +105 -225
  91. package/fesm2022/angular-fire-storage.mjs.map +1 -7
  92. package/fesm2022/angular-fire-vertexai-preview.mjs +85 -146
  93. package/fesm2022/angular-fire-vertexai-preview.mjs.map +1 -7
  94. package/fesm2022/angular-fire.mjs +213 -183
  95. package/fesm2022/angular-fire.mjs.map +1 -7
  96. package/package.json +7 -7
@@ -1,276 +1,285 @@
1
- // base.mjs
2
- var proxyPolyfillCompat = {
3
- app: null,
4
- logEvent: null,
5
- setCurrentScreen: null,
6
- setUserId: null,
7
- setUserProperties: null,
8
- setAnalyticsCollectionEnabled: null
1
+ import { isPlatformBrowser, isPlatformServer } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { InjectionToken, PLATFORM_ID, Injectable, Optional, Inject, NgModule } from '@angular/core';
4
+ import * as i2 from '@angular/fire';
5
+ import { VERSION } from '@angular/fire';
6
+ import * as i1 from '@angular/fire/compat';
7
+ import { ɵcacheInstance as _cacheInstance, ɵlazySDKProxy as _lazySDKProxy, ɵapplyMixins as _applyMixins } from '@angular/fire/compat';
8
+ import { isSupported } from 'firebase/analytics';
9
+ import { of, EMPTY } from 'rxjs';
10
+ import { observeOn, switchMap, map, shareReplay } from 'rxjs/operators';
11
+ import firebase from 'firebase/compat/app';
12
+ import { ɵscreenViewEvent as _screenViewEvent } from '@angular/fire/analytics';
13
+ import * as i3 from '@angular/platform-browser';
14
+ import * as i2$2 from '@angular/router';
15
+ import * as i2$1 from '@angular/fire/compat/auth';
16
+
17
+ // DO NOT MODIFY, this file is autogenerated by tools/build.ts
18
+ // Export a null object with the same keys as firebase/compat/analytics, so Proxy can work with proxy-polyfill in Internet Explorer
19
+ const proxyPolyfillCompat = {
20
+ app: null,
21
+ logEvent: null,
22
+ setCurrentScreen: null,
23
+ setUserId: null,
24
+ setUserProperties: null,
25
+ setAnalyticsCollectionEnabled: null,
9
26
  };
10
27
 
11
- // analytics.mjs
12
- import { isPlatformBrowser } from "@angular/common";
13
- import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from "@angular/core";
14
- import { ɵAngularFireSchedulers } from "@angular/fire";
15
- import { ɵapplyMixins, ɵcacheInstance, ɵlazySDKProxy } from "@angular/fire/compat";
16
- import { FirebaseApp } from "@angular/fire/compat";
17
- import { isSupported } from "firebase/analytics";
18
- import { EMPTY, of } from "rxjs";
19
- import { map, observeOn, shareReplay, switchMap } from "rxjs/operators";
20
- import * as i0 from "@angular/core";
21
- import * as i1 from "@angular/fire/compat";
22
- import * as i2 from "@angular/fire";
23
- var COLLECTION_ENABLED = new InjectionToken("angularfire2.analytics.analyticsCollectionEnabled");
24
- var APP_VERSION = new InjectionToken("angularfire2.analytics.appVersion");
25
- var APP_NAME = new InjectionToken("angularfire2.analytics.appName");
26
- var DEBUG_MODE = new InjectionToken("angularfire2.analytics.debugMode");
27
- var CONFIG = new InjectionToken("angularfire2.analytics.config");
28
- var APP_NAME_KEY = "app_name";
29
- var APP_VERSION_KEY = "app_version";
30
- var DEBUG_MODE_KEY = "debug_mode";
31
- var GTAG_CONFIG_COMMAND = "config";
32
- var GTAG_FUNCTION_NAME = "gtag";
33
- var DATA_LAYER_NAME = "dataLayer";
34
- var SEND_TO_KEY = "send_to";
35
- var AngularFireAnalytics = class _AngularFireAnalytics {
36
- measurementId;
37
- analyticsInitialized = new Promise(() => void 0);
38
- async updateConfig(config) {
39
- await this.analyticsInitialized;
40
- window[GTAG_FUNCTION_NAME](GTAG_CONFIG_COMMAND, this.measurementId, { ...config, update: true });
41
- }
42
- constructor(app, analyticsCollectionEnabled, providedAppVersion, providedAppName, debugModeEnabled, providedConfig, platformId, zone, schedulers) {
43
- if (isPlatformBrowser(platformId)) {
44
- window[DATA_LAYER_NAME] = window[DATA_LAYER_NAME] || [];
45
- const parseMeasurementId = (...args) => {
46
- if (args[0] === "config" && args[2].origin === "firebase") {
47
- this.measurementId = args[1];
48
- return true;
49
- } else {
50
- return false;
51
- }
52
- };
53
- const patchGtag = (fn) => {
54
- window[GTAG_FUNCTION_NAME] = (...args) => {
55
- if (fn) {
56
- fn(...args);
57
- }
58
- if (args[0] === "event" && args[2][SEND_TO_KEY] === this.measurementId) {
59
- if (providedAppName) {
60
- args[2][APP_NAME_KEY] = providedAppName;
28
+ const COLLECTION_ENABLED = new InjectionToken('angularfire2.analytics.analyticsCollectionEnabled');
29
+ const APP_VERSION = new InjectionToken('angularfire2.analytics.appVersion');
30
+ const APP_NAME = new InjectionToken('angularfire2.analytics.appName');
31
+ const DEBUG_MODE = new InjectionToken('angularfire2.analytics.debugMode');
32
+ const CONFIG = new InjectionToken('angularfire2.analytics.config');
33
+ const APP_NAME_KEY = 'app_name';
34
+ const APP_VERSION_KEY = 'app_version';
35
+ const DEBUG_MODE_KEY = 'debug_mode';
36
+ const GTAG_CONFIG_COMMAND = 'config';
37
+ const GTAG_FUNCTION_NAME = 'gtag'; // TODO rename these
38
+ const DATA_LAYER_NAME = 'dataLayer';
39
+ const SEND_TO_KEY = 'send_to';
40
+ class AngularFireAnalytics {
41
+ measurementId;
42
+ analyticsInitialized = new Promise(() => undefined);
43
+ async updateConfig(config) {
44
+ await this.analyticsInitialized;
45
+ window[GTAG_FUNCTION_NAME](GTAG_CONFIG_COMMAND, this.measurementId, { ...config, update: true });
46
+ }
47
+ constructor(app, analyticsCollectionEnabled, providedAppVersion, providedAppName, debugModeEnabled, providedConfig,
48
+ // eslint-disable-next-line @typescript-eslint/ban-types
49
+ platformId, zone, schedulers) {
50
+ if (isPlatformBrowser(platformId)) {
51
+ window[DATA_LAYER_NAME] = window[DATA_LAYER_NAME] || [];
52
+ // It turns out we can't rely on the measurementId in the Firebase config JSON
53
+ // this identifier is not stable. firebase/analytics does a call to get a fresh value
54
+ // falling back on the one in the config. Rather than do that ourselves we should listen
55
+ // on our gtag function for a analytics config command
56
+ // e.g, ['config', measurementId, { origin: 'firebase', firebase_id }]
57
+ const parseMeasurementId = (...args) => {
58
+ if (args[0] === 'config' && args[2].origin === 'firebase') {
59
+ this.measurementId = args[1];
60
+ return true;
61
+ }
62
+ else {
63
+ return false;
64
+ }
65
+ };
66
+ const patchGtag = (fn) => {
67
+ window[GTAG_FUNCTION_NAME] = (...args) => {
68
+ if (fn) {
69
+ fn(...args);
70
+ }
71
+ // Inject app_name and app_version into events
72
+ // TODO(jamesdaniels): I'm doing this as documented but it's still not
73
+ // showing up in the console. Investigate. Guessing it's just part of the
74
+ // whole GA4 transition mess.
75
+ if (args[0] === 'event' && args[2][SEND_TO_KEY] === this.measurementId) {
76
+ if (providedAppName) {
77
+ args[2][APP_NAME_KEY] = providedAppName;
78
+ }
79
+ if (providedAppVersion) {
80
+ args[2][APP_VERSION_KEY] = providedAppVersion;
81
+ }
82
+ }
83
+ if (debugModeEnabled && typeof console !== 'undefined') {
84
+ // eslint-disable-next-line no-console
85
+ console.info(...args);
86
+ }
87
+ /**
88
+ * According to the gtag documentation, this function that defines a custom data layer cannot be
89
+ * an arrow function because 'arguments' is not an array. It is actually an object that behaves
90
+ * like an array and contains more information then just indexes. Transforming this into arrow function
91
+ * caused issue #2505 where analytics no longer sent any data.
92
+ */
93
+ (function (..._args) {
94
+ window[DATA_LAYER_NAME].push(arguments);
95
+ })(...args);
96
+ };
97
+ };
98
+ // Unclear if we still need to but I was running into config/events I passed
99
+ // to gtag before ['js' timestamp] weren't getting parsed, so let's make a promise
100
+ // that resolves when firebase/analytics has configured gtag.js that we wait on
101
+ // before sending anything
102
+ const firebaseAnalyticsAlreadyInitialized = window[DATA_LAYER_NAME].some(parseMeasurementId);
103
+ if (firebaseAnalyticsAlreadyInitialized) {
104
+ this.analyticsInitialized = Promise.resolve();
105
+ patchGtag();
61
106
  }
62
- if (providedAppVersion) {
63
- args[2][APP_VERSION_KEY] = providedAppVersion;
107
+ else {
108
+ this.analyticsInitialized = new Promise(resolve => {
109
+ patchGtag((...args) => {
110
+ if (parseMeasurementId(...args)) {
111
+ resolve();
112
+ }
113
+ });
114
+ });
64
115
  }
65
- }
66
- if (debugModeEnabled && typeof console !== "undefined") {
67
- console.info(...args);
68
- }
69
- (function(..._args) {
70
- window[DATA_LAYER_NAME].push(arguments);
71
- })(...args);
72
- };
73
- };
74
- const firebaseAnalyticsAlreadyInitialized = window[DATA_LAYER_NAME].some(parseMeasurementId);
75
- if (firebaseAnalyticsAlreadyInitialized) {
76
- this.analyticsInitialized = Promise.resolve();
77
- patchGtag();
78
- } else {
79
- this.analyticsInitialized = new Promise((resolve) => {
80
- patchGtag((...args) => {
81
- if (parseMeasurementId(...args)) {
82
- resolve();
116
+ if (providedConfig) {
117
+ this.updateConfig(providedConfig);
118
+ }
119
+ if (debugModeEnabled) {
120
+ this.updateConfig({ [DEBUG_MODE_KEY]: 1 });
83
121
  }
84
- });
85
- });
86
- }
87
- if (providedConfig) {
88
- this.updateConfig(providedConfig);
89
- }
90
- if (debugModeEnabled) {
91
- this.updateConfig({ [DEBUG_MODE_KEY]: 1 });
92
- }
93
- } else {
94
- this.analyticsInitialized = Promise.resolve();
95
- }
96
- const analytics = of(void 0).pipe(observeOn(schedulers.outsideAngular), switchMap(isSupported), switchMap((supported) => supported ? zone.runOutsideAngular(() => import("firebase/compat/analytics")) : EMPTY), map(() => {
97
- return ɵcacheInstance(`analytics`, "AngularFireAnalytics", app.name, () => {
98
- const analytics2 = app.analytics();
99
- if (analyticsCollectionEnabled === false) {
100
- analytics2.setAnalyticsCollectionEnabled(false);
101
122
  }
102
- return analytics2;
103
- }, [app, analyticsCollectionEnabled, providedConfig, debugModeEnabled]);
104
- }), shareReplay({ bufferSize: 1, refCount: false }));
105
- return ɵlazySDKProxy(this, analytics, zone);
106
- }
107
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: _AngularFireAnalytics, deps: [{ token: i1.FirebaseApp }, { token: COLLECTION_ENABLED, optional: true }, { token: APP_VERSION, optional: true }, { token: APP_NAME, optional: true }, { token: DEBUG_MODE, optional: true }, { token: CONFIG, optional: true }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: i2.ɵAngularFireSchedulers }], target: i0.ɵɵFactoryTarget.Injectable });
108
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: _AngularFireAnalytics, providedIn: "any" });
109
- };
110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: AngularFireAnalytics, decorators: [{
111
- type: Injectable,
112
- args: [{
113
- providedIn: "any"
114
- }]
115
- }], ctorParameters: () => [{ type: i1.FirebaseApp }, { type: void 0, decorators: [{
116
- type: Optional
117
- }, {
118
- type: Inject,
119
- args: [COLLECTION_ENABLED]
120
- }] }, { type: void 0, decorators: [{
121
- type: Optional
122
- }, {
123
- type: Inject,
124
- args: [APP_VERSION]
125
- }] }, { type: void 0, decorators: [{
126
- type: Optional
127
- }, {
128
- type: Inject,
129
- args: [APP_NAME]
130
- }] }, { type: void 0, decorators: [{
131
- type: Optional
132
- }, {
133
- type: Inject,
134
- args: [DEBUG_MODE]
135
- }] }, { type: void 0, decorators: [{
136
- type: Optional
137
- }, {
138
- type: Inject,
139
- args: [CONFIG]
140
- }] }, { type: Object, decorators: [{
141
- type: Inject,
142
- args: [PLATFORM_ID]
143
- }] }, { type: i0.NgZone }, { type: i2.ɵAngularFireSchedulers }] });
144
- ɵapplyMixins(AngularFireAnalytics, [proxyPolyfillCompat]);
123
+ else {
124
+ this.analyticsInitialized = Promise.resolve();
125
+ }
126
+ const analytics = of(undefined).pipe(observeOn(schedulers.outsideAngular), switchMap(isSupported), switchMap(supported => supported ? zone.runOutsideAngular(() => import('firebase/compat/analytics')) : EMPTY), map(() => {
127
+ return _cacheInstance(`analytics`, 'AngularFireAnalytics', app.name, () => {
128
+ const analytics = app.analytics();
129
+ if (analyticsCollectionEnabled === false) {
130
+ analytics.setAnalyticsCollectionEnabled(false);
131
+ }
132
+ return analytics;
133
+ }, [app, analyticsCollectionEnabled, providedConfig, debugModeEnabled]);
134
+ }), shareReplay({ bufferSize: 1, refCount: false }));
135
+ return _lazySDKProxy(this, analytics, zone);
136
+ }
137
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireAnalytics, deps: [{ token: i1.FirebaseApp }, { token: COLLECTION_ENABLED, optional: true }, { token: APP_VERSION, optional: true }, { token: APP_NAME, optional: true }, { token: DEBUG_MODE, optional: true }, { token: CONFIG, optional: true }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: i2.ɵAngularFireSchedulers }], target: i0.ɵɵFactoryTarget.Injectable });
138
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireAnalytics, providedIn: 'any' });
139
+ }
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireAnalytics, decorators: [{
141
+ type: Injectable,
142
+ args: [{
143
+ providedIn: 'any'
144
+ }]
145
+ }], ctorParameters: () => [{ type: i1.FirebaseApp }, { type: undefined, decorators: [{
146
+ type: Optional
147
+ }, {
148
+ type: Inject,
149
+ args: [COLLECTION_ENABLED]
150
+ }] }, { type: undefined, decorators: [{
151
+ type: Optional
152
+ }, {
153
+ type: Inject,
154
+ args: [APP_VERSION]
155
+ }] }, { type: undefined, decorators: [{
156
+ type: Optional
157
+ }, {
158
+ type: Inject,
159
+ args: [APP_NAME]
160
+ }] }, { type: undefined, decorators: [{
161
+ type: Optional
162
+ }, {
163
+ type: Inject,
164
+ args: [DEBUG_MODE]
165
+ }] }, { type: undefined, decorators: [{
166
+ type: Optional
167
+ }, {
168
+ type: Inject,
169
+ args: [CONFIG]
170
+ }] }, { type: Object, decorators: [{
171
+ type: Inject,
172
+ args: [PLATFORM_ID]
173
+ }] }, { type: i0.NgZone }, { type: i2.ɵAngularFireSchedulers }] });
174
+ _applyMixins(AngularFireAnalytics, [proxyPolyfillCompat]);
145
175
 
146
- // user-tracking.service.mjs
147
- import { isPlatformServer } from "@angular/common";
148
- import { Inject as Inject2, Injectable as Injectable2, NgZone as NgZone3, PLATFORM_ID as PLATFORM_ID2 } from "@angular/core";
149
- import { VERSION } from "@angular/fire";
150
- import { AngularFireAuth } from "@angular/fire/compat/auth";
151
- import firebase from "firebase/compat/app";
152
- import * as i02 from "@angular/core";
153
- import * as i22 from "@angular/fire/compat/auth";
154
- var UserTrackingService = class _UserTrackingService {
155
- initialized;
156
- disposables = [];
157
- // TODO a user properties injector
158
- constructor(analytics, platformId, auth, zone) {
159
- firebase.registerVersion("angularfire", VERSION.full, "compat-user-tracking");
160
- if (!isPlatformServer(platformId)) {
161
- let resolveInitialized;
162
- this.initialized = zone.runOutsideAngular(() => new Promise((resolve) => resolveInitialized = resolve));
163
- this.disposables = [
164
- auth.authState.subscribe((user) => {
165
- analytics.setUserId(user?.uid);
166
- resolveInitialized();
167
- }),
168
- auth.credential.subscribe((credential) => {
169
- if (credential) {
170
- const method = credential.user.isAnonymous ? "anonymous" : credential.additionalUserInfo.providerId;
171
- if (credential.additionalUserInfo.isNewUser) {
172
- analytics.logEvent("sign_up", { method });
173
- }
174
- analytics.logEvent("login", { method });
175
- }
176
- })
177
- ];
178
- } else {
179
- this.initialized = Promise.resolve();
176
+ class UserTrackingService {
177
+ initialized;
178
+ disposables = [];
179
+ // TODO a user properties injector
180
+ constructor(analytics,
181
+ // eslint-disable-next-line @typescript-eslint/ban-types
182
+ platformId, auth, zone) {
183
+ firebase.registerVersion('angularfire', VERSION.full, 'compat-user-tracking');
184
+ if (!isPlatformServer(platformId)) {
185
+ let resolveInitialized;
186
+ this.initialized = zone.runOutsideAngular(() => new Promise(resolve => resolveInitialized = resolve));
187
+ this.disposables = [
188
+ auth.authState.subscribe(user => {
189
+ analytics.setUserId(user?.uid);
190
+ resolveInitialized();
191
+ }),
192
+ auth.credential.subscribe(credential => {
193
+ if (credential) {
194
+ const method = credential.user.isAnonymous ? 'anonymous' : credential.additionalUserInfo.providerId;
195
+ if (credential.additionalUserInfo.isNewUser) {
196
+ analytics.logEvent('sign_up', { method });
197
+ }
198
+ analytics.logEvent('login', { method });
199
+ }
200
+ })
201
+ ];
202
+ }
203
+ else {
204
+ this.initialized = Promise.resolve();
205
+ }
180
206
  }
181
- }
182
- ngOnDestroy() {
183
- this.disposables.forEach((it) => it.unsubscribe());
184
- }
185
- static ɵfac = i02.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _UserTrackingService, deps: [{ token: AngularFireAnalytics }, { token: PLATFORM_ID2 }, { token: i22.AngularFireAuth }, { token: i02.NgZone }], target: i02.ɵɵFactoryTarget.Injectable });
186
- static ɵprov = i02.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _UserTrackingService });
187
- };
188
- i02.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: UserTrackingService, decorators: [{
189
- type: Injectable2
190
- }], ctorParameters: () => [{ type: AngularFireAnalytics }, { type: Object, decorators: [{
191
- type: Inject2,
192
- args: [PLATFORM_ID2]
193
- }] }, { type: i22.AngularFireAuth }, { type: i02.NgZone }] });
207
+ ngOnDestroy() {
208
+ this.disposables.forEach(it => it.unsubscribe());
209
+ }
210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: UserTrackingService, deps: [{ token: AngularFireAnalytics }, { token: PLATFORM_ID }, { token: i2$1.AngularFireAuth }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
211
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: UserTrackingService });
212
+ }
213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: UserTrackingService, decorators: [{
214
+ type: Injectable
215
+ }], ctorParameters: () => [{ type: AngularFireAnalytics }, { type: Object, decorators: [{
216
+ type: Inject,
217
+ args: [PLATFORM_ID]
218
+ }] }, { type: i2$1.AngularFireAuth }, { type: i0.NgZone }] });
194
219
 
195
- // screen-tracking.service.mjs
196
- import { ComponentFactoryResolver, Injectable as Injectable3, NgZone as NgZone5, Optional as Optional2 } from "@angular/core";
197
- import { VERSION as VERSION2 } from "@angular/fire";
198
- import { ɵscreenViewEvent } from "@angular/fire/analytics";
199
- import { Title } from "@angular/platform-browser";
200
- import { Router } from "@angular/router";
201
- import firebase2 from "firebase/compat/app";
202
- import { switchMap as switchMap2 } from "rxjs/operators";
203
- import * as i03 from "@angular/core";
204
- import * as i23 from "@angular/router";
205
- import * as i3 from "@angular/platform-browser";
206
- var SCREEN_VIEW_EVENT = "screen_view";
207
- var ScreenTrackingService = class _ScreenTrackingService {
208
- disposable;
209
- constructor(analytics, router, title, componentFactoryResolver, zone, userTrackingService) {
210
- firebase2.registerVersion("angularfire", VERSION2.full, "compat-screen-tracking");
211
- if (!router || !analytics) {
212
- return this;
220
+ const SCREEN_VIEW_EVENT = 'screen_view';
221
+ class ScreenTrackingService {
222
+ disposable;
223
+ constructor(analytics, router, title, componentFactoryResolver, zone, userTrackingService) {
224
+ firebase.registerVersion('angularfire', VERSION.full, 'compat-screen-tracking');
225
+ if (!router || !analytics) {
226
+ return this;
227
+ }
228
+ zone.runOutsideAngular(() => {
229
+ this.disposable = _screenViewEvent(router, title, componentFactoryResolver).pipe(switchMap(async (params) => {
230
+ if (userTrackingService) {
231
+ await userTrackingService.initialized;
232
+ }
233
+ return await analytics.logEvent(SCREEN_VIEW_EVENT, params);
234
+ })).subscribe();
235
+ });
213
236
  }
214
- zone.runOutsideAngular(() => {
215
- this.disposable = ɵscreenViewEvent(router, title, componentFactoryResolver).pipe(switchMap2(async (params) => {
216
- if (userTrackingService) {
217
- await userTrackingService.initialized;
237
+ ngOnDestroy() {
238
+ if (this.disposable) {
239
+ this.disposable.unsubscribe();
218
240
  }
219
- return await analytics.logEvent(SCREEN_VIEW_EVENT, params);
220
- })).subscribe();
221
- });
222
- }
223
- ngOnDestroy() {
224
- if (this.disposable) {
225
- this.disposable.unsubscribe();
226
241
  }
227
- }
228
- static ɵfac = i03.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i03, type: _ScreenTrackingService, deps: [{ token: AngularFireAnalytics }, { token: i23.Router, optional: true }, { token: i3.Title, optional: true }, { token: i03.ComponentFactoryResolver }, { token: i03.NgZone }, { token: UserTrackingService, optional: true }], target: i03.ɵɵFactoryTarget.Injectable });
229
- static ɵprov = i03.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i03, type: _ScreenTrackingService });
230
- };
231
- i03.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i03, type: ScreenTrackingService, decorators: [{
232
- type: Injectable3
233
- }], ctorParameters: () => [{ type: AngularFireAnalytics }, { type: i23.Router, decorators: [{
234
- type: Optional2
235
- }] }, { type: i3.Title, decorators: [{
236
- type: Optional2
237
- }] }, { type: i03.ComponentFactoryResolver }, { type: i03.NgZone }, { type: UserTrackingService, decorators: [{
238
- type: Optional2
239
- }] }] });
242
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ScreenTrackingService, deps: [{ token: AngularFireAnalytics }, { token: i2$2.Router, optional: true }, { token: i3.Title, optional: true }, { token: i0.ComponentFactoryResolver }, { token: i0.NgZone }, { token: UserTrackingService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
243
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ScreenTrackingService });
244
+ }
245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ScreenTrackingService, decorators: [{
246
+ type: Injectable
247
+ }], ctorParameters: () => [{ type: AngularFireAnalytics }, { type: i2$2.Router, decorators: [{
248
+ type: Optional
249
+ }] }, { type: i3.Title, decorators: [{
250
+ type: Optional
251
+ }] }, { type: i0.ComponentFactoryResolver }, { type: i0.NgZone }, { type: UserTrackingService, decorators: [{
252
+ type: Optional
253
+ }] }] });
240
254
 
241
- // analytics.module.mjs
242
- import { NgModule, Optional as Optional3 } from "@angular/core";
243
- import { VERSION as VERSION3 } from "@angular/fire";
244
- import firebase3 from "firebase/compat/app";
245
- import * as i04 from "@angular/core";
246
- var AngularFireAnalyticsModule = class _AngularFireAnalyticsModule {
247
- constructor(analytics, screenTracking, userTracking) {
248
- firebase3.registerVersion("angularfire", VERSION3.full, "analytics-compat");
249
- analytics.app.then(() => void 0);
250
- }
251
- static ɵfac = i04.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i04, type: _AngularFireAnalyticsModule, deps: [{ token: AngularFireAnalytics }, { token: ScreenTrackingService, optional: true }, { token: UserTrackingService, optional: true }], target: i04.ɵɵFactoryTarget.NgModule });
252
- static ɵmod = i04.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0-rc.3", ngImport: i04, type: _AngularFireAnalyticsModule });
253
- static ɵinj = i04.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i04, type: _AngularFireAnalyticsModule, providers: [AngularFireAnalytics] });
254
- };
255
- i04.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i04, type: AngularFireAnalyticsModule, decorators: [{
256
- type: NgModule,
257
- args: [{
258
- providers: [AngularFireAnalytics]
259
- }]
260
- }], ctorParameters: () => [{ type: AngularFireAnalytics }, { type: ScreenTrackingService, decorators: [{
261
- type: Optional3
262
- }] }, { type: UserTrackingService, decorators: [{
263
- type: Optional3
264
- }] }] });
265
- export {
266
- APP_NAME,
267
- APP_VERSION,
268
- AngularFireAnalytics,
269
- AngularFireAnalyticsModule,
270
- COLLECTION_ENABLED,
271
- CONFIG,
272
- DEBUG_MODE,
273
- ScreenTrackingService,
274
- UserTrackingService
275
- };
255
+ class AngularFireAnalyticsModule {
256
+ constructor(analytics,
257
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
258
+ screenTracking,
259
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
260
+ userTracking) {
261
+ firebase.registerVersion('angularfire', VERSION.full, 'analytics-compat');
262
+ // calling anything on analytics will eagerly load the SDK
263
+ analytics.app.then(() => undefined);
264
+ }
265
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireAnalyticsModule, deps: [{ token: AngularFireAnalytics }, { token: ScreenTrackingService, optional: true }, { token: UserTrackingService, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
266
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0", ngImport: i0, type: AngularFireAnalyticsModule });
267
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireAnalyticsModule, providers: [AngularFireAnalytics] });
268
+ }
269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireAnalyticsModule, decorators: [{
270
+ type: NgModule,
271
+ args: [{
272
+ providers: [AngularFireAnalytics]
273
+ }]
274
+ }], ctorParameters: () => [{ type: AngularFireAnalytics }, { type: ScreenTrackingService, decorators: [{
275
+ type: Optional
276
+ }] }, { type: UserTrackingService, decorators: [{
277
+ type: Optional
278
+ }] }] });
279
+
280
+ /**
281
+ * Generated bundle index. Do not edit.
282
+ */
283
+
284
+ export { APP_NAME, APP_VERSION, AngularFireAnalytics, AngularFireAnalyticsModule, COLLECTION_ENABLED, CONFIG, DEBUG_MODE, ScreenTrackingService, UserTrackingService };
276
285
  //# sourceMappingURL=angular-fire-compat-analytics.mjs.map