@entrolytics/shared 3.0.1 → 3.1.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.
- package/package.json +18 -15
- package/dist/index.cjs +0 -773
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -866
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts +0 -866
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -716
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
DELETED
|
@@ -1,866 +0,0 @@
|
|
|
1
|
-
//#region src/analytics-types.d.ts
|
|
2
|
-
export 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
|
-
export interface OverviewStats {
|
|
14
|
-
pageviews: number;
|
|
15
|
-
visitors: number;
|
|
16
|
-
sessions: number;
|
|
17
|
-
pagesPerVisitor: number;
|
|
18
|
-
avgLoadTime: number;
|
|
19
|
-
}
|
|
20
|
-
export interface TimeseriesData {
|
|
21
|
-
date: Date;
|
|
22
|
-
pageviews: number;
|
|
23
|
-
visitors: number;
|
|
24
|
-
sessions: number;
|
|
25
|
-
}
|
|
26
|
-
export interface TopPage {
|
|
27
|
-
path: string;
|
|
28
|
-
views: number;
|
|
29
|
-
uniqueVisitors: number;
|
|
30
|
-
avgLoadTime: number;
|
|
31
|
-
p95LoadTime: number;
|
|
32
|
-
}
|
|
33
|
-
export interface Referrer {
|
|
34
|
-
referrerDomain: string;
|
|
35
|
-
visits: number;
|
|
36
|
-
uniqueVisitors: number;
|
|
37
|
-
}
|
|
38
|
-
export interface DeviceStats {
|
|
39
|
-
deviceType: string;
|
|
40
|
-
browser: string;
|
|
41
|
-
os: string;
|
|
42
|
-
pageviews: number;
|
|
43
|
-
uniqueVisitors: number;
|
|
44
|
-
}
|
|
45
|
-
export interface GeoStats {
|
|
46
|
-
country: string;
|
|
47
|
-
city: string;
|
|
48
|
-
pageviews: number;
|
|
49
|
-
uniqueVisitors: number;
|
|
50
|
-
}
|
|
51
|
-
export interface RealtimeStats {
|
|
52
|
-
visitors: number;
|
|
53
|
-
sessions: number;
|
|
54
|
-
pageviews: number;
|
|
55
|
-
}
|
|
56
|
-
export 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
|
-
export interface ActivePage {
|
|
67
|
-
path: string;
|
|
68
|
-
viewers: number;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Core event interface
|
|
72
|
-
*/
|
|
73
|
-
export 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
|
-
export 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
|
-
export 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
|
-
export type DeviceType = "desktop" | "mobile" | "tablet" | "server" | "unknown";
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/index.d.ts
|
|
193
|
-
/**
|
|
194
|
-
* Shared constants across Entrolytics ecosystem
|
|
195
|
-
* Used by: CLI, SDKs, Dashboard, Integrations
|
|
196
|
-
*/
|
|
197
|
-
/**
|
|
198
|
-
* Plan definitions and limits
|
|
199
|
-
*/
|
|
200
|
-
export declare const PLANS: {
|
|
201
|
-
readonly starter: {
|
|
202
|
-
readonly id: "starter";
|
|
203
|
-
readonly name: "Starter";
|
|
204
|
-
readonly price: 0;
|
|
205
|
-
readonly limits: {
|
|
206
|
-
readonly pageviewsPerMonth: 25_000;
|
|
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: 250_000;
|
|
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: 1_000_000;
|
|
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
|
-
};
|
|
284
|
-
};
|
|
285
|
-
/**
|
|
286
|
-
* Plan feature names for display
|
|
287
|
-
*/
|
|
288
|
-
export 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";
|
|
298
|
-
};
|
|
299
|
-
/**
|
|
300
|
-
* Usage warning thresholds (percentages)
|
|
301
|
-
*/
|
|
302
|
-
export declare const USAGE_THRESHOLDS: {
|
|
303
|
-
readonly warning: 90;
|
|
304
|
-
readonly critical: 95;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* Billing-related error codes
|
|
308
|
-
*/
|
|
309
|
-
export 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";
|
|
315
|
-
};
|
|
316
|
-
/**
|
|
317
|
-
* API endpoint configuration
|
|
318
|
-
*/
|
|
319
|
-
export declare const API_ENDPOINTS: {
|
|
320
|
-
readonly production: "https://api.entrolytics.click";
|
|
321
|
-
readonly development: "http://localhost:3001";
|
|
322
|
-
};
|
|
323
|
-
/**
|
|
324
|
-
* Default API host
|
|
325
|
-
*/
|
|
326
|
-
export declare const DEFAULT_API_HOST: string;
|
|
327
|
-
/**
|
|
328
|
-
* Environment variable naming conventions by framework
|
|
329
|
-
*/
|
|
330
|
-
export 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
|
-
};
|
|
381
|
-
};
|
|
382
|
-
/**
|
|
383
|
-
* CLI configuration constants
|
|
384
|
-
*/
|
|
385
|
-
export 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";
|
|
391
|
-
};
|
|
392
|
-
/**
|
|
393
|
-
* Core event types - matches backend protocol values exactly
|
|
394
|
-
* Used by: API Server, SDKs, CLI, worker processes
|
|
395
|
-
* See: entrolytics/packages/protocol/src/events.ts
|
|
396
|
-
*/
|
|
397
|
-
export declare const EVENT_TYPES: {
|
|
398
|
-
readonly pageView: "pageview";
|
|
399
|
-
readonly custom: "custom_event";
|
|
400
|
-
readonly click: "click";
|
|
401
|
-
};
|
|
402
|
-
/**
|
|
403
|
-
* Extended event types for SDK-level semantics
|
|
404
|
-
* These are higher-level event categories used by SDKs
|
|
405
|
-
* They map to the core EVENT_TYPES when sent to the backend
|
|
406
|
-
*/
|
|
407
|
-
export 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";
|
|
414
|
-
};
|
|
415
|
-
/**
|
|
416
|
-
* Web Vitals metric types (Phase 2)
|
|
417
|
-
* Core Web Vitals: LCP, INP, CLS
|
|
418
|
-
* Additional: TTFB, FCP
|
|
419
|
-
*/
|
|
420
|
-
export declare const VITAL_TYPES: {
|
|
421
|
-
readonly LCP: "LCP";
|
|
422
|
-
readonly INP: "INP";
|
|
423
|
-
readonly CLS: "CLS";
|
|
424
|
-
readonly TTFB: "TTFB";
|
|
425
|
-
readonly FCP: "FCP";
|
|
426
|
-
};
|
|
427
|
-
/**
|
|
428
|
-
* Web Vitals rating thresholds
|
|
429
|
-
*/
|
|
430
|
-
export declare const VITAL_RATINGS: {
|
|
431
|
-
readonly good: "good";
|
|
432
|
-
readonly needsImprovement: "needs-improvement";
|
|
433
|
-
readonly poor: "poor";
|
|
434
|
-
};
|
|
435
|
-
/**
|
|
436
|
-
* Web Vitals thresholds by metric (in milliseconds, except CLS which is unitless)
|
|
437
|
-
*/
|
|
438
|
-
export 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
|
-
};
|
|
459
|
-
};
|
|
460
|
-
/**
|
|
461
|
-
* Navigation types for Web Vitals context
|
|
462
|
-
*/
|
|
463
|
-
export 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";
|
|
470
|
-
readonly softNavigation: "soft-navigation";
|
|
471
|
-
};
|
|
472
|
-
/**
|
|
473
|
-
* Form event types (Phase 2)
|
|
474
|
-
*/
|
|
475
|
-
export declare const FORM_EVENT_TYPES: {
|
|
476
|
-
readonly start: "start";
|
|
477
|
-
readonly fieldFocus: "field_focus";
|
|
478
|
-
readonly fieldBlur: "field_blur";
|
|
479
|
-
readonly fieldError: "field_error";
|
|
480
|
-
readonly submit: "submit";
|
|
481
|
-
readonly abandon: "abandon";
|
|
482
|
-
};
|
|
483
|
-
/**
|
|
484
|
-
* Form field types
|
|
485
|
-
*/
|
|
486
|
-
export declare const FORM_FIELD_TYPES: {
|
|
487
|
-
readonly text: "text";
|
|
488
|
-
readonly email: "email";
|
|
489
|
-
readonly password: "password";
|
|
490
|
-
readonly tel: "tel";
|
|
491
|
-
readonly number: "number";
|
|
492
|
-
readonly url: "url";
|
|
493
|
-
readonly textarea: "textarea";
|
|
494
|
-
readonly select: "select";
|
|
495
|
-
readonly checkbox: "checkbox";
|
|
496
|
-
readonly radio: "radio";
|
|
497
|
-
readonly date: "date";
|
|
498
|
-
readonly file: "file";
|
|
499
|
-
readonly hidden: "hidden";
|
|
500
|
-
readonly submit: "submit";
|
|
501
|
-
readonly other: "other";
|
|
502
|
-
};
|
|
503
|
-
/**
|
|
504
|
-
* Deployment platform sources (Phase 2)
|
|
505
|
-
*/
|
|
506
|
-
export declare const DEPLOYMENT_SOURCES: {
|
|
507
|
-
readonly vercel: "vercel";
|
|
508
|
-
readonly netlify: "netlify";
|
|
509
|
-
readonly cloudflare: "cloudflare";
|
|
510
|
-
readonly railway: "railway";
|
|
511
|
-
readonly render: "render";
|
|
512
|
-
readonly fly: "fly";
|
|
513
|
-
readonly heroku: "heroku";
|
|
514
|
-
readonly aws: "aws";
|
|
515
|
-
readonly gcp: "gcp";
|
|
516
|
-
readonly azure: "azure";
|
|
517
|
-
readonly custom: "custom";
|
|
518
|
-
};
|
|
519
|
-
/**
|
|
520
|
-
* Deployment environment variables by platform
|
|
521
|
-
*/
|
|
522
|
-
export declare const DEPLOYMENT_ENV_VARS: {
|
|
523
|
-
readonly vercel: {
|
|
524
|
-
readonly deployId: "VERCEL_DEPLOYMENT_ID";
|
|
525
|
-
readonly gitSha: "VERCEL_GIT_COMMIT_SHA";
|
|
526
|
-
readonly gitBranch: "VERCEL_GIT_COMMIT_REF";
|
|
527
|
-
readonly url: "VERCEL_URL";
|
|
528
|
-
};
|
|
529
|
-
readonly netlify: {
|
|
530
|
-
readonly deployId: "DEPLOY_ID";
|
|
531
|
-
readonly gitSha: "COMMIT_REF";
|
|
532
|
-
readonly gitBranch: "BRANCH";
|
|
533
|
-
readonly url: "DEPLOY_URL";
|
|
534
|
-
};
|
|
535
|
-
readonly cloudflare: {
|
|
536
|
-
readonly deployId: "CF_PAGES_COMMIT_SHA";
|
|
537
|
-
readonly gitSha: "CF_PAGES_COMMIT_SHA";
|
|
538
|
-
readonly gitBranch: "CF_PAGES_BRANCH";
|
|
539
|
-
readonly url: "CF_PAGES_URL";
|
|
540
|
-
};
|
|
541
|
-
};
|
|
542
|
-
/**
|
|
543
|
-
* HTTP status codes
|
|
544
|
-
*/
|
|
545
|
-
export declare const HTTP_STATUS: {
|
|
546
|
-
readonly ok: 200;
|
|
547
|
-
readonly created: 201;
|
|
548
|
-
readonly accepted: 202;
|
|
549
|
-
readonly noContent: 204;
|
|
550
|
-
readonly badRequest: 400;
|
|
551
|
-
readonly unauthorized: 401;
|
|
552
|
-
readonly forbidden: 403;
|
|
553
|
-
readonly notFound: 404;
|
|
554
|
-
readonly conflict: 409;
|
|
555
|
-
readonly tooManyRequests: 429;
|
|
556
|
-
readonly internalServerError: 500;
|
|
557
|
-
readonly serviceUnavailable: 503;
|
|
558
|
-
};
|
|
559
|
-
/**
|
|
560
|
-
* API route paths
|
|
561
|
-
*/
|
|
562
|
-
export declare const API_ROUTES: {
|
|
563
|
-
readonly cliAuthToken: "/api/auth/cli/token";
|
|
564
|
-
readonly cliAuthTokens: "/api/auth/cli/tokens";
|
|
565
|
-
readonly cliValidate: "/api/auth/cli/validate";
|
|
566
|
-
readonly shareToken: (shareId: string) => string;
|
|
567
|
-
readonly links: "/api/links";
|
|
568
|
-
readonly linkRedirect: (slug: string) => string;
|
|
569
|
-
readonly websites: "/api/websites";
|
|
570
|
-
readonly websiteById: (id: string) => string;
|
|
571
|
-
readonly websiteEvents: (id: string) => string;
|
|
572
|
-
readonly websiteRecentEvents: (id: string) => string;
|
|
573
|
-
readonly userOnboarding: "/api/user/onboarding";
|
|
574
|
-
readonly userProfile: "/api/user/profile";
|
|
575
|
-
readonly userEmailPreferences: "/api/me/email-preferences";
|
|
576
|
-
readonly billingUsage: "/api/billing/usage";
|
|
577
|
-
readonly billingCheckout: "/api/billing/checkout";
|
|
578
|
-
readonly billingPortal: "/api/billing/portal";
|
|
579
|
-
readonly billingWebhook: "/api/billing/webhook";
|
|
580
|
-
readonly analyticsOverview: (websiteId: string) => string;
|
|
581
|
-
readonly analyticsTimeseries: (websiteId: string) => string;
|
|
582
|
-
readonly analyticsTopPages: (websiteId: string) => string;
|
|
583
|
-
readonly analyticsTopReferrers: (websiteId: string) => string;
|
|
584
|
-
readonly analyticsGeography: (websiteId: string) => string;
|
|
585
|
-
readonly analyticsDevices: (websiteId: string) => string;
|
|
586
|
-
readonly collect: "/collect";
|
|
587
|
-
readonly collectBatch: "/collect/batch";
|
|
588
|
-
readonly send: "/collect";
|
|
589
|
-
readonly collectVitals: "/api/collect/vitals";
|
|
590
|
-
readonly collectVitalsBatch: "/api/collect/vitals/batch";
|
|
591
|
-
readonly collectForms: "/api/collect/forms";
|
|
592
|
-
readonly collectFormsBatch: "/api/collect/forms/batch";
|
|
593
|
-
readonly vitalsOverview: "/api/vitals/overview";
|
|
594
|
-
readonly vitalsByPage: "/api/vitals/by-page";
|
|
595
|
-
readonly vitalsTrend: "/api/vitals/trend";
|
|
596
|
-
readonly vitalsRecent: "/api/vitals/recent";
|
|
597
|
-
readonly vitalsPageBreakdown: "/api/vitals/page-breakdown";
|
|
598
|
-
readonly formsConversions: "/api/forms/conversions";
|
|
599
|
-
readonly formsFieldMetrics: "/api/forms/field-metrics";
|
|
600
|
-
readonly formsFunnel: "/api/forms/funnel";
|
|
601
|
-
readonly formsRecent: "/api/forms/recent";
|
|
602
|
-
readonly deployments: "/api/deployments";
|
|
603
|
-
readonly deploymentByWebsite: (id: string) => string;
|
|
604
|
-
readonly deploymentCompare: (id: string) => string;
|
|
605
|
-
readonly deploymentLatest: (id: string) => string;
|
|
606
|
-
readonly health: "/api/health";
|
|
607
|
-
readonly healthIntegrations: "/api/health/integrations";
|
|
608
|
-
};
|
|
609
|
-
/**
|
|
610
|
-
* Onboarding step identifiers
|
|
611
|
-
*/
|
|
612
|
-
export declare const ONBOARDING_STEPS: {
|
|
613
|
-
readonly welcome: "welcome";
|
|
614
|
-
readonly createWebsite: "create-website";
|
|
615
|
-
readonly installTracking: "install-tracking";
|
|
616
|
-
readonly verify: "verify";
|
|
617
|
-
readonly complete: "complete";
|
|
618
|
-
readonly skipped: "skipped";
|
|
619
|
-
};
|
|
620
|
-
/**
|
|
621
|
-
* CLI token statuses
|
|
622
|
-
*/
|
|
623
|
-
export declare const CLI_TOKEN_STATUS: {
|
|
624
|
-
readonly pending: "pending";
|
|
625
|
-
readonly used: "used";
|
|
626
|
-
readonly expired: "expired";
|
|
627
|
-
readonly revoked: "revoked";
|
|
628
|
-
};
|
|
629
|
-
/**
|
|
630
|
-
* User roles
|
|
631
|
-
*/
|
|
632
|
-
export declare const USER_ROLES: {
|
|
633
|
-
readonly admin: "admin";
|
|
634
|
-
readonly user: "user";
|
|
635
|
-
readonly viewer: "viewer";
|
|
636
|
-
};
|
|
637
|
-
/**
|
|
638
|
-
* Framework package names
|
|
639
|
-
*/
|
|
640
|
-
export declare const FRAMEWORK_PACKAGES: {
|
|
641
|
-
readonly nextjs: "@entrolytics/nextjs-sdk";
|
|
642
|
-
readonly react: "@entrolytics/react-sdk";
|
|
643
|
-
readonly vue: "@entrolytics/vue-sdk";
|
|
644
|
-
readonly svelte: "@entrolytics/svelte-sdk";
|
|
645
|
-
readonly astro: "@entrolytics/astro-sdk";
|
|
646
|
-
readonly node: "@entrolytics/node-sdk";
|
|
647
|
-
};
|
|
648
|
-
/**
|
|
649
|
-
* Framework detection patterns
|
|
650
|
-
*/
|
|
651
|
-
export declare const FRAMEWORK_PATTERNS: {
|
|
652
|
-
readonly nextjs: {
|
|
653
|
-
readonly files: readonly ["next.config.js", "next.config.mjs", "next.config.ts"];
|
|
654
|
-
readonly dependencies: readonly ["next"];
|
|
655
|
-
};
|
|
656
|
-
readonly react: {
|
|
657
|
-
readonly files: readonly ["vite.config.js", "vite.config.ts"];
|
|
658
|
-
readonly dependencies: readonly ["react", "vite"];
|
|
659
|
-
};
|
|
660
|
-
readonly vue: {
|
|
661
|
-
readonly files: readonly ["vite.config.js", "vite.config.ts"];
|
|
662
|
-
readonly dependencies: readonly ["vue", "vite"];
|
|
663
|
-
};
|
|
664
|
-
readonly svelte: {
|
|
665
|
-
readonly files: readonly ["svelte.config.js", "svelte.config.ts"];
|
|
666
|
-
readonly dependencies: readonly ["svelte"];
|
|
667
|
-
};
|
|
668
|
-
readonly astro: {
|
|
669
|
-
readonly files: readonly ["astro.config.mjs", "astro.config.ts"];
|
|
670
|
-
readonly dependencies: readonly ["astro"];
|
|
671
|
-
};
|
|
672
|
-
};
|
|
673
|
-
/**
|
|
674
|
-
* Rate limiting configuration
|
|
675
|
-
* Updated to match server-side implementation
|
|
676
|
-
*/
|
|
677
|
-
export declare const RATE_LIMITS: {
|
|
678
|
-
readonly cliTokenExchange: {
|
|
679
|
-
readonly windowSeconds: 60;
|
|
680
|
-
readonly maxRequests: 5;
|
|
681
|
-
};
|
|
682
|
-
readonly shareTokenGeneration: {
|
|
683
|
-
readonly windowSeconds: 60;
|
|
684
|
-
readonly maxRequests: 10;
|
|
685
|
-
};
|
|
686
|
-
readonly linkCreation: {
|
|
687
|
-
readonly windowSeconds: 60;
|
|
688
|
-
readonly maxRequests: 20;
|
|
689
|
-
};
|
|
690
|
-
readonly linkRedirect: {
|
|
691
|
-
readonly windowSeconds: 60;
|
|
692
|
-
readonly maxRequests: 100;
|
|
693
|
-
};
|
|
694
|
-
readonly apiGeneral: {
|
|
695
|
-
readonly windowSeconds: 60;
|
|
696
|
-
readonly maxRequests: 100;
|
|
697
|
-
};
|
|
698
|
-
};
|
|
699
|
-
/**
|
|
700
|
-
* Error messages
|
|
701
|
-
*/
|
|
702
|
-
export declare const ERROR_MESSAGES: {
|
|
703
|
-
readonly unauthorized: "Unauthorized access";
|
|
704
|
-
readonly forbidden: "Access forbidden";
|
|
705
|
-
readonly tokenExpired: "Token has expired";
|
|
706
|
-
readonly tokenInvalid: "Invalid token";
|
|
707
|
-
readonly tokenNotFound: "Token not found";
|
|
708
|
-
readonly tokenAlreadyUsed: "Token has already been used";
|
|
709
|
-
readonly tokenRevoked: "Token has been revoked";
|
|
710
|
-
readonly tokenMissingJti: "Token missing JTI - please re-authenticate";
|
|
711
|
-
readonly userBanned: "User account has been banned";
|
|
712
|
-
readonly userDeleted: "User account has been deleted";
|
|
713
|
-
readonly shareTokenExpired: "Share token has expired";
|
|
714
|
-
readonly shareTokenRevoked: "Share has been revoked";
|
|
715
|
-
readonly shareTokenInvalid: "Invalid share token";
|
|
716
|
-
readonly invalidUrl: "Invalid URL provided";
|
|
717
|
-
readonly invalidUrlProtocol: "URL must use http or https protocol";
|
|
718
|
-
readonly openRedirectBlocked: "Open redirect attempt blocked";
|
|
719
|
-
readonly invalidInput: "Invalid input provided";
|
|
720
|
-
readonly missingRequired: "Missing required fields";
|
|
721
|
-
readonly invalidFormat: "Invalid format";
|
|
722
|
-
readonly notFound: "Resource not found";
|
|
723
|
-
readonly websiteNotFound: "Website not found";
|
|
724
|
-
readonly userNotFound: "User not found";
|
|
725
|
-
readonly linkNotFound: "Link not found";
|
|
726
|
-
readonly tooManyRequests: "Too many requests. Please try again later.";
|
|
727
|
-
readonly rateLimitExceeded: "Rate limit exceeded";
|
|
728
|
-
readonly internalError: "Internal server error";
|
|
729
|
-
readonly serviceUnavailable: "Service temporarily unavailable";
|
|
730
|
-
};
|
|
731
|
-
/**
|
|
732
|
-
* Success messages
|
|
733
|
-
*/
|
|
734
|
-
export declare const SUCCESS_MESSAGES: {
|
|
735
|
-
readonly tokenGenerated: "Setup token generated successfully";
|
|
736
|
-
readonly tokenValidated: "Token validated successfully";
|
|
737
|
-
readonly tokenRevoked: "Token revoked successfully";
|
|
738
|
-
readonly allTokensRevoked: "All tokens revoked successfully";
|
|
739
|
-
readonly websiteCreated: "Website created successfully";
|
|
740
|
-
readonly linkCreated: "Link created successfully";
|
|
741
|
-
readonly shareCreated: "Share created successfully";
|
|
742
|
-
readonly onboardingComplete: "Onboarding completed successfully";
|
|
743
|
-
readonly setupComplete: "Setup completed successfully";
|
|
744
|
-
};
|
|
745
|
-
/**
|
|
746
|
-
* CLI Access Token metadata
|
|
747
|
-
*/
|
|
748
|
-
export interface CliAccessTokenMetadata {
|
|
749
|
-
jti: string;
|
|
750
|
-
createdAt: string;
|
|
751
|
-
expiresAt: string;
|
|
752
|
-
lastUsedAt: string | null;
|
|
753
|
-
ipAddress: string | null;
|
|
754
|
-
userAgent: string | null;
|
|
755
|
-
}
|
|
756
|
-
export type Framework = keyof typeof ENV_VAR_NAMES;
|
|
757
|
-
export type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];
|
|
758
|
-
export type SdkEventType = (typeof SDK_EVENT_TYPES)[keyof typeof SDK_EVENT_TYPES];
|
|
759
|
-
export type OnboardingStep = (typeof ONBOARDING_STEPS)[keyof typeof ONBOARDING_STEPS];
|
|
760
|
-
export type CliTokenStatus = (typeof CLI_TOKEN_STATUS)[keyof typeof CLI_TOKEN_STATUS];
|
|
761
|
-
export type UserRole = (typeof USER_ROLES)[keyof typeof USER_ROLES];
|
|
762
|
-
export type PlanId = keyof typeof PLANS;
|
|
763
|
-
export type Plan = (typeof PLANS)[PlanId];
|
|
764
|
-
export type PlanFeature = keyof typeof PLAN_FEATURES;
|
|
765
|
-
export type BillingError = (typeof BILLING_ERRORS)[keyof typeof BILLING_ERRORS];
|
|
766
|
-
export type VitalType = (typeof VITAL_TYPES)[keyof typeof VITAL_TYPES];
|
|
767
|
-
export type VitalRating = (typeof VITAL_RATINGS)[keyof typeof VITAL_RATINGS];
|
|
768
|
-
export type NavigationType = (typeof NAVIGATION_TYPES)[keyof typeof NAVIGATION_TYPES];
|
|
769
|
-
export type FormEventType = (typeof FORM_EVENT_TYPES)[keyof typeof FORM_EVENT_TYPES];
|
|
770
|
-
export type FormFieldType = (typeof FORM_FIELD_TYPES)[keyof typeof FORM_FIELD_TYPES];
|
|
771
|
-
export type DeploymentSource = (typeof DEPLOYMENT_SOURCES)[keyof typeof DEPLOYMENT_SOURCES];
|
|
772
|
-
export declare const EVENT_TYPE_VALUES: [EventType, ...EventType[]];
|
|
773
|
-
export declare const SDK_EVENT_TYPE_VALUES: [SdkEventType, ...SdkEventType[]];
|
|
774
|
-
export declare const VITAL_TYPE_VALUES: [VitalType, ...VitalType[]];
|
|
775
|
-
export declare const VITAL_RATING_VALUES: [VitalRating, ...VitalRating[]];
|
|
776
|
-
export declare const NAVIGATION_TYPE_VALUES: [NavigationType, ...NavigationType[]];
|
|
777
|
-
export declare const FORM_EVENT_TYPE_VALUES: [FormEventType, ...FormEventType[]];
|
|
778
|
-
export declare const FORM_FIELD_TYPE_VALUES: [FormFieldType, ...FormFieldType[]];
|
|
779
|
-
export declare const DEPLOYMENT_SOURCE_VALUES: [DeploymentSource, ...DeploymentSource[]];
|
|
780
|
-
export declare function isEventType(value: string): value is EventType;
|
|
781
|
-
export declare function isSdkEventType(value: string): value is SdkEventType;
|
|
782
|
-
export declare function isVitalType(value: string): value is VitalType;
|
|
783
|
-
export declare function isVitalRating(value: string): value is VitalRating;
|
|
784
|
-
export declare function isNavigationType(value: string): value is NavigationType;
|
|
785
|
-
export declare function isFormEventType(value: string): value is FormEventType;
|
|
786
|
-
export declare function isFormFieldType(value: string): value is FormFieldType;
|
|
787
|
-
export declare function isDeploymentSource(value: string): value is DeploymentSource;
|
|
788
|
-
export declare function normalizeDeploymentSource(value: string | null | undefined): DeploymentSource;
|
|
789
|
-
/**
|
|
790
|
-
* Web Vital data structure for SDK tracking
|
|
791
|
-
*/
|
|
792
|
-
export interface WebVitalData {
|
|
793
|
-
metric: VitalType;
|
|
794
|
-
value: number;
|
|
795
|
-
rating: VitalRating;
|
|
796
|
-
delta?: number;
|
|
797
|
-
id?: string;
|
|
798
|
-
navigationType?: NavigationType;
|
|
799
|
-
attribution?: Record<string, unknown>;
|
|
800
|
-
url?: string;
|
|
801
|
-
path?: string;
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* Form event data structure for SDK tracking
|
|
805
|
-
*/
|
|
806
|
-
export interface FormEventData {
|
|
807
|
-
eventType: FormEventType;
|
|
808
|
-
formId: string;
|
|
809
|
-
formName?: string;
|
|
810
|
-
urlPath: string;
|
|
811
|
-
fieldName?: string;
|
|
812
|
-
fieldType?: FormFieldType;
|
|
813
|
-
fieldIndex?: number;
|
|
814
|
-
timeOnField?: number;
|
|
815
|
-
timeSinceStart?: number;
|
|
816
|
-
errorMessage?: string;
|
|
817
|
-
success?: boolean;
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* Deployment context for SDK tracking
|
|
821
|
-
*/
|
|
822
|
-
export interface DeploymentContext {
|
|
823
|
-
deployId: string;
|
|
824
|
-
gitSha?: string;
|
|
825
|
-
gitBranch?: string;
|
|
826
|
-
deployUrl?: string;
|
|
827
|
-
source?: DeploymentSource;
|
|
828
|
-
}
|
|
829
|
-
/**
|
|
830
|
-
* Utility functions
|
|
831
|
-
*/
|
|
832
|
-
export declare function getEnvVarNames(framework: Framework): (typeof ENV_VAR_NAMES)[Framework];
|
|
833
|
-
export declare function getFrameworkPackage(framework: Framework): string | null;
|
|
834
|
-
export declare function isValidFramework(framework: string): framework is Framework;
|
|
835
|
-
export declare function getApiRoute(route: keyof typeof API_ROUTES, ...args: string[]): string;
|
|
836
|
-
/**
|
|
837
|
-
* Get plan by ID
|
|
838
|
-
*/
|
|
839
|
-
export declare function getPlan(planId: PlanId): Plan;
|
|
840
|
-
/**
|
|
841
|
-
* Check if a feature is available for a plan
|
|
842
|
-
*/
|
|
843
|
-
export declare function isPlanFeatureEnabled(planId: PlanId, feature: PlanFeature): boolean;
|
|
844
|
-
/**
|
|
845
|
-
* Get plan limit value (-1 means unlimited)
|
|
846
|
-
*/
|
|
847
|
-
export declare function getPlanLimit(planId: PlanId, limit: keyof Plan["limits"]): number;
|
|
848
|
-
/**
|
|
849
|
-
* Check if usage is at warning threshold
|
|
850
|
-
*/
|
|
851
|
-
export declare function isUsageWarning(current: number, limit: number): boolean;
|
|
852
|
-
/**
|
|
853
|
-
* Check if usage is at critical threshold
|
|
854
|
-
*/
|
|
855
|
-
export declare function isUsageCritical(current: number, limit: number): boolean;
|
|
856
|
-
/**
|
|
857
|
-
* Calculate Web Vital rating from value (Phase 2)
|
|
858
|
-
*/
|
|
859
|
-
export declare function getVitalRating(metric: VitalType, value: number): VitalRating;
|
|
860
|
-
/**
|
|
861
|
-
* Detect deployment context from environment variables (Phase 2)
|
|
862
|
-
* Works in Node.js environments only - returns null in browser
|
|
863
|
-
*/
|
|
864
|
-
export declare function detectDeploymentContext(): DeploymentContext | null;
|
|
865
|
-
//#endregion
|
|
866
|
-
//# sourceMappingURL=index.d.cts.map
|