tf-checkout-react 1.2.9 → 1.2.12

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.
@@ -33,8 +33,8 @@ import _isNumber from 'lodash-es/isNumber';
33
33
  import SVG from 'react-inlinesvg';
34
34
  import _flatMapDeep from 'lodash-es/flatMapDeep';
35
35
  import _isArray from 'lodash-es/isArray';
36
- import Container from '@mui/material/Container';
37
36
  import Alert$1 from '@mui/material/Alert';
37
+ import Container from '@mui/material/Container';
38
38
  import { useStripe, useElements, CardNumberElement, CardExpiryElement, CardCvcElement, Elements } from '@stripe/react-stripe-js';
39
39
  import { loadStripe } from '@stripe/stripe-js';
40
40
  import { FacebookShareButton, FacebookIcon, FacebookMessengerShareButton, FacebookMessengerIcon, TwitterShareButton, TwitterIcon, LinkedinShareButton, LinkedinIcon, PinterestShareButton, PinterestIcon, VKShareButton, VKIcon, OKShareButton, OKIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, RedditShareButton, RedditIcon, TumblrShareButton, TumblrIcon, MailruShareButton, MailruIcon, EmailShareButton, EmailIcon, LivejournalShareButton, LivejournalIcon, ViberShareButton, ViberIcon, WorkplaceShareButton, WorkplaceIcon, LineShareButton, LineIcon, PocketShareButton, PocketIcon, InstapaperShareButton, InstapaperIcon, WeiboShareButton, WeiboIcon, HatenaShareButton, HatenaIcon } from 'react-share';
@@ -1679,6 +1679,7 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1679
1679
  values = _ref$form.values,
1680
1680
  initialValues = _ref$form.initialValues,
1681
1681
  setFieldValue = _ref$form.setFieldValue,
1682
+ setFieldTouched = _ref$form.setFieldTouched,
1682
1683
  _ref$disableDropdown = _ref.disableDropdown,
1683
1684
  disableDropdown = _ref$disableDropdown === void 0 ? true : _ref$disableDropdown,
1684
1685
  _ref$fill = _ref.fill,
@@ -1692,6 +1693,12 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1692
1693
  return void cb();
1693
1694
  }, 1000), []);
1694
1695
  useEffect(function () {
1696
+ if (field.value === '+') {
1697
+ setFieldError(field.name, '');
1698
+ setFieldTouched(field.name, false);
1699
+ return;
1700
+ }
1701
+
1695
1702
  if (field.value) {
1696
1703
  var _setStatus;
1697
1704
 
@@ -1717,33 +1724,35 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1717
1724
 
1718
1725
  case 4:
1719
1726
  setFieldError(field.name, '');
1720
- _context.next = 11;
1727
+ setFieldTouched(field.name, false);
1728
+ _context.next = 12;
1721
1729
  break;
1722
1730
 
1723
- case 7:
1724
- _context.prev = 7;
1731
+ case 8:
1732
+ _context.prev = 8;
1725
1733
  _context.t0 = _context["catch"](0);
1726
1734
  message = _get(_context.t0, 'response.data.message', 'Invalid phone number');
1727
1735
  setFieldError(field.name, message);
1728
1736
 
1729
- case 11:
1730
- _context.prev = 11;
1737
+ case 12:
1738
+ _context.prev = 12;
1731
1739
  setStatus((_setStatus2 = {}, _setStatus2[field.name] = false, _setStatus2));
1732
- return _context.finish(11);
1740
+ return _context.finish(12);
1733
1741
 
1734
- case 14:
1742
+ case 15:
1735
1743
  case "end":
1736
1744
  return _context.stop();
1737
1745
  }
1738
1746
  }
1739
- }, _callee, null, [[0, 7, 11, 14]]);
1747
+ }, _callee, null, [[0, 8, 12, 15]]);
1740
1748
  }))); // eslint-disable-next-line
1741
1749
  }, [field.value]);
1742
1750
  return React.createElement(MuiPhoneNumber, {
1743
1751
  name: field.name,
1744
1752
  value: fill ? values.phone : initialValues.phone,
1745
1753
  onChange: function onChange(e) {
1746
- return setFieldValue(field.name, e);
1754
+ setFieldTouched(field.name, true);
1755
+ setFieldValue(field.name, e);
1747
1756
  },
1748
1757
  variant: "outlined",
1749
1758
  defaultCountry: "us",
@@ -3498,7 +3507,6 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
3498
3507
  name: element.name + "-" + index,
3499
3508
  label: element.label,
3500
3509
  type: element.type,
3501
- required: true,
3502
3510
  component: element.type === 'checkbox' ? CheckboxField : element.type === 'phone' ? PhoneNumberField : CustomField,
3503
3511
  validate: combineValidators(element.required ? requiredValidator : function () {
3504
3512
  return props.errors[element.name + "-" + index];
@@ -3955,11 +3963,11 @@ var PaymentContainer = function PaymentContainer(_ref) {
3955
3963
  _ref$onErrorClose = _ref.onErrorClose,
3956
3964
  onErrorClose = _ref$onErrorClose === void 0 ? _identity : _ref$onErrorClose,
3957
3965
  _ref$onGetPaymentData = _ref.onGetPaymentDataSuccess,
3958
- onGetPaymentDataSuccess = _ref$onGetPaymentData === void 0 ? function () {} : _ref$onGetPaymentData,
3966
+ onGetPaymentDataSuccess = _ref$onGetPaymentData === void 0 ? _identity : _ref$onGetPaymentData,
3959
3967
  _ref$onGetPaymentData2 = _ref.onGetPaymentDataError,
3960
- onGetPaymentDataError = _ref$onGetPaymentData2 === void 0 ? function () {} : _ref$onGetPaymentData2,
3968
+ onGetPaymentDataError = _ref$onGetPaymentData2 === void 0 ? _identity : _ref$onGetPaymentData2,
3961
3969
  _ref$onPaymentError = _ref.onPaymentError,
3962
- onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError,
3970
+ onPaymentError = _ref$onPaymentError === void 0 ? _identity : _ref$onPaymentError,
3963
3971
  _ref$stripeCardOption = _ref.stripeCardOptions,
3964
3972
  stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption,
3965
3973
  _ref$disableZipSectio = _ref.disableZipSection,
@@ -3967,7 +3975,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
3967
3975
  themeOptions = _ref.themeOptions,
3968
3976
  elementsOptions = _ref.elementsOptions,
3969
3977
  _ref$onCountdownFinis = _ref.onCountdownFinish,
3970
- onCountdownFinish = _ref$onCountdownFinis === void 0 ? function () {} : _ref$onCountdownFinis,
3978
+ onCountdownFinish = _ref$onCountdownFinis === void 0 ? _identity : _ref$onCountdownFinis,
3971
3979
  _ref$enableTimer = _ref.enableTimer,
3972
3980
  enableTimer = _ref$enableTimer === void 0 ? false : _ref$enableTimer,
3973
3981
  _ref$enablePaymentPla = _ref.enablePaymentPlan,
@@ -4007,6 +4015,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4007
4015
  var eventId = getQueryVariable('event_id');
4008
4016
  var hash = checkoutData.hash,
4009
4017
  total = checkoutData.total;
4018
+ var isFreeTickets = !Number(total) && !Number(orderData.total);
4010
4019
  useEffect(function () {
4011
4020
  _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
4012
4021
  var response, _cart$, attributes, cart, order_details, _order_details$ticket, ticket, _orderData;
@@ -4127,7 +4136,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4127
4136
  case 3:
4128
4137
  order_hash = reviewData.order_details.order_hash;
4129
4138
 
4130
- if (!(total === '0.00')) {
4139
+ if (!isFreeTickets) {
4131
4140
  _context3.next = 10;
4132
4141
  break;
4133
4142
  }
@@ -4234,7 +4243,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4234
4243
  className: "plan_block"
4235
4244
  }, React.createElement("h3", null, "Mbrand Payment Plan Terms"), React.createElement("p", null, "By clicking on the \u201CConfirm Payment Plan\u201D button, you are starting your payment plan of 2 payments of $115.00, which will be drawn from your account every 2 weeks, with the first payment taken later today."), React.createElement("p", null, "This includes a non-refundable admin fee of $3.00 per payment."), React.createElement("p", {
4236
4245
  className: "payment_note"
4237
- }, "NOTE: If today\u2019s payment fails, your payment plan will not activate, and your tickets will not be issued until you complete your final payment."), React.createElement("p", null, "If you do not complete your payements, your order will be canceled. Your first payment of $115.00, plus the non-refundable admin fee of $3.00 will not be refunded."), React.createElement("p", null, "Your payment will proceed with the card ending in **** 4242."))), total !== '0.00' ? React.createElement("div", {
4246
+ }, "NOTE: If today\u2019s payment fails, your payment plan will not activate, and your tickets will not be issued until you complete your final payment."), React.createElement("p", null, "If you do not complete your payements, your order will be canceled. Your first payment of $115.00, plus the non-refundable admin fee of $3.00 will not be refunded."), React.createElement("p", null, "Your payment will proceed with the card ending in **** 4242."))), !isFreeTickets ? React.createElement("div", {
4238
4247
  className: "payment_info"
4239
4248
  }, React.createElement("div", {
4240
4249
  className: "payment_info_label"