@thecb/components 10.6.6-beta.0 → 10.6.6-beta.1
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 +3 -23
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3 -23
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +3 -10
- package/src/components/molecules/payment-form-card/PaymentFormCard.stories.js +7 -2
- package/src/util/general.js +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -6296,7 +6296,7 @@ var displayCardBrand = function displayCardBrand(number) {
|
|
|
6296
6296
|
return "Mastercard";
|
|
6297
6297
|
} else if (/^4/.test(number)) {
|
|
6298
6298
|
return "Visa";
|
|
6299
|
-
} else if (/^3[4,7]
|
|
6299
|
+
} else if (/^3[4,7]\d{13}$/.test(number)) {
|
|
6300
6300
|
return "American Express";
|
|
6301
6301
|
} else return "Unknown Card";
|
|
6302
6302
|
};
|
|
@@ -40372,21 +40372,6 @@ validatorFns[VALID_NAME] = (value, args, form) =>
|
|
|
40372
40372
|
? false
|
|
40373
40373
|
: new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
|
|
40374
40374
|
|
|
40375
|
-
const IS_NOT_AMEX_CARD = 'validator/IS_NOT_AMEX_CARD';
|
|
40376
|
-
const IS_NOT_AMEX_CARD_ERROR = 'validator/IS_NOT_AMEX_CARD_ERROR';
|
|
40377
|
-
const isNotAmExCard = createValidator(
|
|
40378
|
-
IS_NOT_AMEX_CARD,
|
|
40379
|
-
IS_NOT_AMEX_CARD_ERROR
|
|
40380
|
-
);
|
|
40381
|
-
/* This regular expression looks for values not starting with 34 or 37, and
|
|
40382
|
-
* reflects that the shortest credit card number we will see is 8 digits,
|
|
40383
|
-
* while the longest we'd see is 19 digits according to ansi.org. We want to
|
|
40384
|
-
* allow any number with a length in that range that is not an AmEx Card.
|
|
40385
|
-
* Source: https://www.ansi.org/standards-news/all-news/2016/07/announcing-major-changes-to-the-issuer-identification-number-iin-standard-28
|
|
40386
|
-
*/
|
|
40387
|
-
validatorFns[IS_NOT_AMEX_CARD] = (value, args, form) =>
|
|
40388
|
-
new RegExp(/^([^3]\d{7,18}|3[^47]\d{6,17})$/).test(value);
|
|
40389
|
-
|
|
40390
40375
|
const runValidatorErrorMessage = (type) =>
|
|
40391
40376
|
`${type} was passed to runValidator, but that validator type does not exist.
|
|
40392
40377
|
Please check that you are only calling validator creator functions exported from
|
|
@@ -49539,9 +49524,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49539
49524
|
saveToWallet = _ref.saveToWallet,
|
|
49540
49525
|
walletCheckboxMarked = _ref.walletCheckboxMarked,
|
|
49541
49526
|
deniedCards = _ref.deniedCards,
|
|
49542
|
-
termsContent = _ref.termsContent
|
|
49543
|
-
_ref$allowAmExCards = _ref.allowAmExCards,
|
|
49544
|
-
allowAmExCards = _ref$allowAmExCards === void 0 ? true : _ref$allowAmExCards;
|
|
49527
|
+
termsContent = _ref.termsContent;
|
|
49545
49528
|
var _useContext = useContext(ThemeContext),
|
|
49546
49529
|
isMobile = _useContext.isMobile;
|
|
49547
49530
|
var showTerms = !!termsContent;
|
|
@@ -49551,9 +49534,6 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49551
49534
|
return actions.fields.creditCardNumber.addValidator(matchesRegex(checkDeniedCards(card)));
|
|
49552
49535
|
});
|
|
49553
49536
|
}
|
|
49554
|
-
if (!allowAmExCards) {
|
|
49555
|
-
actions.fields.creditCardNumber.addValidator(isNotAmExCard());
|
|
49556
|
-
}
|
|
49557
49537
|
}, []);
|
|
49558
49538
|
useEffect$1(function () {
|
|
49559
49539
|
if (clearOnDismount) {
|
|
@@ -49563,7 +49543,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49563
49543
|
}
|
|
49564
49544
|
}, []);
|
|
49565
49545
|
var nameOnCardErrors = _defineProperty({}, required.error, "Name is required");
|
|
49566
|
-
var creditCardNumberErrors = _defineProperty(_defineProperty(_defineProperty(
|
|
49546
|
+
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), " cards are not available for payment"));
|
|
49567
49547
|
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");
|
|
49568
49548
|
var cvvErrors = _defineProperty(_defineProperty({}, required.error, "CVV is required"), hasLength.error, "CVV is invalid");
|
|
49569
49549
|
var zipCodeErrors = _defineProperty(_defineProperty({}, required.error, "Zip code is required"), hasLength.error, "Zip code is invalid");
|