@cohostvip/cohost-node 0.0.5 → 0.0.9

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