@thecb/components 4.0.3-beta-0 → 4.0.5
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 +278 -241
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/FormLayouts.theme.js +2 -2
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +25 -11
- package/src/components/atoms/heading/Heading.js +1 -3
- package/src/components/atoms/labeled-amount/LabeledAmount.js +1 -3
- package/src/components/atoms/layouts/Box.styled.js +3 -7
- package/src/components/molecules/module/Module.js +2 -1
- package/src/components/molecules/module/Module.theme.js +1 -1
- package/src/components/molecules/obligation/Obligation.js +9 -1
- package/src/components/molecules/obligation/modules/AmountModule.js +5 -1
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +22 -8
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +9 -2
- package/src/components/molecules/payment-details/PaymentDetails.js +2 -3
- package/src/components/molecules/radio-section/RadioSection.js +0 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js +0 -38353
- package/dist/index.esm.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
STORM_GREY,
|
|
3
3
|
MATISSE_BLUE,
|
|
4
4
|
WHITE,
|
|
5
5
|
SEASHELL_WHITE,
|
|
@@ -23,7 +23,7 @@ const inputBackgroundColor = {
|
|
|
23
23
|
disabled: `${SEASHELL_WHITE}`
|
|
24
24
|
};
|
|
25
25
|
const color = { default: `${MINESHAFT_GREY}`, disabled: `${DUSTY_GREY}` };
|
|
26
|
-
const labelColor = { default: `${
|
|
26
|
+
const labelColor = { default: `${STORM_GREY}`, disabled: `${STORM_GREY}` };
|
|
27
27
|
const borderColor = { default: `${GREY_CHATEAU}`, disabled: `${GREY_CHATEAU}` };
|
|
28
28
|
const lineHeight = { default: "1rem", disabled: "1rem" };
|
|
29
29
|
const fontSize = { default: "0.875rem", disabled: "0.875rem" };
|
|
@@ -2,9 +2,11 @@ import React from "react";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import GenericCard from "../icons/GenericCard";
|
|
4
4
|
import Text from "../text";
|
|
5
|
-
import
|
|
5
|
+
import Paragraph from "../paragraph";
|
|
6
|
+
import { Box, Stack } from "../layouts";
|
|
6
7
|
import { fallbackValues } from "./FormattedCreditCard.theme";
|
|
7
8
|
import { themeComponent } from "../../../util/themeUtils";
|
|
9
|
+
import { ASH_GREY } from "../../../constants/colors";
|
|
8
10
|
|
|
9
11
|
export const CreditCardWrapper = styled.div`
|
|
10
12
|
display: flex;
|
|
@@ -19,21 +21,33 @@ export const CCIconWrapper = styled.div`
|
|
|
19
21
|
display: flex;
|
|
20
22
|
`;
|
|
21
23
|
|
|
22
|
-
const FormattedCreditCard = ({
|
|
24
|
+
const FormattedCreditCard = ({
|
|
25
|
+
lastFour,
|
|
26
|
+
autoPay,
|
|
27
|
+
expireDate,
|
|
28
|
+
themeValues
|
|
29
|
+
}) => (
|
|
23
30
|
<CreditCardWrapper>
|
|
24
31
|
<CCIconWrapper>
|
|
25
32
|
<GenericCard />
|
|
26
33
|
</CCIconWrapper>
|
|
27
34
|
<Stack childGap="0">
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
<Box padding="0">
|
|
36
|
+
<Text
|
|
37
|
+
variant="p"
|
|
38
|
+
padding="0 0 0 8px"
|
|
39
|
+
color={themeValues.textColor}
|
|
40
|
+
textAlign="left"
|
|
41
|
+
extraStyles={`display: inline-block;`}
|
|
42
|
+
>
|
|
43
|
+
{`Card ending in ${lastFour}`}
|
|
44
|
+
</Text>
|
|
45
|
+
{expireDate && (
|
|
46
|
+
<Paragraph variant="pXS" color={ASH_GREY} textAlign="left">
|
|
47
|
+
{`Exp ${expireDate}`}
|
|
48
|
+
</Paragraph>
|
|
49
|
+
)}
|
|
50
|
+
</Box>
|
|
37
51
|
{autoPay && (
|
|
38
52
|
<Text
|
|
39
53
|
variant="p"
|
|
@@ -15,14 +15,12 @@ const Heading = ({
|
|
|
15
15
|
extraStyles = ``,
|
|
16
16
|
className,
|
|
17
17
|
variant = "h1",
|
|
18
|
-
as = "h1",
|
|
19
18
|
dataQa,
|
|
20
19
|
children,
|
|
21
20
|
...rest
|
|
22
21
|
}) => (
|
|
23
22
|
<HeadingText
|
|
24
|
-
|
|
25
|
-
as={as}
|
|
23
|
+
as={variant}
|
|
26
24
|
weight={weight}
|
|
27
25
|
color={color}
|
|
28
26
|
margin={margin}
|
|
@@ -5,13 +5,12 @@ import { Stack } from "../layouts";
|
|
|
5
5
|
import Heading from "../heading";
|
|
6
6
|
import Paragraph from "../paragraph";
|
|
7
7
|
|
|
8
|
-
const LabeledAmount = ({ variant = "pL", label, amount, themeValues
|
|
8
|
+
const LabeledAmount = ({ variant = "pL", label, amount, themeValues }) => {
|
|
9
9
|
const LabeledAmountText = variant === "h6" ? Heading : Paragraph;
|
|
10
10
|
return (
|
|
11
11
|
<Stack direction="row">
|
|
12
12
|
<LabeledAmountText
|
|
13
13
|
variant={variant}
|
|
14
|
-
as={as}
|
|
15
14
|
weight={themeValues.fontWeight}
|
|
16
15
|
extraStyles="text-align: start; flex: 3;"
|
|
17
16
|
>
|
|
@@ -19,7 +18,6 @@ const LabeledAmount = ({ variant = "pL", label, amount, themeValues, as }) => {
|
|
|
19
18
|
</LabeledAmountText>
|
|
20
19
|
<LabeledAmountText
|
|
21
20
|
variant={variant}
|
|
22
|
-
as={as}
|
|
23
21
|
weight={themeValues.fontWeight}
|
|
24
22
|
extraStyles="text-align: end; flex: 1;"
|
|
25
23
|
>
|
|
@@ -27,8 +27,10 @@ export const BoxWrapper = styled(
|
|
|
27
27
|
maxWidth,
|
|
28
28
|
padding,
|
|
29
29
|
hiddenStyles,
|
|
30
|
+
ariaControls,
|
|
31
|
+
ariaLabel,
|
|
30
32
|
...props
|
|
31
|
-
}) => <div {...props} />
|
|
33
|
+
}) => <div aria-controls={ariaControls} aria-label={ariaLabel} {...props} />
|
|
32
34
|
)`
|
|
33
35
|
position: relative;
|
|
34
36
|
box-sizing: border-box;
|
|
@@ -106,11 +108,5 @@ export const BoxWrapper = styled(
|
|
|
106
108
|
css`
|
|
107
109
|
${extraStyles}
|
|
108
110
|
`}
|
|
109
|
-
|
|
110
|
-
${({ hiddenStyles }) =>
|
|
111
|
-
hiddenStyles &&
|
|
112
|
-
css`
|
|
113
|
-
display: none;
|
|
114
|
-
`}
|
|
115
111
|
`;
|
|
116
112
|
/* eslint-enable no-unused-vars */
|
|
@@ -16,11 +16,12 @@ const Module = ({
|
|
|
16
16
|
<Fragment>
|
|
17
17
|
{heading && (
|
|
18
18
|
<Heading
|
|
19
|
-
variant={variant === "default" ? "h5" : "
|
|
19
|
+
variant={variant === "default" ? "h5" : "h3"}
|
|
20
20
|
weight={themeValues.fontWeight}
|
|
21
21
|
color={themeValues.fontColor}
|
|
22
22
|
margin={`${spacing} 0 ${themeValues.titleSpacing} 0`}
|
|
23
23
|
textAlign={themeValues.textAlign}
|
|
24
|
+
aria-level={variant === "default" ? "3" : "1"}
|
|
24
25
|
>
|
|
25
26
|
{heading}
|
|
26
27
|
</Heading>
|
|
@@ -5,7 +5,7 @@ const fontWeight = { default: "600", largeTitle: "700" };
|
|
|
5
5
|
const fontColor = { default: CHARADE_GREY, largeTitle: CHARADE_GREY };
|
|
6
6
|
const lineHeight = { default: "2rem", largeTitle: "2rem" };
|
|
7
7
|
const textAlign = { default: "left", largeTitle: "left" };
|
|
8
|
-
const titleType = { default: "h5", largeTitle: "
|
|
8
|
+
const titleType = { default: "h5", largeTitle: "h3" };
|
|
9
9
|
const titleSpacing = { default: "0.5rem", largeTitle: "1.125rem" };
|
|
10
10
|
const boxShadow = {
|
|
11
11
|
default:
|
|
@@ -17,8 +17,10 @@ const Obligation = ({
|
|
|
17
17
|
handleAutopayAction,
|
|
18
18
|
deactivatePaymentSchedule,
|
|
19
19
|
autoPaySchedule,
|
|
20
|
+
paymentPlanSchedule,
|
|
20
21
|
navigateToSettings,
|
|
21
|
-
isMobile
|
|
22
|
+
isMobile,
|
|
23
|
+
isPaymentPlan
|
|
22
24
|
}) => {
|
|
23
25
|
const obligation = obligations[0];
|
|
24
26
|
const { customAttributes } = obligation;
|
|
@@ -67,6 +69,8 @@ const Obligation = ({
|
|
|
67
69
|
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
68
70
|
navigateToSettings={navigateToSettings}
|
|
69
71
|
autoPaySchedule={autoPaySchedule}
|
|
72
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
73
|
+
isPaymentPlan={isPaymentPlan}
|
|
70
74
|
/>
|
|
71
75
|
)}
|
|
72
76
|
</Cluster>
|
|
@@ -79,10 +83,12 @@ const Obligation = ({
|
|
|
79
83
|
handleAutopayAction={handleAutopayAction}
|
|
80
84
|
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
81
85
|
autoPaySchedule={autoPaySchedule}
|
|
86
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
82
87
|
navigateToSettings={navigateToSettings}
|
|
83
88
|
config={config}
|
|
84
89
|
actions={actions}
|
|
85
90
|
isMobile={isMobile}
|
|
91
|
+
isPaymentPlan={isPaymentPlan}
|
|
86
92
|
/>
|
|
87
93
|
)}
|
|
88
94
|
</Stack>
|
|
@@ -95,10 +101,12 @@ const Obligation = ({
|
|
|
95
101
|
handleAutopayAction={handleAutopayAction}
|
|
96
102
|
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
97
103
|
autoPaySchedule={autoPaySchedule}
|
|
104
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
98
105
|
navigateToSettings={navigateToSettings}
|
|
99
106
|
config={config}
|
|
100
107
|
actions={actions}
|
|
101
108
|
isMobile={isMobile}
|
|
109
|
+
isPaymentPlan={isPaymentPlan}
|
|
102
110
|
/>
|
|
103
111
|
)}
|
|
104
112
|
</Box>
|
|
@@ -12,7 +12,9 @@ const AmountModule = ({
|
|
|
12
12
|
isMobile,
|
|
13
13
|
deactivatePaymentSchedule,
|
|
14
14
|
navigateToSettings,
|
|
15
|
-
autoPaySchedule
|
|
15
|
+
autoPaySchedule,
|
|
16
|
+
paymentPlanSchedule,
|
|
17
|
+
isPaymentPlan
|
|
16
18
|
}) => {
|
|
17
19
|
const [modalOpen, toggleModal] = useState(false);
|
|
18
20
|
return (
|
|
@@ -38,6 +40,8 @@ const AmountModule = ({
|
|
|
38
40
|
navigateToSettings={navigateToSettings}
|
|
39
41
|
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
40
42
|
isMobile={isMobile}
|
|
43
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
44
|
+
isPaymentPlan={isPaymentPlan}
|
|
41
45
|
/>
|
|
42
46
|
)}
|
|
43
47
|
</Stack>
|
|
@@ -9,24 +9,38 @@ import { themeComponent } from "../../../../util/themeUtils";
|
|
|
9
9
|
const AutopayModal = ({
|
|
10
10
|
autoPayActive,
|
|
11
11
|
autoPaySchedule,
|
|
12
|
+
paymentPlanSchedule,
|
|
12
13
|
toggleModal,
|
|
13
14
|
modalOpen,
|
|
14
15
|
deactivatePaymentSchedule,
|
|
15
16
|
navigateToSettings,
|
|
16
17
|
buttonLinkType,
|
|
17
18
|
isMobile,
|
|
18
|
-
themeValues
|
|
19
|
+
themeValues,
|
|
20
|
+
isPaymentPlan
|
|
19
21
|
}) => {
|
|
22
|
+
const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
|
|
20
23
|
const modalExtraProps = {
|
|
21
|
-
modalHeaderText: autoPayActive
|
|
24
|
+
modalHeaderText: autoPayActive
|
|
25
|
+
? `Deactivate ${planType}`
|
|
26
|
+
: `Set Up ${planType}`,
|
|
22
27
|
modalBodyText: autoPayActive
|
|
23
|
-
?
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
? `Are you sure you want to deactivate ${
|
|
29
|
+
isPaymentPlan ? "your payment plan" : "autopay"
|
|
30
|
+
}? You will need to manually make your next payment.`
|
|
31
|
+
: `To set up ${
|
|
32
|
+
isPaymentPlan ? "a payment plan" : "autopay"
|
|
33
|
+
} you must save a payment method and address in your profile. Do you want to save these now?`,
|
|
34
|
+
continueButtonText: autoPayActive
|
|
35
|
+
? `Disable ${planType}`
|
|
36
|
+
: "Add to Profile",
|
|
26
37
|
useDangerButton: autoPayActive,
|
|
27
38
|
continueAction: autoPayActive
|
|
28
39
|
? () => {
|
|
29
|
-
deactivatePaymentSchedule(
|
|
40
|
+
deactivatePaymentSchedule(
|
|
41
|
+
isPaymentPlan ? paymentPlanSchedule : autoPaySchedule,
|
|
42
|
+
isPaymentPlan
|
|
43
|
+
);
|
|
30
44
|
toggleModal(false);
|
|
31
45
|
}
|
|
32
46
|
: navigateToSettings
|
|
@@ -50,7 +64,7 @@ const AutopayModal = ({
|
|
|
50
64
|
ModalLink={() =>
|
|
51
65
|
buttonLinkType ? (
|
|
52
66
|
<ButtonWithAction
|
|
53
|
-
text={autoPayActive ?
|
|
67
|
+
text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
|
|
54
68
|
variant="tertiary"
|
|
55
69
|
action={() => {
|
|
56
70
|
toggleModal(true);
|
|
@@ -74,7 +88,7 @@ const AutopayModal = ({
|
|
|
74
88
|
>
|
|
75
89
|
<AutopayOnIcon />
|
|
76
90
|
<ButtonWithAction
|
|
77
|
-
text=
|
|
91
|
+
text={`${planType} On`}
|
|
78
92
|
variant="smallGhost"
|
|
79
93
|
dataQa="Autopay On"
|
|
80
94
|
textExtraStyles={`font-size: 0.875rem; `}
|
|
@@ -15,8 +15,11 @@ const PaymentDetailsActions = ({
|
|
|
15
15
|
handleAutopayAction,
|
|
16
16
|
deactivatePaymentSchedule,
|
|
17
17
|
navigateToSettings,
|
|
18
|
-
autoPaySchedule
|
|
18
|
+
autoPaySchedule,
|
|
19
|
+
paymentPlanSchedule,
|
|
20
|
+
isPaymentPlan
|
|
19
21
|
}) => {
|
|
22
|
+
const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
|
|
20
23
|
const [isLoading, setIsLoading] = useState(false);
|
|
21
24
|
const [modalOpen, toggleModal] = useState(false);
|
|
22
25
|
const { obligationSlug } = config;
|
|
@@ -64,6 +67,8 @@ const PaymentDetailsActions = ({
|
|
|
64
67
|
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
65
68
|
navigateToSettings={navigateToSettings}
|
|
66
69
|
autoPaySchedule={autoPaySchedule}
|
|
70
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
71
|
+
isPaymentPlan={isPaymentPlan}
|
|
67
72
|
/>
|
|
68
73
|
</Cluster>
|
|
69
74
|
</Box>
|
|
@@ -97,7 +102,7 @@ const PaymentDetailsActions = ({
|
|
|
97
102
|
{autoPayAvailable && !autoPayEnabled ? (
|
|
98
103
|
<ButtonWithAction
|
|
99
104
|
variant="tertiary"
|
|
100
|
-
text=
|
|
105
|
+
text={`Set Up ${planType}`}
|
|
101
106
|
action={() => {
|
|
102
107
|
setDetailedObligation(obligations, config);
|
|
103
108
|
handleAutopayAction();
|
|
@@ -115,6 +120,8 @@ const PaymentDetailsActions = ({
|
|
|
115
120
|
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
116
121
|
buttonLinkType
|
|
117
122
|
isMobile={isMobile}
|
|
123
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
124
|
+
isPaymentPlan={isPaymentPlan}
|
|
118
125
|
/>
|
|
119
126
|
)}
|
|
120
127
|
</Box>
|
|
@@ -31,7 +31,6 @@ const PaymentDetailsContent = ({
|
|
|
31
31
|
</Box>
|
|
32
32
|
<SolidDivider />
|
|
33
33
|
<LabeledAmount
|
|
34
|
-
as="h2"
|
|
35
34
|
variant={themeValues.labeledAmountTotal}
|
|
36
35
|
label="Total"
|
|
37
36
|
amount={displayCurrency(total)}
|
|
@@ -124,14 +123,14 @@ const PaymentDetails = ({
|
|
|
124
123
|
) : isCollapsible ? (
|
|
125
124
|
<Box width="100%" padding="none">
|
|
126
125
|
<Cluster justify="space-between" align="center">
|
|
127
|
-
<Heading variant="
|
|
126
|
+
<Heading variant="h6" weight="700">
|
|
128
127
|
{titleText}
|
|
129
128
|
</Heading>
|
|
130
129
|
{displayCurrency(total)}
|
|
131
130
|
</Cluster>
|
|
132
131
|
</Box>
|
|
133
132
|
) : (
|
|
134
|
-
<Heading
|
|
133
|
+
<Heading variant="h3" weight="700" margin="1rem 0 0 0">
|
|
135
134
|
{titleText}
|
|
136
135
|
</Heading>
|
|
137
136
|
);
|