zorihq 0.7.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 (102) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/resources/v1/analytics/analytics.d.mts +22 -3
  4. package/resources/v1/analytics/analytics.d.mts.map +1 -1
  5. package/resources/v1/analytics/analytics.d.ts +22 -3
  6. package/resources/v1/analytics/analytics.d.ts.map +1 -1
  7. package/resources/v1/analytics/analytics.js.map +1 -1
  8. package/resources/v1/analytics/analytics.mjs.map +1 -1
  9. package/resources/v1/analytics/events.d.mts +49 -2
  10. package/resources/v1/analytics/events.d.mts.map +1 -1
  11. package/resources/v1/analytics/events.d.ts +49 -2
  12. package/resources/v1/analytics/events.d.ts.map +1 -1
  13. package/resources/v1/analytics/events.js +16 -1
  14. package/resources/v1/analytics/events.js.map +1 -1
  15. package/resources/v1/analytics/events.mjs +16 -1
  16. package/resources/v1/analytics/events.mjs.map +1 -1
  17. package/resources/v1/analytics/index.d.mts +2 -2
  18. package/resources/v1/analytics/index.d.mts.map +1 -1
  19. package/resources/v1/analytics/index.d.ts +2 -2
  20. package/resources/v1/analytics/index.d.ts.map +1 -1
  21. package/resources/v1/analytics/index.js.map +1 -1
  22. package/resources/v1/analytics/index.mjs.map +1 -1
  23. package/resources/v1/index.d.mts +2 -1
  24. package/resources/v1/index.d.mts.map +1 -1
  25. package/resources/v1/index.d.ts +2 -1
  26. package/resources/v1/index.d.ts.map +1 -1
  27. package/resources/v1/index.js +3 -1
  28. package/resources/v1/index.js.map +1 -1
  29. package/resources/v1/index.mjs +1 -0
  30. package/resources/v1/index.mjs.map +1 -1
  31. package/resources/v1/revenue/attribution.d.mts +62 -0
  32. package/resources/v1/revenue/attribution.d.mts.map +1 -0
  33. package/resources/v1/revenue/attribution.d.ts +62 -0
  34. package/resources/v1/revenue/attribution.d.ts.map +1 -0
  35. package/resources/v1/revenue/attribution.js +41 -0
  36. package/resources/v1/revenue/attribution.js.map +1 -0
  37. package/resources/v1/revenue/attribution.mjs +37 -0
  38. package/resources/v1/revenue/attribution.mjs.map +1 -0
  39. package/resources/v1/revenue/conversion.d.mts +34 -0
  40. package/resources/v1/revenue/conversion.d.mts.map +1 -0
  41. package/resources/v1/revenue/conversion.d.ts +34 -0
  42. package/resources/v1/revenue/conversion.d.ts.map +1 -0
  43. package/resources/v1/revenue/conversion.js +25 -0
  44. package/resources/v1/revenue/conversion.js.map +1 -0
  45. package/resources/v1/revenue/conversion.mjs +21 -0
  46. package/resources/v1/revenue/conversion.mjs.map +1 -0
  47. package/resources/v1/revenue/customers.d.mts +61 -0
  48. package/resources/v1/revenue/customers.d.mts.map +1 -0
  49. package/resources/v1/revenue/customers.d.ts +61 -0
  50. package/resources/v1/revenue/customers.d.ts.map +1 -0
  51. package/resources/v1/revenue/customers.js +40 -0
  52. package/resources/v1/revenue/customers.js.map +1 -0
  53. package/resources/v1/revenue/customers.mjs +36 -0
  54. package/resources/v1/revenue/customers.mjs.map +1 -0
  55. package/resources/v1/revenue/index.d.mts +5 -0
  56. package/resources/v1/revenue/index.d.mts.map +1 -0
  57. package/resources/v1/revenue/index.d.ts +5 -0
  58. package/resources/v1/revenue/index.d.ts.map +1 -0
  59. package/resources/v1/revenue/index.js +13 -0
  60. package/resources/v1/revenue/index.js.map +1 -0
  61. package/resources/v1/revenue/index.mjs +6 -0
  62. package/resources/v1/revenue/index.mjs.map +1 -0
  63. package/resources/v1/revenue/revenue.d.mts +255 -0
  64. package/resources/v1/revenue/revenue.d.mts.map +1 -0
  65. package/resources/v1/revenue/revenue.d.ts +255 -0
  66. package/resources/v1/revenue/revenue.d.ts.map +1 -0
  67. package/resources/v1/revenue/revenue.js +53 -0
  68. package/resources/v1/revenue/revenue.js.map +1 -0
  69. package/resources/v1/revenue/revenue.mjs +48 -0
  70. package/resources/v1/revenue/revenue.mjs.map +1 -0
  71. package/resources/v1/revenue.d.mts +2 -0
  72. package/resources/v1/revenue.d.mts.map +1 -0
  73. package/resources/v1/revenue.d.ts +2 -0
  74. package/resources/v1/revenue.d.ts.map +1 -0
  75. package/resources/v1/revenue.js +6 -0
  76. package/resources/v1/revenue.js.map +1 -0
  77. package/resources/v1/revenue.mjs +3 -0
  78. package/resources/v1/revenue.mjs.map +1 -0
  79. package/resources/v1/v1.d.mts +6 -2
  80. package/resources/v1/v1.d.mts.map +1 -1
  81. package/resources/v1/v1.d.ts +6 -2
  82. package/resources/v1/v1.d.ts.map +1 -1
  83. package/resources/v1/v1.js +4 -0
  84. package/resources/v1/v1.js.map +1 -1
  85. package/resources/v1/v1.mjs +4 -0
  86. package/resources/v1/v1.mjs.map +1 -1
  87. package/src/resources/v1/analytics/analytics.ts +34 -2
  88. package/src/resources/v1/analytics/events.ts +66 -2
  89. package/src/resources/v1/analytics/index.ts +2 -1
  90. package/src/resources/v1/index.ts +19 -0
  91. package/src/resources/v1/revenue/attribution.ts +84 -0
  92. package/src/resources/v1/revenue/conversion.ts +44 -0
  93. package/src/resources/v1/revenue/customers.ts +77 -0
  94. package/src/resources/v1/revenue/index.ts +23 -0
  95. package/src/resources/v1/revenue/revenue.ts +385 -0
  96. package/src/resources/v1/revenue.ts +3 -0
  97. package/src/resources/v1/v1.ts +42 -0
  98. package/src/version.ts +1 -1
  99. package/version.d.mts +1 -1
  100. package/version.d.ts +1 -1
  101. package/version.js +1 -1
  102. package/version.mjs +1 -1
@@ -0,0 +1,385 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as AttributionAPI from './attribution';
5
+ import { Attribution, AttributionByOriginParams, AttributionByUtmParams } from './attribution';
6
+ import * as ConversionAPI from './conversion';
7
+ import { Conversion, ConversionMetricsParams } from './conversion';
8
+ import * as CustomersAPI from './customers';
9
+ import { CustomerProfileParams, CustomerTopParams, Customers } from './customers';
10
+ import { APIPromise } from '../../../core/api-promise';
11
+ import { RequestOptions } from '../../../internal/request-options';
12
+
13
+ export class Revenue extends APIResource {
14
+ attribution: AttributionAPI.Attribution = new AttributionAPI.Attribution(this._client);
15
+ customers: CustomersAPI.Customers = new CustomersAPI.Customers(this._client);
16
+ conversion: ConversionAPI.Conversion = new ConversionAPI.Conversion(this._client);
17
+
18
+ /**
19
+ * Get key revenue metrics including total revenue, conversion rate, and average
20
+ * order value
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const dashboardResponse = await client.v1.revenue.dashboard(
25
+ * { project_id: 'project_id', time_range: 'last_hour' },
26
+ * );
27
+ * ```
28
+ */
29
+ dashboard(query: RevenueDashboardParams, options?: RequestOptions): APIPromise<DashboardResponse> {
30
+ return this._client.get('/api/v1/revenue/dashboard', { query, ...options });
31
+ }
32
+
33
+ /**
34
+ * Get revenue metrics over time for chart visualization
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const timelineResponse = await client.v1.revenue.timeline({
39
+ * project_id: 'project_id',
40
+ * time_range: 'last_hour',
41
+ * });
42
+ * ```
43
+ */
44
+ timeline(query: RevenueTimelineParams, options?: RequestOptions): APIPromise<TimelineResponse> {
45
+ return this._client.get('/api/v1/revenue/timeline', { query, ...options });
46
+ }
47
+ }
48
+
49
+ export interface AttributionByOriginResponse {
50
+ data?: Array<OriginAttributionDataPoint>;
51
+ }
52
+
53
+ export interface AttributionByUtmResponse {
54
+ data?: Array<UtmAttributionDataPoint>;
55
+ }
56
+
57
+ export interface ConversionMetricsResponse {
58
+ avg_purchases_per_customer?: number;
59
+
60
+ /**
61
+ * Time to conversion
62
+ */
63
+ avg_time_to_first_purchase_hours?: number;
64
+
65
+ /**
66
+ * % of visitors who paid
67
+ */
68
+ conversion_rate?: number;
69
+
70
+ /**
71
+ * Customer value
72
+ */
73
+ customer_lifetime_value?: number;
74
+
75
+ median_time_to_first_purchase_hours?: number;
76
+
77
+ paying_customers?: number;
78
+
79
+ /**
80
+ * Repeat purchase metrics
81
+ */
82
+ repeat_purchase_rate?: number;
83
+
84
+ /**
85
+ * Funnel metrics
86
+ */
87
+ total_visitors?: number;
88
+ }
89
+
90
+ export interface CustomerProfileResponse {
91
+ avg_order_value?: number;
92
+
93
+ currency?: string;
94
+
95
+ email?: string;
96
+
97
+ external_id?: string;
98
+
99
+ first_payment_date?: string;
100
+
101
+ /**
102
+ * Attribution
103
+ */
104
+ first_traffic_origin?: string;
105
+
106
+ first_utm_campaign?: string;
107
+
108
+ first_utm_medium?: string;
109
+
110
+ first_utm_source?: string;
111
+
112
+ last_payment_date?: string;
113
+
114
+ name?: string;
115
+
116
+ payment_count?: number;
117
+
118
+ /**
119
+ * Payment history
120
+ */
121
+ payments?: Array<Payment>;
122
+
123
+ /**
124
+ * Revenue over time (last 90 days)
125
+ */
126
+ revenue_over_time?: Array<RevenueOverTimeDataPoint>;
127
+
128
+ /**
129
+ * Revenue summary
130
+ */
131
+ total_revenue?: number;
132
+
133
+ user_id?: string;
134
+
135
+ /**
136
+ * Identity
137
+ */
138
+ visitor_id?: string;
139
+ }
140
+
141
+ export interface DashboardResponse {
142
+ /**
143
+ * Average metrics
144
+ */
145
+ avg_order_value?: number;
146
+
147
+ /**
148
+ * Average revenue per paying customer
149
+ */
150
+ avg_revenue_per_customer?: number;
151
+
152
+ avg_revenue_per_identified_customer?: number;
153
+
154
+ /**
155
+ * Average revenue per session
156
+ */
157
+ avg_revenue_per_session?: number;
158
+
159
+ /**
160
+ * % of visitors who paid
161
+ */
162
+ conversion_rate?: number;
163
+
164
+ currency?: string;
165
+
166
+ identified_customer_revenue?: number;
167
+
168
+ /**
169
+ * Identified customers (have email/user_id)
170
+ */
171
+ identified_customers?: number;
172
+
173
+ /**
174
+ * Customer metrics
175
+ */
176
+ paying_customers?: number;
177
+
178
+ /**
179
+ * Count of successful payments
180
+ */
181
+ total_payments?: number;
182
+
183
+ /**
184
+ * Core revenue metrics
185
+ */
186
+ total_revenue?: number;
187
+ }
188
+
189
+ export interface OriginAttributionDataPoint {
190
+ /**
191
+ * Average revenue per paying customer
192
+ */
193
+ avg_revenue_per_customer?: number;
194
+
195
+ /**
196
+ * paying_customers / unique_visitors \* 100
197
+ */
198
+ conversion_rate?: number;
199
+
200
+ currency?: string;
201
+
202
+ origin?: string;
203
+
204
+ paying_customers?: number;
205
+
206
+ payment_count?: number;
207
+
208
+ revenue_percentage?: number;
209
+
210
+ /**
211
+ * Revenue in smallest currency unit (cents)
212
+ */
213
+ total_revenue?: number;
214
+
215
+ unique_visitors?: number;
216
+ }
217
+
218
+ export interface Payment {
219
+ amount?: number;
220
+
221
+ currency?: string;
222
+
223
+ payment_id?: string;
224
+
225
+ payment_timestamp?: string;
226
+
227
+ product_name?: string;
228
+
229
+ provider_type?: string;
230
+
231
+ status?: string;
232
+ }
233
+
234
+ export interface RevenueOverTimeDataPoint {
235
+ payment_count?: number;
236
+
237
+ timestamp?: string;
238
+
239
+ total_revenue?: number;
240
+ }
241
+
242
+ export interface TimelineDataPoint {
243
+ currency?: string;
244
+
245
+ payment_count?: number;
246
+
247
+ timestamp?: string;
248
+
249
+ /**
250
+ * Revenue in smallest currency unit (cents)
251
+ */
252
+ total_revenue?: number;
253
+ }
254
+
255
+ export interface TimelineResponse {
256
+ data?: Array<TimelineDataPoint>;
257
+ }
258
+
259
+ export interface TopCustomer {
260
+ avg_order_value?: number;
261
+
262
+ currency?: string;
263
+
264
+ email?: string;
265
+
266
+ external_id?: string;
267
+
268
+ first_payment_date?: string;
269
+
270
+ first_traffic_origin?: string;
271
+
272
+ last_payment_date?: string;
273
+
274
+ location_country_iso?: string;
275
+
276
+ name?: string;
277
+
278
+ payment_count?: number;
279
+
280
+ /**
281
+ * Total revenue in smallest currency unit (cents)
282
+ */
283
+ total_revenue?: number;
284
+
285
+ user_id?: string;
286
+
287
+ visitor_id?: string;
288
+ }
289
+
290
+ export interface TopCustomersResponse {
291
+ customers?: Array<TopCustomer>;
292
+
293
+ total?: number;
294
+ }
295
+
296
+ export interface UtmAttributionDataPoint {
297
+ /**
298
+ * Average revenue per paying customer
299
+ */
300
+ avg_revenue_per_customer?: number;
301
+
302
+ /**
303
+ * paying_customers / unique_visitors \* 100
304
+ */
305
+ conversion_rate?: number;
306
+
307
+ currency?: string;
308
+
309
+ paying_customers?: number;
310
+
311
+ payment_count?: number;
312
+
313
+ revenue_percentage?: number;
314
+
315
+ /**
316
+ * Revenue in smallest currency unit (cents)
317
+ */
318
+ total_revenue?: number;
319
+
320
+ unique_visitors?: number;
321
+
322
+ utm_value?: string;
323
+ }
324
+
325
+ export interface RevenueDashboardParams {
326
+ /**
327
+ * Project ID
328
+ */
329
+ project_id: string;
330
+
331
+ /**
332
+ * Time range
333
+ */
334
+ time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
335
+ }
336
+
337
+ export interface RevenueTimelineParams {
338
+ /**
339
+ * Project ID
340
+ */
341
+ project_id: string;
342
+
343
+ /**
344
+ * Time range
345
+ */
346
+ time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
347
+ }
348
+
349
+ Revenue.Attribution = Attribution;
350
+ Revenue.Customers = Customers;
351
+ Revenue.Conversion = Conversion;
352
+
353
+ export declare namespace Revenue {
354
+ export {
355
+ type AttributionByOriginResponse as AttributionByOriginResponse,
356
+ type AttributionByUtmResponse as AttributionByUtmResponse,
357
+ type ConversionMetricsResponse as ConversionMetricsResponse,
358
+ type CustomerProfileResponse as CustomerProfileResponse,
359
+ type DashboardResponse as DashboardResponse,
360
+ type OriginAttributionDataPoint as OriginAttributionDataPoint,
361
+ type Payment as Payment,
362
+ type RevenueOverTimeDataPoint as RevenueOverTimeDataPoint,
363
+ type TimelineDataPoint as TimelineDataPoint,
364
+ type TimelineResponse as TimelineResponse,
365
+ type TopCustomer as TopCustomer,
366
+ type TopCustomersResponse as TopCustomersResponse,
367
+ type UtmAttributionDataPoint as UtmAttributionDataPoint,
368
+ type RevenueDashboardParams as RevenueDashboardParams,
369
+ type RevenueTimelineParams as RevenueTimelineParams,
370
+ };
371
+
372
+ export {
373
+ Attribution as Attribution,
374
+ type AttributionByOriginParams as AttributionByOriginParams,
375
+ type AttributionByUtmParams as AttributionByUtmParams,
376
+ };
377
+
378
+ export {
379
+ Customers as Customers,
380
+ type CustomerProfileParams as CustomerProfileParams,
381
+ type CustomerTopParams as CustomerTopParams,
382
+ };
383
+
384
+ export { Conversion as Conversion, type ConversionMetricsParams as ConversionMetricsParams };
385
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './revenue/index';
@@ -51,6 +51,7 @@ import {
51
51
  CohortData,
52
52
  CountryDataPoint,
53
53
  DashboardMetricsResponse,
54
+ EventFilterOptionsResponse,
54
55
  EventsOverTimeDataPoint,
55
56
  ManualIdentifyRequest,
56
57
  ManualIdentifyResponse,
@@ -70,9 +71,29 @@ import {
70
71
  VisitorsByDeviceResponse,
71
72
  VisitorsByOriginResponse,
72
73
  } from './analytics/analytics';
74
+ import * as RevenueAPI from './revenue/revenue';
75
+ import {
76
+ AttributionByOriginResponse,
77
+ AttributionByUtmResponse,
78
+ ConversionMetricsResponse,
79
+ CustomerProfileResponse,
80
+ DashboardResponse,
81
+ OriginAttributionDataPoint,
82
+ Payment,
83
+ Revenue,
84
+ RevenueDashboardParams,
85
+ RevenueOverTimeDataPoint,
86
+ RevenueTimelineParams,
87
+ TimelineDataPoint,
88
+ TimelineResponse,
89
+ TopCustomer,
90
+ TopCustomersResponse,
91
+ UtmAttributionDataPoint,
92
+ } from './revenue/revenue';
73
93
 
74
94
  export class V1 extends APIResource {
75
95
  analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client);
96
+ revenue: RevenueAPI.Revenue = new RevenueAPI.Revenue(this._client);
76
97
  projects: ProjectsAPI.Projects = new ProjectsAPI.Projects(this._client);
77
98
  auth: AuthAPI.Auth = new AuthAPI.Auth(this._client);
78
99
  paymentProviders: PaymentProvidersAPI.PaymentProviders = new PaymentProvidersAPI.PaymentProviders(
@@ -81,6 +102,7 @@ export class V1 extends APIResource {
81
102
  }
82
103
 
83
104
  V1.Analytics = Analytics;
105
+ V1.Revenue = Revenue;
84
106
  V1.Projects = Projects;
85
107
  V1.Auth = Auth;
86
108
  V1.PaymentProviders = PaymentProviders;
@@ -96,6 +118,7 @@ export declare namespace V1 {
96
118
  type CohortData as CohortData,
97
119
  type CountryDataPoint as CountryDataPoint,
98
120
  type DashboardMetricsResponse as DashboardMetricsResponse,
121
+ type EventFilterOptionsResponse as EventFilterOptionsResponse,
99
122
  type EventsOverTimeDataPoint as EventsOverTimeDataPoint,
100
123
  type ManualIdentifyRequest as ManualIdentifyRequest,
101
124
  type ManualIdentifyResponse as ManualIdentifyResponse,
@@ -117,6 +140,25 @@ export declare namespace V1 {
117
140
  type AnalyticsDashboardParams as AnalyticsDashboardParams,
118
141
  };
119
142
 
143
+ export {
144
+ Revenue as Revenue,
145
+ type AttributionByOriginResponse as AttributionByOriginResponse,
146
+ type AttributionByUtmResponse as AttributionByUtmResponse,
147
+ type ConversionMetricsResponse as ConversionMetricsResponse,
148
+ type CustomerProfileResponse as CustomerProfileResponse,
149
+ type DashboardResponse as DashboardResponse,
150
+ type OriginAttributionDataPoint as OriginAttributionDataPoint,
151
+ type Payment as Payment,
152
+ type RevenueOverTimeDataPoint as RevenueOverTimeDataPoint,
153
+ type TimelineDataPoint as TimelineDataPoint,
154
+ type TimelineResponse as TimelineResponse,
155
+ type TopCustomer as TopCustomer,
156
+ type TopCustomersResponse as TopCustomersResponse,
157
+ type UtmAttributionDataPoint as UtmAttributionDataPoint,
158
+ type RevenueDashboardParams as RevenueDashboardParams,
159
+ type RevenueTimelineParams as RevenueTimelineParams,
160
+ };
161
+
120
162
  export {
121
163
  Projects as Projects,
122
164
  type CreateProjectRequest as CreateProjectRequest,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.7.0'; // x-release-please-version
1
+ export const VERSION = '0.9.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.7.0";
1
+ export declare const VERSION = "0.9.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.7.0";
1
+ export declare const VERSION = "0.9.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.7.0'; // x-release-please-version
4
+ exports.VERSION = '0.9.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.7.0'; // x-release-please-version
1
+ export const VERSION = '0.9.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map