tf-checkout-react 1.3.13 → 1.3.14

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.
@@ -13,6 +13,7 @@ interface CartSuccess {
13
13
  hash?: string;
14
14
  total?: string;
15
15
  hasAddOn?: boolean;
16
+ free_ticket: boolean;
16
17
  }
17
18
  export interface IGetTickets {
18
19
  eventId: number;
@@ -3058,6 +3058,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3058
3058
  var expirationTime = _get(cartInfoData, 'expiresAt');
3059
3059
 
3060
3060
  var flagRequirePhone = getQueryVariable('phone_required') === 'true';
3061
+ var flagFreeTicket = getQueryVariable('free_ticket') === 'true';
3061
3062
  var hidePhoneField = getQueryVariable('hide_phone_field') === 'true'; // Get prevProps
3062
3063
 
3063
3064
  var prevData = React.useRef(data);
@@ -3627,6 +3628,20 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3627
3628
  }
3628
3629
  }
3629
3630
 
3631
+ if (el.name === 'zip') {
3632
+ if (flagFreeTicket) {
3633
+ el.required = false;
3634
+ return false;
3635
+ }
3636
+ }
3637
+
3638
+ if (el.name === 'street_address') {
3639
+ if (flagFreeTicket) {
3640
+ el.required = false;
3641
+ return false;
3642
+ }
3643
+ }
3644
+
3630
3645
  return true;
3631
3646
  }), function (element) {
3632
3647
  return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : React__default.createElement(React__default.Fragment, {
@@ -5659,7 +5674,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5659
5674
  var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
5660
5675
  var _product_options, _product_options2, _ticket_types;
5661
5676
 
5662
- 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;
5677
+ var ticket, optionName, ticketId, ticketQuantity, data, result, pageConfigsDataResponse, _pageConfigsData$skip, _pageConfigsData$name, _pageConfigsData$age_, _pageConfigsData$phon, _pageConfigsData$hide, _pageConfigsData$has_, _pageConfigsData$free, pageConfigsData, skipBillingPage, nameIsRequired, ageIsRequired, phoneIsRequired, hidePhoneField, hasAddOn, freeTicket, hash, total, _isWindowDefined, userData, access_token, checkoutBody, checkoutResult;
5663
5678
 
5664
5679
  return runtime_1.wrap(function _callee2$(_context2) {
5665
5680
  while (1) {
@@ -5716,7 +5731,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5716
5731
  pageConfigsDataResponse = _context2.t0;
5717
5732
 
5718
5733
  if (!(result.status === 200 && pageConfigsDataResponse.status === 200)) {
5719
- _context2.next = 45;
5734
+ _context2.next = 46;
5720
5735
  break;
5721
5736
  }
5722
5737
 
@@ -5727,13 +5742,14 @@ var TicketsContainer = function TicketsContainer(_ref) {
5727
5742
  phoneIsRequired = (_pageConfigsData$phon = pageConfigsData.phone_required) != null ? _pageConfigsData$phon : false;
5728
5743
  hidePhoneField = (_pageConfigsData$hide = pageConfigsData.hide_phone_field) != null ? _pageConfigsData$hide : false;
5729
5744
  hasAddOn = (_pageConfigsData$has_ = pageConfigsData.has_add_on) != null ? _pageConfigsData$has_ : false;
5745
+ freeTicket = (_pageConfigsData$free = pageConfigsData.free_ticket) != null ? _pageConfigsData$free : false;
5730
5746
  hash = '';
5731
5747
  total = '';
5732
5748
  _isWindowDefined = typeof window !== 'undefined';
5733
5749
  _isWindowDefined && window.localStorage.removeItem('add_ons');
5734
5750
 
5735
5751
  if (!(skipBillingPage && !hasAddOn)) {
5736
- _context2.next = 44;
5752
+ _context2.next = 45;
5737
5753
  break;
5738
5754
  }
5739
5755
 
@@ -5743,45 +5759,46 @@ var TicketsContainer = function TicketsContainer(_ref) {
5743
5759
  checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketQuantity, userData);
5744
5760
 
5745
5761
  if (!enableBillingInfoAutoCreate) {
5746
- _context2.next = 40;
5762
+ _context2.next = 41;
5747
5763
  break;
5748
5764
  }
5749
5765
 
5750
- _context2.next = 37;
5766
+ _context2.next = 38;
5751
5767
  return postOnCheckout(checkoutBody, access_token);
5752
5768
 
5753
- case 37:
5769
+ case 38:
5754
5770
  _context2.t1 = _context2.sent;
5755
- _context2.next = 41;
5771
+ _context2.next = 42;
5756
5772
  break;
5757
5773
 
5758
- case 40:
5774
+ case 41:
5759
5775
  _context2.t1 = null;
5760
5776
 
5761
- case 41:
5777
+ case 42:
5762
5778
  checkoutResult = _context2.t1;
5763
5779
  hash = _get(checkoutResult, 'data.data.attributes.hash');
5764
5780
  total = _get(checkoutResult, 'data.data.attributes.total');
5765
5781
 
5766
- case 44:
5782
+ case 45:
5767
5783
  onAddToCartSuccess({
5768
5784
  skip_billing_page: skipBillingPage,
5769
5785
  names_required: nameIsRequired,
5770
5786
  phone_required: phoneIsRequired,
5771
5787
  age_required: ageIsRequired,
5772
5788
  hide_phone_field: hidePhoneField,
5789
+ free_ticket: freeTicket,
5773
5790
  event_id: String(eventId),
5774
5791
  hash: hash,
5775
5792
  total: total,
5776
5793
  hasAddOn: hasAddOn
5777
5794
  });
5778
5795
 
5779
- case 45:
5780
- _context2.next = 50;
5796
+ case 46:
5797
+ _context2.next = 51;
5781
5798
  break;
5782
5799
 
5783
- case 47:
5784
- _context2.prev = 47;
5800
+ case 48:
5801
+ _context2.prev = 48;
5785
5802
  _context2.t2 = _context2["catch"](6);
5786
5803
 
5787
5804
  if (axios.isAxiosError(_context2.t2)) {
@@ -5789,17 +5806,17 @@ var TicketsContainer = function TicketsContainer(_ref) {
5789
5806
  setError(_get(_context2.t2, 'response.data.message'));
5790
5807
  }
5791
5808
 
5792
- case 50:
5793
- _context2.prev = 50;
5809
+ case 51:
5810
+ _context2.prev = 51;
5794
5811
  setHandleBookIsLoading(false);
5795
- return _context2.finish(50);
5812
+ return _context2.finish(51);
5796
5813
 
5797
- case 53:
5814
+ case 54:
5798
5815
  case "end":
5799
5816
  return _context2.stop();
5800
5817
  }
5801
5818
  }
5802
- }, _callee2, null, [[6, 47, 50, 53]]);
5819
+ }, _callee2, null, [[6, 48, 51, 54]]);
5803
5820
  }));
5804
5821
 
5805
5822
  return function handleBook() {