tf-checkout-react 1.2.2 → 1.2.3

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.
@@ -1306,15 +1306,16 @@ var handleSetAccessToken = function handleSetAccessToken(token) {
1306
1306
  }
1307
1307
  };
1308
1308
  function getEvent(id) {
1309
- var referralValue = "";
1309
+ var referralValue = '';
1310
1310
 
1311
1311
  if (isWindowDefined) {
1312
1312
  var params = new URL("" + window.location);
1313
1313
  var referralId = params.searchParams.get('ttf_r') || '';
1314
1314
  var referral_key = window.localStorage.getItem('referral_key');
1315
- var referralIdlocal = "";
1315
+ var referralIdlocal = '';
1316
1316
 
1317
1317
  if (referral_key) {
1318
+ // eslint-disable-next-line prefer-destructuring
1318
1319
  referralIdlocal = referral_key.split('.')[1];
1319
1320
  }
1320
1321
 
@@ -1323,8 +1324,8 @@ function getEvent(id) {
1323
1324
 
1324
1325
  var response = publicRequest.get("v1/event/" + id, {
1325
1326
  headers: _extends({}, ttfHeaders, {
1326
- "Referer-Url": isDocumentDefined ? document.referrer : '',
1327
- "Referrer-Id": isWindowDefined ? referralValue : ''
1327
+ 'Referer-Url': isDocumentDefined ? document.referrer : '',
1328
+ 'Referrer-Id': isWindowDefined ? referralValue : ''
1328
1329
  })
1329
1330
  })["catch"](function (error) {
1330
1331
  throw error;
@@ -1344,9 +1345,10 @@ function getTickets(id, promoCode) {
1344
1345
  }
1345
1346
  var addToCart = function addToCart(id, data) {
1346
1347
  var res = publicRequest.post("v1/event/" + id + "/add-to-cart/", {
1347
- data: data,
1348
+ data: data
1349
+ }, {
1348
1350
  headers: {
1349
- "Referer-Url": isDocumentDefined ? document.referrer : ''
1351
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
1350
1352
  }
1351
1353
  });
1352
1354
  return res;
@@ -1374,7 +1376,7 @@ var register = function register(data) {
1374
1376
  var getPaymentData = function getPaymentData(hash) {
1375
1377
  var response = publicRequest.get("v1/order/" + hash + "/review/", {
1376
1378
  headers: {
1377
- "Referer-Url": isDocumentDefined ? document.referrer : ''
1379
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
1378
1380
  }
1379
1381
  })["catch"](function (error) {
1380
1382
  throw error;
@@ -1382,9 +1384,9 @@ var getPaymentData = function getPaymentData(hash) {
1382
1384
  return response;
1383
1385
  };
1384
1386
  var handlePaymentSuccess = function handlePaymentSuccess(orderHash) {
1385
- var res = publicRequest.post("v1/order/" + orderHash + "/success", {
1387
+ var res = publicRequest.post("v1/order/" + orderHash + "/success", undefined, {
1386
1388
  headers: {
1387
- "Referer-Url": isDocumentDefined ? document.referrer : ''
1389
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
1388
1390
  }
1389
1391
  })["catch"](function (error) {
1390
1392
  throw error;
@@ -1392,9 +1394,9 @@ var handlePaymentSuccess = function handlePaymentSuccess(orderHash) {
1392
1394
  return res;
1393
1395
  };
1394
1396
  var handleFreeSuccess = function handleFreeSuccess(orderHash) {
1395
- var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration", {
1397
+ var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration", undefined, {
1396
1398
  headers: {
1397
- "Referer-Url": isDocumentDefined ? document.referrer : ''
1399
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
1398
1400
  }
1399
1401
  })["catch"](function (error) {
1400
1402
  throw error;
@@ -3567,7 +3569,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3567
3569
  type: element.type,
3568
3570
  required: true,
3569
3571
  component: element.type === 'checkbox' ? CheckboxField : element.type === 'phone' ? PhoneNumberField : CustomField,
3570
- validate: combineValidators(element.required ? requiredValidator : function () {}, element.onValidate ? element.onValidate : function () {}),
3572
+ validate: combineValidators(element.required ? requiredValidator : function () {
3573
+ return props.errors[element.name + "-" + index];
3574
+ }, element.onValidate ? element.onValidate : function () {
3575
+ return props.errors[element.name + "-" + index];
3576
+ }),
3571
3577
  disableDropdown: element.disableDropdown
3572
3578
  }));
3573
3579
  })));
@@ -3672,7 +3678,8 @@ var CheckoutForm = function CheckoutForm(_ref) {
3672
3678
  handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
3673
3679
  _ref$conditions = _ref.conditions,
3674
3680
  conditions = _ref$conditions === void 0 ? [] : _ref$conditions,
3675
- disableZipSection = _ref.disableZipSection;
3681
+ disableZipSection = _ref.disableZipSection,
3682
+ paymentButtonText = _ref.paymentButtonText;
3676
3683
  var stripe = useStripe();
3677
3684
  var elements = useElements();
3678
3685
 
@@ -3903,7 +3910,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
3903
3910
  type: "submit"
3904
3911
  }, isLoading ? React.createElement(CircularProgress, {
3905
3912
  size: 26
3906
- }) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
3913
+ }) : (paymentButtonText ? paymentButtonText : 'Pay') + " " + getCurrencySymbolByCurrency(currency) + total))));
3907
3914
  };
3908
3915
 
3909
3916
  var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
@@ -3966,7 +3973,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
3966
3973
  _ref$enableTimer = _ref.enableTimer,
3967
3974
  enableTimer = _ref$enableTimer === void 0 ? false : _ref$enableTimer,
3968
3975
  _ref$enablePaymentPla = _ref.enablePaymentPlan,
3969
- enablePaymentPlan = _ref$enablePaymentPla === void 0 ? false : _ref$enablePaymentPla;
3976
+ enablePaymentPlan = _ref$enablePaymentPla === void 0 ? false : _ref$enablePaymentPla,
3977
+ paymentButtonText = _ref.paymentButtonText;
3970
3978
 
3971
3979
  var _useState = useState(initialReviewValues),
3972
3980
  reviewData = _useState[0],
@@ -4250,7 +4258,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
4250
4258
  },
4251
4259
  conditions: conditions,
4252
4260
  stripeCardOptions: stripeCardOptions,
4253
- disableZipSection: disableZipSection
4261
+ disableZipSection: disableZipSection,
4262
+ paymentButtonText: paymentButtonText
4254
4263
  })))) : React.createElement("div", {
4255
4264
  className: "payment_button " + (paymentIsLoading ? 'disabled-payment-button' : '')
4256
4265
  }, React.createElement("button", {