@seatlayer/js 0.28.2 → 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 +16 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -222,10 +222,22 @@ declare class SeatingChart {
|
|
|
222
222
|
tierId?: string | null;
|
|
223
223
|
ttlMs?: number;
|
|
224
224
|
}): Promise<HoldResult | null>;
|
|
225
|
-
/**
|
|
226
|
-
|
|
225
|
+
/**
|
|
226
|
+
* Ask the server for the `qty` best free seats and hold them atomically.
|
|
227
|
+
* `options.ttlMs` sets the checkout window exactly like {@link hold}; omit it
|
|
228
|
+
* and the server falls back to the event setting, then its own default.
|
|
229
|
+
*/
|
|
230
|
+
bestAvailable(qty: number, categoryKey?: string, options?: {
|
|
231
|
+
zoneId?: string;
|
|
232
|
+
preferPremium?: boolean;
|
|
233
|
+
ttlMs?: number;
|
|
234
|
+
}): Promise<BestAvailableResult | null>;
|
|
227
235
|
/** @internal Throwing variant of {@link bestAvailable} for the native host adapter. See {@link holdOrThrow}. */
|
|
228
|
-
bestAvailableOrThrow(qty: number, categoryKey?: string
|
|
236
|
+
bestAvailableOrThrow(qty: number, categoryKey?: string, options?: {
|
|
237
|
+
zoneId?: string;
|
|
238
|
+
preferPremium?: boolean;
|
|
239
|
+
ttlMs?: number;
|
|
240
|
+
}): Promise<BestAvailableResult | null>;
|
|
229
241
|
/**
|
|
230
242
|
* Choose a ticket tier for a selected seat (e.g. Adult → Child). The seat's
|
|
231
243
|
* available `tiers` are on each `SelectedSeat` from `getSelection()` /
|
package/dist/index.d.ts
CHANGED
|
@@ -222,10 +222,22 @@ declare class SeatingChart {
|
|
|
222
222
|
tierId?: string | null;
|
|
223
223
|
ttlMs?: number;
|
|
224
224
|
}): Promise<HoldResult | null>;
|
|
225
|
-
/**
|
|
226
|
-
|
|
225
|
+
/**
|
|
226
|
+
* Ask the server for the `qty` best free seats and hold them atomically.
|
|
227
|
+
* `options.ttlMs` sets the checkout window exactly like {@link hold}; omit it
|
|
228
|
+
* and the server falls back to the event setting, then its own default.
|
|
229
|
+
*/
|
|
230
|
+
bestAvailable(qty: number, categoryKey?: string, options?: {
|
|
231
|
+
zoneId?: string;
|
|
232
|
+
preferPremium?: boolean;
|
|
233
|
+
ttlMs?: number;
|
|
234
|
+
}): Promise<BestAvailableResult | null>;
|
|
227
235
|
/** @internal Throwing variant of {@link bestAvailable} for the native host adapter. See {@link holdOrThrow}. */
|
|
228
|
-
bestAvailableOrThrow(qty: number, categoryKey?: string
|
|
236
|
+
bestAvailableOrThrow(qty: number, categoryKey?: string, options?: {
|
|
237
|
+
zoneId?: string;
|
|
238
|
+
preferPremium?: boolean;
|
|
239
|
+
ttlMs?: number;
|
|
240
|
+
}): Promise<BestAvailableResult | null>;
|
|
229
241
|
/**
|
|
230
242
|
* Choose a ticket tier for a selected seat (e.g. Adult → Child). The seat's
|
|
231
243
|
* available `tiers` are on each `SelectedSeat` from `getSelection()` /
|
package/dist/index.js
CHANGED
|
@@ -52,10 +52,13 @@ var PubApi = class {
|
|
|
52
52
|
body: { selections, ...ttlMs ? { ttlMs } : {}, ...replaceHoldId ? { replaceHoldId } : {} }
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
// `zoneId` scopes the pick to one zone and `ttlMs` carries the host's checkout
|
|
56
|
+
// window — both are part of the route contract, and dropping either here made
|
|
57
|
+
// the SDK quietly pick venue-wide and hold for the server default instead.
|
|
58
|
+
bestAvailable(key, qty, categoryKey, zoneId, ttlMs) {
|
|
56
59
|
return request(this.base, `/pub/events/${encodeURIComponent(key)}/best-available`, {
|
|
57
60
|
method: "POST",
|
|
58
|
-
body: { qty, ...categoryKey ? { categoryKey } : {} }
|
|
61
|
+
body: { qty, ...categoryKey ? { categoryKey } : {}, ...zoneId ? { zoneId } : {}, ...ttlMs ? { ttlMs } : {} }
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
64
|
resume(key, holdId) {
|
|
@@ -322,18 +325,22 @@ var SeatingChart = class {
|
|
|
322
325
|
const h = await this.controller.holdGA(areaId, qty, options);
|
|
323
326
|
return h ? { holdId: h.holdId, expiresAt: h.expiresAt, seats: h.seats, items: h.items } : null;
|
|
324
327
|
}
|
|
325
|
-
/**
|
|
326
|
-
|
|
328
|
+
/**
|
|
329
|
+
* Ask the server for the `qty` best free seats and hold them atomically.
|
|
330
|
+
* `options.ttlMs` sets the checkout window exactly like {@link hold}; omit it
|
|
331
|
+
* and the server falls back to the event setting, then its own default.
|
|
332
|
+
*/
|
|
333
|
+
async bestAvailable(qty, categoryKey, options = {}) {
|
|
327
334
|
try {
|
|
328
|
-
return await this.bestAvailableOrThrow(qty, categoryKey);
|
|
335
|
+
return await this.bestAvailableOrThrow(qty, categoryKey, options);
|
|
329
336
|
} catch (err) {
|
|
330
337
|
this.opts.onError?.(err);
|
|
331
338
|
return null;
|
|
332
339
|
}
|
|
333
340
|
}
|
|
334
341
|
/** @internal Throwing variant of {@link bestAvailable} for the native host adapter. See {@link holdOrThrow}. */
|
|
335
|
-
async bestAvailableOrThrow(qty, categoryKey) {
|
|
336
|
-
const h = await this.controller.bestAvailable(qty, categoryKey);
|
|
342
|
+
async bestAvailableOrThrow(qty, categoryKey, options = {}) {
|
|
343
|
+
const h = await this.controller.bestAvailable(qty, categoryKey, options);
|
|
337
344
|
return h ? { holdId: h.holdId, expiresAt: h.expiresAt, labels: h.labels, seats: h.seats, items: h.items } : null;
|
|
338
345
|
}
|
|
339
346
|
/**
|
|
@@ -3409,7 +3416,7 @@ var SeatPicker = class _SeatPicker {
|
|
|
3409
3416
|
}
|
|
3410
3417
|
if (held) {
|
|
3411
3418
|
try {
|
|
3412
|
-
const updated = await this.controller.replaceTableQuantity(table.label, table.quantity);
|
|
3419
|
+
const updated = await this.controller.replaceTableQuantity(table.label, table.quantity, this.opts.holdTtlMs);
|
|
3413
3420
|
if (!updated) {
|
|
3414
3421
|
this.toast("That guest count could not be secured. Your current table hold is unchanged.", "warning");
|
|
3415
3422
|
this.renderTableDialogState();
|
|
@@ -4388,7 +4395,7 @@ var SeatPicker = class _SeatPicker {
|
|
|
4388
4395
|
button.innerHTML = '<span class="sl-ba-spin" aria-hidden="true"></span>Finding\u2026';
|
|
4389
4396
|
}
|
|
4390
4397
|
try {
|
|
4391
|
-
const h = await this.controller.bestAvailable(qty, categoryKey, opts);
|
|
4398
|
+
const h = await this.controller.bestAvailable(qty, categoryKey, { ...opts, ttlMs: this.opts.holdTtlMs });
|
|
4392
4399
|
if (h) {
|
|
4393
4400
|
this.hold = { holdId: h.holdId, expiresAt: h.expiresAt, seats: h.seats, items: h.items };
|
|
4394
4401
|
this.handedOff = false;
|