@thecb/components 10.6.5-beta.0 → 10.6.6-beta.0

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.
package/dist/index.cjs.js CHANGED
@@ -39730,9 +39730,7 @@ var WalletName = function WalletName(_ref) {
39730
39730
  _ref$linkButtonExtraS = _ref.linkButtonExtraStyles,
39731
39731
  linkButtonExtraStyles = _ref$linkButtonExtraS === void 0 ? "" : _ref$linkButtonExtraS,
39732
39732
  _ref$isLoading = _ref.isLoading,
39733
- isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
39734
- _ref$dataQa = _ref.dataQa,
39735
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
39733
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
39736
39734
  var _useContext = React.useContext(styled.ThemeContext),
39737
39735
  isMobile = _useContext.isMobile;
39738
39736
  return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Module$1, {
@@ -39762,7 +39760,6 @@ var WalletName = function WalletName(_ref) {
39762
39760
  }, text), (text || actionText) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\xA0"), action && actionText && /*#__PURE__*/React__default.createElement(ButtonWithAction, {
39763
39761
  disabled: disableAction,
39764
39762
  text: actionText,
39765
- dataQa: dataQa,
39766
39763
  action: action,
39767
39764
  variant: "smallGhost",
39768
39765
  extraStyles: "\n margin: 0;\n min-width: 0;\n span {font-size: 0.75rem;}\n ".concat(linkButtonExtraStyles, "\n ")
@@ -40383,6 +40380,21 @@ validatorFns[VALID_NAME] = (value, args, form) =>
40383
40380
  ? false
40384
40381
  : new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
40385
40382
 
40383
+ const IS_NOT_AMEX_CARD = 'validator/IS_NOT_AMEX_CARD';
40384
+ const IS_NOT_AMEX_CARD_ERROR = 'validator/IS_NOT_AMEX_CARD_ERROR';
40385
+ const isNotAmExCard = createValidator(
40386
+ IS_NOT_AMEX_CARD,
40387
+ IS_NOT_AMEX_CARD_ERROR
40388
+ );
40389
+ /* This regular expression looks for values not starting with 34 or 37, and
40390
+ * reflects that the shortest credit card number we will see is 8 digits,
40391
+ * while the longest we'd see is 19 digits according to ansi.org. We want to
40392
+ * allow any number with a length in that range that is not an AmEx Card.
40393
+ * Source: https://www.ansi.org/standards-news/all-news/2016/07/announcing-major-changes-to-the-issuer-identification-number-iin-standard-28
40394
+ */
40395
+ validatorFns[IS_NOT_AMEX_CARD] = (value, args, form) =>
40396
+ new RegExp(/^([^3]\d{7,18}|3[^47]\d{6,17})$/).test(value);
40397
+
40386
40398
  const runValidatorErrorMessage = (type) =>
40387
40399
  `${type} was passed to runValidator, but that validator type does not exist.
40388
40400
  Please check that you are only calling validator creator functions exported from
@@ -49535,7 +49547,9 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
49535
49547
  saveToWallet = _ref.saveToWallet,
49536
49548
  walletCheckboxMarked = _ref.walletCheckboxMarked,
49537
49549
  deniedCards = _ref.deniedCards,
49538
- termsContent = _ref.termsContent;
49550
+ termsContent = _ref.termsContent,
49551
+ _ref$allowAmExCards = _ref.allowAmExCards,
49552
+ allowAmExCards = _ref$allowAmExCards === void 0 ? true : _ref$allowAmExCards;
49539
49553
  var _useContext = React.useContext(styled.ThemeContext),
49540
49554
  isMobile = _useContext.isMobile;
49541
49555
  var showTerms = !!termsContent;
@@ -49545,6 +49559,9 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
49545
49559
  return actions.fields.creditCardNumber.addValidator(matchesRegex(checkDeniedCards(card)));
49546
49560
  });
49547
49561
  }
49562
+ if (!allowAmExCards) {
49563
+ actions.fields.creditCardNumber.addValidator(isNotAmExCard());
49564
+ }
49548
49565
  }, []);
49549
49566
  React.useEffect(function () {
49550
49567
  if (clearOnDismount) {
@@ -49554,7 +49571,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
49554
49571
  }
49555
49572
  }, []);
49556
49573
  var nameOnCardErrors = _defineProperty({}, required.error, "Name is required");
49557
- var creditCardNumberErrors = _defineProperty(_defineProperty(_defineProperty({}, required.error, "Credit card number is required"), hasLength.error, "Credit card number is invalid"), matchesRegex.error, "".concat(displayCardBrand(fields.creditCardNumber.rawValue), " is not accepted"));
49574
+ var creditCardNumberErrors = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, required.error, "Credit card number is required"), hasLength.error, "Credit card number is invalid"), isNotAmExCard.error, "American Express cards are not available for payment."), matchesRegex.error, "".concat(displayCardBrand(fields.creditCardNumber.rawValue), " is not accepted"));
49558
49575
  var expirationDateErrors = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, required.error, "Expiration date is required"), hasLength.error, "Expiration date is invalid"), isValidMonth.error, "Expiration month is invalid"), dateAfterToday.error, "Expiration date is invalid");
49559
49576
  var cvvErrors = _defineProperty(_defineProperty({}, required.error, "CVV is required"), hasLength.error, "CVV is invalid");
49560
49577
  var zipCodeErrors = _defineProperty(_defineProperty({}, required.error, "Zip code is required"), hasLength.error, "Zip code is invalid");