tixbit 0.1.0 → 0.1.2

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.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  interface TixBitConfig {
3
3
  /**
4
4
  * Base URL of the TixBit web app.
5
- * @default "https://tixbit.com"
5
+ * @default "https://www.tixbit.com"
6
6
  */
7
7
  baseUrl?: string;
8
8
  /**
@@ -11,9 +11,16 @@ interface TixBitConfig {
11
11
  */
12
12
  timeoutMs?: number;
13
13
  /**
14
- * Optional API key for authenticated endpoints (future use).
14
+ * Public TixBit MPP purchase endpoint.
15
+ * Only the canonical endpoint is accepted; loopback HTTP is allowed for local QA.
16
+ * @default "https://mcp.tixbit.com/api/purchase"
15
17
  */
16
- apiKey?: string;
18
+ paymentEndpoint?: string;
19
+ /**
20
+ * Fetch implementation used for purchases. Supply `mppx.fetch` to
21
+ * automatically answer an MPP 402 challenge and retry with a credential.
22
+ */
23
+ paymentFetch?: typeof fetch;
17
24
  }
18
25
  interface SearchEventsParams {
19
26
  /** Free-text search query (e.g. "Hawks", "Taylor Swift"). */
@@ -24,6 +31,22 @@ interface SearchEventsParams {
24
31
  state?: string;
25
32
  /** Category slug (e.g. "nba-basketball", "mlb-baseball"). */
26
33
  category?: string;
34
+ /** League abbreviation (for example "NBA" or "MLB"). */
35
+ league?: string;
36
+ /** High-level event type. */
37
+ categoryEventType?: "SPORT" | "CONCERT" | "THEATER" | "ALL";
38
+ /** Public performer ID. */
39
+ performerId?: string;
40
+ /** Public venue ID. */
41
+ venueId?: string;
42
+ /** Parking-event behavior. */
43
+ parkingFilter?: ParkingFilter;
44
+ /** Latitude used with manual location filtering. */
45
+ nearLat?: number;
46
+ /** Longitude used with manual location filtering. */
47
+ nearLng?: number;
48
+ /** Whether location values are inferred, manual, or disabled. */
49
+ locationMode?: LocationMode;
27
50
  /** ISO date string — only events on or after this date. */
28
51
  startDate?: string;
29
52
  /** ISO date string — only events on or before this date. */
@@ -42,14 +65,21 @@ interface TixBitEvent {
42
65
  venue_name: string | null;
43
66
  venue_city: string | null;
44
67
  venue_state: string | null;
68
+ venue_country: string | null;
45
69
  image_url: string | null;
70
+ category_slug: string | null;
46
71
  category_name: string | null;
47
72
  category_event_type: string | null;
73
+ metadata: Record<string, unknown> | null;
48
74
  has_listings: boolean;
49
75
  inventory: {
50
76
  total_available: number;
51
77
  min_price: number;
52
78
  max_price: number;
79
+ sources?: {
80
+ local: number;
81
+ marketplace: number;
82
+ };
53
83
  };
54
84
  }
55
85
  interface SearchEventsResult {
@@ -57,10 +87,35 @@ interface SearchEventsResult {
57
87
  pagination: {
58
88
  page: number;
59
89
  size: number;
60
- total: number;
61
- totalPages: number;
90
+ total: number | null;
91
+ totalPages: number | null;
62
92
  hasNext: boolean;
63
93
  hasPrev: boolean;
94
+ totalExact: boolean;
95
+ };
96
+ }
97
+ /** Public event detail returned by `GET /api/events/:eventId`. */
98
+ interface TixBitEventDetail {
99
+ success: boolean;
100
+ id: string;
101
+ external_id: string;
102
+ slug?: string;
103
+ name?: string;
104
+ url?: string;
105
+ images?: Array<Record<string, unknown> & {
106
+ url: string;
107
+ }>;
108
+ dates?: Record<string, unknown>;
109
+ sales?: Record<string, unknown>;
110
+ priceRanges?: unknown[];
111
+ classifications?: unknown[];
112
+ info?: string;
113
+ pleaseNote?: string;
114
+ seatmap?: {
115
+ staticUrl: string;
116
+ };
117
+ _embedded?: {
118
+ venues?: Array<Record<string, unknown>>;
64
119
  };
65
120
  }
66
121
  interface GetListingsParams {
@@ -72,19 +127,39 @@ interface GetListingsParams {
72
127
  page?: number;
73
128
  /** Sort direction for price. @default "asc" */
74
129
  orderByDirection?: "asc" | "desc";
130
+ /** Return all currently available listings. */
131
+ includeAll?: boolean;
132
+ /** Bypass the listings cache for this request. */
133
+ refresh?: boolean;
75
134
  }
76
135
  interface TixBitListing {
77
136
  id: string;
137
+ event_id: string | null;
78
138
  price: number;
139
+ total_price: number | null;
140
+ base_price_per_ticket: number | null;
141
+ base_total_price: number | null;
142
+ face_value: number | null;
143
+ fee_amount_per_ticket: number | null;
144
+ fee_amount_total: number | null;
145
+ fee_percent: number | null;
146
+ currency: string;
79
147
  quantity: number;
80
148
  quantities_list: number[];
81
149
  section: string | null;
82
150
  row: string | null;
151
+ seat_from: string | null;
152
+ seat_to: string | null;
83
153
  seat_numbers: string | null;
154
+ /** @deprecated The public API no longer returns listing hashes. */
84
155
  listing_hash: string;
85
156
  notes: string | null;
86
157
  delivery_method: string | null;
158
+ in_hand_date: string | null;
159
+ stock_type: string | null;
160
+ disclosure_ids: string[];
87
161
  splits: number[];
162
+ /** Sanitized public response fields not normalized above. */
88
163
  raw: Record<string, unknown>;
89
164
  }
90
165
  interface GetListingsResult {
@@ -93,9 +168,29 @@ interface GetListingsResult {
93
168
  total: number;
94
169
  page: number;
95
170
  size: number;
171
+ totalPages?: number;
172
+ currentPageTotalCount?: number;
173
+ cache?: boolean;
174
+ cacheExpiresAt?: string | null;
175
+ cacheState?: "fresh" | "stale" | "unavailable";
176
+ freshness?: "live" | "cached";
96
177
  cacheSource?: string;
97
178
  };
98
179
  }
180
+ interface TixBitListingDisclosure {
181
+ id: string;
182
+ description: string;
183
+ type?: {
184
+ id: string;
185
+ name?: string;
186
+ severity?: string;
187
+ slug?: string;
188
+ };
189
+ }
190
+ interface GetListingResult {
191
+ listing: TixBitListing;
192
+ disclosures: TixBitListingDisclosure[];
193
+ }
99
194
  interface CheckoutParams {
100
195
  /** Listing ID to purchase (from getListings results). */
101
196
  listingId: string;
@@ -104,13 +199,73 @@ interface CheckoutParams {
104
199
  }
105
200
  /** A checkout link that the user opens in a browser to complete purchase. */
106
201
  interface CheckoutLink {
107
- /** Full URL to the checkout page on tixbit.com. */
202
+ /** Full URL to the checkout page on www.tixbit.com. */
108
203
  url: string;
109
204
  /** Listing ID being purchased. */
110
205
  listingId: string;
111
206
  /** Ticket quantity. */
112
207
  quantity: number;
113
208
  }
209
+ interface BuyTicketsParams {
210
+ listingId: string;
211
+ quantity: number;
212
+ email: string;
213
+ /** Total USD charge ceiling, including fees. */
214
+ maxAmountCents: number;
215
+ confirm?: boolean;
216
+ sharedPaymentToken?: string;
217
+ }
218
+ interface AgentResult {
219
+ success: boolean;
220
+ status?: string;
221
+ data?: Record<string, unknown>;
222
+ error?: {
223
+ code: string;
224
+ message: string;
225
+ };
226
+ action?: string;
227
+ }
228
+ interface PurchaseTicketsParams {
229
+ /** Listing ID selected from `getListings`. */
230
+ listingId: string;
231
+ /** Number of tickets to purchase (1–8). */
232
+ quantity: number;
233
+ /** Required buyer email for confirmation and ticket delivery. */
234
+ email: string;
235
+ /** Optional buyer/recipient name. */
236
+ name?: string;
237
+ /** Stable value to reuse across retries and recovery checks. */
238
+ idempotencyKey?: string;
239
+ }
240
+ type PurchaseStatus = "fulfilled" | "payment_required" | "pending" | "manual_review_required" | "payment_failed" | "rejected";
241
+ interface PurchaseOrder {
242
+ reference: string;
243
+ status: PurchaseStatus;
244
+ listingId: string;
245
+ quantity: number;
246
+ pricePerTicket: number;
247
+ subtotal: number;
248
+ fees: number;
249
+ total: number;
250
+ currency: string;
251
+ section?: string;
252
+ row?: string;
253
+ }
254
+ /** Agent-readable outcome from the MPP machine checkout flow. */
255
+ interface PurchaseTicketsResult {
256
+ success: boolean;
257
+ status: PurchaseStatus;
258
+ idempotencyKey: string;
259
+ orderReference: string | null;
260
+ receiptUrl: string | null;
261
+ order?: PurchaseOrder;
262
+ paid?: boolean;
263
+ error?: {
264
+ code: string;
265
+ message: string;
266
+ };
267
+ action?: string;
268
+ }
114
269
  interface BrowseEventsParams {
115
270
  /** User latitude for location-aware results. */
116
271
  latitude?: number;
@@ -122,17 +277,51 @@ interface BrowseEventsParams {
122
277
  state?: string;
123
278
  /** Number of results. @default 18 */
124
279
  size?: number;
280
+ /** Page number (1-indexed). @default 1 */
281
+ page?: number;
282
+ /** Optional free-text query. */
283
+ query?: string;
284
+ /** Category slug. */
285
+ category?: string;
286
+ /** League abbreviation. */
287
+ league?: string;
288
+ /** Event date in YYYY-MM-DD format. */
289
+ date?: string;
125
290
  /** Category event type: SPORT, CONCERT, THEATER. */
126
291
  categoryEventType?: "SPORT" | "CONCERT" | "THEATER" | "ALL";
292
+ /** Response context used by the public browse endpoint. */
293
+ context?: "homepage" | "events" | "category";
294
+ /** Location-selection behavior. */
295
+ locationMode?: LocationMode;
296
+ /** Local-only or broadened search behavior. */
297
+ searchScope?: "local" | "broadened";
298
+ /** Parking-event behavior. */
299
+ parkingFilter?: ParkingFilter;
300
+ /** Upcoming or trending recommendation order. */
301
+ recommendation?: "upcoming" | "trending";
127
302
  }
128
303
  interface BrowseEventsResult {
129
304
  events: TixBitEvent[];
130
- total: number;
305
+ total: number | null;
306
+ totalExact: boolean;
307
+ hasMore: boolean;
308
+ page: number;
309
+ pageSize: number;
310
+ degraded?: boolean;
131
311
  }
312
+ type ParkingFilter = "exclude" | "only" | "include";
313
+ type LocationMode = "inferred" | "manual" | "none";
132
314
  interface GetSeatmapParams {
133
315
  /** External event ID (from search results). */
134
316
  eventId: string;
135
317
  }
318
+ interface SeatmapLabel {
319
+ text: string;
320
+ x: number;
321
+ y: number;
322
+ size?: number;
323
+ angle?: number;
324
+ }
136
325
  /** A single section in the venue's seating chart. */
137
326
  interface SeatmapSection {
138
327
  /** Section ID (e.g. "80841"). */
@@ -140,11 +329,18 @@ interface SeatmapSection {
140
329
  /** Human-readable section name (e.g. "101", "FLOOR3", "201"). */
141
330
  name: string;
142
331
  /**
143
- * Center coordinates of the section label on the map.
144
- * Useful for understanding relative position.
332
+ * Primary label anchor for simple renderers and relative position helpers.
145
333
  */
146
334
  x: number;
147
335
  y: number;
336
+ /**
337
+ * All labels from the seatmap payload (useful for richer rendering).
338
+ */
339
+ labels: SeatmapLabel[];
340
+ /**
341
+ * SVG path for drawing the section shape overlay.
342
+ */
343
+ shape_path: string | null;
148
344
  }
149
345
  /** A zone grouping sections (e.g. "Section", "Floor", "Suite"). */
150
346
  interface SeatmapZone {
@@ -185,7 +381,8 @@ interface SeatmapResult {
185
381
  declare class TixBitClient {
186
382
  private readonly baseUrl;
187
383
  private readonly timeoutMs;
188
- private readonly apiKey;
384
+ private readonly paymentEndpoint;
385
+ private readonly paymentFetch;
189
386
  constructor(config?: TixBitConfig);
190
387
  private request;
191
388
  private qs;
@@ -198,6 +395,8 @@ declare class TixBitClient {
198
395
  * ```
199
396
  */
200
397
  searchEvents(params?: SearchEventsParams): Promise<SearchEventsResult>;
398
+ /** Get one public event by ID or slug. */
399
+ getEvent(eventId: string): Promise<TixBitEventDetail>;
201
400
  /**
202
401
  * Browse upcoming events near a location (homepage-style).
203
402
  *
@@ -212,10 +411,29 @@ declare class TixBitClient {
212
411
  *
213
412
  * @example
214
413
  * ```ts
215
- * const listings = await client.getListings({ eventId: "abc123" });
414
+ * const listings = await client.getListings({ eventId: "EVENT123" });
216
415
  * ```
217
416
  */
218
417
  getListings(params: GetListingsParams): Promise<GetListingsResult>;
418
+ /** Get one public listing by listing ID. */
419
+ getListing(listingId: string): Promise<GetListingResult>;
420
+ /** Refreshed inventory, not a reservation or negotiated offer. */
421
+ quoteListings(params: GetListingsParams): Promise<GetListingsResult>;
422
+ private agentRequest;
423
+ /** Public browser entry points. This does not create or import a CLI session. */
424
+ getAuthorizationInfo(): {
425
+ apiKeyRequired: boolean;
426
+ cliSessionSupported: boolean;
427
+ signInUrl: string;
428
+ sellerUrl: string;
429
+ linkWalletUrl: string;
430
+ action: string;
431
+ };
432
+ private sellerAuthorizationRequired;
433
+ /** Stripe Link checkout. No confirmation means quote only. Never retries payment. */
434
+ buyTickets(params: BuyTicketsParams): Promise<AgentResult>;
435
+ listSellerListings(accessToken?: string): Promise<AgentResult>;
436
+ createSellerListing(body: unknown, accessToken: string, confirm: boolean): Promise<AgentResult>;
219
437
  /**
220
438
  * Create a checkout link for a listing.
221
439
  *
@@ -225,17 +443,25 @@ declare class TixBitClient {
225
443
  * @example
226
444
  * ```ts
227
445
  * const link = client.createCheckoutLink({
228
- * listingId: "P2JO5OBX",
446
+ * listingId: "LISTING123",
229
447
  * quantity: 2,
230
448
  * });
231
449
  *
232
450
  * console.log(link.url);
233
- * // → "https://tixbit.com/checkout/process?listing=P2JO5OBX&quantity=2"
451
+ * // → "https://www.tixbit.com/checkout/process?listing=LISTING123&quantity=2"
234
452
  * ```
235
453
  */
236
454
  createCheckoutLink(params: CheckoutParams): CheckoutLink;
237
455
  /**
238
- * Build the direct URL to an event page on tixbit.com.
456
+ * Purchase tickets through the public MPP endpoint.
457
+ *
458
+ * Configure `paymentFetch` with the official mppx client to automatically
459
+ * answer the server's 402 challenge. Reuse the returned idempotency key for
460
+ * any recovery check after a timeout or pending result.
461
+ */
462
+ purchaseTickets(params: PurchaseTicketsParams): Promise<PurchaseTicketsResult>;
463
+ /**
464
+ * Build the direct URL to an event page on www.tixbit.com.
239
465
  */
240
466
  eventUrl(slugOrId: string): string;
241
467
  /**
@@ -247,7 +473,7 @@ declare class TixBitClient {
247
473
  *
248
474
  * @example
249
475
  * ```ts
250
- * const seatmap = await client.getSeatmap({ eventId: "4BKJMDZ" });
476
+ * const seatmap = await client.getSeatmap({ eventId: "EVENT123" });
251
477
  * console.log(seatmap.venue_name); // "State Farm Arena"
252
478
  * console.log(seatmap.section_names); // ["101", "102", ...]
253
479
  * ```
@@ -263,5 +489,19 @@ declare class TixBitApiError extends Error {
263
489
  readonly url: string;
264
490
  constructor(message: string, status: number, url: string);
265
491
  }
492
+ declare class TixBitTimeoutError extends Error {
493
+ readonly url: string;
494
+ readonly timeoutMs: number;
495
+ constructor(url: string, timeoutMs: number);
496
+ }
497
+
498
+ /** Run in mppx onChallenge, before signing or transferring any funds.
499
+ * pathUSD uses six atomic decimals. Unknown tokens and recurring intents fail closed.
500
+ */
501
+ declare function assertMppChallenge(challenge: {
502
+ method: string;
503
+ intent: string;
504
+ request: Record<string, unknown>;
505
+ }, maxAmountCents: number): void;
266
506
 
267
- export { type BrowseEventsParams, type BrowseEventsResult, type CheckoutLink, type CheckoutParams, type GetListingsParams, type GetListingsResult, type GetSeatmapParams, type SearchEventsParams, type SearchEventsResult, type SeatmapResult, type SeatmapSection, type SeatmapVenue, type SeatmapZone, TixBitApiError, TixBitClient, type TixBitConfig, type TixBitEvent, type TixBitListing };
507
+ export { type AgentResult, type BrowseEventsParams, type BrowseEventsResult, type BuyTicketsParams, type CheckoutLink, type CheckoutParams, type GetListingResult, type GetListingsParams, type GetListingsResult, type GetSeatmapParams, type LocationMode, type ParkingFilter, type PurchaseOrder, type PurchaseStatus, type PurchaseTicketsParams, type PurchaseTicketsResult, type SearchEventsParams, type SearchEventsResult, type SeatmapLabel, type SeatmapResult, type SeatmapSection, type SeatmapVenue, type SeatmapZone, TixBitApiError, TixBitClient, type TixBitConfig, type TixBitEvent, type TixBitEventDetail, type TixBitListing, type TixBitListingDisclosure, TixBitTimeoutError, assertMppChallenge };