tf-checkout-react 1.2.17 → 1.2.20

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,8 +8,8 @@ export declare const publicRequest: IPublicRequest;
8
8
  export declare const setXSourceOrigin: (sourceOrigin: string) => void;
9
9
  export declare const setCustomHeader: (response: any) => void;
10
10
  export declare const handleSetAccessToken: (token: string) => void;
11
- export declare function getEvent(id: string | number): Promise<AxiosResponse<any, any>>;
12
- export declare function getTickets(id: string | number, promoCode: string): Promise<AxiosResponse<any, any>>;
11
+ export declare function getEvent(id: string | number, pk?: string): Promise<AxiosResponse<any, any>>;
12
+ export declare function getTickets(id: string | number, promoCode: string, pk?: string): Promise<AxiosResponse<any, any>>;
13
13
  export declare const addToCart: (id: string | number, data: any) => Promise<AxiosResponse<any, any>>;
14
14
  export declare const getCart: () => Promise<AxiosResponse<any, any>>;
15
15
  export declare const postOnCheckout: (data: any, accessToken?: string | undefined) => Promise<AxiosResponse<any, any>>;
@@ -7,5 +7,6 @@ export interface IPhoneNumberField {
7
7
  type: string;
8
8
  disableDropdown: boolean;
9
9
  fill: boolean;
10
+ setPhoneValidationIsLoading: (isLoading: boolean) => void;
10
11
  }
11
- export declare const PhoneNumberField: ({ label, field, form: { errors, touched, setFieldError, values, initialValues, setFieldValue, setFieldTouched, }, disableDropdown, fill, }: IPhoneNumberField) => JSX.Element;
12
+ export declare const PhoneNumberField: ({ label, field, form: { errors, touched, setFieldError, values, initialValues, setFieldValue, setFieldTouched, }, disableDropdown, fill, setPhoneValidationIsLoading, }: IPhoneNumberField) => JSX.Element;
@@ -50,5 +50,5 @@ export interface ITicket {
50
50
  export interface ISelectedTickets {
51
51
  [key: string]: string | number;
52
52
  }
53
- export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, onLogoutSuccess, onLogoutError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons, hideWaitingList, enableBillingInfoAutoCreate, isButtonScrollable, sortBySoldOut, disableCountdownLeadingZero, isLoggedIn, actionsSectionComponent: ActionsSectionComponent, ticketsHeaderComponent, hideTicketsHeader, enableInfluencersSection }: IGetTickets) => JSX.Element;
53
+ export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, onLogoutSuccess, onLogoutError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons, hideWaitingList, enableBillingInfoAutoCreate, isButtonScrollable, sortBySoldOut, disableCountdownLeadingZero, isLoggedIn, actionsSectionComponent: ActionsSectionComponent, ticketsHeaderComponent, hideTicketsHeader, enableInfluencersSection, }: IGetTickets) => JSX.Element;
54
54
  export {};
@@ -1312,7 +1312,7 @@ var handleSetAccessToken = function handleSetAccessToken(token) {
1312
1312
  }
1313
1313
  }
1314
1314
  };
1315
- function getEvent(id) {
1315
+ function getEvent(id, pk) {
1316
1316
  var referralValue = '';
1317
1317
 
1318
1318
  if (isWindowDefined) {
@@ -1330,6 +1330,9 @@ function getEvent(id) {
1330
1330
  }
1331
1331
 
1332
1332
  var response = publicRequest.get("v1/event/" + id, {
1333
+ params: {
1334
+ pk: pk
1335
+ },
1333
1336
  headers: _extends({}, ttfHeaders, {
1334
1337
  'Referer-Url': isDocumentDefined ? document.referrer : '',
1335
1338
  'Referrer-Id': isWindowDefined ? referralValue : ''
@@ -1339,8 +1342,11 @@ function getEvent(id) {
1339
1342
  });
1340
1343
  return response;
1341
1344
  }
1342
- function getTickets(id, promoCode) {
1343
- var response = publicRequest.get("v1/event/" + id + "/tickets/", {
1345
+ function getTickets(id, promoCode, pk) {
1346
+ var response = publicRequest.get("v1/event/" + id + "/tickets", {
1347
+ params: {
1348
+ pk: pk
1349
+ },
1344
1350
  headers: promoCode ? _extends({}, ttfHeaders, {
1345
1351
  'Promotion-Event': String(id),
1346
1352
  'Promotion-Code': promoCode
@@ -1689,7 +1695,8 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1689
1695
  _ref$disableDropdown = _ref.disableDropdown,
1690
1696
  disableDropdown = _ref$disableDropdown === void 0 ? true : _ref$disableDropdown,
1691
1697
  _ref$fill = _ref.fill,
1692
- fill = _ref$fill === void 0 ? false : _ref$fill;
1698
+ fill = _ref$fill === void 0 ? false : _ref$fill,
1699
+ setPhoneValidationIsLoading = _ref.setPhoneValidationIsLoading;
1693
1700
 
1694
1701
  var error = _get(errors, field.name);
1695
1702
 
@@ -1699,11 +1706,8 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1699
1706
  return void cb();
1700
1707
  }, 1000), []);
1701
1708
  React.useEffect(function () {
1702
- if (field.value === '+') {
1703
- setFieldError(field.name, '');
1704
- setFieldTouched(field.name, false);
1705
- setFieldValue(field.name, '');
1706
- return;
1709
+ if (field.value) {
1710
+ setPhoneValidationIsLoading(true);
1707
1711
  }
1708
1712
 
1709
1713
  debounceCb( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -1737,11 +1741,16 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1737
1741
  }
1738
1742
 
1739
1743
  case 11:
1744
+ _context.prev = 11;
1745
+ setPhoneValidationIsLoading(false);
1746
+ return _context.finish(11);
1747
+
1748
+ case 14:
1740
1749
  case "end":
1741
1750
  return _context.stop();
1742
1751
  }
1743
1752
  }
1744
- }, _callee, null, [[0, 7]]);
1753
+ }, _callee, null, [[0, 7, 11, 14]]);
1745
1754
  }))); // eslint-disable-next-line
1746
1755
  }, [field.value]);
1747
1756
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(MuiPhoneNumber, {
@@ -2911,6 +2920,10 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
2911
2920
  error = _useState14[0],
2912
2921
  setError = _useState14[1];
2913
2922
 
2923
+ var _useState15 = React.useState(false),
2924
+ phoneValidationIsLoading = _useState15[0],
2925
+ setPhoneValidationIsLoading = _useState15[1];
2926
+
2914
2927
  var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
2915
2928
 
2916
2929
  var firstNameLogged = _get(userData, 'first_name', '') || _get(userValues, 'first_name', '');
@@ -3473,6 +3486,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
3473
3486
  }, React__default.createElement("div", {
3474
3487
  className: element.className
3475
3488
  }, element.component ? element.component : React__default.createElement(formik.Field, {
3489
+ setPhoneValidationIsLoading: element.type === 'phone' ? setPhoneValidationIsLoading : undefined,
3476
3490
  name: element.name,
3477
3491
  label: element.name === 'phone' ? "" + element.label + (flagRequirePhone ? '' : ' (optional)') + " " : element.label,
3478
3492
  type: element.type,
@@ -3513,7 +3527,8 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
3513
3527
  }, element.onValidate ? element.onValidate : function () {
3514
3528
  return props.errors[element.name + "-" + index];
3515
3529
  }),
3516
- disableDropdown: element.disableDropdown
3530
+ disableDropdown: element.disableDropdown,
3531
+ setPhoneValidationIsLoading: setPhoneValidationIsLoading
3517
3532
  }));
3518
3533
  })));
3519
3534
  }));
@@ -3523,7 +3538,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
3523
3538
  type: "submit",
3524
3539
  variant: "contained",
3525
3540
  className: "login-register-button",
3526
- disabled: props.isSubmitting
3541
+ disabled: props.isSubmitting || phoneValidationIsLoading
3527
3542
  }, props.isSubmitting ? React__default.createElement(material.CircularProgress, {
3528
3543
  size: 26
3529
3544
  }) : buttonName))));
@@ -5362,7 +5377,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5362
5377
 
5363
5378
  function _getTicketsApi() {
5364
5379
  _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(isUpdateingCode, type) {
5365
- var response, eventResponse, attributes, _event2;
5380
+ var previewKey, response, eventResponse, attributes, _event2;
5366
5381
 
5367
5382
  return runtime_1.wrap(function _callee3$(_context3) {
5368
5383
  while (1) {
@@ -5370,15 +5385,16 @@ var TicketsContainer = function TicketsContainer(_ref) {
5370
5385
  case 0:
5371
5386
  _context3.prev = 0;
5372
5387
  isUpdateingCode ? setCodeIsLoading(true) : setIsLoading(true);
5373
- _context3.next = 4;
5374
- return getTickets(eventId, code);
5388
+ previewKey = getQueryVariable('pk') || undefined;
5389
+ _context3.next = 5;
5390
+ return getTickets(eventId, code, previewKey);
5375
5391
 
5376
- case 4:
5392
+ case 5:
5377
5393
  response = _context3.sent;
5378
- _context3.next = 7;
5379
- return getEvent(eventId);
5394
+ _context3.next = 8;
5395
+ return getEvent(eventId, previewKey);
5380
5396
 
5381
- case 7:
5397
+ case 8:
5382
5398
  eventResponse = _context3.sent;
5383
5399
 
5384
5400
  if (response.data.success) {
@@ -5397,29 +5413,29 @@ var TicketsContainer = function TicketsContainer(_ref) {
5397
5413
  setEvent(_event2);
5398
5414
  }
5399
5415
 
5400
- _context3.next = 15;
5416
+ _context3.next = 16;
5401
5417
  break;
5402
5418
 
5403
- case 12:
5404
- _context3.prev = 12;
5419
+ case 13:
5420
+ _context3.prev = 13;
5405
5421
  _context3.t0 = _context3["catch"](0);
5406
5422
 
5407
5423
  if (axios.isAxiosError(_context3.t0)) {
5408
5424
  onGetTicketsError(_context3.t0);
5409
5425
  }
5410
5426
 
5411
- case 15:
5412
- _context3.prev = 15;
5427
+ case 16:
5428
+ _context3.prev = 16;
5413
5429
  setIsLoading(false);
5414
5430
  setCodeIsLoading(false);
5415
- return _context3.finish(15);
5431
+ return _context3.finish(16);
5416
5432
 
5417
- case 19:
5433
+ case 20:
5418
5434
  case "end":
5419
5435
  return _context3.stop();
5420
5436
  }
5421
5437
  }
5422
- }, _callee3, null, [[0, 12, 15, 19]]);
5438
+ }, _callee3, null, [[0, 13, 16, 20]]);
5423
5439
  }));
5424
5440
  return _getTicketsApi.apply(this, arguments);
5425
5441
  }