tf-checkout-react 1.2.17 → 1.2.18

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.
@@ -1682,7 +1682,8 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1682
1682
  _ref$disableDropdown = _ref.disableDropdown,
1683
1683
  disableDropdown = _ref$disableDropdown === void 0 ? true : _ref$disableDropdown,
1684
1684
  _ref$fill = _ref.fill,
1685
- fill = _ref$fill === void 0 ? false : _ref$fill;
1685
+ fill = _ref$fill === void 0 ? false : _ref$fill,
1686
+ setPhoneValidationIsLoading = _ref.setPhoneValidationIsLoading;
1686
1687
 
1687
1688
  var error = _get(errors, field.name);
1688
1689
 
@@ -1692,11 +1693,8 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1692
1693
  return void cb();
1693
1694
  }, 1000), []);
1694
1695
  useEffect(function () {
1695
- if (field.value === '+') {
1696
- setFieldError(field.name, '');
1697
- setFieldTouched(field.name, false);
1698
- setFieldValue(field.name, '');
1699
- return;
1696
+ if (field.value) {
1697
+ setPhoneValidationIsLoading(true);
1700
1698
  }
1701
1699
 
1702
1700
  debounceCb( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -1730,11 +1728,16 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
1730
1728
  }
1731
1729
 
1732
1730
  case 11:
1731
+ _context.prev = 11;
1732
+ setPhoneValidationIsLoading(false);
1733
+ return _context.finish(11);
1734
+
1735
+ case 14:
1733
1736
  case "end":
1734
1737
  return _context.stop();
1735
1738
  }
1736
1739
  }
1737
- }, _callee, null, [[0, 7]]);
1740
+ }, _callee, null, [[0, 7, 11, 14]]);
1738
1741
  }))); // eslint-disable-next-line
1739
1742
  }, [field.value]);
1740
1743
  return React.createElement(React.Fragment, null, React.createElement(MuiPhoneNumber, {
@@ -2909,6 +2912,10 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
2909
2912
  error = _useState14[0],
2910
2913
  setError = _useState14[1];
2911
2914
 
2915
+ var _useState15 = useState(false),
2916
+ phoneValidationIsLoading = _useState15[0],
2917
+ setPhoneValidationIsLoading = _useState15[1];
2918
+
2912
2919
  var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
2913
2920
 
2914
2921
  var firstNameLogged = _get(userData, 'first_name', '') || _get(userValues, 'first_name', '');
@@ -3511,7 +3518,8 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3511
3518
  }, element.onValidate ? element.onValidate : function () {
3512
3519
  return props.errors[element.name + "-" + index];
3513
3520
  }),
3514
- disableDropdown: element.disableDropdown
3521
+ disableDropdown: element.disableDropdown,
3522
+ setPhoneValidationIsLoading: setPhoneValidationIsLoading
3515
3523
  }));
3516
3524
  })));
3517
3525
  }));
@@ -3521,7 +3529,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3521
3529
  type: "submit",
3522
3530
  variant: "contained",
3523
3531
  className: "login-register-button",
3524
- disabled: props.isSubmitting
3532
+ disabled: props.isSubmitting || phoneValidationIsLoading
3525
3533
  }, props.isSubmitting ? React.createElement(CircularProgress$1, {
3526
3534
  size: 26
3527
3535
  }) : buttonName))));