@seatlayer/core 0.28.3 → 0.28.4

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
@@ -2749,7 +2749,7 @@ interface PickerTransport {
2749
2749
  closed?: string[];
2750
2750
  }>;
2751
2751
  hold(key: string, selections: HoldSelectionRequest[], ttlMs?: number, replaceHoldId?: string): Promise<HoldResponse>;
2752
- bestAvailable(key: string, qty: number, categoryKey?: string, zoneId?: string): Promise<BestAvailableResponse>;
2752
+ bestAvailable(key: string, qty: number, categoryKey?: string, zoneId?: string, ttlMs?: number): Promise<BestAvailableResponse>;
2753
2753
  release(key: string, labels: string[], holdId: string): Promise<unknown>;
2754
2754
  /** Optional capability-style lookup used to restore an active browser hold. */
2755
2755
  resume?(key: string, holdId: string): Promise<ResumeHoldResponse>;
@@ -2923,8 +2923,12 @@ declare class PickerController {
2923
2923
  select(ids: string[]): PickerSeat[];
2924
2924
  /** Confirm/update the guest quantity for a selected variable table. */
2925
2925
  setTableQuantity(label: string, quantity: number): boolean;
2926
- /** Atomically replace an active variable-table hold with a new guest count. */
2927
- replaceTableQuantity(label: string, quantity: number): Promise<HoldInfo | null>;
2926
+ /**
2927
+ * Atomically replace an active variable-table hold with a new guest count.
2928
+ * `ttlMs` keeps the host's checkout window across the replacement — without it
2929
+ * a guest-count change silently re-based the countdown on the server default.
2930
+ */
2931
+ replaceTableQuantity(label: string, quantity: number, ttlMs?: number): Promise<HoldInfo | null>;
2928
2932
  private rendererSelectionCap;
2929
2933
  private selectionGuestCount;
2930
2934
  private handleRendererSelect;
@@ -2987,10 +2991,15 @@ declare class PickerController {
2987
2991
  * failure. With `preferPremium`, first tries to hold the best PREMIUM block
2988
2992
  * locally; when none matches the requested quantity it falls back to the
2989
2993
  * normal server pick (the widget surfaces a subtle note on that fallback).
2994
+ *
2995
+ * `ttlMs` is the host's checkout window and MUST reach both branches: a hold
2996
+ * born here is the same buyer commitment as one made by clicking seats, so
2997
+ * omitting it silently handed the buyer the server default instead.
2990
2998
  */
2991
2999
  bestAvailable(qty: number, categoryKey?: string, opts?: {
2992
3000
  preferPremium?: boolean;
2993
3001
  zoneId?: string;
3002
+ ttlMs?: number;
2994
3003
  }): Promise<HoldInfo | null>;
2995
3004
  /**
2996
3005
  * Complete a booking. Requires a transport that supports book() (the SDK
@@ -2999,8 +3008,10 @@ declare class PickerController {
2999
3008
  * cart can hold best-available seats that aren't in the renderer selection);
3000
3009
  * defaults to the renderer selection. Reuses an existing exact-match hold, else
3001
3010
  * holds first. Returns the labels booked, or null on failure (conflicts painted).
3011
+ * `ttlMs` only matters on the hold-first path: if the book call then fails, the
3012
+ * seats sit held for the host's window rather than the longer server default.
3002
3013
  */
3003
- book(bookingRef: string, labelsArg?: string[]): Promise<string[] | null>;
3014
+ book(bookingRef: string, labelsArg?: string[], ttlMs?: number): Promise<string[] | null>;
3004
3015
  /** Release the whole open hold (if any), repaint those seats free. */
3005
3016
  release(): Promise<boolean>;
3006
3017
  /**
package/dist/index.d.ts CHANGED
@@ -2749,7 +2749,7 @@ interface PickerTransport {
2749
2749
  closed?: string[];
2750
2750
  }>;
2751
2751
  hold(key: string, selections: HoldSelectionRequest[], ttlMs?: number, replaceHoldId?: string): Promise<HoldResponse>;
2752
- bestAvailable(key: string, qty: number, categoryKey?: string, zoneId?: string): Promise<BestAvailableResponse>;
2752
+ bestAvailable(key: string, qty: number, categoryKey?: string, zoneId?: string, ttlMs?: number): Promise<BestAvailableResponse>;
2753
2753
  release(key: string, labels: string[], holdId: string): Promise<unknown>;
2754
2754
  /** Optional capability-style lookup used to restore an active browser hold. */
2755
2755
  resume?(key: string, holdId: string): Promise<ResumeHoldResponse>;
@@ -2923,8 +2923,12 @@ declare class PickerController {
2923
2923
  select(ids: string[]): PickerSeat[];
2924
2924
  /** Confirm/update the guest quantity for a selected variable table. */
2925
2925
  setTableQuantity(label: string, quantity: number): boolean;
2926
- /** Atomically replace an active variable-table hold with a new guest count. */
2927
- replaceTableQuantity(label: string, quantity: number): Promise<HoldInfo | null>;
2926
+ /**
2927
+ * Atomically replace an active variable-table hold with a new guest count.
2928
+ * `ttlMs` keeps the host's checkout window across the replacement — without it
2929
+ * a guest-count change silently re-based the countdown on the server default.
2930
+ */
2931
+ replaceTableQuantity(label: string, quantity: number, ttlMs?: number): Promise<HoldInfo | null>;
2928
2932
  private rendererSelectionCap;
2929
2933
  private selectionGuestCount;
2930
2934
  private handleRendererSelect;
@@ -2987,10 +2991,15 @@ declare class PickerController {
2987
2991
  * failure. With `preferPremium`, first tries to hold the best PREMIUM block
2988
2992
  * locally; when none matches the requested quantity it falls back to the
2989
2993
  * normal server pick (the widget surfaces a subtle note on that fallback).
2994
+ *
2995
+ * `ttlMs` is the host's checkout window and MUST reach both branches: a hold
2996
+ * born here is the same buyer commitment as one made by clicking seats, so
2997
+ * omitting it silently handed the buyer the server default instead.
2990
2998
  */
2991
2999
  bestAvailable(qty: number, categoryKey?: string, opts?: {
2992
3000
  preferPremium?: boolean;
2993
3001
  zoneId?: string;
3002
+ ttlMs?: number;
2994
3003
  }): Promise<HoldInfo | null>;
2995
3004
  /**
2996
3005
  * Complete a booking. Requires a transport that supports book() (the SDK
@@ -2999,8 +3008,10 @@ declare class PickerController {
2999
3008
  * cart can hold best-available seats that aren't in the renderer selection);
3000
3009
  * defaults to the renderer selection. Reuses an existing exact-match hold, else
3001
3010
  * holds first. Returns the labels booked, or null on failure (conflicts painted).
3011
+ * `ttlMs` only matters on the hold-first path: if the book call then fails, the
3012
+ * seats sit held for the host's window rather than the longer server default.
3002
3013
  */
3003
- book(bookingRef: string, labelsArg?: string[]): Promise<string[] | null>;
3014
+ book(bookingRef: string, labelsArg?: string[], ttlMs?: number): Promise<string[] | null>;
3004
3015
  /** Release the whole open hold (if any), repaint those seats free. */
3005
3016
  release(): Promise<boolean>;
3006
3017
  /**
package/dist/index.js CHANGED
@@ -7406,8 +7406,12 @@ var PickerController = class {
7406
7406
  this.emitSelectionChange();
7407
7407
  return true;
7408
7408
  }
7409
- /** Atomically replace an active variable-table hold with a new guest count. */
7410
- async replaceTableQuantity(label, quantity) {
7409
+ /**
7410
+ * Atomically replace an active variable-table hold with a new guest count.
7411
+ * `ttlMs` keeps the host's checkout window across the replacement — without it
7412
+ * a guest-count change silently re-based the countdown on the server default.
7413
+ */
7414
+ async replaceTableQuantity(label, quantity, ttlMs) {
7411
7415
  const table = this.groupedTablesByLabel.get(label);
7412
7416
  const hold = this.hold_;
7413
7417
  if (!table || table.mode !== "variable" || !hold?.labels.includes(label)) return null;
@@ -7424,7 +7428,7 @@ var PickerController = class {
7424
7428
  quantity: item.label === label ? q : item.quantity
7425
7429
  }));
7426
7430
  if (!selections.some((item) => item.label === label)) return null;
7427
- const result = await this.api.hold(this.key, selections, void 0, hold.holdId);
7431
+ const result = await this.api.hold(this.key, selections, ttlMs, hold.holdId);
7428
7432
  this.tableQuantities.set(label, q);
7429
7433
  this.setHold({
7430
7434
  holdId: result.holdId,
@@ -7708,6 +7712,10 @@ var PickerController = class {
7708
7712
  * failure. With `preferPremium`, first tries to hold the best PREMIUM block
7709
7713
  * locally; when none matches the requested quantity it falls back to the
7710
7714
  * normal server pick (the widget surfaces a subtle note on that fallback).
7715
+ *
7716
+ * `ttlMs` is the host's checkout window and MUST reach both branches: a hold
7717
+ * born here is the same buyer commitment as one made by clicking seats, so
7718
+ * omitting it silently handed the buyer the server default instead.
7711
7719
  */
7712
7720
  async bestAvailable(qty, categoryKey, opts = {}) {
7713
7721
  const r = this.renderer;
@@ -7722,7 +7730,7 @@ var PickerController = class {
7722
7730
  const resolved = seat ? this.toSeat(seat) : null;
7723
7731
  return { label, ...resolved?.tierId ? { tierId: resolved.tierId } : {} };
7724
7732
  });
7725
- const result = await this.api.hold(this.key, selection);
7733
+ const result = await this.api.hold(this.key, selection, opts.ttlMs);
7726
7734
  r.clearSelection();
7727
7735
  const ids = this.idsForLabels(block);
7728
7736
  if (ids.length) r.setStatus(ids, "held");
@@ -7741,7 +7749,7 @@ var PickerController = class {
7741
7749
  }
7742
7750
  if (this.hold_ && !await this.release()) return null;
7743
7751
  try {
7744
- const result = await this.api.bestAvailable(this.key, qty, categoryKey, opts.zoneId);
7752
+ const result = await this.api.bestAvailable(this.key, qty, categoryKey, opts.zoneId, opts.ttlMs);
7745
7753
  r.clearSelection();
7746
7754
  const ids = this.idsForLabels(result.labels);
7747
7755
  if (ids.length) r.setStatus(ids, "held");
@@ -7762,8 +7770,10 @@ var PickerController = class {
7762
7770
  * cart can hold best-available seats that aren't in the renderer selection);
7763
7771
  * defaults to the renderer selection. Reuses an existing exact-match hold, else
7764
7772
  * holds first. Returns the labels booked, or null on failure (conflicts painted).
7773
+ * `ttlMs` only matters on the hold-first path: if the book call then fails, the
7774
+ * seats sit held for the host's window rather than the longer server default.
7765
7775
  */
7766
- async book(bookingRef, labelsArg) {
7776
+ async book(bookingRef, labelsArg, ttlMs) {
7767
7777
  const r = this.renderer;
7768
7778
  if (!r) return null;
7769
7779
  if (!this.api.book) throw new Error("picker: transport has no book() \u2014 hold-only mode");
@@ -7786,7 +7796,7 @@ var PickerController = class {
7786
7796
  ...this.tableQuantityRequest(resolved)
7787
7797
  };
7788
7798
  }),
7789
- void 0,
7799
+ ttlMs,
7790
7800
  replaceHoldId
7791
7801
  );
7792
7802
  holdId = h.holdId;