tf-checkout-react 1.0.83 → 1.0.87

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.
@@ -38,5 +38,6 @@ export interface IBillingInfoPage {
38
38
  input?: CSSProperties;
39
39
  checkbox?: CSSProperties;
40
40
  };
41
+ hideErrorsAlertSection?: boolean;
41
42
  }
42
- export declare const BillingInfoContainer: ({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onAuthorizeSuccess, onAuthorizeError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, hideLogo, themeOptions, onErrorClose }: IBillingInfoPage) => JSX.Element;
43
+ export declare const BillingInfoContainer: ({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onAuthorizeSuccess, onAuthorizeError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, hideLogo, themeOptions, onErrorClose, hideErrorsAlertSection }: IBillingInfoPage) => JSX.Element;
@@ -13,6 +13,7 @@ var _map = _interopDefault(require('lodash/map'));
13
13
  var _get = _interopDefault(require('lodash/get'));
14
14
  var _includes = _interopDefault(require('lodash/includes'));
15
15
  var _isEqual = _interopDefault(require('lodash/isEqual'));
16
+ var _isEmpty = _interopDefault(require('lodash/isEmpty'));
16
17
  var axios = _interopDefault(require('axios'));
17
18
  var _forEach = _interopDefault(require('lodash/forEach'));
18
19
  var material = require('@mui/material');
@@ -36,8 +37,8 @@ var reactStripeJs = require('@stripe/react-stripe-js');
36
37
  var stripeJs = require('@stripe/stripe-js');
37
38
  var reactShare = require('react-share');
38
39
  var _some = _interopDefault(require('lodash/some'));
40
+ var _every = _interopDefault(require('lodash/every'));
39
41
  var _find = _interopDefault(require('lodash/find'));
40
- var _isEmpty = _interopDefault(require('lodash/isEmpty'));
41
42
  var Button$1 = _interopDefault(require('react-bootstrap/Button'));
42
43
  var jwt_decode = _interopDefault(require('jwt-decode'));
43
44
  var _sortBy = _interopDefault(require('lodash/sortBy'));
@@ -1109,9 +1110,16 @@ publicRequest.interceptors.response.use(function (response) {
1109
1110
 
1110
1111
  if ((error == null ? void 0 : (_error$response = error.response) == null ? void 0 : _error$response.status) === 401) {
1111
1112
  if (isWindowDefined) {
1113
+ var _error$response2, _error$response2$data;
1114
+
1112
1115
  window.localStorage.removeItem('auth_guest_token');
1113
1116
  window.localStorage.removeItem('user_data');
1114
1117
  window.localStorage.removeItem('access_token');
1118
+ var errorType = error == null ? void 0 : (_error$response2 = error.response) == null ? void 0 : (_error$response2$data = _error$response2.data) == null ? void 0 : _error$response2$data.error;
1119
+
1120
+ if (errorType === 'invalid_token') {
1121
+ window.location.href = '/';
1122
+ }
1115
1123
  }
1116
1124
  }
1117
1125
 
@@ -1258,11 +1266,6 @@ var getProfileData = function getProfileData(accessToken) {
1258
1266
  Authorization: "Bearer " + accessToken
1259
1267
  })
1260
1268
  })["catch"](function (e) {
1261
- if (isWindowDefined) {
1262
- var event = new window.CustomEvent('auth_error', e);
1263
- window.document.dispatchEvent(event);
1264
- }
1265
-
1266
1269
  return e;
1267
1270
  });
1268
1271
  };
@@ -1905,7 +1908,8 @@ var CustomField = function CustomField(_ref) {
1905
1908
  }
1906
1909
  },
1907
1910
  InputLabelProps: {
1908
- sx: customTheme == null ? void 0 : customTheme.input
1911
+ sx: customTheme == null ? void 0 : customTheme.input,
1912
+ shrink: field.name === 'holderAge' ? true : undefined
1909
1913
  },
1910
1914
  inputProps: {
1911
1915
  sx: customTheme == null ? void 0 : customTheme.input
@@ -2181,7 +2185,7 @@ var LogicRunner = function LogicRunner(_ref) {
2181
2185
  confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
2182
2186
  state: (parsedData == null ? void 0 : parsedData.state) || '',
2183
2187
  street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
2184
- country: (parsedData == null ? void 0 : parsedData.country) || "1",
2188
+ country: (parsedData == null ? void 0 : parsedData.country) || '1',
2185
2189
  zip: (parsedData == null ? void 0 : parsedData.zip) || '',
2186
2190
  brand_opt_in: (parsedData == null ? void 0 : parsedData.brand_opt_in) || '',
2187
2191
  city: (parsedData == null ? void 0 : parsedData.city) || '',
@@ -2255,7 +2259,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2255
2259
  hideLogo = _ref3.hideLogo,
2256
2260
  themeOptions = _ref3.themeOptions,
2257
2261
  _ref3$onErrorClose = _ref3.onErrorClose,
2258
- onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose;
2262
+ onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose,
2263
+ _ref3$hideErrorsAlert = _ref3.hideErrorsAlertSection,
2264
+ hideErrorsAlertSection = _ref3$hideErrorsAlert === void 0 ? false : _ref3$hideErrorsAlert;
2259
2265
 
2260
2266
  var themeMui = styles$1.createTheme(themeOptions);
2261
2267
  var isWindowDefined = typeof window !== 'undefined';
@@ -2335,7 +2341,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2335
2341
 
2336
2342
  var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
2337
2343
 
2338
- var ttfOptIn = _get(cartInfoData, 'ttfOptIn', false);
2344
+ var ttfOptIn = Boolean(_get(cartInfoData, 'ttfOptIn', false));
2339
2345
 
2340
2346
  var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true); // Get prevProps
2341
2347
 
@@ -2367,15 +2373,6 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2367
2373
  return qty;
2368
2374
  };
2369
2375
 
2370
- var handleAuthErrors = React.useCallback(function () {
2371
- setIsLoggedIn(false);
2372
- }, []);
2373
- React.useEffect(function () {
2374
- isWindowDefined && window.document.addEventListener('auth_error', handleAuthErrors);
2375
- return function () {
2376
- isWindowDefined && window.document.removeEventListener('auth_error', handleAuthErrors);
2377
- };
2378
- }, [handleAuthErrors]);
2379
2376
  React.useEffect(function () {
2380
2377
  if ((pIsLoggedIn || access_token) && !isLoggedIn) {
2381
2378
  setIsLoggedIn(true);
@@ -2541,8 +2538,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2541
2538
  theme: themeMui
2542
2539
  }, React__default.createElement(formik.Formik, {
2543
2540
  initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
2544
- country: _get(userData, 'country', '') || "1",
2545
- state: _get(userData, 'state', '') || "1",
2541
+ country: _get(userData, 'country', '') || '1',
2542
+ state: _get(userData, 'state', '') || '1',
2546
2543
  brand_opt_in: optedInFieldValue,
2547
2544
  ttf_opt_in: ttfOptIn
2548
2545
  }), userValues),
@@ -2732,7 +2729,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2732
2729
  onGetStatesError: onGetStatesError
2733
2730
  }), React__default.createElement("div", {
2734
2731
  className: "billing-info-container " + theme
2735
- }, error && React__default.createElement(material.Alert, {
2732
+ }, error && !hideErrorsAlertSection && React__default.createElement(material.Alert, {
2736
2733
  severity: "error",
2737
2734
  onClose: onErrorClose,
2738
2735
  variant: "filled"
@@ -2799,7 +2796,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2799
2796
  })));
2800
2797
  })));
2801
2798
  }));
2802
- }), React__default.createElement("div", {
2799
+ }), !_isEmpty(ticketHoldersFields.fields) && React__default.createElement("div", {
2803
2800
  className: "ticket-holders-fields"
2804
2801
  }, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
2805
2802
  return React__default.createElement("div", {
@@ -3931,6 +3928,8 @@ var WaitingList = function WaitingList(_ref) {
3931
3928
  var _ref$tickets = _ref.tickets,
3932
3929
  tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
3933
3930
  eventId = _ref.eventId;
3931
+ var isWindowDefined = typeof window !== 'undefined';
3932
+ var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
3934
3933
 
3935
3934
  var _useState = React.useState(false),
3936
3935
  showSuccessMessage = _useState[0],
@@ -4009,16 +4008,16 @@ var WaitingList = function WaitingList(_ref) {
4009
4008
  initialValues: {
4010
4009
  ticketTypeId: '',
4011
4010
  quantity: '',
4012
- firstName: '',
4013
- lastName: '',
4014
- email: ''
4011
+ firstName: userData.first_name || '',
4012
+ lastName: userData.last_name || '',
4013
+ email: userData.email || ''
4015
4014
  },
4016
4015
  onSubmit: handleSubmit
4017
4016
  }, React__default.createElement(formik.Form, null, React__default.createElement(ErrorFocus, null), showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
4018
4017
  className: "field-item"
4019
4018
  }, React__default.createElement(formik.Field, {
4020
4019
  name: "ticketTypeId",
4021
- label: "Ticket types",
4020
+ label: "Type of Ticket",
4022
4021
  type: "select",
4023
4022
  component: CustomField,
4024
4023
  selectOptions: [{
@@ -4030,7 +4029,7 @@ var WaitingList = function WaitingList(_ref) {
4030
4029
  className: "field-item"
4031
4030
  }, React__default.createElement(formik.Field, {
4032
4031
  name: "quantity",
4033
- label: "Quantity",
4032
+ label: "Quantity Requested",
4034
4033
  type: "select",
4035
4034
  component: CustomField,
4036
4035
  selectOptions: [{
@@ -4296,7 +4295,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
4296
4295
  promoCode = _useState8[0],
4297
4296
  setPromoCode = _useState8[1];
4298
4297
 
4299
- var _useState9 = React.useState(queryPromoCode),
4298
+ var _useState9 = React.useState(getQueryVariable('r') || queryPromoCode),
4300
4299
  promoCodeUpdated = _useState9[0],
4301
4300
  setPromoCodeUpdated = _useState9[1];
4302
4301
 
@@ -4547,9 +4546,14 @@ var TicketsContainer = function TicketsContainer(_ref) {
4547
4546
  getTicketsApi();
4548
4547
  };
4549
4548
 
4550
- var isAllTicketsSoldOut = !_some(tickets, function (item) {
4551
- return !(item.sold_out || item.soldOut);
4549
+ var isAllTicketsSoldOut = _every(tickets, function (item) {
4550
+ return item.sold_out || item.soldOut;
4552
4551
  });
4552
+
4553
+ var isTicketOnSale = _some(tickets, function (item) {
4554
+ return item.salesStarted && !item.salesEnded && !item.soldOut;
4555
+ });
4556
+
4553
4557
  var themeMui = material.createTheme(themeOptions);
4554
4558
  React.useEffect(function () {
4555
4559
  isWindowDefined && window.document.addEventListener('custom-logout', handleLogout);
@@ -4573,7 +4577,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
4573
4577
  selectedTickets: selectedTickets,
4574
4578
  handleTicketSelect: handleTicketSelect,
4575
4579
  promoCodeIsApplied: promoCodeIsApplied
4576
- }), event != null && event.salesEnded ? React__default.createElement("p", null, "Sales for this event are closed.") : event != null && event.salesStart ? React__default.createElement(Countdown, {
4580
+ }), event != null && event.salesEnded ? React__default.createElement("p", {
4581
+ className: 'event-closed-message'
4582
+ }, "Sales for this event are closed.") : !(event != null && event.salesStarted) && event != null && event.salesStart ? React__default.createElement(Countdown, {
4577
4583
  startDate: event.salesStart,
4578
4584
  timezone: event.timezone,
4579
4585
  title: "Sales start in:",
@@ -4592,7 +4598,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
4592
4598
  isPromotionsEnabled: isPromotionsEnabled,
4593
4599
  isAccessCodeEnabled: isAccessCodeEnabled,
4594
4600
  isAllTicketsSoldOut: isAllTicketsSoldOut
4595
- }), !isAllTicketsSoldOut && React__default.createElement(Button$1, {
4601
+ }), (isTicketOnSale || !(event != null && event.salesEnded)) && React__default.createElement(Button$1, {
4596
4602
  "aria-hidden": true,
4597
4603
  className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
4598
4604
  onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}