iticket-seatingplan-dev 1.6.6 → 1.6.7

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.
@@ -11,7 +11,7 @@ var _reactLeaflet = require("react-leaflet");
11
11
  var L = _interopRequireWildcard(require("leaflet"));
12
12
  var _reactLeafletDraw = require("react-leaflet-draw");
13
13
  var _gestureHandling2 = require("./gestureHandling");
14
- var _Control = _interopRequireDefault(require("./Control"));
14
+ var _reactLeafletCustomControl = _interopRequireDefault(require("react-leaflet-custom-control"));
15
15
  var _encodedSvgs = require("./assets/encodedSvgs");
16
16
  var _utils = require("../utils");
17
17
  var _PriceButton = _interopRequireDefault(require("./PriceButton"));
@@ -195,7 +195,7 @@ function Map(_ref) {
195
195
  map.dragging.disable();
196
196
  }
197
197
  }, [mode, map]);
198
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Control.default, {
198
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
199
199
  position: "bottomright"
200
200
  }, /*#__PURE__*/_react.default.createElement("div", {
201
201
  className: "legendBox"
@@ -236,7 +236,7 @@ function Map(_ref) {
236
236
  src: _encodedSvgs.userIcon,
237
237
  width: 15,
238
238
  height: 15
239
- }), /*#__PURE__*/_react.default.createElement("p", null, "membership seats"))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null)))), /*#__PURE__*/_react.default.createElement(_Control.default, {
239
+ }), /*#__PURE__*/_react.default.createElement("p", null, "membership seats"))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null)))), /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
240
240
  position: "topleft"
241
241
  }, /*#__PURE__*/_react.default.createElement("div", {
242
242
  className: "extra-controls"
@@ -266,7 +266,7 @@ function Map(_ref) {
266
266
  style: {
267
267
  height: "17px"
268
268
  }
269
- })))), /*#__PURE__*/_react.default.createElement(_Control.default, {
269
+ })))), /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
270
270
  position: "topleft"
271
271
  }, /*#__PURE__*/_react.default.createElement("div", {
272
272
  className: "extra-controls full-screen-control"
@@ -281,7 +281,7 @@ function Map(_ref) {
281
281
  style: {
282
282
  height: "24px"
283
283
  }
284
- })))), canMultiSelect && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Control.default, {
284
+ })))), canMultiSelect && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
285
285
  position: "bottomleft"
286
286
  }, /*#__PURE__*/_react.default.createElement("div", {
287
287
  className: "extra-controls multi-select-control"
@@ -361,7 +361,7 @@ function Map(_ref) {
361
361
  onMounted: drawInstance => {
362
362
  drawRef.current = drawInstance;
363
363
  }
364
- }))), /*#__PURE__*/_react.default.createElement(_Control.default, {
364
+ }))), /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
365
365
  position: "topright"
366
366
  }, /*#__PURE__*/_react.default.createElement("button", {
367
367
  title: "Close full screen",
@@ -381,6 +381,7 @@ function Map(_ref) {
381
381
  const isIcon = (!priceSectionIds || priceSectionIds.includes(s.psId)) && (s.s === _utils.statuses.WHEELCHAIR_ACCESS || s.s === _utils.statuses.USER_PENDING && s.m);
382
382
  const seatCenter = getSeatCenterLatLng(s, isIcon);
383
383
  const seatPrices = seats.pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && price.psId === s.psId);
384
+ const hasSeatPrices = (seatPrices === null || seatPrices === void 0 ? void 0 : seatPrices.length) > 0;
384
385
  const isSingleFlexi = seatPrices.length === 1 && !!seatPrices[0].pMax && !!seatPrices[0].pMin && seatPrices[0].pMax > seatPrices[0].pMin;
385
386
  return /*#__PURE__*/_react.default.createElement("div", {
386
387
  key: i
@@ -399,7 +400,7 @@ function Map(_ref) {
399
400
  zIndex: 10
400
401
  }) : /*#__PURE__*/_react.default.createElement(_reactLeaflet.Circle, {
401
402
  center: [s.r.includes("NORTH") ? getNorthSeatLat(s) : seatCenter.lat, seatCenter.lng],
402
- pathOptions: (0, _utils.getInitialColor)(s, price
403
+ pathOptions: (0, _utils.getInitialColor)(s, price, !hasSeatPrices
403
404
  // TEST selected state for multiselect
404
405
  // !!selectedSeats.find(
405
406
  // (selectedSeat) => selectedSeat.ssId === s.ssId
@@ -408,7 +409,7 @@ function Map(_ref) {
408
409
  radius: 12000,
409
410
  eventHandlers: {
410
411
  click: e => {
411
- if (mode === _utils.modes.SINGLE) {
412
+ if (mode === _utils.modes.SINGLE && hasSeatPrices) {
412
413
  handleClickSeat(e, s);
413
414
  }
414
415
  },
@@ -421,14 +422,14 @@ function Map(_ref) {
421
422
  popupRef.current = null;
422
423
  },
423
424
  mousedown: () => {
424
- if ((mode === _utils.modes.DRAG || mode === _utils.modes.REMOVE) && canMultiSelect) {
425
+ if ((mode === _utils.modes.DRAG || mode === _utils.modes.REMOVE) && canMultiSelect && hasSeatPrices) {
425
426
  if (!selectedSeats.find(seat => seat.ssId === s.ssId) && s.s === (mode === _utils.modes.DRAG ? _utils.statuses.UNSOLD : _utils.statuses.USER_PENDING)) {
426
427
  setSelectedSeats(prev => [...prev, s]);
427
428
  }
428
429
  }
429
430
  },
430
431
  mouseover: () => {
431
- if ((mode === _utils.modes.DRAG || mode === _utils.modes.REMOVE) && isDragging && canMultiSelect) {
432
+ if ((mode === _utils.modes.DRAG || mode === _utils.modes.REMOVE) && isDragging && canMultiSelect && hasSeatPrices) {
432
433
  if (!selectedSeats.find(seat => seat.ssId === s.ssId) && s.s === (mode === _utils.modes.DRAG ? _utils.statuses.UNSOLD : _utils.statuses.USER_PENDING)) {
433
434
  setSelectedSeats(prev => [...prev, s]);
434
435
  }
@@ -440,7 +441,7 @@ function Map(_ref) {
440
441
  className: "seatname-tooltip",
441
442
  direction: "top",
442
443
  offset: [0, height * 0.03 + -30]
443
- }, s.r + "-" + s.c), s.s === _utils.statuses.UNSOLD && /*#__PURE__*/_react.default.createElement(_reactLeaflet.Popup, {
444
+ }, s.r + "-" + s.c), s.s === _utils.statuses.UNSOLD && hasSeatPrices ? /*#__PURE__*/_react.default.createElement(_reactLeaflet.Popup, {
444
445
  className: "ticket-popup popup-".concat(s.sId)
445
446
  }, isSingleFlexi ? /*#__PURE__*/_react.default.createElement("div", {
446
447
  className: "single-flexi"
@@ -488,7 +489,7 @@ function Map(_ref) {
488
489
  className: "heading"
489
490
  }, "Select option:"), /*#__PURE__*/_react.default.createElement("div", {
490
491
  className: "priceages"
491
- }, seats.pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && price.psId === s.psId).map(price => /*#__PURE__*/_react.default.createElement(_PriceButton.default, {
492
+ }, seatPrices.map(price => /*#__PURE__*/_react.default.createElement(_PriceButton.default, {
492
493
  key: price.paId,
493
494
  price: price,
494
495
  addToCart: amount => addTicketToCart(s, _objectSpread(_objectSpread({}, price), {}, {
@@ -506,6 +507,6 @@ function Map(_ref) {
506
507
  }
507
508
  }
508
509
  }
509
- }))))))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null));
510
+ })))))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null));
510
511
  }));
511
512
  }
@@ -39,15 +39,7 @@ const SeatingPlan = _ref => {
39
39
  connectedShowings,
40
40
  areaName,
41
41
  promoCode,
42
- bookingMode = _utils.bookingModes.SHOPSITE,
43
- theme = {
44
- accent: "#6366f1",
45
- accentDark: "#3730a3",
46
- accentLight: "#e0e7ff",
47
- flexiAccent: "#e32664",
48
- flexiAccentDark: "#ffd3e2",
49
- flexiAccentLight: "#be003f"
50
- }
42
+ bookingMode = _utils.bookingModes.SHOPSITE
51
43
  } = _ref;
52
44
  const [initialiseMessage, setInitialiseMessage] = (0, _react.useState)("Initialising seating plan...");
53
45
  const [isReloading, setIsReloading] = (0, _react.useState)(false);
@@ -469,30 +461,19 @@ const SeatingPlan = _ref => {
469
461
  setPricingPopupOpen(false);
470
462
  setSelectedSeats([]);
471
463
  };
472
- const themeStyles = {
473
- "--accent": theme.accent,
474
- "--accent-dark": theme.accentDark,
475
- "--accent-light": theme.accentLight,
476
- "--flexi-accent": theme.flexiAccent,
477
- "--flexi-accent-light": theme.flexiAccentLight,
478
- "--flexi-accent-dark": theme.flexiAccentDark
479
- };
480
464
 
481
465
  // return seating plan
482
466
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
483
467
  className: "seating-plan-root",
484
- id: "seating-plan-root",
485
- style: themeStyles
468
+ id: "seating-plan-root"
486
469
  }, error ? /*#__PURE__*/_react.default.createElement("div", {
487
470
  className: "loading"
488
471
  }, /*#__PURE__*/_react.default.createElement("h1", null, "OOPS!"), /*#__PURE__*/_react.default.createElement("div", null, error.response.data.message)) : position && area === areaId ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, backdropContainer && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement("div", {
489
472
  className: "seating-plan-backdrop ".concat(isFullScreen ? "full-screen" : ""),
490
- onClick: () => setIsFullScreen(false),
491
- style: themeStyles
473
+ onClick: () => setIsFullScreen(false)
492
474
  }), backdropContainer), mapContainer && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement("div", {
493
475
  className: "seating-plan-container ".concat(isFullScreen ? "full-screen" : ""),
494
- "data-mode": mode,
495
- style: themeStyles
476
+ "data-mode": mode
496
477
  }, pricingPopupOpen && canMultiSelect && /*#__PURE__*/_react.default.createElement(_PricingPopup.default, {
497
478
  cancelPriceSelect: cancelPriceSelect,
498
479
  groupedSelectedSeats: groupedSelectedSeats,
@@ -27,12 +27,12 @@ button {
27
27
  }
28
28
 
29
29
  .seating-plan-container {
30
- /* --accent: #6366f1;
31
- --accent-dark: #3730a3;
32
- --accent-light: #e0e7ff;
33
- --flexi-accent: #e32664;
34
- --flexi-accent-light: #ffd3e2;
35
- --flexi-accent-dark: #be003f; */
30
+ --accent: rgb(99 102 241);
31
+ --accent-dark: rgb(55 48 163);
32
+ --accent-light: rgb(224 231 255);
33
+ --flexi-accent: rgb(227 38 100);
34
+ --flexi-accent-light: rgb(255 211 226);
35
+ --flexi-accent-dark: rgb(190 0 63);
36
36
  font-family: inherit;
37
37
  }
38
38
 
@@ -41,7 +41,6 @@ button {
41
41
  padding: 0.5rem 0.8rem;
42
42
  border-radius: 3px;
43
43
  text-align: left;
44
- color: #333;
45
44
  }
46
45
 
47
46
  .legend-header {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getInitialColor = exports.calculateCenterOfMap = exports.NZDollar = void 0;
7
7
  var _enums = require("./enums");
8
- const getInitialColor = (s, price, selected) => {
8
+ const getInitialColor = (s, price, disabled, selected) => {
9
9
  // TEST selected state for multiselect
10
10
  // if (selected) {
11
11
  // return {
@@ -16,7 +16,7 @@ const getInitialColor = (s, price, selected) => {
16
16
  // }
17
17
 
18
18
  return {
19
- fillColor: s.s === _enums.statuses.UNSOLD ? _enums.statusColors.available : s.s === _enums.statuses.USER_PENDING ? s.bookedPrice === price ? _enums.statusColors.booked : _enums.statusColors.bookedWithDifferentPrice : _enums.statusColors.sold,
19
+ fillColor: s.s === _enums.statuses.UNSOLD && !disabled ? _enums.statusColors.available : s.s === _enums.statuses.USER_PENDING ? s.bookedPrice === price ? _enums.statusColors.booked : _enums.statusColors.bookedWithDifferentPrice : _enums.statusColors.sold,
20
20
  color: "none",
21
21
  fillOpacity: s.loading ? 0 : 1,
22
22
  stroke: false
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "iticket-seatingplan-dev",
3
3
  "description": "Seating plan with FLEXi pricing",
4
4
  "author": "gedwyne",
5
- "version": "1.6.6",
5
+ "version": "1.6.7",
6
6
  "private": false,
7
7
  "keywords": [
8
8
  "iticket",
@@ -20,9 +20,10 @@
20
20
  "@types/leaflet-draw": "^1.0.11",
21
21
  "leaflet": "^1.9.3",
22
22
  "leaflet-draw": "^1.0.4",
23
- "react": "^19.0.0",
24
- "react-dom": "^19.0.0",
25
- "react-leaflet": "^5.0.0-rc.2",
23
+ "react": "^18.3.1",
24
+ "react-dom": "^18.3.1",
25
+ "react-leaflet": "^4.2.1",
26
+ "react-leaflet-custom-control": "^1.3.5",
26
27
  "react-leaflet-draw": "^0.20.4",
27
28
  "react-scripts": "^5.0.1"
28
29
  },
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _leaflet = _interopRequireDefault(require("leaflet"));
8
- var _react = _interopRequireDefault(require("react"));
9
- var _reactLeaflet = require("react-leaflet");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
12
- const POSITION_CLASSES = {
13
- bottomleft: "leaflet-bottom leaflet-left",
14
- bottomright: "leaflet-bottom leaflet-right",
15
- topleft: "leaflet-top leaflet-left",
16
- topright: "leaflet-top leaflet-right"
17
- };
18
- const Control = props => {
19
- var _props$container;
20
- const [portalRoot, setPortalRoot] = _react.default.useState(document.createElement("div"));
21
- const positionClass = props.position && POSITION_CLASSES[props.position] || POSITION_CLASSES.topright;
22
- const controlContainerRef = /*#__PURE__*/_react.default.createRef();
23
- const map = (0, _reactLeaflet.useMap)();
24
-
25
- /**
26
- * Whenever the control container ref is created,
27
- * Ensure the click / scroll propagation is removed
28
- * This way click/scroll events do not bubble down to the map
29
- */
30
- _react.default.useEffect(() => {
31
- if (controlContainerRef.current !== null) {
32
- _leaflet.default.DomEvent.disableClickPropagation(controlContainerRef.current);
33
- _leaflet.default.DomEvent.disableScrollPropagation(controlContainerRef.current);
34
- }
35
- }, [controlContainerRef]);
36
-
37
- /**
38
- * Whenever the position is changed, go ahead and get the container of the map and the first
39
- * instance of the position class in that map container
40
- * Fixes #17
41
- */
42
- _react.default.useEffect(() => {
43
- const mapContainer = map.getContainer();
44
- const targetDiv = mapContainer.getElementsByClassName(positionClass);
45
- setPortalRoot(targetDiv[0]);
46
- }, [positionClass]);
47
-
48
- /**
49
- * Whenever the portal root is complete,
50
- * append or prepend the control container to the portal root
51
- */
52
- _react.default.useEffect(() => {
53
- if (portalRoot !== null) {
54
- if (props.prepend !== undefined && props.prepend === true) {
55
- portalRoot.prepend(controlContainerRef.current);
56
- } else {
57
- portalRoot.append(controlContainerRef.current);
58
- }
59
- }
60
- }, [portalRoot, props.prepend, controlContainerRef]);
61
-
62
- /**
63
- * Concatenate the props.container className to the class of the control div
64
- */
65
- const className = (((_props$container = props.container) === null || _props$container === void 0 || (_props$container = _props$container.className) === null || _props$container === void 0 ? void 0 : _props$container.concat(" ")) || "") + "leaflet-control";
66
-
67
- /**
68
- * Render
69
- */
70
- return /*#__PURE__*/_react.default.createElement("div", _extends({}, props.container, {
71
- ref: controlContainerRef,
72
- className: className
73
- }), props.children);
74
- };
75
- var _default = exports.default = Control;