@seatlayer/core 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1169,6 +1169,11 @@ declare class PickerController {
1169
1169
  */
1170
1170
  hold(labelsArg?: string[], ttlMs?: number): Promise<HoldInfo | null>;
1171
1171
  /** Public GA inventory derived from the live synthetic-unit status stream. */
1172
+ /**
1173
+ * Live seats-left per category key (status 'free' right now). Recompute on
1174
+ * onStatusChange — this is what a price panel's "N left" counters read.
1175
+ */
1176
+ categoryAvailability(): Record<string, number>;
1172
1177
  getGAAreas(): {
1173
1178
  id: string;
1174
1179
  label: string;
package/dist/index.d.ts CHANGED
@@ -1169,6 +1169,11 @@ declare class PickerController {
1169
1169
  */
1170
1170
  hold(labelsArg?: string[], ttlMs?: number): Promise<HoldInfo | null>;
1171
1171
  /** Public GA inventory derived from the live synthetic-unit status stream. */
1172
+ /**
1173
+ * Live seats-left per category key (status 'free' right now). Recompute on
1174
+ * onStatusChange — this is what a price panel's "N left" counters read.
1175
+ */
1176
+ categoryAvailability(): Record<string, number>;
1172
1177
  getGAAreas(): {
1173
1178
  id: string;
1174
1179
  label: string;
package/dist/index.js CHANGED
@@ -2817,6 +2817,19 @@ var PickerController = class {
2817
2817
  }
2818
2818
  }
2819
2819
  /** Public GA inventory derived from the live synthetic-unit status stream. */
2820
+ /**
2821
+ * Live seats-left per category key (status 'free' right now). Recompute on
2822
+ * onStatusChange — this is what a price panel's "N left" counters read.
2823
+ */
2824
+ categoryAvailability() {
2825
+ const out = {};
2826
+ for (const [id, s] of this.seatById) {
2827
+ if ((this.getStatus(id) ?? "free") === "free") {
2828
+ out[s.categoryKey] = (out[s.categoryKey] ?? 0) + 1;
2829
+ }
2830
+ }
2831
+ return out;
2832
+ }
2820
2833
  getGAAreas() {
2821
2834
  const doc = this.visibleDoc();
2822
2835
  if (!doc) return [];
@@ -3358,7 +3371,7 @@ var PickerController = class {
3358
3371
  if (!id) continue;
3359
3372
  const next = mapStatus(ch.status);
3360
3373
  if (this.opts.flashOnLiveChange && next !== "free" && r.getStatus(id) === "free" && !this.hold_?.labels.includes(ch.label)) {
3361
- r.flashSeat(id);
3374
+ r.flashSeat(id, next === "held" ? "#f4b740" : "#f43f5e");
3362
3375
  }
3363
3376
  r.setStatus([id], next);
3364
3377
  }