@dotcms/analytics 1.0.2-next.1 → 1.0.2-next.2

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.
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalytics, DotCMSAnalyticsConfig } from './shared/dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * Creates an analytics instance for content analytics tracking.
5
4
  *
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalyticsConfig, DotCMSAnalyticsParams } from '../shared/dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * Analytics plugin for tracking page views and custom events in DotCMS applications.
5
4
  * This plugin handles sending analytics data to the DotCMS server, managing initialization,
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalyticsPayload } from '../../shared/dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * Plugin that enriches the analytics payload data based on the event type.
5
4
  * Uses Analytics.js lifecycle events to inject context before processing.
@@ -18,13 +17,13 @@ export declare const dotAnalyticsEnricherPlugin: () => {
18
17
  payload: DotCMSAnalyticsPayload;
19
18
  }) => {
20
19
  local_time: string;
21
- utm?: import('../../shared/dot-content-analytics.model').DotCMSUtmData | undefined;
20
+ utm?: import('../../shared/dot-content-analytics.model').DotCMSUtmData;
22
21
  page: import('../../shared/dot-content-analytics.model').DotCMSPageData;
23
22
  device: import('../../shared/dot-content-analytics.model').DotCMSDeviceData;
24
23
  event: string;
25
24
  properties: Record<string, unknown>;
26
25
  options: Record<string, unknown>;
27
- context?: import('../../shared/dot-content-analytics.model').DotCMSAnalyticsContext | undefined;
26
+ context?: import('../../shared/dot-content-analytics.model').DotCMSAnalyticsContext;
28
27
  };
29
28
  /**
30
29
  * TRACK EVENT ENRICHMENT - Runs after identity context injection
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalyticsConfig, DotCMSAnalyticsHookParams } from '../../shared/dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * Identity Plugin for DotAnalytics
5
4
  * Handles user ID generation, session management, and activity tracking.
@@ -35,7 +34,7 @@ export declare const dotAnalyticsIdentityPlugin: (config: DotCMSAnalyticsConfig)
35
34
  search: string;
36
35
  width: number;
37
36
  height: number;
38
- referrer?: string | undefined;
37
+ referrer?: string;
39
38
  };
40
39
  options: Record<string, unknown>;
41
40
  userId: string | null;
@@ -61,7 +60,7 @@ export declare const dotAnalyticsIdentityPlugin: (config: DotCMSAnalyticsConfig)
61
60
  search: string;
62
61
  width: number;
63
62
  height: number;
64
- referrer?: string | undefined;
63
+ referrer?: string;
65
64
  };
66
65
  options: Record<string, unknown>;
67
66
  userId: string | null;
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalyticsConfig } from './dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * Updates session activity with throttling
5
4
  */
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalyticsConfig, DotCMSAnalyticsRequestBody } from './dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * Send an analytics event to the server
5
4
  * @param payload - The event payload data
@@ -1,5 +1,4 @@
1
1
  import { EVENT_TYPES } from './dot-content-analytics.constants';
2
-
3
2
  declare global {
4
3
  interface Window {
5
4
  __dotAnalyticsCleanup?: () => void;
@@ -1,6 +1,5 @@
1
- import { DotCMSAnalyticsConfig, DotCMSAnalyticsContext, DotCMSAnalyticsPayload, DotCMSBrowserEventData, DotCMSDeviceData, DotCMSPageData, DotCMSUtmData } from './dot-content-analytics.model';
2
1
  import { PageData } from 'analytics';
3
-
2
+ import { DotCMSAnalyticsConfig, DotCMSAnalyticsContext, DotCMSAnalyticsPayload, DotCMSBrowserEventData, DotCMSDeviceData, DotCMSPageData, DotCMSUtmData } from './dot-content-analytics.model';
4
3
  export { cleanupActivityTracking, getLastActivity, getSessionInfo, initializeActivityTracking, isUserInactive, updateSessionActivity } from './dot-content-analytics.activity-tracker';
5
4
  /**
6
5
  * Generates a cryptographically secure random ID
@@ -78,13 +77,13 @@ export declare const enrichWithUtmData: (payload: DotCMSAnalyticsPayload) => Dot
78
77
  */
79
78
  export declare const enrichPagePayloadOptimized: (payload: DotCMSAnalyticsPayload, location?: Location) => {
80
79
  local_time: string;
81
- utm?: DotCMSUtmData | undefined;
80
+ utm?: DotCMSUtmData;
82
81
  page: DotCMSPageData;
83
82
  device: DotCMSDeviceData;
84
83
  event: string;
85
84
  properties: Record<string, unknown>;
86
85
  options: Record<string, unknown>;
87
- context?: DotCMSAnalyticsContext | undefined;
86
+ context?: DotCMSAnalyticsContext;
88
87
  };
89
88
  /**
90
89
  * @deprecated Use enrichPagePayloadOptimized instead to avoid data duplication
@@ -94,12 +93,12 @@ export declare const enrichPagePayloadOptimized: (payload: DotCMSAnalyticsPayloa
94
93
  export declare const enrichPagePayload: (payload: DotCMSAnalyticsPayload, location?: Location) => {
95
94
  payload: {
96
95
  local_time: string;
97
- utm?: DotCMSUtmData | undefined;
96
+ utm?: DotCMSUtmData;
98
97
  page: PageData;
99
98
  device: DotCMSDeviceData;
100
99
  event: string;
101
100
  properties: Record<string, unknown>;
102
101
  options: Record<string, unknown>;
103
- context?: DotCMSAnalyticsContext | undefined;
102
+ context?: DotCMSAnalyticsContext;
104
103
  };
105
104
  };
@@ -1,6 +1,5 @@
1
- import { DotCMSAnalyticsConfig } from '../../dotAnalytics/shared/dot-content-analytics.model';
2
1
  import { ReactElement, ReactNode } from 'react';
3
-
2
+ import { DotCMSAnalyticsConfig } from '../../dotAnalytics/shared/dot-content-analytics.model';
4
3
  interface DotContentAnalyticsProviderProps {
5
4
  children?: ReactNode;
6
5
  config: DotCMSAnalyticsConfig;
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalytics } from '../../dotAnalytics/shared/dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * `DotContentAnalyticsContext` is a React context that is designed to provide an instance of
5
4
  * `DotCMSAnalytics` to all of the components within its tree that are Consumers of this context.
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalytics } from '../../dotAnalytics/shared/dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * Custom hook that handles analytics tracking for anonymous users.
5
4
  *
@@ -1,5 +1,4 @@
1
1
  import { DotCMSAnalytics } from '../../dotAnalytics/shared/dot-content-analytics.model';
2
-
3
2
  /**
4
3
  * Internal custom hook that handles analytics page view tracking.
5
4
  *
@@ -4,8 +4,7 @@ import "../../../uve/src/internal/constants.js";
4
4
  function p(t) {
5
5
  const n = u(null);
6
6
  i(() => {
7
- if (!t)
8
- return;
7
+ if (!t) return;
9
8
  function e() {
10
9
  const o = window.location.pathname, r = a();
11
10
  o !== n.current && !r && t && (n.current = o, t.pageView());
@@ -1,6 +1,5 @@
1
- import { DotCMSAnalytics } from './dotAnalytics/shared/dot-content-analytics.model';
2
1
  import { ANALYTICS_WINDOWS_KEY } from './dotAnalytics/shared/dot-content-analytics.constants';
3
-
2
+ import { DotCMSAnalytics } from './dotAnalytics/shared/dot-content-analytics.model';
4
3
  declare global {
5
4
  interface Window {
6
5
  [ANALYTICS_WINDOWS_KEY]: DotCMSAnalytics | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/analytics",
3
- "version": "1.0.2-next.1",
3
+ "version": "1.0.2-next.2",
4
4
  "description": "Official JavaScript library for Content Analytics with DotCMS.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,8 +57,7 @@ function B(o) {
57
57
  const t = (n) => {
58
58
  var d, r, E, c, T, l, m, _, u, C;
59
59
  const e = M(n.target);
60
- if (!e)
61
- return;
60
+ if (!e) return;
62
61
  const { x: i, y: g, width: v, height: N } = e.getBoundingClientRect(), f = ((d = e.dataset) == null ? void 0 : d.dotObject) === "container", L = {
63
62
  identifier: "TEMP_EMPTY_CONTENTLET",
64
63
  title: "TEMP_EMPTY_CONTENTLET",
@@ -52,8 +52,7 @@ function y(t) {
52
52
  }
53
53
  function g(t) {
54
54
  var o, n, d;
55
- if (!t)
56
- return null;
55
+ if (!t) return null;
57
56
  const a = t.querySelector('[data-dot-object="empty-content"]');
58
57
  return ((o = t == null ? void 0 : t.dataset) == null ? void 0 : o.dotObject) === "contentlet" || // The container inside Headless components have a span with the data-dot-object="container" attribute
59
58
  ((n = t == null ? void 0 : t.dataset) == null ? void 0 : n.dotObject) === "container" && a || // The container inside Traditional have no content inside