tf-checkout-react 1.2.16 → 1.2.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.
@@ -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, {
@@ -2753,7 +2762,7 @@ var LogicRunner = function LogicRunner(_ref) {
2753
2762
  return null;
2754
2763
  };
2755
2764
 
2756
- var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2765
+ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
2757
2766
  var _ref3$data = _ref3.data,
2758
2767
  data = _ref3$data === void 0 ? [] : _ref3$data,
2759
2768
  _ref3$ticketHoldersFi = _ref3.ticketHoldersFields,
@@ -2770,34 +2779,34 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2770
2779
  _ref3$theme = _ref3.theme,
2771
2780
  theme = _ref3$theme === void 0 ? 'light' : _ref3$theme,
2772
2781
  _ref3$onRegisterSucce = _ref3.onRegisterSuccess,
2773
- onRegisterSuccess = _ref3$onRegisterSucce === void 0 ? function () {} : _ref3$onRegisterSucce,
2782
+ onRegisterSuccess = _ref3$onRegisterSucce === void 0 ? _identity : _ref3$onRegisterSucce,
2774
2783
  _ref3$onRegisterError = _ref3.onRegisterError,
2775
- onRegisterError = _ref3$onRegisterError === void 0 ? function () {} : _ref3$onRegisterError,
2784
+ onRegisterError = _ref3$onRegisterError === void 0 ? _identity : _ref3$onRegisterError,
2776
2785
  _ref3$onSubmitError = _ref3.onSubmitError,
2777
- onSubmitError = _ref3$onSubmitError === void 0 ? function () {} : _ref3$onSubmitError,
2786
+ onSubmitError = _ref3$onSubmitError === void 0 ? _identity : _ref3$onSubmitError,
2778
2787
  _ref3$onGetCartSucces = _ref3.onGetCartSuccess,
2779
- onGetCartSuccess = _ref3$onGetCartSucces === void 0 ? function () {} : _ref3$onGetCartSucces,
2788
+ onGetCartSuccess = _ref3$onGetCartSucces === void 0 ? _identity : _ref3$onGetCartSucces,
2780
2789
  _ref3$onGetCartError = _ref3.onGetCartError,
2781
- onGetCartError = _ref3$onGetCartError === void 0 ? function () {} : _ref3$onGetCartError,
2790
+ onGetCartError = _ref3$onGetCartError === void 0 ? _identity : _ref3$onGetCartError,
2782
2791
  _ref3$onGetCountriesS = _ref3.onGetCountriesSuccess,
2783
- onGetCountriesSuccess = _ref3$onGetCountriesS === void 0 ? function () {} : _ref3$onGetCountriesS,
2792
+ onGetCountriesSuccess = _ref3$onGetCountriesS === void 0 ? _identity : _ref3$onGetCountriesS,
2784
2793
  _ref3$onGetCountriesE = _ref3.onGetCountriesError,
2785
- onGetCountriesError = _ref3$onGetCountriesE === void 0 ? function () {} : _ref3$onGetCountriesE,
2794
+ onGetCountriesError = _ref3$onGetCountriesE === void 0 ? _identity : _ref3$onGetCountriesE,
2786
2795
  _ref3$onGetStatesSucc = _ref3.onGetStatesSuccess,
2787
- onGetStatesSuccess = _ref3$onGetStatesSucc === void 0 ? function () {} : _ref3$onGetStatesSucc,
2796
+ onGetStatesSuccess = _ref3$onGetStatesSucc === void 0 ? _identity : _ref3$onGetStatesSucc,
2788
2797
  _ref3$onGetStatesErro = _ref3.onGetStatesError,
2789
- onGetStatesError = _ref3$onGetStatesErro === void 0 ? function () {} : _ref3$onGetStatesErro,
2798
+ onGetStatesError = _ref3$onGetStatesErro === void 0 ? _identity : _ref3$onGetStatesErro,
2790
2799
  _ref3$onGetProfileDat = _ref3.onGetProfileDataSuccess,
2791
- _onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
2800
+ _onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? _identity : _ref3$onGetProfileDat,
2792
2801
  _ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
2793
- onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? function () {} : _ref3$onGetProfileDat2,
2802
+ onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? _identity : _ref3$onGetProfileDat2,
2794
2803
  _ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
2795
- onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? function () {} : _ref3$onAuthorizeSucc,
2804
+ onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? _identity : _ref3$onAuthorizeSucc,
2796
2805
  _ref3$onAuthorizeErro = _ref3.onAuthorizeError,
2797
- onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
2806
+ onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? _identity : _ref3$onAuthorizeErro,
2798
2807
  onLogin = _ref3.onLogin,
2799
2808
  _ref3$onLoginSuccess = _ref3.onLoginSuccess,
2800
- onLoginSuccess = _ref3$onLoginSuccess === void 0 ? function () {} : _ref3$onLoginSuccess,
2809
+ onLoginSuccess = _ref3$onLoginSuccess === void 0 ? _identity : _ref3$onLoginSuccess,
2801
2810
  _ref3$isLoggedIn = _ref3.isLoggedIn,
2802
2811
  pIsLoggedIn = _ref3$isLoggedIn === void 0 ? false : _ref3$isLoggedIn,
2803
2812
  _ref3$accountInfoTitl = _ref3.accountInfoTitle,
@@ -2805,23 +2814,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2805
2814
  hideLogo = _ref3.hideLogo,
2806
2815
  themeOptions = _ref3.themeOptions,
2807
2816
  _ref3$onErrorClose = _ref3.onErrorClose,
2808
- onErrorClose = _ref3$onErrorClose === void 0 ? function () {} : _ref3$onErrorClose,
2817
+ onErrorClose = _ref3$onErrorClose === void 0 ? _identity : _ref3$onErrorClose,
2809
2818
  _ref3$hideErrorsAlert = _ref3.hideErrorsAlertSection,
2810
2819
  hideErrorsAlertSection = _ref3$hideErrorsAlert === void 0 ? false : _ref3$hideErrorsAlert,
2811
2820
  _ref3$onSkipBillingPa = _ref3.onSkipBillingPage,
2812
- onSkipBillingPage = _ref3$onSkipBillingPa === void 0 ? function () {} : _ref3$onSkipBillingPa,
2821
+ onSkipBillingPage = _ref3$onSkipBillingPa === void 0 ? _identity : _ref3$onSkipBillingPa,
2813
2822
  _ref3$skipPage = _ref3.skipPage,
2814
2823
  skipPage = _ref3$skipPage === void 0 ? false : _ref3$skipPage,
2815
2824
  _ref3$canSkipHolderNa = _ref3.canSkipHolderNames,
2816
2825
  canSkipHolderNames = _ref3$canSkipHolderNa === void 0 ? false : _ref3$canSkipHolderNa,
2817
2826
  _ref3$onForgotPasswor = _ref3.onForgotPasswordSuccess,
2818
- onForgotPasswordSuccess = _ref3$onForgotPasswor === void 0 ? function () {} : _ref3$onForgotPasswor,
2827
+ onForgotPasswordSuccess = _ref3$onForgotPasswor === void 0 ? _identity : _ref3$onForgotPasswor,
2819
2828
  _ref3$onForgotPasswor2 = _ref3.onForgotPasswordError,
2820
- onForgotPasswordError = _ref3$onForgotPasswor2 === void 0 ? function () {} : _ref3$onForgotPasswor2,
2829
+ onForgotPasswordError = _ref3$onForgotPasswor2 === void 0 ? _identity : _ref3$onForgotPasswor2,
2821
2830
  _ref3$shouldFetchCoun = _ref3.shouldFetchCountries,
2822
2831
  shouldFetchCountries = _ref3$shouldFetchCoun === void 0 ? true : _ref3$shouldFetchCoun,
2823
2832
  _ref3$onCountdownFini = _ref3.onCountdownFinish,
2824
- onCountdownFinish = _ref3$onCountdownFini === void 0 ? function () {} : _ref3$onCountdownFini,
2833
+ onCountdownFinish = _ref3$onCountdownFini === void 0 ? _identity : _ref3$onCountdownFini,
2825
2834
  _ref3$enableTimer = _ref3.enableTimer,
2826
2835
  enableTimer = _ref3$enableTimer === void 0 ? false : _ref3$enableTimer,
2827
2836
  logo = _ref3.logo,
@@ -2909,6 +2918,10 @@ var BillingInfoContainer = function BillingInfoContainer(_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', '');
@@ -3114,6 +3127,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3114
3127
 
3115
3128
  useEffect(function () {
3116
3129
  fetchUserData(access_token);
3130
+ fetchCart();
3117
3131
  }, [access_token, isLoggedIn]);
3118
3132
  useEffect(function () {
3119
3133
  var collectPaymentData = /*#__PURE__*/function () {
@@ -3510,7 +3524,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3510
3524
  }, element.onValidate ? element.onValidate : function () {
3511
3525
  return props.errors[element.name + "-" + index];
3512
3526
  }),
3513
- disableDropdown: element.disableDropdown
3527
+ disableDropdown: element.disableDropdown,
3528
+ setPhoneValidationIsLoading: setPhoneValidationIsLoading
3514
3529
  }));
3515
3530
  })));
3516
3531
  }));
@@ -3520,7 +3535,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3520
3535
  type: "submit",
3521
3536
  variant: "contained",
3522
3537
  className: "login-register-button",
3523
- disabled: props.isSubmitting
3538
+ disabled: props.isSubmitting || phoneValidationIsLoading
3524
3539
  }, props.isSubmitting ? React.createElement(CircularProgress$1, {
3525
3540
  size: 26
3526
3541
  }) : buttonName))));
@@ -3575,7 +3590,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3575
3590
  onForgotPasswordSuccess: onForgotPasswordSuccess,
3576
3591
  onForgotPasswordError: onForgotPasswordError
3577
3592
  }));
3578
- };
3593
+ });
3579
3594
 
3580
3595
  var currencyNormalizerCreator = function currencyNormalizerCreator(value, currency) {
3581
3596
  return !value ? '' : "" + getCurrencySymbolByCurrency(currency) + value;
@@ -5359,7 +5374,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5359
5374
 
5360
5375
  function _getTicketsApi() {
5361
5376
  _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(isUpdateingCode, type) {
5362
- var response, eventResponse, attributes, _event2;
5377
+ var previewKey, response, eventResponse, attributes, _event2;
5363
5378
 
5364
5379
  return runtime_1.wrap(function _callee3$(_context3) {
5365
5380
  while (1) {
@@ -5367,15 +5382,16 @@ var TicketsContainer = function TicketsContainer(_ref) {
5367
5382
  case 0:
5368
5383
  _context3.prev = 0;
5369
5384
  isUpdateingCode ? setCodeIsLoading(true) : setIsLoading(true);
5370
- _context3.next = 4;
5371
- return getTickets(eventId, code);
5385
+ previewKey = getQueryVariable('pk') || undefined;
5386
+ _context3.next = 5;
5387
+ return getTickets(eventId, code, previewKey);
5372
5388
 
5373
- case 4:
5389
+ case 5:
5374
5390
  response = _context3.sent;
5375
- _context3.next = 7;
5376
- return getEvent(eventId);
5391
+ _context3.next = 8;
5392
+ return getEvent(eventId, previewKey);
5377
5393
 
5378
- case 7:
5394
+ case 8:
5379
5395
  eventResponse = _context3.sent;
5380
5396
 
5381
5397
  if (response.data.success) {
@@ -5394,29 +5410,29 @@ var TicketsContainer = function TicketsContainer(_ref) {
5394
5410
  setEvent(_event2);
5395
5411
  }
5396
5412
 
5397
- _context3.next = 15;
5413
+ _context3.next = 16;
5398
5414
  break;
5399
5415
 
5400
- case 12:
5401
- _context3.prev = 12;
5416
+ case 13:
5417
+ _context3.prev = 13;
5402
5418
  _context3.t0 = _context3["catch"](0);
5403
5419
 
5404
5420
  if (axios.isAxiosError(_context3.t0)) {
5405
5421
  onGetTicketsError(_context3.t0);
5406
5422
  }
5407
5423
 
5408
- case 15:
5409
- _context3.prev = 15;
5424
+ case 16:
5425
+ _context3.prev = 16;
5410
5426
  setIsLoading(false);
5411
5427
  setCodeIsLoading(false);
5412
- return _context3.finish(15);
5428
+ return _context3.finish(16);
5413
5429
 
5414
- case 19:
5430
+ case 20:
5415
5431
  case "end":
5416
5432
  return _context3.stop();
5417
5433
  }
5418
5434
  }
5419
- }, _callee3, null, [[0, 12, 15, 19]]);
5435
+ }, _callee3, null, [[0, 13, 16, 20]]);
5420
5436
  }));
5421
5437
  return _getTicketsApi.apply(this, arguments);
5422
5438
  }