tf-checkout-react 1.3.9 → 1.3.11

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.
@@ -2782,7 +2782,7 @@ var LogicRunner = function LogicRunner(_ref) {
2782
2782
  useEffect(function () {
2783
2783
  var fetchStates = /*#__PURE__*/function () {
2784
2784
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2785
- var res, mappedStates, _mappedStates$0$value, _mappedStates$;
2785
+ var res, mappedStates, _mappedStates$find, _mappedStates$0$value, _mappedStates$, stateExists;
2786
2786
 
2787
2787
  return runtime_1.wrap(function _callee$(_context) {
2788
2788
  while (1) {
@@ -2803,7 +2803,10 @@ var LogicRunner = function LogicRunner(_ref) {
2803
2803
  setStates(mappedStates);
2804
2804
 
2805
2805
  if (prevCountry.current !== values.country) {
2806
- setFieldValue('state', (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
2806
+ stateExists = (_mappedStates$find = mappedStates.find(function (state) {
2807
+ return state.value === values.state;
2808
+ })) == null ? void 0 : _mappedStates$find.value;
2809
+ setFieldValue('state', stateExists != null ? stateExists : (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
2807
2810
  prevCountry.current = values.country;
2808
2811
  }
2809
2812
 
@@ -3048,7 +3051,8 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3048
3051
 
3049
3052
  var expirationTime = _get(cartInfoData, 'expiresAt');
3050
3053
 
3051
- var flagRequirePhone = getQueryVariable('phone_required') === 'true'; // Get prevProps
3054
+ var flagRequirePhone = getQueryVariable('phone_required') === 'true';
3055
+ var hidePhoneField = getQueryVariable('hide_phone_field') === 'true'; // Get prevProps
3052
3056
 
3053
3057
  var prevData = useRef(data);
3054
3058
 
@@ -3603,7 +3607,11 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3603
3607
  }
3604
3608
 
3605
3609
  if (el.name === 'phone') {
3606
- el.required = flagRequirePhone;
3610
+ if (!hidePhoneField) {
3611
+ el.required = flagRequirePhone;
3612
+ } else {
3613
+ return false;
3614
+ }
3607
3615
  }
3608
3616
 
3609
3617
  return true;
@@ -5638,7 +5646,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5638
5646
  var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
5639
5647
  var _product_options, _product_options2, _ticket_types;
5640
5648
 
5641
- var ticket, optionName, ticketId, ticketQuantity, data, result, pageConfigsDataResponse, _pageConfigsData$skip, _pageConfigsData$name, _pageConfigsData$age_, _pageConfigsData$phon, _pageConfigsData$has_, pageConfigsData, skipBillingPage, nameIsRequired, ageIsRequired, phoneIsRequired, hasAddOn, hash, total, _isWindowDefined, userData, access_token, checkoutBody, checkoutResult;
5649
+ var ticket, optionName, ticketId, ticketQuantity, data, result, pageConfigsDataResponse, _pageConfigsData$skip, _pageConfigsData$name, _pageConfigsData$age_, _pageConfigsData$phon, _pageConfigsData$hide, _pageConfigsData$has_, pageConfigsData, skipBillingPage, nameIsRequired, ageIsRequired, phoneIsRequired, hidePhoneField, hasAddOn, hash, total, _isWindowDefined, userData, access_token, checkoutBody, checkoutResult;
5642
5650
 
5643
5651
  return runtime_1.wrap(function _callee2$(_context2) {
5644
5652
  while (1) {
@@ -5695,7 +5703,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5695
5703
  pageConfigsDataResponse = _context2.t0;
5696
5704
 
5697
5705
  if (!(result.status === 200 && pageConfigsDataResponse.status === 200)) {
5698
- _context2.next = 44;
5706
+ _context2.next = 45;
5699
5707
  break;
5700
5708
  }
5701
5709
 
@@ -5704,6 +5712,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5704
5712
  nameIsRequired = (_pageConfigsData$name = pageConfigsData.names_required) != null ? _pageConfigsData$name : false;
5705
5713
  ageIsRequired = (_pageConfigsData$age_ = pageConfigsData.age_required) != null ? _pageConfigsData$age_ : false;
5706
5714
  phoneIsRequired = (_pageConfigsData$phon = pageConfigsData.phone_required) != null ? _pageConfigsData$phon : false;
5715
+ hidePhoneField = (_pageConfigsData$hide = pageConfigsData.hide_phone_field) != null ? _pageConfigsData$hide : false;
5707
5716
  hasAddOn = (_pageConfigsData$has_ = pageConfigsData.has_add_on) != null ? _pageConfigsData$has_ : false;
5708
5717
  hash = '';
5709
5718
  total = '';
@@ -5711,7 +5720,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5711
5720
  _isWindowDefined && window.localStorage.removeItem('add_ons');
5712
5721
 
5713
5722
  if (!(skipBillingPage && !hasAddOn)) {
5714
- _context2.next = 43;
5723
+ _context2.next = 44;
5715
5724
  break;
5716
5725
  }
5717
5726
 
@@ -5721,44 +5730,45 @@ var TicketsContainer = function TicketsContainer(_ref) {
5721
5730
  checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketQuantity, userData);
5722
5731
 
5723
5732
  if (!enableBillingInfoAutoCreate) {
5724
- _context2.next = 39;
5733
+ _context2.next = 40;
5725
5734
  break;
5726
5735
  }
5727
5736
 
5728
- _context2.next = 36;
5737
+ _context2.next = 37;
5729
5738
  return postOnCheckout(checkoutBody, access_token);
5730
5739
 
5731
- case 36:
5740
+ case 37:
5732
5741
  _context2.t1 = _context2.sent;
5733
- _context2.next = 40;
5742
+ _context2.next = 41;
5734
5743
  break;
5735
5744
 
5736
- case 39:
5745
+ case 40:
5737
5746
  _context2.t1 = null;
5738
5747
 
5739
- case 40:
5748
+ case 41:
5740
5749
  checkoutResult = _context2.t1;
5741
5750
  hash = _get(checkoutResult, 'data.data.attributes.hash');
5742
5751
  total = _get(checkoutResult, 'data.data.attributes.total');
5743
5752
 
5744
- case 43:
5753
+ case 44:
5745
5754
  onAddToCartSuccess({
5746
5755
  skip_billing_page: skipBillingPage,
5747
5756
  names_required: nameIsRequired,
5748
5757
  phone_required: phoneIsRequired,
5749
5758
  age_required: ageIsRequired,
5759
+ hide_phone_field: hidePhoneField,
5750
5760
  event_id: String(eventId),
5751
5761
  hash: hash,
5752
5762
  total: total,
5753
5763
  hasAddOn: hasAddOn
5754
5764
  });
5755
5765
 
5756
- case 44:
5757
- _context2.next = 49;
5766
+ case 45:
5767
+ _context2.next = 50;
5758
5768
  break;
5759
5769
 
5760
- case 46:
5761
- _context2.prev = 46;
5770
+ case 47:
5771
+ _context2.prev = 47;
5762
5772
  _context2.t2 = _context2["catch"](6);
5763
5773
 
5764
5774
  if (axios.isAxiosError(_context2.t2)) {
@@ -5766,17 +5776,17 @@ var TicketsContainer = function TicketsContainer(_ref) {
5766
5776
  setError(_get(_context2.t2, 'response.data.message'));
5767
5777
  }
5768
5778
 
5769
- case 49:
5770
- _context2.prev = 49;
5779
+ case 50:
5780
+ _context2.prev = 50;
5771
5781
  setHandleBookIsLoading(false);
5772
- return _context2.finish(49);
5782
+ return _context2.finish(50);
5773
5783
 
5774
- case 52:
5784
+ case 53:
5775
5785
  case "end":
5776
5786
  return _context2.stop();
5777
5787
  }
5778
5788
  }
5779
- }, _callee2, null, [[6, 46, 49, 52]]);
5789
+ }, _callee2, null, [[6, 47, 50, 53]]);
5780
5790
  }));
5781
5791
 
5782
5792
  return function handleBook() {
@@ -5949,7 +5959,7 @@ var tableConfig = function tableConfig(key) {
5949
5959
  body: [function (row) {
5950
5960
  return row.id;
5951
5961
  }, function (row) {
5952
- return row.date;
5962
+ return row.timezone ? moment.tz(row.date, row.timezone).format('DD MMMM YYYY') : row.date;
5953
5963
  }, function (row) {
5954
5964
  return React.createElement(EventInfoItem, {
5955
5965
  image: row.image,