iticket-seatingplan-dev 1.8.2 → 1.8.4
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 +150 -141
- package/dist/components/styles/index.css +16 -0
- package/dist/utils/enums.js +2 -1
- package/dist/utils/helpers.js +3 -5
- package/package.json +1 -1
|
@@ -68,6 +68,7 @@ const SeatingPlan = _ref => {
|
|
|
68
68
|
const [seatsToRemove, setSeatsToRemove] = (0, _react.useState)([]);
|
|
69
69
|
const [removeMultipleSeatsPopupOpen, setRemoveMultipleSeatsPopupOpen] = (0, _react.useState)(false);
|
|
70
70
|
const [invalidSeatsPopupOpen, setInvalidSeatsPopupOpen] = (0, _react.useState)(false);
|
|
71
|
+
const [retrying, setRetrying] = (0, _react.useState)([]);
|
|
71
72
|
const mapRef = (0, _react.useRef)(null);
|
|
72
73
|
const canMultiSelect = bookingMode === _utils.bookingModes.POS;
|
|
73
74
|
const apiUrl = "".concat(baseUrl, "/legacy/").concat(countryCode, "/shop/events/").concat(eventId, "/").concat(eventVenueId, "/showings/").concat(showingId, "/tickets/allocated/").concat(areaId);
|
|
@@ -84,18 +85,36 @@ const SeatingPlan = _ref => {
|
|
|
84
85
|
};
|
|
85
86
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
86
87
|
};
|
|
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 setSeatsLoading = (seatsToUpdate, loading) => {
|
|
98
|
+
setSeats(prev => {
|
|
99
|
+
const updatedSeats = _objectSpread({}, prev);
|
|
100
|
+
seatsToUpdate.forEach(seat => {
|
|
101
|
+
const seatIndex = updatedSeats.seats.findIndex(s => s.ssId === seat.ssId);
|
|
102
|
+
if (seatIndex !== -1) {
|
|
103
|
+
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, updatedSeats.seats[seatIndex]), {}, {
|
|
104
|
+
loading: loading
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return updatedSeats;
|
|
109
|
+
});
|
|
110
|
+
};
|
|
87
111
|
const _addTicketToCart = async function addTicketToCart(s, priceage) {
|
|
88
112
|
var _mapRef$current;
|
|
89
113
|
let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
updatedSeats.seats[seatIndex].loading = loading;
|
|
95
|
-
setSeats(updatedSeats);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
setSeatLoading(true);
|
|
114
|
+
const seatIndex = seats.seats.findIndex(seat => seat.ssId === s.ssId);
|
|
115
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
116
|
+
loading: true
|
|
117
|
+
}));
|
|
99
118
|
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);
|
|
100
119
|
if (!isSeatAvailable) {
|
|
101
120
|
if (bookedSeats.length >= quantity) {
|
|
@@ -107,7 +126,9 @@ const SeatingPlan = _ref => {
|
|
|
107
126
|
message: _utils.ERROR_MESSAGES.NO_ALLOCATION
|
|
108
127
|
});
|
|
109
128
|
}
|
|
110
|
-
|
|
129
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
130
|
+
loading: false
|
|
131
|
+
}));
|
|
111
132
|
return;
|
|
112
133
|
}
|
|
113
134
|
(_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 || (_mapRef$current = _mapRef$current.target) === null || _mapRef$current === void 0 || _mapRef$current.closePopup();
|
|
@@ -125,134 +146,118 @@ const SeatingPlan = _ref => {
|
|
|
125
146
|
"basket-key": sessionId
|
|
126
147
|
}
|
|
127
148
|
});
|
|
128
|
-
if ((response === null || response === void 0 ? void 0 : response.status) ===
|
|
129
|
-
if (seatIndex !== -1) {
|
|
130
|
-
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, s), {}, {
|
|
131
|
-
loading: false,
|
|
132
|
-
s: _utils.statuses.SOLD
|
|
133
|
-
});
|
|
134
|
-
setSeats(updatedSeats);
|
|
135
|
-
}
|
|
136
|
-
handleError({
|
|
137
|
-
code: 403,
|
|
138
|
-
message: response.status === 400 ? _utils.ERROR_MESSAGES.INCOMPATIBLE_TICKETS : _utils.ERROR_MESSAGES.SEAT_UNAVAILABLE
|
|
139
|
-
});
|
|
140
|
-
} else if ((response === null || response === void 0 ? void 0 : response.status) === 429) {
|
|
149
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 429) {
|
|
141
150
|
if (retryCount < BOOKING_MAX_RETRIES) {
|
|
142
|
-
|
|
151
|
+
setRetrying(prev => [...prev, s.ssId]);
|
|
152
|
+
const delay = (0, _utils.getRetryDelay)(response);
|
|
143
153
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
144
154
|
return _addTicketToCart(s, priceage, retryCount + 1);
|
|
145
155
|
}
|
|
146
|
-
|
|
156
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
157
|
+
loading: false
|
|
158
|
+
}));
|
|
159
|
+
setRetrying(prev => prev.filter(id => id !== s.ssId));
|
|
147
160
|
handleError({
|
|
148
161
|
code: 429,
|
|
162
|
+
message: _utils.ERROR_MESSAGES.MAX_RETRIES
|
|
163
|
+
});
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
setRetrying(prev => prev.filter(id => id !== s.ssId));
|
|
167
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 403) {
|
|
168
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
169
|
+
loading: false,
|
|
170
|
+
s: _utils.statuses.SOLD
|
|
171
|
+
}));
|
|
172
|
+
handleError({
|
|
173
|
+
code: 403,
|
|
149
174
|
message: _utils.ERROR_MESSAGES.SEAT_TAKEN
|
|
150
175
|
});
|
|
151
|
-
|
|
152
|
-
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (!(response !== null && response !== void 0 && response.ok)) {
|
|
179
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
180
|
+
loading: false
|
|
181
|
+
}));
|
|
153
182
|
handleError({
|
|
154
|
-
code: 500,
|
|
155
|
-
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
183
|
+
code: (response === null || response === void 0 ? void 0 : response.status) === 400 ? 400 : 500,
|
|
184
|
+
message: (response === null || response === void 0 ? void 0 : response.status) === 400 ? _utils.ERROR_MESSAGES.INCOMPATIBLE_TICKETS : _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
156
185
|
});
|
|
157
186
|
} else {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
setSeats(updatedSeats);
|
|
165
|
-
}
|
|
166
|
-
setBookedSeats(prev => [...prev, {
|
|
167
|
-
ssId: s.ssId,
|
|
168
|
-
r: s.r,
|
|
169
|
-
c: s.c,
|
|
187
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
188
|
+
loading: false,
|
|
189
|
+
s: _utils.statuses.USER_PENDING,
|
|
190
|
+
bookedPrice: price
|
|
191
|
+
}));
|
|
192
|
+
setBookedSeats(prev => [...prev, _objectSpread(_objectSpread({}, s), {}, {
|
|
170
193
|
showingId: showingId,
|
|
171
194
|
pId: priceage.paId,
|
|
172
195
|
p: priceage.p,
|
|
173
196
|
paName: priceage.paName
|
|
174
|
-
}]);
|
|
197
|
+
})]);
|
|
175
198
|
const event = {
|
|
176
199
|
type: "cart-change-add",
|
|
177
|
-
details: [
|
|
178
|
-
ssId: s.ssId,
|
|
179
|
-
r: s.r,
|
|
180
|
-
c: s.c,
|
|
200
|
+
details: [_objectSpread(_objectSpread({}, s), {}, {
|
|
181
201
|
showingId: showingId,
|
|
182
202
|
pId: priceage.paId,
|
|
183
203
|
p: priceage.p,
|
|
184
204
|
paName: priceage.paName
|
|
185
|
-
}]
|
|
205
|
+
})]
|
|
186
206
|
};
|
|
187
207
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
188
208
|
}
|
|
189
209
|
} catch (_unused) {
|
|
190
|
-
|
|
210
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
211
|
+
loading: false
|
|
212
|
+
}));
|
|
213
|
+
setRetrying(prev => prev.filter(id => id !== s.ssId));
|
|
191
214
|
handleError({
|
|
192
215
|
code: 500,
|
|
193
216
|
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
194
217
|
});
|
|
195
218
|
}
|
|
196
|
-
_initialFetch(true);
|
|
197
219
|
};
|
|
198
|
-
const removeTicketFromCart = (s, e) => {
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
"
|
|
212
|
-
}
|
|
213
|
-
}).then(() => {
|
|
214
|
-
if (seatIndex !== -1) {
|
|
215
|
-
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, s), {}, {
|
|
216
|
-
loading: false,
|
|
217
|
-
s: _utils.statuses.UNSOLD,
|
|
218
|
-
bookedPrice: null
|
|
219
|
-
});
|
|
220
|
-
setSeats(updatedSeats);
|
|
220
|
+
const removeTicketFromCart = async (s, e) => {
|
|
221
|
+
const seatIndex = seats.seats.findIndex(seat => seat.ssId === s.ssId);
|
|
222
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
223
|
+
loading: true
|
|
224
|
+
}));
|
|
225
|
+
try {
|
|
226
|
+
const response = await fetch("".concat(apiUrl, "/seat/").concat(s.ssId), {
|
|
227
|
+
method: "DELETE",
|
|
228
|
+
headers: {
|
|
229
|
+
"basket-key": sessionId
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
if (!response.ok) {
|
|
233
|
+
throw new Error("".concat(response.status));
|
|
221
234
|
}
|
|
235
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
236
|
+
loading: false,
|
|
237
|
+
s: _utils.statuses.UNSOLD,
|
|
238
|
+
bookedPrice: null
|
|
239
|
+
}));
|
|
222
240
|
setBookedSeats(prev => prev.filter(bs => bs.ssId !== s.ssId));
|
|
223
241
|
const event = {
|
|
224
242
|
type: "cart-change-remove",
|
|
225
243
|
details: bookedSeats.filter(bs => bs.ssId === s.ssId)
|
|
226
244
|
};
|
|
227
245
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
});
|
|
246
|
+
} catch (_unused2) {
|
|
247
|
+
updateSeat(seatIndex, _objectSpread(_objectSpread({}, s), {}, {
|
|
248
|
+
loading: false
|
|
249
|
+
}));
|
|
233
250
|
handleError({
|
|
234
251
|
code: 500,
|
|
235
252
|
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
236
253
|
});
|
|
237
|
-
}
|
|
238
|
-
_initialFetch(true);
|
|
239
|
-
});
|
|
254
|
+
}
|
|
240
255
|
};
|
|
241
256
|
const batchAddTicketsToCart = async seatsToBook => {
|
|
242
257
|
if (!canMultiSelect && !seats.preventOrphanedSeats || seatsToBook.length === 0) {
|
|
243
258
|
return;
|
|
244
259
|
}
|
|
245
|
-
|
|
246
|
-
const seatIds = seatsToBook.map(s => s.seat.ssId);
|
|
247
|
-
const setSeatsLoading = loading => {
|
|
248
|
-
updatedSeats.seats.forEach(s => {
|
|
249
|
-
if (seatIds.includes(s.ssId)) {
|
|
250
|
-
s.loading = loading;
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
setSeats(updatedSeats);
|
|
254
|
-
};
|
|
255
|
-
setSeatsLoading(true);
|
|
260
|
+
setSeatsLoading(seatsToBook.map(seat => seat.seat), true);
|
|
256
261
|
const succeeded = [];
|
|
257
262
|
const _tryBook = async function tryBook(seatToBook) {
|
|
258
263
|
let retryCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -272,65 +277,73 @@ const SeatingPlan = _ref => {
|
|
|
272
277
|
});
|
|
273
278
|
if (res.status === 429) {
|
|
274
279
|
if (retryCount < BOOKING_MAX_RETRIES) {
|
|
275
|
-
|
|
280
|
+
setRetrying(prev => [...prev, seatToBook.seat.ssId]);
|
|
281
|
+
const delay = (0, _utils.getRetryDelay)(res);
|
|
276
282
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
277
283
|
return _tryBook(seatToBook, retryCount + 1);
|
|
284
|
+
} else {
|
|
285
|
+
throw new Error("429");
|
|
278
286
|
}
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
if (!res.ok) {
|
|
287
|
+
} else if (!res.ok) {
|
|
282
288
|
throw new Error("".concat(res.status));
|
|
283
289
|
}
|
|
284
|
-
succeeded.push(seatToBook);
|
|
285
|
-
} catch (
|
|
290
|
+
succeeded.push(seatToBook.seat);
|
|
291
|
+
} catch (_unused3) {
|
|
286
292
|
throw new Error("Booking failed for seat ".concat(seatToBook.seat.r, " ").concat(seatToBook.seat.c));
|
|
287
293
|
}
|
|
288
294
|
};
|
|
289
295
|
try {
|
|
290
|
-
|
|
296
|
+
for (const seatToBook of seatsToBook) {
|
|
297
|
+
await _tryBook(seatToBook);
|
|
298
|
+
}
|
|
299
|
+
setRetrying(prev => prev.filter(id => !seatsToBook.some(s => s.seat.ssId === id)));
|
|
291
300
|
setBookedSeats(prev => [...prev, ...seatsToBook.map(_ref2 => {
|
|
292
301
|
let {
|
|
293
302
|
seat,
|
|
294
303
|
priceage
|
|
295
304
|
} = _ref2;
|
|
296
|
-
return {
|
|
297
|
-
ssId: seat.ssId,
|
|
298
|
-
r: seat.r,
|
|
299
|
-
c: seat.c,
|
|
305
|
+
return _objectSpread(_objectSpread({}, seat), {}, {
|
|
300
306
|
showingId: showingId,
|
|
301
307
|
pId: priceage.paId,
|
|
302
308
|
p: priceage.p,
|
|
303
309
|
paName: priceage.paName
|
|
304
|
-
};
|
|
310
|
+
});
|
|
305
311
|
})]);
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
+
setSeats(prev => {
|
|
313
|
+
const updatedSeats = _objectSpread({}, prev);
|
|
314
|
+
seatsToBook.forEach(_ref3 => {
|
|
315
|
+
let {
|
|
316
|
+
seat
|
|
317
|
+
} = _ref3;
|
|
318
|
+
const seatIndex = updatedSeats.seats.findIndex(s => s.ssId === seat.ssId);
|
|
319
|
+
if (seatIndex !== -1) {
|
|
320
|
+
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, updatedSeats.seats[seatIndex]), {}, {
|
|
321
|
+
loading: false,
|
|
322
|
+
s: _utils.statuses.USER_PENDING,
|
|
323
|
+
bookedPrice: price
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
return updatedSeats;
|
|
312
328
|
});
|
|
313
|
-
setSeats(updatedSeats);
|
|
314
329
|
const event = {
|
|
315
330
|
type: "cart-change-add",
|
|
316
|
-
details: [...
|
|
331
|
+
details: [...seatsToBook.map(_ref4 => {
|
|
317
332
|
let {
|
|
318
333
|
seat,
|
|
319
334
|
priceage
|
|
320
|
-
} =
|
|
321
|
-
return {
|
|
322
|
-
ssId: seat.ssId,
|
|
323
|
-
r: seat.r,
|
|
324
|
-
c: seat.c,
|
|
335
|
+
} = _ref4;
|
|
336
|
+
return _objectSpread(_objectSpread({}, seat), {}, {
|
|
325
337
|
showingId: showingId,
|
|
326
338
|
pId: priceage.paId,
|
|
327
339
|
p: priceage.p,
|
|
328
340
|
paName: priceage.paName
|
|
329
|
-
};
|
|
341
|
+
});
|
|
330
342
|
})]
|
|
331
343
|
};
|
|
332
344
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
333
345
|
} catch (error) {
|
|
346
|
+
setRetrying(prev => prev.filter(id => !seatsToBook.some(s => s.seat.ssId === id)));
|
|
334
347
|
console.error("Failed to book seats:", error);
|
|
335
348
|
for (const seat of succeeded) {
|
|
336
349
|
await fetch("".concat(apiUrl, "/seat/").concat(seat.ssId), {
|
|
@@ -340,27 +353,18 @@ const SeatingPlan = _ref => {
|
|
|
340
353
|
}
|
|
341
354
|
});
|
|
342
355
|
}
|
|
343
|
-
setSeatsLoading(false);
|
|
356
|
+
setSeatsLoading(seatsToBook.map(seat => seat.seat), false);
|
|
344
357
|
handleError({
|
|
345
358
|
code: error === "429" ? 429 : 500,
|
|
346
|
-
message:
|
|
359
|
+
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
347
360
|
});
|
|
348
|
-
} finally {
|
|
349
|
-
_initialFetch(true);
|
|
350
361
|
}
|
|
351
362
|
};
|
|
352
363
|
const batchRemoveTicketsFromCart = async seatsToRemove => {
|
|
353
364
|
if (!canMultiSelect && !seats.preventOrphanedSeats || seatsToRemove.length === 0) {
|
|
354
365
|
return;
|
|
355
366
|
}
|
|
356
|
-
|
|
357
|
-
const seatIds = seatsToRemove.map(s => s.ssId);
|
|
358
|
-
updatedSeats.seats.forEach(s => {
|
|
359
|
-
if (seatIds.includes(s.ssId)) {
|
|
360
|
-
s.loading = true;
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
setSeats(updatedSeats);
|
|
367
|
+
setSeatsLoading(seatsToRemove, true);
|
|
364
368
|
const succeededIds = [];
|
|
365
369
|
try {
|
|
366
370
|
for (const seat of seatsToRemove) {
|
|
@@ -379,23 +383,27 @@ const SeatingPlan = _ref => {
|
|
|
379
383
|
console.error("Failed to remove seat ".concat(seat, ":"), error);
|
|
380
384
|
}
|
|
381
385
|
}
|
|
382
|
-
} catch (
|
|
386
|
+
} catch (_unused4) {
|
|
383
387
|
handleError({
|
|
384
388
|
code: 500,
|
|
385
389
|
message: _utils.ERROR_MESSAGES.GENERIC_ERROR
|
|
386
390
|
});
|
|
387
391
|
}
|
|
388
392
|
setBookedSeats(prev => [...prev.filter(v => !succeededIds.includes(v.ssId))]);
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
setSeats(prev => {
|
|
394
|
+
const updatedSeats = _objectSpread({}, prev);
|
|
395
|
+
seatsToRemove.forEach(s => {
|
|
396
|
+
const seatIndex = updatedSeats.seats.findIndex(seat => seat.ssId === s.ssId);
|
|
397
|
+
if (seatIndex !== -1) {
|
|
398
|
+
updatedSeats.seats[seatIndex] = _objectSpread(_objectSpread({}, updatedSeats.seats[seatIndex]), {}, {
|
|
399
|
+
loading: false,
|
|
400
|
+
s: succeededIds.includes(s.ssId) ? _utils.statuses.UNSOLD : s.s,
|
|
401
|
+
bookedPrice: null
|
|
402
|
+
});
|
|
395
403
|
}
|
|
396
|
-
}
|
|
404
|
+
});
|
|
405
|
+
return updatedSeats;
|
|
397
406
|
});
|
|
398
|
-
setSeats(updatedSeats);
|
|
399
407
|
setSeatsToRemove([]);
|
|
400
408
|
if (succeededIds.length > 0) {
|
|
401
409
|
const event = {
|
|
@@ -404,7 +412,6 @@ const SeatingPlan = _ref => {
|
|
|
404
412
|
};
|
|
405
413
|
callbackFunction === null || callbackFunction === void 0 || callbackFunction(event);
|
|
406
414
|
}
|
|
407
|
-
_initialFetch(true);
|
|
408
415
|
};
|
|
409
416
|
const handleClickSeat = (e, s) => {
|
|
410
417
|
setChosenSeat({
|
|
@@ -451,7 +458,7 @@ const SeatingPlan = _ref => {
|
|
|
451
458
|
if (retryCount >= SEATINGPLAN_MAX_RETRIES) {
|
|
452
459
|
throw new Error("We're experiencing high demand. Please try again later.");
|
|
453
460
|
}
|
|
454
|
-
const delay = (0, _utils.getRetryDelay)(response
|
|
461
|
+
const delay = (0, _utils.getRetryDelay)(response);
|
|
455
462
|
setInitialiseMessage("We're experiencing high demand. Please wait while we try again...");
|
|
456
463
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
457
464
|
return _initialFetch(isReload, retryCount + 1);
|
|
@@ -538,7 +545,9 @@ const SeatingPlan = _ref => {
|
|
|
538
545
|
pricing: seats.pricing,
|
|
539
546
|
priceSectionIds: priceSectionIds,
|
|
540
547
|
batchAddTicketsToCart: batchAddTicketsToCart
|
|
541
|
-
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null),
|
|
548
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), retrying.length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
549
|
+
className: "retrying"
|
|
550
|
+
}, "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, {
|
|
542
551
|
quantity: desiredSeatQuantity,
|
|
543
552
|
setQuantity: v => {
|
|
544
553
|
setDesiredSeatQuantity(v);
|
|
@@ -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
|
};
|
package/dist/utils/helpers.js
CHANGED
|
@@ -228,15 +228,13 @@ const getAdjacentBookedSeats = (seat, seatsMap) => {
|
|
|
228
228
|
return adjacentBookedSeats;
|
|
229
229
|
};
|
|
230
230
|
exports.getAdjacentBookedSeats = getAdjacentBookedSeats;
|
|
231
|
-
const getRetryDelay =
|
|
231
|
+
const getRetryDelay = response => {
|
|
232
232
|
var _ref, _ref2, _response$headers$get;
|
|
233
233
|
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";
|
|
234
|
-
|
|
235
|
-
return response.headers.get("rl-twm") ? Math.round(parseInt(retryAfter) * 60 * 1000) : parseInt(retryAfter) * 1000;
|
|
236
|
-
}
|
|
234
|
+
const delay = response.headers.get("rl-twm") ? Math.round(parseInt(retryAfter) * 60 * 1000) : parseInt(retryAfter) * 1000;
|
|
237
235
|
|
|
238
236
|
// adds jitter
|
|
239
|
-
return
|
|
237
|
+
return delay + Math.random() * 1000;
|
|
240
238
|
};
|
|
241
239
|
exports.getRetryDelay = getRetryDelay;
|
|
242
240
|
const groupSeatsByPriceSection = (seats, pricing, priceSectionIds) => {
|