iticket-seatingplan-dev 1.7.0 → 1.7.2

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.
@@ -16,9 +16,13 @@ function Flexi(_ref) {
16
16
  buttonText,
17
17
  onConfirm,
18
18
  isOpen,
19
- panMap
19
+ panMap,
20
+ showCheckbox,
21
+ checkboxText,
22
+ initialChecked
20
23
  } = _ref;
21
24
  const [value, setValue] = (0, _react.useState)((_price$p = price.p) !== null && _price$p !== void 0 ? _price$p : price.pMin);
25
+ const [checked, setChecked] = (0, _react.useState)(initialChecked ? true : false);
22
26
  return /*#__PURE__*/_react.default.createElement("div", {
23
27
  className: "flexi-popup-content"
24
28
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -41,10 +45,19 @@ function Flexi(_ref) {
41
45
  onChange: e => setValue(parseInt(e.target.value))
42
46
  }), /*#__PURE__*/_react.default.createElement("div", {
43
47
  className: "min-max"
44
- }, /*#__PURE__*/_react.default.createElement("p", null, _utils.NZDollar.format(price.pMin)), /*#__PURE__*/_react.default.createElement("p", null, _utils.NZDollar.format(price.pMax)))), /*#__PURE__*/_react.default.createElement("button", {
48
+ }, /*#__PURE__*/_react.default.createElement("p", null, _utils.NZDollar.format(price.pMin)), /*#__PURE__*/_react.default.createElement("p", null, _utils.NZDollar.format(price.pMax)))), showCheckbox && /*#__PURE__*/_react.default.createElement("div", {
49
+ className: "flexi-checkbox"
50
+ }, /*#__PURE__*/_react.default.createElement("input", {
51
+ type: "checkbox",
52
+ id: "checkbox",
53
+ checked: checked,
54
+ onChange: () => setChecked(prev => !prev)
55
+ }), /*#__PURE__*/_react.default.createElement("label", {
56
+ htmlFor: "checkbox"
57
+ }, checkboxText)), /*#__PURE__*/_react.default.createElement("button", {
45
58
  className: "add-cart",
46
59
  onClick: () => {
47
- onConfirm(value);
60
+ onConfirm(value, checked);
48
61
  onClose();
49
62
  }
50
63
  }, buttonText)));
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = HoverPopup;
7
+ var _reactLeaflet = require("react-leaflet");
8
+ var _utils = require("../utils");
9
+ var _react = require("react");
10
+ const offset = 10;
11
+ const numOnlyRgx = /^\d+$/;
12
+ function HoverPopup(_ref) {
13
+ var _highlightedSeats$;
14
+ let {
15
+ hoveredSeat,
16
+ highlightedSeats,
17
+ mousePos,
18
+ show,
19
+ availablePrices,
20
+ prevHovered
21
+ } = _ref;
22
+ const map = (0, _reactLeaflet.useMap)();
23
+ const ref = (0, _react.useRef)(null);
24
+ const tooltipPos = (0, _react.useMemo)(() => {
25
+ var _ref$current, _ref$current2;
26
+ const tooltipWidth = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetWidth) || 0;
27
+ const tooltipHeight = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.offsetHeight) || 0;
28
+ const bounds = map.getPixelBounds();
29
+ const height = bounds.max.y - bounds.min.y;
30
+ const width = bounds.max.x - bounds.min.x;
31
+ let x = mousePos.x;
32
+ let y = mousePos.y;
33
+ if (y + tooltipHeight + offset * 2 > height) {
34
+ y -= tooltipHeight + offset;
35
+ } else {
36
+ y += offset * 2;
37
+ }
38
+ if (x + tooltipWidth + offset * 2 > width) {
39
+ x -= tooltipWidth + offset;
40
+ } else {
41
+ x += offset * 2;
42
+ }
43
+ return {
44
+ x,
45
+ y
46
+ };
47
+ }, [mousePos]);
48
+ const minPrice = (availablePrices === null || availablePrices === void 0 ? void 0 : availablePrices.length) > 0 ? Math.min(...availablePrices.map(price => price.pMin || price.p)) : 0;
49
+ const maxPrice = (availablePrices === null || availablePrices === void 0 ? void 0 : availablePrices.length) > 0 ? Math.max(...(availablePrices === null || availablePrices === void 0 ? void 0 : availablePrices.map(price => price.pMax || price.p))) : 0;
50
+ const priceText = (availablePrices === null || availablePrices === void 0 ? void 0 : availablePrices.length) > 0 ? availablePrices.length === 1 || maxPrice === minPrice ? _utils.NZDollar.format(availablePrices[0].p) : "".concat(_utils.NZDollar.format(minPrice), " - ").concat(_utils.NZDollar.format(maxPrice)) : "";
51
+ const rowName = (highlightedSeats === null || highlightedSeats === void 0 || (_highlightedSeats$ = highlightedSeats[0]) === null || _highlightedSeats$ === void 0 ? void 0 : _highlightedSeats$.r) || (hoveredSeat === null || hoveredSeat === void 0 ? void 0 : hoveredSeat.r);
52
+ const seatNames = (highlightedSeats === null || highlightedSeats === void 0 ? void 0 : highlightedSeats.map(seat => seat.c)) || [hoveredSeat === null || hoveredSeat === void 0 ? void 0 : hoveredSeat.c];
53
+ if (seatNames.every(s => numOnlyRgx.test(s))) {
54
+ seatNames.sort((a, b) => parseInt(a) - parseInt(b));
55
+ } else {
56
+ seatNames.sort();
57
+ }
58
+ const psName = highlightedSeats ? highlightedSeats === null || highlightedSeats === void 0 ? void 0 : highlightedSeats.reduce((acc, val) => {
59
+ if (!acc.some(s => s.psName === val.psName)) {
60
+ acc.push(val);
61
+ }
62
+ return acc;
63
+ }, []).map(s => s.psName).join(", ") : hoveredSeat === null || hoveredSeat === void 0 ? void 0 : hoveredSeat.psName;
64
+ return /*#__PURE__*/React.createElement("div", {
65
+ ref: ref,
66
+ className: "hover-popup",
67
+ style: {
68
+ top: "".concat(tooltipPos.y, "px"),
69
+ left: "".concat(tooltipPos.x, "px"),
70
+ opacity: show ? 1 : 0,
71
+ transitionDelay: show ? "50ms, 0ms, 0ms" : "250ms, 0ms, 0ms",
72
+ // a way to have smooth animation when hovering over the same row
73
+ transitionDuration: prevHovered !== null && prevHovered !== void 0 && prevHovered.r && prevHovered.r === (hoveredSeat === null || hoveredSeat === void 0 ? void 0 : hoveredSeat.r) ? "100ms, 150ms, 150ms" : "100ms, 50ms, 50ms"
74
+ }
75
+ }, /*#__PURE__*/React.createElement("div", {
76
+ className: "hover-popup-content"
77
+ }, /*#__PURE__*/React.createElement("div", {
78
+ className: "hover-popup-header"
79
+ }, /*#__PURE__*/React.createElement("div", {
80
+ className: "hover-popup-row"
81
+ }, /*#__PURE__*/React.createElement("p", {
82
+ className: "hover-popup-header-title"
83
+ }, "ROW"), /*#__PURE__*/React.createElement("div", {
84
+ className: "row-name"
85
+ }, /*#__PURE__*/React.createElement("p", null, rowName))), /*#__PURE__*/React.createElement("div", {
86
+ className: "hover-popup-column"
87
+ }, /*#__PURE__*/React.createElement("p", {
88
+ className: "hover-popup-header-title"
89
+ }, "SEAT"), /*#__PURE__*/React.createElement("div", {
90
+ className: "hover-popup-seats"
91
+ }, seatNames.map((s, i) => {
92
+ if (seatNames.length > 4) {
93
+ if (i === 3) {
94
+ return /*#__PURE__*/React.createElement("p", {
95
+ key: "".concat(s).concat(i),
96
+ className: "seat-name"
97
+ }, "...");
98
+ }
99
+ if (i < 2 || i === seatNames.length - 1) {
100
+ return /*#__PURE__*/React.createElement("p", {
101
+ key: "".concat(s).concat(i),
102
+ className: "seat-name"
103
+ }, s);
104
+ }
105
+ return null;
106
+ }
107
+ return /*#__PURE__*/React.createElement("p", {
108
+ key: "".concat(s).concat(i),
109
+ className: "seat-name"
110
+ }, s);
111
+ })))), /*#__PURE__*/React.createElement("div", {
112
+ className: "hover-popup-price"
113
+ }, /*#__PURE__*/React.createElement("p", {
114
+ className: "hover-popup-psname"
115
+ }, psName), /*#__PURE__*/React.createElement("div", {
116
+ className: "hover-popup-divider"
117
+ }), /*#__PURE__*/React.createElement("p", {
118
+ className: "hover-popup-pricetext"
119
+ }, priceText))));
120
+ }
@@ -13,10 +13,10 @@ function InvalidSeatsPopup(_ref) {
13
13
  onClose
14
14
  } = _ref;
15
15
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
16
- className: "pricing-popup-backdrop",
16
+ className: "seatingplan-dialog-backdrop",
17
17
  onClick: onClose
18
18
  }), /*#__PURE__*/_react.default.createElement("div", {
19
- className: "pricing-popup remove-multiple-seats-popup",
19
+ className: "seatingplan-dialog remove-multiple-seats-popup",
20
20
  role: "dialog",
21
21
  "aria-modal": "true"
22
22
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -35,7 +35,7 @@ function InvalidSeatsPopup(_ref) {
35
35
  height: "20px",
36
36
  width: "20px"
37
37
  })), /*#__PURE__*/_react.default.createElement("h3", null, "Seat selection")), /*#__PURE__*/_react.default.createElement("div", {
38
- className: "pricing-popup-content"
38
+ className: "seatingplan-dialog-content"
39
39
  }, /*#__PURE__*/_react.default.createElement("h4", {
40
40
  className: "quantity-heading"
41
41
  }, "The seats you've chosen aren't available. They may leave a single seat on its own, or there may not be enough seats in the row for your selection. Please select different seats to continue."), /*#__PURE__*/_react.default.createElement("div", {
@@ -20,6 +20,7 @@ var _CloseIcon = _interopRequireDefault(require("./icons/CloseIcon"));
20
20
  var _TicketIcon = _interopRequireDefault(require("./icons/TicketIcon"));
21
21
  var _FlexiIcon = _interopRequireDefault(require("./icons/FlexiIcon"));
22
22
  var _EditIcon = _interopRequireDefault(require("./icons/EditIcon"));
23
+ var _HoverPopup = _interopRequireDefault(require("./HoverPopup"));
23
24
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
25
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
25
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -29,6 +30,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
29
30
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
30
31
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
31
32
  function SeatMap(_ref) {
33
+ var _seats$pricing2, _seats$seats2;
32
34
  let {
33
35
  seats,
34
36
  height,
@@ -55,7 +57,6 @@ function SeatMap(_ref) {
55
57
  setPricingPopupOpen,
56
58
  selectedSeats,
57
59
  setSelectedSeats,
58
- selectQuantityPopupOpen,
59
60
  setSelectQuantityPopupOpen,
60
61
  desiredSeatQuantity,
61
62
  setSeatsToRemove,
@@ -66,9 +67,20 @@ function SeatMap(_ref) {
66
67
  const [isDragging, setIsDragging] = (0, _react.useState)(false);
67
68
  const [highlightedSeats, setHighlightedSeats] = (0, _react.useState)([]);
68
69
  const [greyedOutSeats, setGreyedOutSeats] = (0, _react.useState)([]);
70
+ const [clickedSeat, setClickedSeat] = (0, _react.useState)(null);
71
+ const [mousePos, setMousePos] = (0, _react.useState)({
72
+ x: 0,
73
+ y: 0
74
+ });
75
+ const [isHoveringOnSeat, setIsHoveringOnSeat] = (0, _react.useState)(false);
76
+ const [hoveredSeat, setHoveredSeat] = (0, _react.useState)(null);
69
77
  const drawLayersRef = (0, _react.useRef)(null);
70
78
  const drawRef = (0, _react.useRef)(null);
71
79
  const popupRef = (0, _react.useRef)(null);
80
+ const prevHovered = (0, _react.useRef)(null);
81
+ (0, _react.useEffect)(() => {
82
+ prevHovered.current = hoveredSeat;
83
+ }, [hoveredSeat]);
72
84
  const map = (0, _reactLeaflet.useMap)();
73
85
 
74
86
  // L.drawLocal.draw.toolbar.buttons.rectangle = "Box select";
@@ -205,7 +217,17 @@ function SeatMap(_ref) {
205
217
  }
206
218
  }, [mode, map]);
207
219
  const seatsMap = (0, _react.useMemo)(() => new Map(seats.seats.map(s => [s.sId, s])), [seats.seats]);
208
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, seats.preventOrphanedSeats && /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
220
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_HoverPopup.default, {
221
+ hoveredSeat: hoveredSeat,
222
+ highlightedSeats: highlightedSeats && highlightedSeats.length > 0 ? highlightedSeats : null,
223
+ mousePos: mousePos,
224
+ show: (hoveredSeat || (highlightedSeats === null || highlightedSeats === void 0 ? void 0 : highlightedSeats.length) > 0) && !ticketPopupOpen && !pricingPopupOpen && !isDragging && isHoveringOnSeat,
225
+ availablePrices: highlightedSeats && highlightedSeats.length > 0 ? highlightedSeats.flatMap(s => {
226
+ var _seats$pricing;
227
+ return ((_seats$pricing = seats.pricing) === null || _seats$pricing === void 0 ? void 0 : _seats$pricing.filter(p => p.psId === s.psId && (!priceSectionIds || priceSectionIds.includes(p.psId)) && (p.q === null || p.q > 0))) || [];
228
+ }) : hoveredSeat ? ((_seats$pricing2 = seats.pricing) === null || _seats$pricing2 === void 0 ? void 0 : _seats$pricing2.filter(p => p.psId === hoveredSeat.psId && (!priceSectionIds || priceSectionIds.includes(p.psId)) && (p.q === null || p.q > 0))) || [] : undefined,
229
+ prevHovered: prevHovered.current
230
+ }), seats.preventOrphanedSeats && /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
209
231
  position: "topright"
210
232
  }, /*#__PURE__*/_react.default.createElement("div", {
211
233
  className: "extra-controls seat-quantity-control"
@@ -254,7 +276,7 @@ function SeatMap(_ref) {
254
276
  src: _encodedSvgs.wheelchairIcon,
255
277
  width: 15,
256
278
  height: 15
257
- }), /*#__PURE__*/_react.default.createElement("p", null, "wheelchair"))), seats.seats.filter(seat => seat.m).length > 0 ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
279
+ }), /*#__PURE__*/_react.default.createElement("p", null, "wheelchair"))), ((_seats$seats2 = seats.seats) === null || _seats$seats2 === void 0 ? void 0 : _seats$seats2.filter(seat => seat.m).length) > 0 ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
258
280
  className: "legend-item"
259
281
  }, /*#__PURE__*/_react.default.createElement("img", {
260
282
  src: _encodedSvgs.userIcon,
@@ -401,10 +423,10 @@ function SeatMap(_ref) {
401
423
  bounds: [[0, 0], [height * 0.03, width * 0.03]],
402
424
  zIndex: 10
403
425
  }), seats && seats.seats && seats.seats.map((s, i) => {
404
- var _chosenSeat$seat, _chosenSeat$seat2;
426
+ var _seats$pricing3, _chosenSeat$seat, _chosenSeat$seat2, _chosenSeat$seat3;
405
427
  const isIcon = (!priceSectionIds || priceSectionIds.includes(s.psId)) && (s.s === _utils.statuses.WHEELCHAIR_ACCESS || s.s === _utils.statuses.USER_PENDING && s.m);
406
428
  const seatCenter = getSeatCenterLatLng(s, isIcon);
407
- const seatPrices = seats.pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && price.psId === s.psId);
429
+ const seatPrices = ((_seats$pricing3 = seats.pricing) === null || _seats$pricing3 === void 0 ? void 0 : _seats$pricing3.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && price.psId === s.psId)) || [];
408
430
  const hasSeatPrices = (seatPrices === null || seatPrices === void 0 ? void 0 : seatPrices.length) > 0;
409
431
  const isSingleFlexi = seatPrices.length === 1 && !!seatPrices[0].pMax && !!seatPrices[0].pMin && seatPrices[0].pMax > seatPrices[0].pMin;
410
432
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -424,11 +446,13 @@ function SeatMap(_ref) {
424
446
  zIndex: 10
425
447
  }) : /*#__PURE__*/_react.default.createElement(_reactLeaflet.Circle, {
426
448
  center: [s.r.includes("NORTH") ? getNorthSeatLat(s) : seatCenter.lat, seatCenter.lng],
427
- pathOptions: (0, _utils.getInitialColor)(s, price, !hasSeatPrices, selectedSeats.some(selectedSeat => selectedSeat.ssId === s.ssId) || highlightedSeats.some(hs => hs.ssId === s.ssId), greyedOutSeats.some(gs => gs.ssId === s.ssId)),
449
+ pathOptions: (0, _utils.getInitialColor)(s, price, s.loading || ticketPopupOpen && (chosenSeat === null || chosenSeat === void 0 || (_chosenSeat$seat3 = chosenSeat.seat) === null || _chosenSeat$seat3 === void 0 ? void 0 : _chosenSeat$seat3.ssId) === s.ssId, !hasSeatPrices, selectedSeats.some(selectedSeat => selectedSeat.ssId === s.ssId) || highlightedSeats.some(hs => hs.ssId === s.ssId), greyedOutSeats.some(gs => gs.ssId === s.ssId)),
428
450
  radius: 12000,
429
451
  eventHandlers: {
430
452
  click: e => {
431
- if (seats.preventOrphanedSeats && desiredSeatQuantity > 0) {
453
+ if (mode === _utils.modes.DRAG || mode === _utils.modes.REMOVE || mode === _utils.modes.DRAW || selectedSeats.length > 0) {
454
+ map.closePopup();
455
+ } else if (seats.preventOrphanedSeats && desiredSeatQuantity > 0) {
432
456
  map.closePopup();
433
457
  if (s.s === _utils.statuses.USER_PENDING) {
434
458
  const newSeatsToRemove = (0, _utils.getAdjacentBookedSeats)(s, seatsMap);
@@ -439,8 +463,12 @@ function SeatMap(_ref) {
439
463
  setRemoveMultipleSeatsPopupOpen(true);
440
464
  }
441
465
  } else if (highlightedSeats.length > 0 && highlightedSeats.length === desiredSeatQuantity) {
442
- setSelectedSeats([...highlightedSeats]);
443
- setPricingPopupOpen(true);
466
+ if ((0, _utils.isTouchScreen)() && clickedSeat !== s.ssId) {
467
+ setClickedSeat(s.ssId);
468
+ } else {
469
+ setSelectedSeats([...highlightedSeats]);
470
+ setPricingPopupOpen(true);
471
+ }
444
472
  } else if (greyedOutSeats.some(gs => gs.ssId === s.ssId)) {
445
473
  setInvalidSeatsPopupOpen(true);
446
474
  }
@@ -469,6 +497,8 @@ function SeatMap(_ref) {
469
497
  setSelectedSeats(prev => [...prev, s]);
470
498
  }
471
499
  } else {
500
+ setIsHoveringOnSeat(true);
501
+ setHoveredSeat(s);
472
502
  if (seats.preventOrphanedSeats && desiredSeatQuantity > 0 && s.s === _utils.statuses.UNSOLD) {
473
503
  const seatsToBook = (0, _utils.getValidSeats)(s, seatsMap, desiredSeatQuantity);
474
504
  if (seatsToBook.valid) {
@@ -480,20 +510,38 @@ function SeatMap(_ref) {
480
510
  }
481
511
  },
482
512
  mouseout: () => {
483
- if (highlightedSeats.length > 0) {
484
- setHighlightedSeats([]);
485
- }
486
513
  if (greyedOutSeats.length > 0) {
487
514
  setGreyedOutSeats([]);
488
515
  }
516
+ if (clickedSeat) {
517
+ setClickedSeat(null);
518
+ }
519
+ if (hoveredSeat || highlightedSeats) {
520
+ setTimeout(() => {
521
+ if (hoveredSeat) {
522
+ setHoveredSeat(prev => prev && prev === hoveredSeat ? null : prev);
523
+ }
524
+ if (highlightedSeats) {
525
+ setHighlightedSeats(prev => prev && prev === highlightedSeats ? [] : prev);
526
+ }
527
+ }, 400);
528
+ }
529
+ if (isHoveringOnSeat) {
530
+ setIsHoveringOnSeat(false);
531
+ }
532
+ },
533
+ mousemove: e => {
534
+ setMousePos({
535
+ x: e.containerPoint.x,
536
+ y: e.containerPoint.y
537
+ });
489
538
  }
490
539
  }
491
- // value={s}
492
- }, /*#__PURE__*/_react.default.createElement(_reactLeaflet.Tooltip, {
493
- className: "seatname-tooltip",
540
+ }, (0, _utils.isTouchScreen)() && /*#__PURE__*/_react.default.createElement(_reactLeaflet.Tooltip, {
541
+ className: "mobile-tooltip",
494
542
  direction: "top",
495
- offset: [0, height * 0.03 + -30]
496
- }, s.r + "-" + s.c), s.s === _utils.statuses.UNSOLD && hasSeatPrices ? /*#__PURE__*/_react.default.createElement(_reactLeaflet.Popup, {
543
+ offset: [0, height * 0.03 + -60]
544
+ }, "Tap again to select these seats"), s.s === _utils.statuses.UNSOLD && hasSeatPrices ? /*#__PURE__*/_react.default.createElement(_reactLeaflet.Popup, {
497
545
  className: "ticket-popup popup-".concat(s.sId)
498
546
  }, isSingleFlexi ? /*#__PURE__*/_react.default.createElement("div", {
499
547
  className: "single-flexi"
@@ -19,6 +19,7 @@ function PriceButton(_ref) {
19
19
  const [flexiOpen, setFlexiOpen] = (0, _react.useState)(false);
20
20
  const flexiRef = (0, _react.useRef)(null);
21
21
  const focusRef = (0, _react.useRef)(null);
22
+ const isAvailable = price.q === null || price.q > 0;
22
23
  const isFlexi = !!price.pMax && !!price.pMin && price.pMax > price.pMin;
23
24
  (0, _react.useEffect)(() => {
24
25
  if (flexiOpen) {
@@ -38,7 +39,7 @@ function PriceButton(_ref) {
38
39
  addToCart(price.p);
39
40
  }
40
41
  },
41
- disabled: price.is_available === false
42
+ disabled: !isAvailable
42
43
  }, /*#__PURE__*/_react.default.createElement("span", {
43
44
  className: "price"
44
45
  }, /*#__PURE__*/_react.default.createElement("span", {
@@ -47,7 +48,7 @@ function PriceButton(_ref) {
47
48
  className: "flexi-badge"
48
49
  }, "FLEXi")), /*#__PURE__*/_react.default.createElement("span", {
49
50
  className: "amount"
50
- }, isFlexi ? "".concat(_utils.NZDollar.format(price.pMin), " - ").concat(_utils.NZDollar.format(price.pMax)) : _utils.NZDollar.format(price.p))), price.is_available === false && /*#__PURE__*/_react.default.createElement("span", {
51
+ }, isFlexi ? "".concat(_utils.NZDollar.format(price.pMin), " - ").concat(_utils.NZDollar.format(price.pMax)) : _utils.NZDollar.format(price.p))), !isAvailable && /*#__PURE__*/_react.default.createElement("span", {
51
52
  className: "unavailable"
52
53
  }, "Allocation exhausted")), isFlexi && /*#__PURE__*/_react.default.createElement(_Flexi.default, {
53
54
  price: price,