@nex125/seatmap-viewer 0.1.22 → 0.1.23

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
@@ -1,913 +1,785 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- var seatmapCore = require('@nex125/seatmap-core');
5
- var seatmapReact = require('@nex125/seatmap-react');
6
- var jsxRuntime = require('react/jsx-runtime');
7
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let react = require("react");
3
+ let _nex125_seatmap_core = require("@nex125/seatmap-core");
4
+ let _nex125_seatmap_react = require("@nex125/seatmap-react");
5
+ let react_jsx_runtime = require("react/jsx-runtime");
8
6
  // src/SeatmapViewer.tsx
9
- var defaultSeatmapViewerMessages = {
10
- uncategorizedCategoryName: "Uncategorized",
11
- sectionFallbackLabel: "Section",
12
- tableLabel: (tableLabel) => `Table ${tableLabel}`,
13
- tooltipSeatLabel: (rowLabel, seatLabel) => `Row ${rowLabel}, Seat ${seatLabel}`,
14
- tooltipStatusAvailable: "Available",
15
- tooltipPriceLabel: (price) => `Price: ${price}`,
16
- tooltipPriceUnavailable: "Price unavailable",
17
- legendAriaLabel: "Seatmap legend",
18
- legendStatusesTitle: "Seat statuses",
19
- legendPricesTitle: "Prices",
20
- cartChipLabel: (selectedCount) => `Cart (${selectedCount})`,
21
- cartAriaLabel: "Selected seats cart",
22
- cartHeaderTitle: "Selected seats cart",
23
- cartCloseLabel: "Close cart",
24
- cartEmptyState: "No seats selected yet.",
25
- cartGroupMeta: (count, unitPrice) => `${count} tickets - ${unitPrice} each`,
26
- cartGroupFee: (basePrice, serviceFee, serviceFeePercent) => serviceFeePercent ? `Base ${basePrice} + service fee ${serviceFee} (${serviceFeePercent})` : `Base ${basePrice} + service fee ${serviceFee}`,
27
- cartRemoveOneAriaLabel: (categoryName) => `Remove one seat from ${categoryName}`,
28
- cartAddOneAriaLabel: (categoryName) => `Add one seat to ${categoryName}`,
29
- cartRemoveSeatTitle: "Remove seat",
30
- cartRemoveSeatAriaLabel: (seatLabel) => `Remove seat ${seatLabel}`,
31
- cartServiceFeeSummary: (serviceFeeTotal) => `Service fee included: ${serviceFeeTotal}`,
32
- cartSummary: (count, totalCost) => `${count} seats - Total ${totalCost}`,
33
- cartProceedButton: "Proceed"
7
+ const defaultSeatmapViewerMessages = {
8
+ uncategorizedCategoryName: "Uncategorized",
9
+ sectionFallbackLabel: "Section",
10
+ tableLabel: (tableLabel) => `Table ${tableLabel}`,
11
+ tooltipSeatLabel: (rowLabel, seatLabel) => `Row ${rowLabel}, Seat ${seatLabel}`,
12
+ tooltipStatusAvailable: "Available",
13
+ tooltipPriceLabel: (price) => `Price: ${price}`,
14
+ tooltipPriceUnavailable: "Price unavailable",
15
+ legendAriaLabel: "Seatmap legend",
16
+ legendStatusesTitle: "Seat statuses",
17
+ legendPricesTitle: "Prices",
18
+ cartChipLabel: (selectedCount) => `Cart (${selectedCount})`,
19
+ cartAriaLabel: "Selected seats cart",
20
+ cartHeaderTitle: "Selected seats cart",
21
+ cartCloseLabel: "Close cart",
22
+ cartEmptyState: "No seats selected yet.",
23
+ cartGroupMeta: (count, unitPrice) => `${count} tickets - ${unitPrice} each`,
24
+ cartGroupFee: (basePrice, serviceFee, serviceFeePercent) => serviceFeePercent ? `Base ${basePrice} + service fee ${serviceFee} (${serviceFeePercent})` : `Base ${basePrice} + service fee ${serviceFee}`,
25
+ cartRemoveOneAriaLabel: (categoryName) => `Remove one seat from ${categoryName}`,
26
+ cartAddOneAriaLabel: (categoryName) => `Add one seat to ${categoryName}`,
27
+ cartRemoveSeatTitle: "Remove seat",
28
+ cartRemoveSeatAriaLabel: (seatLabel) => `Remove seat ${seatLabel}`,
29
+ cartServiceFeeSummary: (serviceFeeTotal) => `Service fee included: ${serviceFeeTotal}`,
30
+ cartSummary: (count, totalCost) => `${count} seats - Total ${totalCost}`,
31
+ cartProceedButton: "Proceed"
34
32
  };
35
33
  function getCategoryPriceBreakdown(category) {
36
- if (!category) {
37
- return { unitPrice: 0, baseUnitPrice: 0, serviceFee: 0 };
38
- }
39
- const baseUnitPrice = Number.isFinite(category.basePrice) ? category.basePrice : 0;
40
- const serviceFee = Number.isFinite(category.serviceFee) ? category.serviceFee : 0;
41
- if (category.isPriceOverridden && Number.isFinite(category.overriddenPrice)) {
42
- return {
43
- unitPrice: category.overriddenPrice ?? 0,
44
- baseUnitPrice,
45
- serviceFee
46
- };
47
- }
48
- if (Number.isFinite(category.backendPrice)) {
49
- return {
50
- unitPrice: category.backendPrice,
51
- baseUnitPrice,
52
- serviceFee
53
- };
54
- }
55
- return {
56
- unitPrice: baseUnitPrice + serviceFee,
57
- baseUnitPrice,
58
- serviceFee
59
- };
34
+ if (!category) return {
35
+ unitPrice: 0,
36
+ baseUnitPrice: 0,
37
+ serviceFee: 0
38
+ };
39
+ const baseUnitPrice = Number.isFinite(category.basePrice) ? category.basePrice : 0;
40
+ const serviceFee = Number.isFinite(category.serviceFee) ? category.serviceFee : 0;
41
+ if (category.isPriceOverridden && Number.isFinite(category.overriddenPrice)) return {
42
+ unitPrice: category.overriddenPrice ?? 0,
43
+ baseUnitPrice,
44
+ serviceFee
45
+ };
46
+ if (Number.isFinite(category.backendPrice)) return {
47
+ unitPrice: category.backendPrice,
48
+ baseUnitPrice,
49
+ serviceFee
50
+ };
51
+ return {
52
+ unitPrice: baseUnitPrice + serviceFee,
53
+ baseUnitPrice,
54
+ serviceFee
55
+ };
60
56
  }
61
57
  function formatPercent(value, locale) {
62
- return new Intl.NumberFormat(locale, {
63
- style: "percent",
64
- maximumFractionDigits: 2
65
- }).format(value);
58
+ return new Intl.NumberFormat(locale, {
59
+ style: "percent",
60
+ maximumFractionDigits: 2
61
+ }).format(value);
66
62
  }
67
63
  function formatMoney(value, locale, currency) {
68
- return new Intl.NumberFormat(locale, {
69
- style: "currency",
70
- currency
71
- }).format(value);
64
+ return new Intl.NumberFormat(locale, {
65
+ style: "currency",
66
+ currency
67
+ }).format(value);
72
68
  }
73
- function DefaultSeatmapViewerTooltip({
74
- data,
75
- locale,
76
- currency,
77
- messages
78
- }) {
79
- const statusLabel = data.statusName ?? (data.seat.status === seatmapCore.AVAILABLE_STATUS_ID ? messages.tooltipStatusAvailable : data.seat.status);
80
- const priceLabel = typeof data.price === "number" ? messages.tooltipPriceLabel(formatMoney(data.price, locale, currency)) : messages.tooltipPriceUnavailable;
81
- return /* @__PURE__ */ jsxRuntime.jsxs(
82
- "div",
83
- {
84
- style: {
85
- background: "var(--seatmap-tooltip-surface, color-mix(in srgb, var(--seatmap-surface-container-low, #181818) 94%, transparent))",
86
- border: "1px solid var(--seatmap-tooltip-border, var(--seatmap-outline, #353331))",
87
- borderRadius: 10,
88
- padding: "8px 14px",
89
- color: "var(--seatmap-tooltip-text, var(--seatmap-on-surface, #e5e2e1))",
90
- fontSize: 13,
91
- fontFamily: "system-ui",
92
- pointerEvents: "none",
93
- whiteSpace: "nowrap"
94
- },
95
- children: [
96
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 600, marginBottom: 2 }, children: data.section.label }),
97
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: messages.tooltipSeatLabel(data.row.label, data.seat.label) }),
98
- /* @__PURE__ */ jsxRuntime.jsx(
99
- "div",
100
- {
101
- style: {
102
- color: "var(--seatmap-tooltip-muted-text, var(--seatmap-on-surface-variant, #9a9694))",
103
- fontSize: 12,
104
- marginTop: 2
105
- },
106
- children: statusLabel
107
- }
108
- ),
109
- /* @__PURE__ */ jsxRuntime.jsx(
110
- "div",
111
- {
112
- style: {
113
- color: "var(--seatmap-tooltip-muted-text, var(--seatmap-on-surface-variant, #9a9694))",
114
- fontSize: 12,
115
- marginTop: 2
116
- },
117
- children: priceLabel
118
- }
119
- )
120
- ]
121
- }
122
- );
69
+ function DefaultSeatmapViewerTooltip({ data, locale, currency, messages }) {
70
+ const statusLabel = data.statusName ?? (data.seat.status === _nex125_seatmap_core.AVAILABLE_STATUS_ID ? messages.tooltipStatusAvailable : data.seat.status);
71
+ const priceLabel = typeof data.price === "number" ? messages.tooltipPriceLabel(formatMoney(data.price, locale, currency)) : messages.tooltipPriceUnavailable;
72
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
73
+ style: {
74
+ background: "var(--seatmap-tooltip-surface, color-mix(in srgb, var(--seatmap-surface-container-low, #181818) 94%, transparent))",
75
+ border: "1px solid var(--seatmap-tooltip-border, var(--seatmap-outline, #353331))",
76
+ borderRadius: 10,
77
+ padding: "8px 14px",
78
+ color: "var(--seatmap-tooltip-text, var(--seatmap-on-surface, #e5e2e1))",
79
+ fontSize: 13,
80
+ fontFamily: "system-ui",
81
+ pointerEvents: "none",
82
+ whiteSpace: "nowrap"
83
+ },
84
+ children: [
85
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
86
+ style: {
87
+ fontWeight: 600,
88
+ marginBottom: 2
89
+ },
90
+ children: data.section.label
91
+ }),
92
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: messages.tooltipSeatLabel(data.row.label, data.seat.label) }),
93
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
94
+ style: {
95
+ color: "var(--seatmap-tooltip-muted-text, var(--seatmap-on-surface-variant, #9a9694))",
96
+ fontSize: 12,
97
+ marginTop: 2
98
+ },
99
+ children: statusLabel
100
+ }),
101
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
102
+ style: {
103
+ color: "var(--seatmap-tooltip-muted-text, var(--seatmap-on-surface-variant, #9a9694))",
104
+ fontSize: 12,
105
+ marginTop: 2
106
+ },
107
+ children: priceLabel
108
+ })
109
+ ]
110
+ });
123
111
  }
124
112
  function TrashIcon() {
125
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
126
- "path",
127
- {
128
- d: "M9 3h6l1 2h4v2H4V5h4l1-2Zm1 7h2v8h-2v-8Zm4 0h2v8h-2v-8ZM7 10h2v8H7v-8Zm-1 12h12a2 2 0 0 0 2-2V8H4v12a2 2 0 0 0 2 2Z",
129
- fill: "currentColor"
130
- }
131
- ) });
113
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
114
+ width: "12",
115
+ height: "12",
116
+ viewBox: "0 0 24 24",
117
+ fill: "none",
118
+ "aria-hidden": "true",
119
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
120
+ d: "M9 3h6l1 2h4v2H4V5h4l1-2Zm1 7h2v8h-2v-8Zm4 0h2v8h-2v-8ZM7 10h2v8H7v-8Zm-1 12h12a2 2 0 0 0 2-2V8H4v12a2 2 0 0 0 2 2Z",
121
+ fill: "currentColor"
122
+ })
123
+ });
132
124
  }
133
125
  function mergeStyles(base, override) {
134
- if (!override) return base;
135
- return { ...base, ...override };
126
+ if (!override) return base;
127
+ return {
128
+ ...base,
129
+ ...override
130
+ };
136
131
  }
137
132
  function mergeClassNames(...classNames) {
138
- const merged = classNames.filter(Boolean).join(" ").trim();
139
- return merged.length > 0 ? merged : void 0;
133
+ const merged = classNames.filter(Boolean).join(" ").trim();
134
+ return merged.length > 0 ? merged : void 0;
140
135
  }
141
- function SeatmapViewerContent({
142
- venue,
143
- onSeatClick,
144
- onSeatHover,
145
- onSelectionChange,
146
- renderTooltip,
147
- showLabels,
148
- onCartEvent,
149
- locale = "en-US",
150
- currency = "BYN",
151
- maxSelectedSeats,
152
- styles = {},
153
- classNames = {},
154
- messages: messagesOverride = {}
155
- }) {
156
- const messages = react.useMemo(
157
- () => ({ ...defaultSeatmapViewerMessages, ...messagesOverride }),
158
- [messagesOverride]
159
- );
160
- const { selectedSeatIds, setSelection } = seatmapReact.useSelection();
161
- const [isCartOpen, setIsCartOpen] = react.useState(false);
162
- const [lastUserAnchorByCategory, setLastUserAnchorByCategory] = react.useState({});
163
- const [viewportWidth, setViewportWidth] = react.useState(
164
- () => typeof window === "undefined" ? 1280 : window.innerWidth
165
- );
166
- const previousSelectedRef = react.useRef([]);
167
- const pendingSeatClickRef = react.useRef(null);
168
- const showStatuses = venue.seatStatuses.length > 0;
169
- const showCategories = venue.categories.length > 0;
170
- const selectedSeatIdArray = react.useMemo(() => Array.from(selectedSeatIds), [selectedSeatIds]);
171
- const seatDetailsById = react.useMemo(() => {
172
- const categoryMap = new Map(venue.categories.map((category) => [category.id, category]));
173
- const next = /* @__PURE__ */ new Map();
174
- for (const section of venue.sections) {
175
- const cos = Math.cos(section.rotation);
176
- const sin = Math.sin(section.rotation);
177
- for (const row of section.rows) {
178
- for (const seat of row.seats) {
179
- const category = categoryMap.get(seat.categoryId);
180
- const priceBreakdown = getCategoryPriceBreakdown(category);
181
- next.set(seat.id, {
182
- seatId: seat.id,
183
- seatLabel: seat.label,
184
- rowLabel: row.label,
185
- sectionId: section.id,
186
- sectionLabel: section.label,
187
- categoryId: seat.categoryId,
188
- categoryName: category?.name ?? messages.uncategorizedCategoryName,
189
- unitPrice: priceBreakdown.unitPrice,
190
- baseUnitPrice: priceBreakdown.baseUnitPrice,
191
- serviceFee: priceBreakdown.serviceFee,
192
- status: seat.status,
193
- x: section.position.x + seat.position.x * cos - seat.position.y * sin,
194
- y: section.position.y + seat.position.x * sin + seat.position.y * cos
195
- });
196
- }
197
- }
198
- }
199
- for (const table of venue.tables) {
200
- for (const seat of table.seats) {
201
- const category = categoryMap.get(seat.categoryId);
202
- const priceBreakdown = getCategoryPriceBreakdown(category);
203
- next.set(seat.id, {
204
- seatId: seat.id,
205
- seatLabel: seat.label,
206
- rowLabel: null,
207
- sectionId: table.id,
208
- sectionLabel: messages.tableLabel(table.label),
209
- categoryId: seat.categoryId,
210
- categoryName: category?.name ?? messages.uncategorizedCategoryName,
211
- unitPrice: priceBreakdown.unitPrice,
212
- baseUnitPrice: priceBreakdown.baseUnitPrice,
213
- serviceFee: priceBreakdown.serviceFee,
214
- status: seat.status,
215
- x: table.position.x + seat.position.x,
216
- y: table.position.y + seat.position.y
217
- });
218
- }
219
- }
220
- return next;
221
- }, [venue, messages]);
222
- const selectedSeats = react.useMemo(() => {
223
- const ordered = [];
224
- for (const selectedSeatId of selectedSeatIdArray) {
225
- const seat = seatDetailsById.get(selectedSeatId);
226
- if (seat) ordered.push(seat);
227
- }
228
- return ordered;
229
- }, [seatDetailsById, selectedSeatIdArray]);
230
- react.useEffect(() => {
231
- onSelectionChange?.(selectedSeatIdArray);
232
- }, [onSelectionChange, selectedSeatIdArray]);
233
- react.useEffect(() => {
234
- const previous = new Set(previousSelectedRef.current);
235
- const added = selectedSeatIdArray.filter((seatId) => !previous.has(seatId));
236
- const clickedSeatId = pendingSeatClickRef.current;
237
- if (clickedSeatId && added.includes(clickedSeatId)) {
238
- const clickedSeat = seatDetailsById.get(clickedSeatId);
239
- if (clickedSeat) {
240
- setLastUserAnchorByCategory((current) => ({
241
- ...current,
242
- [clickedSeat.categoryId]: clickedSeatId
243
- }));
244
- }
245
- }
246
- previousSelectedRef.current = selectedSeatIdArray;
247
- pendingSeatClickRef.current = null;
248
- }, [seatDetailsById, selectedSeatIdArray]);
249
- react.useEffect(() => {
250
- if (typeof window === "undefined") return;
251
- const onResize = () => setViewportWidth(window.innerWidth);
252
- window.addEventListener("resize", onResize);
253
- return () => window.removeEventListener("resize", onResize);
254
- }, []);
255
- const cartSeats = react.useMemo(
256
- () => selectedSeats.map((seat) => ({
257
- seatId: seat.seatId,
258
- seatLabel: seat.seatLabel,
259
- rowLabel: seat.rowLabel,
260
- sectionId: seat.sectionId,
261
- sectionLabel: seat.sectionLabel,
262
- categoryId: seat.categoryId,
263
- categoryName: seat.categoryName,
264
- unitPrice: seat.unitPrice,
265
- baseUnitPrice: seat.baseUnitPrice,
266
- serviceFee: seat.serviceFee
267
- })),
268
- [selectedSeats]
269
- );
270
- const totalSelectedSeats = react.useMemo(() => cartSeats.length, [cartSeats]);
271
- const isSelectionOverLimit = typeof maxSelectedSeats === "number" && totalSelectedSeats > maxSelectedSeats;
272
- const totalCost = react.useMemo(() => cartSeats.reduce((sum, seat) => sum + seat.unitPrice, 0), [cartSeats]);
273
- const totalServiceFee = react.useMemo(() => cartSeats.reduce((sum, seat) => sum + seat.serviceFee, 0), [cartSeats]);
274
- const effectiveTooltipRenderer = react.useCallback(
275
- (data) => {
276
- if (renderTooltip) {
277
- return renderTooltip(data);
278
- }
279
- return /* @__PURE__ */ jsxRuntime.jsx(
280
- DefaultSeatmapViewerTooltip,
281
- {
282
- data,
283
- locale,
284
- currency,
285
- messages
286
- }
287
- );
288
- },
289
- [currency, locale, messages, renderTooltip]
290
- );
291
- const groupedSeatsList = react.useMemo(() => {
292
- const grouped = /* @__PURE__ */ new Map();
293
- for (const seat of cartSeats) {
294
- const existing = grouped.get(seat.categoryId);
295
- if (existing) {
296
- existing.seats.push(seat);
297
- } else {
298
- grouped.set(seat.categoryId, {
299
- categoryName: seat.categoryName,
300
- unitPrice: seat.unitPrice,
301
- baseUnitPrice: seat.baseUnitPrice,
302
- serviceFee: seat.serviceFee,
303
- seats: [seat]
304
- });
305
- }
306
- }
307
- const ordered = [];
308
- const selectedSet = new Set(selectedSeatIdArray);
309
- const availableToAddByCategory = /* @__PURE__ */ new Map();
310
- for (const seat of seatDetailsById.values()) {
311
- if (seat.status !== seatmapCore.AVAILABLE_STATUS_ID || selectedSet.has(seat.seatId)) continue;
312
- availableToAddByCategory.set(
313
- seat.categoryId,
314
- (availableToAddByCategory.get(seat.categoryId) ?? 0) + 1
315
- );
316
- }
317
- for (const category of venue.categories) {
318
- const group = grouped.get(category.id);
319
- if (!group) continue;
320
- ordered.push({
321
- categoryId: category.id,
322
- categoryName: group.categoryName,
323
- unitPrice: group.unitPrice,
324
- baseUnitPrice: group.baseUnitPrice,
325
- serviceFee: group.serviceFee,
326
- seats: group.seats,
327
- availableToAdd: availableToAddByCategory.get(category.id) ?? 0
328
- });
329
- }
330
- for (const [categoryId, group] of grouped.entries()) {
331
- if (venue.categories.some((category) => category.id === categoryId)) continue;
332
- ordered.push({
333
- categoryId,
334
- categoryName: group.categoryName,
335
- unitPrice: group.unitPrice,
336
- baseUnitPrice: group.baseUnitPrice,
337
- serviceFee: group.serviceFee,
338
- seats: group.seats,
339
- availableToAdd: availableToAddByCategory.get(categoryId) ?? 0
340
- });
341
- }
342
- return ordered;
343
- }, [cartSeats, seatDetailsById, selectedSeatIdArray, venue.categories]);
344
- const cartPayload = react.useMemo(
345
- () => ({
346
- venueId: venue.id,
347
- venueName: venue.name,
348
- seats: cartSeats,
349
- totalSelectedSeats,
350
- totalCost
351
- }),
352
- [venue.id, venue.name, cartSeats, totalSelectedSeats, totalCost]
353
- );
354
- const emitCartEvent = react.useCallback(
355
- (event) => {
356
- onCartEvent?.(event);
357
- },
358
- [onCartEvent]
359
- );
360
- const removeSeatFromSelection = react.useCallback(
361
- (seatId) => {
362
- const seat = seatDetailsById.get(seatId);
363
- if (seat?.sectionId) {
364
- onSeatClick?.(seatId, seat.sectionId);
365
- }
366
- const next = selectedSeatIdArray.filter((id) => id !== seatId);
367
- setSelection(next);
368
- },
369
- [seatDetailsById, onSeatClick, selectedSeatIdArray, setSelection]
370
- );
371
- const handleSeatCanvasClick = react.useCallback(
372
- (seatId, sectionId) => {
373
- pendingSeatClickRef.current = seatId;
374
- onSeatClick?.(seatId, sectionId);
375
- },
376
- [onSeatClick]
377
- );
378
- const handleAddSeatInCategory = react.useCallback(
379
- (categoryId) => {
380
- const selectedSet = new Set(selectedSeatIdArray);
381
- const selectedInCategory = selectedSeatIdArray.filter(
382
- (selectedSeatId) => seatDetailsById.get(selectedSeatId)?.categoryId === categoryId
383
- );
384
- const anchorSeatId = (lastUserAnchorByCategory[categoryId] && seatDetailsById.has(lastUserAnchorByCategory[categoryId]) ? lastUserAnchorByCategory[categoryId] : null) ?? selectedInCategory[selectedInCategory.length - 1] ?? null;
385
- const anchorSeat = anchorSeatId ? seatDetailsById.get(anchorSeatId) : null;
386
- const candidates = Array.from(seatDetailsById.values()).filter(
387
- (seat) => seat.categoryId === categoryId && seat.status === seatmapCore.AVAILABLE_STATUS_ID && !selectedSet.has(seat.seatId)
388
- );
389
- if (candidates.length === 0) return;
390
- let nextSeat = candidates[0];
391
- if (anchorSeat) {
392
- nextSeat = candidates.reduce((best, candidate) => {
393
- const bestDistance = (best.x - anchorSeat.x) ** 2 + (best.y - anchorSeat.y) ** 2;
394
- const candidateDistance = (candidate.x - anchorSeat.x) ** 2 + (candidate.y - anchorSeat.y) ** 2;
395
- return candidateDistance < bestDistance ? candidate : best;
396
- }, candidates[0]);
397
- }
398
- setSelection([...selectedSeatIdArray, nextSeat.seatId]);
399
- if (nextSeat.sectionId) {
400
- onSeatClick?.(nextSeat.seatId, nextSeat.sectionId);
401
- }
402
- },
403
- [lastUserAnchorByCategory, seatDetailsById, selectedSeatIdArray, setSelection, onSeatClick]
404
- );
405
- const handleRemoveLastInCategory = react.useCallback(
406
- (categoryId) => {
407
- const selectedInCategory = selectedSeatIdArray.filter(
408
- (selectedSeatId) => seatDetailsById.get(selectedSeatId)?.categoryId === categoryId
409
- );
410
- const seatIdToRemove = selectedInCategory[selectedInCategory.length - 1];
411
- if (!seatIdToRemove) return;
412
- const seat = seatDetailsById.get(seatIdToRemove);
413
- if (seat?.sectionId) {
414
- onSeatClick?.(seatIdToRemove, seat.sectionId);
415
- }
416
- setSelection(selectedSeatIdArray.filter((selectedSeatId) => selectedSeatId !== seatIdToRemove));
417
- },
418
- [seatDetailsById, selectedSeatIdArray, setSelection, onSeatClick]
419
- );
420
- const handleProceed = react.useCallback(() => {
421
- if (cartPayload.seats.length === 0 || isSelectionOverLimit) return;
422
- emitCartEvent({ type: "cart-proceed-clicked", payload: cartPayload });
423
- }, [cartPayload, emitCartEvent, isSelectionOverLimit]);
424
- const cartWidth = viewportWidth > 1200 ? Math.floor(viewportWidth / 5) : viewportWidth;
425
- return /* @__PURE__ */ jsxRuntime.jsxs(
426
- "div",
427
- {
428
- className: classNames.root,
429
- style: mergeStyles({ width: "100%", height: "100%", position: "relative" }, styles.root),
430
- children: [
431
- /* @__PURE__ */ jsxRuntime.jsx(
432
- seatmapReact.SeatmapCanvas,
433
- {
434
- onSeatClick: handleSeatCanvasClick,
435
- onSeatHover,
436
- showSectionLabels: showLabels,
437
- enableSeatHover: showLabels
438
- }
439
- ),
440
- (showStatuses || showCategories) && /* @__PURE__ */ jsxRuntime.jsxs(
441
- "aside",
442
- {
443
- "aria-label": messages.legendAriaLabel,
444
- className: mergeClassNames("seatmap-viewer__legend", classNames.legendContainer),
445
- style: styles.legendContainer,
446
- children: [
447
- showStatuses && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "seatmap-viewer__legend-section", children: [
448
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: mergeClassNames("seatmap-viewer__legend-heading-base", classNames.legendHeading), style: styles.legendHeading, children: messages.legendStatusesTitle }),
449
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: mergeClassNames("seatmap-viewer__legend-list-base", classNames.legendList), style: styles.legendList, children: venue.seatStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: mergeClassNames("seatmap-viewer__legend-item-base", classNames.legendItem), style: styles.legendItem, children: [
450
- /* @__PURE__ */ jsxRuntime.jsx(
451
- "span",
452
- {
453
- className: mergeClassNames("seatmap-viewer__legend-swatch-base", classNames.legendSwatch),
454
- style: mergeStyles({ background: status.color }, styles.legendSwatch)
455
- }
456
- ),
457
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: status.name })
458
- ] }, status.id)) })
459
- ] }),
460
- showStatuses && showCategories && /* @__PURE__ */ jsxRuntime.jsx(
461
- "div",
462
- {
463
- className: mergeClassNames("seatmap-viewer__legend-divider-base", classNames.legendDivider),
464
- style: styles.legendDivider
465
- }
466
- ),
467
- showCategories && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "seatmap-viewer__legend-section", children: [
468
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: mergeClassNames("seatmap-viewer__legend-heading-base", classNames.legendHeading), style: styles.legendHeading, children: messages.legendPricesTitle }),
469
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: mergeClassNames("seatmap-viewer__legend-list-base", classNames.legendList), style: styles.legendList, children: venue.categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: mergeClassNames("seatmap-viewer__legend-item-base", classNames.legendItem), style: styles.legendItem, children: [
470
- /* @__PURE__ */ jsxRuntime.jsx(
471
- "span",
472
- {
473
- className: mergeClassNames("seatmap-viewer__legend-swatch-base", classNames.legendSwatch),
474
- style: mergeStyles({ background: category.color }, styles.legendSwatch)
475
- }
476
- ),
477
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: category.name })
478
- ] }, category.id)) })
479
- ] })
480
- ]
481
- }
482
- ),
483
- !isCartOpen && /* @__PURE__ */ jsxRuntime.jsx(
484
- "button",
485
- {
486
- type: "button",
487
- className: mergeClassNames("seatmap-viewer__cart-chip-base", classNames.cartChip),
488
- onClick: () => setIsCartOpen(true),
489
- disabled: isSelectionOverLimit,
490
- style: styles.cartChip,
491
- children: messages.cartChipLabel(totalSelectedSeats)
492
- }
493
- ),
494
- isCartOpen && /* @__PURE__ */ jsxRuntime.jsxs(
495
- "aside",
496
- {
497
- "aria-label": messages.cartAriaLabel,
498
- className: mergeClassNames("seatmap-viewer__cart-popup-base", classNames.cartPopup),
499
- style: mergeStyles({ width: cartWidth, maxWidth: "100%" }, styles.cartPopup),
500
- children: [
501
- /* @__PURE__ */ jsxRuntime.jsxs(
502
- "div",
503
- {
504
- className: mergeClassNames("seatmap-viewer__cart-header-base", classNames.cartHeader),
505
- style: styles.cartHeader,
506
- children: [
507
- /* @__PURE__ */ jsxRuntime.jsx(
508
- "strong",
509
- {
510
- className: mergeClassNames("seatmap-viewer__cart-header-title-base", classNames.cartHeaderTitle),
511
- style: styles.cartHeaderTitle,
512
- children: messages.cartHeaderTitle
513
- }
514
- ),
515
- /* @__PURE__ */ jsxRuntime.jsx(
516
- "button",
517
- {
518
- type: "button",
519
- onClick: () => setIsCartOpen(false),
520
- className: mergeClassNames("seatmap-viewer__cart-icon-button-base", classNames.cartIconButton),
521
- style: styles.cartIconButton,
522
- title: messages.cartCloseLabel,
523
- "aria-label": messages.cartCloseLabel,
524
- children: "x"
525
- }
526
- )
527
- ]
528
- }
529
- ),
530
- /* @__PURE__ */ jsxRuntime.jsx(
531
- "div",
532
- {
533
- className: mergeClassNames("seatmap-viewer__cart-body-base", classNames.cartBody),
534
- style: styles.cartBody,
535
- children: groupedSeatsList.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
536
- "div",
537
- {
538
- className: mergeClassNames("seatmap-viewer__cart-empty-state-base", classNames.cartEmptyState),
539
- style: styles.cartEmptyState,
540
- children: messages.cartEmptyState
541
- }
542
- ) : groupedSeatsList.map((group) => /* @__PURE__ */ jsxRuntime.jsxs(
543
- "article",
544
- {
545
- className: mergeClassNames("seatmap-viewer__cart-group-base", classNames.cartGroup),
546
- style: styles.cartGroup,
547
- children: [
548
- /* @__PURE__ */ jsxRuntime.jsx(
549
- "div",
550
- {
551
- className: mergeClassNames("seatmap-viewer__cart-group-title-base", classNames.cartGroupTitle),
552
- style: styles.cartGroupTitle,
553
- children: group.categoryName
554
- }
555
- ),
556
- /* @__PURE__ */ jsxRuntime.jsx(
557
- "div",
558
- {
559
- className: mergeClassNames("seatmap-viewer__cart-group-meta-base", classNames.cartGroupMeta),
560
- style: styles.cartGroupMeta,
561
- children: messages.cartGroupMeta(group.seats.length, formatMoney(group.unitPrice, locale, currency))
562
- }
563
- ),
564
- group.serviceFee > 0 && /* @__PURE__ */ jsxRuntime.jsx(
565
- "div",
566
- {
567
- className: mergeClassNames("seatmap-viewer__cart-group-meta-base", classNames.cartGroupMeta),
568
- style: styles.cartGroupMeta,
569
- children: messages.cartGroupFee(
570
- formatMoney(group.baseUnitPrice, locale, currency),
571
- formatMoney(group.serviceFee, locale, currency),
572
- group.baseUnitPrice > 0 ? formatPercent(group.serviceFee / group.baseUnitPrice, locale) : null
573
- )
574
- }
575
- ),
576
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: mergeClassNames("seatmap-viewer__cart-quantity-row-base", classNames.cartQuantityRow), style: styles.cartQuantityRow, children: [
577
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "seatmap-viewer__cart-quantity-controls", children: [
578
- /* @__PURE__ */ jsxRuntime.jsx(
579
- "button",
580
- {
581
- type: "button",
582
- className: mergeClassNames("seatmap-viewer__cart-icon-button-base", classNames.cartIconButton),
583
- style: styles.cartIconButton,
584
- onClick: () => handleRemoveLastInCategory(group.categoryId),
585
- disabled: group.seats.length === 0,
586
- "aria-label": messages.cartRemoveOneAriaLabel(group.categoryName),
587
- children: "-"
588
- }
589
- ),
590
- /* @__PURE__ */ jsxRuntime.jsx(
591
- "span",
592
- {
593
- className: mergeClassNames("seatmap-viewer__cart-quantity-value-base", classNames.cartQuantityValue),
594
- style: styles.cartQuantityValue,
595
- children: group.seats.length
596
- }
597
- ),
598
- /* @__PURE__ */ jsxRuntime.jsx(
599
- "button",
600
- {
601
- type: "button",
602
- className: mergeClassNames("seatmap-viewer__cart-icon-button-base", classNames.cartIconButton),
603
- style: styles.cartIconButton,
604
- onClick: () => handleAddSeatInCategory(group.categoryId),
605
- disabled: group.availableToAdd === 0,
606
- "aria-label": messages.cartAddOneAriaLabel(group.categoryName),
607
- children: "+"
608
- }
609
- )
610
- ] }),
611
- /* @__PURE__ */ jsxRuntime.jsx(
612
- "span",
613
- {
614
- className: mergeClassNames("seatmap-viewer__cart-group-total-base", classNames.cartGroupTotal),
615
- style: styles.cartGroupTotal,
616
- children: formatMoney(group.seats.reduce((sum, seat) => sum + seat.unitPrice, 0), locale, currency)
617
- }
618
- )
619
- ] }),
620
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "seatmap-viewer__cart-seat-list", children: group.seats.map((seat) => /* @__PURE__ */ jsxRuntime.jsxs(
621
- "div",
622
- {
623
- className: mergeClassNames("seatmap-viewer__cart-seat-row-base", classNames.cartSeatRow),
624
- style: styles.cartSeatRow,
625
- children: [
626
- /* @__PURE__ */ jsxRuntime.jsxs(
627
- "span",
628
- {
629
- className: mergeClassNames("seatmap-viewer__cart-seat-label-base", classNames.cartSeatLabel),
630
- style: styles.cartSeatLabel,
631
- children: [
632
- seat.sectionLabel ?? messages.sectionFallbackLabel,
633
- " ",
634
- seat.rowLabel ? `- ${seat.rowLabel}${seat.seatLabel}` : `- ${seat.seatLabel}`
635
- ]
636
- }
637
- ),
638
- /* @__PURE__ */ jsxRuntime.jsx(
639
- "button",
640
- {
641
- type: "button",
642
- className: mergeClassNames("seatmap-viewer__cart-icon-button-base", classNames.cartIconButton),
643
- style: styles.cartIconButton,
644
- onClick: () => removeSeatFromSelection(seat.seatId),
645
- title: messages.cartRemoveSeatTitle,
646
- "aria-label": messages.cartRemoveSeatAriaLabel(seat.seatLabel),
647
- children: /* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {})
648
- }
649
- )
650
- ]
651
- },
652
- seat.seatId
653
- )) })
654
- ]
655
- },
656
- group.categoryId
657
- ))
658
- }
659
- ),
660
- /* @__PURE__ */ jsxRuntime.jsxs(
661
- "div",
662
- {
663
- className: mergeClassNames("seatmap-viewer__cart-footer-base", classNames.cartFooter),
664
- style: styles.cartFooter,
665
- children: [
666
- /* @__PURE__ */ jsxRuntime.jsxs(
667
- "div",
668
- {
669
- className: mergeClassNames("seatmap-viewer__cart-summary-base", classNames.cartSummary),
670
- style: styles.cartSummary,
671
- children: [
672
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: messages.cartSummary(totalSelectedSeats, formatMoney(totalCost, locale, currency)) }),
673
- totalServiceFee > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: messages.cartServiceFeeSummary(formatMoney(totalServiceFee, locale, currency)) })
674
- ]
675
- }
676
- ),
677
- /* @__PURE__ */ jsxRuntime.jsx(
678
- "button",
679
- {
680
- type: "button",
681
- disabled: cartSeats.length === 0 || isSelectionOverLimit,
682
- onClick: handleProceed,
683
- className: mergeClassNames("seatmap-viewer__cart-proceed-button-base", classNames.cartProceedButton),
684
- style: styles.cartProceedButton,
685
- children: messages.cartProceedButton
686
- }
687
- )
688
- ]
689
- }
690
- )
691
- ]
692
- }
693
- ),
694
- showLabels && /* @__PURE__ */ jsxRuntime.jsx(seatmapReact.TooltipOverlay, { renderTooltip: effectiveTooltipRenderer })
695
- ]
696
- }
697
- );
136
+ function SeatmapViewerContent({ venue, onSeatClick, onSeatHover, onSelectionChange, renderTooltip, showLabels, onCartEvent, locale = "en-US", currency = "BYN", maxSelectedSeats, styles = {}, classNames = {}, messages: messagesOverride = {} }) {
137
+ const messages = (0, react.useMemo)(() => ({
138
+ ...defaultSeatmapViewerMessages,
139
+ ...messagesOverride
140
+ }), [messagesOverride]);
141
+ const { selectedSeatIds, setSelection } = (0, _nex125_seatmap_react.useSelection)();
142
+ const [isCartOpen, setIsCartOpen] = (0, react.useState)(false);
143
+ const [lastUserAnchorByCategory, setLastUserAnchorByCategory] = (0, react.useState)({});
144
+ const [viewportWidth, setViewportWidth] = (0, react.useState)(() => typeof window === "undefined" ? 1280 : window.innerWidth);
145
+ const previousSelectedRef = (0, react.useRef)([]);
146
+ const pendingSeatClickRef = (0, react.useRef)(null);
147
+ const showStatuses = venue.seatStatuses.length > 0;
148
+ const showCategories = venue.categories.length > 0;
149
+ const selectedSeatIdArray = (0, react.useMemo)(() => Array.from(selectedSeatIds), [selectedSeatIds]);
150
+ const seatDetailsById = (0, react.useMemo)(() => {
151
+ const categoryMap = new Map(venue.categories.map((category) => [category.id, category]));
152
+ const next = /* @__PURE__ */ new Map();
153
+ for (const section of venue.sections) {
154
+ const cos = Math.cos(section.rotation);
155
+ const sin = Math.sin(section.rotation);
156
+ for (const row of section.rows) for (const seat of row.seats) {
157
+ const category = categoryMap.get(seat.categoryId);
158
+ const priceBreakdown = getCategoryPriceBreakdown(category);
159
+ next.set(seat.id, {
160
+ seatId: seat.id,
161
+ seatLabel: seat.label,
162
+ rowLabel: row.label,
163
+ sectionId: section.id,
164
+ sectionLabel: section.label,
165
+ categoryId: seat.categoryId,
166
+ categoryName: category?.name ?? messages.uncategorizedCategoryName,
167
+ unitPrice: priceBreakdown.unitPrice,
168
+ baseUnitPrice: priceBreakdown.baseUnitPrice,
169
+ serviceFee: priceBreakdown.serviceFee,
170
+ status: seat.status,
171
+ x: section.position.x + seat.position.x * cos - seat.position.y * sin,
172
+ y: section.position.y + seat.position.x * sin + seat.position.y * cos
173
+ });
174
+ }
175
+ }
176
+ for (const table of venue.tables) for (const seat of table.seats) {
177
+ const category = categoryMap.get(seat.categoryId);
178
+ const priceBreakdown = getCategoryPriceBreakdown(category);
179
+ next.set(seat.id, {
180
+ seatId: seat.id,
181
+ seatLabel: seat.label,
182
+ rowLabel: null,
183
+ sectionId: table.id,
184
+ sectionLabel: messages.tableLabel(table.label),
185
+ categoryId: seat.categoryId,
186
+ categoryName: category?.name ?? messages.uncategorizedCategoryName,
187
+ unitPrice: priceBreakdown.unitPrice,
188
+ baseUnitPrice: priceBreakdown.baseUnitPrice,
189
+ serviceFee: priceBreakdown.serviceFee,
190
+ status: seat.status,
191
+ x: table.position.x + seat.position.x,
192
+ y: table.position.y + seat.position.y
193
+ });
194
+ }
195
+ return next;
196
+ }, [venue, messages]);
197
+ const selectedSeats = (0, react.useMemo)(() => {
198
+ const ordered = [];
199
+ for (const selectedSeatId of selectedSeatIdArray) {
200
+ const seat = seatDetailsById.get(selectedSeatId);
201
+ if (seat) ordered.push(seat);
202
+ }
203
+ return ordered;
204
+ }, [seatDetailsById, selectedSeatIdArray]);
205
+ (0, react.useEffect)(() => {
206
+ onSelectionChange?.(selectedSeatIdArray);
207
+ }, [onSelectionChange, selectedSeatIdArray]);
208
+ (0, react.useEffect)(() => {
209
+ const previous = new Set(previousSelectedRef.current);
210
+ const added = selectedSeatIdArray.filter((seatId) => !previous.has(seatId));
211
+ const clickedSeatId = pendingSeatClickRef.current;
212
+ if (clickedSeatId && added.includes(clickedSeatId)) {
213
+ const clickedSeat = seatDetailsById.get(clickedSeatId);
214
+ if (clickedSeat) setLastUserAnchorByCategory((current) => ({
215
+ ...current,
216
+ [clickedSeat.categoryId]: clickedSeatId
217
+ }));
218
+ }
219
+ previousSelectedRef.current = selectedSeatIdArray;
220
+ pendingSeatClickRef.current = null;
221
+ }, [seatDetailsById, selectedSeatIdArray]);
222
+ (0, react.useEffect)(() => {
223
+ if (typeof window === "undefined") return;
224
+ const onResize = () => setViewportWidth(window.innerWidth);
225
+ window.addEventListener("resize", onResize);
226
+ return () => window.removeEventListener("resize", onResize);
227
+ }, []);
228
+ const cartSeats = (0, react.useMemo)(() => selectedSeats.map((seat) => ({
229
+ seatId: seat.seatId,
230
+ seatLabel: seat.seatLabel,
231
+ rowLabel: seat.rowLabel,
232
+ sectionId: seat.sectionId,
233
+ sectionLabel: seat.sectionLabel,
234
+ categoryId: seat.categoryId,
235
+ categoryName: seat.categoryName,
236
+ unitPrice: seat.unitPrice,
237
+ baseUnitPrice: seat.baseUnitPrice,
238
+ serviceFee: seat.serviceFee
239
+ })), [selectedSeats]);
240
+ const totalSelectedSeats = (0, react.useMemo)(() => cartSeats.length, [cartSeats]);
241
+ const isSelectionOverLimit = typeof maxSelectedSeats === "number" && totalSelectedSeats > maxSelectedSeats;
242
+ const totalCost = (0, react.useMemo)(() => cartSeats.reduce((sum, seat) => sum + seat.unitPrice, 0), [cartSeats]);
243
+ const totalServiceFee = (0, react.useMemo)(() => cartSeats.reduce((sum, seat) => sum + seat.serviceFee, 0), [cartSeats]);
244
+ const effectiveTooltipRenderer = (0, react.useCallback)((data) => {
245
+ if (renderTooltip) return renderTooltip(data);
246
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultSeatmapViewerTooltip, {
247
+ data,
248
+ locale,
249
+ currency,
250
+ messages
251
+ });
252
+ }, [
253
+ currency,
254
+ locale,
255
+ messages,
256
+ renderTooltip
257
+ ]);
258
+ const groupedSeatsList = (0, react.useMemo)(() => {
259
+ const grouped = /* @__PURE__ */ new Map();
260
+ for (const seat of cartSeats) {
261
+ const existing = grouped.get(seat.categoryId);
262
+ if (existing) existing.seats.push(seat);
263
+ else grouped.set(seat.categoryId, {
264
+ categoryName: seat.categoryName,
265
+ unitPrice: seat.unitPrice,
266
+ baseUnitPrice: seat.baseUnitPrice,
267
+ serviceFee: seat.serviceFee,
268
+ seats: [seat]
269
+ });
270
+ }
271
+ const ordered = [];
272
+ const selectedSet = new Set(selectedSeatIdArray);
273
+ const availableToAddByCategory = /* @__PURE__ */ new Map();
274
+ for (const seat of seatDetailsById.values()) {
275
+ if (seat.status !== _nex125_seatmap_core.AVAILABLE_STATUS_ID || selectedSet.has(seat.seatId)) continue;
276
+ availableToAddByCategory.set(seat.categoryId, (availableToAddByCategory.get(seat.categoryId) ?? 0) + 1);
277
+ }
278
+ for (const category of venue.categories) {
279
+ const group = grouped.get(category.id);
280
+ if (!group) continue;
281
+ ordered.push({
282
+ categoryId: category.id,
283
+ categoryName: group.categoryName,
284
+ unitPrice: group.unitPrice,
285
+ baseUnitPrice: group.baseUnitPrice,
286
+ serviceFee: group.serviceFee,
287
+ seats: group.seats,
288
+ availableToAdd: availableToAddByCategory.get(category.id) ?? 0
289
+ });
290
+ }
291
+ for (const [categoryId, group] of grouped.entries()) {
292
+ if (venue.categories.some((category) => category.id === categoryId)) continue;
293
+ ordered.push({
294
+ categoryId,
295
+ categoryName: group.categoryName,
296
+ unitPrice: group.unitPrice,
297
+ baseUnitPrice: group.baseUnitPrice,
298
+ serviceFee: group.serviceFee,
299
+ seats: group.seats,
300
+ availableToAdd: availableToAddByCategory.get(categoryId) ?? 0
301
+ });
302
+ }
303
+ return ordered;
304
+ }, [
305
+ cartSeats,
306
+ seatDetailsById,
307
+ selectedSeatIdArray,
308
+ venue.categories
309
+ ]);
310
+ const cartPayload = (0, react.useMemo)(() => ({
311
+ venueId: venue.id,
312
+ venueName: venue.name,
313
+ seats: cartSeats,
314
+ totalSelectedSeats,
315
+ totalCost
316
+ }), [
317
+ venue.id,
318
+ venue.name,
319
+ cartSeats,
320
+ totalSelectedSeats,
321
+ totalCost
322
+ ]);
323
+ const emitCartEvent = (0, react.useCallback)((event) => {
324
+ onCartEvent?.(event);
325
+ }, [onCartEvent]);
326
+ const removeSeatFromSelection = (0, react.useCallback)((seatId) => {
327
+ const seat = seatDetailsById.get(seatId);
328
+ if (seat?.sectionId) onSeatClick?.(seatId, seat.sectionId);
329
+ const next = selectedSeatIdArray.filter((id) => id !== seatId);
330
+ setSelection(next);
331
+ }, [
332
+ seatDetailsById,
333
+ onSeatClick,
334
+ selectedSeatIdArray,
335
+ setSelection
336
+ ]);
337
+ const handleSeatCanvasClick = (0, react.useCallback)((seatId, sectionId) => {
338
+ pendingSeatClickRef.current = seatId;
339
+ onSeatClick?.(seatId, sectionId);
340
+ }, [onSeatClick]);
341
+ const handleAddSeatInCategory = (0, react.useCallback)((categoryId) => {
342
+ const selectedSet = new Set(selectedSeatIdArray);
343
+ const selectedInCategory = selectedSeatIdArray.filter((selectedSeatId) => seatDetailsById.get(selectedSeatId)?.categoryId === categoryId);
344
+ const anchorSeatId = (lastUserAnchorByCategory[categoryId] && seatDetailsById.has(lastUserAnchorByCategory[categoryId]) ? lastUserAnchorByCategory[categoryId] : null) ?? selectedInCategory[selectedInCategory.length - 1] ?? null;
345
+ const anchorSeat = anchorSeatId ? seatDetailsById.get(anchorSeatId) : null;
346
+ const candidates = Array.from(seatDetailsById.values()).filter((seat) => seat.categoryId === categoryId && seat.status === _nex125_seatmap_core.AVAILABLE_STATUS_ID && !selectedSet.has(seat.seatId));
347
+ if (candidates.length === 0) return;
348
+ let nextSeat = candidates[0];
349
+ if (anchorSeat) nextSeat = candidates.reduce((best, candidate) => {
350
+ const bestDistance = (best.x - anchorSeat.x) ** 2 + (best.y - anchorSeat.y) ** 2;
351
+ return (candidate.x - anchorSeat.x) ** 2 + (candidate.y - anchorSeat.y) ** 2 < bestDistance ? candidate : best;
352
+ }, candidates[0]);
353
+ setSelection([...selectedSeatIdArray, nextSeat.seatId]);
354
+ if (nextSeat.sectionId) onSeatClick?.(nextSeat.seatId, nextSeat.sectionId);
355
+ }, [
356
+ lastUserAnchorByCategory,
357
+ seatDetailsById,
358
+ selectedSeatIdArray,
359
+ setSelection,
360
+ onSeatClick
361
+ ]);
362
+ const handleRemoveLastInCategory = (0, react.useCallback)((categoryId) => {
363
+ const selectedInCategory = selectedSeatIdArray.filter((selectedSeatId) => seatDetailsById.get(selectedSeatId)?.categoryId === categoryId);
364
+ const seatIdToRemove = selectedInCategory[selectedInCategory.length - 1];
365
+ if (!seatIdToRemove) return;
366
+ const seat = seatDetailsById.get(seatIdToRemove);
367
+ if (seat?.sectionId) onSeatClick?.(seatIdToRemove, seat.sectionId);
368
+ setSelection(selectedSeatIdArray.filter((selectedSeatId) => selectedSeatId !== seatIdToRemove));
369
+ }, [
370
+ seatDetailsById,
371
+ selectedSeatIdArray,
372
+ setSelection,
373
+ onSeatClick
374
+ ]);
375
+ const handleProceed = (0, react.useCallback)(() => {
376
+ if (cartPayload.seats.length === 0 || isSelectionOverLimit) return;
377
+ emitCartEvent({
378
+ type: "cart-proceed-clicked",
379
+ payload: cartPayload
380
+ });
381
+ }, [
382
+ cartPayload,
383
+ emitCartEvent,
384
+ isSelectionOverLimit
385
+ ]);
386
+ const cartWidth = viewportWidth > 1200 ? Math.floor(viewportWidth / 5) : viewportWidth;
387
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
388
+ className: classNames.root,
389
+ style: mergeStyles({
390
+ width: "100%",
391
+ height: "100%",
392
+ position: "relative"
393
+ }, styles.root),
394
+ children: [
395
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_nex125_seatmap_react.SeatmapCanvas, {
396
+ onSeatClick: handleSeatCanvasClick,
397
+ onSeatHover,
398
+ showSectionLabels: showLabels,
399
+ enableSeatHover: showLabels
400
+ }),
401
+ (showStatuses || showCategories) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("aside", {
402
+ "aria-label": messages.legendAriaLabel,
403
+ className: mergeClassNames("seatmap-viewer__legend", classNames.legendContainer),
404
+ style: styles.legendContainer,
405
+ children: [
406
+ showStatuses && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
407
+ className: "seatmap-viewer__legend-section",
408
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
409
+ className: mergeClassNames("seatmap-viewer__legend-heading-base", classNames.legendHeading),
410
+ style: styles.legendHeading,
411
+ children: messages.legendStatusesTitle
412
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
413
+ className: mergeClassNames("seatmap-viewer__legend-list-base", classNames.legendList),
414
+ style: styles.legendList,
415
+ children: venue.seatStatuses.map((status) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
416
+ className: mergeClassNames("seatmap-viewer__legend-item-base", classNames.legendItem),
417
+ style: styles.legendItem,
418
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
419
+ className: mergeClassNames("seatmap-viewer__legend-swatch-base", classNames.legendSwatch),
420
+ style: mergeStyles({ background: status.color }, styles.legendSwatch)
421
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: status.name })]
422
+ }, status.id))
423
+ })]
424
+ }),
425
+ showStatuses && showCategories && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
426
+ className: mergeClassNames("seatmap-viewer__legend-divider-base", classNames.legendDivider),
427
+ style: styles.legendDivider
428
+ }),
429
+ showCategories && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
430
+ className: "seatmap-viewer__legend-section",
431
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
432
+ className: mergeClassNames("seatmap-viewer__legend-heading-base", classNames.legendHeading),
433
+ style: styles.legendHeading,
434
+ children: messages.legendPricesTitle
435
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
436
+ className: mergeClassNames("seatmap-viewer__legend-list-base", classNames.legendList),
437
+ style: styles.legendList,
438
+ children: venue.categories.map((category) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
439
+ className: mergeClassNames("seatmap-viewer__legend-item-base", classNames.legendItem),
440
+ style: styles.legendItem,
441
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
442
+ className: mergeClassNames("seatmap-viewer__legend-swatch-base", classNames.legendSwatch),
443
+ style: mergeStyles({ background: category.color }, styles.legendSwatch)
444
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: category.name })]
445
+ }, category.id))
446
+ })]
447
+ })
448
+ ]
449
+ }),
450
+ !isCartOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
451
+ type: "button",
452
+ className: mergeClassNames("seatmap-viewer__cart-chip-base", classNames.cartChip),
453
+ onClick: () => setIsCartOpen(true),
454
+ disabled: isSelectionOverLimit,
455
+ style: styles.cartChip,
456
+ children: messages.cartChipLabel(totalSelectedSeats)
457
+ }),
458
+ isCartOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("aside", {
459
+ "aria-label": messages.cartAriaLabel,
460
+ className: mergeClassNames("seatmap-viewer__cart-popup-base", classNames.cartPopup),
461
+ style: mergeStyles({
462
+ width: cartWidth,
463
+ maxWidth: "100%"
464
+ }, styles.cartPopup),
465
+ children: [
466
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
467
+ className: mergeClassNames("seatmap-viewer__cart-header-base", classNames.cartHeader),
468
+ style: styles.cartHeader,
469
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
470
+ className: mergeClassNames("seatmap-viewer__cart-header-title-base", classNames.cartHeaderTitle),
471
+ style: styles.cartHeaderTitle,
472
+ children: messages.cartHeaderTitle
473
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
474
+ type: "button",
475
+ onClick: () => setIsCartOpen(false),
476
+ className: mergeClassNames("seatmap-viewer__cart-icon-button-base", classNames.cartIconButton),
477
+ style: styles.cartIconButton,
478
+ title: messages.cartCloseLabel,
479
+ "aria-label": messages.cartCloseLabel,
480
+ children: "x"
481
+ })]
482
+ }),
483
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
484
+ className: mergeClassNames("seatmap-viewer__cart-body-base", classNames.cartBody),
485
+ style: styles.cartBody,
486
+ children: groupedSeatsList.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
487
+ className: mergeClassNames("seatmap-viewer__cart-empty-state-base", classNames.cartEmptyState),
488
+ style: styles.cartEmptyState,
489
+ children: messages.cartEmptyState
490
+ }) : groupedSeatsList.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
491
+ className: mergeClassNames("seatmap-viewer__cart-group-base", classNames.cartGroup),
492
+ style: styles.cartGroup,
493
+ children: [
494
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
495
+ className: mergeClassNames("seatmap-viewer__cart-group-title-base", classNames.cartGroupTitle),
496
+ style: styles.cartGroupTitle,
497
+ children: group.categoryName
498
+ }),
499
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
500
+ className: mergeClassNames("seatmap-viewer__cart-group-meta-base", classNames.cartGroupMeta),
501
+ style: styles.cartGroupMeta,
502
+ children: messages.cartGroupMeta(group.seats.length, formatMoney(group.unitPrice, locale, currency))
503
+ }),
504
+ group.serviceFee > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
505
+ className: mergeClassNames("seatmap-viewer__cart-group-meta-base", classNames.cartGroupMeta),
506
+ style: styles.cartGroupMeta,
507
+ children: messages.cartGroupFee(formatMoney(group.baseUnitPrice, locale, currency), formatMoney(group.serviceFee, locale, currency), group.baseUnitPrice > 0 ? formatPercent(group.serviceFee / group.baseUnitPrice, locale) : null)
508
+ }),
509
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
510
+ className: mergeClassNames("seatmap-viewer__cart-quantity-row-base", classNames.cartQuantityRow),
511
+ style: styles.cartQuantityRow,
512
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
513
+ className: "seatmap-viewer__cart-quantity-controls",
514
+ children: [
515
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
516
+ type: "button",
517
+ className: mergeClassNames("seatmap-viewer__cart-icon-button-base", classNames.cartIconButton),
518
+ style: styles.cartIconButton,
519
+ onClick: () => handleRemoveLastInCategory(group.categoryId),
520
+ disabled: group.seats.length === 0,
521
+ "aria-label": messages.cartRemoveOneAriaLabel(group.categoryName),
522
+ children: "-"
523
+ }),
524
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
525
+ className: mergeClassNames("seatmap-viewer__cart-quantity-value-base", classNames.cartQuantityValue),
526
+ style: styles.cartQuantityValue,
527
+ children: group.seats.length
528
+ }),
529
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
530
+ type: "button",
531
+ className: mergeClassNames("seatmap-viewer__cart-icon-button-base", classNames.cartIconButton),
532
+ style: styles.cartIconButton,
533
+ onClick: () => handleAddSeatInCategory(group.categoryId),
534
+ disabled: group.availableToAdd === 0,
535
+ "aria-label": messages.cartAddOneAriaLabel(group.categoryName),
536
+ children: "+"
537
+ })
538
+ ]
539
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
540
+ className: mergeClassNames("seatmap-viewer__cart-group-total-base", classNames.cartGroupTotal),
541
+ style: styles.cartGroupTotal,
542
+ children: formatMoney(group.seats.reduce((sum, seat) => sum + seat.unitPrice, 0), locale, currency)
543
+ })]
544
+ }),
545
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
546
+ className: "seatmap-viewer__cart-seat-list",
547
+ children: group.seats.map((seat) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
548
+ className: mergeClassNames("seatmap-viewer__cart-seat-row-base", classNames.cartSeatRow),
549
+ style: styles.cartSeatRow,
550
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
551
+ className: mergeClassNames("seatmap-viewer__cart-seat-label-base", classNames.cartSeatLabel),
552
+ style: styles.cartSeatLabel,
553
+ children: [
554
+ seat.sectionLabel ?? messages.sectionFallbackLabel,
555
+ " ",
556
+ seat.rowLabel ? `- ${seat.rowLabel}${seat.seatLabel}` : `- ${seat.seatLabel}`
557
+ ]
558
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
559
+ type: "button",
560
+ className: mergeClassNames("seatmap-viewer__cart-icon-button-base", classNames.cartIconButton),
561
+ style: styles.cartIconButton,
562
+ onClick: () => removeSeatFromSelection(seat.seatId),
563
+ title: messages.cartRemoveSeatTitle,
564
+ "aria-label": messages.cartRemoveSeatAriaLabel(seat.seatLabel),
565
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TrashIcon, {})
566
+ })]
567
+ }, seat.seatId))
568
+ })
569
+ ]
570
+ }, group.categoryId))
571
+ }),
572
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
573
+ className: mergeClassNames("seatmap-viewer__cart-footer-base", classNames.cartFooter),
574
+ style: styles.cartFooter,
575
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
576
+ className: mergeClassNames("seatmap-viewer__cart-summary-base", classNames.cartSummary),
577
+ style: styles.cartSummary,
578
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: messages.cartSummary(totalSelectedSeats, formatMoney(totalCost, locale, currency)) }), totalServiceFee > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: messages.cartServiceFeeSummary(formatMoney(totalServiceFee, locale, currency)) })]
579
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
580
+ type: "button",
581
+ disabled: cartSeats.length === 0 || isSelectionOverLimit,
582
+ onClick: handleProceed,
583
+ className: mergeClassNames("seatmap-viewer__cart-proceed-button-base", classNames.cartProceedButton),
584
+ style: styles.cartProceedButton,
585
+ children: messages.cartProceedButton
586
+ })]
587
+ })
588
+ ]
589
+ }),
590
+ showLabels && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_nex125_seatmap_react.TooltipOverlay, { renderTooltip: effectiveTooltipRenderer })
591
+ ]
592
+ });
698
593
  }
699
- function SeatmapViewer({
700
- venue,
701
- onSeatClick,
702
- onSeatHover,
703
- onSelectionChange,
704
- renderTooltip,
705
- showLabels = true,
706
- className,
707
- onCartEvent,
708
- locale,
709
- currency,
710
- maxSelectedSeats,
711
- styles,
712
- classNames,
713
- messages
714
- }) {
715
- return /* @__PURE__ */ jsxRuntime.jsx(seatmapReact.SeatmapProvider, { venue, children: /* @__PURE__ */ jsxRuntime.jsx(
716
- "div",
717
- {
718
- className: mergeClassNames(className, classNames?.root),
719
- style: mergeStyles({ width: "100%", height: "100%", position: "relative" }, styles?.root),
720
- children: /* @__PURE__ */ jsxRuntime.jsx(
721
- SeatmapViewerContent,
722
- {
723
- venue,
724
- onSeatClick,
725
- onSeatHover,
726
- onSelectionChange,
727
- renderTooltip,
728
- showLabels,
729
- onCartEvent,
730
- locale,
731
- currency,
732
- maxSelectedSeats,
733
- styles,
734
- classNames,
735
- messages
736
- }
737
- )
738
- }
739
- ) });
594
+ function SeatmapViewer({ venue, onSeatClick, onSeatHover, onSelectionChange, renderTooltip, showLabels = true, className, onCartEvent, locale, currency, maxSelectedSeats, styles, classNames, messages }) {
595
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_nex125_seatmap_react.SeatmapProvider, {
596
+ venue,
597
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
598
+ className: mergeClassNames(className, classNames?.root),
599
+ style: mergeStyles({
600
+ width: "100%",
601
+ height: "100%",
602
+ position: "relative"
603
+ }, styles?.root),
604
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SeatmapViewerContent, {
605
+ venue,
606
+ onSeatClick,
607
+ onSeatHover,
608
+ onSelectionChange,
609
+ renderTooltip,
610
+ showLabels,
611
+ onCartEvent,
612
+ locale,
613
+ currency,
614
+ maxSelectedSeats,
615
+ styles,
616
+ classNames,
617
+ messages
618
+ })
619
+ })
620
+ });
740
621
  }
741
-
742
622
  // src/styleContract.ts
743
- var seatmapViewerStyleSlots = [
744
- "root",
745
- "legendContainer",
746
- "legendHeading",
747
- "legendList",
748
- "legendItem",
749
- "legendSwatch",
750
- "legendDivider",
751
- "cartChip",
752
- "cartPopup",
753
- "cartHeader",
754
- "cartHeaderTitle",
755
- "cartIconButton",
756
- "cartBody",
757
- "cartEmptyState",
758
- "cartGroup",
759
- "cartGroupTitle",
760
- "cartGroupMeta",
761
- "cartQuantityRow",
762
- "cartQuantityValue",
763
- "cartGroupTotal",
764
- "cartSeatRow",
765
- "cartSeatLabel",
766
- "cartFooter",
767
- "cartSummary",
768
- "cartProceedButton"
623
+ const seatmapViewerStyleSlots = [
624
+ "root",
625
+ "legendContainer",
626
+ "legendHeading",
627
+ "legendList",
628
+ "legendItem",
629
+ "legendSwatch",
630
+ "legendDivider",
631
+ "cartChip",
632
+ "cartPopup",
633
+ "cartHeader",
634
+ "cartHeaderTitle",
635
+ "cartIconButton",
636
+ "cartBody",
637
+ "cartEmptyState",
638
+ "cartGroup",
639
+ "cartGroupTitle",
640
+ "cartGroupMeta",
641
+ "cartQuantityRow",
642
+ "cartQuantityValue",
643
+ "cartGroupTotal",
644
+ "cartSeatRow",
645
+ "cartSeatLabel",
646
+ "cartFooter",
647
+ "cartSummary",
648
+ "cartProceedButton"
769
649
  ];
770
- var STYLE_CONTRACT_CLASS_PREFIX = "seatmap-viewer";
771
- var seatmapViewerDefaultClassNames = {
772
- root: `${STYLE_CONTRACT_CLASS_PREFIX}__root`,
773
- legendContainer: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-container`,
774
- legendHeading: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-heading`,
775
- legendList: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-list`,
776
- legendItem: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-item`,
777
- legendSwatch: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-swatch`,
778
- legendDivider: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-divider`,
779
- cartChip: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-chip`,
780
- cartPopup: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-popup`,
781
- cartHeader: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-header`,
782
- cartHeaderTitle: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-header-title`,
783
- cartIconButton: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-icon-button`,
784
- cartBody: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-body`,
785
- cartEmptyState: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-empty-state`,
786
- cartGroup: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-group`,
787
- cartGroupTitle: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-group-title`,
788
- cartGroupMeta: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-group-meta`,
789
- cartQuantityRow: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-quantity-row`,
790
- cartQuantityValue: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-quantity-value`,
791
- cartGroupTotal: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-group-total`,
792
- cartSeatRow: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-seat-row`,
793
- cartSeatLabel: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-seat-label`,
794
- cartFooter: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-footer`,
795
- cartSummary: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-summary`,
796
- cartProceedButton: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-proceed-button`
650
+ const STYLE_CONTRACT_CLASS_PREFIX = "seatmap-viewer";
651
+ const seatmapViewerDefaultClassNames = {
652
+ root: `${STYLE_CONTRACT_CLASS_PREFIX}__root`,
653
+ legendContainer: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-container`,
654
+ legendHeading: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-heading`,
655
+ legendList: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-list`,
656
+ legendItem: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-item`,
657
+ legendSwatch: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-swatch`,
658
+ legendDivider: `${STYLE_CONTRACT_CLASS_PREFIX}__legend-divider`,
659
+ cartChip: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-chip`,
660
+ cartPopup: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-popup`,
661
+ cartHeader: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-header`,
662
+ cartHeaderTitle: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-header-title`,
663
+ cartIconButton: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-icon-button`,
664
+ cartBody: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-body`,
665
+ cartEmptyState: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-empty-state`,
666
+ cartGroup: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-group`,
667
+ cartGroupTitle: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-group-title`,
668
+ cartGroupMeta: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-group-meta`,
669
+ cartQuantityRow: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-quantity-row`,
670
+ cartQuantityValue: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-quantity-value`,
671
+ cartGroupTotal: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-group-total`,
672
+ cartSeatRow: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-seat-row`,
673
+ cartSeatLabel: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-seat-label`,
674
+ cartFooter: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-footer`,
675
+ cartSummary: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-summary`,
676
+ cartProceedButton: `${STYLE_CONTRACT_CLASS_PREFIX}__cart-proceed-button`
797
677
  };
798
- var seatmapViewerCssVariables = [
799
- "--seatmap-surface",
800
- "--seatmap-surface-elevated",
801
- "--seatmap-surface-muted",
802
- "--seatmap-on-surface",
803
- "--seatmap-on-surface-variant",
804
- "--seatmap-outline",
805
- "--seatmap-outline-variant",
806
- "--seatmap-primary",
807
- "--seatmap-on-primary",
808
- "--seatmap-error",
809
- "--seatmap-on-error",
810
- "--seatmap-state-layer-hover",
811
- "--seatmap-state-layer-pressed",
812
- "--seatmap-focus-ring",
813
- "--seatmap-radius-sm",
814
- "--seatmap-radius-md",
815
- "--seatmap-radius-lg",
816
- "--seatmap-shadow-raised",
817
- "--seatmap-shadow-elevated",
818
- "--seatmap-shadow-floating",
819
- "--seatmap-viewer-surface",
820
- "--seatmap-viewer-surface-elevated",
821
- "--seatmap-viewer-surface-muted",
822
- "--seatmap-viewer-border",
823
- "--seatmap-viewer-border-subtle",
824
- "--seatmap-viewer-text",
825
- "--seatmap-viewer-text-muted",
826
- "--seatmap-viewer-accent",
827
- "--seatmap-viewer-accent-disabled",
828
- "--seatmap-viewer-accent-text",
829
- "--seatmap-viewer-danger",
830
- "--seatmap-viewer-danger-text",
831
- "--seatmap-viewer-state-layer-hover",
832
- "--seatmap-viewer-state-layer-pressed",
833
- "--seatmap-viewer-focus-ring",
834
- "--seatmap-viewer-radius-sm",
835
- "--seatmap-viewer-radius-md",
836
- "--seatmap-viewer-radius-lg",
837
- "--seatmap-viewer-shadow-raised",
838
- "--seatmap-viewer-shadow-elevated",
839
- "--seatmap-viewer-shadow-floating"
678
+ const seatmapViewerCssVariables = [
679
+ "--seatmap-surface",
680
+ "--seatmap-surface-elevated",
681
+ "--seatmap-surface-muted",
682
+ "--seatmap-on-surface",
683
+ "--seatmap-on-surface-variant",
684
+ "--seatmap-outline",
685
+ "--seatmap-outline-variant",
686
+ "--seatmap-primary",
687
+ "--seatmap-on-primary",
688
+ "--seatmap-error",
689
+ "--seatmap-on-error",
690
+ "--seatmap-state-layer-hover",
691
+ "--seatmap-state-layer-pressed",
692
+ "--seatmap-focus-ring",
693
+ "--seatmap-radius-sm",
694
+ "--seatmap-radius-md",
695
+ "--seatmap-radius-lg",
696
+ "--seatmap-shadow-raised",
697
+ "--seatmap-shadow-elevated",
698
+ "--seatmap-shadow-floating",
699
+ "--seatmap-viewer-surface",
700
+ "--seatmap-viewer-surface-elevated",
701
+ "--seatmap-viewer-surface-muted",
702
+ "--seatmap-viewer-border",
703
+ "--seatmap-viewer-border-subtle",
704
+ "--seatmap-viewer-text",
705
+ "--seatmap-viewer-text-muted",
706
+ "--seatmap-viewer-accent",
707
+ "--seatmap-viewer-accent-disabled",
708
+ "--seatmap-viewer-accent-text",
709
+ "--seatmap-viewer-danger",
710
+ "--seatmap-viewer-danger-text",
711
+ "--seatmap-viewer-state-layer-hover",
712
+ "--seatmap-viewer-state-layer-pressed",
713
+ "--seatmap-viewer-focus-ring",
714
+ "--seatmap-viewer-radius-sm",
715
+ "--seatmap-viewer-radius-md",
716
+ "--seatmap-viewer-radius-lg",
717
+ "--seatmap-viewer-shadow-raised",
718
+ "--seatmap-viewer-shadow-elevated",
719
+ "--seatmap-viewer-shadow-floating"
840
720
  ];
841
- var seatmapViewerStyleContract = {
842
- slots: seatmapViewerStyleSlots,
843
- defaultClassNames: seatmapViewerDefaultClassNames,
844
- cssVariables: seatmapViewerCssVariables
721
+ const seatmapViewerStyleContract = {
722
+ slots: seatmapViewerStyleSlots,
723
+ defaultClassNames: seatmapViewerDefaultClassNames,
724
+ cssVariables: seatmapViewerCssVariables
845
725
  };
846
-
847
726
  // src/theme/seatmapViewerTheme.ts
848
- var seatmapViewerSharedThemeRootClassName = "seatmap-viewer-theme";
849
- var seatmapViewerSharedThemeClassNames = {
850
- ...seatmapViewerDefaultClassNames
851
- };
852
- var seatmapViewerSharedThemeVariables = {
853
- "--seatmap-surface": "var(--ds-surface-container-low, rgba(24, 24, 24, 0.94))",
854
- "--seatmap-surface-elevated": "var(--ds-surface-container, rgba(28, 28, 28, 0.98))",
855
- "--seatmap-surface-muted": "var(--ds-surface-container-high, rgba(33, 33, 33, 1))",
856
- "--seatmap-on-surface": "var(--ds-on-surface, #e5e2e1)",
857
- "--seatmap-on-surface-variant": "var(--ds-on-surface-variant, #9a9694)",
858
- "--seatmap-outline": "var(--ds-input-border, rgba(92, 89, 87, 0.65))",
859
- "--seatmap-outline-variant": "var(--ds-border-subtle, rgba(92, 89, 87, 0.45))",
860
- "--seatmap-primary": "var(--ds-primary, #6f663a)",
861
- "--seatmap-on-primary": "var(--ds-on-primary, #f5edc7)",
862
- "--seatmap-error": "var(--ds-error, #ad3f3f)",
863
- "--seatmap-on-error": "var(--ds-on-error, #ffffff)",
864
- "--seatmap-state-layer-hover": "var(--ds-primary-wash, color-mix(in srgb, var(--ds-primary, #6f663a) 12%, transparent))",
865
- "--seatmap-state-layer-pressed": "var(--ds-primary-wash-strong, color-mix(in srgb, var(--ds-primary, #6f663a) 16%, transparent))",
866
- "--seatmap-focus-ring": "var(--ds-primary-ring, color-mix(in srgb, var(--ds-primary, #6f663a) 55%, transparent))",
867
- "--seatmap-radius-sm": "var(--ds-radius-structural-sm, 8px)",
868
- "--seatmap-radius-md": "var(--ds-radius-structural, 10px)",
869
- "--seatmap-radius-lg": "calc(var(--ds-radius-structural, 10px) + 6px)",
870
- "--seatmap-shadow-raised": "var(--ds-shadow-ambient-sm, 0 8px 20px rgba(0, 0, 0, 0.22))",
871
- "--seatmap-shadow-elevated": "var(--ds-shadow-ambient, 0 10px 24px rgba(0, 0, 0, 0.28))",
872
- "--seatmap-shadow-floating": "var(--ds-shadow-ambient-lg, 0 14px 34px rgba(0, 0, 0, 0.32))",
873
- "--seatmap-viewer-surface": "var(--seatmap-surface)",
874
- "--seatmap-viewer-surface-elevated": "var(--seatmap-surface-elevated)",
875
- "--seatmap-viewer-surface-muted": "var(--seatmap-surface-muted)",
876
- "--seatmap-viewer-border": "var(--seatmap-outline)",
877
- "--seatmap-viewer-border-subtle": "var(--seatmap-outline-variant)",
878
- "--seatmap-viewer-text": "var(--seatmap-on-surface)",
879
- "--seatmap-viewer-text-muted": "var(--seatmap-on-surface-variant)",
880
- "--seatmap-viewer-accent": "var(--seatmap-primary)",
881
- "--seatmap-viewer-accent-disabled": "color-mix(in srgb, var(--seatmap-primary) 28%, var(--seatmap-surface-muted))",
882
- "--seatmap-viewer-accent-text": "var(--seatmap-on-primary)",
883
- "--seatmap-viewer-danger": "var(--seatmap-error)",
884
- "--seatmap-viewer-danger-text": "var(--seatmap-on-error)",
885
- "--seatmap-viewer-state-layer-hover": "var(--seatmap-state-layer-hover)",
886
- "--seatmap-viewer-state-layer-pressed": "var(--seatmap-state-layer-pressed)",
887
- "--seatmap-viewer-focus-ring": "var(--seatmap-focus-ring)",
888
- "--seatmap-viewer-radius-sm": "var(--seatmap-radius-sm)",
889
- "--seatmap-viewer-radius-md": "var(--seatmap-radius-md)",
890
- "--seatmap-viewer-radius-lg": "var(--seatmap-radius-lg)",
891
- "--seatmap-viewer-shadow-raised": "var(--seatmap-shadow-raised)",
892
- "--seatmap-viewer-shadow-elevated": "var(--seatmap-shadow-elevated)",
893
- "--seatmap-viewer-shadow-floating": "var(--seatmap-shadow-floating)"
727
+ const seatmapViewerSharedThemeRootClassName = "seatmap-viewer-theme";
728
+ const seatmapViewerSharedThemeClassNames = { ...seatmapViewerDefaultClassNames };
729
+ const seatmapViewerSharedThemeVariables = {
730
+ "--seatmap-surface": "var(--ds-surface-container-low, rgba(24, 24, 24, 0.94))",
731
+ "--seatmap-surface-elevated": "var(--ds-surface-container, rgba(28, 28, 28, 0.98))",
732
+ "--seatmap-surface-muted": "var(--ds-surface-container-high, rgba(33, 33, 33, 1))",
733
+ "--seatmap-on-surface": "var(--ds-on-surface, #e5e2e1)",
734
+ "--seatmap-on-surface-variant": "var(--ds-on-surface-variant, #9a9694)",
735
+ "--seatmap-outline": "var(--ds-input-border, rgba(92, 89, 87, 0.65))",
736
+ "--seatmap-outline-variant": "var(--ds-border-subtle, rgba(92, 89, 87, 0.45))",
737
+ "--seatmap-primary": "var(--ds-primary, #6f663a)",
738
+ "--seatmap-on-primary": "var(--ds-on-primary, #f5edc7)",
739
+ "--seatmap-error": "var(--ds-error, #ad3f3f)",
740
+ "--seatmap-on-error": "var(--ds-on-error, #ffffff)",
741
+ "--seatmap-state-layer-hover": "var(--ds-primary-wash, color-mix(in srgb, var(--ds-primary, #6f663a) 12%, transparent))",
742
+ "--seatmap-state-layer-pressed": "var(--ds-primary-wash-strong, color-mix(in srgb, var(--ds-primary, #6f663a) 16%, transparent))",
743
+ "--seatmap-focus-ring": "var(--ds-primary-ring, color-mix(in srgb, var(--ds-primary, #6f663a) 55%, transparent))",
744
+ "--seatmap-radius-sm": "var(--ds-radius-structural-sm, 8px)",
745
+ "--seatmap-radius-md": "var(--ds-radius-structural, 10px)",
746
+ "--seatmap-radius-lg": "calc(var(--ds-radius-structural, 10px) + 6px)",
747
+ "--seatmap-shadow-raised": "var(--ds-shadow-ambient-sm, 0 8px 20px rgba(0, 0, 0, 0.22))",
748
+ "--seatmap-shadow-elevated": "var(--ds-shadow-ambient, 0 10px 24px rgba(0, 0, 0, 0.28))",
749
+ "--seatmap-shadow-floating": "var(--ds-shadow-ambient-lg, 0 14px 34px rgba(0, 0, 0, 0.32))",
750
+ "--seatmap-viewer-surface": "var(--seatmap-surface)",
751
+ "--seatmap-viewer-surface-elevated": "var(--seatmap-surface-elevated)",
752
+ "--seatmap-viewer-surface-muted": "var(--seatmap-surface-muted)",
753
+ "--seatmap-viewer-border": "var(--seatmap-outline)",
754
+ "--seatmap-viewer-border-subtle": "var(--seatmap-outline-variant)",
755
+ "--seatmap-viewer-text": "var(--seatmap-on-surface)",
756
+ "--seatmap-viewer-text-muted": "var(--seatmap-on-surface-variant)",
757
+ "--seatmap-viewer-accent": "var(--seatmap-primary)",
758
+ "--seatmap-viewer-accent-disabled": "color-mix(in srgb, var(--seatmap-primary) 28%, var(--seatmap-surface-muted))",
759
+ "--seatmap-viewer-accent-text": "var(--seatmap-on-primary)",
760
+ "--seatmap-viewer-danger": "var(--seatmap-error)",
761
+ "--seatmap-viewer-danger-text": "var(--seatmap-on-error)",
762
+ "--seatmap-viewer-state-layer-hover": "var(--seatmap-state-layer-hover)",
763
+ "--seatmap-viewer-state-layer-pressed": "var(--seatmap-state-layer-pressed)",
764
+ "--seatmap-viewer-focus-ring": "var(--seatmap-focus-ring)",
765
+ "--seatmap-viewer-radius-sm": "var(--seatmap-radius-sm)",
766
+ "--seatmap-viewer-radius-md": "var(--seatmap-radius-md)",
767
+ "--seatmap-viewer-radius-lg": "var(--seatmap-radius-lg)",
768
+ "--seatmap-viewer-shadow-raised": "var(--seatmap-shadow-raised)",
769
+ "--seatmap-viewer-shadow-elevated": "var(--seatmap-shadow-elevated)",
770
+ "--seatmap-viewer-shadow-floating": "var(--seatmap-shadow-floating)"
894
771
  };
895
- var seatmapViewerSharedTheme = {
896
- rootClassName: seatmapViewerSharedThemeRootClassName,
897
- classNames: seatmapViewerSharedThemeClassNames,
898
- variables: seatmapViewerSharedThemeVariables
772
+ const seatmapViewerSharedTheme = {
773
+ rootClassName: seatmapViewerSharedThemeRootClassName,
774
+ classNames: seatmapViewerSharedThemeClassNames,
775
+ variables: seatmapViewerSharedThemeVariables
899
776
  };
900
777
  function getSeatmapViewerSharedThemeRootStyle(overrides) {
901
- return {
902
- ...seatmapViewerSharedThemeVariables,
903
- ...overrides ?? {}
904
- };
778
+ return {
779
+ ...seatmapViewerSharedThemeVariables,
780
+ ...overrides ?? {}
781
+ };
905
782
  }
906
-
907
- Object.defineProperty(exports, "useSeatStatus", {
908
- enumerable: true,
909
- get: function () { return seatmapReact.useSeatStatus; }
910
- });
911
783
  exports.SeatmapViewer = SeatmapViewer;
912
784
  exports.SeatmapViewerContent = SeatmapViewerContent;
913
785
  exports.defaultSeatmapViewerMessages = defaultSeatmapViewerMessages;
@@ -920,5 +792,11 @@ exports.seatmapViewerSharedThemeRootClassName = seatmapViewerSharedThemeRootClas
920
792
  exports.seatmapViewerSharedThemeVariables = seatmapViewerSharedThemeVariables;
921
793
  exports.seatmapViewerStyleContract = seatmapViewerStyleContract;
922
794
  exports.seatmapViewerStyleSlots = seatmapViewerStyleSlots;
923
- //# sourceMappingURL=index.cjs.map
795
+ Object.defineProperty(exports, "useSeatStatus", {
796
+ enumerable: true,
797
+ get: function() {
798
+ return _nex125_seatmap_react.useSeatStatus;
799
+ }
800
+ });
801
+
924
802
  //# sourceMappingURL=index.cjs.map