@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 +23 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -6
- 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-form-card/PaymentFormCard.js +9 -2
- package/src/components/molecules/payment-form-card/PaymentFormCard.stories.js +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecb/components",
|
|
3
|
-
"version": "10.6.
|
|
3
|
+
"version": "10.6.6-beta.0",
|
|
4
4
|
"description": "Common lib for CityBase react components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -90,6 +90,6 @@
|
|
|
90
90
|
"ramda": "^0.27.0",
|
|
91
91
|
"react-aria-modal": "^4.0.0",
|
|
92
92
|
"react-pose": "^4.0.10",
|
|
93
|
-
"redux-freeform": "^5.9.
|
|
93
|
+
"redux-freeform": "^5.9.1-beta.2"
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -16,8 +16,7 @@ const WalletName = ({
|
|
|
16
16
|
actionText = null, // right side hyperlinked text
|
|
17
17
|
disableAction = false,
|
|
18
18
|
linkButtonExtraStyles = "", // hyperlinked text extraStyles
|
|
19
|
-
isLoading = false
|
|
20
|
-
dataQa = null
|
|
19
|
+
isLoading = false // shows a spinner on the left when true
|
|
21
20
|
}) => {
|
|
22
21
|
const { isMobile } = useContext(ThemeContext);
|
|
23
22
|
|
|
@@ -58,7 +57,6 @@ const WalletName = ({
|
|
|
58
57
|
<ButtonWithAction
|
|
59
58
|
disabled={disableAction}
|
|
60
59
|
text={actionText}
|
|
61
|
-
dataQa={dataQa}
|
|
62
60
|
action={action}
|
|
63
61
|
variant="smallGhost"
|
|
64
62
|
extraStyles={`
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
hasLength,
|
|
6
6
|
matchesRegex,
|
|
7
7
|
dateAfterToday,
|
|
8
|
-
isValidMonth
|
|
8
|
+
isValidMonth,
|
|
9
|
+
isNotAmExCard
|
|
9
10
|
} from "redux-freeform";
|
|
10
11
|
import Checkbox from "../../atoms/checkbox";
|
|
11
12
|
import CountryDropdown from "../../atoms/country-dropdown";
|
|
@@ -42,7 +43,8 @@ const PaymentFormCard = ({
|
|
|
42
43
|
saveToWallet,
|
|
43
44
|
walletCheckboxMarked,
|
|
44
45
|
deniedCards,
|
|
45
|
-
termsContent
|
|
46
|
+
termsContent,
|
|
47
|
+
allowAmExCards = true
|
|
46
48
|
}) => {
|
|
47
49
|
const { isMobile } = useContext(ThemeContext);
|
|
48
50
|
const showTerms = !!termsContent;
|
|
@@ -55,6 +57,9 @@ const PaymentFormCard = ({
|
|
|
55
57
|
)
|
|
56
58
|
);
|
|
57
59
|
}
|
|
60
|
+
if (!allowAmExCards) {
|
|
61
|
+
actions.fields.creditCardNumber.addValidator(isNotAmExCard());
|
|
62
|
+
}
|
|
58
63
|
}, []);
|
|
59
64
|
|
|
60
65
|
useEffect(() => {
|
|
@@ -69,6 +74,8 @@ const PaymentFormCard = ({
|
|
|
69
74
|
const creditCardNumberErrors = {
|
|
70
75
|
[required.error]: "Credit card number is required",
|
|
71
76
|
[hasLength.error]: "Credit card number is invalid",
|
|
77
|
+
[isNotAmExCard.error]:
|
|
78
|
+
"American Express cards are not available for payment.",
|
|
72
79
|
[matchesRegex.error]: `${displayCardBrand(
|
|
73
80
|
fields.creditCardNumber.rawValue
|
|
74
81
|
)} is not accepted`
|
|
@@ -19,6 +19,10 @@ const ConnectedForm = connect(
|
|
|
19
19
|
PaymentFormCardState.mapStateToProps,
|
|
20
20
|
PaymentFormCardState.mapDispatchToProps
|
|
21
21
|
)(PaymentFormCard);
|
|
22
|
+
|
|
22
23
|
export const paymentFormCard = () => (
|
|
23
|
-
<ConnectedForm
|
|
24
|
+
<ConnectedForm
|
|
25
|
+
showErrors={boolean("showErrors", false, "props")}
|
|
26
|
+
allowAmExCards={boolean("allowAmExCards", true, "props")}
|
|
27
|
+
/>
|
|
24
28
|
);
|