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.
@@ -1305,7 +1305,7 @@ var handleSetAccessToken = function handleSetAccessToken(token) {
1305
1305
  }
1306
1306
  }
1307
1307
  };
1308
- function getEvent(id) {
1308
+ function getEvent(id, pk) {
1309
1309
  var referralValue = '';
1310
1310
 
1311
1311
  if (isWindowDefined) {
@@ -1323,6 +1323,9 @@ function getEvent(id) {
1323
1323
  }
1324
1324
 
1325
1325
  var response = publicRequest.get("v1/event/" + id, {
1326
+ params: {
1327
+ pk: pk
1328
+ },
1326
1329
  headers: _extends({}, ttfHeaders, {
1327
1330
  'Referer-Url': isDocumentDefined ? document.referrer : '',
1328
1331
  'Referrer-Id': isWindowDefined ? referralValue : ''
@@ -1332,8 +1335,11 @@ function getEvent(id) {
1332
1335
  });
1333
1336
  return response;
1334
1337
  }
1335
- function getTickets(id, promoCode) {
1336
- var response = publicRequest.get("v1/event/" + id + "/tickets/", {
1338
+ function getTickets(id, promoCode, pk) {
1339
+ var response = publicRequest.get("v1/event/" + id + "/tickets", {
1340
+ params: {
1341
+ pk: pk
1342
+ },
1337
1343
  headers: promoCode ? _extends({}, ttfHeaders, {
1338
1344
  'Promotion-Event': String(id),
1339
1345
  'Promotion-Code': promoCode
@@ -1682,7 +1688,8 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1682
1688
  _ref$disableDropdown = _ref.disableDropdown,
1683
1689
  disableDropdown = _ref$disableDropdown === void 0 ? true : _ref$disableDropdown,
1684
1690
  _ref$fill = _ref.fill,
1685
- fill = _ref$fill === void 0 ? false : _ref$fill;
1691
+ fill = _ref$fill === void 0 ? false : _ref$fill,
1692
+ setPhoneValidationIsLoading = _ref.setPhoneValidationIsLoading;
1686
1693
 
1687
1694
  var error = _get(errors, field.name);
1688
1695
 
@@ -1692,11 +1699,8 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1692
1699
  return void cb();
1693
1700
  }, 1000), []);
1694
1701
  useEffect(function () {
1695
- if (field.value === '+') {
1696
- setFieldError(field.name, '');
1697
- setFieldTouched(field.name, false);
1698
- setFieldValue(field.name, '');
1699
- return;
1702
+ if (field.value) {
1703
+ setPhoneValidationIsLoading(true);
1700
1704
  }
1701
1705
 
1702
1706
  debounceCb( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -1730,11 +1734,16 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1730
1734
  }
1731
1735
 
1732
1736
  case 11:
1737
+ _context.prev = 11;
1738
+ setPhoneValidationIsLoading(false);
1739
+ return _context.finish(11);
1740
+
1741
+ case 14:
1733
1742
  case "end":
1734
1743
  return _context.stop();
1735
1744
  }
1736
1745
  }
1737
- }, _callee, null, [[0, 7]]);
1746
+ }, _callee, null, [[0, 7, 11, 14]]);
1738
1747
  }))); // eslint-disable-next-line
1739
1748
  }, [field.value]);
1740
1749
  return React.createElement(React.Fragment, null, React.createElement(MuiPhoneNumber, {
@@ -2909,6 +2918,10 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
2909
2918
  error = _useState14[0],
2910
2919
  setError = _useState14[1];
2911
2920
 
2921
+ var _useState15 = useState(false),
2922
+ phoneValidationIsLoading = _useState15[0],
2923
+ setPhoneValidationIsLoading = _useState15[1];
2924
+
2912
2925
  var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
2913
2926
 
2914
2927
  var firstNameLogged = _get(userData, 'first_name', '') || _get(userValues, 'first_name', '');
@@ -3471,6 +3484,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3471
3484
  }, React.createElement("div", {
3472
3485
  className: element.className
3473
3486
  }, element.component ? element.component : React.createElement(Field, {
3487
+ setPhoneValidationIsLoading: element.type === 'phone' ? setPhoneValidationIsLoading : undefined,
3474
3488
  name: element.name,
3475
3489
  label: element.name === 'phone' ? "" + element.label + (flagRequirePhone ? '' : ' (optional)') + " " : element.label,
3476
3490
  type: element.type,
@@ -3511,7 +3525,8 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3511
3525
  }, element.onValidate ? element.onValidate : function () {
3512
3526
  return props.errors[element.name + "-" + index];
3513
3527
  }),
3514
- disableDropdown: element.disableDropdown
3528
+ disableDropdown: element.disableDropdown,
3529
+ setPhoneValidationIsLoading: setPhoneValidationIsLoading
3515
3530
  }));
3516
3531
  })));
3517
3532
  }));
@@ -3521,7 +3536,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3521
3536
  type: "submit",
3522
3537
  variant: "contained",
3523
3538
  className: "login-register-button",
3524
- disabled: props.isSubmitting
3539
+ disabled: props.isSubmitting || phoneValidationIsLoading
3525
3540
  }, props.isSubmitting ? React.createElement(CircularProgress$1, {
3526
3541
  size: 26
3527
3542
  }) : buttonName))));
@@ -5360,7 +5375,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5360
5375
 
5361
5376
  function _getTicketsApi() {
5362
5377
  _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(isUpdateingCode, type) {
5363
- var response, eventResponse, attributes, _event2;
5378
+ var previewKey, response, eventResponse, attributes, _event2;
5364
5379
 
5365
5380
  return runtime_1.wrap(function _callee3$(_context3) {
5366
5381
  while (1) {
@@ -5368,15 +5383,16 @@ var TicketsContainer = function TicketsContainer(_ref) {
5368
5383
  case 0:
5369
5384
  _context3.prev = 0;
5370
5385
  isUpdateingCode ? setCodeIsLoading(true) : setIsLoading(true);
5371
- _context3.next = 4;
5372
- return getTickets(eventId, code);
5386
+ previewKey = getQueryVariable('pk') || undefined;
5387
+ _context3.next = 5;
5388
+ return getTickets(eventId, code, previewKey);
5373
5389
 
5374
- case 4:
5390
+ case 5:
5375
5391
  response = _context3.sent;
5376
- _context3.next = 7;
5377
- return getEvent(eventId);
5392
+ _context3.next = 8;
5393
+ return getEvent(eventId, previewKey);
5378
5394
 
5379
- case 7:
5395
+ case 8:
5380
5396
  eventResponse = _context3.sent;
5381
5397
 
5382
5398
  if (response.data.success) {
@@ -5395,29 +5411,29 @@ var TicketsContainer = function TicketsContainer(_ref) {
5395
5411
  setEvent(_event2);
5396
5412
  }
5397
5413
 
5398
- _context3.next = 15;
5414
+ _context3.next = 16;
5399
5415
  break;
5400
5416
 
5401
- case 12:
5402
- _context3.prev = 12;
5417
+ case 13:
5418
+ _context3.prev = 13;
5403
5419
  _context3.t0 = _context3["catch"](0);
5404
5420
 
5405
5421
  if (axios.isAxiosError(_context3.t0)) {
5406
5422
  onGetTicketsError(_context3.t0);
5407
5423
  }
5408
5424
 
5409
- case 15:
5410
- _context3.prev = 15;
5425
+ case 16:
5426
+ _context3.prev = 16;
5411
5427
  setIsLoading(false);
5412
5428
  setCodeIsLoading(false);
5413
- return _context3.finish(15);
5429
+ return _context3.finish(16);
5414
5430
 
5415
- case 19:
5431
+ case 20:
5416
5432
  case "end":
5417
5433
  return _context3.stop();
5418
5434
  }
5419
5435
  }
5420
- }, _callee3, null, [[0, 12, 15, 19]]);
5436
+ }, _callee3, null, [[0, 13, 16, 20]]);
5421
5437
  }));
5422
5438
  return _getTicketsApi.apply(this, arguments);
5423
5439
  }