iticket-seatingplan-dev 1.3.7 → 1.4.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.
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const Badge = props => {
10
+ return /*#__PURE__*/_react.default.createElement("div", {
11
+ className: "badge ".concat(!props.value ? 'badge--none' : '', " ")
12
+ }, /*#__PURE__*/_react.default.createElement("h4", {
13
+ className: "heavy"
14
+ }, props.value || 0));
15
+ };
16
+ var _default = Badge;
17
+ exports.default = _default;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const Button = props => {
10
+ return /*#__PURE__*/_react.default.createElement("button", {
11
+ className: "btn btn--".concat(props.kind, " CTA"),
12
+ "data-id": props.id,
13
+ type: props.type,
14
+ name: props.name,
15
+ value: props.value,
16
+ disabled: props.disabled,
17
+ onClick: props.handleClick
18
+ }, /*#__PURE__*/_react.default.createElement("h4", null, props.label));
19
+ };
20
+ var _default = Button;
21
+ exports.default = _default;
@@ -0,0 +1,275 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Map;
7
+ require("leaflet-gesture-handling/dist/leaflet-gesture-handling.css");
8
+ var _reactLeaflet = require("react-leaflet");
9
+ var _leafletGestureHandling2 = require("leaflet-gesture-handling");
10
+ var _reactLeafletCustomControl = _interopRequireDefault(require("react-leaflet-custom-control"));
11
+ var _encodedSvgs = require("./assets/encodedSvgs");
12
+ var _utils = require("../utils");
13
+ var _react = require("react");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function Map(_ref) {
16
+ let {
17
+ seats,
18
+ height,
19
+ width,
20
+ bounds,
21
+ handleClickSeat,
22
+ ticketPopupOpen,
23
+ setTicketPopupOpen,
24
+ chosenSeat,
25
+ addTicketToCart,
26
+ isReloading,
27
+ initialFetch,
28
+ isFullScreen,
29
+ setIsFullScreen,
30
+ priceSectionIds,
31
+ areaName,
32
+ price
33
+ } = _ref;
34
+ const [isLegendOpen, setIsLegendOpen] = (0, _react.useState)(false);
35
+ const map = (0, _reactLeaflet.useMap)();
36
+ (0, _react.useEffect)(() => {
37
+ const closeOnEscape = e => {
38
+ if (e.key === "Escape") {
39
+ if (isFullScreen && !ticketPopupOpen) {
40
+ setIsFullScreen(false);
41
+ } else if (ticketPopupOpen) {
42
+ map.closePopup();
43
+ }
44
+ }
45
+ };
46
+ if (typeof window !== "undefined") {
47
+ window.addEventListener("keydown", closeOnEscape);
48
+ }
49
+ return () => {
50
+ if (typeof window !== "undefined") {
51
+ window.removeEventListener("keydown", closeOnEscape);
52
+ }
53
+ };
54
+ }, [isFullScreen, ticketPopupOpen]);
55
+
56
+ // gesture-handling plugin disallows scroll zooming and touch panning,
57
+ // to allow users to scroll past the map when it's not full screen.
58
+ (0, _react.useEffect)(() => {
59
+ if (!isFullScreen) {
60
+ map.addHandler("gestureHandling", _leafletGestureHandling2.GestureHandling);
61
+ map.gestureHandling.enable();
62
+ }
63
+ }, [map, isFullScreen]);
64
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_reactLeafletCustomControl.default, {
65
+ position: "bottomright"
66
+ }, /*#__PURE__*/React.createElement("div", {
67
+ className: "legendBox"
68
+ }, /*#__PURE__*/React.createElement("div", {
69
+ className: "legend-header"
70
+ }, /*#__PURE__*/React.createElement("button", {
71
+ className: "legend-button ".concat(isLegendOpen ? "expanded" : ""),
72
+ onClick: () => setIsLegendOpen(!isLegendOpen)
73
+ }, /*#__PURE__*/React.createElement("p", null, isLegendOpen ? "LEGEND:" : "VIEW LEGEND")), isLegendOpen && /*#__PURE__*/React.createElement("button", {
74
+ className: "close-button",
75
+ onClick: () => setIsLegendOpen(false)
76
+ }, /*#__PURE__*/React.createElement("img", {
77
+ src: _encodedSvgs.closeIcon,
78
+ alt: "close"
79
+ }))), /*#__PURE__*/React.createElement("div", {
80
+ className: "legend-contents ".concat(isLegendOpen ? "expanded" : "")
81
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
82
+ className: "legend-item"
83
+ }, /*#__PURE__*/React.createElement("div", {
84
+ className: "legend-symbol legend-available"
85
+ }), /*#__PURE__*/React.createElement("p", null, "available"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
86
+ className: "legend-item"
87
+ }, /*#__PURE__*/React.createElement("div", {
88
+ className: "legend-symbol legend-sold"
89
+ }), /*#__PURE__*/React.createElement("p", null, "sold"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
90
+ className: "legend-item"
91
+ }, /*#__PURE__*/React.createElement("div", {
92
+ className: "legend-symbol legend-in-cart"
93
+ }), /*#__PURE__*/React.createElement("p", null, "in cart"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
94
+ className: "legend-item"
95
+ }, /*#__PURE__*/React.createElement("img", {
96
+ src: _encodedSvgs.wheelchairIcon,
97
+ width: 15,
98
+ height: 15
99
+ }), /*#__PURE__*/React.createElement("p", null, "wheelchair"))), seats.seats.filter(seat => seat.m).length > 0 ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
100
+ className: "legend-item"
101
+ }, /*#__PURE__*/React.createElement("img", {
102
+ src: _encodedSvgs.userIcon,
103
+ width: 15,
104
+ height: 15
105
+ }), /*#__PURE__*/React.createElement("p", null, "membership seats"))) : /*#__PURE__*/React.createElement(React.Fragment, null)))), /*#__PURE__*/React.createElement(_reactLeafletCustomControl.default, {
106
+ position: "topleft"
107
+ }, /*#__PURE__*/React.createElement("div", {
108
+ className: "extra-controls"
109
+ }, /*#__PURE__*/React.createElement("button", {
110
+ title: "Re-centre Seating Plan",
111
+ onClick: () => map.fitBounds(bounds),
112
+ className: "leaflet-control-zoom-in"
113
+ }, /*#__PURE__*/React.createElement("img", {
114
+ src: "https://au-iticket-shop-legacy.azurewebsites.net/assets/images/fit-icon.jpg",
115
+ style: {
116
+ height: "17px"
117
+ }
118
+ })), /*#__PURE__*/React.createElement("button", {
119
+ title: "Reload Seating Plan",
120
+ disabled: isReloading,
121
+ onClick: () => {
122
+ initialFetch(true);
123
+ map.fitBounds(bounds);
124
+ },
125
+ className: "leaflet-control-zoom-in reload-seating-plan",
126
+ style: {
127
+ background: isReloading ? "rgb(0, 230, 64)" : "#fff"
128
+ }
129
+ }, /*#__PURE__*/React.createElement("img", {
130
+ className: isReloading ? "rotate" : "",
131
+ src: "https://au-iticket-shop-legacy.azurewebsites.net/assets/images/refresh.png",
132
+ style: {
133
+ height: "17px"
134
+ }
135
+ })))), /*#__PURE__*/React.createElement(_reactLeafletCustomControl.default, {
136
+ position: "topleft"
137
+ }, /*#__PURE__*/React.createElement("div", {
138
+ className: "extra-controls"
139
+ }, /*#__PURE__*/React.createElement("button", {
140
+ title: isFullScreen ? "Collapse Seating Plan" : "Expand Seating Plan",
141
+ onClick: () => {
142
+ setIsFullScreen(!isFullScreen);
143
+ },
144
+ className: "leaflet-control-zoom-in"
145
+ }, /*#__PURE__*/React.createElement("img", {
146
+ src: isFullScreen ? _encodedSvgs.collapseIcon : _encodedSvgs.expandIcon,
147
+ style: {
148
+ height: "24px"
149
+ }
150
+ })))), /*#__PURE__*/React.createElement(_reactLeafletCustomControl.default, {
151
+ position: "topright"
152
+ }, /*#__PURE__*/React.createElement("button", {
153
+ title: "Close full screen",
154
+ onClick: () => setIsFullScreen(false),
155
+ className: "full-screen-close-button ".concat(isFullScreen ? "show" : "")
156
+ }, /*#__PURE__*/React.createElement("img", {
157
+ src: _encodedSvgs.closeIcon,
158
+ style: {
159
+ height: "24px"
160
+ }
161
+ }))), /*#__PURE__*/React.createElement(_reactLeaflet.ImageOverlay, {
162
+ url: seats.background,
163
+ bounds: [[0, 0], [height * 0.03, width * 0.03]],
164
+ zIndex: 10
165
+ }), seats && seats.seats && seats.seats.map((s, i) => {
166
+ var _chosenSeat$seat;
167
+ return /*#__PURE__*/React.createElement("div", {
168
+ key: i
169
+ }, /*#__PURE__*/React.createElement(_reactLeaflet.ImageOverlay, {
170
+ url: "https://iticketseatingplan.blob.core.windows.net/embed/static/media/rippleload.08e6a08dd832819226ef.gif",
171
+ bounds: [[(s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207)) - 0.11, s.x * 0.3 + 0.15 - 0.11], [(s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207)) + 0.11, s.x * 0.3 + 0.15 + 0.11]
172
+ // [height * 0.0302 - s.y * 0.602 - 0.3, s.x * 0.61 - 0.3],
173
+ // [height * 0.0302 - s.y * 0.602 + 0.3, s.x * 0.61 + 0.3],
174
+ // [height * 0.0302 - s.y * 0.602 - 0.17, s.x * 0.61 - 0.17],
175
+ // [height * 0.0302 - s.y * 0.602 + 0.17, s.x * 0.61 + 0.17],
176
+ ],
177
+
178
+ opacity: s.loading || ticketPopupOpen && (chosenSeat === null || chosenSeat === void 0 ? void 0 : (_chosenSeat$seat = chosenSeat.seat) === null || _chosenSeat$seat === void 0 ? void 0 : _chosenSeat$seat.ssId) === s.ssId ? 100 : 0,
179
+ zIndex: 10
180
+ }), !priceSectionIds || priceSectionIds.includes(s.psId) ? s.s === _utils.statuses.WHEELCHAIR_ACCESS ? /*#__PURE__*/React.createElement(_reactLeaflet.ImageOverlay, {
181
+ url: _encodedSvgs.wheelchairIcon,
182
+ bounds: [
183
+ // [
184
+ // height * 0.0302 - s.y * 0.602 - 0.17,
185
+ // s.x * 0.61 - 0.17,
186
+ // ],
187
+ // [
188
+ // height * 0.0302 - s.y * 0.602 + 0.17,
189
+ // s.x * 0.61 + 0.17,
190
+ // ],
191
+ [height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) - 0.11, s.x * 0.3 + 0.15 - 0.11], [height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) + 0.11, s.x * 0.3 + 0.15 + 0.11]],
192
+ zIndex: 10
193
+ }) : s.s === _utils.statuses.USER_PENDING && s.m ? /*#__PURE__*/React.createElement(_reactLeaflet.ImageOverlay, {
194
+ url: _encodedSvgs.userIcon,
195
+ bounds: [
196
+ // [
197
+ // height * 0.0302 - s.y * 0.602 - 0.17,
198
+ // s.x * 0.61 - 0.17,
199
+ // ],
200
+ // [
201
+ // height * 0.0302 - s.y * 0.602 + 0.17,
202
+ // s.x * 0.61 + 0.17,
203
+ // ],
204
+ [height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) - 0.11, s.x * 0.3 + 0.15 - 0.15], [height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.5 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207) + 0.11, s.x * 0.3 + 0.15 + 0.15]],
205
+ zIndex: 10
206
+ }) : /*#__PURE__*/React.createElement(_reactLeaflet.Circle, {
207
+ center: [
208
+ // height * 0.0305 -
209
+ // s.y * 0.57 -
210
+ // height * (height > 700 ? 0.0001 : 0.0006),
211
+ // s.x * 0.6 + 0.25,
212
+ //experimental
213
+ // 14.42,
214
+ // (height / 33.33 - 0.3 * s.y).toFixed(1)
215
+ // height / 33.33 - (height / 33.33) * s.y * 0.01, //29, //3 27, // height / 33.33 - s.y, // s.y * 0.3, //+ (height / 0.503) * 0.01, //11.66, // 5.2,
216
+ //working
217
+ s.r.includes("NORTH") ? height / 33.33 - height / 33.33 * s.y * 0.0105 + 1.4 : height * 0.05 - s.y / (height > 800 ? height > 999 ? 3.45 : 3.3 : 3.35) - (height > 800 ? height > 999 ? height * 0.0201 : height * 0.0198 : height > 587 ? height * 0.0201 : height > 399 ? height * 0.02035 : height * 0.0207),
218
+ // s.r.includes('NORTH')
219
+ // ? 0
220
+ // : 0,
221
+ s.x * 0.3 + 0.15
222
+
223
+ // height * 0.04 -
224
+ // s.y / (height > 800 ? 3.5 : 3.35) -
225
+ // (height > 800 ? height * 0.0101 : height * 0.0201),
226
+ // s.x * 0.3 + 0.15,
227
+
228
+ // -s.y * (height * 0.00037) + 24.2,
229
+ // s.x * 0.3 + 0.15,
230
+ ],
231
+
232
+ pathOptions: (0, _utils.getInitialColor)(s, price),
233
+ radius: 12000,
234
+ eventHandlers: {
235
+ click: e => handleClickSeat(e, s),
236
+ popupopen: () => {
237
+ setTicketPopupOpen(true);
238
+ },
239
+ popupclose: () => {
240
+ setTicketPopupOpen(false);
241
+ }
242
+ }
243
+ // value={s}
244
+ }, /*#__PURE__*/React.createElement(_reactLeaflet.Tooltip, {
245
+ className: "seatname-tooltip",
246
+ direction: "top",
247
+ offset: [0, height * 0.03 + -30]
248
+ }, s.r + "-" + s.c), s.s === _utils.statuses.UNSOLD && /*#__PURE__*/React.createElement(_reactLeaflet.Popup, {
249
+ className: "ticket-popup"
250
+ }, /*#__PURE__*/React.createElement("div", {
251
+ className: "popup-header"
252
+ }, /*#__PURE__*/React.createElement("p", {
253
+ className: "seatname"
254
+ }, "".concat(areaName ? areaName + " | " : "").concat(s.r, "-").concat(s.c)), /*#__PURE__*/React.createElement("button", {
255
+ className: "close-button",
256
+ "aria-label": "close popup",
257
+ onClick: () => map.closePopup()
258
+ }, /*#__PURE__*/React.createElement("img", {
259
+ src: _encodedSvgs.closeIcon,
260
+ alt: "close"
261
+ }))), /*#__PURE__*/React.createElement("p", {
262
+ className: "heading"
263
+ }, "Select option:"), seats.pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && price.psId === s.psId).map(price => /*#__PURE__*/React.createElement("div", {
264
+ key: price.paId,
265
+ className: "priceage",
266
+ onClick: () => {
267
+ s.loading = true;
268
+ map.closePopup();
269
+ addTicketToCart(s, price);
270
+ }
271
+ }, /*#__PURE__*/React.createElement("p", {
272
+ className: "price"
273
+ }, /*#__PURE__*/React.createElement("span", null, price.paName), /*#__PURE__*/React.createElement("span", null, _utils.NZDollar.format(price.p))))))) : /*#__PURE__*/React.createElement(React.Fragment, null));
274
+ }));
275
+ }