@dereekb/dbx-analytics 13.11.14 → 13.11.15

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.
@@ -182,9 +182,9 @@ class DbxAnalyticsServiceConfiguration {
182
182
  * Wraps a {@link UserAnalyticsEvent} into a {@link DbxAnalyticsStreamEventAnalyticsEventWrapper},
183
183
  * extracting the user ID for convenient access by listeners.
184
184
  *
185
- * @param event - the analytics event with optional user context
186
- * @param type - the stream event type classification; defaults to `Event`
187
- * @returns a wrapper combining the event, type, user, and extracted userId
185
+ * @param event - The analytics event with optional user context.
186
+ * @param type - The stream event type classification; defaults to `Event`
187
+ * @returns A wrapper combining the event, type, user, and extracted userId.
188
188
  *
189
189
  * @example
190
190
  * ```ts
@@ -256,7 +256,7 @@ class DbxAnalyticsService {
256
256
  *
257
257
  * Pass `undefined` to clear the current user (e.g., on logout).
258
258
  *
259
- * @param user - the user to identify, or undefined to clear
259
+ * @param user - The user to identify, or undefined to clear.
260
260
  */
261
261
  setUser(user) {
262
262
  let source;
@@ -271,7 +271,7 @@ class DbxAnalyticsService {
271
271
  /**
272
272
  * Sets the reactive user source that automatically updates the analytics user as auth state changes.
273
273
  *
274
- * @param source - the user source providing an observable of the current analytics user
274
+ * @param source - The user source providing an observable of the current analytics user.
275
275
  */
276
276
  setUserSource(source) {
277
277
  this._userSource.next(source);
@@ -280,8 +280,8 @@ class DbxAnalyticsService {
280
280
  /**
281
281
  * Emits a new user registration event, typically sent once after account creation.
282
282
  *
283
- * @param user - the newly registered user
284
- * @param data - registration-specific data including the signup method
283
+ * @param user - The newly registered user.
284
+ * @param data - Registration-specific data including the signup method.
285
285
  */
286
286
  sendNewUserEvent(user, data) {
287
287
  this.sendNextEvent({
@@ -292,8 +292,8 @@ class DbxAnalyticsService {
292
292
  /**
293
293
  * Emits a user login event, identifying the user in analytics providers.
294
294
  *
295
- * @param user - the user who logged in
296
- * @param data - optional additional event data
295
+ * @param user - The user who logged in.
296
+ * @param data - Optional additional event data.
297
297
  */
298
298
  sendUserLoginEvent(user, data) {
299
299
  this.sendNextEvent({
@@ -304,8 +304,8 @@ class DbxAnalyticsService {
304
304
  /**
305
305
  * Emits a user logout event and optionally clears the current analytics user.
306
306
  *
307
- * @param data - optional additional event data
308
- * @param clearUser - whether to reset the analytics user identity; defaults to `true`
307
+ * @param data - Optional additional event data.
308
+ * @param clearUser - Whether to reset the analytics user identity; defaults to `true`
309
309
  */
310
310
  sendUserLogoutEvent(data, clearUser = true) {
311
311
  this.sendNextEvent({
@@ -319,8 +319,8 @@ class DbxAnalyticsService {
319
319
  /**
320
320
  * Emits a user properties update event, used to sync user traits to analytics providers.
321
321
  *
322
- * @param user - the user whose properties are being updated
323
- * @param data - optional additional event data
322
+ * @param user - The user whose properties are being updated.
323
+ * @param data - Optional additional event data.
324
324
  */
325
325
  sendUserPropertiesEvent(user, data) {
326
326
  this.sendNextEvent({
@@ -337,7 +337,7 @@ class DbxAnalyticsService {
337
337
  /**
338
338
  * Sends a named event with no additional data, useful for simple occurrence tracking.
339
339
  *
340
- * @param eventType - the event name to track
340
+ * @param eventType - The event name to track.
341
341
  *
342
342
  * @example
343
343
  * ```ts
@@ -352,7 +352,7 @@ class DbxAnalyticsService {
352
352
  /**
353
353
  * Sends a fully constructed analytics event object.
354
354
  *
355
- * @param event - the event containing name, optional value, and data
355
+ * @param event - The event containing name, optional value, and data.
356
356
  */
357
357
  sendEvent(event) {
358
358
  this.sendNextEvent(event, DbxAnalyticsStreamEventType.Event);
@@ -360,7 +360,7 @@ class DbxAnalyticsService {
360
360
  /**
361
361
  * Sends a page view event, typically called on successful route transitions.
362
362
  *
363
- * @param page - optional page name/path override; if omitted, the provider determines the current page
363
+ * @param page - Optional page name/path override; if omitted, the provider determines the current page.
364
364
  *
365
365
  * @example
366
366
  * ```ts
@@ -413,7 +413,7 @@ class DbxAnalyticsService {
413
413
  *
414
414
  * @param event
415
415
  * @param type
416
- * @param userOverride Uses this user if set as null or an override value. If undefined the current analytics user is used.
416
+ * @param userOverride - Uses this user if set as null or an override value. If undefined the current analytics user is used.
417
417
  */
418
418
  sendNextEvent(event = {}, type, userOverride) {
419
419
  this.user$.pipe(first()).subscribe((analyticsUser) => {
@@ -542,8 +542,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
542
542
  * Call this in your application's `providers` array to set up analytics with a custom configuration factory
543
543
  * that resolves listeners, user sources, and environment flags at runtime.
544
544
  *
545
- * @param config - contains the factory function that produces a {@link DbxAnalyticsServiceConfiguration}
546
- * @returns environment providers for the analytics service
545
+ * @param config - Contains the factory function that produces a {@link DbxAnalyticsServiceConfiguration}
546
+ * @returns Environment providers for the analytics service.
547
547
  *
548
548
  * @example
549
549
  * ```ts
@@ -561,6 +561,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
561
561
  * ]
562
562
  * };
563
563
  * ```
564
+ *
564
565
  * @__NO_SIDE_EFFECTS__
565
566
  */
566
567
  function provideDbxAnalyticsService(config) {
@@ -682,8 +683,8 @@ class DbxAnalyticsMixpanelServiceListener extends AbstractDbxAnalyticsServiceLis
682
683
  * Non-session-replay events are intentionally ignored — Segment's device-mode integration
683
684
  * already forwards track/identify/page to Mixpanel.
684
685
  *
685
- * @param api - The loaded Mixpanel SDK instance
686
- * @param streamEvent - The analytics event to process
686
+ * @param api - The loaded Mixpanel SDK instance.
687
+ * @param streamEvent - The analytics event to process.
687
688
  */
688
689
  handleStreamEvent(api, streamEvent) {
689
690
  switch (streamEvent.type) {
@@ -720,8 +721,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
720
721
  * Use alongside {@link provideDbxAnalyticsService} to wire Mixpanel as an analytics listener that
721
722
  * handles session-replay start/stop/pause/resume events.
722
723
  *
723
- * @param config - Mixpanel-specific configuration
724
- * @returns environment providers for Mixpanel analytics
724
+ * @param config - Mixpanel-specific configuration.
725
+ * @returns Environment providers for Mixpanel analytics.
725
726
  *
726
727
  * @example
727
728
  * ```ts
@@ -747,6 +748,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
747
748
  * ]
748
749
  * };
749
750
  * ```
751
+ *
750
752
  * @__NO_SIDE_EFFECTS__
751
753
  */
752
754
  function provideDbxAnalyticsMixpanelApiService(config) {
@@ -896,7 +898,7 @@ class DbxAnalyticsSegmentServiceListener extends AbstractDbxAnalyticsServiceList
896
898
  *
897
899
  * Events are only sent when the Segment configuration is marked as active.
898
900
  *
899
- * @returns subscription to the combined Segment API and analytics event stream
901
+ * @returns Subscription to the combined Segment API and analytics event stream.
900
902
  */
901
903
  _initializeServiceSubscription() {
902
904
  return combineLatest([this._segmentApi.service$, this.analyticsEvents$]).subscribe(([segment, streamEvent]) => {
@@ -911,8 +913,8 @@ class DbxAnalyticsSegmentServiceListener extends AbstractDbxAnalyticsServiceList
911
913
  /**
912
914
  * Routes an analytics stream event to the appropriate Segment API method based on event type.
913
915
  *
914
- * @param api - The Segment analytics SDK instance
915
- * @param streamEvent - The analytics event to process
916
+ * @param api - The Segment analytics SDK instance.
917
+ * @param streamEvent - The analytics event to process.
916
918
  */
917
919
  handleStreamEvent(api, streamEvent) {
918
920
  switch (streamEvent.type) {
@@ -948,8 +950,8 @@ class DbxAnalyticsSegmentServiceListener extends AbstractDbxAnalyticsServiceList
948
950
  /**
949
951
  * Handles a new user registration event by identifying the user in Segment.
950
952
  *
951
- * @param api - The Segment analytics SDK instance
952
- * @param streamEvent - The event containing the new user data
953
+ * @param api - The Segment analytics SDK instance.
954
+ * @param streamEvent - The event containing the new user data.
953
955
  */
954
956
  updateWithNewUserEvent(api, streamEvent) {
955
957
  this.changeUser(api, streamEvent.user);
@@ -957,9 +959,9 @@ class DbxAnalyticsSegmentServiceListener extends AbstractDbxAnalyticsServiceList
957
959
  /**
958
960
  * Sends a track event to Segment with the event name, value, and additional data properties.
959
961
  *
960
- * @param api - The Segment analytics SDK instance
961
- * @param streamEvent - The analytics event containing name, value, and data
962
- * @param name - Optional override for the event name
962
+ * @param api - The Segment analytics SDK instance.
963
+ * @param streamEvent - The analytics event containing name, value, and data.
964
+ * @param name - Optional override for the event name.
963
965
  */
964
966
  updateWithEvent(api, streamEvent, name) {
965
967
  const event = streamEvent.event;
@@ -1010,8 +1012,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
1010
1012
  *
1011
1013
  * Use alongside {@link provideDbxAnalyticsService} to wire Segment as an analytics listener.
1012
1014
  *
1013
- * @param config - Segment-specific configuration including the write key factory
1014
- * @returns environment providers for Segment analytics
1015
+ * @param config - Segment-specific configuration including the write key factory.
1016
+ * @returns Environment providers for Segment analytics.
1015
1017
  *
1016
1018
  * @example
1017
1019
  * ```ts
@@ -1035,6 +1037,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
1035
1037
  * ]
1036
1038
  * };
1037
1039
  * ```
1040
+ *
1038
1041
  * @__NO_SIDE_EFFECTS__
1039
1042
  */
1040
1043
  function provideDbxAnalyticsSegmentApiService(config) {
@@ -1 +1 @@
1
- {"version":3,"file":"dereekb-dbx-analytics.mjs","sources":["../../../../packages/dbx-analytics/src/lib/analytics/analytics.stream.ts","../../../../packages/dbx-analytics/src/lib/analytics/analytics.service.ts","../../../../packages/dbx-analytics/src/lib/action/analytics.action.directive.ts","../../../../packages/dbx-analytics/src/lib/action/analytics.module.ts","../../../../packages/dbx-analytics/src/lib/analytics/analytics.providers.ts","../../../../packages/dbx-analytics/src/lib/providers/mixpanel/mixpanel.service.ts","../../../../packages/dbx-analytics/src/lib/providers/mixpanel/mixpanel.listener.service.ts","../../../../packages/dbx-analytics/src/lib/providers/mixpanel/mixpanel.providers.ts","../../../../packages/dbx-analytics/src/lib/providers/segment/segment.service.ts","../../../../packages/dbx-analytics/src/lib/providers/segment/segment.listener.service.ts","../../../../packages/dbx-analytics/src/lib/providers/segment/segment.providers.ts","../../../../packages/dbx-analytics/src/dereekb-dbx-analytics.ts"],"sourcesContent":["import { type Maybe } from '@dereekb/util';\nimport { type AnalyticsUser, type UserAnalyticsEvent, type AnalyticsUserId } from './analytics';\n\n/**\n * Categorizes the kind of analytics stream event emitted by {@link DbxAnalyticsService}.\n *\n * Listeners use this type to route events to the appropriate analytics provider method\n * (e.g., Segment `track()`, `identify()`, `page()`).\n */\nexport enum DbxAnalyticsStreamEventType {\n /**\n * A page/screen view event, typically sent on route transitions.\n */\n PageView,\n /**\n * Emitted any time the user value changes, including when transitioning from defined to undefined.\n *\n * Used by listeners to update the identified user in analytics providers.\n */\n UserChange,\n /**\n * Emitted only when the user's unique ID changes, filtering out property-only updates.\n *\n * Useful for triggering identity calls without redundant updates when only traits change.\n */\n UserIdChange,\n\n // User Events\n /**\n * A new user registration event.\n */\n NewUserEvent,\n /**\n * A returning user login event.\n */\n UserLoginEvent,\n /**\n * A user logout event.\n */\n UserLogoutEvent,\n /**\n * An update to user profile properties/traits.\n */\n UserPropertiesEvent,\n\n // Events\n /**\n * A generic custom analytics event.\n */\n Event,\n\n // Session Replay\n /**\n * Request to start session replay recording.\n */\n StartSessionRecording,\n /**\n * Request to stop session replay recording.\n */\n StopSessionRecording,\n /**\n * Request to pause an active session replay recording without clearing it.\n */\n PauseSessionRecording,\n /**\n * Request to resume a previously paused session replay recording.\n */\n ResumeSessionRecording\n}\n\n/**\n * Represents a single event in the analytics stream, combining the event type, payload, and user context.\n *\n * Emitted by {@link DbxAnalyticsService} and consumed by {@link DbxAnalyticsServiceListener} implementations\n * (e.g., {@link DbxAnalyticsSegmentServiceListener}) to forward events to external analytics providers.\n *\n * @example\n * ```ts\n * // Subscribe to the analytics event stream\n * analyticsService.events$.subscribe((streamEvent: DbxAnalyticsStreamEvent) => {\n * console.log(streamEvent.type, streamEvent.event?.name, streamEvent.userId);\n * });\n * ```\n */\nexport interface DbxAnalyticsStreamEvent {\n readonly type: DbxAnalyticsStreamEventType;\n readonly user?: Maybe<AnalyticsUser>;\n readonly event?: UserAnalyticsEvent;\n readonly userId?: AnalyticsUserId;\n}\n","import { type Observable, Subject, BehaviorSubject, of, type Subscription, first, shareReplay, switchMap, distinctUntilChanged } from 'rxjs';\nimport { Injectable, inject } from '@angular/core';\nimport { SubscriptionObject, filterMaybe } from '@dereekb/rxjs';\nimport { type AnalyticsEvent, type AnalyticsEventData, type AnalyticsEventName, type AnalyticsUser, type NewUserAnalyticsEventData, type UserAnalyticsEvent } from './analytics';\nimport { type DbxAnalyticsStreamEvent, DbxAnalyticsStreamEventType } from './analytics.stream';\nimport { type Maybe, type Destroyable, safeCompareEquality } from '@dereekb/util';\n\n/**\n * Abstract emitter interface for sending analytics events.\n *\n * Implemented by {@link DbxAnalyticsService} as the primary concrete implementation.\n * Components and services use this to fire analytics events without coupling to a specific provider.\n *\n * @example\n * ```ts\n * // Inject and send a custom event\n * const emitter = inject(DbxAnalyticsEventEmitterService);\n * emitter.sendEventData('Button Clicked', { buttonId: 'save' });\n * ```\n */\nexport abstract class DbxAnalyticsEventEmitterService {\n abstract sendNewUserEvent(user: AnalyticsUser, data: NewUserAnalyticsEventData): void;\n abstract sendUserLoginEvent(user: AnalyticsUser, data?: AnalyticsEventData): void;\n abstract sendUserLogoutEvent(data?: AnalyticsEventData): void;\n abstract sendUserPropertiesEvent(user: AnalyticsUser, data?: AnalyticsEventData): void;\n /**\n * @deprecated When sending an event with no data, use {@link sendEventType} instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n abstract sendEventData(name: AnalyticsEventName): void;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n abstract sendEventData(name: AnalyticsEventName, data: AnalyticsEventData): void;\n abstract sendEvent(event: AnalyticsEvent): void;\n abstract sendPageView(page?: string): void;\n abstract startSessionRecording(): void;\n abstract stopSessionRecording(): void;\n abstract pauseSessionRecording(): void;\n abstract resumeSessionRecording(): void;\n}\n\n/**\n * Abstract interface exposing the analytics event stream as an observable.\n *\n * Implemented by {@link DbxAnalyticsService}. Listeners subscribe to `events$` to forward events to external providers.\n */\nexport abstract class DbxAnalyticsEventStreamService {\n abstract readonly events$: Observable<DbxAnalyticsStreamEvent>;\n}\n\n/**\n * Abstract source for the current analytics user identity.\n *\n * Provide an implementation to automatically associate a user with all emitted analytics events.\n * Typically backed by the auth system (e.g., {@link DbxFirebaseAnalyticsUserSource}).\n *\n * @example\n * ```ts\n * // Provide a static user source\n * const userSource: DbxAnalyticsUserSource = {\n * analyticsUser$: of({ user: 'uid_abc123', properties: { role: 'admin' } })\n * };\n * ```\n */\nexport abstract class DbxAnalyticsUserSource {\n abstract readonly analyticsUser$: Observable<Maybe<AnalyticsUser>>;\n}\n\n/**\n * Abstract listener that receives analytics events from {@link DbxAnalyticsService}.\n *\n * Implement this to forward events to an external analytics provider (e.g., Segment, Mixpanel).\n * Register listeners via {@link DbxAnalyticsServiceConfiguration.listeners}.\n */\nexport abstract class DbxAnalyticsServiceListener {\n public abstract listenToService(service: DbxAnalyticsService): void;\n}\n\n/**\n * Base class for analytics service listeners that manages subscription lifecycle and provides\n * reactive access to the analytics service and its event stream.\n *\n * Subclasses implement {@link _initializeServiceSubscription} to subscribe to events and forward them\n * to an external analytics provider.\n *\n * @example\n * ```ts\n * class MyAnalyticsListener extends AbstractDbxAnalyticsServiceListener {\n * protected _initializeServiceSubscription(): Subscription | false {\n * return this.analyticsEvents$.subscribe((event) => {\n * console.log('Event:', event.type, event.event?.name);\n * });\n * }\n * }\n * ```\n */\nexport abstract class AbstractDbxAnalyticsServiceListener implements DbxAnalyticsServiceListener, Destroyable {\n private _sub = new SubscriptionObject();\n protected _analytics = new BehaviorSubject<Maybe<DbxAnalyticsService>>(undefined);\n\n readonly analytics$ = this._analytics.pipe(filterMaybe(), shareReplay(1));\n readonly analyticsEvents$ = this.analytics$.pipe(\n switchMap((x) => x.events$),\n shareReplay(1)\n );\n\n // MARK: AnalyticsServiceListener\n listenToService(service: DbxAnalyticsService): void {\n this._analytics.next(service);\n const sub = this._initializeServiceSubscription();\n\n if (sub !== false) {\n this._sub.subscription = sub;\n }\n }\n\n protected abstract _initializeServiceSubscription(): Subscription | false;\n\n // MARK: Destroy\n destroy(): void {\n this._analytics.complete();\n this._sub.destroy();\n }\n}\n\n/**\n * Configuration for {@link DbxAnalyticsService}, controlling which listeners receive events,\n * whether analytics runs in production mode, and optionally providing a user source.\n *\n * In non-production mode, listeners are not initialized and all events are logged to the console instead.\n * Provide via {@link provideDbxAnalyticsService} using a factory function.\n *\n * @example\n * ```ts\n * const config: DbxAnalyticsServiceConfiguration = {\n * isProduction: environment.production,\n * logEvents: !environment.production,\n * listeners: [segmentListener],\n * userSource: firebaseAnalyticsUserSource\n * };\n * ```\n */\nexport abstract class DbxAnalyticsServiceConfiguration {\n readonly listeners: DbxAnalyticsServiceListener[] = [];\n readonly isProduction?: boolean;\n readonly logEvents?: boolean;\n readonly userSource?: DbxAnalyticsUserSource;\n}\n\n/**\n * A fully resolved analytics stream event that includes the event payload, type, user context, and extracted user ID.\n *\n * Created by {@link dbxAnalyticsStreamEventAnalyticsEventWrapper} and emitted through the analytics event stream.\n */\nexport interface DbxAnalyticsStreamEventAnalyticsEventWrapper extends DbxAnalyticsStreamEvent {\n readonly event: UserAnalyticsEvent;\n readonly type: DbxAnalyticsStreamEventType;\n readonly user: Maybe<AnalyticsUser>;\n readonly userId: string | undefined;\n}\n\n/**\n * Wraps a {@link UserAnalyticsEvent} into a {@link DbxAnalyticsStreamEventAnalyticsEventWrapper},\n * extracting the user ID for convenient access by listeners.\n *\n * @param event - the analytics event with optional user context\n * @param type - the stream event type classification; defaults to `Event`\n * @returns a wrapper combining the event, type, user, and extracted userId\n *\n * @example\n * ```ts\n * const wrapper = dbxAnalyticsStreamEventAnalyticsEventWrapper(\n * { name: 'Button Clicked', user: { user: 'uid_123' } },\n * DbxAnalyticsStreamEventType.Event\n * );\n * // wrapper.userId === 'uid_123'\n * ```\n */\nexport function dbxAnalyticsStreamEventAnalyticsEventWrapper(event: UserAnalyticsEvent, type: DbxAnalyticsStreamEventType = DbxAnalyticsStreamEventType.Event) {\n const { user } = event;\n const userId = user ? user.user : undefined;\n\n return {\n event,\n type,\n user,\n userId\n };\n}\n\n/**\n * Central analytics service that emits typed analytics events for consumption by registered listeners.\n *\n * Acts as both the event emitter (components call methods like {@link sendEventData}, {@link sendPageView})\n * and the event stream source (listeners subscribe to {@link events$}).\n *\n * In production mode, registered {@link DbxAnalyticsServiceListener} instances (e.g., Segment) receive all events.\n * In non-production mode, events are logged to the console for debugging.\n *\n * Provided via {@link provideDbxAnalyticsService} with a {@link DbxAnalyticsServiceConfiguration} factory.\n *\n * @example\n * ```ts\n * // Send a custom event from a component\n * const analytics = inject(DbxAnalyticsService);\n * analytics.sendEventData('Interview Started', { candidateId: 'abc123' });\n *\n * // Send a page view on route transitions\n * transitionService.onSuccess({}, () => {\n * analytics.sendPageView();\n * });\n * ```\n */\n@Injectable()\nexport class DbxAnalyticsService implements DbxAnalyticsEventStreamService, DbxAnalyticsEventEmitterService, Destroyable {\n private readonly _config = inject(DbxAnalyticsServiceConfiguration);\n\n // TODO: Make these configurable.\n static readonly USER_REGISTRATION_EVENT_NAME = 'User Registered';\n static readonly USER_LOGIN_EVENT_NAME = 'User Login';\n static readonly USER_LOGOUT_EVENT_NAME = 'User Logout';\n static readonly USER_PROPERTIES_EVENT_NAME = 'User Properties';\n\n private _subject = new Subject<DbxAnalyticsStreamEvent>();\n readonly events$ = this._subject.asObservable();\n\n private _userSource = new BehaviorSubject<Maybe<DbxAnalyticsUserSource>>(undefined);\n\n readonly user$ = this._userSource.pipe(\n switchMap((x) => (x ? x.analyticsUser$ : of(undefined))),\n shareReplay(1)\n );\n\n private _userSourceSub = new SubscriptionObject();\n private _userIdEventSub = new SubscriptionObject();\n private _loggerSub = new SubscriptionObject();\n\n constructor() {\n this._init();\n let userSource: Maybe<DbxAnalyticsUserSource> = inject(DbxAnalyticsUserSource, { optional: true });\n userSource = userSource || this._config.userSource;\n\n if (userSource) {\n this.setUserSource(userSource);\n }\n }\n\n // MARK: Source\n /**\n * Sets the analytics user directly, overriding any configured {@link DbxAnalyticsUserSource}.\n *\n * Pass `undefined` to clear the current user (e.g., on logout).\n *\n * @param user - the user to identify, or undefined to clear\n */\n public setUser(user: Maybe<AnalyticsUser>): void {\n let source: Maybe<DbxAnalyticsUserSource>;\n\n if (user) {\n source = { analyticsUser$: of(user) };\n }\n\n this._userSource.next(source);\n\n if (this._userSource.value) {\n console.warn('DbxAnalyticsService has a userSource that is set. Source is now overridden by setUser() value.');\n }\n }\n\n /**\n * Sets the reactive user source that automatically updates the analytics user as auth state changes.\n *\n * @param source - the user source providing an observable of the current analytics user\n */\n public setUserSource(source: DbxAnalyticsUserSource): void {\n this._userSource.next(source);\n }\n\n // MARK: DbxAnalyticsEventEmitterService\n /**\n * Emits a new user registration event, typically sent once after account creation.\n *\n * @param user - the newly registered user\n * @param data - registration-specific data including the signup method\n */\n public sendNewUserEvent(user: AnalyticsUser, data: NewUserAnalyticsEventData): void {\n this.sendNextEvent(\n {\n name: DbxAnalyticsService.USER_REGISTRATION_EVENT_NAME,\n data\n },\n DbxAnalyticsStreamEventType.NewUserEvent,\n user\n );\n }\n\n /**\n * Emits a user login event, identifying the user in analytics providers.\n *\n * @param user - the user who logged in\n * @param data - optional additional event data\n */\n public sendUserLoginEvent(user: AnalyticsUser, data?: AnalyticsEventData): void {\n this.sendNextEvent(\n {\n name: DbxAnalyticsService.USER_LOGIN_EVENT_NAME,\n data\n },\n DbxAnalyticsStreamEventType.UserLoginEvent,\n user\n );\n }\n\n /**\n * Emits a user logout event and optionally clears the current analytics user.\n *\n * @param data - optional additional event data\n * @param clearUser - whether to reset the analytics user identity; defaults to `true`\n */\n public sendUserLogoutEvent(data?: AnalyticsEventData, clearUser = true): void {\n this.sendNextEvent(\n {\n name: DbxAnalyticsService.USER_LOGOUT_EVENT_NAME,\n data\n },\n DbxAnalyticsStreamEventType.UserLogoutEvent\n );\n\n if (clearUser) {\n this.setUser(undefined);\n }\n }\n\n /**\n * Emits a user properties update event, used to sync user traits to analytics providers.\n *\n * @param user - the user whose properties are being updated\n * @param data - optional additional event data\n */\n public sendUserPropertiesEvent(user: AnalyticsUser, data?: AnalyticsEventData): void {\n this.sendNextEvent(\n {\n name: DbxAnalyticsService.USER_PROPERTIES_EVENT_NAME,\n data\n },\n DbxAnalyticsStreamEventType.UserPropertiesEvent,\n user\n );\n }\n\n /**\n * @deprecated When sending an event with no data, use {@link sendEventType} instead.\n */\n public sendEventData(name: AnalyticsEventName): void;\n /**\n * Sends a named analytics event with a data payload.\n *\n * This is the primary method for tracking custom events with associated properties.\n *\n * @param name - the event name (e.g., `'Interview Ended'`)\n * @param data - key-value data attached to the event\n *\n * @example\n * ```ts\n * analytics.sendEventData('Interview Ended', {\n * seconds: 120,\n * endedDueToTime: 'true'\n * });\n * ```\n */\n public sendEventData(name: AnalyticsEventName, data: AnalyticsEventData): void;\n public sendEventData(name: AnalyticsEventName, data?: AnalyticsEventData): void {\n return this.sendEvent({\n name,\n data\n });\n }\n\n /**\n * Sends a named event with no additional data, useful for simple occurrence tracking.\n *\n * @param eventType - the event name to track\n *\n * @example\n * ```ts\n * analytics.sendEventType('Finish Account Setup');\n * ```\n */\n public sendEventType(eventType: AnalyticsEventName): void {\n this.sendNextEvent(\n {\n name: eventType\n },\n DbxAnalyticsStreamEventType.Event\n );\n }\n\n /**\n * Sends a fully constructed analytics event object.\n *\n * @param event - the event containing name, optional value, and data\n */\n public sendEvent(event: AnalyticsEvent): void {\n this.sendNextEvent(event, DbxAnalyticsStreamEventType.Event);\n }\n\n /**\n * Sends a page view event, typically called on successful route transitions.\n *\n * @param page - optional page name/path override; if omitted, the provider determines the current page\n *\n * @example\n * ```ts\n * // In a router config function\n * transitionService.onSuccess({}, () => {\n * analyticsService.sendPageView();\n * });\n * ```\n */\n public sendPageView(page?: string): void {\n this.sendNextEvent(\n {\n name: page\n },\n DbxAnalyticsStreamEventType.PageView\n );\n }\n\n /**\n * Requests that opt-in listeners (e.g. Mixpanel) start session replay recording.\n *\n * Forwarded as a {@link DbxAnalyticsStreamEventType.StartSessionRecording} event. Listeners\n * that don't handle session replay (e.g. Segment) ignore it.\n */\n public startSessionRecording(): void {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.StartSessionRecording);\n }\n\n /**\n * Requests that opt-in listeners stop session replay recording.\n *\n * Forwarded as a {@link DbxAnalyticsStreamEventType.StopSessionRecording} event.\n */\n public stopSessionRecording(): void {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.StopSessionRecording);\n }\n\n /**\n * Requests that opt-in listeners pause active session replay recording without clearing it.\n *\n * Forwarded as a {@link DbxAnalyticsStreamEventType.PauseSessionRecording} event.\n */\n public pauseSessionRecording(): void {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.PauseSessionRecording);\n }\n\n /**\n * Requests that opt-in listeners resume previously paused session replay recording.\n *\n * Forwarded as a {@link DbxAnalyticsStreamEventType.ResumeSessionRecording} event.\n */\n public resumeSessionRecording(): void {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.ResumeSessionRecording);\n }\n\n /**\n * Sends the next event.\n *\n * @param event\n * @param type\n * @param userOverride Uses this user if set as null or an override value. If undefined the current analytics user is used.\n */\n protected sendNextEvent(event: AnalyticsEvent = {}, type: DbxAnalyticsStreamEventType, userOverride?: Maybe<AnalyticsUser>): void {\n this.user$.pipe(first()).subscribe((analyticsUser) => {\n const user: Maybe<AnalyticsUser> = userOverride !== undefined ? userOverride : analyticsUser;\n const analyticsEvent: UserAnalyticsEvent = { ...event, user };\n this.nextEvent(analyticsEvent, type);\n });\n }\n\n protected nextEvent(event: UserAnalyticsEvent, type: DbxAnalyticsStreamEventType): void {\n const wrapper = dbxAnalyticsStreamEventAnalyticsEventWrapper(event, type);\n this._subject.next(wrapper);\n }\n\n // MARK: Internal\n private _init(): void {\n if (this._config.isProduction) {\n // Initialize listeners.\n this._config.listeners.forEach((listener) => {\n listener.listenToService(this);\n });\n } else {\n console.warn('AnalyticsService: Analytics not in production mode. All analytics events are ignored.');\n }\n\n if (this._config.logEvents || !this._config.isProduction) {\n console.log('AnalyticsService: Log analytics events enabled.');\n\n // Create a new subscription\n this._loggerSub.subscription = this._subject.subscribe((x) => {\n console.log(`AnalyticsService: Analytics Event - ${DbxAnalyticsStreamEventType[x.type]} | User: ${x.userId} | Data: ${JSON.stringify(x.event)}.`);\n });\n }\n\n this._userSourceSub.subscription = this.user$.subscribe((user) => {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.UserChange, user ?? null);\n });\n\n this._userIdEventSub.subscription = this.user$.pipe(distinctUntilChanged((a, b) => safeCompareEquality(a, b, (x, y) => x.user === y.user))).subscribe((user) => {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.UserIdChange, user ?? null);\n });\n }\n\n destroy() {\n this._subject.complete();\n this._userSource.complete();\n this._userSourceSub.destroy();\n this._userIdEventSub.destroy();\n this._loggerSub.destroy();\n }\n}\n","import { filterMaybe } from '@dereekb/rxjs';\nimport { switchMap, tap, shareReplay, merge, type Observable, of } from 'rxjs';\nimport { Directive, inject, input } from '@angular/core';\nimport { DbxActionContextStoreSourceInstance, cleanSubscriptionWithLockSet } from '@dereekb/dbx-core';\nimport { DbxAnalyticsService } from '../analytics/analytics.service';\nimport { type Maybe, type ReadableError } from '@dereekb/util';\nimport { toObservable } from '@angular/core/rxjs-interop';\n\n/**\n * Configuration for {@link DbxActionAnalyticsDirective} that maps action lifecycle events to analytics calls.\n *\n * Each callback receives the {@link DbxAnalyticsService} and relevant action data, allowing you to\n * send targeted analytics events at each stage of an action's lifecycle (trigger, ready, success, error).\n *\n * @example\n * ```ts\n * // In a component, define analytics config for a form submit action\n * readonly submitAnalytics: DbxActionAnalyticsConfig<MyFormValue, MyResult> = {\n * onReady: (service, value) => {\n * service.sendEventData('Form Submitted', { formType: 'onboard' });\n * },\n * onSuccess: (service, result, value) => {\n * service.sendEventType('Onboarding Complete');\n * },\n * onError: (service, error) => {\n * service.sendEventData('Form Submit Failed', { code: error?.code ?? 'unknown' });\n * }\n * };\n *\n * // In the template\n * // <button dbxAction [dbxActionAnalytics]=\"submitAnalytics\">Submit</button>\n * ```\n */\nexport interface DbxActionAnalyticsConfig<T = unknown, O = unknown> {\n /**\n * Called when the action is triggered (button pressed).\n */\n readonly onTriggered?: (service: DbxAnalyticsService) => void;\n /**\n * Called when the action value is ready and about to be processed.\n */\n readonly onReady?: (service: DbxAnalyticsService, value: T) => void;\n /**\n * Called when the action completes successfully.\n */\n readonly onSuccess?: (service: DbxAnalyticsService, result: Maybe<O>, value: T) => void;\n /**\n * Called when the action encounters an error.\n */\n readonly onError?: (service: DbxAnalyticsService, error: Maybe<ReadableError>) => void;\n}\n\n/**\n * Standalone directive that listens to a host {@link DbxActionDirective} and fires analytics events\n * based on the action's lifecycle (triggered, ready, success, error).\n *\n * Attach to any element that has a `dbxAction` directive and pass a {@link DbxActionAnalyticsConfig}\n * to define which events to send at each lifecycle stage.\n *\n * @example\n * ```html\n * <button dbxAction\n * [dbxActionHandler]=\"handleSave\"\n * [dbxActionAnalytics]=\"saveAnalytics\">\n * Save\n * </button>\n * ```\n */\n@Directive({\n selector: '[dbxActionAnalytics]',\n standalone: true\n})\nexport class DbxActionAnalyticsDirective<T, O> {\n readonly source = inject(DbxActionContextStoreSourceInstance<T, O>, { host: true });\n readonly analyticsService = inject(DbxAnalyticsService);\n\n readonly config = input<Maybe<DbxActionAnalyticsConfig<T, O>>>(undefined, { alias: 'dbxActionAnalytics' });\n readonly config$ = toObservable(this.config).pipe(filterMaybe(), shareReplay(1));\n\n constructor() {\n cleanSubscriptionWithLockSet({\n lockSet: this.source.lockSet,\n sub: this.config$\n .pipe(\n switchMap(({ onTriggered, onReady, onSuccess, onError }) => {\n const triggerObs: Observable<unknown>[] = [];\n\n if (onTriggered) {\n triggerObs.push(this.source.triggered$.pipe(tap(() => onTriggered(this.analyticsService))));\n }\n\n if (onReady) {\n triggerObs.push(this.source.valueReady$.pipe(tap((value) => onReady(this.analyticsService, value))));\n }\n\n if (onSuccess) {\n triggerObs.push(this.source.successPair$.pipe(tap(({ result, value }) => onSuccess(this.analyticsService, result, value))));\n }\n\n if (onError) {\n triggerObs.push(\n this.source.error$.pipe(\n filterMaybe(),\n tap((error) => onError(this.analyticsService, error))\n )\n );\n }\n\n return triggerObs.length ? merge(...triggerObs) : of();\n })\n )\n .subscribe()\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { DbxActionAnalyticsDirective } from './analytics.action.directive';\n\n/**\n * @deprecated The exported DbxActionAnalyticsDirective is now a standalone component. Import that instead.\n */\n@NgModule({\n imports: [DbxActionAnalyticsDirective],\n exports: [DbxActionAnalyticsDirective]\n})\nexport class DbxAnalyticsActionModule {}\n","import { type EnvironmentProviders, Injector, type Provider, makeEnvironmentProviders } from '@angular/core';\nimport { DbxAnalyticsServiceConfiguration, DbxAnalyticsService } from './analytics.service';\n\n/**\n * Factory function that creates a {@link DbxAnalyticsServiceConfiguration} using the Angular injector.\n *\n * Used by {@link provideDbxAnalyticsService} to defer configuration resolution to runtime.\n */\nexport type DbxAnalyticsServiceConfigurationFactory = (injector: Injector) => DbxAnalyticsServiceConfiguration;\n\n/**\n * Configuration for {@link provideDbxAnalyticsService}.\n */\nexport interface ProvideDbxAnalyticsConfig {\n readonly dbxAnalyticsServiceConfigurationFactory: DbxAnalyticsServiceConfigurationFactory;\n}\n\n/**\n * Creates Angular environment providers that register {@link DbxAnalyticsService} and its configuration.\n *\n * Call this in your application's `providers` array to set up analytics with a custom configuration factory\n * that resolves listeners, user sources, and environment flags at runtime.\n *\n * @param config - contains the factory function that produces a {@link DbxAnalyticsServiceConfiguration}\n * @returns environment providers for the analytics service\n *\n * @example\n * ```ts\n * // In app.config.ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDbxAnalyticsService({\n * dbxAnalyticsServiceConfigurationFactory: (injector: Injector) => ({\n * isProduction: environment.production,\n * logEvents: !environment.production,\n * listeners: [injector.get(DbxAnalyticsSegmentServiceListener)],\n * userSource: injector.get(DbxFirebaseAnalyticsUserSource)\n * })\n * })\n * ]\n * };\n * ```\n * @__NO_SIDE_EFFECTS__\n */\nexport function provideDbxAnalyticsService(config: ProvideDbxAnalyticsConfig): EnvironmentProviders {\n const { dbxAnalyticsServiceConfigurationFactory } = config;\n\n const providers: Provider[] = [\n // configuration\n {\n provide: DbxAnalyticsServiceConfiguration,\n useFactory: dbxAnalyticsServiceConfigurationFactory,\n deps: [Injector]\n },\n // service\n DbxAnalyticsService\n ];\n\n return makeEnvironmentProviders(providers);\n}\n","import { Injectable, InjectionToken, inject } from '@angular/core';\nimport { AbstractAsyncWindowLoadedService } from '@dereekb/browser';\n\n/**\n * Injection token for optionally preloading the Mixpanel SDK on the page.\n *\n * In typical setups Mixpanel is loaded by Segment device mode, so this token is rarely needed.\n */\nexport const PRELOAD_MIXPANEL_TOKEN = new InjectionToken<string>('DbxAnalyticsMixpanelApiServicePreload');\n\n/**\n * Minimal subset of the Mixpanel JS SDK surface used by the Mixpanel listener.\n *\n * Avoids taking a runtime dependency on `mixpanel-browser` since the SDK is loaded on the page\n * by Segment's Mixpanel (Actions) device-mode destination. Widen this interface if more\n * Mixpanel APIs are needed.\n */\nexport interface MixpanelLike {\n start_session_recording(): void;\n stop_session_recording(): void;\n pause_session_recording(): void;\n resume_session_recording(): void;\n}\n\n/**\n * Configuration for the Mixpanel analytics integration.\n *\n * Unlike {@link DbxAnalyticsSegmentApiServiceConfig}, this config does not take a write key —\n * Mixpanel is initialized by Segment device mode. The `active` and `logging` flags exist for\n * parity with the Segment config and to gate listener behavior.\n *\n * @example\n * ```ts\n * const config = new DbxAnalyticsMixpanelApiServiceConfig();\n * config.active = environment.production;\n * config.logging = !environment.production;\n * ```\n */\nexport class DbxAnalyticsMixpanelApiServiceConfig {\n logging = true;\n active = true;\n}\n\n/**\n * Service that manages async access to the Mixpanel JS SDK exposed on `window.mixpanel`.\n *\n * The Mixpanel SDK is typically loaded by Segment's Mixpanel (Actions) device-mode destination,\n * so this service waits for `window.mixpanel` to exist using the inherited window-loading polling.\n * The resolved SDK instance is available via the inherited `service$` observable.\n *\n * Provided via {@link provideDbxAnalyticsMixpanelApiService}.\n *\n * @example\n * ```ts\n * // In app.config.ts\n * provideDbxAnalyticsMixpanelApiService({\n * dbxAnalyticsMixpanelApiServiceConfigFactory: () => {\n * const config = new DbxAnalyticsMixpanelApiServiceConfig();\n * config.active = environment.production;\n * return config;\n * }\n * })\n * ```\n */\n@Injectable()\nexport class DbxAnalyticsMixpanelApiService extends AbstractAsyncWindowLoadedService<MixpanelLike> {\n private readonly _config = inject(DbxAnalyticsMixpanelApiServiceConfig);\n\n static readonly MIXPANEL_API_WINDOW_KEY = 'mixpanel';\n\n constructor() {\n const preload = inject(PRELOAD_MIXPANEL_TOKEN, { optional: true });\n super(DbxAnalyticsMixpanelApiService.MIXPANEL_API_WINDOW_KEY, undefined, 'Mixpanel', preload);\n }\n\n get config(): DbxAnalyticsMixpanelApiServiceConfig {\n return this._config;\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { combineLatest } from 'rxjs';\nimport { AbstractDbxAnalyticsServiceListener, type DbxAnalyticsStreamEvent, DbxAnalyticsStreamEventType } from '../../analytics';\nimport { DbxAnalyticsMixpanelApiService, type MixpanelLike } from './mixpanel.service';\n\n/**\n * Analytics listener that forwards session-replay control events to the Mixpanel SDK.\n *\n * Handles only the four session-replay event types — track/identify/page events are intentionally\n * not forwarded here because Segment's Mixpanel (Actions) device-mode destination already routes\n * them to Mixpanel. Forwarding them again would produce duplicate events.\n *\n * - {@link DbxAnalyticsStreamEventType.StartSessionRecording} -> `mixpanel.start_session_recording()`\n * - {@link DbxAnalyticsStreamEventType.StopSessionRecording} -> `mixpanel.stop_session_recording()`\n * - {@link DbxAnalyticsStreamEventType.PauseSessionRecording} -> `mixpanel.pause_session_recording()`\n * - {@link DbxAnalyticsStreamEventType.ResumeSessionRecording} -> `mixpanel.resume_session_recording()`\n *\n * Events are only sent when the Mixpanel configuration is marked as `active`.\n * Provided at root level and registered as a listener via {@link DbxAnalyticsServiceConfiguration.listeners}.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class DbxAnalyticsMixpanelServiceListener extends AbstractDbxAnalyticsServiceListener {\n private readonly _mixpanelApi = inject(DbxAnalyticsMixpanelApiService);\n\n constructor() {\n super();\n\n if (this._mixpanelApi.config.logging) {\n console.log('MixpanelAnalyticsListenerService: Mixpanel is logging events.');\n }\n\n if (!this._mixpanelApi.config.active) {\n console.log('MixpanelAnalyticsListenerService: Mixpanel is disabled from sending events to the server.');\n }\n }\n\n protected _initializeServiceSubscription() {\n return combineLatest([this._mixpanelApi.service$, this.analyticsEvents$]).subscribe(([mixpanel, streamEvent]: [MixpanelLike, DbxAnalyticsStreamEvent]) => {\n if (this._mixpanelApi.config.logging) {\n console.log('Mixpanel Listener Logging Event: ', streamEvent);\n }\n\n if (this._mixpanelApi.config.active) {\n this.handleStreamEvent(mixpanel, streamEvent);\n }\n });\n }\n\n /**\n * Routes a session-replay control event to the corresponding Mixpanel SDK method.\n *\n * Non-session-replay events are intentionally ignored — Segment's device-mode integration\n * already forwards track/identify/page to Mixpanel.\n *\n * @param api - The loaded Mixpanel SDK instance\n * @param streamEvent - The analytics event to process\n */\n protected handleStreamEvent(api: MixpanelLike, streamEvent: DbxAnalyticsStreamEvent): void {\n switch (streamEvent.type) {\n case DbxAnalyticsStreamEventType.StartSessionRecording:\n api.start_session_recording();\n break;\n case DbxAnalyticsStreamEventType.StopSessionRecording:\n api.stop_session_recording();\n break;\n case DbxAnalyticsStreamEventType.PauseSessionRecording:\n api.pause_session_recording();\n break;\n case DbxAnalyticsStreamEventType.ResumeSessionRecording:\n api.resume_session_recording();\n break;\n default:\n // All other event types are routed to Mixpanel by Segment's device-mode destination.\n break;\n }\n }\n}\n","import { type EnvironmentProviders, Injector, makeEnvironmentProviders, type Provider } from '@angular/core';\nimport { DbxAnalyticsMixpanelApiService, DbxAnalyticsMixpanelApiServiceConfig, PRELOAD_MIXPANEL_TOKEN } from './mixpanel.service';\n\n/**\n * Factory function that creates a {@link DbxAnalyticsMixpanelApiServiceConfig} using the Angular injector.\n *\n * Used by {@link provideDbxAnalyticsMixpanelApiService} to defer Mixpanel configuration to runtime.\n */\nexport type DbxAnalyticsMixpanelApiServiceConfigFactory = (injector: Injector) => DbxAnalyticsMixpanelApiServiceConfig;\n\n/**\n * Configuration for {@link provideDbxAnalyticsMixpanelApiService}.\n */\nexport interface ProvideDbxAnalyticsMixpanelModuleConfig {\n /**\n * Whether to preload the Mixpanel script token.\n *\n * Rarely needed — Mixpanel is typically loaded by Segment's device-mode destination.\n */\n readonly preloadMixpanelToken?: boolean;\n /**\n * Factory function that produces the Mixpanel API service configuration.\n */\n readonly dbxAnalyticsMixpanelApiServiceConfigFactory: DbxAnalyticsMixpanelApiServiceConfigFactory;\n}\n\n/**\n * Creates Angular environment providers that register {@link DbxAnalyticsMixpanelApiService} for Mixpanel session-replay control.\n *\n * Use alongside {@link provideDbxAnalyticsService} to wire Mixpanel as an analytics listener that\n * handles session-replay start/stop/pause/resume events.\n *\n * @param config - Mixpanel-specific configuration\n * @returns environment providers for Mixpanel analytics\n *\n * @example\n * ```ts\n * // In app.config.ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDbxAnalyticsMixpanelApiService({\n * dbxAnalyticsMixpanelApiServiceConfigFactory: () => {\n * const config = new DbxAnalyticsMixpanelApiServiceConfig();\n * config.active = environment.production;\n * return config;\n * }\n * }),\n * provideDbxAnalyticsService({\n * dbxAnalyticsServiceConfigurationFactory: (injector) => ({\n * isProduction: environment.production,\n * listeners: [\n * injector.get(DbxAnalyticsSegmentServiceListener),\n * injector.get(DbxAnalyticsMixpanelServiceListener)\n * ]\n * })\n * })\n * ]\n * };\n * ```\n * @__NO_SIDE_EFFECTS__\n */\nexport function provideDbxAnalyticsMixpanelApiService(config: ProvideDbxAnalyticsMixpanelModuleConfig): EnvironmentProviders {\n const { preloadMixpanelToken, dbxAnalyticsMixpanelApiServiceConfigFactory } = config;\n\n const providers: Provider[] = [\n // configuration\n {\n provide: DbxAnalyticsMixpanelApiServiceConfig,\n useFactory: dbxAnalyticsMixpanelApiServiceConfigFactory,\n deps: [Injector]\n },\n // service\n DbxAnalyticsMixpanelApiService\n ];\n\n if (preloadMixpanelToken) {\n providers.push({\n provide: PRELOAD_MIXPANEL_TOKEN,\n useValue: preloadMixpanelToken\n });\n }\n\n return makeEnvironmentProviders(providers);\n}\n","import { Injectable, InjectionToken, inject } from '@angular/core';\nimport { AbstractAsyncWindowLoadedService } from '@dereekb/browser';\nimport { poll } from '@dereekb/util';\n\n/**\n * Injection token for optionally preloading the Segment analytics script.\n */\nexport const PRELOAD_SEGMENT_TOKEN = new InjectionToken<string>('DbxAnalyticsSegmentApiServicePreload');\n\n/**\n * Configuration for the Segment analytics integration.\n *\n * @example\n * ```ts\n * const config = new DbxAnalyticsSegmentApiServiceConfig('your-segment-write-key');\n * config.active = environment.production;\n * config.logging = !environment.production;\n * ```\n */\nexport class DbxAnalyticsSegmentApiServiceConfig {\n writeKey: string;\n logging = true;\n active = true;\n constructor(writeKey: string) {\n this.writeKey = writeKey;\n }\n}\n\n/**\n * Extended Segment analytics type that includes the `invoked` flag set after the snippet initializes.\n */\ntype SegmentAnalyticsInvoked = SegmentAnalytics.AnalyticsJS & { invoked?: boolean };\n\n/**\n * Service that manages the async loading and initialization of the Segment analytics SDK from `window.analytics`.\n *\n * Polls for the Segment snippet to be invoked, then calls `analytics.load()` with the configured write key.\n * Once Segment reports ready, the resolved SDK instance is available via the inherited `service$` observable.\n *\n * Requires the Segment analytics snippet to be included in `index.html`.\n *\n * Provided via {@link provideDbxAnalyticsSegmentApiService}.\n *\n * @example\n * ```ts\n * // In app.config.ts\n * provideDbxAnalyticsSegmentApiService({\n * dbxAnalyticsSegmentApiServiceConfigFactory: (injector) => {\n * const config = new DbxAnalyticsSegmentApiServiceConfig(environment.analytics.segment);\n * config.active = environment.production;\n * return config;\n * }\n * })\n * ```\n */\n@Injectable()\nexport class DbxAnalyticsSegmentApiService extends AbstractAsyncWindowLoadedService<SegmentAnalytics.AnalyticsJS> {\n private readonly _config = inject(DbxAnalyticsSegmentApiServiceConfig);\n\n static readonly SEGMENT_API_WINDOW_KEY = 'analytics';\n static readonly SEGMENT_READY_KEY = 'SegmentReady';\n\n constructor() {\n const preload = inject(PRELOAD_SEGMENT_TOKEN, { optional: true });\n super(DbxAnalyticsSegmentApiService.SEGMENT_API_WINDOW_KEY, undefined, 'Segment', preload);\n }\n\n get config(): DbxAnalyticsSegmentApiServiceConfig {\n return this._config;\n }\n\n protected override _prepareCompleteLoadingService(): Promise<void> {\n return poll({\n // poll until analytics.invoked is true.\n check: () => Boolean((window.analytics as SegmentAnalyticsInvoked).invoked),\n timesToGiveup: 100\n });\n }\n\n protected override _initService(service: SegmentAnalytics.AnalyticsJS): Promise<SegmentAnalytics.AnalyticsJS> {\n return new Promise((resolve, reject) => {\n try {\n service.load(this._config.writeKey); // Initialize Segment\n\n // Wait for the service to ready itself.\n service.ready(() => {\n // Segment changes itself or rather the target, and the previous initial target is ignored after.\n const segment: SegmentAnalytics.AnalyticsJS = window[DbxAnalyticsSegmentApiService.SEGMENT_API_WINDOW_KEY];\n resolve(segment);\n });\n } catch (e) {\n console.log('Failed to init segment: ' + e);\n reject(e);\n }\n });\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { type Maybe } from '@dereekb/util';\nimport { combineLatest } from 'rxjs';\nimport { AbstractDbxAnalyticsServiceListener, type DbxAnalyticsStreamEvent, DbxAnalyticsStreamEventType, type AnalyticsUser } from '../../analytics';\nimport { DbxAnalyticsSegmentApiService } from './segment.service';\n\n/**\n * Analytics listener that forwards {@link DbxAnalyticsStreamEvent} events to the Segment SDK.\n *\n * Automatically maps event types to the appropriate Segment methods:\n * - {@link DbxAnalyticsStreamEventType.Event} / {@link DbxAnalyticsStreamEventType.UserLoginEvent} -> `track()`\n * - {@link DbxAnalyticsStreamEventType.UserChange} / {@link DbxAnalyticsStreamEventType.NewUserEvent} -> `identify()`\n * - {@link DbxAnalyticsStreamEventType.UserLogoutEvent} -> `reset()`\n * - {@link DbxAnalyticsStreamEventType.PageView} -> `page()`\n *\n * Events are only sent when the Segment configuration is marked as `active`.\n * Provided at root level and registered as a listener via {@link DbxAnalyticsServiceConfiguration.listeners}.\n *\n * @example\n * ```ts\n * // Register in analytics configuration factory\n * function analyticsConfigFactory(injector: Injector): DbxAnalyticsServiceConfiguration {\n * const segmentListener = injector.get(DbxAnalyticsSegmentServiceListener);\n * return {\n * isProduction: true,\n * listeners: [segmentListener]\n * };\n * }\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class DbxAnalyticsSegmentServiceListener extends AbstractDbxAnalyticsServiceListener {\n private readonly _segmentApi = inject(DbxAnalyticsSegmentApiService);\n\n constructor() {\n super();\n\n if (this._segmentApi.config.logging) {\n console.log('SegmentAnalyticsListenerService: Segment is logging events.');\n }\n\n if (!this._segmentApi.config.active) {\n console.log('SegmentAnalyticsListenerService: Segment is disabled from sending events to the server.');\n }\n }\n\n /**\n * Subscribes to the Segment API service and analytics event stream, forwarding events to the Segment SDK.\n *\n * Events are only sent when the Segment configuration is marked as active.\n *\n * @returns subscription to the combined Segment API and analytics event stream\n */\n protected _initializeServiceSubscription() {\n return combineLatest([this._segmentApi.service$, this.analyticsEvents$]).subscribe(([segment, streamEvent]: [SegmentAnalytics.AnalyticsJS, DbxAnalyticsStreamEvent]) => {\n if (this._segmentApi.config.logging) {\n console.log('Segment Listener Logging Event: ', streamEvent);\n }\n\n if (this._segmentApi.config.active) {\n this.handleStreamEvent(segment, streamEvent);\n }\n });\n }\n\n /**\n * Routes an analytics stream event to the appropriate Segment API method based on event type.\n *\n * @param api - The Segment analytics SDK instance\n * @param streamEvent - The analytics event to process\n */\n protected handleStreamEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent): void {\n switch (streamEvent.type) {\n case DbxAnalyticsStreamEventType.NewUserEvent:\n this.updateWithNewUserEvent(api, streamEvent);\n break;\n case DbxAnalyticsStreamEventType.UserLoginEvent:\n this.changeUser(api, streamEvent.user);\n this.updateWithEvent(api, streamEvent);\n break;\n case DbxAnalyticsStreamEventType.Event:\n this.updateWithEvent(api, streamEvent);\n break;\n case DbxAnalyticsStreamEventType.UserLogoutEvent:\n this.changeUser(api, undefined);\n break;\n case DbxAnalyticsStreamEventType.PageView:\n api.page();\n break;\n case DbxAnalyticsStreamEventType.UserChange:\n this.changeUser(api, streamEvent.user);\n break;\n case DbxAnalyticsStreamEventType.UserIdChange:\n case DbxAnalyticsStreamEventType.UserPropertiesEvent:\n case DbxAnalyticsStreamEventType.StartSessionRecording:\n case DbxAnalyticsStreamEventType.StopSessionRecording:\n case DbxAnalyticsStreamEventType.PauseSessionRecording:\n case DbxAnalyticsStreamEventType.ResumeSessionRecording:\n // These event types are not forwarded to Segment.\n break;\n }\n }\n\n /**\n * Handles a new user registration event by identifying the user in Segment.\n *\n * @param api - The Segment analytics SDK instance\n * @param streamEvent - The event containing the new user data\n */\n protected updateWithNewUserEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent): void {\n this.changeUser(api, streamEvent.user);\n }\n\n /**\n * Sends a track event to Segment with the event name, value, and additional data properties.\n *\n * @param api - The Segment analytics SDK instance\n * @param streamEvent - The analytics event containing name, value, and data\n * @param name - Optional override for the event name\n */\n protected updateWithEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent, name?: string): void {\n const event = streamEvent.event;\n const eventName = name || event?.name;\n\n if (eventName) {\n const value = event?.value;\n const data = event?.data;\n\n api.track(\n eventName,\n {\n ...(value != null\n ? {\n value\n }\n : undefined),\n ...data\n },\n {},\n () => {\n if (this._segmentApi.config.logging) {\n console.log('Segment track success.');\n }\n }\n );\n }\n }\n\n private changeUser(api: SegmentAnalytics.AnalyticsJS, user: Maybe<AnalyticsUser>): void {\n if (user?.user) {\n api.identify(\n user.user,\n {\n ...user.properties\n },\n {},\n () => {\n if (this._segmentApi.config.logging) {\n console.log('Segment identify success.');\n }\n }\n );\n } else {\n api.reset();\n }\n }\n}\n","import { type EnvironmentProviders, Injector, makeEnvironmentProviders, type Provider } from '@angular/core';\nimport { DbxAnalyticsSegmentApiService, DbxAnalyticsSegmentApiServiceConfig, PRELOAD_SEGMENT_TOKEN } from './segment.service';\n\n/**\n * Factory function that creates a {@link DbxAnalyticsSegmentApiServiceConfig} using the Angular injector.\n *\n * Used by {@link provideDbxAnalyticsSegmentApiService} to defer Segment configuration to runtime.\n */\nexport type DbxAnalyticsSegmentApiServiceConfigFactory = (injector: Injector) => DbxAnalyticsSegmentApiServiceConfig;\n\n/**\n * Configuration for {@link provideDbxAnalyticsSegmentApiService}.\n */\nexport interface ProvideDbxAnalyticsSegmentModuleConfig {\n /**\n * Whether to preload the Segment script token.\n */\n readonly preloadSegmentToken?: boolean;\n /**\n * Factory function that produces the Segment API service configuration.\n */\n readonly dbxAnalyticsSegmentApiServiceConfigFactory: DbxAnalyticsSegmentApiServiceConfigFactory;\n}\n\n/**\n * Creates Angular environment providers that register {@link DbxAnalyticsSegmentApiService} for Segment analytics integration.\n *\n * Use alongside {@link provideDbxAnalyticsService} to wire Segment as an analytics listener.\n *\n * @param config - Segment-specific configuration including the write key factory\n * @returns environment providers for Segment analytics\n *\n * @example\n * ```ts\n * // In app.config.ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDbxAnalyticsSegmentApiService({\n * dbxAnalyticsSegmentApiServiceConfigFactory: (injector) => {\n * const config = new DbxAnalyticsSegmentApiServiceConfig(environment.analytics.segment);\n * config.active = environment.production;\n * config.logging = !environment.production;\n * return config;\n * }\n * }),\n * provideDbxAnalyticsService({\n * dbxAnalyticsServiceConfigurationFactory: (injector) => ({\n * isProduction: environment.production,\n * listeners: [injector.get(DbxAnalyticsSegmentServiceListener)]\n * })\n * })\n * ]\n * };\n * ```\n * @__NO_SIDE_EFFECTS__\n */\nexport function provideDbxAnalyticsSegmentApiService(config: ProvideDbxAnalyticsSegmentModuleConfig): EnvironmentProviders {\n const { preloadSegmentToken, dbxAnalyticsSegmentApiServiceConfigFactory } = config;\n\n const providers: Provider[] = [\n // configuration\n {\n provide: DbxAnalyticsSegmentApiServiceConfig,\n useFactory: dbxAnalyticsSegmentApiServiceConfigFactory,\n deps: [Injector]\n },\n // service\n DbxAnalyticsSegmentApiService\n ];\n\n if (preloadSegmentToken) {\n providers.push({\n provide: PRELOAD_SEGMENT_TOKEN,\n useValue: preloadSegmentToken\n });\n }\n\n return makeEnvironmentProviders(providers);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAGA;;;;;AAKG;IACS;AAAZ,CAAA,UAAY,2BAA2B,EAAA;AACrC;;AAEG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ;AACR;;;;AAIG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU;AACV;;;;AAIG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY;;AAGZ;;AAEG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY;AACZ;;AAEG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAc;AACd;;AAEG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,iBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,iBAAe;AACf;;AAEG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAmB;;AAGnB;;AAEG;AACH,IAAA,2BAAA,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oBAAA,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC;gBAC1C;AACF,YAAA,CAAC,CACF;QACH;aAAO;YACL,GAAG,CAAC,KAAK,EAAE;QACb;IACF;wGAtIW,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAlC,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cAFjC,MAAM,EAAA,CAAA;;4FAEP,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAH9C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACRD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACG,SAAU,oCAAoC,CAAC,MAA8C,EAAA;AACjG,IAAA,MAAM,EAAE,mBAAmB,EAAE,0CAA0C,EAAE,GAAG,MAAM;AAElF,IAAA,MAAM,SAAS,GAAe;;AAE5B,QAAA;AACE,YAAA,OAAO,EAAE,mCAAmC;AAC5C,YAAA,UAAU,EAAE,0CAA0C;YACtD,IAAI,EAAE,CAAC,QAAQ;AAChB,SAAA;;QAED;KACD;IAED,IAAI,mBAAmB,EAAE;QACvB,SAAS,CAAC,IAAI,CAAC;AACb,YAAA,OAAO,EAAE,qBAAqB;AAC9B,YAAA,QAAQ,EAAE;AACX,SAAA,CAAC;IACJ;AAEA,IAAA,OAAO,wBAAwB,CAAC,SAAS,CAAC;AAC5C;;AC9EA;;AAEG;;;;"}
1
+ {"version":3,"file":"dereekb-dbx-analytics.mjs","sources":["../../../../packages/dbx-analytics/src/lib/analytics/analytics.stream.ts","../../../../packages/dbx-analytics/src/lib/analytics/analytics.service.ts","../../../../packages/dbx-analytics/src/lib/action/analytics.action.directive.ts","../../../../packages/dbx-analytics/src/lib/action/analytics.module.ts","../../../../packages/dbx-analytics/src/lib/analytics/analytics.providers.ts","../../../../packages/dbx-analytics/src/lib/providers/mixpanel/mixpanel.service.ts","../../../../packages/dbx-analytics/src/lib/providers/mixpanel/mixpanel.listener.service.ts","../../../../packages/dbx-analytics/src/lib/providers/mixpanel/mixpanel.providers.ts","../../../../packages/dbx-analytics/src/lib/providers/segment/segment.service.ts","../../../../packages/dbx-analytics/src/lib/providers/segment/segment.listener.service.ts","../../../../packages/dbx-analytics/src/lib/providers/segment/segment.providers.ts","../../../../packages/dbx-analytics/src/dereekb-dbx-analytics.ts"],"sourcesContent":["import { type Maybe } from '@dereekb/util';\nimport { type AnalyticsUser, type UserAnalyticsEvent, type AnalyticsUserId } from './analytics';\n\n/**\n * Categorizes the kind of analytics stream event emitted by {@link DbxAnalyticsService}.\n *\n * Listeners use this type to route events to the appropriate analytics provider method\n * (e.g., Segment `track()`, `identify()`, `page()`).\n */\nexport enum DbxAnalyticsStreamEventType {\n /**\n * A page/screen view event, typically sent on route transitions.\n */\n PageView,\n /**\n * Emitted any time the user value changes, including when transitioning from defined to undefined.\n *\n * Used by listeners to update the identified user in analytics providers.\n */\n UserChange,\n /**\n * Emitted only when the user's unique ID changes, filtering out property-only updates.\n *\n * Useful for triggering identity calls without redundant updates when only traits change.\n */\n UserIdChange,\n\n // User Events\n /**\n * A new user registration event.\n */\n NewUserEvent,\n /**\n * A returning user login event.\n */\n UserLoginEvent,\n /**\n * A user logout event.\n */\n UserLogoutEvent,\n /**\n * An update to user profile properties/traits.\n */\n UserPropertiesEvent,\n\n // Events\n /**\n * A generic custom analytics event.\n */\n Event,\n\n // Session Replay\n /**\n * Request to start session replay recording.\n */\n StartSessionRecording,\n /**\n * Request to stop session replay recording.\n */\n StopSessionRecording,\n /**\n * Request to pause an active session replay recording without clearing it.\n */\n PauseSessionRecording,\n /**\n * Request to resume a previously paused session replay recording.\n */\n ResumeSessionRecording\n}\n\n/**\n * Represents a single event in the analytics stream, combining the event type, payload, and user context.\n *\n * Emitted by {@link DbxAnalyticsService} and consumed by {@link DbxAnalyticsServiceListener} implementations\n * (e.g., {@link DbxAnalyticsSegmentServiceListener}) to forward events to external analytics providers.\n *\n * @example\n * ```ts\n * // Subscribe to the analytics event stream\n * analyticsService.events$.subscribe((streamEvent: DbxAnalyticsStreamEvent) => {\n * console.log(streamEvent.type, streamEvent.event?.name, streamEvent.userId);\n * });\n * ```\n */\nexport interface DbxAnalyticsStreamEvent {\n readonly type: DbxAnalyticsStreamEventType;\n readonly user?: Maybe<AnalyticsUser>;\n readonly event?: UserAnalyticsEvent;\n readonly userId?: AnalyticsUserId;\n}\n","import { type Observable, Subject, BehaviorSubject, of, type Subscription, first, shareReplay, switchMap, distinctUntilChanged } from 'rxjs';\nimport { Injectable, inject } from '@angular/core';\nimport { SubscriptionObject, filterMaybe } from '@dereekb/rxjs';\nimport { type AnalyticsEvent, type AnalyticsEventData, type AnalyticsEventName, type AnalyticsUser, type NewUserAnalyticsEventData, type UserAnalyticsEvent } from './analytics';\nimport { type DbxAnalyticsStreamEvent, DbxAnalyticsStreamEventType } from './analytics.stream';\nimport { type Maybe, type Destroyable, safeCompareEquality } from '@dereekb/util';\n\n/**\n * Abstract emitter interface for sending analytics events.\n *\n * Implemented by {@link DbxAnalyticsService} as the primary concrete implementation.\n * Components and services use this to fire analytics events without coupling to a specific provider.\n *\n * @example\n * ```ts\n * // Inject and send a custom event\n * const emitter = inject(DbxAnalyticsEventEmitterService);\n * emitter.sendEventData('Button Clicked', { buttonId: 'save' });\n * ```\n */\nexport abstract class DbxAnalyticsEventEmitterService {\n abstract sendNewUserEvent(user: AnalyticsUser, data: NewUserAnalyticsEventData): void;\n abstract sendUserLoginEvent(user: AnalyticsUser, data?: AnalyticsEventData): void;\n abstract sendUserLogoutEvent(data?: AnalyticsEventData): void;\n abstract sendUserPropertiesEvent(user: AnalyticsUser, data?: AnalyticsEventData): void;\n /**\n * @deprecated When sending an event with no data, use {@link sendEventType} instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n abstract sendEventData(name: AnalyticsEventName): void;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n abstract sendEventData(name: AnalyticsEventName, data: AnalyticsEventData): void;\n abstract sendEvent(event: AnalyticsEvent): void;\n abstract sendPageView(page?: string): void;\n abstract startSessionRecording(): void;\n abstract stopSessionRecording(): void;\n abstract pauseSessionRecording(): void;\n abstract resumeSessionRecording(): void;\n}\n\n/**\n * Abstract interface exposing the analytics event stream as an observable.\n *\n * Implemented by {@link DbxAnalyticsService}. Listeners subscribe to `events$` to forward events to external providers.\n */\nexport abstract class DbxAnalyticsEventStreamService {\n abstract readonly events$: Observable<DbxAnalyticsStreamEvent>;\n}\n\n/**\n * Abstract source for the current analytics user identity.\n *\n * Provide an implementation to automatically associate a user with all emitted analytics events.\n * Typically backed by the auth system (e.g., {@link DbxFirebaseAnalyticsUserSource}).\n *\n * @example\n * ```ts\n * // Provide a static user source\n * const userSource: DbxAnalyticsUserSource = {\n * analyticsUser$: of({ user: 'uid_abc123', properties: { role: 'admin' } })\n * };\n * ```\n */\nexport abstract class DbxAnalyticsUserSource {\n abstract readonly analyticsUser$: Observable<Maybe<AnalyticsUser>>;\n}\n\n/**\n * Abstract listener that receives analytics events from {@link DbxAnalyticsService}.\n *\n * Implement this to forward events to an external analytics provider (e.g., Segment, Mixpanel).\n * Register listeners via {@link DbxAnalyticsServiceConfiguration.listeners}.\n */\nexport abstract class DbxAnalyticsServiceListener {\n public abstract listenToService(service: DbxAnalyticsService): void;\n}\n\n/**\n * Base class for analytics service listeners that manages subscription lifecycle and provides\n * reactive access to the analytics service and its event stream.\n *\n * Subclasses implement {@link _initializeServiceSubscription} to subscribe to events and forward them\n * to an external analytics provider.\n *\n * @example\n * ```ts\n * class MyAnalyticsListener extends AbstractDbxAnalyticsServiceListener {\n * protected _initializeServiceSubscription(): Subscription | false {\n * return this.analyticsEvents$.subscribe((event) => {\n * console.log('Event:', event.type, event.event?.name);\n * });\n * }\n * }\n * ```\n */\nexport abstract class AbstractDbxAnalyticsServiceListener implements DbxAnalyticsServiceListener, Destroyable {\n private _sub = new SubscriptionObject();\n protected _analytics = new BehaviorSubject<Maybe<DbxAnalyticsService>>(undefined);\n\n readonly analytics$ = this._analytics.pipe(filterMaybe(), shareReplay(1));\n readonly analyticsEvents$ = this.analytics$.pipe(\n switchMap((x) => x.events$),\n shareReplay(1)\n );\n\n // MARK: AnalyticsServiceListener\n listenToService(service: DbxAnalyticsService): void {\n this._analytics.next(service);\n const sub = this._initializeServiceSubscription();\n\n if (sub !== false) {\n this._sub.subscription = sub;\n }\n }\n\n protected abstract _initializeServiceSubscription(): Subscription | false;\n\n // MARK: Destroy\n destroy(): void {\n this._analytics.complete();\n this._sub.destroy();\n }\n}\n\n/**\n * Configuration for {@link DbxAnalyticsService}, controlling which listeners receive events,\n * whether analytics runs in production mode, and optionally providing a user source.\n *\n * In non-production mode, listeners are not initialized and all events are logged to the console instead.\n * Provide via {@link provideDbxAnalyticsService} using a factory function.\n *\n * @example\n * ```ts\n * const config: DbxAnalyticsServiceConfiguration = {\n * isProduction: environment.production,\n * logEvents: !environment.production,\n * listeners: [segmentListener],\n * userSource: firebaseAnalyticsUserSource\n * };\n * ```\n */\nexport abstract class DbxAnalyticsServiceConfiguration {\n readonly listeners: DbxAnalyticsServiceListener[] = [];\n readonly isProduction?: boolean;\n readonly logEvents?: boolean;\n readonly userSource?: DbxAnalyticsUserSource;\n}\n\n/**\n * A fully resolved analytics stream event that includes the event payload, type, user context, and extracted user ID.\n *\n * Created by {@link dbxAnalyticsStreamEventAnalyticsEventWrapper} and emitted through the analytics event stream.\n */\nexport interface DbxAnalyticsStreamEventAnalyticsEventWrapper extends DbxAnalyticsStreamEvent {\n readonly event: UserAnalyticsEvent;\n readonly type: DbxAnalyticsStreamEventType;\n readonly user: Maybe<AnalyticsUser>;\n readonly userId: string | undefined;\n}\n\n/**\n * Wraps a {@link UserAnalyticsEvent} into a {@link DbxAnalyticsStreamEventAnalyticsEventWrapper},\n * extracting the user ID for convenient access by listeners.\n *\n * @param event - The analytics event with optional user context.\n * @param type - The stream event type classification; defaults to `Event`\n * @returns A wrapper combining the event, type, user, and extracted userId.\n *\n * @example\n * ```ts\n * const wrapper = dbxAnalyticsStreamEventAnalyticsEventWrapper(\n * { name: 'Button Clicked', user: { user: 'uid_123' } },\n * DbxAnalyticsStreamEventType.Event\n * );\n * // wrapper.userId === 'uid_123'\n * ```\n */\nexport function dbxAnalyticsStreamEventAnalyticsEventWrapper(event: UserAnalyticsEvent, type: DbxAnalyticsStreamEventType = DbxAnalyticsStreamEventType.Event) {\n const { user } = event;\n const userId = user ? user.user : undefined;\n\n return {\n event,\n type,\n user,\n userId\n };\n}\n\n/**\n * Central analytics service that emits typed analytics events for consumption by registered listeners.\n *\n * Acts as both the event emitter (components call methods like {@link sendEventData}, {@link sendPageView})\n * and the event stream source (listeners subscribe to {@link events$}).\n *\n * In production mode, registered {@link DbxAnalyticsServiceListener} instances (e.g., Segment) receive all events.\n * In non-production mode, events are logged to the console for debugging.\n *\n * Provided via {@link provideDbxAnalyticsService} with a {@link DbxAnalyticsServiceConfiguration} factory.\n *\n * @example\n * ```ts\n * // Send a custom event from a component\n * const analytics = inject(DbxAnalyticsService);\n * analytics.sendEventData('Interview Started', { candidateId: 'abc123' });\n *\n * // Send a page view on route transitions\n * transitionService.onSuccess({}, () => {\n * analytics.sendPageView();\n * });\n * ```\n */\n@Injectable()\nexport class DbxAnalyticsService implements DbxAnalyticsEventStreamService, DbxAnalyticsEventEmitterService, Destroyable {\n private readonly _config = inject(DbxAnalyticsServiceConfiguration);\n\n // TODO: Make these configurable.\n static readonly USER_REGISTRATION_EVENT_NAME = 'User Registered';\n static readonly USER_LOGIN_EVENT_NAME = 'User Login';\n static readonly USER_LOGOUT_EVENT_NAME = 'User Logout';\n static readonly USER_PROPERTIES_EVENT_NAME = 'User Properties';\n\n private _subject = new Subject<DbxAnalyticsStreamEvent>();\n readonly events$ = this._subject.asObservable();\n\n private _userSource = new BehaviorSubject<Maybe<DbxAnalyticsUserSource>>(undefined);\n\n readonly user$ = this._userSource.pipe(\n switchMap((x) => (x ? x.analyticsUser$ : of(undefined))),\n shareReplay(1)\n );\n\n private _userSourceSub = new SubscriptionObject();\n private _userIdEventSub = new SubscriptionObject();\n private _loggerSub = new SubscriptionObject();\n\n constructor() {\n this._init();\n let userSource: Maybe<DbxAnalyticsUserSource> = inject(DbxAnalyticsUserSource, { optional: true });\n userSource = userSource || this._config.userSource;\n\n if (userSource) {\n this.setUserSource(userSource);\n }\n }\n\n // MARK: Source\n /**\n * Sets the analytics user directly, overriding any configured {@link DbxAnalyticsUserSource}.\n *\n * Pass `undefined` to clear the current user (e.g., on logout).\n *\n * @param user - The user to identify, or undefined to clear.\n */\n public setUser(user: Maybe<AnalyticsUser>): void {\n let source: Maybe<DbxAnalyticsUserSource>;\n\n if (user) {\n source = { analyticsUser$: of(user) };\n }\n\n this._userSource.next(source);\n\n if (this._userSource.value) {\n console.warn('DbxAnalyticsService has a userSource that is set. Source is now overridden by setUser() value.');\n }\n }\n\n /**\n * Sets the reactive user source that automatically updates the analytics user as auth state changes.\n *\n * @param source - The user source providing an observable of the current analytics user.\n */\n public setUserSource(source: DbxAnalyticsUserSource): void {\n this._userSource.next(source);\n }\n\n // MARK: DbxAnalyticsEventEmitterService\n /**\n * Emits a new user registration event, typically sent once after account creation.\n *\n * @param user - The newly registered user.\n * @param data - Registration-specific data including the signup method.\n */\n public sendNewUserEvent(user: AnalyticsUser, data: NewUserAnalyticsEventData): void {\n this.sendNextEvent(\n {\n name: DbxAnalyticsService.USER_REGISTRATION_EVENT_NAME,\n data\n },\n DbxAnalyticsStreamEventType.NewUserEvent,\n user\n );\n }\n\n /**\n * Emits a user login event, identifying the user in analytics providers.\n *\n * @param user - The user who logged in.\n * @param data - Optional additional event data.\n */\n public sendUserLoginEvent(user: AnalyticsUser, data?: AnalyticsEventData): void {\n this.sendNextEvent(\n {\n name: DbxAnalyticsService.USER_LOGIN_EVENT_NAME,\n data\n },\n DbxAnalyticsStreamEventType.UserLoginEvent,\n user\n );\n }\n\n /**\n * Emits a user logout event and optionally clears the current analytics user.\n *\n * @param data - Optional additional event data.\n * @param clearUser - Whether to reset the analytics user identity; defaults to `true`\n */\n public sendUserLogoutEvent(data?: AnalyticsEventData, clearUser = true): void {\n this.sendNextEvent(\n {\n name: DbxAnalyticsService.USER_LOGOUT_EVENT_NAME,\n data\n },\n DbxAnalyticsStreamEventType.UserLogoutEvent\n );\n\n if (clearUser) {\n this.setUser(undefined);\n }\n }\n\n /**\n * Emits a user properties update event, used to sync user traits to analytics providers.\n *\n * @param user - The user whose properties are being updated.\n * @param data - Optional additional event data.\n */\n public sendUserPropertiesEvent(user: AnalyticsUser, data?: AnalyticsEventData): void {\n this.sendNextEvent(\n {\n name: DbxAnalyticsService.USER_PROPERTIES_EVENT_NAME,\n data\n },\n DbxAnalyticsStreamEventType.UserPropertiesEvent,\n user\n );\n }\n\n /**\n * @deprecated When sending an event with no data, use {@link sendEventType} instead.\n */\n public sendEventData(name: AnalyticsEventName): void;\n /**\n * Sends a named analytics event with a data payload.\n *\n * This is the primary method for tracking custom events with associated properties.\n *\n * @param name - The event name (e.g., `'Interview Ended'`)\n * @param data - Key-value data attached to the event.\n *\n * @example\n * ```ts\n * analytics.sendEventData('Interview Ended', {\n * seconds: 120,\n * endedDueToTime: 'true'\n * });\n * ```\n */\n public sendEventData(name: AnalyticsEventName, data: AnalyticsEventData): void;\n public sendEventData(name: AnalyticsEventName, data?: AnalyticsEventData): void {\n return this.sendEvent({\n name,\n data\n });\n }\n\n /**\n * Sends a named event with no additional data, useful for simple occurrence tracking.\n *\n * @param eventType - The event name to track.\n *\n * @example\n * ```ts\n * analytics.sendEventType('Finish Account Setup');\n * ```\n */\n public sendEventType(eventType: AnalyticsEventName): void {\n this.sendNextEvent(\n {\n name: eventType\n },\n DbxAnalyticsStreamEventType.Event\n );\n }\n\n /**\n * Sends a fully constructed analytics event object.\n *\n * @param event - The event containing name, optional value, and data.\n */\n public sendEvent(event: AnalyticsEvent): void {\n this.sendNextEvent(event, DbxAnalyticsStreamEventType.Event);\n }\n\n /**\n * Sends a page view event, typically called on successful route transitions.\n *\n * @param page - Optional page name/path override; if omitted, the provider determines the current page.\n *\n * @example\n * ```ts\n * // In a router config function\n * transitionService.onSuccess({}, () => {\n * analyticsService.sendPageView();\n * });\n * ```\n */\n public sendPageView(page?: string): void {\n this.sendNextEvent(\n {\n name: page\n },\n DbxAnalyticsStreamEventType.PageView\n );\n }\n\n /**\n * Requests that opt-in listeners (e.g. Mixpanel) start session replay recording.\n *\n * Forwarded as a {@link DbxAnalyticsStreamEventType.StartSessionRecording} event. Listeners\n * that don't handle session replay (e.g. Segment) ignore it.\n */\n public startSessionRecording(): void {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.StartSessionRecording);\n }\n\n /**\n * Requests that opt-in listeners stop session replay recording.\n *\n * Forwarded as a {@link DbxAnalyticsStreamEventType.StopSessionRecording} event.\n */\n public stopSessionRecording(): void {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.StopSessionRecording);\n }\n\n /**\n * Requests that opt-in listeners pause active session replay recording without clearing it.\n *\n * Forwarded as a {@link DbxAnalyticsStreamEventType.PauseSessionRecording} event.\n */\n public pauseSessionRecording(): void {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.PauseSessionRecording);\n }\n\n /**\n * Requests that opt-in listeners resume previously paused session replay recording.\n *\n * Forwarded as a {@link DbxAnalyticsStreamEventType.ResumeSessionRecording} event.\n */\n public resumeSessionRecording(): void {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.ResumeSessionRecording);\n }\n\n /**\n * Sends the next event.\n *\n * @param event\n * @param type\n * @param userOverride - Uses this user if set as null or an override value. If undefined the current analytics user is used.\n */\n protected sendNextEvent(event: AnalyticsEvent = {}, type: DbxAnalyticsStreamEventType, userOverride?: Maybe<AnalyticsUser>): void {\n this.user$.pipe(first()).subscribe((analyticsUser) => {\n const user: Maybe<AnalyticsUser> = userOverride !== undefined ? userOverride : analyticsUser;\n const analyticsEvent: UserAnalyticsEvent = { ...event, user };\n this.nextEvent(analyticsEvent, type);\n });\n }\n\n protected nextEvent(event: UserAnalyticsEvent, type: DbxAnalyticsStreamEventType): void {\n const wrapper = dbxAnalyticsStreamEventAnalyticsEventWrapper(event, type);\n this._subject.next(wrapper);\n }\n\n // MARK: Internal\n private _init(): void {\n if (this._config.isProduction) {\n // Initialize listeners.\n this._config.listeners.forEach((listener) => {\n listener.listenToService(this);\n });\n } else {\n console.warn('AnalyticsService: Analytics not in production mode. All analytics events are ignored.');\n }\n\n if (this._config.logEvents || !this._config.isProduction) {\n console.log('AnalyticsService: Log analytics events enabled.');\n\n // Create a new subscription\n this._loggerSub.subscription = this._subject.subscribe((x) => {\n console.log(`AnalyticsService: Analytics Event - ${DbxAnalyticsStreamEventType[x.type]} | User: ${x.userId} | Data: ${JSON.stringify(x.event)}.`);\n });\n }\n\n this._userSourceSub.subscription = this.user$.subscribe((user) => {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.UserChange, user ?? null);\n });\n\n this._userIdEventSub.subscription = this.user$.pipe(distinctUntilChanged((a, b) => safeCompareEquality(a, b, (x, y) => x.user === y.user))).subscribe((user) => {\n this.sendNextEvent({}, DbxAnalyticsStreamEventType.UserIdChange, user ?? null);\n });\n }\n\n destroy() {\n this._subject.complete();\n this._userSource.complete();\n this._userSourceSub.destroy();\n this._userIdEventSub.destroy();\n this._loggerSub.destroy();\n }\n}\n","import { filterMaybe } from '@dereekb/rxjs';\nimport { switchMap, tap, shareReplay, merge, type Observable, of } from 'rxjs';\nimport { Directive, inject, input } from '@angular/core';\nimport { DbxActionContextStoreSourceInstance, cleanSubscriptionWithLockSet } from '@dereekb/dbx-core';\nimport { DbxAnalyticsService } from '../analytics/analytics.service';\nimport { type Maybe, type ReadableError } from '@dereekb/util';\nimport { toObservable } from '@angular/core/rxjs-interop';\n\n/**\n * Configuration for {@link DbxActionAnalyticsDirective} that maps action lifecycle events to analytics calls.\n *\n * Each callback receives the {@link DbxAnalyticsService} and relevant action data, allowing you to\n * send targeted analytics events at each stage of an action's lifecycle (trigger, ready, success, error).\n *\n * @example\n * ```ts\n * // In a component, define analytics config for a form submit action\n * readonly submitAnalytics: DbxActionAnalyticsConfig<MyFormValue, MyResult> = {\n * onReady: (service, value) => {\n * service.sendEventData('Form Submitted', { formType: 'onboard' });\n * },\n * onSuccess: (service, result, value) => {\n * service.sendEventType('Onboarding Complete');\n * },\n * onError: (service, error) => {\n * service.sendEventData('Form Submit Failed', { code: error?.code ?? 'unknown' });\n * }\n * };\n *\n * // In the template\n * // <button dbxAction [dbxActionAnalytics]=\"submitAnalytics\">Submit</button>\n * ```\n */\nexport interface DbxActionAnalyticsConfig<T = unknown, O = unknown> {\n /**\n * Called when the action is triggered (button pressed).\n */\n readonly onTriggered?: (service: DbxAnalyticsService) => void;\n /**\n * Called when the action value is ready and about to be processed.\n */\n readonly onReady?: (service: DbxAnalyticsService, value: T) => void;\n /**\n * Called when the action completes successfully.\n */\n readonly onSuccess?: (service: DbxAnalyticsService, result: Maybe<O>, value: T) => void;\n /**\n * Called when the action encounters an error.\n */\n readonly onError?: (service: DbxAnalyticsService, error: Maybe<ReadableError>) => void;\n}\n\n/**\n * Standalone directive that listens to a host {@link DbxActionDirective} and fires analytics events\n * based on the action's lifecycle (triggered, ready, success, error).\n *\n * Attach to any element that has a `dbxAction` directive and pass a {@link DbxActionAnalyticsConfig}\n * to define which events to send at each lifecycle stage.\n *\n * @example\n * ```html\n * <button dbxAction\n * [dbxActionHandler]=\"handleSave\"\n * [dbxActionAnalytics]=\"saveAnalytics\">\n * Save\n * </button>\n * ```\n */\n@Directive({\n selector: '[dbxActionAnalytics]',\n standalone: true\n})\nexport class DbxActionAnalyticsDirective<T, O> {\n readonly source = inject(DbxActionContextStoreSourceInstance<T, O>, { host: true });\n readonly analyticsService = inject(DbxAnalyticsService);\n\n readonly config = input<Maybe<DbxActionAnalyticsConfig<T, O>>>(undefined, { alias: 'dbxActionAnalytics' });\n readonly config$ = toObservable(this.config).pipe(filterMaybe(), shareReplay(1));\n\n constructor() {\n cleanSubscriptionWithLockSet({\n lockSet: this.source.lockSet,\n sub: this.config$\n .pipe(\n switchMap(({ onTriggered, onReady, onSuccess, onError }) => {\n const triggerObs: Observable<unknown>[] = [];\n\n if (onTriggered) {\n triggerObs.push(this.source.triggered$.pipe(tap(() => onTriggered(this.analyticsService))));\n }\n\n if (onReady) {\n triggerObs.push(this.source.valueReady$.pipe(tap((value) => onReady(this.analyticsService, value))));\n }\n\n if (onSuccess) {\n triggerObs.push(this.source.successPair$.pipe(tap(({ result, value }) => onSuccess(this.analyticsService, result, value))));\n }\n\n if (onError) {\n triggerObs.push(\n this.source.error$.pipe(\n filterMaybe(),\n tap((error) => onError(this.analyticsService, error))\n )\n );\n }\n\n return triggerObs.length ? merge(...triggerObs) : of();\n })\n )\n .subscribe()\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { DbxActionAnalyticsDirective } from './analytics.action.directive';\n\n/**\n * @deprecated The exported DbxActionAnalyticsDirective is now a standalone component. Import that instead.\n */\n@NgModule({\n imports: [DbxActionAnalyticsDirective],\n exports: [DbxActionAnalyticsDirective]\n})\nexport class DbxAnalyticsActionModule {}\n","import { type EnvironmentProviders, Injector, type Provider, makeEnvironmentProviders } from '@angular/core';\nimport { DbxAnalyticsServiceConfiguration, DbxAnalyticsService } from './analytics.service';\n\n/**\n * Factory function that creates a {@link DbxAnalyticsServiceConfiguration} using the Angular injector.\n *\n * Used by {@link provideDbxAnalyticsService} to defer configuration resolution to runtime.\n */\nexport type DbxAnalyticsServiceConfigurationFactory = (injector: Injector) => DbxAnalyticsServiceConfiguration;\n\n/**\n * Configuration for {@link provideDbxAnalyticsService}.\n */\nexport interface ProvideDbxAnalyticsConfig {\n readonly dbxAnalyticsServiceConfigurationFactory: DbxAnalyticsServiceConfigurationFactory;\n}\n\n/**\n * Creates Angular environment providers that register {@link DbxAnalyticsService} and its configuration.\n *\n * Call this in your application's `providers` array to set up analytics with a custom configuration factory\n * that resolves listeners, user sources, and environment flags at runtime.\n *\n * @param config - Contains the factory function that produces a {@link DbxAnalyticsServiceConfiguration}\n * @returns Environment providers for the analytics service.\n *\n * @example\n * ```ts\n * // In app.config.ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDbxAnalyticsService({\n * dbxAnalyticsServiceConfigurationFactory: (injector: Injector) => ({\n * isProduction: environment.production,\n * logEvents: !environment.production,\n * listeners: [injector.get(DbxAnalyticsSegmentServiceListener)],\n * userSource: injector.get(DbxFirebaseAnalyticsUserSource)\n * })\n * })\n * ]\n * };\n * ```\n *\n * @__NO_SIDE_EFFECTS__\n */\nexport function provideDbxAnalyticsService(config: ProvideDbxAnalyticsConfig): EnvironmentProviders {\n const { dbxAnalyticsServiceConfigurationFactory } = config;\n\n const providers: Provider[] = [\n // configuration\n {\n provide: DbxAnalyticsServiceConfiguration,\n useFactory: dbxAnalyticsServiceConfigurationFactory,\n deps: [Injector]\n },\n // service\n DbxAnalyticsService\n ];\n\n return makeEnvironmentProviders(providers);\n}\n","import { Injectable, InjectionToken, inject } from '@angular/core';\nimport { AbstractAsyncWindowLoadedService } from '@dereekb/browser';\n\n/**\n * Injection token for optionally preloading the Mixpanel SDK on the page.\n *\n * In typical setups Mixpanel is loaded by Segment device mode, so this token is rarely needed.\n */\nexport const PRELOAD_MIXPANEL_TOKEN = new InjectionToken<string>('DbxAnalyticsMixpanelApiServicePreload');\n\n/**\n * Minimal subset of the Mixpanel JS SDK surface used by the Mixpanel listener.\n *\n * Avoids taking a runtime dependency on `mixpanel-browser` since the SDK is loaded on the page\n * by Segment's Mixpanel (Actions) device-mode destination. Widen this interface if more\n * Mixpanel APIs are needed.\n */\nexport interface MixpanelLike {\n start_session_recording(): void;\n stop_session_recording(): void;\n pause_session_recording(): void;\n resume_session_recording(): void;\n}\n\n/**\n * Configuration for the Mixpanel analytics integration.\n *\n * Unlike {@link DbxAnalyticsSegmentApiServiceConfig}, this config does not take a write key —\n * Mixpanel is initialized by Segment device mode. The `active` and `logging` flags exist for\n * parity with the Segment config and to gate listener behavior.\n *\n * @example\n * ```ts\n * const config = new DbxAnalyticsMixpanelApiServiceConfig();\n * config.active = environment.production;\n * config.logging = !environment.production;\n * ```\n */\nexport class DbxAnalyticsMixpanelApiServiceConfig {\n logging = true;\n active = true;\n}\n\n/**\n * Service that manages async access to the Mixpanel JS SDK exposed on `window.mixpanel`.\n *\n * The Mixpanel SDK is typically loaded by Segment's Mixpanel (Actions) device-mode destination,\n * so this service waits for `window.mixpanel` to exist using the inherited window-loading polling.\n * The resolved SDK instance is available via the inherited `service$` observable.\n *\n * Provided via {@link provideDbxAnalyticsMixpanelApiService}.\n *\n * @example\n * ```ts\n * // In app.config.ts\n * provideDbxAnalyticsMixpanelApiService({\n * dbxAnalyticsMixpanelApiServiceConfigFactory: () => {\n * const config = new DbxAnalyticsMixpanelApiServiceConfig();\n * config.active = environment.production;\n * return config;\n * }\n * })\n * ```\n */\n@Injectable()\nexport class DbxAnalyticsMixpanelApiService extends AbstractAsyncWindowLoadedService<MixpanelLike> {\n private readonly _config = inject(DbxAnalyticsMixpanelApiServiceConfig);\n\n static readonly MIXPANEL_API_WINDOW_KEY = 'mixpanel';\n\n constructor() {\n const preload = inject(PRELOAD_MIXPANEL_TOKEN, { optional: true });\n super(DbxAnalyticsMixpanelApiService.MIXPANEL_API_WINDOW_KEY, undefined, 'Mixpanel', preload);\n }\n\n get config(): DbxAnalyticsMixpanelApiServiceConfig {\n return this._config;\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { combineLatest } from 'rxjs';\nimport { AbstractDbxAnalyticsServiceListener, type DbxAnalyticsStreamEvent, DbxAnalyticsStreamEventType } from '../../analytics';\nimport { DbxAnalyticsMixpanelApiService, type MixpanelLike } from './mixpanel.service';\n\n/**\n * Analytics listener that forwards session-replay control events to the Mixpanel SDK.\n *\n * Handles only the four session-replay event types — track/identify/page events are intentionally\n * not forwarded here because Segment's Mixpanel (Actions) device-mode destination already routes\n * them to Mixpanel. Forwarding them again would produce duplicate events.\n *\n * - {@link DbxAnalyticsStreamEventType.StartSessionRecording} -> `mixpanel.start_session_recording()`\n * - {@link DbxAnalyticsStreamEventType.StopSessionRecording} -> `mixpanel.stop_session_recording()`\n * - {@link DbxAnalyticsStreamEventType.PauseSessionRecording} -> `mixpanel.pause_session_recording()`\n * - {@link DbxAnalyticsStreamEventType.ResumeSessionRecording} -> `mixpanel.resume_session_recording()`\n *\n * Events are only sent when the Mixpanel configuration is marked as `active`.\n * Provided at root level and registered as a listener via {@link DbxAnalyticsServiceConfiguration.listeners}.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class DbxAnalyticsMixpanelServiceListener extends AbstractDbxAnalyticsServiceListener {\n private readonly _mixpanelApi = inject(DbxAnalyticsMixpanelApiService);\n\n constructor() {\n super();\n\n if (this._mixpanelApi.config.logging) {\n console.log('MixpanelAnalyticsListenerService: Mixpanel is logging events.');\n }\n\n if (!this._mixpanelApi.config.active) {\n console.log('MixpanelAnalyticsListenerService: Mixpanel is disabled from sending events to the server.');\n }\n }\n\n protected _initializeServiceSubscription() {\n return combineLatest([this._mixpanelApi.service$, this.analyticsEvents$]).subscribe(([mixpanel, streamEvent]: [MixpanelLike, DbxAnalyticsStreamEvent]) => {\n if (this._mixpanelApi.config.logging) {\n console.log('Mixpanel Listener Logging Event: ', streamEvent);\n }\n\n if (this._mixpanelApi.config.active) {\n this.handleStreamEvent(mixpanel, streamEvent);\n }\n });\n }\n\n /**\n * Routes a session-replay control event to the corresponding Mixpanel SDK method.\n *\n * Non-session-replay events are intentionally ignored — Segment's device-mode integration\n * already forwards track/identify/page to Mixpanel.\n *\n * @param api - The loaded Mixpanel SDK instance.\n * @param streamEvent - The analytics event to process.\n */\n protected handleStreamEvent(api: MixpanelLike, streamEvent: DbxAnalyticsStreamEvent): void {\n switch (streamEvent.type) {\n case DbxAnalyticsStreamEventType.StartSessionRecording:\n api.start_session_recording();\n break;\n case DbxAnalyticsStreamEventType.StopSessionRecording:\n api.stop_session_recording();\n break;\n case DbxAnalyticsStreamEventType.PauseSessionRecording:\n api.pause_session_recording();\n break;\n case DbxAnalyticsStreamEventType.ResumeSessionRecording:\n api.resume_session_recording();\n break;\n default:\n // All other event types are routed to Mixpanel by Segment's device-mode destination.\n break;\n }\n }\n}\n","import { type EnvironmentProviders, Injector, makeEnvironmentProviders, type Provider } from '@angular/core';\nimport { DbxAnalyticsMixpanelApiService, DbxAnalyticsMixpanelApiServiceConfig, PRELOAD_MIXPANEL_TOKEN } from './mixpanel.service';\n\n/**\n * Factory function that creates a {@link DbxAnalyticsMixpanelApiServiceConfig} using the Angular injector.\n *\n * Used by {@link provideDbxAnalyticsMixpanelApiService} to defer Mixpanel configuration to runtime.\n */\nexport type DbxAnalyticsMixpanelApiServiceConfigFactory = (injector: Injector) => DbxAnalyticsMixpanelApiServiceConfig;\n\n/**\n * Configuration for {@link provideDbxAnalyticsMixpanelApiService}.\n */\nexport interface ProvideDbxAnalyticsMixpanelModuleConfig {\n /**\n * Whether to preload the Mixpanel script token.\n *\n * Rarely needed — Mixpanel is typically loaded by Segment's device-mode destination.\n */\n readonly preloadMixpanelToken?: boolean;\n /**\n * Factory function that produces the Mixpanel API service configuration.\n */\n readonly dbxAnalyticsMixpanelApiServiceConfigFactory: DbxAnalyticsMixpanelApiServiceConfigFactory;\n}\n\n/**\n * Creates Angular environment providers that register {@link DbxAnalyticsMixpanelApiService} for Mixpanel session-replay control.\n *\n * Use alongside {@link provideDbxAnalyticsService} to wire Mixpanel as an analytics listener that\n * handles session-replay start/stop/pause/resume events.\n *\n * @param config - Mixpanel-specific configuration.\n * @returns Environment providers for Mixpanel analytics.\n *\n * @example\n * ```ts\n * // In app.config.ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDbxAnalyticsMixpanelApiService({\n * dbxAnalyticsMixpanelApiServiceConfigFactory: () => {\n * const config = new DbxAnalyticsMixpanelApiServiceConfig();\n * config.active = environment.production;\n * return config;\n * }\n * }),\n * provideDbxAnalyticsService({\n * dbxAnalyticsServiceConfigurationFactory: (injector) => ({\n * isProduction: environment.production,\n * listeners: [\n * injector.get(DbxAnalyticsSegmentServiceListener),\n * injector.get(DbxAnalyticsMixpanelServiceListener)\n * ]\n * })\n * })\n * ]\n * };\n * ```\n *\n * @__NO_SIDE_EFFECTS__\n */\nexport function provideDbxAnalyticsMixpanelApiService(config: ProvideDbxAnalyticsMixpanelModuleConfig): EnvironmentProviders {\n const { preloadMixpanelToken, dbxAnalyticsMixpanelApiServiceConfigFactory } = config;\n\n const providers: Provider[] = [\n // configuration\n {\n provide: DbxAnalyticsMixpanelApiServiceConfig,\n useFactory: dbxAnalyticsMixpanelApiServiceConfigFactory,\n deps: [Injector]\n },\n // service\n DbxAnalyticsMixpanelApiService\n ];\n\n if (preloadMixpanelToken) {\n providers.push({\n provide: PRELOAD_MIXPANEL_TOKEN,\n useValue: preloadMixpanelToken\n });\n }\n\n return makeEnvironmentProviders(providers);\n}\n","import { Injectable, InjectionToken, inject } from '@angular/core';\nimport { AbstractAsyncWindowLoadedService } from '@dereekb/browser';\nimport { poll } from '@dereekb/util';\n\n/**\n * Injection token for optionally preloading the Segment analytics script.\n */\nexport const PRELOAD_SEGMENT_TOKEN = new InjectionToken<string>('DbxAnalyticsSegmentApiServicePreload');\n\n/**\n * Configuration for the Segment analytics integration.\n *\n * @example\n * ```ts\n * const config = new DbxAnalyticsSegmentApiServiceConfig('your-segment-write-key');\n * config.active = environment.production;\n * config.logging = !environment.production;\n * ```\n */\nexport class DbxAnalyticsSegmentApiServiceConfig {\n writeKey: string;\n logging = true;\n active = true;\n constructor(writeKey: string) {\n this.writeKey = writeKey;\n }\n}\n\n/**\n * Extended Segment analytics type that includes the `invoked` flag set after the snippet initializes.\n */\ntype SegmentAnalyticsInvoked = SegmentAnalytics.AnalyticsJS & { invoked?: boolean };\n\n/**\n * Service that manages the async loading and initialization of the Segment analytics SDK from `window.analytics`.\n *\n * Polls for the Segment snippet to be invoked, then calls `analytics.load()` with the configured write key.\n * Once Segment reports ready, the resolved SDK instance is available via the inherited `service$` observable.\n *\n * Requires the Segment analytics snippet to be included in `index.html`.\n *\n * Provided via {@link provideDbxAnalyticsSegmentApiService}.\n *\n * @example\n * ```ts\n * // In app.config.ts\n * provideDbxAnalyticsSegmentApiService({\n * dbxAnalyticsSegmentApiServiceConfigFactory: (injector) => {\n * const config = new DbxAnalyticsSegmentApiServiceConfig(environment.analytics.segment);\n * config.active = environment.production;\n * return config;\n * }\n * })\n * ```\n */\n@Injectable()\nexport class DbxAnalyticsSegmentApiService extends AbstractAsyncWindowLoadedService<SegmentAnalytics.AnalyticsJS> {\n private readonly _config = inject(DbxAnalyticsSegmentApiServiceConfig);\n\n static readonly SEGMENT_API_WINDOW_KEY = 'analytics';\n static readonly SEGMENT_READY_KEY = 'SegmentReady';\n\n constructor() {\n const preload = inject(PRELOAD_SEGMENT_TOKEN, { optional: true });\n super(DbxAnalyticsSegmentApiService.SEGMENT_API_WINDOW_KEY, undefined, 'Segment', preload);\n }\n\n get config(): DbxAnalyticsSegmentApiServiceConfig {\n return this._config;\n }\n\n protected override _prepareCompleteLoadingService(): Promise<void> {\n return poll({\n // poll until analytics.invoked is true.\n check: () => Boolean((window.analytics as SegmentAnalyticsInvoked).invoked),\n timesToGiveup: 100\n });\n }\n\n protected override _initService(service: SegmentAnalytics.AnalyticsJS): Promise<SegmentAnalytics.AnalyticsJS> {\n return new Promise((resolve, reject) => {\n try {\n service.load(this._config.writeKey); // Initialize Segment\n\n // Wait for the service to ready itself.\n service.ready(() => {\n // Segment changes itself or rather the target, and the previous initial target is ignored after.\n const segment: SegmentAnalytics.AnalyticsJS = window[DbxAnalyticsSegmentApiService.SEGMENT_API_WINDOW_KEY];\n resolve(segment);\n });\n } catch (e) {\n console.log('Failed to init segment: ' + e);\n reject(e);\n }\n });\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { type Maybe } from '@dereekb/util';\nimport { combineLatest } from 'rxjs';\nimport { AbstractDbxAnalyticsServiceListener, type DbxAnalyticsStreamEvent, DbxAnalyticsStreamEventType, type AnalyticsUser } from '../../analytics';\nimport { DbxAnalyticsSegmentApiService } from './segment.service';\n\n/**\n * Analytics listener that forwards {@link DbxAnalyticsStreamEvent} events to the Segment SDK.\n *\n * Automatically maps event types to the appropriate Segment methods:\n * - {@link DbxAnalyticsStreamEventType.Event} / {@link DbxAnalyticsStreamEventType.UserLoginEvent} -> `track()`\n * - {@link DbxAnalyticsStreamEventType.UserChange} / {@link DbxAnalyticsStreamEventType.NewUserEvent} -> `identify()`\n * - {@link DbxAnalyticsStreamEventType.UserLogoutEvent} -> `reset()`\n * - {@link DbxAnalyticsStreamEventType.PageView} -> `page()`\n *\n * Events are only sent when the Segment configuration is marked as `active`.\n * Provided at root level and registered as a listener via {@link DbxAnalyticsServiceConfiguration.listeners}.\n *\n * @example\n * ```ts\n * // Register in analytics configuration factory\n * function analyticsConfigFactory(injector: Injector): DbxAnalyticsServiceConfiguration {\n * const segmentListener = injector.get(DbxAnalyticsSegmentServiceListener);\n * return {\n * isProduction: true,\n * listeners: [segmentListener]\n * };\n * }\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class DbxAnalyticsSegmentServiceListener extends AbstractDbxAnalyticsServiceListener {\n private readonly _segmentApi = inject(DbxAnalyticsSegmentApiService);\n\n constructor() {\n super();\n\n if (this._segmentApi.config.logging) {\n console.log('SegmentAnalyticsListenerService: Segment is logging events.');\n }\n\n if (!this._segmentApi.config.active) {\n console.log('SegmentAnalyticsListenerService: Segment is disabled from sending events to the server.');\n }\n }\n\n /**\n * Subscribes to the Segment API service and analytics event stream, forwarding events to the Segment SDK.\n *\n * Events are only sent when the Segment configuration is marked as active.\n *\n * @returns Subscription to the combined Segment API and analytics event stream.\n */\n protected _initializeServiceSubscription() {\n return combineLatest([this._segmentApi.service$, this.analyticsEvents$]).subscribe(([segment, streamEvent]: [SegmentAnalytics.AnalyticsJS, DbxAnalyticsStreamEvent]) => {\n if (this._segmentApi.config.logging) {\n console.log('Segment Listener Logging Event: ', streamEvent);\n }\n\n if (this._segmentApi.config.active) {\n this.handleStreamEvent(segment, streamEvent);\n }\n });\n }\n\n /**\n * Routes an analytics stream event to the appropriate Segment API method based on event type.\n *\n * @param api - The Segment analytics SDK instance.\n * @param streamEvent - The analytics event to process.\n */\n protected handleStreamEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent): void {\n switch (streamEvent.type) {\n case DbxAnalyticsStreamEventType.NewUserEvent:\n this.updateWithNewUserEvent(api, streamEvent);\n break;\n case DbxAnalyticsStreamEventType.UserLoginEvent:\n this.changeUser(api, streamEvent.user);\n this.updateWithEvent(api, streamEvent);\n break;\n case DbxAnalyticsStreamEventType.Event:\n this.updateWithEvent(api, streamEvent);\n break;\n case DbxAnalyticsStreamEventType.UserLogoutEvent:\n this.changeUser(api, undefined);\n break;\n case DbxAnalyticsStreamEventType.PageView:\n api.page();\n break;\n case DbxAnalyticsStreamEventType.UserChange:\n this.changeUser(api, streamEvent.user);\n break;\n case DbxAnalyticsStreamEventType.UserIdChange:\n case DbxAnalyticsStreamEventType.UserPropertiesEvent:\n case DbxAnalyticsStreamEventType.StartSessionRecording:\n case DbxAnalyticsStreamEventType.StopSessionRecording:\n case DbxAnalyticsStreamEventType.PauseSessionRecording:\n case DbxAnalyticsStreamEventType.ResumeSessionRecording:\n // These event types are not forwarded to Segment.\n break;\n }\n }\n\n /**\n * Handles a new user registration event by identifying the user in Segment.\n *\n * @param api - The Segment analytics SDK instance.\n * @param streamEvent - The event containing the new user data.\n */\n protected updateWithNewUserEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent): void {\n this.changeUser(api, streamEvent.user);\n }\n\n /**\n * Sends a track event to Segment with the event name, value, and additional data properties.\n *\n * @param api - The Segment analytics SDK instance.\n * @param streamEvent - The analytics event containing name, value, and data.\n * @param name - Optional override for the event name.\n */\n protected updateWithEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent, name?: string): void {\n const event = streamEvent.event;\n const eventName = name || event?.name;\n\n if (eventName) {\n const value = event?.value;\n const data = event?.data;\n\n api.track(\n eventName,\n {\n ...(value != null\n ? {\n value\n }\n : undefined),\n ...data\n },\n {},\n () => {\n if (this._segmentApi.config.logging) {\n console.log('Segment track success.');\n }\n }\n );\n }\n }\n\n private changeUser(api: SegmentAnalytics.AnalyticsJS, user: Maybe<AnalyticsUser>): void {\n if (user?.user) {\n api.identify(\n user.user,\n {\n ...user.properties\n },\n {},\n () => {\n if (this._segmentApi.config.logging) {\n console.log('Segment identify success.');\n }\n }\n );\n } else {\n api.reset();\n }\n }\n}\n","import { type EnvironmentProviders, Injector, makeEnvironmentProviders, type Provider } from '@angular/core';\nimport { DbxAnalyticsSegmentApiService, DbxAnalyticsSegmentApiServiceConfig, PRELOAD_SEGMENT_TOKEN } from './segment.service';\n\n/**\n * Factory function that creates a {@link DbxAnalyticsSegmentApiServiceConfig} using the Angular injector.\n *\n * Used by {@link provideDbxAnalyticsSegmentApiService} to defer Segment configuration to runtime.\n */\nexport type DbxAnalyticsSegmentApiServiceConfigFactory = (injector: Injector) => DbxAnalyticsSegmentApiServiceConfig;\n\n/**\n * Configuration for {@link provideDbxAnalyticsSegmentApiService}.\n */\nexport interface ProvideDbxAnalyticsSegmentModuleConfig {\n /**\n * Whether to preload the Segment script token.\n */\n readonly preloadSegmentToken?: boolean;\n /**\n * Factory function that produces the Segment API service configuration.\n */\n readonly dbxAnalyticsSegmentApiServiceConfigFactory: DbxAnalyticsSegmentApiServiceConfigFactory;\n}\n\n/**\n * Creates Angular environment providers that register {@link DbxAnalyticsSegmentApiService} for Segment analytics integration.\n *\n * Use alongside {@link provideDbxAnalyticsService} to wire Segment as an analytics listener.\n *\n * @param config - Segment-specific configuration including the write key factory.\n * @returns Environment providers for Segment analytics.\n *\n * @example\n * ```ts\n * // In app.config.ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDbxAnalyticsSegmentApiService({\n * dbxAnalyticsSegmentApiServiceConfigFactory: (injector) => {\n * const config = new DbxAnalyticsSegmentApiServiceConfig(environment.analytics.segment);\n * config.active = environment.production;\n * config.logging = !environment.production;\n * return config;\n * }\n * }),\n * provideDbxAnalyticsService({\n * dbxAnalyticsServiceConfigurationFactory: (injector) => ({\n * isProduction: environment.production,\n * listeners: [injector.get(DbxAnalyticsSegmentServiceListener)]\n * })\n * })\n * ]\n * };\n * ```\n *\n * @__NO_SIDE_EFFECTS__\n */\nexport function provideDbxAnalyticsSegmentApiService(config: ProvideDbxAnalyticsSegmentModuleConfig): EnvironmentProviders {\n const { preloadSegmentToken, dbxAnalyticsSegmentApiServiceConfigFactory } = config;\n\n const providers: Provider[] = [\n // configuration\n {\n provide: DbxAnalyticsSegmentApiServiceConfig,\n useFactory: dbxAnalyticsSegmentApiServiceConfigFactory,\n deps: [Injector]\n },\n // service\n DbxAnalyticsSegmentApiService\n ];\n\n if (preloadSegmentToken) {\n providers.push({\n provide: PRELOAD_SEGMENT_TOKEN,\n useValue: preloadSegmentToken\n });\n }\n\n return makeEnvironmentProviders(providers);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAGA;;;;;AAKG;IACS;AAAZ,CAAA,UAAY,2BAA2B,EAAA;AACrC;;AAEG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ;AACR;;;;AAIG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU;AACV;;;;AAIG;AACH,IAAA,2BAAA,CAAA,2BAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY;;AAGZ;;AAEG;AACH,IAAA,2BAAA,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,IAAI,mBAAmB,EAAE;QACvB,SAAS,CAAC,IAAI,CAAC;AACb,YAAA,OAAO,EAAE,qBAAqB;AAC9B,YAAA,QAAQ,EAAE;AACX,SAAA,CAAC;IACJ;AAEA,IAAA,OAAO,wBAAwB,CAAC,SAAS,CAAC;AAC5C;;AC/EA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-analytics",
3
- "version": "13.11.14",
3
+ "version": "13.11.15",
4
4
  "peerDependencies": {
5
5
  "@angular/core": "21.2.11",
6
- "@dereekb/analytics": "13.11.14",
7
- "@dereekb/browser": "13.11.14",
8
- "@dereekb/dbx-core": "13.11.14",
9
- "@dereekb/rxjs": "13.11.14",
10
- "@dereekb/util": "13.11.14",
11
- "@dereekb/vitest": "13.11.14",
6
+ "@dereekb/analytics": "13.11.15",
7
+ "@dereekb/browser": "13.11.15",
8
+ "@dereekb/dbx-core": "13.11.15",
9
+ "@dereekb/rxjs": "13.11.15",
10
+ "@dereekb/util": "13.11.15",
11
+ "@dereekb/vitest": "13.11.15",
12
12
  "rxjs": "^7.8.2"
13
13
  },
14
14
  "dependencies": {
@@ -247,9 +247,9 @@ interface DbxAnalyticsStreamEventAnalyticsEventWrapper extends DbxAnalyticsStrea
247
247
  * Wraps a {@link UserAnalyticsEvent} into a {@link DbxAnalyticsStreamEventAnalyticsEventWrapper},
248
248
  * extracting the user ID for convenient access by listeners.
249
249
  *
250
- * @param event - the analytics event with optional user context
251
- * @param type - the stream event type classification; defaults to `Event`
252
- * @returns a wrapper combining the event, type, user, and extracted userId
250
+ * @param event - The analytics event with optional user context.
251
+ * @param type - The stream event type classification; defaults to `Event`
252
+ * @returns A wrapper combining the event, type, user, and extracted userId.
253
253
  *
254
254
  * @example
255
255
  * ```ts
@@ -308,41 +308,41 @@ declare class DbxAnalyticsService implements DbxAnalyticsEventStreamService, Dbx
308
308
  *
309
309
  * Pass `undefined` to clear the current user (e.g., on logout).
310
310
  *
311
- * @param user - the user to identify, or undefined to clear
311
+ * @param user - The user to identify, or undefined to clear.
312
312
  */
313
313
  setUser(user: Maybe<AnalyticsUser>): void;
314
314
  /**
315
315
  * Sets the reactive user source that automatically updates the analytics user as auth state changes.
316
316
  *
317
- * @param source - the user source providing an observable of the current analytics user
317
+ * @param source - The user source providing an observable of the current analytics user.
318
318
  */
319
319
  setUserSource(source: DbxAnalyticsUserSource): void;
320
320
  /**
321
321
  * Emits a new user registration event, typically sent once after account creation.
322
322
  *
323
- * @param user - the newly registered user
324
- * @param data - registration-specific data including the signup method
323
+ * @param user - The newly registered user.
324
+ * @param data - Registration-specific data including the signup method.
325
325
  */
326
326
  sendNewUserEvent(user: AnalyticsUser, data: NewUserAnalyticsEventData): void;
327
327
  /**
328
328
  * Emits a user login event, identifying the user in analytics providers.
329
329
  *
330
- * @param user - the user who logged in
331
- * @param data - optional additional event data
330
+ * @param user - The user who logged in.
331
+ * @param data - Optional additional event data.
332
332
  */
333
333
  sendUserLoginEvent(user: AnalyticsUser, data?: AnalyticsEventData): void;
334
334
  /**
335
335
  * Emits a user logout event and optionally clears the current analytics user.
336
336
  *
337
- * @param data - optional additional event data
338
- * @param clearUser - whether to reset the analytics user identity; defaults to `true`
337
+ * @param data - Optional additional event data.
338
+ * @param clearUser - Whether to reset the analytics user identity; defaults to `true`
339
339
  */
340
340
  sendUserLogoutEvent(data?: AnalyticsEventData, clearUser?: boolean): void;
341
341
  /**
342
342
  * Emits a user properties update event, used to sync user traits to analytics providers.
343
343
  *
344
- * @param user - the user whose properties are being updated
345
- * @param data - optional additional event data
344
+ * @param user - The user whose properties are being updated.
345
+ * @param data - Optional additional event data.
346
346
  */
347
347
  sendUserPropertiesEvent(user: AnalyticsUser, data?: AnalyticsEventData): void;
348
348
  /**
@@ -354,8 +354,8 @@ declare class DbxAnalyticsService implements DbxAnalyticsEventStreamService, Dbx
354
354
  *
355
355
  * This is the primary method for tracking custom events with associated properties.
356
356
  *
357
- * @param name - the event name (e.g., `'Interview Ended'`)
358
- * @param data - key-value data attached to the event
357
+ * @param name - The event name (e.g., `'Interview Ended'`)
358
+ * @param data - Key-value data attached to the event.
359
359
  *
360
360
  * @example
361
361
  * ```ts
@@ -369,7 +369,7 @@ declare class DbxAnalyticsService implements DbxAnalyticsEventStreamService, Dbx
369
369
  /**
370
370
  * Sends a named event with no additional data, useful for simple occurrence tracking.
371
371
  *
372
- * @param eventType - the event name to track
372
+ * @param eventType - The event name to track.
373
373
  *
374
374
  * @example
375
375
  * ```ts
@@ -380,13 +380,13 @@ declare class DbxAnalyticsService implements DbxAnalyticsEventStreamService, Dbx
380
380
  /**
381
381
  * Sends a fully constructed analytics event object.
382
382
  *
383
- * @param event - the event containing name, optional value, and data
383
+ * @param event - The event containing name, optional value, and data.
384
384
  */
385
385
  sendEvent(event: AnalyticsEvent): void;
386
386
  /**
387
387
  * Sends a page view event, typically called on successful route transitions.
388
388
  *
389
- * @param page - optional page name/path override; if omitted, the provider determines the current page
389
+ * @param page - Optional page name/path override; if omitted, the provider determines the current page.
390
390
  *
391
391
  * @example
392
392
  * ```ts
@@ -427,7 +427,7 @@ declare class DbxAnalyticsService implements DbxAnalyticsEventStreamService, Dbx
427
427
  *
428
428
  * @param event
429
429
  * @param type
430
- * @param userOverride Uses this user if set as null or an override value. If undefined the current analytics user is used.
430
+ * @param userOverride - Uses this user if set as null or an override value. If undefined the current analytics user is used.
431
431
  */
432
432
  protected sendNextEvent(event: AnalyticsEvent | undefined, type: DbxAnalyticsStreamEventType, userOverride?: Maybe<AnalyticsUser>): void;
433
433
  protected nextEvent(event: UserAnalyticsEvent, type: DbxAnalyticsStreamEventType): void;
@@ -533,8 +533,8 @@ interface ProvideDbxAnalyticsConfig {
533
533
  * Call this in your application's `providers` array to set up analytics with a custom configuration factory
534
534
  * that resolves listeners, user sources, and environment flags at runtime.
535
535
  *
536
- * @param config - contains the factory function that produces a {@link DbxAnalyticsServiceConfiguration}
537
- * @returns environment providers for the analytics service
536
+ * @param config - Contains the factory function that produces a {@link DbxAnalyticsServiceConfiguration}
537
+ * @returns Environment providers for the analytics service.
538
538
  *
539
539
  * @example
540
540
  * ```ts
@@ -552,6 +552,7 @@ interface ProvideDbxAnalyticsConfig {
552
552
  * ]
553
553
  * };
554
554
  * ```
555
+ *
555
556
  * @__NO_SIDE_EFFECTS__
556
557
  */
557
558
  declare function provideDbxAnalyticsService(config: ProvideDbxAnalyticsConfig): EnvironmentProviders;
@@ -648,8 +649,8 @@ declare class DbxAnalyticsMixpanelServiceListener extends AbstractDbxAnalyticsSe
648
649
  * Non-session-replay events are intentionally ignored — Segment's device-mode integration
649
650
  * already forwards track/identify/page to Mixpanel.
650
651
  *
651
- * @param api - The loaded Mixpanel SDK instance
652
- * @param streamEvent - The analytics event to process
652
+ * @param api - The loaded Mixpanel SDK instance.
653
+ * @param streamEvent - The analytics event to process.
653
654
  */
654
655
  protected handleStreamEvent(api: MixpanelLike, streamEvent: DbxAnalyticsStreamEvent): void;
655
656
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxAnalyticsMixpanelServiceListener, never>;
@@ -683,8 +684,8 @@ interface ProvideDbxAnalyticsMixpanelModuleConfig {
683
684
  * Use alongside {@link provideDbxAnalyticsService} to wire Mixpanel as an analytics listener that
684
685
  * handles session-replay start/stop/pause/resume events.
685
686
  *
686
- * @param config - Mixpanel-specific configuration
687
- * @returns environment providers for Mixpanel analytics
687
+ * @param config - Mixpanel-specific configuration.
688
+ * @returns Environment providers for Mixpanel analytics.
688
689
  *
689
690
  * @example
690
691
  * ```ts
@@ -710,6 +711,7 @@ interface ProvideDbxAnalyticsMixpanelModuleConfig {
710
711
  * ]
711
712
  * };
712
713
  * ```
714
+ *
713
715
  * @__NO_SIDE_EFFECTS__
714
716
  */
715
717
  declare function provideDbxAnalyticsMixpanelApiService(config: ProvideDbxAnalyticsMixpanelModuleConfig): EnvironmentProviders;
@@ -746,29 +748,29 @@ declare class DbxAnalyticsSegmentServiceListener extends AbstractDbxAnalyticsSer
746
748
  *
747
749
  * Events are only sent when the Segment configuration is marked as active.
748
750
  *
749
- * @returns subscription to the combined Segment API and analytics event stream
751
+ * @returns Subscription to the combined Segment API and analytics event stream.
750
752
  */
751
753
  protected _initializeServiceSubscription(): rxjs.Subscription;
752
754
  /**
753
755
  * Routes an analytics stream event to the appropriate Segment API method based on event type.
754
756
  *
755
- * @param api - The Segment analytics SDK instance
756
- * @param streamEvent - The analytics event to process
757
+ * @param api - The Segment analytics SDK instance.
758
+ * @param streamEvent - The analytics event to process.
757
759
  */
758
760
  protected handleStreamEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent): void;
759
761
  /**
760
762
  * Handles a new user registration event by identifying the user in Segment.
761
763
  *
762
- * @param api - The Segment analytics SDK instance
763
- * @param streamEvent - The event containing the new user data
764
+ * @param api - The Segment analytics SDK instance.
765
+ * @param streamEvent - The event containing the new user data.
764
766
  */
765
767
  protected updateWithNewUserEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent): void;
766
768
  /**
767
769
  * Sends a track event to Segment with the event name, value, and additional data properties.
768
770
  *
769
- * @param api - The Segment analytics SDK instance
770
- * @param streamEvent - The analytics event containing name, value, and data
771
- * @param name - Optional override for the event name
771
+ * @param api - The Segment analytics SDK instance.
772
+ * @param streamEvent - The analytics event containing name, value, and data.
773
+ * @param name - Optional override for the event name.
772
774
  */
773
775
  protected updateWithEvent(api: SegmentAnalytics.AnalyticsJS, streamEvent: DbxAnalyticsStreamEvent, name?: string): void;
774
776
  private changeUser;
@@ -854,8 +856,8 @@ interface ProvideDbxAnalyticsSegmentModuleConfig {
854
856
  *
855
857
  * Use alongside {@link provideDbxAnalyticsService} to wire Segment as an analytics listener.
856
858
  *
857
- * @param config - Segment-specific configuration including the write key factory
858
- * @returns environment providers for Segment analytics
859
+ * @param config - Segment-specific configuration including the write key factory.
860
+ * @returns Environment providers for Segment analytics.
859
861
  *
860
862
  * @example
861
863
  * ```ts
@@ -879,6 +881,7 @@ interface ProvideDbxAnalyticsSegmentModuleConfig {
879
881
  * ]
880
882
  * };
881
883
  * ```
884
+ *
882
885
  * @__NO_SIDE_EFFECTS__
883
886
  */
884
887
  declare function provideDbxAnalyticsSegmentApiService(config: ProvideDbxAnalyticsSegmentModuleConfig): EnvironmentProviders;