tf-checkout-react 1.3.17 → 1.3.19

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.
@@ -5,7 +5,7 @@ export declare function getEvent(id: string | number, pk?: string): Promise<Axio
5
5
  export declare function getTickets(id: string | number, promoCode: string, pk?: string): Promise<AxiosResponse<any, any>>;
6
6
  export declare const addToCart: (id: string | number, data: any) => Promise<AxiosResponse<any, any>>;
7
7
  export declare const getCart: () => Promise<AxiosResponse<any, any>>;
8
- export declare const postOnCheckout: (data: any, accessToken?: string | undefined) => Promise<AxiosResponse<any, any>>;
8
+ export declare const postOnCheckout: (data: any, accessToken?: string | undefined, freeTicket?: boolean) => Promise<AxiosResponse<any, any>>;
9
9
  export declare const authorize: (data: {
10
10
  email: string;
11
11
  password: string;
@@ -1379,7 +1379,19 @@ var getCart = function getCart() {
1379
1379
  var res = publicRequest.get("v1/cart/");
1380
1380
  return res;
1381
1381
  };
1382
- var postOnCheckout = function postOnCheckout(data, accessToken) {
1382
+ var postOnCheckout = function postOnCheckout(data, accessToken, freeTicket) {
1383
+ if (freeTicket === void 0) {
1384
+ freeTicket = false;
1385
+ }
1386
+
1387
+ if (freeTicket) {
1388
+ delete data.attributes.city;
1389
+ delete data.attributes.country;
1390
+ delete data.attributes.state;
1391
+ delete data.attributes.zip;
1392
+ delete data.attributes.street_address;
1393
+ }
1394
+
1383
1395
  var res = publicRequest.post("v1/on-checkout/", {
1384
1396
  data: data
1385
1397
  }, {
@@ -3306,7 +3318,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3306
3318
  }
3307
3319
 
3308
3320
  _context5.next = 7;
3309
- return postOnCheckout(checkoutBody, access_token);
3321
+ return postOnCheckout(checkoutBody, access_token, flagFreeTicket);
3310
3322
 
3311
3323
  case 7:
3312
3324
  res = _context5.sent;
@@ -3419,7 +3431,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3419
3431
  }
3420
3432
 
3421
3433
  _context6.next = 6;
3422
- return postOnCheckout(_checkoutBody, access_token);
3434
+ return postOnCheckout(_checkoutBody, access_token, flagFreeTicket);
3423
3435
 
3424
3436
  case 6:
3425
3437
  _res = _context6.sent;
@@ -3523,7 +3535,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3523
3535
  }
3524
3536
 
3525
3537
  _context6.next = 47;
3526
- return postOnCheckout(checkoutBody);
3538
+ return postOnCheckout(checkoutBody, undefined, flagFreeTicket);
3527
3539
 
3528
3540
  case 47:
3529
3541
  res = _context6.sent;
@@ -3669,6 +3681,10 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3669
3681
  }
3670
3682
  }
3671
3683
 
3684
+ if (hideWalletAddressField && el.name === 'wallet-address-info') {
3685
+ return false;
3686
+ }
3687
+
3672
3688
  return true;
3673
3689
  }), function (element) {
3674
3690
  return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : ['data_capture[wallet_address]'].includes(element.name) && hideWalletAddressField ? null : React__default.createElement(React__default.Fragment, {
@@ -5850,7 +5866,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5850
5866
  }
5851
5867
 
5852
5868
  _context2.next = 40;
5853
- return postOnCheckout(checkoutBody, access_token);
5869
+ return postOnCheckout(checkoutBody, access_token, freeTicket);
5854
5870
 
5855
5871
  case 40:
5856
5872
  _context2.t1 = _context2.sent;
@@ -7762,7 +7778,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
7762
7778
 
7763
7779
  var handleConfirm = /*#__PURE__*/function () {
7764
7780
  var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(values, skipAddonPage) {
7765
- var _pageConfigsData$skip, _pageConfigsData$name, _pageConfigsData$age_, _pageConfigsData$phon, _pageConfigsData$has_, pageConfigsDataResponse, pageConfigsData, isWindowDefined, skipBillingPage, nameIsRequired, ageIsRequired, phoneIsRequired, hasAddOn, ticketsQuantity, userData, checkoutBody, checkoutResponse, hash, total;
7781
+ var _pageConfigsData$skip, _pageConfigsData$name, _pageConfigsData$age_, _pageConfigsData$phon, _pageConfigsData$has_, _pageConfigsData$free, _pageConfigsData$coll, _pageConfigsData$coll2, pageConfigsDataResponse, pageConfigsData, isWindowDefined, skipBillingPage, nameIsRequired, ageIsRequired, phoneIsRequired, hasAddOn, freeTicket, collectOptionalWalletAddress, collectMandatoryWalletAddress, ticketsQuantity, userData, checkoutBody, checkoutResponse, hash, total;
7766
7782
 
7767
7783
  return runtime_1.wrap(function _callee2$(_context2) {
7768
7784
  while (1) {
@@ -7781,24 +7797,27 @@ var AddonsContainter = function AddonsContainter(_ref) {
7781
7797
  ageIsRequired = (_pageConfigsData$age_ = pageConfigsData.age_required) != null ? _pageConfigsData$age_ : false;
7782
7798
  phoneIsRequired = (_pageConfigsData$phon = pageConfigsData.phone_required) != null ? _pageConfigsData$phon : false;
7783
7799
  hasAddOn = (_pageConfigsData$has_ = pageConfigsData.has_add_on) != null ? _pageConfigsData$has_ : false;
7800
+ freeTicket = (_pageConfigsData$free = pageConfigsData.free_ticket) != null ? _pageConfigsData$free : false;
7801
+ collectOptionalWalletAddress = (_pageConfigsData$coll = pageConfigsData.collect_optional_wallet_address) != null ? _pageConfigsData$coll : false;
7802
+ collectMandatoryWalletAddress = (_pageConfigsData$coll2 = pageConfigsData.collect_mandatory_wallet_address) != null ? _pageConfigsData$coll2 : false;
7784
7803
 
7785
7804
  if (!(skipBillingPage && enableBillingInfoAutoCreate)) {
7786
- _context2.next = 33;
7805
+ _context2.next = 36;
7787
7806
  break;
7788
7807
  }
7789
7808
 
7790
7809
  ticketsQuantity = window.localStorage.getItem('quantity');
7791
7810
  userData = JSON.parse(window.localStorage.getItem('user_data') || '{}');
7792
7811
  checkoutBody = createCheckoutDataBodyWithDefaultHolder(Number(ticketsQuantity) || 0, userData);
7793
- _context2.prev = 15;
7794
- _context2.next = 18;
7812
+ _context2.prev = 18;
7813
+ _context2.next = 21;
7795
7814
  return postOnCheckout(_extends({}, checkoutBody, {
7796
7815
  attributes: _extends({}, checkoutBody.attributes, !skipAddonPage && {
7797
7816
  add_ons: values
7798
7817
  })
7799
7818
  }));
7800
7819
 
7801
- case 18:
7820
+ case 21:
7802
7821
  checkoutResponse = _context2.sent;
7803
7822
  hash = _get(checkoutResponse, 'data.data.attributes.hash');
7804
7823
  total = _get(checkoutResponse, 'data.data.attributes.total');
@@ -7813,22 +7832,25 @@ var AddonsContainter = function AddonsContainter(_ref) {
7813
7832
  event_id: String(eventId),
7814
7833
  hash: hash,
7815
7834
  total: total,
7816
- hasAddOn: hasAddOn
7835
+ hasAddOn: hasAddOn,
7836
+ free_ticket: freeTicket,
7837
+ collect_optional_wallet_address: collectOptionalWalletAddress,
7838
+ collect_mandatory_wallet_address: collectMandatoryWalletAddress
7817
7839
  });
7818
- _context2.next = 31;
7840
+ _context2.next = 34;
7819
7841
  break;
7820
7842
 
7821
- case 27:
7822
- _context2.prev = 27;
7823
- _context2.t0 = _context2["catch"](15);
7843
+ case 30:
7844
+ _context2.prev = 30;
7845
+ _context2.t0 = _context2["catch"](18);
7824
7846
  onPostCheckoutError(_context2.t0);
7825
7847
  onConfirmSelectionError(_context2.t0);
7826
7848
 
7827
- case 31:
7828
- _context2.next = 34;
7849
+ case 34:
7850
+ _context2.next = 37;
7829
7851
  break;
7830
7852
 
7831
- case 33:
7853
+ case 36:
7832
7854
  if (isWindowDefined) {
7833
7855
  if (!skipAddonPage) {
7834
7856
  window.localStorage.setItem('add_ons', JSON.stringify(values));
@@ -7849,21 +7871,21 @@ var AddonsContainter = function AddonsContainter(_ref) {
7849
7871
  });
7850
7872
  }
7851
7873
 
7852
- case 34:
7853
- _context2.next = 39;
7874
+ case 37:
7875
+ _context2.next = 42;
7854
7876
  break;
7855
7877
 
7856
- case 36:
7857
- _context2.prev = 36;
7878
+ case 39:
7879
+ _context2.prev = 39;
7858
7880
  _context2.t1 = _context2["catch"](0);
7859
7881
  onConfirmSelectionError(_context2.t1);
7860
7882
 
7861
- case 39:
7883
+ case 42:
7862
7884
  case "end":
7863
7885
  return _context2.stop();
7864
7886
  }
7865
7887
  }
7866
- }, _callee2, null, [[0, 36], [15, 27]]);
7888
+ }, _callee2, null, [[0, 39], [18, 30]]);
7867
7889
  }));
7868
7890
 
7869
7891
  return function handleConfirm(_x, _x2) {