@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.6.5-beta.1",
3
+ "version": "10.6.6-beta.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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> &
@@ -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={backButtonTestId || cancelText}
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={nextButtonTestId || redirectText}
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={nextButtonTestId || forwardButtonText}
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
- )} is not accepted`
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
+ );
@@ -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]/.test(number)) {
77
+ } else if (/^3[4,7]\d{13}$/.test(number)) {
78
78
  return "American Express";
79
79
  } else return "Unknown Card";
80
80
  };