tf-checkout-react 1.4.23-beta.2 → 1.4.23-beta.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/hooks/useOnline.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +85 -37
- 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 +85 -37
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/preRegistration/PreRegistrationComplete.tsx +11 -4
- package/src/components/preRegistration/constants.tsx +10 -4
- package/src/components/preRegistration/index.tsx +10 -4
- package/src/components/seatMapContainer/index.tsx +74 -52
- package/src/components/ticketsContainer/TicketRow.tsx +4 -1
- package/src/components/ticketsContainer/index.tsx +7 -1
- package/src/hooks/useOnline.ts +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useOnline: (handler: (value: boolean) => void) => void;
|
|
@@ -5922,7 +5922,7 @@ var TicketRow = function TicketRow(_ref) {
|
|
|
5922
5922
|
} else if (canPurchaseTicket && isSeatMapAllowed && !isDirectPurchaseAllowed) {
|
|
5923
5923
|
// Seat Map Tickets renderer logic
|
|
5924
5924
|
returnValue = null;
|
|
5925
|
-
} else if (canPurchaseTicket || event != null && event.presalesStarted && !(event != null && event.presalesEnded)) {
|
|
5925
|
+
} else if (canPurchaseTicket || canPurchaseTicket && event != null && event.presalesStarted && !(event != null && event.presalesEnded)) {
|
|
5926
5926
|
returnValue = onSaleContent;
|
|
5927
5927
|
} else if (_get(prevTicketTier, 'in_stock')) {
|
|
5928
5928
|
returnValue = 'SOON';
|
|
@@ -6601,6 +6601,11 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
6601
6601
|
}
|
|
6602
6602
|
}
|
|
6603
6603
|
};
|
|
6604
|
+
var handleNotAvailableTicketsClick = function handleNotAvailableTicketsClick() {
|
|
6605
|
+
if (!_isEmpty(selectedTickets)) {
|
|
6606
|
+
setTicketsNotAvailableModalOpen(true);
|
|
6607
|
+
}
|
|
6608
|
+
};
|
|
6604
6609
|
var bookButtonIsDisabled = (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0) && !(event != null && event.flagSeatMapAllowed);
|
|
6605
6610
|
var isTicketAvailable = _some(tickets, function (ticket) {
|
|
6606
6611
|
return ticket.displayTicket && !ticket.soldOut && (ticket.salesStarted || (event == null ? void 0 : event.presalesStarted) && !(event != null && event.presalesEnded));
|
|
@@ -6733,9 +6738,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
6733
6738
|
}) : null, wrappedActionsSectionComponent, canShowGetTicketBtn() && React__default.createElement(Button$1, {
|
|
6734
6739
|
"aria-hidden": true,
|
|
6735
6740
|
className: "book-button \n " + (bookButtonIsDisabled ? 'disabled' : '') + " \n " + (isButtonScrollable ? 'is-scrollable' : '') + "\n " + (!isLoggedIn ? 'on-bottom' : '') + "\n ",
|
|
6736
|
-
onClick: event != null && event.salesStart && event != null && event.presalesStarted && !(event != null && event.presalesEnded) && (!isPreregistred || !isLogged) ?
|
|
6737
|
-
return setTicketsNotAvailableModalOpen(true);
|
|
6738
|
-
} : handleGetTicketClick
|
|
6741
|
+
onClick: event != null && event.salesStart && event != null && event.presalesStarted && !(event != null && event.presalesEnded) && (!isPreregistred || !isLogged) ? handleNotAvailableTicketsClick : handleGetTicketClick
|
|
6739
6742
|
}, selectedTickets.isTable ? 'RESERVE TABLES' : getTicketsLabel || 'GET TICKETS'), isSeatMapAllowed && !(event != null && event.salesEnded) && isTicketAvailable && React__default.createElement(Button$1, {
|
|
6740
6743
|
className: "reserve-button",
|
|
6741
6744
|
"aria-hidden": true,
|
|
@@ -9487,6 +9490,24 @@ var DelegationsContainer = function DelegationsContainer(_ref) {
|
|
|
9487
9490
|
}));
|
|
9488
9491
|
};
|
|
9489
9492
|
|
|
9493
|
+
var useOnline = function useOnline(handler) {
|
|
9494
|
+
React.useEffect(function () {
|
|
9495
|
+
var handleOffline = function handleOffline() {
|
|
9496
|
+
handler(false);
|
|
9497
|
+
};
|
|
9498
|
+
var handleOnline = function handleOnline() {
|
|
9499
|
+
handler(true);
|
|
9500
|
+
};
|
|
9501
|
+
window.addEventListener('offline', handleOffline);
|
|
9502
|
+
window.addEventListener('online', handleOnline);
|
|
9503
|
+
return function () {
|
|
9504
|
+
window.removeEventListener('offline', handleOffline);
|
|
9505
|
+
window.removeEventListener('online', handleOnline);
|
|
9506
|
+
};
|
|
9507
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9508
|
+
}, []);
|
|
9509
|
+
};
|
|
9510
|
+
|
|
9490
9511
|
var addToCartFunc = /*#__PURE__*/function () {
|
|
9491
9512
|
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9492
9513
|
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;
|
|
@@ -9937,6 +9958,7 @@ var TicketsSection$1 = function TicketsSection(props) {
|
|
|
9937
9958
|
}) : getTicketsBtnLabel || getButtonLabel(reservedSeats.length, tableMapEnabled)))));
|
|
9938
9959
|
};
|
|
9939
9960
|
|
|
9961
|
+
var OFFLINE_MESSAGE = 'Offline.';
|
|
9940
9962
|
var SeatMapContainer = function SeatMapContainer(props) {
|
|
9941
9963
|
var _props$event = props.event,
|
|
9942
9964
|
eventId = _props$event.id,
|
|
@@ -9989,7 +10011,11 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
9989
10011
|
var _useState11 = React.useState({}),
|
|
9990
10012
|
guestCounts = _useState11[0],
|
|
9991
10013
|
setGuestCounts = _useState11[1];
|
|
10014
|
+
var _useState12 = React.useState(true),
|
|
10015
|
+
isOnline = _useState12[0],
|
|
10016
|
+
setIsOnline = _useState12[1];
|
|
9992
10017
|
var isGuestCountsSet = React.useRef(false);
|
|
10018
|
+
useOnline(setIsOnline);
|
|
9993
10019
|
var updateGuestCounts = function updateGuestCounts(data) {
|
|
9994
10020
|
_forEach(data, function (item) {
|
|
9995
10021
|
var tierTickets = ticketTypeTierRelationsRef.current[item.tierId];
|
|
@@ -10041,10 +10067,14 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
10041
10067
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
10042
10068
|
while (1) switch (_context2.prev = _context2.next) {
|
|
10043
10069
|
case 0:
|
|
10044
|
-
|
|
10045
|
-
|
|
10070
|
+
if (!isOnline) {
|
|
10071
|
+
_context2.next = 18;
|
|
10072
|
+
break;
|
|
10073
|
+
}
|
|
10074
|
+
_context2.prev = 1;
|
|
10075
|
+
_context2.next = 4;
|
|
10046
10076
|
return getSeatMapStatuses(eventId);
|
|
10047
|
-
case
|
|
10077
|
+
case 4:
|
|
10048
10078
|
statusesResponse = _context2.sent;
|
|
10049
10079
|
statuses = _get(statusesResponse, 'data.attributes') || {};
|
|
10050
10080
|
reservationData = [];
|
|
@@ -10083,18 +10113,18 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
10083
10113
|
setSelectedTickets({});
|
|
10084
10114
|
}
|
|
10085
10115
|
}
|
|
10086
|
-
_context2.next =
|
|
10116
|
+
_context2.next = 18;
|
|
10087
10117
|
break;
|
|
10088
|
-
case
|
|
10089
|
-
_context2.prev =
|
|
10090
|
-
_context2.t0 = _context2["catch"](
|
|
10118
|
+
case 15:
|
|
10119
|
+
_context2.prev = 15;
|
|
10120
|
+
_context2.t0 = _context2["catch"](1);
|
|
10091
10121
|
setError('Something went wrong');
|
|
10092
|
-
case
|
|
10122
|
+
case 18:
|
|
10093
10123
|
case "end":
|
|
10094
10124
|
return _context2.stop();
|
|
10095
10125
|
}
|
|
10096
|
-
}, _callee2, null, [[
|
|
10097
|
-
})), [eventId, seatMapStatuses, reservedSeats]);
|
|
10126
|
+
}, _callee2, null, [[1, 15]]);
|
|
10127
|
+
})), [eventId, seatMapStatuses, reservedSeats, isOnline]);
|
|
10098
10128
|
var startTimer = React.useCallback(function (duration) {
|
|
10099
10129
|
setShowTimer(true);
|
|
10100
10130
|
if (!localStorage.getItem("reservationStart-" + eventId)) {
|
|
@@ -10336,6 +10366,13 @@ var SeatMapContainer = function SeatMapContainer(props) {
|
|
|
10336
10366
|
clearInterval(intervalId);
|
|
10337
10367
|
};
|
|
10338
10368
|
}, [fetchSeatMapReservations]);
|
|
10369
|
+
React.useEffect(function () {
|
|
10370
|
+
if (!isOnline) {
|
|
10371
|
+
setError(OFFLINE_MESSAGE);
|
|
10372
|
+
} else if (isOnline && error === OFFLINE_MESSAGE) {
|
|
10373
|
+
setError(null);
|
|
10374
|
+
}
|
|
10375
|
+
}, [error, isOnline]);
|
|
10339
10376
|
return React__default.createElement(React__default.Fragment, null, error && React__default.createElement(material.Alert, {
|
|
10340
10377
|
severity: "error",
|
|
10341
10378
|
onClose: function onClose() {
|
|
@@ -10864,7 +10901,7 @@ var RsvpContainer = function RsvpContainer(_ref) {
|
|
|
10864
10901
|
|
|
10865
10902
|
var formFieldsNotLoggedIn = [{
|
|
10866
10903
|
name: 'basic-info',
|
|
10867
|
-
groupLabel:
|
|
10904
|
+
groupLabel: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", null, "If you want to enter your details manually, please type them below to create an account, then click on"), /*#__PURE__*/React__default.createElement("b", null, " Confirm Registration:")),
|
|
10868
10905
|
groupLabelClassName: '',
|
|
10869
10906
|
groupClassName: '',
|
|
10870
10907
|
fields: [{
|
|
@@ -11276,11 +11313,11 @@ var PreRegistration = function PreRegistration(_ref) {
|
|
|
11276
11313
|
}();
|
|
11277
11314
|
fetchCountries();
|
|
11278
11315
|
}, []);
|
|
11316
|
+
var hash = getQueryVariable('hash') || '';
|
|
11317
|
+
var referrerId = getQueryVariable('referrer_id') || '';
|
|
11279
11318
|
return React__default.createElement("div", {
|
|
11280
11319
|
className: "pre-registration-container"
|
|
11281
|
-
}, React__default.createElement(
|
|
11282
|
-
eventId: eventId
|
|
11283
|
-
}), React__default.createElement(SnackbarAlert, {
|
|
11320
|
+
}, React__default.createElement(SnackbarAlert, {
|
|
11284
11321
|
type: "error",
|
|
11285
11322
|
isOpen: !!error,
|
|
11286
11323
|
message: error || '',
|
|
@@ -11291,7 +11328,7 @@ var PreRegistration = function PreRegistration(_ref) {
|
|
|
11291
11328
|
className: "account-actions-block"
|
|
11292
11329
|
}, React__default.createElement("div", {
|
|
11293
11330
|
className: "action-item"
|
|
11294
|
-
}, React__default.createElement("div", null, React__default.createElement("span", null, "If you have a"), React__default.createElement("b", null, " Mana Common "), React__default.createElement("span", null, "account and password already,"))), React__default.createElement("div", {
|
|
11331
|
+
}, React__default.createElement("div", null, React__default.createElement("span", null, "If you have a"), React__default.createElement("b", null, " Mana Common "), React__default.createElement("span", null, "account and password already, create (or log in to) your account, then click on Confirm Registration."))), React__default.createElement("div", {
|
|
11295
11332
|
className: "action-item login-block"
|
|
11296
11333
|
}, React__default.createElement("button", {
|
|
11297
11334
|
className: "login-register-button",
|
|
@@ -11335,7 +11372,7 @@ var PreRegistration = function PreRegistration(_ref) {
|
|
|
11335
11372
|
case 0:
|
|
11336
11373
|
_context2.prev = 0;
|
|
11337
11374
|
if (!isLoggedIn) {
|
|
11338
|
-
_context2.next =
|
|
11375
|
+
_context2.next = 17;
|
|
11339
11376
|
break;
|
|
11340
11377
|
}
|
|
11341
11378
|
updatedValues = _extends({}, values);
|
|
@@ -11343,19 +11380,21 @@ var PreRegistration = function PreRegistration(_ref) {
|
|
|
11343
11380
|
updatedValues.dobDay = holderAgeDate.getDate();
|
|
11344
11381
|
updatedValues.dobMonth = holderAgeDate.getMonth() + 1;
|
|
11345
11382
|
updatedValues.dobYear = holderAgeDate.getFullYear();
|
|
11383
|
+
updatedValues.referrerId = referrerId;
|
|
11384
|
+
updatedValues.shareHash = hash;
|
|
11346
11385
|
// remove date picker string value
|
|
11347
11386
|
delete updatedValues.holderAge;
|
|
11348
|
-
_context2.next =
|
|
11387
|
+
_context2.next = 12;
|
|
11349
11388
|
return confirmPreRegistration(eventId, updatedValues);
|
|
11350
|
-
case
|
|
11389
|
+
case 12:
|
|
11351
11390
|
confirmationData = _context2.sent;
|
|
11352
11391
|
if (isWindowDefined$1) {
|
|
11353
11392
|
window.localStorage.setItem('pre-registration-hash', _get(confirmationData, 'attributes.hash'));
|
|
11354
11393
|
}
|
|
11355
11394
|
onConfirmationSuccess(confirmationData);
|
|
11356
|
-
_context2.next =
|
|
11395
|
+
_context2.next = 37;
|
|
11357
11396
|
break;
|
|
11358
|
-
case
|
|
11397
|
+
case 17:
|
|
11359
11398
|
bodyFormData = new FormData();
|
|
11360
11399
|
bodyFormData.append('first_name', values.firstName);
|
|
11361
11400
|
bodyFormData.append('last_name', values.lastName);
|
|
@@ -11368,23 +11407,23 @@ var PreRegistration = function PreRegistration(_ref) {
|
|
|
11368
11407
|
bodyFormData.append('client_id', CONFIGS.CLIENT_ID);
|
|
11369
11408
|
bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET);
|
|
11370
11409
|
bodyFormData.append('register_for', 'prereg');
|
|
11371
|
-
_context2.next =
|
|
11410
|
+
_context2.next = 31;
|
|
11372
11411
|
return register(bodyFormData);
|
|
11373
|
-
case
|
|
11412
|
+
case 31:
|
|
11374
11413
|
res = _context2.sent;
|
|
11375
|
-
_context2.next =
|
|
11414
|
+
_context2.next = 34;
|
|
11376
11415
|
return getProfileData();
|
|
11377
|
-
case
|
|
11416
|
+
case 34:
|
|
11378
11417
|
profileRes = _context2.sent;
|
|
11379
11418
|
onLoginSuccess(res.data);
|
|
11380
11419
|
if (isWindowDefined$1) {
|
|
11381
11420
|
window.localStorage.setItem('user_data', JSON.stringify(_get(profileRes, 'data.data')));
|
|
11382
11421
|
}
|
|
11383
|
-
case 35:
|
|
11384
|
-
_context2.next = 44;
|
|
11385
|
-
break;
|
|
11386
11422
|
case 37:
|
|
11387
|
-
_context2.
|
|
11423
|
+
_context2.next = 46;
|
|
11424
|
+
break;
|
|
11425
|
+
case 39:
|
|
11426
|
+
_context2.prev = 39;
|
|
11388
11427
|
_context2.t0 = _context2["catch"](0);
|
|
11389
11428
|
errorMessage = (_context2.t0 == null ? void 0 : _context2.t0.message) || 'Error';
|
|
11390
11429
|
emailErrors = _context2.t0 == null ? void 0 : (_e$response2 = _context2.t0.response) == null ? void 0 : (_e$response2$data = _e$response2.data) == null ? void 0 : (_e$response2$data$mes = _e$response2$data.message) == null ? void 0 : _e$response2$data$mes.email;
|
|
@@ -11400,11 +11439,11 @@ var PreRegistration = function PreRegistration(_ref) {
|
|
|
11400
11439
|
setError(errorMessage);
|
|
11401
11440
|
}
|
|
11402
11441
|
onConfirmationError(_context2.t0);
|
|
11403
|
-
case
|
|
11442
|
+
case 46:
|
|
11404
11443
|
case "end":
|
|
11405
11444
|
return _context2.stop();
|
|
11406
11445
|
}
|
|
11407
|
-
}, _callee2, null, [[0,
|
|
11446
|
+
}, _callee2, null, [[0, 39]]);
|
|
11408
11447
|
}));
|
|
11409
11448
|
function onSubmit(_x) {
|
|
11410
11449
|
return _onSubmit.apply(this, arguments);
|
|
@@ -11616,13 +11655,16 @@ var PreRegistrationComplete = function PreRegistrationComplete(_ref) {
|
|
|
11616
11655
|
var _useState6 = React.useState({}),
|
|
11617
11656
|
shareActionData = _useState6[0],
|
|
11618
11657
|
setShareActionData = _useState6[1];
|
|
11658
|
+
var _useState7 = React.useState({}),
|
|
11659
|
+
error = _useState7[0],
|
|
11660
|
+
setError = _useState7[1];
|
|
11619
11661
|
useCookieListener(X_TF_ECOMMERCE, function (value) {
|
|
11620
11662
|
return setIsLoggedIn(Boolean(value));
|
|
11621
11663
|
});
|
|
11622
11664
|
React.useEffect(function () {
|
|
11623
11665
|
var fetchConfirmationData = /*#__PURE__*/function () {
|
|
11624
11666
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
11625
|
-
var shareOptionsData, attributes, eventId, influencersData;
|
|
11667
|
+
var shareOptionsData, attributes, eventId, influencersData, _error$response;
|
|
11626
11668
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
11627
11669
|
while (1) switch (_context.prev = _context.next) {
|
|
11628
11670
|
case 0:
|
|
@@ -11664,7 +11706,7 @@ var PreRegistrationComplete = function PreRegistrationComplete(_ref) {
|
|
|
11664
11706
|
_context.prev = 17;
|
|
11665
11707
|
_context.t0 = _context["catch"](0);
|
|
11666
11708
|
if (axios.isAxiosError(_context.t0)) {
|
|
11667
|
-
|
|
11709
|
+
setError((_error$response = _context.t0.response) == null ? void 0 : _error$response.data);
|
|
11668
11710
|
}
|
|
11669
11711
|
case 20:
|
|
11670
11712
|
case "end":
|
|
@@ -11712,7 +11754,7 @@ var PreRegistrationComplete = function PreRegistrationComplete(_ref) {
|
|
|
11712
11754
|
return _ref3.apply(this, arguments);
|
|
11713
11755
|
};
|
|
11714
11756
|
}();
|
|
11715
|
-
return React__default.createElement(React__default.Fragment, null, isLoggedIn ? React__default.createElement("div", {
|
|
11757
|
+
return React__default.createElement(React__default.Fragment, null, isLoggedIn && _isEmpty(error) ? React__default.createElement("div", {
|
|
11716
11758
|
className: classNamePrefix + "_pre_registration_complete_container"
|
|
11717
11759
|
}, React__default.createElement(CopyMessageModal, {
|
|
11718
11760
|
showCopyModal: showCopyModal,
|
|
@@ -11746,6 +11788,12 @@ var PreRegistrationComplete = function PreRegistrationComplete(_ref) {
|
|
|
11746
11788
|
setShowModalLogin(false);
|
|
11747
11789
|
onLoginSuccess(res);
|
|
11748
11790
|
}
|
|
11791
|
+
}), !_isEmpty(error) && React__default.createElement(ConfirmModal, {
|
|
11792
|
+
hideCancelBtn: true,
|
|
11793
|
+
message: error.message,
|
|
11794
|
+
onConfirm: function onConfirm() {
|
|
11795
|
+
return onGetConfirmationDataError(error);
|
|
11796
|
+
}
|
|
11749
11797
|
}));
|
|
11750
11798
|
};
|
|
11751
11799
|
|