tf-checkout-react 1.0.85 → 1.0.86

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');
@@ -38,7 +39,6 @@ var reactShare = require('react-share');
38
39
  var _some = _interopDefault(require('lodash/some'));
39
40
  var _every = _interopDefault(require('lodash/every'));
40
41
  var _find = _interopDefault(require('lodash/find'));
41
- var _isEmpty = _interopDefault(require('lodash/isEmpty'));
42
42
  var Button$1 = _interopDefault(require('react-bootstrap/Button'));
43
43
  var jwt_decode = _interopDefault(require('jwt-decode'));
44
44
  var _sortBy = _interopDefault(require('lodash/sortBy'));
@@ -1110,9 +1110,16 @@ publicRequest.interceptors.response.use(function (response) {
1110
1110
 
1111
1111
  if ((error == null ? void 0 : (_error$response = error.response) == null ? void 0 : _error$response.status) === 401) {
1112
1112
  if (isWindowDefined) {
1113
+ var _error$response2, _error$response2$data;
1114
+
1113
1115
  window.localStorage.removeItem('auth_guest_token');
1114
1116
  window.localStorage.removeItem('user_data');
1115
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
+ }
1116
1123
  }
1117
1124
  }
1118
1125
 
@@ -1259,17 +1266,6 @@ var getProfileData = function getProfileData(accessToken) {
1259
1266
  Authorization: "Bearer " + accessToken
1260
1267
  })
1261
1268
  })["catch"](function (e) {
1262
- var _e$response, _e$response$data;
1263
-
1264
- var errorType = e == null ? void 0 : (_e$response = e.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.error;
1265
-
1266
- if (isWindowDefined) {
1267
- var event = new window.CustomEvent('auth_error', {
1268
- detail: errorType
1269
- });
1270
- window.document.dispatchEvent(event);
1271
- }
1272
-
1273
1269
  return e;
1274
1270
  });
1275
1271
  };
@@ -1912,7 +1908,8 @@ var CustomField = function CustomField(_ref) {
1912
1908
  }
1913
1909
  },
1914
1910
  InputLabelProps: {
1915
- sx: customTheme == null ? void 0 : customTheme.input
1911
+ sx: customTheme == null ? void 0 : customTheme.input,
1912
+ shrink: field.name === 'holderAge' ? true : undefined
1916
1913
  },
1917
1914
  inputProps: {
1918
1915
  sx: customTheme == null ? void 0 : customTheme.input
@@ -2188,7 +2185,7 @@ var LogicRunner = function LogicRunner(_ref) {
2188
2185
  confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
2189
2186
  state: (parsedData == null ? void 0 : parsedData.state) || '',
2190
2187
  street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
2191
- country: (parsedData == null ? void 0 : parsedData.country) || "1",
2188
+ country: (parsedData == null ? void 0 : parsedData.country) || '1',
2192
2189
  zip: (parsedData == null ? void 0 : parsedData.zip) || '',
2193
2190
  brand_opt_in: (parsedData == null ? void 0 : parsedData.brand_opt_in) || '',
2194
2191
  city: (parsedData == null ? void 0 : parsedData.city) || '',
@@ -2262,7 +2259,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2262
2259
  hideLogo = _ref3.hideLogo,
2263
2260
  themeOptions = _ref3.themeOptions,
2264
2261
  _ref3$onErrorClose = _ref3.onErrorClose,
2265
- 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;
2266
2265
 
2267
2266
  var themeMui = styles$1.createTheme(themeOptions);
2268
2267
  var isWindowDefined = typeof window !== 'undefined';
@@ -2374,19 +2373,6 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2374
2373
  return qty;
2375
2374
  };
2376
2375
 
2377
- var handleAuthErrors = React.useCallback(function (e) {
2378
- setIsLoggedIn(false);
2379
-
2380
- if (isWindowDefined && (e == null ? void 0 : e.detail) === 'invalid_token') {
2381
- window.location.href = '/';
2382
- }
2383
- }, []);
2384
- React.useEffect(function () {
2385
- isWindowDefined && window.document.addEventListener('auth_error', handleAuthErrors);
2386
- return function () {
2387
- isWindowDefined && window.document.removeEventListener('auth_error', handleAuthErrors);
2388
- };
2389
- }, [handleAuthErrors]);
2390
2376
  React.useEffect(function () {
2391
2377
  if ((pIsLoggedIn || access_token) && !isLoggedIn) {
2392
2378
  setIsLoggedIn(true);
@@ -2552,8 +2538,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2552
2538
  theme: themeMui
2553
2539
  }, React__default.createElement(formik.Formik, {
2554
2540
  initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
2555
- country: _get(userData, 'country', '') || "1",
2556
- state: _get(userData, 'state', '') || "1",
2541
+ country: _get(userData, 'country', '') || '1',
2542
+ state: _get(userData, 'state', '') || '1',
2557
2543
  brand_opt_in: optedInFieldValue,
2558
2544
  ttf_opt_in: ttfOptIn
2559
2545
  }), userValues),
@@ -2743,7 +2729,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2743
2729
  onGetStatesError: onGetStatesError
2744
2730
  }), React__default.createElement("div", {
2745
2731
  className: "billing-info-container " + theme
2746
- }, error && React__default.createElement(material.Alert, {
2732
+ }, error && !hideErrorsAlertSection && React__default.createElement(material.Alert, {
2747
2733
  severity: "error",
2748
2734
  onClose: onErrorClose,
2749
2735
  variant: "filled"
@@ -2810,7 +2796,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2810
2796
  })));
2811
2797
  })));
2812
2798
  }));
2813
- }), React__default.createElement("div", {
2799
+ }), !_isEmpty(ticketHoldersFields.fields) && React__default.createElement("div", {
2814
2800
  className: "ticket-holders-fields"
2815
2801
  }, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
2816
2802
  return React__default.createElement("div", {
@@ -3942,6 +3928,8 @@ var WaitingList = function WaitingList(_ref) {
3942
3928
  var _ref$tickets = _ref.tickets,
3943
3929
  tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
3944
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') || '') : {};
3945
3933
 
3946
3934
  var _useState = React.useState(false),
3947
3935
  showSuccessMessage = _useState[0],
@@ -4020,9 +4008,9 @@ var WaitingList = function WaitingList(_ref) {
4020
4008
  initialValues: {
4021
4009
  ticketTypeId: '',
4022
4010
  quantity: '',
4023
- firstName: '',
4024
- lastName: '',
4025
- email: ''
4011
+ firstName: userData.first_name || '',
4012
+ lastName: userData.last_name || '',
4013
+ email: userData.email || ''
4026
4014
  },
4027
4015
  onSubmit: handleSubmit
4028
4016
  }, React__default.createElement(formik.Form, null, React__default.createElement(ErrorFocus, null), showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
@@ -4610,7 +4598,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
4610
4598
  isPromotionsEnabled: isPromotionsEnabled,
4611
4599
  isAccessCodeEnabled: isAccessCodeEnabled,
4612
4600
  isAllTicketsSoldOut: isAllTicketsSoldOut
4613
- }), isTicketOnSale && React__default.createElement(Button$1, {
4601
+ }), (isTicketOnSale || !(event != null && event.salesEnded)) && React__default.createElement(Button$1, {
4614
4602
  "aria-hidden": true,
4615
4603
  className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
4616
4604
  onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}