@seatlayer/js 0.80.2 → 0.81.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/index.d.ts CHANGED
@@ -89,7 +89,24 @@ type BuyerAccessUnavailableReason =
89
89
  /** The host's token provider threw or returned nothing usable. */
90
90
  | 'provider_failed'
91
91
  /** A one-shot `buyerAccessToken` lapsed and no provider was configured. */
92
- | 'no_token';
92
+ | 'no_token'
93
+ /**
94
+ * 403 `audience_not_public`: this Season is embed-only, so an anonymous
95
+ * browser session cannot be minted for it. The organizer has to open the
96
+ * Season to the public before a tokenless embed can sell it.
97
+ */
98
+ | 'audience_not_public'
99
+ /**
100
+ * 403 `sales_not_open`: the Season exists and is public, but its sales state
101
+ * is not open yet (or is paused, or has ended). Nothing is misconfigured and
102
+ * the same request may succeed later, so this one is retryable.
103
+ */
104
+ | 'sales_not_open'
105
+ /**
106
+ * 403 `origin_not_allowed`: the browser's Origin is not among the embed
107
+ * domains the organizer declared for this Season's account.
108
+ */
109
+ | 'origin_not_allowed';
93
110
  /** The access session expired. Carries whether the refresh recovered it. */
94
111
  interface BuyerAccessExpiredEvent {
95
112
  reason: BuyerAccessRefreshReason;
@@ -1108,9 +1125,9 @@ interface SeatPickerOptions {
1108
1125
  */
1109
1126
  referral?: string;
1110
1127
  /**
1111
- * Hide the "Powered by SeatLayer" attribution badge in the side panel foot.
1112
- * The chart theme's own `hideBadge` flag (paid orgs) also hides it — the badge
1113
- * is shown only when BOTH this option and the theme flag are unset/false.
1128
+ * @deprecated No effect since 0.81: the badge follows the account's
1129
+ * white-label entitlement, which the server applies to the served chart.
1130
+ * Accepted and ignored so existing embeds keep type-checking.
1114
1131
  */
1115
1132
  hideBadge?: boolean;
1116
1133
  /**
@@ -1747,7 +1764,11 @@ interface SeatingChartOptions {
1747
1764
  seatTooltip?: boolean;
1748
1765
  /** Internal hosted-runtime control. Defaults true for direct web embeds. */
1749
1766
  showTestModeIndicator?: boolean;
1750
- /** Internal hosted-runtime control. Defaults true, subject to white-label entitlement. */
1767
+ /**
1768
+ * @deprecated No effect since 0.81: the badge follows the account's
1769
+ * white-label entitlement, which the server applies to the served chart.
1770
+ * Accepted and ignored.
1771
+ */
1751
1772
  showAttribution?: boolean;
1752
1773
  /**
1753
1774
  * Seat hover with everything a popover needs (category label/color, resolved
@@ -3222,6 +3243,26 @@ interface WebMcpRegistration {
3222
3243
  /** What `PickerController.render()` reports back about the loaded event. */
3223
3244
  type PickerRenderInfo = NonNullable<Awaited<ReturnType<PickerController['render']>>>;
3224
3245
 
3246
+ /** What `GET /pub/orders/:id/status` returns while the webhook is in flight. */
3247
+ interface CheckoutOrderStatus {
3248
+ orderId: string;
3249
+ status: string;
3250
+ totalMinor: number;
3251
+ currency: string;
3252
+ amountFormatted: string;
3253
+ seatCount: number;
3254
+ tickets?: Array<{
3255
+ label: string;
3256
+ token: string;
3257
+ status: 'issued' | 'checked_in' | 'void';
3258
+ checkedInAt: number | null;
3259
+ }>;
3260
+ /** Hosted ticket page — the durable re-entry point after the card closes. */
3261
+ ticketUrl?: string;
3262
+ /** Printable A4 PDF, up to three ticket cards per page. */
3263
+ pdfUrl?: string;
3264
+ }
3265
+
3225
3266
  declare class SeatPicker implements GaPromptPicker {
3226
3267
  /** @internal Read by pickerGaPrompt for the `onGAPrompt` host hook. */
3227
3268
  readonly opts: SeatPickerOptions;
@@ -3320,6 +3361,8 @@ declare class SeatPicker implements GaPromptPicker {
3320
3361
  private bookedEl;
3321
3362
  /** The blocking "your seats were released" dialog, while it is up. */
3322
3363
  private holdExpiredEl;
3364
+ /** True once the dialog's own availability read has landed; Start again then pulses off it. */
3365
+ private holdExpiredFresh;
3323
3366
  /** What that hold actually held, captured before the state was cleared. */
3324
3367
  private holdExpiredUnits;
3325
3368
  /** @internal Pending GA units per (area, tier) — see pickerGaPrompt.ts. */
@@ -3368,15 +3411,6 @@ declare class SeatPicker implements GaPromptPicker {
3368
3411
  private baZone;
3369
3412
  /** "★ Best seats" premium quick-pick toggle — biases best-available to premium seats. */
3370
3413
  private baPremium;
3371
- /**
3372
- * The buyer re-opened the best-seats form with seats already in the cart
3373
- * ("I picked one, actually find us three together"). The card normally
3374
- * yields this space to the ticket chips the moment anything is selected —
3375
- * which removed the accelerator at exactly the moment a one-handed phone
3376
- * buyer wants it. Cleared when the cart empties, a hold lands, or the
3377
- * buyer backs out.
3378
- */
3379
- private baReopen;
3380
3414
  private bestAvailableConfirm;
3381
3415
  /** Event sales window is closed (read-only load state / live close). */
3382
3416
  /** @internal */ salesClosed: boolean;
@@ -3686,7 +3720,15 @@ declare class SeatPicker implements GaPromptPicker {
3686
3720
  */
3687
3721
  private setSalesClosed;
3688
3722
  private applySalesClosed;
3689
- /** The badge is hidden when the host opts out OR the org's theme sets hideBadge. */
3723
+ /**
3724
+ * The badge follows the SERVED chart theme, and nothing else.
3725
+ *
3726
+ * The API writes `theme.hideBadge` from the owning account's white-label
3727
+ * entitlement on every buyer-facing document, so this one flag is the whole
3728
+ * answer. The host's own `hideBadge` option is deliberately NOT consulted:
3729
+ * an un-entitled embed could otherwise strip the attribution by passing a
3730
+ * boolean. It stays in the option type for compatibility, inert.
3731
+ */
3690
3732
  private badgeHidden;
3691
3733
  /** Attribution badge in the side-panel foot (Gap 7). Hidden per host/theme. */
3692
3734
  private buildBadge;
@@ -4365,6 +4407,13 @@ declare class SeatPicker implements GaPromptPicker {
4365
4407
  * stale, so the picker stops until they have acknowledged it.
4366
4408
  */
4367
4409
  private showHoldExpired;
4410
+ /**
4411
+ * "Select them again": the seats the refresh still calls free go straight
4412
+ * back into a new hold, through the same path the tab-regain note uses —
4413
+ * select, then the CTA, which secures and hands off exactly as a first
4414
+ * pick would. The dialog's other state goes the way Start again takes it.
4415
+ */
4416
+ private recoverAfterHoldExpiry;
4368
4417
  private dismissHoldExpired;
4369
4418
  /**
4370
4419
  * "Start again": put the picker back to the state it would have been in had
@@ -4789,6 +4838,24 @@ declare class PerformanceGroupPicker {
4789
4838
  }
4790
4839
 
4791
4840
  type SeasonOperationState = 'preparing' | 'commit_pending' | 'committed' | 'expire_pending' | 'booking_pending' | 'abort_pending' | 'aborted' | 'partial_terminal' | 'expired' | 'booked';
4841
+ /**
4842
+ * Who may open this Season in a browser.
4843
+ *
4844
+ * `public` is the only value an anonymous, tokenless embed can mint a session
4845
+ * for; every other value needs a bearer minted by the organizer's own backend.
4846
+ */
4847
+ type SeasonAudience = 'private' | 'embed_only' | 'discoverable' | 'public';
4848
+ /**
4849
+ * Who takes the buyer's money.
4850
+ *
4851
+ * 'seatlayer' the Season is sold through SeatLayer's hosted checkout, so the
4852
+ * widget may run `checkout: 'hosted'` end to end.
4853
+ * 'server' the organizer's own backend prices and charges the package;
4854
+ * the widget hands off and never asks for money.
4855
+ * null the organizer has not chosen yet (or the worker predates the
4856
+ * field), which reads exactly like `'server'`.
4857
+ */
4858
+ type SeasonCheckoutMode = 'seatlayer' | 'server';
4792
4859
  interface SeasonDescriptor {
4793
4860
  key: string;
4794
4861
  name: string;
@@ -4797,7 +4864,9 @@ interface SeasonDescriptor {
4797
4864
  currency: string;
4798
4865
  venue: string;
4799
4866
  timezone: string | null;
4800
- audience: 'private' | 'embed_only' | 'discoverable';
4867
+ audience: SeasonAudience;
4868
+ /** Absent on a worker that predates hosted Season checkout; read as `null`. */
4869
+ checkoutMode?: SeasonCheckoutMode | null;
4801
4870
  planActivationId: string;
4802
4871
  occurrenceCount: number;
4803
4872
  occurrences: Array<{
@@ -4848,6 +4917,56 @@ interface SeasonCheckoutHandoff {
4848
4917
  state: string;
4849
4918
  }>;
4850
4919
  }
4920
+ /**
4921
+ * One category's package price, for one package.
4922
+ *
4923
+ * `unitPrice` is an integer in the currency's MINOR unit, like every other
4924
+ * money field the API returns, and it is the price of the whole package for one
4925
+ * seat — not a per-performance price. Rendering divides by the currency's own
4926
+ * exponent (`fromMinorUnits`), never by a hardcoded 100.
4927
+ */
4928
+ interface SeasonCategoryPrice {
4929
+ categoryKey: string;
4930
+ unitPrice: number;
4931
+ }
4932
+ interface SeasonPackagePrices {
4933
+ planKey: string;
4934
+ name: string;
4935
+ prices: SeasonCategoryPrice[];
4936
+ }
4937
+ /**
4938
+ * Server-authored package prices for this Season.
4939
+ *
4940
+ * When this is present it OUTRANKS the host-authored `offer` copy: the server
4941
+ * is the only party that can price what the buyer will actually be charged, so
4942
+ * a display-only `priceLabel` must never sit in front of it.
4943
+ */
4944
+ interface SeasonPrices {
4945
+ currency: string;
4946
+ packages: SeasonPackagePrices[];
4947
+ }
4948
+ /**
4949
+ * A started Season payment. Identical in shape to the Event hosted checkout's
4950
+ * response (`POST /pub/events/:key/checkout`) so the same card, the same
4951
+ * gateway handoff and the same order polling serve both.
4952
+ */
4953
+ interface SeasonCheckoutSession {
4954
+ orderId: string;
4955
+ totalMinor: number;
4956
+ currency: string;
4957
+ expiresAt: number;
4958
+ /** Hosted gateway page — navigate to it. */
4959
+ redirectUrl?: string;
4960
+ /** In-page modal gateway — open it without leaving the page. */
4961
+ clientPayload?: Record<string, unknown>;
4962
+ }
4963
+ interface SeasonCheckoutRequest {
4964
+ operationId: string;
4965
+ buyerEmail: string;
4966
+ buyerName?: string;
4967
+ provider?: string;
4968
+ returnUrl?: string;
4969
+ }
4851
4970
  interface SeasonRenewalIntent {
4852
4971
  offerId: string;
4853
4972
  state: 'intent_received';
@@ -4891,6 +5010,43 @@ interface SeasonPickerOptions {
4891
5010
  container: string | HTMLElement;
4892
5011
  season: string;
4893
5012
  apiBase?: string;
5013
+ /**
5014
+ * Publishable account key (`pk_live_…` / `pk_test_…`), accepted for parity
5015
+ * with `SeatPicker`'s `publicKey` so one embed snippet shape covers
5016
+ * Events and Seasons.
5017
+ *
5018
+ * It is NOT sent to the server and is not a credential: a public Season
5019
+ * session is authorized by the Season key plus the browser's registered
5020
+ * Origin. Supply it to name the account in your own source; omit it and a
5021
+ * tokenless picker behaves identically.
5022
+ */
5023
+ publicKey?: string;
5024
+ /**
5025
+ * WHO TAKES THE MONEY once the package is held. Default `'handoff'`.
5026
+ *
5027
+ * 'handoff' (default, and every Season integration that has ever existed)
5028
+ * {@link onContinue} fires with the opaque, price-free handoff
5029
+ * and YOUR server prices, charges and books it. Nothing about
5030
+ * this path changes and no payment code is downloaded.
5031
+ * 'hosted' the widget collects an email and takes the money through the
5032
+ * gateway the ORGANIZER connected, on their account, against
5033
+ * `POST /pub/seasons/:key/checkout`. One order, one ticket per
5034
+ * performance. {@link onContinue} still fires, so a host that
5035
+ * only wants to observe the moment keeps working.
5036
+ *
5037
+ * A Season the organizer priced on their own backend reports
5038
+ * `checkoutMode: 'server'`; asking for `'hosted'` there stays on `'handoff'`
5039
+ * rather than starting a payment SeatLayer cannot complete.
5040
+ */
5041
+ checkout?: 'handoff' | 'hosted';
5042
+ /**
5043
+ * Where a redirecting gateway sends the buyer back to, for
5044
+ * `checkout: 'hosted'`. Same rules as the Event picker's `returnUrl`: the
5045
+ * server keeps the path and query, adds only `seatlayer_checkout=…`, and
5046
+ * ignores an origin the organizer has not declared — so supplying a URL
5047
+ * cannot authorize it.
5048
+ */
5049
+ returnUrl?: string;
4894
5050
  buyerAccessTokenProvider?: BuyerAccessTokenProvider;
4895
5051
  buyerAccessToken?: string | BuyerAccessToken;
4896
5052
  initialOperationId?: string;
@@ -4927,7 +5083,21 @@ interface SeasonPickerOptions {
4927
5083
  onHoldExpired?: () => void;
4928
5084
  onRenewalIntent?: (intent: SeasonRenewalIntent) => void;
4929
5085
  onAccessExpired?: (event: BuyerAccessExpiredEvent) => void;
5086
+ /**
5087
+ * Private inventory is unavailable, and refreshing will not fix it.
5088
+ *
5089
+ * A tokenless public embed reports the server's three Season refusals here
5090
+ * with their own reasons — `audience_not_public`, `sales_not_open`,
5091
+ * `origin_not_allowed` — rather than collapsing them into `provider_failed`,
5092
+ * because the three call for three different answers from the organizer.
5093
+ */
4930
5094
  onAccessUnavailable?: (event: BuyerAccessUnavailableEvent) => void;
5095
+ /**
5096
+ * `checkout: 'hosted'` only — the gateway's webhook landed and the Season
5097
+ * order is PAID. The one signal a host with no backend of its own can build
5098
+ * a receipt from.
5099
+ */
5100
+ onOrderConfirmed?: (order: CheckoutOrderStatus) => void;
4931
5101
  onStatusChange?: (event: SeasonStatusEvent) => void;
4932
5102
  onError?: (error: unknown) => void;
4933
5103
  }
@@ -4946,6 +5116,50 @@ declare class SeasonPicker {
4946
5116
  destroy(): void;
4947
5117
  }
4948
5118
 
5119
+ /**
5120
+ * The anonymous Season buyer session — how a page with no backend at all can
5121
+ * put a Season on sale.
5122
+ *
5123
+ * Until now every `SeasonPicker` needed a `bss_` bearer minted by the
5124
+ * organizer's own server with their secret key, which meant only a developer
5125
+ * could embed a Season. `POST /pub/seasons/:key/sessions` removes that step: it
5126
+ * takes no credential, checks the Season is public, its sales are open and the
5127
+ * browser's Origin is one the organizer declared, and hands back an ordinary
5128
+ * Season buyer bearer. Every existing `/pub/seasons/:key/*` call then works
5129
+ * unchanged — this module mints and renews the bearer and does nothing else.
5130
+ *
5131
+ * A publishable `pk_…` key is NOT sent here. It is accepted by the picker for
5132
+ * parity with `SeatPicker` (one snippet shape across surfaces) and to name the
5133
+ * account in a host's own source, but the Season key plus the registered Origin
5134
+ * are what the server actually verifies, so putting a key on the wire would add
5135
+ * a value to leak without adding a check.
5136
+ *
5137
+ * WHAT MAKES THIS SAFE TO BE ANONYMOUS: the session it mints is Public-sale
5138
+ * only. It can never select a private channel or a renewal allocation — that
5139
+ * still needs `buyerAccessTokenProvider` with the organizer's own scope — and
5140
+ * an explicit host token always takes precedence over this path.
5141
+ */
5142
+
5143
+ /** The three ways the server refuses to mint an anonymous Season session. */
5144
+ type SeasonPublicRefusalReason = 'audience_not_public' | 'sales_not_open' | 'origin_not_allowed';
5145
+ /** What `POST /pub/seasons/:key/sessions` returns. */
5146
+ interface SeasonPublicSession {
5147
+ token: string;
5148
+ expiresAt: number;
5149
+ seasonKey: string;
5150
+ planActivationIds: string[];
5151
+ }
5152
+ /**
5153
+ * Thrown when the server refuses to mint. Carries the machine reason and
5154
+ * nothing else — no origin, no account, no audience detail — because the
5155
+ * refusal is reported to an anonymous browser.
5156
+ */
5157
+ declare class SeasonPublicSessionRefused extends Error {
5158
+ readonly reason: SeasonPublicRefusalReason;
5159
+ readonly status: number;
5160
+ constructor(reason: SeasonPublicRefusalReason, status: number);
5161
+ }
5162
+
4949
5163
  /**
4950
5164
  * Host-side helper for embedding the SeatLayer picker as an iframe.
4951
5165
  *
@@ -4986,4 +5200,4 @@ interface AttachPickerFrameOptions {
4986
5200
  */
4987
5201
  declare function attachPickerFrame(iframe: HTMLIFrameElement, opts?: AttachPickerFrameOptions): () => void;
4988
5202
 
4989
- 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 SeasonAvailability, type SeasonBestAvailableOptions, type SeasonCheckoutHandoff, type SeasonDescriptor, type SeasonOfferPresentation, type SeasonOperation, type SeasonOperationState, SeasonPicker, type SeasonPickerOptions, SeasonRecoveryTimeoutError, type SeasonRenewalIntent, type SeasonStatusEvent, SeatPicker, type SeatPickerBestAvailableOptions, type SeatPickerBuyerView, type SeatPickerBuyerViewOptions, type SeatPickerOptions, 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, shortOperationReference, ticketOfferPrices };
5203
+ 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 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, shortOperationReference, ticketOfferPrices };