@cohostvip/cohost-node 0.0.3 → 0.0.5

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
@@ -71,89 +71,402 @@ declare enum CostBucket {
71
71
  TAX = "tax"
72
72
  }
73
73
 
74
- type CostComponentCap = {
75
- op: string;
76
- type: CostComponentCap.type;
74
+ type CalculatedCostComponent = {
75
+ base: string;
76
+ bucket: CostBucket;
77
77
  /**
78
- * The value of the cap. If type is percentage, it is a percentage of the base value.
79
- * If type is absolute, it is an absolute value.
80
- *
81
- * Absolute value is represented in the same denomination as the cost.
82
- * i.e. if the cost is in cents, the absolute value should be in cents.
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).
83
81
  *
84
- * percentage value is represented as a decimal.
85
- * For example, 10% is represented as 0.1.
82
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
86
83
  */
84
+ cost: string;
85
+ discount: null;
86
+ id: string;
87
+ name: string;
88
+ payer: CalculatedCostComponent.payer;
89
+ recipient: string;
87
90
  value: number;
91
+ version: string;
88
92
  };
89
- declare namespace CostComponentCap {
90
- enum type {
91
- ABSOLUTE = "absolute",
92
- PERCENTAGE = "percentage"
93
+ declare namespace CalculatedCostComponent {
94
+ enum payer {
95
+ ATTENDEE = "attendee",
96
+ ORGANIZER = "organizer"
93
97
  }
94
98
  }
95
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;
112
+ /**
113
+ * Unique identifier for the record.
114
+ */
115
+ id: string;
116
+ /**
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.
119
+ */
120
+ offeringIds: Array<string>;
121
+ /**
122
+ * Percentage to deduct from the item or order total.
123
+ * Range is 0–100. Use 0 for no percentage-based discount.
124
+ */
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_ = {
143
+ /**
144
+ * The unique cart session ID assigned at the time the cart was created.
145
+ * Helps track cart attribution across systems.
146
+ */
147
+ cartSessionId?: string;
148
+ /**
149
+ * IP addresses associated with the user request.
150
+ * Typically includes forwarded IPs and direct client IP.
151
+ */
152
+ ipAddresses?: Array<string>;
153
+ /**
154
+ * (Optional) Origin domain name if embedded or white-labeled.
155
+ * Can help identify partner portals or iframe referrers.
156
+ */
157
+ originDomain?: string;
158
+ /**
159
+ * The referring URL from which the cart or checkout was initiated.
160
+ * May be a partner site, marketing page, or event listing.
161
+ */
162
+ referrer?: string;
163
+ /**
164
+ * (Optional) Campaign ID, UTM source, or tracking label.
165
+ * Useful for affiliate and analytics systems.
166
+ */
167
+ trackingId?: string;
168
+ /**
169
+ * Authenticated user ID, or null for anonymous guests.
170
+ */
171
+ uid?: string;
172
+ /**
173
+ * Raw User-Agent header from the client request.
174
+ */
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"
191
+ }
192
+
96
193
  /**
97
- * A set of comparison operators used for evaluating conditional expressions.
98
- *
99
- * Supported operators:
100
- * - '==' (equal to)
101
- * - '!=' (not equal to)
102
- * - '<' (less than)
103
- * - '<=' (less than or equal to)
104
- * - '>' (greater than)
105
- * - '>=' (greater than or equal to)
194
+ * Cost breakdown for a specific item in the order.
195
+ * Extends the standard `OfferingCosts` with totals calculated for quantity and discounts.
106
196
  */
107
- declare enum EqualOperator {
108
- _ = "!="
109
- }
197
+ type OrderItemCosts = {
198
+ /**
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).
202
+ *
203
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
204
+ */
205
+ cost: string;
206
+ /**
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).
210
+ *
211
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
212
+ */
213
+ delivery: string;
214
+ /**
215
+ * Total discount amount applied to this item.
216
+ */
217
+ discount: string;
218
+ /**
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
+ *
223
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
224
+ */
225
+ fee: string;
226
+ /**
227
+ * cost + fee - discount , not including tax
228
+ */
229
+ gross: string;
230
+ /**
231
+ * Total price before discounts.
232
+ * Equal to subtotal + fee, before subtracting discount.
233
+ */
234
+ preDiscount: string;
235
+ /**
236
+ * Total cost of tickets before taxes, fees, and discounts.
237
+ */
238
+ subtotal: string;
239
+ /**
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).
243
+ *
244
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
245
+ */
246
+ tax: string;
247
+ /**
248
+ * total cost including tax
249
+ */
250
+ total: string;
251
+ };
110
252
 
111
- type CostComponentRuleCondition = {
253
+ /**
254
+ * Represents the costs associated with an offering.
255
+ */
256
+ type OfferingCosts = {
257
+ /**
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).
261
+ *
262
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
263
+ */
264
+ cost: string;
265
+ /**
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).
269
+ *
270
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
271
+ */
272
+ delivery: string;
112
273
  /**
113
- * evaluator, will define a function or endpoint to evaluate the condition.
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).
277
+ *
278
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
114
279
  */
115
- eval?: string;
280
+ fee: string;
116
281
  /**
117
- * The field to evaluate the condition against.
118
- * For example, "item.price" or "order.total".
119
- * The field should be a valid path to the field in the cost component base.
282
+ * cost + fee - discount , not including tax
283
+ */
284
+ gross: string;
285
+ /**
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).
289
+ *
290
+ * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
120
291
  */
121
- field: string;
122
- operator: EqualOperator;
292
+ tax: string;
123
293
  /**
124
- * Can be a value such as number, currencyAmount, an ISO date string, etc...
294
+ * total cost including tax
125
295
  */
126
- value: any;
296
+ total: string;
127
297
  };
128
298
 
129
- type CostComponentRule = {
299
+ type OrderItemOffering = {
300
+ costs: OfferingCosts;
130
301
  /**
131
- * The rule will be applied to the cost component if the conditions are met.
302
+ * doc assicated with this offering in the DB.
132
303
  */
133
- conditions: Array<CostComponentRuleCondition>;
304
+ docPath: string;
134
305
  /**
135
- * Friendly name of the rule.
306
+ * Offering name, can be ticket name, vaucher name, etc...
136
307
  */
137
308
  name: string;
309
+ type: OfferingType;
138
310
  };
139
311
 
140
- type CostComponent = {
141
- base: string;
142
- bucket: CostBucket;
143
- cap?: CostComponentCap;
144
- currency: string;
145
- details?: any;
312
+ type Partial_OrderItem_ = {
313
+ /**
314
+ * Breakdown of cost components (e.g., base, service fee, delivery).
315
+ */
316
+ costComponents?: Array<CalculatedCostComponent>;
317
+ costs?: OrderItemCosts;
318
+ /**
319
+ * Unique ID for this order item.
320
+ */
146
321
  id?: string;
147
- name: string;
148
- payer: CostComponent.payer;
149
- recipient: string;
150
- rules: Array<CostComponentRule>;
322
+ /**
323
+ * If this item is included as part of a package, this is the ID of the parent item.
324
+ * Otherwise, null.
325
+ */
326
+ includedWithItemId?: string;
327
+ /**
328
+ * Any relevant metadata associated with this item.
329
+ * This can include custom fields or additional information.
330
+ */
331
+ meta?: any;
332
+ offering?: OrderItemOffering;
333
+ /**
334
+ * ID of the offering purchased.
335
+ */
336
+ offeringId?: string;
337
+ offeringType?: OfferingType;
338
+ /**
339
+ * Quantity purchased of this item.
340
+ */
341
+ quantity?: number;
342
+ };
343
+
344
+ /**
345
+ * Represents a temporary or persisted cart before order placement.
346
+ * Focuses on user intent and checkout prep, not post-purchase records.
347
+ */
348
+ type CartSession = {
349
+ /**
350
+ * ISO 8601 timestamp indicating when the record was last updated, if applicable.
351
+ */
352
+ changed?: string;
353
+ context: Partial_OrderContext_;
354
+ /**
355
+ * Namespaced identifier indicating what the order is associated with.
356
+ * Format: "{type}_{id}", where type is "evt", "ven", or "org".
357
+ */
358
+ contextId: string;
359
+ /**
360
+ * Estimated totals based on current cart state.
361
+ * These values are subject to recalculation before checkout.
362
+ */
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;
412
+ };
413
+ /**
414
+ * List of applied coupons used in the order.
415
+ * Supports multiple entries based on organizer preferences.
416
+ */
417
+ coupons?: Array<CouponSummary>;
418
+ /**
419
+ * ISO 8601 timestamp indicating when the record was created.
420
+ */
421
+ created: string;
422
+ /**
423
+ * The currency code used for this order in ISO 4217 format.
424
+ */
425
+ currency: string;
426
+ customer?: Partial_Customer_;
427
+ /**
428
+ * Partner-forwarded data (e.g. utm, session metadata).
429
+ */
430
+ forwarded?: any;
431
+ /**
432
+ * Unique identifier for the record.
433
+ */
434
+ id: string;
435
+ /**
436
+ * Items the user has added to their cart.
437
+ */
438
+ items: Array<Partial_OrderItem_>;
439
+ /**
440
+ * Internal metadata, flags, debug hints, or experimental context.
441
+ */
442
+ meta: Record<string, any>;
443
+ /**
444
+ * Stripe PaymentIntent client secret, used by frontend (e.g. Stripe.js).
445
+ * Required for completing the payment flow.
446
+ */
447
+ paymentIntentClientSecret?: string;
448
+ /**
449
+ * Stripe PaymentIntent ID linked to this cart, if created.
450
+ * Used for confirming payment on the backend.
451
+ */
452
+ paymentIntentId?: string;
453
+ status: CartSession.status;
454
+ /**
455
+ * Authenticated user ID, if available.
456
+ */
457
+ uid: string;
458
+ /**
459
+ * Schema version identifier for this record.
460
+ * Helps manage compatibility across client-server contracts.
461
+ */
151
462
  version: string;
152
463
  };
153
- declare namespace CostComponent {
154
- enum payer {
155
- ATTENDEE = "attendee",
156
- ORGANIZER = "organizer"
464
+ declare namespace CartSession {
465
+ enum status {
466
+ ABANDONED = "abandoned",
467
+ CANCELLED = "cancelled",
468
+ COMPLETED = "completed",
469
+ STARTED = "started"
157
470
  }
158
471
  }
159
472
 
@@ -338,52 +651,6 @@ type EventProfile = {
338
651
  widgets: Array<EventFeature>;
339
652
  };
340
653
 
341
- /**
342
- * Represents the costs associated with an offering.
343
- */
344
- type OfferingCosts = {
345
- /**
346
- * A string representing a currency amount in the format `"USD,1000"` where:
347
- * - `"USD"` is the 3-letter ISO currency code.
348
- * - The number after the comma represents the value in **minor units** (e.g., cents for USD).
349
- *
350
- * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
351
- */
352
- cost: string;
353
- /**
354
- * A string representing a currency amount in the format `"USD,1000"` where:
355
- * - `"USD"` is the 3-letter ISO currency code.
356
- * - The number after the comma represents the value in **minor units** (e.g., cents for USD).
357
- *
358
- * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
359
- */
360
- delivery: string;
361
- /**
362
- * A string representing a currency amount in the format `"USD,1000"` where:
363
- * - `"USD"` is the 3-letter ISO currency code.
364
- * - The number after the comma represents the value in **minor units** (e.g., cents for USD).
365
- *
366
- * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
367
- */
368
- fee: string;
369
- /**
370
- * cost + fee - discount , not including tax
371
- */
372
- gross: string;
373
- /**
374
- * A string representing a currency amount in the format `"USD,1000"` where:
375
- * - `"USD"` is the 3-letter ISO currency code.
376
- * - The number after the comma represents the value in **minor units** (e.g., cents for USD).
377
- *
378
- * For example, `"USD,1000"` equals $10.00 (i.e., 1000 cents).
379
- */
380
- tax: string;
381
- /**
382
- * total cost including tax
383
- */
384
- total: string;
385
- };
386
-
387
654
  declare enum OfferingStatus {
388
655
  DELETED = "deleted",
389
656
  DRAFT = "draft",
@@ -393,21 +660,6 @@ declare enum OfferingStatus {
393
660
  UNAVAILABLE = "unavailable"
394
661
  }
395
662
 
396
- declare enum OfferingType {
397
- ADMISSION = "admission",
398
- DONATION = "donation",
399
- DRINK = "drink",
400
- MEMBERSHIP = "membership",
401
- MERCH = "merch",
402
- OTHER = "other",
403
- PACKAGE = "package",
404
- SERVICE = "service",
405
- SKIP = "skip",
406
- TC_TICKET = "tc-ticket",
407
- TICKET = "ticket",
408
- VOUCHER = "voucher"
409
- }
410
-
411
663
  type PackageInclude = {
412
664
  description: string;
413
665
  id: string;
@@ -423,49 +675,39 @@ declare enum PriceCategory {
423
675
  PAID = "paid"
424
676
  }
425
677
 
426
- /**
427
- * A repeating or structured date schedule for an event or item.
428
- */
429
- type Schedule = {
430
- /**
431
- * Days of the week (0 = Sunday, 6 = Saturday).
432
- */
433
- daysOfWeek?: Array<number>;
434
- /**
435
- * ISO-formatted UTC end datetime.
436
- */
437
- end: string;
438
- /**
439
- * Specific dates to exclude in "YYYY-MM-DD" format.
440
- */
441
- excludeDates?: Array<string>;
442
- /**
443
- * Specific dates to include in "YYYY-MM-DD" format.
444
- */
445
- includeDates?: Array<string>;
678
+ type Ticket = {
446
679
  /**
447
- * ISO-formatted UTC start datetime.
680
+ * The maximum number of tickets that can be sold for this offering.
448
681
  */
449
- start: string;
450
- };
451
-
452
- type Ticket = {
453
682
  capacity: number;
454
683
  category: string;
455
- changed?: string;
456
684
  /**
457
- * Describe fees and other costs associated with purchasing tickets
458
- * to this offering
685
+ * ISO 8601 timestamp indicating when the record was last updated, if applicable.
459
686
  */
460
- costComponents?: Array<CostComponent>;
687
+ changed?: string;
461
688
  costs: OfferingCosts;
689
+ /**
690
+ * ISO 8601 timestamp indicating when the record was created.
691
+ */
462
692
  created: string;
463
693
  description?: string;
464
694
  display_name?: string;
695
+ /**
696
+ * Unique identifier for the record.
697
+ */
465
698
  id: string;
699
+ /**
700
+ * Items, products ,and vouchers included in this offering.
701
+ */
466
702
  included?: Array<PackageInclude>;
467
703
  instructions?: string;
704
+ /**
705
+ * Maximum number of tickets that can be purchased in a single order.
706
+ */
468
707
  maximumQuantity: number;
708
+ /**
709
+ * Minimum number of tickets that can be purchased in a single order.
710
+ */
469
711
  minimumQuantity: number;
470
712
  /**
471
713
  * Offering name, can be ticket name, vaucher name, etc...
@@ -479,7 +721,6 @@ type Ticket = {
479
721
  refId?: string;
480
722
  salesEnd: string;
481
723
  salesStart: string;
482
- schedule?: Schedule;
483
724
  sorting: number;
484
725
  source: string;
485
726
  status: OfferingStatus;
@@ -489,21 +730,40 @@ type Ticket = {
489
730
  declare namespace Ticket {
490
731
  enum type {
491
732
  ADMISSION = "admission",
733
+ ADMISSION_TABLE_COMMITMENT = "admission.tableCommitment",
492
734
  PACKAGE = "package"
493
735
  }
494
736
  }
495
737
 
738
+ type UpdatableCartSession = {
739
+ customer?: Partial_Customer_;
740
+ /**
741
+ * Items the user has added to their cart.
742
+ */
743
+ items: Array<Partial_OrderItem_>;
744
+ };
745
+
496
746
  /**
497
747
  * Provides methods to interact with the Cohost Events API.
498
748
  *
499
749
  * Usage:
500
750
  * ```ts
501
751
  * const client = new CohostClient({ token: 'your-token' });
752
+ * const list = await client.events.list();
502
753
  * const event = await client.events.fetch('event-id');
503
754
  * const tickets = await client.events.tickets('event-id');
504
755
  * ```
505
756
  */
506
757
  declare class EventsAPI extends CohostEndpoint {
758
+ /**
759
+ * Fetch a list of all events.
760
+ *
761
+ * @returns A Promise resolving to an array of event objects
762
+ * @throws Will throw an error if the request fails
763
+ *
764
+ * @todo Implement pagination and filtering options
765
+ */
766
+ list(): Promise<EventProfile[]>;
507
767
  /**
508
768
  * Fetch a single event by ID.
509
769
  *
@@ -543,6 +803,83 @@ declare class OrdersAPI extends CohostEndpoint {
543
803
  fetch(id: string, uid: string): Promise<any>;
544
804
  }
545
805
 
806
+ interface StartCartSessionInput {
807
+ contextId: string;
808
+ userAgent?: string;
809
+ referrer?: string;
810
+ ipAddresses?: string[];
811
+ }
812
+
813
+ /**
814
+ * Provides methods to interact with cart sessions in the Cohost API.
815
+ *
816
+ * Usage:
817
+ * ```ts
818
+ * const client = new CohostClient({ token: 'your-token' });
819
+ * const session = await client.sessions.start({ contextId: 'evt_abc123' });
820
+ * ```
821
+ */
822
+ declare class SessionsAPI extends CohostEndpoint {
823
+ /**
824
+ * Start a new cart session.
825
+ *
826
+ * @param input - Data to start the session
827
+ * @returns {CartSession} The latest cart session
828
+ *
829
+ * @throws Will throw an error if the request fails
830
+ */
831
+ start(input: StartCartSessionInput): Promise<CartSession>;
832
+ /**
833
+ * Get a cart session by its ID.
834
+ *
835
+ * @param id - The unique session ID
836
+ * @returns {CartSession} The latest cart session
837
+ *
838
+ * @throws Will throw an error if the session is not found or request fails
839
+ */
840
+ get(id: string): Promise<CartSession>;
841
+ /**
842
+ * Update a cart session.
843
+ *
844
+ * @param id - The ID of the session to update
845
+ * @param input - Data to update the session
846
+ * @returns {CartSession} The latest cart session
847
+ *
848
+ * @throws Will throw an error if the update fails
849
+ */
850
+ update(id: string, input: UpdatableCartSession): Promise<CartSession>;
851
+ /**
852
+ * Cancel (soft delete) a cart session.
853
+ *
854
+ * @param id - The ID of the session to cancel
855
+ * @returns Nothing if successful
856
+ * @throws Will throw an error if the cancel operation fails
857
+ */
858
+ cancel(id: string): Promise<void>;
859
+ /**
860
+ * Update an item in the cart session.
861
+ *
862
+ * @param sessionId - The ID of the session
863
+ * @param props - Properties to update
864
+ * @returns {CartSession} The latest cart session
865
+ *
866
+ * @throws Will throw an error if the update fails
867
+ */
868
+ updateItem(sessionId: string, props: {
869
+ offeringId: string;
870
+ quantity: number;
871
+ }): Promise<CartSession>;
872
+ /**
873
+ * Remove an item from the cart session.
874
+ * The same as setting the quantity to 0.
875
+ *
876
+ * @param sessionId
877
+ * @param offeringId
878
+ * @returns {CartSession} The latest cart session
879
+ */
880
+ deleteItem(sessionId: string, offeringId: string): Promise<CartSession>;
881
+ }
882
+
546
883
  /**
547
884
  * Configuration options for instantiating a CohostClient.
548
885
  */
@@ -558,6 +895,7 @@ interface CohostClientOptions {
558
895
  declare class CohostClient {
559
896
  readonly events: EventsAPI;
560
897
  readonly orders: OrdersAPI;
898
+ readonly cart: SessionsAPI;
561
899
  private readonly baseOptions;
562
900
  constructor(options: CohostClientOptions, customRequestFn?: RequestFn);
563
901
  /**
@@ -580,4 +918,4 @@ declare class CohostClient {
580
918
  */
581
919
  declare function createCohostClient(options: CohostClientOptions): CohostClient;
582
920
 
583
- export { CohostClient, createCohostClient };
921
+ export { CohostClient, type CohostClientSettings, createCohostClient };