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.
@@ -48,4 +48,4 @@ export interface IBillingInfoPage {
48
48
  showForgotPasswordButton?: boolean;
49
49
  showSignUpButton?: boolean;
50
50
  }
51
- export declare const BillingInfoContainer: ({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onAuthorizeSuccess, onAuthorizeError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, hideLogo, themeOptions, onErrorClose, hideErrorsAlertSection, onSkipBillingPage, skipPage, canSkipHolderNames, onForgotPasswordSuccess, onForgotPasswordError, shouldFetchCountries, onCountdownFinish, enableTimer, logo, showForgotPasswordButton, showSignUpButton }: IBillingInfoPage) => JSX.Element;
51
+ export declare const BillingInfoContainer: ({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onAuthorizeSuccess, onAuthorizeError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, hideLogo, themeOptions, onErrorClose, hideErrorsAlertSection, onSkipBillingPage, skipPage, canSkipHolderNames, onForgotPasswordSuccess, onForgotPasswordError, shouldFetchCountries, onCountdownFinish, enableTimer, logo, showForgotPasswordButton, showSignUpButton, }: IBillingInfoPage) => JSX.Element;
@@ -26,5 +26,6 @@ export interface IPaymentPage {
26
26
  onCountdownFinish?: () => void;
27
27
  enableTimer?: boolean;
28
28
  enablePaymentPlan?: boolean;
29
+ paymentButtonText?: string;
29
30
  }
30
- export declare const PaymentContainer: ({ paymentFields, handlePayment, formTitle, errorText, checkoutData, onErrorClose, onGetPaymentDataSuccess, onGetPaymentDataError, onPaymentError, stripeCardOptions, disableZipSection, themeOptions, elementsOptions, onCountdownFinish, enableTimer, enablePaymentPlan, }: IPaymentPage) => JSX.Element;
31
+ export declare const PaymentContainer: ({ paymentFields, handlePayment, formTitle, errorText, checkoutData, onErrorClose, onGetPaymentDataSuccess, onGetPaymentDataError, onPaymentError, stripeCardOptions, disableZipSection, themeOptions, elementsOptions, onCountdownFinish, enableTimer, enablePaymentPlan, paymentButtonText }: IPaymentPage) => JSX.Element;
@@ -15,6 +15,7 @@ export interface ICheckoutForm {
15
15
  handleSetLoading: (loading: any) => void;
16
16
  conditions: any;
17
17
  disableZipSection: boolean;
18
+ paymentButtonText?: string;
18
19
  }
19
- declare const CheckoutForm: ({ total, onSubmit, stripeCardOptions, error, stripe_client_secret, currency, billing_info, isLoading, handleSetLoading, conditions, disableZipSection, }: ICheckoutForm) => JSX.Element;
20
+ declare const CheckoutForm: ({ total, onSubmit, stripeCardOptions, error, stripe_client_secret, currency, billing_info, isLoading, handleSetLoading, conditions, disableZipSection, paymentButtonText }: ICheckoutForm) => JSX.Element;
20
21
  export default CheckoutForm;
@@ -1313,15 +1313,16 @@ var handleSetAccessToken = function handleSetAccessToken(token) {
1313
1313
  }
1314
1314
  };
1315
1315
  function getEvent(id) {
1316
- var referralValue = "";
1316
+ var referralValue = '';
1317
1317
 
1318
1318
  if (isWindowDefined) {
1319
1319
  var params = new URL("" + window.location);
1320
1320
  var referralId = params.searchParams.get('ttf_r') || '';
1321
1321
  var referral_key = window.localStorage.getItem('referral_key');
1322
- var referralIdlocal = "";
1322
+ var referralIdlocal = '';
1323
1323
 
1324
1324
  if (referral_key) {
1325
+ // eslint-disable-next-line prefer-destructuring
1325
1326
  referralIdlocal = referral_key.split('.')[1];
1326
1327
  }
1327
1328
 
@@ -1330,8 +1331,8 @@ function getEvent(id) {
1330
1331
 
1331
1332
  var response = publicRequest.get("v1/event/" + id, {
1332
1333
  headers: _extends({}, ttfHeaders, {
1333
- "Referer-Url": isDocumentDefined ? document.referrer : '',
1334
- "Referrer-Id": isWindowDefined ? referralValue : ''
1334
+ 'Referer-Url': isDocumentDefined ? document.referrer : '',
1335
+ 'Referrer-Id': isWindowDefined ? referralValue : ''
1335
1336
  })
1336
1337
  })["catch"](function (error) {
1337
1338
  throw error;
@@ -1351,9 +1352,10 @@ function getTickets(id, promoCode) {
1351
1352
  }
1352
1353
  var addToCart = function addToCart(id, data) {
1353
1354
  var res = publicRequest.post("v1/event/" + id + "/add-to-cart/", {
1354
- data: data,
1355
+ data: data
1356
+ }, {
1355
1357
  headers: {
1356
- "Referer-Url": isDocumentDefined ? document.referrer : ''
1358
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
1357
1359
  }
1358
1360
  });
1359
1361
  return res;
@@ -1381,7 +1383,7 @@ var register = function register(data) {
1381
1383
  var getPaymentData = function getPaymentData(hash) {
1382
1384
  var response = publicRequest.get("v1/order/" + hash + "/review/", {
1383
1385
  headers: {
1384
- "Referer-Url": isDocumentDefined ? document.referrer : ''
1386
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
1385
1387
  }
1386
1388
  })["catch"](function (error) {
1387
1389
  throw error;
@@ -1389,9 +1391,9 @@ var getPaymentData = function getPaymentData(hash) {
1389
1391
  return response;
1390
1392
  };
1391
1393
  var handlePaymentSuccess = function handlePaymentSuccess(orderHash) {
1392
- var res = publicRequest.post("v1/order/" + orderHash + "/success", {
1394
+ var res = publicRequest.post("v1/order/" + orderHash + "/success", undefined, {
1393
1395
  headers: {
1394
- "Referer-Url": isDocumentDefined ? document.referrer : ''
1396
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
1395
1397
  }
1396
1398
  })["catch"](function (error) {
1397
1399
  throw error;
@@ -1399,9 +1401,9 @@ var handlePaymentSuccess = function handlePaymentSuccess(orderHash) {
1399
1401
  return res;
1400
1402
  };
1401
1403
  var handleFreeSuccess = function handleFreeSuccess(orderHash) {
1402
- var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration", {
1404
+ var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration", undefined, {
1403
1405
  headers: {
1404
- "Referer-Url": isDocumentDefined ? document.referrer : ''
1406
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
1405
1407
  }
1406
1408
  })["catch"](function (error) {
1407
1409
  throw error;
@@ -3569,7 +3571,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3569
3571
  type: element.type,
3570
3572
  required: true,
3571
3573
  component: element.type === 'checkbox' ? CheckboxField : element.type === 'phone' ? PhoneNumberField : CustomField,
3572
- validate: combineValidators(element.required ? requiredValidator : function () {}, element.onValidate ? element.onValidate : function () {}),
3574
+ validate: combineValidators(element.required ? requiredValidator : function () {
3575
+ return props.errors[element.name + "-" + index];
3576
+ }, element.onValidate ? element.onValidate : function () {
3577
+ return props.errors[element.name + "-" + index];
3578
+ }),
3573
3579
  disableDropdown: element.disableDropdown
3574
3580
  }));
3575
3581
  })));
@@ -3674,7 +3680,8 @@ var CheckoutForm = function CheckoutForm(_ref) {
3674
3680
  handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
3675
3681
  _ref$conditions = _ref.conditions,
3676
3682
  conditions = _ref$conditions === void 0 ? [] : _ref$conditions,
3677
- disableZipSection = _ref.disableZipSection;
3683
+ disableZipSection = _ref.disableZipSection,
3684
+ paymentButtonText = _ref.paymentButtonText;
3678
3685
  var stripe = reactStripeJs.useStripe();
3679
3686
  var elements = reactStripeJs.useElements();
3680
3687
 
@@ -3905,7 +3912,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
3905
3912
  type: "submit"
3906
3913
  }, isLoading ? React__default.createElement(CircularProgress, {
3907
3914
  size: 26
3908
- }) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
3915
+ }) : (paymentButtonText ? paymentButtonText : 'Pay') + " " + getCurrencySymbolByCurrency(currency) + total))));
3909
3916
  };
3910
3917
 
3911
3918
  var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
@@ -3968,7 +3975,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
3968
3975
  _ref$enableTimer = _ref.enableTimer,
3969
3976
  enableTimer = _ref$enableTimer === void 0 ? false : _ref$enableTimer,
3970
3977
  _ref$enablePaymentPla = _ref.enablePaymentPlan,
3971
- enablePaymentPlan = _ref$enablePaymentPla === void 0 ? false : _ref$enablePaymentPla;
3978
+ enablePaymentPlan = _ref$enablePaymentPla === void 0 ? false : _ref$enablePaymentPla,
3979
+ paymentButtonText = _ref.paymentButtonText;
3972
3980
 
3973
3981
  var _useState = React.useState(initialReviewValues),
3974
3982
  reviewData = _useState[0],
@@ -4252,7 +4260,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
4252
4260
  },
4253
4261
  conditions: conditions,
4254
4262
  stripeCardOptions: stripeCardOptions,
4255
- disableZipSection: disableZipSection
4263
+ disableZipSection: disableZipSection,
4264
+ paymentButtonText: paymentButtonText
4256
4265
  })))) : React__default.createElement("div", {
4257
4266
  className: "payment_button " + (paymentIsLoading ? 'disabled-payment-button' : '')
4258
4267
  }, React__default.createElement("button", {