iticket-seatingplan-dev 1.6.0 → 1.6.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.
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Map;
7
- require("leaflet-gesture-handling/dist/leaflet-gesture-handling.css");
7
+ require("./styles/gestureHandling.css");
8
8
  require("leaflet-draw/dist/leaflet.draw.css");
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _reactLeaflet = require("react-leaflet");
11
11
  var L = _interopRequireWildcard(require("leaflet"));
12
12
  var _reactLeafletDraw = require("react-leaflet-draw");
13
- var _leafletGestureHandling2 = require("leaflet-gesture-handling");
13
+ var _gestureHandling2 = require("./gestureHandling");
14
14
  var _reactLeafletCustomControl = _interopRequireDefault(require("react-leaflet-custom-control"));
15
15
  var _encodedSvgs = require("./assets/encodedSvgs");
16
16
  var _utils = require("../utils");
@@ -183,7 +183,7 @@ function Map(_ref) {
183
183
  // to allow users to scroll past the map when it's not full screen.
184
184
  (0, _react.useEffect)(() => {
185
185
  if (!isFullScreen) {
186
- map.addHandler("gestureHandling", _leafletGestureHandling2.GestureHandling);
186
+ map.addHandler("gestureHandling", _gestureHandling2.GestureHandling);
187
187
  // @ts-ignore
188
188
  map.gestureHandling.enable();
189
189
  }
@@ -377,17 +377,17 @@ function Map(_ref) {
377
377
  bounds: [[0, 0], [height * 0.03, width * 0.03]],
378
378
  zIndex: 10
379
379
  }), seats && seats.seats && seats.seats.map((s, i) => {
380
- var _chosenSeat$seat;
380
+ var _chosenSeat$seat, _chosenSeat$seat2;
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
384
  const isSingleFlexi = seatPrices.length === 1 && !!seatPrices[0].pMax && !!seatPrices[0].pMin && seatPrices[0].pMax > seatPrices[0].pMin;
385
385
  return /*#__PURE__*/_react.default.createElement("div", {
386
386
  key: i
387
- }, /*#__PURE__*/_react.default.createElement(_reactLeaflet.ImageOverlay, {
387
+ }, (s.loading || ticketPopupOpen && (chosenSeat === null || chosenSeat === void 0 || (_chosenSeat$seat = chosenSeat.seat) === null || _chosenSeat$seat === void 0 ? void 0 : _chosenSeat$seat.ssId) === s.ssId) && /*#__PURE__*/_react.default.createElement(_reactLeaflet.ImageOverlay, {
388
388
  url: "https://iticketseatingplan.blob.core.windows.net/embed/static/media/rippleload.08e6a08dd832819226ef.gif",
389
389
  bounds: [[(s.r.includes("NORTH") ? getNorthSeatLat(s) : seatCenter.lat) - 0.11, seatCenter.lng - 0.11], [(s.r.includes("NORTH") ? getNorthSeatLat(s) : seatCenter.lat) + 0.11, seatCenter.lng + 0.11]],
390
- opacity: s.loading || ticketPopupOpen && (chosenSeat === null || chosenSeat === void 0 || (_chosenSeat$seat = chosenSeat.seat) === null || _chosenSeat$seat === void 0 ? void 0 : _chosenSeat$seat.ssId) === s.ssId ? 100 : 0,
390
+ opacity: s.loading || ticketPopupOpen && (chosenSeat === null || chosenSeat === void 0 || (_chosenSeat$seat2 = chosenSeat.seat) === null || _chosenSeat$seat2 === void 0 ? void 0 : _chosenSeat$seat2.ssId) === s.ssId ? 100 : 0,
391
391
  zIndex: 10
392
392
  }), !priceSectionIds || priceSectionIds.includes(s.psId) ? s.s === _utils.statuses.WHEELCHAIR_ACCESS ? /*#__PURE__*/_react.default.createElement(_reactLeaflet.ImageOverlay, {
393
393
  url: _encodedSvgs.wheelchairIcon,
@@ -490,7 +490,8 @@ const SeatingPlan = _ref => {
490
490
  bounds: bounds
491
491
  // @ts-ignore
492
492
  ,
493
- whenReady: setMap
493
+ whenReady: setMap,
494
+ preferCanvas: true
494
495
  }, /*#__PURE__*/_react.default.createElement(_Map.default, {
495
496
  seats: seats,
496
497
  height: height,
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.GestureHandling = void 0;
7
+ var L = _interopRequireWildcard(require("leaflet"));
8
+ 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); }
9
+ 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; }
10
+ /*
11
+ * * Leaflet Gesture Handling **
12
+ * * Version 1.1.8
13
+ */
14
+
15
+ const LanguageContent = {
16
+ en: {
17
+ touch: "Use two fingers to move the map",
18
+ scroll: "Use ctrl + scroll to zoom the map",
19
+ scrollMac: "Use \u2318 + scroll to zoom the map"
20
+ }
21
+ };
22
+ L.Map.mergeOptions({
23
+ gestureHandlingOptions: {
24
+ text: {},
25
+ duration: 500
26
+ }
27
+ });
28
+ var draggingMap = false;
29
+ var GestureHandling = exports.GestureHandling = L.Handler.extend({
30
+ addHooks: function addHooks() {
31
+ this._handleTouch = this._handleTouch.bind(this);
32
+ this._setupPluginOptions();
33
+ this._setLanguageContent();
34
+ this._disableInteractions();
35
+
36
+ //Uses native event listeners instead of L.DomEvent due to issues with Android touch events
37
+ //turning into pointer events
38
+ this._map._container.addEventListener("touchstart", this._handleTouch);
39
+ this._map._container.addEventListener("touchmove", this._handleTouch);
40
+ this._map._container.addEventListener("touchend", this._handleTouch);
41
+ this._map._container.addEventListener("touchcancel", this._handleTouch);
42
+ this._map._container.addEventListener("click", this._handleTouch);
43
+ L.DomEvent.on(this._map._container, "wheel", this._handleScroll, this);
44
+ L.DomEvent.on(this._map, "mouseover", this._handleMouseOver, this);
45
+ // removed this as it's triggering on canvas points
46
+ // L.DomEvent.on(this._map, "mouseout", this._handleMouseOut, this);
47
+
48
+ // Listen to these events so will not disable dragging if the user moves the mouse out the boundary of the map container whilst actively dragging the map.
49
+ L.DomEvent.on(this._map, "movestart", this._handleDragging, this);
50
+ L.DomEvent.on(this._map, "move", this._handleDragging, this);
51
+ L.DomEvent.on(this._map, "moveend", this._handleDragging, this);
52
+ },
53
+ removeHooks: function removeHooks() {
54
+ this._enableInteractions();
55
+ this._map._container.removeEventListener("touchstart", this._handleTouch);
56
+ this._map._container.removeEventListener("touchmove", this._handleTouch);
57
+ this._map._container.removeEventListener("touchend", this._handleTouch);
58
+ this._map._container.removeEventListener("touchcancel", this._handleTouch);
59
+ this._map._container.removeEventListener("click", this._handleTouch);
60
+ L.DomEvent.off(this._map._container, "wheel", this._handleScroll, this);
61
+ L.DomEvent.off(this._map, "mouseover", this._handleMouseOver, this);
62
+ L.DomEvent.off(this._map, "mouseout", this._handleMouseOut, this);
63
+ L.DomEvent.off(this._map, "movestart", this._handleDragging, this);
64
+ L.DomEvent.off(this._map, "move", this._handleDragging, this);
65
+ L.DomEvent.off(this._map, "moveend", this._handleDragging, this);
66
+ },
67
+ _handleDragging: function _handleDragging(e) {
68
+ if (e.type == "movestart" || e.type == "move") {
69
+ draggingMap = true;
70
+ } else if (e.type == "moveend") {
71
+ draggingMap = false;
72
+ }
73
+ },
74
+ _disableInteractions: function _disableInteractions() {
75
+ this._map.dragging.disable();
76
+ this._map.scrollWheelZoom.disable();
77
+ if (this._map.tap) {
78
+ this._map.tap.disable();
79
+ }
80
+ },
81
+ _enableInteractions: function _enableInteractions() {
82
+ this._map.dragging.enable();
83
+ this._map.scrollWheelZoom.enable();
84
+ if (this._map.tap) {
85
+ this._map.tap.enable();
86
+ }
87
+ },
88
+ _setupPluginOptions: function _setupPluginOptions() {
89
+ //For backwards compatibility, merge gestureHandlingText into the new options object
90
+ if (this._map.options.gestureHandlingText) {
91
+ this._map.options.gestureHandlingOptions.text = this._map.options.gestureHandlingText;
92
+ }
93
+ },
94
+ _setLanguageContent: function _setLanguageContent() {
95
+ var languageContent;
96
+ //If user has supplied custom language, use that
97
+ if (this._map.options.gestureHandlingOptions && this._map.options.gestureHandlingOptions.text && this._map.options.gestureHandlingOptions.text.touch && this._map.options.gestureHandlingOptions.text.scroll && this._map.options.gestureHandlingOptions.text.scrollMac) {
98
+ languageContent = this._map.options.gestureHandlingOptions.text;
99
+ } else {
100
+ //Otherwise auto set it from the language files
101
+
102
+ //Determine their language e.g fr or en-US
103
+ // var lang = this._getUserLanguage();
104
+ var lang = "en";
105
+
106
+ //If we couldn't find it default to en
107
+ // if (!lang) {
108
+ // lang = "en";
109
+ // }
110
+
111
+ //Lookup the appropriate language content
112
+ if (LanguageContent[lang]) {
113
+ languageContent = LanguageContent[lang];
114
+ }
115
+
116
+ //If no result, try searching by the first part only. e.g en-US just use en.
117
+ if (!languageContent && lang.indexOf("-") !== -1) {
118
+ lang = lang.split("-")[0];
119
+ languageContent = LanguageContent[lang];
120
+ }
121
+ if (!languageContent) {
122
+ // If still nothing, default to English
123
+ // console.log("No lang found for", lang);
124
+ lang = "en";
125
+ languageContent = LanguageContent[lang];
126
+ }
127
+ }
128
+
129
+ //TEST
130
+ // languageContent = LanguageContent["bg"];
131
+
132
+ //Check if they're on a mac for display of command instead of ctrl
133
+ var mac = false;
134
+ if (navigator.platform.toUpperCase().indexOf("MAC") >= 0) {
135
+ mac = true;
136
+ }
137
+ var scrollContent = languageContent.scroll;
138
+ if (mac) {
139
+ scrollContent = languageContent.scrollMac;
140
+ }
141
+ this._map._container.setAttribute("data-gesture-handling-touch-content", languageContent.touch);
142
+ this._map._container.setAttribute("data-gesture-handling-scroll-content", scrollContent);
143
+ },
144
+ _getUserLanguage: function _getUserLanguage() {
145
+ var lang = navigator.languages ? navigator.languages[0] : navigator.language;
146
+ return lang;
147
+ },
148
+ _handleTouch: function _handleTouch(e) {
149
+ //Disregard touch events on the minimap if present
150
+ var ignoreList = ["leaflet-control-minimap", "leaflet-interactive", "leaflet-popup-content", "leaflet-popup-content-wrapper", "leaflet-popup-close-button", "leaflet-control-zoom-in", "leaflet-control-zoom-out"];
151
+ var ignoreElement = false;
152
+ for (var i = 0; i < ignoreList.length; i++) {
153
+ if (L.DomUtil.hasClass(e.target, ignoreList[i])) {
154
+ ignoreElement = true;
155
+ }
156
+ }
157
+ if (ignoreElement) {
158
+ if (L.DomUtil.hasClass(e.target, "leaflet-interactive") && e.type === "touchmove" && e.touches.length === 1) {
159
+ L.DomUtil.addClass(this._map._container, "leaflet-gesture-handling-touch-warning");
160
+ this._disableInteractions();
161
+ } else {
162
+ L.DomUtil.removeClass(this._map._container, "leaflet-gesture-handling-touch-warning");
163
+ }
164
+ return;
165
+ }
166
+ // screenLog(e.type+' '+e.touches.length);
167
+ if (e.type !== "touchmove" && e.type !== "touchstart") {
168
+ L.DomUtil.removeClass(this._map._container, "leaflet-gesture-handling-touch-warning");
169
+ return;
170
+ }
171
+ if (e.touches.length === 1) {
172
+ // added condition for touchmove, because the overlay appearing when you only clicked is annoying.
173
+ if (e.type === "touchmove") {
174
+ L.DomUtil.addClass(this._map._container, "leaflet-gesture-handling-touch-warning");
175
+ this._disableInteractions();
176
+ }
177
+ } else {
178
+ e.preventDefault();
179
+ this._enableInteractions();
180
+ L.DomUtil.removeClass(this._map._container, "leaflet-gesture-handling-touch-warning");
181
+ }
182
+ },
183
+ _isScrolling: false,
184
+ _handleScroll: function _handleScroll(e) {
185
+ if (e.metaKey || e.ctrlKey) {
186
+ e.preventDefault();
187
+ L.DomUtil.removeClass(this._map._container, "leaflet-gesture-handling-scroll-warning");
188
+ this._map.scrollWheelZoom.enable();
189
+ } else {
190
+ L.DomUtil.addClass(this._map._container, "leaflet-gesture-handling-scroll-warning");
191
+ this._map.scrollWheelZoom.disable();
192
+ clearTimeout(this._isScrolling);
193
+
194
+ // Set a timeout to run after scrolling ends
195
+ this._isScrolling = setTimeout(function () {
196
+ // Run the callback
197
+ var warnings = document.getElementsByClassName("leaflet-gesture-handling-scroll-warning");
198
+ for (var i = 0; i < warnings.length; i++) {
199
+ L.DomUtil.removeClass(warnings[i], "leaflet-gesture-handling-scroll-warning");
200
+ }
201
+ }, this._map.options.gestureHandlingOptions.duration);
202
+ }
203
+ },
204
+ _handleMouseOver: function _handleMouseOver(e) {
205
+ this._enableInteractions();
206
+ },
207
+ _handleMouseOut: function _handleMouseOut(e) {
208
+ if (!draggingMap) {
209
+ this._disableInteractions();
210
+ }
211
+ }
212
+ });
213
+ L.Map.addInitHook("addHandler", "gestureHandling", GestureHandling);
214
+ var _default = exports.default = GestureHandling;
@@ -0,0 +1,40 @@
1
+ @keyframes leaflet-gestures-fadein {
2
+ 0% {
3
+ opacity: 0;
4
+ }
5
+ 100% {
6
+ opacity: 1;
7
+ }
8
+ }
9
+
10
+ .leaflet-container::after {
11
+ animation: leaflet-gestures-fadein 0.8s backwards;
12
+ color: #fff;
13
+ font-family: "Roboto", Arial, sans-serif;
14
+ font-size: 22px;
15
+ justify-content: center;
16
+ display: flex;
17
+ align-items: center;
18
+ padding: 15px;
19
+ position: absolute;
20
+ top: 0;
21
+ left: 0;
22
+ right: 0;
23
+ bottom: 0;
24
+ background: rgba(0, 0, 0, 0.5);
25
+ z-index: 461;
26
+ pointer-events: none;
27
+ }
28
+
29
+ .leaflet-gesture-handling-touch-warning::after,
30
+ .leaflet-gesture-handling-scroll-warning::after {
31
+ animation: leaflet-gestures-fadein 0.8s forwards;
32
+ }
33
+
34
+ .leaflet-gesture-handling-touch-warning::after {
35
+ content: attr(data-gesture-handling-touch-content);
36
+ }
37
+
38
+ .leaflet-gesture-handling-scroll-warning::after {
39
+ content: attr(data-gesture-handling-scroll-content);
40
+ }
@@ -18,7 +18,8 @@ const getInitialColor = (s, price, selected) => {
18
18
  return {
19
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,
20
20
  color: "none",
21
- fillOpacity: s.loading ? 0 : 1
21
+ fillOpacity: s.loading ? 0 : 1,
22
+ stroke: false
22
23
  };
23
24
  };
24
25
  exports.getInitialColor = getInitialColor;
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.0",
5
+ "version": "1.6.2",
6
6
  "private": false,
7
7
  "keywords": [
8
8
  "iticket",