zorihq 0.8.0 → 0.9.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/resources/v1/analytics/analytics.d.mts +1 -124
  4. package/resources/v1/analytics/analytics.d.mts.map +1 -1
  5. package/resources/v1/analytics/analytics.d.ts +1 -124
  6. package/resources/v1/analytics/analytics.d.ts.map +1 -1
  7. package/resources/v1/analytics/analytics.js +0 -4
  8. package/resources/v1/analytics/analytics.js.map +1 -1
  9. package/resources/v1/analytics/analytics.mjs +0 -4
  10. package/resources/v1/analytics/analytics.mjs.map +1 -1
  11. package/resources/v1/analytics/index.d.mts +1 -2
  12. package/resources/v1/analytics/index.d.mts.map +1 -1
  13. package/resources/v1/analytics/index.d.ts +1 -2
  14. package/resources/v1/analytics/index.d.ts.map +1 -1
  15. package/resources/v1/analytics/index.js +1 -3
  16. package/resources/v1/analytics/index.js.map +1 -1
  17. package/resources/v1/analytics/index.mjs +0 -1
  18. package/resources/v1/analytics/index.mjs.map +1 -1
  19. package/resources/v1/index.d.mts +2 -1
  20. package/resources/v1/index.d.mts.map +1 -1
  21. package/resources/v1/index.d.ts +2 -1
  22. package/resources/v1/index.d.ts.map +1 -1
  23. package/resources/v1/index.js +3 -1
  24. package/resources/v1/index.js.map +1 -1
  25. package/resources/v1/index.mjs +1 -0
  26. package/resources/v1/index.mjs.map +1 -1
  27. package/resources/v1/{analytics/revenue.d.mts → revenue/attribution.d.mts} +21 -19
  28. package/resources/v1/revenue/attribution.d.mts.map +1 -0
  29. package/resources/v1/{analytics/revenue.d.ts → revenue/attribution.d.ts} +21 -19
  30. package/resources/v1/revenue/attribution.d.ts.map +1 -0
  31. package/resources/v1/revenue/attribution.js +41 -0
  32. package/resources/v1/revenue/attribution.js.map +1 -0
  33. package/resources/v1/revenue/attribution.mjs +37 -0
  34. package/resources/v1/revenue/attribution.mjs.map +1 -0
  35. package/resources/v1/revenue/conversion.d.mts +34 -0
  36. package/resources/v1/revenue/conversion.d.mts.map +1 -0
  37. package/resources/v1/revenue/conversion.d.ts +34 -0
  38. package/resources/v1/revenue/conversion.d.ts.map +1 -0
  39. package/resources/v1/revenue/conversion.js +25 -0
  40. package/resources/v1/revenue/conversion.js.map +1 -0
  41. package/resources/v1/revenue/conversion.mjs +21 -0
  42. package/resources/v1/revenue/conversion.mjs.map +1 -0
  43. package/resources/v1/revenue/customers.d.mts +61 -0
  44. package/resources/v1/revenue/customers.d.mts.map +1 -0
  45. package/resources/v1/revenue/customers.d.ts +61 -0
  46. package/resources/v1/revenue/customers.d.ts.map +1 -0
  47. package/resources/v1/revenue/customers.js +40 -0
  48. package/resources/v1/revenue/customers.js.map +1 -0
  49. package/resources/v1/revenue/customers.mjs +36 -0
  50. package/resources/v1/revenue/customers.mjs.map +1 -0
  51. package/resources/v1/revenue/index.d.mts +5 -0
  52. package/resources/v1/revenue/index.d.mts.map +1 -0
  53. package/resources/v1/revenue/index.d.ts +5 -0
  54. package/resources/v1/revenue/index.d.ts.map +1 -0
  55. package/resources/v1/revenue/index.js +13 -0
  56. package/resources/v1/revenue/index.js.map +1 -0
  57. package/resources/v1/revenue/index.mjs +6 -0
  58. package/resources/v1/revenue/index.mjs.map +1 -0
  59. package/resources/v1/revenue/revenue.d.mts +255 -0
  60. package/resources/v1/revenue/revenue.d.mts.map +1 -0
  61. package/resources/v1/revenue/revenue.d.ts +255 -0
  62. package/resources/v1/revenue/revenue.d.ts.map +1 -0
  63. package/resources/v1/revenue/revenue.js +53 -0
  64. package/resources/v1/revenue/revenue.js.map +1 -0
  65. package/resources/v1/revenue/revenue.mjs +48 -0
  66. package/resources/v1/revenue/revenue.mjs.map +1 -0
  67. package/resources/v1/revenue.d.mts +2 -0
  68. package/resources/v1/revenue.d.mts.map +1 -0
  69. package/resources/v1/revenue.d.ts +2 -0
  70. package/resources/v1/revenue.d.ts.map +1 -0
  71. package/resources/v1/revenue.js +6 -0
  72. package/resources/v1/revenue.js.map +1 -0
  73. package/resources/v1/revenue.mjs +3 -0
  74. package/resources/v1/revenue.mjs.map +1 -0
  75. package/resources/v1/v1.d.mts +6 -2
  76. package/resources/v1/v1.d.mts.map +1 -1
  77. package/resources/v1/v1.d.ts +6 -2
  78. package/resources/v1/v1.d.ts.map +1 -1
  79. package/resources/v1/v1.js +4 -0
  80. package/resources/v1/v1.js.map +1 -1
  81. package/resources/v1/v1.mjs +4 -0
  82. package/resources/v1/v1.mjs.map +1 -1
  83. package/src/resources/v1/analytics/analytics.ts +0 -183
  84. package/src/resources/v1/analytics/index.ts +0 -6
  85. package/src/resources/v1/index.ts +18 -5
  86. package/src/resources/v1/{analytics/revenue.ts → revenue/attribution.ts} +29 -24
  87. package/src/resources/v1/revenue/conversion.ts +44 -0
  88. package/src/resources/v1/revenue/customers.ts +77 -0
  89. package/src/resources/v1/revenue/index.ts +23 -0
  90. package/src/resources/v1/revenue/revenue.ts +385 -0
  91. package/src/resources/v1/revenue.ts +3 -0
  92. package/src/resources/v1/v1.ts +40 -10
  93. package/src/version.ts +1 -1
  94. package/version.d.mts +1 -1
  95. package/version.d.ts +1 -1
  96. package/version.js +1 -1
  97. package/version.mjs +1 -1
  98. package/resources/v1/analytics/revenue.d.mts.map +0 -1
  99. package/resources/v1/analytics/revenue.d.ts.map +0 -1
  100. package/resources/v1/analytics/revenue.js +0 -39
  101. package/resources/v1/analytics/revenue.js.map +0 -1
  102. package/resources/v1/analytics/revenue.mjs +0 -35
  103. package/resources/v1/analytics/revenue.mjs.map +0 -1
@@ -10,8 +10,6 @@ import {
10
10
  RetentionCohortsParams,
11
11
  RetentionReturnRateParams,
12
12
  } from './retention';
13
- import * as RevenueAPI from './revenue';
14
- import { Revenue, RevenueByUtmParams, RevenueTimelineParams } from './revenue';
15
13
  import * as SessionsAPI from './sessions';
16
14
  import { SessionBounceRateParams, SessionMetricsParams, Sessions } from './sessions';
17
15
  import * as UsersAPI from './users';
@@ -33,7 +31,6 @@ import { RequestOptions } from '../../../internal/request-options';
33
31
  export class Analytics extends APIResource {
34
32
  visitors: VisitorsAPI.Visitors = new VisitorsAPI.Visitors(this._client);
35
33
  events: EventsAPI.Events = new EventsAPI.Events(this._client);
36
- revenue: RevenueAPI.Revenue = new RevenueAPI.Revenue(this._client);
37
34
  sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client);
38
35
  users: UsersAPI.Users = new UsersAPI.Users(this._client);
39
36
  retention: RetentionAPI.Retention = new RetentionAPI.Retention(this._client);
@@ -121,21 +118,6 @@ export interface CountryDataPoint {
121
118
  export interface DashboardMetricsResponse {
122
119
  avg_pages_per_session?: number;
123
120
 
124
- /**
125
- * Average revenue for identified visitors only (deprecated)
126
- */
127
- avg_revenue_per_identified_customer?: number;
128
-
129
- /**
130
- * 3. Average revenue per unique session
131
- */
132
- avg_revenue_per_session?: number;
133
-
134
- /**
135
- * Average revenue per paying visitor
136
- */
137
- avg_revenue_per_visitor?: number;
138
-
139
121
  avg_session_duration_seconds?: number;
140
122
 
141
123
  /**
@@ -143,18 +125,6 @@ export interface DashboardMetricsResponse {
143
125
  */
144
126
  bounce_rate?: number;
145
127
 
146
- /**
147
- * 4. % of unique visitors who made payment
148
- */
149
- conversion_rate?: number;
150
-
151
- /**
152
- * Same as ConversionRate (deprecated, use ConversionRate)
153
- */
154
- conversion_to_paying?: number;
155
-
156
- currency?: string;
157
-
158
128
  /**
159
129
  * Active users
160
130
  */
@@ -162,11 +132,6 @@ export interface DashboardMetricsResponse {
162
132
 
163
133
  mau?: number;
164
134
 
165
- /**
166
- * Additional revenue metrics (kept for compatibility)
167
- */
168
- paying_visitors?: number;
169
-
170
135
  return_rate?: number;
171
136
 
172
137
  /**
@@ -179,21 +144,6 @@ export interface DashboardMetricsResponse {
179
144
  */
180
145
  total_events?: number;
181
146
 
182
- /**
183
- * Count of successful payments
184
- */
185
- total_payments?: number;
186
-
187
- /**
188
- * Revenue metrics - 4 key metrics as separate queries
189
- */
190
- total_revenue?: number;
191
-
192
- /**
193
- * 2. Total revenue for identified customers only
194
- */
195
- total_revenue_identified_customers?: number;
196
-
197
147
  total_sessions_in_period?: number;
198
148
 
199
149
  /**
@@ -251,33 +201,10 @@ export interface ManualIdentifyResponse {
251
201
  }
252
202
 
253
203
  export interface OriginDataPoint {
254
- /**
255
- * Average revenue per paying visitor
256
- */
257
- avg_revenue_per_visitor?: number;
258
-
259
- /**
260
- * paying_visitors / unique_visitors \* 100
261
- */
262
- conversion_rate?: number;
263
-
264
- currency?: string;
265
-
266
204
  origin?: string;
267
205
 
268
- paying_visitors?: number;
269
-
270
- payment_count?: number;
271
-
272
206
  percentage?: number;
273
207
 
274
- revenue_percentage?: number;
275
-
276
- /**
277
- * Revenue in smallest currency unit (cents)
278
- */
279
- total_revenue?: number;
280
-
281
208
  unique_visitors?: number;
282
209
  }
283
210
 
@@ -333,27 +260,6 @@ export interface ReturnRateResponse {
333
260
  total_users?: number;
334
261
  }
335
262
 
336
- export interface RevenueByUtmResponse {
337
- data?: Array<UtmRevenueDataPoint>;
338
- }
339
-
340
- export interface RevenueTimelineDataPoint {
341
- currency?: string;
342
-
343
- payment_count?: number;
344
-
345
- timestamp?: string;
346
-
347
- /**
348
- * Revenue in smallest currency unit (cents)
349
- */
350
- total_revenue?: number;
351
- }
352
-
353
- export interface RevenueTimelineResponse {
354
- data?: Array<RevenueTimelineDataPoint>;
355
- }
356
-
357
263
  export interface SessionMetricsResponse {
358
264
  average_pages_per_session?: number;
359
265
 
@@ -365,8 +271,6 @@ export interface SessionMetricsResponse {
365
271
  export interface TopVisitor {
366
272
  browser_name?: string;
367
273
 
368
- currency?: string;
369
-
370
274
  device_type?: string;
371
275
 
372
276
  event_count?: number;
@@ -381,13 +285,6 @@ export interface TopVisitor {
381
285
 
382
286
  location_country_iso?: string;
383
287
 
384
- payment_count?: number;
385
-
386
- /**
387
- * Total revenue in smallest currency unit (cents)
388
- */
389
- total_revenue?: number;
390
-
391
288
  user_id?: string;
392
289
 
393
290
  visitor_id?: string;
@@ -411,38 +308,6 @@ export interface UniqueVisitorsTimelineResponse {
411
308
  data?: Array<UniqueVisitorsDataPoint>;
412
309
  }
413
310
 
414
- export interface UtmRevenueDataPoint {
415
- /**
416
- * Average revenue per paying visitor
417
- */
418
- avg_revenue_per_visitor?: number;
419
-
420
- /**
421
- * paying_visitors / unique_visitors \* 100
422
- */
423
- conversion_rate?: number;
424
-
425
- currency?: string;
426
-
427
- paying_visitors?: number;
428
-
429
- payment_count?: number;
430
-
431
- revenue_percentage?: number;
432
-
433
- /**
434
- * Revenue in smallest currency unit (cents)
435
- */
436
- total_revenue?: number;
437
-
438
- unique_visitors?: number;
439
-
440
- /**
441
- * The UTM parameter value
442
- */
443
- utm_value?: string;
444
- }
445
-
446
311
  export interface VisitorDataPoint {
447
312
  desktop?: number;
448
313
 
@@ -469,30 +334,7 @@ export interface VisitorEvent {
469
334
  referrer_url?: string;
470
335
  }
471
336
 
472
- export interface VisitorPayment {
473
- amount?: number;
474
-
475
- currency?: string;
476
-
477
- payment_id?: string;
478
-
479
- payment_timestamp?: string;
480
-
481
- product_name?: string;
482
-
483
- provider_type?: string;
484
-
485
- status?: string;
486
- }
487
-
488
337
  export interface VisitorProfileResponse {
489
- /**
490
- * Average payment amount
491
- */
492
- avg_order_value?: number;
493
-
494
- currency?: string;
495
-
496
338
  custom_traits?: { [key: string]: unknown };
497
339
 
498
340
  email?: string;
@@ -505,8 +347,6 @@ export interface VisitorProfileResponse {
505
347
 
506
348
  first_identified_at?: string;
507
349
 
508
- first_payment_date?: string;
509
-
510
350
  first_referrer_url?: string;
511
351
 
512
352
  first_seen?: string;
@@ -517,8 +357,6 @@ export interface VisitorProfileResponse {
517
357
 
518
358
  last_identified_at?: string;
519
359
 
520
- last_payment_date?: string;
521
-
522
360
  last_seen?: string;
523
361
 
524
362
  location_city?: string;
@@ -527,19 +365,10 @@ export interface VisitorProfileResponse {
527
365
 
528
366
  name?: string;
529
367
 
530
- payment_count?: number;
531
-
532
- payments?: Array<VisitorPayment>;
533
-
534
368
  phone?: string;
535
369
 
536
370
  total_events?: number;
537
371
 
538
- /**
539
- * Revenue fields
540
- */
541
- total_revenue?: number;
542
-
543
372
  user_id?: string;
544
373
 
545
374
  visitor_id?: string;
@@ -571,7 +400,6 @@ export interface AnalyticsDashboardParams {
571
400
 
572
401
  Analytics.Visitors = Visitors;
573
402
  Analytics.Events = Events;
574
- Analytics.Revenue = Revenue;
575
403
  Analytics.Sessions = Sessions;
576
404
  Analytics.Users = Users;
577
405
  Analytics.Retention = Retention;
@@ -594,18 +422,13 @@ export declare namespace Analytics {
594
422
  type RecentEvent as RecentEvent,
595
423
  type RecentEventsResponse as RecentEventsResponse,
596
424
  type ReturnRateResponse as ReturnRateResponse,
597
- type RevenueByUtmResponse as RevenueByUtmResponse,
598
- type RevenueTimelineDataPoint as RevenueTimelineDataPoint,
599
- type RevenueTimelineResponse as RevenueTimelineResponse,
600
425
  type SessionMetricsResponse as SessionMetricsResponse,
601
426
  type TopVisitor as TopVisitor,
602
427
  type TopVisitorsResponse as TopVisitorsResponse,
603
428
  type UniqueVisitorsDataPoint as UniqueVisitorsDataPoint,
604
429
  type UniqueVisitorsTimelineResponse as UniqueVisitorsTimelineResponse,
605
- type UtmRevenueDataPoint as UtmRevenueDataPoint,
606
430
  type VisitorDataPoint as VisitorDataPoint,
607
431
  type VisitorEvent as VisitorEvent,
608
- type VisitorPayment as VisitorPayment,
609
432
  type VisitorProfileResponse as VisitorProfileResponse,
610
433
  type VisitorsByCountryResponse as VisitorsByCountryResponse,
611
434
  type VisitorsByDeviceResponse as VisitorsByDeviceResponse,
@@ -630,12 +453,6 @@ export declare namespace Analytics {
630
453
  type EventRecentParams as EventRecentParams,
631
454
  };
632
455
 
633
- export {
634
- Revenue as Revenue,
635
- type RevenueByUtmParams as RevenueByUtmParams,
636
- type RevenueTimelineParams as RevenueTimelineParams,
637
- };
638
-
639
456
  export {
640
457
  Sessions as Sessions,
641
458
  type SessionBounceRateParams as SessionBounceRateParams,
@@ -18,18 +18,13 @@ export {
18
18
  type RecentEvent,
19
19
  type RecentEventsResponse,
20
20
  type ReturnRateResponse,
21
- type RevenueByUtmResponse,
22
- type RevenueTimelineDataPoint,
23
- type RevenueTimelineResponse,
24
21
  type SessionMetricsResponse,
25
22
  type TopVisitor,
26
23
  type TopVisitorsResponse,
27
24
  type UniqueVisitorsDataPoint,
28
25
  type UniqueVisitorsTimelineResponse,
29
- type UtmRevenueDataPoint,
30
26
  type VisitorDataPoint,
31
27
  type VisitorEvent,
32
- type VisitorPayment,
33
28
  type VisitorProfileResponse,
34
29
  type VisitorsByCountryResponse,
35
30
  type VisitorsByDeviceResponse,
@@ -43,7 +38,6 @@ export {
43
38
  type RetentionCohortsParams,
44
39
  type RetentionReturnRateParams,
45
40
  } from './retention';
46
- export { Revenue, type RevenueByUtmParams, type RevenueTimelineParams } from './revenue';
47
41
  export { Sessions, type SessionBounceRateParams, type SessionMetricsParams } from './sessions';
48
42
  export { Users, type UserActiveParams } from './users';
49
43
  export {
@@ -18,18 +18,13 @@ export {
18
18
  type RecentEvent,
19
19
  type RecentEventsResponse,
20
20
  type ReturnRateResponse,
21
- type RevenueByUtmResponse,
22
- type RevenueTimelineDataPoint,
23
- type RevenueTimelineResponse,
24
21
  type SessionMetricsResponse,
25
22
  type TopVisitor,
26
23
  type TopVisitorsResponse,
27
24
  type UniqueVisitorsDataPoint,
28
25
  type UniqueVisitorsTimelineResponse,
29
- type UtmRevenueDataPoint,
30
26
  type VisitorDataPoint,
31
27
  type VisitorEvent,
32
- type VisitorPayment,
33
28
  type VisitorProfileResponse,
34
29
  type VisitorsByCountryResponse,
35
30
  type VisitorsByDeviceResponse,
@@ -71,4 +66,22 @@ export {
71
66
  type ProjectCreateParams,
72
67
  type ProjectUpdateParams,
73
68
  } from './projects';
69
+ export {
70
+ Revenue,
71
+ type AttributionByOriginResponse,
72
+ type AttributionByUtmResponse,
73
+ type ConversionMetricsResponse,
74
+ type CustomerProfileResponse,
75
+ type DashboardResponse,
76
+ type OriginAttributionDataPoint,
77
+ type Payment,
78
+ type RevenueOverTimeDataPoint,
79
+ type TimelineDataPoint,
80
+ type TimelineResponse,
81
+ type TopCustomer,
82
+ type TopCustomersResponse,
83
+ type UtmAttributionDataPoint,
84
+ type RevenueDashboardParams,
85
+ type RevenueTimelineParams,
86
+ } from './revenue/index';
74
87
  export { V1 } from './v1';
@@ -1,48 +1,53 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../../core/resource';
4
- import * as AnalyticsAPI from './analytics';
4
+ import * as RevenueAPI from './revenue';
5
5
  import { APIPromise } from '../../../core/api-promise';
6
6
  import { RequestOptions } from '../../../internal/request-options';
7
7
 
8
- export class Revenue extends APIResource {
8
+ export class Attribution extends APIResource {
9
9
  /**
10
- * Get revenue metrics grouped by UTM source, medium, or campaign
10
+ * Get revenue metrics grouped by traffic origin (referrer domain) using
11
+ * first-touch attribution
11
12
  *
12
13
  * @example
13
14
  * ```ts
14
- * const revenueByUtmResponse =
15
- * await client.v1.analytics.revenue.byUtm({
15
+ * const attributionByOriginResponse =
16
+ * await client.v1.revenue.attribution.byOrigin({
16
17
  * project_id: 'project_id',
17
18
  * time_range: 'last_hour',
18
19
  * });
19
20
  * ```
20
21
  */
21
- byUtm(query: RevenueByUtmParams, options?: RequestOptions): APIPromise<AnalyticsAPI.RevenueByUtmResponse> {
22
- return this._client.get('/api/v1/analytics/revenue/by-utm', { query, ...options });
22
+ byOrigin(
23
+ query: AttributionByOriginParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<RevenueAPI.AttributionByOriginResponse> {
26
+ return this._client.get('/api/v1/revenue/attribution/origin', { query, ...options });
23
27
  }
24
28
 
25
29
  /**
26
- * Get revenue metrics over time for chart visualization
30
+ * Get revenue metrics grouped by UTM source, medium, or campaign using first-touch
31
+ * attribution
27
32
  *
28
33
  * @example
29
34
  * ```ts
30
- * const revenueTimelineResponse =
31
- * await client.v1.analytics.revenue.timeline({
35
+ * const attributionByUtmResponse =
36
+ * await client.v1.revenue.attribution.byUtm({
32
37
  * project_id: 'project_id',
33
38
  * time_range: 'last_hour',
34
39
  * });
35
40
  * ```
36
41
  */
37
- timeline(
38
- query: RevenueTimelineParams,
42
+ byUtm(
43
+ query: AttributionByUtmParams,
39
44
  options?: RequestOptions,
40
- ): APIPromise<AnalyticsAPI.RevenueTimelineResponse> {
41
- return this._client.get('/api/v1/analytics/revenue/timeline', { query, ...options });
45
+ ): APIPromise<RevenueAPI.AttributionByUtmResponse> {
46
+ return this._client.get('/api/v1/revenue/attribution/utm', { query, ...options });
42
47
  }
43
48
  }
44
49
 
45
- export interface RevenueByUtmParams {
50
+ export interface AttributionByOriginParams {
46
51
  /**
47
52
  * Project ID
48
53
  */
@@ -52,14 +57,9 @@ export interface RevenueByUtmParams {
52
57
  * Time range
53
58
  */
54
59
  time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
55
-
56
- /**
57
- * UTM type: source, medium, or campaign (default: source)
58
- */
59
- utm_type?: string;
60
60
  }
61
61
 
62
- export interface RevenueTimelineParams {
62
+ export interface AttributionByUtmParams {
63
63
  /**
64
64
  * Project ID
65
65
  */
@@ -69,11 +69,16 @@ export interface RevenueTimelineParams {
69
69
  * Time range
70
70
  */
71
71
  time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
72
+
73
+ /**
74
+ * UTM type: source, medium, or campaign (default: source)
75
+ */
76
+ utm_type?: string;
72
77
  }
73
78
 
74
- export declare namespace Revenue {
79
+ export declare namespace Attribution {
75
80
  export {
76
- type RevenueByUtmParams as RevenueByUtmParams,
77
- type RevenueTimelineParams as RevenueTimelineParams,
81
+ type AttributionByOriginParams as AttributionByOriginParams,
82
+ type AttributionByUtmParams as AttributionByUtmParams,
78
83
  };
79
84
  }
@@ -0,0 +1,44 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as RevenueAPI from './revenue';
5
+ import { APIPromise } from '../../../core/api-promise';
6
+ import { RequestOptions } from '../../../internal/request-options';
7
+
8
+ export class Conversion extends APIResource {
9
+ /**
10
+ * Get conversion funnel metrics including conversion rate, time to purchase, and
11
+ * customer lifetime value
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const conversionMetricsResponse =
16
+ * await client.v1.revenue.conversion.metrics({
17
+ * project_id: 'project_id',
18
+ * time_range: 'last_hour',
19
+ * });
20
+ * ```
21
+ */
22
+ metrics(
23
+ query: ConversionMetricsParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<RevenueAPI.ConversionMetricsResponse> {
26
+ return this._client.get('/api/v1/revenue/conversion/metrics', { query, ...options });
27
+ }
28
+ }
29
+
30
+ export interface ConversionMetricsParams {
31
+ /**
32
+ * Project ID
33
+ */
34
+ project_id: string;
35
+
36
+ /**
37
+ * Time range
38
+ */
39
+ time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
40
+ }
41
+
42
+ export declare namespace Conversion {
43
+ export { type ConversionMetricsParams as ConversionMetricsParams };
44
+ }
@@ -0,0 +1,77 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as RevenueAPI from './revenue';
5
+ import { APIPromise } from '../../../core/api-promise';
6
+ import { RequestOptions } from '../../../internal/request-options';
7
+
8
+ export class Customers extends APIResource {
9
+ /**
10
+ * Get detailed revenue information for a specific customer including payment
11
+ * history and attribution
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const customerProfileResponse =
16
+ * await client.v1.revenue.customers.profile({
17
+ * project_id: 'project_id',
18
+ * visitor_id: 'visitor_id',
19
+ * });
20
+ * ```
21
+ */
22
+ profile(
23
+ query: CustomerProfileParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<RevenueAPI.CustomerProfileResponse> {
26
+ return this._client.get('/api/v1/revenue/customers/profile', { query, ...options });
27
+ }
28
+
29
+ /**
30
+ * Get a list of customers ranked by total revenue
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const topCustomersResponse =
35
+ * await client.v1.revenue.customers.top({
36
+ * project_id: 'project_id',
37
+ * time_range: 'last_hour',
38
+ * });
39
+ * ```
40
+ */
41
+ top(query: CustomerTopParams, options?: RequestOptions): APIPromise<RevenueAPI.TopCustomersResponse> {
42
+ return this._client.get('/api/v1/revenue/customers/top', { query, ...options });
43
+ }
44
+ }
45
+
46
+ export interface CustomerProfileParams {
47
+ /**
48
+ * Project ID
49
+ */
50
+ project_id: string;
51
+
52
+ /**
53
+ * Visitor ID
54
+ */
55
+ visitor_id: string;
56
+ }
57
+
58
+ export interface CustomerTopParams {
59
+ /**
60
+ * Project ID
61
+ */
62
+ project_id: string;
63
+
64
+ /**
65
+ * Time range
66
+ */
67
+ time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
68
+
69
+ /**
70
+ * Maximum number of customers to return (default: 50)
71
+ */
72
+ limit?: number;
73
+ }
74
+
75
+ export declare namespace Customers {
76
+ export { type CustomerProfileParams as CustomerProfileParams, type CustomerTopParams as CustomerTopParams };
77
+ }
@@ -0,0 +1,23 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Attribution, type AttributionByOriginParams, type AttributionByUtmParams } from './attribution';
4
+ export { Conversion, type ConversionMetricsParams } from './conversion';
5
+ export { Customers, type CustomerProfileParams, type CustomerTopParams } from './customers';
6
+ export {
7
+ Revenue,
8
+ type AttributionByOriginResponse,
9
+ type AttributionByUtmResponse,
10
+ type ConversionMetricsResponse,
11
+ type CustomerProfileResponse,
12
+ type DashboardResponse,
13
+ type OriginAttributionDataPoint,
14
+ type Payment,
15
+ type RevenueOverTimeDataPoint,
16
+ type TimelineDataPoint,
17
+ type TimelineResponse,
18
+ type TopCustomer,
19
+ type TopCustomersResponse,
20
+ type UtmAttributionDataPoint,
21
+ type RevenueDashboardParams,
22
+ type RevenueTimelineParams,
23
+ } from './revenue';