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