@thecb/components 10.6.5-beta.1 → 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 +7 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +7 -14
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- 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 +1 -1
- package/src/components/molecules/payment-form-card/PaymentFormCard.stories.js +10 -1
- package/src/util/general.js +1 -1
package/package.json
CHANGED
|
@@ -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={`
|
|
@@ -25,9 +25,7 @@ const PaymentButtonBar = ({
|
|
|
25
25
|
hideBackButton = false,
|
|
26
26
|
buttonGroupStyles,
|
|
27
27
|
hideAdditionalButton = false,
|
|
28
|
-
additionalButton
|
|
29
|
-
nextButtonTestId = null,
|
|
30
|
-
backButtonTestId = null
|
|
28
|
+
additionalButton
|
|
31
29
|
}) => {
|
|
32
30
|
const { isMobile } = useContext(ThemeContext);
|
|
33
31
|
|
|
@@ -38,7 +36,7 @@ const PaymentButtonBar = ({
|
|
|
38
36
|
url={cancelURL}
|
|
39
37
|
variant={backButtonVariant}
|
|
40
38
|
extraStyles={isMobile && "flex-grow: 1"}
|
|
41
|
-
dataQa={
|
|
39
|
+
dataQa={cancelText}
|
|
42
40
|
aria-labelledby={`${kebabCaseString(cancelText)}-button`}
|
|
43
41
|
role="link"
|
|
44
42
|
/>
|
|
@@ -62,7 +60,7 @@ const PaymentButtonBar = ({
|
|
|
62
60
|
text={redirectText}
|
|
63
61
|
variant={forwardButtonVariant}
|
|
64
62
|
extraStyles={isMobile && "flex-grow: 1"}
|
|
65
|
-
dataQa={
|
|
63
|
+
dataQa={redirectText}
|
|
66
64
|
disabled={isForwardButtonDisabled}
|
|
67
65
|
aria-labelledby={`${kebabCaseString(redirectText)}-button`}
|
|
68
66
|
role={forwardButtonAriaRole}
|
|
@@ -75,7 +73,7 @@ const PaymentButtonBar = ({
|
|
|
75
73
|
action={forwardButtonAction}
|
|
76
74
|
isLoading={forwardButtonLoading}
|
|
77
75
|
extraStyles={isMobile && "flex-grow: 1"}
|
|
78
|
-
dataQa={
|
|
76
|
+
dataQa={forwardButtonText}
|
|
79
77
|
disabled={isForwardButtonDisabled}
|
|
80
78
|
aria-labelledby={`${kebabCaseString(forwardButtonText)}-button`}
|
|
81
79
|
role={forwardButtonAriaRole}
|
|
@@ -71,7 +71,7 @@ const PaymentFormCard = ({
|
|
|
71
71
|
[hasLength.error]: "Credit card number is invalid",
|
|
72
72
|
[matchesRegex.error]: `${displayCardBrand(
|
|
73
73
|
fields.creditCardNumber.rawValue
|
|
74
|
-
)}
|
|
74
|
+
)} cards are not available for payment`
|
|
75
75
|
};
|
|
76
76
|
const expirationDateErrors = {
|
|
77
77
|
[required.error]: "Expiration date is required",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
import { boolean } from "@storybook/addon-knobs";
|
|
3
|
+
import { boolean, object } from "@storybook/addon-knobs";
|
|
4
4
|
|
|
5
5
|
import PaymentFormCard from "./PaymentFormCard";
|
|
6
6
|
import page from "../../../../.storybook/page";
|
|
@@ -13,12 +13,21 @@ const story = page({
|
|
|
13
13
|
mapStateToProps: PaymentFormCardState.mapStateToProps,
|
|
14
14
|
mapDispatchToProps: PaymentFormCardState.mapDispatchToProps
|
|
15
15
|
});
|
|
16
|
+
|
|
16
17
|
export default story;
|
|
17
18
|
|
|
18
19
|
const ConnectedForm = connect(
|
|
19
20
|
PaymentFormCardState.mapStateToProps,
|
|
20
21
|
PaymentFormCardState.mapDispatchToProps
|
|
21
22
|
)(PaymentFormCard);
|
|
23
|
+
|
|
22
24
|
export const paymentFormCard = () => (
|
|
23
25
|
<ConnectedForm showErrors={boolean("showErrors", false, "props")} />
|
|
24
26
|
);
|
|
27
|
+
|
|
28
|
+
export const paymentFormCardWithDeniedCards = () => (
|
|
29
|
+
<ConnectedForm
|
|
30
|
+
showErrors={boolean("showErrors", false, "props")}
|
|
31
|
+
deniedCards={object("deniedCards", ["AMEX"], "props")}
|
|
32
|
+
/>
|
|
33
|
+
);
|
package/src/util/general.js
CHANGED
|
@@ -74,7 +74,7 @@ export const displayCardBrand = number => {
|
|
|
74
74
|
return "Mastercard";
|
|
75
75
|
} else if (/^4/.test(number)) {
|
|
76
76
|
return "Visa";
|
|
77
|
-
} else if (/^3[4,7]
|
|
77
|
+
} else if (/^3[4,7]\d{13}$/.test(number)) {
|
|
78
78
|
return "American Express";
|
|
79
79
|
} else return "Unknown Card";
|
|
80
80
|
};
|