@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.cjs CHANGED
@@ -2294,7 +2294,8 @@ var CSS2 = `
2294
2294
  .slm input{font:inherit}
2295
2295
 
2296
2296
  /* top bar */
2297
- .slm-bar{display:flex;align-items:center;gap:14px;padding:10px 16px;border-bottom:1px solid var(--slm-line);flex:none;flex-wrap:wrap}
2297
+ .slm-bar{display:grid;grid-template-columns:auto auto minmax(0,1fr);align-items:center;column-gap:14px;row-gap:10px;
2298
+ padding:10px 16px;border-bottom:1px solid var(--slm-line);flex:none}
2298
2299
  .slm-modes{display:inline-flex;background:var(--slm-surface);border:1px solid var(--slm-line);border-radius:999px;padding:3px}
2299
2300
  .slm-mode{padding:6px 16px;border-radius:999px;font-weight:700;font-size:13px;color:var(--slm-muted)}
2300
2301
  .slm-mode.on{background:var(--slm-accent);color:var(--slm-accent-ink)}
@@ -2302,9 +2303,11 @@ var CSS2 = `
2302
2303
  .slm-live-dot{width:8px;height:8px;border-radius:50%;background:#8b94ac}
2303
2304
  .slm.live .slm-live-dot{background:#22a06b;box-shadow:0 0 0 0 rgba(34,160,107,.55);animation:slm-pulse 2s infinite}
2304
2305
  @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)}}
2305
- .slm-kpis{display:flex;align-items:center;gap:16px;margin-left:auto;flex-wrap:wrap}
2306
- .slm-kpi{display:flex;flex-direction:column;line-height:1.15}
2307
- .slm-kpi b{font-size:17px;font-weight:800;font-variant-numeric:tabular-nums}
2306
+ .slm-kpis{grid-column:1/-1;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));width:100%;padding-top:10px;
2307
+ border-top:1px solid var(--slm-line)}
2308
+ .slm-kpi{display:flex;min-width:0;flex-direction:column;align-items:center;padding:0 5px;line-height:1.15;text-align:center}
2309
+ .slm-kpi b{display:flex;min-width:0;align-items:baseline;justify-content:center;font-size:17px;font-weight:800;
2310
+ font-variant-numeric:tabular-nums;white-space:nowrap}
2308
2311
  .slm-kpi span{font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--slm-muted);font-weight:700}
2309
2312
  .slm-kpi .dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px;vertical-align:baseline}
2310
2313
  .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}
@@ -2373,7 +2376,7 @@ var CSS2 = `
2373
2376
  .slm-toast.ok{background:#1f7a4d;color:#fff;border-color:#1f7a4d}
2374
2377
 
2375
2378
  /* control-room actions + insights */
2376
- .slm-bar-actions{display:flex;align-items:center;gap:7px}
2379
+ .slm-bar-actions{display:flex;align-items:center;justify-self:end;gap:7px}
2377
2380
  .slm-barbtn.on{background:rgba(244,183,64,.13);border-color:#f4b740;color:#f7ca6b}
2378
2381
  .slm-sectionlist{display:flex;flex-direction:column;gap:8px;margin-top:4px}
2379
2382
  .slm-sectionlist + .slm-eyebrow{margin-top:18px}
@@ -2391,16 +2394,22 @@ var CSS2 = `
2391
2394
  .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}
2392
2395
  .slm-momentumgradient{height:6px;min-width:64px;flex:1;border-radius:999px;background:linear-gradient(90deg,#f4b740,#ef4444)}
2393
2396
  .slm-momentumcopy{margin-top:7px;color:var(--slm-muted);font-size:11px;line-height:1.45}
2394
- .slm-inspect-card{padding:12px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface)}
2395
- .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}
2396
- .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}
2397
+ .slm-inspect-card{padding:16px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface)}
2398
+ .slm-inspect-label{font-size:24px;font-weight:850;letter-spacing:-.02em;line-height:1.1}
2399
+ .slm-inspect-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;margin-top:18px}
2400
+ .slm-inspect-grid>div{min-width:0}.slm-inspect-grid span{display:block;color:var(--slm-muted);font-size:10px;
2401
+ 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}
2397
2402
  .slm:fullscreen{border-radius:0;min-height:100vh;background:var(--slm-bg)}
2398
2403
  .slm:fullscreen .slm-bar{padding:14px 22px}.slm:fullscreen .slm-kpi b{font-size:21px}.slm:fullscreen .slm-rail{width:360px}
2399
2404
 
2400
2405
  .slm.compact .slm-rail{width:100%;border-left:0;border-top:1px solid var(--slm-line);height:44%}
2401
2406
  .slm.compact .slm-body{flex-direction:column}
2402
- .slm.compact .slm-bar{gap:8px;padding:8px}.slm.compact .slm-barbtn{padding:6px 9px}
2403
- .slm.compact .slm-kpis{gap:9px}.slm.compact .slm-kpi:nth-child(n+5){display:none}
2407
+ .slm.compact .slm-bar{grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:8px}
2408
+ .slm.compact .slm-modes{min-width:0}.slm.compact .slm-mode{padding-inline:11px}
2409
+ .slm.compact .slm-live{justify-self:end}.slm.compact .slm-bar-actions{grid-column:1/-1;justify-self:stretch}
2410
+ .slm.compact .slm-barbtn{flex:1;padding:6px 9px}.slm.compact .slm-kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
2411
+ .slm.compact .slm-kpi[data-kpi="buyers"],.slm.compact .slm-kpi[data-kpi="active-holds"],
2412
+ .slm.compact .slm-kpi[data-kpi="sold-pct"],.slm.compact .slm-kpi[data-kpi="gross-sales"]{display:none}
2404
2413
  `;
2405
2414
  function injectStyle() {
2406
2415
  if (typeof document === "undefined" || document.getElementById(STYLE_ID2)) return;
@@ -2519,11 +2528,12 @@ var SeatManager = class {
2519
2528
  }
2520
2529
  this.buildRenderer();
2521
2530
  this.buildSectionOptions();
2522
- await Promise.all([
2531
+ const [, controlRoom] = await Promise.all([
2523
2532
  this.resnapshot(),
2524
2533
  this.refreshControlRoom().catch((err) => this.opts.onError?.(err))
2525
2534
  ]);
2526
- this.api.log(this.key, { limit: 24 }).then((page) => this.seedFeed(page.entries)).catch(() => {
2535
+ if (controlRoom?.activity) this.seedFeed(controlRoom.activity);
2536
+ else this.api.log(this.key, { limit: 24 }).then((page) => this.seedFeed(page.entries)).catch(() => {
2527
2537
  });
2528
2538
  this.connect();
2529
2539
  this.startFeedClock();
@@ -3029,7 +3039,8 @@ var SeatManager = class {
3029
3039
  release: "released",
3030
3040
  expire: "expired",
3031
3041
  block: "blocked",
3032
- unblock: "unblocked"
3042
+ unblock: "unblocked",
3043
+ unbook: "cancelled"
3033
3044
  };
3034
3045
  const stByAction = {
3035
3046
  hold: "held",
@@ -3037,7 +3048,8 @@ var SeatManager = class {
3037
3048
  release: "free",
3038
3049
  expire: "free",
3039
3050
  block: "blocked",
3040
- unblock: "free"
3051
+ unblock: "free",
3052
+ unbook: "free"
3041
3053
  };
3042
3054
  for (const e of entries) {
3043
3055
  const label = e.labels[0];
@@ -3215,15 +3227,15 @@ var SeatManager = class {
3215
3227
  const rev = t3.revenueStatus === "current" ? fmtMoney(t3.grossRevenue, t3.currency) : "\u2014";
3216
3228
  const presence = this.controlRoomSnapshot?.presence;
3217
3229
  this.els.kpis.innerHTML = [
3218
- { n: t3.booked.toLocaleString(), l: "Sold", dot: "#22a06b" },
3219
- { n: t3.held.toLocaleString(), l: "Held", dot: "#f4b740" },
3220
- { n: presence ? presence.shoppingSessions.toLocaleString() : "\u2014", l: "Shopping" },
3221
- { n: presence ? presence.activeHolds.toLocaleString() : "\u2014", l: "Live holds" },
3222
- { n: t3.free.toLocaleString(), l: "Free", dot: "#6e7bff" },
3223
- { n: t3.blocked.toLocaleString(), l: "Blocked", dot: "#8b94ac" },
3224
- { n: `${t3.capacityPct}%`, l: "Capacity" },
3225
- { n: rev, l: "Gross" }
3226
- ].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("");
3230
+ { key: "sold-seats", n: t3.booked.toLocaleString(), l: "Sold seats", dot: "#22a06b" },
3231
+ { key: "held-seats", n: t3.held.toLocaleString(), l: "Held seats", dot: "#f4b740" },
3232
+ { key: "buyers", n: presence ? presence.shoppingSessions.toLocaleString() : "\u2014", l: "Buyers" },
3233
+ { key: "active-holds", n: presence ? presence.activeHolds.toLocaleString() : "\u2014", l: "Active holds" },
3234
+ { key: "free-seats", n: t3.free.toLocaleString(), l: "Free seats", dot: "#6e7bff" },
3235
+ { key: "blocked", n: t3.blocked.toLocaleString(), l: "Blocked", dot: "#8b94ac" },
3236
+ { key: "sold-pct", n: `${t3.capacityPct}%`, l: "Sold" },
3237
+ { key: "gross-sales", n: rev, l: "Gross sales" }
3238
+ ].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("");
3227
3239
  }
3228
3240
  // ---- DOM: rails -----------------------------------------------------------
3229
3241
  paintRail() {
@@ -3322,9 +3334,9 @@ var SeatManager = class {
3322
3334
  const seat = seats[seats.length - 1];
3323
3335
  if (!seat) {
3324
3336
  this.els.rail.innerHTML = `
3325
- <p class="slm-eyebrow">Inspect</p>
3326
- <p class="slm-hint">Select any seat to see its live inventory context. Inspect is read-only and never changes availability.</p>
3327
- <div class="slm-empty">Choose a seat on the map.</div>`;
3337
+ <p class="slm-eyebrow">Inspect seats</p>
3338
+ <p class="slm-hint">Select a seat to see its availability and sales context. Nothing changes in this view.</p>
3339
+ <div class="slm-empty">Select a seat on the map.</div>`;
3328
3340
  return;
3329
3341
  }
3330
3342
  const status = this.status.get(seat.label) ?? "free";
@@ -3333,17 +3345,20 @@ var SeatManager = class {
3333
3345
  const sectionLabel = this.sectionLabelById.get(sectionId) ?? "Other seats";
3334
3346
  const category = this.doc?.categories.find((item) => item.key === seat.categoryKey);
3335
3347
  const sectionMetric = this.controlRoomSnapshot?.revenue.bySection.find((row) => row.sectionId === sectionId);
3348
+ const object = this.doc?.objects.find((item) => item.id === seat.rowId);
3349
+ 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;
3350
+ const itemKind = seat.kind === "booth" ? "Booth" : "Seat";
3336
3351
  this.els.rail.innerHTML = `
3337
- <p class="slm-eyebrow">Inspect</p>
3338
- <p class="slm-hint">Live inventory context. Booked seats remain read-only; order and payment actions belong to the host commerce system.</p>
3352
+ <p class="slm-eyebrow">${itemKind} details</p>
3353
+ <p class="slm-hint">Live availability and section performance.</p>
3339
3354
  <div class="slm-inspect-card">
3340
3355
  <div class="slm-inspect-label">${esc(seat.label)}</div>
3341
3356
  <div class="slm-inspect-grid">
3342
3357
  <div><span>Status</span><b>${statusLabel[status]}</b></div>
3343
3358
  <div><span>Section</span><b>${esc(sectionLabel)}</b></div>
3344
- <div><span>Row</span><b>${esc(seat.rowId)}</b></div>
3359
+ ${location ? `<div><span>${location.label}</span><b>${esc(location.value)}</b></div>` : ""}
3345
3360
  <div><span>Category</span><b>${esc(category?.label ?? seat.categoryKey)}</b></div>
3346
- <div><span>Section sold</span><b>${sectionMetric ? `${sectionMetric.booked}/${sectionMetric.total}` : "\u2014"}</b></div>
3361
+ <div><span>Sold in section</span><b>${sectionMetric ? `${sectionMetric.booked} of ${sectionMetric.total}` : "\u2014"}</b></div>
3347
3362
  <div><span>Section revenue</span><b>${sectionMetric && this.controlRoomSnapshot ? fmtMoney(sectionMetric.bookedRevenue, this.controlRoomSnapshot.currency) : "\u2014"}</b></div>
3348
3363
  </div>
3349
3364
  </div>`;