@thecb/components 10.6.6-beta.0 → 10.6.6-beta.2
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 +4 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4 -24
- 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 +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -6304,9 +6304,9 @@ var displayCardBrand = function displayCardBrand(number) {
|
|
|
6304
6304
|
return "Mastercard";
|
|
6305
6305
|
} else if (/^4/.test(number)) {
|
|
6306
6306
|
return "Visa";
|
|
6307
|
-
} else if (/^3[4,7]
|
|
6307
|
+
} else if (/^3[4,7]\d{13}$/.test(number)) {
|
|
6308
6308
|
return "American Express";
|
|
6309
|
-
} else return "Unknown
|
|
6309
|
+
} else return "Unknown";
|
|
6310
6310
|
};
|
|
6311
6311
|
var checkDeniedCards = function checkDeniedCards(name) {
|
|
6312
6312
|
switch (name) {
|
|
@@ -40380,21 +40380,6 @@ validatorFns[VALID_NAME] = (value, args, form) =>
|
|
|
40380
40380
|
? false
|
|
40381
40381
|
: new RegExp(/[A-zÀ-ÿ\-,'\S]+(\s?[A-zÀ-ÿ\-,'\S])*/).test(value);
|
|
40382
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
|
-
|
|
40398
40383
|
const runValidatorErrorMessage = (type) =>
|
|
40399
40384
|
`${type} was passed to runValidator, but that validator type does not exist.
|
|
40400
40385
|
Please check that you are only calling validator creator functions exported from
|
|
@@ -49547,9 +49532,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49547
49532
|
saveToWallet = _ref.saveToWallet,
|
|
49548
49533
|
walletCheckboxMarked = _ref.walletCheckboxMarked,
|
|
49549
49534
|
deniedCards = _ref.deniedCards,
|
|
49550
|
-
termsContent = _ref.termsContent
|
|
49551
|
-
_ref$allowAmExCards = _ref.allowAmExCards,
|
|
49552
|
-
allowAmExCards = _ref$allowAmExCards === void 0 ? true : _ref$allowAmExCards;
|
|
49535
|
+
termsContent = _ref.termsContent;
|
|
49553
49536
|
var _useContext = React.useContext(styled.ThemeContext),
|
|
49554
49537
|
isMobile = _useContext.isMobile;
|
|
49555
49538
|
var showTerms = !!termsContent;
|
|
@@ -49559,9 +49542,6 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49559
49542
|
return actions.fields.creditCardNumber.addValidator(matchesRegex(checkDeniedCards(card)));
|
|
49560
49543
|
});
|
|
49561
49544
|
}
|
|
49562
|
-
if (!allowAmExCards) {
|
|
49563
|
-
actions.fields.creditCardNumber.addValidator(isNotAmExCard());
|
|
49564
|
-
}
|
|
49565
49545
|
}, []);
|
|
49566
49546
|
React.useEffect(function () {
|
|
49567
49547
|
if (clearOnDismount) {
|
|
@@ -49571,7 +49551,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49571
49551
|
}
|
|
49572
49552
|
}, []);
|
|
49573
49553
|
var nameOnCardErrors = _defineProperty({}, required.error, "Name is required");
|
|
49574
|
-
var creditCardNumberErrors = _defineProperty(_defineProperty(_defineProperty(
|
|
49554
|
+
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"));
|
|
49575
49555
|
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");
|
|
49576
49556
|
var cvvErrors = _defineProperty(_defineProperty({}, required.error, "CVV is required"), hasLength.error, "CVV is invalid");
|
|
49577
49557
|
var zipCodeErrors = _defineProperty(_defineProperty({}, required.error, "Zip code is required"), hasLength.error, "Zip code is invalid");
|