@cohostvip/cohost-node 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,48 +1,3 @@
1
- /**
2
- * Supported HTTP methods.
3
- */
4
- type RequestMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
5
- /**
6
- * A function that performs a request to the Cohost API.
7
- * The generic <T> allows you to specify the expected response type.
8
- */
9
- type RequestFn = <T = any>(path: string, options?: {
10
- method?: RequestMethod;
11
- data?: any;
12
- query?: Record<string, string | number | boolean | undefined>;
13
- headers?: Record<string, string>;
14
- }) => Promise<T>;
15
-
16
- /**
17
- * Optional settings for customizing the behavior of the CohostClient.
18
- */
19
- interface CohostClientSettings {
20
- /** Enable verbose debug output for all API requests. */
21
- debug?: boolean;
22
- /** Override the default API base URL (defaults to apiBaseUrl). */
23
- apiUrl?: string;
24
- }
25
-
26
- /**
27
- * Base class for all API endpoint groups within the Cohost SDK.
28
- * Provides shared access to the configured request function and settings.
29
- */
30
- declare class CohostEndpoint {
31
- /** Shared request function injected from the client */
32
- protected request: RequestFn;
33
- /** Client settings passed during instantiation */
34
- protected settings: CohostClientSettings;
35
- /**
36
- * Constructs a new endpoint group.
37
- *
38
- * @param request - The shared request function for performing API calls
39
- * @param settings - The client-wide settings passed from the parent client
40
- */
41
- constructor(request: RequestFn, settings: CohostClientSettings);
42
- }
43
-
44
- // Generated by dts-bundle-generator v9.5.1
45
-
46
1
  /**
47
2
  * A namespaced identifier representing the entity an order is associated with.
48
3
  *
@@ -63,55 +18,76 @@ type ApiVersion = "2025-04-15";
63
18
  * A rich content object that supports multiple representations of text.
64
19
  */
65
20
  interface MultipartText {
66
- /** HTML version of the content. */
67
- html?: string;
68
- /** Plain text version of the content. */
69
- text?: string;
70
- /** Markdown version of the content. */
71
- md?: string;
72
- /** Optional rich editor blocks (if structured editing is supported). */
73
- blocks?: any[] | null;
21
+ /** HTML version of the content. */
22
+ html?: string;
23
+ /** Plain text version of the content. */
24
+ text?: string;
25
+ /** Markdown version of the content. */
26
+ md?: string;
27
+ /** Optional rich editor blocks (if structured editing is supported). */
28
+ blocks?: any[] | null;
74
29
  }
75
30
  /**
76
31
  * A photo object with resolution options and optional metadata.
77
32
  */
78
33
  interface Photo {
79
- /** High-resolution (2x) image URL. */
80
- "2x"?: string;
81
- /** Internal photo ID, if stored in a media system. */
82
- id?: string;
83
- /**
84
- * Primary image URL.
85
- * This is the default image URL to be used when no other resolution is specified.
86
- *
87
- * @example "https://picsum.photos/500"
88
- *
89
- *
90
- * @x-faker image.imageUrl
91
- */
92
- url: string;
93
- /** Width of the image in pixels. */
94
- width?: number;
95
- /** Height of the image in pixels. */
96
- height?: number;
97
- /** Optional caption for the image. */
98
- caption?: string;
34
+ /** High-resolution (2x) image URL. */
35
+ "2x"?: string;
36
+ /** Internal photo ID, if stored in a media system. */
37
+ id?: string;
38
+ /**
39
+ * Primary image URL.
40
+ * This is the default image URL to be used when no other resolution is specified.
41
+ *
42
+ * @example "https://picsum.photos/500"
43
+ *
44
+ *
45
+ * @x-faker image.imageUrl
46
+ */
47
+ url: string;
48
+ /** Width of the image in pixels. */
49
+ width?: number;
50
+ /** Height of the image in pixels. */
51
+ height?: number;
52
+ /** Optional caption for the image. */
53
+ caption?: string;
99
54
  }
100
55
  /**
101
56
  * A repeating or structured date schedule for an event or item.
102
57
  */
103
58
  interface Schedule {
104
- /** Days of the week (0 = Sunday, 6 = Saturday). */
105
- daysOfWeek?: number[];
106
- /** ISO-formatted UTC start datetime. */
107
- start: string;
108
- /** ISO-formatted UTC end datetime. */
109
- end: string;
110
- /** Specific dates to exclude in "YYYY-MM-DD" format. */
111
- excludeDates?: string[];
112
- /** Specific dates to include in "YYYY-MM-DD" format. */
113
- includeDates?: string[];
59
+ /** Days of the week (0 = Sunday, 6 = Saturday). */
60
+ daysOfWeek?: number[];
61
+ /** ISO-formatted UTC start datetime. */
62
+ start: string;
63
+ /** ISO-formatted UTC end datetime. */
64
+ end: string;
65
+ /** Specific dates to exclude in "YYYY-MM-DD" format. */
66
+ excludeDates?: string[];
67
+ /** Specific dates to include in "YYYY-MM-DD" format. */
68
+ includeDates?: string[];
69
+ }
70
+ /**
71
+ * Pagination parameters for a paginated API request.
72
+ */
73
+ interface Pagination$1 {
74
+ /** Number of results per page. */
75
+ size: number;
76
+ /** Page number (starting from 1). */
77
+ page: number;
78
+ /** Continuation */
79
+ continuation?: string;
80
+ }
81
+ interface PaginationResponse extends Pagination$1 {
82
+ /** Total number of results available. */
83
+ total: number;
114
84
  }
85
+ type PaginatedResponse<T> = {
86
+ /** Array of results. */
87
+ results: T[];
88
+ /** Pagination metadata. */
89
+ pagination: PaginationResponse;
90
+ };
115
91
  /**
116
92
  * Base metadata for any record stored in the system.
117
93
  * Includes an ID and timestamps for creation and optional updates.
@@ -119,21 +95,21 @@ interface Schedule {
119
95
  * @export
120
96
  */
121
97
  interface DataRecord {
122
- /**
123
- * Unique identifier for the record.
124
- * @example "rec_123abc"
125
- */
126
- id: string;
127
- /**
128
- * ISO 8601 timestamp indicating when the record was created.
129
- * @example "2025-04-16T10:15:00Z"
130
- */
131
- created: string;
132
- /**
133
- * ISO 8601 timestamp indicating when the record was last updated, if applicable.
134
- * @example "2025-04-18T08:00:00Z"
135
- */
136
- changed?: string;
98
+ /**
99
+ * Unique identifier for the record.
100
+ * @example "rec_123abc"
101
+ */
102
+ id: string;
103
+ /**
104
+ * ISO 8601 timestamp indicating when the record was created.
105
+ * @example "2025-04-16T10:15:00Z"
106
+ */
107
+ created: string;
108
+ /**
109
+ * ISO 8601 timestamp indicating when the record was last updated, if applicable.
110
+ * @example "2025-04-18T08:00:00Z"
111
+ */
112
+ changed?: string;
137
113
  }
138
114
  /**
139
115
  * Extension of `DataRecord` for resources returned from RESTful APIs.
@@ -142,15 +118,15 @@ interface DataRecord {
142
118
  * @export
143
119
  */
144
120
  interface VersionedDataRecord extends DataRecord {
145
- /**
146
- * Schema version identifier for this record.
147
- * Helps manage compatibility across client-server contracts.
148
- * @example "2025-01-10"
149
- */
150
- version: ApiVersion;
121
+ /**
122
+ * Schema version identifier for this record.
123
+ * Helps manage compatibility across client-server contracts.
124
+ * @example "2025-01-10"
125
+ */
126
+ version: ApiVersion;
151
127
  }
152
128
  interface VCDataRecord extends VersionedDataRecord {
153
- companyId: string;
129
+ companyId: string;
154
130
  }
155
131
  /**
156
132
  * Represents either an absolute or a relative time constraint.
@@ -161,19 +137,28 @@ interface VCDataRecord extends VersionedDataRecord {
161
137
  * @export
162
138
  */
163
139
  type TimeOrOffset = {
164
- /**
165
- * Absolute time in ISO 8601 format.
166
- * @example "2025-06-30T23:59:59"
167
- */
168
- date: string;
169
- secondsBefore?: never;
140
+ /**
141
+ * Absolute time in ISO 8601 format.
142
+ * @example "2025-06-30T23:59:59"
143
+ */
144
+ date: string;
145
+ secondsBefore?: never;
170
146
  } | {
171
- /**
172
- * Relative time before an anchor point (e.g. event start), in seconds.
173
- * @example 3600
174
- */
175
- secondsBefore: number;
176
- date?: never;
147
+ /**
148
+ * Relative time before an anchor point (e.g. event start), in seconds.
149
+ * @example 3600
150
+ */
151
+ secondsBefore: number;
152
+ date?: never;
153
+ };
154
+ /**
155
+ * A request structure that includes both query parameters and pagination.
156
+ *
157
+ * @ignore
158
+ */
159
+ type PaginatedRequest<T> = T & {
160
+ /** Pagination settings. */
161
+ pagination: Pagination$1;
177
162
  };
178
163
  /**
179
164
  * @description A string representing a currency amount in the format `"USD,1000"` where:
@@ -191,44 +176,44 @@ type TimeOrOffset = {
191
176
  */
192
177
  type CurrencyAmount = string;
193
178
  interface CostBase {
194
- /**
195
- * The base value of the cost. This is the value before any operations are applied.
196
- * in OrderItem this is the cost of a single item.
197
- *
198
- * @example "USD,1000"
199
- */
200
- cost: CurrencyAmount;
201
- /**
202
- * Delivery fee for a single item.
203
- *
204
- * @example "USD,1000"
205
- */
206
- delivery: CurrencyAmount;
207
- /**
208
- * Fee per item.
209
- * @example "USD,1000"
210
- */
211
- fee: CurrencyAmount;
212
- /**
213
- * Total discount amount applied to this item.
214
- * @example "USD,1000"
215
- */
216
- tax: CurrencyAmount;
179
+ /**
180
+ * The base value of the cost. This is the value before any operations are applied.
181
+ * in OrderItem this is the cost of a single item.
182
+ *
183
+ * @example "USD,1000"
184
+ */
185
+ cost: CurrencyAmount;
186
+ /**
187
+ * Delivery fee for a single item.
188
+ *
189
+ * @example "USD,1000"
190
+ */
191
+ delivery: CurrencyAmount;
192
+ /**
193
+ * Fee per item.
194
+ * @example "USD,1000"
195
+ */
196
+ fee: CurrencyAmount;
197
+ /**
198
+ * Total discount amount applied to this item.
199
+ * @example "USD,1000"
200
+ */
201
+ tax: CurrencyAmount;
217
202
  }
218
203
  interface CostComponentCap {
219
- op: "cap";
220
- type: "percentage" | "absolute";
221
- /**
222
- * The value of the cap. If type is percentage, it is a percentage of the base value.
223
- * If type is absolute, it is an absolute value.
224
- *
225
- * Absolute value is represented in the same denomination as the cost.
226
- * i.e. if the cost is in cents, the absolute value should be in cents.
227
- *
228
- * percentage value is represented as a decimal.
229
- * For example, 10% is represented as 0.1.
230
- */
231
- value: number;
204
+ op: "cap";
205
+ type: "percentage" | "absolute";
206
+ /**
207
+ * The value of the cap. If type is percentage, it is a percentage of the base value.
208
+ * If type is absolute, it is an absolute value.
209
+ *
210
+ * Absolute value is represented in the same denomination as the cost.
211
+ * i.e. if the cost is in cents, the absolute value should be in cents.
212
+ *
213
+ * percentage value is represented as a decimal.
214
+ * For example, 10% is represented as 0.1.
215
+ */
216
+ value: number;
232
217
  }
233
218
  /**
234
219
  * Represents a cost operation to be applied in a pricing formula.
@@ -237,27 +222,27 @@ interface CostComponentCap {
237
222
  * { op: '*', value: 0.9 }
238
223
  */
239
224
  interface CostOp {
240
- /**
241
- * The operation to apply to the cost value.
242
- *
243
- * Allowed values:
244
- * - "+" (addition)
245
- * - "-" (subtraction)
246
- * - "*" (multiplication)
247
- * - "/" (division)
248
- * @ignore
249
- * @enum {string}
250
- */
251
- op: "+" | "-" | "*" | "/";
252
- /**
253
- * The operand value used in the cost operation.
254
- *
255
- * The unit should match the denomination of the cost.
256
- * For example, if cost is expressed in cents, this value should also be in cents.
257
- *
258
- * @example 100
259
- */
260
- value: number;
225
+ /**
226
+ * The operation to apply to the cost value.
227
+ *
228
+ * Allowed values:
229
+ * - "+" (addition)
230
+ * - "-" (subtraction)
231
+ * - "*" (multiplication)
232
+ * - "/" (division)
233
+ * @ignore
234
+ * @enum {string}
235
+ */
236
+ op: "+" | "-" | "*" | "/";
237
+ /**
238
+ * The operand value used in the cost operation.
239
+ *
240
+ * The unit should match the denomination of the cost.
241
+ * For example, if cost is expressed in cents, this value should also be in cents.
242
+ *
243
+ * @example 100
244
+ */
245
+ value: number;
261
246
  }
262
247
  /**
263
248
  * A set of comparison operators used for evaluating conditional expressions.
@@ -274,34 +259,34 @@ interface CostOp {
274
259
  */
275
260
  type EqualOperator = "==" | "!=" | "<" | "<=" | ">" | ">=";
276
261
  interface CostComponentRuleCondition {
277
- /**
278
- * The field to evaluate the condition against.
279
- * For example, "item.price" or "order.total".
280
- * The field should be a valid path to the field in the cost component base.
281
- */
282
- field: string;
283
- /**
284
- *
285
- */
286
- operator: EqualOperator;
287
- /**
288
- * Can be a value such as number, currencyAmount, an ISO date string, etc...
289
- */
290
- value: string | number | any;
291
- /**
292
- * evaluator, will define a function or endpoint to evaluate the condition.
293
- */
294
- eval?: string;
262
+ /**
263
+ * The field to evaluate the condition against.
264
+ * For example, "item.price" or "order.total".
265
+ * The field should be a valid path to the field in the cost component base.
266
+ */
267
+ field: string;
268
+ /**
269
+ *
270
+ */
271
+ operator: EqualOperator;
272
+ /**
273
+ * Can be a value such as number, currencyAmount, an ISO date string, etc...
274
+ */
275
+ value: string | number | any;
276
+ /**
277
+ * evaluator, will define a function or endpoint to evaluate the condition.
278
+ */
279
+ eval?: string;
295
280
  }
296
281
  interface CostComponentRule {
297
- /**
298
- * Friendly name of the rule.
299
- */
300
- name: string;
301
- /**
302
- * The rule will be applied to the cost component if the conditions are met.
303
- */
304
- conditions: CostComponentRuleCondition[];
282
+ /**
283
+ * Friendly name of the rule.
284
+ */
285
+ name: string;
286
+ /**
287
+ * The rule will be applied to the cost component if the conditions are met.
288
+ */
289
+ conditions: CostComponentRuleCondition[];
305
290
  }
306
291
  /**
307
292
  * Represents the costs associated with an offering.
@@ -314,43 +299,43 @@ interface CostComponentRule {
314
299
  * @property {CurrencyAmount} total - The total cost including tax.
315
300
  */
316
301
  interface OfferingCosts extends CostBase {
317
- /**
318
- * cost + fee - discount , not including tax
319
- *
320
- * In an order item, this is the gross cost of a single item.
321
- *
322
- * @x-faker {"random.arrayElement": ["\"USD,100000\"", "\"USD,25000\""]}
323
- */
324
- gross: CurrencyAmount;
325
- /**
326
- * total cost including tax
327
- *
328
- * In an order item, this is the total cost * Quantity.
329
- */
330
- total: CurrencyAmount;
302
+ /**
303
+ * cost + fee - discount , not including tax
304
+ *
305
+ * In an order item, this is the gross cost of a single item.
306
+ *
307
+ * @x-faker {"random.arrayElement": ["\"USD,100000\"", "\"USD,25000\""]}
308
+ */
309
+ gross: CurrencyAmount;
310
+ /**
311
+ * total cost including tax
312
+ *
313
+ * In an order item, this is the total cost * Quantity.
314
+ */
315
+ total: CurrencyAmount;
331
316
  }
332
317
  type CostBucket = "item" | "fee" | "tax" | "delivery";
333
318
  interface CostComponent {
334
- id: string;
335
- name: string;
336
- details?: any;
337
- currency: string | "*";
338
- base: "order" | "item" | string;
339
- bucket: CostBucket;
340
- recipient: "organizer" | "platform" | "tax" | string;
341
- payer: "attendee" | "organizer";
342
- /**
343
- * @ignore
344
- */
345
- ops: CostOp[];
346
- cap?: CostComponentCap;
347
- rules: CostComponentRule[];
348
- version: "2025-03-25";
319
+ id: string;
320
+ name: string;
321
+ details?: any;
322
+ currency: string | "*";
323
+ base: "order" | "item" | string;
324
+ bucket: CostBucket;
325
+ recipient: "organizer" | "platform" | "tax" | string;
326
+ payer: "attendee" | "organizer";
327
+ /**
328
+ * @ignore
329
+ */
330
+ ops: CostOp[];
331
+ cap?: CostComponentCap;
332
+ rules: CostComponentRule[];
333
+ version: "2025-03-25";
349
334
  }
350
335
  interface CalculatedCostComponent extends Omit<CostComponent, "ops" | "cap" | "rules" | "details" | "currency"> {
351
- cost: CurrencyAmount;
352
- value: number;
353
- discount: null;
336
+ cost: CurrencyAmount;
337
+ value: number;
338
+ discount: null;
354
339
  }
355
340
  /**
356
341
  * @zod .string()
@@ -360,126 +345,164 @@ type ActiveOfferingStatus = "live" | "hidden" | "sold-out";
360
345
  type OfferingStatus = ActiveOfferingStatus | "draft" | "deleted" | "unavailable";
361
346
  type PriceCategory = "donation" | "free" | "paid" | "other";
362
347
  interface Offering extends DataRecord {
363
- /**
364
- * Offering name, can be ticket name, vaucher name, etc...
365
- * @example "General Admission" (ticket) | "T-shirt" (merch) | "Donation" (donation) | "Membership" (membership) | "Gift Card" (voucher) | "Service Fee" (service) | "Other" (other)
366
- *
367
- * @x-faker commerce.productName
368
- */
369
- name: string;
370
- type: OfferingType;
371
- /**
372
- * @description The maximum number of tickets that can be sold for this offering.
373
- *
374
- * @example 100
375
- *
376
- * @x-faker {"datatype.number": { "min": 10, "max": 100 }}
377
- */
378
- capacity: number;
379
- quantitySold: number;
380
- status: OfferingStatus;
381
- priceCategory: PriceCategory;
382
- sorting: number;
383
- /**
384
- * @ignore
385
- */
386
- schedule?: Schedule;
387
- description?: string;
388
- instructions?: string;
389
- /**
390
- * @description Maximum number of tickets that can be purchased in a single order.
391
- *
392
- * @example 10
393
- *
394
- * @x-faker {"datatype.number": { "min": 4, "max": 15 }}
395
- */
396
- maximumQuantity: number;
397
- /**
398
- * @description Minimum number of tickets that can be purchased in a single order.
399
- *
400
- * @example 1
401
- *
402
- * @x-faker {"datatype.number": { "min": 1, "max": 4 }}
403
- */
404
- minimumQuantity: number;
405
- package?: boolean;
406
- /**
407
- * @description Items, products ,and vouchers included in this offering.
408
- *
409
- *
410
- * @x-faker {"array.length": 0}
411
- */
412
- included?: PackageInclude[];
413
- /**
414
- * Any constraints that apply to this offering.
415
- * it can be time limit, quantity limit, etc...
416
- */
417
- constraints?: any;
418
- hidden: boolean;
419
- order_confirmation_message?: string | null;
420
- costs: OfferingCosts;
421
- /**
422
- * Describe fees and other costs associated with purchasing tickets
423
- * to this offering
424
- *
425
- * @ignore
426
- */
427
- costComponents?: CostComponent[];
348
+ /**
349
+ * Offering name, can be ticket name, vaucher name, etc...
350
+ * @example "General Admission" (ticket) | "T-shirt" (merch) | "Donation" (donation) | "Membership" (membership) | "Gift Card" (voucher) | "Service Fee" (service) | "Other" (other)
351
+ *
352
+ * @x-faker commerce.productName
353
+ */
354
+ name: string;
355
+ type: OfferingType;
356
+ /**
357
+ * @description The maximum number of tickets that can be sold for this offering.
358
+ *
359
+ * @example 100
360
+ *
361
+ * @x-faker {"datatype.number": { "min": 10, "max": 100 }}
362
+ */
363
+ capacity: number;
364
+ quantitySold: number;
365
+ status: OfferingStatus;
366
+ priceCategory: PriceCategory;
367
+ sorting: number;
368
+ /**
369
+ * @ignore
370
+ */
371
+ schedule?: Schedule;
372
+ description?: string;
373
+ instructions?: string;
374
+ /**
375
+ * @description Maximum number of tickets that can be purchased in a single order.
376
+ *
377
+ * @example 10
378
+ *
379
+ * @x-faker {"datatype.number": { "min": 4, "max": 15 }}
380
+ */
381
+ maximumQuantity: number;
382
+ /**
383
+ * @description Minimum number of tickets that can be purchased in a single order.
384
+ *
385
+ * @example 1
386
+ *
387
+ * @x-faker {"datatype.number": { "min": 1, "max": 4 }}
388
+ */
389
+ minimumQuantity: number;
390
+ package?: boolean;
391
+ /**
392
+ * @description Items, products ,and vouchers included in this offering.
393
+ *
394
+ *
395
+ * @x-faker {"array.length": 0}
396
+ */
397
+ included?: PackageInclude[];
398
+ /**
399
+ * Any constraints that apply to this offering.
400
+ * it can be time limit, quantity limit, etc...
401
+ */
402
+ constraints?: any;
403
+ hidden: boolean;
404
+ order_confirmation_message?: string | null;
405
+ costs: OfferingCosts;
406
+ /**
407
+ * Describe fees and other costs associated with purchasing tickets
408
+ * to this offering
409
+ *
410
+ * @ignore
411
+ */
412
+ costComponents?: CostComponent[];
428
413
  }
429
414
  interface PackageInclude {
430
- id: string;
431
- quantity: number;
432
- type: OfferingType;
433
- description: string;
434
- ref?: any;
415
+ id: string;
416
+ quantity: number;
417
+ type: OfferingType;
418
+ description: string;
419
+ ref?: any;
435
420
  }
436
421
  interface Ticket extends Omit<Offering, "hidden" | "constraints" | "type"> {
437
- category: string;
438
- type: "admission" | "package" | "admission.tableCommitment";
439
- source: string;
440
- display_name?: string;
441
- description?: string;
442
- ticketParentId?: string;
443
- salesEnd: string;
444
- salesStart: string;
445
- parentId?: string;
446
- refId?: string;
422
+ category: string;
423
+ type: "admission" | "package" | "admission.tableCommitment";
424
+ source: string;
425
+ display_name?: string;
426
+ description?: string;
427
+ ticketParentId?: string;
428
+ salesEnd: string;
429
+ salesStart: string;
430
+ parentId?: string;
431
+ refId?: string;
432
+ }
433
+ /**
434
+ * Person interface
435
+ */
436
+ interface Person {
437
+ name: string;
438
+ photoURL?: string | null;
439
+ displayName: string;
440
+ first: string;
441
+ last: string;
442
+ gender: null | string | "male" | "female" | "other";
443
+ birthdate?: string | null;
444
+ age?: number;
445
+ }
446
+ interface PersonContact {
447
+ email: string | null;
448
+ phone: string | null;
449
+ }
450
+ type Customer = Person & PersonContact & {
451
+ uid: string | null;
452
+ };
453
+ type AttendeeStatus = "attending" | "checkedIn" | "cancelled" | "refunded" | "noShow" | "unknown" | string;
454
+ interface Attendee3 extends DataRecord {
455
+ /**
456
+ * Order ID, from /orders/:orderId
457
+ */
458
+ orderId: string;
459
+ /**
460
+ * For event it will be the ticket's id
461
+ */
462
+ offeringId: string;
463
+ offeringSnapshot: Partial<Offering>;
464
+ profile: Customer | null;
465
+ checkedIn: boolean;
466
+ barcodes: string[];
467
+ version: ApiVersion;
468
+ status: AttendeeStatus | string;
469
+ index: number;
447
470
  }
448
471
  interface BuzzBuilder {
449
- countLabel: string;
450
- profiles: {
451
- id: string;
452
- name: string;
453
- photoURL: string;
454
- }[];
472
+ countLabel: string;
473
+ profiles: {
474
+ id: string;
475
+ name: string;
476
+ photoURL: string;
477
+ }[];
455
478
  }
456
479
  interface EventFeature {
457
- id: string;
458
- title: string;
459
- enabled: boolean;
460
- order: number;
461
- widgetUri: string;
462
- iconName?: string;
463
- logoUri?: string;
464
- description: string;
465
- type: string;
466
- version?: string;
467
- key: string;
468
- meta?: any;
469
- data: any;
480
+ id: string;
481
+ title: string;
482
+ enabled: boolean;
483
+ order: number;
484
+ widgetUri: string;
485
+ iconName?: string;
486
+ logoUri?: string;
487
+ description: string;
488
+ type: string;
489
+ version?: string;
490
+ key: string;
491
+ meta?: any;
492
+ data: any;
470
493
  }
471
494
  interface Address {
472
- address_1: string;
473
- address_2?: string;
474
- city: string;
475
- country: string;
476
- premise?: string;
477
- formattedAddress?: string;
478
- localized_address_display?: string;
479
- localized_area_display?: string;
480
- localized_multi_line_address_display?: string[];
481
- postal_code: string;
482
- region: string;
495
+ address_1: string;
496
+ address_2?: string;
497
+ city: string;
498
+ country: string;
499
+ premise?: string;
500
+ formattedAddress?: string;
501
+ localized_address_display?: string;
502
+ localized_area_display?: string;
503
+ localized_multi_line_address_display?: string[];
504
+ postal_code: string;
505
+ region: string;
483
506
  }
484
507
  /**
485
508
  * A simple point geometry consisting of latitude and longitude.
@@ -495,8 +518,8 @@ interface Address {
495
518
  * }
496
519
  */
497
520
  interface GeometryPoint {
498
- lat: number;
499
- lng: number;
521
+ lat: number;
522
+ lng: number;
500
523
  }
501
524
  /**
502
525
  * Represents the geometry of a location, including optional viewport and zoom level.
@@ -527,15 +550,15 @@ interface GeometryPoint {
527
550
  * }
528
551
  */
529
552
  interface LocationGeometry extends GeometryPoint {
530
- zoom?: number;
531
- viewport?: {
532
- northeast: GeometryPoint;
533
- southwest: GeometryPoint;
534
- };
535
- vicinity?: string;
536
- region?: string;
537
- locality?: string;
538
- geoHash?: string;
553
+ zoom?: number;
554
+ viewport?: {
555
+ northeast: GeometryPoint;
556
+ southwest: GeometryPoint;
557
+ };
558
+ vicinity?: string;
559
+ region?: string;
560
+ locality?: string;
561
+ geoHash?: string;
539
562
  }
540
563
  /**
541
564
  * A structured representation of a physical location, including address and coordinates.
@@ -573,23 +596,38 @@ interface LocationGeometry extends GeometryPoint {
573
596
  * }
574
597
  */
575
598
  interface Location {
576
- venueId: string | null;
577
- placeId: string | null;
578
- name: string;
579
- geometry: LocationGeometry | null;
580
- address: Address | null;
581
- timezone?: string;
599
+ venueId: string | null;
600
+ placeId: string | null;
601
+ name: string;
602
+ geometry: LocationGeometry | null;
603
+ address: Address | null;
604
+ timezone?: string;
582
605
  }
583
606
  interface VenueBase {
584
- id: string;
585
- name: string;
586
- formattedAddress: string;
587
- placeId?: string | null;
588
- tz: string;
589
- logo: Photo | null;
590
- public: boolean;
591
- address: Address | null;
592
- slug: string | null;
607
+ id: string;
608
+ name: string;
609
+ formattedAddress: string;
610
+ placeId?: string | null;
611
+ tz: string;
612
+ logo: Photo | null;
613
+ public: boolean;
614
+ address: Address | null;
615
+ slug: string | null;
616
+ }
617
+ interface Venue extends VenueBase {
618
+ claimed: boolean;
619
+ refId?: string;
620
+ description?: MultipartText;
621
+ capacity?: number | null;
622
+ types: string[];
623
+ photos?: Photo[];
624
+ hoursOfOperation: string[];
625
+ phoneNumber?: string | null;
626
+ priceLevel: number | null;
627
+ rating: {
628
+ google: number | null;
629
+ };
630
+ [key: string]: any;
593
631
  }
594
632
  /**
595
633
  * @description Status of the event lifecycle.
@@ -603,80 +641,80 @@ interface VenueBase {
603
641
  * - `canceled`: The event was canceled and is no longer active.
604
642
  */
605
643
  type EventStatus = "archived" | "draft" | "live" | "started" | "ended" | "completed" | "canceled";
606
- interface EventBase {
607
- id: string;
608
- /**
609
- * @example "Spring Concert"
610
- * @faker name.firstName
611
- * @x-faker name.firstName
612
- */
613
- name: string;
614
- summary: string;
615
- companyId: string;
616
- /**
617
- * @description The timezone in which the event is taking place.
618
- * @example "America/New_York"
619
- * @example "Europe/London"
620
- * @example "Asia/Tokyo"
621
- */
622
- tz: string;
623
- /**
624
- * @description The start date and time of the event in ISO 8601 format.
625
- * @example "2023-10-01T12:00:00Z"
626
- */
627
- start: string;
628
- /**
629
- * @description The end date and time of the event in ISO 8601 format.
630
- * @example "2023-10-01T14:00:00Z"
631
- */
632
- end: string;
633
- isSeries?: boolean;
634
- /**
635
- * @description The status of the event in its lifecycle.
636
- * @example "draft"
637
- * @example "live"
638
- * @example "ended"
639
- */
640
- status: EventStatus;
641
- /**
642
- * @x-faker { url: faker.image.imageUrl() }
643
- */
644
- flyer?: Photo | null;
645
- venue?: VenueBase | null;
646
- /**
647
- * @description Curerncy used for the event.
648
- * @example "USD"
649
- */
650
- currency: string;
651
- /**
652
- * @description Is the event public?
653
- * @example true
654
- */
655
- public: boolean;
656
- location?: Location;
644
+ interface EventBase extends DataRecord {
645
+ /**
646
+ * @example "Spring Concert"
647
+ * @faker name.firstName
648
+ * @x-faker name.firstName
649
+ */
650
+ name: string;
651
+ summary: string;
652
+ companyId: string;
653
+ /**
654
+ * @description The timezone in which the event is taking place.
655
+ * @example "America/New_York"
656
+ * @example "Europe/London"
657
+ * @example "Asia/Tokyo"
658
+ */
659
+ tz: string;
660
+ /**
661
+ * @description The start date and time of the event in ISO 8601 format.
662
+ * @example "2023-10-01T12:00:00Z"
663
+ */
664
+ start: string;
665
+ /**
666
+ * @description The end date and time of the event in ISO 8601 format.
667
+ * @example "2023-10-01T14:00:00Z"
668
+ */
669
+ end: string;
670
+ isSeries?: boolean;
671
+ /**
672
+ * @description The status of the event in its lifecycle.
673
+ * @example "draft"
674
+ * @example "live"
675
+ * @example "ended"
676
+ */
677
+ status: EventStatus;
678
+ /**
679
+ * @x-faker { url: faker.image.imageUrl() }
680
+ */
681
+ flyer?: Photo | null;
682
+ venue?: VenueBase | null;
683
+ /**
684
+ * @description Curerncy used for the event.
685
+ * @example "USD"
686
+ */
687
+ currency: string;
688
+ /**
689
+ * @description Is the event public?
690
+ * @example true
691
+ */
692
+ public: boolean;
693
+ location?: Location;
694
+ organizerId: string;
657
695
  }
658
696
  /**
659
697
  * @openapi
660
698
  * @description EventProfile respresent a public view of an event
661
699
  */
662
700
  interface EventProfile extends EventBase {
663
- meta?: any;
664
- organizer: any;
665
- url?: string;
666
- slug: string;
667
- channels: string[];
668
- description: MultipartText;
669
- widgets: EventFeature[];
670
- ticketPrices: string[];
671
- buzzBuilder?: BuzzBuilder | null;
672
- venue?: VenueBase | null;
673
- tags: string[];
674
- searchTags: string[];
675
- sections: string[];
676
- priceRange?: {
677
- min?: string;
678
- max?: string;
679
- };
701
+ meta?: any;
702
+ organizer: any;
703
+ url?: string;
704
+ slug: string;
705
+ channels: string[];
706
+ description: MultipartText;
707
+ widgets: EventFeature[];
708
+ ticketPrices: string[];
709
+ buzzBuilder?: BuzzBuilder | null;
710
+ venue?: VenueBase | null;
711
+ tags: string[];
712
+ searchTags: string[];
713
+ sections: string[];
714
+ priceRange?: {
715
+ min?: string;
716
+ max?: string;
717
+ };
680
718
  }
681
719
  /**
682
720
  * Represents a discount coupon that can be applied to one or more offerings in an event platform.
@@ -684,152 +722,98 @@ interface EventProfile extends EventBase {
684
722
  * @export
685
723
  */
686
724
  interface Coupon extends VersionedDataRecord {
687
- /**
688
- * ID of the company that issued this coupon.
689
- * @example "company_123abc"
690
- */
691
- companyId: string;
692
- /**
693
- * Internal description for the coupon.
694
- * This is not necessarily visible to users.
695
- * @example "Early bird discount for spring events"
696
- */
697
- description: string;
698
- /**
699
- * The code used to redeem this coupon during checkout.
700
- * For public or coded discounts.
701
- * @example "SPRING2025"
702
- */
703
- code: string;
704
- /**
705
- * Type of coupon — determines how it's distributed or applied.
706
- * @example "coded"
707
- */
708
- type: "access" | "coded" | "public" | "hold";
709
- /**
710
- * Fixed amount to deduct from the order total.
711
- * This is a currency-less value that matches the event or order currency.
712
- * Example: `10.00` = $10.00 off.
713
- * @minimum 0
714
- * @maximum 99999
715
- * @example 10.0
716
- */
717
- amountOff: number;
718
- /**
719
- * Percentage to deduct from the item or order total.
720
- * Range is 0–100. Use 0 for no percentage-based discount.
721
- * @minimum 0
722
- * @maximum 100
723
- * @example 20.0
724
- */
725
- percentOff: number;
726
- /**
727
- * Total number of times this coupon can be used.
728
- * A value of `0` means unlimited usage.
729
- * @example 100
730
- */
731
- limit: number;
732
- /**
733
- * Number of times this coupon has been redeemed.
734
- * Read-only field.
735
- * @readonly
736
- * @example 42
737
- */
738
- quantitySold: number;
739
- /**
740
- * List of offering IDs (e.g., ticket classes) this coupon applies to.
741
- * If empty, the coupon applies to all eligible offerings in its context.
742
- * @example ["off_123abc", "off_456def"]
743
- */
744
- offeringIds: string[];
745
- /**
746
- * List of context IDs (e.g., event, venue, or organizer) this coupon is valid for.
747
- * Follows the format: "evt_xxx", "org_xxx", etc.
748
- * @example ["evt_abc123", "org_def456"]
749
- */
750
- contextIds: ContextId[];
751
- /**
752
- * Time-based constraints that control when the coupon is active and when it expires.
753
- * Supports absolute dates or relative time offsets (in seconds) from event start.
754
- *
755
- * - If `start` is omitted, the coupon is valid immediately.
756
- * - If `end` is omitted, the coupon remains valid until the event ends.
757
- *
758
- * @example {
759
- * start: { date: "2025-04-01T00:00:00" },
760
- * end: { secondsBefore: 3600 }
761
- * }
762
- */
763
- constraints: {
764
- start?: TimeOrOffset;
765
- end?: TimeOrOffset;
766
- };
767
- /**
768
- * Current status of the coupon for administrative purposes.
769
- * Determines whether it can be redeemed at checkout.
770
- * @example "active"
771
- */
772
- status: "active" | "expired" | "disabled" | "sold_out";
773
- /**
774
- * Schema version identifier.
775
- * Used to ensure compatibility between coupon formats.
776
- * @example "2025-01-10"
777
- */
778
- version: ApiVersion;
779
- }
780
- /**
781
- * Captures metadata and request/session context at the time the cart is created.
782
- * Supports fraud detection, attribution, analytics, and partner session tracking.
783
- *
784
- * This interface is extensible — additional custom fields may be included as needed.
785
- *
786
- * @export
787
- */
788
- interface OrderContext {
789
- /**
790
- * IP addresses associated with the user request.
791
- * Typically includes forwarded IPs and direct client IP.
792
- * @example ["203.0.113.1", "10.0.0.1"]
793
- */
794
- ipAddresses: string[];
795
- /**
796
- * Raw User-Agent header from the client request.
797
- * @example "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)..."
798
- */
799
- userAgent: string;
800
- /**
801
- * The referring URL from which the cart or checkout was initiated.
802
- * May be a partner site, marketing page, or event listing.
803
- * @example "https://partner.example.com/tickets/event123"
804
- */
805
- referrer: string;
806
- /**
807
- * Authenticated user ID, or null for anonymous guests.
808
- * @example "uid_456def"
809
- */
810
- uid: string | null;
811
- /**
812
- * The unique cart session ID assigned at the time the cart was created.
813
- * Helps track cart attribution across systems.
814
- * @example "cart_sess_abc123"
815
- */
816
- cartSessionId: string;
817
- /**
818
- * (Optional) Origin domain name if embedded or white-labeled.
819
- * Can help identify partner portals or iframe referrers.
820
- * @example "examplepartner.com"
821
- */
822
- originDomain?: string;
823
- /**
824
- * (Optional) Campaign ID, UTM source, or tracking label.
825
- * Useful for affiliate and analytics systems.
826
- * @example "utm_campaign=spring_launch"
827
- */
828
- trackingId?: string;
829
- /**
830
- * Allows custom fields for analytics, partners, or experiment data.
831
- */
832
- [custom: string]: unknown;
725
+ /**
726
+ * ID of the company that issued this coupon.
727
+ * @example "company_123abc"
728
+ */
729
+ companyId: string;
730
+ /**
731
+ * Internal description for the coupon.
732
+ * This is not necessarily visible to users.
733
+ * @example "Early bird discount for spring events"
734
+ */
735
+ description: string;
736
+ /**
737
+ * The code used to redeem this coupon during checkout.
738
+ * For public or coded discounts.
739
+ * @example "SPRING2025"
740
+ */
741
+ code: string;
742
+ /**
743
+ * Type of coupon — determines how it's distributed or applied.
744
+ * @example "coded"
745
+ */
746
+ type: "access" | "coded" | "public" | "hold";
747
+ /**
748
+ * Fixed amount to deduct from the order total.
749
+ * This is a currency-less value that matches the event or order currency.
750
+ * Example: `10.00` = $10.00 off.
751
+ * @minimum 0
752
+ * @maximum 99999
753
+ * @example 10.0
754
+ */
755
+ amountOff: number;
756
+ /**
757
+ * Percentage to deduct from the item or order total.
758
+ * Range is 0–100. Use 0 for no percentage-based discount.
759
+ * @minimum 0
760
+ * @maximum 100
761
+ * @example 20.0
762
+ */
763
+ percentOff: number;
764
+ /**
765
+ * Total number of times this coupon can be used.
766
+ * A value of `0` means unlimited usage.
767
+ * @example 100
768
+ */
769
+ limit: number;
770
+ /**
771
+ * Number of times this coupon has been redeemed.
772
+ * Read-only field.
773
+ * @readonly
774
+ * @example 42
775
+ */
776
+ quantitySold: number;
777
+ /**
778
+ * List of offering IDs (e.g., ticket classes) this coupon applies to.
779
+ * If empty, the coupon applies to all eligible offerings in its context.
780
+ * @example ["off_123abc", "off_456def"]
781
+ */
782
+ offeringIds: string[];
783
+ /**
784
+ * List of context IDs (e.g., event, venue, or organizer) this coupon is valid for.
785
+ * Follows the format: "evt_xxx", "org_xxx", etc.
786
+ * @example ["evt_abc123", "org_def456"]
787
+ */
788
+ contextIds: ContextId[];
789
+ /**
790
+ * Time-based constraints that control when the coupon is active and when it expires.
791
+ * Supports absolute dates or relative time offsets (in seconds) from event start.
792
+ *
793
+ * - If `start` is omitted, the coupon is valid immediately.
794
+ * - If `end` is omitted, the coupon remains valid until the event ends.
795
+ *
796
+ * @example {
797
+ * start: { date: "2025-04-01T00:00:00" },
798
+ * end: { secondsBefore: 3600 }
799
+ * }
800
+ */
801
+ constraints: {
802
+ start?: TimeOrOffset;
803
+ end?: TimeOrOffset;
804
+ };
805
+ /**
806
+ * Current status of the coupon for administrative purposes.
807
+ * Determines whether it can be redeemed at checkout.
808
+ * @example "active"
809
+ */
810
+ status: "active" | "expired" | "disabled" | "sold_out";
811
+ /**
812
+ * Schema version identifier.
813
+ * Used to ensure compatibility between coupon formats.
814
+ * @example "2025-01-10"
815
+ */
816
+ version: ApiVersion;
833
817
  }
834
818
  /**
835
819
  * Cost breakdown for a specific item in the order.
@@ -838,22 +822,22 @@ interface OrderContext {
838
822
  * @export
839
823
  */
840
824
  interface OrderItemCosts extends OfferingCosts {
841
- /**
842
- * Total cost of tickets before taxes, fees, and discounts.
843
- * @example { amount: 5000, currency: "USD" }
844
- */
845
- subtotal: CurrencyAmount;
846
- /**
847
- * Total discount amount applied to this item.
848
- * @example { amount: 1000, currency: "USD" }
849
- */
850
- discount: CurrencyAmount;
851
- /**
852
- * Total price before discounts.
853
- * Equal to subtotal + fee, before subtracting discount.
854
- * @example { amount: 6000, currency: "USD" }
855
- */
856
- preDiscount: CurrencyAmount;
825
+ /**
826
+ * Total cost of tickets before taxes, fees, and discounts.
827
+ * @example { amount: 5000, currency: "USD" }
828
+ */
829
+ subtotal: CurrencyAmount;
830
+ /**
831
+ * Total discount amount applied to this item.
832
+ * @example { amount: 1000, currency: "USD" }
833
+ */
834
+ discount: CurrencyAmount;
835
+ /**
836
+ * Total price before discounts.
837
+ * Equal to subtotal + fee, before subtracting discount.
838
+ * @example { amount: 6000, currency: "USD" }
839
+ */
840
+ preDiscount: CurrencyAmount;
857
841
  }
858
842
  /**
859
843
  * Represents an individual item within an order.
@@ -861,87 +845,126 @@ interface OrderItemCosts extends OfferingCosts {
861
845
  * @export
862
846
  */
863
847
  interface OrderItem {
864
- /**
865
- * Unique ID for this order item.
866
- * @example "item_abc123"
867
- */
868
- id: string;
869
- /**
870
- * Type of offering (e.g., ticket, package, merch).
871
- * @example "ticket"
872
- */
873
- offeringType: OfferingType;
874
- /**
875
- * ID of the offering purchased.
876
- * @example "evt_abc123_off_001"
877
- */
878
- offeringId: string;
879
- /**
880
- * Quantity purchased of this item.
881
- * @example 2
882
- */
883
- quantity: number;
884
- /**
885
- * Full cost breakdown for this item.
886
- */
887
- costs: OrderItemCosts;
888
- /**
889
- * If this item is included as part of a package, this is the ID of the parent item.
890
- * Otherwise, null.
891
- * @example null
892
- */
893
- includedWithItemId: string | null;
894
- /**
895
- * Breakdown of cost components (e.g., base, service fee, delivery).
896
- */
897
- costComponents: CalculatedCostComponent[];
898
- /**
899
- * Any relevant metadata associated with this item.
900
- * This can include custom fields or additional information.
901
- * @example { "customField": "value" }
902
- */
903
- meta: any;
904
- offering: OrderItemOffering;
848
+ /**
849
+ * Unique ID for this order item.
850
+ * @example "item_abc123"
851
+ */
852
+ id: string;
853
+ /**
854
+ * Type of offering (e.g., ticket, package, merch).
855
+ * @example "ticket"
856
+ */
857
+ offeringType: OfferingType;
858
+ /**
859
+ * ID of the offering purchased.
860
+ * @example "evt_abc123_off_001"
861
+ */
862
+ offeringId: string;
863
+ /**
864
+ * Quantity purchased of this item.
865
+ * @example 2
866
+ */
867
+ quantity: number;
868
+ /**
869
+ * Full cost breakdown for this item.
870
+ */
871
+ costs: OrderItemCosts;
872
+ /**
873
+ * If this item is included as part of a package, this is the ID of the parent item.
874
+ * Otherwise, null.
875
+ * @example null
876
+ */
877
+ includedWithItemId: string | null;
878
+ /**
879
+ * Breakdown of cost components (e.g., base, service fee, delivery).
880
+ */
881
+ costComponents: CalculatedCostComponent[];
882
+ /**
883
+ * Any relevant metadata associated with this item.
884
+ * This can include custom fields or additional information.
885
+ * @example { "customField": "value" }
886
+ */
887
+ meta: any;
888
+ offering: OrderItemOffering;
905
889
  }
906
890
  interface OrderItemOffering extends Pick<Offering, "name" | "costs" | "type"> {
907
- /**
908
- * doc assicated with this offering in the DB.
909
- *
910
- * @example "events/1234567890/tickets/0987654321"
911
- */
912
- docPath: string;
891
+ /**
892
+ * doc assicated with this offering in the DB.
893
+ *
894
+ * @example "events/1234567890/tickets/0987654321"
895
+ */
896
+ docPath: string;
913
897
  }
914
898
  /**
915
- * Person interface
899
+ * Represents the resolved context associated with a cart session.
900
+ * This may be an event, venue, or organizer, and is used to enrich the cart with metadata
901
+ * needed for UI rendering and pricing logic without requiring repeated DB lookups.
902
+ *
903
+ * Typically stored in `cart.meta.resolvedContext`.
904
+ *
905
+ * @export
916
906
  */
917
- interface Person {
918
- name: string;
919
- photoURL?: string | null;
920
- displayName: string;
921
- first: string;
922
- last: string;
923
- gender: null | string | "male" | "female" | "other";
924
- birthdate?: string | null;
925
- age?: number;
907
+ interface ResolvedCartContext {
908
+ /**
909
+ * Unique identifier of the context entity.
910
+ * Typically matches the cart's `contextId` (e.g., "evt_abc123").
911
+ * @example "evt_abc123"
912
+ */
913
+ id: string;
914
+ /**
915
+ * Human-readable title or name of the context entity.
916
+ * Used for display in headers, summaries, and confirmations.
917
+ * @example "Downtown Comedy Night"
918
+ */
919
+ title: string;
920
+ /**
921
+ * Optional physical or virtual location of the event or venue.
922
+ * Can include address, coordinates, or virtual link.
923
+ */
924
+ location?: Location;
925
+ /**
926
+ * Optional logo, banner, or primary image representing the context.
927
+ * Used in UI to visually identify the entity during checkout.
928
+ */
929
+ logo?: Photo;
930
+ /**
931
+ * Optional description or summary of the context entity.
932
+ * Provides additional information to the customer during checkout.
933
+ * @example "Join us for a night of laughter with top comedians!"
934
+ */
935
+ start: string;
936
+ /**
937
+ * Optional end date or time of the event or context entity.
938
+ * Useful for events with a specific duration or schedule.
939
+ * @example "2023-10-15T22:00:00Z"
940
+ */
941
+ end?: string;
942
+ /**
943
+ * A map of offerings relevant to this context (e.g., ticket types, merch).
944
+ * Stored as a record keyed by offering ID to allow fast lookup.
945
+ * Each value is a partial offering object, intended for display, validation, or pricing.
946
+ * @example {
947
+ * "off_123abc": { path: "events/ev_1234/tickets/tkt_567", offering: { name: "VIP Ticket", price: 3000 }),
948
+ * "off_456def": { path: "events/ev_1234/tickets/tkt_567", offering: { name: "T-Shirt", price: 2000 }}
949
+ * }
950
+ */
951
+ offerings?: Record<string, ResolvedCartContextOffering>;
926
952
  }
927
- interface PersonContact {
928
- email: string | null;
929
- phone: string | null;
953
+ interface ResolvedCartContextOffering {
954
+ path: string;
955
+ offering: Offering;
930
956
  }
931
- type Customer = Person & PersonContact & {
932
- uid: string | null;
933
- };
934
957
  type CouponSummary = Pick<Coupon, "id" | "code" | "amountOff" | "percentOff" | "offeringIds">;
935
958
  type OrderStatus = "placed" | "completed" | "attending" | "cancelled" | "refunded" | "started" | "pending" | "abandoned";
936
959
  interface OrderCosts {
937
- subtotal: CurrencyAmount;
938
- fee: CurrencyAmount;
939
- tax: CurrencyAmount;
940
- discount: CurrencyAmount;
941
- delivery: CurrencyAmount;
942
- gross: CurrencyAmount;
943
- preDiscount: CurrencyAmount;
944
- total: CurrencyAmount;
960
+ subtotal: CurrencyAmount;
961
+ fee: CurrencyAmount;
962
+ tax: CurrencyAmount;
963
+ discount: CurrencyAmount;
964
+ delivery: CurrencyAmount;
965
+ gross: CurrencyAmount;
966
+ preDiscount: CurrencyAmount;
967
+ total: CurrencyAmount;
945
968
  }
946
969
  /**
947
970
  * Represents an order in the system.
@@ -949,145 +972,178 @@ interface OrderCosts {
949
972
  * @export
950
973
  */
951
974
  interface Order extends VCDataRecord {
952
- /**
953
- * Human-readable order number for customer reference.
954
- * Often used in emails and receipts.
955
- * @example "GW-12345679"
956
- */
957
- orderNumber: string;
958
- /**
959
- * @description The currency code used for this order in ISO 4217 format.
960
- * @example "USD"
961
- *
962
- * @pattern ^[A-Z]{3}$
963
- */
964
- currency: string;
965
- /**
966
- * List of applied coupons used in the order.
967
- * Supports multiple entries based on organizer preferences.
968
- */
969
- coupons?: CouponSummary[];
970
- /**
971
- * Namespaced identifier indicating what the order is associated with.
972
- * Format: "{type}_{id}", where type is "evt", "ven", or "org".
973
- * @example "evt_56k2cf348"
974
- * @example "org_9912ff8"
975
- */
976
- contextId: ContextId;
977
- /**
978
- * Detailed cost breakdown for this order.
979
- */
980
- costs: OrderCosts;
981
- /**
982
- * Customer information related to this order.
983
- */
984
- customer: Customer;
985
- /**
986
- * The current status of the order.
987
- * @example "paid"
988
- */
989
- status: OrderStatus;
990
- /**
991
- * A list of individual items included in the order.
992
- */
993
- items: OrderItem[];
994
- /**
995
- * Agreement flags for terms and marketing opt-ins.
996
- */
997
- agreements: {
998
- /**
999
- * Whether the customer accepted the organizer’s custom terms.
1000
- * @example true
1001
- */
1002
- agreedToOrganizerTerms?: boolean;
1003
- /**
1004
- * Whether the customer accepted the platform-wide terms of service.
1005
- * @example true
1006
- */
1007
- agreedToTerms?: boolean;
1008
- /**
1009
- * Whether the customer opted in to receive marketing emails.
1010
- * @example false
1011
- */
1012
- emailOptIn?: boolean;
1013
- /**
1014
- * Whether the customer opted in to receive marketing SMS messages.
1015
- * @example false
1016
- */
1017
- textOptIn?: boolean;
1018
- };
1019
- /**
1020
- * Responses to dynamic questions during checkout (e.g. survey or registration).
1021
- * @example { "tshirtSize": "M", "vipNewsletter": true }
1022
- */
1023
- answers: {
1024
- [questionId: string]: string | boolean;
1025
- };
1026
- /**
1027
- * Freeform object containing metadata forwarded from the partner site
1028
- * or embedding context. Can include UTM tags, user traits, campaign IDs, etc.
1029
- * @example { utm_campaign: "spring_launch", partner: "venue_123" }
1030
- */
1031
- forwarded: any;
1032
- /**
1033
- * Internal or computed metadata associated with the order.
1034
- * May include fulfillment flags, debugging info, or derived calculations.
1035
- * @example { preview: true, manuallyAdjusted: true }
1036
- */
1037
- meta: any;
1038
- /**
1039
- * Session and request context captured at the time of order creation.
1040
- * Includes IPs, referrer, user agent, cart session ID, and tracking info.
1041
- */
1042
- context: OrderContext;
1043
- version: ApiVersion;
1044
- }
1045
- /**
1046
- * Represents the resolved context associated with a cart session.
1047
- * This may be an event, venue, or organizer, and is used to enrich the cart with metadata
1048
- * needed for UI rendering and pricing logic without requiring repeated DB lookups.
1049
- *
1050
- * Typically stored in `cart.meta.resolvedContext`.
1051
- *
1052
- * @export
1053
- */
1054
- interface ResolvedCartContext {
1055
- /**
1056
- * Unique identifier of the context entity.
1057
- * Typically matches the cart's `contextId` (e.g., "evt_abc123").
1058
- * @example "evt_abc123"
1059
- */
1060
- id: string;
1061
- /**
1062
- * Human-readable title or name of the context entity.
1063
- * Used for display in headers, summaries, and confirmations.
1064
- * @example "Downtown Comedy Night"
1065
- */
1066
- title: string;
1067
- /**
1068
- * Optional physical or virtual location of the event or venue.
1069
- * Can include address, coordinates, or virtual link.
1070
- */
1071
- location?: Location;
1072
- /**
1073
- * Optional logo, banner, or primary image representing the context.
1074
- * Used in UI to visually identify the entity during checkout.
1075
- */
1076
- logo?: Photo;
1077
- /**
1078
- * A map of offerings relevant to this context (e.g., ticket types, merch).
1079
- * Stored as a record keyed by offering ID to allow fast lookup.
1080
- * Each value is a partial offering object, intended for display, validation, or pricing.
1081
- * @example {
1082
- * "off_123abc": { path: "events/ev_1234/tickets/tkt_567", offering: { name: "VIP Ticket", price: 3000 }),
1083
- * "off_456def": { path: "events/ev_1234/tickets/tkt_567", offering: { name: "T-Shirt", price: 2000 }}
1084
- * }
1085
- */
1086
- offerings?: Record<string, ResolvedCartContextOffering>;
975
+ /**
976
+ * Human-readable order number for customer reference.
977
+ * Often used in emails and receipts.
978
+ * @example "GW-12345679"
979
+ */
980
+ orderNumber: string;
981
+ /**
982
+ * @description The currency code used for this order in ISO 4217 format.
983
+ * @example "USD"
984
+ *
985
+ * @pattern ^[A-Z]{3}$
986
+ */
987
+ currency: string;
988
+ /**
989
+ * List of applied coupons used in the order.
990
+ * Supports multiple entries based on organizer preferences.
991
+ */
992
+ coupons?: CouponSummary[];
993
+ organizerId: string;
994
+ /**
995
+ * Namespaced identifier indicating what the order is associated with.
996
+ * Format: "{type}_{id}", where type is "evt", "ven", or "org".
997
+ * @example "evt_56k2cf348"
998
+ * @example "org_9912ff8"
999
+ */
1000
+ contextId: ContextId;
1001
+ /**
1002
+ * Detailed cost breakdown for this order.
1003
+ */
1004
+ costs: OrderCosts;
1005
+ /**
1006
+ * Customer information related to this order.
1007
+ */
1008
+ customer: Customer;
1009
+ /**
1010
+ * The current status of the order.
1011
+ * @example "paid"
1012
+ */
1013
+ status: OrderStatus;
1014
+ /**
1015
+ * A list of individual items included in the order.
1016
+ */
1017
+ items: OrderItem[];
1018
+ /**
1019
+ * Agreement flags for terms and marketing opt-ins.
1020
+ */
1021
+ agreements: {
1022
+ /**
1023
+ * Whether the customer accepted the organizer’s custom terms.
1024
+ * @example true
1025
+ */
1026
+ agreedToOrganizerTerms?: boolean;
1027
+ /**
1028
+ * Whether the customer accepted the platform-wide terms of service.
1029
+ * @example true
1030
+ */
1031
+ agreedToTerms?: boolean;
1032
+ /**
1033
+ * Whether the customer opted in to receive marketing emails.
1034
+ * @example false
1035
+ */
1036
+ emailOptIn?: boolean;
1037
+ /**
1038
+ * Whether the customer opted in to receive marketing SMS messages.
1039
+ * @example false
1040
+ */
1041
+ textOptIn?: boolean;
1042
+ };
1043
+ /**
1044
+ * Responses to dynamic questions during checkout (e.g. survey or registration).
1045
+ * @example { "tshirtSize": "M", "vipNewsletter": true }
1046
+ */
1047
+ answers: {
1048
+ [questionId: string]: string | boolean;
1049
+ };
1050
+ /**
1051
+ * Freeform object containing metadata forwarded from the partner site
1052
+ * or embedding context. Can include UTM tags, user traits, campaign IDs, etc.
1053
+ * @example { utm_campaign: "spring_launch", partner: "venue_123" }
1054
+ */
1055
+ forwarded: any;
1056
+ /**
1057
+ * Internal or computed metadata associated with the order.
1058
+ * May include fulfillment flags, debugging info, or derived calculations.
1059
+ * @example { preview: true, manuallyAdjusted: true }
1060
+ */
1061
+ meta: {
1062
+ /**
1063
+ * Display context (event, venue, organizer) for rendering and logic.
1064
+ */
1065
+ resolvedContext?: ResolvedCartContext;
1066
+ /**
1067
+ * Cost components to calculate the cart costs.
1068
+ *
1069
+ * @ignore
1070
+ */
1071
+ costComponents?: CostComponent[];
1072
+ /**
1073
+ * Snapshot of when pricing was calculated and locked.
1074
+ * Useful for honoring totals during a grace window.
1075
+ */
1076
+ priceLock?: {
1077
+ lockedAt: string;
1078
+ ttl?: number;
1079
+ };
1080
+ /**
1081
+ * Any additional internal system flags, A/B test conditions, or
1082
+ * non-critical partner payloads.
1083
+ */
1084
+ [key: string]: any;
1085
+ };
1086
+ /**
1087
+ * Session and request context captured at the time of order creation.
1088
+ * Includes IPs, referrer, user agent, cart session ID, and tracking info.
1089
+ */
1090
+ context: OrderContext;
1091
+ version: ApiVersion;
1087
1092
  }
1088
- interface ResolvedCartContextOffering {
1089
- path: string;
1090
- offering: Offering;
1093
+ type OrderContext = {
1094
+ type: "event";
1095
+ event: EventProfile;
1096
+ venue?: Venue;
1097
+ } | {
1098
+ type: "venue";
1099
+ event?: EventProfile;
1100
+ venue: Venue;
1101
+ };
1102
+ interface OrderContext$1 {
1103
+ /**
1104
+ * IP addresses associated with the user request.
1105
+ * Typically includes forwarded IPs and direct client IP.
1106
+ * @example ["203.0.113.1", "10.0.0.1"]
1107
+ */
1108
+ ipAddresses: string[];
1109
+ /**
1110
+ * Raw User-Agent header from the client request.
1111
+ * @example "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)..."
1112
+ */
1113
+ userAgent: string;
1114
+ /**
1115
+ * The referring URL from which the cart or checkout was initiated.
1116
+ * May be a partner site, marketing page, or event listing.
1117
+ * @example "https://partner.example.com/tickets/event123"
1118
+ */
1119
+ referrer: string;
1120
+ /**
1121
+ * Authenticated user ID, or null for anonymous guests.
1122
+ * @example "uid_456def"
1123
+ */
1124
+ uid: string | null;
1125
+ /**
1126
+ * The unique cart session ID assigned at the time the cart was created.
1127
+ * Helps track cart attribution across systems.
1128
+ * @example "cart_sess_abc123"
1129
+ */
1130
+ cartSessionId: string;
1131
+ /**
1132
+ * (Optional) Origin domain name if embedded or white-labeled.
1133
+ * Can help identify partner portals or iframe referrers.
1134
+ * @example "examplepartner.com"
1135
+ */
1136
+ originDomain?: string;
1137
+ /**
1138
+ * (Optional) Campaign ID, UTM source, or tracking label.
1139
+ * Useful for affiliate and analytics systems.
1140
+ * @example "utm_campaign=spring_launch"
1141
+ */
1142
+ trackingId?: string;
1143
+ /**
1144
+ * Allows custom fields for analytics, partners, or experiment data.
1145
+ */
1146
+ [custom: string]: unknown;
1091
1147
  }
1092
1148
  /**
1093
1149
  * Represents a temporary or persisted cart before order placement.
@@ -1095,87 +1151,118 @@ interface ResolvedCartContextOffering {
1095
1151
  *
1096
1152
  * @export
1097
1153
  */
1098
- interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" | "version" | "coupons"> {
1099
- /**
1100
- * Authenticated user ID, if available.
1101
- * @example "uid_123abc"
1102
- */
1103
- uid: string | null;
1104
- /**
1105
- * Optional snapshot of customer info entered during cart fill.
1106
- * Not required and not final.
1107
- *
1108
- * @schema lazy(() => customerSchema).optional()
1109
- */
1110
- customer?: Partial<Customer>;
1111
- /**
1112
- * @schema lazy(() => orderContextSchema).optional()
1113
- */
1114
- context: Partial<OrderContext>;
1115
- /**
1116
- * Items the user has added to their cart.
1117
- */
1118
- items: Partial<OrderItem>[];
1119
- /**
1120
- * Estimated totals based on current cart state.
1121
- * These values are subject to recalculation before checkout.
1122
- */
1123
- costs?: {
1124
- subtotal: CurrencyAmount;
1125
- discount: CurrencyAmount;
1126
- tax: CurrencyAmount;
1127
- fee: CurrencyAmount;
1128
- delivery: CurrencyAmount;
1129
- total: CurrencyAmount;
1130
- };
1131
- /**
1132
- * Stripe PaymentIntent ID linked to this cart, if created.
1133
- * Used for confirming payment on the backend.
1134
- * @example "pi_1ABCXYZ..."
1135
- */
1136
- paymentIntentId?: string;
1137
- /**
1138
- * Stripe PaymentIntent client secret, used by frontend (e.g. Stripe.js).
1139
- * Required for completing the payment flow.
1140
- * @example "pi_1ABCXYZ..._secret_456"
1141
- */
1142
- paymentIntentClientSecret?: string;
1143
- /**
1144
- * Partner-forwarded data (e.g. utm, session metadata).
1145
- */
1146
- forwarded?: any;
1147
- /**
1148
- * Internal metadata, flags, debug hints, or experimental context.
1149
- */
1150
- meta: {
1151
- /**
1152
- * Display context (event, venue, organizer) for rendering and logic.
1153
- */
1154
- resolvedContext?: ResolvedCartContext;
1155
- /**
1156
- * Cost components to calculate the cart costs.
1157
- *
1158
- * @ignore
1159
- */
1160
- costComponents?: CostComponent[];
1161
- /**
1162
- * Snapshot of when pricing was calculated and locked.
1163
- * Useful for honoring totals during a grace window.
1164
- */
1165
- priceLock?: {
1166
- lockedAt: string;
1167
- ttl?: number;
1168
- };
1169
- /**
1170
- * Any additional internal system flags, A/B test conditions, or
1171
- * non-critical partner payloads.
1172
- */
1173
- [key: string]: any;
1174
- };
1175
- status: "started" | "completed" | "abandoned" | "cancelled";
1154
+ interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" | "version" | "coupons" | "companyId" | "organizerId" | "meta"> {
1155
+ orderId?: string;
1156
+ /**
1157
+ * Authenticated user ID, if available.
1158
+ * @example "uid_123abc"
1159
+ */
1160
+ uid: string | null;
1161
+ /**
1162
+ * Optional snapshot of customer info entered during cart fill.
1163
+ * Not required and not final.
1164
+ *
1165
+ * @schema lazy(() => customerSchema).optional()
1166
+ */
1167
+ customer?: Partial<Customer>;
1168
+ /**
1169
+ * @schema lazy(() => orderContextSchema).optional()
1170
+ */
1171
+ context: Partial<OrderContext$1>;
1172
+ /**
1173
+ * Items the user has added to their cart.
1174
+ */
1175
+ items: Partial<OrderItem>[];
1176
+ /**
1177
+ * Estimated totals based on current cart state.
1178
+ * These values are subject to recalculation before checkout.
1179
+ */
1180
+ costs?: {
1181
+ subtotal: CurrencyAmount;
1182
+ discount: CurrencyAmount;
1183
+ tax: CurrencyAmount;
1184
+ fee: CurrencyAmount;
1185
+ delivery: CurrencyAmount;
1186
+ total: CurrencyAmount;
1187
+ };
1188
+ paymentStatus: "pending" | "confirmed" | "failed" | "refunded";
1189
+ /**
1190
+ * Stripe PaymentIntent ID linked to this cart, if created.
1191
+ * Used for confirming payment on the backend.
1192
+ * @example "pi_1ABCXYZ..."
1193
+ */
1194
+ paymentIntentId?: string;
1195
+ /**
1196
+ * Stripe PaymentIntent client secret, used by frontend (e.g. Stripe.js).
1197
+ * Required for completing the payment flow.
1198
+ * @example "pi_1ABCXYZ..._secret_456"
1199
+ */
1200
+ paymentIntentClientSecret?: string;
1201
+ /**
1202
+ * Partner-forwarded data (e.g. utm, session metadata).
1203
+ */
1204
+ forwarded?: any;
1205
+ status: "started" | "completed" | "abandoned" | "cancelled";
1176
1206
  }
1177
1207
  type UpdatableCartSession = Pick<CartSession, "customer" | "items">;
1178
1208
 
1209
+ /**
1210
+ * Pagination parameters for a paginated API request.
1211
+ */
1212
+ interface Pagination {
1213
+ /** Number of results per page. */
1214
+ size: number;
1215
+ /** Page number (starting from 1). */
1216
+ page: number;
1217
+ /** Continuation */
1218
+ continuation?: string;
1219
+ }
1220
+
1221
+ /**
1222
+ * Supported HTTP methods.
1223
+ */
1224
+ type RequestMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
1225
+ type RequestOptions = {
1226
+ method?: RequestMethod;
1227
+ data?: any;
1228
+ query?: Record<string, string | number | boolean | undefined>;
1229
+ headers?: Record<string, string>;
1230
+ pagination?: Pagination;
1231
+ };
1232
+ /**
1233
+ * A function that performs a request to the Cohost API.
1234
+ * The generic <T> allows you to specify the expected response type.
1235
+ */
1236
+ type RequestFn = <T = any>(path: string, options?: RequestOptions) => Promise<T>;
1237
+
1238
+ /**
1239
+ * Optional settings for customizing the behavior of the CohostClient.
1240
+ */
1241
+ interface CohostClientSettings {
1242
+ /** Enable verbose debug output for all API requests. */
1243
+ debug?: boolean;
1244
+ /** Override the default API base URL (defaults to apiBaseUrl). */
1245
+ apiUrl?: string;
1246
+ }
1247
+
1248
+ /**
1249
+ * Base class for all API endpoint groups within the Cohost SDK.
1250
+ * Provides shared access to the configured request function and settings.
1251
+ */
1252
+ declare class CohostEndpoint {
1253
+ /** Shared request function injected from the client */
1254
+ protected request: RequestFn;
1255
+ /** Client settings passed during instantiation */
1256
+ protected settings: CohostClientSettings;
1257
+ /**
1258
+ * Constructs a new endpoint group.
1259
+ *
1260
+ * @param request - The shared request function for performing API calls
1261
+ * @param settings - The client-wide settings passed from the parent client
1262
+ */
1263
+ constructor(request: RequestFn, settings: CohostClientSettings);
1264
+ }
1265
+
1179
1266
  /**
1180
1267
  * Provides methods to interact with the Cohost Events API.
1181
1268
  *
@@ -1213,6 +1300,15 @@ declare class EventsAPI extends CohostEndpoint {
1213
1300
  * @throws Will throw an error if the request fails or the event does not exist
1214
1301
  */
1215
1302
  tickets(id: string): Promise<Ticket[]>;
1303
+ /**
1304
+ * List attendees in the event.
1305
+ *
1306
+ * Requires: valid authentication token. This endpoint is not public.
1307
+ *
1308
+ * @param id - The ID of the event.
1309
+ * @returns List of tickets (attendees) for the event.
1310
+ */
1311
+ attendees(id: string, filters?: PaginatedRequest<any>): Promise<PaginatedResponse<Attendee3>>;
1216
1312
  }
1217
1313
 
1218
1314
  /**
@@ -1280,7 +1376,7 @@ declare class SessionsAPI extends CohostEndpoint {
1280
1376
  *
1281
1377
  * @throws Will throw an error if the update fails
1282
1378
  */
1283
- update(id: string, input: UpdatableCartSession): Promise<CartSession>;
1379
+ update(id: string, input: Partial<UpdatableCartSession>): Promise<CartSession>;
1284
1380
  /**
1285
1381
  * Cancel (soft delete) a cart session.
1286
1382
  *
@@ -1302,6 +1398,21 @@ declare class SessionsAPI extends CohostEndpoint {
1302
1398
  offeringId: string;
1303
1399
  quantity: number;
1304
1400
  }): Promise<CartSession>;
1401
+ /**
1402
+ * Pre-validate and prepare the cart session for checkout.
1403
+ * @param sessionId
1404
+ */
1405
+ preValidate(sessionId: string, data: any): Promise<CartSession>;
1406
+ /**
1407
+ * Close the cart session, and place the order.
1408
+ *
1409
+ * @param sessionId - The ID of the session
1410
+ * @param data - Data to place the order
1411
+ * @returns {CartSession} The latest cart session
1412
+ *
1413
+ * @throws Will throw an error if the order placement fails
1414
+ */
1415
+ placeOrder(sessionId: string, data: any): Promise<CartSession>;
1305
1416
  /**
1306
1417
  * Remove an item from the cart session.
1307
1418
  * The same as setting the quantity to 0.