tf-checkout-react 1.2.1 → 1.2.4

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;
@@ -7,5 +7,5 @@ export interface ICheckboxField {
7
7
  interface IOtherProps {
8
8
  [key: string]: any;
9
9
  }
10
- export declare const CheckboxField: ({ label, field, selectOptions, theme, setFieldValue, ...rest }: ICheckboxField & IOtherProps) => JSX.Element;
10
+ export declare const CheckboxField: ({ label, field, selectOptions, theme, setFieldValue, disableDropdown, ...rest }: ICheckboxField & IOtherProps) => JSX.Element;
11
11
  export {};
@@ -5,5 +5,6 @@ export interface IPhoneNumberField {
5
5
  field: FieldInputProps<any>;
6
6
  form: FormikProps<any>;
7
7
  type: string;
8
+ disableDropdown: boolean;
8
9
  }
9
- export declare const PhoneNumberField: ({ label, type, field, form: { errors, setFieldError, setStatus }, }: IPhoneNumberField) => JSX.Element;
10
+ export declare const PhoneNumberField: ({ label, field, form: { errors, touched, setFieldError, setStatus, initialValues, setFieldValue }, disableDropdown }: IPhoneNumberField) => JSX.Element;
@@ -7,5 +7,5 @@ export interface IRadioField {
7
7
  interface IOtherProps {
8
8
  [key: string]: any;
9
9
  }
10
- export declare const RadioField: ({ label, field, theme, ...rest }: IRadioField & IOtherProps) => JSX.Element;
10
+ export declare const RadioField: ({ label, field, theme, disableDropdown, ...rest }: IRadioField & IOtherProps) => JSX.Element;
11
11
  export {};
@@ -1,5 +1,5 @@
1
1
  declare const tableConfig: (key?: string | undefined) => {
2
- header: never[];
2
+ header: string[];
3
3
  body: ((row: any) => any)[];
4
4
  };
5
5
  export default tableConfig;
@@ -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;
@@ -28,7 +28,7 @@ var styles$1 = require('@mui/styles');
28
28
  var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
29
29
  var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
30
30
  var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
31
- require('material-ui-phone-number');
31
+ var MuiPhoneNumber = _interopDefault(require('material-ui-phone-number'));
32
32
  var _debounce = _interopDefault(require('lodash/debounce'));
33
33
  var CircularProgress = _interopDefault(require('@mui/material/CircularProgress'));
34
34
  var Select = _interopDefault(require('@mui/material/Select'));
@@ -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;
@@ -1653,7 +1655,7 @@ var DatePickerField = function DatePickerField(_ref) {
1653
1655
  })));
1654
1656
  };
1655
1657
 
1656
- var _excluded = ["label", "field", "selectOptions", "theme", "setFieldValue"];
1658
+ var _excluded = ["label", "field", "selectOptions", "theme", "setFieldValue", "disableDropdown"];
1657
1659
  var CheckboxField = function CheckboxField(_ref) {
1658
1660
  var _rest$form, _field$name, _rest$form2, _field$name2;
1659
1661
 
@@ -1739,19 +1741,30 @@ var getCurrencySymbolByCurrency = function getCurrencySymbolByCurrency(currency)
1739
1741
  return 'US$';
1740
1742
  }
1741
1743
  };
1744
+ var removePlusSign = function removePlusSign(string) {
1745
+ if (string === void 0) {
1746
+ string = '';
1747
+ }
1748
+
1749
+ return string.replace('+', '');
1750
+ };
1742
1751
 
1743
1752
  var PhoneNumberField = function PhoneNumberField(_ref) {
1744
1753
  var label = _ref.label,
1745
- _ref$type = _ref.type,
1746
- type = _ref$type === void 0 ? 'text' : _ref$type,
1747
1754
  field = _ref.field,
1748
1755
  _ref$form = _ref.form,
1749
1756
  errors = _ref$form.errors,
1757
+ touched = _ref$form.touched,
1750
1758
  setFieldError = _ref$form.setFieldError,
1751
- setStatus = _ref$form.setStatus;
1759
+ setStatus = _ref$form.setStatus,
1760
+ initialValues = _ref$form.initialValues,
1761
+ setFieldValue = _ref$form.setFieldValue,
1762
+ _ref$disableDropdown = _ref.disableDropdown,
1763
+ disableDropdown = _ref$disableDropdown === void 0 ? true : _ref$disableDropdown;
1752
1764
 
1753
- var error = _get(errors, field.name); // eslint-disable-next-line react-hooks/exhaustive-deps
1765
+ var error = _get(errors, field.name);
1754
1766
 
1767
+ var isTouched = Boolean(_get(touched, field.name)); // eslint-disable-next-line react-hooks/exhaustive-deps
1755
1768
 
1756
1769
  var debounceCb = React.useCallback(_debounce(function (cb) {
1757
1770
  return void cb();
@@ -1804,15 +1817,21 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1804
1817
  }, _callee, null, [[0, 7, 11, 14]]);
1805
1818
  }))); // eslint-disable-next-line
1806
1819
  }, [field.value]);
1807
- return React__default.createElement(TextField, Object.assign({}, field, {
1808
- id: field.name,
1820
+ return React__default.createElement(MuiPhoneNumber, {
1821
+ name: field.name,
1822
+ value: initialValues.phone,
1823
+ onChange: function onChange(e) {
1824
+ return setFieldValue(field.name, removePlusSign(e));
1825
+ },
1826
+ variant: "outlined",
1827
+ defaultCountry: 'us',
1828
+ disableDropdown: disableDropdown,
1809
1829
  label: label,
1810
- type: type,
1830
+ error: !!error && isTouched,
1831
+ helperText: isTouched && error,
1811
1832
  fullWidth: true,
1812
- error: !!error,
1813
- helperText: error,
1814
- value: field.value || ''
1815
- }));
1833
+ autoFormat: false
1834
+ });
1816
1835
  };
1817
1836
 
1818
1837
  function Loader() {
@@ -3525,7 +3544,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3525
3544
  onBlur: props.handleBlur,
3526
3545
  component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : element.type === 'phone' ? PhoneNumberField : element.type === 'date' ? DatePickerField : CustomField,
3527
3546
  selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
3528
- theme: theme
3547
+ theme: theme,
3548
+ disableDropdown: element.disableDropdown
3529
3549
  })));
3530
3550
  })));
3531
3551
  }));
@@ -3551,7 +3571,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3551
3571
  type: element.type,
3552
3572
  required: true,
3553
3573
  component: element.type === 'checkbox' ? CheckboxField : element.type === 'phone' ? PhoneNumberField : CustomField,
3554
- 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
+ }),
3579
+ disableDropdown: element.disableDropdown
3555
3580
  }));
3556
3581
  })));
3557
3582
  }));
@@ -3655,7 +3680,8 @@ var CheckoutForm = function CheckoutForm(_ref) {
3655
3680
  handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
3656
3681
  _ref$conditions = _ref.conditions,
3657
3682
  conditions = _ref$conditions === void 0 ? [] : _ref$conditions,
3658
- disableZipSection = _ref.disableZipSection;
3683
+ disableZipSection = _ref.disableZipSection,
3684
+ paymentButtonText = _ref.paymentButtonText;
3659
3685
  var stripe = reactStripeJs.useStripe();
3660
3686
  var elements = reactStripeJs.useElements();
3661
3687
 
@@ -3886,7 +3912,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
3886
3912
  type: "submit"
3887
3913
  }, isLoading ? React__default.createElement(CircularProgress, {
3888
3914
  size: 26
3889
- }) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
3915
+ }) : (paymentButtonText ? paymentButtonText : 'Pay') + " " + getCurrencySymbolByCurrency(currency) + total))));
3890
3916
  };
3891
3917
 
3892
3918
  var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
@@ -3949,7 +3975,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
3949
3975
  _ref$enableTimer = _ref.enableTimer,
3950
3976
  enableTimer = _ref$enableTimer === void 0 ? false : _ref$enableTimer,
3951
3977
  _ref$enablePaymentPla = _ref.enablePaymentPlan,
3952
- enablePaymentPlan = _ref$enablePaymentPla === void 0 ? false : _ref$enablePaymentPla;
3978
+ enablePaymentPlan = _ref$enablePaymentPla === void 0 ? false : _ref$enablePaymentPla,
3979
+ paymentButtonText = _ref.paymentButtonText;
3953
3980
 
3954
3981
  var _useState = React.useState(initialReviewValues),
3955
3982
  reviewData = _useState[0],
@@ -4233,7 +4260,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
4233
4260
  },
4234
4261
  conditions: conditions,
4235
4262
  stripeCardOptions: stripeCardOptions,
4236
- disableZipSection: disableZipSection
4263
+ disableZipSection: disableZipSection,
4264
+ paymentButtonText: paymentButtonText
4237
4265
  })))) : React__default.createElement("div", {
4238
4266
  className: "payment_button " + (paymentIsLoading ? 'disabled-payment-button' : '')
4239
4267
  }, React__default.createElement("button", {
@@ -5657,7 +5685,7 @@ var EventInfoItem = function EventInfoItem(_ref) {
5657
5685
  var image = _ref.image,
5658
5686
  name = _ref.name;
5659
5687
  return React__default.createElement("div", {
5660
- className: 'event-info'
5688
+ className: "event-info"
5661
5689
  }, React__default.createElement("img", {
5662
5690
  src: image,
5663
5691
  alt: "event"
@@ -5670,8 +5698,10 @@ var tableConfig = function tableConfig(key) {
5670
5698
  switch (key) {
5671
5699
  default:
5672
5700
  config = {
5673
- header: [],
5701
+ header: ['Order No.', 'Date', 'Event', 'Total'],
5674
5702
  body: [function (row) {
5703
+ return row.id;
5704
+ }, function (row) {
5675
5705
  return row.date;
5676
5706
  }, function (row) {
5677
5707
  return React__default.createElement(EventInfoItem, {
@@ -5846,9 +5876,7 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
5846
5876
  },
5847
5877
  userExpired: userExpired,
5848
5878
  logo: logo
5849
- })), data && React__default.createElement(React__default.Fragment, null, React__default.createElement("h2", null, "My Ticket Orders"), React__default.createElement("div", {
5850
- className: "order_event"
5851
- }, React__default.createElement(Autocomplete, {
5879
+ })), data && React__default.createElement(React__default.Fragment, null, React__default.createElement("h2", null, "My Ticket Orders"), React__default.createElement(Autocomplete, {
5852
5880
  disablePortal: true,
5853
5881
  id: "combo-box-demo",
5854
5882
  getOptionLabel: function getOptionLabel(option) {
@@ -5864,10 +5892,7 @@ var MyTicketsContainer = function MyTicketsContainer(_ref) {
5864
5892
  label: "Events"
5865
5893
  }));
5866
5894
  }
5867
- }), React__default.createElement("button", {
5868
- type: "button",
5869
- className: "clear"
5870
- }, "CLEAR")), loading ? React__default.createElement("div", {
5895
+ }), loading ? React__default.createElement("div", {
5871
5896
  className: "loading"
5872
5897
  }, React__default.createElement(CircularProgress, null)) : React__default.createElement(React__default.Fragment, null, React__default.createElement(TableContainer, {
5873
5898
  component: Paper,
@@ -6020,7 +6045,7 @@ var TicketsTable = function TicketsTable(_ref) {
6020
6045
  })))));
6021
6046
  };
6022
6047
 
6023
- var _excluded$2 = ["label", "field", "theme"];
6048
+ var _excluded$2 = ["label", "field", "theme", "disableDropdown"];
6024
6049
  var RadioField = function RadioField(_ref) {
6025
6050
  var label = _ref.label,
6026
6051
  field = _ref.field,