iticket-seatingplan-dev 1.8.1 → 1.8.3
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/SeatingPlan.js +191 -137
- package/dist/components/styles/index.css +16 -0
- package/dist/utils/enums.js +2 -1
- package/package.json +1 -1
|
@@ -24,7 +24,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
24
24
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
26
26
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
|
-
const
|
|
27
|
+
const SEATINGPLAN_MAX_RETRIES = 5;
|
|
28
|
+
const BOOKING_MAX_RETRIES = 2;
|
|
28
29
|
const SeatingPlan = _ref => {
|
|
29
30
|
var _document, _document2, _document3;
|
|
30
31
|
let {
|
|
@@ -67,6 +68,7 @@ const SeatingPlan = _ref => {
|
|
|
67
68
|
const [seatsToRemove, setSeatsToRemove] = (0, _react.useState)([]);
|
|
68
69
|
const [removeMultipleSeatsPopupOpen, setRemoveMultipleSeatsPopupOpen] = (0, _react.useState)(false);
|
|
69
70
|
const [invalidSeatsPopupOpen, setInvalidSeatsPopupOpen] = (0, _react.useState)(false);
|
|
71
|
+
const [retrying, setRetrying] = (0, _react.useState)([]);
|
|
70
72
|
const mapRef = (0, _react.useRef)(null);
|
|
71
73
|
const canMultiSelect = bookingMode === _utils.bookingModes.POS;
|
|
72
74
|
const apiUrl = "".concat(baseUrl, "/legacy/").concat(countryCode, "/shop/events/").concat(eventId, "/").concat(eventVenueId, "/showings/").concat(showingId, "/tickets/allocated/").concat(areaId);
|
|
@@ -83,17 +85,22 @@ const SeatingPlan = _ref => {
|
|
|
83
85
|
};
|
|
84
86
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
85
87
|
};
|
|
86
|
-
const
|
|
88
|
+
const updateSeat = (seatIndex, newSeat) => {
|
|
89
|
+
if (seatIndex !== -1) {
|
|
90
|
+
setSeats(prev => {
|
|
91
|
+
const updatedSeats = _objectSpread({}, prev);
|
|
92
|
+
updatedSeats.seats[seatIndex] = newSeat;
|
|
93
|
+
return updatedSeats;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const _addTicketToCart = async function addTicketToCart(s, priceage) {
|
|
87
98
|
var _mapRef$current;
|
|
88
|
-
|
|
89
|
-
const seatIndex =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
setSeats(updatedSeats);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
setSeatLoading(true);
|
|
99
|
+
let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
100
|
+
const seatIndex = seats.seats.findIndex(seat => seat.ssId === s.ssId);
|
|
101
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
102
|
+
loading: true
|
|
103
|
+
}));
|
|
97
104
|
const isSeatAvailable = (s.s === _utils.statuses.UNSOLD || s.s === _utils.statuses.USER_PENDING) && !(bookedSeats.length >= quantity && s.s === _utils.statuses.UNSOLD) && (priceage.q === null || priceage.q > 0);
|
|
98
105
|
if (!isSeatAvailable) {
|
|
99
106
|
if (bookedSeats.length >= quantity) {
|
|
@@ -105,50 +112,70 @@ const SeatingPlan = _ref => {
|
|
|
105
112
|
message: _utils.ERROR_MESSAGES.NO_ALLOCATION
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
|
-
|
|
115
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
116
|
+
loading: false
|
|
117
|
+
}));
|
|
109
118
|
return;
|
|
110
119
|
}
|
|
111
120
|
(_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 || (_mapRef$current = _mapRef$current.target) === null || _mapRef$current === void 0 || _mapRef$current.closePopup();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
try {
|
|
122
|
+
const response = await fetch(apiUrl, {
|
|
123
|
+
method: "POST",
|
|
124
|
+
body: JSON.stringify({
|
|
125
|
+
priceAgeId: priceage.paId,
|
|
126
|
+
seatId: s.ssId,
|
|
127
|
+
price: priceage.p,
|
|
128
|
+
connectedShowings: connectedShowings
|
|
129
|
+
}),
|
|
130
|
+
headers: {
|
|
131
|
+
"content-type": "application/json",
|
|
132
|
+
"basket-key": sessionId
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 429) {
|
|
136
|
+
if (retryCount < BOOKING_MAX_RETRIES) {
|
|
137
|
+
setRetrying(prev => [...prev, s.ssId]);
|
|
138
|
+
const delay = (0, _utils.getRetryDelay)(response, retryCount);
|
|
139
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
140
|
+
return _addTicketToCart(s, priceage, retryCount + 1);
|
|
132
141
|
}
|
|
142
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
143
|
+
loading: false
|
|
144
|
+
}));
|
|
145
|
+
setRetrying(prev => prev.filter(id => id !== s.ssId));
|
|
133
146
|
handleError({
|
|
134
|
-
code:
|
|
135
|
-
message:
|
|
147
|
+
code: 429,
|
|
148
|
+
message: _utils.ERROR_MESSAGES.MAX_RETRIES
|
|
136
149
|
});
|
|
137
|
-
|
|
138
|
-
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
setRetrying(prev => prev.filter(id => id !== s.ssId));
|
|
153
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 403) {
|
|
154
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
155
|
+
loading: false,
|
|
156
|
+
s: _utils.statuses.SOLD
|
|
157
|
+
}));
|
|
139
158
|
handleError({
|
|
140
|
-
code:
|
|
159
|
+
code: 403,
|
|
141
160
|
message: _utils.ERROR_MESSAGES.SEAT_TAKEN
|
|
142
161
|
});
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
165
|
+
loading: false
|
|
166
|
+
}));
|
|
167
|
+
if (!(response !== null && response !== void 0 && response.ok)) {
|
|
168
|
+
handleError({
|
|
169
|
+
code: (response === null || response === void 0 ? void 0 : response.status) === 400 ? 400 : 500,
|
|
170
|
+
message: (response === null || response === void 0 ? void 0 : response.status) === 400 ? _utils.ERROR_MESSAGES.INCOMPATIBLE_TICKETS : _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
171
|
+
});
|
|
143
172
|
} else {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
setSeats(updatedSeats);
|
|
151
|
-
}
|
|
173
|
+
setRetrying(prev => prev.filter(id => id !== s.ssId));
|
|
174
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
175
|
+
loading: false,
|
|
176
|
+
s: _utils.statuses.USER_PENDING,
|
|
177
|
+
bookedPrice: price
|
|
178
|
+
}));
|
|
152
179
|
setBookedSeats(prev => [...prev, {
|
|
153
180
|
ssId: s.ssId,
|
|
154
181
|
r: s.r,
|
|
@@ -172,40 +199,33 @@ const SeatingPlan = _ref => {
|
|
|
172
199
|
};
|
|
173
200
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
174
201
|
}
|
|
175
|
-
}
|
|
176
|
-
|
|
202
|
+
} catch (_unused) {
|
|
203
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
204
|
+
loading: false
|
|
205
|
+
}));
|
|
206
|
+
setRetrying(prev => prev.filter(id => id !== s.ssId));
|
|
177
207
|
handleError({
|
|
178
208
|
code: 500,
|
|
179
209
|
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
180
210
|
});
|
|
181
|
-
}
|
|
182
|
-
_initialFetch(true);
|
|
183
|
-
});
|
|
211
|
+
}
|
|
184
212
|
};
|
|
185
213
|
const removeTicketFromCart = (s, e) => {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
updatedSeats.seats[seatIndex].loading = loading;
|
|
191
|
-
setSeats(updatedSeats);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
setSeatLoading(true);
|
|
214
|
+
const seatIndex = seats.seats.findIndex(seat => seat.ssId === s.ssId);
|
|
215
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
216
|
+
loading: true
|
|
217
|
+
}));
|
|
195
218
|
fetch("".concat(apiUrl, "/seat/").concat(s.ssId), {
|
|
196
219
|
method: "DELETE",
|
|
197
220
|
headers: {
|
|
198
221
|
"basket-key": sessionId
|
|
199
222
|
}
|
|
200
223
|
}).then(() => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
});
|
|
207
|
-
setSeats(updatedSeats);
|
|
208
|
-
}
|
|
224
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
225
|
+
loading: false,
|
|
226
|
+
s: _utils.statuses.UNSOLD,
|
|
227
|
+
bookedPrice: null
|
|
228
|
+
}));
|
|
209
229
|
setBookedSeats(prev => prev.filter(bs => bs.ssId !== s.ssId));
|
|
210
230
|
const event = {
|
|
211
231
|
type: "cart-change-remove",
|
|
@@ -213,64 +233,81 @@ const SeatingPlan = _ref => {
|
|
|
213
233
|
};
|
|
214
234
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
215
235
|
}).catch(() => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
});
|
|
236
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
237
|
+
loading: false
|
|
238
|
+
}));
|
|
220
239
|
handleError({
|
|
221
240
|
code: 500,
|
|
222
241
|
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
223
242
|
});
|
|
224
|
-
}).finally(() => {
|
|
225
|
-
_initialFetch(true);
|
|
226
243
|
});
|
|
227
244
|
};
|
|
228
245
|
const batchAddTicketsToCart = async seatsToBook => {
|
|
229
246
|
if (!canMultiSelect && !seats.preventOrphanedSeats || seatsToBook.length === 0) {
|
|
230
247
|
return;
|
|
231
248
|
}
|
|
232
|
-
const updatedSeats = _objectSpread({}, seats);
|
|
233
|
-
const seatIds = seatsToBook.map(s => s.seat.ssId);
|
|
234
249
|
const setSeatsLoading = loading => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
250
|
+
setSeats(prev => {
|
|
251
|
+
const updatedSeats = _objectSpread({}, prev);
|
|
252
|
+
seatsToBook.forEach(_ref2 => {
|
|
253
|
+
let {
|
|
254
|
+
seat
|
|
255
|
+
} = _ref2;
|
|
256
|
+
const seatIndex = updatedSeats.seats.findIndex(s => s.ssId === seat.ssId);
|
|
257
|
+
if (seatIndex !== -1) {
|
|
258
|
+
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, updatedSeats.seats[seatIndex]), {}, {
|
|
259
|
+
loading: loading
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return updatedSeats;
|
|
239
264
|
});
|
|
240
|
-
setSeats(updatedSeats);
|
|
241
265
|
};
|
|
242
266
|
setSeatsLoading(true);
|
|
243
267
|
const succeeded = [];
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
if (!res.ok) {
|
|
261
|
-
throw new Error("".concat(res.status));
|
|
268
|
+
const _tryBook = async function tryBook(seatToBook) {
|
|
269
|
+
let retryCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
270
|
+
try {
|
|
271
|
+
const res = await fetch(apiUrl, {
|
|
272
|
+
method: "POST",
|
|
273
|
+
body: JSON.stringify({
|
|
274
|
+
priceAgeId: seatToBook.priceage.paId,
|
|
275
|
+
seatId: seatToBook.seat.ssId,
|
|
276
|
+
price: seatToBook.priceage.p,
|
|
277
|
+
connectedShowings: connectedShowings
|
|
278
|
+
}),
|
|
279
|
+
headers: {
|
|
280
|
+
"content-type": "application/json",
|
|
281
|
+
"basket-key": sessionId
|
|
262
282
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
283
|
+
});
|
|
284
|
+
if (res.status === 429) {
|
|
285
|
+
if (retryCount < BOOKING_MAX_RETRIES) {
|
|
286
|
+
setRetrying(prev => [...prev, seatToBook.seat.ssId]);
|
|
287
|
+
const delay = (0, _utils.getRetryDelay)(res, retryCount);
|
|
288
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
289
|
+
return _tryBook(seatToBook, retryCount + 1);
|
|
290
|
+
} else {
|
|
291
|
+
throw new Error("429");
|
|
292
|
+
}
|
|
293
|
+
} else if (!res.ok) {
|
|
294
|
+
throw new Error("".concat(res.status));
|
|
267
295
|
}
|
|
296
|
+
succeeded.push(seatToBook.seat);
|
|
297
|
+
} catch (_unused2) {
|
|
298
|
+
throw new Error("Booking failed for seat ".concat(seatToBook.seat.r, " ").concat(seatToBook.seat.c));
|
|
268
299
|
}
|
|
269
|
-
|
|
300
|
+
};
|
|
301
|
+
try {
|
|
302
|
+
for (const seatToBook of seatsToBook) {
|
|
303
|
+
await _tryBook(seatToBook);
|
|
304
|
+
}
|
|
305
|
+
setRetrying(prev => prev.filter(id => !seatsToBook.some(s => s.seat.ssId === id)));
|
|
306
|
+
setBookedSeats(prev => [...prev, ...seatsToBook.map(_ref3 => {
|
|
270
307
|
let {
|
|
271
308
|
seat,
|
|
272
309
|
priceage
|
|
273
|
-
} =
|
|
310
|
+
} = _ref3;
|
|
274
311
|
return {
|
|
275
312
|
ssId: seat.ssId,
|
|
276
313
|
r: seat.r,
|
|
@@ -281,21 +318,30 @@ const SeatingPlan = _ref => {
|
|
|
281
318
|
paName: priceage.paName
|
|
282
319
|
};
|
|
283
320
|
})]);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
321
|
+
setSeats(prev => {
|
|
322
|
+
const updatedSeats = _objectSpread({}, prev);
|
|
323
|
+
seatsToBook.forEach(_ref4 => {
|
|
324
|
+
let {
|
|
325
|
+
seat
|
|
326
|
+
} = _ref4;
|
|
327
|
+
const seatIndex = updatedSeats.seats.findIndex(s => s.ssId === seat.ssId);
|
|
328
|
+
if (seatIndex !== -1) {
|
|
329
|
+
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, updatedSeats.seats[seatIndex]), {}, {
|
|
330
|
+
loading: false,
|
|
331
|
+
s: _utils.statuses.USER_PENDING,
|
|
332
|
+
bookedPrice: price
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
return updatedSeats;
|
|
290
337
|
});
|
|
291
|
-
setSeats(updatedSeats);
|
|
292
338
|
const event = {
|
|
293
339
|
type: "cart-change-add",
|
|
294
|
-
details: [...bookedSeats, ...seatsToBook.map(
|
|
340
|
+
details: [...bookedSeats, ...seatsToBook.map(_ref5 => {
|
|
295
341
|
let {
|
|
296
342
|
seat,
|
|
297
343
|
priceage
|
|
298
|
-
} =
|
|
344
|
+
} = _ref5;
|
|
299
345
|
return {
|
|
300
346
|
ssId: seat.ssId,
|
|
301
347
|
r: seat.r,
|
|
@@ -309,6 +355,7 @@ const SeatingPlan = _ref => {
|
|
|
309
355
|
};
|
|
310
356
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
311
357
|
} catch (error) {
|
|
358
|
+
setRetrying(prev => prev.filter(id => !seatsToBook.some(s => s.seat.ssId === id)));
|
|
312
359
|
console.error("Failed to book seats:", error);
|
|
313
360
|
for (const seat of succeeded) {
|
|
314
361
|
await fetch("".concat(apiUrl, "/seat/").concat(seat.ssId), {
|
|
@@ -321,24 +368,26 @@ const SeatingPlan = _ref => {
|
|
|
321
368
|
setSeatsLoading(false);
|
|
322
369
|
handleError({
|
|
323
370
|
code: error === "429" ? 429 : 500,
|
|
324
|
-
message:
|
|
371
|
+
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
325
372
|
});
|
|
326
|
-
} finally {
|
|
327
|
-
_initialFetch(true);
|
|
328
373
|
}
|
|
329
374
|
};
|
|
330
375
|
const batchRemoveTicketsFromCart = async seatsToRemove => {
|
|
331
376
|
if (!canMultiSelect && !seats.preventOrphanedSeats || seatsToRemove.length === 0) {
|
|
332
377
|
return;
|
|
333
378
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
379
|
+
setSeats(prev => {
|
|
380
|
+
const updatedSeats = _objectSpread({}, prev);
|
|
381
|
+
seatsToRemove.forEach(s => {
|
|
382
|
+
const seatIndex = updatedSeats.seats.findIndex(seat => seat.ssId === s.ssId);
|
|
383
|
+
if (seatIndex !== -1) {
|
|
384
|
+
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, updatedSeats.seats[seatIndex]), {}, {
|
|
385
|
+
loading: true
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
return updatedSeats;
|
|
340
390
|
});
|
|
341
|
-
setSeats(updatedSeats);
|
|
342
391
|
const succeededIds = [];
|
|
343
392
|
try {
|
|
344
393
|
for (const seat of seatsToRemove) {
|
|
@@ -357,23 +406,27 @@ const SeatingPlan = _ref => {
|
|
|
357
406
|
console.error("Failed to remove seat ".concat(seat, ":"), error);
|
|
358
407
|
}
|
|
359
408
|
}
|
|
360
|
-
} catch (
|
|
409
|
+
} catch (_unused3) {
|
|
361
410
|
handleError({
|
|
362
411
|
code: 500,
|
|
363
412
|
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
364
413
|
});
|
|
365
414
|
}
|
|
366
415
|
setBookedSeats(prev => [...prev.filter(v => !succeededIds.includes(v.ssId))]);
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
416
|
+
setSeats(prev => {
|
|
417
|
+
const updatedSeats = _objectSpread({}, prev);
|
|
418
|
+
seatsToRemove.forEach(s => {
|
|
419
|
+
const seatIndex = updatedSeats.seats.findIndex(seat => seat.ssId === s.ssId);
|
|
420
|
+
if (seatIndex !== -1) {
|
|
421
|
+
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, updatedSeats.seats[seatIndex]), {}, {
|
|
422
|
+
loading: false,
|
|
423
|
+
s: succeededIds.includes(s.ssId) ? _utils.statuses.UNSOLD : s.s,
|
|
424
|
+
bookedPrice: null
|
|
425
|
+
});
|
|
373
426
|
}
|
|
374
|
-
}
|
|
427
|
+
});
|
|
428
|
+
return updatedSeats;
|
|
375
429
|
});
|
|
376
|
-
setSeats(updatedSeats);
|
|
377
430
|
setSeatsToRemove([]);
|
|
378
431
|
if (succeededIds.length > 0) {
|
|
379
432
|
const event = {
|
|
@@ -382,7 +435,6 @@ const SeatingPlan = _ref => {
|
|
|
382
435
|
};
|
|
383
436
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
384
437
|
}
|
|
385
|
-
_initialFetch(true);
|
|
386
438
|
};
|
|
387
439
|
const handleClickSeat = (e, s) => {
|
|
388
440
|
setChosenSeat({
|
|
@@ -402,7 +454,7 @@ const SeatingPlan = _ref => {
|
|
|
402
454
|
const availablePrices = ((_seats$pricing = seats.pricing) === null || _seats$pricing === void 0 ? void 0 : _seats$pricing.filter(price => (!priceSectionIds || priceSectionIds.includes(price.psId)) && s.psId === price.psId)) || [];
|
|
403
455
|
const isSingleFlexi = availablePrices.length === 1 && !!availablePrices[0].pMax && !!availablePrices[0].pMin && availablePrices[0].pMax > availablePrices[0].pMin;
|
|
404
456
|
if (availablePrices.length === 1 && !isSingleFlexi) {
|
|
405
|
-
|
|
457
|
+
_addTicketToCart(s, availablePrices[0]);
|
|
406
458
|
}
|
|
407
459
|
} else {
|
|
408
460
|
removeTicketFromCart(s, e);
|
|
@@ -426,7 +478,7 @@ const SeatingPlan = _ref => {
|
|
|
426
478
|
}
|
|
427
479
|
});
|
|
428
480
|
if (response.status === 429) {
|
|
429
|
-
if (retryCount >=
|
|
481
|
+
if (retryCount >= SEATINGPLAN_MAX_RETRIES) {
|
|
430
482
|
throw new Error("We're experiencing high demand. Please try again later.");
|
|
431
483
|
}
|
|
432
484
|
const delay = (0, _utils.getRetryDelay)(response, retryCount);
|
|
@@ -516,7 +568,9 @@ const SeatingPlan = _ref => {
|
|
|
516
568
|
pricing: seats.pricing,
|
|
517
569
|
priceSectionIds: priceSectionIds,
|
|
518
570
|
batchAddTicketsToCart: batchAddTicketsToCart
|
|
519
|
-
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null),
|
|
571
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), retrying.length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
572
|
+
className: "retrying"
|
|
573
|
+
}, "Looks like things are busy right now. Please wait while we continue to confirm your selection...") : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), seats.preventOrphanedSeats && selectQuantityPopupOpen ? /*#__PURE__*/_react.default.createElement(_SelectQuantityPopup.default, {
|
|
520
574
|
quantity: desiredSeatQuantity,
|
|
521
575
|
setQuantity: v => {
|
|
522
576
|
setDesiredSeatQuantity(v);
|
|
@@ -553,7 +607,7 @@ const SeatingPlan = _ref => {
|
|
|
553
607
|
setTicketPopupOpen: setTicketPopupOpen,
|
|
554
608
|
chosenSeat: chosenSeat,
|
|
555
609
|
bookedSeats: bookedSeats,
|
|
556
|
-
addTicketToCart:
|
|
610
|
+
addTicketToCart: _addTicketToCart,
|
|
557
611
|
batchRemoveTicketsFromCart: batchRemoveTicketsFromCart,
|
|
558
612
|
isReloading: isReloading,
|
|
559
613
|
initialFetch: _initialFetch,
|
|
@@ -1597,6 +1597,22 @@ svg.leaflet-image-layer.leaflet-interactive path {
|
|
|
1597
1597
|
transform: translateX(-50%);
|
|
1598
1598
|
}
|
|
1599
1599
|
|
|
1600
|
+
.retrying {
|
|
1601
|
+
position: absolute;
|
|
1602
|
+
top: 10px;
|
|
1603
|
+
left: 50%;
|
|
1604
|
+
transform: translateX(-50%);
|
|
1605
|
+
background: white;
|
|
1606
|
+
border-radius: 5px;
|
|
1607
|
+
padding: 0.5rem;
|
|
1608
|
+
font-size: 0.875rem;
|
|
1609
|
+
color: #333;
|
|
1610
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
|
1611
|
+
z-index: 1005;
|
|
1612
|
+
animation: fade-in 400ms;
|
|
1613
|
+
max-width: 50%;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1600
1616
|
/* Printing */
|
|
1601
1617
|
|
|
1602
1618
|
@media print {
|
package/dist/utils/enums.js
CHANGED
|
@@ -42,5 +42,6 @@ const ERROR_MESSAGES = exports.ERROR_MESSAGES = {
|
|
|
42
42
|
SEAT_TAKEN: "Someone else selected this first. Please try again",
|
|
43
43
|
GENERIC_ERROR: "Oops! Something went wrong. Please try again.",
|
|
44
44
|
MAX_QUANTITY: "Maximum ticket booking quantity specified reached.",
|
|
45
|
-
NO_ALLOCATION: "Allocation exhausted, please try another area or price."
|
|
45
|
+
NO_ALLOCATION: "Allocation exhausted, please try another area or price.",
|
|
46
|
+
MAX_RETRIES: "Looks like things are busy and we couldn't complete your request. Please try again."
|
|
46
47
|
};
|