tf-checkout-react 1.4.21 → 1.4.22
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/hooks/useOnline.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +44 -10
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +44 -10
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/seatMapContainer/index.tsx +74 -52
- package/src/hooks/useOnline.ts +21 -0
|
@@ -9357,6 +9357,24 @@ var DelegationsContainer = function DelegationsContainer(_ref) {
|
|
|
9357
9357
|
}));
|
|
9358
9358
|
};
|
|
9359
9359
|
|
|
9360
|
+
var useOnline = function useOnline(handler) {
|
|
9361
|
+
useEffect(function () {
|
|
9362
|
+
var handleOffline = function handleOffline() {
|
|
9363
|
+
handler(false);
|
|
9364
|
+
};
|
|
9365
|
+
var handleOnline = function handleOnline() {
|
|
9366
|
+
handler(true);
|
|
9367
|
+
};
|
|
9368
|
+
window.addEventListener('offline', handleOffline);
|
|
9369
|
+
window.addEventListener('online', handleOnline);
|
|
9370
|
+
return function () {
|
|
9371
|
+
window.removeEventListener('offline', handleOffline);
|
|
9372
|
+
window.removeEventListener('online', handleOnline);
|
|
9373
|
+
};
|
|
9374
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9375
|
+
}, []);
|
|
9376
|
+
};
|
|
9377
|
+
|
|
9360
9378
|
var addToCartFunc = /*#__PURE__*/function () {
|
|
9361
9379
|
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9362
9380
|
var eventId, data, ticketQuantity, _ref$enableBillingInf, enableBillingInfoAutoCreate, isWindowDefined, result, pageConfigsDataResponse, pageConfigsData, _pageConfigsData$skip, skipBillingPage, _pageConfigsData$name, nameIsRequired, _pageConfigsData$age_, ageIsRequired, _pageConfigsData$phon, phoneIsRequired, _pageConfigsData$hide, hidePhoneField, _pageConfigsData$has_, hasAddOn, _pageConfigsData$free, freeTicket, _pageConfigsData$coll, collectOptionalWalletAddress, _pageConfigsData$coll2, collectMandatoryWalletAddress, hash, total, userData, checkoutBody, checkoutResult;
|
|
@@ -9807,6 +9825,7 @@ var TicketsSection$1 = function TicketsSection(props) {
|
|
|
9807
9825
|
}) : getTicketsBtnLabel || getButtonLabel(reservedSeats.length, tableMapEnabled)))));
|
|
9808
9826
|
};
|
|
9809
9827
|
|
|
9828
|
+
var OFFLINE_MESSAGE = 'Offline.';
|
|
9810
9829
|
var SeatMapContainer = function SeatMapContainer(props) {
|
|
9811
9830
|
var _props$event = props.event,
|
|
9812
9831
|
eventId = _props$event.id,
|
|
@@ -9859,7 +9878,11 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
9859
9878
|
var _useState11 = useState({}),
|
|
9860
9879
|
guestCounts = _useState11[0],
|
|
9861
9880
|
setGuestCounts = _useState11[1];
|
|
9881
|
+
var _useState12 = useState(true),
|
|
9882
|
+
isOnline = _useState12[0],
|
|
9883
|
+
setIsOnline = _useState12[1];
|
|
9862
9884
|
var isGuestCountsSet = useRef(false);
|
|
9885
|
+
useOnline(setIsOnline);
|
|
9863
9886
|
var updateGuestCounts = function updateGuestCounts(data) {
|
|
9864
9887
|
_forEach(data, function (item) {
|
|
9865
9888
|
var tierTickets = ticketTypeTierRelationsRef.current[item.tierId];
|
|
@@ -9911,10 +9934,14 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
9911
9934
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
9912
9935
|
while (1) switch (_context2.prev = _context2.next) {
|
|
9913
9936
|
case 0:
|
|
9914
|
-
|
|
9915
|
-
|
|
9937
|
+
if (!isOnline) {
|
|
9938
|
+
_context2.next = 18;
|
|
9939
|
+
break;
|
|
9940
|
+
}
|
|
9941
|
+
_context2.prev = 1;
|
|
9942
|
+
_context2.next = 4;
|
|
9916
9943
|
return getSeatMapStatuses(eventId);
|
|
9917
|
-
case
|
|
9944
|
+
case 4:
|
|
9918
9945
|
statusesResponse = _context2.sent;
|
|
9919
9946
|
statuses = _get(statusesResponse, 'data.attributes') || {};
|
|
9920
9947
|
reservationData = [];
|
|
@@ -9953,18 +9980,18 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
9953
9980
|
setSelectedTickets({});
|
|
9954
9981
|
}
|
|
9955
9982
|
}
|
|
9956
|
-
_context2.next =
|
|
9983
|
+
_context2.next = 18;
|
|
9957
9984
|
break;
|
|
9958
|
-
case
|
|
9959
|
-
_context2.prev =
|
|
9960
|
-
_context2.t0 = _context2["catch"](
|
|
9985
|
+
case 15:
|
|
9986
|
+
_context2.prev = 15;
|
|
9987
|
+
_context2.t0 = _context2["catch"](1);
|
|
9961
9988
|
setError('Something went wrong');
|
|
9962
|
-
case
|
|
9989
|
+
case 18:
|
|
9963
9990
|
case "end":
|
|
9964
9991
|
return _context2.stop();
|
|
9965
9992
|
}
|
|
9966
|
-
}, _callee2, null, [[
|
|
9967
|
-
})), [eventId, seatMapStatuses, reservedSeats]);
|
|
9993
|
+
}, _callee2, null, [[1, 15]]);
|
|
9994
|
+
})), [eventId, seatMapStatuses, reservedSeats, isOnline]);
|
|
9968
9995
|
var startTimer = useCallback(function (duration) {
|
|
9969
9996
|
setShowTimer(true);
|
|
9970
9997
|
if (!localStorage.getItem("reservationStart-" + eventId)) {
|
|
@@ -10206,6 +10233,13 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
10206
10233
|
clearInterval(intervalId);
|
|
10207
10234
|
};
|
|
10208
10235
|
}, [fetchSeatMapReservations]);
|
|
10236
|
+
useEffect(function () {
|
|
10237
|
+
if (!isOnline) {
|
|
10238
|
+
setError(OFFLINE_MESSAGE);
|
|
10239
|
+
} else if (isOnline && error === OFFLINE_MESSAGE) {
|
|
10240
|
+
setError(null);
|
|
10241
|
+
}
|
|
10242
|
+
}, [error, isOnline]);
|
|
10209
10243
|
return React.createElement(React.Fragment, null, error && React.createElement(Alert, {
|
|
10210
10244
|
severity: "error",
|
|
10211
10245
|
onClose: function onClose() {
|