iticket-seatingplan-dev 1.8.7 → 1.8.9

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.
@@ -423,7 +423,12 @@ function SeatMap(_ref) {
423
423
  }), (seats === null || seats === void 0 ? void 0 : seats.background) && /*#__PURE__*/_react.default.createElement(_reactLeaflet.ImageOverlay, {
424
424
  url: seats === null || seats === void 0 ? void 0 : seats.background,
425
425
  bounds: [[0, 0], [height * 0.03, width * 0.03]],
426
- zIndex: 10
426
+ zIndex: 10,
427
+ eventHandlers: {
428
+ error: i => {
429
+ i.target.remove();
430
+ }
431
+ }
427
432
  }), seats && seats.seats && seats.seats.map((s, i) => {
428
433
  var _seatsMap$get2, _seats$pricing3, _chosenSeat$seat, _chosenSeat$seat2, _chosenSeat$seat3;
429
434
  const seatCenter = ((_seatsMap$get2 = seatsMap.get(s.sId)) === null || _seatsMap$get2 === void 0 ? void 0 : _seatsMap$get2.center) || {
@@ -496,15 +496,19 @@ const SeatingPlan = _ref => {
496
496
  setSelectQuantityPopupOpen(true);
497
497
  }
498
498
  };
499
+ const fallbackHeight = 800;
500
+ const fallbackWidth = 800;
499
501
  if (data.background) {
500
502
  img.src = data.background;
503
+ img.onerror = () => {
504
+ setupSeats(fallbackHeight, fallbackWidth);
505
+ img.src = "";
506
+ };
501
507
  img.onload = () => {
502
508
  setupSeats(img.height, img.width);
503
509
  };
504
510
  } else {
505
- const estHeight = 800;
506
- const estWidth = 800;
507
- setupSeats(estHeight, estWidth);
511
+ setupSeats(fallbackHeight, fallbackWidth);
508
512
  }
509
513
  setIsReloading(false);
510
514
  } catch (error) {
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.8.7",
5
+ "version": "1.8.9",
6
6
  "private": false,
7
7
  "keywords": [
8
8
  "iticket",
@@ -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;