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.
- package/dist/components/Flexi.js +16 -3
- package/dist/components/HoverPopup.js +120 -0
- package/dist/components/InvalidSeatsPopup.js +3 -3
- package/dist/components/Map.js +65 -17
- package/dist/components/PriceButton.js +3 -2
- package/dist/components/PricingPopup.js +369 -87
- package/dist/components/RemoveMultipleSeatsPopup.js +3 -3
- package/dist/components/SeatingPlan.js +40 -62
- package/dist/components/SelectQuantityPopup.js +4 -4
- package/dist/components/icons/MinusIcon.js +31 -0
- package/dist/components/icons/PlusIcon.js +31 -0
- package/dist/components/styles/flexi.css +21 -3
- package/dist/components/styles/index.css +475 -2
- package/dist/components/styles/pos.css +0 -206
- package/dist/utils/helpers.js +75 -27
- package/package.json +1 -1
package/dist/utils/helpers.js
CHANGED
|
@@ -3,15 +3,31 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getValidSeats = exports.getRowSection = exports.getInitialColor = exports.getAdjacentBookedSeats = exports.createsOrphan = exports.canSelectSingleSeatGivenOrphanRules = exports.calculateCenterOfMap = exports.NZDollar = void 0;
|
|
6
|
+
exports.isTouchScreen = exports.getValidSeats = exports.getRowSection = exports.getRetryDelay = exports.getInitialColor = exports.getAdjacentBookedSeats = exports.createsOrphan = exports.canSelectSingleSeatGivenOrphanRules = exports.calculateCenterOfMap = exports.NZDollar = void 0;
|
|
7
7
|
var _enums = require("./enums");
|
|
8
|
-
const
|
|
8
|
+
const isTouchScreen = () => {
|
|
9
|
+
let hasTouchScreen = false;
|
|
10
|
+
if (typeof window !== "undefined") {
|
|
11
|
+
if ("maxTouchPoints" in window.navigator) {
|
|
12
|
+
hasTouchScreen = window.navigator.maxTouchPoints > 0;
|
|
13
|
+
} else {
|
|
14
|
+
var _matchMedia;
|
|
15
|
+
const mQ = (_matchMedia = matchMedia) === null || _matchMedia === void 0 ? void 0 : _matchMedia("(pointer:coarse)");
|
|
16
|
+
if ((mQ === null || mQ === void 0 ? void 0 : mQ.media) === "(pointer:coarse)") {
|
|
17
|
+
hasTouchScreen = !!mQ.matches;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return hasTouchScreen;
|
|
22
|
+
};
|
|
23
|
+
exports.isTouchScreen = isTouchScreen;
|
|
24
|
+
const getInitialColor = (s, price, loading, disabled, selected, greyedOut) => {
|
|
9
25
|
// selected state for multiselect
|
|
10
26
|
if (selected) {
|
|
11
27
|
return {
|
|
12
28
|
fillColor: _enums.statusColors.selected,
|
|
13
29
|
color: "none",
|
|
14
|
-
fillOpacity:
|
|
30
|
+
fillOpacity: loading ? 0 : 1,
|
|
15
31
|
stroke: false
|
|
16
32
|
};
|
|
17
33
|
}
|
|
@@ -19,19 +35,20 @@ const getInitialColor = (s, price, disabled, selected, greyedOut) => {
|
|
|
19
35
|
return {
|
|
20
36
|
fillColor: _enums.statusColors.unknown,
|
|
21
37
|
color: "none",
|
|
22
|
-
fillOpacity:
|
|
38
|
+
fillOpacity: loading ? 0 : 1,
|
|
39
|
+
stroke: false
|
|
23
40
|
};
|
|
24
41
|
}
|
|
25
42
|
return {
|
|
26
43
|
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,
|
|
27
44
|
color: "none",
|
|
28
|
-
fillOpacity:
|
|
45
|
+
fillOpacity: loading ? 0 : 1,
|
|
29
46
|
stroke: false
|
|
30
47
|
};
|
|
31
48
|
};
|
|
32
49
|
exports.getInitialColor = getInitialColor;
|
|
33
50
|
const calculateCenterOfMap = (height, seats, priceSectionIds) => {
|
|
34
|
-
const filteredSeats = seats.filter(price => !priceSectionIds || priceSectionIds.includes(price.psId));
|
|
51
|
+
const filteredSeats = (seats === null || seats === void 0 ? void 0 : seats.filter(price => !priceSectionIds || priceSectionIds.includes(price.psId))) || [];
|
|
35
52
|
const avgY = filteredSeats.reduce((acc, val) => {
|
|
36
53
|
return acc + val.y / filteredSeats.length;
|
|
37
54
|
}, 0);
|
|
@@ -121,7 +138,8 @@ const getSeats = (seat, rowSectionMap, desiredSeatQuantity, rowSection, ignoreOr
|
|
|
121
138
|
const sb = rowSectionMap.get(firstSeat.sb);
|
|
122
139
|
const sbb = rowSectionMap.get(sb === null || sb === void 0 ? void 0 : sb.sb);
|
|
123
140
|
const orphanToLeft = sb && sbb && sb.s === _enums.statuses.UNSOLD && sbb.s !== _enums.statuses.UNSOLD || sb && !sbb && sb.s === _enums.statuses.UNSOLD;
|
|
124
|
-
|
|
141
|
+
const orphanToLeftIsEnd = orphanToLeft && !sbb;
|
|
142
|
+
if (seats.length < desiredSeatQuantity || !ignoreOrphans && orphanToLeft || ignoreOrphans && !orphanToLeftIsEnd) {
|
|
125
143
|
seats = [seat];
|
|
126
144
|
traverse(seats, seat, "left", rowSectionMap, desiredSeatQuantity, rowSection, ignoreOrphans);
|
|
127
145
|
if (seats.length < desiredSeatQuantity) {
|
|
@@ -147,29 +165,48 @@ const getValidSeats = (s, seatsMap, desiredSeatQuantity) => {
|
|
|
147
165
|
};
|
|
148
166
|
}
|
|
149
167
|
const seatsToBook = getSeats(s, rowSectionMap, desiredSeatQuantity, rowSection);
|
|
150
|
-
if (seatsToBook.length
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
if (seatsToBook.length === desiredSeatQuantity) {
|
|
169
|
+
return {
|
|
170
|
+
seats: seatsToBook,
|
|
171
|
+
valid: true
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
let hasOtherOptions = false;
|
|
175
|
+
const orphaningSeats = getSeats(s, rowSectionMap, desiredSeatQuantity, rowSection, true);
|
|
176
|
+
if (orphaningSeats.length < desiredSeatQuantity) {
|
|
177
|
+
return {
|
|
178
|
+
seats: seatsToBook,
|
|
179
|
+
valid: false
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
const otherAvailableSeats = rowSection.filter(seat => seat.s === _enums.statuses.UNSOLD && seat.sId !== s.sId);
|
|
183
|
+
if (otherAvailableSeats.length > 0) {
|
|
184
|
+
for (const seat of otherAvailableSeats) {
|
|
185
|
+
const possibleSeats = getSeats(seat, rowSectionMap, desiredSeatQuantity, rowSection);
|
|
186
|
+
if (possibleSeats.length === desiredSeatQuantity) {
|
|
187
|
+
hasOtherOptions = true;
|
|
188
|
+
break;
|
|
163
189
|
}
|
|
164
|
-
return {
|
|
165
|
-
seats: orphaningSeats,
|
|
166
|
-
valid: hasOtherOptions ? false : true
|
|
167
|
-
};
|
|
168
190
|
}
|
|
169
191
|
}
|
|
192
|
+
if (hasOtherOptions) {
|
|
193
|
+
return {
|
|
194
|
+
seats: seatsToBook,
|
|
195
|
+
valid: false
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
const firstSeat = orphaningSeats[0];
|
|
199
|
+
const lastSeat = orphaningSeats[orphaningSeats.length - 1];
|
|
200
|
+
if (!firstSeat.sb || !lastSeat.sa) {
|
|
201
|
+
// user should instead select seats that leave the orphan at the end of the row
|
|
202
|
+
return {
|
|
203
|
+
seats: orphaningSeats,
|
|
204
|
+
valid: false
|
|
205
|
+
};
|
|
206
|
+
}
|
|
170
207
|
return {
|
|
171
|
-
seats:
|
|
172
|
-
valid:
|
|
208
|
+
seats: orphaningSeats,
|
|
209
|
+
valid: true
|
|
173
210
|
};
|
|
174
211
|
};
|
|
175
212
|
exports.getValidSeats = getValidSeats;
|
|
@@ -194,4 +231,15 @@ const getAdjacentBookedSeats = (seat, seatsMap) => {
|
|
|
194
231
|
traverseRow(seat, "left");
|
|
195
232
|
return adjacentBookedSeats;
|
|
196
233
|
};
|
|
197
|
-
exports.getAdjacentBookedSeats = getAdjacentBookedSeats;
|
|
234
|
+
exports.getAdjacentBookedSeats = getAdjacentBookedSeats;
|
|
235
|
+
const getRetryDelay = (response, attempt) => {
|
|
236
|
+
var _ref, _ref2, _response$headers$get;
|
|
237
|
+
const retryAfter = (_ref = (_ref2 = (_response$headers$get = response.headers.get("Retry-After")) !== null && _response$headers$get !== void 0 ? _response$headers$get : response.headers.get("retry-after")) !== null && _ref2 !== void 0 ? _ref2 : response.headers.get("rl-twm")) !== null && _ref !== void 0 ? _ref : "5";
|
|
238
|
+
if (retryAfter) {
|
|
239
|
+
return response.headers.get("rl-twm") ? Math.round(parseInt(retryAfter) * 60 * 1000) : parseInt(retryAfter) * 1000;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// adds jitter
|
|
243
|
+
return attempt + Math.random() * 1000;
|
|
244
|
+
};
|
|
245
|
+
exports.getRetryDelay = getRetryDelay;
|