@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.6.5-beta.0",
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.0"
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, // shows a spinner on the left when true
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={`
@@ -9,7 +9,6 @@ export interface WalletNameProps {
9
9
  text?: string | null;
10
10
  isLoading: boolean;
11
11
  buttonExtraStyles?: string;
12
- dataQa?: string | null;
13
12
  }
14
13
 
15
14
  export const WalletName: React.FC<Expand<WalletNameProps> &
@@ -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 showErrors={boolean("showErrors", false, "props")} />
24
+ <ConnectedForm
25
+ showErrors={boolean("showErrors", false, "props")}
26
+ allowAmExCards={boolean("allowAmExCards", true, "props")}
27
+ />
24
28
  );