@entrolytics/shared 2.4.0 → 2.4.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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,195 @@
1
+ //#region src/analytics-types.d.ts
2
+ interface DateRangeFilter {
3
+ websiteId: string;
4
+ startDate: Date;
5
+ endDate: Date;
6
+ filters?: {
7
+ country?: string;
8
+ device?: "desktop" | "mobile" | "tablet";
9
+ browser?: string;
10
+ path?: string;
11
+ };
12
+ }
13
+ interface OverviewStats {
14
+ pageviews: number;
15
+ visitors: number;
16
+ sessions: number;
17
+ pagesPerVisitor: number;
18
+ avgLoadTime: number;
19
+ }
20
+ interface TimeseriesData {
21
+ date: Date;
22
+ pageviews: number;
23
+ visitors: number;
24
+ sessions: number;
25
+ }
26
+ interface TopPage {
27
+ path: string;
28
+ views: number;
29
+ uniqueVisitors: number;
30
+ avgLoadTime: number;
31
+ p95LoadTime: number;
32
+ }
33
+ interface Referrer {
34
+ referrerDomain: string;
35
+ visits: number;
36
+ uniqueVisitors: number;
37
+ }
38
+ interface DeviceStats {
39
+ deviceType: string;
40
+ browser: string;
41
+ os: string;
42
+ pageviews: number;
43
+ uniqueVisitors: number;
44
+ }
45
+ interface GeoStats {
46
+ country: string;
47
+ city: string;
48
+ pageviews: number;
49
+ uniqueVisitors: number;
50
+ }
51
+ interface RealtimeStats {
52
+ visitors: number;
53
+ sessions: number;
54
+ pageviews: number;
55
+ }
56
+ interface RealtimeEvent {
57
+ timestamp: Date;
58
+ eventType: string;
59
+ eventName?: string;
60
+ path: string;
61
+ visitorId: string;
62
+ country?: string;
63
+ deviceType: string;
64
+ browser: string;
65
+ }
66
+ interface ActivePage {
67
+ path: string;
68
+ viewers: number;
69
+ }
70
+ /**
71
+ * Core event interface
72
+ */
73
+ interface EntrolyticsEvent {
74
+ id: string;
75
+ websiteId: string;
76
+ sessionId: string;
77
+ visitorId: string;
78
+ timestamp: Date;
79
+ eventType: string;
80
+ eventName?: string;
81
+ url: string;
82
+ path: string;
83
+ referrer?: string;
84
+ referrerDomain?: string;
85
+ browser: string;
86
+ browserVersion?: string;
87
+ os: string;
88
+ osVersion?: string;
89
+ deviceType: "desktop" | "mobile" | "tablet" | "server" | "unknown";
90
+ screenWidth?: number;
91
+ screenHeight?: number;
92
+ country?: string;
93
+ city?: string;
94
+ region?: string;
95
+ loadTime?: number;
96
+ domInteractive?: number;
97
+ domComplete?: number;
98
+ utmSource?: string;
99
+ utmMedium?: string;
100
+ utmCampaign?: string;
101
+ utmTerm?: string;
102
+ utmContent?: string;
103
+ properties?: Record<string, unknown>;
104
+ }
105
+ //#endregion
106
+ //#region src/event-protocol.d.ts
107
+ /**
108
+ * Event Protocol Types
109
+ *
110
+ * These types define the canonical event structures used across the Entrolytics ecosystem.
111
+ * Used by: API Server, SDKs, CLI, worker processes.
112
+ *
113
+ * This file was extracted from the internal @entrolytics/protocol package to enable
114
+ * sharing with external packages.
115
+ */
116
+ /**
117
+ * Core event types supported by the analytics platform
118
+ */
119
+ declare const EventType$1: {
120
+ readonly PageView: "pageview";
121
+ readonly Custom: "custom_event";
122
+ readonly Click: "click";
123
+ };
124
+ type EventType$1 = (typeof EventType$1)[keyof typeof EventType$1];
125
+ /**
126
+ * Event payload as sent from client SDKs
127
+ */
128
+ interface EventPayload {
129
+ websiteId: string;
130
+ eventId: string;
131
+ timestamp: string;
132
+ sessionId: string;
133
+ visitorId: string;
134
+ url: string;
135
+ referrer?: string;
136
+ eventType: EventType$1;
137
+ eventName?: string;
138
+ consent?: boolean;
139
+ properties?: Record<string, unknown>;
140
+ screenWidth?: number;
141
+ screenHeight?: number;
142
+ loadTime?: number;
143
+ domInteractive?: number;
144
+ domComplete?: number;
145
+ utmSource?: string;
146
+ utmMedium?: string;
147
+ utmCampaign?: string;
148
+ utmTerm?: string;
149
+ utmContent?: string;
150
+ }
151
+ /**
152
+ * Event DB row structure as stored in ClickHouse
153
+ * Uses snake_case to match database column naming convention
154
+ */
155
+ interface EventDBRow {
156
+ id: string;
157
+ website_id: string;
158
+ session_id: string;
159
+ visitor_id: string;
160
+ timestamp: string;
161
+ event_type: EventType$1;
162
+ event_name: string | null;
163
+ url: string;
164
+ path: string;
165
+ referrer: string | null;
166
+ referrer_domain: string | null;
167
+ browser: string;
168
+ browser_version: string | null;
169
+ os: string;
170
+ os_version: string | null;
171
+ device_type: "desktop" | "mobile" | "tablet" | "server" | "unknown";
172
+ screen_width: number | null;
173
+ screen_height: number | null;
174
+ country: string | null;
175
+ city: string | null;
176
+ region: string | null;
177
+ load_time: number | null;
178
+ dom_interactive: number | null;
179
+ dom_complete: number | null;
180
+ utm_source: string | null;
181
+ utm_medium: string | null;
182
+ utm_campaign: string | null;
183
+ utm_term: string | null;
184
+ utm_content: string | null;
185
+ properties: string;
186
+ }
187
+ /**
188
+ * Device types for analytics segmentation
189
+ */
190
+ type DeviceType = "desktop" | "mobile" | "tablet" | "server" | "unknown";
191
+ //#endregion
192
+ //#region src/index.d.ts
1
193
  /**
2
194
  * Shared constants across Entrolytics ecosystem
3
195
  * Used by: CLI, SDKs, Dashboard, Integrations
@@ -5,733 +197,710 @@
5
197
  /**
6
198
  * Plan definitions and limits
7
199
  */
8
- export declare const PLANS: {
9
- readonly starter: {
10
- readonly id: "starter";
11
- readonly name: "Starter";
12
- readonly price: 0;
13
- readonly limits: {
14
- readonly pageviewsPerMonth: 25000;
15
- readonly websites: 2;
16
- readonly retentionDays: 30;
17
- readonly seats: 1;
18
- };
19
- readonly features: {
20
- readonly funnels: false;
21
- readonly attribution: false;
22
- readonly revenue: false;
23
- readonly customDashboards: false;
24
- readonly apiAccess: false;
25
- readonly weeklyReports: true;
26
- readonly support: "community";
27
- };
28
- };
29
- readonly pro: {
30
- readonly id: "pro";
31
- readonly name: "Pro";
32
- readonly price: 29;
33
- readonly limits: {
34
- readonly pageviewsPerMonth: 250000;
35
- readonly websites: 10;
36
- readonly retentionDays: 365;
37
- readonly seats: 5;
38
- };
39
- readonly features: {
40
- readonly funnels: true;
41
- readonly attribution: true;
42
- readonly revenue: true;
43
- readonly customDashboards: false;
44
- readonly apiAccess: true;
45
- readonly weeklyReports: true;
46
- readonly support: "email";
47
- };
48
- };
49
- readonly business: {
50
- readonly id: "business";
51
- readonly name: "Business";
52
- readonly price: 99;
53
- readonly limits: {
54
- readonly pageviewsPerMonth: 1000000;
55
- readonly websites: -1;
56
- readonly retentionDays: 730;
57
- readonly seats: -1;
58
- };
59
- readonly features: {
60
- readonly funnels: true;
61
- readonly attribution: true;
62
- readonly revenue: true;
63
- readonly customDashboards: true;
64
- readonly apiAccess: true;
65
- readonly weeklyReports: true;
66
- readonly support: "priority";
67
- };
68
- };
69
- readonly enterprise: {
70
- readonly id: "enterprise";
71
- readonly name: "Enterprise";
72
- readonly price: -1;
73
- readonly limits: {
74
- readonly pageviewsPerMonth: -1;
75
- readonly websites: -1;
76
- readonly retentionDays: -1;
77
- readonly seats: -1;
78
- };
79
- readonly features: {
80
- readonly funnels: true;
81
- readonly attribution: true;
82
- readonly revenue: true;
83
- readonly customDashboards: true;
84
- readonly apiAccess: true;
85
- readonly weeklyReports: true;
86
- readonly support: "dedicated";
87
- readonly sso: true;
88
- readonly auditLogs: true;
89
- readonly customRetention: true;
90
- };
91
- };
200
+ declare const PLANS: {
201
+ readonly starter: {
202
+ readonly id: "starter";
203
+ readonly name: "Starter";
204
+ readonly price: 0;
205
+ readonly limits: {
206
+ readonly pageviewsPerMonth: 25000;
207
+ readonly websites: 2;
208
+ readonly retentionDays: 30;
209
+ readonly seats: 1;
210
+ };
211
+ readonly features: {
212
+ readonly funnels: false;
213
+ readonly attribution: false;
214
+ readonly revenue: false;
215
+ readonly customDashboards: false;
216
+ readonly apiAccess: false;
217
+ readonly weeklyReports: true;
218
+ readonly support: "community";
219
+ };
220
+ };
221
+ readonly pro: {
222
+ readonly id: "pro";
223
+ readonly name: "Pro";
224
+ readonly price: 29;
225
+ readonly limits: {
226
+ readonly pageviewsPerMonth: 250000;
227
+ readonly websites: 10;
228
+ readonly retentionDays: 365;
229
+ readonly seats: 5;
230
+ };
231
+ readonly features: {
232
+ readonly funnels: true;
233
+ readonly attribution: true;
234
+ readonly revenue: true;
235
+ readonly customDashboards: false;
236
+ readonly apiAccess: true;
237
+ readonly weeklyReports: true;
238
+ readonly support: "email";
239
+ };
240
+ };
241
+ readonly business: {
242
+ readonly id: "business";
243
+ readonly name: "Business";
244
+ readonly price: 99;
245
+ readonly limits: {
246
+ readonly pageviewsPerMonth: 1000000;
247
+ readonly websites: -1;
248
+ readonly retentionDays: 730;
249
+ readonly seats: -1;
250
+ };
251
+ readonly features: {
252
+ readonly funnels: true;
253
+ readonly attribution: true;
254
+ readonly revenue: true;
255
+ readonly customDashboards: true;
256
+ readonly apiAccess: true;
257
+ readonly weeklyReports: true;
258
+ readonly support: "priority";
259
+ };
260
+ };
261
+ readonly enterprise: {
262
+ readonly id: "enterprise";
263
+ readonly name: "Enterprise";
264
+ readonly price: -1;
265
+ readonly limits: {
266
+ readonly pageviewsPerMonth: -1;
267
+ readonly websites: -1;
268
+ readonly retentionDays: -1;
269
+ readonly seats: -1;
270
+ };
271
+ readonly features: {
272
+ readonly funnels: true;
273
+ readonly attribution: true;
274
+ readonly revenue: true;
275
+ readonly customDashboards: true;
276
+ readonly apiAccess: true;
277
+ readonly weeklyReports: true;
278
+ readonly support: "dedicated";
279
+ readonly sso: true;
280
+ readonly auditLogs: true;
281
+ readonly customRetention: true;
282
+ };
283
+ };
92
284
  };
93
285
  /**
94
286
  * Plan feature names for display
95
287
  */
96
- export declare const PLAN_FEATURES: {
97
- readonly funnels: "Funnel Analytics";
98
- readonly attribution: "Attribution Reports";
99
- readonly revenue: "Revenue Tracking";
100
- readonly customDashboards: "Custom Dashboards";
101
- readonly apiAccess: "API Access";
102
- readonly weeklyReports: "Weekly Email Reports";
103
- readonly sso: "SSO/SAML";
104
- readonly auditLogs: "Audit Logs";
105
- readonly customRetention: "Custom Data Retention";
288
+ declare const PLAN_FEATURES: {
289
+ readonly funnels: "Funnel Analytics";
290
+ readonly attribution: "Attribution Reports";
291
+ readonly revenue: "Revenue Tracking";
292
+ readonly customDashboards: "Custom Dashboards";
293
+ readonly apiAccess: "API Access";
294
+ readonly weeklyReports: "Weekly Email Reports";
295
+ readonly sso: "SSO/SAML";
296
+ readonly auditLogs: "Audit Logs";
297
+ readonly customRetention: "Custom Data Retention";
106
298
  };
107
299
  /**
108
300
  * Usage warning thresholds (percentages)
109
301
  */
110
- export declare const USAGE_THRESHOLDS: {
111
- readonly warning: 90;
112
- readonly critical: 95;
302
+ declare const USAGE_THRESHOLDS: {
303
+ readonly warning: 90;
304
+ readonly critical: 95;
113
305
  };
114
306
  /**
115
307
  * Billing-related error codes
116
308
  */
117
- export declare const BILLING_ERRORS: {
118
- readonly quotaExceeded: "QUOTA_EXCEEDED";
119
- readonly planRequired: "PLAN_REQUIRED";
120
- readonly featureNotAvailable: "FEATURE_NOT_AVAILABLE";
121
- readonly subscriptionInactive: "SUBSCRIPTION_INACTIVE";
122
- readonly paymentFailed: "PAYMENT_FAILED";
309
+ declare const BILLING_ERRORS: {
310
+ readonly quotaExceeded: "QUOTA_EXCEEDED";
311
+ readonly planRequired: "PLAN_REQUIRED";
312
+ readonly featureNotAvailable: "FEATURE_NOT_AVAILABLE";
313
+ readonly subscriptionInactive: "SUBSCRIPTION_INACTIVE";
314
+ readonly paymentFailed: "PAYMENT_FAILED";
123
315
  };
124
316
  /**
125
317
  * API endpoint configuration
126
318
  */
127
- export declare const API_ENDPOINTS: {
128
- readonly production: "https://api.entrolytics.click";
129
- readonly development: "http://localhost:3001";
319
+ declare const API_ENDPOINTS: {
320
+ readonly production: "https://api.entrolytics.click";
321
+ readonly development: "http://localhost:3001";
130
322
  };
131
323
  /**
132
324
  * Default API host
133
325
  */
134
- export declare const DEFAULT_API_HOST: "https://api.entrolytics.click" | "http://localhost:3001";
326
+ declare const DEFAULT_API_HOST: "http://localhost:3001" | "https://api.entrolytics.click";
135
327
  /**
136
328
  * Environment variable naming conventions by framework
137
329
  */
138
- export declare const ENV_VAR_NAMES: {
139
- readonly nextjs: {
140
- readonly websiteId: "NEXT_PUBLIC_ENTROLYTICS_WEBSITE_ID";
141
- readonly host: "NEXT_PUBLIC_ENTROLYTICS_HOST";
142
- readonly envFile: ".env.local";
143
- };
144
- readonly react: {
145
- readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
146
- readonly host: "VITE_ENTROLYTICS_HOST";
147
- readonly envFile: ".env";
148
- readonly fallback: {
149
- readonly websiteId: "REACT_APP_ENTROLYTICS_WEBSITE_ID";
150
- readonly host: "REACT_APP_ENTROLYTICS_HOST";
151
- };
152
- };
153
- readonly vue: {
154
- readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
155
- readonly host: "VITE_ENTROLYTICS_HOST";
156
- readonly envFile: ".env";
157
- };
158
- readonly svelte: {
159
- readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
160
- readonly host: "PUBLIC_ENTROLYTICS_HOST";
161
- readonly envFile: ".env";
162
- };
163
- readonly astro: {
164
- readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
165
- readonly host: "PUBLIC_ENTROLYTICS_HOST";
166
- readonly envFile: ".env";
167
- };
168
- readonly html: {
169
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
170
- readonly host: "ENTROLYTICS_HOST";
171
- readonly envFile: ".env";
172
- };
173
- readonly node: {
174
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
175
- readonly host: "ENTROLYTICS_HOST";
176
- readonly envFile: ".env";
177
- };
178
- readonly php: {
179
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
180
- readonly host: "ENTROLYTICS_HOST";
181
- readonly envFile: ".env";
182
- };
183
- readonly python: {
184
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
185
- readonly host: "ENTROLYTICS_HOST";
186
- readonly envFile: ".env";
187
- };
188
- readonly go: {
189
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
190
- readonly host: "ENTROLYTICS_HOST";
191
- readonly envFile: ".env";
192
- };
330
+ declare const ENV_VAR_NAMES: {
331
+ readonly nextjs: {
332
+ readonly websiteId: "NEXT_PUBLIC_ENTROLYTICS_WEBSITE_ID";
333
+ readonly host: "NEXT_PUBLIC_ENTROLYTICS_HOST";
334
+ readonly envFile: ".env.local";
335
+ };
336
+ readonly react: {
337
+ readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
338
+ readonly host: "VITE_ENTROLYTICS_HOST";
339
+ readonly envFile: ".env";
340
+ };
341
+ readonly vue: {
342
+ readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
343
+ readonly host: "VITE_ENTROLYTICS_HOST";
344
+ readonly envFile: ".env";
345
+ };
346
+ readonly svelte: {
347
+ readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
348
+ readonly host: "PUBLIC_ENTROLYTICS_HOST";
349
+ readonly envFile: ".env";
350
+ };
351
+ readonly astro: {
352
+ readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
353
+ readonly host: "PUBLIC_ENTROLYTICS_HOST";
354
+ readonly envFile: ".env";
355
+ };
356
+ readonly html: {
357
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
358
+ readonly host: "ENTROLYTICS_HOST";
359
+ readonly envFile: ".env";
360
+ };
361
+ readonly node: {
362
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
363
+ readonly host: "ENTROLYTICS_HOST";
364
+ readonly envFile: ".env";
365
+ };
366
+ readonly php: {
367
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
368
+ readonly host: "ENTROLYTICS_HOST";
369
+ readonly envFile: ".env";
370
+ };
371
+ readonly python: {
372
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
373
+ readonly host: "ENTROLYTICS_HOST";
374
+ readonly envFile: ".env";
375
+ };
376
+ readonly go: {
377
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
378
+ readonly host: "ENTROLYTICS_HOST";
379
+ readonly envFile: ".env";
380
+ };
193
381
  };
194
382
  /**
195
383
  * CLI configuration constants
196
384
  */
197
- export declare const CLI_CONFIG: {
198
- readonly tokenExpiryMinutes: 15;
199
- readonly maxTokensPerUser: 10;
200
- readonly pollIntervalMs: 2000;
201
- readonly setupTimeoutMs: 300000;
202
- readonly minCliVersion: "1.0.0";
385
+ declare const CLI_CONFIG: {
386
+ readonly tokenExpiryMinutes: 15;
387
+ readonly maxTokensPerUser: 10;
388
+ readonly pollIntervalMs: 2000;
389
+ readonly setupTimeoutMs: 300000;
390
+ readonly minCliVersion: "1.0.0";
203
391
  };
204
392
  /**
205
393
  * Core event types - matches backend protocol values exactly
206
394
  * Used by: API Server, SDKs, CLI, worker processes
207
395
  * See: entrolytics/packages/protocol/src/events.ts
208
396
  */
209
- export declare const EVENT_TYPES: {
210
- readonly pageView: "pageview";
211
- readonly custom: "custom_event";
212
- readonly click: "click";
397
+ declare const EVENT_TYPES: {
398
+ readonly pageView: "pageview";
399
+ readonly custom: "custom_event";
400
+ readonly click: "click";
213
401
  };
214
402
  /**
215
403
  * Extended event types for SDK-level semantics
216
404
  * These are higher-level event categories used by SDKs
217
405
  * They map to the core EVENT_TYPES when sent to the backend
218
406
  */
219
- export declare const SDK_EVENT_TYPES: {
220
- readonly pageView: "pageview";
221
- readonly click: "click";
222
- readonly formSubmit: "form_submit";
223
- readonly custom: "custom_event";
224
- readonly error: "error";
225
- readonly performance: "performance";
407
+ declare const SDK_EVENT_TYPES: {
408
+ readonly pageView: "pageview";
409
+ readonly click: "click";
410
+ readonly formSubmit: "form_submit";
411
+ readonly custom: "custom_event";
412
+ readonly error: "error";
413
+ readonly performance: "performance";
226
414
  };
227
415
  /**
228
416
  * Web Vitals metric types (Phase 2)
229
417
  * Core Web Vitals: LCP, INP, CLS
230
418
  * Additional: TTFB, FCP
231
419
  */
232
- export declare const VITAL_TYPES: {
233
- readonly LCP: "LCP";
234
- readonly INP: "INP";
235
- readonly CLS: "CLS";
236
- readonly TTFB: "TTFB";
237
- readonly FCP: "FCP";
420
+ declare const VITAL_TYPES: {
421
+ readonly LCP: "LCP";
422
+ readonly INP: "INP";
423
+ readonly CLS: "CLS";
424
+ readonly TTFB: "TTFB";
425
+ readonly FCP: "FCP";
238
426
  };
239
427
  /**
240
428
  * Web Vitals rating thresholds
241
429
  */
242
- export declare const VITAL_RATINGS: {
243
- readonly good: "good";
244
- readonly needsImprovement: "needs-improvement";
245
- readonly poor: "poor";
430
+ declare const VITAL_RATINGS: {
431
+ readonly good: "good";
432
+ readonly needsImprovement: "needs-improvement";
433
+ readonly poor: "poor";
246
434
  };
247
435
  /**
248
436
  * Web Vitals thresholds by metric (in milliseconds, except CLS which is unitless)
249
437
  */
250
- export declare const VITAL_THRESHOLDS: {
251
- readonly LCP: {
252
- readonly good: 2500;
253
- readonly poor: 4000;
254
- };
255
- readonly INP: {
256
- readonly good: 200;
257
- readonly poor: 500;
258
- };
259
- readonly CLS: {
260
- readonly good: 0.1;
261
- readonly poor: 0.25;
262
- };
263
- readonly TTFB: {
264
- readonly good: 800;
265
- readonly poor: 1800;
266
- };
267
- readonly FCP: {
268
- readonly good: 1800;
269
- readonly poor: 3000;
270
- };
438
+ declare const VITAL_THRESHOLDS: {
439
+ readonly LCP: {
440
+ readonly good: 2500;
441
+ readonly poor: 4000;
442
+ };
443
+ readonly INP: {
444
+ readonly good: 200;
445
+ readonly poor: 500;
446
+ };
447
+ readonly CLS: {
448
+ readonly good: 0.1;
449
+ readonly poor: 0.25;
450
+ };
451
+ readonly TTFB: {
452
+ readonly good: 800;
453
+ readonly poor: 1800;
454
+ };
455
+ readonly FCP: {
456
+ readonly good: 1800;
457
+ readonly poor: 3000;
458
+ };
271
459
  };
272
460
  /**
273
461
  * Navigation types for Web Vitals context
274
462
  */
275
- export declare const NAVIGATION_TYPES: {
276
- readonly navigate: "navigate";
277
- readonly reload: "reload";
278
- readonly backForward: "back-forward";
279
- readonly backForwardCache: "back-forward-cache";
280
- readonly prerender: "prerender";
281
- readonly restore: "restore";
463
+ declare const NAVIGATION_TYPES: {
464
+ readonly navigate: "navigate";
465
+ readonly reload: "reload";
466
+ readonly backForward: "back-forward";
467
+ readonly backForwardCache: "back-forward-cache";
468
+ readonly prerender: "prerender";
469
+ readonly restore: "restore";
282
470
  };
283
471
  /**
284
472
  * Form event types (Phase 2)
285
473
  */
286
- export declare const FORM_EVENT_TYPES: {
287
- readonly start: "start";
288
- readonly fieldFocus: "field_focus";
289
- readonly fieldBlur: "field_blur";
290
- readonly fieldError: "field_error";
291
- readonly submit: "submit";
292
- readonly abandon: "abandon";
474
+ declare const FORM_EVENT_TYPES: {
475
+ readonly start: "start";
476
+ readonly fieldFocus: "field_focus";
477
+ readonly fieldBlur: "field_blur";
478
+ readonly fieldError: "field_error";
479
+ readonly submit: "submit";
480
+ readonly abandon: "abandon";
293
481
  };
294
482
  /**
295
483
  * Form field types
296
484
  */
297
- export declare const FORM_FIELD_TYPES: {
298
- readonly text: "text";
299
- readonly email: "email";
300
- readonly password: "password";
301
- readonly tel: "tel";
302
- readonly number: "number";
303
- readonly url: "url";
304
- readonly textarea: "textarea";
305
- readonly select: "select";
306
- readonly checkbox: "checkbox";
307
- readonly radio: "radio";
308
- readonly date: "date";
309
- readonly file: "file";
310
- readonly hidden: "hidden";
311
- readonly submit: "submit";
312
- readonly other: "other";
485
+ declare const FORM_FIELD_TYPES: {
486
+ readonly text: "text";
487
+ readonly email: "email";
488
+ readonly password: "password";
489
+ readonly tel: "tel";
490
+ readonly number: "number";
491
+ readonly url: "url";
492
+ readonly textarea: "textarea";
493
+ readonly select: "select";
494
+ readonly checkbox: "checkbox";
495
+ readonly radio: "radio";
496
+ readonly date: "date";
497
+ readonly file: "file";
498
+ readonly hidden: "hidden";
499
+ readonly submit: "submit";
500
+ readonly other: "other";
313
501
  };
314
502
  /**
315
503
  * Deployment platform sources (Phase 2)
316
504
  */
317
- export declare const DEPLOYMENT_SOURCES: {
318
- readonly vercel: "vercel";
319
- readonly netlify: "netlify";
320
- readonly cloudflare: "cloudflare";
321
- readonly railway: "railway";
322
- readonly render: "render";
323
- readonly fly: "fly";
324
- readonly heroku: "heroku";
325
- readonly aws: "aws";
326
- readonly gcp: "gcp";
327
- readonly azure: "azure";
328
- readonly custom: "custom";
505
+ declare const DEPLOYMENT_SOURCES: {
506
+ readonly vercel: "vercel";
507
+ readonly netlify: "netlify";
508
+ readonly cloudflare: "cloudflare";
509
+ readonly railway: "railway";
510
+ readonly render: "render";
511
+ readonly fly: "fly";
512
+ readonly heroku: "heroku";
513
+ readonly aws: "aws";
514
+ readonly gcp: "gcp";
515
+ readonly azure: "azure";
516
+ readonly custom: "custom";
329
517
  };
330
518
  /**
331
519
  * Deployment environment variables by platform
332
520
  */
333
- export declare const DEPLOYMENT_ENV_VARS: {
334
- readonly vercel: {
335
- readonly deployId: "VERCEL_DEPLOYMENT_ID";
336
- readonly gitSha: "VERCEL_GIT_COMMIT_SHA";
337
- readonly gitBranch: "VERCEL_GIT_COMMIT_REF";
338
- readonly url: "VERCEL_URL";
339
- };
340
- readonly netlify: {
341
- readonly deployId: "DEPLOY_ID";
342
- readonly gitSha: "COMMIT_REF";
343
- readonly gitBranch: "BRANCH";
344
- readonly url: "DEPLOY_URL";
345
- };
346
- readonly cloudflare: {
347
- readonly deployId: "CF_PAGES_COMMIT_SHA";
348
- readonly gitSha: "CF_PAGES_COMMIT_SHA";
349
- readonly gitBranch: "CF_PAGES_BRANCH";
350
- readonly url: "CF_PAGES_URL";
351
- };
521
+ declare const DEPLOYMENT_ENV_VARS: {
522
+ readonly vercel: {
523
+ readonly deployId: "VERCEL_DEPLOYMENT_ID";
524
+ readonly gitSha: "VERCEL_GIT_COMMIT_SHA";
525
+ readonly gitBranch: "VERCEL_GIT_COMMIT_REF";
526
+ readonly url: "VERCEL_URL";
527
+ };
528
+ readonly netlify: {
529
+ readonly deployId: "DEPLOY_ID";
530
+ readonly gitSha: "COMMIT_REF";
531
+ readonly gitBranch: "BRANCH";
532
+ readonly url: "DEPLOY_URL";
533
+ };
534
+ readonly cloudflare: {
535
+ readonly deployId: "CF_PAGES_COMMIT_SHA";
536
+ readonly gitSha: "CF_PAGES_COMMIT_SHA";
537
+ readonly gitBranch: "CF_PAGES_BRANCH";
538
+ readonly url: "CF_PAGES_URL";
539
+ };
352
540
  };
353
541
  /**
354
542
  * HTTP status codes
355
543
  */
356
- export declare const HTTP_STATUS: {
357
- readonly ok: 200;
358
- readonly created: 201;
359
- readonly accepted: 202;
360
- readonly noContent: 204;
361
- readonly badRequest: 400;
362
- readonly unauthorized: 401;
363
- readonly forbidden: 403;
364
- readonly notFound: 404;
365
- readonly conflict: 409;
366
- readonly tooManyRequests: 429;
367
- readonly internalServerError: 500;
368
- readonly serviceUnavailable: 503;
544
+ declare const HTTP_STATUS: {
545
+ readonly ok: 200;
546
+ readonly created: 201;
547
+ readonly accepted: 202;
548
+ readonly noContent: 204;
549
+ readonly badRequest: 400;
550
+ readonly unauthorized: 401;
551
+ readonly forbidden: 403;
552
+ readonly notFound: 404;
553
+ readonly conflict: 409;
554
+ readonly tooManyRequests: 429;
555
+ readonly internalServerError: 500;
556
+ readonly serviceUnavailable: 503;
369
557
  };
370
558
  /**
371
559
  * API route paths
372
560
  */
373
- export declare const API_ROUTES: {
374
- readonly cliAuthToken: "/api/auth/cli/token";
375
- readonly cliAuthTokens: "/api/auth/cli/tokens";
376
- readonly cliValidate: "/api/auth/cli/validate";
377
- readonly cliToken: "/api/cli/token";
378
- readonly shareToken: (shareId: string) => string;
379
- readonly links: "/api/links";
380
- readonly linkRedirect: (slug: string) => string;
381
- readonly websites: "/api/websites";
382
- readonly websiteById: (id: string) => string;
383
- readonly websiteEvents: (id: string) => string;
384
- readonly websiteRecentEvents: (id: string) => string;
385
- readonly userOnboarding: "/api/user/onboarding";
386
- readonly userProfile: "/api/user/profile";
387
- readonly userEmailPreferences: "/api/me/email-preferences";
388
- readonly billingUsage: "/api/billing/usage";
389
- readonly billingCheckout: "/api/billing/checkout";
390
- readonly billingPortal: "/api/billing/portal";
391
- readonly billingWebhook: "/api/billing/webhook";
392
- readonly analyticsOverview: (websiteId: string) => string;
393
- readonly analyticsTimeseries: (websiteId: string) => string;
394
- readonly analyticsTopPages: (websiteId: string) => string;
395
- readonly analyticsTopReferrers: (websiteId: string) => string;
396
- readonly analyticsGeography: (websiteId: string) => string;
397
- readonly analyticsDevices: (websiteId: string) => string;
398
- readonly collect: "/collect";
399
- readonly collectBatch: "/collect/batch";
400
- readonly send: "/collect";
401
- readonly collectVitals: "/api/collect/vitals";
402
- readonly collectVitalsBatch: "/api/collect/vitals/batch";
403
- readonly collectForms: "/api/collect/forms";
404
- readonly collectFormsBatch: "/api/collect/forms/batch";
405
- readonly vitalsOverview: "/api/vitals/overview";
406
- readonly vitalsByPage: "/api/vitals/by-page";
407
- readonly vitalsTrend: "/api/vitals/trend";
408
- readonly vitalsRecent: "/api/vitals/recent";
409
- readonly vitalsPageBreakdown: "/api/vitals/page-breakdown";
410
- readonly formsConversions: "/api/forms/conversions";
411
- readonly formsFieldMetrics: "/api/forms/field-metrics";
412
- readonly formsFunnel: "/api/forms/funnel";
413
- readonly formsRecent: "/api/forms/recent";
414
- readonly deployments: "/api/deployments";
415
- readonly deploymentByWebsite: (id: string) => string;
416
- readonly deploymentLatest: (id: string) => string;
417
- readonly websiteVitals: (id: string) => string;
418
- readonly websiteForms: (id: string) => string;
419
- readonly websiteDeployments: (id: string) => string;
420
- readonly health: "/api/health";
421
- readonly healthIntegrations: "/api/health/integrations";
561
+ declare const API_ROUTES: {
562
+ readonly cliAuthToken: "/api/auth/cli/token";
563
+ readonly cliAuthTokens: "/api/auth/cli/tokens";
564
+ readonly cliValidate: "/api/auth/cli/validate";
565
+ readonly shareToken: (shareId: string) => string;
566
+ readonly links: "/api/links";
567
+ readonly linkRedirect: (slug: string) => string;
568
+ readonly websites: "/api/websites";
569
+ readonly websiteById: (id: string) => string;
570
+ readonly websiteEvents: (id: string) => string;
571
+ readonly websiteRecentEvents: (id: string) => string;
572
+ readonly userOnboarding: "/api/user/onboarding";
573
+ readonly userProfile: "/api/user/profile";
574
+ readonly userEmailPreferences: "/api/me/email-preferences";
575
+ readonly billingUsage: "/api/billing/usage";
576
+ readonly billingCheckout: "/api/billing/checkout";
577
+ readonly billingPortal: "/api/billing/portal";
578
+ readonly billingWebhook: "/api/billing/webhook";
579
+ readonly analyticsOverview: (websiteId: string) => string;
580
+ readonly analyticsTimeseries: (websiteId: string) => string;
581
+ readonly analyticsTopPages: (websiteId: string) => string;
582
+ readonly analyticsTopReferrers: (websiteId: string) => string;
583
+ readonly analyticsGeography: (websiteId: string) => string;
584
+ readonly analyticsDevices: (websiteId: string) => string;
585
+ readonly collect: "/collect";
586
+ readonly collectBatch: "/collect/batch";
587
+ readonly send: "/collect";
588
+ readonly collectVitals: "/api/collect/vitals";
589
+ readonly collectVitalsBatch: "/api/collect/vitals/batch";
590
+ readonly collectForms: "/api/collect/forms";
591
+ readonly collectFormsBatch: "/api/collect/forms/batch";
592
+ readonly vitalsOverview: "/api/vitals/overview";
593
+ readonly vitalsByPage: "/api/vitals/by-page";
594
+ readonly vitalsTrend: "/api/vitals/trend";
595
+ readonly vitalsRecent: "/api/vitals/recent";
596
+ readonly vitalsPageBreakdown: "/api/vitals/page-breakdown";
597
+ readonly formsConversions: "/api/forms/conversions";
598
+ readonly formsFieldMetrics: "/api/forms/field-metrics";
599
+ readonly formsFunnel: "/api/forms/funnel";
600
+ readonly formsRecent: "/api/forms/recent";
601
+ readonly deployments: "/api/deployments";
602
+ readonly deploymentByWebsite: (id: string) => string;
603
+ readonly deploymentCompare: (id: string) => string;
604
+ readonly deploymentLatest: (id: string) => string;
605
+ readonly health: "/api/health";
606
+ readonly healthIntegrations: "/api/health/integrations";
422
607
  };
423
608
  /**
424
609
  * Onboarding step identifiers
425
610
  */
426
- export declare const ONBOARDING_STEPS: {
427
- readonly welcome: "welcome";
428
- readonly createWebsite: "create-website";
429
- readonly installTracking: "install-tracking";
430
- readonly verify: "verify";
431
- readonly complete: "complete";
432
- readonly skipped: "skipped";
611
+ declare const ONBOARDING_STEPS: {
612
+ readonly welcome: "welcome";
613
+ readonly createWebsite: "create-website";
614
+ readonly installTracking: "install-tracking";
615
+ readonly verify: "verify";
616
+ readonly complete: "complete";
617
+ readonly skipped: "skipped";
433
618
  };
434
619
  /**
435
620
  * CLI token statuses
436
621
  */
437
- export declare const CLI_TOKEN_STATUS: {
438
- readonly pending: "pending";
439
- readonly used: "used";
440
- readonly expired: "expired";
441
- readonly revoked: "revoked";
622
+ declare const CLI_TOKEN_STATUS: {
623
+ readonly pending: "pending";
624
+ readonly used: "used";
625
+ readonly expired: "expired";
626
+ readonly revoked: "revoked";
442
627
  };
443
628
  /**
444
629
  * User roles
445
630
  */
446
- export declare const USER_ROLES: {
447
- readonly admin: "admin";
448
- readonly user: "user";
449
- readonly viewer: "viewer";
631
+ declare const USER_ROLES: {
632
+ readonly admin: "admin";
633
+ readonly user: "user";
634
+ readonly viewer: "viewer";
450
635
  };
451
636
  /**
452
637
  * Framework package names
453
638
  */
454
- export declare const FRAMEWORK_PACKAGES: {
455
- readonly nextjs: "@entrolytics/nextjs-sdk";
456
- readonly react: "@entrolytics/react-sdk";
457
- readonly vue: "@entrolytics/vue-sdk";
458
- readonly svelte: "@entrolytics/svelte-sdk";
459
- readonly astro: "@entrolytics/astro-sdk";
460
- readonly node: "@entrolytics/node-sdk";
639
+ declare const FRAMEWORK_PACKAGES: {
640
+ readonly nextjs: "@entrolytics/nextjs-sdk";
641
+ readonly react: "@entrolytics/react-sdk";
642
+ readonly vue: "@entrolytics/vue-sdk";
643
+ readonly svelte: "@entrolytics/svelte-sdk";
644
+ readonly astro: "@entrolytics/astro-sdk";
645
+ readonly node: "@entrolytics/node-sdk";
461
646
  };
462
647
  /**
463
648
  * Framework detection patterns
464
649
  */
465
- export declare const FRAMEWORK_PATTERNS: {
466
- readonly nextjs: {
467
- readonly files: readonly ["next.config.js", "next.config.mjs", "next.config.ts"];
468
- readonly dependencies: readonly ["next"];
469
- };
470
- readonly react: {
471
- readonly files: readonly ["vite.config.js", "vite.config.ts"];
472
- readonly dependencies: readonly ["react", "vite"];
473
- };
474
- readonly vue: {
475
- readonly files: readonly ["vite.config.js", "vite.config.ts"];
476
- readonly dependencies: readonly ["vue", "vite"];
477
- };
478
- readonly svelte: {
479
- readonly files: readonly ["svelte.config.js", "svelte.config.ts"];
480
- readonly dependencies: readonly ["svelte"];
481
- };
482
- readonly astro: {
483
- readonly files: readonly ["astro.config.mjs", "astro.config.ts"];
484
- readonly dependencies: readonly ["astro"];
485
- };
650
+ declare const FRAMEWORK_PATTERNS: {
651
+ readonly nextjs: {
652
+ readonly files: readonly ["next.config.js", "next.config.mjs", "next.config.ts"];
653
+ readonly dependencies: readonly ["next"];
654
+ };
655
+ readonly react: {
656
+ readonly files: readonly ["vite.config.js", "vite.config.ts"];
657
+ readonly dependencies: readonly ["react", "vite"];
658
+ };
659
+ readonly vue: {
660
+ readonly files: readonly ["vite.config.js", "vite.config.ts"];
661
+ readonly dependencies: readonly ["vue", "vite"];
662
+ };
663
+ readonly svelte: {
664
+ readonly files: readonly ["svelte.config.js", "svelte.config.ts"];
665
+ readonly dependencies: readonly ["svelte"];
666
+ };
667
+ readonly astro: {
668
+ readonly files: readonly ["astro.config.mjs", "astro.config.ts"];
669
+ readonly dependencies: readonly ["astro"];
670
+ };
486
671
  };
487
672
  /**
488
673
  * Rate limiting configuration
489
674
  * Updated to match server-side implementation
490
675
  */
491
- export declare const RATE_LIMITS: {
492
- readonly cliTokenExchange: {
493
- readonly windowSeconds: 60;
494
- readonly maxRequests: 5;
495
- };
496
- readonly shareTokenGeneration: {
497
- readonly windowSeconds: 60;
498
- readonly maxRequests: 10;
499
- };
500
- readonly linkCreation: {
501
- readonly windowSeconds: 60;
502
- readonly maxRequests: 20;
503
- };
504
- readonly linkRedirect: {
505
- readonly windowSeconds: 60;
506
- readonly maxRequests: 100;
507
- };
508
- readonly apiGeneral: {
509
- readonly windowSeconds: 60;
510
- readonly maxRequests: 100;
511
- };
512
- readonly cliTokenGeneration: {
513
- readonly windowMs: 3600000;
514
- readonly maxRequests: 10;
515
- };
516
- readonly cliValidation: {
517
- readonly windowMs: 3600000;
518
- readonly maxRequests: 100;
519
- };
520
- readonly eventCollection: {
521
- readonly windowMs: 60000;
522
- readonly maxRequests: 1000;
523
- };
676
+ declare const RATE_LIMITS: {
677
+ readonly cliTokenExchange: {
678
+ readonly windowSeconds: 60;
679
+ readonly maxRequests: 5;
680
+ };
681
+ readonly shareTokenGeneration: {
682
+ readonly windowSeconds: 60;
683
+ readonly maxRequests: 10;
684
+ };
685
+ readonly linkCreation: {
686
+ readonly windowSeconds: 60;
687
+ readonly maxRequests: 20;
688
+ };
689
+ readonly linkRedirect: {
690
+ readonly windowSeconds: 60;
691
+ readonly maxRequests: 100;
692
+ };
693
+ readonly apiGeneral: {
694
+ readonly windowSeconds: 60;
695
+ readonly maxRequests: 100;
696
+ };
524
697
  };
525
698
  /**
526
699
  * Error messages
527
700
  */
528
- export declare const ERROR_MESSAGES: {
529
- readonly unauthorized: "Unauthorized access";
530
- readonly forbidden: "Access forbidden";
531
- readonly tokenExpired: "Token has expired";
532
- readonly tokenInvalid: "Invalid token";
533
- readonly tokenNotFound: "Token not found";
534
- readonly tokenAlreadyUsed: "Token has already been used";
535
- readonly tokenRevoked: "Token has been revoked";
536
- readonly tokenMissingJti: "Token missing JTI - please re-authenticate";
537
- readonly userBanned: "User account has been banned";
538
- readonly userDeleted: "User account has been deleted";
539
- readonly shareTokenExpired: "Share token has expired";
540
- readonly shareTokenRevoked: "Share has been revoked";
541
- readonly shareTokenInvalid: "Invalid share token";
542
- readonly invalidUrl: "Invalid URL provided";
543
- readonly invalidUrlProtocol: "URL must use http or https protocol";
544
- readonly openRedirectBlocked: "Open redirect attempt blocked";
545
- readonly invalidInput: "Invalid input provided";
546
- readonly missingRequired: "Missing required fields";
547
- readonly invalidFormat: "Invalid format";
548
- readonly notFound: "Resource not found";
549
- readonly websiteNotFound: "Website not found";
550
- readonly userNotFound: "User not found";
551
- readonly linkNotFound: "Link not found";
552
- readonly tooManyRequests: "Too many requests. Please try again later.";
553
- readonly rateLimitExceeded: "Rate limit exceeded";
554
- readonly internalError: "Internal server error";
555
- readonly serviceUnavailable: "Service temporarily unavailable";
701
+ declare const ERROR_MESSAGES: {
702
+ readonly unauthorized: "Unauthorized access";
703
+ readonly forbidden: "Access forbidden";
704
+ readonly tokenExpired: "Token has expired";
705
+ readonly tokenInvalid: "Invalid token";
706
+ readonly tokenNotFound: "Token not found";
707
+ readonly tokenAlreadyUsed: "Token has already been used";
708
+ readonly tokenRevoked: "Token has been revoked";
709
+ readonly tokenMissingJti: "Token missing JTI - please re-authenticate";
710
+ readonly userBanned: "User account has been banned";
711
+ readonly userDeleted: "User account has been deleted";
712
+ readonly shareTokenExpired: "Share token has expired";
713
+ readonly shareTokenRevoked: "Share has been revoked";
714
+ readonly shareTokenInvalid: "Invalid share token";
715
+ readonly invalidUrl: "Invalid URL provided";
716
+ readonly invalidUrlProtocol: "URL must use http or https protocol";
717
+ readonly openRedirectBlocked: "Open redirect attempt blocked";
718
+ readonly invalidInput: "Invalid input provided";
719
+ readonly missingRequired: "Missing required fields";
720
+ readonly invalidFormat: "Invalid format";
721
+ readonly notFound: "Resource not found";
722
+ readonly websiteNotFound: "Website not found";
723
+ readonly userNotFound: "User not found";
724
+ readonly linkNotFound: "Link not found";
725
+ readonly tooManyRequests: "Too many requests. Please try again later.";
726
+ readonly rateLimitExceeded: "Rate limit exceeded";
727
+ readonly internalError: "Internal server error";
728
+ readonly serviceUnavailable: "Service temporarily unavailable";
556
729
  };
557
730
  /**
558
731
  * Success messages
559
732
  */
560
- export declare const SUCCESS_MESSAGES: {
561
- readonly tokenGenerated: "Setup token generated successfully";
562
- readonly tokenValidated: "Token validated successfully";
563
- readonly tokenRevoked: "Token revoked successfully";
564
- readonly allTokensRevoked: "All tokens revoked successfully";
565
- readonly websiteCreated: "Website created successfully";
566
- readonly linkCreated: "Link created successfully";
567
- readonly shareCreated: "Share created successfully";
568
- readonly onboardingComplete: "Onboarding completed successfully";
569
- readonly setupComplete: "Setup completed successfully";
733
+ declare const SUCCESS_MESSAGES: {
734
+ readonly tokenGenerated: "Setup token generated successfully";
735
+ readonly tokenValidated: "Token validated successfully";
736
+ readonly tokenRevoked: "Token revoked successfully";
737
+ readonly allTokensRevoked: "All tokens revoked successfully";
738
+ readonly websiteCreated: "Website created successfully";
739
+ readonly linkCreated: "Link created successfully";
740
+ readonly shareCreated: "Share created successfully";
741
+ readonly onboardingComplete: "Onboarding completed successfully";
742
+ readonly setupComplete: "Setup completed successfully";
570
743
  };
571
744
  /**
572
745
  * CLI Access Token metadata
573
746
  */
574
- export interface CliAccessTokenMetadata {
575
- jti: string;
576
- createdAt: string;
577
- expiresAt: string;
578
- lastUsedAt: string | null;
579
- ipAddress: string | null;
580
- userAgent: string | null;
747
+ interface CliAccessTokenMetadata {
748
+ jti: string;
749
+ createdAt: string;
750
+ expiresAt: string;
751
+ lastUsedAt: string | null;
752
+ ipAddress: string | null;
753
+ userAgent: string | null;
581
754
  }
582
- export type Framework = keyof typeof ENV_VAR_NAMES;
583
- export type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];
584
- export type SdkEventType = (typeof SDK_EVENT_TYPES)[keyof typeof SDK_EVENT_TYPES];
585
- export type OnboardingStep = (typeof ONBOARDING_STEPS)[keyof typeof ONBOARDING_STEPS];
586
- export type CliTokenStatus = (typeof CLI_TOKEN_STATUS)[keyof typeof CLI_TOKEN_STATUS];
587
- export type UserRole = (typeof USER_ROLES)[keyof typeof USER_ROLES];
588
- export type PlanId = keyof typeof PLANS;
589
- export type Plan = (typeof PLANS)[PlanId];
590
- export type PlanFeature = keyof typeof PLAN_FEATURES;
591
- export type BillingError = (typeof BILLING_ERRORS)[keyof typeof BILLING_ERRORS];
592
- export type VitalType = (typeof VITAL_TYPES)[keyof typeof VITAL_TYPES];
593
- export type VitalRating = (typeof VITAL_RATINGS)[keyof typeof VITAL_RATINGS];
594
- export type NavigationType = (typeof NAVIGATION_TYPES)[keyof typeof NAVIGATION_TYPES];
595
- export type FormEventType = (typeof FORM_EVENT_TYPES)[keyof typeof FORM_EVENT_TYPES];
596
- export type FormFieldType = (typeof FORM_FIELD_TYPES)[keyof typeof FORM_FIELD_TYPES];
597
- export type DeploymentSource = (typeof DEPLOYMENT_SOURCES)[keyof typeof DEPLOYMENT_SOURCES];
598
- export declare const EVENT_TYPE_VALUES: [EventType, ...EventType[]];
599
- export declare const SDK_EVENT_TYPE_VALUES: [SdkEventType, ...SdkEventType[]];
600
- export declare const VITAL_TYPE_VALUES: [VitalType, ...VitalType[]];
601
- export declare const VITAL_RATING_VALUES: [VitalRating, ...VitalRating[]];
602
- export declare const NAVIGATION_TYPE_VALUES: [NavigationType, ...NavigationType[]];
603
- export declare const FORM_EVENT_TYPE_VALUES: [FormEventType, ...FormEventType[]];
604
- export declare const FORM_FIELD_TYPE_VALUES: [FormFieldType, ...FormFieldType[]];
605
- export declare const DEPLOYMENT_SOURCE_VALUES: [DeploymentSource, ...DeploymentSource[]];
606
- export declare function isEventType(value: string): value is EventType;
607
- export declare function isSdkEventType(value: string): value is SdkEventType;
608
- export declare function isVitalType(value: string): value is VitalType;
609
- export declare function isVitalRating(value: string): value is VitalRating;
610
- export declare function isNavigationType(value: string): value is NavigationType;
611
- export declare function isFormEventType(value: string): value is FormEventType;
612
- export declare function isFormFieldType(value: string): value is FormFieldType;
613
- export declare function isDeploymentSource(value: string): value is DeploymentSource;
614
- export declare function normalizeDeploymentSource(value: string | null | undefined): DeploymentSource;
755
+ type Framework = keyof typeof ENV_VAR_NAMES;
756
+ type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];
757
+ type SdkEventType = (typeof SDK_EVENT_TYPES)[keyof typeof SDK_EVENT_TYPES];
758
+ type OnboardingStep = (typeof ONBOARDING_STEPS)[keyof typeof ONBOARDING_STEPS];
759
+ type CliTokenStatus = (typeof CLI_TOKEN_STATUS)[keyof typeof CLI_TOKEN_STATUS];
760
+ type UserRole = (typeof USER_ROLES)[keyof typeof USER_ROLES];
761
+ type PlanId = keyof typeof PLANS;
762
+ type Plan = (typeof PLANS)[PlanId];
763
+ type PlanFeature = keyof typeof PLAN_FEATURES;
764
+ type BillingError = (typeof BILLING_ERRORS)[keyof typeof BILLING_ERRORS];
765
+ type VitalType = (typeof VITAL_TYPES)[keyof typeof VITAL_TYPES];
766
+ type VitalRating = (typeof VITAL_RATINGS)[keyof typeof VITAL_RATINGS];
767
+ type NavigationType = (typeof NAVIGATION_TYPES)[keyof typeof NAVIGATION_TYPES];
768
+ type FormEventType = (typeof FORM_EVENT_TYPES)[keyof typeof FORM_EVENT_TYPES];
769
+ type FormFieldType = (typeof FORM_FIELD_TYPES)[keyof typeof FORM_FIELD_TYPES];
770
+ type DeploymentSource = (typeof DEPLOYMENT_SOURCES)[keyof typeof DEPLOYMENT_SOURCES];
771
+ declare const EVENT_TYPE_VALUES: [EventType, ...EventType[]];
772
+ declare const SDK_EVENT_TYPE_VALUES: [SdkEventType, ...SdkEventType[]];
773
+ declare const VITAL_TYPE_VALUES: [VitalType, ...VitalType[]];
774
+ declare const VITAL_RATING_VALUES: [VitalRating, ...VitalRating[]];
775
+ declare const NAVIGATION_TYPE_VALUES: [NavigationType, ...NavigationType[]];
776
+ declare const FORM_EVENT_TYPE_VALUES: [FormEventType, ...FormEventType[]];
777
+ declare const FORM_FIELD_TYPE_VALUES: [FormFieldType, ...FormFieldType[]];
778
+ declare const DEPLOYMENT_SOURCE_VALUES: [DeploymentSource, ...DeploymentSource[]];
779
+ declare function isEventType(value: string): value is EventType;
780
+ declare function isSdkEventType(value: string): value is SdkEventType;
781
+ declare function isVitalType(value: string): value is VitalType;
782
+ declare function isVitalRating(value: string): value is VitalRating;
783
+ declare function isNavigationType(value: string): value is NavigationType;
784
+ declare function isFormEventType(value: string): value is FormEventType;
785
+ declare function isFormFieldType(value: string): value is FormFieldType;
786
+ declare function isDeploymentSource(value: string): value is DeploymentSource;
787
+ declare function normalizeDeploymentSource(value: string | null | undefined): DeploymentSource;
615
788
  /**
616
789
  * Web Vital data structure for SDK tracking
617
790
  */
618
- export interface WebVitalData {
619
- metric: VitalType;
620
- value: number;
621
- rating: VitalRating;
622
- delta?: number;
623
- id?: string;
624
- navigationType?: NavigationType;
625
- attribution?: Record<string, unknown>;
626
- url?: string;
627
- path?: string;
791
+ interface WebVitalData {
792
+ metric: VitalType;
793
+ value: number;
794
+ rating: VitalRating;
795
+ delta?: number;
796
+ id?: string;
797
+ navigationType?: NavigationType;
798
+ attribution?: Record<string, unknown>;
799
+ url?: string;
800
+ path?: string;
628
801
  }
629
802
  /**
630
803
  * Form event data structure for SDK tracking
631
804
  */
632
- export interface FormEventData {
633
- eventType: FormEventType;
634
- formId: string;
635
- formName?: string;
636
- urlPath: string;
637
- fieldName?: string;
638
- fieldType?: FormFieldType;
639
- fieldIndex?: number;
640
- timeOnField?: number;
641
- timeSinceStart?: number;
642
- errorMessage?: string;
643
- success?: boolean;
805
+ interface FormEventData {
806
+ eventType: FormEventType;
807
+ formId: string;
808
+ formName?: string;
809
+ urlPath: string;
810
+ fieldName?: string;
811
+ fieldType?: FormFieldType;
812
+ fieldIndex?: number;
813
+ timeOnField?: number;
814
+ timeSinceStart?: number;
815
+ errorMessage?: string;
816
+ success?: boolean;
644
817
  }
645
818
  /**
646
819
  * Deployment context for SDK tracking
647
820
  */
648
- export interface DeploymentContext {
649
- deployId: string;
650
- gitSha?: string;
651
- gitBranch?: string;
652
- deployUrl?: string;
653
- source?: DeploymentSource;
821
+ interface DeploymentContext {
822
+ deployId: string;
823
+ gitSha?: string;
824
+ gitBranch?: string;
825
+ deployUrl?: string;
826
+ source?: DeploymentSource;
654
827
  }
655
828
  /**
656
829
  * Utility functions
657
830
  */
658
- export declare function getEnvVarNames(framework: Framework): {
659
- readonly websiteId: "NEXT_PUBLIC_ENTROLYTICS_WEBSITE_ID";
660
- readonly host: "NEXT_PUBLIC_ENTROLYTICS_HOST";
661
- readonly envFile: ".env.local";
831
+ declare function getEnvVarNames(framework: Framework): {
832
+ readonly websiteId: "NEXT_PUBLIC_ENTROLYTICS_WEBSITE_ID";
833
+ readonly host: "NEXT_PUBLIC_ENTROLYTICS_HOST";
834
+ readonly envFile: ".env.local";
662
835
  } | {
663
- readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
664
- readonly host: "VITE_ENTROLYTICS_HOST";
665
- readonly envFile: ".env";
666
- readonly fallback: {
667
- readonly websiteId: "REACT_APP_ENTROLYTICS_WEBSITE_ID";
668
- readonly host: "REACT_APP_ENTROLYTICS_HOST";
669
- };
836
+ readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
837
+ readonly host: "VITE_ENTROLYTICS_HOST";
838
+ readonly envFile: ".env";
670
839
  } | {
671
- readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
672
- readonly host: "VITE_ENTROLYTICS_HOST";
673
- readonly envFile: ".env";
840
+ readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
841
+ readonly host: "VITE_ENTROLYTICS_HOST";
842
+ readonly envFile: ".env";
674
843
  } | {
675
- readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
676
- readonly host: "PUBLIC_ENTROLYTICS_HOST";
677
- readonly envFile: ".env";
844
+ readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
845
+ readonly host: "PUBLIC_ENTROLYTICS_HOST";
846
+ readonly envFile: ".env";
678
847
  } | {
679
- readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
680
- readonly host: "PUBLIC_ENTROLYTICS_HOST";
681
- readonly envFile: ".env";
848
+ readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
849
+ readonly host: "PUBLIC_ENTROLYTICS_HOST";
850
+ readonly envFile: ".env";
682
851
  } | {
683
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
684
- readonly host: "ENTROLYTICS_HOST";
685
- readonly envFile: ".env";
852
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
853
+ readonly host: "ENTROLYTICS_HOST";
854
+ readonly envFile: ".env";
686
855
  } | {
687
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
688
- readonly host: "ENTROLYTICS_HOST";
689
- readonly envFile: ".env";
856
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
857
+ readonly host: "ENTROLYTICS_HOST";
858
+ readonly envFile: ".env";
690
859
  } | {
691
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
692
- readonly host: "ENTROLYTICS_HOST";
693
- readonly envFile: ".env";
860
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
861
+ readonly host: "ENTROLYTICS_HOST";
862
+ readonly envFile: ".env";
694
863
  } | {
695
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
696
- readonly host: "ENTROLYTICS_HOST";
697
- readonly envFile: ".env";
864
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
865
+ readonly host: "ENTROLYTICS_HOST";
866
+ readonly envFile: ".env";
698
867
  } | {
699
- readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
700
- readonly host: "ENTROLYTICS_HOST";
701
- readonly envFile: ".env";
868
+ readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
869
+ readonly host: "ENTROLYTICS_HOST";
870
+ readonly envFile: ".env";
702
871
  };
703
- export declare function getFrameworkPackage(framework: Framework): "@entrolytics/nextjs-sdk" | "@entrolytics/react-sdk" | "@entrolytics/vue-sdk" | "@entrolytics/svelte-sdk" | "@entrolytics/astro-sdk" | "@entrolytics/node-sdk";
704
- export declare function isValidFramework(framework: string): framework is Framework;
705
- export declare function getApiRoute(route: keyof typeof API_ROUTES, ...args: string[]): string;
872
+ declare function getFrameworkPackage(framework: Framework): "@entrolytics/astro-sdk" | "@entrolytics/nextjs-sdk" | "@entrolytics/node-sdk" | "@entrolytics/react-sdk" | "@entrolytics/svelte-sdk" | "@entrolytics/vue-sdk";
873
+ declare function isValidFramework(framework: string): framework is Framework;
874
+ declare function getApiRoute(route: keyof typeof API_ROUTES, ...args: string[]): string;
706
875
  /**
707
876
  * Get plan by ID
708
877
  */
709
- export declare function getPlan(planId: PlanId): Plan;
878
+ declare function getPlan(planId: PlanId): Plan;
710
879
  /**
711
880
  * Check if a feature is available for a plan
712
881
  */
713
- export declare function isPlanFeatureEnabled(planId: PlanId, feature: PlanFeature): boolean;
882
+ declare function isPlanFeatureEnabled(planId: PlanId, feature: PlanFeature): boolean;
714
883
  /**
715
884
  * Get plan limit value (-1 means unlimited)
716
885
  */
717
- export declare function getPlanLimit(planId: PlanId, limit: keyof Plan["limits"]): number;
886
+ declare function getPlanLimit(planId: PlanId, limit: keyof Plan["limits"]): number;
718
887
  /**
719
888
  * Check if usage is at warning threshold
720
889
  */
721
- export declare function isUsageWarning(current: number, limit: number): boolean;
890
+ declare function isUsageWarning(current: number, limit: number): boolean;
722
891
  /**
723
892
  * Check if usage is at critical threshold
724
893
  */
725
- export declare function isUsageCritical(current: number, limit: number): boolean;
894
+ declare function isUsageCritical(current: number, limit: number): boolean;
726
895
  /**
727
896
  * Calculate Web Vital rating from value (Phase 2)
728
897
  */
729
- export declare function getVitalRating(metric: VitalType, value: number): VitalRating;
898
+ declare function getVitalRating(metric: VitalType, value: number): VitalRating;
730
899
  /**
731
900
  * Detect deployment context from environment variables (Phase 2)
732
901
  * Works in Node.js environments only - returns null in browser
733
902
  */
734
- export declare function detectDeploymentContext(): DeploymentContext | null;
735
- export * from "./analytics-types";
736
- export * from "./event-protocol";
903
+ declare function detectDeploymentContext(): DeploymentContext | null;
904
+ //#endregion
905
+ export { API_ENDPOINTS, API_ROUTES, ActivePage, BILLING_ERRORS, BillingError, CLI_CONFIG, CLI_TOKEN_STATUS, CliAccessTokenMetadata, CliTokenStatus, DEFAULT_API_HOST, DEPLOYMENT_ENV_VARS, DEPLOYMENT_SOURCES, DEPLOYMENT_SOURCE_VALUES, DateRangeFilter, DeploymentContext, DeploymentSource, DeviceStats, DeviceType, ENV_VAR_NAMES, ERROR_MESSAGES, EVENT_TYPES, EVENT_TYPE_VALUES, EntrolyticsEvent, EventDBRow, EventPayload, EventType, FORM_EVENT_TYPES, FORM_EVENT_TYPE_VALUES, FORM_FIELD_TYPES, FORM_FIELD_TYPE_VALUES, FRAMEWORK_PACKAGES, FRAMEWORK_PATTERNS, FormEventData, FormEventType, FormFieldType, Framework, GeoStats, HTTP_STATUS, NAVIGATION_TYPES, NAVIGATION_TYPE_VALUES, NavigationType, ONBOARDING_STEPS, OnboardingStep, OverviewStats, PLANS, PLAN_FEATURES, Plan, PlanFeature, PlanId, RATE_LIMITS, RealtimeEvent, RealtimeStats, Referrer, SDK_EVENT_TYPES, SDK_EVENT_TYPE_VALUES, SUCCESS_MESSAGES, SdkEventType, TimeseriesData, TopPage, USAGE_THRESHOLDS, USER_ROLES, UserRole, VITAL_RATINGS, VITAL_RATING_VALUES, VITAL_THRESHOLDS, VITAL_TYPES, VITAL_TYPE_VALUES, VitalRating, VitalType, WebVitalData, detectDeploymentContext, getApiRoute, getEnvVarNames, getFrameworkPackage, getPlan, getPlanLimit, getVitalRating, isDeploymentSource, isEventType, isFormEventType, isFormFieldType, isNavigationType, isPlanFeatureEnabled, isSdkEventType, isUsageCritical, isUsageWarning, isValidFramework, isVitalRating, isVitalType, normalizeDeploymentSource };
737
906
  //# sourceMappingURL=index.d.ts.map