@seatlayer/js 0.88.0 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hostedCheckout-TMNTMVMM.js +58 -0
- package/dist/index.cjs +37 -20
- package/dist/index.d.cts +179 -6
- package/dist/index.d.ts +179 -6
- package/dist/index.js +17 -17
- package/package.json +2 -2
- package/dist/hostedCheckout-W7QZWSOQ.js +0 -41
package/dist/index.d.cts
CHANGED
|
@@ -478,6 +478,78 @@ interface ControllerSinkOptions {
|
|
|
478
478
|
}
|
|
479
479
|
declare function createControllerSink(controller: PickerControllerLike, options?: ControllerSinkOptions): RealtimeSink;
|
|
480
480
|
|
|
481
|
+
/**
|
|
482
|
+
* The booking form inside the hosted-checkout card: a name, email or phone for
|
|
483
|
+
* each ticket, and the organizer's own questions, rendered from the
|
|
484
|
+
* `bookingForm` that `GET /pub/events/:key/payment-options` already carries.
|
|
485
|
+
*
|
|
486
|
+
* Built into the standalone `seatlayer-checkout.mjs` asset with the card, so it
|
|
487
|
+
* follows the card's rule: NO RUNTIME IMPORTS. Everything it needs — the ticket
|
|
488
|
+
* keys, the translator, the buyer's own details — arrives as arguments.
|
|
489
|
+
*
|
|
490
|
+
* The server is the authority on every rule below (`booking_form_incomplete`).
|
|
491
|
+
* These checks only exist so a buyer hears about a missing name next to the
|
|
492
|
+
* field, before a round trip, in the same words the refusal would map to.
|
|
493
|
+
*/
|
|
494
|
+
/** Organizer setting for one attendee detail. */
|
|
495
|
+
type AttendeeFieldMode = 'off' | 'optional' | 'required';
|
|
496
|
+
type BookingQuestionType = 'text' | 'textarea' | 'number' | 'select' | 'multiselect' | 'checkbox' | 'date' | 'email' | 'phone';
|
|
497
|
+
interface BookingQuestionOption {
|
|
498
|
+
id: string;
|
|
499
|
+
label: string;
|
|
500
|
+
}
|
|
501
|
+
/** One organizer question. Public payloads carry active questions only. */
|
|
502
|
+
interface BookingQuestion {
|
|
503
|
+
id: string;
|
|
504
|
+
position: number;
|
|
505
|
+
label: string;
|
|
506
|
+
helpText: string | null;
|
|
507
|
+
type: BookingQuestionType;
|
|
508
|
+
/** Present for `select` and `multiselect`. */
|
|
509
|
+
options: BookingQuestionOption[] | null;
|
|
510
|
+
required: boolean;
|
|
511
|
+
/** `order` is asked once per booking; `ticket` inside every ticket's block. */
|
|
512
|
+
scope: 'order' | 'ticket';
|
|
513
|
+
/** Who later sees the answer. Staff-only questions are still asked. */
|
|
514
|
+
visibility: 'buyer' | 'staff';
|
|
515
|
+
archived: boolean;
|
|
516
|
+
/** Organizer reads only. */
|
|
517
|
+
hasAnswers?: boolean;
|
|
518
|
+
}
|
|
519
|
+
/** What `payment-options` says the checkout must ask. */
|
|
520
|
+
interface BookingForm {
|
|
521
|
+
attendeeName: AttendeeFieldMode;
|
|
522
|
+
attendeeEmail: AttendeeFieldMode;
|
|
523
|
+
attendeePhone: AttendeeFieldMode;
|
|
524
|
+
questions: BookingQuestion[];
|
|
525
|
+
/** Organizer reads only. */
|
|
526
|
+
revision?: number;
|
|
527
|
+
}
|
|
528
|
+
/** One ticket's attendee, keyed by the server's ticket key. */
|
|
529
|
+
interface CheckoutAttendee {
|
|
530
|
+
ticketKey: string;
|
|
531
|
+
name?: string;
|
|
532
|
+
email?: string;
|
|
533
|
+
phone?: string;
|
|
534
|
+
}
|
|
535
|
+
type CheckoutAnswerValue = string | number | boolean | string[];
|
|
536
|
+
/** One answer. `ticketKey` is set for ticket-scope questions only. */
|
|
537
|
+
interface CheckoutAnswer {
|
|
538
|
+
questionId: string;
|
|
539
|
+
ticketKey?: string;
|
|
540
|
+
value: CheckoutAnswerValue;
|
|
541
|
+
}
|
|
542
|
+
type BookingFieldErrorCode = 'required' | 'invalid' | 'too_long';
|
|
543
|
+
/**
|
|
544
|
+
* One field the server refused (`422 booking_form_incomplete`). `key` is
|
|
545
|
+
* `attendeeName` | `attendeeEmail` | `attendeePhone` | `question:<id>`.
|
|
546
|
+
*/
|
|
547
|
+
interface BookingFormFieldError {
|
|
548
|
+
key: string;
|
|
549
|
+
ticketKey?: string;
|
|
550
|
+
code: BookingFieldErrorCode;
|
|
551
|
+
}
|
|
552
|
+
|
|
481
553
|
/**
|
|
482
554
|
* Minimal client for the browser embed surface of workers/api (the `/pub/*`
|
|
483
555
|
* routes). Platform events bind this client to a buyer access context; Managed
|
|
@@ -516,14 +588,26 @@ declare class ApiError extends Error {
|
|
|
516
588
|
/** Present when best-available 409s ('not_enough_together' | 'sold_out'). */
|
|
517
589
|
reason?: string;
|
|
518
590
|
/**
|
|
519
|
-
* Seconds the server asked the caller to wait, off a 429's
|
|
591
|
+
* Seconds the server asked the caller to wait, off a 429's or a 503's
|
|
592
|
+
* `Retry-After`.
|
|
520
593
|
*
|
|
521
|
-
* Present ONLY on a rate-limit error, and it is the server's
|
|
522
|
-
* guess. A widget that catches this can say "try again in
|
|
523
|
-
* of rendering the blank map a swallowed 429 used to
|
|
594
|
+
* Present ONLY on a rate-limit or maintenance error, and it is the server's
|
|
595
|
+
* number — never a guess. A widget that catches this can say "try again in
|
|
596
|
+
* N minutes" instead of rendering the blank map a swallowed 429 used to
|
|
597
|
+
* produce, or the "seats were just taken" a maintenance 503 used to become.
|
|
524
598
|
*/
|
|
525
599
|
retryAfterS?: number;
|
|
526
|
-
|
|
600
|
+
/**
|
|
601
|
+
* Operator-written buyer copy that arrived with a maintenance 503 (the API's
|
|
602
|
+
* `notice`). Shown verbatim when present; absent, the widget uses its own
|
|
603
|
+
* localised wording built from `retryAfterS`.
|
|
604
|
+
*/
|
|
605
|
+
notice?: string;
|
|
606
|
+
/** `422 booking_form_incomplete`: the fields the server refused, for inline errors. */
|
|
607
|
+
fields?: BookingFormFieldError[];
|
|
608
|
+
constructor(status: number, message: string, code?: string, conflicts?: HoldConflict[], reason?: string, retryAfterS?: number, notice?: string, details?: {
|
|
609
|
+
fields?: BookingFormFieldError[];
|
|
610
|
+
});
|
|
527
611
|
}
|
|
528
612
|
interface HoldResult {
|
|
529
613
|
holdId: string;
|
|
@@ -531,6 +615,35 @@ interface HoldResult {
|
|
|
531
615
|
/** The held seats with the buyer's chosen ticket tier per seat (present on hold). */
|
|
532
616
|
seats?: PickerSeat[];
|
|
533
617
|
items?: HoldLineItem[];
|
|
618
|
+
/**
|
|
619
|
+
* One key per guest this hold admits, in issuance order: a seat, booth or
|
|
620
|
+
* individually sold chair is its label; a general-admission place (its own
|
|
621
|
+
* inventory unit) is `"<label>#1"`; a whole table admitting q places is
|
|
622
|
+
* `"<label>#1"` … `"<label>#q"`. The booking form keys attendees and ticket
|
|
623
|
+
* answers by it. Keys and GA unit labels are internal: never show them.
|
|
624
|
+
* Absent from older servers.
|
|
625
|
+
*/
|
|
626
|
+
ticketKeys?: string[];
|
|
627
|
+
/** Per key: its label, and which guest of how many it is. */
|
|
628
|
+
ticketKeyDetails?: TicketKeyDetail[];
|
|
629
|
+
/**
|
|
630
|
+
* True when the server answered a retried hold attempt with the hold that
|
|
631
|
+
* attempt already created. Same `holdId` and `expiresAt`; `items` come back
|
|
632
|
+
* sorted by label with their committed prices.
|
|
633
|
+
*/
|
|
634
|
+
replayed?: boolean;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* One guest's ticket key. `label` is the inventory label and may be internal
|
|
638
|
+
* (a GA place); `displayLabel` is what a buyer may see. `unitIndex` and
|
|
639
|
+
* `quantity` number the guests of one ticket admitting several places.
|
|
640
|
+
*/
|
|
641
|
+
interface TicketKeyDetail {
|
|
642
|
+
ticketKey: string;
|
|
643
|
+
label: string;
|
|
644
|
+
unitIndex: number;
|
|
645
|
+
quantity: number;
|
|
646
|
+
displayLabel?: string;
|
|
534
647
|
}
|
|
535
648
|
/** Browser-safe active-hold projection returned by the resume endpoint. */
|
|
536
649
|
interface ResumedHoldResult extends HoldResult {
|
|
@@ -544,6 +657,10 @@ interface BestAvailableResult {
|
|
|
544
657
|
seats?: PickerSeat[];
|
|
545
658
|
items?: HoldResult['items'];
|
|
546
659
|
zoneId?: string;
|
|
660
|
+
/** See {@link HoldResult.ticketKeys}. */
|
|
661
|
+
ticketKeys?: string[];
|
|
662
|
+
/** See {@link HoldResult.ticketKeyDetails}. */
|
|
663
|
+
ticketKeyDetails?: TicketKeyDetail[];
|
|
547
664
|
}
|
|
548
665
|
/** A gateway the organizer can be connected to. */
|
|
549
666
|
type PaymentProviderName = 'stripe' | 'razorpay';
|
|
@@ -570,6 +687,14 @@ interface PaymentOptionsResult {
|
|
|
570
687
|
providers: PaymentProviderName[];
|
|
571
688
|
currency: string | null;
|
|
572
689
|
reason?: PaymentOptionsReason | null;
|
|
690
|
+
/**
|
|
691
|
+
* Whether the event charges. `'free'` comes with an empty `providers` list
|
|
692
|
+
* and `reason: null`: nothing is missing, the booking simply has no payment
|
|
693
|
+
* step. Absent from older servers, which only ever meant `'paid'`.
|
|
694
|
+
*/
|
|
695
|
+
bookingMode?: 'paid' | 'free';
|
|
696
|
+
/** What hosted checkout must ask: attendee details and active questions. */
|
|
697
|
+
bookingForm?: BookingForm | null;
|
|
573
698
|
}
|
|
574
699
|
/** A started payment. Exactly one of the two handoffs comes back. */
|
|
575
700
|
interface CheckoutSessionResult {
|
|
@@ -581,6 +706,16 @@ interface CheckoutSessionResult {
|
|
|
581
706
|
redirectUrl?: string;
|
|
582
707
|
/** In-page modal gateway — open it without leaving the page. */
|
|
583
708
|
clientPayload?: Record<string, unknown>;
|
|
709
|
+
/**
|
|
710
|
+
* `'confirmed'` when the booking needed no payment (a free event, or a hold
|
|
711
|
+
* that sums to zero): the seats are already booked and the tickets issued,
|
|
712
|
+
* so there is no handoff to follow. Read the order's status for the receipt.
|
|
713
|
+
*/
|
|
714
|
+
status?: 'confirmed';
|
|
715
|
+
/** Buyer-facing order number, on a booking confirmed without payment. */
|
|
716
|
+
orderNumber?: string;
|
|
717
|
+
/** Hosted confirmation page path, on a booking confirmed without payment. */
|
|
718
|
+
confirmationUrl?: string;
|
|
584
719
|
}
|
|
585
720
|
/** An order's state while its gateway webhook is in flight. */
|
|
586
721
|
interface OrderStatusResult {
|
|
@@ -595,6 +730,8 @@ interface OrderStatusResult {
|
|
|
595
730
|
startsAt?: number | null;
|
|
596
731
|
tickets?: Array<{
|
|
597
732
|
label: string;
|
|
733
|
+
/** What a buyer may call the ticket; `label` can be an internal inventory label. */
|
|
734
|
+
displayLabel?: string | null;
|
|
598
735
|
token: string;
|
|
599
736
|
status: 'issued' | 'checked_in' | 'void';
|
|
600
737
|
checkedInAt: number | null;
|
|
@@ -3272,6 +3409,40 @@ interface WebMcpRegistration {
|
|
|
3272
3409
|
/** What `PickerController.render()` reports back about the loaded event. */
|
|
3273
3410
|
type PickerRenderInfo = NonNullable<Awaited<ReturnType<PickerController['render']>>>;
|
|
3274
3411
|
|
|
3412
|
+
/**
|
|
3413
|
+
* Hosted checkout — the payment step, as a module nobody downloads until a
|
|
3414
|
+
* buyer actually asks to pay.
|
|
3415
|
+
*
|
|
3416
|
+
* This is the whole of what `checkout: 'hosted'` adds to SeatPicker: a card
|
|
3417
|
+
* that collects an email, starts a payment against `POST /pub/events/:key/
|
|
3418
|
+
* checkout`, hands off to the gateway, and waits for the webhook to land. It is
|
|
3419
|
+
* a straight port of the panel our own buyer page has shipped since hosted
|
|
3420
|
+
* checkout existed (`src/pages/CheckoutPanel.tsx`), with React and the app's
|
|
3421
|
+
* shared api client taken out.
|
|
3422
|
+
*
|
|
3423
|
+
* IT IMPORTS NOTHING AT RUNTIME. Not `@seatlayer/core`, not `./api`, not even a
|
|
3424
|
+
* type from `./SeatPicker` — every input arrives through {@link CheckoutMount},
|
|
3425
|
+
* including the two API calls, which arrive as functions. That is not
|
|
3426
|
+
* fastidiousness: this file is built as a standalone CDN asset
|
|
3427
|
+
* (`seatlayer-checkout.mjs`), and a single value import from the engine would
|
|
3428
|
+
* pull a second copy of it into that asset and undo the point of splitting.
|
|
3429
|
+
* The one exception is `./hostedCheckoutForm`, the booking form, which lives
|
|
3430
|
+
* in that same asset under the same rule.
|
|
3431
|
+
*
|
|
3432
|
+
* Three states, one card, because they are the same moment in the buyer's
|
|
3433
|
+
* journey and share every pixel of chrome:
|
|
3434
|
+
*
|
|
3435
|
+
* pay a live hold — collect an email and START a payment
|
|
3436
|
+
* resume back from a hosted gateway page — the hold and its line items
|
|
3437
|
+
* are gone with the old document, so this can only WAIT on the
|
|
3438
|
+
* order id restored from tab storage. It must never offer
|
|
3439
|
+
* to start a second payment for a purchase that may have already
|
|
3440
|
+
* succeeded.
|
|
3441
|
+
* unavailable the event cannot take money here, and the buyer is holding
|
|
3442
|
+
* seats. Say which of the three reasons it is, because two of
|
|
3443
|
+
* them give opposite advice.
|
|
3444
|
+
*/
|
|
3445
|
+
|
|
3275
3446
|
/** What `GET /pub/orders/:id/status` returns while the webhook is in flight. */
|
|
3276
3447
|
interface CheckoutOrderStatus {
|
|
3277
3448
|
orderId: string;
|
|
@@ -3282,6 +3453,8 @@ interface CheckoutOrderStatus {
|
|
|
3282
3453
|
seatCount: number;
|
|
3283
3454
|
tickets?: Array<{
|
|
3284
3455
|
label: string;
|
|
3456
|
+
/** What a buyer may call the ticket; the inventory label can be internal. */
|
|
3457
|
+
displayLabel?: string | null;
|
|
3285
3458
|
token: string;
|
|
3286
3459
|
status: 'issued' | 'checked_in' | 'void';
|
|
3287
3460
|
checkedInAt: number | null;
|
|
@@ -5480,4 +5653,4 @@ interface AttachPickerFrameOptions {
|
|
|
5480
5653
|
*/
|
|
5481
5654
|
declare function attachPickerFrame(iframe: HTMLIFrameElement, opts?: AttachPickerFrameOptions): () => void;
|
|
5482
5655
|
|
|
5483
|
-
export { ApiError, type AttachPickerFrameOptions, type BestAvailableResult, BuyerAccessContext, type BuyerAccessExpiredEvent, type BuyerAccessRefreshReason, type BuyerAccessToken, type BuyerAccessTokenProvider, BuyerAccessUnavailableError, type BuyerAccessUnavailableEvent, type BuyerAccessUnavailableReason, BuyerRealtimeClient, type BuyerRealtimeOptions, type CheckoutHandoff, type CheckoutLineItem, type CheckoutSessionResult, EmbeddedDesigner, type EmbeddedDesignerEventType, type EmbeddedDesignerMessage, type EmbeddedDesignerOptions, type GAAreaAvailability, type GAPromptRequest, type GaPromptTier, type HoldConflict, type HoldLineItem, type HoldResult, type OrderStatusResult, type PaymentOptionsReason, type PaymentOptionsResult, type PaymentProviderName, type PerformanceGroupAvailability, type PerformanceGroupCheckoutHandoff, type PerformanceGroupDescriptor, PerformanceGroupDestroyedError, type PerformanceGroupHold, type PerformanceGroupHoldAllocation, type PerformanceGroupOperationEvent, type PerformanceGroupOperationState, PerformanceGroupPicker, type PerformanceGroupPickerOptions, type PerformanceGroupRecoveryState, type PerformanceGroupSeatAllocation, type PerformanceGroupSelectionMode, type PerformanceGroupStatusEvent, type Projection, type PubApiOptions, type RealtimeSink, type ResumedHoldResult, SEATING_CHART_CALLBACK_PROPS, SEATING_CHART_HANDLE_METHODS, SEATING_CHART_IDENTITY_PROPS, SEATING_CHART_VALUE_PROPS, type SaleState, SeasonApiError, type SeasonAudience, type SeasonAvailability, type SeasonBestAvailableOptions, type SeasonCategoryPrice, type SeasonCheckoutHandoff, type SeasonCheckoutMode, type SeasonCheckoutRequest, type SeasonCheckoutSession, type SeasonDescriptor, type SeasonOfferPresentation, type SeasonOperation, type SeasonOperationState, type SeasonPackagePrices, SeasonPicker, type SeasonPickerOptions, type SeasonPrices, type SeasonPublicRefusalReason, type SeasonPublicSession, SeasonPublicSessionRefused, SeasonRecoveryTimeoutError, type SeasonRenewalIntent, type SeasonStatusEvent, SeatPicker, type SeatPickerBestAvailableOptions, type SeatPickerBuyerView, type SeatPickerBuyerViewOptions, type SeatPickerOptions, type SeatPickerPrewarmOptions, type SeatPickerPricing, type SeatPickerTheme, type SeatPickerWebMcpOptions, SeatingChart, type SeatingChartCallbackProp, type SeatingChartCallbacks, type SeatingChartHandle, type SeatingChartHandleMethod, type SeatingChartIdentityProp, type SeatingChartOptions, type SeatingChartSeatViewInfo, type SeatingChartValueProp, type SeatingChartValues, type SelectedObjectUnavailableEvent, type SelectedSeat, type StatusChange, type SubscribeTicket, ThemeMode, type TicketOfferAvailability, type TicketOfferPrice, type TicketOfferSummary, attachPickerFrame, bindSeatingChartHandle, buildSeatingChartOptions, createBuyerAccessContext, createControllerSink, parseTicketOfferAvailability, prewarmSeatPicker, shortOperationReference, ticketOfferPrices };
|
|
5656
|
+
export { ApiError, type AttachPickerFrameOptions, type AttendeeFieldMode, type BestAvailableResult, type BookingForm, type BookingFormFieldError, type BookingQuestion, type BookingQuestionType, BuyerAccessContext, type BuyerAccessExpiredEvent, type BuyerAccessRefreshReason, type BuyerAccessToken, type BuyerAccessTokenProvider, BuyerAccessUnavailableError, type BuyerAccessUnavailableEvent, type BuyerAccessUnavailableReason, BuyerRealtimeClient, type BuyerRealtimeOptions, type CheckoutAnswer, type CheckoutAttendee, type CheckoutHandoff, type CheckoutLineItem, type CheckoutSessionResult, EmbeddedDesigner, type EmbeddedDesignerEventType, type EmbeddedDesignerMessage, type EmbeddedDesignerOptions, type GAAreaAvailability, type GAPromptRequest, type GaPromptTier, type HoldConflict, type HoldLineItem, type HoldResult, type OrderStatusResult, type PaymentOptionsReason, type PaymentOptionsResult, type PaymentProviderName, type PerformanceGroupAvailability, type PerformanceGroupCheckoutHandoff, type PerformanceGroupDescriptor, PerformanceGroupDestroyedError, type PerformanceGroupHold, type PerformanceGroupHoldAllocation, type PerformanceGroupOperationEvent, type PerformanceGroupOperationState, PerformanceGroupPicker, type PerformanceGroupPickerOptions, type PerformanceGroupRecoveryState, type PerformanceGroupSeatAllocation, type PerformanceGroupSelectionMode, type PerformanceGroupStatusEvent, type Projection, type PubApiOptions, type RealtimeSink, type ResumedHoldResult, SEATING_CHART_CALLBACK_PROPS, SEATING_CHART_HANDLE_METHODS, SEATING_CHART_IDENTITY_PROPS, SEATING_CHART_VALUE_PROPS, type SaleState, SeasonApiError, type SeasonAudience, type SeasonAvailability, type SeasonBestAvailableOptions, type SeasonCategoryPrice, type SeasonCheckoutHandoff, type SeasonCheckoutMode, type SeasonCheckoutRequest, type SeasonCheckoutSession, type SeasonDescriptor, type SeasonOfferPresentation, type SeasonOperation, type SeasonOperationState, type SeasonPackagePrices, SeasonPicker, type SeasonPickerOptions, type SeasonPrices, type SeasonPublicRefusalReason, type SeasonPublicSession, SeasonPublicSessionRefused, SeasonRecoveryTimeoutError, type SeasonRenewalIntent, type SeasonStatusEvent, SeatPicker, type SeatPickerBestAvailableOptions, type SeatPickerBuyerView, type SeatPickerBuyerViewOptions, type SeatPickerOptions, type SeatPickerPrewarmOptions, type SeatPickerPricing, type SeatPickerTheme, type SeatPickerWebMcpOptions, SeatingChart, type SeatingChartCallbackProp, type SeatingChartCallbacks, type SeatingChartHandle, type SeatingChartHandleMethod, type SeatingChartIdentityProp, type SeatingChartOptions, type SeatingChartSeatViewInfo, type SeatingChartValueProp, type SeatingChartValues, type SelectedObjectUnavailableEvent, type SelectedSeat, type StatusChange, type SubscribeTicket, ThemeMode, type TicketKeyDetail, type TicketOfferAvailability, type TicketOfferPrice, type TicketOfferSummary, attachPickerFrame, bindSeatingChartHandle, buildSeatingChartOptions, createBuyerAccessContext, createControllerSink, parseTicketOfferAvailability, prewarmSeatPicker, shortOperationReference, ticketOfferPrices };
|
package/dist/index.d.ts
CHANGED
|
@@ -478,6 +478,78 @@ interface ControllerSinkOptions {
|
|
|
478
478
|
}
|
|
479
479
|
declare function createControllerSink(controller: PickerControllerLike, options?: ControllerSinkOptions): RealtimeSink;
|
|
480
480
|
|
|
481
|
+
/**
|
|
482
|
+
* The booking form inside the hosted-checkout card: a name, email or phone for
|
|
483
|
+
* each ticket, and the organizer's own questions, rendered from the
|
|
484
|
+
* `bookingForm` that `GET /pub/events/:key/payment-options` already carries.
|
|
485
|
+
*
|
|
486
|
+
* Built into the standalone `seatlayer-checkout.mjs` asset with the card, so it
|
|
487
|
+
* follows the card's rule: NO RUNTIME IMPORTS. Everything it needs — the ticket
|
|
488
|
+
* keys, the translator, the buyer's own details — arrives as arguments.
|
|
489
|
+
*
|
|
490
|
+
* The server is the authority on every rule below (`booking_form_incomplete`).
|
|
491
|
+
* These checks only exist so a buyer hears about a missing name next to the
|
|
492
|
+
* field, before a round trip, in the same words the refusal would map to.
|
|
493
|
+
*/
|
|
494
|
+
/** Organizer setting for one attendee detail. */
|
|
495
|
+
type AttendeeFieldMode = 'off' | 'optional' | 'required';
|
|
496
|
+
type BookingQuestionType = 'text' | 'textarea' | 'number' | 'select' | 'multiselect' | 'checkbox' | 'date' | 'email' | 'phone';
|
|
497
|
+
interface BookingQuestionOption {
|
|
498
|
+
id: string;
|
|
499
|
+
label: string;
|
|
500
|
+
}
|
|
501
|
+
/** One organizer question. Public payloads carry active questions only. */
|
|
502
|
+
interface BookingQuestion {
|
|
503
|
+
id: string;
|
|
504
|
+
position: number;
|
|
505
|
+
label: string;
|
|
506
|
+
helpText: string | null;
|
|
507
|
+
type: BookingQuestionType;
|
|
508
|
+
/** Present for `select` and `multiselect`. */
|
|
509
|
+
options: BookingQuestionOption[] | null;
|
|
510
|
+
required: boolean;
|
|
511
|
+
/** `order` is asked once per booking; `ticket` inside every ticket's block. */
|
|
512
|
+
scope: 'order' | 'ticket';
|
|
513
|
+
/** Who later sees the answer. Staff-only questions are still asked. */
|
|
514
|
+
visibility: 'buyer' | 'staff';
|
|
515
|
+
archived: boolean;
|
|
516
|
+
/** Organizer reads only. */
|
|
517
|
+
hasAnswers?: boolean;
|
|
518
|
+
}
|
|
519
|
+
/** What `payment-options` says the checkout must ask. */
|
|
520
|
+
interface BookingForm {
|
|
521
|
+
attendeeName: AttendeeFieldMode;
|
|
522
|
+
attendeeEmail: AttendeeFieldMode;
|
|
523
|
+
attendeePhone: AttendeeFieldMode;
|
|
524
|
+
questions: BookingQuestion[];
|
|
525
|
+
/** Organizer reads only. */
|
|
526
|
+
revision?: number;
|
|
527
|
+
}
|
|
528
|
+
/** One ticket's attendee, keyed by the server's ticket key. */
|
|
529
|
+
interface CheckoutAttendee {
|
|
530
|
+
ticketKey: string;
|
|
531
|
+
name?: string;
|
|
532
|
+
email?: string;
|
|
533
|
+
phone?: string;
|
|
534
|
+
}
|
|
535
|
+
type CheckoutAnswerValue = string | number | boolean | string[];
|
|
536
|
+
/** One answer. `ticketKey` is set for ticket-scope questions only. */
|
|
537
|
+
interface CheckoutAnswer {
|
|
538
|
+
questionId: string;
|
|
539
|
+
ticketKey?: string;
|
|
540
|
+
value: CheckoutAnswerValue;
|
|
541
|
+
}
|
|
542
|
+
type BookingFieldErrorCode = 'required' | 'invalid' | 'too_long';
|
|
543
|
+
/**
|
|
544
|
+
* One field the server refused (`422 booking_form_incomplete`). `key` is
|
|
545
|
+
* `attendeeName` | `attendeeEmail` | `attendeePhone` | `question:<id>`.
|
|
546
|
+
*/
|
|
547
|
+
interface BookingFormFieldError {
|
|
548
|
+
key: string;
|
|
549
|
+
ticketKey?: string;
|
|
550
|
+
code: BookingFieldErrorCode;
|
|
551
|
+
}
|
|
552
|
+
|
|
481
553
|
/**
|
|
482
554
|
* Minimal client for the browser embed surface of workers/api (the `/pub/*`
|
|
483
555
|
* routes). Platform events bind this client to a buyer access context; Managed
|
|
@@ -516,14 +588,26 @@ declare class ApiError extends Error {
|
|
|
516
588
|
/** Present when best-available 409s ('not_enough_together' | 'sold_out'). */
|
|
517
589
|
reason?: string;
|
|
518
590
|
/**
|
|
519
|
-
* Seconds the server asked the caller to wait, off a 429's
|
|
591
|
+
* Seconds the server asked the caller to wait, off a 429's or a 503's
|
|
592
|
+
* `Retry-After`.
|
|
520
593
|
*
|
|
521
|
-
* Present ONLY on a rate-limit error, and it is the server's
|
|
522
|
-
* guess. A widget that catches this can say "try again in
|
|
523
|
-
* of rendering the blank map a swallowed 429 used to
|
|
594
|
+
* Present ONLY on a rate-limit or maintenance error, and it is the server's
|
|
595
|
+
* number — never a guess. A widget that catches this can say "try again in
|
|
596
|
+
* N minutes" instead of rendering the blank map a swallowed 429 used to
|
|
597
|
+
* produce, or the "seats were just taken" a maintenance 503 used to become.
|
|
524
598
|
*/
|
|
525
599
|
retryAfterS?: number;
|
|
526
|
-
|
|
600
|
+
/**
|
|
601
|
+
* Operator-written buyer copy that arrived with a maintenance 503 (the API's
|
|
602
|
+
* `notice`). Shown verbatim when present; absent, the widget uses its own
|
|
603
|
+
* localised wording built from `retryAfterS`.
|
|
604
|
+
*/
|
|
605
|
+
notice?: string;
|
|
606
|
+
/** `422 booking_form_incomplete`: the fields the server refused, for inline errors. */
|
|
607
|
+
fields?: BookingFormFieldError[];
|
|
608
|
+
constructor(status: number, message: string, code?: string, conflicts?: HoldConflict[], reason?: string, retryAfterS?: number, notice?: string, details?: {
|
|
609
|
+
fields?: BookingFormFieldError[];
|
|
610
|
+
});
|
|
527
611
|
}
|
|
528
612
|
interface HoldResult {
|
|
529
613
|
holdId: string;
|
|
@@ -531,6 +615,35 @@ interface HoldResult {
|
|
|
531
615
|
/** The held seats with the buyer's chosen ticket tier per seat (present on hold). */
|
|
532
616
|
seats?: PickerSeat[];
|
|
533
617
|
items?: HoldLineItem[];
|
|
618
|
+
/**
|
|
619
|
+
* One key per guest this hold admits, in issuance order: a seat, booth or
|
|
620
|
+
* individually sold chair is its label; a general-admission place (its own
|
|
621
|
+
* inventory unit) is `"<label>#1"`; a whole table admitting q places is
|
|
622
|
+
* `"<label>#1"` … `"<label>#q"`. The booking form keys attendees and ticket
|
|
623
|
+
* answers by it. Keys and GA unit labels are internal: never show them.
|
|
624
|
+
* Absent from older servers.
|
|
625
|
+
*/
|
|
626
|
+
ticketKeys?: string[];
|
|
627
|
+
/** Per key: its label, and which guest of how many it is. */
|
|
628
|
+
ticketKeyDetails?: TicketKeyDetail[];
|
|
629
|
+
/**
|
|
630
|
+
* True when the server answered a retried hold attempt with the hold that
|
|
631
|
+
* attempt already created. Same `holdId` and `expiresAt`; `items` come back
|
|
632
|
+
* sorted by label with their committed prices.
|
|
633
|
+
*/
|
|
634
|
+
replayed?: boolean;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* One guest's ticket key. `label` is the inventory label and may be internal
|
|
638
|
+
* (a GA place); `displayLabel` is what a buyer may see. `unitIndex` and
|
|
639
|
+
* `quantity` number the guests of one ticket admitting several places.
|
|
640
|
+
*/
|
|
641
|
+
interface TicketKeyDetail {
|
|
642
|
+
ticketKey: string;
|
|
643
|
+
label: string;
|
|
644
|
+
unitIndex: number;
|
|
645
|
+
quantity: number;
|
|
646
|
+
displayLabel?: string;
|
|
534
647
|
}
|
|
535
648
|
/** Browser-safe active-hold projection returned by the resume endpoint. */
|
|
536
649
|
interface ResumedHoldResult extends HoldResult {
|
|
@@ -544,6 +657,10 @@ interface BestAvailableResult {
|
|
|
544
657
|
seats?: PickerSeat[];
|
|
545
658
|
items?: HoldResult['items'];
|
|
546
659
|
zoneId?: string;
|
|
660
|
+
/** See {@link HoldResult.ticketKeys}. */
|
|
661
|
+
ticketKeys?: string[];
|
|
662
|
+
/** See {@link HoldResult.ticketKeyDetails}. */
|
|
663
|
+
ticketKeyDetails?: TicketKeyDetail[];
|
|
547
664
|
}
|
|
548
665
|
/** A gateway the organizer can be connected to. */
|
|
549
666
|
type PaymentProviderName = 'stripe' | 'razorpay';
|
|
@@ -570,6 +687,14 @@ interface PaymentOptionsResult {
|
|
|
570
687
|
providers: PaymentProviderName[];
|
|
571
688
|
currency: string | null;
|
|
572
689
|
reason?: PaymentOptionsReason | null;
|
|
690
|
+
/**
|
|
691
|
+
* Whether the event charges. `'free'` comes with an empty `providers` list
|
|
692
|
+
* and `reason: null`: nothing is missing, the booking simply has no payment
|
|
693
|
+
* step. Absent from older servers, which only ever meant `'paid'`.
|
|
694
|
+
*/
|
|
695
|
+
bookingMode?: 'paid' | 'free';
|
|
696
|
+
/** What hosted checkout must ask: attendee details and active questions. */
|
|
697
|
+
bookingForm?: BookingForm | null;
|
|
573
698
|
}
|
|
574
699
|
/** A started payment. Exactly one of the two handoffs comes back. */
|
|
575
700
|
interface CheckoutSessionResult {
|
|
@@ -581,6 +706,16 @@ interface CheckoutSessionResult {
|
|
|
581
706
|
redirectUrl?: string;
|
|
582
707
|
/** In-page modal gateway — open it without leaving the page. */
|
|
583
708
|
clientPayload?: Record<string, unknown>;
|
|
709
|
+
/**
|
|
710
|
+
* `'confirmed'` when the booking needed no payment (a free event, or a hold
|
|
711
|
+
* that sums to zero): the seats are already booked and the tickets issued,
|
|
712
|
+
* so there is no handoff to follow. Read the order's status for the receipt.
|
|
713
|
+
*/
|
|
714
|
+
status?: 'confirmed';
|
|
715
|
+
/** Buyer-facing order number, on a booking confirmed without payment. */
|
|
716
|
+
orderNumber?: string;
|
|
717
|
+
/** Hosted confirmation page path, on a booking confirmed without payment. */
|
|
718
|
+
confirmationUrl?: string;
|
|
584
719
|
}
|
|
585
720
|
/** An order's state while its gateway webhook is in flight. */
|
|
586
721
|
interface OrderStatusResult {
|
|
@@ -595,6 +730,8 @@ interface OrderStatusResult {
|
|
|
595
730
|
startsAt?: number | null;
|
|
596
731
|
tickets?: Array<{
|
|
597
732
|
label: string;
|
|
733
|
+
/** What a buyer may call the ticket; `label` can be an internal inventory label. */
|
|
734
|
+
displayLabel?: string | null;
|
|
598
735
|
token: string;
|
|
599
736
|
status: 'issued' | 'checked_in' | 'void';
|
|
600
737
|
checkedInAt: number | null;
|
|
@@ -3272,6 +3409,40 @@ interface WebMcpRegistration {
|
|
|
3272
3409
|
/** What `PickerController.render()` reports back about the loaded event. */
|
|
3273
3410
|
type PickerRenderInfo = NonNullable<Awaited<ReturnType<PickerController['render']>>>;
|
|
3274
3411
|
|
|
3412
|
+
/**
|
|
3413
|
+
* Hosted checkout — the payment step, as a module nobody downloads until a
|
|
3414
|
+
* buyer actually asks to pay.
|
|
3415
|
+
*
|
|
3416
|
+
* This is the whole of what `checkout: 'hosted'` adds to SeatPicker: a card
|
|
3417
|
+
* that collects an email, starts a payment against `POST /pub/events/:key/
|
|
3418
|
+
* checkout`, hands off to the gateway, and waits for the webhook to land. It is
|
|
3419
|
+
* a straight port of the panel our own buyer page has shipped since hosted
|
|
3420
|
+
* checkout existed (`src/pages/CheckoutPanel.tsx`), with React and the app's
|
|
3421
|
+
* shared api client taken out.
|
|
3422
|
+
*
|
|
3423
|
+
* IT IMPORTS NOTHING AT RUNTIME. Not `@seatlayer/core`, not `./api`, not even a
|
|
3424
|
+
* type from `./SeatPicker` — every input arrives through {@link CheckoutMount},
|
|
3425
|
+
* including the two API calls, which arrive as functions. That is not
|
|
3426
|
+
* fastidiousness: this file is built as a standalone CDN asset
|
|
3427
|
+
* (`seatlayer-checkout.mjs`), and a single value import from the engine would
|
|
3428
|
+
* pull a second copy of it into that asset and undo the point of splitting.
|
|
3429
|
+
* The one exception is `./hostedCheckoutForm`, the booking form, which lives
|
|
3430
|
+
* in that same asset under the same rule.
|
|
3431
|
+
*
|
|
3432
|
+
* Three states, one card, because they are the same moment in the buyer's
|
|
3433
|
+
* journey and share every pixel of chrome:
|
|
3434
|
+
*
|
|
3435
|
+
* pay a live hold — collect an email and START a payment
|
|
3436
|
+
* resume back from a hosted gateway page — the hold and its line items
|
|
3437
|
+
* are gone with the old document, so this can only WAIT on the
|
|
3438
|
+
* order id restored from tab storage. It must never offer
|
|
3439
|
+
* to start a second payment for a purchase that may have already
|
|
3440
|
+
* succeeded.
|
|
3441
|
+
* unavailable the event cannot take money here, and the buyer is holding
|
|
3442
|
+
* seats. Say which of the three reasons it is, because two of
|
|
3443
|
+
* them give opposite advice.
|
|
3444
|
+
*/
|
|
3445
|
+
|
|
3275
3446
|
/** What `GET /pub/orders/:id/status` returns while the webhook is in flight. */
|
|
3276
3447
|
interface CheckoutOrderStatus {
|
|
3277
3448
|
orderId: string;
|
|
@@ -3282,6 +3453,8 @@ interface CheckoutOrderStatus {
|
|
|
3282
3453
|
seatCount: number;
|
|
3283
3454
|
tickets?: Array<{
|
|
3284
3455
|
label: string;
|
|
3456
|
+
/** What a buyer may call the ticket; the inventory label can be internal. */
|
|
3457
|
+
displayLabel?: string | null;
|
|
3285
3458
|
token: string;
|
|
3286
3459
|
status: 'issued' | 'checked_in' | 'void';
|
|
3287
3460
|
checkedInAt: number | null;
|
|
@@ -5480,4 +5653,4 @@ interface AttachPickerFrameOptions {
|
|
|
5480
5653
|
*/
|
|
5481
5654
|
declare function attachPickerFrame(iframe: HTMLIFrameElement, opts?: AttachPickerFrameOptions): () => void;
|
|
5482
5655
|
|
|
5483
|
-
export { ApiError, type AttachPickerFrameOptions, type BestAvailableResult, BuyerAccessContext, type BuyerAccessExpiredEvent, type BuyerAccessRefreshReason, type BuyerAccessToken, type BuyerAccessTokenProvider, BuyerAccessUnavailableError, type BuyerAccessUnavailableEvent, type BuyerAccessUnavailableReason, BuyerRealtimeClient, type BuyerRealtimeOptions, type CheckoutHandoff, type CheckoutLineItem, type CheckoutSessionResult, EmbeddedDesigner, type EmbeddedDesignerEventType, type EmbeddedDesignerMessage, type EmbeddedDesignerOptions, type GAAreaAvailability, type GAPromptRequest, type GaPromptTier, type HoldConflict, type HoldLineItem, type HoldResult, type OrderStatusResult, type PaymentOptionsReason, type PaymentOptionsResult, type PaymentProviderName, type PerformanceGroupAvailability, type PerformanceGroupCheckoutHandoff, type PerformanceGroupDescriptor, PerformanceGroupDestroyedError, type PerformanceGroupHold, type PerformanceGroupHoldAllocation, type PerformanceGroupOperationEvent, type PerformanceGroupOperationState, PerformanceGroupPicker, type PerformanceGroupPickerOptions, type PerformanceGroupRecoveryState, type PerformanceGroupSeatAllocation, type PerformanceGroupSelectionMode, type PerformanceGroupStatusEvent, type Projection, type PubApiOptions, type RealtimeSink, type ResumedHoldResult, SEATING_CHART_CALLBACK_PROPS, SEATING_CHART_HANDLE_METHODS, SEATING_CHART_IDENTITY_PROPS, SEATING_CHART_VALUE_PROPS, type SaleState, SeasonApiError, type SeasonAudience, type SeasonAvailability, type SeasonBestAvailableOptions, type SeasonCategoryPrice, type SeasonCheckoutHandoff, type SeasonCheckoutMode, type SeasonCheckoutRequest, type SeasonCheckoutSession, type SeasonDescriptor, type SeasonOfferPresentation, type SeasonOperation, type SeasonOperationState, type SeasonPackagePrices, SeasonPicker, type SeasonPickerOptions, type SeasonPrices, type SeasonPublicRefusalReason, type SeasonPublicSession, SeasonPublicSessionRefused, SeasonRecoveryTimeoutError, type SeasonRenewalIntent, type SeasonStatusEvent, SeatPicker, type SeatPickerBestAvailableOptions, type SeatPickerBuyerView, type SeatPickerBuyerViewOptions, type SeatPickerOptions, type SeatPickerPrewarmOptions, type SeatPickerPricing, type SeatPickerTheme, type SeatPickerWebMcpOptions, SeatingChart, type SeatingChartCallbackProp, type SeatingChartCallbacks, type SeatingChartHandle, type SeatingChartHandleMethod, type SeatingChartIdentityProp, type SeatingChartOptions, type SeatingChartSeatViewInfo, type SeatingChartValueProp, type SeatingChartValues, type SelectedObjectUnavailableEvent, type SelectedSeat, type StatusChange, type SubscribeTicket, ThemeMode, type TicketOfferAvailability, type TicketOfferPrice, type TicketOfferSummary, attachPickerFrame, bindSeatingChartHandle, buildSeatingChartOptions, createBuyerAccessContext, createControllerSink, parseTicketOfferAvailability, prewarmSeatPicker, shortOperationReference, ticketOfferPrices };
|
|
5656
|
+
export { ApiError, type AttachPickerFrameOptions, type AttendeeFieldMode, type BestAvailableResult, type BookingForm, type BookingFormFieldError, type BookingQuestion, type BookingQuestionType, BuyerAccessContext, type BuyerAccessExpiredEvent, type BuyerAccessRefreshReason, type BuyerAccessToken, type BuyerAccessTokenProvider, BuyerAccessUnavailableError, type BuyerAccessUnavailableEvent, type BuyerAccessUnavailableReason, BuyerRealtimeClient, type BuyerRealtimeOptions, type CheckoutAnswer, type CheckoutAttendee, type CheckoutHandoff, type CheckoutLineItem, type CheckoutSessionResult, EmbeddedDesigner, type EmbeddedDesignerEventType, type EmbeddedDesignerMessage, type EmbeddedDesignerOptions, type GAAreaAvailability, type GAPromptRequest, type GaPromptTier, type HoldConflict, type HoldLineItem, type HoldResult, type OrderStatusResult, type PaymentOptionsReason, type PaymentOptionsResult, type PaymentProviderName, type PerformanceGroupAvailability, type PerformanceGroupCheckoutHandoff, type PerformanceGroupDescriptor, PerformanceGroupDestroyedError, type PerformanceGroupHold, type PerformanceGroupHoldAllocation, type PerformanceGroupOperationEvent, type PerformanceGroupOperationState, PerformanceGroupPicker, type PerformanceGroupPickerOptions, type PerformanceGroupRecoveryState, type PerformanceGroupSeatAllocation, type PerformanceGroupSelectionMode, type PerformanceGroupStatusEvent, type Projection, type PubApiOptions, type RealtimeSink, type ResumedHoldResult, SEATING_CHART_CALLBACK_PROPS, SEATING_CHART_HANDLE_METHODS, SEATING_CHART_IDENTITY_PROPS, SEATING_CHART_VALUE_PROPS, type SaleState, SeasonApiError, type SeasonAudience, type SeasonAvailability, type SeasonBestAvailableOptions, type SeasonCategoryPrice, type SeasonCheckoutHandoff, type SeasonCheckoutMode, type SeasonCheckoutRequest, type SeasonCheckoutSession, type SeasonDescriptor, type SeasonOfferPresentation, type SeasonOperation, type SeasonOperationState, type SeasonPackagePrices, SeasonPicker, type SeasonPickerOptions, type SeasonPrices, type SeasonPublicRefusalReason, type SeasonPublicSession, SeasonPublicSessionRefused, SeasonRecoveryTimeoutError, type SeasonRenewalIntent, type SeasonStatusEvent, SeatPicker, type SeatPickerBestAvailableOptions, type SeatPickerBuyerView, type SeatPickerBuyerViewOptions, type SeatPickerOptions, type SeatPickerPrewarmOptions, type SeatPickerPricing, type SeatPickerTheme, type SeatPickerWebMcpOptions, SeatingChart, type SeatingChartCallbackProp, type SeatingChartCallbacks, type SeatingChartHandle, type SeatingChartHandleMethod, type SeatingChartIdentityProp, type SeatingChartOptions, type SeatingChartSeatViewInfo, type SeatingChartValueProp, type SeatingChartValues, type SelectedObjectUnavailableEvent, type SelectedSeat, type StatusChange, type SubscribeTicket, ThemeMode, type TicketKeyDetail, type TicketOfferAvailability, type TicketOfferPrice, type TicketOfferSummary, attachPickerFrame, bindSeatingChartHandle, buildSeatingChartOptions, createBuyerAccessContext, createControllerSink, parseTicketOfferAvailability, prewarmSeatPicker, shortOperationReference, ticketOfferPrices };
|