tf-checkout-react 1.0.77 → 1.0.81
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/api/index.d.ts +1 -0
- package/dist/components/billing-info-container/index.d.ts +1 -1
- package/dist/components/common/FormikPhoneNumberField.d.ts +1 -1
- package/dist/components/countdown/index.d.ts +11 -0
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +13 -1
- package/dist/components/paymentContainer/index.d.ts +5 -2
- package/dist/components/ticketsContainer/PromoCodeSection.d.ts +2 -1
- package/dist/components/ticketsContainer/index.d.ts +10 -1
- package/dist/components/waitingList/index.d.ts +1 -2
- package/dist/hooks/usePrevious.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +458 -156
- 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 +460 -158
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/utils/downloadPDF.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +2 -1
- package/src/api/index.ts +9 -0
- package/src/components/billing-info-container/index.tsx +19 -6
- package/src/components/common/CheckboxField.tsx +13 -9
- package/src/components/common/FormikPhoneNumberField.tsx +2 -1
- package/src/components/countdown/index.tsx +89 -0
- package/src/components/countdown/style.css +10 -0
- package/src/components/loginModal/index.tsx +2 -0
- package/src/components/orderDetailsContainer/ticketsTable.tsx +66 -60
- package/src/components/paymentContainer/index.tsx +6 -3
- package/src/components/stripePayment/index.tsx +3 -3
- package/src/components/ticketsContainer/PromoCodeSection.tsx +46 -32
- package/src/components/ticketsContainer/TicketsSection.tsx +10 -6
- package/src/components/ticketsContainer/index.tsx +191 -70
- package/src/components/ticketsContainer/style.css +7 -0
- package/src/components/waitingList/index.tsx +3 -9
- package/src/components/waitingList/style.css +4 -2
- package/src/hooks/usePrevious.tsx +9 -0
- package/src/utils/downloadPDF.tsx +30 -0
- package/src/utils/index.ts +2 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React, { Component, useState,
|
|
1
|
+
import React, { Component, useState, useRef, useEffect, useCallback, Fragment } from 'react';
|
|
2
2
|
import { connect, Formik, Form, Field } from 'formik';
|
|
3
3
|
import Button from '@mui/material/Button';
|
|
4
4
|
import _identity from 'lodash-es/identity';
|
|
5
5
|
import _map from 'lodash-es/map';
|
|
6
6
|
import _get from 'lodash-es/get';
|
|
7
7
|
import _includes from 'lodash-es/includes';
|
|
8
|
+
import _isEqual from 'lodash-es/isEqual';
|
|
8
9
|
import axios from 'axios';
|
|
9
10
|
import _forEach from 'lodash-es/forEach';
|
|
10
|
-
import { TextField, FormControl,
|
|
11
|
+
import { TextField, FormControl, FormHelperText, InputLabel, CircularProgress, createTheme as createTheme$1 } from '@mui/material';
|
|
11
12
|
import Modal from '@mui/material/Modal';
|
|
12
13
|
import Box from '@mui/material/Box';
|
|
13
14
|
import _flatMapDeep from 'lodash-es/flatMapDeep';
|
|
@@ -37,6 +38,8 @@ import _has from 'lodash-es/has';
|
|
|
37
38
|
import FormControl$1 from '@mui/material/FormControl';
|
|
38
39
|
import MenuItem from '@mui/material/MenuItem';
|
|
39
40
|
import SVG from 'react-inlinesvg';
|
|
41
|
+
import moment from 'moment-timezone';
|
|
42
|
+
import { ThemeProvider as ThemeProvider$1 } from '@mui/private-theming';
|
|
40
43
|
import Table from '@mui/material/Table';
|
|
41
44
|
import TableBody from '@mui/material/TableBody';
|
|
42
45
|
import TableCell from '@mui/material/TableCell';
|
|
@@ -987,6 +990,61 @@ var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
|
|
|
987
990
|
|
|
988
991
|
var ErrorFocus = /*#__PURE__*/connect(ErrorFocusInternal);
|
|
989
992
|
|
|
993
|
+
var downloadPDF = function downloadPDF(pdfUrl) {
|
|
994
|
+
if (typeof window === 'undefined') return;
|
|
995
|
+
var accessToken = localStorage.getItem('access_token');
|
|
996
|
+
if (!accessToken) return;
|
|
997
|
+
fetch(pdfUrl, {
|
|
998
|
+
headers: {
|
|
999
|
+
Authorization: "Bearer " + accessToken
|
|
1000
|
+
}
|
|
1001
|
+
}).then( /*#__PURE__*/function () {
|
|
1002
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(response) {
|
|
1003
|
+
var blobValue, fileNameHeader, fileName;
|
|
1004
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1005
|
+
while (1) {
|
|
1006
|
+
switch (_context.prev = _context.next) {
|
|
1007
|
+
case 0:
|
|
1008
|
+
_context.next = 2;
|
|
1009
|
+
return response.blob();
|
|
1010
|
+
|
|
1011
|
+
case 2:
|
|
1012
|
+
blobValue = _context.sent;
|
|
1013
|
+
fileNameHeader = response.headers.get("content-disposition") || '';
|
|
1014
|
+
fileName = fileNameHeader.split('"')[1];
|
|
1015
|
+
return _context.abrupt("return", {
|
|
1016
|
+
blobValue: blobValue,
|
|
1017
|
+
fileName: fileName
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
case 6:
|
|
1021
|
+
case "end":
|
|
1022
|
+
return _context.stop();
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}, _callee);
|
|
1026
|
+
}));
|
|
1027
|
+
|
|
1028
|
+
return function (_x) {
|
|
1029
|
+
return _ref.apply(this, arguments);
|
|
1030
|
+
};
|
|
1031
|
+
}()).then(function (_ref2) {
|
|
1032
|
+
var blobValue = _ref2.blobValue,
|
|
1033
|
+
fileName = _ref2.fileName;
|
|
1034
|
+
if (!fileName) return;
|
|
1035
|
+
var file = new Blob([blobValue], {
|
|
1036
|
+
type: 'application/pdf'
|
|
1037
|
+
});
|
|
1038
|
+
var fileURL = URL.createObjectURL(file);
|
|
1039
|
+
var link = document.createElement('a');
|
|
1040
|
+
link.href = fileURL;
|
|
1041
|
+
link.setAttribute('download', fileName);
|
|
1042
|
+
document.body.appendChild(link);
|
|
1043
|
+
link.click();
|
|
1044
|
+
document.body.removeChild(link);
|
|
1045
|
+
});
|
|
1046
|
+
};
|
|
1047
|
+
|
|
990
1048
|
var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, logedInValues) {
|
|
991
1049
|
var ticket_holders = [];
|
|
992
1050
|
var first_name = _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || '';
|
|
@@ -1127,6 +1185,14 @@ var handleSetAccessToken = function handleSetAccessToken(token) {
|
|
|
1127
1185
|
}
|
|
1128
1186
|
}
|
|
1129
1187
|
};
|
|
1188
|
+
function getEvent(id) {
|
|
1189
|
+
var response = publicRequest.get("v1/event/" + id, {
|
|
1190
|
+
headers: ttfHeaders
|
|
1191
|
+
})["catch"](function (error) {
|
|
1192
|
+
throw error;
|
|
1193
|
+
});
|
|
1194
|
+
return response;
|
|
1195
|
+
}
|
|
1130
1196
|
function getTickets(id, promoCode) {
|
|
1131
1197
|
var response = publicRequest.get("v1/event/" + id + "/tickets/", {
|
|
1132
1198
|
headers: promoCode ? _extends({}, ttfHeaders, {
|
|
@@ -1262,7 +1328,7 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1262
1328
|
},
|
|
1263
1329
|
onSubmit: function () {
|
|
1264
1330
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
|
|
1265
|
-
var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileResponse, profileSpecifiedData, profileDataObj, _e$response, _e$response$data, _error;
|
|
1331
|
+
var email, password, bodyFormData, resAutorize, bodyFormDataToken, resAccessToken, accessToken, profileResponse, profileSpecifiedData, profileDataObj, event, _e$response, _e$response$data, _error;
|
|
1266
1332
|
|
|
1267
1333
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1268
1334
|
while (1) {
|
|
@@ -1341,6 +1407,8 @@ var LoginModal = function LoginModal(_ref) {
|
|
|
1341
1407
|
if (typeof window !== 'undefined') {
|
|
1342
1408
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
1343
1409
|
window.localStorage.setItem('access_token', accessToken);
|
|
1410
|
+
event = new window.CustomEvent('tf-login');
|
|
1411
|
+
window.document.dispatchEvent(event);
|
|
1344
1412
|
}
|
|
1345
1413
|
|
|
1346
1414
|
onLogin();
|
|
@@ -1846,18 +1914,22 @@ var CustomField = function CustomField(_ref) {
|
|
|
1846
1914
|
|
|
1847
1915
|
var _excluded$1 = ["label", "field", "selectOptions", "theme", "setFieldValue"];
|
|
1848
1916
|
var CheckboxField = function CheckboxField(_ref) {
|
|
1917
|
+
var _rest$form, _field$name, _rest$form2, _field$name2;
|
|
1918
|
+
|
|
1849
1919
|
var label = _ref.label,
|
|
1850
1920
|
field = _ref.field,
|
|
1851
1921
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1852
1922
|
|
|
1853
1923
|
var customTheme = useTheme();
|
|
1854
|
-
return React.createElement(
|
|
1924
|
+
return React.createElement(FormControl, {
|
|
1925
|
+
error: !!(rest != null && (_rest$form = rest.form) != null && _rest$form.errors && rest.form.errors[(_field$name = field == null ? void 0 : field.name) != null ? _field$name : ""])
|
|
1926
|
+
}, React.createElement(FormGroup, null, React.createElement(FormControlLabel, {
|
|
1855
1927
|
control: React.createElement(Checkbox, Object.assign({}, field, rest)),
|
|
1856
1928
|
label: label,
|
|
1857
1929
|
componentsProps: {
|
|
1858
1930
|
typography: customTheme == null ? void 0 : customTheme.checkbox
|
|
1859
1931
|
}
|
|
1860
|
-
}));
|
|
1932
|
+
})), !!(rest != null && (_rest$form2 = rest.form) != null && _rest$form2.errors && rest.form.errors[(_field$name2 = field == null ? void 0 : field.name) != null ? _field$name2 : ""]) ? React.createElement(FormHelperText, null, "Required") : null);
|
|
1861
1933
|
};
|
|
1862
1934
|
|
|
1863
1935
|
var SelectField = function SelectField(_ref) {
|
|
@@ -1991,6 +2063,7 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
|
|
|
1991
2063
|
_ref$form = _ref.form,
|
|
1992
2064
|
touched = _ref$form.touched,
|
|
1993
2065
|
errors = _ref$form.errors,
|
|
2066
|
+
initialValues = _ref$form.initialValues,
|
|
1994
2067
|
setFieldValue = _ref.setFieldValue,
|
|
1995
2068
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1996
2069
|
|
|
@@ -2000,6 +2073,7 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
|
|
|
2000
2073
|
var customTheme = useTheme();
|
|
2001
2074
|
return React.createElement(MuiPhoneNumber, Object.assign({
|
|
2002
2075
|
name: 'phone',
|
|
2076
|
+
value: initialValues.phone,
|
|
2003
2077
|
onChange: function onChange(e) {
|
|
2004
2078
|
return setFieldValue("phone", removePlusSign(e));
|
|
2005
2079
|
},
|
|
@@ -2020,6 +2094,14 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
|
|
|
2020
2094
|
}, rest));
|
|
2021
2095
|
};
|
|
2022
2096
|
|
|
2097
|
+
var usePrevious = function usePrevious(value) {
|
|
2098
|
+
var ref = useRef();
|
|
2099
|
+
useEffect(function () {
|
|
2100
|
+
ref.current = value;
|
|
2101
|
+
});
|
|
2102
|
+
return ref.current;
|
|
2103
|
+
};
|
|
2104
|
+
|
|
2023
2105
|
var LogicRunner = function LogicRunner(_ref) {
|
|
2024
2106
|
var values = _ref.values,
|
|
2025
2107
|
setStates = _ref.setStates,
|
|
@@ -2157,7 +2239,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2157
2239
|
_ref3$onGetStatesErro = _ref3.onGetStatesError,
|
|
2158
2240
|
onGetStatesError = _ref3$onGetStatesErro === void 0 ? function () {} : _ref3$onGetStatesErro,
|
|
2159
2241
|
_ref3$onGetProfileDat = _ref3.onGetProfileDataSuccess,
|
|
2160
|
-
|
|
2242
|
+
_onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
|
|
2161
2243
|
_ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
|
|
2162
2244
|
onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? function () {} : _ref3$onGetProfileDat2,
|
|
2163
2245
|
_ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
|
|
@@ -2173,6 +2255,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2173
2255
|
accountInfoTitle = _ref3$accountInfoTitl === void 0 ? '' : _ref3$accountInfoTitl,
|
|
2174
2256
|
hideLogo = _ref3.hideLogo,
|
|
2175
2257
|
themeOptions = _ref3.themeOptions;
|
|
2258
|
+
|
|
2176
2259
|
var themeMui = createTheme(themeOptions);
|
|
2177
2260
|
var isWindowDefined = typeof window !== 'undefined';
|
|
2178
2261
|
var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
@@ -2247,9 +2330,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2247
2330
|
|
|
2248
2331
|
var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
|
|
2249
2332
|
|
|
2250
|
-
var
|
|
2333
|
+
var ttfOptIn = _get(cartInfoData, 'ttfOptIn', false);
|
|
2334
|
+
|
|
2335
|
+
var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true); // Get prevProps
|
|
2251
2336
|
|
|
2252
|
-
|
|
2337
|
+
|
|
2338
|
+
var prevData = usePrevious(data);
|
|
2339
|
+
|
|
2340
|
+
if (!_get(dataWithUniqueIds, '[0].uniqueId') || !_isEqual(prevData, data)) {
|
|
2253
2341
|
setDataWithUniqueIds(assingUniqueIds(data));
|
|
2254
2342
|
}
|
|
2255
2343
|
|
|
@@ -2404,7 +2492,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2404
2492
|
lastName: profileDataObj.last_name
|
|
2405
2493
|
}));
|
|
2406
2494
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
2407
|
-
|
|
2495
|
+
|
|
2496
|
+
_onGetProfileDataSuccess(userDataResponse.data);
|
|
2408
2497
|
|
|
2409
2498
|
case 10:
|
|
2410
2499
|
_context4.next = 15;
|
|
@@ -2440,7 +2529,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2440
2529
|
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2441
2530
|
country: _get(userData, 'country', '') || "1",
|
|
2442
2531
|
state: _get(userData, 'state', '') || "1",
|
|
2443
|
-
brand_opt_in: optedInFieldValue
|
|
2532
|
+
brand_opt_in: optedInFieldValue,
|
|
2533
|
+
ttf_opt_in: ttfOptIn
|
|
2444
2534
|
}), userValues),
|
|
2445
2535
|
enableReinitialize: true,
|
|
2446
2536
|
onSubmit: function () {
|
|
@@ -2684,13 +2774,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2684
2774
|
var groupClassname = group.groupClassname,
|
|
2685
2775
|
groupItems = group.groupItems;
|
|
2686
2776
|
return React.createElement("div", {
|
|
2687
|
-
key: group.
|
|
2777
|
+
key: group.id
|
|
2688
2778
|
}, React.createElement("div", {
|
|
2689
2779
|
className: groupClassname
|
|
2690
2780
|
}, _map(groupItems, function (element) {
|
|
2691
2781
|
return React.createElement("div", {
|
|
2692
2782
|
className: element.className,
|
|
2693
|
-
key: element.
|
|
2783
|
+
key: element.name
|
|
2694
2784
|
}, React.createElement(Field, {
|
|
2695
2785
|
name: element.name + "-" + index,
|
|
2696
2786
|
label: element.label,
|
|
@@ -2724,7 +2814,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2724
2814
|
userExpired: userExpired,
|
|
2725
2815
|
onAuthorizeSuccess: onAuthorizeSuccess,
|
|
2726
2816
|
onAuthorizeError: onAuthorizeError,
|
|
2727
|
-
onGetProfileDataSuccess: onGetProfileDataSuccess
|
|
2817
|
+
onGetProfileDataSuccess: function onGetProfileDataSuccess(data) {
|
|
2818
|
+
fetchCart();
|
|
2819
|
+
|
|
2820
|
+
_onGetProfileDataSuccess(data);
|
|
2821
|
+
},
|
|
2728
2822
|
onGetProfileDataError: onGetProfileDataError
|
|
2729
2823
|
}), showModalRegister && React.createElement(RegisterModal, {
|
|
2730
2824
|
onClose: function onClose() {
|
|
@@ -2733,7 +2827,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2733
2827
|
onRegister: function onRegister() {
|
|
2734
2828
|
setShowModalRegister(false);
|
|
2735
2829
|
},
|
|
2736
|
-
onGetProfileDataSuccess: onGetProfileDataSuccess
|
|
2830
|
+
onGetProfileDataSuccess: function onGetProfileDataSuccess(data) {
|
|
2831
|
+
fetchCart();
|
|
2832
|
+
|
|
2833
|
+
_onGetProfileDataSuccess(data);
|
|
2834
|
+
},
|
|
2737
2835
|
onGetProfileDataError: onGetProfileDataError
|
|
2738
2836
|
}));
|
|
2739
2837
|
};
|
|
@@ -2957,7 +3055,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2957
3055
|
}, React.createElement("span", {
|
|
2958
3056
|
className: "card_label_text"
|
|
2959
3057
|
}, "Card number"), React.createElement(CardNumberElement, {
|
|
2960
|
-
options: _extends({}, options
|
|
3058
|
+
options: _extends({}, options, stripeCardOptions),
|
|
2961
3059
|
onReady: _identity,
|
|
2962
3060
|
onChange: _identity,
|
|
2963
3061
|
onBlur: _identity,
|
|
@@ -2967,13 +3065,13 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2967
3065
|
}, React.createElement("span", {
|
|
2968
3066
|
className: "card_label_text"
|
|
2969
3067
|
}, "Expiration date"), React.createElement(CardExpiryElement, {
|
|
2970
|
-
options: _extends({}, options
|
|
3068
|
+
options: _extends({}, options, stripeCardOptions)
|
|
2971
3069
|
})), React.createElement("label", {
|
|
2972
3070
|
className: "cvc_element"
|
|
2973
3071
|
}, React.createElement("span", {
|
|
2974
3072
|
className: "card_label_text"
|
|
2975
3073
|
}, "CVC"), React.createElement(CardCvcElement, {
|
|
2976
|
-
options: _extends({}, options
|
|
3074
|
+
options: _extends({}, options, stripeCardOptions)
|
|
2977
3075
|
})), !disableZipSection && React.createElement("label", {
|
|
2978
3076
|
className: "zip_element"
|
|
2979
3077
|
}, React.createElement("p", {
|
|
@@ -3065,7 +3163,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3065
3163
|
stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption,
|
|
3066
3164
|
_ref$disableZipSectio = _ref.disableZipSection,
|
|
3067
3165
|
disableZipSection = _ref$disableZipSectio === void 0 ? false : _ref$disableZipSectio,
|
|
3068
|
-
themeOptions = _ref.themeOptions
|
|
3166
|
+
themeOptions = _ref.themeOptions,
|
|
3167
|
+
elementsOptions = _ref.elementsOptions;
|
|
3069
3168
|
|
|
3070
3169
|
var _useState = useState(initialReviewValues),
|
|
3071
3170
|
reviewData = _useState[0],
|
|
@@ -3286,7 +3385,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3286
3385
|
}, "Please provide your payment information"), showErrorText && React.createElement("p", {
|
|
3287
3386
|
className: "payment_info__error"
|
|
3288
3387
|
}, errorText), React.createElement("div", null, React.createElement(Elements, {
|
|
3289
|
-
stripe: getStripePromise(reviewData)
|
|
3388
|
+
stripe: getStripePromise(reviewData),
|
|
3389
|
+
options: elementsOptions
|
|
3290
3390
|
}, React.createElement(CheckoutForm, {
|
|
3291
3391
|
stripe_client_secret: _get(reviewData, 'payment_method.stripe_client_secret'),
|
|
3292
3392
|
total: orderData.total,
|
|
@@ -3769,12 +3869,14 @@ var TicketsSection = function TicketsSection(_ref) {
|
|
|
3769
3869
|
style: {
|
|
3770
3870
|
minWidth: 55
|
|
3771
3871
|
}
|
|
3772
|
-
}, React.createElement(TicketRow, {
|
|
3872
|
+
}, ticket.salesStarted ? React.createElement(TicketRow, {
|
|
3773
3873
|
ticketTier: ticket,
|
|
3774
3874
|
prevTicketTier: arr[i - 1],
|
|
3775
3875
|
selectedTickets: selectedTickets,
|
|
3776
3876
|
handleTicketSelect: ticketSelect
|
|
3777
|
-
})
|
|
3877
|
+
}) : React.createElement("p", {
|
|
3878
|
+
className: 'ticket-not-started-message'
|
|
3879
|
+
}, "Sales not started"))));
|
|
3778
3880
|
}));
|
|
3779
3881
|
};
|
|
3780
3882
|
|
|
@@ -3794,8 +3896,7 @@ var generateQuantity = function generateQuantity(n) {
|
|
|
3794
3896
|
var WaitingList = function WaitingList(_ref) {
|
|
3795
3897
|
var _ref$tickets = _ref.tickets,
|
|
3796
3898
|
tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
|
|
3797
|
-
eventId = _ref.eventId
|
|
3798
|
-
isPromotionsEnabled = _ref.isPromotionsEnabled;
|
|
3899
|
+
eventId = _ref.eventId;
|
|
3799
3900
|
|
|
3800
3901
|
var _useState = useState(false),
|
|
3801
3902
|
showSuccessMessage = _useState[0],
|
|
@@ -3870,9 +3971,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3870
3971
|
className: "success-message"
|
|
3871
3972
|
}, React.createElement("p", {
|
|
3872
3973
|
className: "added-success-message"
|
|
3873
|
-
}, "You've been added to the waiting list!"), React.createElement("p", null, "You'll be notified if tickets become available.")) : React.createElement(React.Fragment, null,
|
|
3874
|
-
className: "no-tickets-text"
|
|
3875
|
-
}, "No tickets are currently available for this event."), React.createElement("h2", null, "WAITING LIST"), React.createElement(Formik, {
|
|
3974
|
+
}, "You've been added to the waiting list!"), React.createElement("p", null, "You'll be notified if tickets become available.")) : React.createElement(React.Fragment, null, React.createElement("h2", null, "WAITING LIST"), React.createElement(Formik, {
|
|
3876
3975
|
initialValues: {
|
|
3877
3976
|
ticketTypeId: '',
|
|
3878
3977
|
quantity: '',
|
|
@@ -3967,10 +4066,42 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
3967
4066
|
promoCodeIsApplied = _ref.promoCodeIsApplied,
|
|
3968
4067
|
showPromoInput = _ref.showPromoInput,
|
|
3969
4068
|
isPromotionsEnabled = _ref.isPromotionsEnabled,
|
|
3970
|
-
isAllTicketsSoldOut = _ref.isAllTicketsSoldOut,
|
|
3971
4069
|
setPromoCode = _ref.setPromoCode,
|
|
3972
4070
|
setPromoCodeUpdated = _ref.setPromoCodeUpdated,
|
|
3973
|
-
setShowPromoInput = _ref.setShowPromoInput
|
|
4071
|
+
setShowPromoInput = _ref.setShowPromoInput,
|
|
4072
|
+
isAccessCodeEnabled = _ref.isAccessCodeEnabled;
|
|
4073
|
+
var isPromoCodeHasValue = !!promoCode.trim();
|
|
4074
|
+
|
|
4075
|
+
var renderInputField = function renderInputField() {
|
|
4076
|
+
return React.createElement("div", {
|
|
4077
|
+
className: "promo-code-block"
|
|
4078
|
+
}, React.createElement("div", {
|
|
4079
|
+
className: "promo-code-block"
|
|
4080
|
+
}, React.createElement("p", {
|
|
4081
|
+
className: "promo-code-text"
|
|
4082
|
+
}, isAccessCodeEnabled ? 'Access code required' : 'Promo code')), React.createElement("input", {
|
|
4083
|
+
className: "promo-code-input",
|
|
4084
|
+
placeholder: "",
|
|
4085
|
+
onChange: function onChange(e) {
|
|
4086
|
+
setPromoCode(e.target.value);
|
|
4087
|
+
},
|
|
4088
|
+
onKeyPress: function onKeyPress(event) {
|
|
4089
|
+
if (event.key === 'Enter' && isPromoCodeHasValue) {
|
|
4090
|
+
setPromoCodeUpdated(promoCode);
|
|
4091
|
+
setShowPromoInput(false);
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
4094
|
+
}), React.createElement(Button$1, {
|
|
4095
|
+
className: "promo-submit-button",
|
|
4096
|
+
onClick: function onClick() {
|
|
4097
|
+
if (isPromoCodeHasValue) {
|
|
4098
|
+
setPromoCodeUpdated(promoCode);
|
|
4099
|
+
setShowPromoInput(false);
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
}, isAccessCodeEnabled ? 'ENTER' : 'APPLY'));
|
|
4103
|
+
};
|
|
4104
|
+
|
|
3974
4105
|
return React.createElement("div", null, promoCodeIsApplied ? React.createElement("div", {
|
|
3975
4106
|
className: "alert-info"
|
|
3976
4107
|
}, React.createElement(SVG, {
|
|
@@ -3978,35 +4109,95 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
3978
4109
|
preProcessor: function preProcessor(code) {
|
|
3979
4110
|
return code.replace(/fill=".*?"/g, 'fill="currentColor"');
|
|
3980
4111
|
}
|
|
3981
|
-
}), React.createElement("p",
|
|
3982
|
-
className: "promo-code-
|
|
3983
|
-
}, React.createElement(
|
|
3984
|
-
placeholder: "Promo Code",
|
|
3985
|
-
onChange: function onChange(e) {
|
|
3986
|
-
setPromoCode(e.target.value);
|
|
3987
|
-
},
|
|
3988
|
-
onKeyPress: function onKeyPress(event) {
|
|
3989
|
-
if (event.key === 'Enter') {
|
|
3990
|
-
setPromoCodeUpdated(promoCode);
|
|
3991
|
-
}
|
|
3992
|
-
}
|
|
3993
|
-
}), React.createElement(Button$1, {
|
|
3994
|
-
className: "promo-apply-button",
|
|
3995
|
-
placeholder: "Promo Code",
|
|
3996
|
-
onClick: function onClick() {
|
|
3997
|
-
setPromoCodeUpdated(promoCode);
|
|
3998
|
-
}
|
|
3999
|
-
}, "Apply")), isPromotionsEnabled && !showPromoInput && isAllTicketsSoldOut && React.createElement("p", {
|
|
4000
|
-
className: "promo-code-text"
|
|
4001
|
-
}, "Access code needed"), isPromotionsEnabled && !showPromoInput ? React.createElement(Button$1, {
|
|
4112
|
+
}), React.createElement("p", {
|
|
4113
|
+
className: "promo-code-success"
|
|
4114
|
+
}, "PROMO CODE APPLIED SUCCESSFULLY")) : null, showPromoInput && renderInputField(), isPromotionsEnabled && !showPromoInput && !isAccessCodeEnabled ? React.createElement(Button$1, {
|
|
4002
4115
|
className: "promo-code-button",
|
|
4003
4116
|
placeholder: "Promo Codes",
|
|
4004
4117
|
onClick: function onClick() {
|
|
4005
4118
|
setShowPromoInput(true);
|
|
4006
4119
|
}
|
|
4007
|
-
}, "Got a promo code? Click here") : null);
|
|
4120
|
+
}, "Got a promo code? Click here") : !isPromotionsEnabled && !showPromoInput && isAccessCodeEnabled && !promoCodeIsApplied ? renderInputField() : null);
|
|
4121
|
+
};
|
|
4122
|
+
|
|
4123
|
+
var isTimeExpired = function isTimeExpired(startDate, timezone) {
|
|
4124
|
+
return !moment(startDate).isAfter(moment.tz(moment(), timezone).format('YYYY-MM-DD HH:mm:ss'));
|
|
4008
4125
|
};
|
|
4009
4126
|
|
|
4127
|
+
function Countdown(_ref) {
|
|
4128
|
+
var startDate = _ref.startDate,
|
|
4129
|
+
_ref$timezone = _ref.timezone,
|
|
4130
|
+
timezone = _ref$timezone === void 0 ? moment.tz.guess() : _ref$timezone,
|
|
4131
|
+
_ref$title = _ref.title,
|
|
4132
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
|
4133
|
+
_ref$message = _ref.message,
|
|
4134
|
+
message = _ref$message === void 0 ? '' : _ref$message,
|
|
4135
|
+
_ref$callback = _ref.callback,
|
|
4136
|
+
callback = _ref$callback === void 0 ? function () {} : _ref$callback;
|
|
4137
|
+
|
|
4138
|
+
var _useState = useState(''),
|
|
4139
|
+
duration = _useState[0],
|
|
4140
|
+
setDuration = _useState[1];
|
|
4141
|
+
|
|
4142
|
+
var _useState2 = useState(false),
|
|
4143
|
+
timeExpired = _useState2[0],
|
|
4144
|
+
setTimeExpired = _useState2[1];
|
|
4145
|
+
|
|
4146
|
+
useEffect(function () {
|
|
4147
|
+
setTimeExpired(isTimeExpired(startDate, timezone));
|
|
4148
|
+
}, []);
|
|
4149
|
+
useEffect(function () {
|
|
4150
|
+
var timer;
|
|
4151
|
+
|
|
4152
|
+
if (!timeExpired) {
|
|
4153
|
+
timer = setInterval(function () {
|
|
4154
|
+
if (isTimeExpired(startDate, timezone)) {
|
|
4155
|
+
clearInterval(timer);
|
|
4156
|
+
setTimeExpired(true);
|
|
4157
|
+
callback();
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4160
|
+
var currentDate = moment.tz(moment(), timezone).format('YYYY-MM-DD HH:mm:ss');
|
|
4161
|
+
var diffTime = moment(startDate).diff(currentDate);
|
|
4162
|
+
var duration = moment.duration(diffTime);
|
|
4163
|
+
var dateArr = {
|
|
4164
|
+
year: duration.years(),
|
|
4165
|
+
month: duration.months(),
|
|
4166
|
+
day: duration.days(),
|
|
4167
|
+
hour: duration.hours(),
|
|
4168
|
+
minute: duration.minutes(),
|
|
4169
|
+
second: duration.seconds()
|
|
4170
|
+
};
|
|
4171
|
+
var timeLeft = '';
|
|
4172
|
+
|
|
4173
|
+
for (var date in dateArr) {
|
|
4174
|
+
var unit = dateArr[date] === 1 ? date : date + 's';
|
|
4175
|
+
var val = String(dateArr[date]).length === 1 ? '0' + dateArr[date] : dateArr[date];
|
|
4176
|
+
|
|
4177
|
+
if (timeLeft) {
|
|
4178
|
+
timeLeft += ", " + val + " " + unit;
|
|
4179
|
+
} else if (dateArr[date]) {
|
|
4180
|
+
timeLeft += val + " " + unit;
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
setDuration(timeLeft);
|
|
4185
|
+
}, 1000);
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
return function () {
|
|
4189
|
+
clearInterval(timer);
|
|
4190
|
+
};
|
|
4191
|
+
}, [timeExpired]);
|
|
4192
|
+
return React.createElement(React.Fragment, null, !timeExpired && duration && React.createElement("div", {
|
|
4193
|
+
className: 'countdown'
|
|
4194
|
+
}, React.createElement("div", null, React.createElement("p", {
|
|
4195
|
+
className: 'title'
|
|
4196
|
+
}, title), React.createElement("p", null, duration)), React.createElement("p", {
|
|
4197
|
+
className: 'message'
|
|
4198
|
+
}, message)));
|
|
4199
|
+
}
|
|
4200
|
+
|
|
4010
4201
|
function Loader$1() {
|
|
4011
4202
|
return React.createElement("div", {
|
|
4012
4203
|
className: "loader-container"
|
|
@@ -4014,7 +4205,8 @@ function Loader$1() {
|
|
|
4014
4205
|
}
|
|
4015
4206
|
|
|
4016
4207
|
var TicketsContainer = function TicketsContainer(_ref) {
|
|
4017
|
-
var
|
|
4208
|
+
var onLoginSuccess = _ref.onLoginSuccess,
|
|
4209
|
+
getTicketsLabel = _ref.getTicketsLabel,
|
|
4018
4210
|
eventId = _ref.eventId,
|
|
4019
4211
|
onAddToCartSuccess = _ref.onAddToCartSuccess,
|
|
4020
4212
|
_ref$contentStyle = _ref.contentStyle,
|
|
@@ -4030,43 +4222,62 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4030
4222
|
_ref$queryPromoCode = _ref.queryPromoCode,
|
|
4031
4223
|
queryPromoCode = _ref$queryPromoCode === void 0 ? '' : _ref$queryPromoCode,
|
|
4032
4224
|
_ref$isPromotionsEnab = _ref.isPromotionsEnabled,
|
|
4033
|
-
isPromotionsEnabled = _ref$isPromotionsEnab === void 0 ? true : _ref$isPromotionsEnab
|
|
4225
|
+
isPromotionsEnabled = _ref$isPromotionsEnab === void 0 ? true : _ref$isPromotionsEnab,
|
|
4226
|
+
themeOptions = _ref.themeOptions,
|
|
4227
|
+
_ref$isAccessCodeEnab = _ref.isAccessCodeEnabled,
|
|
4228
|
+
isAccessCodeEnabled = _ref$isAccessCodeEnab === void 0 ? false : _ref$isAccessCodeEnab,
|
|
4229
|
+
_ref$hideSessionButto = _ref.hideSessionButtons,
|
|
4230
|
+
hideSessionButtons = _ref$hideSessionButto === void 0 ? false : _ref$hideSessionButto;
|
|
4034
4231
|
|
|
4035
4232
|
var _useState = useState({}),
|
|
4036
4233
|
selectedTickets = _useState[0],
|
|
4037
4234
|
setSelectedTickets = _useState[1];
|
|
4038
4235
|
|
|
4039
|
-
var
|
|
4040
|
-
tickets = _useState2[0],
|
|
4041
|
-
setTickets = _useState2[1];
|
|
4236
|
+
var isWindowDefined = typeof window !== 'undefined';
|
|
4042
4237
|
|
|
4043
|
-
var
|
|
4044
|
-
|
|
4045
|
-
|
|
4238
|
+
var _useState2 = useState(isWindowDefined ? !!window.localStorage.getItem('access_token') : false),
|
|
4239
|
+
isLogged = _useState2[0],
|
|
4240
|
+
setIsLogged = _useState2[1];
|
|
4046
4241
|
|
|
4047
|
-
var
|
|
4048
|
-
|
|
4049
|
-
|
|
4242
|
+
var _React$useState = React.useState(false),
|
|
4243
|
+
showLoginModal = _React$useState[0],
|
|
4244
|
+
setShowLoginModal = _React$useState[1];
|
|
4245
|
+
|
|
4246
|
+
var _useState3 = useState([]),
|
|
4247
|
+
tickets = _useState3[0],
|
|
4248
|
+
setTickets = _useState3[1];
|
|
4249
|
+
|
|
4250
|
+
var _useState4 = useState(null),
|
|
4251
|
+
event = _useState4[0],
|
|
4252
|
+
setEvent = _useState4[1];
|
|
4050
4253
|
|
|
4051
4254
|
var _useState5 = useState(false),
|
|
4052
|
-
|
|
4053
|
-
|
|
4255
|
+
showWaitingList = _useState5[0],
|
|
4256
|
+
setShowWaitingList = _useState5[1];
|
|
4054
4257
|
|
|
4055
|
-
var _useState6 = useState(
|
|
4056
|
-
|
|
4057
|
-
|
|
4258
|
+
var _useState6 = useState(false),
|
|
4259
|
+
isLoading = _useState6[0],
|
|
4260
|
+
setIsLoading = _useState6[1];
|
|
4058
4261
|
|
|
4059
|
-
var _useState7 = useState(
|
|
4060
|
-
|
|
4061
|
-
|
|
4262
|
+
var _useState7 = useState(false),
|
|
4263
|
+
handleBookIsLoading = _useState7[0],
|
|
4264
|
+
setHandleBookIsLoading = _useState7[1];
|
|
4062
4265
|
|
|
4063
|
-
var _useState8 = useState(
|
|
4064
|
-
|
|
4065
|
-
|
|
4266
|
+
var _useState8 = useState(''),
|
|
4267
|
+
promoCode = _useState8[0],
|
|
4268
|
+
setPromoCode = _useState8[1];
|
|
4066
4269
|
|
|
4067
|
-
var _useState9 = useState(
|
|
4068
|
-
|
|
4069
|
-
|
|
4270
|
+
var _useState9 = useState(queryPromoCode),
|
|
4271
|
+
promoCodeUpdated = _useState9[0],
|
|
4272
|
+
setPromoCodeUpdated = _useState9[1];
|
|
4273
|
+
|
|
4274
|
+
var _useState10 = useState(false),
|
|
4275
|
+
showPromoInput = _useState10[0],
|
|
4276
|
+
setShowPromoInput = _useState10[1];
|
|
4277
|
+
|
|
4278
|
+
var _useState11 = useState(false),
|
|
4279
|
+
promoCodeIsApplied = _useState11[0],
|
|
4280
|
+
setPromoCodeIsApplied = _useState11[1];
|
|
4070
4281
|
|
|
4071
4282
|
useEffect(function () {
|
|
4072
4283
|
if (typeof window !== 'undefined') {
|
|
@@ -4083,62 +4294,103 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4083
4294
|
}
|
|
4084
4295
|
}, []);
|
|
4085
4296
|
useEffect(function () {
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
}
|
|
4297
|
+
getTicketsApi();
|
|
4298
|
+
}, [eventId, promoCodeUpdated]);
|
|
4089
4299
|
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
switch (_context.prev = _context.next) {
|
|
4096
|
-
case 0:
|
|
4097
|
-
_context.prev = 0;
|
|
4098
|
-
setIsLoading(true);
|
|
4099
|
-
_context.next = 4;
|
|
4100
|
-
return getTickets(eventId, promoCodeUpdated);
|
|
4101
|
-
|
|
4102
|
-
case 4:
|
|
4103
|
-
response = _context.sent;
|
|
4104
|
-
|
|
4105
|
-
if (response.data.success) {
|
|
4106
|
-
setCustomHeader(response);
|
|
4107
|
-
attributes = _get(response, 'data.data.attributes');
|
|
4108
|
-
setPromoCodeIsApplied(attributes.ValidPromoCode);
|
|
4109
|
-
setTickets(_get(attributes, 'tickets'));
|
|
4110
|
-
setShowWaitingList(attributes.showWaitingList);
|
|
4111
|
-
onGetTicketsSuccess(response.data);
|
|
4112
|
-
}
|
|
4300
|
+
var handleLogout = function handleLogout() {
|
|
4301
|
+
if (isWindowDefined) {
|
|
4302
|
+
window.localStorage.removeItem('access_token');
|
|
4303
|
+
window.localStorage.removeItem('user_data');
|
|
4304
|
+
setIsLogged(false);
|
|
4113
4305
|
|
|
4114
|
-
|
|
4115
|
-
break;
|
|
4306
|
+
var _event = new window.CustomEvent('tf-logout');
|
|
4116
4307
|
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4308
|
+
window.document.dispatchEvent(_event);
|
|
4309
|
+
}
|
|
4310
|
+
};
|
|
4120
4311
|
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4312
|
+
var handleExternalLogin = function handleExternalLogin() {
|
|
4313
|
+
setIsLogged(true);
|
|
4314
|
+
};
|
|
4124
4315
|
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
return _context.finish(11);
|
|
4316
|
+
var handleOnClose = function handleOnClose() {
|
|
4317
|
+
setShowLoginModal(false);
|
|
4318
|
+
};
|
|
4129
4319
|
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
}));
|
|
4137
|
-
return _getTicketsApi.apply(this, arguments);
|
|
4320
|
+
var handleOnLogin = function handleOnLogin() {
|
|
4321
|
+
setShowLoginModal(false);
|
|
4322
|
+
setIsLogged(true);
|
|
4323
|
+
|
|
4324
|
+
if (onLoginSuccess) {
|
|
4325
|
+
onLoginSuccess();
|
|
4138
4326
|
}
|
|
4327
|
+
};
|
|
4139
4328
|
|
|
4140
|
-
|
|
4141
|
-
|
|
4329
|
+
function getTicketsApi() {
|
|
4330
|
+
return _getTicketsApi.apply(this, arguments);
|
|
4331
|
+
}
|
|
4332
|
+
|
|
4333
|
+
function _getTicketsApi() {
|
|
4334
|
+
_getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
4335
|
+
var response, eventResponse, attributes, _event2;
|
|
4336
|
+
|
|
4337
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
4338
|
+
while (1) {
|
|
4339
|
+
switch (_context2.prev = _context2.next) {
|
|
4340
|
+
case 0:
|
|
4341
|
+
_context2.prev = 0;
|
|
4342
|
+
setIsLoading(true);
|
|
4343
|
+
_context2.next = 4;
|
|
4344
|
+
return getTickets(eventId, promoCodeUpdated);
|
|
4345
|
+
|
|
4346
|
+
case 4:
|
|
4347
|
+
response = _context2.sent;
|
|
4348
|
+
_context2.next = 7;
|
|
4349
|
+
return getEvent(eventId);
|
|
4350
|
+
|
|
4351
|
+
case 7:
|
|
4352
|
+
eventResponse = _context2.sent;
|
|
4353
|
+
|
|
4354
|
+
if (response.data.success) {
|
|
4355
|
+
setCustomHeader(response);
|
|
4356
|
+
attributes = _get(response, 'data.data.attributes');
|
|
4357
|
+
setPromoCodeIsApplied(attributes.ValidPromoCode);
|
|
4358
|
+
setTickets(_get(attributes, 'tickets'));
|
|
4359
|
+
setShowWaitingList(attributes.showWaitingList);
|
|
4360
|
+
onGetTicketsSuccess(response.data);
|
|
4361
|
+
setPromoCode('');
|
|
4362
|
+
}
|
|
4363
|
+
|
|
4364
|
+
if (eventResponse.data.success) {
|
|
4365
|
+
_event2 = _get(eventResponse, 'data.data.attributes');
|
|
4366
|
+
setEvent(_event2);
|
|
4367
|
+
}
|
|
4368
|
+
|
|
4369
|
+
_context2.next = 15;
|
|
4370
|
+
break;
|
|
4371
|
+
|
|
4372
|
+
case 12:
|
|
4373
|
+
_context2.prev = 12;
|
|
4374
|
+
_context2.t0 = _context2["catch"](0);
|
|
4375
|
+
|
|
4376
|
+
if (axios.isAxiosError(_context2.t0)) {
|
|
4377
|
+
onGetTicketsError(_context2.t0);
|
|
4378
|
+
}
|
|
4379
|
+
|
|
4380
|
+
case 15:
|
|
4381
|
+
_context2.prev = 15;
|
|
4382
|
+
setIsLoading(false);
|
|
4383
|
+
return _context2.finish(15);
|
|
4384
|
+
|
|
4385
|
+
case 18:
|
|
4386
|
+
case "end":
|
|
4387
|
+
return _context2.stop();
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4390
|
+
}, _callee2, null, [[0, 12, 15, 18]]);
|
|
4391
|
+
}));
|
|
4392
|
+
return _getTicketsApi.apply(this, arguments);
|
|
4393
|
+
}
|
|
4142
4394
|
|
|
4143
4395
|
var handleTicketSelect = function handleTicketSelect(key, value) {
|
|
4144
4396
|
setSelectedTickets(function (prevState) {
|
|
@@ -4152,15 +4404,21 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4152
4404
|
});
|
|
4153
4405
|
};
|
|
4154
4406
|
|
|
4407
|
+
var handleOrdersClick = function handleOrdersClick() {
|
|
4408
|
+
if (isWindowDefined) {
|
|
4409
|
+
window.location.href = '/orders';
|
|
4410
|
+
}
|
|
4411
|
+
};
|
|
4412
|
+
|
|
4155
4413
|
var handleBook = /*#__PURE__*/function () {
|
|
4156
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4414
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
4157
4415
|
var _product_options, _product_options2, _ticket_types;
|
|
4158
4416
|
|
|
4159
|
-
var ticket, optionName, ticketId, ticketQuantity, data, result, _result$data$data$att, _result$data, _result$data$data, _result$data$data$att2, _result$data$data$att3, _result$data2, _result$data2$data, _result$data2$data$at, _result$data$data$att4, _result$data3, _result$data3$data, _result$data3$data$at, skipBillingPage, nameIsRequired, ageIsRequired, hash,
|
|
4417
|
+
var ticket, optionName, ticketId, ticketQuantity, data, result, _result$data$data$att, _result$data, _result$data$data, _result$data$data$att2, _result$data$data$att3, _result$data2, _result$data2$data, _result$data2$data$at, _result$data$data$att4, _result$data3, _result$data3$data, _result$data3$data$at, skipBillingPage, nameIsRequired, ageIsRequired, hash, _isWindowDefined, userData, access_token, ticketsQuantity, checkoutBody, checkoutResult;
|
|
4160
4418
|
|
|
4161
|
-
return runtime_1.wrap(function
|
|
4419
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
4162
4420
|
while (1) {
|
|
4163
|
-
switch (
|
|
4421
|
+
switch (_context.prev = _context.next) {
|
|
4164
4422
|
case 0:
|
|
4165
4423
|
setHandleBookIsLoading(true);
|
|
4166
4424
|
ticket = _find(tickets, function (item) {
|
|
@@ -4181,15 +4439,15 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4181
4439
|
}, _ticket_types)
|
|
4182
4440
|
}
|
|
4183
4441
|
};
|
|
4184
|
-
|
|
4185
|
-
|
|
4442
|
+
_context.prev = 6;
|
|
4443
|
+
_context.next = 9;
|
|
4186
4444
|
return addToCart(eventId, data);
|
|
4187
4445
|
|
|
4188
4446
|
case 9:
|
|
4189
|
-
result =
|
|
4447
|
+
result = _context.sent;
|
|
4190
4448
|
|
|
4191
4449
|
if (!(result.status === 200)) {
|
|
4192
|
-
|
|
4450
|
+
_context.next = 27;
|
|
4193
4451
|
break;
|
|
4194
4452
|
}
|
|
4195
4453
|
|
|
@@ -4200,21 +4458,21 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4200
4458
|
hash = '';
|
|
4201
4459
|
|
|
4202
4460
|
if (!skipBillingPage) {
|
|
4203
|
-
|
|
4461
|
+
_context.next = 26;
|
|
4204
4462
|
break;
|
|
4205
4463
|
}
|
|
4206
4464
|
|
|
4207
4465
|
// Get user data for checkout data
|
|
4208
|
-
|
|
4209
|
-
userData =
|
|
4210
|
-
access_token =
|
|
4466
|
+
_isWindowDefined = typeof window !== 'undefined';
|
|
4467
|
+
userData = _isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
4468
|
+
access_token = _isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
4211
4469
|
ticketsQuantity = Object.keys(selectedTickets).length;
|
|
4212
4470
|
checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, userData);
|
|
4213
|
-
|
|
4471
|
+
_context.next = 24;
|
|
4214
4472
|
return postOnCheckout(checkoutBody, access_token);
|
|
4215
4473
|
|
|
4216
4474
|
case 24:
|
|
4217
|
-
checkoutResult =
|
|
4475
|
+
checkoutResult = _context.sent;
|
|
4218
4476
|
hash = _get(checkoutResult, 'data.data.attributes.hash');
|
|
4219
4477
|
|
|
4220
4478
|
case 26:
|
|
@@ -4227,28 +4485,28 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4227
4485
|
});
|
|
4228
4486
|
|
|
4229
4487
|
case 27:
|
|
4230
|
-
|
|
4488
|
+
_context.next = 32;
|
|
4231
4489
|
break;
|
|
4232
4490
|
|
|
4233
4491
|
case 29:
|
|
4234
|
-
|
|
4235
|
-
|
|
4492
|
+
_context.prev = 29;
|
|
4493
|
+
_context.t0 = _context["catch"](6);
|
|
4236
4494
|
|
|
4237
|
-
if (axios.isAxiosError(
|
|
4238
|
-
onAddToCartError(
|
|
4495
|
+
if (axios.isAxiosError(_context.t0)) {
|
|
4496
|
+
onAddToCartError(_context.t0);
|
|
4239
4497
|
}
|
|
4240
4498
|
|
|
4241
4499
|
case 32:
|
|
4242
|
-
|
|
4500
|
+
_context.prev = 32;
|
|
4243
4501
|
setHandleBookIsLoading(false);
|
|
4244
|
-
return
|
|
4502
|
+
return _context.finish(32);
|
|
4245
4503
|
|
|
4246
4504
|
case 35:
|
|
4247
4505
|
case "end":
|
|
4248
|
-
return
|
|
4506
|
+
return _context.stop();
|
|
4249
4507
|
}
|
|
4250
4508
|
}
|
|
4251
|
-
},
|
|
4509
|
+
}, _callee, null, [[6, 29, 32, 35]]);
|
|
4252
4510
|
}));
|
|
4253
4511
|
|
|
4254
4512
|
return function handleBook() {
|
|
@@ -4256,10 +4514,29 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4256
4514
|
};
|
|
4257
4515
|
}();
|
|
4258
4516
|
|
|
4517
|
+
var updateTickets = function updateTickets() {
|
|
4518
|
+
getTicketsApi();
|
|
4519
|
+
};
|
|
4520
|
+
|
|
4259
4521
|
var isAllTicketsSoldOut = !_some(tickets, function (item) {
|
|
4260
4522
|
return !(item.sold_out || item.soldOut);
|
|
4261
4523
|
});
|
|
4262
|
-
|
|
4524
|
+
var themeMui = createTheme$1(themeOptions);
|
|
4525
|
+
useEffect(function () {
|
|
4526
|
+
isWindowDefined && window.document.addEventListener('custom-logout', handleLogout);
|
|
4527
|
+
return function () {
|
|
4528
|
+
isWindowDefined && window.document.removeEventListener('custom-logout', handleLogout);
|
|
4529
|
+
};
|
|
4530
|
+
}, []);
|
|
4531
|
+
useEffect(function () {
|
|
4532
|
+
isWindowDefined && window.document.addEventListener('custom-login', handleExternalLogin);
|
|
4533
|
+
return function () {
|
|
4534
|
+
isWindowDefined && window.document.removeEventListener('custom-login', handleExternalLogin);
|
|
4535
|
+
};
|
|
4536
|
+
}, []);
|
|
4537
|
+
return React.createElement(ThemeProvider$1, {
|
|
4538
|
+
theme: themeMui
|
|
4539
|
+
}, React.createElement("div", {
|
|
4263
4540
|
className: "get-tickets-page " + theme,
|
|
4264
4541
|
style: contentStyle
|
|
4265
4542
|
}, isLoading ? React.createElement(Loader$1, null) : React.createElement("div", null, React.createElement(TicketsSection, {
|
|
@@ -4267,10 +4544,15 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4267
4544
|
selectedTickets: selectedTickets,
|
|
4268
4545
|
handleTicketSelect: handleTicketSelect,
|
|
4269
4546
|
promoCodeIsApplied: promoCodeIsApplied
|
|
4270
|
-
}),
|
|
4547
|
+
}), event != null && event.salesEnded ? React.createElement("p", null, "Sales for this event are closed.") : event != null && event.salesStart ? React.createElement(Countdown, {
|
|
4548
|
+
startDate: event.salesStart,
|
|
4549
|
+
timezone: event.timezone,
|
|
4550
|
+
title: "Sales start in:",
|
|
4551
|
+
message: "No tickets are currently available for this event.",
|
|
4552
|
+
callback: updateTickets
|
|
4553
|
+
}) : null, showWaitingList && event.salesStarted && React.createElement(WaitingList, {
|
|
4271
4554
|
tickets: tickets,
|
|
4272
|
-
eventId: eventId
|
|
4273
|
-
isPromotionsEnabled: isPromotionsEnabled
|
|
4555
|
+
eventId: eventId
|
|
4274
4556
|
}), React.createElement(PromoCodeSection, {
|
|
4275
4557
|
promoCode: promoCode,
|
|
4276
4558
|
promoCodeIsApplied: promoCodeIsApplied,
|
|
@@ -4279,12 +4561,30 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4279
4561
|
setPromoCodeUpdated: setPromoCodeUpdated,
|
|
4280
4562
|
setShowPromoInput: setShowPromoInput,
|
|
4281
4563
|
isPromotionsEnabled: isPromotionsEnabled,
|
|
4564
|
+
isAccessCodeEnabled: isAccessCodeEnabled,
|
|
4282
4565
|
isAllTicketsSoldOut: isAllTicketsSoldOut
|
|
4283
4566
|
}), !isAllTicketsSoldOut && React.createElement(Button$1, {
|
|
4284
4567
|
"aria-hidden": true,
|
|
4285
4568
|
className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
|
|
4286
4569
|
onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
|
|
4287
|
-
}, getTicketsLabel || 'GET TICKETS')
|
|
4570
|
+
}, getTicketsLabel || 'GET TICKETS'), isLogged && !hideSessionButtons ? React.createElement("div", {
|
|
4571
|
+
className: "session-wrapper"
|
|
4572
|
+
}, React.createElement("span", {
|
|
4573
|
+
className: "session-container"
|
|
4574
|
+
}, React.createElement(Button$1, {
|
|
4575
|
+
variant: "outline-light",
|
|
4576
|
+
className: "session-buttons",
|
|
4577
|
+
onClick: handleOrdersClick
|
|
4578
|
+
}, "My Orders")), React.createElement("span", {
|
|
4579
|
+
className: "session-container"
|
|
4580
|
+
}, React.createElement(Button$1, {
|
|
4581
|
+
variant: "outline-light",
|
|
4582
|
+
className: "session-buttons",
|
|
4583
|
+
onClick: handleLogout
|
|
4584
|
+
}, "Log out"))) : ''), showLoginModal ? React.createElement(LoginModal, {
|
|
4585
|
+
onClose: handleOnClose,
|
|
4586
|
+
onLogin: handleOnLogin
|
|
4587
|
+
}) : null));
|
|
4288
4588
|
};
|
|
4289
4589
|
|
|
4290
4590
|
var EventInfoItem = function EventInfoItem(_ref) {
|
|
@@ -4492,9 +4792,9 @@ var TicketsTable = function TicketsTable(_ref) {
|
|
|
4492
4792
|
var _ref$tickets = _ref.tickets,
|
|
4493
4793
|
tickets = _ref$tickets === void 0 ? [] : _ref$tickets;
|
|
4494
4794
|
return React.createElement("div", {
|
|
4495
|
-
className:
|
|
4795
|
+
className: "tickets-box"
|
|
4496
4796
|
}, React.createElement("h4", {
|
|
4497
|
-
className:
|
|
4797
|
+
className: "sub-title"
|
|
4498
4798
|
}, "Your Tickets"), React.createElement(TableContainer, {
|
|
4499
4799
|
component: Paper
|
|
4500
4800
|
}, React.createElement(Table, {
|
|
@@ -4504,14 +4804,16 @@ var TicketsTable = function TicketsTable(_ref) {
|
|
|
4504
4804
|
|
|
4505
4805
|
return React.createElement(Fragment, {
|
|
4506
4806
|
key: index
|
|
4507
|
-
}, React.createElement(TableRow, null, React.createElement(TableCell, null, ticket.hash), React.createElement(TableCell, null, ticket.ticket_type), React.createElement(TableCell, null, ticket.holder_name), React.createElement(TableCell, null, ticket.status), React.createElement(TableCell, null, React.createElement("
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4807
|
+
}, React.createElement(TableRow, null, React.createElement(TableCell, null, ticket.hash), React.createElement(TableCell, null, ticket.ticket_type), React.createElement(TableCell, null, ticket.holder_name), React.createElement(TableCell, null, ticket.status), React.createElement(TableCell, null, React.createElement("span", {
|
|
4808
|
+
"aria-hidden": true,
|
|
4809
|
+
className: "download-button",
|
|
4810
|
+
onClick: function onClick() {
|
|
4811
|
+
return downloadPDF(ticket.pdf_link);
|
|
4812
|
+
}
|
|
4511
4813
|
}, "Download"))), !!((_ticket$add_ons = ticket.add_ons) != null && _ticket$add_ons.length) && React.createElement(TableRow, null, React.createElement(TableCell, {
|
|
4512
4814
|
colSpan: 5
|
|
4513
4815
|
}, React.createElement(Table, {
|
|
4514
|
-
className:
|
|
4816
|
+
className: "ticket-add-on-table"
|
|
4515
4817
|
}, React.createElement(TableHead, null, React.createElement(TableRow, null, React.createElement(TableCell, null, "Add-On"), React.createElement(TableCell, null, "Status"))), React.createElement(TableBody, null, ticket.add_ons.map(function (add_on, index) {
|
|
4516
4818
|
return React.createElement(TableRow, {
|
|
4517
4819
|
key: index
|