@entrolytics/api-client 2.2.3 → 3.0.1

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.
Files changed (49) hide show
  1. package/dist/client.d.ts +81 -0
  2. package/dist/client.d.ts.map +1 -0
  3. package/dist/edge-helpers.d.ts +146 -0
  4. package/dist/edge-helpers.d.ts.map +1 -0
  5. package/dist/endpoints/admin.d.ts +41 -0
  6. package/dist/endpoints/admin.d.ts.map +1 -0
  7. package/dist/endpoints/auth.d.ts +25 -0
  8. package/dist/endpoints/auth.d.ts.map +1 -0
  9. package/dist/endpoints/billing.d.ts +25 -0
  10. package/dist/endpoints/billing.d.ts.map +1 -0
  11. package/dist/endpoints/boards.d.ts +49 -0
  12. package/dist/endpoints/boards.d.ts.map +1 -0
  13. package/dist/endpoints/config.d.ts +24 -0
  14. package/dist/endpoints/config.d.ts.map +1 -0
  15. package/dist/endpoints/events.d.ts +59 -0
  16. package/dist/endpoints/events.d.ts.map +1 -0
  17. package/dist/endpoints/index.d.ts +18 -0
  18. package/dist/endpoints/index.d.ts.map +1 -0
  19. package/dist/endpoints/integrations.d.ts +11 -0
  20. package/dist/endpoints/integrations.d.ts.map +1 -0
  21. package/dist/endpoints/links.d.ts +33 -0
  22. package/dist/endpoints/links.d.ts.map +1 -0
  23. package/dist/endpoints/me.d.ts +24 -0
  24. package/dist/endpoints/me.d.ts.map +1 -0
  25. package/dist/endpoints/orgs.d.ts +64 -0
  26. package/dist/endpoints/orgs.d.ts.map +1 -0
  27. package/dist/endpoints/pixels.d.ts +29 -0
  28. package/dist/endpoints/pixels.d.ts.map +1 -0
  29. package/dist/endpoints/reports.d.ts +148 -0
  30. package/dist/endpoints/reports.d.ts.map +1 -0
  31. package/dist/endpoints/segments.d.ts +25 -0
  32. package/dist/endpoints/segments.d.ts.map +1 -0
  33. package/dist/endpoints/sessions.d.ts +39 -0
  34. package/dist/endpoints/sessions.d.ts.map +1 -0
  35. package/dist/endpoints/users.d.ts +39 -0
  36. package/dist/endpoints/users.d.ts.map +1 -0
  37. package/dist/endpoints/webhooks.d.ts +11 -0
  38. package/dist/endpoints/webhooks.d.ts.map +1 -0
  39. package/dist/endpoints/websites.d.ts +203 -0
  40. package/dist/endpoints/websites.d.ts.map +1 -0
  41. package/dist/index.d.ts +129 -1904
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/runtime.d.ts +118 -0
  44. package/dist/runtime.d.ts.map +1 -0
  45. package/dist/types/index.d.ts +602 -0
  46. package/dist/types/index.d.ts.map +1 -0
  47. package/package.json +9 -9
  48. package/dist/index.d.cts +0 -1927
  49. package/dist/index.d.cts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,1907 +1,129 @@
1
- import { API_ENDPOINTS, API_ROUTES, BILLING_ERRORS, CLI_CONFIG, CLI_TOKEN_STATUS, CliAccessTokenMetadata, DEFAULT_API_HOST, DEPLOYMENT_ENV_VARS, DEPLOYMENT_SOURCES, DeploymentSource, ENV_VAR_NAMES, ERROR_MESSAGES, EVENT_TYPES, FORM_EVENT_TYPES, FORM_FIELD_TYPES, FRAMEWORK_PACKAGES, FRAMEWORK_PATTERNS, FormEventType, FormFieldType, HTTP_STATUS, NAVIGATION_TYPES, NavigationType, ONBOARDING_STEPS, PLANS, PLAN_FEATURES, RATE_LIMITS, SDK_EVENT_TYPES, SUCCESS_MESSAGES, USAGE_THRESHOLDS, USER_ROLES, VITAL_RATINGS, VITAL_THRESHOLDS, VITAL_TYPES, VitalRating, VitalType, detectDeploymentContext, getApiRoute, getEnvVarNames, getFrameworkPackage, getPlan, getPlanLimit, getVitalRating, isPlanFeatureEnabled, isUsageCritical, isUsageWarning, isValidFramework } from "@entrolytics/shared";
2
- //#region src/types/index.d.ts
3
- interface ApiResponse<T> {
4
- ok: boolean;
5
- status: number;
6
- data?: T;
7
- error?: string;
8
- }
9
- interface PaginationParams {
10
- page?: number;
11
- pageSize?: number;
12
- orderBy?: string;
13
- }
14
- interface DateRangeParams {
15
- startAt: number;
16
- endAt: number;
17
- [key: string]: string | number | boolean | undefined;
18
- }
19
- type PlatformRole = "admin" | "user" | "view-only";
20
- type OrganizationRole = "owner" | "admin" | "member" | "viewer";
21
- interface User {
22
- id: string;
23
- /** Clerk user ID (user_xxx format) */
24
- clerkId: string;
25
- /** Primary email address */
26
- email: string;
27
- /** Display name (computed from firstName + lastName or email) */
28
- displayName: string;
29
- /** First name from Clerk */
30
- firstName?: string | null;
31
- /** Last name from Clerk */
32
- lastName?: string | null;
33
- /** Profile image URL */
34
- imageUrl?: string | null;
35
- /** Platform-level role */
36
- role: PlatformRole;
37
- /** Whether user has admin privileges */
38
- isAdmin: boolean;
39
- /** Current organization ID (if in org context) */
40
- orgId?: string | null;
41
- /** Role within current organization */
42
- orgRole?: OrganizationRole | null;
43
- createdAt: string;
44
- updatedAt?: string | null;
45
- }
46
- interface CreateUserData {
47
- email: string;
48
- firstName?: string;
49
- lastName?: string;
50
- role?: PlatformRole;
51
- }
52
- interface UpdateUserData {
53
- firstName?: string;
54
- lastName?: string;
55
- role?: PlatformRole;
56
- }
57
- interface Organization {
58
- id: string;
59
- name: string;
60
- createdAt: string;
61
- }
62
- interface CreateOrgData {
63
- name: string;
64
- }
65
- interface UpdateOrgData {
66
- name?: string;
67
- }
68
- interface OrgMember {
69
- id: string;
70
- userId: string;
71
- orgId: string;
72
- role: OrganizationRole;
73
- user: User;
74
- createdAt: string;
75
- }
76
- interface JoinOrgData {
77
- accessCode: string;
78
- }
79
- interface Website {
80
- id: string;
81
- name: string;
82
- domain: string;
83
- shareId?: string;
84
- resetAt?: string;
85
- userId?: string;
86
- orgId?: string;
87
- createdAt: string;
88
- deletedAt?: string;
89
- }
90
- interface CreateWebsiteData {
91
- name: string;
92
- domain: string;
93
- shareId?: string;
94
- orgId?: string;
95
- }
96
- interface UpdateWebsiteData {
97
- name?: string;
98
- domain?: string;
99
- shareId?: string;
100
- }
101
- interface WebsiteStats {
102
- pageviews: {
103
- value: number;
104
- change: number;
105
- };
106
- visitors: {
107
- value: number;
108
- change: number;
109
- };
110
- visits: {
111
- value: number;
112
- change: number;
113
- };
114
- bounces: {
115
- value: number;
116
- change: number;
117
- };
118
- totalTime: {
119
- value: number;
120
- change: number;
121
- };
122
- }
123
- /**
124
- * Link statistics - alias to WebsiteStats as they share the same structure
125
- */
126
- type LinkStats = WebsiteStats;
127
- interface PageviewData {
128
- x: string;
129
- y: number;
130
- }
131
- interface WebsitePageviews {
132
- pageviews: PageviewData[];
133
- sessions: PageviewData[];
134
- }
135
- interface MetricData {
136
- x: string;
137
- y: number;
138
- }
139
- type MetricType = "url" | "title" | "referrer" | "browser" | "os" | "device" | "country" | "region" | "city" | "language" | "event";
140
- interface WebsiteMetricsParams extends DateRangeParams {
141
- type: MetricType;
142
- url?: string;
143
- referrer?: string;
144
- title?: string;
145
- query?: string;
146
- event?: string;
147
- limit?: number;
148
- offset?: number;
149
- [key: string]: string | number | boolean | undefined;
150
- }
151
- interface WebsiteEvent {
152
- id: string;
153
- websiteId: string;
154
- sessionId: string;
155
- createdAt: string;
156
- urlPath: string;
157
- urlQuery?: string;
158
- referrerPath?: string;
159
- referrerQuery?: string;
160
- referrerDomain?: string;
161
- pageTitle?: string;
162
- eventType: number;
163
- eventName?: string;
164
- }
165
- interface EventStats {
166
- events: number;
167
- fields: number;
168
- }
169
- interface EventData {
170
- eventName: string;
171
- propertyName: string;
172
- dataType: number;
173
- total: number;
174
- }
175
- interface EventDataField {
176
- fieldName: string;
177
- dataType: number;
178
- fieldValue?: string;
179
- }
180
- interface Session {
181
- id: string;
182
- websiteId: string;
183
- hostname: string;
184
- browser: string;
185
- os: string;
186
- device: string;
187
- screen: string;
188
- language: string;
189
- country?: string;
190
- subdivision1?: string;
191
- subdivision2?: string;
192
- city?: string;
193
- createdAt: string;
194
- distinctId?: string;
195
- }
196
- interface SessionStats {
197
- pageviews: number;
198
- visitors: number;
199
- visits: number;
200
- countries: number;
201
- }
202
- interface SessionActivity {
203
- createdAt: string;
204
- urlPath: string;
205
- urlQuery?: string;
206
- referrerDomain?: string;
207
- referrerPath?: string;
208
- eventName?: string;
209
- eventType: number;
210
- }
211
- interface Report {
212
- id: string;
213
- userId: string;
214
- websiteId: string;
215
- type: string;
216
- name: string;
217
- description?: string;
218
- parameters: string;
219
- createdAt: string;
220
- updatedAt: string;
221
- }
222
- interface CreateReportData {
223
- websiteId: string;
224
- type: string;
225
- name: string;
226
- description?: string;
227
- parameters: Record<string, unknown>;
228
- }
229
- interface UpdateReportData {
230
- name?: string;
231
- description?: string;
232
- parameters?: Record<string, unknown>;
233
- }
234
- interface Segment {
235
- id: string;
236
- websiteId: string;
237
- name: string;
238
- data: string;
239
- createdAt: string;
240
- updatedAt: string;
241
- }
242
- interface CreateSegmentData {
243
- name: string;
244
- data: Record<string, unknown>;
245
- }
246
- interface UpdateSegmentData {
247
- name?: string;
248
- data?: Record<string, unknown>;
249
- }
250
- interface Link {
251
- id: string;
252
- orgId: string;
253
- name: string;
254
- url: string;
255
- shortUrl: string;
256
- clicks: number;
257
- createdAt: string;
258
- }
259
- interface CreateLinkData {
260
- name: string;
261
- url: string;
262
- shortUrl?: string;
263
- }
264
- interface UpdateLinkData {
265
- name?: string;
266
- url?: string;
267
- }
268
- interface Pixel {
269
- id: string;
270
- orgId: string;
271
- name: string;
272
- trackingId: string;
273
- impressions: number;
274
- createdAt: string;
275
- }
276
- interface CreatePixelData {
277
- name: string;
278
- }
279
- interface UpdatePixelData {
280
- name?: string;
281
- }
282
- interface RealtimeData {
283
- pageviews: PageviewData[];
284
- sessions: PageviewData[];
285
- events: EventData[];
286
- timestamp: number;
287
- }
288
- interface ActiveVisitor {
289
- x: string;
290
- y: number;
291
- }
292
- interface Board {
293
- id: string;
294
- userId: string;
295
- orgId?: string;
296
- websiteId: string;
297
- name: string;
298
- description?: string;
299
- createdAt: string;
300
- updatedAt: string;
301
- }
302
- interface BoardWidget {
303
- id: string;
304
- boardId: string;
305
- title: string;
306
- type: string;
307
- parameters: Record<string, unknown>;
308
- position: {
309
- x: number;
310
- y: number;
311
- w: number;
312
- h: number;
313
- };
314
- createdAt: string;
315
- updatedAt: string;
316
- }
317
- interface CreateBoardData {
318
- websiteId: string;
319
- name: string;
320
- description?: string;
321
- }
322
- interface UpdateBoardData {
323
- name?: string;
324
- description?: string;
325
- }
326
- interface CreateBoardWidgetData {
327
- title: string;
328
- type: string;
329
- parameters?: Record<string, unknown>;
330
- position?: {
331
- x: number;
332
- y: number;
333
- w: number;
334
- h: number;
335
- };
336
- }
337
- interface UpdateBoardWidgetData {
338
- title?: string;
339
- type?: string;
340
- parameters?: Record<string, unknown>;
341
- position?: {
342
- x: number;
343
- y: number;
344
- w: number;
345
- h: number;
346
- };
347
- }
348
- type PlanId = "starter" | "pro" | "business" | "enterprise";
349
- interface AccountUsage {
350
- /** Current billing period start date (ISO string) */
351
- periodStart: string;
352
- /** Current billing period end date (ISO string) */
353
- periodEnd: string;
354
- /** Number of pageviews recorded this period */
355
- pageviews: number;
356
- /** Number of custom events recorded this period */
357
- events: number;
358
- /** Number of websites currently active */
359
- websites: number;
360
- /** Number of team members (for org accounts) */
361
- teamMembers: number;
362
- }
363
- interface AccountEntitlements {
364
- /** User's current plan */
365
- plan: PlanId;
366
- /** Maximum pageviews per month */
367
- maxPageviews: number;
368
- /** Maximum custom events per month */
369
- maxEvents: number;
370
- /** Maximum websites allowed */
371
- maxWebsites: number;
372
- /** Maximum team members allowed */
373
- maxTeamMembers: number;
374
- /** Data retention period in months */
375
- dataRetentionMonths: number;
376
- /** Feature flags */
377
- features: {
378
- customDomains: boolean;
379
- apiAccess: boolean;
380
- webhooks: boolean;
381
- advancedReports: boolean;
382
- exportData: boolean;
383
- whiteLabel: boolean;
384
- prioritySupport: boolean;
385
- sla: boolean;
386
- };
387
- }
388
- interface Subscription {
389
- /** Subscription ID */
390
- id: string;
391
- /** Current plan */
392
- plan: PlanId;
393
- /** Subscription status */
394
- status: "active" | "past_due" | "canceled" | "trialing" | "incomplete";
395
- /** Current billing period start */
396
- currentPeriodStart: string;
397
- /** Current billing period end */
398
- currentPeriodEnd: string;
399
- /** Whether subscription will cancel at period end */
400
- cancelAtPeriodEnd: boolean;
401
- /** Trial end date (if trialing) */
402
- trialEnd?: string;
403
- }
404
- interface CheckoutOptions {
405
- /** Plan to checkout */
406
- plan: PlanId;
407
- /** Billing interval */
408
- interval?: "month" | "year";
409
- /** Success redirect URL */
410
- successUrl?: string;
411
- /** Cancel redirect URL */
412
- cancelUrl?: string;
413
- }
414
- interface CheckoutResponse {
415
- /** Stripe checkout URL */
416
- url: string;
417
- }
418
- interface PortalResponse {
419
- /** Stripe customer portal URL */
420
- url: string;
421
- }
422
- /**
423
- * Website ingest mode configuration
424
- */
425
- type IngestMode = "auto" | "node" | "edge";
426
- interface WebsiteModeConfig {
427
- ingestMode: IngestMode;
428
- }
429
- /**
430
- * Routing health status
431
- */
432
- interface RoutingHealth {
433
- status: "ok" | "degraded" | "error";
434
- edge: {
435
- healthy: boolean;
436
- latency: number;
437
- };
438
- node: {
439
- healthy: boolean;
440
- latency: number;
441
- };
442
- timestamp: string;
443
- }
444
- /**
445
- * Routing statistics
446
- */
447
- interface RoutingStats {
448
- period: {
449
- start: string;
450
- end: string;
451
- };
452
- requests: {
453
- total: number;
454
- edge: number;
455
- node: number;
456
- };
457
- latency: {
458
- edge: {
459
- p50: number;
460
- p95: number;
461
- p99: number;
462
- };
463
- node: {
464
- p50: number;
465
- p95: number;
466
- p99: number;
467
- };
468
- };
469
- }
470
- type VitalMetric = VitalType;
471
- interface WebVital {
472
- id: string;
473
- websiteId: string;
474
- sessionId?: string;
475
- createdAt: string;
476
- metricName: VitalMetric;
477
- metricValue: number;
478
- metricRating: VitalRating;
479
- urlPath: string;
480
- deviceType?: string;
481
- connectionType?: string;
482
- deployId?: string;
483
- navigationType?: NavigationType;
484
- }
485
- interface WebVitalsStats {
486
- metricName: VitalMetric;
487
- goodCount: number;
488
- needsImprovementCount: number;
489
- poorCount: number;
490
- p75Value: number;
491
- p95Value: number;
492
- avgValue: number;
493
- count: number;
494
- goodPercentage: number;
495
- }
496
- interface WebVitalsParams extends DateRangeParams {
497
- metric?: VitalMetric;
498
- urlPath?: string;
499
- deployId?: string;
500
- deviceType?: string;
501
- }
502
- interface TrackVitalData {
503
- visitorId: string;
504
- sessionId: string;
505
- url: string;
506
- path: string;
507
- metric: VitalMetric;
508
- value: number;
509
- rating: VitalRating;
510
- delta?: number;
511
- id?: string;
512
- navigationType?: NavigationType;
513
- attribution?: Record<string, unknown>;
514
- deviceType?: string;
515
- browser?: string;
516
- }
517
- interface FormEvent {
518
- id: string;
519
- websiteId: string;
520
- sessionId?: string;
521
- createdAt: string;
522
- formId: string;
523
- formName?: string;
524
- eventType: FormEventType;
525
- fieldName?: string;
526
- fieldType?: string;
527
- fieldIndex?: number;
528
- timeOnField?: number;
529
- timeSinceStart?: number;
530
- errorMessage?: string;
531
- success?: boolean;
532
- urlPath: string;
533
- }
534
- interface FormStats {
535
- formId: string;
536
- formName: string | null;
537
- starts: number;
538
- submits: number;
539
- abandons: number;
540
- conversionRate: number;
541
- }
542
- interface FormFieldStats {
543
- fieldName: string;
544
- fieldType: FormFieldType;
545
- focusCount: number;
546
- blurCount: number;
547
- errorCount: number;
548
- avgTimeOnField: number;
549
- }
550
- interface FormAnalyticsParams extends DateRangeParams {
551
- formId?: string;
552
- urlPath?: string;
553
- }
554
- interface TrackFormEventData {
555
- visitorId: string;
556
- sessionId: string;
557
- eventType: FormEventType;
558
- formId: string;
559
- formName?: string;
560
- urlPath: string;
561
- fieldName?: string;
562
- fieldType?: string;
563
- fieldIndex?: number;
564
- timeOnField?: number;
565
- timeSinceStart?: number;
566
- errorMessage?: string;
567
- success?: boolean;
568
- }
569
- interface Deployment {
570
- deployId: string;
571
- gitSha: string | null;
572
- gitBranch: string | null;
573
- source: "vercel" | "netlify" | "cloudflare" | "railway" | "render" | "fly" | "heroku" | "aws" | "gcp" | "azure" | "custom";
574
- deployUrl: string | null;
575
- environment: string | null;
576
- deployedAt: string;
577
- pageviews: number;
578
- visitors: number;
579
- errors: number;
580
- }
581
- interface DeploymentComparison {
582
- deployId: string;
583
- gitSha: string | null;
584
- deployedAt: string;
585
- pageviews: number;
586
- visitors: number;
587
- avgLoadTime: number | null;
588
- errorCount: number;
589
- }
590
- interface DeploymentParams extends DateRangeParams {
591
- deployId?: string;
592
- gitBranch?: string;
593
- limit?: number;
594
- }
595
- interface SetDeploymentData {
596
- deployId: string;
597
- gitSha?: string;
598
- gitBranch?: string;
599
- deployUrl?: string;
600
- source?: "vercel" | "netlify" | "cloudflare" | "railway" | "render" | "fly" | "heroku" | "aws" | "gcp" | "azure" | "custom";
601
- }
602
- //#endregion
603
- //#region src/client.d.ts
604
- interface ClientConfig {
605
- /** API endpoint URL (e.g., 'https://analytics.example.com/api') */
606
- endpoint?: string;
607
- /** Bearer token for Clerk-authenticated requests */
608
- bearerToken?: string;
609
- /** API key for programmatic access */
610
- apiKey?: string;
611
- /** Custom fetch implementation */
612
- fetch?: typeof fetch;
613
- /** Number of retry attempts for failed requests (default: 3) */
614
- retries?: number;
615
- /** Base delay between retries in ms (default: 1000) */
616
- retryDelay?: number;
617
- }
618
- type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
619
- interface RequestOptions {
620
- method?: HttpMethod;
621
- body?: unknown;
622
- params?: Record<string, string | number | boolean | undefined>;
623
- headers?: Record<string, string>;
624
- }
625
- /**
626
- * Core API client for making authenticated requests.
627
- */
628
- declare class ApiClient {
629
- private endpoint;
630
- private bearerToken?;
631
- private apiKey?;
632
- private fetchFn;
633
- private retries;
634
- private retryDelay;
635
- constructor(config?: ClientConfig);
636
- /**
637
- * Update the bearer token (useful for token refresh).
638
- */
639
- setBearerToken(token: string): void;
640
- /**
641
- * Generate authentication headers.
642
- * Priority: Bearer token > API key
643
- */
644
- private getAuthHeaders;
645
- /**
646
- * Sleep helper for retry delays.
647
- */
648
- private sleep;
649
- /**
650
- * Check if error is retryable.
651
- */
652
- private isRetryable;
653
- /**
654
- * Build URL with query parameters.
655
- */
656
- private buildUrl;
657
- /**
658
- * Make an authenticated API request with automatic retries.
659
- */
660
- request<T>(path: string, options?: RequestOptions): Promise<ApiResponse<T>>;
661
- /**
662
- * GET request helper.
663
- */
664
- get<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<ApiResponse<T>>;
665
- /**
666
- * POST request helper.
667
- */
668
- post<T>(path: string, body?: unknown): Promise<ApiResponse<T>>;
669
- /**
670
- * PUT request helper.
671
- */
672
- put<T>(path: string, body?: unknown): Promise<ApiResponse<T>>;
673
- /**
674
- * DELETE request helper.
675
- */
676
- delete<T>(path: string): Promise<ApiResponse<T>>;
677
- /**
678
- * PATCH request helper.
679
- */
680
- patch<T>(path: string, body?: unknown): Promise<ApiResponse<T>>;
681
- }
682
- //#endregion
683
- //#region src/endpoints/admin.d.ts
684
- interface AdminOrgParams {
685
- orgId: string;
686
- }
687
- interface AdminUserParams {
688
- userId: string;
689
- }
690
- interface AdminWebsiteParams {
691
- websiteId: string;
692
- }
693
- declare function createAdminEndpoints(client: ApiClient): {
694
- /**
695
- * Get all organizations (admin only)
696
- */
697
- getOrgs: () => Promise<ApiResponse<unknown>>;
698
- /**
699
- * Get organization details (admin only)
700
- */
701
- getOrg: ({ orgId }: AdminOrgParams) => Promise<ApiResponse<unknown>>;
702
- /**
703
- * Get all users (admin only)
704
- */
705
- getUsers: () => Promise<ApiResponse<unknown>>;
706
- /**
707
- * Get user details (admin only)
708
- */
709
- getUser: ({ userId }: AdminUserParams) => Promise<ApiResponse<unknown>>;
710
- /**
711
- * Get all websites (admin only)
712
- */
713
- getWebsites: () => Promise<ApiResponse<unknown>>;
714
- /**
715
- * Get website details (admin only)
716
- */
717
- getWebsite: ({ websiteId }: AdminWebsiteParams) => Promise<ApiResponse<unknown>>;
718
- /**
719
- * Run admin setup
720
- */
721
- setup: () => Promise<ApiResponse<unknown>>;
722
- };
723
- //#endregion
724
- //#region src/endpoints/auth.d.ts
725
- declare function createAuthEndpoints(client: ApiClient): {
726
- /**
727
- * List all active CLI access tokens for the current user.
728
- */
729
- listCliTokens(): Promise<ApiResponse<CliAccessTokenMetadata[]>>;
730
- /**
731
- * Revoke a specific CLI access token by its JTI.
732
- *
733
- * @param jti - The JWT ID of the token to revoke
734
- */
735
- revokeCliToken(jti: string): Promise<ApiResponse<{
736
- message: string;
737
- }>>;
738
- /**
739
- * Revoke all CLI access tokens for the current user.
740
- */
741
- revokeAllCliTokens(): Promise<ApiResponse<{
742
- message: string;
743
- count: number;
744
- }>>;
745
- };
746
- //#endregion
747
- //#region src/endpoints/billing.d.ts
748
- declare function createBillingEndpoints(client: ApiClient): {
749
- /**
750
- * Get current account usage for the billing period.
751
- */
752
- getUsage(): Promise<ApiResponse<AccountUsage>>;
753
- /**
754
- * Get account entitlements based on current plan.
755
- */
756
- getEntitlements(): Promise<ApiResponse<AccountEntitlements>>;
757
- /**
758
- * Get current subscription details.
759
- */
760
- getSubscription(): Promise<ApiResponse<Subscription>>;
761
- /**
762
- * Create a Stripe checkout session for upgrading/changing plan.
763
- */
764
- createCheckoutSession(options: CheckoutOptions): Promise<ApiResponse<CheckoutResponse>>;
765
- /**
766
- * Create a Stripe billing portal session for managing subscription.
767
- */
768
- createPortalSession(): Promise<ApiResponse<PortalResponse>>;
769
- };
770
- //#endregion
771
- //#region src/endpoints/boards.d.ts
772
- declare function createBoardsEndpoints(client: ApiClient): {
773
- /**
774
- * Get all boards for a website.
775
- */
776
- getBoards(websiteId: string): Promise<ApiResponse<Board[]>>;
777
- /**
778
- * Get a specific board by ID.
779
- */
780
- getBoard(boardId: string): Promise<ApiResponse<Board>>;
781
- /**
782
- * Create a new board.
783
- */
784
- createBoard(data: CreateBoardData): Promise<ApiResponse<Board>>;
785
- /**
786
- * Update a board.
787
- */
788
- updateBoard(boardId: string, data: UpdateBoardData): Promise<ApiResponse<Board>>;
789
- /**
790
- * Delete a board.
791
- */
792
- deleteBoard(boardId: string): Promise<ApiResponse<{
793
- ok: boolean;
794
- }>>;
795
- /**
796
- * Get all widgets for a board.
797
- */
798
- getBoardWidgets(boardId: string): Promise<ApiResponse<BoardWidget[]>>;
799
- /**
800
- * Get a specific widget by ID.
801
- */
802
- getBoardWidget(boardId: string, widgetId: string): Promise<ApiResponse<BoardWidget>>;
803
- /**
804
- * Create a new widget on a board.
805
- */
806
- createBoardWidget(boardId: string, data: CreateBoardWidgetData): Promise<ApiResponse<BoardWidget>>;
807
- /**
808
- * Update a widget.
809
- */
810
- updateBoardWidget(boardId: string, widgetId: string, data: UpdateBoardWidgetData): Promise<ApiResponse<BoardWidget>>;
811
- /**
812
- * Delete a widget.
813
- */
814
- deleteBoardWidget(boardId: string, widgetId: string): Promise<ApiResponse<{
815
- ok: boolean;
816
- }>>;
817
- };
818
- //#endregion
819
- //#region src/endpoints/config.d.ts
820
- interface ConfigResponse {
821
- cloudMode: string;
822
- cloudUrl: string;
823
- defaultDateRange: number;
824
- defaultTimezone: string;
825
- disableBot: boolean;
826
- disableLogin: boolean;
827
- disableTelemetry: boolean;
828
- disableUI: boolean;
829
- forceSSL: boolean;
830
- hostname: string;
831
- isTelemetryEnabled: boolean;
832
- trackingCodeScriptUrl: string;
833
- uiDisabled: boolean;
834
- version: string;
835
- }
836
- declare function createConfigEndpoints(client: ApiClient): {
837
- /**
838
- * Get system configuration
839
- */
840
- get: () => Promise<ApiResponse<ConfigResponse>>;
841
- };
842
- //#endregion
843
- //#region src/endpoints/events.d.ts
844
- declare function createEventsEndpoints(client: ApiClient): {
845
- /**
846
- * Get event data statistics.
847
- */
848
- getEventDataStats(websiteId: string, params: DateRangeParams): Promise<ApiResponse<EventStats>>;
849
- /**
850
- * Get event data events (distinct event names).
851
- */
852
- getEventDataEvents(websiteId: string, params: DateRangeParams): Promise<ApiResponse<{
853
- eventName: string;
854
- total: number;
855
- }[]>>;
856
- /**
857
- * Get event data fields for a specific event.
858
- */
859
- getEventDataFields(websiteId: string, params: DateRangeParams & {
860
- eventName: string;
861
- }): Promise<ApiResponse<EventDataField[]>>;
862
- /**
863
- * Get event data values for a specific field.
864
- */
865
- getEventDataValues(websiteId: string, params: DateRangeParams & {
866
- eventName: string;
867
- fieldName: string;
868
- }): Promise<ApiResponse<{
869
- fieldValue: string;
870
- total: number;
871
- }[]>>;
872
- /**
873
- * Get event data properties breakdown.
874
- */
875
- getEventDataProperties(websiteId: string, params: DateRangeParams & {
876
- eventName?: string;
877
- }): Promise<ApiResponse<EventData[]>>;
878
- /**
879
- * Get specific event data by ID.
880
- */
881
- getEventData(websiteId: string, eventId: string): Promise<ApiResponse<Record<string, unknown>>>;
882
- /**
883
- * Get session data properties.
884
- */
885
- getSessionDataProperties(websiteId: string, params: DateRangeParams): Promise<ApiResponse<{
886
- propertyName: string;
887
- total: number;
888
- }[]>>;
889
- getSessionDataValues(websiteId: string, params: DateRangeParams & {
890
- propertyName: string;
891
- }): Promise<ApiResponse<{
892
- propertyValue: string;
893
- total: number;
894
- }[]>>;
895
- /**
896
- * Send a test event to verify setup.
897
- */
898
- sendTestEvent(websiteId: string): Promise<ApiResponse<void>>;
899
- };
900
- //#endregion
901
- //#region src/endpoints/integrations.d.ts
902
- interface IntegrationWordPressParams {
903
- data: unknown;
904
- }
905
- declare function createIntegrationsEndpoints(client: ApiClient): {
906
- /**
907
- * Handle WordPress integration
908
- */
909
- wordpress: (params: IntegrationWordPressParams) => Promise<ApiResponse<unknown>>;
910
- };
911
- //#endregion
912
- //#region src/endpoints/links.d.ts
913
- declare function createLinksEndpoints(client: ApiClient): {
914
- /**
915
- * Get all links.
916
- */
917
- getLinks(): Promise<ApiResponse<Link[]>>;
918
- /**
919
- * Get links for an organization.
920
- */
921
- getOrgLinks(orgId: string): Promise<ApiResponse<Link[]>>;
922
- /**
923
- * Create a new link.
924
- */
925
- createLink(orgId: string, data: CreateLinkData): Promise<ApiResponse<Link>>;
926
- /**
927
- * Get a link by ID.
928
- */
929
- getLink(linkId: string): Promise<ApiResponse<Link>>;
930
- /**
931
- * Update a link.
932
- */
933
- updateLink(linkId: string, data: UpdateLinkData): Promise<ApiResponse<Link>>;
934
- /**
935
- * Delete a link.
936
- */
937
- deleteLink(linkId: string): Promise<ApiResponse<void>>;
938
- /**
939
- * Get link statistics.
940
- */
941
- getLinkStats(linkId: string): Promise<ApiResponse<LinkStats>>;
942
- };
943
- //#endregion
944
- //#region src/endpoints/me.d.ts
945
- declare function createMeEndpoints(client: ApiClient): {
946
- /**
947
- * Get current user profile.
948
- */
949
- getMe(): Promise<ApiResponse<User>>;
950
- /**
951
- * Update current user's password.
952
- */
953
- updateMyPassword(data: {
954
- currentPassword: string;
955
- newPassword: string;
956
- }): Promise<ApiResponse<void>>;
957
- /**
958
- * Get current user's websites.
959
- */
960
- getMyWebsites(): Promise<ApiResponse<Website[]>>;
961
- /**
962
- * Get current user's organizations.
963
- */
964
- getMyOrgs(): Promise<ApiResponse<Organization[]>>;
965
- };
966
- //#endregion
967
- //#region src/endpoints/orgs.d.ts
968
- declare function createOrgsEndpoints(client: ApiClient): {
969
- /**
970
- * Get all organizations for the current user.
971
- */
972
- getOrgs(): Promise<ApiResponse<Organization[]>>;
973
- /**
974
- * Create a new organization.
975
- */
976
- createOrg(data: CreateOrgData): Promise<ApiResponse<Organization>>;
977
- /**
978
- * Join an organization using access code.
979
- */
980
- joinOrg(data: JoinOrgData): Promise<ApiResponse<Organization>>;
981
- /**
982
- * Get an organization by ID.
983
- */
984
- getOrg(orgId: string): Promise<ApiResponse<Organization>>;
985
- /**
986
- * Update an organization.
987
- */
988
- updateOrg(orgId: string, data: UpdateOrgData): Promise<ApiResponse<Organization>>;
989
- /**
990
- * Delete an organization.
991
- */
992
- deleteOrg(orgId: string): Promise<ApiResponse<void>>;
993
- /**
994
- * Get organization members.
995
- */
996
- getOrgMembers(orgId: string): Promise<ApiResponse<OrgMember[]>>;
997
- /**
998
- * Invite a member to an organization.
999
- */
1000
- inviteOrgMember(orgId: string, data: {
1001
- email: string;
1002
- role: "admin" | "member" | "viewer";
1003
- }): Promise<ApiResponse<void>>;
1004
- /**
1005
- * Update an organization member's role.
1006
- */
1007
- updateOrgMember(orgId: string, memberId: string, data: {
1008
- role: "admin" | "member" | "viewer";
1009
- }): Promise<ApiResponse<OrgMember>>;
1010
- /**
1011
- * Remove a member from an organization.
1012
- */
1013
- removeOrgMember(orgId: string, memberId: string): Promise<ApiResponse<void>>;
1014
- /**
1015
- * Get organization websites.
1016
- */
1017
- getOrgWebsites(orgId: string): Promise<ApiResponse<Website[]>>;
1018
- /**
1019
- * Add a website to an organization.
1020
- */
1021
- addOrgWebsite(orgId: string, data: {
1022
- websiteId: string;
1023
- }): Promise<ApiResponse<Website>>;
1024
- /**
1025
- * Remove a website from an organization.
1026
- */
1027
- removeOrgWebsite(orgId: string, websiteId: string): Promise<ApiResponse<void>>;
1028
- };
1029
- //#endregion
1030
- //#region src/endpoints/pixels.d.ts
1031
- declare function createPixelsEndpoints(client: ApiClient): {
1032
- /**
1033
- * Get all pixels.
1034
- */
1035
- getPixels(): Promise<ApiResponse<Pixel[]>>;
1036
- /**
1037
- * Get pixels for an organization.
1038
- */
1039
- getOrgPixels(orgId: string): Promise<ApiResponse<Pixel[]>>;
1040
- /**
1041
- * Create a new pixel.
1042
- */
1043
- createPixel(orgId: string, data: CreatePixelData): Promise<ApiResponse<Pixel>>;
1044
- /**
1045
- * Get a pixel by ID.
1046
- */
1047
- getPixel(pixelId: string): Promise<ApiResponse<Pixel>>;
1048
- /**
1049
- * Update a pixel.
1050
- */
1051
- updatePixel(pixelId: string, data: UpdatePixelData): Promise<ApiResponse<Pixel>>;
1052
- /**
1053
- * Delete a pixel.
1054
- */
1055
- deletePixel(pixelId: string): Promise<ApiResponse<void>>;
1056
- };
1057
- //#endregion
1058
- //#region src/endpoints/reports.d.ts
1059
- interface FunnelResult {
1060
- step: number;
1061
- name: string;
1062
- visitors: number;
1063
- dropoff: number;
1064
- rate: number;
1065
- }
1066
- interface RetentionResult {
1067
- date: string;
1068
- visitors: number;
1069
- returning: number[];
1070
- }
1071
- interface JourneyNode {
1072
- id: string;
1073
- name: string;
1074
- }
1075
- interface JourneyEdge {
1076
- source: string;
1077
- target: string;
1078
- value: number;
1079
- }
1080
- interface JourneyResult {
1081
- nodes: JourneyNode[];
1082
- edges: JourneyEdge[];
1083
- }
1084
- interface GoalResult {
1085
- goal: string;
1086
- visitors: number;
1087
- conversions: number;
1088
- rate: number;
1089
- }
1090
- interface AttributionResult {
1091
- channel: string;
1092
- visitors: number;
1093
- conversions: number;
1094
- revenue: number;
1095
- }
1096
- interface RevenueResult {
1097
- date: string;
1098
- revenue: number;
1099
- transactions: number;
1100
- averageOrder: number;
1101
- }
1102
- interface UTMResult {
1103
- source: string;
1104
- medium: string;
1105
- campaign: string;
1106
- visitors: number;
1107
- conversions: number;
1108
- }
1109
- interface BreakdownResult {
1110
- field: string;
1111
- value: string;
1112
- visitors: number;
1113
- pageviews: number;
1114
- }
1115
- declare function createReportsEndpoints(client: ApiClient): {
1116
- /**
1117
- * Get all reports for a website.
1118
- */
1119
- getReports(websiteId: string): Promise<ApiResponse<Report[]>>;
1120
- /**
1121
- * Create a new report.
1122
- */
1123
- createReport(data: CreateReportData): Promise<ApiResponse<Report>>;
1124
- /**
1125
- * Get a report by ID.
1126
- */
1127
- getReport(reportId: string): Promise<ApiResponse<Report>>;
1128
- /**
1129
- * Update a report.
1130
- */
1131
- updateReport(reportId: string, data: UpdateReportData): Promise<ApiResponse<Report>>;
1132
- /**
1133
- * Delete a report.
1134
- */
1135
- deleteReport(reportId: string): Promise<ApiResponse<void>>;
1136
- /**
1137
- * Run a funnel report.
1138
- */
1139
- runFunnelReport(params: DateRangeParams & {
1140
- websiteId: string;
1141
- steps: {
1142
- type: "path" | "event";
1143
- value: string;
1144
- }[];
1145
- window?: number;
1146
- }): Promise<ApiResponse<FunnelResult[]>>;
1147
- /**
1148
- * Run a retention report.
1149
- */
1150
- runRetentionReport(params: DateRangeParams & {
1151
- websiteId: string;
1152
- timezone?: string;
1153
- }): Promise<ApiResponse<RetentionResult[]>>;
1154
- /**
1155
- * Run a journey/flow report.
1156
- */
1157
- runJourneyReport(params: DateRangeParams & {
1158
- websiteId: string;
1159
- steps?: number;
1160
- startStep?: string;
1161
- endStep?: string;
1162
- }): Promise<ApiResponse<JourneyResult>>;
1163
- /**
1164
- * Run a goals report.
1165
- */
1166
- runGoalReport(params: DateRangeParams & {
1167
- websiteId: string;
1168
- type: string;
1169
- value: string;
1170
- }): Promise<ApiResponse<GoalResult[]>>;
1171
- /**
1172
- * Run an attribution report.
1173
- */
1174
- runAttributionReport(params: DateRangeParams & {
1175
- websiteId: string;
1176
- model: "first-click" | "last-click";
1177
- type: "path" | "event";
1178
- step: string;
1179
- currency?: string;
1180
- }): Promise<ApiResponse<AttributionResult[]>>;
1181
- /**
1182
- * Run a revenue report.
1183
- */
1184
- runRevenueReport(params: DateRangeParams & {
1185
- websiteId: string;
1186
- currency?: string;
1187
- }): Promise<ApiResponse<RevenueResult[]>>;
1188
- /**
1189
- * Run a UTM report.
1190
- */
1191
- runUTMReport(params: DateRangeParams & {
1192
- websiteId: string;
1193
- }): Promise<ApiResponse<UTMResult[]>>;
1194
- /**
1195
- * Run a breakdown report.
1196
- * @param property - Field to break down by (path, referrer, browser, device, os, country, etc.)
1197
- */
1198
- runBreakdownReport(params: DateRangeParams & {
1199
- websiteId: string;
1200
- property: string;
1201
- }): Promise<ApiResponse<BreakdownResult[]>>;
1202
- };
1203
- //#endregion
1204
- //#region src/endpoints/segments.d.ts
1205
- declare function createSegmentsEndpoints(client: ApiClient): {
1206
- /**
1207
- * Get all segments for a website.
1208
- */
1209
- getSegments(websiteId: string): Promise<ApiResponse<Segment[]>>;
1210
- /**
1211
- * Create a new segment.
1212
- */
1213
- createSegment(websiteId: string, data: CreateSegmentData): Promise<ApiResponse<Segment>>;
1214
- /**
1215
- * Get a segment by ID.
1216
- */
1217
- getSegment(websiteId: string, segmentId: string): Promise<ApiResponse<Segment>>;
1218
- /**
1219
- * Update a segment.
1220
- */
1221
- updateSegment(websiteId: string, segmentId: string, data: UpdateSegmentData): Promise<ApiResponse<Segment>>;
1222
- /**
1223
- * Delete a segment.
1224
- */
1225
- deleteSegment(websiteId: string, segmentId: string): Promise<ApiResponse<void>>;
1226
- };
1227
- //#endregion
1228
- //#region src/endpoints/sessions.d.ts
1229
- declare function createSessionsEndpoints(client: ApiClient): {
1230
- /**
1231
- * Get website sessions.
1232
- */
1233
- getWebsiteSessions(websiteId: string, params: DateRangeParams & {
1234
- query?: string;
1235
- limit?: number;
1236
- offset?: number;
1237
- }): Promise<ApiResponse<Session[]>>;
1238
- /**
1239
- * Get session statistics.
1240
- */
1241
- getWebsiteSessionStats(websiteId: string, params: DateRangeParams): Promise<ApiResponse<SessionStats>>;
1242
- /**
1243
- * Get weekly session traffic.
1244
- */
1245
- getWeeklyTraffic(websiteId: string, params: DateRangeParams & {
1246
- timezone?: string;
1247
- }): Promise<ApiResponse<{
1248
- day: number;
1249
- hour: number;
1250
- y: number;
1251
- }[]>>;
1252
- /**
1253
- * Get a specific session.
1254
- */
1255
- getSession(websiteId: string, sessionId: string): Promise<ApiResponse<Session>>;
1256
- /**
1257
- * Get session activity (pageviews and events).
1258
- */
1259
- getSessionActivity(websiteId: string, sessionId: string, params: DateRangeParams): Promise<ApiResponse<SessionActivity[]>>;
1260
- /**
1261
- * Get session properties (custom data).
1262
- */
1263
- getSessionProperties(websiteId: string, sessionId: string): Promise<ApiResponse<Record<string, string | number | boolean>[]>>;
1264
- };
1265
- //#endregion
1266
- //#region src/endpoints/users.d.ts
1267
- declare function createUsersEndpoints(client: ApiClient): {
1268
- /**
1269
- * Get all users (admin only).
1270
- */
1271
- getUsers(): Promise<ApiResponse<User[]>>;
1272
- /**
1273
- * Create a new user (admin only).
1274
- */
1275
- createUser(data: CreateUserData): Promise<ApiResponse<User>>;
1276
- /**
1277
- * Get a user by ID.
1278
- */
1279
- getUser(userId: string): Promise<ApiResponse<User>>;
1280
- /**
1281
- * Update a user.
1282
- */
1283
- updateUser(userId: string, data: UpdateUserData): Promise<ApiResponse<User>>;
1284
- /**
1285
- * Delete a user (admin only).
1286
- */
1287
- deleteUser(userId: string): Promise<ApiResponse<void>>;
1288
- /**
1289
- * Get websites belonging to a user.
1290
- */
1291
- getUserWebsites(userId: string): Promise<ApiResponse<Website[]>>;
1292
- /**
1293
- * Get user usage statistics.
1294
- */
1295
- getUserUsage(userId: string, params: {
1296
- startAt: number;
1297
- endAt: number;
1298
- }): Promise<ApiResponse<{
1299
- websiteCount: number;
1300
- eventCount: number;
1301
- }>>;
1302
- };
1303
- //#endregion
1304
- //#region src/endpoints/webhooks.d.ts
1305
- interface WebhookClerkParams {
1306
- data: unknown;
1307
- }
1308
- declare function createWebhooksEndpoints(client: ApiClient): {
1309
- /**
1310
- * Handle Clerk webhook
1311
- */
1312
- clerk: (params: WebhookClerkParams) => Promise<ApiResponse<unknown>>;
1313
- };
1314
- //#endregion
1315
- //#region src/endpoints/websites.d.ts
1316
- declare function createWebsitesEndpoints(client: ApiClient): {
1317
- /**
1318
- * Get all websites.
1319
- */
1320
- getWebsites(): Promise<ApiResponse<Website[]>>;
1321
- /**
1322
- * Create a new website.
1323
- */
1324
- createWebsite(data: CreateWebsiteData): Promise<ApiResponse<Website>>;
1325
- /**
1326
- * Get a website by ID.
1327
- */
1328
- getWebsite(websiteId: string): Promise<ApiResponse<Website>>;
1329
- /**
1330
- * Update a website.
1331
- */
1332
- updateWebsite(websiteId: string, data: UpdateWebsiteData): Promise<ApiResponse<Website>>;
1333
- /**
1334
- * Delete a website.
1335
- */
1336
- deleteWebsite(websiteId: string): Promise<ApiResponse<void>>;
1337
- /**
1338
- * Reset a website's data.
1339
- */
1340
- resetWebsite(websiteId: string): Promise<ApiResponse<void>>;
1341
- /**
1342
- * Transfer website ownership.
1343
- */
1344
- transferWebsite(websiteId: string, data: {
1345
- userId?: string;
1346
- orgId?: string;
1347
- }): Promise<ApiResponse<Website>>;
1348
- /**
1349
- * Get website statistics.
1350
- */
1351
- getWebsiteStats(websiteId: string, params: DateRangeParams): Promise<ApiResponse<WebsiteStats>>;
1352
- /**
1353
- * Get website pageviews data.
1354
- */
1355
- getWebsitePageviews(websiteId: string, params: DateRangeParams & {
1356
- unit?: string;
1357
- timezone?: string;
1358
- }): Promise<ApiResponse<WebsitePageviews>>;
1359
- /**
1360
- * Get website metrics (URLs, referrers, browsers, etc.).
1361
- */
1362
- getWebsiteMetrics(websiteId: string, params: WebsiteMetricsParams): Promise<ApiResponse<MetricData[]>>;
1363
- /**
1364
- * Get expanded metrics (with additional details).
1365
- */
1366
- getWebsiteExpandedMetrics(websiteId: string, params: WebsiteMetricsParams): Promise<ApiResponse<MetricData[]>>;
1367
- /**
1368
- * Get website events.
1369
- */
1370
- getWebsiteEvents(websiteId: string, params: DateRangeParams & {
1371
- query?: string;
1372
- limit?: number;
1373
- offset?: number;
1374
- }): Promise<ApiResponse<WebsiteEvent[]>>;
1375
- /**
1376
- * Get events time series.
1377
- */
1378
- getWebsiteEventsSeries(websiteId: string, params: DateRangeParams & {
1379
- unit?: string;
1380
- timezone?: string;
1381
- event?: string;
1382
- }): Promise<ApiResponse<{
1383
- x: string;
1384
- y: number;
1385
- }[]>>;
1386
- /**
1387
- * Get active visitors count.
1388
- */
1389
- getWebsiteActive(websiteId: string): Promise<ApiResponse<ActiveVisitor[]>>;
1390
- /**
1391
- * Get website date range (first and last event dates).
1392
- */
1393
- getWebsiteDateRange(websiteId: string): Promise<ApiResponse<{
1394
- minDate: string;
1395
- maxDate: string;
1396
- }>>;
1397
- /**
1398
- * Get website values for a specific field.
1399
- */
1400
- getWebsiteValues(websiteId: string, params: DateRangeParams & {
1401
- type: string;
1402
- }): Promise<ApiResponse<string[]>>;
1403
- /**
1404
- * Get realtime data.
1405
- */
1406
- getRealtimeData(websiteId: string): Promise<ApiResponse<RealtimeData>>;
1407
- /**
1408
- * Export website data.
1409
- */
1410
- exportWebsiteData(websiteId: string, params: DateRangeParams & {
1411
- type: "csv" | "json";
1412
- }): Promise<ApiResponse<string>>;
1413
- /**
1414
- * Get website ingest mode configuration.
1415
- */
1416
- getWebsiteMode(websiteId: string): Promise<ApiResponse<WebsiteModeConfig>>;
1417
- /**
1418
- * Set website ingest mode (auto, node, or edge).
1419
- */
1420
- setWebsiteMode(websiteId: string, mode: IngestMode): Promise<ApiResponse<{
1421
- message: string;
1422
- }>>;
1423
- /**
1424
- * Get routing health status.
1425
- */
1426
- getRoutingHealth(): Promise<ApiResponse<RoutingHealth>>;
1427
- /**
1428
- * Get routing statistics.
1429
- */
1430
- getRoutingStats(params?: {
1431
- start?: string;
1432
- end?: string;
1433
- }): Promise<ApiResponse<RoutingStats>>;
1434
- /**
1435
- * Get Web Vitals statistics for a website.
1436
- * Note: Only available in entrolytics.
1437
- */
1438
- getWebsiteVitals(websiteId: string, params: WebVitalsParams): Promise<ApiResponse<WebVitalsStats[]>>;
1439
- /**
1440
- * Get individual Web Vital events.
1441
- * Note: Only available in entrolytics.
1442
- */
1443
- getWebsiteVitalEvents(websiteId: string, params: WebVitalsParams & {
1444
- limit?: number;
1445
- offset?: number;
1446
- }): Promise<ApiResponse<WebVital[]>>;
1447
- /**
1448
- * Track a Web Vital metric (send to collection endpoint).
1449
- * Note: Only available in entrolytics.
1450
- */
1451
- trackVital(websiteId: string, data: TrackVitalData): Promise<ApiResponse<{
1452
- success: boolean;
1453
- }>>;
1454
- /**
1455
- * Track multiple Web Vitals metrics in batch.
1456
- * Note: Only available in entrolytics.
1457
- */
1458
- trackVitalsBatch(websiteId: string, vitals: TrackVitalData[]): Promise<ApiResponse<{
1459
- success: boolean;
1460
- count: number;
1461
- }>>;
1462
- /**
1463
- * Get form analytics for a website.
1464
- * Note: Only available in entrolytics.
1465
- */
1466
- getWebsiteForms(websiteId: string, params: FormAnalyticsParams): Promise<ApiResponse<FormStats[]>>;
1467
- /**
1468
- * Get field-level analytics for a specific form.
1469
- * Note: Only available in entrolytics.
1470
- */
1471
- getFormFields(websiteId: string, formId: string, params: FormAnalyticsParams): Promise<ApiResponse<FormFieldStats[]>>;
1472
- /**
1473
- * Get individual form events.
1474
- * Note: Only available in entrolytics.
1475
- */
1476
- getFormEvents(websiteId: string, params: FormAnalyticsParams & {
1477
- limit?: number;
1478
- offset?: number;
1479
- }): Promise<ApiResponse<FormEvent[]>>;
1480
- /**
1481
- * Track a form event (send to collection endpoint).
1482
- * Note: Only available in entrolytics.
1483
- */
1484
- trackFormEvent(websiteId: string, data: TrackFormEventData): Promise<ApiResponse<{
1485
- success: boolean;
1486
- }>>;
1487
- /**
1488
- * Track multiple form events in batch.
1489
- * Note: Only available in entrolytics.
1490
- */
1491
- trackFormEventsBatch(websiteId: string, events: TrackFormEventData[]): Promise<ApiResponse<{
1492
- success: boolean;
1493
- count: number;
1494
- }>>;
1495
- /**
1496
- * Get deployments for a website.
1497
- * Note: Only available in entrolytics.
1498
- */
1499
- getWebsiteDeployments(websiteId: string, params: DeploymentParams): Promise<ApiResponse<Deployment[]>>;
1500
- /**
1501
- * Get a specific deployment.
1502
- * Note: Only available in entrolytics.
1503
- */
1504
- getDeployment(websiteId: string, deployId: string): Promise<ApiResponse<Deployment>>;
1505
- /**
1506
- * Compare two deployments.
1507
- * Note: Only available in entrolytics.
1508
- */
1509
- compareDeployments(websiteId: string, limit?: number): Promise<ApiResponse<DeploymentComparison[]>>;
1510
- /**
1511
- * Set/register a deployment context.
1512
- * Note: Only available in entrolytics.
1513
- */
1514
- setDeployment(websiteId: string, data: SetDeploymentData): Promise<ApiResponse<Deployment>>;
1515
- };
1516
- //#endregion
1517
- //#region src/runtime.d.ts
1518
- /**
1519
- * Runtime detection utilities for Node.js vs Edge environments
1520
- *
1521
- * @module runtime
1522
- * @example
1523
- * ```ts
1524
- * import { detectRuntime, isNodeRuntime, isEdgeRuntime } from 'entro-api/runtime';
1525
- *
1526
- * // Detect current runtime
1527
- * const runtime = detectRuntime();
1528
- * console.log(runtime); // 'node' | 'edge' | 'unknown'
1529
- *
1530
- * // Check specific runtime
1531
- * if (isNodeRuntime()) {
1532
- * // Use Node.js-specific features
1533
- * }
1534
- *
1535
- * if (isEdgeRuntime()) {
1536
- * // Use edge-compatible features only
1537
- * }
1538
- * ```
1539
- */
1540
- type Runtime = "node" | "edge" | "unknown";
1541
- /**
1542
- * Detect the current JavaScript runtime environment
1543
- *
1544
- * @returns {Runtime} The detected runtime ('node', 'edge', or 'unknown')
1545
- *
1546
- * @example
1547
- * ```ts
1548
- * const runtime = detectRuntime();
1549
- *
1550
- * switch (runtime) {
1551
- * case 'node':
1552
- * console.log('Running in Node.js');
1553
- * break;
1554
- * case 'edge':
1555
- * console.log('Running in Edge Runtime');
1556
- * break;
1557
- * default:
1558
- * console.log('Unknown runtime');
1559
- * }
1560
- * ```
1561
- */
1562
- declare function detectRuntime(): Runtime;
1563
- /**
1564
- * Check if code is running in Node.js runtime
1565
- *
1566
- * @returns {boolean} True if running in Node.js
1567
- *
1568
- * @example
1569
- * ```ts
1570
- * if (isNodeRuntime()) {
1571
- * // Safe to use Node.js-only features
1572
- * const fs = require('fs');
1573
- * const data = fs.readFileSync('file.txt');
1574
- * }
1575
- * ```
1576
- */
1577
- declare function isNodeRuntime(): boolean;
1578
- /**
1579
- * Check if code is running in Edge runtime
1580
- *
1581
- * @returns {boolean} True if running in Edge runtime (Vercel, Netlify, Cloudflare)
1582
- *
1583
- * @example
1584
- * ```ts
1585
- * if (isEdgeRuntime()) {
1586
- * // Use only edge-compatible features
1587
- * const response = await fetch('https://api.example.com');
1588
- * }
1589
- * ```
1590
- */
1591
- declare function isEdgeRuntime(): boolean;
1592
- /**
1593
- * Get runtime capabilities
1594
- *
1595
- * @returns Runtime capabilities object
1596
- *
1597
- * @example
1598
- * ```ts
1599
- * const capabilities = getRuntimeCapabilities();
1600
- *
1601
- * if (capabilities.supportsFileSystem) {
1602
- * // Can use fs module
1603
- * }
1604
- *
1605
- * if (capabilities.supportsWebCrypto) {
1606
- * // Can use Web Crypto API
1607
- * }
1608
- * ```
1609
- */
1610
- declare function getRuntimeCapabilities(): {
1611
- runtime: Runtime;
1612
- isNode: boolean;
1613
- isEdge: boolean;
1614
- supportsFileSystem: boolean;
1615
- supportsWebCrypto: boolean;
1616
- supportsFetch: boolean;
1617
- supportsStreams: boolean;
1618
- };
1619
- /**
1620
- * Assert that code is running in a specific runtime
1621
- *
1622
- * @param {Runtime} expected - The expected runtime
1623
- * @throws {Error} If not running in the expected runtime
1624
- *
1625
- * @example
1626
- * ```ts
1627
- * // Ensure we're in edge runtime
1628
- * assertRuntime('edge');
1629
- *
1630
- * // Now safe to use edge-only features
1631
- * export const runtime = 'edge';
1632
- * ```
1633
- */
1634
- declare function assertRuntime(expected: Runtime): void;
1635
- //#endregion
1636
- //#region src/edge-helpers.d.ts
1637
- /**
1638
- * Edge runtime helper utilities
1639
- *
1640
- * Provides edge-compatible environment variable access, fetch utilities,
1641
- * and common patterns for edge deployments (Vercel, Netlify, Cloudflare).
1642
- *
1643
- * @module edge-helpers
1644
- * @example
1645
- * ```ts
1646
- * import { getEdgeEnv, createEdgeFetch, getRegionInfo } from 'entro-api/edge-helpers';
1647
- *
1648
- * // Access environment variables safely
1649
- * const apiKey = getEdgeEnv('API_KEY', 'default-key');
1650
- *
1651
- * // Create a fetch wrapper with retries
1652
- * const edgeFetch = createEdgeFetch({ retries: 3 });
1653
- * const response = await edgeFetch('https://api.example.com');
1654
- *
1655
- * // Get deployment region information
1656
- * const region = getRegionInfo();
1657
- * console.log(`Running in ${region.provider} region ${region.region}`);
1658
- * ```
1659
- */
1660
- /**
1661
- * Safely access environment variables in edge runtime
1662
- *
1663
- * @param {string} key - Environment variable name
1664
- * @param {string} [defaultValue] - Optional default value if variable not found
1665
- * @returns {string | undefined} The environment variable value or default
1666
- *
1667
- * @example
1668
- * ```ts
1669
- * // With default value
1670
- * const apiKey = getEdgeEnv('API_KEY', 'fallback-key');
1671
- *
1672
- * // Without default (returns undefined if not found)
1673
- * const optionalVar = getEdgeEnv('OPTIONAL_VAR');
1674
- * ```
1675
- */
1676
- declare function getEdgeEnv(key: string, defaultValue?: string): string | undefined;
1677
- /**
1678
- * Check if a required environment variable is set
1679
- *
1680
- * @param {string} key - Environment variable name
1681
- * @throws {Error} If the required variable is not set
1682
- *
1683
- * @example
1684
- * ```ts
1685
- * // Throws if DATABASE_URL is not set
1686
- * requireEdgeEnv('DATABASE_URL');
1687
- * ```
1688
- */
1689
- declare function requireEdgeEnv(key: string): string;
1690
- interface EdgeFetchOptions extends RequestInit {
1691
- /** Number of retry attempts (default: 3) */
1692
- retries?: number;
1693
- /** Base delay between retries in ms (default: 1000) */
1694
- retryDelay?: number;
1695
- /** Timeout in milliseconds (default: 30000) */
1696
- timeout?: number;
1697
- }
1698
- /**
1699
- * Create an edge-compatible fetch wrapper with retries and timeout
1700
- *
1701
- * @param {EdgeFetchOptions} [defaultOptions] - Default options for all requests
1702
- * @returns {Function} Enhanced fetch function
1703
- *
1704
- * @example
1705
- * ```ts
1706
- * const edgeFetch = createEdgeFetch({
1707
- * retries: 3,
1708
- * retryDelay: 1000,
1709
- * timeout: 10000,
1710
- * });
1711
- *
1712
- * // Fetch with automatic retries
1713
- * const response = await edgeFetch('https://api.example.com/data');
1714
- * ```
1715
- */
1716
- declare function createEdgeFetch(defaultOptions?: EdgeFetchOptions): (input: RequestInfo | URL, options?: EdgeFetchOptions) => Promise<Response>;
1717
- interface RegionInfo {
1718
- /** Cloud provider (vercel, netlify, cloudflare, unknown) */
1719
- provider: "vercel" | "netlify" | "cloudflare" | "unknown";
1720
- /** Region code (e.g., 'iad1', 'us-east-1') */
1721
- region?: string;
1722
- /** Whether running in edge runtime */
1723
- isEdge: boolean;
1724
- }
1725
- /**
1726
- * Get information about the current edge deployment region
1727
- *
1728
- * @returns {RegionInfo} Information about the deployment region
1729
- *
1730
- * @example
1731
- * ```ts
1732
- * const region = getRegionInfo();
1733
- *
1734
- * if (region.provider === 'vercel') {
1735
- * console.log(`Running in Vercel region: ${region.region}`);
1736
- * }
1737
- * ```
1738
- */
1739
- declare function getRegionInfo(): RegionInfo;
1740
- /**
1741
- * Extract geo information from edge request
1742
- *
1743
- * @param {Request} request - The incoming Request object
1744
- * @returns {Object} Geo information extracted from headers
1745
- *
1746
- * @example
1747
- * ```ts
1748
- * export async function POST(request: Request) {
1749
- * const geo = getGeoFromRequest(request);
1750
- * console.log(`Request from: ${geo.country}, ${geo.city}`);
1751
- * }
1752
- * ```
1753
- */
1754
- declare function getGeoFromRequest(request: Request): {
1755
- country: string;
1756
- region: string | null;
1757
- city: string | null;
1758
- latitude: string | null;
1759
- longitude: string | null;
1760
- } | {
1761
- country: undefined;
1762
- region: undefined;
1763
- city: undefined;
1764
- latitude: undefined;
1765
- longitude: undefined;
1766
- };
1767
- /**
1768
- * Get client IP address from edge request
1769
- *
1770
- * @param {Request} request - The incoming Request object
1771
- * @returns {string | undefined} The client IP address
1772
- *
1773
- * @example
1774
- * ```ts
1775
- * export async function POST(request: Request) {
1776
- * const clientIp = getClientIp(request);
1777
- * console.log(`Request from IP: ${clientIp}`);
1778
- * }
1779
- * ```
1780
- */
1781
- declare function getClientIp(request: Request): string | undefined;
1782
- //#endregion
1783
- //#region src/index.d.ts
1
+ import { ApiClient, type ClientConfig } from "./client";
2
+ import { createAdminEndpoints, createAuthEndpoints, createBillingEndpoints, createBoardsEndpoints, createConfigEndpoints, createEventsEndpoints, createIntegrationsEndpoints, createLinksEndpoints, createMeEndpoints, createOrgsEndpoints, createPixelsEndpoints, createReportsEndpoints, createSegmentsEndpoints, createSessionsEndpoints, createUsersEndpoints, createWebhooksEndpoints, createWebsitesEndpoints } from "./endpoints";
3
+ export type { ClientConfig } from "./client";
4
+ export { PLANS, PLAN_FEATURES, USAGE_THRESHOLDS, BILLING_ERRORS, API_ENDPOINTS, DEFAULT_API_HOST, ENV_VAR_NAMES, CLI_CONFIG, EVENT_TYPES, SDK_EVENT_TYPES, VITAL_TYPES, VITAL_RATINGS, VITAL_THRESHOLDS, NAVIGATION_TYPES, FORM_EVENT_TYPES, FORM_FIELD_TYPES, DEPLOYMENT_SOURCES, DEPLOYMENT_ENV_VARS, HTTP_STATUS, API_ROUTES, ONBOARDING_STEPS, CLI_TOKEN_STATUS, USER_ROLES, FRAMEWORK_PACKAGES, FRAMEWORK_PATTERNS, RATE_LIMITS, ERROR_MESSAGES, SUCCESS_MESSAGES, getEnvVarNames, getFrameworkPackage, isValidFramework, getApiRoute, getPlan, isPlanFeatureEnabled, getPlanLimit, isUsageWarning, isUsageCritical, getVitalRating, detectDeploymentContext, } from "@entrolytics/shared";
5
+ export * from "./types";
1784
6
  /**
1785
7
  * Entrolytics API client with all endpoints.
1786
8
  */
1787
- interface EntrolyticsClient {
1788
- auth: ReturnType<typeof createAuthEndpoints>;
1789
- getMe: ReturnType<typeof createMeEndpoints>["getMe"];
1790
- updateMyPassword: ReturnType<typeof createMeEndpoints>["updateMyPassword"];
1791
- getMyWebsites: ReturnType<typeof createMeEndpoints>["getMyWebsites"];
1792
- getMyOrgs: ReturnType<typeof createMeEndpoints>["getMyOrgs"];
1793
- getUsers: ReturnType<typeof createUsersEndpoints>["getUsers"];
1794
- createUser: ReturnType<typeof createUsersEndpoints>["createUser"];
1795
- getUser: ReturnType<typeof createUsersEndpoints>["getUser"];
1796
- updateUser: ReturnType<typeof createUsersEndpoints>["updateUser"];
1797
- deleteUser: ReturnType<typeof createUsersEndpoints>["deleteUser"];
1798
- getUserWebsites: ReturnType<typeof createUsersEndpoints>["getUserWebsites"];
1799
- getUserUsage: ReturnType<typeof createUsersEndpoints>["getUserUsage"];
1800
- getOrgs: ReturnType<typeof createOrgsEndpoints>["getOrgs"];
1801
- createOrg: ReturnType<typeof createOrgsEndpoints>["createOrg"];
1802
- joinOrg: ReturnType<typeof createOrgsEndpoints>["joinOrg"];
1803
- getOrg: ReturnType<typeof createOrgsEndpoints>["getOrg"];
1804
- updateOrg: ReturnType<typeof createOrgsEndpoints>["updateOrg"];
1805
- deleteOrg: ReturnType<typeof createOrgsEndpoints>["deleteOrg"];
1806
- getOrgMembers: ReturnType<typeof createOrgsEndpoints>["getOrgMembers"];
1807
- inviteOrgMember: ReturnType<typeof createOrgsEndpoints>["inviteOrgMember"];
1808
- updateOrgMember: ReturnType<typeof createOrgsEndpoints>["updateOrgMember"];
1809
- removeOrgMember: ReturnType<typeof createOrgsEndpoints>["removeOrgMember"];
1810
- getOrgWebsites: ReturnType<typeof createOrgsEndpoints>["getOrgWebsites"];
1811
- addOrgWebsite: ReturnType<typeof createOrgsEndpoints>["addOrgWebsite"];
1812
- removeOrgWebsite: ReturnType<typeof createOrgsEndpoints>["removeOrgWebsite"];
1813
- getWebsites: ReturnType<typeof createWebsitesEndpoints>["getWebsites"];
1814
- createWebsite: ReturnType<typeof createWebsitesEndpoints>["createWebsite"];
1815
- getWebsite: ReturnType<typeof createWebsitesEndpoints>["getWebsite"];
1816
- updateWebsite: ReturnType<typeof createWebsitesEndpoints>["updateWebsite"];
1817
- deleteWebsite: ReturnType<typeof createWebsitesEndpoints>["deleteWebsite"];
1818
- resetWebsite: ReturnType<typeof createWebsitesEndpoints>["resetWebsite"];
1819
- transferWebsite: ReturnType<typeof createWebsitesEndpoints>["transferWebsite"];
1820
- getWebsiteStats: ReturnType<typeof createWebsitesEndpoints>["getWebsiteStats"];
1821
- getWebsitePageviews: ReturnType<typeof createWebsitesEndpoints>["getWebsitePageviews"];
1822
- getWebsiteMetrics: ReturnType<typeof createWebsitesEndpoints>["getWebsiteMetrics"];
1823
- getWebsiteExpandedMetrics: ReturnType<typeof createWebsitesEndpoints>["getWebsiteExpandedMetrics"];
1824
- getWebsiteEvents: ReturnType<typeof createWebsitesEndpoints>["getWebsiteEvents"];
1825
- getWebsiteEventsSeries: ReturnType<typeof createWebsitesEndpoints>["getWebsiteEventsSeries"];
1826
- getWebsiteActive: ReturnType<typeof createWebsitesEndpoints>["getWebsiteActive"];
1827
- getWebsiteDateRange: ReturnType<typeof createWebsitesEndpoints>["getWebsiteDateRange"];
1828
- getWebsiteValues: ReturnType<typeof createWebsitesEndpoints>["getWebsiteValues"];
1829
- getRealtimeData: ReturnType<typeof createWebsitesEndpoints>["getRealtimeData"];
1830
- exportWebsiteData: ReturnType<typeof createWebsitesEndpoints>["exportWebsiteData"];
1831
- getWebsiteVitals: ReturnType<typeof createWebsitesEndpoints>["getWebsiteVitals"];
1832
- getWebsiteVitalEvents: ReturnType<typeof createWebsitesEndpoints>["getWebsiteVitalEvents"];
1833
- trackVital: ReturnType<typeof createWebsitesEndpoints>["trackVital"];
1834
- trackVitalsBatch: ReturnType<typeof createWebsitesEndpoints>["trackVitalsBatch"];
1835
- getWebsiteForms: ReturnType<typeof createWebsitesEndpoints>["getWebsiteForms"];
1836
- getFormFields: ReturnType<typeof createWebsitesEndpoints>["getFormFields"];
1837
- getFormEvents: ReturnType<typeof createWebsitesEndpoints>["getFormEvents"];
1838
- trackFormEvent: ReturnType<typeof createWebsitesEndpoints>["trackFormEvent"];
1839
- trackFormEventsBatch: ReturnType<typeof createWebsitesEndpoints>["trackFormEventsBatch"];
1840
- getWebsiteDeployments: ReturnType<typeof createWebsitesEndpoints>["getWebsiteDeployments"];
1841
- getDeployment: ReturnType<typeof createWebsitesEndpoints>["getDeployment"];
1842
- compareDeployments: ReturnType<typeof createWebsitesEndpoints>["compareDeployments"];
1843
- setDeployment: ReturnType<typeof createWebsitesEndpoints>["setDeployment"];
1844
- getWebsiteSessions: ReturnType<typeof createSessionsEndpoints>["getWebsiteSessions"];
1845
- getWebsiteSessionStats: ReturnType<typeof createSessionsEndpoints>["getWebsiteSessionStats"];
1846
- getWeeklyTraffic: ReturnType<typeof createSessionsEndpoints>["getWeeklyTraffic"];
1847
- getSession: ReturnType<typeof createSessionsEndpoints>["getSession"];
1848
- getSessionActivity: ReturnType<typeof createSessionsEndpoints>["getSessionActivity"];
1849
- getSessionProperties: ReturnType<typeof createSessionsEndpoints>["getSessionProperties"];
1850
- getEventDataStats: ReturnType<typeof createEventsEndpoints>["getEventDataStats"];
1851
- getEventDataEvents: ReturnType<typeof createEventsEndpoints>["getEventDataEvents"];
1852
- getEventDataFields: ReturnType<typeof createEventsEndpoints>["getEventDataFields"];
1853
- getEventDataValues: ReturnType<typeof createEventsEndpoints>["getEventDataValues"];
1854
- getEventDataProperties: ReturnType<typeof createEventsEndpoints>["getEventDataProperties"];
1855
- getEventData: ReturnType<typeof createEventsEndpoints>["getEventData"];
1856
- getSessionDataProperties: ReturnType<typeof createEventsEndpoints>["getSessionDataProperties"];
1857
- getSessionDataValues: ReturnType<typeof createEventsEndpoints>["getSessionDataValues"];
1858
- sendTestEvent: ReturnType<typeof createEventsEndpoints>["sendTestEvent"];
1859
- getReports: ReturnType<typeof createReportsEndpoints>["getReports"];
1860
- createReport: ReturnType<typeof createReportsEndpoints>["createReport"];
1861
- getReport: ReturnType<typeof createReportsEndpoints>["getReport"];
1862
- updateReport: ReturnType<typeof createReportsEndpoints>["updateReport"];
1863
- deleteReport: ReturnType<typeof createReportsEndpoints>["deleteReport"];
1864
- runFunnelReport: ReturnType<typeof createReportsEndpoints>["runFunnelReport"];
1865
- runRetentionReport: ReturnType<typeof createReportsEndpoints>["runRetentionReport"];
1866
- runJourneyReport: ReturnType<typeof createReportsEndpoints>["runJourneyReport"];
1867
- runGoalReport: ReturnType<typeof createReportsEndpoints>["runGoalReport"];
1868
- runAttributionReport: ReturnType<typeof createReportsEndpoints>["runAttributionReport"];
1869
- runRevenueReport: ReturnType<typeof createReportsEndpoints>["runRevenueReport"];
1870
- runUTMReport: ReturnType<typeof createReportsEndpoints>["runUTMReport"];
1871
- runBreakdownReport: ReturnType<typeof createReportsEndpoints>["runBreakdownReport"];
1872
- getSegments: ReturnType<typeof createSegmentsEndpoints>["getSegments"];
1873
- createSegment: ReturnType<typeof createSegmentsEndpoints>["createSegment"];
1874
- getSegment: ReturnType<typeof createSegmentsEndpoints>["getSegment"];
1875
- updateSegment: ReturnType<typeof createSegmentsEndpoints>["updateSegment"];
1876
- deleteSegment: ReturnType<typeof createSegmentsEndpoints>["deleteSegment"];
1877
- getLinks: ReturnType<typeof createLinksEndpoints>["getLinks"];
1878
- getOrgLinks: ReturnType<typeof createLinksEndpoints>["getOrgLinks"];
1879
- createLink: ReturnType<typeof createLinksEndpoints>["createLink"];
1880
- getLink: ReturnType<typeof createLinksEndpoints>["getLink"];
1881
- updateLink: ReturnType<typeof createLinksEndpoints>["updateLink"];
1882
- deleteLink: ReturnType<typeof createLinksEndpoints>["deleteLink"];
1883
- getLinkStats: ReturnType<typeof createLinksEndpoints>["getLinkStats"];
1884
- getPixels: ReturnType<typeof createPixelsEndpoints>["getPixels"];
1885
- getOrgPixels: ReturnType<typeof createPixelsEndpoints>["getOrgPixels"];
1886
- createPixel: ReturnType<typeof createPixelsEndpoints>["createPixel"];
1887
- getPixel: ReturnType<typeof createPixelsEndpoints>["getPixel"];
1888
- updatePixel: ReturnType<typeof createPixelsEndpoints>["updatePixel"];
1889
- deletePixel: ReturnType<typeof createPixelsEndpoints>["deletePixel"];
1890
- getBoards: ReturnType<typeof createBoardsEndpoints>["getBoards"];
1891
- getBoard: ReturnType<typeof createBoardsEndpoints>["getBoard"];
1892
- createBoard: ReturnType<typeof createBoardsEndpoints>["createBoard"];
1893
- updateBoard: ReturnType<typeof createBoardsEndpoints>["updateBoard"];
1894
- deleteBoard: ReturnType<typeof createBoardsEndpoints>["deleteBoard"];
1895
- getBoardWidgets: ReturnType<typeof createBoardsEndpoints>["getBoardWidgets"];
1896
- getBoardWidget: ReturnType<typeof createBoardsEndpoints>["getBoardWidget"];
1897
- createBoardWidget: ReturnType<typeof createBoardsEndpoints>["createBoardWidget"];
1898
- updateBoardWidget: ReturnType<typeof createBoardsEndpoints>["updateBoardWidget"];
1899
- deleteBoardWidget: ReturnType<typeof createBoardsEndpoints>["deleteBoardWidget"];
1900
- getConfig: ReturnType<typeof createConfigEndpoints>["get"];
1901
- admin: ReturnType<typeof createAdminEndpoints>;
1902
- webhooks: ReturnType<typeof createWebhooksEndpoints>;
1903
- integrations: ReturnType<typeof createIntegrationsEndpoints>;
1904
- billing: ReturnType<typeof createBillingEndpoints>;
9
+ export interface EntrolyticsClient {
10
+ auth: ReturnType<typeof createAuthEndpoints>;
11
+ getMe: ReturnType<typeof createMeEndpoints>["getMe"];
12
+ updateMyPassword: ReturnType<typeof createMeEndpoints>["updateMyPassword"];
13
+ getMyWebsites: ReturnType<typeof createMeEndpoints>["getMyWebsites"];
14
+ getMyOrgs: ReturnType<typeof createMeEndpoints>["getMyOrgs"];
15
+ getUsers: ReturnType<typeof createUsersEndpoints>["getUsers"];
16
+ createUser: ReturnType<typeof createUsersEndpoints>["createUser"];
17
+ getUser: ReturnType<typeof createUsersEndpoints>["getUser"];
18
+ updateUser: ReturnType<typeof createUsersEndpoints>["updateUser"];
19
+ deleteUser: ReturnType<typeof createUsersEndpoints>["deleteUser"];
20
+ getUserWebsites: ReturnType<typeof createUsersEndpoints>["getUserWebsites"];
21
+ getUserUsage: ReturnType<typeof createUsersEndpoints>["getUserUsage"];
22
+ getOrgs: ReturnType<typeof createOrgsEndpoints>["getOrgs"];
23
+ createOrg: ReturnType<typeof createOrgsEndpoints>["createOrg"];
24
+ joinOrg: ReturnType<typeof createOrgsEndpoints>["joinOrg"];
25
+ getOrg: ReturnType<typeof createOrgsEndpoints>["getOrg"];
26
+ updateOrg: ReturnType<typeof createOrgsEndpoints>["updateOrg"];
27
+ deleteOrg: ReturnType<typeof createOrgsEndpoints>["deleteOrg"];
28
+ getOrgMembers: ReturnType<typeof createOrgsEndpoints>["getOrgMembers"];
29
+ inviteOrgMember: ReturnType<typeof createOrgsEndpoints>["inviteOrgMember"];
30
+ updateOrgMember: ReturnType<typeof createOrgsEndpoints>["updateOrgMember"];
31
+ removeOrgMember: ReturnType<typeof createOrgsEndpoints>["removeOrgMember"];
32
+ getOrgWebsites: ReturnType<typeof createOrgsEndpoints>["getOrgWebsites"];
33
+ addOrgWebsite: ReturnType<typeof createOrgsEndpoints>["addOrgWebsite"];
34
+ removeOrgWebsite: ReturnType<typeof createOrgsEndpoints>["removeOrgWebsite"];
35
+ getWebsites: ReturnType<typeof createWebsitesEndpoints>["getWebsites"];
36
+ createWebsite: ReturnType<typeof createWebsitesEndpoints>["createWebsite"];
37
+ getWebsite: ReturnType<typeof createWebsitesEndpoints>["getWebsite"];
38
+ updateWebsite: ReturnType<typeof createWebsitesEndpoints>["updateWebsite"];
39
+ deleteWebsite: ReturnType<typeof createWebsitesEndpoints>["deleteWebsite"];
40
+ resetWebsite: ReturnType<typeof createWebsitesEndpoints>["resetWebsite"];
41
+ transferWebsite: ReturnType<typeof createWebsitesEndpoints>["transferWebsite"];
42
+ getWebsiteStats: ReturnType<typeof createWebsitesEndpoints>["getWebsiteStats"];
43
+ getWebsitePageviews: ReturnType<typeof createWebsitesEndpoints>["getWebsitePageviews"];
44
+ getWebsiteMetrics: ReturnType<typeof createWebsitesEndpoints>["getWebsiteMetrics"];
45
+ getWebsiteExpandedMetrics: ReturnType<typeof createWebsitesEndpoints>["getWebsiteExpandedMetrics"];
46
+ getWebsiteEvents: ReturnType<typeof createWebsitesEndpoints>["getWebsiteEvents"];
47
+ getWebsiteEventsSeries: ReturnType<typeof createWebsitesEndpoints>["getWebsiteEventsSeries"];
48
+ getWebsiteActive: ReturnType<typeof createWebsitesEndpoints>["getWebsiteActive"];
49
+ getWebsiteDateRange: ReturnType<typeof createWebsitesEndpoints>["getWebsiteDateRange"];
50
+ getWebsiteValues: ReturnType<typeof createWebsitesEndpoints>["getWebsiteValues"];
51
+ getRealtimeData: ReturnType<typeof createWebsitesEndpoints>["getRealtimeData"];
52
+ exportWebsiteData: ReturnType<typeof createWebsitesEndpoints>["exportWebsiteData"];
53
+ getWebsiteVitals: ReturnType<typeof createWebsitesEndpoints>["getWebsiteVitals"];
54
+ getWebsiteVitalEvents: ReturnType<typeof createWebsitesEndpoints>["getWebsiteVitalEvents"];
55
+ trackVital: ReturnType<typeof createWebsitesEndpoints>["trackVital"];
56
+ trackVitalsBatch: ReturnType<typeof createWebsitesEndpoints>["trackVitalsBatch"];
57
+ getWebsiteForms: ReturnType<typeof createWebsitesEndpoints>["getWebsiteForms"];
58
+ getFormFields: ReturnType<typeof createWebsitesEndpoints>["getFormFields"];
59
+ getFormEvents: ReturnType<typeof createWebsitesEndpoints>["getFormEvents"];
60
+ trackFormEvent: ReturnType<typeof createWebsitesEndpoints>["trackFormEvent"];
61
+ trackFormEventsBatch: ReturnType<typeof createWebsitesEndpoints>["trackFormEventsBatch"];
62
+ getWebsiteDeployments: ReturnType<typeof createWebsitesEndpoints>["getWebsiteDeployments"];
63
+ getDeployment: ReturnType<typeof createWebsitesEndpoints>["getDeployment"];
64
+ compareDeployments: ReturnType<typeof createWebsitesEndpoints>["compareDeployments"];
65
+ setDeployment: ReturnType<typeof createWebsitesEndpoints>["setDeployment"];
66
+ getWebsiteSessions: ReturnType<typeof createSessionsEndpoints>["getWebsiteSessions"];
67
+ getWebsiteSessionStats: ReturnType<typeof createSessionsEndpoints>["getWebsiteSessionStats"];
68
+ getWeeklyTraffic: ReturnType<typeof createSessionsEndpoints>["getWeeklyTraffic"];
69
+ getSession: ReturnType<typeof createSessionsEndpoints>["getSession"];
70
+ getSessionActivity: ReturnType<typeof createSessionsEndpoints>["getSessionActivity"];
71
+ getSessionProperties: ReturnType<typeof createSessionsEndpoints>["getSessionProperties"];
72
+ getEventDataStats: ReturnType<typeof createEventsEndpoints>["getEventDataStats"];
73
+ getEventDataEvents: ReturnType<typeof createEventsEndpoints>["getEventDataEvents"];
74
+ getEventDataFields: ReturnType<typeof createEventsEndpoints>["getEventDataFields"];
75
+ getEventDataValues: ReturnType<typeof createEventsEndpoints>["getEventDataValues"];
76
+ getEventDataProperties: ReturnType<typeof createEventsEndpoints>["getEventDataProperties"];
77
+ getEventData: ReturnType<typeof createEventsEndpoints>["getEventData"];
78
+ getSessionDataProperties: ReturnType<typeof createEventsEndpoints>["getSessionDataProperties"];
79
+ getSessionDataValues: ReturnType<typeof createEventsEndpoints>["getSessionDataValues"];
80
+ sendTestEvent: ReturnType<typeof createEventsEndpoints>["sendTestEvent"];
81
+ getReports: ReturnType<typeof createReportsEndpoints>["getReports"];
82
+ createReport: ReturnType<typeof createReportsEndpoints>["createReport"];
83
+ getReport: ReturnType<typeof createReportsEndpoints>["getReport"];
84
+ updateReport: ReturnType<typeof createReportsEndpoints>["updateReport"];
85
+ deleteReport: ReturnType<typeof createReportsEndpoints>["deleteReport"];
86
+ runFunnelReport: ReturnType<typeof createReportsEndpoints>["runFunnelReport"];
87
+ runRetentionReport: ReturnType<typeof createReportsEndpoints>["runRetentionReport"];
88
+ runJourneyReport: ReturnType<typeof createReportsEndpoints>["runJourneyReport"];
89
+ runGoalReport: ReturnType<typeof createReportsEndpoints>["runGoalReport"];
90
+ runAttributionReport: ReturnType<typeof createReportsEndpoints>["runAttributionReport"];
91
+ runRevenueReport: ReturnType<typeof createReportsEndpoints>["runRevenueReport"];
92
+ runUTMReport: ReturnType<typeof createReportsEndpoints>["runUTMReport"];
93
+ runBreakdownReport: ReturnType<typeof createReportsEndpoints>["runBreakdownReport"];
94
+ getSegments: ReturnType<typeof createSegmentsEndpoints>["getSegments"];
95
+ createSegment: ReturnType<typeof createSegmentsEndpoints>["createSegment"];
96
+ getSegment: ReturnType<typeof createSegmentsEndpoints>["getSegment"];
97
+ updateSegment: ReturnType<typeof createSegmentsEndpoints>["updateSegment"];
98
+ deleteSegment: ReturnType<typeof createSegmentsEndpoints>["deleteSegment"];
99
+ getLinks: ReturnType<typeof createLinksEndpoints>["getLinks"];
100
+ getOrgLinks: ReturnType<typeof createLinksEndpoints>["getOrgLinks"];
101
+ createLink: ReturnType<typeof createLinksEndpoints>["createLink"];
102
+ getLink: ReturnType<typeof createLinksEndpoints>["getLink"];
103
+ updateLink: ReturnType<typeof createLinksEndpoints>["updateLink"];
104
+ deleteLink: ReturnType<typeof createLinksEndpoints>["deleteLink"];
105
+ getLinkStats: ReturnType<typeof createLinksEndpoints>["getLinkStats"];
106
+ getPixels: ReturnType<typeof createPixelsEndpoints>["getPixels"];
107
+ getOrgPixels: ReturnType<typeof createPixelsEndpoints>["getOrgPixels"];
108
+ createPixel: ReturnType<typeof createPixelsEndpoints>["createPixel"];
109
+ getPixel: ReturnType<typeof createPixelsEndpoints>["getPixel"];
110
+ updatePixel: ReturnType<typeof createPixelsEndpoints>["updatePixel"];
111
+ deletePixel: ReturnType<typeof createPixelsEndpoints>["deletePixel"];
112
+ getBoards: ReturnType<typeof createBoardsEndpoints>["getBoards"];
113
+ getBoard: ReturnType<typeof createBoardsEndpoints>["getBoard"];
114
+ createBoard: ReturnType<typeof createBoardsEndpoints>["createBoard"];
115
+ updateBoard: ReturnType<typeof createBoardsEndpoints>["updateBoard"];
116
+ deleteBoard: ReturnType<typeof createBoardsEndpoints>["deleteBoard"];
117
+ getBoardWidgets: ReturnType<typeof createBoardsEndpoints>["getBoardWidgets"];
118
+ getBoardWidget: ReturnType<typeof createBoardsEndpoints>["getBoardWidget"];
119
+ createBoardWidget: ReturnType<typeof createBoardsEndpoints>["createBoardWidget"];
120
+ updateBoardWidget: ReturnType<typeof createBoardsEndpoints>["updateBoardWidget"];
121
+ deleteBoardWidget: ReturnType<typeof createBoardsEndpoints>["deleteBoardWidget"];
122
+ getConfig: ReturnType<typeof createConfigEndpoints>["get"];
123
+ admin: ReturnType<typeof createAdminEndpoints>;
124
+ webhooks: ReturnType<typeof createWebhooksEndpoints>;
125
+ integrations: ReturnType<typeof createIntegrationsEndpoints>;
126
+ billing: ReturnType<typeof createBillingEndpoints>;
1905
127
  }
1906
128
  /**
1907
129
  * Create an Entrolytics API client.
@@ -1921,7 +143,10 @@ interface EntrolyticsClient {
1921
143
  * const { ok, data, error } = await client.getWebsites();
1922
144
  * ```
1923
145
  */
1924
- declare function getClient(config?: ClientConfig): EntrolyticsClient;
1925
- //#endregion
1926
- export { API_ENDPOINTS, API_ROUTES, AccountEntitlements, AccountUsage, ActiveVisitor, ApiClient, ApiResponse, BILLING_ERRORS, Board, BoardWidget, CLI_CONFIG, CLI_TOKEN_STATUS, CheckoutOptions, CheckoutResponse, type ClientConfig, CreateBoardData, CreateBoardWidgetData, CreateLinkData, CreateOrgData, CreatePixelData, CreateReportData, CreateSegmentData, CreateUserData, CreateWebsiteData, DEFAULT_API_HOST, DEPLOYMENT_ENV_VARS, DEPLOYMENT_SOURCES, DateRangeParams, Deployment, DeploymentComparison, DeploymentParams, type DeploymentSource, ENV_VAR_NAMES, ERROR_MESSAGES, EVENT_TYPES, type EdgeFetchOptions, EntrolyticsClient, EventData, EventDataField, EventStats, FORM_EVENT_TYPES, FORM_FIELD_TYPES, FRAMEWORK_PACKAGES, FRAMEWORK_PATTERNS, FormAnalyticsParams, FormEvent, type FormEventType, FormFieldStats, type FormFieldType, FormStats, HTTP_STATUS, IngestMode, JoinOrgData, Link, LinkStats, MetricData, MetricType, NAVIGATION_TYPES, type NavigationType, ONBOARDING_STEPS, OrgMember, Organization, OrganizationRole, PLANS, PLAN_FEATURES, PageviewData, PaginationParams, Pixel, PlanId, PlatformRole, PortalResponse, RATE_LIMITS, RealtimeData, type RegionInfo, Report, RoutingHealth, RoutingStats, type Runtime, SDK_EVENT_TYPES, SUCCESS_MESSAGES, Segment, Session, SessionActivity, SessionStats, SetDeploymentData, Subscription, TrackFormEventData, TrackVitalData, USAGE_THRESHOLDS, USER_ROLES, UpdateBoardData, UpdateBoardWidgetData, UpdateLinkData, UpdateOrgData, UpdatePixelData, UpdateReportData, UpdateSegmentData, UpdateUserData, UpdateWebsiteData, User, VITAL_RATINGS, VITAL_THRESHOLDS, VITAL_TYPES, VitalMetric, type VitalRating, WebVital, WebVitalsParams, WebVitalsStats, Website, WebsiteEvent, WebsiteMetricsParams, WebsiteModeConfig, WebsitePageviews, WebsiteStats, assertRuntime, createAdminEndpoints, createAuthEndpoints, createBillingEndpoints, createBoardsEndpoints, createConfigEndpoints, createEdgeFetch, createEventsEndpoints, createIntegrationsEndpoints, createLinksEndpoints, createMeEndpoints, createOrgsEndpoints, createPixelsEndpoints, createReportsEndpoints, createSegmentsEndpoints, createSessionsEndpoints, createUsersEndpoints, createWebhooksEndpoints, createWebsitesEndpoints, getClient as default, getClient, detectDeploymentContext, detectRuntime, getApiRoute, getClientIp, getEdgeEnv, getEnvVarNames, getFrameworkPackage, getGeoFromRequest, getPlan, getPlanLimit, getRegionInfo, getRuntimeCapabilities, getVitalRating, isEdgeRuntime, isNodeRuntime, isPlanFeatureEnabled, isUsageCritical, isUsageWarning, isValidFramework, requireEdgeEnv };
146
+ export declare function getClient(config?: ClientConfig): EntrolyticsClient;
147
+ export { createAdminEndpoints, createAuthEndpoints, createBillingEndpoints, createBoardsEndpoints, createConfigEndpoints, createEventsEndpoints, createIntegrationsEndpoints, createLinksEndpoints, createMeEndpoints, createOrgsEndpoints, createPixelsEndpoints, createReportsEndpoints, createSegmentsEndpoints, createSessionsEndpoints, createUsersEndpoints, createWebhooksEndpoints, createWebsitesEndpoints, };
148
+ export { ApiClient };
149
+ export { detectRuntime, isNodeRuntime, isEdgeRuntime, getRuntimeCapabilities, assertRuntime, type Runtime, } from "./runtime";
150
+ export { getEdgeEnv, requireEdgeEnv, createEdgeFetch, getRegionInfo, getGeoFromRequest, getClientIp, type EdgeFetchOptions, type RegionInfo, } from "./edge-helpers";
151
+ export default getClient;
1927
152
  //# sourceMappingURL=index.d.ts.map