@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.
- package/esm2022/analytics/analytics.module.mjs +5 -5
- package/esm2022/analytics/screen-tracking.service.mjs +4 -4
- package/esm2022/analytics/user-tracking.service.mjs +4 -4
- package/esm2022/app/app.module.mjs +5 -5
- package/esm2022/app-check/app-check.module.mjs +5 -5
- package/esm2022/auth/auth.module.mjs +5 -5
- package/esm2022/auth-guard/auth-guard.mjs +4 -4
- package/esm2022/auth-guard/auth-guard.module.mjs +5 -5
- package/esm2022/compat/analytics/analytics.mjs +4 -4
- package/esm2022/compat/analytics/analytics.module.mjs +5 -5
- package/esm2022/compat/analytics/screen-tracking.service.mjs +4 -4
- package/esm2022/compat/analytics/user-tracking.service.mjs +4 -4
- package/esm2022/compat/auth/auth.mjs +4 -4
- package/esm2022/compat/auth/auth.module.mjs +5 -5
- package/esm2022/compat/auth-guard/auth-guard.mjs +4 -4
- package/esm2022/compat/auth-guard/auth-guard.module.mjs +5 -5
- package/esm2022/compat/database/database.mjs +4 -4
- package/esm2022/compat/database/database.module.mjs +5 -5
- package/esm2022/compat/firebase.app.module.mjs +5 -5
- package/esm2022/compat/firestore/firestore.mjs +4 -4
- package/esm2022/compat/firestore/firestore.module.mjs +5 -5
- package/esm2022/compat/functions/functions.mjs +4 -4
- package/esm2022/compat/functions/functions.module.mjs +5 -5
- package/esm2022/compat/messaging/messaging.mjs +4 -4
- package/esm2022/compat/messaging/messaging.module.mjs +5 -5
- package/esm2022/compat/performance/performance.mjs +4 -4
- package/esm2022/compat/performance/performance.module.mjs +5 -5
- package/esm2022/compat/performance/performance.service.mjs +4 -4
- package/esm2022/compat/remote-config/remote-config.mjs +4 -4
- package/esm2022/compat/remote-config/remote-config.module.mjs +5 -5
- package/esm2022/compat/storage/pipes/storageUrl.pipe.mjs +8 -8
- package/esm2022/compat/storage/storage.mjs +4 -4
- package/esm2022/compat/storage/storage.module.mjs +5 -5
- package/esm2022/database/database.module.mjs +5 -5
- package/esm2022/firestore/firestore.module.mjs +5 -5
- package/esm2022/firestore/lite/lite.module.mjs +5 -5
- package/esm2022/functions/functions.module.mjs +5 -5
- package/esm2022/messaging/messaging.module.mjs +5 -5
- package/esm2022/performance/performance.module.mjs +5 -5
- package/esm2022/remote-config/remote-config.module.mjs +5 -5
- package/esm2022/storage/storage.module.mjs +5 -5
- package/esm2022/vertexai-preview/vertexai.module.mjs +5 -5
- package/esm2022/zones.mjs +4 -4
- package/fesm2022/angular-fire-analytics.mjs +297 -410
- package/fesm2022/angular-fire-analytics.mjs.map +1 -7
- package/fesm2022/angular-fire-app-check.mjs +91 -162
- package/fesm2022/angular-fire-app-check.mjs.map +1 -7
- package/fesm2022/angular-fire-app.mjs +108 -181
- package/fesm2022/angular-fire-app.mjs.map +1 -7
- package/fesm2022/angular-fire-auth-guard.mjs +73 -83
- package/fesm2022/angular-fire-auth-guard.mjs.map +1 -7
- package/fesm2022/angular-fire-auth.mjs +142 -421
- package/fesm2022/angular-fire-auth.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-analytics.mjs +271 -262
- package/fesm2022/angular-fire-compat-analytics.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-auth-guard.mjs +72 -83
- package/fesm2022/angular-fire-compat-auth-guard.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-auth.mjs +214 -215
- package/fesm2022/angular-fire-compat-auth.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-database.mjs +378 -375
- package/fesm2022/angular-fire-compat-database.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-firestore.mjs +677 -537
- package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-functions.mjs +94 -98
- package/fesm2022/angular-fire-compat-functions.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-messaging.mjs +107 -107
- package/fesm2022/angular-fire-compat-messaging.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-performance.mjs +152 -158
- package/fesm2022/angular-fire-compat-performance.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-remote-config.mjs +232 -216
- package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -7
- package/fesm2022/angular-fire-compat-storage.mjs +231 -226
- package/fesm2022/angular-fire-compat-storage.mjs.map +1 -7
- package/fesm2022/angular-fire-compat.mjs +153 -140
- package/fesm2022/angular-fire-compat.mjs.map +1 -7
- package/fesm2022/angular-fire-database.mjs +136 -376
- package/fesm2022/angular-fire-database.mjs.map +1 -7
- package/fesm2022/angular-fire-firestore-lite.mjs +139 -388
- package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -7
- package/fesm2022/angular-fire-firestore.mjs +167 -526
- package/fesm2022/angular-fire-firestore.mjs.map +1 -7
- package/fesm2022/angular-fire-functions.mjs +93 -166
- package/fesm2022/angular-fire-functions.mjs.map +1 -7
- package/fesm2022/angular-fire-messaging.mjs +118 -196
- package/fesm2022/angular-fire-messaging.mjs.map +1 -7
- package/fesm2022/angular-fire-performance.mjs +104 -178
- package/fesm2022/angular-fire-performance.mjs.map +1 -7
- package/fesm2022/angular-fire-remote-config.mjs +132 -254
- package/fesm2022/angular-fire-remote-config.mjs.map +1 -7
- package/fesm2022/angular-fire-storage.mjs +105 -225
- package/fesm2022/angular-fire-storage.mjs.map +1 -7
- package/fesm2022/angular-fire-vertexai-preview.mjs +85 -146
- package/fesm2022/angular-fire-vertexai-preview.mjs.map +1 -7
- package/fesm2022/angular-fire.mjs +213 -183
- package/fesm2022/angular-fire.mjs.map +1 -7
- package/package.json +7 -7
|
@@ -1,276 +1,285 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
63
|
-
|
|
107
|
+
else {
|
|
108
|
+
this.analyticsInitialized = new Promise(resolve => {
|
|
109
|
+
patchGtag((...args) => {
|
|
110
|
+
if (parseMeasurementId(...args)) {
|
|
111
|
+
resolve();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
64
115
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}], ctorParameters: () => [{ type: AngularFireAnalytics }, { type: ScreenTrackingService, decorators: [{
|
|
261
|
-
|
|
262
|
-
}] }, { type: UserTrackingService, decorators: [{
|
|
263
|
-
|
|
264
|
-
}] }] });
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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
|