@zonetrix/viewer 2.11.0 → 2.11.1

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.
@@ -21,14 +21,14 @@ export interface SeatMapViewerProps {
21
21
  onConfigLoad?: (config: SeatMapConfig) => void;
22
22
  onError?: (error: Error) => void;
23
23
  showFloorSelector?: boolean;
24
- floorSelectorPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
24
+ floorSelectorPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
25
25
  floorSelectorClassName?: string;
26
26
  showAllFloorsOption?: boolean;
27
27
  allFloorsLabel?: string;
28
28
  fitToView?: boolean;
29
29
  fitPadding?: number;
30
30
  showZoomControls?: boolean;
31
- zoomControlsPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
31
+ zoomControlsPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
32
32
  zoomControlsClassName?: string;
33
33
  /**
34
34
  * Minimum zoom level.
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@ export { useConfigFetcher } from './hooks/useConfigFetcher';
6
6
  export { useContainerSize } from './hooks/useContainerSize';
7
7
  export { useTouchGestures } from './hooks/useTouchGestures';
8
8
  export { useFirebaseSeatStates } from './hooks/useFirebaseSeatStates';
9
- export type { UseFirebaseSeatStatesOptions, UseFirebaseSeatStatesResult } from './hooks/useFirebaseSeatStates';
9
+ export type { UseFirebaseSeatStatesOptions, UseFirebaseSeatStatesResult, } from './hooks/useFirebaseSeatStates';
10
10
  export { useFirebaseConfig } from './hooks/useFirebaseConfig';
11
- export type { UseFirebaseConfigOptions, UseFirebaseConfigResult } from './hooks/useFirebaseConfig';
11
+ export type { UseFirebaseConfigOptions, UseFirebaseConfigResult, } from './hooks/useFirebaseConfig';
12
12
  export { useRealtimeSeatMap } from './hooks/useRealtimeSeatMap';
13
- export type { UseRealtimeSeatMapOptions, UseRealtimeSeatMapResult } from './hooks/useRealtimeSeatMap';
13
+ export type { UseRealtimeSeatMapOptions, UseRealtimeSeatMapResult, } from './hooks/useRealtimeSeatMap';
14
14
  export { initializeFirebaseForViewer, isFirebaseInitialized, clearFirebaseInstance, } from './firebase/client';
package/dist/index.mjs CHANGED
@@ -88,7 +88,11 @@ function Ct(n, r) {
88
88
  }, s = (a) => {
89
89
  a.touches.length < 2 && (t.current = null, o.current = null);
90
90
  };
91
- return i.addEventListener("touchstart", S, { passive: !1 }), i.addEventListener("touchmove", p, { passive: !1 }), i.addEventListener("touchend", s), () => {
91
+ return i.addEventListener("touchstart", S, {
92
+ passive: !1
93
+ }), i.addEventListener("touchmove", p, {
94
+ passive: !1
95
+ }), i.addEventListener("touchend", s), () => {
92
96
  i.removeEventListener("touchstart", S), i.removeEventListener("touchmove", p), i.removeEventListener("touchend", s);
93
97
  };
94
98
  }, [n, r]);
@@ -103,59 +107,64 @@ const Rt = {
103
107
  seatHidden: "#4a4a4a",
104
108
  gridLines: "#404040",
105
109
  currency: "KD"
106
- }, ke = J(({ seat: n, state: r, colors: t, onClick: o, onMouseEnter: d, onMouseLeave: l }) => {
107
- const p = {
108
- available: t.seatAvailable,
109
- reserved: t.seatReserved,
110
- selected: t.seatSelected,
111
- unavailable: t.seatUnavailable,
112
- hidden: t.seatHidden
113
- // Hidden seats are filtered out, but included for type safety
114
- }[r], s = r === "available" || r === "selected", a = z(() => {
115
- s && o(n);
116
- }, [n, o, s]), f = z((g) => {
117
- d(n, g);
118
- const C = g.target.getStage();
119
- C && s && (C.container().style.cursor = "pointer");
120
- }, [n, d, s]), b = z((g) => {
121
- l();
122
- const C = g.target.getStage();
123
- C && (C.container().style.cursor = "grab");
124
- }, [l]), x = {
125
- x: n.position.x,
126
- y: n.position.y,
127
- fill: p,
128
- stroke: "#ffffff",
129
- strokeWidth: 1,
130
- onClick: a,
131
- onTap: a,
132
- onMouseEnter: f,
133
- onMouseLeave: b
134
- };
135
- return n.shape === "circle" ? /* @__PURE__ */ u(
136
- ze,
137
- {
138
- ...x,
139
- radius: 12
140
- }
141
- ) : /* @__PURE__ */ u(
142
- De,
143
- {
144
- ...x,
145
- width: 24,
146
- height: 24,
147
- offsetX: 12,
148
- offsetY: 12,
149
- cornerRadius: n.shape === "square" ? 0 : 4
150
- }
151
- );
152
- });
110
+ }, ke = J(
111
+ ({ seat: n, state: r, colors: t, onClick: o, onMouseEnter: d, onMouseLeave: l }) => {
112
+ const p = {
113
+ available: t.seatAvailable,
114
+ reserved: t.seatReserved,
115
+ selected: t.seatSelected,
116
+ unavailable: t.seatUnavailable,
117
+ hidden: t.seatHidden
118
+ // Hidden seats are filtered out, but included for type safety
119
+ }[r], s = r === "available" || r === "selected", a = z(() => {
120
+ s && o(n);
121
+ }, [n, o, s]), f = z(
122
+ (g) => {
123
+ d(n, g);
124
+ const C = g.target.getStage();
125
+ C && s && (C.container().style.cursor = "pointer");
126
+ },
127
+ [n, d, s]
128
+ ), b = z(
129
+ (g) => {
130
+ l();
131
+ const C = g.target.getStage();
132
+ C && (C.container().style.cursor = "grab");
133
+ },
134
+ [l]
135
+ ), x = {
136
+ x: n.position.x,
137
+ y: n.position.y,
138
+ fill: p,
139
+ stroke: "#ffffff",
140
+ strokeWidth: 1,
141
+ onClick: a,
142
+ onTap: a,
143
+ onMouseEnter: f,
144
+ onMouseLeave: b
145
+ };
146
+ return n.shape === "circle" ? /* @__PURE__ */ u(ze, { ...x, radius: 12 }) : /* @__PURE__ */ u(
147
+ De,
148
+ {
149
+ ...x,
150
+ width: 24,
151
+ height: 24,
152
+ offsetX: 12,
153
+ offsetY: 12,
154
+ cornerRadius: n.shape === "square" ? 0 : 4
155
+ }
156
+ );
157
+ }
158
+ );
153
159
  ke.displayName = "ViewerSeat";
154
160
  const We = J(({ stage: n, stageColor: r }) => {
155
161
  const t = n.config, o = t.shape || "rectangle", d = t.showLabel !== !1, l = t.color || r, i = t.width / t.height, S = i < 0.5, p = i > 2;
156
162
  let s;
157
163
  S ? s = t.width * 0.25 : p ? s = t.height * 0.35 : s = Math.min(t.width, t.height) * 0.25;
158
- const a = t.label?.length || 6, x = t.width * 0.85 / a * 1.5, g = Math.max(10, Math.min(24, Math.min(s, x))), C = 4, E = Math.max(20, t.width - C * 2), F = (t.width - E) / 2, R = {
164
+ const a = t.label?.length || 6, x = t.width * 0.85 / a * 1.5, g = Math.max(
165
+ 10,
166
+ Math.min(24, Math.min(s, x))
167
+ ), C = 4, E = Math.max(20, t.width - C * 2), F = (t.width - E) / 2, R = {
159
168
  fill: l + "80",
160
169
  stroke: "#ffffff",
161
170
  strokeWidth: 2,
@@ -205,26 +214,34 @@ const We = J(({ stage: n, stageColor: r }) => {
205
214
  );
206
215
  }
207
216
  };
208
- return /* @__PURE__ */ D(bt, { x: n.position.x, y: n.position.y, rotation: t.rotation || 0, children: [
209
- I(),
210
- d && /* @__PURE__ */ u(
211
- Te,
212
- {
213
- text: t.label,
214
- x: F,
215
- y: C,
216
- width: E,
217
- height: t.height - C * 2,
218
- fontSize: g,
219
- fontStyle: "bold",
220
- fill: "#ffffff",
221
- align: "center",
222
- verticalAlign: "middle",
223
- wrap: "word",
224
- ellipsis: !0
225
- }
226
- )
227
- ] });
217
+ return /* @__PURE__ */ D(
218
+ bt,
219
+ {
220
+ x: n.position.x,
221
+ y: n.position.y,
222
+ rotation: t.rotation || 0,
223
+ children: [
224
+ I(),
225
+ d && /* @__PURE__ */ u(
226
+ Te,
227
+ {
228
+ text: t.label,
229
+ x: F,
230
+ y: C,
231
+ width: E,
232
+ height: t.height - C * 2,
233
+ fontSize: g,
234
+ fontStyle: "bold",
235
+ fill: "#ffffff",
236
+ align: "center",
237
+ verticalAlign: "middle",
238
+ wrap: "word",
239
+ ellipsis: !0
240
+ }
241
+ )
242
+ ]
243
+ }
244
+ );
228
245
  });
229
246
  We.displayName = "ViewerStage";
230
247
  const Pe = J(({ text: n }) => /* @__PURE__ */ u(
@@ -240,208 +257,199 @@ const Pe = J(({ text: n }) => /* @__PURE__ */ u(
240
257
  }
241
258
  ));
242
259
  Pe.displayName = "ViewerText";
243
- const Xe = J(({
244
- floors: n,
245
- currentFloorId: r,
246
- onFloorChange: t,
247
- showAllOption: o,
248
- allLabel: d,
249
- position: l,
250
- className: i
251
- }) => {
252
- const S = A(
253
- () => [...n].sort((b, x) => b.order - x.order),
254
- [n]
255
- ), s = {
256
- position: "absolute",
257
- display: "flex",
258
- alignItems: "center",
259
- gap: "8px",
260
- padding: "8px 12px",
261
- backgroundColor: "rgba(26, 26, 26, 0.95)",
262
- borderRadius: "8px",
263
- margin: "12px",
264
- zIndex: 10,
265
- ...{
266
- "top-left": { top: 0, left: 0 },
267
- "top-right": { top: 0, right: 0 },
268
- "bottom-left": { bottom: 0, left: 0 },
269
- "bottom-right": { bottom: 0, right: 0 }
270
- }[l]
271
- }, a = {
272
- padding: "10px 16px",
273
- fontSize: "14px",
274
- fontWeight: 500,
275
- border: "1px solid #444",
276
- borderRadius: "6px",
277
- backgroundColor: "transparent",
278
- color: "#fff",
279
- cursor: "pointer",
280
- transition: "all 0.2s ease",
281
- minHeight: "44px",
282
- touchAction: "manipulation"
283
- }, f = {
284
- ...a,
285
- backgroundColor: "#3A7DE5",
286
- borderColor: "#3A7DE5"
287
- };
288
- return /* @__PURE__ */ D("div", { className: i, style: s, children: [
289
- o && /* @__PURE__ */ u(
290
- "button",
291
- {
292
- type: "button",
293
- onClick: () => t(null),
294
- style: r === null ? f : a,
295
- children: d
296
- }
297
- ),
298
- S.map((b) => /* @__PURE__ */ u(
299
- "button",
300
- {
301
- type: "button",
302
- onClick: () => t(b.id),
303
- style: r === b.id ? f : a,
304
- children: b.name
305
- },
306
- b.id
307
- ))
308
- ] });
309
- });
260
+ const Xe = J(
261
+ ({
262
+ floors: n,
263
+ currentFloorId: r,
264
+ onFloorChange: t,
265
+ showAllOption: o,
266
+ allLabel: d,
267
+ position: l,
268
+ className: i
269
+ }) => {
270
+ const S = A(
271
+ () => [...n].sort((b, x) => b.order - x.order),
272
+ [n]
273
+ ), s = {
274
+ position: "absolute",
275
+ display: "flex",
276
+ alignItems: "center",
277
+ gap: "8px",
278
+ padding: "8px 12px",
279
+ backgroundColor: "rgba(26, 26, 26, 0.95)",
280
+ borderRadius: "8px",
281
+ margin: "12px",
282
+ zIndex: 10,
283
+ ...{
284
+ "top-left": { top: 0, left: 0 },
285
+ "top-right": { top: 0, right: 0 },
286
+ "bottom-left": { bottom: 0, left: 0 },
287
+ "bottom-right": { bottom: 0, right: 0 }
288
+ }[l]
289
+ }, a = {
290
+ padding: "10px 16px",
291
+ fontSize: "14px",
292
+ fontWeight: 500,
293
+ border: "1px solid #444",
294
+ borderRadius: "6px",
295
+ backgroundColor: "transparent",
296
+ color: "#fff",
297
+ cursor: "pointer",
298
+ transition: "all 0.2s ease",
299
+ minHeight: "44px",
300
+ touchAction: "manipulation"
301
+ }, f = {
302
+ ...a,
303
+ backgroundColor: "#3A7DE5",
304
+ borderColor: "#3A7DE5"
305
+ };
306
+ return /* @__PURE__ */ D("div", { className: i, style: s, children: [
307
+ o && /* @__PURE__ */ u(
308
+ "button",
309
+ {
310
+ type: "button",
311
+ onClick: () => t(null),
312
+ style: r === null ? f : a,
313
+ children: d
314
+ }
315
+ ),
316
+ S.map((b) => /* @__PURE__ */ u(
317
+ "button",
318
+ {
319
+ type: "button",
320
+ onClick: () => t(b.id),
321
+ style: r === b.id ? f : a,
322
+ children: b.name
323
+ },
324
+ b.id
325
+ ))
326
+ ] });
327
+ }
328
+ );
310
329
  Xe.displayName = "FloorSelectorBar";
311
- const Ye = J(({
312
- scale: n,
313
- minScale: r,
314
- maxScale: t,
315
- onZoomIn: o,
316
- onZoomOut: d,
317
- position: l,
318
- className: i
319
- }) => {
320
- const p = {
321
- position: "absolute",
322
- display: "flex",
323
- flexDirection: "column",
324
- gap: "4px",
325
- padding: "8px",
326
- backgroundColor: "rgba(26, 26, 26, 0.95)",
327
- borderRadius: "8px",
328
- margin: "12px",
329
- zIndex: 10,
330
- ...{
331
- "top-left": { top: 0, left: 0 },
332
- "top-right": { top: 0, right: 0 },
333
- "bottom-left": { bottom: 0, left: 0 },
334
- "bottom-right": { bottom: 0, right: 0 }
335
- }[l]
336
- }, s = {
337
- width: "44px",
338
- height: "44px",
339
- minWidth: "44px",
340
- minHeight: "44px",
341
- fontSize: "22px",
342
- fontWeight: "bold",
343
- border: "1px solid #444",
344
- borderRadius: "6px",
345
- backgroundColor: "transparent",
346
- color: "#fff",
347
- cursor: "pointer",
348
- display: "flex",
349
- alignItems: "center",
350
- justifyContent: "center",
351
- transition: "all 0.2s ease",
352
- touchAction: "manipulation"
353
- }, a = {
354
- ...s,
355
- opacity: 0.4,
356
- cursor: "not-allowed"
357
- }, f = n < t, b = n > r;
358
- return /* @__PURE__ */ D("div", { className: i, style: p, children: [
359
- /* @__PURE__ */ u(
360
- "button",
361
- {
362
- type: "button",
363
- onClick: o,
364
- disabled: !f,
365
- style: f ? s : a,
366
- title: "Zoom In",
367
- children: "+"
368
- }
369
- ),
370
- /* @__PURE__ */ u(
371
- "button",
372
- {
373
- type: "button",
374
- onClick: d,
375
- disabled: !b,
376
- style: b ? s : a,
377
- title: "Zoom Out",
378
- children: "−"
379
- }
380
- )
381
- ] });
382
- });
330
+ const Ye = J(
331
+ ({ scale: n, minScale: r, maxScale: t, onZoomIn: o, onZoomOut: d, position: l, className: i }) => {
332
+ const p = {
333
+ position: "absolute",
334
+ display: "flex",
335
+ flexDirection: "column",
336
+ gap: "4px",
337
+ padding: "8px",
338
+ backgroundColor: "rgba(26, 26, 26, 0.95)",
339
+ borderRadius: "8px",
340
+ margin: "12px",
341
+ zIndex: 10,
342
+ ...{
343
+ "top-left": { top: 0, left: 0 },
344
+ "top-right": { top: 0, right: 0 },
345
+ "bottom-left": { bottom: 0, left: 0 },
346
+ "bottom-right": { bottom: 0, right: 0 }
347
+ }[l]
348
+ }, s = {
349
+ width: "44px",
350
+ height: "44px",
351
+ minWidth: "44px",
352
+ minHeight: "44px",
353
+ fontSize: "22px",
354
+ fontWeight: "bold",
355
+ border: "1px solid #444",
356
+ borderRadius: "6px",
357
+ backgroundColor: "transparent",
358
+ color: "#fff",
359
+ cursor: "pointer",
360
+ display: "flex",
361
+ alignItems: "center",
362
+ justifyContent: "center",
363
+ transition: "all 0.2s ease",
364
+ touchAction: "manipulation"
365
+ }, a = {
366
+ ...s,
367
+ opacity: 0.4,
368
+ cursor: "not-allowed"
369
+ }, f = n < t, b = n > r;
370
+ return /* @__PURE__ */ D("div", { className: i, style: p, children: [
371
+ /* @__PURE__ */ u(
372
+ "button",
373
+ {
374
+ type: "button",
375
+ onClick: o,
376
+ disabled: !f,
377
+ style: f ? s : a,
378
+ title: "Zoom In",
379
+ children: "+"
380
+ }
381
+ ),
382
+ /* @__PURE__ */ u(
383
+ "button",
384
+ {
385
+ type: "button",
386
+ onClick: d,
387
+ disabled: !b,
388
+ style: b ? s : a,
389
+ title: "Zoom Out",
390
+ children: ""
391
+ }
392
+ )
393
+ ] });
394
+ }
395
+ );
383
396
  Ye.displayName = "ZoomControls";
384
- const Ae = J(({
385
- visible: n,
386
- x: r,
387
- y: t,
388
- seat: o,
389
- currency: d,
390
- state: l
391
- }) => {
392
- if (!n || !o) return null;
393
- const i = o.seatNumber || (o.rowLabel && o.columnLabel ? `${o.rowLabel}-${o.columnLabel}` : "N/A"), S = {
394
- position: "fixed",
395
- left: `${r + 15}px`,
396
- top: `${t + 15}px`,
397
- zIndex: 1e3,
398
- pointerEvents: "none"
399
- }, p = {
400
- backgroundColor: "rgba(26, 26, 26, 0.95)",
401
- color: "#fff",
402
- border: "1px solid #444",
403
- borderRadius: "8px",
404
- padding: "8px 12px",
405
- fontSize: "13px",
406
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)",
407
- minWidth: "140px"
408
- }, s = {
409
- color: "#9ca3af",
410
- marginRight: "4px"
411
- }, a = {
412
- fontWeight: 600
413
- }, f = {
414
- color: "#4ade80",
415
- fontWeight: 600
416
- }, b = {
417
- fontSize: "11px",
418
- color: "#6b7280",
419
- textTransform: "capitalize",
420
- marginTop: "4px"
421
- };
422
- return /* @__PURE__ */ u("div", { style: S, children: /* @__PURE__ */ D("div", { style: p, children: [
423
- o.sectionName && /* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
424
- /* @__PURE__ */ u("span", { style: s, children: "Section:" }),
425
- /* @__PURE__ */ u("span", { style: { ...a, color: "#3b82f6" }, children: o.sectionName })
426
- ] }),
427
- /* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
428
- /* @__PURE__ */ u("span", { style: s, children: "Seat:" }),
429
- /* @__PURE__ */ u("span", { style: a, children: i })
430
- ] }),
431
- o.price !== void 0 && o.price > 0 && l === "available" && /* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
432
- /* @__PURE__ */ u("span", { style: s, children: "Price:" }),
433
- /* @__PURE__ */ D("span", { style: f, children: [
434
- d,
435
- " ",
436
- o.price.toFixed(2)
397
+ const Ae = J(
398
+ ({ visible: n, x: r, y: t, seat: o, currency: d, state: l }) => {
399
+ if (!n || !o) return null;
400
+ const i = o.seatNumber || (o.rowLabel && o.columnLabel ? `${o.rowLabel}-${o.columnLabel}` : "N/A"), S = {
401
+ position: "fixed",
402
+ left: `${r + 15}px`,
403
+ top: `${t + 15}px`,
404
+ zIndex: 1e3,
405
+ pointerEvents: "none"
406
+ }, p = {
407
+ backgroundColor: "rgba(26, 26, 26, 0.95)",
408
+ color: "#fff",
409
+ border: "1px solid #444",
410
+ borderRadius: "8px",
411
+ padding: "8px 12px",
412
+ fontSize: "13px",
413
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)",
414
+ minWidth: "140px"
415
+ }, s = {
416
+ color: "#9ca3af",
417
+ marginRight: "4px"
418
+ }, a = {
419
+ fontWeight: 600
420
+ }, f = {
421
+ color: "#4ade80",
422
+ fontWeight: 600
423
+ }, b = {
424
+ fontSize: "11px",
425
+ color: "#6b7280",
426
+ textTransform: "capitalize",
427
+ marginTop: "4px"
428
+ };
429
+ return /* @__PURE__ */ u("div", { style: S, children: /* @__PURE__ */ D("div", { style: p, children: [
430
+ o.sectionName && /* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
431
+ /* @__PURE__ */ u("span", { style: s, children: "Section:" }),
432
+ /* @__PURE__ */ u("span", { style: { ...a, color: "#3b82f6" }, children: o.sectionName })
433
+ ] }),
434
+ /* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
435
+ /* @__PURE__ */ u("span", { style: s, children: "Seat:" }),
436
+ /* @__PURE__ */ u("span", { style: a, children: i })
437
+ ] }),
438
+ o.price !== void 0 && o.price > 0 && l === "available" && /* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
439
+ /* @__PURE__ */ u("span", { style: s, children: "Price:" }),
440
+ /* @__PURE__ */ D("span", { style: f, children: [
441
+ d,
442
+ " ",
443
+ o.price.toFixed(2)
444
+ ] })
445
+ ] }),
446
+ /* @__PURE__ */ D("div", { style: b, children: [
447
+ "Status: ",
448
+ l
437
449
  ] })
438
- ] }),
439
- /* @__PURE__ */ D("div", { style: b, children: [
440
- "Status: ",
441
- l
442
- ] })
443
- ] }) });
444
- });
450
+ ] }) });
451
+ }
452
+ );
445
453
  Ae.displayName = "SeatTooltip";
446
454
  const Nt = ({
447
455
  config: n,
@@ -481,9 +489,14 @@ const Nt = ({
481
489
  // Touch gestures
482
490
  touchEnabled: Ve = !0
483
491
  }) => {
484
- const Re = l !== void 0 ? l : d, fe = X(null), Me = X(null), T = wt(Me), [q, Ee] = k(/* @__PURE__ */ new Set()), [N, Q] = k(1), [P, V] = k({ x: 0, y: 0 }), [Oe, je] = k(null), [_e, qe] = k(1), se = X({ width: 0, height: 0 }), [ee, Ie] = k({ visible: !1, x: 0, y: 0, seat: null, state: "available" }), { config: Ze, loading: Ge, error: te } = xt(r), h = n || Ze, ge = t !== void 0, $ = ge ? t || null : Oe, ae = S !== void 0, Ke = z((e) => {
485
- ge || je(e), o?.(e);
486
- }, [ge, o]), pe = h?.floors || [], Je = R !== void 0 ? R : pe.length > 1, ce = A(
492
+ const Re = l !== void 0 ? l : d, fe = X(null), Me = X(null), T = wt(Me), [q, Ee] = k(
493
+ /* @__PURE__ */ new Set()
494
+ ), [N, Q] = k(1), [P, V] = k({ x: 0, y: 0 }), [Oe, je] = k(null), [_e, qe] = k(1), se = X({ width: 0, height: 0 }), [ee, Ie] = k({ visible: !1, x: 0, y: 0, seat: null, state: "available" }), { config: Ze, loading: Ge, error: te } = xt(r), h = n || Ze, ge = t !== void 0, $ = ge ? t || null : Oe, ae = S !== void 0, Ke = z(
495
+ (e) => {
496
+ ge || je(e), o?.(e);
497
+ },
498
+ [ge, o]
499
+ ), pe = h?.floors || [], Je = R !== void 0 ? R : pe.length > 1, ce = A(
487
500
  () => h ? { ...h.colors, ...b } : { ...Rt, ...b },
488
501
  [h, b]
489
502
  ), Z = A(() => {
@@ -512,19 +525,34 @@ const Nt = ({
512
525
  }, [h, Z, le, de]);
513
526
  B(() => {
514
527
  if (!Y || !h || !H || T.width === 0 || T.height === 0) return;
515
- const e = Math.abs(T.width - se.current.width), c = Math.abs(T.height - se.current.height);
528
+ const e = Math.abs(
529
+ T.width - se.current.width
530
+ ), c = Math.abs(
531
+ T.height - se.current.height
532
+ );
516
533
  if (!(se.current.width === 0) && e < 10 && c < 10) return;
517
534
  se.current = T;
518
535
  const y = T.width, w = T.height, m = y - _ * 2, j = w - _ * 2, K = m / H.width, ve = j / H.height, he = Math.min(K, ve, U), ct = H.minX + H.width / 2, lt = H.minY + H.height / 2, dt = y / 2, ht = w / 2, ut = dt - ct * he, ft = ht - lt * he;
519
536
  Q(he), V({ x: ut, y: ft }), qe(he);
520
- }, [Y, h, H, _, U, T, $]);
537
+ }, [
538
+ Y,
539
+ h,
540
+ H,
541
+ _,
542
+ U,
543
+ T,
544
+ $
545
+ ]);
521
546
  const O = A(() => {
522
547
  const e = new Set(Re), c = new Set(i), v = new Set(p);
523
548
  return { reserved: e, unavailable: c, myReserved: v };
524
- }, [Re, i, p]), be = A(() => S ? new Set(S) : null, [S]), ne = z((e) => {
525
- const c = e.id, v = e.seatNumber || "";
526
- return O.unavailable.has(c) || O.unavailable.has(v) ? "unavailable" : O.reserved.has(c) || O.reserved.has(v) ? "reserved" : O.myReserved.has(c) || O.myReserved.has(v) || q.has(c) ? "selected" : e.state;
527
- }, [O, q]);
549
+ }, [Re, i, p]), be = A(() => S ? new Set(S) : null, [S]), ne = z(
550
+ (e) => {
551
+ const c = e.id, v = e.seatNumber || "";
552
+ return O.unavailable.has(c) || O.unavailable.has(v) ? "unavailable" : O.reserved.has(c) || O.reserved.has(v) ? "reserved" : O.myReserved.has(c) || O.myReserved.has(v) || q.has(c) ? "selected" : e.state;
553
+ },
554
+ [O, q]
555
+ );
528
556
  B(() => {
529
557
  h && E && E(h);
530
558
  }, [h, E]), B(() => {
@@ -532,16 +560,25 @@ const Nt = ({
532
560
  }, [te, F]), B(() => {
533
561
  ae && be && Ee(be);
534
562
  }, [ae, be]);
535
- const Qe = z((e) => {
536
- const c = ne(e);
537
- if (c !== "available" && c !== "selected")
538
- return;
539
- const v = q.has(e.id);
540
- ae || Ee((y) => {
541
- const w = new Set(y);
542
- return v ? w.delete(e.id) : w.add(e.id), w;
543
- }), v ? a?.(e) : (s?.(e), s || console.log("Seat selected:", e));
544
- }, [ne, q, ae, s, a]), re = A(() => h ? Z.filter((e) => q.has(e.id)) : [], [Z, q]);
563
+ const Qe = z(
564
+ (e) => {
565
+ const c = ne(e);
566
+ if (c !== "available" && c !== "selected")
567
+ return;
568
+ const v = q.has(e.id);
569
+ ae || Ee((y) => {
570
+ const w = new Set(y);
571
+ return v ? w.delete(e.id) : w.add(e.id), w;
572
+ }), v ? a?.(e) : (s?.(e), s || console.log("Seat selected:", e));
573
+ },
574
+ [
575
+ ne,
576
+ q,
577
+ ae,
578
+ s,
579
+ a
580
+ ]
581
+ ), re = A(() => h ? Z.filter((e) => q.has(e.id)) : [], [Z, q]);
545
582
  B(() => {
546
583
  f?.(re);
547
584
  }, [re, f]);
@@ -558,7 +595,15 @@ const Nt = ({
558
595
  y: w - m.y * e
559
596
  });
560
597
  }
561
- }, [g, N, ie, U, T, h, P]), tt = z(() => {
598
+ }, [
599
+ g,
600
+ N,
601
+ ie,
602
+ U,
603
+ T,
604
+ h,
605
+ P
606
+ ]), tt = z(() => {
562
607
  if (!g) return;
563
608
  const e = Math.max(N - ie, G);
564
609
  if (e !== N) {
@@ -571,27 +616,38 @@ const Nt = ({
571
616
  y: w - m.y * e
572
617
  });
573
618
  }
574
- }, [g, N, ie, G, T, h, P]), nt = z((e) => {
619
+ }, [
620
+ g,
621
+ N,
622
+ ie,
623
+ G,
624
+ T,
625
+ h,
626
+ P
627
+ ]), nt = z((e) => {
575
628
  V({
576
629
  x: e.target.x(),
577
630
  y: e.target.y()
578
631
  });
579
- }, []), rt = z((e) => {
580
- if (!g) return;
581
- e.evt.preventDefault();
582
- const c = fe.current;
583
- if (!c) return;
584
- const v = c.scaleX(), y = c.getPointerPosition();
585
- if (!y) return;
586
- const w = 1.1, m = e.evt.deltaY > 0 ? v / w : v * w, j = Math.min(Math.max(m, G), U), K = {
587
- x: (y.x - P.x) / v,
588
- y: (y.y - P.y) / v
589
- }, ve = {
590
- x: y.x - K.x * j,
591
- y: y.y - K.y * j
592
- };
593
- Q(j), V(ve);
594
- }, [g, P, G, U]);
632
+ }, []), rt = z(
633
+ (e) => {
634
+ if (!g) return;
635
+ e.evt.preventDefault();
636
+ const c = fe.current;
637
+ if (!c) return;
638
+ const v = c.scaleX(), y = c.getPointerPosition();
639
+ if (!y) return;
640
+ const w = 1.1, m = e.evt.deltaY > 0 ? v / w : v * w, j = Math.min(Math.max(m, G), U), K = {
641
+ x: (y.x - P.x) / v,
642
+ y: (y.y - P.y) / v
643
+ }, ve = {
644
+ x: y.x - K.x * j,
645
+ y: y.y - K.y * j
646
+ };
647
+ Q(j), V(ve);
648
+ },
649
+ [g, P, G, U]
650
+ );
595
651
  Ct(fe, {
596
652
  enabled: Ve && g,
597
653
  minScale: G,
@@ -605,21 +661,24 @@ const Nt = ({
605
661
  V(e);
606
662
  }
607
663
  });
608
- const ot = z((e, c) => {
609
- if (!x) return;
610
- const v = c.target.getStage();
611
- if (!v) return;
612
- const y = v.getPointerPosition();
613
- if (!y) return;
614
- const w = v.container().getBoundingClientRect();
615
- Ie({
616
- visible: !0,
617
- x: w.left + y.x,
618
- y: w.top + y.y,
619
- seat: e,
620
- state: ne(e)
621
- });
622
- }, [x, ne]), it = z(() => {
664
+ const ot = z(
665
+ (e, c) => {
666
+ if (!x) return;
667
+ const v = c.target.getStage();
668
+ if (!v) return;
669
+ const y = v.getPointerPosition();
670
+ if (!y) return;
671
+ const w = v.container().getBoundingClientRect();
672
+ Ie({
673
+ visible: !0,
674
+ x: w.left + y.x,
675
+ y: w.top + y.y,
676
+ seat: e,
677
+ state: ne(e)
678
+ });
679
+ },
680
+ [x, ne]
681
+ ), it = z(() => {
623
682
  Ie((e) => ({ ...e, visible: !1 }));
624
683
  }, []);
625
684
  if (Ge)
@@ -664,7 +723,10 @@ const Nt = ({
664
723
  draggable: !0,
665
724
  onDragEnd: nt,
666
725
  onWheel: rt,
667
- style: { backgroundColor: h.canvas.backgroundColor, cursor: "grab" },
726
+ style: {
727
+ backgroundColor: h.canvas.backgroundColor,
728
+ cursor: "grab"
729
+ },
668
730
  children: [
669
731
  /* @__PURE__ */ u(ye, { listening: !1, children: le.map((e) => /* @__PURE__ */ u(
670
732
  We,
@@ -770,7 +832,13 @@ const ue = {
770
832
  unavailableSeats: []
771
833
  };
772
834
  function Et(n) {
773
- const { seatMapId: r, currentUserId: t, enabled: o = !0, onStateChange: d, onError: l } = n, i = X({ ...ue }), S = X(d), p = X(l), s = X(t);
835
+ const {
836
+ seatMapId: r,
837
+ currentUserId: t,
838
+ enabled: o = !0,
839
+ onStateChange: d,
840
+ onError: l
841
+ } = n, i = X({ ...ue }), S = X(d), p = X(l), s = X(t);
774
842
  S.current = d, p.current = l, s.current = t;
775
843
  const a = z(
776
844
  (g) => {
@@ -788,8 +856,14 @@ function Et(n) {
788
856
  }
789
857
  const C = xe(), E = Se(C, `seatmaps/${r}/seat_states`);
790
858
  return Ne(E, (I) => {
791
- const L = I.val() || {}, W = Mt(L, s.current), Y = i.current;
792
- (Y.loading || !me(Y.myReservedSeats, W.myReserved) || !me(Y.otherReservedSeats, W.otherReserved) || !me(Y.unavailableSeats, W.unavailable)) && (i.current = {
859
+ const L = I.val() || {}, W = Mt(
860
+ L,
861
+ s.current
862
+ ), Y = i.current;
863
+ (Y.loading || !me(Y.myReservedSeats, W.myReserved) || !me(
864
+ Y.otherReservedSeats,
865
+ W.otherReserved
866
+ ) || !me(Y.unavailableSeats, W.unavailable)) && (i.current = {
793
867
  states: L,
794
868
  loading: !1,
795
869
  error: null,
@@ -810,7 +884,11 @@ function Et(n) {
810
884
  },
811
885
  [r, o]
812
886
  // Don't include currentUserId - we use currentUserIdRef.current which is always up-to-date
813
- ), f = z(() => i.current, []), b = z(() => ue, []), x = gt(a, f, b);
887
+ ), f = z(() => i.current, []), b = z(() => ue, []), x = gt(
888
+ a,
889
+ f,
890
+ b
891
+ );
814
892
  return {
815
893
  states: x.states,
816
894
  loading: x.loading,
@@ -835,7 +913,11 @@ function It(n) {
835
913
  const g = z(async () => {
836
914
  if (!r) return;
837
915
  if (!we()) {
838
- f(new Error("Firebase not initialized. Call initializeFirebaseForViewer first.")), s(!1);
916
+ f(
917
+ new Error(
918
+ "Firebase not initialized. Call initializeFirebaseForViewer first."
919
+ )
920
+ ), s(!1);
839
921
  return;
840
922
  }
841
923
  const C = xe(), E = Se(C, `seatmaps/${r}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonetrix/viewer",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "type": "module",
5
5
  "description": "Lightweight React component for rendering interactive seat maps",
6
6
  "main": "./dist/index.js",