@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.cjs CHANGED
@@ -7685,8 +7685,12 @@ var PickerController = class {
7685
7685
  this.emitSelectionChange();
7686
7686
  return true;
7687
7687
  }
7688
- /** Atomically replace an active variable-table hold with a new guest count. */
7689
- async replaceTableQuantity(label, quantity) {
7688
+ /**
7689
+ * Atomically replace an active variable-table hold with a new guest count.
7690
+ * `ttlMs` keeps the host's checkout window across the replacement — without it
7691
+ * a guest-count change silently re-based the countdown on the server default.
7692
+ */
7693
+ async replaceTableQuantity(label, quantity, ttlMs) {
7690
7694
  const table = this.groupedTablesByLabel.get(label);
7691
7695
  const hold = this.hold_;
7692
7696
  if (!table || table.mode !== "variable" || !hold?.labels.includes(label)) return null;
@@ -7703,7 +7707,7 @@ var PickerController = class {
7703
7707
  quantity: item.label === label ? q : item.quantity
7704
7708
  }));
7705
7709
  if (!selections.some((item) => item.label === label)) return null;
7706
- const result = await this.api.hold(this.key, selections, void 0, hold.holdId);
7710
+ const result = await this.api.hold(this.key, selections, ttlMs, hold.holdId);
7707
7711
  this.tableQuantities.set(label, q);
7708
7712
  this.setHold({
7709
7713
  holdId: result.holdId,
@@ -7987,6 +7991,10 @@ var PickerController = class {
7987
7991
  * failure. With `preferPremium`, first tries to hold the best PREMIUM block
7988
7992
  * locally; when none matches the requested quantity it falls back to the
7989
7993
  * normal server pick (the widget surfaces a subtle note on that fallback).
7994
+ *
7995
+ * `ttlMs` is the host's checkout window and MUST reach both branches: a hold
7996
+ * born here is the same buyer commitment as one made by clicking seats, so
7997
+ * omitting it silently handed the buyer the server default instead.
7990
7998
  */
7991
7999
  async bestAvailable(qty, categoryKey, opts = {}) {
7992
8000
  const r = this.renderer;
@@ -8001,7 +8009,7 @@ var PickerController = class {
8001
8009
  const resolved = seat ? this.toSeat(seat) : null;
8002
8010
  return { label, ...resolved?.tierId ? { tierId: resolved.tierId } : {} };
8003
8011
  });
8004
- const result = await this.api.hold(this.key, selection);
8012
+ const result = await this.api.hold(this.key, selection, opts.ttlMs);
8005
8013
  r.clearSelection();
8006
8014
  const ids = this.idsForLabels(block);
8007
8015
  if (ids.length) r.setStatus(ids, "held");
@@ -8020,7 +8028,7 @@ var PickerController = class {
8020
8028
  }
8021
8029
  if (this.hold_ && !await this.release()) return null;
8022
8030
  try {
8023
- const result = await this.api.bestAvailable(this.key, qty, categoryKey, opts.zoneId);
8031
+ const result = await this.api.bestAvailable(this.key, qty, categoryKey, opts.zoneId, opts.ttlMs);
8024
8032
  r.clearSelection();
8025
8033
  const ids = this.idsForLabels(result.labels);
8026
8034
  if (ids.length) r.setStatus(ids, "held");
@@ -8041,8 +8049,10 @@ var PickerController = class {
8041
8049
  * cart can hold best-available seats that aren't in the renderer selection);
8042
8050
  * defaults to the renderer selection. Reuses an existing exact-match hold, else
8043
8051
  * holds first. Returns the labels booked, or null on failure (conflicts painted).
8052
+ * `ttlMs` only matters on the hold-first path: if the book call then fails, the
8053
+ * seats sit held for the host's window rather than the longer server default.
8044
8054
  */
8045
- async book(bookingRef, labelsArg) {
8055
+ async book(bookingRef, labelsArg, ttlMs) {
8046
8056
  const r = this.renderer;
8047
8057
  if (!r) return null;
8048
8058
  if (!this.api.book) throw new Error("picker: transport has no book() \u2014 hold-only mode");
@@ -8065,7 +8075,7 @@ var PickerController = class {
8065
8075
  ...this.tableQuantityRequest(resolved)
8066
8076
  };
8067
8077
  }),
8068
- void 0,
8078
+ ttlMs,
8069
8079
  replaceHoldId
8070
8080
  );
8071
8081
  holdId = h.holdId;