@thecb/components 10.6.5-beta.1 → 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 +27 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -14
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/wallet-name/WalletName.js +1 -3
- package/src/components/atoms/wallet-name/index.d.ts +0 -1
- package/src/components/molecules/payment-button-bar/PaymentButtonBar.js +4 -6
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +9 -2
- package/src/components/molecules/payment-form-card/PaymentFormCard.stories.js +5 -1
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
|
|
@@ -48550,11 +48562,7 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
|
|
|
48550
48562
|
buttonGroupStyles = _ref.buttonGroupStyles,
|
|
48551
48563
|
_ref$hideAdditionalBu = _ref.hideAdditionalButton,
|
|
48552
48564
|
hideAdditionalButton = _ref$hideAdditionalBu === void 0 ? false : _ref$hideAdditionalBu,
|
|
48553
|
-
additionalButton = _ref.additionalButton
|
|
48554
|
-
_ref$nextButtonTestId = _ref.nextButtonTestId,
|
|
48555
|
-
nextButtonTestId = _ref$nextButtonTestId === void 0 ? null : _ref$nextButtonTestId,
|
|
48556
|
-
_ref$backButtonTestId = _ref.backButtonTestId,
|
|
48557
|
-
backButtonTestId = _ref$backButtonTestId === void 0 ? null : _ref$backButtonTestId;
|
|
48565
|
+
additionalButton = _ref.additionalButton;
|
|
48558
48566
|
var _useContext = React.useContext(styled.ThemeContext),
|
|
48559
48567
|
isMobile = _useContext.isMobile;
|
|
48560
48568
|
var backButton = !!cancelURL && !!cancelText ? /*#__PURE__*/React__default.createElement(ButtonWithLink, {
|
|
@@ -48562,7 +48570,7 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
|
|
|
48562
48570
|
url: cancelURL,
|
|
48563
48571
|
variant: backButtonVariant,
|
|
48564
48572
|
extraStyles: isMobile && "flex-grow: 1",
|
|
48565
|
-
dataQa:
|
|
48573
|
+
dataQa: cancelText,
|
|
48566
48574
|
"aria-labelledby": "".concat(kebabCaseString(cancelText), "-button"),
|
|
48567
48575
|
role: "link"
|
|
48568
48576
|
}) : backButtonAction && /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
@@ -48579,7 +48587,7 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
|
|
|
48579
48587
|
text: redirectText,
|
|
48580
48588
|
variant: forwardButtonVariant,
|
|
48581
48589
|
extraStyles: isMobile && "flex-grow: 1",
|
|
48582
|
-
dataQa:
|
|
48590
|
+
dataQa: redirectText,
|
|
48583
48591
|
disabled: isForwardButtonDisabled,
|
|
48584
48592
|
"aria-labelledby": "".concat(kebabCaseString(redirectText), "-button"),
|
|
48585
48593
|
role: forwardButtonAriaRole
|
|
@@ -48589,7 +48597,7 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
|
|
|
48589
48597
|
action: forwardButtonAction,
|
|
48590
48598
|
isLoading: forwardButtonLoading,
|
|
48591
48599
|
extraStyles: isMobile && "flex-grow: 1",
|
|
48592
|
-
dataQa:
|
|
48600
|
+
dataQa: forwardButtonText,
|
|
48593
48601
|
disabled: isForwardButtonDisabled,
|
|
48594
48602
|
"aria-labelledby": "".concat(kebabCaseString(forwardButtonText), "-button"),
|
|
48595
48603
|
role: forwardButtonAriaRole
|
|
@@ -49539,7 +49547,9 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49539
49547
|
saveToWallet = _ref.saveToWallet,
|
|
49540
49548
|
walletCheckboxMarked = _ref.walletCheckboxMarked,
|
|
49541
49549
|
deniedCards = _ref.deniedCards,
|
|
49542
|
-
termsContent = _ref.termsContent
|
|
49550
|
+
termsContent = _ref.termsContent,
|
|
49551
|
+
_ref$allowAmExCards = _ref.allowAmExCards,
|
|
49552
|
+
allowAmExCards = _ref$allowAmExCards === void 0 ? true : _ref$allowAmExCards;
|
|
49543
49553
|
var _useContext = React.useContext(styled.ThemeContext),
|
|
49544
49554
|
isMobile = _useContext.isMobile;
|
|
49545
49555
|
var showTerms = !!termsContent;
|
|
@@ -49549,6 +49559,9 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49549
49559
|
return actions.fields.creditCardNumber.addValidator(matchesRegex(checkDeniedCards(card)));
|
|
49550
49560
|
});
|
|
49551
49561
|
}
|
|
49562
|
+
if (!allowAmExCards) {
|
|
49563
|
+
actions.fields.creditCardNumber.addValidator(isNotAmExCard());
|
|
49564
|
+
}
|
|
49552
49565
|
}, []);
|
|
49553
49566
|
React.useEffect(function () {
|
|
49554
49567
|
if (clearOnDismount) {
|
|
@@ -49558,7 +49571,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49558
49571
|
}
|
|
49559
49572
|
}, []);
|
|
49560
49573
|
var nameOnCardErrors = _defineProperty({}, required.error, "Name is required");
|
|
49561
|
-
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"));
|
|
49562
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");
|
|
49563
49576
|
var cvvErrors = _defineProperty(_defineProperty({}, required.error, "CVV is required"), hasLength.error, "CVV is invalid");
|
|
49564
49577
|
var zipCodeErrors = _defineProperty(_defineProperty({}, required.error, "Zip code is required"), hasLength.error, "Zip code is invalid");
|