@seatlayer/core 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 +23 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1369,9 +1369,10 @@ function compositeHexOver(foreground, background, opacity) {
|
|
|
1369
1369
|
const channels = front.map((value, index) => Math.round(value * alpha + back[index] * (1 - alpha)));
|
|
1370
1370
|
return `#${channels.map((value) => value.toString(16).padStart(2, "0")).join("")}`;
|
|
1371
1371
|
}
|
|
1372
|
-
|
|
1372
|
+
var AUTHORED_LABEL_MIN_CONTRAST = 3;
|
|
1373
|
+
function stateAwareBookableLabelInk(fill, preferred, minContrast = SMALL_TEXT_CONTRAST) {
|
|
1373
1374
|
const preferredContrast = renderedTextContrast(preferred, fill);
|
|
1374
|
-
if (preferredContrast != null && preferredContrast >=
|
|
1375
|
+
if (preferredContrast != null && preferredContrast >= minContrast) return preferred;
|
|
1375
1376
|
const darkContrast = renderedTextContrast(DARK_BOOKABLE_LABEL_INK, fill) ?? 0;
|
|
1376
1377
|
const lightContrast = renderedTextContrast(LIGHT_BOOKABLE_LABEL_INK, fill) ?? 0;
|
|
1377
1378
|
if (darkContrast === 0 && lightContrast === 0) return preferred;
|
|
@@ -4786,7 +4787,7 @@ var _SeatmapRenderer = class _SeatmapRenderer {
|
|
|
4786
4787
|
* authored per-seat colour through the same auto-contrast rule as sections. */
|
|
4787
4788
|
seatLabelInk(seat, shape) {
|
|
4788
4789
|
const fill = shape.fill();
|
|
4789
|
-
return stateAwareBookableLabelInk(typeof fill === "string" ? fill : "", this.seatPreferredLabelInk(seat));
|
|
4790
|
+
return stateAwareBookableLabelInk(typeof fill === "string" ? fill : "", this.seatPreferredLabelInk(seat), AUTHORED_LABEL_MIN_CONTRAST);
|
|
4790
4791
|
}
|
|
4791
4792
|
/** Apply fill/stroke/opacity for a seat's current status + selection. */
|
|
4792
4793
|
paintSeat(c, id) {
|
|
@@ -6954,7 +6955,8 @@ var _SeatmapRenderer = class _SeatmapRenderer {
|
|
|
6954
6955
|
const labelStyle = presentation?.labelStyle;
|
|
6955
6956
|
const ink = stateAwareBookableLabelInk(
|
|
6956
6957
|
background,
|
|
6957
|
-
labelStyle?.color ?? this.theme.rowLabelColor ?? this.theme.textColor ?? "#e6e9f0"
|
|
6958
|
+
labelStyle?.color ?? this.theme.rowLabelColor ?? this.theme.textColor ?? "#e6e9f0",
|
|
6959
|
+
AUTHORED_LABEL_MIN_CONTRAST
|
|
6958
6960
|
);
|
|
6959
6961
|
const fontSize = labelStyle?.size ?? 12;
|
|
6960
6962
|
const rotation = presentation?.rotation ?? 0;
|
|
@@ -7683,8 +7685,12 @@ var PickerController = class {
|
|
|
7683
7685
|
this.emitSelectionChange();
|
|
7684
7686
|
return true;
|
|
7685
7687
|
}
|
|
7686
|
-
/**
|
|
7687
|
-
|
|
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) {
|
|
7688
7694
|
const table = this.groupedTablesByLabel.get(label);
|
|
7689
7695
|
const hold = this.hold_;
|
|
7690
7696
|
if (!table || table.mode !== "variable" || !hold?.labels.includes(label)) return null;
|
|
@@ -7701,7 +7707,7 @@ var PickerController = class {
|
|
|
7701
7707
|
quantity: item.label === label ? q : item.quantity
|
|
7702
7708
|
}));
|
|
7703
7709
|
if (!selections.some((item) => item.label === label)) return null;
|
|
7704
|
-
const result = await this.api.hold(this.key, selections,
|
|
7710
|
+
const result = await this.api.hold(this.key, selections, ttlMs, hold.holdId);
|
|
7705
7711
|
this.tableQuantities.set(label, q);
|
|
7706
7712
|
this.setHold({
|
|
7707
7713
|
holdId: result.holdId,
|
|
@@ -7985,6 +7991,10 @@ var PickerController = class {
|
|
|
7985
7991
|
* failure. With `preferPremium`, first tries to hold the best PREMIUM block
|
|
7986
7992
|
* locally; when none matches the requested quantity it falls back to the
|
|
7987
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.
|
|
7988
7998
|
*/
|
|
7989
7999
|
async bestAvailable(qty, categoryKey, opts = {}) {
|
|
7990
8000
|
const r = this.renderer;
|
|
@@ -7999,7 +8009,7 @@ var PickerController = class {
|
|
|
7999
8009
|
const resolved = seat ? this.toSeat(seat) : null;
|
|
8000
8010
|
return { label, ...resolved?.tierId ? { tierId: resolved.tierId } : {} };
|
|
8001
8011
|
});
|
|
8002
|
-
const result = await this.api.hold(this.key, selection);
|
|
8012
|
+
const result = await this.api.hold(this.key, selection, opts.ttlMs);
|
|
8003
8013
|
r.clearSelection();
|
|
8004
8014
|
const ids = this.idsForLabels(block);
|
|
8005
8015
|
if (ids.length) r.setStatus(ids, "held");
|
|
@@ -8018,7 +8028,7 @@ var PickerController = class {
|
|
|
8018
8028
|
}
|
|
8019
8029
|
if (this.hold_ && !await this.release()) return null;
|
|
8020
8030
|
try {
|
|
8021
|
-
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);
|
|
8022
8032
|
r.clearSelection();
|
|
8023
8033
|
const ids = this.idsForLabels(result.labels);
|
|
8024
8034
|
if (ids.length) r.setStatus(ids, "held");
|
|
@@ -8039,8 +8049,10 @@ var PickerController = class {
|
|
|
8039
8049
|
* cart can hold best-available seats that aren't in the renderer selection);
|
|
8040
8050
|
* defaults to the renderer selection. Reuses an existing exact-match hold, else
|
|
8041
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.
|
|
8042
8054
|
*/
|
|
8043
|
-
async book(bookingRef, labelsArg) {
|
|
8055
|
+
async book(bookingRef, labelsArg, ttlMs) {
|
|
8044
8056
|
const r = this.renderer;
|
|
8045
8057
|
if (!r) return null;
|
|
8046
8058
|
if (!this.api.book) throw new Error("picker: transport has no book() \u2014 hold-only mode");
|
|
@@ -8063,7 +8075,7 @@ var PickerController = class {
|
|
|
8063
8075
|
...this.tableQuantityRequest(resolved)
|
|
8064
8076
|
};
|
|
8065
8077
|
}),
|
|
8066
|
-
|
|
8078
|
+
ttlMs,
|
|
8067
8079
|
replaceHoldId
|
|
8068
8080
|
);
|
|
8069
8081
|
holdId = h.holdId;
|