@seatlayer/core 0.16.0 → 0.16.1

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
@@ -362,6 +362,8 @@ type SeatStatus = 'free' | 'held' | 'booked' | 'not_for_sale';
362
362
  interface RendererCallbacks {
363
363
  onSelect?: (seat: ExpandedSeat) => void;
364
364
  onDeselect?: (seat: ExpandedSeat) => void;
365
+ /** Buyer tried to add a seat after the active selection cap was reached. */
366
+ onSelectionLimit?: (maxSelection: number) => void;
365
367
  /** seat is null when the pointer leaves any seat. */
366
368
  onHover?: (seat: ExpandedSeat | null) => void;
367
369
  /** Keyboard focus moved to a seat (arrow-key navigation) — for screen-reader announcements. */
@@ -461,6 +463,13 @@ interface ISeatmapRenderer {
461
463
  getStatus(seatId: string): SeatStatus;
462
464
  getSelection(): ExpandedSeat[];
463
465
  clearSelection(): void;
466
+ /** Update the buyer selection cap without rebuilding the chart or camera. */
467
+ setMaxSelection?(maxSelection: number): void;
468
+ /**
469
+ * Programmatically restore free seats (for example an Undo action). Added
470
+ * seats respect the active cap and do not reopen a confirmation popover.
471
+ */
472
+ select?(seatIds: string[]): ExpandedSeat[];
464
473
  /**
465
474
  * Dynamically update organizer-only interaction without rebuilding the
466
475
  * renderer. No buyer surface calls this; every behavior remains gated by
@@ -913,6 +922,8 @@ declare class SeatmapRenderer implements ISeatmapRenderer {
913
922
  getStatus(seatId: string): SeatStatus;
914
923
  getSelection(): ExpandedSeat[];
915
924
  clearSelection(): void;
925
+ setMaxSelection(maxSelection: number): void;
926
+ select(seatIds: string[]): ExpandedSeat[];
916
927
  /** Switch organizer interaction in place so the host preserves camera, LOD,
917
928
  * focus and live status state while moving between Monitor and Block. */
918
929
  setManageInteraction(options: {
@@ -1462,7 +1473,7 @@ declare class PickerController {
1462
1473
  private readonly opts;
1463
1474
  private readonly api;
1464
1475
  private readonly key;
1465
- private readonly maxSelection;
1476
+ private maxSelection;
1466
1477
  private renderer;
1467
1478
  private _doc;
1468
1479
  /** Section/zone ids hidden from buyers this event (3.3) — seats vanish, not grey. */
@@ -1523,6 +1534,8 @@ declare class PickerController {
1523
1534
  seatDetails(seatId: string): SeatHoverDetails | null;
1524
1535
  clearSelection(): void;
1525
1536
  deselect(ids: string[]): void;
1537
+ setMaxSelection(maxSelection: number): void;
1538
+ select(ids: string[]): PickerSeat[];
1526
1539
  /**
1527
1540
  * Hold the current selection (or a given label set). The controller does the
1528
1541
  * renderer/hold side (409 → deselect + repaint the taken seats held) and then
package/dist/index.d.ts CHANGED
@@ -362,6 +362,8 @@ type SeatStatus = 'free' | 'held' | 'booked' | 'not_for_sale';
362
362
  interface RendererCallbacks {
363
363
  onSelect?: (seat: ExpandedSeat) => void;
364
364
  onDeselect?: (seat: ExpandedSeat) => void;
365
+ /** Buyer tried to add a seat after the active selection cap was reached. */
366
+ onSelectionLimit?: (maxSelection: number) => void;
365
367
  /** seat is null when the pointer leaves any seat. */
366
368
  onHover?: (seat: ExpandedSeat | null) => void;
367
369
  /** Keyboard focus moved to a seat (arrow-key navigation) — for screen-reader announcements. */
@@ -461,6 +463,13 @@ interface ISeatmapRenderer {
461
463
  getStatus(seatId: string): SeatStatus;
462
464
  getSelection(): ExpandedSeat[];
463
465
  clearSelection(): void;
466
+ /** Update the buyer selection cap without rebuilding the chart or camera. */
467
+ setMaxSelection?(maxSelection: number): void;
468
+ /**
469
+ * Programmatically restore free seats (for example an Undo action). Added
470
+ * seats respect the active cap and do not reopen a confirmation popover.
471
+ */
472
+ select?(seatIds: string[]): ExpandedSeat[];
464
473
  /**
465
474
  * Dynamically update organizer-only interaction without rebuilding the
466
475
  * renderer. No buyer surface calls this; every behavior remains gated by
@@ -913,6 +922,8 @@ declare class SeatmapRenderer implements ISeatmapRenderer {
913
922
  getStatus(seatId: string): SeatStatus;
914
923
  getSelection(): ExpandedSeat[];
915
924
  clearSelection(): void;
925
+ setMaxSelection(maxSelection: number): void;
926
+ select(seatIds: string[]): ExpandedSeat[];
916
927
  /** Switch organizer interaction in place so the host preserves camera, LOD,
917
928
  * focus and live status state while moving between Monitor and Block. */
918
929
  setManageInteraction(options: {
@@ -1462,7 +1473,7 @@ declare class PickerController {
1462
1473
  private readonly opts;
1463
1474
  private readonly api;
1464
1475
  private readonly key;
1465
- private readonly maxSelection;
1476
+ private maxSelection;
1466
1477
  private renderer;
1467
1478
  private _doc;
1468
1479
  /** Section/zone ids hidden from buyers this event (3.3) — seats vanish, not grey. */
@@ -1523,6 +1534,8 @@ declare class PickerController {
1523
1534
  seatDetails(seatId: string): SeatHoverDetails | null;
1524
1535
  clearSelection(): void;
1525
1536
  deselect(ids: string[]): void;
1537
+ setMaxSelection(maxSelection: number): void;
1538
+ select(ids: string[]): PickerSeat[];
1526
1539
  /**
1527
1540
  * Hold the current selection (or a given label set). The controller does the
1528
1541
  * renderer/hold side (409 → deselect + repaint the taken seats held) and then
package/dist/index.js CHANGED
@@ -1271,6 +1271,24 @@ var _SeatmapRenderer = class _SeatmapRenderer {
1271
1271
  for (const id of ids) this.setSelected(id, false, true);
1272
1272
  this.overlayLayer.batchDraw();
1273
1273
  }
1274
+ setMaxSelection(maxSelection) {
1275
+ this.opts.maxSelection = Math.max(0, Math.floor(maxSelection));
1276
+ }
1277
+ select(seatIds) {
1278
+ const added = [];
1279
+ for (const id of seatIds) {
1280
+ if (this.selection.has(id) || !this.isSelectable(id)) continue;
1281
+ if (this.selection.size >= this.opts.maxSelection) {
1282
+ this.opts.onSelectionLimit?.(this.opts.maxSelection);
1283
+ break;
1284
+ }
1285
+ this.setSelected(id, true, true);
1286
+ const seat = this.seatById.get(id);
1287
+ if (seat) added.push(seat);
1288
+ }
1289
+ if (added.length) this.overlayLayer.batchDraw();
1290
+ return added;
1291
+ }
1274
1292
  /** Switch organizer interaction in place so the host preserves camera, LOD,
1275
1293
  * focus and live status state while moving between Monitor and Block. */
1276
1294
  setManageInteraction(options) {
@@ -2821,7 +2839,10 @@ var _SeatmapRenderer = class _SeatmapRenderer {
2821
2839
  if (seat) this.opts.onDeselect?.(seat);
2822
2840
  } else {
2823
2841
  if (!this.isSelectable(id)) return;
2824
- if (this.selection.size >= this.opts.maxSelection) return;
2842
+ if (this.selection.size >= this.opts.maxSelection) {
2843
+ this.opts.onSelectionLimit?.(this.opts.maxSelection);
2844
+ return;
2845
+ }
2825
2846
  this.setSelected(id, true);
2826
2847
  const seat = this.seatById.get(id);
2827
2848
  if (seat) this.opts.onSelect?.(seat);
@@ -3588,6 +3609,7 @@ var PickerController = class {
3588
3609
  this.opts.onDeselect?.(seat);
3589
3610
  this.emitSelectionChange();
3590
3611
  },
3612
+ onSelectionLimit: this.opts.onSelectionLimit,
3591
3613
  onHover: (seat) => {
3592
3614
  this.opts.onHover?.(seat);
3593
3615
  if (this.opts.onSeatHover) this.opts.onSeatHover(seat ? this.describeSeat(seat) : null);
@@ -3655,6 +3677,15 @@ var PickerController = class {
3655
3677
  this.renderer?.deselect(ids);
3656
3678
  this.emitSelectionChange();
3657
3679
  }
3680
+ setMaxSelection(maxSelection) {
3681
+ this.maxSelection = Math.max(0, Math.floor(maxSelection));
3682
+ this.renderer?.setMaxSelection?.(this.maxSelection);
3683
+ }
3684
+ select(ids) {
3685
+ const added = this.renderer?.select?.(ids) ?? [];
3686
+ if (added.length) this.emitSelectionChange();
3687
+ return added.map((seat) => this.toSeat(seat));
3688
+ }
3658
3689
  // ---- booking machine ------------------------------------------------------
3659
3690
  /**
3660
3691
  * Hold the current selection (or a given label set). The controller does the