@entrolytics/shared 2.3.3 → 2.4.0

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.
@@ -0,0 +1,104 @@
1
+ export interface DateRangeFilter {
2
+ websiteId: string;
3
+ startDate: Date;
4
+ endDate: Date;
5
+ filters?: {
6
+ country?: string;
7
+ device?: "desktop" | "mobile" | "tablet";
8
+ browser?: string;
9
+ path?: string;
10
+ };
11
+ }
12
+ export interface OverviewStats {
13
+ pageviews: number;
14
+ visitors: number;
15
+ sessions: number;
16
+ pagesPerVisitor: number;
17
+ avgLoadTime: number;
18
+ }
19
+ export interface TimeseriesData {
20
+ date: Date;
21
+ pageviews: number;
22
+ visitors: number;
23
+ sessions: number;
24
+ }
25
+ export interface TopPage {
26
+ path: string;
27
+ views: number;
28
+ uniqueVisitors: number;
29
+ avgLoadTime: number;
30
+ p95LoadTime: number;
31
+ }
32
+ export interface Referrer {
33
+ referrerDomain: string;
34
+ visits: number;
35
+ uniqueVisitors: number;
36
+ }
37
+ export interface DeviceStats {
38
+ deviceType: string;
39
+ browser: string;
40
+ os: string;
41
+ pageviews: number;
42
+ uniqueVisitors: number;
43
+ }
44
+ export interface GeoStats {
45
+ country: string;
46
+ city: string;
47
+ pageviews: number;
48
+ uniqueVisitors: number;
49
+ }
50
+ export interface RealtimeStats {
51
+ visitors: number;
52
+ sessions: number;
53
+ pageviews: number;
54
+ }
55
+ export interface RealtimeEvent {
56
+ timestamp: Date;
57
+ eventType: string;
58
+ eventName?: string;
59
+ path: string;
60
+ visitorId: string;
61
+ country?: string;
62
+ deviceType: string;
63
+ browser: string;
64
+ }
65
+ export interface ActivePage {
66
+ path: string;
67
+ viewers: number;
68
+ }
69
+ /**
70
+ * Core event interface
71
+ */
72
+ export interface EntrolyticsEvent {
73
+ id: string;
74
+ websiteId: string;
75
+ sessionId: string;
76
+ visitorId: string;
77
+ timestamp: Date;
78
+ eventType: string;
79
+ eventName?: string;
80
+ url: string;
81
+ path: string;
82
+ referrer?: string;
83
+ referrerDomain?: string;
84
+ browser: string;
85
+ browserVersion?: string;
86
+ os: string;
87
+ osVersion?: string;
88
+ deviceType: "desktop" | "mobile" | "tablet" | "server" | "unknown";
89
+ screenWidth?: number;
90
+ screenHeight?: number;
91
+ country?: string;
92
+ city?: string;
93
+ region?: string;
94
+ loadTime?: number;
95
+ domInteractive?: number;
96
+ domComplete?: number;
97
+ utmSource?: string;
98
+ utmMedium?: string;
99
+ utmCampaign?: string;
100
+ utmTerm?: string;
101
+ utmContent?: string;
102
+ properties?: Record<string, unknown>;
103
+ }
104
+ //# sourceMappingURL=analytics-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics-types.d.ts","sourceRoot":"","sources":["../src/analytics-types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;QACzC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,C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B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC"}
@@ -0,0 +1,2 @@
1
+ // Moved from @entrolytics/types
2
+ export {};
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Event Protocol Types
3
+ *
4
+ * These types define the canonical event structures used across the Entrolytics ecosystem.
5
+ * Used by: API Server, SDKs, CLI, worker processes.
6
+ *
7
+ * This file was extracted from the internal @entrolytics/protocol package to enable
8
+ * sharing with external packages.
9
+ */
10
+ /**
11
+ * Core event types supported by the analytics platform
12
+ */
13
+ export declare const EventType: {
14
+ readonly PageView: "pageview";
15
+ readonly Custom: "custom_event";
16
+ readonly Click: "click";
17
+ };
18
+ export type EventType = (typeof EventType)[keyof typeof EventType];
19
+ /**
20
+ * Event payload as sent from client SDKs
21
+ */
22
+ export interface EventPayload {
23
+ websiteId: string;
24
+ sessionId: string;
25
+ visitorId: string;
26
+ url: string;
27
+ referrer?: string;
28
+ eventType: EventType;
29
+ eventName?: string;
30
+ properties?: Record<string, unknown>;
31
+ screenWidth?: number;
32
+ screenHeight?: number;
33
+ loadTime?: number;
34
+ domInteractive?: number;
35
+ domComplete?: number;
36
+ utmSource?: string;
37
+ utmMedium?: string;
38
+ utmCampaign?: string;
39
+ utmTerm?: string;
40
+ utmContent?: string;
41
+ }
42
+ /**
43
+ * Event DB row structure as stored in ClickHouse
44
+ * Uses snake_case to match database column naming convention
45
+ */
46
+ export interface EventDBRow {
47
+ id: string;
48
+ website_id: string;
49
+ session_id: string;
50
+ visitor_id: string;
51
+ timestamp: string;
52
+ event_type: EventType;
53
+ event_name: string | null;
54
+ url: string;
55
+ path: string;
56
+ referrer: string | null;
57
+ referrer_domain: string | null;
58
+ browser: string;
59
+ browser_version: string | null;
60
+ os: string;
61
+ os_version: string | null;
62
+ device_type: "desktop" | "mobile" | "tablet" | "server" | "unknown";
63
+ screen_width: number | null;
64
+ screen_height: number | null;
65
+ country: string | null;
66
+ city: string | null;
67
+ region: string | null;
68
+ load_time: number | null;
69
+ dom_interactive: number | null;
70
+ dom_complete: number | null;
71
+ utm_source: string | null;
72
+ utm_medium: string | null;
73
+ utm_campaign: string | null;
74
+ utm_term: string | null;
75
+ utm_content: string | null;
76
+ properties: string;
77
+ }
78
+ /**
79
+ * Device types for analytics segmentation
80
+ */
81
+ export type DeviceType = "desktop" | "mobile" | "tablet" | "server" | "unknown";
82
+ //# sourceMappingURL=event-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-protocol.d.ts","sourceRoot":"","sources":["../src/event-protocol.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AAI,CAAC;IACxB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACpE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Event Protocol Types
3
+ *
4
+ * These types define the canonical event structures used across the Entrolytics ecosystem.
5
+ * Used by: API Server, SDKs, CLI, worker processes.
6
+ *
7
+ * This file was extracted from the internal @entrolytics/protocol package to enable
8
+ * sharing with external packages.
9
+ */
10
+ /**
11
+ * Core event types supported by the analytics platform
12
+ */
13
+ export const EventType = {
14
+ PageView: "pageview",
15
+ Custom: "custom_event",
16
+ Click: "click",
17
+ };