tf-checkout-react 1.0.99-beta.30 → 1.0.99-beta.33

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.
@@ -4,3 +4,4 @@ export declare const getCountries: () => Promise<ICountriesResponse>;
4
4
  export declare const getStates: (countryId: string | number) => Promise<IStatesResponse>;
5
5
  export declare const sendRSVPInfo: (eventId: number, data: IRSVPRequestData) => Promise<IRSVPResponse>;
6
6
  export declare const addToWaitingList: (id: number, data: IWaitingListRequestData) => Promise<IWaitingListResponse>;
7
+ export declare const postReferralVisits: (eventId: string, referralId: string) => Promise<IAxiosResponseData>;
@@ -4,6 +4,6 @@ export { setAxiosHeader, setBaseUrl } from './publicRequest';
4
4
  export { getOrders, getOrderDetails } from './orders';
5
5
  export { addToCart, getCart } from './cart';
6
6
  export { postOnCheckout } from './checkout';
7
- export { getEvent, getTickets, getCountries, getStates, addToWaitingList, sendRSVPInfo, } from './common';
7
+ export { getEvent, getTickets, getCountries, getStates, addToWaitingList, sendRSVPInfo, postReferralVisits, } from './common';
8
8
  export { getPaymentData, getConditions, handlePaymentSuccess, handleFreeSuccess, getConfirmationData, } from './payment';
9
9
  export { resaleTicket, removeFromResale, processTicket, declineInvitation, } from './resale';
@@ -7,7 +7,7 @@ import { AxiosError } from 'axios';
7
7
  import { IPaymentField } from '../../types';
8
8
  export interface IPaymentPage {
9
9
  paymentFields: IPaymentField[];
10
- handlePayment: (value: IFreeRegistrationDataResponse | IPaymentSuccessDataResponse) => void;
10
+ handlePayment: (value: string) => void;
11
11
  checkoutData: any;
12
12
  formTitle?: string;
13
13
  errorText?: string;
@@ -8,4 +8,4 @@ export interface IPromoCodeSectionProps {
8
8
  updateTickets: (value: boolean, type: string) => void;
9
9
  setCodeIsApplied: (value: boolean) => void;
10
10
  }
11
- export declare const PromoCodeSection: ({ code, codeIsApplied, showPromoInput, setCode, setShowPromoInput, updateTickets, setCodeIsApplied }: IPromoCodeSectionProps) => JSX.Element;
11
+ export declare const PromoCodeSection: ({ code, codeIsApplied, showPromoInput, setCode, setShowPromoInput, updateTickets, setCodeIsApplied, }: IPromoCodeSectionProps) => JSX.Element;
@@ -1286,9 +1286,7 @@ var signUp = /*#__PURE__*/function () {
1286
1286
  switch (_context2.prev = _context2.next) {
1287
1287
  case 0:
1288
1288
  _context2.next = 2;
1289
- return publicRequest.post('auth/signup', {
1290
- data: data
1291
- });
1289
+ return publicRequest.post('auth/signup', _extends({}, data));
1292
1290
 
1293
1291
  case 2:
1294
1292
  response = _context2.sent;
@@ -1539,12 +1537,15 @@ var getTickets = /*#__PURE__*/function () {
1539
1537
  while (1) {
1540
1538
  switch (_context2.prev = _context2.next) {
1541
1539
  case 0:
1542
- setAxiosHeader('Promotion-Event', String(eventId));
1543
- setAxiosHeader('Promotion-Code', promoCode);
1544
- _context2.next = 4;
1545
- return publicRequest.get("v1/event/" + eventId + "/tickets/");
1540
+ _context2.next = 2;
1541
+ return publicRequest.get("v1/event/" + eventId + "/tickets/", {
1542
+ headers: {
1543
+ 'Promotion-Event': String(eventId),
1544
+ 'Promotion-Code': promoCode
1545
+ }
1546
+ });
1546
1547
 
1547
- case 4:
1548
+ case 2:
1548
1549
  response = _context2.sent;
1549
1550
  tickets = response.data.data.attributes.tickets;
1550
1551
  ticketsArr = [];
@@ -1564,7 +1565,7 @@ var getTickets = /*#__PURE__*/function () {
1564
1565
  });
1565
1566
  return _context2.abrupt("return", adaptedResponse.data);
1566
1567
 
1567
- case 10:
1568
+ case 8:
1568
1569
  case "end":
1569
1570
  return _context2.stop();
1570
1571
  }
@@ -1684,6 +1685,34 @@ var addToWaitingList = /*#__PURE__*/function () {
1684
1685
  return _ref6.apply(this, arguments);
1685
1686
  };
1686
1687
  }();
1688
+ var postReferralVisits = /*#__PURE__*/function () {
1689
+ var _ref7 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(eventId, referralId) {
1690
+ var response;
1691
+ return runtime_1.wrap(function _callee7$(_context7) {
1692
+ while (1) {
1693
+ switch (_context7.prev = _context7.next) {
1694
+ case 0:
1695
+ _context7.next = 2;
1696
+ return publicRequest.post("v1/event/" + eventId + "/referrer/", {
1697
+ referrer: "" + referralId
1698
+ });
1699
+
1700
+ case 2:
1701
+ response = _context7.sent;
1702
+ return _context7.abrupt("return", response.data);
1703
+
1704
+ case 4:
1705
+ case "end":
1706
+ return _context7.stop();
1707
+ }
1708
+ }
1709
+ }, _callee7);
1710
+ }));
1711
+
1712
+ return function postReferralVisits(_x9, _x10) {
1713
+ return _ref7.apply(this, arguments);
1714
+ };
1715
+ }();
1687
1716
 
1688
1717
  var getPaymentData = /*#__PURE__*/function () {
1689
1718
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(hash) {
@@ -3489,7 +3518,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
3489
3518
  while (1) {
3490
3519
  switch (_context4.prev = _context4.next) {
3491
3520
  case 0:
3492
- if (!(skipPage && !_isEmpty(ticketsQuantity) && !showDOB)) {
3521
+ if (!((skipPage || ticketsQuantity.length === 1 && !_isEmpty(userData)) && !_isEmpty(ticketsQuantity) && !showDOB)) {
3493
3522
  _context4.next = 17;
3494
3523
  break;
3495
3524
  }
@@ -3534,7 +3563,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
3534
3563
  }();
3535
3564
 
3536
3565
  collectPaymentData();
3537
- }, [skipPage, ticketsQuantity, showDOB]);
3566
+ }, [skipPage, ticketsQuantity, showDOB, userData, onSkipBillingPage, onSubmitError]);
3538
3567
 
3539
3568
  var collectCheckoutBody = function collectCheckoutBody(values, profileData) {
3540
3569
  var checkoutBody = {}; // Auto collect ticket holders name when it was skipped optionally
@@ -3781,8 +3810,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref) {
3781
3810
  handleBlur: props.handleBlur,
3782
3811
  theme: theme,
3783
3812
  showDOB: showDOB,
3784
- showTicketHolderName: showTicketHolders
3785
- }), !_isEmpty(ticketHoldersFields.fields) && React__default.createElement("div", {
3813
+ showTicketHolderName: showTicketHolders && ticketsQuantity.length > 1
3814
+ }), !_isEmpty(ticketHoldersFields.fields) && ticketsQuantity.length > 1 && React__default.createElement("div", {
3786
3815
  className: "ticket-holders-fields"
3787
3816
  }, ticketHoldersFields.groupLabel && React__default.createElement("p", null, ticketHoldersFields.groupLabel), _map(ticketsQuantity, function (_item, index) {
3788
3817
  return React__default.createElement("div", {
@@ -4339,7 +4368,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4339
4368
  paymentSuccessResponse = _context3.t0;
4340
4369
 
4341
4370
  if (paymentSuccessResponse.status === 200) {
4342
- handlePayment(paymentSuccessResponse);
4371
+ handlePayment(orderHash);
4343
4372
  setPaymentIsLoading(false);
4344
4373
  }
4345
4374
 
@@ -4759,7 +4788,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
4759
4788
  className: "main"
4760
4789
  }, "Your tickets have been emailed to you"), React__default.createElement("span", {
4761
4790
  className: "helper"
4762
- }, "Please bring them with you to the event")), data.disableReferral === false && !isReferralEnabled && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
4791
+ }, "Please bring them with you to the event")), data.disableReferral === false && isReferralEnabled && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
4763
4792
  className: "referral_text_image_section"
4764
4793
  }, React__default.createElement("div", {
4765
4794
  className: "referral_text_section"
@@ -5177,9 +5206,36 @@ var ReferralLogic = function ReferralLogic(props) {
5177
5206
  var params = new URL("" + window.location).searchParams;
5178
5207
  var referralId = params.get('ttf_r') || '';
5179
5208
  var referralValue = [eventId, '.', referralId].join('');
5180
- localStorage.setItem(referralId, referralValue);
5209
+
5210
+ if (referralId && eventId) {
5211
+ _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
5212
+ return runtime_1.wrap(function _callee$(_context) {
5213
+ while (1) {
5214
+ switch (_context.prev = _context.next) {
5215
+ case 0:
5216
+ _context.prev = 0;
5217
+ _context.next = 3;
5218
+ return postReferralVisits("" + eventId, referralId);
5219
+
5220
+ case 3:
5221
+ localStorage.setItem('referral_key', referralValue);
5222
+ _context.next = 8;
5223
+ break;
5224
+
5225
+ case 6:
5226
+ _context.prev = 6;
5227
+ _context.t0 = _context["catch"](0);
5228
+
5229
+ case 8:
5230
+ case "end":
5231
+ return _context.stop();
5232
+ }
5233
+ }
5234
+ }, _callee, null, [[0, 6]]);
5235
+ }))();
5236
+ }
5181
5237
  }
5182
- }, []);
5238
+ }, [eventId, isWindowDefined]);
5183
5239
  return null;
5184
5240
  };
5185
5241