@seatlayer/core 0.8.0 → 0.9.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
@@ -1062,6 +1062,12 @@ interface PickerTransport {
1062
1062
  release(key: string, labels: string[], holdId: string): Promise<unknown>;
1063
1063
  /** Optional — the SDK omits booking (it hands the holdId to the host page). */
1064
1064
  book?(key: string, labels: string[], holdId: string, bookingRef: string): Promise<unknown>;
1065
+ /** Optional (P4) — push an active hold's expiry out ("need more time?"). */
1066
+ extend?(key: string, holdId: string, ttlMs?: number): Promise<{
1067
+ holdId: string;
1068
+ expiresAt: number;
1069
+ extends?: number;
1070
+ }>;
1065
1071
  socketUrl(key: string): string;
1066
1072
  }
1067
1073
  interface PickerCallbacks extends RendererCallbacks {
@@ -1168,6 +1174,15 @@ declare class PickerController {
1168
1174
  * there's nothing to hold.
1169
1175
  */
1170
1176
  hold(labelsArg?: string[], ttlMs?: number): Promise<HoldInfo | null>;
1177
+ /**
1178
+ * P4 "need more time?": extend the OPEN hold's server-side expiry and re-arm
1179
+ * the client expiry timer to match (via setHold), so the controller doesn't
1180
+ * fire a false expiry and start polling. Returns the new hold, or null if
1181
+ * there's no open hold or the transport can't extend / the server refused
1182
+ * (hold gone, expired, or at its renewal cap). Never throws for the refusal
1183
+ * case — the caller decides the copy.
1184
+ */
1185
+ extendHold(ttlMs?: number): Promise<HoldInfo | null>;
1171
1186
  /** Public GA inventory derived from the live synthetic-unit status stream. */
1172
1187
  /**
1173
1188
  * Live seats-left per category key (status 'free' right now). Recompute on
package/dist/index.d.ts CHANGED
@@ -1062,6 +1062,12 @@ interface PickerTransport {
1062
1062
  release(key: string, labels: string[], holdId: string): Promise<unknown>;
1063
1063
  /** Optional — the SDK omits booking (it hands the holdId to the host page). */
1064
1064
  book?(key: string, labels: string[], holdId: string, bookingRef: string): Promise<unknown>;
1065
+ /** Optional (P4) — push an active hold's expiry out ("need more time?"). */
1066
+ extend?(key: string, holdId: string, ttlMs?: number): Promise<{
1067
+ holdId: string;
1068
+ expiresAt: number;
1069
+ extends?: number;
1070
+ }>;
1065
1071
  socketUrl(key: string): string;
1066
1072
  }
1067
1073
  interface PickerCallbacks extends RendererCallbacks {
@@ -1168,6 +1174,15 @@ declare class PickerController {
1168
1174
  * there's nothing to hold.
1169
1175
  */
1170
1176
  hold(labelsArg?: string[], ttlMs?: number): Promise<HoldInfo | null>;
1177
+ /**
1178
+ * P4 "need more time?": extend the OPEN hold's server-side expiry and re-arm
1179
+ * the client expiry timer to match (via setHold), so the controller doesn't
1180
+ * fire a false expiry and start polling. Returns the new hold, or null if
1181
+ * there's no open hold or the transport can't extend / the server refused
1182
+ * (hold gone, expired, or at its renewal cap). Never throws for the refusal
1183
+ * case — the caller decides the copy.
1184
+ */
1185
+ extendHold(ttlMs?: number): Promise<HoldInfo | null>;
1171
1186
  /** Public GA inventory derived from the live synthetic-unit status stream. */
1172
1187
  /**
1173
1188
  * Live seats-left per category key (status 'free' right now). Recompute on
package/dist/index.js CHANGED
@@ -2816,6 +2816,26 @@ var PickerController = class {
2816
2816
  throw err;
2817
2817
  }
2818
2818
  }
2819
+ /**
2820
+ * P4 "need more time?": extend the OPEN hold's server-side expiry and re-arm
2821
+ * the client expiry timer to match (via setHold), so the controller doesn't
2822
+ * fire a false expiry and start polling. Returns the new hold, or null if
2823
+ * there's no open hold or the transport can't extend / the server refused
2824
+ * (hold gone, expired, or at its renewal cap). Never throws for the refusal
2825
+ * case — the caller decides the copy.
2826
+ */
2827
+ async extendHold(ttlMs) {
2828
+ const current = this.hold_;
2829
+ if (!current || !this.api.extend) return null;
2830
+ try {
2831
+ const result = await this.api.extend(this.key, current.holdId, ttlMs);
2832
+ if (this.hold_?.holdId !== current.holdId) return this.hold_;
2833
+ this.setHold({ holdId: current.holdId, labels: current.labels, expiresAt: result.expiresAt, items: current.items });
2834
+ return this.hold_;
2835
+ } catch {
2836
+ return null;
2837
+ }
2838
+ }
2819
2839
  /** Public GA inventory derived from the live synthetic-unit status stream. */
2820
2840
  /**
2821
2841
  * Live seats-left per category key (status 'free' right now). Recompute on