@seatlayer/js 0.51.0 → 0.53.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/LICENSE +16 -17
- package/README.md +2 -2
- package/dist/channelsMode-BX7s9bUl.d.cts +2241 -0
- package/dist/channelsMode-BX7s9bUl.d.ts +2241 -0
- package/dist/channelsMode-RUNPEHKD.js +1 -0
- package/dist/chunk-7F6RSJRL.js +695 -0
- package/dist/chunk-OSZ7DOEH.js +1 -0
- package/dist/hostedCheckout-3NTOVIZG.js +35 -0
- package/dist/index.cjs +103 -7371
- package/dist/index.d.cts +187 -96
- package/dist/index.d.ts +187 -96
- package/dist/index.js +102 -6992
- package/dist/manager.cjs +298 -5656
- package/dist/manager.d.cts +8 -2261
- package/dist/manager.d.ts +8 -2261
- package/dist/manager.js +71 -2418
- package/package.json +3 -8
- package/dist/channelsMode-S4GEWCWS.js +0 -12
- package/dist/channelsMode-S4GEWCWS.js.map +0 -1
- package/dist/chunk-5URCWBHM.js +0 -3683
- package/dist/chunk-5URCWBHM.js.map +0 -1
- package/dist/chunk-HMLY7DHA.js +0 -16
- package/dist/chunk-HMLY7DHA.js.map +0 -1
- package/dist/hostedCheckout-GVS6UKYA.js +0 -370
- package/dist/hostedCheckout-GVS6UKYA.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/manager.cjs.map +0 -1
- package/dist/manager.js.map +0 -1
|
@@ -0,0 +1,2241 @@
|
|
|
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>`. Browser code must
|
|
397
|
+
* use a short-lived, event-scoped organizer grant (`mse_…`, minted by a
|
|
398
|
+
* trusted backend). The low-level client retains tenant-secret (`sk_…`)
|
|
399
|
+
* compatibility for trusted server runtimes only; never pass one to
|
|
400
|
+
* SeatManager or any other browser bundle.
|
|
401
|
+
* - `credentials: 'omit'` — there is no session cookie; the CMS runs
|
|
402
|
+
* cross-origin. The worker's credentialed CORS still echoes the CMS origin.
|
|
403
|
+
* - chart geometry and authored media use authenticated organizer Event
|
|
404
|
+
* routes. A manage bearer is not buyer authority and is never sent to
|
|
405
|
+
* `/pub`. The seat STATE reads are private too. `/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
|
+
* Managed sales are deliberately not exposed by this browser client. Create
|
|
413
|
+
* them from trusted server code through the inventory booking API; SeatManager
|
|
414
|
+
* exposes only the organizer operations it can actually complete itself.
|
|
415
|
+
*/
|
|
416
|
+
|
|
417
|
+
/** One page of the organizer-only label → channel projection. */
|
|
418
|
+
interface ChannelAllocationPage {
|
|
419
|
+
assignmentVersion: number;
|
|
420
|
+
allocations: Array<{
|
|
421
|
+
label: string;
|
|
422
|
+
channelId: string;
|
|
423
|
+
}>;
|
|
424
|
+
nextAfterLabel: string | null;
|
|
425
|
+
}
|
|
426
|
+
interface ChannelAuditEntry {
|
|
427
|
+
id: number;
|
|
428
|
+
at: number;
|
|
429
|
+
actor: string | null;
|
|
430
|
+
action: string;
|
|
431
|
+
channelId: string | null;
|
|
432
|
+
assignmentVersion: number;
|
|
433
|
+
before: unknown;
|
|
434
|
+
after: unknown;
|
|
435
|
+
reason: string | null;
|
|
436
|
+
}
|
|
437
|
+
interface ChannelAuditPage {
|
|
438
|
+
entries: ChannelAuditEntry[];
|
|
439
|
+
nextBefore: number | null;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Buyer projection for a preview audience — the same scoped server view the
|
|
443
|
+
* buyer SDK receives. When an audience cannot be previewed (a paused or
|
|
444
|
+
* archived channel), the server answers `{available:false, unavailable:[…]}`
|
|
445
|
+
* and the UI shows the real paused/unavailable landing state instead of
|
|
446
|
+
* rendering those seats as eligible.
|
|
447
|
+
*
|
|
448
|
+
* Fields stay optional: a worker that predates the hardening merge 404s here,
|
|
449
|
+
* and Channels mode says the preview needs a newer server rather than faking a
|
|
450
|
+
* projection client-side.
|
|
451
|
+
*/
|
|
452
|
+
interface ChannelPreviewProjection {
|
|
453
|
+
available?: boolean;
|
|
454
|
+
unavailable?: Array<{
|
|
455
|
+
channelId: string;
|
|
456
|
+
state: 'paused' | 'archived' | string;
|
|
457
|
+
}>;
|
|
458
|
+
channelIds?: string[];
|
|
459
|
+
includePublic?: boolean;
|
|
460
|
+
/** Labels this audience may buy. Everything else renders as ONE neutral
|
|
461
|
+
* unavailable state so preview never leaks which channel holds a seat. */
|
|
462
|
+
eligible?: string[];
|
|
463
|
+
counts?: {
|
|
464
|
+
eligible?: number;
|
|
465
|
+
free?: number;
|
|
466
|
+
held?: number;
|
|
467
|
+
booked?: number;
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
declare class ManageApiError extends Error {
|
|
471
|
+
status: number;
|
|
472
|
+
code?: string;
|
|
473
|
+
/** Present when a block/unbook 409s because seats were just taken. */
|
|
474
|
+
conflicts?: {
|
|
475
|
+
label: string;
|
|
476
|
+
reason?: string;
|
|
477
|
+
}[];
|
|
478
|
+
/**
|
|
479
|
+
* Structured refusal detail. The channel routes use it for the two 409s a UI
|
|
480
|
+
* must render rather than merely report: `channel_archive_blocked_by_holds`
|
|
481
|
+
* carries {activeHolds, heldUnits, latestHoldExpiresAt, retryAfterMs}, and
|
|
482
|
+
* `channel_assignment_conflict` carries the current assignmentVersion.
|
|
483
|
+
*/
|
|
484
|
+
details?: Record<string, unknown>;
|
|
485
|
+
/**
|
|
486
|
+
* The server's own human sentence, when it sent one. `message` is the machine
|
|
487
|
+
* code (that is what `error` carries), so a UI that wants to state a PLATFORM
|
|
488
|
+
* RULE — "redemptions must be between 1 and 10 000" — reads this instead of
|
|
489
|
+
* re-encoding the bound locally and risking disagreement with the server.
|
|
490
|
+
*/
|
|
491
|
+
serverMessage?: string;
|
|
492
|
+
constructor(status: number, message: string, code?: string, conflicts?: {
|
|
493
|
+
label: string;
|
|
494
|
+
reason?: string;
|
|
495
|
+
}[], details?: Record<string, unknown>, serverMessage?: string);
|
|
496
|
+
}
|
|
497
|
+
interface ReportByStatus {
|
|
498
|
+
free: number;
|
|
499
|
+
held: number;
|
|
500
|
+
booked: number;
|
|
501
|
+
not_for_sale: number;
|
|
502
|
+
}
|
|
503
|
+
interface ReportCategoryRow {
|
|
504
|
+
category: string;
|
|
505
|
+
total: number;
|
|
506
|
+
free: number;
|
|
507
|
+
held: number;
|
|
508
|
+
booked: number;
|
|
509
|
+
not_for_sale: number;
|
|
510
|
+
/** Configured-price snapshots for booked inventory; not proof of payment. */
|
|
511
|
+
bookedValue: number;
|
|
512
|
+
/** @deprecated Use `bookedValue`. */
|
|
513
|
+
bookedRevenue: number;
|
|
514
|
+
}
|
|
515
|
+
interface ReportCategoryMeta {
|
|
516
|
+
key: string;
|
|
517
|
+
label: string;
|
|
518
|
+
color: string;
|
|
519
|
+
price: number;
|
|
520
|
+
}
|
|
521
|
+
interface ReportResult {
|
|
522
|
+
report: {
|
|
523
|
+
byStatus: ReportByStatus;
|
|
524
|
+
byCategory: ReportCategoryRow[];
|
|
525
|
+
bySection?: ControlRoomSectionMetric[];
|
|
526
|
+
};
|
|
527
|
+
event: {
|
|
528
|
+
key: string;
|
|
529
|
+
name: string;
|
|
530
|
+
seatTotal: number;
|
|
531
|
+
currency?: string;
|
|
532
|
+
};
|
|
533
|
+
categories: ReportCategoryMeta[];
|
|
534
|
+
}
|
|
535
|
+
interface ControlRoomSectionMetric {
|
|
536
|
+
sectionId: string;
|
|
537
|
+
sectionLabel: string;
|
|
538
|
+
zoneId: string | null;
|
|
539
|
+
total: number;
|
|
540
|
+
free: number;
|
|
541
|
+
held: number;
|
|
542
|
+
booked: number;
|
|
543
|
+
not_for_sale: number;
|
|
544
|
+
bookedValue: number;
|
|
545
|
+
/** @deprecated Use `bookedValue`. */
|
|
546
|
+
bookedRevenue: number;
|
|
547
|
+
}
|
|
548
|
+
/** Recent seat-state change safe for an event:view control-room grant. Full
|
|
549
|
+
* audit references remain available only through the event:reports log API. */
|
|
550
|
+
interface ControlRoomActivityEntry {
|
|
551
|
+
id: number;
|
|
552
|
+
at: number;
|
|
553
|
+
action: string;
|
|
554
|
+
labels: string[];
|
|
555
|
+
}
|
|
556
|
+
interface ControlRoomSnapshot {
|
|
557
|
+
version: number;
|
|
558
|
+
currency: string;
|
|
559
|
+
totals: {
|
|
560
|
+
free: number;
|
|
561
|
+
held: number;
|
|
562
|
+
booked: number;
|
|
563
|
+
blocked: number;
|
|
564
|
+
};
|
|
565
|
+
/** Configured value attached to booked inventory, never payment revenue. */
|
|
566
|
+
bookedValue: {
|
|
567
|
+
gross: number;
|
|
568
|
+
bySection: ControlRoomSectionMetric[];
|
|
569
|
+
};
|
|
570
|
+
/** @deprecated Use `bookedValue`. */
|
|
571
|
+
revenue: {
|
|
572
|
+
gross: number;
|
|
573
|
+
bySection: ControlRoomSectionMetric[];
|
|
574
|
+
};
|
|
575
|
+
velocity: {
|
|
576
|
+
windowMinutes: number;
|
|
577
|
+
bySection: Array<{
|
|
578
|
+
sectionId: string;
|
|
579
|
+
netBooked: number;
|
|
580
|
+
bookedValue: number;
|
|
581
|
+
/** @deprecated Use `bookedValue`. */
|
|
582
|
+
grossRevenue: number;
|
|
583
|
+
previousNetBooked: number;
|
|
584
|
+
trend: 'rising' | 'steady' | 'cooling';
|
|
585
|
+
}>;
|
|
586
|
+
};
|
|
587
|
+
presence: {
|
|
588
|
+
shoppingSessions: number;
|
|
589
|
+
activeHolds: number;
|
|
590
|
+
};
|
|
591
|
+
/** Present on workers that support reload-safe activity hydration. */
|
|
592
|
+
activity?: ControlRoomActivityEntry[];
|
|
593
|
+
event: {
|
|
594
|
+
key: string;
|
|
595
|
+
name: string;
|
|
596
|
+
seatTotal: number;
|
|
597
|
+
currency?: string;
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
interface LogEntry {
|
|
601
|
+
id: number;
|
|
602
|
+
at: number;
|
|
603
|
+
action: string;
|
|
604
|
+
labels: string[];
|
|
605
|
+
ref: string | null;
|
|
606
|
+
}
|
|
607
|
+
interface LogPage {
|
|
608
|
+
entries: LogEntry[];
|
|
609
|
+
nextBefore: number | null;
|
|
610
|
+
}
|
|
611
|
+
/** Platform/SDK inventory history — deliberately unrelated to commerce Orders. */
|
|
612
|
+
type InventoryBookingState = 'booked' | 'partially_cancelled' | 'cancelled';
|
|
613
|
+
interface InventoryBookingObject {
|
|
614
|
+
label: string;
|
|
615
|
+
objectId: string;
|
|
616
|
+
objectType: 'seat' | 'booth' | 'ga' | 'table';
|
|
617
|
+
categoryKey: string;
|
|
618
|
+
sectionId: string | null;
|
|
619
|
+
sectionLabel: string | null;
|
|
620
|
+
zoneId: string | null;
|
|
621
|
+
tierId: string | null;
|
|
622
|
+
releaseId: string | null;
|
|
623
|
+
bookingMode: 'individual' | 'whole' | 'variable';
|
|
624
|
+
quantity: number;
|
|
625
|
+
/** Event-configured price snapshot; not proof of what a buyer paid. */
|
|
626
|
+
unitPrice: number;
|
|
627
|
+
configuredValue: number;
|
|
628
|
+
currency: string;
|
|
629
|
+
channelId: string | null;
|
|
630
|
+
channelExternalRef: string | null;
|
|
631
|
+
source: string;
|
|
632
|
+
state: 'booked' | 'cancelled';
|
|
633
|
+
bookedAt: number;
|
|
634
|
+
cancelledAt: number | null;
|
|
635
|
+
}
|
|
636
|
+
interface InventoryBooking {
|
|
637
|
+
eventKey: string;
|
|
638
|
+
eventMode: 'live' | 'test';
|
|
639
|
+
bookingRef: string;
|
|
640
|
+
state: InventoryBookingState;
|
|
641
|
+
bookedAt: number;
|
|
642
|
+
updatedAt: number;
|
|
643
|
+
cancelledAt: number | null;
|
|
644
|
+
source: string;
|
|
645
|
+
bookedBy: string | null;
|
|
646
|
+
lastActor: string | null;
|
|
647
|
+
lastSource: string;
|
|
648
|
+
labels: string[];
|
|
649
|
+
objects: InventoryBookingObject[];
|
|
650
|
+
quantity: number;
|
|
651
|
+
activeQuantity: number;
|
|
652
|
+
configuredValue: number;
|
|
653
|
+
activeConfiguredValue: number;
|
|
654
|
+
currency: string | null;
|
|
655
|
+
}
|
|
656
|
+
interface InventoryBookingsQuery {
|
|
657
|
+
q?: string;
|
|
658
|
+
state?: InventoryBookingState | null;
|
|
659
|
+
cursor?: string | null;
|
|
660
|
+
limit?: number;
|
|
661
|
+
}
|
|
662
|
+
interface InventoryBookingsPage {
|
|
663
|
+
bookings: InventoryBooking[];
|
|
664
|
+
nextCursor: string | null;
|
|
665
|
+
}
|
|
666
|
+
interface InventoryBookingActivity {
|
|
667
|
+
id: number;
|
|
668
|
+
action: 'book' | 'replay' | 'partial_cancel' | 'cancel' | 'reconcile';
|
|
669
|
+
at: number;
|
|
670
|
+
labels: string[];
|
|
671
|
+
actor: string | null;
|
|
672
|
+
source: string;
|
|
673
|
+
}
|
|
674
|
+
interface InventoryBookingDetail {
|
|
675
|
+
booking: InventoryBooking;
|
|
676
|
+
activity: InventoryBookingActivity[];
|
|
677
|
+
activityTruncated: boolean;
|
|
678
|
+
}
|
|
679
|
+
/** Booking-time facts attached to the channel that produced the inventory move. */
|
|
680
|
+
interface ChannelAttribution {
|
|
681
|
+
sold: number;
|
|
682
|
+
units: number;
|
|
683
|
+
bookedValue: number | null;
|
|
684
|
+
/** @deprecated Use `bookedValue`. */
|
|
685
|
+
revenue: number | null;
|
|
686
|
+
}
|
|
687
|
+
interface ChannelReportRow {
|
|
688
|
+
channelId: string;
|
|
689
|
+
name: string;
|
|
690
|
+
externalRef: string | null;
|
|
691
|
+
state: ChannelState;
|
|
692
|
+
allocation: ChannelCounts;
|
|
693
|
+
attribution: ChannelAttribution;
|
|
694
|
+
sellThrough: number | null;
|
|
695
|
+
}
|
|
696
|
+
interface ChannelReport {
|
|
697
|
+
assignmentVersion: number;
|
|
698
|
+
includesBookedValue: boolean;
|
|
699
|
+
/** @deprecated Use `includesBookedValue`. */
|
|
700
|
+
includesRevenue: boolean;
|
|
701
|
+
methodology: {
|
|
702
|
+
allocation: string;
|
|
703
|
+
attribution: string;
|
|
704
|
+
sellThrough: string;
|
|
705
|
+
};
|
|
706
|
+
rows: ChannelReportRow[];
|
|
707
|
+
totals: {
|
|
708
|
+
allocated: number;
|
|
709
|
+
free: number;
|
|
710
|
+
held: number;
|
|
711
|
+
booked: number;
|
|
712
|
+
blocked: number;
|
|
713
|
+
sold: number;
|
|
714
|
+
bookedValue: number | null;
|
|
715
|
+
/** @deprecated Use `bookedValue`. */
|
|
716
|
+
revenue: number | null;
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
interface ChannelReportResult {
|
|
720
|
+
report: ChannelReport;
|
|
721
|
+
event: {
|
|
722
|
+
key: string;
|
|
723
|
+
name: string;
|
|
724
|
+
seatTotal?: number;
|
|
725
|
+
currency?: string;
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
interface ChannelReportLinkRecord {
|
|
729
|
+
id: string;
|
|
730
|
+
channelId: string;
|
|
731
|
+
label: string | null;
|
|
732
|
+
includesBookedValue: boolean;
|
|
733
|
+
/** @deprecated Use `includesBookedValue`. */
|
|
734
|
+
includesRevenue: boolean;
|
|
735
|
+
expiresAt: number;
|
|
736
|
+
state: 'active' | 'revoked';
|
|
737
|
+
status: 'active' | 'revoked' | 'expired';
|
|
738
|
+
views: number;
|
|
739
|
+
lastViewedAt: number | null;
|
|
740
|
+
createdAt: number;
|
|
741
|
+
createdBy: string | null;
|
|
742
|
+
revokedAt: number | null;
|
|
743
|
+
}
|
|
744
|
+
interface ChannelReportLinkReveal {
|
|
745
|
+
link: ChannelReportLinkRecord;
|
|
746
|
+
url: string;
|
|
747
|
+
capability: string;
|
|
748
|
+
revealedOnce: true;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* A one-use WebSocket subscribe ticket. `protocols` is exactly what to hand
|
|
752
|
+
* `new WebSocket(url, protocols)` — the ticket rides in `Sec-WebSocket-Protocol`
|
|
753
|
+
* because a browser socket cannot carry an Authorization header and a bearer
|
|
754
|
+
* must never travel in a URL.
|
|
755
|
+
*/
|
|
756
|
+
interface SubscribeTicket {
|
|
757
|
+
ticket: string;
|
|
758
|
+
expiresAt: number;
|
|
759
|
+
protocol: string;
|
|
760
|
+
protocols: string[];
|
|
761
|
+
}
|
|
762
|
+
interface PubObjectsResult {
|
|
763
|
+
/** Every non-free seat's status keyed by label (free seats omitted). */
|
|
764
|
+
seats: Record<string, string>;
|
|
765
|
+
hidden?: string[];
|
|
766
|
+
closed?: string[];
|
|
767
|
+
updatedAt: number;
|
|
768
|
+
}
|
|
769
|
+
interface PubChartResult {
|
|
770
|
+
event: {
|
|
771
|
+
key: string;
|
|
772
|
+
name: string;
|
|
773
|
+
status?: string;
|
|
774
|
+
venue?: string | null;
|
|
775
|
+
startsAt?: number | null;
|
|
776
|
+
currency?: string;
|
|
777
|
+
mode?: string;
|
|
778
|
+
};
|
|
779
|
+
doc: ChartDoc;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Bound to one apiBase + bearer token. Browser callers use an event-scoped
|
|
783
|
+
* `mse_…` grant. A tenant `sk_…` remains accepted only so trusted server code
|
|
784
|
+
* can use this low-level client; SeatManager rejects it before construction.
|
|
785
|
+
* Rebuild (or `setToken`) when a token is re-minted on 401.
|
|
786
|
+
*/
|
|
787
|
+
declare class ManageApi {
|
|
788
|
+
private base;
|
|
789
|
+
private token;
|
|
790
|
+
constructor(apiBase: string, token: string);
|
|
791
|
+
/** Swap the Bearer token in place (SeatManager re-mints on 401). */
|
|
792
|
+
setToken(token: string): void;
|
|
793
|
+
private auth;
|
|
794
|
+
private authBlob;
|
|
795
|
+
/** Event-pinned organizer geometry. A manage token is never sent to `/pub`. */
|
|
796
|
+
chart(key: string): Promise<PubChartResult>;
|
|
797
|
+
/** Authenticated bytes for an Event-scoped organizer chart asset. */
|
|
798
|
+
asset(key: string, asset: string): Promise<Blob>;
|
|
799
|
+
/**
|
|
800
|
+
* The ORGANIZER's seat map: physical state, token-authed.
|
|
801
|
+
*
|
|
802
|
+
* This used to read `/pub/events/:key/objects` with no credential, which
|
|
803
|
+
* answers with the BUYER projection — every unit the caller may not buy
|
|
804
|
+
* collapses to a neutral `blocked`. An anonymous caller may buy only Public
|
|
805
|
+
* sale inventory, so the cockpit rendered every channel-allocated seat as
|
|
806
|
+
* blocked and then computed its KPIs, sell-through and (worse) its
|
|
807
|
+
* block/unblock target sets from that. `/v1/events/:key/objects` returns the
|
|
808
|
+
* unprojected snapshot the control-room read model already trusts.
|
|
809
|
+
*/
|
|
810
|
+
objects(key: string): Promise<PubObjectsResult>;
|
|
811
|
+
/**
|
|
812
|
+
* Exchange the manage token for a one-use organizer socket ticket.
|
|
813
|
+
*
|
|
814
|
+
* A browser `WebSocket` cannot send an Authorization header, so the socket's
|
|
815
|
+
* scope is established here, over ordinary HTTPS. Without it the DO treats a
|
|
816
|
+
* manager socket as an anonymous public buyer and projects its deltas — so a
|
|
817
|
+
* hold inside a private allocation is structurally suppressed and the map
|
|
818
|
+
* drifts away from the truth `objects()` just established.
|
|
819
|
+
*
|
|
820
|
+
* Tickets are single-redemption and expire in ~30s: mint one per connect.
|
|
821
|
+
*/
|
|
822
|
+
subscribeTicket(key: string): Promise<SubscribeTicket>;
|
|
823
|
+
socketUrl(key: string): string;
|
|
824
|
+
/** Take FREE seats off sale in one batched call. Optional `releaseAt` (epoch
|
|
825
|
+
* ms, future) auto-returns them to sale; `reason` tags the block (M3 uses it).
|
|
826
|
+
* Throws ManageApiError 409 (conflicts) if any seat was just taken. */
|
|
827
|
+
block(key: string, labels: string[], opts?: {
|
|
828
|
+
releaseAt?: number;
|
|
829
|
+
reason?: string;
|
|
830
|
+
}): Promise<{
|
|
831
|
+
ok: true;
|
|
832
|
+
blocked: string[];
|
|
833
|
+
}>;
|
|
834
|
+
/** Return specific blocked seats to sale (one batched call). */
|
|
835
|
+
unblock(key: string, labels: string[]): Promise<{
|
|
836
|
+
ok: true;
|
|
837
|
+
unblocked: string[];
|
|
838
|
+
}>;
|
|
839
|
+
/** Return every blocked seat to sale; resolves with the freed count. */
|
|
840
|
+
unblockAll(key: string): Promise<{
|
|
841
|
+
ok: true;
|
|
842
|
+
freed: number;
|
|
843
|
+
}>;
|
|
844
|
+
/** Cancel bookings — return BOOKED seats to free (credit not refunded).
|
|
845
|
+
* Guarded by the original booking reference. */
|
|
846
|
+
unbook(key: string, labels: string[], bookingRef: string): Promise<{
|
|
847
|
+
ok: true;
|
|
848
|
+
unbooked: string[];
|
|
849
|
+
}>;
|
|
850
|
+
/** Set (ms, clamped 1–60 min server-side) or clear (null) the hold TTL. */
|
|
851
|
+
setHoldTtl(key: string, holdTtlMs: number | null): Promise<{
|
|
852
|
+
ok: true;
|
|
853
|
+
holdTtlMs: number | null;
|
|
854
|
+
}>;
|
|
855
|
+
/** Inventory lifecycle by stable integrator bookingRef. Absent on Managed. */
|
|
856
|
+
bookings(key: string, query?: InventoryBookingsQuery): Promise<InventoryBookingsPage>;
|
|
857
|
+
/** Exact configured-value snapshot plus book/replay/cancellation audit. */
|
|
858
|
+
booking(key: string, bookingRef: string): Promise<InventoryBookingDetail>;
|
|
859
|
+
/** Alias matching the server SDK vocabulary. */
|
|
860
|
+
listBookings(key: string, query?: InventoryBookingsQuery): Promise<InventoryBookingsPage>;
|
|
861
|
+
/** Alias matching the server SDK vocabulary. */
|
|
862
|
+
retrieveBooking(key: string, bookingRef: string): Promise<InventoryBookingDetail>;
|
|
863
|
+
/** The organizer's current per section/zone availability windows (needs
|
|
864
|
+
* `event:view`). Ids absent from `rules` are open / on sale. */
|
|
865
|
+
availability(key: string): Promise<{
|
|
866
|
+
rules: Record<string, AvailabilityRule>;
|
|
867
|
+
}>;
|
|
868
|
+
/** Replace the availability windows for a set of section/zone ids (needs
|
|
869
|
+
* `event:block`). Ids absent from `rules` become open / on sale; a zone rule
|
|
870
|
+
* cascades to its sections. The worker derives each id's seat labels, so
|
|
871
|
+
* `labels` on the sent rules is best-effort. Resolves with the authoritative
|
|
872
|
+
* effective `hidden` set (a due rule may fire at once) and the server-cleaned
|
|
873
|
+
* `rules` map (fired timed/threshold windows dropped). */
|
|
874
|
+
setAvailability(key: string, rules: Record<string, AvailabilityRule>): Promise<{
|
|
875
|
+
ok: true;
|
|
876
|
+
hidden: string[];
|
|
877
|
+
rules: Record<string, AvailabilityRule>;
|
|
878
|
+
}>;
|
|
879
|
+
/** Allocation list with exact per-channel counts. `includeArchived` adds the
|
|
880
|
+
* read-only archived rows behind the rail's "Show archived" control. */
|
|
881
|
+
channels(key: string, opts?: {
|
|
882
|
+
includeArchived?: boolean;
|
|
883
|
+
}): Promise<ChannelListResult>;
|
|
884
|
+
/** One page of the label → channel map that paints the allocation overlay.
|
|
885
|
+
* Paged by label; follow `nextAfterLabel` until it is null. */
|
|
886
|
+
channelAllocation(key: string, opts?: {
|
|
887
|
+
afterLabel?: string;
|
|
888
|
+
limit?: number;
|
|
889
|
+
}): Promise<ChannelAllocationPage>;
|
|
890
|
+
channelAudit(key: string, opts?: {
|
|
891
|
+
limit?: number;
|
|
892
|
+
before?: number;
|
|
893
|
+
}): Promise<ChannelAuditPage>;
|
|
894
|
+
createChannel(key: string, input: {
|
|
895
|
+
name: string;
|
|
896
|
+
color?: string | null;
|
|
897
|
+
marker?: string | null;
|
|
898
|
+
externalRef?: string | null;
|
|
899
|
+
}): Promise<{
|
|
900
|
+
ok: true;
|
|
901
|
+
channel: ChannelRecord;
|
|
902
|
+
}>;
|
|
903
|
+
renameChannel(key: string, channelId: string, name: string): Promise<{
|
|
904
|
+
ok: true;
|
|
905
|
+
channel: ChannelRecord;
|
|
906
|
+
}>;
|
|
907
|
+
setChannelPaused(key: string, channelId: string, paused: boolean): Promise<{
|
|
908
|
+
ok: true;
|
|
909
|
+
channel: ChannelRecord;
|
|
910
|
+
}>;
|
|
911
|
+
/** Archive with a mandatory destination for the remaining allocation.
|
|
912
|
+
* Throws ManageApiError 409 `channel_archive_blocked_by_holds` while any hold
|
|
913
|
+
* is live; `err.details` carries the exact counts + retry window. */
|
|
914
|
+
archiveChannel(key: string, channelId: string, destination: string | null): Promise<{
|
|
915
|
+
ok: true;
|
|
916
|
+
channel: ChannelRecord;
|
|
917
|
+
assignmentVersion: number;
|
|
918
|
+
moved: number;
|
|
919
|
+
}>;
|
|
920
|
+
/**
|
|
921
|
+
* Versioned Apply. A stale `assignmentVersion` mutates NOTHING and throws
|
|
922
|
+
* ManageApiError 409 `channel_assignment_conflict` — the caller keeps its
|
|
923
|
+
* selection and offers "Refresh and review". There is no dry-run: the review
|
|
924
|
+
* sheet previews locally, this call returns the authoritative buckets.
|
|
925
|
+
*/
|
|
926
|
+
applyChannelAssignment(key: string, input: {
|
|
927
|
+
targetChannelId: string | null;
|
|
928
|
+
labels: string[];
|
|
929
|
+
assignmentVersion: number;
|
|
930
|
+
}): Promise<AssignmentResult>;
|
|
931
|
+
/**
|
|
932
|
+
* Read-only buyer projection for an audience (§8.6) — the SAME scoped server
|
|
933
|
+
* view the buyer SDK receives, never a local approximation.
|
|
934
|
+
*
|
|
935
|
+
* Ships on the access-hardening branch. Older workers 404/405 here; callers
|
|
936
|
+
* MUST feature-detect and quietly say the preview needs a newer server rather
|
|
937
|
+
* than faking a projection client-side.
|
|
938
|
+
*/
|
|
939
|
+
channelPreview(key: string, channelIds: string[], opts?: {
|
|
940
|
+
includePublic?: boolean;
|
|
941
|
+
}): Promise<ChannelPreviewProjection>;
|
|
942
|
+
/**
|
|
943
|
+
* Choose which sale route this channel opens.
|
|
944
|
+
*
|
|
945
|
+
* Since the server's 2026-08-06 change this is AUTHORIZATION, not a label:
|
|
946
|
+
* exactly one of the four routes may mint buyer access for the channel and the
|
|
947
|
+
* other three refuse with 409 `channel_access_intent_forbids`. The default is
|
|
948
|
+
* `none`, which refuses all four — so a route has to be declared before any
|
|
949
|
+
* buyer-facing action on the channel can succeed.
|
|
950
|
+
*
|
|
951
|
+
* Switching the route while buyers are already inside the current one is
|
|
952
|
+
* refused with 409 `channel_intent_switch_blocked`, whose `details` name what
|
|
953
|
+
* is live (`liveAccessLinks`, `activeSessions`). Retry with
|
|
954
|
+
* `acknowledgeLiveAccess: true`: hosted links on the channel are revoked,
|
|
955
|
+
* while sessions already minted keep their holds and drain on their own.
|
|
956
|
+
* `intentSwitch` is present on the response ONLY when the switch disturbed
|
|
957
|
+
* something, so the ordinary case stays the two-key body it has always been.
|
|
958
|
+
*/
|
|
959
|
+
setChannelAccessIntent(key: string, channelId: string, accessIntent: ChannelAccessIntent, opts?: {
|
|
960
|
+
acknowledgeLiveAccess?: boolean;
|
|
961
|
+
reason?: string;
|
|
962
|
+
}): Promise<{
|
|
963
|
+
ok: true;
|
|
964
|
+
channel: ChannelRecord;
|
|
965
|
+
intentSwitch?: {
|
|
966
|
+
closedLinks: number;
|
|
967
|
+
keptSessions: number;
|
|
968
|
+
};
|
|
969
|
+
}>;
|
|
970
|
+
/**
|
|
971
|
+
* Mint a hosted access link. The 201 is the ONE and ONLY time `url` and
|
|
972
|
+
* `capability` exist outside the buyer's browser — SeatLayer keeps a hash, so
|
|
973
|
+
* there is no route, cache, or support escalation that can produce this string
|
|
974
|
+
* again. Callers must reveal it immediately and then let it go.
|
|
975
|
+
*
|
|
976
|
+
* Every omitted field takes the server's default: expiry = when the event
|
|
977
|
+
* starts, 100 redemptions, 4 seats per buyer, this channel's allocation only.
|
|
978
|
+
* Platform bounds are enforced server-side and reported as 422 with the rule
|
|
979
|
+
* spelled out in `ManageApiError.serverMessage`.
|
|
980
|
+
*
|
|
981
|
+
* NOT a side effect any more. This used to SET the channel's access intent to
|
|
982
|
+
* `hosted_link`; since 2026-08-06 it REQUIRES it, and a channel declaring any
|
|
983
|
+
* other route refuses with 409 `channel_access_intent_forbids`. Callers must
|
|
984
|
+
* declare the route first — `ChannelsMode` does exactly that before it
|
|
985
|
+
* creates, so a first buyer link on a fresh channel is still one gesture.
|
|
986
|
+
*/
|
|
987
|
+
createAccessLink(key: string, channelId: string, input?: {
|
|
988
|
+
label?: string | null;
|
|
989
|
+
/** Absolute epoch ms. Omit for "when the event starts". */
|
|
990
|
+
expiresAt?: number;
|
|
991
|
+
maxRedemptions?: number;
|
|
992
|
+
maxQuantity?: number;
|
|
993
|
+
includePublic?: boolean;
|
|
994
|
+
}): Promise<AccessLinkReveal>;
|
|
995
|
+
/** Status only — label, expiry, redemptions, per-buyer cap, lineage, and the
|
|
996
|
+
* live session count. Never the url, never the capability. Needs `:view`. */
|
|
997
|
+
accessLinks(key: string, channelId: string): Promise<{
|
|
998
|
+
links: AccessLinkStatusRecord[];
|
|
999
|
+
}>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Rotate — the ONLY recovery for a link nobody kept. The old URL stops opening
|
|
1002
|
+
* immediately and the response is a fresh one-time reveal.
|
|
1003
|
+
*
|
|
1004
|
+
* `endActiveSessions` is REQUIRED, not defaulted: the organizer must say
|
|
1005
|
+
* whether buyers already inside finish their checkout or lose access now. The
|
|
1006
|
+
* server answers 422 `end_active_sessions_required` if it is omitted, and that
|
|
1007
|
+
* refusal is correct — a UI must not pick either branch on their behalf.
|
|
1008
|
+
*/
|
|
1009
|
+
rotateAccessLink(key: string, channelId: string, linkId: string, endActiveSessions: boolean): Promise<AccessLinkReveal & {
|
|
1010
|
+
previous: AccessLinkRecord;
|
|
1011
|
+
endedSessions: number;
|
|
1012
|
+
}>;
|
|
1013
|
+
/** Revoke. The link stops opening immediately; `endActiveSessions` decides
|
|
1014
|
+
* whether the buyers already inside keep their sessions. */
|
|
1015
|
+
revokeAccessLink(key: string, channelId: string, linkId: string, endActiveSessions?: boolean): Promise<{
|
|
1016
|
+
ok: true;
|
|
1017
|
+
link: AccessLinkRecord;
|
|
1018
|
+
endedSessions: number;
|
|
1019
|
+
}>;
|
|
1020
|
+
report(key: string): Promise<ReportResult>;
|
|
1021
|
+
controlRoom(key: string, windowMinutes?: number): Promise<ControlRoomSnapshot>;
|
|
1022
|
+
/** Allocation beside immutable booking-time channel attribution. */
|
|
1023
|
+
channelReport(key: string): Promise<ChannelReportResult>;
|
|
1024
|
+
createChannelReportLink(key: string, channelId: string, input?: {
|
|
1025
|
+
label?: string;
|
|
1026
|
+
includesBookedValue?: boolean;
|
|
1027
|
+
/** @deprecated Use `includesBookedValue`. */
|
|
1028
|
+
includesRevenue?: boolean;
|
|
1029
|
+
expiresAt?: number;
|
|
1030
|
+
}): Promise<ChannelReportLinkReveal>;
|
|
1031
|
+
channelReportLinks(key: string, channelId: string): Promise<{
|
|
1032
|
+
links: ChannelReportLinkRecord[];
|
|
1033
|
+
}>;
|
|
1034
|
+
revokeChannelReportLink(key: string, channelId: string, linkId: string): Promise<{
|
|
1035
|
+
ok: true;
|
|
1036
|
+
link: ChannelReportLinkRecord;
|
|
1037
|
+
}>;
|
|
1038
|
+
log(key: string, opts?: {
|
|
1039
|
+
limit?: number;
|
|
1040
|
+
before?: number;
|
|
1041
|
+
}): Promise<LogPage>;
|
|
1042
|
+
/** CSV report as a Blob (Bearer auth can't ride a plain <a href>). Host builds
|
|
1043
|
+
* an object URL for download. */
|
|
1044
|
+
reportCsv(key: string): Promise<Blob>;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* managerTypes — the SeatManager cockpit's public contract (options, the
|
|
1049
|
+
* capability set, the tallies/activity/connection payloads a host subscribes to)
|
|
1050
|
+
* plus the two private shapes the Sections rail and the realtime reducer run on.
|
|
1051
|
+
*
|
|
1052
|
+
* Split out of SeatManager.ts verbatim. `SeatManager.ts` re-exports every public
|
|
1053
|
+
* name, so `@seatlayer/js`'s published surface is unchanged. Types only —
|
|
1054
|
+
* nothing here emits a byte of runtime JavaScript.
|
|
1055
|
+
*/
|
|
1056
|
+
|
|
1057
|
+
type SeatManagerMode = 'view' | 'inspect' | 'block' | 'sections' | 'channels';
|
|
1058
|
+
/** Short-lived, event-scoped browser credential minted by a trusted backend. */
|
|
1059
|
+
type EventScopedManageToken = `mse_${string}`;
|
|
1060
|
+
/**
|
|
1061
|
+
* Capabilities the cockpit's token was minted with. Channels mode is gated on
|
|
1062
|
+
* these and fails CLOSED: no `event:channels:view` ⇒ no Channels pill at all;
|
|
1063
|
+
* view without `event:channels:manage` ⇒ read-only inspection with every
|
|
1064
|
+
* mutation control absent, not merely disabled.
|
|
1065
|
+
*/
|
|
1066
|
+
type SeatManagerCapability = 'event:view' | 'event:block' | 'event:cancel' | 'event:reports' | 'event:channels:view' | 'event:channels:manage';
|
|
1067
|
+
/** DO seat status — 'blocked' has no engine analogue (→ 'not_for_sale'). */
|
|
1068
|
+
type DoStatus = 'free' | 'held' | 'booked' | 'blocked';
|
|
1069
|
+
/** Live KPI snapshot pushed to `onTallies` on every state change. */
|
|
1070
|
+
interface SeatManagerTallies {
|
|
1071
|
+
free: number;
|
|
1072
|
+
held: number;
|
|
1073
|
+
booked: number;
|
|
1074
|
+
blocked: number;
|
|
1075
|
+
/** Total seats on the chart. */
|
|
1076
|
+
total: number;
|
|
1077
|
+
/** booked / total, 0–100. */
|
|
1078
|
+
capacityPct: number;
|
|
1079
|
+
/** booked / (total − blocked), 0–100 — sell-through of sellable inventory. */
|
|
1080
|
+
sellThroughPct: number;
|
|
1081
|
+
/** Exact Σ booked unit_price snapshots from the authenticated report. */
|
|
1082
|
+
bookedValue: number;
|
|
1083
|
+
/** @deprecated Use `bookedValue`. */
|
|
1084
|
+
grossRevenue: number;
|
|
1085
|
+
/** Booked value is never reconstructed from the chart's current list price. */
|
|
1086
|
+
bookedValueStatus: 'loading' | 'current' | 'stale';
|
|
1087
|
+
/** @deprecated Use `bookedValueStatus`. */
|
|
1088
|
+
revenueStatus: 'loading' | 'current' | 'stale';
|
|
1089
|
+
/** ISO-4217 currency for `bookedValue`. */
|
|
1090
|
+
currency: string;
|
|
1091
|
+
}
|
|
1092
|
+
/** One streamed activity line for the live feed. */
|
|
1093
|
+
interface SeatManagerActivity {
|
|
1094
|
+
id: string;
|
|
1095
|
+
at: number;
|
|
1096
|
+
label: string;
|
|
1097
|
+
/** Full labels affected by this one backend/realtime operation. */
|
|
1098
|
+
labels: string[];
|
|
1099
|
+
count: number;
|
|
1100
|
+
/** Human verb: held / booked / released / blocked / unblocked. */
|
|
1101
|
+
verb: string;
|
|
1102
|
+
status: DoStatus;
|
|
1103
|
+
/** Spatial context for grouped activity when the chart defines sections. */
|
|
1104
|
+
sectionIds?: string[];
|
|
1105
|
+
sectionLabels?: string[];
|
|
1106
|
+
}
|
|
1107
|
+
/** Fired after a successful organizer action, for host toasts/telemetry. */
|
|
1108
|
+
interface SeatManagerActionResult {
|
|
1109
|
+
action: 'block' | 'unblock' | 'unblockAll' | 'cancelBooking' | 'setHoldTtl';
|
|
1110
|
+
labels: string[];
|
|
1111
|
+
count: number;
|
|
1112
|
+
}
|
|
1113
|
+
interface SeatManagerOptions {
|
|
1114
|
+
/** CSS selector or element to mount into. */
|
|
1115
|
+
container: string | HTMLElement;
|
|
1116
|
+
/** API origin. Defaults to https://api.seatlayer.io. */
|
|
1117
|
+
apiBase?: string;
|
|
1118
|
+
/** Event key (e.g. `ev_xxx` / `west-end-p3`). */
|
|
1119
|
+
eventKey: string;
|
|
1120
|
+
/**
|
|
1121
|
+
* Short-lived, event-scoped `mse_…` browser grant minted by your backend.
|
|
1122
|
+
* Tenant secret keys are unsupported in SeatManager and must stay server-side.
|
|
1123
|
+
*/
|
|
1124
|
+
token: EventScopedManageToken;
|
|
1125
|
+
/** Absolute token expiry (epoch ms). Enables proactive in-place rotation. */
|
|
1126
|
+
tokenExpiresAt?: number;
|
|
1127
|
+
/** Initial mode. Default 'view'. */
|
|
1128
|
+
mode?: SeatManagerMode;
|
|
1129
|
+
/**
|
|
1130
|
+
* The capability set this token was minted with. Supply it whenever you mint
|
|
1131
|
+
* an `mse_…` grant — it is the only way the widget can know a delegated token
|
|
1132
|
+
* carries `event:channels:manage`, and without it Channels mode stays
|
|
1133
|
+
* read-only (fail-closed).
|
|
1134
|
+
*/
|
|
1135
|
+
capabilities?: SeatManagerCapability[] | string[];
|
|
1136
|
+
/** ISO-4217 fallback currency for configured booked value (chart/event wins). */
|
|
1137
|
+
currency?: string;
|
|
1138
|
+
/** Chart theme override for the chrome (rails/bar). Chart colors come from the doc. */
|
|
1139
|
+
theme?: ChartTheme;
|
|
1140
|
+
/**
|
|
1141
|
+
* Keep the canvas painting even when the tab is hidden/backgrounded (a war-room
|
|
1142
|
+
* board on a second monitor). Calls `forceDraw()` after each delta so Chrome's
|
|
1143
|
+
* rAF throttling on occluded tabs never leaves the board stale. Default true.
|
|
1144
|
+
*/
|
|
1145
|
+
keepLiveWhileHidden?: boolean;
|
|
1146
|
+
/**
|
|
1147
|
+
* Opt in to camera-following for new buyer holds/bookings. Off by default so
|
|
1148
|
+
* a live event never steals an operator's current map context.
|
|
1149
|
+
*/
|
|
1150
|
+
followLive?: boolean;
|
|
1151
|
+
/** Chart + first snapshot are loaded and the board is live. */
|
|
1152
|
+
onReady?: () => void;
|
|
1153
|
+
/** Live KPI tallies changed. */
|
|
1154
|
+
onTallies?: (tallies: SeatManagerTallies) => void;
|
|
1155
|
+
/** A grouped live/audit activity item arrived. */
|
|
1156
|
+
onActivity?: (activity: SeatManagerActivity) => void;
|
|
1157
|
+
/** Exact private control-room projection changed. */
|
|
1158
|
+
onControlRoom?: (snapshot: ControlRoomSnapshot) => void;
|
|
1159
|
+
/** Called before token expiry. The manager swaps the result without remounting. */
|
|
1160
|
+
onTokenRefresh?: () => Promise<{
|
|
1161
|
+
token: EventScopedManageToken;
|
|
1162
|
+
expiresAt: number;
|
|
1163
|
+
}>;
|
|
1164
|
+
/** Tool/mode changed from inside the shared cockpit. */
|
|
1165
|
+
onModeChange?: (mode: SeatManagerMode) => void;
|
|
1166
|
+
/** Follow-live preference changed from inside the cockpit. */
|
|
1167
|
+
onFollowLiveChange?: (enabled: boolean) => void;
|
|
1168
|
+
/** Block-mode selection changed (marquee / ⌘A / category / section / tap). */
|
|
1169
|
+
onSelectionChange?: (seats: ExpandedSeat[]) => void;
|
|
1170
|
+
/** A block/unblock/cancel action completed successfully. */
|
|
1171
|
+
onActionComplete?: (result: SeatManagerActionResult) => void;
|
|
1172
|
+
/**
|
|
1173
|
+
* The realtime link connected or dropped, with the moment the numbers on
|
|
1174
|
+
* screen were last known good.
|
|
1175
|
+
*
|
|
1176
|
+
* A host embedding this cockpit renders its own chrome around it, and until
|
|
1177
|
+
* now had no way to know the board had gone stale: the manager tracked the
|
|
1178
|
+
* drop internally (its own LIVE/RECONNECTING pill) and told nobody. A host
|
|
1179
|
+
* that polls on a timer and pauses while the tab is hidden therefore showed
|
|
1180
|
+
* arbitrarily old numbers that looked exactly like fresh ones.
|
|
1181
|
+
*/
|
|
1182
|
+
onConnectionChange?: (state: SeatManagerConnection) => void;
|
|
1183
|
+
onError?: (err: unknown) => void;
|
|
1184
|
+
}
|
|
1185
|
+
/** Realtime link state, as reported to the embedding host. */
|
|
1186
|
+
interface SeatManagerConnection {
|
|
1187
|
+
/** `live` while the socket is open; `reconnecting` from drop until reopen. */
|
|
1188
|
+
status: 'live' | 'reconnecting';
|
|
1189
|
+
/**
|
|
1190
|
+
* `Date.now()` of the last snapshot or delta accepted from the server, or
|
|
1191
|
+
* null before the first one. This is the honest "as of" for whatever the host
|
|
1192
|
+
* is displaying — NOT the time the connection dropped, which is later and
|
|
1193
|
+
* would overstate freshness.
|
|
1194
|
+
*/
|
|
1195
|
+
lastMessageAt: number | null;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* SeatManager — the organizer manage surface, packaged for the SDK.
|
|
1200
|
+
*
|
|
1201
|
+
* Productizes the SeatLayer dashboard's ManageEventPage into a framework-
|
|
1202
|
+
* agnostic class (mirrors how SeatPicker productized the buyer flow). It mounts
|
|
1203
|
+
* the shared engine in `manageMode`, subscribes to the event's realtime channel
|
|
1204
|
+
* and drives three control-room tools on one persistent canvas:
|
|
1205
|
+
*
|
|
1206
|
+
* - **view** — a live board: realtime seat repaint (flash on hold/book),
|
|
1207
|
+
* live KPI tallies + configured booked value, and a streaming activity
|
|
1208
|
+
* feed derived from the delta stream + audit log. Read-only.
|
|
1209
|
+
* - **inspect** — select one seat to read its live inventory context.
|
|
1210
|
+
* - **block** — bulk-first block/unblock: marquee-drag, ⌘A select-all,
|
|
1211
|
+
* whole-category / whole-section select, single-seat fallback →
|
|
1212
|
+
* one batched block/unblock (optimistic, reconciled by the WS),
|
|
1213
|
+
* and timed auto-release.
|
|
1214
|
+
*
|
|
1215
|
+
* Auth: organizer chart/media, inventory, realtime and reports all carry a
|
|
1216
|
+
* short-lived event-scoped browser grant (`mse_…`) via {@link ManageApi}.
|
|
1217
|
+
* Tenant secret keys are unsupported in this browser surface, and organizer
|
|
1218
|
+
* authority is never downgraded to buyer `/pub`.
|
|
1219
|
+
*/
|
|
1220
|
+
|
|
1221
|
+
declare class SeatManager {
|
|
1222
|
+
private readonly opts;
|
|
1223
|
+
private readonly api;
|
|
1224
|
+
private readonly key;
|
|
1225
|
+
private keepLive;
|
|
1226
|
+
private host;
|
|
1227
|
+
private root;
|
|
1228
|
+
private mapHost;
|
|
1229
|
+
private els;
|
|
1230
|
+
private renderer;
|
|
1231
|
+
private doc;
|
|
1232
|
+
private mode;
|
|
1233
|
+
private labelToId;
|
|
1234
|
+
private labelToSeat;
|
|
1235
|
+
private allIds;
|
|
1236
|
+
/**
|
|
1237
|
+
* GA inventory units — real sellable labels the server counts, with NO seat
|
|
1238
|
+
* geometry and therefore no renderer binding. They live here rather than in
|
|
1239
|
+
* `labelToId`/`allIds` so every paint path keeps addressing paintable nodes
|
|
1240
|
+
* only, while the tally denominator finally covers the same universe the
|
|
1241
|
+
* numerator does. Without them a GA sale hit `booked` but not `total`:
|
|
1242
|
+
* Free under-reported by GA capacity and SOLD% could exceed 100%.
|
|
1243
|
+
*/
|
|
1244
|
+
private gaUnitLabelSet;
|
|
1245
|
+
private status;
|
|
1246
|
+
/** Live non-free counters, moved by each delta rather than re-walked. */
|
|
1247
|
+
private counts;
|
|
1248
|
+
/** Bumped whenever the seat model is replaced wholesale (a full snapshot). */
|
|
1249
|
+
private modelVersion;
|
|
1250
|
+
private currency;
|
|
1251
|
+
/** Currency read from the event/control-room projection; host currency is fallback only. */
|
|
1252
|
+
private authoritativeCurrency;
|
|
1253
|
+
private authoritativeGrossRevenue;
|
|
1254
|
+
private revenueStatus;
|
|
1255
|
+
private revenueRequest;
|
|
1256
|
+
private controlRoomSnapshot;
|
|
1257
|
+
/** Bearer-fetched organizer chart media, revoked with this manager. */
|
|
1258
|
+
private readonly organizerAssetUrls;
|
|
1259
|
+
/**
|
|
1260
|
+
* The server's own totals, pinned to the client model they were read against.
|
|
1261
|
+
* Display = server baseline + (client now − client then), so the authoritative
|
|
1262
|
+
* numbers land exactly on arrival and deltas still move them between reads.
|
|
1263
|
+
* A wholesale model replacement invalidates the pairing (`model`), and the
|
|
1264
|
+
* client tallies — themselves a fresh authenticated read — take over.
|
|
1265
|
+
*/
|
|
1266
|
+
private serverBaseline;
|
|
1267
|
+
/** Latest presence frame, held whether or not a snapshot has landed yet. */
|
|
1268
|
+
private livePresence;
|
|
1269
|
+
/** Latest cumulative booked gross pushed on a delta frame. */
|
|
1270
|
+
private liveGross;
|
|
1271
|
+
/** Coalesces a burst of deltas into one KPI/rail repaint. */
|
|
1272
|
+
private paintHandle;
|
|
1273
|
+
private trendWindowMinutes;
|
|
1274
|
+
private heatEnabled;
|
|
1275
|
+
private followLive;
|
|
1276
|
+
private lastKpiValues;
|
|
1277
|
+
private activeKpiDeltas;
|
|
1278
|
+
private ws;
|
|
1279
|
+
private reconnectTimer;
|
|
1280
|
+
private attempt;
|
|
1281
|
+
private closed;
|
|
1282
|
+
/** Mirrors the `live` root class, so the getter never has to read the DOM. */
|
|
1283
|
+
private connectionStatus;
|
|
1284
|
+
/** When the server last told us something. Stamped on accepted traffic only —
|
|
1285
|
+
* a socket that opens and says nothing has not refreshed anything. */
|
|
1286
|
+
private lastMessageAt;
|
|
1287
|
+
private ready;
|
|
1288
|
+
private feed;
|
|
1289
|
+
private feedTimer;
|
|
1290
|
+
private toastTimer;
|
|
1291
|
+
private liveEventTimer;
|
|
1292
|
+
private kpiCleanupTimer;
|
|
1293
|
+
private followLiveTimer;
|
|
1294
|
+
private followSeatTimer;
|
|
1295
|
+
private releaseAt;
|
|
1296
|
+
private layoutObserver;
|
|
1297
|
+
private tokenExpiresAt;
|
|
1298
|
+
private tokenRefreshTimer;
|
|
1299
|
+
private tokenRefreshInFlight;
|
|
1300
|
+
private sectionByObject;
|
|
1301
|
+
private sectionLabelById;
|
|
1302
|
+
private sectionsBase;
|
|
1303
|
+
private availabilityRules;
|
|
1304
|
+
private effectiveHidden;
|
|
1305
|
+
private effectiveClosed;
|
|
1306
|
+
private availabilitySaving;
|
|
1307
|
+
private lastSyncedAt;
|
|
1308
|
+
private blockedQuery;
|
|
1309
|
+
private blockedSection;
|
|
1310
|
+
private blockedResultLimit;
|
|
1311
|
+
private unblockAllConfirmTimer;
|
|
1312
|
+
/**
|
|
1313
|
+
* Sales channels (M6b).
|
|
1314
|
+
*
|
|
1315
|
+
* Two fields, and the split between them is the whole point. `channelCaps` is
|
|
1316
|
+
* AUTHORITY and is known early — it is read from the token's declared
|
|
1317
|
+
* capabilities before the first rail paint, so the Channels pill either
|
|
1318
|
+
* exists from the start or never appears. `channels` is the loaded sub-app,
|
|
1319
|
+
* and it now arrives late: its module is fetched on first entry into Channels
|
|
1320
|
+
* mode (`ensureChannels`), not at mount.
|
|
1321
|
+
*
|
|
1322
|
+
* So every gate that used to ask `!!this.channels` — the pill, the mode
|
|
1323
|
+
* whitelist, the `c` shortcut — asks `channelCaps.view` instead. Asking the
|
|
1324
|
+
* instance would make a permission the member genuinely has look like one
|
|
1325
|
+
* they do not for as long as a network fetch takes.
|
|
1326
|
+
*/
|
|
1327
|
+
private channels;
|
|
1328
|
+
private channelCaps;
|
|
1329
|
+
/** Supersedes an async capability probe after token/capability rotation. */
|
|
1330
|
+
private channelCapabilityResolution;
|
|
1331
|
+
/** In-flight `import('./channelsMode')`, so concurrent entries load once. */
|
|
1332
|
+
private channelsLoading;
|
|
1333
|
+
private readonly onFullscreenChange;
|
|
1334
|
+
private readonly onKeyDown;
|
|
1335
|
+
private readonly onRailClick;
|
|
1336
|
+
constructor(options: SeatManagerOptions);
|
|
1337
|
+
/** Build the DOM, load the chart, subscribe to realtime, mount the board. */
|
|
1338
|
+
render(): Promise<this>;
|
|
1339
|
+
setMode(mode: SeatManagerMode): void;
|
|
1340
|
+
/**
|
|
1341
|
+
* Decide what this token may do with sales channels.
|
|
1342
|
+
*
|
|
1343
|
+
* Declared capabilities win — a host that mints an `mse_…` grant knows exactly
|
|
1344
|
+
* what it asked for. A delegated token with no declaration is probed for read
|
|
1345
|
+
* access and then treated as READ-ONLY, because "we could not tell" must never
|
|
1346
|
+
* render mutation controls.
|
|
1347
|
+
*/
|
|
1348
|
+
private resolveChannelCapabilities;
|
|
1349
|
+
/**
|
|
1350
|
+
* Load Channels mode, once, on first entry.
|
|
1351
|
+
*
|
|
1352
|
+
* Everything about this method is shaped by one rule: the cockpit must stay
|
|
1353
|
+
* usable and honest while the module is in the air.
|
|
1354
|
+
*
|
|
1355
|
+
* - The promise is memoized, so a member who taps the pill twice, or a host
|
|
1356
|
+
* whose deep link and initial `mode` prop both ask for Channels, loads one
|
|
1357
|
+
* module and builds one instance.
|
|
1358
|
+
* - Authority is re-checked on arrival. A token rotation can revoke
|
|
1359
|
+
* `event:channels:view` between the tap and the load, and building the
|
|
1360
|
+
* sub-app for a token that no longer carries the capability would put
|
|
1361
|
+
* mutation controls on screen that every server call then refuses.
|
|
1362
|
+
* - The mode is re-checked too. Someone who taps Channels and then Monitor
|
|
1363
|
+
* before the chunk lands must not be yanked into Channels when it does; the
|
|
1364
|
+
* instance is kept (it is paid for) but only entered if we are still there.
|
|
1365
|
+
* - A failed load is stated in the rail rather than swallowed. Channels is a
|
|
1366
|
+
* whole surface — silently showing an empty one would read as "this event
|
|
1367
|
+
* has no channels", which is a lie about inventory.
|
|
1368
|
+
*/
|
|
1369
|
+
private ensureChannels;
|
|
1370
|
+
/** The adapter between the cockpit's internals and Channels mode. */
|
|
1371
|
+
private buildChannelsHost;
|
|
1372
|
+
/** Actual on-screen seat diameter, for the channel overlay's marks. The
|
|
1373
|
+
* renderer's base seat radius is 9 chart units; retaining the camera scale
|
|
1374
|
+
* (rather than capping it) keeps every preview paint aligned with the real
|
|
1375
|
+
* chart geometry at deep zoom. */
|
|
1376
|
+
private seatPixelSize;
|
|
1377
|
+
/** Toggle the normalized sales-velocity outline overlay without changing seat colors. */
|
|
1378
|
+
setHeatOverlay(enabled: boolean): void;
|
|
1379
|
+
/** Toggle opt-in camera following for new buyer hold/book events. */
|
|
1380
|
+
setFollowLive(enabled: boolean): void;
|
|
1381
|
+
/** Update background-tab repaint policy without rebuilding the board. */
|
|
1382
|
+
setKeepLiveWhileHidden(enabled: boolean | undefined): void;
|
|
1383
|
+
/** Update the host fallback currency; an event/control-room currency still wins. */
|
|
1384
|
+
setCurrency(currency: string | undefined): void;
|
|
1385
|
+
/** Apply organizer chrome tokens in place without losing camera or selection. */
|
|
1386
|
+
setTheme(theme: ChartTheme | undefined): void;
|
|
1387
|
+
/** Replace the declared authority for the current token and fail closed. */
|
|
1388
|
+
setCapabilities(capabilities: SeatManagerOptions['capabilities']): void;
|
|
1389
|
+
/** Change proactive token-refresh policy without rebuilding the manager. */
|
|
1390
|
+
setTokenRefresh(onTokenRefresh: SeatManagerOptions['onTokenRefresh']): void;
|
|
1391
|
+
/** Change the current-vs-previous sales window and refresh the private projection. */
|
|
1392
|
+
setTrendWindow(windowMinutes: number): Promise<ControlRoomSnapshot>;
|
|
1393
|
+
enterFullscreen(): Promise<void>;
|
|
1394
|
+
exitFullscreen(): Promise<void>;
|
|
1395
|
+
isFullscreen(): boolean;
|
|
1396
|
+
private toggleFullscreen;
|
|
1397
|
+
/** Rotate the delegated credential without rebuilding DOM, canvas or socket. */
|
|
1398
|
+
setToken(token: EventScopedManageToken, expiresAt?: number): void;
|
|
1399
|
+
private scheduleTokenRefresh;
|
|
1400
|
+
private rotateToken;
|
|
1401
|
+
/** Bulk block the given labels (or the current selection when omitted). */
|
|
1402
|
+
block(labels?: string[], opts?: {
|
|
1403
|
+
releaseAt?: number;
|
|
1404
|
+
reason?: string;
|
|
1405
|
+
}): Promise<void>;
|
|
1406
|
+
unblock(labels?: string[]): Promise<void>;
|
|
1407
|
+
unblockAll(): Promise<void>;
|
|
1408
|
+
/** Cancel bookings (BOOKED → free), guarded by the original booking ref. */
|
|
1409
|
+
cancelBooking(labels: string[], bookingRef: string): Promise<void>;
|
|
1410
|
+
selectAll(): ExpandedSeat[];
|
|
1411
|
+
selectSection(sectionId: string): ExpandedSeat[];
|
|
1412
|
+
selectByLabels(labels: string[]): ExpandedSeat[];
|
|
1413
|
+
clearSelection(): void;
|
|
1414
|
+
getSelection(): ExpandedSeat[];
|
|
1415
|
+
getReport(): Promise<ReportResult>;
|
|
1416
|
+
getControlRoomSnapshot(windowMinutes?: number): Promise<ControlRoomSnapshot>;
|
|
1417
|
+
/**
|
|
1418
|
+
* The realtime link's current state and the "as of" behind it.
|
|
1419
|
+
*
|
|
1420
|
+
* Pair with `onConnectionChange` for the edges: a host that mounts after a
|
|
1421
|
+
* drop, or re-reads on tab focus, needs to be able to ASK rather than wait
|
|
1422
|
+
* for the next transition that may never come.
|
|
1423
|
+
*/
|
|
1424
|
+
getConnection(): SeatManagerConnection;
|
|
1425
|
+
getLog(opts?: {
|
|
1426
|
+
limit?: number;
|
|
1427
|
+
before?: number;
|
|
1428
|
+
}): Promise<{
|
|
1429
|
+
entries: LogEntry[];
|
|
1430
|
+
nextBefore: number | null;
|
|
1431
|
+
}>;
|
|
1432
|
+
setHoldTtl(ms: number | null): Promise<void>;
|
|
1433
|
+
zoomToFit(): void;
|
|
1434
|
+
destroy(): void;
|
|
1435
|
+
private buildRenderer;
|
|
1436
|
+
/** Block always uses a marquee. Channels only enables its marquee after the
|
|
1437
|
+
* organizer deliberately chooses Assign seats; Pan map keeps desktop drag
|
|
1438
|
+
* available for large charts. */
|
|
1439
|
+
private isBulkSelectMode;
|
|
1440
|
+
/**
|
|
1441
|
+
* Block never touches held or booked inventory, so it cannot select it.
|
|
1442
|
+
* Channels must be able to select it — the Review sheet's honesty depends on
|
|
1443
|
+
* counting the held and sold units inside a marquee and saying they will not
|
|
1444
|
+
* move, rather than silently omitting them from the selection.
|
|
1445
|
+
*/
|
|
1446
|
+
private selectableStatuses;
|
|
1447
|
+
private updateRendererInteraction;
|
|
1448
|
+
private handleSeatSelect;
|
|
1449
|
+
/**
|
|
1450
|
+
* Build the client's inventory universe from the chart.
|
|
1451
|
+
*
|
|
1452
|
+
* `expandChart` yields SEATS — it has no output for a GA area, whose capacity
|
|
1453
|
+
* is sold as N synthetic unit labels. The server's seat map keys, its deltas
|
|
1454
|
+
* and its `totals` all speak those labels, so a client that only knows seats
|
|
1455
|
+
* counts GA sales in the numerator (every key of the snapshot is written into
|
|
1456
|
+
* `status`) while leaving them out of the denominator. Registering the GA
|
|
1457
|
+
* units here — labels only, never a render binding — is what makes the two
|
|
1458
|
+
* agree.
|
|
1459
|
+
*/
|
|
1460
|
+
private buildUnitUniverse;
|
|
1461
|
+
/** Every sellable unit the client knows: seats + GA capacity. */
|
|
1462
|
+
private unitTotal;
|
|
1463
|
+
/** Every label the client models, whether or not it can be painted. */
|
|
1464
|
+
private knownLabels;
|
|
1465
|
+
private repaintAll;
|
|
1466
|
+
/**
|
|
1467
|
+
* Open the cockpit's realtime socket AS THE ORGANIZER.
|
|
1468
|
+
*
|
|
1469
|
+
* The scope has to be established before the upgrade, because a browser
|
|
1470
|
+
* `WebSocket` cannot send an Authorization header: the manage token is traded
|
|
1471
|
+
* over HTTPS for a one-use ticket which rides in `Sec-WebSocket-Protocol`.
|
|
1472
|
+
* Without it the server treats this socket as an anonymous public buyer and
|
|
1473
|
+
* projects its deltas, so any change inside a private channel allocation is
|
|
1474
|
+
* structurally suppressed and the map silently drifts.
|
|
1475
|
+
*
|
|
1476
|
+
* If the mint fails, remain reconnecting. An unticketed socket is a buyer
|
|
1477
|
+
* projection, so applying it to organizer state would be worse than staying
|
|
1478
|
+
* visibly offline while the host refreshes authority or upgrades the API.
|
|
1479
|
+
*/
|
|
1480
|
+
private connect;
|
|
1481
|
+
private scheduleReconnect;
|
|
1482
|
+
private onMessage;
|
|
1483
|
+
/**
|
|
1484
|
+
* Adopt the cumulative booked gross a delta frame carried.
|
|
1485
|
+
*
|
|
1486
|
+
* Stashed with its arrival time so an in-flight control-room read can decide
|
|
1487
|
+
* whether it is holding the newer number: a frame that landed after the
|
|
1488
|
+
* request started is newer than the response, one that landed before is not.
|
|
1489
|
+
*/
|
|
1490
|
+
private applyLiveGross;
|
|
1491
|
+
/** The single writer for a label's status, so the counters never drift. */
|
|
1492
|
+
private setStatusLabel;
|
|
1493
|
+
private resnapshot;
|
|
1494
|
+
/**
|
|
1495
|
+
* Replace the whole seat model.
|
|
1496
|
+
*
|
|
1497
|
+
* `fallback` is the compact frame's modal status: those snapshots list only
|
|
1498
|
+
* the seats that DIFFER from it, so every other known label takes it. Without
|
|
1499
|
+
* this the omitted majority would silently fall back to `free` — fine when
|
|
1500
|
+
* the mode really is free, wrong the moment it is not.
|
|
1501
|
+
*/
|
|
1502
|
+
private applySnapshot;
|
|
1503
|
+
/** The one O(n) walk left: a wholesale model replacement re-bases the counters. */
|
|
1504
|
+
private recountAll;
|
|
1505
|
+
/** Optimistic local write shared by organizer actions. Paint and tally once,
|
|
1506
|
+
* even when an arena-sized operation changes hundreds of seats. */
|
|
1507
|
+
private setSeatsLocal;
|
|
1508
|
+
/** Keep the canvas painting on hidden/occluded tabs (war-room second monitor). */
|
|
1509
|
+
private afterPaint;
|
|
1510
|
+
private activityColor;
|
|
1511
|
+
private sectionsForLabels;
|
|
1512
|
+
private pulseSeatLabels;
|
|
1513
|
+
/** Render one grouped realtime operation at the right semantic zoom level. */
|
|
1514
|
+
private paintSpatialActivity;
|
|
1515
|
+
private locateSection;
|
|
1516
|
+
private locateActivity;
|
|
1517
|
+
private showLiveEvent;
|
|
1518
|
+
private applyReportRevenue;
|
|
1519
|
+
/**
|
|
1520
|
+
* Read the server's own control-room projection.
|
|
1521
|
+
*
|
|
1522
|
+
* Called on mount, on every socket (re)connect and after an organizer action —
|
|
1523
|
+
* never on a timer and never per delta frame. Presence and gross that arrived
|
|
1524
|
+
* on the socket AFTER this request started are newer than the response, so
|
|
1525
|
+
* they survive it; anything older defers to the read.
|
|
1526
|
+
*/
|
|
1527
|
+
private refreshControlRoom;
|
|
1528
|
+
/** Pin the server's totals to the client model they were read against. */
|
|
1529
|
+
private rebaseServerTotals;
|
|
1530
|
+
/** What the client's own model says — GA units included since `render()`. */
|
|
1531
|
+
private clientTallies;
|
|
1532
|
+
/**
|
|
1533
|
+
* The numbers the KPI bar and rail render.
|
|
1534
|
+
*
|
|
1535
|
+
* The server is the authority: its totals land exactly as read, and the
|
|
1536
|
+
* delta-driven client model carries them forward until the next read. Before
|
|
1537
|
+
* the first snapshot — and after a wholesale model replacement invalidates the
|
|
1538
|
+
* pairing — the client model stands alone.
|
|
1539
|
+
*/
|
|
1540
|
+
private buildTallies;
|
|
1541
|
+
/**
|
|
1542
|
+
* Queue one KPI/rail repaint for this burst of changes.
|
|
1543
|
+
*
|
|
1544
|
+
* A delta frame can carry hundreds of seats and `paintKpis` rebuilds eight
|
|
1545
|
+
* nodes from scratch, so painting per change is what made an arena-sized
|
|
1546
|
+
* frame expensive. Coalescing on a frame keeps the burst to a single rebuild;
|
|
1547
|
+
* without `requestAnimationFrame` (SSR, an older test env) it paints inline
|
|
1548
|
+
* rather than dropping the update.
|
|
1549
|
+
*/
|
|
1550
|
+
private recomputeTallies;
|
|
1551
|
+
private flushTallies;
|
|
1552
|
+
private verbFor;
|
|
1553
|
+
private pushActivity;
|
|
1554
|
+
private seedFeed;
|
|
1555
|
+
private startFeedClock;
|
|
1556
|
+
private selectionLabels;
|
|
1557
|
+
private syncSelection;
|
|
1558
|
+
private buildChrome;
|
|
1559
|
+
private updateContainerLayout;
|
|
1560
|
+
private sectionOptions;
|
|
1561
|
+
private buildSectionOptions;
|
|
1562
|
+
private paintModeTabs;
|
|
1563
|
+
private paintFollowLiveButton;
|
|
1564
|
+
private paintHeatButton;
|
|
1565
|
+
private paintMomentumHelp;
|
|
1566
|
+
private paintFullscreenButton;
|
|
1567
|
+
private paintTrendWindow;
|
|
1568
|
+
private setLive;
|
|
1569
|
+
private updateZoomHint;
|
|
1570
|
+
private formatKpiDelta;
|
|
1571
|
+
private paintKpis;
|
|
1572
|
+
private paintRail;
|
|
1573
|
+
private renderViewRail;
|
|
1574
|
+
/** Live presence wins over the snapshot's copy — it is the fresher channel,
|
|
1575
|
+
* and it exists from the first frame rather than the first fetch. */
|
|
1576
|
+
private presenceCounts;
|
|
1577
|
+
private paintMonitorInsights;
|
|
1578
|
+
private applyHeatOverlay;
|
|
1579
|
+
private renderInspectRail;
|
|
1580
|
+
/** Pull the organizer's availability rules (event:view). Called on load and on
|
|
1581
|
+
* every WS (re)connect, mirroring how the other panels re-hydrate. `closed` is
|
|
1582
|
+
* deterministic from the rules; `hidden` (which folds in already-due timed /
|
|
1583
|
+
* threshold windows) comes from the snapshot + WS effective set. */
|
|
1584
|
+
private refreshAvailability;
|
|
1585
|
+
/** Run a token-authed op; on a 401 re-mint via onTokenRefresh and retry once. */
|
|
1586
|
+
private withAuthRetry;
|
|
1587
|
+
/** Adopt a new effective hidden/closed set (from a snapshot or WS broadcast) and
|
|
1588
|
+
* repaint the rail + canvas when it actually moves. */
|
|
1589
|
+
private updateEffectiveAvailability;
|
|
1590
|
+
/** Canvas read of the availability state: dim hidden sections to a whisper,
|
|
1591
|
+
* half-light closed sections, leave open sections normal. Only in Sections mode;
|
|
1592
|
+
* cleared in every other tool. */
|
|
1593
|
+
private applySectionCanvasTreatment;
|
|
1594
|
+
/** The five cockpit fields the pure row model (managerSections.ts) reads. */
|
|
1595
|
+
private sectionRowsInput;
|
|
1596
|
+
private renderSectionsRail;
|
|
1597
|
+
private wireSectionRail;
|
|
1598
|
+
/** Change one row's availability mode. A zone rule subsumes its child section
|
|
1599
|
+
* rules, so those are dropped from the map (the zone window is the truth). */
|
|
1600
|
+
private setSectionMode;
|
|
1601
|
+
/** Edit a timed reveal time / threshold percent on an existing row rule. */
|
|
1602
|
+
private setSectionRulePatch;
|
|
1603
|
+
/** Optimistically adopt the new rules, then reconcile with the server-cleaned
|
|
1604
|
+
* map + effective hidden/closed sets. Rolls back the rules on failure. */
|
|
1605
|
+
private persistAvailability;
|
|
1606
|
+
private paintLegend;
|
|
1607
|
+
private paintFeed;
|
|
1608
|
+
private renderBlockRail;
|
|
1609
|
+
private toggleCategory;
|
|
1610
|
+
/** A category/filter is a real toggle: add the missing seats, or remove the
|
|
1611
|
+
* whole group when every eligible seat in it is already selected. */
|
|
1612
|
+
private toggleLabels;
|
|
1613
|
+
private isBlockSelectable;
|
|
1614
|
+
private paintSelBar;
|
|
1615
|
+
private paintCategoryControls;
|
|
1616
|
+
private filteredBlockedSeats;
|
|
1617
|
+
private paintBlockedInventory;
|
|
1618
|
+
private confirmUnblockAll;
|
|
1619
|
+
private resetUnblockAllConfirm;
|
|
1620
|
+
private done;
|
|
1621
|
+
private toastOk;
|
|
1622
|
+
private toastErr;
|
|
1623
|
+
private toast;
|
|
1624
|
+
private fail;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* channelsTypes — the Channels cockpit's public contract (the client it talks
|
|
1629
|
+
* to, the capabilities it is granted, the host it is mounted into) plus the two
|
|
1630
|
+
* private shapes its dialog machine runs on.
|
|
1631
|
+
*
|
|
1632
|
+
* Split out of channelsMode.ts verbatim. `channelsMode.ts` re-exports every
|
|
1633
|
+
* public name, so `@seatlayer/js`'s published surface is unchanged. Types only —
|
|
1634
|
+
* nothing here emits a byte of runtime JavaScript.
|
|
1635
|
+
*/
|
|
1636
|
+
|
|
1637
|
+
/** The seat facts the overlay needs. Chart space, not screen space. */
|
|
1638
|
+
interface ChannelsSeatView {
|
|
1639
|
+
id: string;
|
|
1640
|
+
label: string;
|
|
1641
|
+
x: number;
|
|
1642
|
+
y: number;
|
|
1643
|
+
}
|
|
1644
|
+
/** One row offered to the bulk assignment chooser. A physically segmented row
|
|
1645
|
+
* (one label split across several row objects) shares one logical id, so the
|
|
1646
|
+
* organizer picks "Row AA" once rather than three fragments of it. */
|
|
1647
|
+
interface ChannelsRowView {
|
|
1648
|
+
id: string;
|
|
1649
|
+
label: string;
|
|
1650
|
+
sectionId: string;
|
|
1651
|
+
sectionLabel: string;
|
|
1652
|
+
labels: string[];
|
|
1653
|
+
}
|
|
1654
|
+
/** The `ManageApi` subset Channels mode uses — structural so tests can pass a
|
|
1655
|
+
* hand-rolled double without constructing a real client. */
|
|
1656
|
+
interface ChannelsClient {
|
|
1657
|
+
channels(key: string, opts?: {
|
|
1658
|
+
includeArchived?: boolean;
|
|
1659
|
+
}): Promise<ChannelListResult>;
|
|
1660
|
+
channelAllocation(key: string, opts?: {
|
|
1661
|
+
afterLabel?: string;
|
|
1662
|
+
limit?: number;
|
|
1663
|
+
}): Promise<ChannelAllocationPage>;
|
|
1664
|
+
createChannel(key: string, input: {
|
|
1665
|
+
name: string;
|
|
1666
|
+
color?: string | null;
|
|
1667
|
+
marker?: string | null;
|
|
1668
|
+
externalRef?: string | null;
|
|
1669
|
+
}): Promise<{
|
|
1670
|
+
ok: true;
|
|
1671
|
+
channel: ChannelRecord;
|
|
1672
|
+
}>;
|
|
1673
|
+
renameChannel(key: string, channelId: string, name: string): Promise<{
|
|
1674
|
+
ok: true;
|
|
1675
|
+
channel: ChannelRecord;
|
|
1676
|
+
}>;
|
|
1677
|
+
setChannelPaused(key: string, channelId: string, paused: boolean): Promise<{
|
|
1678
|
+
ok: true;
|
|
1679
|
+
channel: ChannelRecord;
|
|
1680
|
+
}>;
|
|
1681
|
+
archiveChannel(key: string, channelId: string, destination: string | null): Promise<{
|
|
1682
|
+
ok: true;
|
|
1683
|
+
channel: ChannelRecord;
|
|
1684
|
+
assignmentVersion: number;
|
|
1685
|
+
moved: number;
|
|
1686
|
+
}>;
|
|
1687
|
+
applyChannelAssignment(key: string, input: {
|
|
1688
|
+
targetChannelId: string | null;
|
|
1689
|
+
labels: string[];
|
|
1690
|
+
assignmentVersion: number;
|
|
1691
|
+
}): Promise<AssignmentResult>;
|
|
1692
|
+
channelPreview(key: string, channelIds: string[], opts?: {
|
|
1693
|
+
includePublic?: boolean;
|
|
1694
|
+
}): Promise<ChannelPreviewProjection>;
|
|
1695
|
+
/** Choose the channel's sale route. Authorization since 2026-08-06, so this is
|
|
1696
|
+
* a precondition of every buyer-facing action, not a label. `opts` carries the
|
|
1697
|
+
* acknowledgement that unblocks a switch with live buyer access. */
|
|
1698
|
+
setChannelAccessIntent(key: string, channelId: string, accessIntent: ChannelAccessIntent, opts?: {
|
|
1699
|
+
acknowledgeLiveAccess?: boolean;
|
|
1700
|
+
reason?: string;
|
|
1701
|
+
}): Promise<{
|
|
1702
|
+
ok: true;
|
|
1703
|
+
channel: ChannelRecord;
|
|
1704
|
+
intentSwitch?: {
|
|
1705
|
+
closedLinks: number;
|
|
1706
|
+
keptSessions: number;
|
|
1707
|
+
};
|
|
1708
|
+
}>;
|
|
1709
|
+
/** 201 with the ONE-TIME reveal. Every omitted field takes the server default
|
|
1710
|
+
* (expiry = event start, 100 redemptions, 4 seats per buyer). */
|
|
1711
|
+
createAccessLink(key: string, channelId: string, input: {
|
|
1712
|
+
label?: string | null;
|
|
1713
|
+
expiresAt?: number;
|
|
1714
|
+
maxRedemptions?: number;
|
|
1715
|
+
maxQuantity?: number;
|
|
1716
|
+
includePublic?: boolean;
|
|
1717
|
+
}): Promise<AccessLinkReveal>;
|
|
1718
|
+
/** Status only. This response has no url and no capability, by contract. */
|
|
1719
|
+
accessLinks(key: string, channelId: string): Promise<{
|
|
1720
|
+
links: AccessLinkStatusRecord[];
|
|
1721
|
+
}>;
|
|
1722
|
+
/** `endActiveSessions` is required — the server 422s without it, deliberately. */
|
|
1723
|
+
rotateAccessLink(key: string, channelId: string, linkId: string, endActiveSessions: boolean): Promise<AccessLinkReveal>;
|
|
1724
|
+
revokeAccessLink(key: string, channelId: string, linkId: string, endActiveSessions?: boolean): Promise<{
|
|
1725
|
+
ok: true;
|
|
1726
|
+
link: unknown;
|
|
1727
|
+
endedSessions: number;
|
|
1728
|
+
}>;
|
|
1729
|
+
}
|
|
1730
|
+
interface ChannelsCapabilities {
|
|
1731
|
+
view: boolean;
|
|
1732
|
+
manage: boolean;
|
|
1733
|
+
}
|
|
1734
|
+
/** Everything Channels mode needs from the cockpit around it. */
|
|
1735
|
+
interface ChannelsModeHost {
|
|
1736
|
+
eventKey: string;
|
|
1737
|
+
api: ChannelsClient;
|
|
1738
|
+
/** The rail scroll container the mode paints into. */
|
|
1739
|
+
rail: HTMLElement;
|
|
1740
|
+
/** An absolutely-positioned layer over the map (overlay canvas, flags, bars). */
|
|
1741
|
+
mapLayer: HTMLElement;
|
|
1742
|
+
/** The widget root — dialogs mount here so they inherit the widget's tokens. */
|
|
1743
|
+
root: HTMLElement;
|
|
1744
|
+
seats(): ChannelsSeatView[];
|
|
1745
|
+
statusOf(label: string): ChannelSeatStatus | undefined;
|
|
1746
|
+
selectionLabels(): string[];
|
|
1747
|
+
selectByLabels(labels: string[]): void;
|
|
1748
|
+
clearSelection(): void;
|
|
1749
|
+
selectSection(sectionId: string): void;
|
|
1750
|
+
sections(): Array<{
|
|
1751
|
+
id: string;
|
|
1752
|
+
label: string;
|
|
1753
|
+
}>;
|
|
1754
|
+
/** Every selectable label inside one section, for the additive scope chooser. */
|
|
1755
|
+
labelsInSection(sectionId: string): string[];
|
|
1756
|
+
/** Logical rows across the whole chart, grouped by their section. */
|
|
1757
|
+
rows(): ChannelsRowView[];
|
|
1758
|
+
categories(): Array<{
|
|
1759
|
+
key: string;
|
|
1760
|
+
label: string;
|
|
1761
|
+
color?: string;
|
|
1762
|
+
}>;
|
|
1763
|
+
labelsInCategory(key: string): string[];
|
|
1764
|
+
sectionOfLabel(label: string): {
|
|
1765
|
+
id: string;
|
|
1766
|
+
label: string;
|
|
1767
|
+
} | null;
|
|
1768
|
+
/** Chart-space → container pixels. Null when there is no live renderer. */
|
|
1769
|
+
worldToScreen(point: {
|
|
1770
|
+
x: number;
|
|
1771
|
+
y: number;
|
|
1772
|
+
}): {
|
|
1773
|
+
x: number;
|
|
1774
|
+
y: number;
|
|
1775
|
+
} | null;
|
|
1776
|
+
/** Approximate on-screen seat size in CSS pixels, for the overlay marks. */
|
|
1777
|
+
seatPixelSize(): number;
|
|
1778
|
+
/** Whether the live renderer is currently showing individual seats. */
|
|
1779
|
+
isSeatDetail(): boolean;
|
|
1780
|
+
/** Return a sectional venue to its section-only overview. */
|
|
1781
|
+
showSectionOverview(): void;
|
|
1782
|
+
/** Focus one section using the renderer's real camera transition. */
|
|
1783
|
+
focusSection(sectionId: string): void;
|
|
1784
|
+
isCompact(): boolean;
|
|
1785
|
+
/** Make the canvas non-interactive behind a full-detent sheet (§13). */
|
|
1786
|
+
setMapInert(inert: boolean): void;
|
|
1787
|
+
toast(message: string, kind: 'ok' | 'err'): void;
|
|
1788
|
+
onError(err: unknown): void;
|
|
1789
|
+
/** Fired whenever the staged mutation count changes, for host telemetry. */
|
|
1790
|
+
onStagedChange?(staged: number): void;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
declare class ChannelsMode {
|
|
1794
|
+
private readonly host;
|
|
1795
|
+
private caps;
|
|
1796
|
+
private active;
|
|
1797
|
+
private list;
|
|
1798
|
+
private allocation;
|
|
1799
|
+
private assignmentVersion;
|
|
1800
|
+
private loadError;
|
|
1801
|
+
private loading;
|
|
1802
|
+
private view;
|
|
1803
|
+
/** Pan is intentionally the initial desktop interaction. Assignment's
|
|
1804
|
+
* marquee is powerful, but must never make an organizer lose map navigation. */
|
|
1805
|
+
private mapIntent;
|
|
1806
|
+
private focusedSectionId;
|
|
1807
|
+
private showArchived;
|
|
1808
|
+
private detailChannelId;
|
|
1809
|
+
/**
|
|
1810
|
+
* Whether the organizer has asked to assign seats.
|
|
1811
|
+
*
|
|
1812
|
+
* The list rail leads with the CHANNELS. The assignment tooling — destination
|
|
1813
|
+
* picker plus five select-by routes — used to paint unconditionally above that
|
|
1814
|
+
* list, so a first-time organizer met a workbench for a job they had not asked
|
|
1815
|
+
* to do, with the thing they came for pushed below the fold. It is now
|
|
1816
|
+
* disclosed on intent: the "Assign seats to a channel" action under the list,
|
|
1817
|
+
* the map's own "Assign seats" segment, or simply having a selection. The
|
|
1818
|
+
* selection rail always shows the tools, because there the intent is proven.
|
|
1819
|
+
*/
|
|
1820
|
+
private assignOpen;
|
|
1821
|
+
private targetChannelId;
|
|
1822
|
+
private conflict;
|
|
1823
|
+
private dialog;
|
|
1824
|
+
private detent;
|
|
1825
|
+
private seatListLimit;
|
|
1826
|
+
/**
|
|
1827
|
+
* Hosted-link STATUS for the channel whose detail panel is open. This is the
|
|
1828
|
+
* listing projection — it carries no url and no capability, because no route
|
|
1829
|
+
* returns one. `unsupported` is the honest answer for a worker that predates
|
|
1830
|
+
* M8, exactly like the buyer-preview probe.
|
|
1831
|
+
*/
|
|
1832
|
+
private links;
|
|
1833
|
+
private linksChannelId;
|
|
1834
|
+
private linksState;
|
|
1835
|
+
/**
|
|
1836
|
+
* Monotonic read generations — one for the channel list + allocation, one for
|
|
1837
|
+
* the open channel's links. Reads are concurrent (a 10s poll versus a
|
|
1838
|
+
* mutation's own reload), and the network does not promise to answer them in
|
|
1839
|
+
* order. Only the NEWEST read of each kind may write to state; an older
|
|
1840
|
+
* answer that arrives late is dropped, never painted.
|
|
1841
|
+
*/
|
|
1842
|
+
private listSeq;
|
|
1843
|
+
private linksSeq;
|
|
1844
|
+
private previewAudience;
|
|
1845
|
+
private previewIncludePublic;
|
|
1846
|
+
private previewProjection;
|
|
1847
|
+
/**
|
|
1848
|
+
* The buyer-preview read, as one honest state rather than a boolean.
|
|
1849
|
+
*
|
|
1850
|
+
* `previewSupported: boolean | null` could say "this worker has no projection
|
|
1851
|
+
* route", but it could not say "the read is in flight" or "the read failed" —
|
|
1852
|
+
* both of those painted an audience picker with no result underneath, which
|
|
1853
|
+
* reads as "this audience can buy nothing". Loading and error are now states
|
|
1854
|
+
* of their own, and the error one offers a retry.
|
|
1855
|
+
*/
|
|
1856
|
+
private previewState;
|
|
1857
|
+
private pollTimer;
|
|
1858
|
+
private layer;
|
|
1859
|
+
private canvas;
|
|
1860
|
+
/** undefined = not resolved yet, null = this environment has no 2d canvas. */
|
|
1861
|
+
private ctx;
|
|
1862
|
+
private bannerEl;
|
|
1863
|
+
private stagedEl;
|
|
1864
|
+
private liveEl;
|
|
1865
|
+
private scrimEl;
|
|
1866
|
+
private lastFocus;
|
|
1867
|
+
private stagedDoneTimer;
|
|
1868
|
+
private lastSelectionCount;
|
|
1869
|
+
private lastCounts;
|
|
1870
|
+
/** Rows are structural chart data — they do not move while the organizer is
|
|
1871
|
+
* allocating. Deriving them walks every seat, so the view is cached for the
|
|
1872
|
+
* lifetime of this mode entry and ordinary selection repaints stay O(1). */
|
|
1873
|
+
private assignmentRowsCache;
|
|
1874
|
+
/** The markup currently in the rail. An identical repaint is skipped, which is
|
|
1875
|
+
* what keeps the organizer's scroll position (and open <select>) alive. */
|
|
1876
|
+
private railHtml;
|
|
1877
|
+
/**
|
|
1878
|
+
* The `assignmentVersion` the allocation map was built from. Walking every
|
|
1879
|
+
* allocation page is the expensive half of a refresh and the server already
|
|
1880
|
+
* tells us, in the channels response, whether ANY seat moved. Unchanged
|
|
1881
|
+
* version, unchanged allocation — so the walk is skipped entirely.
|
|
1882
|
+
*/
|
|
1883
|
+
private allocationVersion;
|
|
1884
|
+
private onVisibility;
|
|
1885
|
+
constructor(host: ChannelsModeHost, capabilities: ChannelsCapabilities);
|
|
1886
|
+
/** Called when the cockpit switches into Channels mode. */
|
|
1887
|
+
enter(): void;
|
|
1888
|
+
/** Called when the cockpit leaves Channels mode. Everything this mode painted
|
|
1889
|
+
* over the map goes with it — no other tool ever inherits a channel overlay. */
|
|
1890
|
+
leave(): void;
|
|
1891
|
+
destroy(): void;
|
|
1892
|
+
/** Capabilities can change when a token rotates. Re-render, fail-closed. */
|
|
1893
|
+
setCapabilities(capabilities: ChannelsCapabilities): void;
|
|
1894
|
+
isActive(): boolean;
|
|
1895
|
+
/**
|
|
1896
|
+
* Whether the map should accept bulk selection right now. Preview is a
|
|
1897
|
+
* read-only simulation of somebody else's view, and a view-only token has no
|
|
1898
|
+
* assignment to stage — in both cases the canvas must not offer selection at
|
|
1899
|
+
* all rather than collect a selection nothing can act on.
|
|
1900
|
+
*/
|
|
1901
|
+
canSelect(): boolean;
|
|
1902
|
+
/** Bulk seat assignment is explicit. In Pan map, clicks can still inspect a
|
|
1903
|
+
* single seat, while a primary-button drag always moves the camera. */
|
|
1904
|
+
usesMarqueeSelection(): boolean;
|
|
1905
|
+
/** The renderer calls this when the organizer opens a section from overview. */
|
|
1906
|
+
handleSectionFocus(sectionId: string): void;
|
|
1907
|
+
/**
|
|
1908
|
+
* Organizer realtime integration point. M5 ships a per-scope socket for
|
|
1909
|
+
* buyers; the organizer channel-count stream is a later milestone. When it
|
|
1910
|
+
* arrives, call this from the cockpit's WS handler instead of waiting for the
|
|
1911
|
+
* poll — everything downstream already reacts to a fresh list.
|
|
1912
|
+
*/
|
|
1913
|
+
applyRealtimeHint(): void;
|
|
1914
|
+
/** The cockpit's selection changed (marquee / click / section / category). */
|
|
1915
|
+
handleSelectionChange(): void;
|
|
1916
|
+
/** Camera moved or the container resized — the overlay is screen-space. */
|
|
1917
|
+
handleViewChange(): void;
|
|
1918
|
+
handleLayoutChange(): void;
|
|
1919
|
+
private refresh;
|
|
1920
|
+
/** Walk every allocation page. Bounded by the event's seat count, and the
|
|
1921
|
+
* server caps each page, so an arena is a handful of round trips. */
|
|
1922
|
+
private loadAllocation;
|
|
1923
|
+
private channelById;
|
|
1924
|
+
private nameOf;
|
|
1925
|
+
private markerFor;
|
|
1926
|
+
/** Channels an organizer may assign INTO: public sale plus every live channel. */
|
|
1927
|
+
private assignableChannels;
|
|
1928
|
+
private currentPlan;
|
|
1929
|
+
private ensureLayer;
|
|
1930
|
+
private announce;
|
|
1931
|
+
/**
|
|
1932
|
+
* Repaint the allocation (or preview) overlay in ONE canvas pass.
|
|
1933
|
+
*
|
|
1934
|
+
* The marks themselves live in channelsOverlay.ts; this is the cockpit half —
|
|
1935
|
+
* the guards, the memoised 2D context, and the command the section hit targets
|
|
1936
|
+
* fire back into the rail.
|
|
1937
|
+
*/
|
|
1938
|
+
private paintOverlay;
|
|
1939
|
+
private setStaged;
|
|
1940
|
+
private paintStagedBar;
|
|
1941
|
+
private setBanner;
|
|
1942
|
+
private setView;
|
|
1943
|
+
/** Set by the cockpit so a view switch can re-arm canvas selection. */
|
|
1944
|
+
onInteractionChange?: () => void;
|
|
1945
|
+
private loadPreview;
|
|
1946
|
+
/**
|
|
1947
|
+
* Replace the rail's markup — but only when it actually differs, and never at
|
|
1948
|
+
* the cost of where the organizer had scrolled to.
|
|
1949
|
+
*
|
|
1950
|
+
* The rail repaints on a clock, on every selection change and after every
|
|
1951
|
+
* mutation. Rewriting `innerHTML` each time resets `scrollTop`, which is
|
|
1952
|
+
* exactly what "the rail gets stuck" was: scroll down to Create channel, the
|
|
1953
|
+
* poll ticks, and the list snaps back to the top under the cursor. So skip the
|
|
1954
|
+
* write when the markup is byte-identical, and restore the offset when it is
|
|
1955
|
+
* not.
|
|
1956
|
+
*
|
|
1957
|
+
* Returns whether the DOM was rewritten. Callers must only re-wire listeners
|
|
1958
|
+
* when it was — a skipped paint keeps the old nodes AND their listeners, so
|
|
1959
|
+
* re-wiring would double every handler.
|
|
1960
|
+
*/
|
|
1961
|
+
private setRailHtml;
|
|
1962
|
+
paintRail(): void;
|
|
1963
|
+
private viewSegmentHtml;
|
|
1964
|
+
private mapNavigationHtml;
|
|
1965
|
+
private countsHtml;
|
|
1966
|
+
private channelRowHtml;
|
|
1967
|
+
private listRailHtml;
|
|
1968
|
+
/**
|
|
1969
|
+
* The assignment entry point on the list rail.
|
|
1970
|
+
*
|
|
1971
|
+
* Collapsed it is ONE plain-language action, so the channels the organizer came
|
|
1972
|
+
* for stay at the top of the panel. Opened it is the same tool set that has
|
|
1973
|
+
* always worked, in the same order, plus the way back out — and opening it is
|
|
1974
|
+
* also what the map's "Assign seats" segment does, so the two routes into the
|
|
1975
|
+
* job cannot disagree about whether it is running.
|
|
1976
|
+
*/
|
|
1977
|
+
private assignEntryHtml;
|
|
1978
|
+
/**
|
|
1979
|
+
* Destination-first assignment controls.
|
|
1980
|
+
*
|
|
1981
|
+
* These used to live only inside the selection rail, which meant every route
|
|
1982
|
+
* into them was gated behind "select a seat on the map first" — the section,
|
|
1983
|
+
* row and category choosers were invisible until the organizer had already
|
|
1984
|
+
* done the work by hand. They are still reachable before a seat is selected,
|
|
1985
|
+
* but they are no longer the first thing in the panel: on the list rail they
|
|
1986
|
+
* are disclosed by `assignEntryHtml`, and there they carry a way back out
|
|
1987
|
+
* (`collapsible`). In the selection rail there is nothing to disclose — a
|
|
1988
|
+
* selection IS the intent — so they paint unconditionally and without Done.
|
|
1989
|
+
*/
|
|
1990
|
+
private assignmentToolsHtml;
|
|
1991
|
+
private selectionRailHtml;
|
|
1992
|
+
private detailRailHtml;
|
|
1993
|
+
/**
|
|
1994
|
+
* "Distribute" — the ONE way this channel's seats reach a buyer.
|
|
1995
|
+
*
|
|
1996
|
+
* All four routes are here, and this is a real chooser again. It was cut down
|
|
1997
|
+
* to two actions in 0.42.0 for a good reason: `access_intent` was stored,
|
|
1998
|
+
* audited, and read by nothing, so "Keep as protected reserve" and "Sell
|
|
1999
|
+
* through your own staff" were labels an organizer could set and then wait
|
|
2000
|
+
* forever for something to happen. The server closed that hole on 2026-08-06 —
|
|
2001
|
+
* each declaration now opens exactly one route and REFUSES the other three —
|
|
2002
|
+
* so all four are honest choices and belong on the surface.
|
|
2003
|
+
*
|
|
2004
|
+
* None of the old copy came back with them. These sentences are written
|
|
2005
|
+
* against the enforcement matrix (`accessIntentDescription`), which is why
|
|
2006
|
+
* each one says what the route refuses as well as what it allows.
|
|
2007
|
+
*
|
|
2008
|
+
* The current route is stated, not merely styled: a chooser whose selection
|
|
2009
|
+
* you have to infer from a border is not a chooser. Its card carries a
|
|
2010
|
+
* "Current route" marker and drops its own select button, because pressing it
|
|
2011
|
+
* would do nothing.
|
|
2012
|
+
*/
|
|
2013
|
+
private distributeHtml;
|
|
2014
|
+
/**
|
|
2015
|
+
* Read the status projection for the open channel. Never paints — the caller
|
|
2016
|
+
* decides when the rail repaints, so a poll-driven reload does not fight a
|
|
2017
|
+
* user-driven one. A worker without M8 answers 404/405 and gets the honest
|
|
2018
|
+
* "needs a newer server" line rather than an error toast.
|
|
2019
|
+
*/
|
|
2020
|
+
private loadLinks;
|
|
2021
|
+
/**
|
|
2022
|
+
* The buyer-link status section of the detail panel.
|
|
2023
|
+
*
|
|
2024
|
+
* STATUS ONLY, by design (comp 06 `hosted`): label, state, expiry,
|
|
2025
|
+
* redemptions, seats per buyer, live sessions. There is no Copy control here
|
|
2026
|
+
* and no field to hang one on — the URL was shown once at creation and cannot
|
|
2027
|
+
* be produced again. Rotation is the recovery path, and it says so.
|
|
2028
|
+
*
|
|
2029
|
+
* Creating a link is the Distribute card's action, not this section's, so a
|
|
2030
|
+
* channel with no links renders nothing here rather than an empty heading and
|
|
2031
|
+
* a second button saying the same thing.
|
|
2032
|
+
*/
|
|
2033
|
+
private hostedLinksHtml;
|
|
2034
|
+
private linkCardHtml;
|
|
2035
|
+
private previewRailHtml;
|
|
2036
|
+
private paintSelection;
|
|
2037
|
+
private wireRail;
|
|
2038
|
+
/** Open a channel's detail panel and start its buyer-link read. */
|
|
2039
|
+
private openChannel;
|
|
2040
|
+
private railAction;
|
|
2041
|
+
/** Derived once per mode entry — see `assignmentRowsCache`. */
|
|
2042
|
+
private assignmentRows;
|
|
2043
|
+
private pickCategory;
|
|
2044
|
+
/** A tiny modal chooser reusing the dialog primitive (focus trap + Escape). */
|
|
2045
|
+
private promptChoice;
|
|
2046
|
+
/**
|
|
2047
|
+
* Add several whole sections, or several whole rows, in one operation.
|
|
2048
|
+
*
|
|
2049
|
+
* ADDITIVE by contract: the chooser starts from the labels already selected
|
|
2050
|
+
* and only ever grows that set, so opening it never destroys a hard-won
|
|
2051
|
+
* marquee or seat-list selection. The confirm button always states the net
|
|
2052
|
+
* number of seats it will add, and refuses to exceed `MAX_ASSIGNMENT_UNITS`.
|
|
2053
|
+
*
|
|
2054
|
+
* Rows get the richer variant. A large venue has thousands of them, so they
|
|
2055
|
+
* arrive collapsed under their section, with a section-level tri-state
|
|
2056
|
+
* checkbox, a search across every row, and a render cap — the flat list used
|
|
2057
|
+
* for sections would be an unusable wall of buttons.
|
|
2058
|
+
*/
|
|
2059
|
+
private renderScopeDialog;
|
|
2060
|
+
private openDialog;
|
|
2061
|
+
private renderDialog;
|
|
2062
|
+
/**
|
|
2063
|
+
* `channel_intent_switch_blocked` — buyers are inside the route being left.
|
|
2064
|
+
*
|
|
2065
|
+
* The same review-then-acknowledge shape as the archive and chart-drop guards,
|
|
2066
|
+
* because it is the same kind of decision: the server refuses once, names
|
|
2067
|
+
* exactly what is at stake, and only a deliberate second press goes through.
|
|
2068
|
+
* What acknowledging does is spelled out per consequence — links close now,
|
|
2069
|
+
* checkouts already running survive and drain — rather than hidden behind a
|
|
2070
|
+
* word like "force".
|
|
2071
|
+
*/
|
|
2072
|
+
private renderIntentSwitchDialog;
|
|
2073
|
+
/**
|
|
2074
|
+
* The acknowledged retry. The declare and the create stay one gesture across
|
|
2075
|
+
* the sheet: if this switch was the first half of a declare-then-create, the
|
|
2076
|
+
* held form finishes on the far side of the acknowledgement.
|
|
2077
|
+
*/
|
|
2078
|
+
private acknowledgeIntentSwitch;
|
|
2079
|
+
/**
|
|
2080
|
+
* Mount a modal: `aria-modal` dialog, programmatic name, focus moved inside,
|
|
2081
|
+
* Tab trapped, Escape closes WITHOUT mutating, focus restored on close (§13).
|
|
2082
|
+
*/
|
|
2083
|
+
private renderScrim;
|
|
2084
|
+
private closeDialog;
|
|
2085
|
+
private renderCreateDialog;
|
|
2086
|
+
private createChannel;
|
|
2087
|
+
private showDialogError;
|
|
2088
|
+
private renderReviewDialog;
|
|
2089
|
+
/**
|
|
2090
|
+
* Apply. On success the sheet CLOSES and the staged bar confirms what moved,
|
|
2091
|
+
* naming the destination and any skipped seats, with the AUTHORITATIVE server
|
|
2092
|
+
* buckets still one Details press away. Leaving the modal up on success made
|
|
2093
|
+
* the organizer dismiss a sheet to get back to a map they had just changed.
|
|
2094
|
+
* On a stale version the server mutated nothing: keep the selection, shake
|
|
2095
|
+
* the bar once, and offer exactly one action — Refresh and review.
|
|
2096
|
+
*/
|
|
2097
|
+
private apply;
|
|
2098
|
+
/**
|
|
2099
|
+
* The success receipt, now that the review sheet closes on Apply. It names the
|
|
2100
|
+
* destination and the seats that could not move, keeps the authoritative
|
|
2101
|
+
* buckets reachable through Details, and stays up long enough to be read —
|
|
2102
|
+
* 1.2s was tuned for a confirmation the organizer was already looking at.
|
|
2103
|
+
*/
|
|
2104
|
+
private showApplied;
|
|
2105
|
+
private shakeStaged;
|
|
2106
|
+
/**
|
|
2107
|
+
* The ⋯ menu.
|
|
2108
|
+
*
|
|
2109
|
+
* Opening a channel is the ROW's job now, so ⋯ carries what is left: the
|
|
2110
|
+
* secondary and destructive lifecycle actions. It is rendered through the same
|
|
2111
|
+
* scrim primitive as every other sheet, which is what gives it a focus trap,
|
|
2112
|
+
* Escape, and a name — a bare absolutely-positioned popup would have had none
|
|
2113
|
+
* of those. Archive keeps its own confirmation dialog; this menu never
|
|
2114
|
+
* destroys anything by itself.
|
|
2115
|
+
*/
|
|
2116
|
+
private renderMenuDialog;
|
|
2117
|
+
private renderRenameDialog;
|
|
2118
|
+
/**
|
|
2119
|
+
* "Use a website or app" — declare the channel's route as `server`.
|
|
2120
|
+
*
|
|
2121
|
+
* This is no longer a flag the Embed page happens to read: since 2026-08-06 it
|
|
2122
|
+
* is what AUTHORIZES `POST /v1/events/:key/buyer-access-sessions` to mint for
|
|
2123
|
+
* this channel at all. Without it, an integration that is otherwise perfectly
|
|
2124
|
+
* wired up gets a 409 on every buyer.
|
|
2125
|
+
*/
|
|
2126
|
+
private chooseWebsiteIntegration;
|
|
2127
|
+
/**
|
|
2128
|
+
* Declare this channel's sale route.
|
|
2129
|
+
*
|
|
2130
|
+
* Reports through the toast lane the rest of the rail's direct actions use.
|
|
2131
|
+
* The two enforcement refusals get real answers rather than a generic failure:
|
|
2132
|
+
* `channel_intent_switch_blocked` opens the review sheet (there is a decision
|
|
2133
|
+
* to make, and a sheet is where decisions live), and
|
|
2134
|
+
* `channel_access_intent_forbids` — which the organizer can hit by racing
|
|
2135
|
+
* their own second tab — says which route is in the way.
|
|
2136
|
+
*/
|
|
2137
|
+
private setAccessIntent;
|
|
2138
|
+
/** What just happened, including anything the switch took down with it — the
|
|
2139
|
+
* server reports `intentSwitch` only when it actually disturbed something. */
|
|
2140
|
+
private intentSavedCopy;
|
|
2141
|
+
/** `channelId` is explicit because this is reachable from the ⋯ menu on a row
|
|
2142
|
+
* that is NOT the open channel, as well as from the detail panel itself. */
|
|
2143
|
+
private togglePause;
|
|
2144
|
+
private renderArchiveDialog;
|
|
2145
|
+
private archive;
|
|
2146
|
+
/**
|
|
2147
|
+
* The synchronized inventory list (§13): the keyboard and screen-reader
|
|
2148
|
+
* equivalent of canvas click / marquee / brush, grouped by section with
|
|
2149
|
+
* per-section select actions.
|
|
2150
|
+
*/
|
|
2151
|
+
private renderSeatListDialog;
|
|
2152
|
+
private reloadLinks;
|
|
2153
|
+
/**
|
|
2154
|
+
* The reload EVERY link mutation owes the panel.
|
|
2155
|
+
*
|
|
2156
|
+
* A create/rotate/revoke changes two things the detail panel renders: the
|
|
2157
|
+
* channel's access line (the server sets `access.intent` on create, and clears
|
|
2158
|
+
* it when the last live link goes) and the link status list. Both are re-read
|
|
2159
|
+
* here and the rail repainted, so the panel the organizer is already looking
|
|
2160
|
+
* at is current the moment the mutation lands — no reload, and no dependence
|
|
2161
|
+
* on HOW the one-time reveal was dismissed (the button, Escape, or never).
|
|
2162
|
+
*/
|
|
2163
|
+
private reloadAfterLinkChange;
|
|
2164
|
+
private linkById;
|
|
2165
|
+
/**
|
|
2166
|
+
* Create. The three policy fields carry the owner's defaults and every one of
|
|
2167
|
+
* them is editable; the PLATFORM bounds (60s–180d, 1–10 000, 1–100, 20 live
|
|
2168
|
+
* links) are the server's to enforce and the server's to explain, so this form
|
|
2169
|
+
* checks only that a number is a number and surfaces the server's sentence for
|
|
2170
|
+
* everything else.
|
|
2171
|
+
*/
|
|
2172
|
+
private renderLinkCreateDialog;
|
|
2173
|
+
/**
|
|
2174
|
+
* DECLARE, then create.
|
|
2175
|
+
*
|
|
2176
|
+
* `createAccessLink` used to set the channel's route to `hosted_link` as a
|
|
2177
|
+
* side effect, which is exactly why the picker could never refuse anything.
|
|
2178
|
+
* The server took that side effect away and now REQUIRES the declaration —
|
|
2179
|
+
* and channels default to `none`, so a create that did not declare first
|
|
2180
|
+
* would 409 on the organizer's very first "Create buyer link".
|
|
2181
|
+
*
|
|
2182
|
+
* So the route is declared here, immediately before the create. It stays ONE
|
|
2183
|
+
* gesture: nothing is declared while the organizer is still filling the form
|
|
2184
|
+
* in (cancelling changes nothing), and if the declaration is the part that is
|
|
2185
|
+
* refused, the review sheet holds this form and finishes the job on the far
|
|
2186
|
+
* side of the acknowledgement.
|
|
2187
|
+
*/
|
|
2188
|
+
private createLink;
|
|
2189
|
+
/**
|
|
2190
|
+
* The create half, on its own.
|
|
2191
|
+
*
|
|
2192
|
+
* Separate from `createLink` because the acknowledge path has ALREADY declared
|
|
2193
|
+
* the route — with the very acknowledgement the plain declaration was refused
|
|
2194
|
+
* for. Sending it back through `ensureHostedLinkRoute` would re-derive the
|
|
2195
|
+
* route from a channel list that has not necessarily caught up, and could
|
|
2196
|
+
* refuse the organizer a second time for a decision they just made.
|
|
2197
|
+
*/
|
|
2198
|
+
private mintLink;
|
|
2199
|
+
/**
|
|
2200
|
+
* Make sure the channel declares the buyer-link route before a link is minted.
|
|
2201
|
+
*
|
|
2202
|
+
* Returns false when the create must NOT proceed — either it was refused, or
|
|
2203
|
+
* the decision has been handed to the switch-review sheet, which resumes it.
|
|
2204
|
+
* A channel already on `hosted_link` costs no request at all, so creating a
|
|
2205
|
+
* second link is the same single call it has always been.
|
|
2206
|
+
*/
|
|
2207
|
+
private ensureHostedLinkRoute;
|
|
2208
|
+
/**
|
|
2209
|
+
* The ONE-TIME reveal.
|
|
2210
|
+
*
|
|
2211
|
+
* Three things make this unrecoverable rather than merely "not shown twice":
|
|
2212
|
+
*
|
|
2213
|
+
* 1. `url` is a local const. It is never assigned to a field on this class,
|
|
2214
|
+
* never handed to the host, never put in a `DialogState`.
|
|
2215
|
+
* 2. `this.dialog` is cleared FIRST, so `renderDialog()` — the only function
|
|
2216
|
+
* that rebuilds a sheet — has nothing to rebuild this one from.
|
|
2217
|
+
* 3. The string exists in exactly one DOM node inside the scrim. Dismissing
|
|
2218
|
+
* the dialog removes the scrim, and the closure goes with it.
|
|
2219
|
+
*
|
|
2220
|
+
* The server holds only a hash, so even a compromised client cannot ask for it
|
|
2221
|
+
* again. Rotation is the recovery path, and the copy says so.
|
|
2222
|
+
*/
|
|
2223
|
+
private revealLink;
|
|
2224
|
+
/**
|
|
2225
|
+
* Rotate. The organizer must SAY what happens to the buyers already inside —
|
|
2226
|
+
* the confirm stays disabled until one of the two choices is picked, because
|
|
2227
|
+
* the gentle branch and the destructive branch are both real decisions and the
|
|
2228
|
+
* server refuses (422 `end_active_sessions_required`) to guess either.
|
|
2229
|
+
*/
|
|
2230
|
+
private renderLinkRotateDialog;
|
|
2231
|
+
private rotateLink;
|
|
2232
|
+
private renderLinkRevokeDialog;
|
|
2233
|
+
private revokeLink;
|
|
2234
|
+
private applySheetClasses;
|
|
2235
|
+
private cycleDetent;
|
|
2236
|
+
/** Back/Close from the full detent returns to the previous one and keeps the
|
|
2237
|
+
* selection — losing a hard-won selection to a Back press is unforgivable. */
|
|
2238
|
+
handleBack(): boolean;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
export { type ReportResult as $, type AccessIntentForbidsDetails as A, type BucketRow as B, type ChannelAccessIntent as C, type ChannelsClient as D, ChannelsMode as E, type ChannelsModeHost as F, type ChannelsRowView as G, type ChannelsSeatView as H, type ControlRoomActivityEntry as I, type ControlRoomSectionMetric as J, type ControlRoomSnapshot as K, type EventScopedManageToken as L, type IntentSwitchBlockedDetails as M, type InventoryBooking as N, type InventoryBookingActivity as O, type InventoryBookingDetail as P, type InventoryBookingObject as Q, type InventoryBookingState as R, type InventoryBookingsPage as S, type InventoryBookingsQuery as T, type LogEntry as U, type LogPage as V, ManageApi as W, ManageApiError as X, type ReportByStatus as Y, type ReportCategoryMeta as Z, type ReportCategoryRow as _, type AccessLinkRecord as a, SeatManager as a0, type SeatManagerActionResult as a1, type SeatManagerActivity as a2, type SeatManagerCapability as a3, type SeatManagerConnection as a4, type SeatManagerMode as a5, type SeatManagerOptions as a6, type SeatManagerTallies as a7, type SelectionSourceRow as a8, ACCESS_LINK_DEFAULTS as a9, PUBLIC_CHANNEL_ID as aa, PUBLIC_CHANNEL_NAME as ab, accessIntentDescription as ac, accessIntentLabel as ad, accessLine as ae, accessLinkBadge as af, accessLinkErrorCopy as ag, accessLinkIsLive as ah, accessLinkPolicyLines as ai, bucketRows as aj, dropReviewRows as ak, intentForbidsCopy as al, intentSwitchBlockedCopy as am, isPublicChannelId as an, markerLetter as ao, markerOf as ap, mutationCount as aq, needsMoveConfirmation as ar, planAssignment as as, retryAfterCopy as at, selectionSources as au, stateBadge as av, suggestMarker as aw, type AccessLinkReveal as b, type AccessLinkState as c, type AccessLinkStatus as d, type AccessLinkStatusRecord as e, type ArchiveBlockedDetails as f, type AssignmentBuckets as g, type AssignmentDropDetails as h, type AssignmentResult as i, type ChannelAccessSummary as j, type ChannelAllocationPage as k, type ChannelAttribution as l, type ChannelAuditEntry as m, type ChannelAuditPage as n, type ChannelCounts as o, type ChannelListResult as p, type ChannelPreviewProjection as q, type ChannelRecord as r, type ChannelReport as s, type ChannelReportLinkRecord as t, type ChannelReportLinkReveal as u, type ChannelReportResult as v, type ChannelReportRow as w, type ChannelSeatStatus as x, type ChannelState as y, type ChannelsCapabilities as z };
|