@entrolytics/shared 2.3.2 → 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.
- package/dist/analytics-types.d.ts +104 -0
- package/dist/analytics-types.d.ts.map +1 -0
- package/dist/analytics-types.js +2 -0
- package/dist/event-protocol.d.ts +82 -0
- package/dist/event-protocol.d.ts.map +1 -0
- package/dist/event-protocol.js +17 -0
- package/dist/index.d.ts +562 -721
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +665 -610
- package/dist/sdk-validation.test.d.ts +8 -0
- package/dist/sdk-validation.test.d.ts.map +1 -0
- package/dist/sdk-validation.test.js +96 -0
- package/package.json +2 -2
- package/dist/index.cjs +0 -726
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -896
- package/dist/index.d.cts.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,192 +1,3 @@
|
|
|
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
|
-
sessionId: string;
|
|
131
|
-
visitorId: string;
|
|
132
|
-
url: string;
|
|
133
|
-
referrer?: string;
|
|
134
|
-
eventType: EventType$1;
|
|
135
|
-
eventName?: string;
|
|
136
|
-
properties?: Record<string, unknown>;
|
|
137
|
-
screenWidth?: number;
|
|
138
|
-
screenHeight?: number;
|
|
139
|
-
loadTime?: number;
|
|
140
|
-
domInteractive?: number;
|
|
141
|
-
domComplete?: number;
|
|
142
|
-
utmSource?: string;
|
|
143
|
-
utmMedium?: string;
|
|
144
|
-
utmCampaign?: string;
|
|
145
|
-
utmTerm?: string;
|
|
146
|
-
utmContent?: string;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Event DB row structure as stored in ClickHouse
|
|
150
|
-
* Uses snake_case to match database column naming convention
|
|
151
|
-
*/
|
|
152
|
-
interface EventDBRow {
|
|
153
|
-
id: string;
|
|
154
|
-
website_id: string;
|
|
155
|
-
session_id: string;
|
|
156
|
-
visitor_id: string;
|
|
157
|
-
timestamp: string;
|
|
158
|
-
event_type: EventType$1;
|
|
159
|
-
event_name: string | null;
|
|
160
|
-
url: string;
|
|
161
|
-
path: string;
|
|
162
|
-
referrer: string | null;
|
|
163
|
-
referrer_domain: string | null;
|
|
164
|
-
browser: string;
|
|
165
|
-
browser_version: string | null;
|
|
166
|
-
os: string;
|
|
167
|
-
os_version: string | null;
|
|
168
|
-
device_type: "desktop" | "mobile" | "tablet" | "server" | "unknown";
|
|
169
|
-
screen_width: number | null;
|
|
170
|
-
screen_height: number | null;
|
|
171
|
-
country: string | null;
|
|
172
|
-
city: string | null;
|
|
173
|
-
region: string | null;
|
|
174
|
-
load_time: number | null;
|
|
175
|
-
dom_interactive: number | null;
|
|
176
|
-
dom_complete: number | null;
|
|
177
|
-
utm_source: string | null;
|
|
178
|
-
utm_medium: string | null;
|
|
179
|
-
utm_campaign: string | null;
|
|
180
|
-
utm_term: string | null;
|
|
181
|
-
utm_content: string | null;
|
|
182
|
-
properties: string;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Device types for analytics segmentation
|
|
186
|
-
*/
|
|
187
|
-
type DeviceType = "desktop" | "mobile" | "tablet" | "server" | "unknown";
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region src/index.d.ts
|
|
190
1
|
/**
|
|
191
2
|
* Shared constants across Entrolytics ecosystem
|
|
192
3
|
* Used by: CLI, SDKs, Dashboard, Integrations
|
|
@@ -194,703 +5,733 @@ type DeviceType = "desktop" | "mobile" | "tablet" | "server" | "unknown";
|
|
|
194
5
|
/**
|
|
195
6
|
* Plan definitions and limits
|
|
196
7
|
*/
|
|
197
|
-
declare const PLANS: {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
+
};
|
|
281
92
|
};
|
|
282
93
|
/**
|
|
283
94
|
* Plan feature names for display
|
|
284
95
|
*/
|
|
285
|
-
declare const PLAN_FEATURES: {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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";
|
|
295
106
|
};
|
|
296
107
|
/**
|
|
297
108
|
* Usage warning thresholds (percentages)
|
|
298
109
|
*/
|
|
299
|
-
declare const USAGE_THRESHOLDS: {
|
|
300
|
-
|
|
301
|
-
|
|
110
|
+
export declare const USAGE_THRESHOLDS: {
|
|
111
|
+
readonly warning: 90;
|
|
112
|
+
readonly critical: 95;
|
|
302
113
|
};
|
|
303
114
|
/**
|
|
304
115
|
* Billing-related error codes
|
|
305
116
|
*/
|
|
306
|
-
declare const BILLING_ERRORS: {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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";
|
|
312
123
|
};
|
|
313
124
|
/**
|
|
314
125
|
* API endpoint configuration
|
|
315
126
|
*/
|
|
316
|
-
declare const API_ENDPOINTS: {
|
|
317
|
-
|
|
318
|
-
|
|
127
|
+
export declare const API_ENDPOINTS: {
|
|
128
|
+
readonly production: "https://api.entrolytics.click";
|
|
129
|
+
readonly development: "http://localhost:3001";
|
|
319
130
|
};
|
|
320
131
|
/**
|
|
321
132
|
* Default API host
|
|
322
133
|
*/
|
|
323
|
-
declare const DEFAULT_API_HOST: "https://api.entrolytics.
|
|
134
|
+
export declare const DEFAULT_API_HOST: "https://api.entrolytics.click" | "http://localhost:3001";
|
|
324
135
|
/**
|
|
325
136
|
* Environment variable naming conventions by framework
|
|
326
137
|
*/
|
|
327
|
-
declare const ENV_VAR_NAMES: {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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";
|
|
340
192
|
};
|
|
341
|
-
};
|
|
342
|
-
readonly vue: {
|
|
343
|
-
readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
|
|
344
|
-
readonly host: "VITE_ENTROLYTICS_HOST";
|
|
345
|
-
readonly envFile: ".env";
|
|
346
|
-
};
|
|
347
|
-
readonly svelte: {
|
|
348
|
-
readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
|
|
349
|
-
readonly host: "PUBLIC_ENTROLYTICS_HOST";
|
|
350
|
-
readonly envFile: ".env";
|
|
351
|
-
};
|
|
352
|
-
readonly astro: {
|
|
353
|
-
readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
|
|
354
|
-
readonly host: "PUBLIC_ENTROLYTICS_HOST";
|
|
355
|
-
readonly envFile: ".env";
|
|
356
|
-
};
|
|
357
|
-
readonly html: {
|
|
358
|
-
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
359
|
-
readonly host: "ENTROLYTICS_HOST";
|
|
360
|
-
readonly envFile: ".env";
|
|
361
|
-
};
|
|
362
|
-
readonly node: {
|
|
363
|
-
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
364
|
-
readonly host: "ENTROLYTICS_HOST";
|
|
365
|
-
readonly envFile: ".env";
|
|
366
|
-
};
|
|
367
|
-
readonly php: {
|
|
368
|
-
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
369
|
-
readonly host: "ENTROLYTICS_HOST";
|
|
370
|
-
readonly envFile: ".env";
|
|
371
|
-
};
|
|
372
|
-
readonly python: {
|
|
373
|
-
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
374
|
-
readonly host: "ENTROLYTICS_HOST";
|
|
375
|
-
readonly envFile: ".env";
|
|
376
|
-
};
|
|
377
|
-
readonly go: {
|
|
378
|
-
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
379
|
-
readonly host: "ENTROLYTICS_HOST";
|
|
380
|
-
readonly envFile: ".env";
|
|
381
|
-
};
|
|
382
193
|
};
|
|
383
194
|
/**
|
|
384
195
|
* CLI configuration constants
|
|
385
196
|
*/
|
|
386
|
-
declare const CLI_CONFIG: {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
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";
|
|
392
203
|
};
|
|
393
204
|
/**
|
|
394
205
|
* Core event types - matches backend protocol values exactly
|
|
395
206
|
* Used by: API Server, SDKs, CLI, worker processes
|
|
396
207
|
* See: entrolytics/packages/protocol/src/events.ts
|
|
397
208
|
*/
|
|
398
|
-
declare const EVENT_TYPES: {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
209
|
+
export declare const EVENT_TYPES: {
|
|
210
|
+
readonly pageView: "pageview";
|
|
211
|
+
readonly custom: "custom_event";
|
|
212
|
+
readonly click: "click";
|
|
402
213
|
};
|
|
403
214
|
/**
|
|
404
215
|
* Extended event types for SDK-level semantics
|
|
405
216
|
* These are higher-level event categories used by SDKs
|
|
406
217
|
* They map to the core EVENT_TYPES when sent to the backend
|
|
407
218
|
*/
|
|
408
|
-
declare const SDK_EVENT_TYPES: {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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";
|
|
415
226
|
};
|
|
416
227
|
/**
|
|
417
228
|
* Web Vitals metric types (Phase 2)
|
|
418
229
|
* Core Web Vitals: LCP, INP, CLS
|
|
419
230
|
* Additional: TTFB, FCP
|
|
420
231
|
*/
|
|
421
|
-
declare const VITAL_TYPES: {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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";
|
|
427
238
|
};
|
|
428
239
|
/**
|
|
429
240
|
* Web Vitals rating thresholds
|
|
430
241
|
*/
|
|
431
|
-
declare const VITAL_RATINGS: {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
242
|
+
export declare const VITAL_RATINGS: {
|
|
243
|
+
readonly good: "good";
|
|
244
|
+
readonly needsImprovement: "needs-improvement";
|
|
245
|
+
readonly poor: "poor";
|
|
435
246
|
};
|
|
436
247
|
/**
|
|
437
248
|
* Web Vitals thresholds by metric (in milliseconds, except CLS which is unitless)
|
|
438
249
|
*/
|
|
439
|
-
declare const VITAL_THRESHOLDS: {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
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
|
+
};
|
|
460
271
|
};
|
|
461
272
|
/**
|
|
462
273
|
* Navigation types for Web Vitals context
|
|
463
274
|
*/
|
|
464
|
-
declare const NAVIGATION_TYPES: {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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";
|
|
471
282
|
};
|
|
472
283
|
/**
|
|
473
284
|
* Form event types (Phase 2)
|
|
474
285
|
*/
|
|
475
|
-
declare const FORM_EVENT_TYPES: {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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";
|
|
482
293
|
};
|
|
483
294
|
/**
|
|
484
295
|
* Form field types
|
|
485
296
|
*/
|
|
486
|
-
declare const FORM_FIELD_TYPES: {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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";
|
|
502
313
|
};
|
|
503
314
|
/**
|
|
504
315
|
* Deployment platform sources (Phase 2)
|
|
505
316
|
*/
|
|
506
|
-
declare const DEPLOYMENT_SOURCES: {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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";
|
|
518
329
|
};
|
|
519
330
|
/**
|
|
520
331
|
* Deployment environment variables by platform
|
|
521
332
|
*/
|
|
522
|
-
declare const DEPLOYMENT_ENV_VARS: {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
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
|
+
};
|
|
541
352
|
};
|
|
542
353
|
/**
|
|
543
354
|
* HTTP status codes
|
|
544
355
|
*/
|
|
545
|
-
declare const HTTP_STATUS: {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
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;
|
|
558
369
|
};
|
|
559
370
|
/**
|
|
560
371
|
* API route paths
|
|
561
372
|
*/
|
|
562
|
-
declare const API_ROUTES: {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
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";
|
|
598
422
|
};
|
|
599
423
|
/**
|
|
600
424
|
* Onboarding step identifiers
|
|
601
425
|
*/
|
|
602
|
-
declare const ONBOARDING_STEPS: {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
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";
|
|
609
433
|
};
|
|
610
434
|
/**
|
|
611
435
|
* CLI token statuses
|
|
612
436
|
*/
|
|
613
|
-
declare const CLI_TOKEN_STATUS: {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
437
|
+
export declare const CLI_TOKEN_STATUS: {
|
|
438
|
+
readonly pending: "pending";
|
|
439
|
+
readonly used: "used";
|
|
440
|
+
readonly expired: "expired";
|
|
441
|
+
readonly revoked: "revoked";
|
|
618
442
|
};
|
|
619
443
|
/**
|
|
620
444
|
* User roles
|
|
621
445
|
*/
|
|
622
|
-
declare const USER_ROLES: {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
446
|
+
export declare const USER_ROLES: {
|
|
447
|
+
readonly admin: "admin";
|
|
448
|
+
readonly user: "user";
|
|
449
|
+
readonly viewer: "viewer";
|
|
626
450
|
};
|
|
627
451
|
/**
|
|
628
452
|
* Framework package names
|
|
629
453
|
*/
|
|
630
|
-
declare const FRAMEWORK_PACKAGES: {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
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";
|
|
637
461
|
};
|
|
638
462
|
/**
|
|
639
463
|
* Framework detection patterns
|
|
640
464
|
*/
|
|
641
|
-
declare const FRAMEWORK_PATTERNS: {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
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
|
+
};
|
|
662
486
|
};
|
|
663
487
|
/**
|
|
664
488
|
* Rate limiting configuration
|
|
665
489
|
* Updated to match server-side implementation
|
|
666
490
|
*/
|
|
667
|
-
declare const RATE_LIMITS: {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
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
|
+
};
|
|
700
524
|
};
|
|
701
525
|
/**
|
|
702
526
|
* Error messages
|
|
703
527
|
*/
|
|
704
|
-
declare const ERROR_MESSAGES: {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
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";
|
|
732
556
|
};
|
|
733
557
|
/**
|
|
734
558
|
* Success messages
|
|
735
559
|
*/
|
|
736
|
-
declare const SUCCESS_MESSAGES: {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
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";
|
|
746
570
|
};
|
|
747
571
|
/**
|
|
748
572
|
* CLI Access Token metadata
|
|
749
573
|
*/
|
|
750
|
-
interface CliAccessTokenMetadata {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
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;
|
|
757
581
|
}
|
|
758
|
-
type Framework = keyof typeof ENV_VAR_NAMES;
|
|
759
|
-
type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];
|
|
760
|
-
type SdkEventType = (typeof SDK_EVENT_TYPES)[keyof typeof SDK_EVENT_TYPES];
|
|
761
|
-
type OnboardingStep = (typeof ONBOARDING_STEPS)[keyof typeof ONBOARDING_STEPS];
|
|
762
|
-
type CliTokenStatus = (typeof CLI_TOKEN_STATUS)[keyof typeof CLI_TOKEN_STATUS];
|
|
763
|
-
type UserRole = (typeof USER_ROLES)[keyof typeof USER_ROLES];
|
|
764
|
-
type PlanId = keyof typeof PLANS;
|
|
765
|
-
type Plan = (typeof PLANS)[PlanId];
|
|
766
|
-
type PlanFeature = keyof typeof PLAN_FEATURES;
|
|
767
|
-
type BillingError = (typeof BILLING_ERRORS)[keyof typeof BILLING_ERRORS];
|
|
768
|
-
type VitalType = (typeof VITAL_TYPES)[keyof typeof VITAL_TYPES];
|
|
769
|
-
type VitalRating = (typeof VITAL_RATINGS)[keyof typeof VITAL_RATINGS];
|
|
770
|
-
type NavigationType = (typeof NAVIGATION_TYPES)[keyof typeof NAVIGATION_TYPES];
|
|
771
|
-
type FormEventType = (typeof FORM_EVENT_TYPES)[keyof typeof FORM_EVENT_TYPES];
|
|
772
|
-
type FormFieldType = (typeof FORM_FIELD_TYPES)[keyof typeof FORM_FIELD_TYPES];
|
|
773
|
-
type DeploymentSource = (typeof DEPLOYMENT_SOURCES)[keyof typeof DEPLOYMENT_SOURCES];
|
|
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;
|
|
774
615
|
/**
|
|
775
616
|
* Web Vital data structure for SDK tracking
|
|
776
617
|
*/
|
|
777
|
-
interface WebVitalData {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
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;
|
|
787
628
|
}
|
|
788
629
|
/**
|
|
789
630
|
* Form event data structure for SDK tracking
|
|
790
631
|
*/
|
|
791
|
-
interface FormEventData {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
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;
|
|
803
644
|
}
|
|
804
645
|
/**
|
|
805
646
|
* Deployment context for SDK tracking
|
|
806
647
|
*/
|
|
807
|
-
interface DeploymentContext {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
648
|
+
export interface DeploymentContext {
|
|
649
|
+
deployId: string;
|
|
650
|
+
gitSha?: string;
|
|
651
|
+
gitBranch?: string;
|
|
652
|
+
deployUrl?: string;
|
|
653
|
+
source?: DeploymentSource;
|
|
813
654
|
}
|
|
814
655
|
/**
|
|
815
656
|
* Utility functions
|
|
816
657
|
*/
|
|
817
|
-
declare function getEnvVarNames(framework: Framework): {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
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";
|
|
821
662
|
} | {
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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
|
+
};
|
|
829
670
|
} | {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
671
|
+
readonly websiteId: "VITE_ENTROLYTICS_WEBSITE_ID";
|
|
672
|
+
readonly host: "VITE_ENTROLYTICS_HOST";
|
|
673
|
+
readonly envFile: ".env";
|
|
833
674
|
} | {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
675
|
+
readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
|
|
676
|
+
readonly host: "PUBLIC_ENTROLYTICS_HOST";
|
|
677
|
+
readonly envFile: ".env";
|
|
837
678
|
} | {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
679
|
+
readonly websiteId: "PUBLIC_ENTROLYTICS_WEBSITE_ID";
|
|
680
|
+
readonly host: "PUBLIC_ENTROLYTICS_HOST";
|
|
681
|
+
readonly envFile: ".env";
|
|
841
682
|
} | {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
683
|
+
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
684
|
+
readonly host: "ENTROLYTICS_HOST";
|
|
685
|
+
readonly envFile: ".env";
|
|
845
686
|
} | {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
687
|
+
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
688
|
+
readonly host: "ENTROLYTICS_HOST";
|
|
689
|
+
readonly envFile: ".env";
|
|
849
690
|
} | {
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
691
|
+
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
692
|
+
readonly host: "ENTROLYTICS_HOST";
|
|
693
|
+
readonly envFile: ".env";
|
|
853
694
|
} | {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
695
|
+
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
696
|
+
readonly host: "ENTROLYTICS_HOST";
|
|
697
|
+
readonly envFile: ".env";
|
|
857
698
|
} | {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
699
|
+
readonly websiteId: "ENTROLYTICS_WEBSITE_ID";
|
|
700
|
+
readonly host: "ENTROLYTICS_HOST";
|
|
701
|
+
readonly envFile: ".env";
|
|
861
702
|
};
|
|
862
|
-
declare function getFrameworkPackage(framework: Framework): "@entrolytics/nextjs-sdk" | "@entrolytics/react-sdk" | "@entrolytics/vue-sdk" | "@entrolytics/svelte-sdk" | "@entrolytics/astro-sdk" | "@entrolytics/node-sdk";
|
|
863
|
-
declare function isValidFramework(framework: string): framework is Framework;
|
|
864
|
-
declare function getApiRoute(route: keyof typeof API_ROUTES, ...args: string[]): string;
|
|
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;
|
|
865
706
|
/**
|
|
866
707
|
* Get plan by ID
|
|
867
708
|
*/
|
|
868
|
-
declare function getPlan(planId: PlanId): Plan;
|
|
709
|
+
export declare function getPlan(planId: PlanId): Plan;
|
|
869
710
|
/**
|
|
870
711
|
* Check if a feature is available for a plan
|
|
871
712
|
*/
|
|
872
|
-
declare function isPlanFeatureEnabled(planId: PlanId, feature: PlanFeature): boolean;
|
|
713
|
+
export declare function isPlanFeatureEnabled(planId: PlanId, feature: PlanFeature): boolean;
|
|
873
714
|
/**
|
|
874
715
|
* Get plan limit value (-1 means unlimited)
|
|
875
716
|
*/
|
|
876
|
-
declare function getPlanLimit(planId: PlanId, limit: keyof Plan["limits"]): number;
|
|
717
|
+
export declare function getPlanLimit(planId: PlanId, limit: keyof Plan["limits"]): number;
|
|
877
718
|
/**
|
|
878
719
|
* Check if usage is at warning threshold
|
|
879
720
|
*/
|
|
880
|
-
declare function isUsageWarning(current: number, limit: number): boolean;
|
|
721
|
+
export declare function isUsageWarning(current: number, limit: number): boolean;
|
|
881
722
|
/**
|
|
882
723
|
* Check if usage is at critical threshold
|
|
883
724
|
*/
|
|
884
|
-
declare function isUsageCritical(current: number, limit: number): boolean;
|
|
725
|
+
export declare function isUsageCritical(current: number, limit: number): boolean;
|
|
885
726
|
/**
|
|
886
727
|
* Calculate Web Vital rating from value (Phase 2)
|
|
887
728
|
*/
|
|
888
|
-
declare function getVitalRating(metric: VitalType, value: number): VitalRating;
|
|
729
|
+
export declare function getVitalRating(metric: VitalType, value: number): VitalRating;
|
|
889
730
|
/**
|
|
890
731
|
* Detect deployment context from environment variables (Phase 2)
|
|
891
732
|
* Works in Node.js environments only - returns null in browser
|
|
892
733
|
*/
|
|
893
|
-
declare function detectDeploymentContext(): DeploymentContext | null;
|
|
894
|
-
|
|
895
|
-
export
|
|
734
|
+
export declare function detectDeploymentContext(): DeploymentContext | null;
|
|
735
|
+
export * from "./analytics-types";
|
|
736
|
+
export * from "./event-protocol";
|
|
896
737
|
//# sourceMappingURL=index.d.ts.map
|