@seatlayer/js 0.12.1 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -656,6 +656,14 @@ interface ControlRoomSectionMetric {
656
656
  not_for_sale: number;
657
657
  bookedRevenue: number;
658
658
  }
659
+ /** Recent seat-state change safe for an event:view control-room grant. Full
660
+ * audit references remain available only through the event:reports log API. */
661
+ interface ControlRoomActivityEntry {
662
+ id: number;
663
+ at: number;
664
+ action: string;
665
+ labels: string[];
666
+ }
659
667
  interface ControlRoomSnapshot {
660
668
  version: number;
661
669
  currency: string;
@@ -683,6 +691,8 @@ interface ControlRoomSnapshot {
683
691
  shoppingSessions: number;
684
692
  activeHolds: number;
685
693
  };
694
+ /** Present on workers that support reload-safe activity hydration. */
695
+ activity?: ControlRoomActivityEntry[];
686
696
  event: {
687
697
  key: string;
688
698
  name: string;
@@ -1022,4 +1032,4 @@ declare class SeatManager {
1022
1032
  private fail;
1023
1033
  }
1024
1034
 
1025
- export { ApiError, type BestAvailableResult, type CheckoutHandoff, type CheckoutLineItem, type ControlRoomSectionMetric, type ControlRoomSnapshot, EmbeddedDesigner, type EmbeddedDesignerEventType, type EmbeddedDesignerMessage, type EmbeddedDesignerOptions, type GAAreaAvailability, type HoldConflict, type HoldLineItem, type HoldResult, type LogEntry, type LogPage, ManageApi, ManageApiError, type ReportByStatus, type ReportCategoryMeta, type ReportCategoryRow, type ReportResult, SeatManager, type SeatManagerActionResult, type SeatManagerActivity, type SeatManagerMode, type SeatManagerOptions, type SeatManagerTallies, SeatPicker, type SeatPickerOptions, type SeatPickerTheme, SeatingChart, type SeatingChartOptions, type SelectedSeat };
1035
+ export { ApiError, type BestAvailableResult, type CheckoutHandoff, type CheckoutLineItem, type ControlRoomActivityEntry, type ControlRoomSectionMetric, type ControlRoomSnapshot, EmbeddedDesigner, type EmbeddedDesignerEventType, type EmbeddedDesignerMessage, type EmbeddedDesignerOptions, type GAAreaAvailability, type HoldConflict, type HoldLineItem, type HoldResult, type LogEntry, type LogPage, ManageApi, ManageApiError, type ReportByStatus, type ReportCategoryMeta, type ReportCategoryRow, type ReportResult, SeatManager, type SeatManagerActionResult, type SeatManagerActivity, type SeatManagerMode, type SeatManagerOptions, type SeatManagerTallies, SeatPicker, type SeatPickerOptions, type SeatPickerTheme, SeatingChart, type SeatingChartOptions, type SelectedSeat };
package/dist/index.d.ts CHANGED
@@ -656,6 +656,14 @@ interface ControlRoomSectionMetric {
656
656
  not_for_sale: number;
657
657
  bookedRevenue: number;
658
658
  }
659
+ /** Recent seat-state change safe for an event:view control-room grant. Full
660
+ * audit references remain available only through the event:reports log API. */
661
+ interface ControlRoomActivityEntry {
662
+ id: number;
663
+ at: number;
664
+ action: string;
665
+ labels: string[];
666
+ }
659
667
  interface ControlRoomSnapshot {
660
668
  version: number;
661
669
  currency: string;
@@ -683,6 +691,8 @@ interface ControlRoomSnapshot {
683
691
  shoppingSessions: number;
684
692
  activeHolds: number;
685
693
  };
694
+ /** Present on workers that support reload-safe activity hydration. */
695
+ activity?: ControlRoomActivityEntry[];
686
696
  event: {
687
697
  key: string;
688
698
  name: string;
@@ -1022,4 +1032,4 @@ declare class SeatManager {
1022
1032
  private fail;
1023
1033
  }
1024
1034
 
1025
- export { ApiError, type BestAvailableResult, type CheckoutHandoff, type CheckoutLineItem, type ControlRoomSectionMetric, type ControlRoomSnapshot, EmbeddedDesigner, type EmbeddedDesignerEventType, type EmbeddedDesignerMessage, type EmbeddedDesignerOptions, type GAAreaAvailability, type HoldConflict, type HoldLineItem, type HoldResult, type LogEntry, type LogPage, ManageApi, ManageApiError, type ReportByStatus, type ReportCategoryMeta, type ReportCategoryRow, type ReportResult, SeatManager, type SeatManagerActionResult, type SeatManagerActivity, type SeatManagerMode, type SeatManagerOptions, type SeatManagerTallies, SeatPicker, type SeatPickerOptions, type SeatPickerTheme, SeatingChart, type SeatingChartOptions, type SelectedSeat };
1035
+ export { ApiError, type BestAvailableResult, type CheckoutHandoff, type CheckoutLineItem, type ControlRoomActivityEntry, type ControlRoomSectionMetric, type ControlRoomSnapshot, EmbeddedDesigner, type EmbeddedDesignerEventType, type EmbeddedDesignerMessage, type EmbeddedDesignerOptions, type GAAreaAvailability, type HoldConflict, type HoldLineItem, type HoldResult, type LogEntry, type LogPage, ManageApi, ManageApiError, type ReportByStatus, type ReportCategoryMeta, type ReportCategoryRow, type ReportResult, SeatManager, type SeatManagerActionResult, type SeatManagerActivity, type SeatManagerMode, type SeatManagerOptions, type SeatManagerTallies, SeatPicker, type SeatPickerOptions, type SeatPickerTheme, SeatingChart, type SeatingChartOptions, type SelectedSeat };
package/dist/index.js CHANGED
@@ -2275,7 +2275,8 @@ var CSS2 = `
2275
2275
  .slm input{font:inherit}
2276
2276
 
2277
2277
  /* top bar */
2278
- .slm-bar{display:flex;align-items:center;gap:14px;padding:10px 16px;border-bottom:1px solid var(--slm-line);flex:none;flex-wrap:wrap}
2278
+ .slm-bar{display:grid;grid-template-columns:auto auto minmax(0,1fr);align-items:center;column-gap:14px;row-gap:10px;
2279
+ padding:10px 16px;border-bottom:1px solid var(--slm-line);flex:none}
2279
2280
  .slm-modes{display:inline-flex;background:var(--slm-surface);border:1px solid var(--slm-line);border-radius:999px;padding:3px}
2280
2281
  .slm-mode{padding:6px 16px;border-radius:999px;font-weight:700;font-size:13px;color:var(--slm-muted)}
2281
2282
  .slm-mode.on{background:var(--slm-accent);color:var(--slm-accent-ink)}
@@ -2283,9 +2284,11 @@ var CSS2 = `
2283
2284
  .slm-live-dot{width:8px;height:8px;border-radius:50%;background:#8b94ac}
2284
2285
  .slm.live .slm-live-dot{background:#22a06b;box-shadow:0 0 0 0 rgba(34,160,107,.55);animation:slm-pulse 2s infinite}
2285
2286
  @keyframes slm-pulse{0%{box-shadow:0 0 0 0 rgba(34,160,107,.5)}70%{box-shadow:0 0 0 7px rgba(34,160,107,0)}100%{box-shadow:0 0 0 0 rgba(34,160,107,0)}}
2286
- .slm-kpis{display:flex;align-items:center;gap:16px;margin-left:auto;flex-wrap:wrap}
2287
- .slm-kpi{display:flex;flex-direction:column;line-height:1.15}
2288
- .slm-kpi b{font-size:17px;font-weight:800;font-variant-numeric:tabular-nums}
2287
+ .slm-kpis{grid-column:1/-1;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));width:100%;padding-top:10px;
2288
+ border-top:1px solid var(--slm-line)}
2289
+ .slm-kpi{display:flex;min-width:0;flex-direction:column;align-items:center;padding:0 5px;line-height:1.15;text-align:center}
2290
+ .slm-kpi b{display:flex;min-width:0;align-items:baseline;justify-content:center;font-size:17px;font-weight:800;
2291
+ font-variant-numeric:tabular-nums;white-space:nowrap}
2289
2292
  .slm-kpi span{font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--slm-muted);font-weight:700}
2290
2293
  .slm-kpi .dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px;vertical-align:baseline}
2291
2294
  .slm-barbtn{padding:7px 13px;border-radius:9px;border:1px solid var(--slm-line);color:var(--slm-text);font-weight:700;font-size:12.5px}
@@ -2354,7 +2357,7 @@ var CSS2 = `
2354
2357
  .slm-toast.ok{background:#1f7a4d;color:#fff;border-color:#1f7a4d}
2355
2358
 
2356
2359
  /* control-room actions + insights */
2357
- .slm-bar-actions{display:flex;align-items:center;gap:7px}
2360
+ .slm-bar-actions{display:flex;align-items:center;justify-self:end;gap:7px}
2358
2361
  .slm-barbtn.on{background:rgba(244,183,64,.13);border-color:#f4b740;color:#f7ca6b}
2359
2362
  .slm-sectionlist{display:flex;flex-direction:column;gap:8px;margin-top:4px}
2360
2363
  .slm-sectionlist + .slm-eyebrow{margin-top:18px}
@@ -2372,16 +2375,22 @@ var CSS2 = `
2372
2375
  .slm-momentumhelp[hidden]{display:none}.slm-momentumscale{display:flex;align-items:center;gap:7px;color:var(--slm-muted);font-size:10px;font-weight:750;text-transform:uppercase;letter-spacing:.07em}
2373
2376
  .slm-momentumgradient{height:6px;min-width:64px;flex:1;border-radius:999px;background:linear-gradient(90deg,#f4b740,#ef4444)}
2374
2377
  .slm-momentumcopy{margin-top:7px;color:var(--slm-muted);font-size:11px;line-height:1.45}
2375
- .slm-inspect-card{padding:12px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface)}
2376
- .slm-inspect-label{font-size:24px;font-weight:850;letter-spacing:-.02em}.slm-inspect-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
2377
- .slm-inspect-grid span{display:block;color:var(--slm-muted);font-size:10px;text-transform:uppercase;letter-spacing:.08em}.slm-inspect-grid b{display:block;margin-top:3px;font-size:12.5px}
2378
+ .slm-inspect-card{padding:16px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface)}
2379
+ .slm-inspect-label{font-size:24px;font-weight:850;letter-spacing:-.02em;line-height:1.1}
2380
+ .slm-inspect-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;margin-top:18px}
2381
+ .slm-inspect-grid>div{min-width:0}.slm-inspect-grid span{display:block;color:var(--slm-muted);font-size:10px;
2382
+ text-transform:uppercase;letter-spacing:.08em}.slm-inspect-grid b{display:block;margin-top:4px;font-size:13px;line-height:1.35;overflow-wrap:anywhere}
2378
2383
  .slm:fullscreen{border-radius:0;min-height:100vh;background:var(--slm-bg)}
2379
2384
  .slm:fullscreen .slm-bar{padding:14px 22px}.slm:fullscreen .slm-kpi b{font-size:21px}.slm:fullscreen .slm-rail{width:360px}
2380
2385
 
2381
2386
  .slm.compact .slm-rail{width:100%;border-left:0;border-top:1px solid var(--slm-line);height:44%}
2382
2387
  .slm.compact .slm-body{flex-direction:column}
2383
- .slm.compact .slm-bar{gap:8px;padding:8px}.slm.compact .slm-barbtn{padding:6px 9px}
2384
- .slm.compact .slm-kpis{gap:9px}.slm.compact .slm-kpi:nth-child(n+5){display:none}
2388
+ .slm.compact .slm-bar{grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:8px}
2389
+ .slm.compact .slm-modes{min-width:0}.slm.compact .slm-mode{padding-inline:11px}
2390
+ .slm.compact .slm-live{justify-self:end}.slm.compact .slm-bar-actions{grid-column:1/-1;justify-self:stretch}
2391
+ .slm.compact .slm-barbtn{flex:1;padding:6px 9px}.slm.compact .slm-kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
2392
+ .slm.compact .slm-kpi[data-kpi="buyers"],.slm.compact .slm-kpi[data-kpi="active-holds"],
2393
+ .slm.compact .slm-kpi[data-kpi="sold-pct"],.slm.compact .slm-kpi[data-kpi="gross-sales"]{display:none}
2385
2394
  `;
2386
2395
  function injectStyle() {
2387
2396
  if (typeof document === "undefined" || document.getElementById(STYLE_ID2)) return;
@@ -2500,11 +2509,12 @@ var SeatManager = class {
2500
2509
  }
2501
2510
  this.buildRenderer();
2502
2511
  this.buildSectionOptions();
2503
- await Promise.all([
2512
+ const [, controlRoom] = await Promise.all([
2504
2513
  this.resnapshot(),
2505
2514
  this.refreshControlRoom().catch((err) => this.opts.onError?.(err))
2506
2515
  ]);
2507
- this.api.log(this.key, { limit: 24 }).then((page) => this.seedFeed(page.entries)).catch(() => {
2516
+ if (controlRoom?.activity) this.seedFeed(controlRoom.activity);
2517
+ else this.api.log(this.key, { limit: 24 }).then((page) => this.seedFeed(page.entries)).catch(() => {
2508
2518
  });
2509
2519
  this.connect();
2510
2520
  this.startFeedClock();
@@ -3010,7 +3020,8 @@ var SeatManager = class {
3010
3020
  release: "released",
3011
3021
  expire: "expired",
3012
3022
  block: "blocked",
3013
- unblock: "unblocked"
3023
+ unblock: "unblocked",
3024
+ unbook: "cancelled"
3014
3025
  };
3015
3026
  const stByAction = {
3016
3027
  hold: "held",
@@ -3018,7 +3029,8 @@ var SeatManager = class {
3018
3029
  release: "free",
3019
3030
  expire: "free",
3020
3031
  block: "blocked",
3021
- unblock: "free"
3032
+ unblock: "free",
3033
+ unbook: "free"
3022
3034
  };
3023
3035
  for (const e of entries) {
3024
3036
  const label = e.labels[0];
@@ -3196,15 +3208,15 @@ var SeatManager = class {
3196
3208
  const rev = t3.revenueStatus === "current" ? fmtMoney(t3.grossRevenue, t3.currency) : "\u2014";
3197
3209
  const presence = this.controlRoomSnapshot?.presence;
3198
3210
  this.els.kpis.innerHTML = [
3199
- { n: t3.booked.toLocaleString(), l: "Sold", dot: "#22a06b" },
3200
- { n: t3.held.toLocaleString(), l: "Held", dot: "#f4b740" },
3201
- { n: presence ? presence.shoppingSessions.toLocaleString() : "\u2014", l: "Shopping" },
3202
- { n: presence ? presence.activeHolds.toLocaleString() : "\u2014", l: "Live holds" },
3203
- { n: t3.free.toLocaleString(), l: "Free", dot: "#6e7bff" },
3204
- { n: t3.blocked.toLocaleString(), l: "Blocked", dot: "#8b94ac" },
3205
- { n: `${t3.capacityPct}%`, l: "Capacity" },
3206
- { n: rev, l: "Gross" }
3207
- ].map((k) => `<div class="slm-kpi"><b>${k.dot ? `<span class="dot" style="background:${k.dot}"></span>` : ""}${k.n}</b><span>${k.l}</span></div>`).join("");
3211
+ { key: "sold-seats", n: t3.booked.toLocaleString(), l: "Sold seats", dot: "#22a06b" },
3212
+ { key: "held-seats", n: t3.held.toLocaleString(), l: "Held seats", dot: "#f4b740" },
3213
+ { key: "buyers", n: presence ? presence.shoppingSessions.toLocaleString() : "\u2014", l: "Buyers" },
3214
+ { key: "active-holds", n: presence ? presence.activeHolds.toLocaleString() : "\u2014", l: "Active holds" },
3215
+ { key: "free-seats", n: t3.free.toLocaleString(), l: "Free seats", dot: "#6e7bff" },
3216
+ { key: "blocked", n: t3.blocked.toLocaleString(), l: "Blocked", dot: "#8b94ac" },
3217
+ { key: "sold-pct", n: `${t3.capacityPct}%`, l: "Sold" },
3218
+ { key: "gross-sales", n: rev, l: "Gross sales" }
3219
+ ].map((k) => `<div class="slm-kpi" data-kpi="${k.key}"><b>${k.dot ? `<span class="dot" style="background:${k.dot}"></span>` : ""}${k.n}</b><span>${k.l}</span></div>`).join("");
3208
3220
  }
3209
3221
  // ---- DOM: rails -----------------------------------------------------------
3210
3222
  paintRail() {
@@ -3303,9 +3315,9 @@ var SeatManager = class {
3303
3315
  const seat = seats[seats.length - 1];
3304
3316
  if (!seat) {
3305
3317
  this.els.rail.innerHTML = `
3306
- <p class="slm-eyebrow">Inspect</p>
3307
- <p class="slm-hint">Select any seat to see its live inventory context. Inspect is read-only and never changes availability.</p>
3308
- <div class="slm-empty">Choose a seat on the map.</div>`;
3318
+ <p class="slm-eyebrow">Inspect seats</p>
3319
+ <p class="slm-hint">Select a seat to see its availability and sales context. Nothing changes in this view.</p>
3320
+ <div class="slm-empty">Select a seat on the map.</div>`;
3309
3321
  return;
3310
3322
  }
3311
3323
  const status = this.status.get(seat.label) ?? "free";
@@ -3314,17 +3326,20 @@ var SeatManager = class {
3314
3326
  const sectionLabel = this.sectionLabelById.get(sectionId) ?? "Other seats";
3315
3327
  const category = this.doc?.categories.find((item) => item.key === seat.categoryKey);
3316
3328
  const sectionMetric = this.controlRoomSnapshot?.revenue.bySection.find((row) => row.sectionId === sectionId);
3329
+ const object = this.doc?.objects.find((item) => item.id === seat.rowId);
3330
+ const location = object?.type === "row" ? { label: "Row", value: object.label } : object?.type === "table" ? { label: "Table", value: object.label } : seat.kind === "booth" ? { label: "Type", value: "Booth" } : null;
3331
+ const itemKind = seat.kind === "booth" ? "Booth" : "Seat";
3317
3332
  this.els.rail.innerHTML = `
3318
- <p class="slm-eyebrow">Inspect</p>
3319
- <p class="slm-hint">Live inventory context. Booked seats remain read-only; order and payment actions belong to the host commerce system.</p>
3333
+ <p class="slm-eyebrow">${itemKind} details</p>
3334
+ <p class="slm-hint">Live availability and section performance.</p>
3320
3335
  <div class="slm-inspect-card">
3321
3336
  <div class="slm-inspect-label">${esc(seat.label)}</div>
3322
3337
  <div class="slm-inspect-grid">
3323
3338
  <div><span>Status</span><b>${statusLabel[status]}</b></div>
3324
3339
  <div><span>Section</span><b>${esc(sectionLabel)}</b></div>
3325
- <div><span>Row</span><b>${esc(seat.rowId)}</b></div>
3340
+ ${location ? `<div><span>${location.label}</span><b>${esc(location.value)}</b></div>` : ""}
3326
3341
  <div><span>Category</span><b>${esc(category?.label ?? seat.categoryKey)}</b></div>
3327
- <div><span>Section sold</span><b>${sectionMetric ? `${sectionMetric.booked}/${sectionMetric.total}` : "\u2014"}</b></div>
3342
+ <div><span>Sold in section</span><b>${sectionMetric ? `${sectionMetric.booked} of ${sectionMetric.total}` : "\u2014"}</b></div>
3328
3343
  <div><span>Section revenue</span><b>${sectionMetric && this.controlRoomSnapshot ? fmtMoney(sectionMetric.bookedRevenue, this.controlRoomSnapshot.currency) : "\u2014"}</b></div>
3329
3344
  </div>
3330
3345
  </div>`;