@seatlayer/js 0.45.0 → 0.47.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/channelsMode-33ZLORVF.js +13 -0
- package/dist/channelsMode-33ZLORVF.js.map +1 -0
- package/dist/chunk-CF5MS7UR.js +2543 -0
- package/dist/chunk-CF5MS7UR.js.map +1 -0
- package/dist/chunk-DMEFXZIL.js +3198 -0
- package/dist/chunk-DMEFXZIL.js.map +1 -0
- package/dist/chunk-X2R4AQSZ.js +323 -0
- package/dist/chunk-X2R4AQSZ.js.map +1 -0
- package/dist/{hostedCheckout-PLHKPT6W.js → hostedCheckout-SHQCWN5Y.js} +27 -4
- package/dist/hostedCheckout-SHQCWN5Y.js.map +1 -0
- package/dist/index.cjs +9855 -9412
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +102 -1391
- package/dist/index.d.ts +102 -1391
- package/dist/index.js +417 -6003
- package/dist/index.js.map +1 -1
- package/dist/manager-CAIPkUYl.d.cts +1419 -0
- package/dist/manager-CAIPkUYl.d.ts +1419 -0
- package/dist/manager.cjs +6069 -0
- package/dist/manager.cjs.map +1 -0
- package/dist/manager.d.cts +2 -0
- package/dist/manager.d.ts +2 -0
- package/dist/manager.js +14 -0
- package/dist/manager.js.map +1 -0
- package/package.json +20 -2
- package/dist/hostedCheckout-PLHKPT6W.js.map +0 -1
|
@@ -0,0 +1,1419 @@
|
|
|
1
|
+
import { ChartDoc, AvailabilityRule, ChartTheme, ExpandedSeat } from '@seatlayer/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sales-channel planning — the pure, DOM-free half of Channels mode.
|
|
5
|
+
*
|
|
6
|
+
* Everything here is deterministic and testable without a canvas: the marker
|
|
7
|
+
* palette, the mixed-source selection summary, the LOCAL staged preview of an
|
|
8
|
+
* assignment, and the bucket rows the Review sheet renders.
|
|
9
|
+
*
|
|
10
|
+
* The local preview deliberately produces the SAME `AssignmentBuckets` shape the
|
|
11
|
+
* server returns from `POST /channels/assignments`. There is no dry-run endpoint,
|
|
12
|
+
* so the review sheet is drawn from this local computation and then REDRAWN from
|
|
13
|
+
* the authoritative server response after Apply. One renderer, two sources —
|
|
14
|
+
* which is why the shapes must match exactly.
|
|
15
|
+
*
|
|
16
|
+
* Spec: sales-channels-product-ux-spec §8.4–8.5.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Public sale is a built-in pseudo-channel. The server's sentinel for it is the
|
|
20
|
+
* literal string `'public'` — it is what `GET /channels` returns as
|
|
21
|
+
* `publicSale.id`, what `GET /channels/allocation` reports for an unallocated
|
|
22
|
+
* unit, and what `POST /channels/assignments` accepts (alongside `null`) as the
|
|
23
|
+
* target meaning "send these back to public sale".
|
|
24
|
+
*
|
|
25
|
+
* This constant was `''` until 2026-08-02, which silently made every public unit
|
|
26
|
+
* look like an unknown PRIVATE channel to `planAssignment` and `markerOf` — the
|
|
27
|
+
* cause of the Review sheet's phantom "moved out of another channel" line and
|
|
28
|
+
* the rail's "?" marker. Keep it byte-identical to the server's
|
|
29
|
+
* `eventChannels.PUBLIC_CHANNEL_ID`.
|
|
30
|
+
*/
|
|
31
|
+
declare const PUBLIC_CHANNEL_ID = "public";
|
|
32
|
+
declare const PUBLIC_CHANNEL_NAME = "Public sale";
|
|
33
|
+
/** True for every spelling of "public sale" a worker may hand us. */
|
|
34
|
+
declare function isPublicChannelId(id: string | null | undefined): boolean;
|
|
35
|
+
type ChannelState = 'active' | 'paused' | 'archived';
|
|
36
|
+
/** Physical inventory status, as the manage surface speaks it. */
|
|
37
|
+
type ChannelSeatStatus = 'free' | 'held' | 'booked' | 'blocked';
|
|
38
|
+
interface ChannelCounts {
|
|
39
|
+
allocated: number;
|
|
40
|
+
free: number;
|
|
41
|
+
held: number;
|
|
42
|
+
booked: number;
|
|
43
|
+
blocked: number;
|
|
44
|
+
units: number;
|
|
45
|
+
}
|
|
46
|
+
/** Buyer-access intents the server stores per channel. */
|
|
47
|
+
type ChannelAccessIntent = 'none' | 'internal' | 'server' | 'hosted_link';
|
|
48
|
+
/**
|
|
49
|
+
* Buyer-access summary on a channel row. Shipped by the access hardening branch
|
|
50
|
+
* (merged to app main). Still optional in this type: a worker that predates the
|
|
51
|
+
* merge simply omits it and the rail reads "—" rather than inventing a state.
|
|
52
|
+
*/
|
|
53
|
+
interface ChannelAccessSummary {
|
|
54
|
+
intent?: ChannelAccessIntent | string;
|
|
55
|
+
hasActiveGrants?: boolean;
|
|
56
|
+
lastMintAt?: number | null;
|
|
57
|
+
/** Free-text detail (partner host, who paused it) when the server offers one. */
|
|
58
|
+
detail?: string | null;
|
|
59
|
+
}
|
|
60
|
+
interface ChannelRecord {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
color: string | null;
|
|
64
|
+
marker: string | null;
|
|
65
|
+
externalRef: string | null;
|
|
66
|
+
state: ChannelState;
|
|
67
|
+
archiveDestination: string | null;
|
|
68
|
+
createdAt: number;
|
|
69
|
+
updatedAt: number;
|
|
70
|
+
archivedAt: number | null;
|
|
71
|
+
counts: ChannelCounts;
|
|
72
|
+
access?: ChannelAccessSummary | null;
|
|
73
|
+
}
|
|
74
|
+
interface PublicSaleChannel {
|
|
75
|
+
/** `'public'` on every shipped worker; typed loosely so an older build that
|
|
76
|
+
* still answers `''` is normalised rather than rejected. */
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
state: 'active';
|
|
80
|
+
counts: ChannelCounts;
|
|
81
|
+
access?: ChannelAccessSummary | null;
|
|
82
|
+
}
|
|
83
|
+
interface ChannelListResult {
|
|
84
|
+
assignmentVersion: number;
|
|
85
|
+
publicSale: PublicSaleChannel;
|
|
86
|
+
channels: ChannelRecord[];
|
|
87
|
+
}
|
|
88
|
+
interface AssignmentBucketCount {
|
|
89
|
+
count: number;
|
|
90
|
+
}
|
|
91
|
+
interface AssignmentSkippedBucket extends AssignmentBucketCount {
|
|
92
|
+
labels: string[];
|
|
93
|
+
truncated: boolean;
|
|
94
|
+
}
|
|
95
|
+
interface AssignmentBuckets {
|
|
96
|
+
changedFromPublic: AssignmentBucketCount;
|
|
97
|
+
movedFromOtherChannel: AssignmentBucketCount & {
|
|
98
|
+
channels: Array<{
|
|
99
|
+
channelId: string;
|
|
100
|
+
name: string | null;
|
|
101
|
+
count: number;
|
|
102
|
+
}>;
|
|
103
|
+
};
|
|
104
|
+
alreadyInTarget: AssignmentBucketCount;
|
|
105
|
+
skippedHeld: AssignmentSkippedBucket;
|
|
106
|
+
skippedBooked: AssignmentSkippedBucket;
|
|
107
|
+
/** Requested labels that are not inventory in this event. */
|
|
108
|
+
notFound: AssignmentSkippedBucket;
|
|
109
|
+
}
|
|
110
|
+
interface AssignmentResult {
|
|
111
|
+
ok: true;
|
|
112
|
+
targetChannelId: string;
|
|
113
|
+
assignmentVersion: number;
|
|
114
|
+
requested: number;
|
|
115
|
+
applied: number;
|
|
116
|
+
buckets: AssignmentBuckets;
|
|
117
|
+
}
|
|
118
|
+
interface ArchiveBlockedDetails {
|
|
119
|
+
activeHolds?: number;
|
|
120
|
+
heldUnits?: number;
|
|
121
|
+
latestHoldExpiresAt?: number | null;
|
|
122
|
+
retryAfterMs?: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Clamp any marker text down to the ONE uppercase character every surface draws.
|
|
126
|
+
*
|
|
127
|
+
* The server stores `marker` as free text (it only length-caps it), so a channel
|
|
128
|
+
* created outside this widget can carry "star" or "VIP". The comp's marker chip
|
|
129
|
+
* is a single glyph: taking two characters ("ST") overflows the 22px chip and
|
|
130
|
+
* stops reading as a letter. Non-letter leading characters (an emoji, a digit,
|
|
131
|
+
* punctuation) are skipped in favour of the first real letter.
|
|
132
|
+
*/
|
|
133
|
+
declare function markerLetter(raw: string | null | undefined, fallback: string): string;
|
|
134
|
+
/**
|
|
135
|
+
* Suggest a marker for a new channel: the first letter of its name when that
|
|
136
|
+
* letter is still free, otherwise the next unused letter. Deterministic so the
|
|
137
|
+
* Create dialog's preview matches what actually gets stored.
|
|
138
|
+
*/
|
|
139
|
+
declare function suggestMarker(name: string, taken: Iterable<string>): {
|
|
140
|
+
letter: string;
|
|
141
|
+
color: string;
|
|
142
|
+
};
|
|
143
|
+
/** The letter + color a channel actually renders with (server value wins). */
|
|
144
|
+
declare function markerOf(channel: {
|
|
145
|
+
id: string;
|
|
146
|
+
name: string;
|
|
147
|
+
marker?: string | null;
|
|
148
|
+
color?: string | null;
|
|
149
|
+
}, index?: number): {
|
|
150
|
+
letter: string;
|
|
151
|
+
color: string;
|
|
152
|
+
};
|
|
153
|
+
/** One line of the rail's mixed-source selection summary (§8.4). */
|
|
154
|
+
interface SelectionSourceRow {
|
|
155
|
+
channelId: string;
|
|
156
|
+
name: string;
|
|
157
|
+
count: number;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Group the current selection by the channel each unit is allocated to today.
|
|
161
|
+
* Public sale is listed first; the rest follow in list order so the rail's
|
|
162
|
+
* ordering never jitters as the selection changes.
|
|
163
|
+
*/
|
|
164
|
+
declare function selectionSources(labels: string[], allocation: Map<string, string>, list: ChannelListResult | null): SelectionSourceRow[];
|
|
165
|
+
/**
|
|
166
|
+
* The LOCAL staged preview of "move these labels to this channel".
|
|
167
|
+
*
|
|
168
|
+
* Mirrors the DO's rules exactly (eventChannels.applyAssignment):
|
|
169
|
+
* - a unit already in the target is `alreadyInTarget`, whatever its status;
|
|
170
|
+
* - otherwise held and booked units are skipped and never rewritten;
|
|
171
|
+
* - otherwise a public unit is `changedFromPublic`, a private one is
|
|
172
|
+
* `movedFromOtherChannel` (itemised per source);
|
|
173
|
+
* - a label that is not inventory in this event is `notFound`.
|
|
174
|
+
*
|
|
175
|
+
* Every requested label lands in exactly one bucket — the property the Review
|
|
176
|
+
* sheet's "every selected seat is in exactly one line" promise depends on.
|
|
177
|
+
*/
|
|
178
|
+
declare function planAssignment(input: {
|
|
179
|
+
labels: string[];
|
|
180
|
+
targetChannelId: string;
|
|
181
|
+
allocation: Map<string, string>;
|
|
182
|
+
statusOf: (label: string) => ChannelSeatStatus | undefined;
|
|
183
|
+
nameOf: (channelId: string) => string | null;
|
|
184
|
+
}): AssignmentBuckets;
|
|
185
|
+
/** Units this plan will actually mutate — what the Apply button counts. */
|
|
186
|
+
declare function mutationCount(buckets: AssignmentBuckets): number;
|
|
187
|
+
/** True when moving inventory out of another PRIVATE channel — §8.5 requires an
|
|
188
|
+
* explicit confirmation line for exactly this case. */
|
|
189
|
+
declare function needsMoveConfirmation(buckets: AssignmentBuckets): boolean;
|
|
190
|
+
interface BucketRow {
|
|
191
|
+
kind: 'add' | 'move' | 'same' | 'skip';
|
|
192
|
+
icon: string;
|
|
193
|
+
count: number;
|
|
194
|
+
text: string;
|
|
195
|
+
why?: string;
|
|
196
|
+
/** Sampled seat labels for a skipped bucket, when the server sent any. */
|
|
197
|
+
peek?: string;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Render-ready rows for the Review sheet. The comp shows five lines; the server
|
|
201
|
+
* carries a sixth bucket (`notFound`) which is emitted only when it is non-zero,
|
|
202
|
+
* so a normal review still reads exactly like the approved design.
|
|
203
|
+
*
|
|
204
|
+
* Empty buckets are dropped — a zero line is noise, not honesty.
|
|
205
|
+
*/
|
|
206
|
+
declare function bucketRows(buckets: AssignmentBuckets, targetName: string): BucketRow[];
|
|
207
|
+
/**
|
|
208
|
+
* "try again in ~N minutes" for the archive-blocked-by-holds 409 (§8.8).
|
|
209
|
+
* Rounds up so the organizer never comes back one tick early.
|
|
210
|
+
*/
|
|
211
|
+
declare function retryAfterCopy(details: ArchiveBlockedDetails | null | undefined): string;
|
|
212
|
+
/** The access line under a channel row. Falls back to "—" before the hardening
|
|
213
|
+
* branch lands the `access` field, never to a guess. */
|
|
214
|
+
declare function accessLine(access: ChannelAccessSummary | null | undefined): string;
|
|
215
|
+
/**
|
|
216
|
+
* The name of each sale route, WORD FOR WORD as the server says it.
|
|
217
|
+
*
|
|
218
|
+
* `eventChannels.ts` builds its refusal sentences from an `INTENT_LABEL` map
|
|
219
|
+
* with exactly these four strings. Diverging here would mean the picker calls a
|
|
220
|
+
* route one thing and the refusal it produces calls it another, so these are
|
|
221
|
+
* copied deliberately rather than paraphrased.
|
|
222
|
+
*/
|
|
223
|
+
declare function accessIntentLabel(intent: ChannelAccessIntent): string;
|
|
224
|
+
/**
|
|
225
|
+
* What choosing this route actually DOES, now that the server enforces it.
|
|
226
|
+
*
|
|
227
|
+
* Written against the enforcement matrix, not against intent: each route opens
|
|
228
|
+
* exactly one way to reach a buyer and refuses the other three, so each sentence
|
|
229
|
+
* says both halves. The old copy for these values promised nothing and delivered
|
|
230
|
+
* nothing; it was deleted in 0.42.0 and is not coming back.
|
|
231
|
+
*/
|
|
232
|
+
declare function accessIntentDescription(intent: ChannelAccessIntent): string;
|
|
233
|
+
/** `channel_access_intent_forbids` (409) — the route this channel declares is
|
|
234
|
+
* not the one the action needed. */
|
|
235
|
+
interface AccessIntentForbidsDetails {
|
|
236
|
+
channelId?: string;
|
|
237
|
+
accessIntent?: ChannelAccessIntent | string;
|
|
238
|
+
/** The route the refused action arrived on: `hosted_link` | `server` | `staff` | `public`. */
|
|
239
|
+
route?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The refusal, said as a decision the organizer can act on.
|
|
243
|
+
*
|
|
244
|
+
* The server's own sentence stops at "…so it cannot be sold through a buyer
|
|
245
|
+
* link" — true, but it leaves the reader to work out what to do. This adds the
|
|
246
|
+
* second half: which route to switch to. The code itself is never shown.
|
|
247
|
+
*/
|
|
248
|
+
declare function intentForbidsCopy(details: AccessIntentForbidsDetails | null | undefined): string;
|
|
249
|
+
/** `channel_intent_switch_blocked` (409) — buyers are inside the current route. */
|
|
250
|
+
interface IntentSwitchBlockedDetails {
|
|
251
|
+
channelId?: string;
|
|
252
|
+
from?: ChannelAccessIntent | string;
|
|
253
|
+
to?: ChannelAccessIntent | string;
|
|
254
|
+
liveAccessLinks?: number;
|
|
255
|
+
activeSessions?: number;
|
|
256
|
+
acknowledgeWith?: {
|
|
257
|
+
acknowledgeLiveAccess?: boolean;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* What is live right now, and what acknowledging would do to it.
|
|
262
|
+
*
|
|
263
|
+
* Both halves are checked against the server rather than guessed: an
|
|
264
|
+
* acknowledged switch REVOKES the channel's hosted links (redemption refuses
|
|
265
|
+
* from that moment, so a link left listed as active would be a door the
|
|
266
|
+
* management surface advertises and the buyer path denies), and deliberately
|
|
267
|
+
* LEAVES buyer sessions and their holds alone — nobody is thrown out of a
|
|
268
|
+
* checkout. Sessions cap at 12 hours (30 minutes by default) and no new ones can
|
|
269
|
+
* be minted, so the old route drains on its own.
|
|
270
|
+
*/
|
|
271
|
+
declare function intentSwitchBlockedCopy(details: IntentSwitchBlockedDetails | null | undefined): {
|
|
272
|
+
headline: string;
|
|
273
|
+
consequences: string[];
|
|
274
|
+
};
|
|
275
|
+
/** Lifecycle the server stores. `rotated` means a newer link replaced this one. */
|
|
276
|
+
type AccessLinkState = 'active' | 'revoked' | 'rotated';
|
|
277
|
+
/** What the organizer surface renders: `state`, unless an active link has run
|
|
278
|
+
* out of time or out of redemptions. Never a capability, never a hash. */
|
|
279
|
+
type AccessLinkStatus = AccessLinkState | 'expired' | 'exhausted';
|
|
280
|
+
/**
|
|
281
|
+
* One hosted link, exactly as `GET …/access-links` projects it.
|
|
282
|
+
*
|
|
283
|
+
* There is deliberately NO `url` and NO `capability` field here — the listing
|
|
284
|
+
* route does not return them, no other route returns them, and this type must
|
|
285
|
+
* not tempt a caller into believing otherwise. The secret exists in exactly one
|
|
286
|
+
* place for exactly one moment: the create/rotate response (`AccessLinkReveal`).
|
|
287
|
+
*/
|
|
288
|
+
interface AccessLinkRecord {
|
|
289
|
+
id: string;
|
|
290
|
+
channelId: string;
|
|
291
|
+
label: string | null;
|
|
292
|
+
includePublic: boolean;
|
|
293
|
+
expiresAt: number;
|
|
294
|
+
maxRedemptions: number;
|
|
295
|
+
redemptions: number;
|
|
296
|
+
/** Guest-weighted per-buyer ceiling handed to every session this link mints. */
|
|
297
|
+
maxQuantity: number;
|
|
298
|
+
sessionTtlSeconds: number;
|
|
299
|
+
state: AccessLinkState;
|
|
300
|
+
status: AccessLinkStatus;
|
|
301
|
+
createdAt: number;
|
|
302
|
+
createdBy: string | null;
|
|
303
|
+
revokedAt: number | null;
|
|
304
|
+
lastRedeemedAt: number | null;
|
|
305
|
+
/** Rotation lineage: the link this replaced, and the one that replaced it. */
|
|
306
|
+
rotatedFrom: string | null;
|
|
307
|
+
rotatedTo: string | null;
|
|
308
|
+
}
|
|
309
|
+
/** A listed link, with the live session count the rotate dialog needs to state
|
|
310
|
+
* "N buyers got in with this link and still have access". */
|
|
311
|
+
interface AccessLinkStatusRecord extends AccessLinkRecord {
|
|
312
|
+
activeSessions?: number;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* The ONE-TIME reveal. `url` and `capability` are on the wire exactly once, in
|
|
316
|
+
* the create/rotate response, and are unrecoverable afterwards: SeatLayer stores
|
|
317
|
+
* only a hash. Nothing may persist this — see `ChannelsMode.revealLink`.
|
|
318
|
+
*/
|
|
319
|
+
interface AccessLinkReveal {
|
|
320
|
+
link: AccessLinkRecord;
|
|
321
|
+
url: string;
|
|
322
|
+
capability: string;
|
|
323
|
+
revealedOnce: true;
|
|
324
|
+
/** Rotation only: the link that just stopped working, and how many live buyer
|
|
325
|
+
* sessions from it were ended (0 when the organizer let them finish). */
|
|
326
|
+
previous?: AccessLinkRecord;
|
|
327
|
+
endedSessions?: number;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Owner-set defaults for a new link. Expiry is NOT here: "when the event starts"
|
|
331
|
+
* is the server's own default (it knows `starts_at`; the cockpit does not), so
|
|
332
|
+
* the create form expresses that choice by omitting `expiresAt` entirely rather
|
|
333
|
+
* than by guessing a timestamp the server would then have to correct.
|
|
334
|
+
*/
|
|
335
|
+
declare const ACCESS_LINK_DEFAULTS: {
|
|
336
|
+
readonly maxRedemptions: 100;
|
|
337
|
+
readonly maxQuantity: 4;
|
|
338
|
+
};
|
|
339
|
+
/** Plain-language state badge for a hosted link (§9: no internal vocabulary). */
|
|
340
|
+
declare function accessLinkBadge(link: Pick<AccessLinkRecord, 'status' | 'state'>): {
|
|
341
|
+
text: string;
|
|
342
|
+
kind: 'active' | 'paused' | 'archived';
|
|
343
|
+
};
|
|
344
|
+
/** Only an `active` link can be rotated or revoked; the server agrees (409
|
|
345
|
+
* `access_link_not_active`), so the buttons are absent rather than failing. */
|
|
346
|
+
declare function accessLinkIsLive(link: Pick<AccessLinkRecord, 'status' | 'state'>): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* The policy an organizer is agreeing to, in one list. Used by BOTH the reveal
|
|
349
|
+
* (what you just created) and the status card (what is live), so the two can
|
|
350
|
+
* never drift into describing the same link differently.
|
|
351
|
+
*/
|
|
352
|
+
declare function accessLinkPolicyLines(link: AccessLinkRecord): Array<{
|
|
353
|
+
k: string;
|
|
354
|
+
v: string;
|
|
355
|
+
}>;
|
|
356
|
+
/**
|
|
357
|
+
* Plain language for a refused hosted-link call.
|
|
358
|
+
*
|
|
359
|
+
* The PLATFORM BOUNDS live on the server (60s–180d expiry, 1–10 000 redemptions,
|
|
360
|
+
* 1–100 seats per buyer, 20 live links per channel) and the server states them
|
|
361
|
+
* in `message`. We surface that sentence rather than re-encoding the numbers
|
|
362
|
+
* here, so the client can never disagree with the rule it is reporting.
|
|
363
|
+
*/
|
|
364
|
+
declare function accessLinkErrorCopy(err: {
|
|
365
|
+
code?: string;
|
|
366
|
+
serverMessage?: string;
|
|
367
|
+
status?: number;
|
|
368
|
+
details?: Record<string, unknown>;
|
|
369
|
+
} | null | undefined): string;
|
|
370
|
+
/**
|
|
371
|
+
* The chart-update refusal `channel_assignment_would_drop` (409) deliberately
|
|
372
|
+
* mirrors the Apply skipped buckets, so ONE review component renders both.
|
|
373
|
+
* This adapts it into the same `BucketRow[]` the Review sheet already draws.
|
|
374
|
+
*/
|
|
375
|
+
interface AssignmentDropDetails {
|
|
376
|
+
droppedUnits?: number;
|
|
377
|
+
channels?: Array<{
|
|
378
|
+
channelId: string;
|
|
379
|
+
name: string | null;
|
|
380
|
+
count: number;
|
|
381
|
+
labels?: string[];
|
|
382
|
+
truncated?: boolean;
|
|
383
|
+
}>;
|
|
384
|
+
acknowledgeWith?: string;
|
|
385
|
+
}
|
|
386
|
+
declare function dropReviewRows(details: AssignmentDropDetails | null | undefined): BucketRow[];
|
|
387
|
+
/** Plain-language state badge text (§9: no internal vocabulary on user surfaces). */
|
|
388
|
+
declare function stateBadge(state: ChannelState | 'builtin'): string;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Organizer manage-surface client for workers/api (the `/v1/events/:key/*`
|
|
392
|
+
* inventory routes + the public realtime channel). Companion to api.ts (the
|
|
393
|
+
* buyer `/pub/*` client) — kept separate because the manage surface is
|
|
394
|
+
* token-authed (Bearer) and cross-origin from the CMS:
|
|
395
|
+
*
|
|
396
|
+
* - Writes + reports send `Authorization: Bearer <token>` where the token is
|
|
397
|
+
* a short-lived, event-scoped organizer manage token (`mse_…`, minted by
|
|
398
|
+
* NestJS) OR a tenant secret key (`sk_…`). Both are accepted by the worker's
|
|
399
|
+
* `eitherAuth` on block / unblock / unblock-all / unbook / hold-ttl / report
|
|
400
|
+
* / log. The Authorization header also exempts the call from the worker's
|
|
401
|
+
* cookie-CSRF gate, so no extra client header is needed.
|
|
402
|
+
* - `credentials: 'omit'` — there is no session cookie; the CMS runs
|
|
403
|
+
* cross-origin. The worker's credentialed CORS still echoes the CMS origin.
|
|
404
|
+
* - `/pub/events/:key/chart` stays public: geometry is the same map buyers
|
|
405
|
+
* see. The seat STATE reads are not. `/pub/.../objects` and an unticketed
|
|
406
|
+
* `/pub/.../subscribe` both answer with the BUYER projection, which shows
|
|
407
|
+
* inventory the caller may not buy as a neutral `blocked` — so an organizer
|
|
408
|
+
* reading them sees its own channel allocations as blocked seats. Both now
|
|
409
|
+
* go through the token: `/v1/events/:key/objects` for the snapshot, and a
|
|
410
|
+
* `/v1/events/:key/subscribe-tickets` mint for the socket's scope.
|
|
411
|
+
*
|
|
412
|
+
* `box-book` is intentionally omitted for M1 (box office ships in M2, and the
|
|
413
|
+
* route is still session-only server-side).
|
|
414
|
+
*/
|
|
415
|
+
|
|
416
|
+
/** One page of the organizer-only label → channel projection. */
|
|
417
|
+
interface ChannelAllocationPage {
|
|
418
|
+
assignmentVersion: number;
|
|
419
|
+
allocations: Array<{
|
|
420
|
+
label: string;
|
|
421
|
+
channelId: string;
|
|
422
|
+
}>;
|
|
423
|
+
nextAfterLabel: string | null;
|
|
424
|
+
}
|
|
425
|
+
interface ChannelAuditEntry {
|
|
426
|
+
id: number;
|
|
427
|
+
at: number;
|
|
428
|
+
actor: string | null;
|
|
429
|
+
action: string;
|
|
430
|
+
channelId: string | null;
|
|
431
|
+
assignmentVersion: number;
|
|
432
|
+
before: unknown;
|
|
433
|
+
after: unknown;
|
|
434
|
+
reason: string | null;
|
|
435
|
+
}
|
|
436
|
+
interface ChannelAuditPage {
|
|
437
|
+
entries: ChannelAuditEntry[];
|
|
438
|
+
nextBefore: number | null;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Buyer projection for a preview audience — the same scoped server view the
|
|
442
|
+
* buyer SDK receives. When an audience cannot be previewed (a paused or
|
|
443
|
+
* archived channel), the server answers `{available:false, unavailable:[…]}`
|
|
444
|
+
* and the UI shows the real paused/unavailable landing state instead of
|
|
445
|
+
* rendering those seats as eligible.
|
|
446
|
+
*
|
|
447
|
+
* Fields stay optional: a worker that predates the hardening merge 404s here,
|
|
448
|
+
* and Channels mode says the preview needs a newer server rather than faking a
|
|
449
|
+
* projection client-side.
|
|
450
|
+
*/
|
|
451
|
+
interface ChannelPreviewProjection {
|
|
452
|
+
available?: boolean;
|
|
453
|
+
unavailable?: Array<{
|
|
454
|
+
channelId: string;
|
|
455
|
+
state: 'paused' | 'archived' | string;
|
|
456
|
+
}>;
|
|
457
|
+
channelIds?: string[];
|
|
458
|
+
includePublic?: boolean;
|
|
459
|
+
/** Labels this audience may buy. Everything else renders as ONE neutral
|
|
460
|
+
* unavailable state so preview never leaks which channel holds a seat. */
|
|
461
|
+
eligible?: string[];
|
|
462
|
+
counts?: {
|
|
463
|
+
eligible?: number;
|
|
464
|
+
free?: number;
|
|
465
|
+
held?: number;
|
|
466
|
+
booked?: number;
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
declare class ManageApiError extends Error {
|
|
470
|
+
status: number;
|
|
471
|
+
code?: string;
|
|
472
|
+
/** Present when a block/unbook 409s because seats were just taken. */
|
|
473
|
+
conflicts?: {
|
|
474
|
+
label: string;
|
|
475
|
+
reason?: string;
|
|
476
|
+
}[];
|
|
477
|
+
/**
|
|
478
|
+
* Structured refusal detail. The channel routes use it for the two 409s a UI
|
|
479
|
+
* must render rather than merely report: `channel_archive_blocked_by_holds`
|
|
480
|
+
* carries {activeHolds, heldUnits, latestHoldExpiresAt, retryAfterMs}, and
|
|
481
|
+
* `channel_assignment_conflict` carries the current assignmentVersion.
|
|
482
|
+
*/
|
|
483
|
+
details?: Record<string, unknown>;
|
|
484
|
+
/**
|
|
485
|
+
* The server's own human sentence, when it sent one. `message` is the machine
|
|
486
|
+
* code (that is what `error` carries), so a UI that wants to state a PLATFORM
|
|
487
|
+
* RULE — "redemptions must be between 1 and 10 000" — reads this instead of
|
|
488
|
+
* re-encoding the bound locally and risking disagreement with the server.
|
|
489
|
+
*/
|
|
490
|
+
serverMessage?: string;
|
|
491
|
+
constructor(status: number, message: string, code?: string, conflicts?: {
|
|
492
|
+
label: string;
|
|
493
|
+
reason?: string;
|
|
494
|
+
}[], details?: Record<string, unknown>, serverMessage?: string);
|
|
495
|
+
}
|
|
496
|
+
interface ReportByStatus {
|
|
497
|
+
free: number;
|
|
498
|
+
held: number;
|
|
499
|
+
booked: number;
|
|
500
|
+
not_for_sale: number;
|
|
501
|
+
}
|
|
502
|
+
interface ReportCategoryRow {
|
|
503
|
+
category: string;
|
|
504
|
+
total: number;
|
|
505
|
+
free: number;
|
|
506
|
+
held: number;
|
|
507
|
+
booked: number;
|
|
508
|
+
not_for_sale: number;
|
|
509
|
+
/** Exact sum of booked unit_price snapshots, in major currency units. */
|
|
510
|
+
bookedRevenue: number;
|
|
511
|
+
}
|
|
512
|
+
interface ReportCategoryMeta {
|
|
513
|
+
key: string;
|
|
514
|
+
label: string;
|
|
515
|
+
color: string;
|
|
516
|
+
price: number;
|
|
517
|
+
}
|
|
518
|
+
interface ReportResult {
|
|
519
|
+
report: {
|
|
520
|
+
byStatus: ReportByStatus;
|
|
521
|
+
byCategory: ReportCategoryRow[];
|
|
522
|
+
bySection?: ControlRoomSectionMetric[];
|
|
523
|
+
};
|
|
524
|
+
event: {
|
|
525
|
+
key: string;
|
|
526
|
+
name: string;
|
|
527
|
+
seatTotal: number;
|
|
528
|
+
currency?: string;
|
|
529
|
+
};
|
|
530
|
+
categories: ReportCategoryMeta[];
|
|
531
|
+
}
|
|
532
|
+
interface ControlRoomSectionMetric {
|
|
533
|
+
sectionId: string;
|
|
534
|
+
sectionLabel: string;
|
|
535
|
+
zoneId: string | null;
|
|
536
|
+
total: number;
|
|
537
|
+
free: number;
|
|
538
|
+
held: number;
|
|
539
|
+
booked: number;
|
|
540
|
+
not_for_sale: number;
|
|
541
|
+
bookedRevenue: number;
|
|
542
|
+
}
|
|
543
|
+
/** Recent seat-state change safe for an event:view control-room grant. Full
|
|
544
|
+
* audit references remain available only through the event:reports log API. */
|
|
545
|
+
interface ControlRoomActivityEntry {
|
|
546
|
+
id: number;
|
|
547
|
+
at: number;
|
|
548
|
+
action: string;
|
|
549
|
+
labels: string[];
|
|
550
|
+
}
|
|
551
|
+
interface ControlRoomSnapshot {
|
|
552
|
+
version: number;
|
|
553
|
+
currency: string;
|
|
554
|
+
totals: {
|
|
555
|
+
free: number;
|
|
556
|
+
held: number;
|
|
557
|
+
booked: number;
|
|
558
|
+
blocked: number;
|
|
559
|
+
};
|
|
560
|
+
revenue: {
|
|
561
|
+
gross: number;
|
|
562
|
+
bySection: ControlRoomSectionMetric[];
|
|
563
|
+
};
|
|
564
|
+
velocity: {
|
|
565
|
+
windowMinutes: number;
|
|
566
|
+
bySection: Array<{
|
|
567
|
+
sectionId: string;
|
|
568
|
+
netBooked: number;
|
|
569
|
+
grossRevenue: number;
|
|
570
|
+
previousNetBooked: number;
|
|
571
|
+
trend: 'rising' | 'steady' | 'cooling';
|
|
572
|
+
}>;
|
|
573
|
+
};
|
|
574
|
+
presence: {
|
|
575
|
+
shoppingSessions: number;
|
|
576
|
+
activeHolds: number;
|
|
577
|
+
};
|
|
578
|
+
/** Present on workers that support reload-safe activity hydration. */
|
|
579
|
+
activity?: ControlRoomActivityEntry[];
|
|
580
|
+
event: {
|
|
581
|
+
key: string;
|
|
582
|
+
name: string;
|
|
583
|
+
seatTotal: number;
|
|
584
|
+
currency?: string;
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
interface LogEntry {
|
|
588
|
+
id: number;
|
|
589
|
+
at: number;
|
|
590
|
+
action: string;
|
|
591
|
+
labels: string[];
|
|
592
|
+
ref: string | null;
|
|
593
|
+
}
|
|
594
|
+
interface LogPage {
|
|
595
|
+
entries: LogEntry[];
|
|
596
|
+
nextBefore: number | null;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* A one-use WebSocket subscribe ticket. `protocols` is exactly what to hand
|
|
600
|
+
* `new WebSocket(url, protocols)` — the ticket rides in `Sec-WebSocket-Protocol`
|
|
601
|
+
* because a browser socket cannot carry an Authorization header and a bearer
|
|
602
|
+
* must never travel in a URL.
|
|
603
|
+
*/
|
|
604
|
+
interface SubscribeTicket {
|
|
605
|
+
ticket: string;
|
|
606
|
+
expiresAt: number;
|
|
607
|
+
protocol: string;
|
|
608
|
+
protocols: string[];
|
|
609
|
+
}
|
|
610
|
+
interface PubObjectsResult {
|
|
611
|
+
/** Every non-free seat's status keyed by label (free seats omitted). */
|
|
612
|
+
seats: Record<string, string>;
|
|
613
|
+
hidden?: string[];
|
|
614
|
+
closed?: string[];
|
|
615
|
+
updatedAt: number;
|
|
616
|
+
}
|
|
617
|
+
interface PubChartResult {
|
|
618
|
+
event: {
|
|
619
|
+
key: string;
|
|
620
|
+
name: string;
|
|
621
|
+
status?: string;
|
|
622
|
+
venue?: string | null;
|
|
623
|
+
startsAt?: number | null;
|
|
624
|
+
currency?: string;
|
|
625
|
+
mode?: string;
|
|
626
|
+
};
|
|
627
|
+
doc: ChartDoc;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Bound to one apiBase + one event-scoped token. Rebuild (or `setToken`) when a
|
|
631
|
+
* token is re-minted on 401.
|
|
632
|
+
*/
|
|
633
|
+
declare class ManageApi {
|
|
634
|
+
private base;
|
|
635
|
+
private token;
|
|
636
|
+
constructor(apiBase: string, token: string);
|
|
637
|
+
/** Swap the Bearer token in place (SeatManager re-mints on 401). */
|
|
638
|
+
setToken(token: string): void;
|
|
639
|
+
private auth;
|
|
640
|
+
private pub;
|
|
641
|
+
/** The chart geometry. Genuinely public — it is the same map buyers see. */
|
|
642
|
+
chart(key: string): Promise<PubChartResult>;
|
|
643
|
+
/**
|
|
644
|
+
* The ORGANIZER's seat map: physical state, token-authed.
|
|
645
|
+
*
|
|
646
|
+
* This used to read `/pub/events/:key/objects` with no credential, which
|
|
647
|
+
* answers with the BUYER projection — every unit the caller may not buy
|
|
648
|
+
* collapses to a neutral `blocked`. An anonymous caller may buy only Public
|
|
649
|
+
* sale inventory, so the cockpit rendered every channel-allocated seat as
|
|
650
|
+
* blocked and then computed its KPIs, sell-through and (worse) its
|
|
651
|
+
* block/unblock target sets from that. `/v1/events/:key/objects` returns the
|
|
652
|
+
* unprojected snapshot the control-room read model already trusts.
|
|
653
|
+
*/
|
|
654
|
+
objects(key: string): Promise<PubObjectsResult>;
|
|
655
|
+
/**
|
|
656
|
+
* Exchange the manage token for a one-use organizer socket ticket.
|
|
657
|
+
*
|
|
658
|
+
* A browser `WebSocket` cannot send an Authorization header, so the socket's
|
|
659
|
+
* scope is established here, over ordinary HTTPS. Without it the DO treats a
|
|
660
|
+
* manager socket as an anonymous public buyer and projects its deltas — so a
|
|
661
|
+
* hold inside a private allocation is structurally suppressed and the map
|
|
662
|
+
* drifts away from the truth `objects()` just established.
|
|
663
|
+
*
|
|
664
|
+
* Tickets are single-redemption and expire in ~30s: mint one per connect.
|
|
665
|
+
*/
|
|
666
|
+
subscribeTicket(key: string): Promise<SubscribeTicket>;
|
|
667
|
+
socketUrl(key: string): string;
|
|
668
|
+
/** Take FREE seats off sale in one batched call. Optional `releaseAt` (epoch
|
|
669
|
+
* ms, future) auto-returns them to sale; `reason` tags the block (M3 uses it).
|
|
670
|
+
* Throws ManageApiError 409 (conflicts) if any seat was just taken. */
|
|
671
|
+
block(key: string, labels: string[], opts?: {
|
|
672
|
+
releaseAt?: number;
|
|
673
|
+
reason?: string;
|
|
674
|
+
}): Promise<{
|
|
675
|
+
ok: true;
|
|
676
|
+
blocked: string[];
|
|
677
|
+
}>;
|
|
678
|
+
/** Return specific blocked seats to sale (one batched call). */
|
|
679
|
+
unblock(key: string, labels: string[]): Promise<{
|
|
680
|
+
ok: true;
|
|
681
|
+
unblocked: string[];
|
|
682
|
+
}>;
|
|
683
|
+
/** Return every blocked seat to sale; resolves with the freed count. */
|
|
684
|
+
unblockAll(key: string): Promise<{
|
|
685
|
+
ok: true;
|
|
686
|
+
freed: number;
|
|
687
|
+
}>;
|
|
688
|
+
/** Cancel bookings — return BOOKED seats to free (credit not refunded).
|
|
689
|
+
* Guarded by the original booking reference. */
|
|
690
|
+
unbook(key: string, labels: string[], bookingRef: string): Promise<{
|
|
691
|
+
ok: true;
|
|
692
|
+
unbooked: string[];
|
|
693
|
+
}>;
|
|
694
|
+
/** Set (ms, clamped 1–60 min server-side) or clear (null) the hold TTL. */
|
|
695
|
+
setHoldTtl(key: string, holdTtlMs: number | null): Promise<{
|
|
696
|
+
ok: true;
|
|
697
|
+
holdTtlMs: number | null;
|
|
698
|
+
}>;
|
|
699
|
+
/** The organizer's current per section/zone availability windows (needs
|
|
700
|
+
* `event:view`). Ids absent from `rules` are open / on sale. */
|
|
701
|
+
availability(key: string): Promise<{
|
|
702
|
+
rules: Record<string, AvailabilityRule>;
|
|
703
|
+
}>;
|
|
704
|
+
/** Replace the availability windows for a set of section/zone ids (needs
|
|
705
|
+
* `event:block`). Ids absent from `rules` become open / on sale; a zone rule
|
|
706
|
+
* cascades to its sections. The worker derives each id's seat labels, so
|
|
707
|
+
* `labels` on the sent rules is best-effort. Resolves with the authoritative
|
|
708
|
+
* effective `hidden` set (a due rule may fire at once) and the server-cleaned
|
|
709
|
+
* `rules` map (fired timed/threshold windows dropped). */
|
|
710
|
+
setAvailability(key: string, rules: Record<string, AvailabilityRule>): Promise<{
|
|
711
|
+
ok: true;
|
|
712
|
+
hidden: string[];
|
|
713
|
+
rules: Record<string, AvailabilityRule>;
|
|
714
|
+
}>;
|
|
715
|
+
/** Allocation list with exact per-channel counts. `includeArchived` adds the
|
|
716
|
+
* read-only archived rows behind the rail's "Show archived" control. */
|
|
717
|
+
channels(key: string, opts?: {
|
|
718
|
+
includeArchived?: boolean;
|
|
719
|
+
}): Promise<ChannelListResult>;
|
|
720
|
+
/** One page of the label → channel map that paints the allocation overlay.
|
|
721
|
+
* Paged by label; follow `nextAfterLabel` until it is null. */
|
|
722
|
+
channelAllocation(key: string, opts?: {
|
|
723
|
+
afterLabel?: string;
|
|
724
|
+
limit?: number;
|
|
725
|
+
}): Promise<ChannelAllocationPage>;
|
|
726
|
+
channelAudit(key: string, opts?: {
|
|
727
|
+
limit?: number;
|
|
728
|
+
before?: number;
|
|
729
|
+
}): Promise<ChannelAuditPage>;
|
|
730
|
+
createChannel(key: string, input: {
|
|
731
|
+
name: string;
|
|
732
|
+
color?: string | null;
|
|
733
|
+
marker?: string | null;
|
|
734
|
+
externalRef?: string | null;
|
|
735
|
+
}): Promise<{
|
|
736
|
+
ok: true;
|
|
737
|
+
channel: ChannelRecord;
|
|
738
|
+
}>;
|
|
739
|
+
renameChannel(key: string, channelId: string, name: string): Promise<{
|
|
740
|
+
ok: true;
|
|
741
|
+
channel: ChannelRecord;
|
|
742
|
+
}>;
|
|
743
|
+
setChannelPaused(key: string, channelId: string, paused: boolean): Promise<{
|
|
744
|
+
ok: true;
|
|
745
|
+
channel: ChannelRecord;
|
|
746
|
+
}>;
|
|
747
|
+
/** Archive with a mandatory destination for the remaining allocation.
|
|
748
|
+
* Throws ManageApiError 409 `channel_archive_blocked_by_holds` while any hold
|
|
749
|
+
* is live; `err.details` carries the exact counts + retry window. */
|
|
750
|
+
archiveChannel(key: string, channelId: string, destination: string | null): Promise<{
|
|
751
|
+
ok: true;
|
|
752
|
+
channel: ChannelRecord;
|
|
753
|
+
assignmentVersion: number;
|
|
754
|
+
moved: number;
|
|
755
|
+
}>;
|
|
756
|
+
/**
|
|
757
|
+
* Versioned Apply. A stale `assignmentVersion` mutates NOTHING and throws
|
|
758
|
+
* ManageApiError 409 `channel_assignment_conflict` — the caller keeps its
|
|
759
|
+
* selection and offers "Refresh and review". There is no dry-run: the review
|
|
760
|
+
* sheet previews locally, this call returns the authoritative buckets.
|
|
761
|
+
*/
|
|
762
|
+
applyChannelAssignment(key: string, input: {
|
|
763
|
+
targetChannelId: string | null;
|
|
764
|
+
labels: string[];
|
|
765
|
+
assignmentVersion: number;
|
|
766
|
+
}): Promise<AssignmentResult>;
|
|
767
|
+
/**
|
|
768
|
+
* Read-only buyer projection for an audience (§8.6) — the SAME scoped server
|
|
769
|
+
* view the buyer SDK receives, never a local approximation.
|
|
770
|
+
*
|
|
771
|
+
* Ships on the access-hardening branch. Older workers 404/405 here; callers
|
|
772
|
+
* MUST feature-detect and quietly say the preview needs a newer server rather
|
|
773
|
+
* than faking a projection client-side.
|
|
774
|
+
*/
|
|
775
|
+
channelPreview(key: string, channelIds: string[], opts?: {
|
|
776
|
+
includePublic?: boolean;
|
|
777
|
+
}): Promise<ChannelPreviewProjection>;
|
|
778
|
+
/**
|
|
779
|
+
* Choose which sale route this channel opens.
|
|
780
|
+
*
|
|
781
|
+
* Since the server's 2026-08-06 change this is AUTHORIZATION, not a label:
|
|
782
|
+
* exactly one of the four routes may mint buyer access for the channel and the
|
|
783
|
+
* other three refuse with 409 `channel_access_intent_forbids`. The default is
|
|
784
|
+
* `none`, which refuses all four — so a route has to be declared before any
|
|
785
|
+
* buyer-facing action on the channel can succeed.
|
|
786
|
+
*
|
|
787
|
+
* Switching the route while buyers are already inside the current one is
|
|
788
|
+
* refused with 409 `channel_intent_switch_blocked`, whose `details` name what
|
|
789
|
+
* is live (`liveAccessLinks`, `activeSessions`). Retry with
|
|
790
|
+
* `acknowledgeLiveAccess: true`: hosted links on the channel are revoked,
|
|
791
|
+
* while sessions already minted keep their holds and drain on their own.
|
|
792
|
+
* `intentSwitch` is present on the response ONLY when the switch disturbed
|
|
793
|
+
* something, so the ordinary case stays the two-key body it has always been.
|
|
794
|
+
*/
|
|
795
|
+
setChannelAccessIntent(key: string, channelId: string, accessIntent: ChannelAccessIntent, opts?: {
|
|
796
|
+
acknowledgeLiveAccess?: boolean;
|
|
797
|
+
reason?: string;
|
|
798
|
+
}): Promise<{
|
|
799
|
+
ok: true;
|
|
800
|
+
channel: ChannelRecord;
|
|
801
|
+
intentSwitch?: {
|
|
802
|
+
closedLinks: number;
|
|
803
|
+
keptSessions: number;
|
|
804
|
+
};
|
|
805
|
+
}>;
|
|
806
|
+
/**
|
|
807
|
+
* Mint a hosted access link. The 201 is the ONE and ONLY time `url` and
|
|
808
|
+
* `capability` exist outside the buyer's browser — SeatLayer keeps a hash, so
|
|
809
|
+
* there is no route, cache, or support escalation that can produce this string
|
|
810
|
+
* again. Callers must reveal it immediately and then let it go.
|
|
811
|
+
*
|
|
812
|
+
* Every omitted field takes the server's default: expiry = when the event
|
|
813
|
+
* starts, 100 redemptions, 4 seats per buyer, this channel's allocation only.
|
|
814
|
+
* Platform bounds are enforced server-side and reported as 422 with the rule
|
|
815
|
+
* spelled out in `ManageApiError.serverMessage`.
|
|
816
|
+
*
|
|
817
|
+
* NOT a side effect any more. This used to SET the channel's access intent to
|
|
818
|
+
* `hosted_link`; since 2026-08-06 it REQUIRES it, and a channel declaring any
|
|
819
|
+
* other route refuses with 409 `channel_access_intent_forbids`. Callers must
|
|
820
|
+
* declare the route first — `ChannelsMode` does exactly that before it
|
|
821
|
+
* creates, so a first buyer link on a fresh channel is still one gesture.
|
|
822
|
+
*/
|
|
823
|
+
createAccessLink(key: string, channelId: string, input?: {
|
|
824
|
+
label?: string | null;
|
|
825
|
+
/** Absolute epoch ms. Omit for "when the event starts". */
|
|
826
|
+
expiresAt?: number;
|
|
827
|
+
maxRedemptions?: number;
|
|
828
|
+
maxQuantity?: number;
|
|
829
|
+
includePublic?: boolean;
|
|
830
|
+
}): Promise<AccessLinkReveal>;
|
|
831
|
+
/** Status only — label, expiry, redemptions, per-buyer cap, lineage, and the
|
|
832
|
+
* live session count. Never the url, never the capability. Needs `:view`. */
|
|
833
|
+
accessLinks(key: string, channelId: string): Promise<{
|
|
834
|
+
links: AccessLinkStatusRecord[];
|
|
835
|
+
}>;
|
|
836
|
+
/**
|
|
837
|
+
* Rotate — the ONLY recovery for a link nobody kept. The old URL stops opening
|
|
838
|
+
* immediately and the response is a fresh one-time reveal.
|
|
839
|
+
*
|
|
840
|
+
* `endActiveSessions` is REQUIRED, not defaulted: the organizer must say
|
|
841
|
+
* whether buyers already inside finish their checkout or lose access now. The
|
|
842
|
+
* server answers 422 `end_active_sessions_required` if it is omitted, and that
|
|
843
|
+
* refusal is correct — a UI must not pick either branch on their behalf.
|
|
844
|
+
*/
|
|
845
|
+
rotateAccessLink(key: string, channelId: string, linkId: string, endActiveSessions: boolean): Promise<AccessLinkReveal & {
|
|
846
|
+
previous: AccessLinkRecord;
|
|
847
|
+
endedSessions: number;
|
|
848
|
+
}>;
|
|
849
|
+
/** Revoke. The link stops opening immediately; `endActiveSessions` decides
|
|
850
|
+
* whether the buyers already inside keep their sessions. */
|
|
851
|
+
revokeAccessLink(key: string, channelId: string, linkId: string, endActiveSessions?: boolean): Promise<{
|
|
852
|
+
ok: true;
|
|
853
|
+
link: AccessLinkRecord;
|
|
854
|
+
endedSessions: number;
|
|
855
|
+
}>;
|
|
856
|
+
report(key: string): Promise<ReportResult>;
|
|
857
|
+
controlRoom(key: string, windowMinutes?: number): Promise<ControlRoomSnapshot>;
|
|
858
|
+
log(key: string, opts?: {
|
|
859
|
+
limit?: number;
|
|
860
|
+
before?: number;
|
|
861
|
+
}): Promise<LogPage>;
|
|
862
|
+
/** CSV report as a Blob (Bearer auth can't ride a plain <a href>). Host builds
|
|
863
|
+
* an object URL for download. */
|
|
864
|
+
reportCsv(key: string): Promise<Blob>;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* SeatManager — the organizer manage surface, packaged for the SDK.
|
|
869
|
+
*
|
|
870
|
+
* Productizes the SeatLayer dashboard's ManageEventPage into a framework-
|
|
871
|
+
* agnostic class (mirrors how SeatPicker productized the buyer flow). It mounts
|
|
872
|
+
* the shared engine in `manageMode`, subscribes to the event's realtime channel
|
|
873
|
+
* and drives three control-room tools on one persistent canvas:
|
|
874
|
+
*
|
|
875
|
+
* - **view** — a live board: realtime seat repaint (flash on hold/book),
|
|
876
|
+
* live KPI tallies + gross revenue, and a streaming activity
|
|
877
|
+
* feed derived from the delta stream + audit log. Read-only.
|
|
878
|
+
* - **inspect** — select one seat to read its live inventory context.
|
|
879
|
+
* - **block** — bulk-first block/unblock: marquee-drag, ⌘A select-all,
|
|
880
|
+
* whole-category / whole-section select, single-seat fallback →
|
|
881
|
+
* one batched block/unblock (optimistic, reconciled by the WS),
|
|
882
|
+
* and timed auto-release.
|
|
883
|
+
*
|
|
884
|
+
* Auth: reads (chart/objects/WS) are public; writes/reports carry a Bearer
|
|
885
|
+
* event-scoped manage token (`mse_…`) or a tenant secret key (`sk_…`) via
|
|
886
|
+
* {@link ManageApi}. Box office + Sections + full Reports UI are M2/M3.
|
|
887
|
+
*/
|
|
888
|
+
|
|
889
|
+
type SeatManagerMode = 'view' | 'inspect' | 'block' | 'sections' | 'channels';
|
|
890
|
+
/**
|
|
891
|
+
* Capabilities the cockpit's token was minted with. Channels mode is gated on
|
|
892
|
+
* these and fails CLOSED: no `event:channels:view` ⇒ no Channels pill at all;
|
|
893
|
+
* view without `event:channels:manage` ⇒ read-only inspection with every
|
|
894
|
+
* mutation control absent, not merely disabled.
|
|
895
|
+
*/
|
|
896
|
+
type SeatManagerCapability = 'event:view' | 'event:block' | 'event:cancel' | 'event:reports' | 'event:channels:view' | 'event:channels:manage';
|
|
897
|
+
/** DO seat status — 'blocked' has no engine analogue (→ 'not_for_sale'). */
|
|
898
|
+
type DoStatus = 'free' | 'held' | 'booked' | 'blocked';
|
|
899
|
+
/** Live KPI snapshot pushed to `onTallies` on every state change. */
|
|
900
|
+
interface SeatManagerTallies {
|
|
901
|
+
free: number;
|
|
902
|
+
held: number;
|
|
903
|
+
booked: number;
|
|
904
|
+
blocked: number;
|
|
905
|
+
/** Total seats on the chart. */
|
|
906
|
+
total: number;
|
|
907
|
+
/** booked / total, 0–100. */
|
|
908
|
+
capacityPct: number;
|
|
909
|
+
/** booked / (total − blocked), 0–100 — sell-through of sellable inventory. */
|
|
910
|
+
sellThroughPct: number;
|
|
911
|
+
/** Exact Σ booked unit_price snapshots from the authenticated report. */
|
|
912
|
+
grossRevenue: number;
|
|
913
|
+
/** Revenue is never reconstructed from chart list price. */
|
|
914
|
+
revenueStatus: 'loading' | 'current' | 'stale';
|
|
915
|
+
/** ISO-4217 currency for grossRevenue. */
|
|
916
|
+
currency: string;
|
|
917
|
+
}
|
|
918
|
+
/** One streamed activity line for the live feed. */
|
|
919
|
+
interface SeatManagerActivity {
|
|
920
|
+
id: string;
|
|
921
|
+
at: number;
|
|
922
|
+
label: string;
|
|
923
|
+
/** Full labels affected by this one backend/realtime operation. */
|
|
924
|
+
labels: string[];
|
|
925
|
+
count: number;
|
|
926
|
+
/** Human verb: held / booked / released / blocked / unblocked. */
|
|
927
|
+
verb: string;
|
|
928
|
+
status: DoStatus;
|
|
929
|
+
/** Spatial context for grouped activity when the chart defines sections. */
|
|
930
|
+
sectionIds?: string[];
|
|
931
|
+
sectionLabels?: string[];
|
|
932
|
+
}
|
|
933
|
+
/** Fired after a successful organizer action, for host toasts/telemetry. */
|
|
934
|
+
interface SeatManagerActionResult {
|
|
935
|
+
action: 'block' | 'unblock' | 'unblockAll' | 'cancelBooking' | 'setHoldTtl';
|
|
936
|
+
labels: string[];
|
|
937
|
+
count: number;
|
|
938
|
+
}
|
|
939
|
+
interface SeatManagerOptions {
|
|
940
|
+
/** CSS selector or element to mount into. */
|
|
941
|
+
container: string | HTMLElement;
|
|
942
|
+
/** API origin. Defaults to https://api.seatlayer.io. */
|
|
943
|
+
apiBase?: string;
|
|
944
|
+
/** Event key (e.g. `ev_xxx` / `west-end-p3`). */
|
|
945
|
+
eventKey: string;
|
|
946
|
+
/** Bearer manage token — event-scoped `mse_…` or a tenant secret `sk_…`. */
|
|
947
|
+
token: string;
|
|
948
|
+
/** Absolute token expiry (epoch ms). Enables proactive in-place rotation. */
|
|
949
|
+
tokenExpiresAt?: number;
|
|
950
|
+
/** Initial mode. Default 'view'. */
|
|
951
|
+
mode?: SeatManagerMode;
|
|
952
|
+
/**
|
|
953
|
+
* The capability set this token was minted with. Supply it whenever you mint
|
|
954
|
+
* an `mse_…` grant — it is the only way the widget can know a delegated token
|
|
955
|
+
* carries `event:channels:manage`, and without it Channels mode stays
|
|
956
|
+
* read-only (fail-closed). A tenant secret (`sk_…`) is org authority and is
|
|
957
|
+
* never narrowed server-side, so it is treated as fully capable.
|
|
958
|
+
*/
|
|
959
|
+
capabilities?: SeatManagerCapability[] | string[];
|
|
960
|
+
/** ISO-4217 fallback currency for revenue (chart/event currency wins). */
|
|
961
|
+
currency?: string;
|
|
962
|
+
/** Chart theme override for the chrome (rails/bar). Chart colors come from the doc. */
|
|
963
|
+
theme?: ChartTheme;
|
|
964
|
+
/**
|
|
965
|
+
* Keep the canvas painting even when the tab is hidden/backgrounded (a war-room
|
|
966
|
+
* board on a second monitor). Calls `forceDraw()` after each delta so Chrome's
|
|
967
|
+
* rAF throttling on occluded tabs never leaves the board stale. Default true.
|
|
968
|
+
*/
|
|
969
|
+
keepLiveWhileHidden?: boolean;
|
|
970
|
+
/**
|
|
971
|
+
* Opt in to camera-following for new buyer holds/bookings. Off by default so
|
|
972
|
+
* a live event never steals an operator's current map context.
|
|
973
|
+
*/
|
|
974
|
+
followLive?: boolean;
|
|
975
|
+
/** Chart + first snapshot are loaded and the board is live. */
|
|
976
|
+
onReady?: () => void;
|
|
977
|
+
/** Live KPI tallies changed. */
|
|
978
|
+
onTallies?: (tallies: SeatManagerTallies) => void;
|
|
979
|
+
/** A grouped live/audit activity item arrived. */
|
|
980
|
+
onActivity?: (activity: SeatManagerActivity) => void;
|
|
981
|
+
/** Exact private control-room projection changed. */
|
|
982
|
+
onControlRoom?: (snapshot: ControlRoomSnapshot) => void;
|
|
983
|
+
/** Called before token expiry. The manager swaps the result without remounting. */
|
|
984
|
+
onTokenRefresh?: () => Promise<{
|
|
985
|
+
token: string;
|
|
986
|
+
expiresAt: number;
|
|
987
|
+
}>;
|
|
988
|
+
/** Tool/mode changed from inside the shared cockpit. */
|
|
989
|
+
onModeChange?: (mode: SeatManagerMode) => void;
|
|
990
|
+
/** Follow-live preference changed from inside the cockpit. */
|
|
991
|
+
onFollowLiveChange?: (enabled: boolean) => void;
|
|
992
|
+
/** Block-mode selection changed (marquee / ⌘A / category / section / tap). */
|
|
993
|
+
onSelectionChange?: (seats: ExpandedSeat[]) => void;
|
|
994
|
+
/** A block/unblock/cancel action completed successfully. */
|
|
995
|
+
onActionComplete?: (result: SeatManagerActionResult) => void;
|
|
996
|
+
/**
|
|
997
|
+
* The realtime link connected or dropped, with the moment the numbers on
|
|
998
|
+
* screen were last known good.
|
|
999
|
+
*
|
|
1000
|
+
* A host embedding this cockpit renders its own chrome around it, and until
|
|
1001
|
+
* now had no way to know the board had gone stale: the manager tracked the
|
|
1002
|
+
* drop internally (its own LIVE/RECONNECTING pill) and told nobody. A host
|
|
1003
|
+
* that polls on a timer and pauses while the tab is hidden therefore showed
|
|
1004
|
+
* arbitrarily old numbers that looked exactly like fresh ones.
|
|
1005
|
+
*/
|
|
1006
|
+
onConnectionChange?: (state: SeatManagerConnection) => void;
|
|
1007
|
+
onError?: (err: unknown) => void;
|
|
1008
|
+
}
|
|
1009
|
+
/** Realtime link state, as reported to the embedding host. */
|
|
1010
|
+
interface SeatManagerConnection {
|
|
1011
|
+
/** `live` while the socket is open; `reconnecting` from drop until reopen. */
|
|
1012
|
+
status: 'live' | 'reconnecting';
|
|
1013
|
+
/**
|
|
1014
|
+
* `Date.now()` of the last snapshot or delta accepted from the server, or
|
|
1015
|
+
* null before the first one. This is the honest "as of" for whatever the host
|
|
1016
|
+
* is displaying — NOT the time the connection dropped, which is later and
|
|
1017
|
+
* would overstate freshness.
|
|
1018
|
+
*/
|
|
1019
|
+
lastMessageAt: number | null;
|
|
1020
|
+
}
|
|
1021
|
+
declare class SeatManager {
|
|
1022
|
+
private readonly opts;
|
|
1023
|
+
private readonly api;
|
|
1024
|
+
private readonly key;
|
|
1025
|
+
private readonly keepLive;
|
|
1026
|
+
private host;
|
|
1027
|
+
private root;
|
|
1028
|
+
private mapHost;
|
|
1029
|
+
private els;
|
|
1030
|
+
private renderer;
|
|
1031
|
+
private doc;
|
|
1032
|
+
private mode;
|
|
1033
|
+
private labelToId;
|
|
1034
|
+
private labelToSeat;
|
|
1035
|
+
private allIds;
|
|
1036
|
+
/**
|
|
1037
|
+
* GA inventory units — real sellable labels the server counts, with NO seat
|
|
1038
|
+
* geometry and therefore no renderer binding. They live here rather than in
|
|
1039
|
+
* `labelToId`/`allIds` so every paint path keeps addressing paintable nodes
|
|
1040
|
+
* only, while the tally denominator finally covers the same universe the
|
|
1041
|
+
* numerator does. Without them a GA sale hit `booked` but not `total`:
|
|
1042
|
+
* Free under-reported by GA capacity and SOLD% could exceed 100%.
|
|
1043
|
+
*/
|
|
1044
|
+
private gaUnitLabelSet;
|
|
1045
|
+
private status;
|
|
1046
|
+
/** Live non-free counters, moved by each delta rather than re-walked. */
|
|
1047
|
+
private counts;
|
|
1048
|
+
/** Bumped whenever the seat model is replaced wholesale (a full snapshot). */
|
|
1049
|
+
private modelVersion;
|
|
1050
|
+
private currency;
|
|
1051
|
+
private authoritativeGrossRevenue;
|
|
1052
|
+
private revenueStatus;
|
|
1053
|
+
private revenueRequest;
|
|
1054
|
+
private controlRoomSnapshot;
|
|
1055
|
+
/**
|
|
1056
|
+
* The server's own totals, pinned to the client model they were read against.
|
|
1057
|
+
* Display = server baseline + (client now − client then), so the authoritative
|
|
1058
|
+
* numbers land exactly on arrival and deltas still move them between reads.
|
|
1059
|
+
* A wholesale model replacement invalidates the pairing (`model`), and the
|
|
1060
|
+
* client tallies — themselves a fresh authenticated read — take over.
|
|
1061
|
+
*/
|
|
1062
|
+
private serverBaseline;
|
|
1063
|
+
/** Latest presence frame, held whether or not a snapshot has landed yet. */
|
|
1064
|
+
private livePresence;
|
|
1065
|
+
/** Latest cumulative booked gross pushed on a delta frame. */
|
|
1066
|
+
private liveGross;
|
|
1067
|
+
/** Coalesces a burst of deltas into one KPI/rail repaint. */
|
|
1068
|
+
private paintHandle;
|
|
1069
|
+
private trendWindowMinutes;
|
|
1070
|
+
private heatEnabled;
|
|
1071
|
+
private followLive;
|
|
1072
|
+
private lastKpiValues;
|
|
1073
|
+
private activeKpiDeltas;
|
|
1074
|
+
private ws;
|
|
1075
|
+
private reconnectTimer;
|
|
1076
|
+
private attempt;
|
|
1077
|
+
private closed;
|
|
1078
|
+
/** Mirrors the `live` root class, so the getter never has to read the DOM. */
|
|
1079
|
+
private connectionStatus;
|
|
1080
|
+
/** When the server last told us something. Stamped on accepted traffic only —
|
|
1081
|
+
* a socket that opens and says nothing has not refreshed anything. */
|
|
1082
|
+
private lastMessageAt;
|
|
1083
|
+
private ready;
|
|
1084
|
+
private feed;
|
|
1085
|
+
private feedTimer;
|
|
1086
|
+
private toastTimer;
|
|
1087
|
+
private liveEventTimer;
|
|
1088
|
+
private kpiCleanupTimer;
|
|
1089
|
+
private followLiveTimer;
|
|
1090
|
+
private followSeatTimer;
|
|
1091
|
+
private releaseAt;
|
|
1092
|
+
private layoutObserver;
|
|
1093
|
+
private tokenExpiresAt;
|
|
1094
|
+
private tokenRefreshTimer;
|
|
1095
|
+
private tokenRefreshInFlight;
|
|
1096
|
+
private sectionByObject;
|
|
1097
|
+
private sectionLabelById;
|
|
1098
|
+
private sectionsBase;
|
|
1099
|
+
private availabilityRules;
|
|
1100
|
+
private effectiveHidden;
|
|
1101
|
+
private effectiveClosed;
|
|
1102
|
+
private availabilitySaving;
|
|
1103
|
+
private lastSyncedAt;
|
|
1104
|
+
private blockedQuery;
|
|
1105
|
+
private blockedSection;
|
|
1106
|
+
private blockedResultLimit;
|
|
1107
|
+
private unblockAllConfirmTimer;
|
|
1108
|
+
/**
|
|
1109
|
+
* Sales channels (M6b).
|
|
1110
|
+
*
|
|
1111
|
+
* Two fields, and the split between them is the whole point. `channelCaps` is
|
|
1112
|
+
* AUTHORITY and is known early — it is read from the token's declared
|
|
1113
|
+
* capabilities before the first rail paint, so the Channels pill either
|
|
1114
|
+
* exists from the start or never appears. `channels` is the loaded sub-app,
|
|
1115
|
+
* and it now arrives late: its module is fetched on first entry into Channels
|
|
1116
|
+
* mode (`ensureChannels`), not at mount.
|
|
1117
|
+
*
|
|
1118
|
+
* So every gate that used to ask `!!this.channels` — the pill, the mode
|
|
1119
|
+
* whitelist, the `c` shortcut — asks `channelCaps.view` instead. Asking the
|
|
1120
|
+
* instance would make a permission the member genuinely has look like one
|
|
1121
|
+
* they do not for as long as a network fetch takes.
|
|
1122
|
+
*/
|
|
1123
|
+
private channels;
|
|
1124
|
+
private channelCaps;
|
|
1125
|
+
/** In-flight `import('./channelsMode')`, so concurrent entries load once. */
|
|
1126
|
+
private channelsLoading;
|
|
1127
|
+
private readonly onFullscreenChange;
|
|
1128
|
+
private readonly onKeyDown;
|
|
1129
|
+
private readonly onRailClick;
|
|
1130
|
+
constructor(options: SeatManagerOptions);
|
|
1131
|
+
/** Build the DOM, load the chart, subscribe to realtime, mount the board. */
|
|
1132
|
+
render(): Promise<this>;
|
|
1133
|
+
setMode(mode: SeatManagerMode): void;
|
|
1134
|
+
/**
|
|
1135
|
+
* Decide what this token may do with sales channels.
|
|
1136
|
+
*
|
|
1137
|
+
* Declared capabilities win — a host that mints an `mse_…` grant knows exactly
|
|
1138
|
+
* what it asked for. Otherwise a tenant secret (`sk_…`) is org authority the
|
|
1139
|
+
* worker never narrows, so it is fully capable; and a delegated token with no
|
|
1140
|
+
* declaration is probed for read access and then treated as READ-ONLY, because
|
|
1141
|
+
* "we could not tell" must never render mutation controls.
|
|
1142
|
+
*/
|
|
1143
|
+
private resolveChannelCapabilities;
|
|
1144
|
+
/**
|
|
1145
|
+
* Load Channels mode, once, on first entry.
|
|
1146
|
+
*
|
|
1147
|
+
* Everything about this method is shaped by one rule: the cockpit must stay
|
|
1148
|
+
* usable and honest while the module is in the air.
|
|
1149
|
+
*
|
|
1150
|
+
* - The promise is memoized, so a member who taps the pill twice, or a host
|
|
1151
|
+
* whose deep link and initial `mode` prop both ask for Channels, loads one
|
|
1152
|
+
* module and builds one instance.
|
|
1153
|
+
* - Authority is re-checked on arrival. A token rotation can revoke
|
|
1154
|
+
* `event:channels:view` between the tap and the load, and building the
|
|
1155
|
+
* sub-app for a token that no longer carries the capability would put
|
|
1156
|
+
* mutation controls on screen that every server call then refuses.
|
|
1157
|
+
* - The mode is re-checked too. Someone who taps Channels and then Monitor
|
|
1158
|
+
* before the chunk lands must not be yanked into Channels when it does; the
|
|
1159
|
+
* instance is kept (it is paid for) but only entered if we are still there.
|
|
1160
|
+
* - A failed load is stated in the rail rather than swallowed. Channels is a
|
|
1161
|
+
* whole surface — silently showing an empty one would read as "this event
|
|
1162
|
+
* has no channels", which is a lie about inventory.
|
|
1163
|
+
*/
|
|
1164
|
+
private ensureChannels;
|
|
1165
|
+
/** The adapter between the cockpit's internals and Channels mode. */
|
|
1166
|
+
private buildChannelsHost;
|
|
1167
|
+
/** Actual on-screen seat diameter, for the channel overlay's marks. The
|
|
1168
|
+
* renderer's base seat radius is 9 chart units; retaining the camera scale
|
|
1169
|
+
* (rather than capping it) keeps every preview paint aligned with the real
|
|
1170
|
+
* chart geometry at deep zoom. */
|
|
1171
|
+
private seatPixelSize;
|
|
1172
|
+
/** Toggle the normalized sales-velocity outline overlay without changing seat colors. */
|
|
1173
|
+
setHeatOverlay(enabled: boolean): void;
|
|
1174
|
+
/** Toggle opt-in camera following for new buyer hold/book events. */
|
|
1175
|
+
setFollowLive(enabled: boolean): void;
|
|
1176
|
+
/** Change the current-vs-previous sales window and refresh the private projection. */
|
|
1177
|
+
setTrendWindow(windowMinutes: number): Promise<ControlRoomSnapshot>;
|
|
1178
|
+
enterFullscreen(): Promise<void>;
|
|
1179
|
+
exitFullscreen(): Promise<void>;
|
|
1180
|
+
isFullscreen(): boolean;
|
|
1181
|
+
private toggleFullscreen;
|
|
1182
|
+
/** Rotate the delegated credential without rebuilding DOM, canvas or socket. */
|
|
1183
|
+
setToken(token: string, expiresAt?: number): void;
|
|
1184
|
+
private scheduleTokenRefresh;
|
|
1185
|
+
private rotateToken;
|
|
1186
|
+
/** Bulk block the given labels (or the current selection when omitted). */
|
|
1187
|
+
block(labels?: string[], opts?: {
|
|
1188
|
+
releaseAt?: number;
|
|
1189
|
+
reason?: string;
|
|
1190
|
+
}): Promise<void>;
|
|
1191
|
+
unblock(labels?: string[]): Promise<void>;
|
|
1192
|
+
unblockAll(): Promise<void>;
|
|
1193
|
+
/** Cancel bookings (BOOKED → free), guarded by the original booking ref. */
|
|
1194
|
+
cancelBooking(labels: string[], bookingRef: string): Promise<void>;
|
|
1195
|
+
selectAll(): ExpandedSeat[];
|
|
1196
|
+
selectSection(sectionId: string): ExpandedSeat[];
|
|
1197
|
+
selectByLabels(labels: string[]): ExpandedSeat[];
|
|
1198
|
+
clearSelection(): void;
|
|
1199
|
+
getSelection(): ExpandedSeat[];
|
|
1200
|
+
getReport(): Promise<ReportResult>;
|
|
1201
|
+
getControlRoomSnapshot(windowMinutes?: number): Promise<ControlRoomSnapshot>;
|
|
1202
|
+
/**
|
|
1203
|
+
* The realtime link's current state and the "as of" behind it.
|
|
1204
|
+
*
|
|
1205
|
+
* Pair with `onConnectionChange` for the edges: a host that mounts after a
|
|
1206
|
+
* drop, or re-reads on tab focus, needs to be able to ASK rather than wait
|
|
1207
|
+
* for the next transition that may never come.
|
|
1208
|
+
*/
|
|
1209
|
+
getConnection(): SeatManagerConnection;
|
|
1210
|
+
getLog(opts?: {
|
|
1211
|
+
limit?: number;
|
|
1212
|
+
before?: number;
|
|
1213
|
+
}): Promise<{
|
|
1214
|
+
entries: LogEntry[];
|
|
1215
|
+
nextBefore: number | null;
|
|
1216
|
+
}>;
|
|
1217
|
+
setHoldTtl(ms: number | null): Promise<void>;
|
|
1218
|
+
/** M2 — box-office booking from free seats. Stubbed (route is session-only today). */
|
|
1219
|
+
boxBook(_labels: string[], _bookingRef: string): Promise<void>;
|
|
1220
|
+
zoomToFit(): void;
|
|
1221
|
+
destroy(): void;
|
|
1222
|
+
private buildRenderer;
|
|
1223
|
+
/** Block always uses a marquee. Channels only enables its marquee after the
|
|
1224
|
+
* organizer deliberately chooses Assign seats; Pan map keeps desktop drag
|
|
1225
|
+
* available for large charts. */
|
|
1226
|
+
private isBulkSelectMode;
|
|
1227
|
+
/**
|
|
1228
|
+
* Block never touches held or booked inventory, so it cannot select it.
|
|
1229
|
+
* Channels must be able to select it — the Review sheet's honesty depends on
|
|
1230
|
+
* counting the held and sold units inside a marquee and saying they will not
|
|
1231
|
+
* move, rather than silently omitting them from the selection.
|
|
1232
|
+
*/
|
|
1233
|
+
private selectableStatuses;
|
|
1234
|
+
private updateRendererInteraction;
|
|
1235
|
+
private handleSeatSelect;
|
|
1236
|
+
/**
|
|
1237
|
+
* Build the client's inventory universe from the chart.
|
|
1238
|
+
*
|
|
1239
|
+
* `expandChart` yields SEATS — it has no output for a GA area, whose capacity
|
|
1240
|
+
* is sold as N synthetic unit labels. The server's seat map keys, its deltas
|
|
1241
|
+
* and its `totals` all speak those labels, so a client that only knows seats
|
|
1242
|
+
* counts GA sales in the numerator (every key of the snapshot is written into
|
|
1243
|
+
* `status`) while leaving them out of the denominator. Registering the GA
|
|
1244
|
+
* units here — labels only, never a render binding — is what makes the two
|
|
1245
|
+
* agree.
|
|
1246
|
+
*/
|
|
1247
|
+
private buildUnitUniverse;
|
|
1248
|
+
/** Every sellable unit the client knows: seats + GA capacity. */
|
|
1249
|
+
private unitTotal;
|
|
1250
|
+
/** Every label the client models, whether or not it can be painted. */
|
|
1251
|
+
private knownLabels;
|
|
1252
|
+
private repaintAll;
|
|
1253
|
+
/**
|
|
1254
|
+
* Open the cockpit's realtime socket AS THE ORGANIZER.
|
|
1255
|
+
*
|
|
1256
|
+
* The scope has to be established before the upgrade, because a browser
|
|
1257
|
+
* `WebSocket` cannot send an Authorization header: the manage token is traded
|
|
1258
|
+
* over HTTPS for a one-use ticket which rides in `Sec-WebSocket-Protocol`.
|
|
1259
|
+
* Without it the server treats this socket as an anonymous public buyer and
|
|
1260
|
+
* projects its deltas, so any change inside a private channel allocation is
|
|
1261
|
+
* structurally suppressed and the map silently drifts.
|
|
1262
|
+
*
|
|
1263
|
+
* If the mint fails (an expired token, a worker that predates the route) we
|
|
1264
|
+
* still connect unticketed rather than going dark — the public-sale stream is
|
|
1265
|
+
* worth having, and every `resnapshot()` re-establishes physical truth from
|
|
1266
|
+
* the authenticated HTTP read.
|
|
1267
|
+
*/
|
|
1268
|
+
private connect;
|
|
1269
|
+
private scheduleReconnect;
|
|
1270
|
+
private onMessage;
|
|
1271
|
+
/**
|
|
1272
|
+
* Adopt the cumulative booked gross a delta frame carried.
|
|
1273
|
+
*
|
|
1274
|
+
* Stashed with its arrival time so an in-flight control-room read can decide
|
|
1275
|
+
* whether it is holding the newer number: a frame that landed after the
|
|
1276
|
+
* request started is newer than the response, one that landed before is not.
|
|
1277
|
+
*/
|
|
1278
|
+
private applyLiveGross;
|
|
1279
|
+
/** The single writer for a label's status, so the counters never drift. */
|
|
1280
|
+
private setStatusLabel;
|
|
1281
|
+
private resnapshot;
|
|
1282
|
+
/**
|
|
1283
|
+
* Replace the whole seat model.
|
|
1284
|
+
*
|
|
1285
|
+
* `fallback` is the compact frame's modal status: those snapshots list only
|
|
1286
|
+
* the seats that DIFFER from it, so every other known label takes it. Without
|
|
1287
|
+
* this the omitted majority would silently fall back to `free` — fine when
|
|
1288
|
+
* the mode really is free, wrong the moment it is not.
|
|
1289
|
+
*/
|
|
1290
|
+
private applySnapshot;
|
|
1291
|
+
/** The one O(n) walk left: a wholesale model replacement re-bases the counters. */
|
|
1292
|
+
private recountAll;
|
|
1293
|
+
/** Optimistic local write shared by organizer actions. Paint and tally once,
|
|
1294
|
+
* even when an arena-sized operation changes hundreds of seats. */
|
|
1295
|
+
private setSeatsLocal;
|
|
1296
|
+
/** Keep the canvas painting on hidden/occluded tabs (war-room second monitor). */
|
|
1297
|
+
private afterPaint;
|
|
1298
|
+
private activityColor;
|
|
1299
|
+
private sectionsForLabels;
|
|
1300
|
+
private pulseSeatLabels;
|
|
1301
|
+
/** Render one grouped realtime operation at the right semantic zoom level. */
|
|
1302
|
+
private paintSpatialActivity;
|
|
1303
|
+
private locateSection;
|
|
1304
|
+
private locateActivity;
|
|
1305
|
+
private showLiveEvent;
|
|
1306
|
+
private applyReportRevenue;
|
|
1307
|
+
/**
|
|
1308
|
+
* Read the server's own control-room projection.
|
|
1309
|
+
*
|
|
1310
|
+
* Called on mount, on every socket (re)connect and after an organizer action —
|
|
1311
|
+
* never on a timer and never per delta frame. Presence and gross that arrived
|
|
1312
|
+
* on the socket AFTER this request started are newer than the response, so
|
|
1313
|
+
* they survive it; anything older defers to the read.
|
|
1314
|
+
*/
|
|
1315
|
+
private refreshControlRoom;
|
|
1316
|
+
/** Pin the server's totals to the client model they were read against. */
|
|
1317
|
+
private rebaseServerTotals;
|
|
1318
|
+
/** What the client's own model says — GA units included since `render()`. */
|
|
1319
|
+
private clientTallies;
|
|
1320
|
+
/**
|
|
1321
|
+
* The numbers the KPI bar and rail render.
|
|
1322
|
+
*
|
|
1323
|
+
* The server is the authority: its totals land exactly as read, and the
|
|
1324
|
+
* delta-driven client model carries them forward until the next read. Before
|
|
1325
|
+
* the first snapshot — and after a wholesale model replacement invalidates the
|
|
1326
|
+
* pairing — the client model stands alone.
|
|
1327
|
+
*/
|
|
1328
|
+
private buildTallies;
|
|
1329
|
+
/**
|
|
1330
|
+
* Queue one KPI/rail repaint for this burst of changes.
|
|
1331
|
+
*
|
|
1332
|
+
* A delta frame can carry hundreds of seats and `paintKpis` rebuilds eight
|
|
1333
|
+
* nodes from scratch, so painting per change is what made an arena-sized
|
|
1334
|
+
* frame expensive. Coalescing on a frame keeps the burst to a single rebuild;
|
|
1335
|
+
* without `requestAnimationFrame` (SSR, an older test env) it paints inline
|
|
1336
|
+
* rather than dropping the update.
|
|
1337
|
+
*/
|
|
1338
|
+
private recomputeTallies;
|
|
1339
|
+
private flushTallies;
|
|
1340
|
+
private verbFor;
|
|
1341
|
+
private pushActivity;
|
|
1342
|
+
private seedFeed;
|
|
1343
|
+
private startFeedClock;
|
|
1344
|
+
private selectionLabels;
|
|
1345
|
+
private syncSelection;
|
|
1346
|
+
private buildChrome;
|
|
1347
|
+
private updateContainerLayout;
|
|
1348
|
+
private sectionOptions;
|
|
1349
|
+
private buildSectionOptions;
|
|
1350
|
+
private paintModeTabs;
|
|
1351
|
+
private paintFollowLiveButton;
|
|
1352
|
+
private paintHeatButton;
|
|
1353
|
+
private paintMomentumHelp;
|
|
1354
|
+
private paintFullscreenButton;
|
|
1355
|
+
private paintTrendWindow;
|
|
1356
|
+
private setLive;
|
|
1357
|
+
private updateZoomHint;
|
|
1358
|
+
private formatKpiDelta;
|
|
1359
|
+
private paintKpis;
|
|
1360
|
+
private paintRail;
|
|
1361
|
+
private renderViewRail;
|
|
1362
|
+
/** Live presence wins over the snapshot's copy — it is the fresher channel,
|
|
1363
|
+
* and it exists from the first frame rather than the first fetch. */
|
|
1364
|
+
private presenceCounts;
|
|
1365
|
+
private paintMonitorInsights;
|
|
1366
|
+
private applyHeatOverlay;
|
|
1367
|
+
private renderInspectRail;
|
|
1368
|
+
/** Pull the organizer's availability rules (event:view). Called on load and on
|
|
1369
|
+
* every WS (re)connect, mirroring how the other panels re-hydrate. `closed` is
|
|
1370
|
+
* deterministic from the rules; `hidden` (which folds in already-due timed /
|
|
1371
|
+
* threshold windows) comes from the snapshot + WS effective set. */
|
|
1372
|
+
private refreshAvailability;
|
|
1373
|
+
/** Run a token-authed op; on a 401 re-mint via onTokenRefresh and retry once. */
|
|
1374
|
+
private withAuthRetry;
|
|
1375
|
+
private closedIdsFromRules;
|
|
1376
|
+
/** Adopt a new effective hidden/closed set (from a snapshot or WS broadcast) and
|
|
1377
|
+
* repaint the rail + canvas when it actually moves. */
|
|
1378
|
+
private updateEffectiveAvailability;
|
|
1379
|
+
/** Canvas read of the availability state: dim hidden sections to a whisper,
|
|
1380
|
+
* half-light closed sections, leave open sections normal. Only in Sections mode;
|
|
1381
|
+
* cleared in every other tool. */
|
|
1382
|
+
private applySectionCanvasTreatment;
|
|
1383
|
+
/** Zone-grouped render tree: each zone header then its sections (which follow the
|
|
1384
|
+
* zone window), then loose sections + the ungrouped bucket. Effective hidden /
|
|
1385
|
+
* closed come from the live sets, rules from the organizer map. */
|
|
1386
|
+
private buildSectionRows;
|
|
1387
|
+
private renderSectionsRail;
|
|
1388
|
+
private sectionRowHtml;
|
|
1389
|
+
private wireSectionRail;
|
|
1390
|
+
/** Change one row's availability mode. A zone rule subsumes its child section
|
|
1391
|
+
* rules, so those are dropped from the map (the zone window is the truth). */
|
|
1392
|
+
private setSectionMode;
|
|
1393
|
+
/** Edit a timed reveal time / threshold percent on an existing row rule. */
|
|
1394
|
+
private setSectionRulePatch;
|
|
1395
|
+
/** Optimistically adopt the new rules, then reconcile with the server-cleaned
|
|
1396
|
+
* map + effective hidden/closed sets. Rolls back the rules on failure. */
|
|
1397
|
+
private persistAvailability;
|
|
1398
|
+
private paintLegend;
|
|
1399
|
+
private paintFeed;
|
|
1400
|
+
private renderBlockRail;
|
|
1401
|
+
private toggleCategory;
|
|
1402
|
+
/** A category/filter is a real toggle: add the missing seats, or remove the
|
|
1403
|
+
* whole group when every eligible seat in it is already selected. */
|
|
1404
|
+
private toggleLabels;
|
|
1405
|
+
private isBlockSelectable;
|
|
1406
|
+
private paintSelBar;
|
|
1407
|
+
private paintCategoryControls;
|
|
1408
|
+
private filteredBlockedSeats;
|
|
1409
|
+
private paintBlockedInventory;
|
|
1410
|
+
private confirmUnblockAll;
|
|
1411
|
+
private resetUnblockAllConfirm;
|
|
1412
|
+
private done;
|
|
1413
|
+
private toastOk;
|
|
1414
|
+
private toastErr;
|
|
1415
|
+
private toast;
|
|
1416
|
+
private fail;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
export { bucketRows as $, type AssignmentResult as A, type BucketRow as B, type ChannelListResult as C, type ReportCategoryMeta as D, type ReportCategoryRow as E, type ReportResult as F, type SeatManagerActionResult as G, type SeatManagerActivity as H, type IntentSwitchBlockedDetails as I, type SeatManagerCapability as J, type SeatManagerConnection as K, type LogEntry as L, ManageApi as M, type SeatManagerMode as N, type SeatManagerOptions as O, PUBLIC_CHANNEL_ID as P, type SeatManagerTallies as Q, type ReportByStatus as R, SeatManager as S, type SelectionSourceRow as T, accessIntentDescription as U, accessIntentLabel as V, accessLine as W, accessLinkBadge as X, accessLinkErrorCopy as Y, accessLinkIsLive as Z, accessLinkPolicyLines as _, type ChannelAllocationPage as a, dropReviewRows as a0, intentForbidsCopy as a1, intentSwitchBlockedCopy as a2, isPublicChannelId as a3, markerLetter as a4, markerOf as a5, mutationCount as a6, needsMoveConfirmation as a7, planAssignment as a8, retryAfterCopy as a9, selectionSources as aa, stateBadge as ab, suggestMarker as ac, type ChannelRecord as b, type ChannelPreviewProjection as c, type ChannelAccessIntent as d, type AccessLinkReveal as e, type AccessLinkStatusRecord as f, type ChannelSeatStatus as g, ACCESS_LINK_DEFAULTS as h, type AccessIntentForbidsDetails as i, type AccessLinkRecord as j, type AccessLinkState as k, type AccessLinkStatus as l, type ArchiveBlockedDetails as m, type AssignmentBuckets as n, type AssignmentDropDetails as o, type ChannelAccessSummary as p, type ChannelAuditEntry as q, type ChannelAuditPage as r, type ChannelCounts as s, type ChannelState as t, type ControlRoomActivityEntry as u, type ControlRoomSectionMetric as v, type ControlRoomSnapshot as w, type LogPage as x, ManageApiError as y, PUBLIC_CHANNEL_NAME as z };
|