tf-checkout-react 1.0.99-beta.2 → 1.0.99-beta.6

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.
@@ -31,4 +31,5 @@ export declare const getOrderDetails: (orderId: string) => Promise<AxiosResponse
31
31
  export declare const addToWaitingList: (id: number, data: any) => Promise<AxiosResponse<any, any>>;
32
32
  export declare const getConditions: (eventId: string) => Promise<AxiosResponse<any, any>>;
33
33
  export declare const postReferralVisits: (eventId: string, referralId: string) => Promise<AxiosResponse<any, any>>;
34
+ export declare const logout: () => void;
34
35
  export {};
@@ -9,7 +9,7 @@ export interface IBillingInfoPage {
9
9
  data?: IBillingInfoData[];
10
10
  ticketHoldersFields?: IBillingInfoData;
11
11
  handleSubmit?: (values: FormikValues, formikHelpers: FormikHelpers<FormikValues>, eventId: any, res: any) => void;
12
- onRegisterSuccess?: () => void;
12
+ onRegisterSuccess?: (value: any) => void;
13
13
  onRegisterError?: (e: AxiosError, email: string) => void;
14
14
  onSubmitError?: (e: AxiosError) => void;
15
15
  onGetCartSuccess?: (res: any) => void;
@@ -18,6 +18,8 @@ export interface IGetTickets {
18
18
  onAddToCartError: (e: AxiosError) => void;
19
19
  onGetTicketsSuccess: (response: any) => void;
20
20
  onGetTicketsError: (e: AxiosError) => void;
21
+ onLogoutSuccess: () => void;
22
+ onLogoutError: (e: AxiosError) => void;
21
23
  onLoginSuccess: () => void;
22
24
  theme?: 'light' | 'dark';
23
25
  queryPromoCode?: string;
@@ -38,5 +40,5 @@ export interface ITicket {
38
40
  export interface ISelectedTickets {
39
41
  [key: string]: string | number;
40
42
  }
41
- export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons, hideWaitingList, enableBillingInfoAutoCreate, }: IGetTickets) => JSX.Element;
43
+ export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, onLogoutSuccess, onLogoutError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons, hideWaitingList, enableBillingInfoAutoCreate, }: IGetTickets) => JSX.Element;
42
44
  export {};
@@ -23,6 +23,7 @@ var _flatMapDeep = _interopDefault(require('lodash/flatMapDeep'));
23
23
  var _isArray = _interopDefault(require('lodash/isArray'));
24
24
  var nanoid = require('nanoid');
25
25
  var TextField = _interopDefault(require('@mui/material/TextField'));
26
+ var moment = _interopDefault(require('moment-timezone'));
26
27
  var styles = require('@mui/styles');
27
28
  var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
28
29
  var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
@@ -48,7 +49,6 @@ var _sortBy = _interopDefault(require('lodash/sortBy'));
48
49
  var FormControl = _interopDefault(require('@mui/material/FormControl'));
49
50
  var MenuItem = _interopDefault(require('@mui/material/MenuItem'));
50
51
  var SVG = _interopDefault(require('react-inlinesvg'));
51
- var moment = _interopDefault(require('moment-timezone'));
52
52
  var privateTheming = require('@mui/private-theming');
53
53
  var Table = _interopDefault(require('@mui/material/Table'));
54
54
  var TableBody = _interopDefault(require('@mui/material/TableBody'));
@@ -1114,18 +1114,22 @@ var downloadPDF = function downloadPDF(pdfUrl) {
1114
1114
  });
1115
1115
  };
1116
1116
 
1117
- var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, logedInValues, includeDob) {
1117
+ var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, logedInValues, includeDob, userCredentials) {
1118
1118
  if (includeDob === void 0) {
1119
1119
  includeDob = false;
1120
1120
  }
1121
1121
 
1122
+ if (userCredentials === void 0) {
1123
+ userCredentials = {};
1124
+ }
1125
+
1122
1126
  var ticket_holders = [];
1123
- var first_name = _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || '';
1124
- var last_name = _get(logedInValues, 'lastName', '') || _get(logedInValues, 'last_name') || '';
1127
+ var first_name = _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || _get(userCredentials, 'firstNameLogged') || '';
1128
+ var last_name = _get(logedInValues, 'lastName') || _get(logedInValues, 'last_name') || _get(userCredentials, 'lastNameLogged') || '';
1125
1129
 
1126
1130
  var phone = _get(logedInValues, 'phone', '');
1127
1131
 
1128
- var email = _get(logedInValues, 'email', '');
1132
+ var email = _get(logedInValues, 'email') || _get(userCredentials, 'emailLogged') || '';
1129
1133
 
1130
1134
  for (var i = 0; i <= ticketsQuantity - 1; i++) {
1131
1135
  var individualHolder = i ? {
@@ -1380,6 +1384,9 @@ var postReferralVisits = function postReferralVisits(eventId, referralId) {
1380
1384
  referrer: "" + referralId
1381
1385
  });
1382
1386
  };
1387
+ var logout = function logout() {
1388
+ publicRequest["delete"]('/auth');
1389
+ };
1383
1390
 
1384
1391
  var style = {
1385
1392
  position: 'absolute',
@@ -1869,10 +1876,10 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
1869
1876
  });
1870
1877
  ticket_holders = filteredHolders.map(function (item, index) {
1871
1878
  return {
1872
- first_name: item["holderFirstName-" + index] || '',
1873
- last_name: item["holderLastName-" + index] || '',
1879
+ first_name: !index ? item["holderFirstName-" + index] || logedInValues.firstNameLogged || '' : item["holderFirstName-" + index] || '',
1880
+ last_name: !index ? item["holderLastName-" + index] || logedInValues.lastNameLogged || '' : item["holderLastName-" + index] || '',
1874
1881
  phone: item["holderPhone-" + index] || '',
1875
- email: item["holderEmail-" + index] || ''
1882
+ email: !index ? item["holderEmail-" + index] || logedInValues.emailLogged || '' : item["holderEmail-" + index] || ''
1876
1883
  };
1877
1884
  });
1878
1885
  var filteredRestValue = {};
@@ -1923,6 +1930,14 @@ var getValidateFunctions = function getValidateFunctions(element, states, values
1923
1930
  validationFunctions.push(isSameEmail);
1924
1931
  }
1925
1932
 
1933
+ if (element.name === 'confirmPassword') {
1934
+ var isSame = function isSame(confirmPassword) {
1935
+ return values.password !== confirmPassword ? 'Password confirmation does not match' : null;
1936
+ };
1937
+
1938
+ validationFunctions.push(isSame);
1939
+ }
1940
+
1926
1941
  return combineValidators.apply(void 0, validationFunctions);
1927
1942
  };
1928
1943
  var assingUniqueIds = function assingUniqueIds(data) {
@@ -1961,6 +1976,14 @@ var CustomField = function CustomField(_ref) {
1961
1976
 
1962
1977
  var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error && !!submitCount;
1963
1978
  var customTheme = styles.useTheme();
1979
+ var inputProps = {
1980
+ sx: customTheme == null ? void 0 : customTheme.input
1981
+ };
1982
+
1983
+ if (type === 'date') {
1984
+ inputProps.max = moment().format('YYYY-MM-DD');
1985
+ }
1986
+
1964
1987
  return React__default.createElement(TextField, Object.assign({
1965
1988
  id: field.name,
1966
1989
  label: label,
@@ -1980,9 +2003,7 @@ var CustomField = function CustomField(_ref) {
1980
2003
  sx: customTheme == null ? void 0 : customTheme.input,
1981
2004
  shrink: field.name === 'holderAge' ? true : undefined
1982
2005
  },
1983
- inputProps: {
1984
- sx: customTheme == null ? void 0 : customTheme.input
1985
- }
2006
+ inputProps: inputProps
1986
2007
  }, field), isSelectField ? _map(selectOptions, function (option) {
1987
2008
  return React__default.createElement("option", {
1988
2009
  key: option.value,
@@ -2352,7 +2373,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2352
2373
 
2353
2374
  var xtfCookie = getCookieByName('X-TF-ECOMMERCE');
2354
2375
 
2355
- var _useState2 = React.useState(!!access_token || xtfCookie),
2376
+ var _useState2 = React.useState(pIsLoggedIn || xtfCookie),
2356
2377
  isLoggedIn = _useState2[0],
2357
2378
  setIsLoggedIn = _useState2[1];
2358
2379
 
@@ -2461,7 +2482,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2461
2482
  };
2462
2483
 
2463
2484
  React.useEffect(function () {
2464
- if ((pIsLoggedIn || access_token) && !isLoggedIn || xtfCookie) {
2485
+ if (pIsLoggedIn && !isLoggedIn || xtfCookie) {
2465
2486
  setIsLoggedIn(true);
2466
2487
  }
2467
2488
  }, [pIsLoggedIn, isLoggedIn, access_token, xtfCookie]); //just once
@@ -2675,37 +2696,38 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2675
2696
  collectPaymentData();
2676
2697
  }, [skipPage, ticketsQuantity]);
2677
2698
 
2678
- var collectCheckoutBody = function collectCheckoutBody(values) {
2699
+ var collectCheckoutBody = function collectCheckoutBody(values, profileData) {
2679
2700
  var checkoutBody = {}; // Auto collect ticket holders name when it was skipped optionally
2680
2701
 
2681
2702
  if (showDOB && !showTicketHolders && canSkipHolderNames) {
2682
- checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, values, true);
2683
- } else {
2684
- checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
2703
+ checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, values, true, {
2685
2704
  emailLogged: emailLogged,
2686
2705
  firstNameLogged: firstNameLogged,
2687
2706
  lastNameLogged: lastNameLogged
2707
+ });
2708
+ } else {
2709
+ checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
2710
+ emailLogged: emailLogged || profileData.email,
2711
+ firstNameLogged: firstNameLogged || profileData.first_name,
2712
+ lastNameLogged: lastNameLogged || profileData.last_name
2688
2713
  }, showDOB);
2689
2714
  }
2690
2715
 
2691
2716
  return checkoutBody;
2692
- }; // Displaying loader
2693
-
2694
-
2695
- if (loading) {
2696
- return React__default.createElement(Backdrop, {
2697
- sx: {
2698
- color: '#fff'
2699
- },
2700
- open: true
2701
- }, React__default.createElement(material.CircularProgress, {
2702
- color: "inherit"
2703
- }));
2704
- }
2717
+ };
2705
2718
 
2706
2719
  return React__default.createElement(styles$1.ThemeProvider, {
2707
2720
  theme: themeMui
2708
- }, React__default.createElement(formik.Formik, {
2721
+ }, loading && React__default.createElement(Backdrop, {
2722
+ sx: {
2723
+ color: '#fff',
2724
+ backgroundColor: '#000000bd',
2725
+ zIndex: 1205
2726
+ },
2727
+ open: true
2728
+ }, React__default.createElement(material.CircularProgress, {
2729
+ color: "inherit"
2730
+ })), React__default.createElement(formik.Formik, {
2709
2731
  initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
2710
2732
  country: _get(userData, 'country', '') || '1',
2711
2733
  state: _get(userData, 'state', '') || '1',
@@ -2715,7 +2737,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2715
2737
  enableReinitialize: true,
2716
2738
  onSubmit: function () {
2717
2739
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
2718
- var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
2740
+ var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, accessToken, refreshToken, userProfile, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
2719
2741
 
2720
2742
  return runtime_1.wrap(function _callee6$(_context6) {
2721
2743
  while (1) {
@@ -2763,17 +2785,29 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2763
2785
  }, showDOB);
2764
2786
  bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
2765
2787
  _context6.prev = 17;
2766
- _context6.next = 20;
2788
+ setLoading(true);
2789
+ _context6.next = 21;
2767
2790
  return register(bodyFormData);
2768
2791
 
2769
- case 20:
2770
- onRegisterSuccess();
2771
- _context6.next = 27;
2792
+ case 21:
2793
+ resRegister = _context6.sent;
2794
+ _xtfCookie = _get(resRegister, 'headers.x-tf-ecommerce');
2795
+ accessToken = _get(resRegister, 'data.data.attributes.access_token');
2796
+ refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
2797
+ userProfile = _get(resRegister, 'data.data.attributes.user_profile');
2798
+ onRegisterSuccess({
2799
+ xtfCookie: _xtfCookie,
2800
+ accessToken: accessToken,
2801
+ refreshToken: refreshToken,
2802
+ userProfile: userProfile
2803
+ });
2804
+ _context6.next = 34;
2772
2805
  break;
2773
2806
 
2774
- case 23:
2775
- _context6.prev = 23;
2807
+ case 29:
2808
+ _context6.prev = 29;
2776
2809
  _context6.t0 = _context6["catch"](17);
2810
+ setLoading(false);
2777
2811
 
2778
2812
  if (axios.isAxiosError(_context6.t0)) {
2779
2813
  _error = _context6.t0 == null ? void 0 : (_e$response = _context6.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
@@ -2798,11 +2832,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2798
2832
 
2799
2833
  return _context6.abrupt("return");
2800
2834
 
2801
- case 27:
2802
- _context6.next = 29;
2835
+ case 34:
2836
+ _context6.next = 36;
2803
2837
  return getProfileData();
2804
2838
 
2805
- case 29:
2839
+ case 36:
2806
2840
  profileData = _context6.sent;
2807
2841
  profileSpecifiedData = _get(profileData, 'data.data');
2808
2842
  profileDataObj = setLoggedUserData(profileSpecifiedData);
@@ -2811,19 +2845,20 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2811
2845
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
2812
2846
  }
2813
2847
 
2814
- checkoutBody = collectCheckoutBody(values);
2815
- _context6.next = 36;
2848
+ checkoutBody = collectCheckoutBody(values, profileDataObj);
2849
+ _context6.next = 43;
2816
2850
  return postOnCheckout(checkoutBody);
2817
2851
 
2818
- case 36:
2852
+ case 43:
2819
2853
  res = _context6.sent;
2820
2854
  handleSubmit(values, formikHelpers, eventId, res);
2821
- _context6.next = 43;
2855
+ _context6.next = 51;
2822
2856
  break;
2823
2857
 
2824
- case 40:
2825
- _context6.prev = 40;
2858
+ case 47:
2859
+ _context6.prev = 47;
2826
2860
  _context6.t1 = _context6["catch"](0);
2861
+ setLoading(false);
2827
2862
 
2828
2863
  if (axios.isAxiosError(_context6.t1)) {
2829
2864
  if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
@@ -2846,12 +2881,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2846
2881
  onSubmitError(_context6.t1);
2847
2882
  }
2848
2883
 
2849
- case 43:
2884
+ case 51:
2885
+ _context6.prev = 51;
2886
+ setLoading(false);
2887
+ return _context6.finish(51);
2888
+
2889
+ case 54:
2850
2890
  case "end":
2851
2891
  return _context6.stop();
2852
2892
  }
2853
2893
  }
2854
- }, _callee6, null, [[0, 40], [17, 23]]);
2894
+ }, _callee6, null, [[0, 47, 51, 54], [17, 29]]);
2855
2895
  }));
2856
2896
 
2857
2897
  function onSubmit(_x2, _x3) {
@@ -4527,6 +4567,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
4527
4567
  onGetTicketsSuccess = _ref$onGetTicketsSucc === void 0 ? function () {} : _ref$onGetTicketsSucc,
4528
4568
  _ref$onGetTicketsErro = _ref.onGetTicketsError,
4529
4569
  onGetTicketsError = _ref$onGetTicketsErro === void 0 ? function () {} : _ref$onGetTicketsErro,
4570
+ _ref$onLogoutSuccess = _ref.onLogoutSuccess,
4571
+ onLogoutSuccess = _ref$onLogoutSuccess === void 0 ? function () {} : _ref$onLogoutSuccess,
4572
+ _ref$onLogoutError = _ref.onLogoutError,
4573
+ onLogoutError = _ref$onLogoutError === void 0 ? function () {} : _ref$onLogoutError,
4530
4574
  _ref$theme = _ref.theme,
4531
4575
  theme = _ref$theme === void 0 ? 'light' : _ref$theme,
4532
4576
  _ref$queryPromoCode = _ref.queryPromoCode,
@@ -4612,18 +4656,50 @@ var TicketsContainer = function TicketsContainer(_ref) {
4612
4656
  !!eventId && getTicketsApi();
4613
4657
  }, [eventId, promoCodeUpdated]);
4614
4658
 
4615
- var handleLogout = function handleLogout() {
4616
- if (isWindowDefined) {
4617
- window.localStorage.removeItem('access_token');
4618
- window.localStorage.removeItem('user_data');
4619
- setIsLogged(false);
4659
+ var handleLogout = /*#__PURE__*/function () {
4660
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
4661
+ var _event;
4620
4662
 
4621
- var _event = new window.CustomEvent('tf-logout');
4663
+ return runtime_1.wrap(function _callee$(_context) {
4664
+ while (1) {
4665
+ switch (_context.prev = _context.next) {
4666
+ case 0:
4667
+ _context.prev = 0;
4668
+ _context.next = 3;
4669
+ return logout();
4622
4670
 
4623
- deleteCookieByName('X-TF-ECOMMERCE');
4624
- window.document.dispatchEvent(_event);
4625
- }
4626
- };
4671
+ case 3:
4672
+ onLogoutSuccess();
4673
+
4674
+ if (isWindowDefined) {
4675
+ window.localStorage.removeItem('access_token');
4676
+ window.localStorage.removeItem('user_data');
4677
+ setIsLogged(false);
4678
+ _event = new window.CustomEvent('tf-logout');
4679
+ deleteCookieByName('X-TF-ECOMMERCE');
4680
+ window.document.dispatchEvent(_event);
4681
+ }
4682
+
4683
+ _context.next = 10;
4684
+ break;
4685
+
4686
+ case 7:
4687
+ _context.prev = 7;
4688
+ _context.t0 = _context["catch"](0);
4689
+ onLogoutError(_context.t0);
4690
+
4691
+ case 10:
4692
+ case "end":
4693
+ return _context.stop();
4694
+ }
4695
+ }
4696
+ }, _callee, null, [[0, 7]]);
4697
+ }));
4698
+
4699
+ return function handleLogout() {
4700
+ return _ref2.apply(this, arguments);
4701
+ };
4702
+ }();
4627
4703
 
4628
4704
  var handleExternalLogin = function handleExternalLogin() {
4629
4705
  setIsLogged(true);
@@ -4647,25 +4723,25 @@ var TicketsContainer = function TicketsContainer(_ref) {
4647
4723
  }
4648
4724
 
4649
4725
  function _getTicketsApi() {
4650
- _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
4726
+ _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
4651
4727
  var response, eventResponse, attributes, _event2;
4652
4728
 
4653
- return runtime_1.wrap(function _callee2$(_context2) {
4729
+ return runtime_1.wrap(function _callee3$(_context3) {
4654
4730
  while (1) {
4655
- switch (_context2.prev = _context2.next) {
4731
+ switch (_context3.prev = _context3.next) {
4656
4732
  case 0:
4657
- _context2.prev = 0;
4733
+ _context3.prev = 0;
4658
4734
  setIsLoading(true);
4659
- _context2.next = 4;
4735
+ _context3.next = 4;
4660
4736
  return getTickets(eventId, promoCodeUpdated);
4661
4737
 
4662
4738
  case 4:
4663
- response = _context2.sent;
4664
- _context2.next = 7;
4739
+ response = _context3.sent;
4740
+ _context3.next = 7;
4665
4741
  return getEvent(eventId);
4666
4742
 
4667
4743
  case 7:
4668
- eventResponse = _context2.sent;
4744
+ eventResponse = _context3.sent;
4669
4745
 
4670
4746
  if (response.data.success) {
4671
4747
  setCustomHeader(response);
@@ -4682,41 +4758,41 @@ var TicketsContainer = function TicketsContainer(_ref) {
4682
4758
  setEvent(_event2);
4683
4759
  }
4684
4760
 
4685
- _context2.next = 15;
4761
+ _context3.next = 15;
4686
4762
  break;
4687
4763
 
4688
4764
  case 12:
4689
- _context2.prev = 12;
4690
- _context2.t0 = _context2["catch"](0);
4765
+ _context3.prev = 12;
4766
+ _context3.t0 = _context3["catch"](0);
4691
4767
 
4692
- if (axios.isAxiosError(_context2.t0)) {
4693
- onGetTicketsError(_context2.t0);
4768
+ if (axios.isAxiosError(_context3.t0)) {
4769
+ onGetTicketsError(_context3.t0);
4694
4770
  }
4695
4771
 
4696
4772
  case 15:
4697
- _context2.prev = 15;
4773
+ _context3.prev = 15;
4698
4774
  setIsLoading(false);
4699
- return _context2.finish(15);
4775
+ return _context3.finish(15);
4700
4776
 
4701
4777
  case 18:
4702
4778
  case "end":
4703
- return _context2.stop();
4779
+ return _context3.stop();
4704
4780
  }
4705
4781
  }
4706
- }, _callee2, null, [[0, 12, 15, 18]]);
4782
+ }, _callee3, null, [[0, 12, 15, 18]]);
4707
4783
  }));
4708
4784
  return _getTicketsApi.apply(this, arguments);
4709
4785
  }
4710
4786
 
4711
4787
  var handleTicketSelect = function handleTicketSelect(key, value) {
4712
4788
  setSelectedTickets(function (prevState) {
4713
- var _ref2;
4789
+ var _ref3;
4714
4790
 
4715
4791
  if (Object.keys(prevState)[0] !== key && !value) {
4716
4792
  return prevState;
4717
4793
  }
4718
4794
 
4719
- return _ref2 = {}, _ref2[key] = value, _ref2;
4795
+ return _ref3 = {}, _ref3[key] = value, _ref3;
4720
4796
  });
4721
4797
  };
4722
4798
 
@@ -4727,14 +4803,14 @@ var TicketsContainer = function TicketsContainer(_ref) {
4727
4803
  };
4728
4804
 
4729
4805
  var handleBook = /*#__PURE__*/function () {
4730
- var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
4806
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
4731
4807
  var _product_options, _product_options2, _ticket_types;
4732
4808
 
4733
4809
  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, checkoutBody, checkoutResult;
4734
4810
 
4735
- return runtime_1.wrap(function _callee$(_context) {
4811
+ return runtime_1.wrap(function _callee2$(_context2) {
4736
4812
  while (1) {
4737
- switch (_context.prev = _context.next) {
4813
+ switch (_context2.prev = _context2.next) {
4738
4814
  case 0:
4739
4815
  setHandleBookIsLoading(true);
4740
4816
  ticket = _find(tickets, function (item) {
@@ -4755,15 +4831,15 @@ var TicketsContainer = function TicketsContainer(_ref) {
4755
4831
  }, _ticket_types)
4756
4832
  }
4757
4833
  };
4758
- _context.prev = 6;
4759
- _context.next = 9;
4834
+ _context2.prev = 6;
4835
+ _context2.next = 9;
4760
4836
  return addToCart(eventId, data);
4761
4837
 
4762
4838
  case 9:
4763
- result = _context.sent;
4839
+ result = _context2.sent;
4764
4840
 
4765
4841
  if (!(result.status === 200)) {
4766
- _context.next = 31;
4842
+ _context2.next = 31;
4767
4843
  break;
4768
4844
  }
4769
4845
 
@@ -4774,7 +4850,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
4774
4850
  hash = '';
4775
4851
 
4776
4852
  if (!skipBillingPage) {
4777
- _context.next = 30;
4853
+ _context2.next = 30;
4778
4854
  break;
4779
4855
  }
4780
4856
 
@@ -4785,23 +4861,23 @@ var TicketsContainer = function TicketsContainer(_ref) {
4785
4861
  checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketQuantity, userData);
4786
4862
 
4787
4863
  if (!enableBillingInfoAutoCreate) {
4788
- _context.next = 27;
4864
+ _context2.next = 27;
4789
4865
  break;
4790
4866
  }
4791
4867
 
4792
- _context.next = 24;
4868
+ _context2.next = 24;
4793
4869
  return postOnCheckout(checkoutBody, access_token);
4794
4870
 
4795
4871
  case 24:
4796
- _context.t0 = _context.sent;
4797
- _context.next = 28;
4872
+ _context2.t0 = _context2.sent;
4873
+ _context2.next = 28;
4798
4874
  break;
4799
4875
 
4800
4876
  case 27:
4801
- _context.t0 = null;
4877
+ _context2.t0 = null;
4802
4878
 
4803
4879
  case 28:
4804
- checkoutResult = _context.t0;
4880
+ checkoutResult = _context2.t0;
4805
4881
  hash = _get(checkoutResult, 'data.data.attributes.hash');
4806
4882
 
4807
4883
  case 30:
@@ -4814,32 +4890,32 @@ var TicketsContainer = function TicketsContainer(_ref) {
4814
4890
  });
4815
4891
 
4816
4892
  case 31:
4817
- _context.next = 36;
4893
+ _context2.next = 36;
4818
4894
  break;
4819
4895
 
4820
4896
  case 33:
4821
- _context.prev = 33;
4822
- _context.t1 = _context["catch"](6);
4897
+ _context2.prev = 33;
4898
+ _context2.t1 = _context2["catch"](6);
4823
4899
 
4824
- if (axios.isAxiosError(_context.t1)) {
4825
- onAddToCartError(_context.t1);
4900
+ if (axios.isAxiosError(_context2.t1)) {
4901
+ onAddToCartError(_context2.t1);
4826
4902
  }
4827
4903
 
4828
4904
  case 36:
4829
- _context.prev = 36;
4905
+ _context2.prev = 36;
4830
4906
  setHandleBookIsLoading(false);
4831
- return _context.finish(36);
4907
+ return _context2.finish(36);
4832
4908
 
4833
4909
  case 39:
4834
4910
  case "end":
4835
- return _context.stop();
4911
+ return _context2.stop();
4836
4912
  }
4837
4913
  }
4838
- }, _callee, null, [[6, 33, 36, 39]]);
4914
+ }, _callee2, null, [[6, 33, 36, 39]]);
4839
4915
  }));
4840
4916
 
4841
4917
  return function handleBook() {
4842
- return _ref3.apply(this, arguments);
4918
+ return _ref4.apply(this, arguments);
4843
4919
  };
4844
4920
  }();
4845
4921
 
@@ -4906,7 +4982,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
4906
4982
  isPromotionsEnabled: isPromotionsEnabled,
4907
4983
  isAccessCodeEnabled: isAccessCodeEnabled,
4908
4984
  isAllTicketsSoldOut: isAllTicketsSoldOut
4909
- }), (isTicketOnSale || !(event != null && event.salesEnded)) && !isSalesClosed && (event == null ? void 0 : event.salesStarted) && React__default.createElement(Button$1, {
4985
+ }), isTicketOnSale && !isSalesClosed && (event == null ? void 0 : event.salesStarted) && React__default.createElement(Button$1, {
4910
4986
  "aria-hidden": true,
4911
4987
  className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
4912
4988
  onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}