@thecb/components 3.4.1 → 3.5.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/.tool-versions +1 -0
- package/dist/index.cjs.js +784 -664
- package/package.json +1 -1
- package/src/components/atoms/icons/AutopayOnIcon.js +28 -0
- package/src/components/atoms/icons/TimeoutImage.js +138 -0
- package/src/components/atoms/icons/icons.stories.js +3 -1
- package/src/components/atoms/icons/index.js +5 -1
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/obligation/Obligation.js +58 -21
- package/src/components/molecules/obligation/modules/AmountModule.js +38 -30
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +99 -0
- package/src/components/molecules/obligation/modules/AutopayModalModule.theme.js +9 -0
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +110 -31
- package/src/components/molecules/timeout/Timeout.js +46 -0
- package/src/components/molecules/timeout/index.js +3 -0
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { fallbackValues } from "./Icons.theme";
|
|
3
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
4
|
+
|
|
5
|
+
const AutopayOnIcon = ({ themeValues }) => (
|
|
6
|
+
<svg
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
width="12"
|
|
9
|
+
height="13"
|
|
10
|
+
viewBox="0 0 12 13"
|
|
11
|
+
>
|
|
12
|
+
<g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
|
|
13
|
+
<path
|
|
14
|
+
className="autopayIcon"
|
|
15
|
+
fill={themeValues.primaryColor}
|
|
16
|
+
fillRule="nonzero"
|
|
17
|
+
d="M1.898 5.75c.079 0 .141-.02.188-.059a.281.281 0 00.094-.152 3.825 3.825 0 011.394-2.144A3.838 3.838 0 016 2.563c.5 0 .98.09 1.441.27.461.179.88.44 1.254.784l-.984.985A.542.542 0 007.547 5c0 .156.055.29.164.398.11.11.242.165.398.165h3.141c.156 0 .289-.055.398-.165A.542.542 0 0011.812 5V1.86a.542.542 0 00-.164-.399.542.542 0 00-.398-.164.542.542 0 00-.398.164l-.844.844A5.699 5.699 0 006 .688c-.938 0-1.809.207-2.613.62-.805.415-1.48.981-2.028 1.7A5.726 5.726 0 00.281 5.422a.265.265 0 00.059.223c.055.07.129.105.222.105h1.336zM6 12.312c.937 0 1.809-.207 2.613-.62a5.919 5.919 0 002.028-1.7 5.726 5.726 0 001.078-2.414.265.265 0 00-.059-.223.267.267 0 00-.223-.105h-1.335c-.079 0-.141.02-.188.059a.281.281 0 00-.094.152 3.825 3.825 0 01-1.394 2.144c-.711.555-1.52.833-2.426.833-.5 0-.98-.09-1.441-.27a3.985 3.985 0 01-1.254-.785l.984-.985A.542.542 0 004.453 8a.542.542 0 00-.164-.398.542.542 0 00-.398-.164H.75a.542.542 0 00-.398.164A.542.542 0 00.187 8v3.14c0 .157.055.29.165.4.109.108.242.163.398.163.156 0 .29-.055.398-.164l.844-.844A5.699 5.699 0 006 12.312z"
|
|
18
|
+
></path>
|
|
19
|
+
</g>
|
|
20
|
+
</svg>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default themeComponent(
|
|
24
|
+
AutopayOnIcon,
|
|
25
|
+
"Icons",
|
|
26
|
+
fallbackValues,
|
|
27
|
+
"primary"
|
|
28
|
+
);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const TimeoutImage = () => {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
width="100%"
|
|
8
|
+
height="100%"
|
|
9
|
+
viewBox="0 0 458 308"
|
|
10
|
+
>
|
|
11
|
+
<g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
|
|
12
|
+
<g transform="translate(-492 -168)">
|
|
13
|
+
<g transform="translate(492 168)">
|
|
14
|
+
<path
|
|
15
|
+
fill="#EAF4EB"
|
|
16
|
+
d="M286.327 294.916c0 7.133-26.041 12.916-58.164 12.916-32.123 0-58.163-5.783-58.163-12.916S196.04 282 228.163 282s58.164 5.783 58.164 12.916"
|
|
17
|
+
></path>
|
|
18
|
+
<g
|
|
19
|
+
stroke="#45B770"
|
|
20
|
+
strokeLinecap="round"
|
|
21
|
+
strokeLinejoin="round"
|
|
22
|
+
strokeWidth="8.362"
|
|
23
|
+
transform="translate(204 268)"
|
|
24
|
+
>
|
|
25
|
+
<path d="M15.817 -2.13162821e-14L15.817 24.795 3.55271368e-15 24.795"></path>
|
|
26
|
+
<path d="M31.3102 -2.30926389e-14L31.3102 25.574 47.1272 25.574"></path>
|
|
27
|
+
</g>
|
|
28
|
+
<path
|
|
29
|
+
fill="#FEFEFE"
|
|
30
|
+
d="M107.968 73h239.721a6.969 6.969 0 016.969 6.968v178.398a6.969 6.969 0 01-6.969 6.968H107.968a6.968 6.968 0 01-6.968-6.968V79.968A6.968 6.968 0 01107.968 73"
|
|
31
|
+
></path>
|
|
32
|
+
<path fill="#E4E6EB" d="M101 99L355 99 355 73 101 73z"></path>
|
|
33
|
+
<g
|
|
34
|
+
stroke="#3B414D"
|
|
35
|
+
strokeLinecap="round"
|
|
36
|
+
strokeWidth="5.575"
|
|
37
|
+
transform="translate(197.811 141.913)"
|
|
38
|
+
>
|
|
39
|
+
<path
|
|
40
|
+
strokeLinejoin="round"
|
|
41
|
+
d="M0 5.575C1.168 2.317 4.16 0 7.666 0c3.505 0 6.497 2.317 7.665 5.575"
|
|
42
|
+
></path>
|
|
43
|
+
<path
|
|
44
|
+
strokeLinejoin="round"
|
|
45
|
+
d="M46 5.575C47.168 2.317 50.16 0 53.666 0c3.505 0 6.497 2.317 7.665 5.575"
|
|
46
|
+
></path>
|
|
47
|
+
<path
|
|
48
|
+
d="M50.38 44.087h0a6.886 6.886 0 01-6.886 6.886h-26.42a6.886 6.886 0 01-6.885-6.886"
|
|
49
|
+
transform="matrix(1 0 0 -1 0 95.06)"
|
|
50
|
+
></path>
|
|
51
|
+
</g>
|
|
52
|
+
<path
|
|
53
|
+
fill="#3B414D"
|
|
54
|
+
d="M124 83a3 3 0 110 6 3 3 0 010-6zm-10 0a3 3 0 110 6 3 3 0 010-6zm20 0a3 3 0 110 6 3 3 0 010-6z"
|
|
55
|
+
></path>
|
|
56
|
+
<path
|
|
57
|
+
stroke="#45B770"
|
|
58
|
+
strokeLinecap="round"
|
|
59
|
+
strokeLinejoin="round"
|
|
60
|
+
strokeWidth="8"
|
|
61
|
+
d="M99.441 205.181L77.181 224.512"
|
|
62
|
+
></path>
|
|
63
|
+
<path
|
|
64
|
+
stroke="#45B770"
|
|
65
|
+
strokeLinecap="round"
|
|
66
|
+
strokeLinejoin="round"
|
|
67
|
+
strokeWidth="8"
|
|
68
|
+
d="M412.8955 190.764648L381.126953 224.790039 356 205.267859"
|
|
69
|
+
></path>
|
|
70
|
+
<path
|
|
71
|
+
stroke="#45B770"
|
|
72
|
+
strokeLinecap="round"
|
|
73
|
+
strokeWidth="8"
|
|
74
|
+
d="M396.5 189.5L429.5 189.5"
|
|
75
|
+
></path>
|
|
76
|
+
<path
|
|
77
|
+
stroke="#45B770"
|
|
78
|
+
strokeLinecap="round"
|
|
79
|
+
strokeLinejoin="round"
|
|
80
|
+
strokeWidth="8"
|
|
81
|
+
d="M137.079 231.103a7.605 7.605 0 000 15.211h6.644"
|
|
82
|
+
></path>
|
|
83
|
+
<g transform="translate(377 63)">
|
|
84
|
+
<g>
|
|
85
|
+
<path
|
|
86
|
+
fill="#FFF"
|
|
87
|
+
d="M66.669 116.462H5.122a5.122 5.122 0 110-10.243h61.547a5.122 5.122 0 110 10.243"
|
|
88
|
+
></path>
|
|
89
|
+
<path
|
|
90
|
+
fill="#E4F4FD"
|
|
91
|
+
d="M15.126 71.521l20.77-13.29 20.769 13.29a19.123 19.123 0 018.815 16.106v18.591H6.311v-18.59c0-6.52 3.323-12.592 8.815-16.107z"
|
|
92
|
+
></path>
|
|
93
|
+
<path
|
|
94
|
+
fill="#E4F4FD"
|
|
95
|
+
d="M56.665 44.94l-20.77 13.292L15.126 44.94a19.12 19.12 0 01-8.815-16.106V10.244H65.48v18.59a19.12 19.12 0 01-8.815 16.107z"
|
|
96
|
+
></path>
|
|
97
|
+
<path
|
|
98
|
+
fill="#FFF"
|
|
99
|
+
d="M66.669 10.244H5.122A5.122 5.122 0 115.122 0h61.547a5.122 5.122 0 110 10.244z"
|
|
100
|
+
></path>
|
|
101
|
+
</g>
|
|
102
|
+
<g stroke="#3B414D" strokeLinecap="round" strokeWidth="6">
|
|
103
|
+
<path d="M66.669 116.462H5.122a5.122 5.122 0 110-10.243h61.547a5.122 5.122 0 110 10.243z"></path>
|
|
104
|
+
<path d="M15.126 71.521l20.77-13.29 20.769 13.29a19.123 19.123 0 018.815 16.106v18.591H6.311v-18.59c0-6.52 3.323-12.592 8.815-16.107z"></path>
|
|
105
|
+
<path d="M56.665 44.94l-20.77 13.292L15.126 44.94a19.12 19.12 0 01-8.815-16.106V10.244H65.48v18.59a19.12 19.12 0 01-8.815 16.107z"></path>
|
|
106
|
+
<path d="M66.669 10.244H5.122A5.122 5.122 0 115.122 0h61.547a5.122 5.122 0 110 10.244z"></path>
|
|
107
|
+
</g>
|
|
108
|
+
</g>
|
|
109
|
+
<path
|
|
110
|
+
stroke="#3B414D"
|
|
111
|
+
strokeLinecap="round"
|
|
112
|
+
strokeWidth="8"
|
|
113
|
+
d="M27.663 247.376l-15.18.348M401 248l-44.96-.276m-256.445-.348l-52.372.348M454 248h-34"
|
|
114
|
+
></path>
|
|
115
|
+
<path
|
|
116
|
+
stroke="#3B414D"
|
|
117
|
+
strokeWidth="6"
|
|
118
|
+
d="M107.969 73H347.69a6.969 6.969 0 016.968 6.969v178.397a6.968 6.968 0 01-6.968 6.968H107.969a6.969 6.969 0 01-6.969-6.968V79.969A6.969 6.969 0 01107.969 73zM104 99h248"
|
|
119
|
+
></path>
|
|
120
|
+
<path
|
|
121
|
+
stroke="#45B770"
|
|
122
|
+
strokeLinecap="round"
|
|
123
|
+
strokeLinejoin="round"
|
|
124
|
+
strokeWidth="8"
|
|
125
|
+
d="M77.181 224.512L127.905 236.375"
|
|
126
|
+
></path>
|
|
127
|
+
<path
|
|
128
|
+
fill="#B8E4F4"
|
|
129
|
+
d="M95.74 141.218c5.753 0 10.652 3.602 12.599 8.67a5.733 5.733 0 016.092 1.987 8.512 8.512 0 013.505-.757 8.557 8.557 0 110 17.114H81.002a8.557 8.557 0 111.69-16.945c1.523-5.792 6.78-10.069 13.049-10.069zM365.823 82c9.17 0 16.7 7.01 17.532 15.963a10.567 10.567 0 016.175-1.99c5.868 0 10.625 4.757 10.625 10.625 0 5.869-4.757 10.625-10.625 10.625h-48.094c-6.868 0-12.435-5.566-12.435-12.434 0-6.868 5.567-12.435 12.435-12.435 2.791 0 5.36.931 7.435 2.484C350.952 87.432 357.75 82 365.822 82zM23.296 75.456c5.752 0 10.651 3.602 12.598 8.669a5.733 5.733 0 011.559-.22c1.84 0 3.476.866 4.532 2.208a8.52 8.52 0 013.506-.757 8.557 8.557 0 110 17.114H8.557a8.557 8.557 0 111.69-16.945c1.523-5.792 6.78-10.07 13.049-10.07zM170.219 8.845c10.946 0 19.935 8.367 20.927 19.054a12.618 12.618 0 017.372-2.375c7.004 0 12.683 5.679 12.683 12.684 0 7.004-5.68 12.683-12.683 12.683h-57.41c-8.197 0-14.843-6.646-14.843-14.844 0-8.197 6.646-14.843 14.843-14.843 3.333 0 6.398 1.112 8.876 2.966 2.485-8.841 10.599-15.325 20.235-15.325zM297.892 0c5.752 0 10.651 3.602 12.598 8.669a5.728 5.728 0 011.56-.219c1.84 0 3.475.865 4.531 2.207a8.516 8.516 0 013.506-.757 8.557 8.557 0 110 17.114h-36.935a8.557 8.557 0 01-8.556-8.557 8.557 8.557 0 0110.248-8.388C286.366 4.277 291.622 0 297.892 0z"
|
|
130
|
+
></path>
|
|
131
|
+
</g>
|
|
132
|
+
</g>
|
|
133
|
+
</g>
|
|
134
|
+
</svg>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default TimeoutImage;
|
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
CheckmarkIcon,
|
|
21
21
|
BankIcon,
|
|
22
22
|
GenericCard,
|
|
23
|
-
PaymentIcon
|
|
23
|
+
PaymentIcon,
|
|
24
|
+
AutopayOnIcon
|
|
24
25
|
} from "./index";
|
|
25
26
|
|
|
26
27
|
const story = page({
|
|
@@ -48,3 +49,4 @@ export const checkmarkIcon = () => <CheckmarkIcon />;
|
|
|
48
49
|
export const bankIcon = () => <BankIcon />;
|
|
49
50
|
export const genericCard = () => <GenericCard />;
|
|
50
51
|
export const paymentIco = () => <PaymentIcon />;
|
|
52
|
+
export const autopayOnIcon = () => <AutopayOnIcon />;
|
|
@@ -18,6 +18,8 @@ import BankIcon from "./BankIcon";
|
|
|
18
18
|
import GenericCard from "./GenericCard";
|
|
19
19
|
import PaymentIcon from "./PaymentIcon";
|
|
20
20
|
import IconAdd from "./IconAdd";
|
|
21
|
+
import TimeoutImage from "./TimeoutImage";
|
|
22
|
+
import AutopayOnIcon from "./AutopayOnIcon";
|
|
21
23
|
|
|
22
24
|
export {
|
|
23
25
|
AccountsIcon,
|
|
@@ -39,5 +41,7 @@ export {
|
|
|
39
41
|
BankIcon,
|
|
40
42
|
GenericCard,
|
|
41
43
|
PaymentIcon,
|
|
42
|
-
IconAdd
|
|
44
|
+
IconAdd,
|
|
45
|
+
TimeoutImage,
|
|
46
|
+
AutopayOnIcon
|
|
43
47
|
};
|
|
@@ -26,4 +26,5 @@ export { default as ResetPasswordSuccess } from "./reset-password-success";
|
|
|
26
26
|
export { default as TabSidebar } from "./tab-sidebar";
|
|
27
27
|
export { default as TermsAndConditions } from "./terms-and-conditions";
|
|
28
28
|
export { default as TermsAndConditionsModal } from "./terms-and-conditions-modal";
|
|
29
|
+
export { default as Timeout } from "./timeout";
|
|
29
30
|
export { default as WorkflowTile } from "./workflow-tile";
|
|
@@ -13,22 +13,32 @@ const Obligation = ({
|
|
|
13
13
|
obligations,
|
|
14
14
|
actions,
|
|
15
15
|
autoPayEnabled,
|
|
16
|
+
autoPayAvailable,
|
|
17
|
+
handleAutopayAction,
|
|
18
|
+
deactivatePaymentSchedule,
|
|
19
|
+
autoPaySchedule,
|
|
20
|
+
navigateToSettings,
|
|
16
21
|
isMobile
|
|
17
22
|
}) => {
|
|
18
23
|
const obligation = obligations[0];
|
|
19
24
|
const { customAttributes } = obligation;
|
|
20
25
|
return (
|
|
21
26
|
<Box
|
|
22
|
-
|
|
27
|
+
padding="0"
|
|
23
28
|
borderRadius="4px"
|
|
24
29
|
boxShadow={`0px 0px 5px 0px ${GHOST_GREY}`}
|
|
25
30
|
>
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
<Box background={WHITE}>
|
|
32
|
+
<Stack childGap="14px">
|
|
33
|
+
<Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
|
|
34
|
+
<Cluster
|
|
35
|
+
justify="space-between"
|
|
36
|
+
align="center"
|
|
37
|
+
childGap="4px"
|
|
38
|
+
nowrap
|
|
39
|
+
>
|
|
40
|
+
<Box padding="0">
|
|
41
|
+
<Cluster justify="flex-start" align="center">
|
|
32
42
|
<IconModule
|
|
33
43
|
icon={config.icon}
|
|
34
44
|
iconDefault={config.iconDefault}
|
|
@@ -36,32 +46,59 @@ const Obligation = ({
|
|
|
36
46
|
iconValue={config.iconValue}
|
|
37
47
|
customAttributes={customAttributes}
|
|
38
48
|
/>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
<TitleModule
|
|
50
|
+
title={obligation.description}
|
|
51
|
+
subtitle={obligation.subDescription}
|
|
52
|
+
titleColor={BRIGHT_GREY}
|
|
53
|
+
isMobile={isMobile}
|
|
54
|
+
/>
|
|
55
|
+
</Cluster>
|
|
56
|
+
</Box>
|
|
57
|
+
{!isMobile && (
|
|
58
|
+
<AmountModule
|
|
59
|
+
totalAmountDue={obligations.reduce(
|
|
60
|
+
(acc, curr) => acc + curr.amountDue,
|
|
61
|
+
0
|
|
62
|
+
)}
|
|
63
|
+
autoPayEnabled={autoPayEnabled}
|
|
44
64
|
isMobile={isMobile}
|
|
65
|
+
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
66
|
+
navigateToSettings={navigateToSettings}
|
|
67
|
+
autoPaySchedule={autoPaySchedule}
|
|
45
68
|
/>
|
|
46
|
-
</Cluster>
|
|
47
|
-
</Box>
|
|
48
|
-
<AmountModule
|
|
49
|
-
totalAmountDue={obligations.reduce(
|
|
50
|
-
(acc, curr) => acc + curr.amountDue,
|
|
51
|
-
0
|
|
52
69
|
)}
|
|
70
|
+
</Cluster>
|
|
71
|
+
</Box>
|
|
72
|
+
{!isMobile && (
|
|
73
|
+
<PaymentDetailsActions
|
|
74
|
+
obligations={obligations}
|
|
53
75
|
autoPayEnabled={autoPayEnabled}
|
|
76
|
+
autoPayAvailable={autoPayAvailable}
|
|
77
|
+
handleAutopayAction={handleAutopayAction}
|
|
78
|
+
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
79
|
+
autoPaySchedule={autoPaySchedule}
|
|
80
|
+
navigateToSettings={navigateToSettings}
|
|
81
|
+
config={config}
|
|
82
|
+
actions={actions}
|
|
54
83
|
isMobile={isMobile}
|
|
55
84
|
/>
|
|
56
|
-
|
|
57
|
-
</
|
|
85
|
+
)}
|
|
86
|
+
</Stack>
|
|
87
|
+
</Box>
|
|
88
|
+
{isMobile && (
|
|
58
89
|
<PaymentDetailsActions
|
|
59
90
|
obligations={obligations}
|
|
91
|
+
autoPayEnabled={autoPayEnabled}
|
|
92
|
+
autoPayAvailable={autoPayAvailable}
|
|
93
|
+
handleAutopayAction={handleAutopayAction}
|
|
94
|
+
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
95
|
+
autoPaySchedule={autoPaySchedule}
|
|
96
|
+
navigateToSettings={navigateToSettings}
|
|
60
97
|
config={config}
|
|
61
98
|
actions={actions}
|
|
62
99
|
isMobile={isMobile}
|
|
63
100
|
/>
|
|
64
|
-
|
|
101
|
+
)}
|
|
65
102
|
</Box>
|
|
66
103
|
);
|
|
67
104
|
};
|
|
@@ -1,40 +1,48 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import Text from "../../../atoms/text";
|
|
3
3
|
import AmountCallout from "../../../atoms/amount-callout";
|
|
4
4
|
import { Box, Stack } from "../../../atoms/layouts";
|
|
5
|
-
import {
|
|
6
|
-
FONT_WEIGHT_SEMIBOLD,
|
|
7
|
-
FONT_WEIGHT_REGULAR
|
|
8
|
-
} from "../../../../constants/style_constants";
|
|
9
|
-
import { REGENT_GREY } from "../../../../constants/colors";
|
|
5
|
+
import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
|
|
10
6
|
import { displayCurrency } from "../../../../util/general";
|
|
7
|
+
import { AutopayModalModule } from "./AutopayModalModule";
|
|
11
8
|
|
|
12
|
-
const AmountModule = ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
textAlign="right"
|
|
25
|
-
/>
|
|
26
|
-
{autoPayEnabled && (
|
|
9
|
+
const AmountModule = ({
|
|
10
|
+
totalAmountDue,
|
|
11
|
+
autoPayEnabled,
|
|
12
|
+
isMobile,
|
|
13
|
+
deactivatePaymentSchedule,
|
|
14
|
+
navigateToSettings,
|
|
15
|
+
autoPaySchedule
|
|
16
|
+
}) => {
|
|
17
|
+
const [modalOpen, toggleModal] = useState(false);
|
|
18
|
+
return (
|
|
19
|
+
<Box padding="0 0.25rem 0 0">
|
|
20
|
+
<Stack childGap="0">
|
|
27
21
|
<Text
|
|
28
|
-
variant="
|
|
29
|
-
weight={
|
|
30
|
-
|
|
31
|
-
extraStyles={`font-style: italic; text-align: right;`}
|
|
22
|
+
variant="pS"
|
|
23
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
24
|
+
extraStyles={isMobile ? `text-align: left;` : `text-align: right;`}
|
|
32
25
|
>
|
|
33
|
-
{isMobile ? "
|
|
26
|
+
{isMobile ? "Total Due" : "Total Amount Due"}
|
|
34
27
|
</Text>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
<AmountCallout
|
|
29
|
+
amount={displayCurrency(totalAmountDue)}
|
|
30
|
+
textAlign={isMobile ? "left" : "right"}
|
|
31
|
+
/>
|
|
32
|
+
{autoPayEnabled && (
|
|
33
|
+
<AutopayModalModule
|
|
34
|
+
autoPayActive={autoPayEnabled}
|
|
35
|
+
autoPaySchedule={autoPaySchedule}
|
|
36
|
+
toggleModal={toggleModal}
|
|
37
|
+
modalOpen={modalOpen}
|
|
38
|
+
navigateToSettings={navigateToSettings}
|
|
39
|
+
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
40
|
+
isMobile={isMobile}
|
|
41
|
+
/>
|
|
42
|
+
)}
|
|
43
|
+
</Stack>
|
|
44
|
+
</Box>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
39
47
|
|
|
40
48
|
export default AmountModule;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Modal from "../../modal";
|
|
3
|
+
import ButtonWithAction from "../../../atoms/button-with-action";
|
|
4
|
+
import { AutopayOnIcon } from "../../../atoms/icons";
|
|
5
|
+
import { Box, Cluster } from "../../../atoms/layouts";
|
|
6
|
+
import { fallbackValues } from "./AutopayModalModule.theme";
|
|
7
|
+
import { themeComponent } from "../../../../util/themeUtils";
|
|
8
|
+
|
|
9
|
+
const AutopayModal = ({
|
|
10
|
+
autoPayActive,
|
|
11
|
+
autoPaySchedule,
|
|
12
|
+
toggleModal,
|
|
13
|
+
modalOpen,
|
|
14
|
+
deactivatePaymentSchedule,
|
|
15
|
+
navigateToSettings,
|
|
16
|
+
buttonLinkType,
|
|
17
|
+
isMobile,
|
|
18
|
+
themeValues
|
|
19
|
+
}) => {
|
|
20
|
+
const modalExtraProps = {
|
|
21
|
+
modalHeaderText: autoPayActive ? "Deactivate Autopay" : "Set Up Autopay",
|
|
22
|
+
modalBodyText: autoPayActive
|
|
23
|
+
? "Are you sure you want to deactivate autopay? You will need to manually make your next payment."
|
|
24
|
+
: "To set up autopay you must save a payment method and address in your profile. Do you want to save these now?",
|
|
25
|
+
continueButtonText: autoPayActive ? "Disable Autopay" : "Add to Profile",
|
|
26
|
+
useDangerButton: autoPayActive,
|
|
27
|
+
continueAction: autoPayActive
|
|
28
|
+
? () => {
|
|
29
|
+
deactivatePaymentSchedule(autoPaySchedule);
|
|
30
|
+
toggleModal(false);
|
|
31
|
+
}
|
|
32
|
+
: navigateToSettings
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const hoverStyles = `
|
|
36
|
+
&:hover {
|
|
37
|
+
.autopayIcon { fill: ${themeValues.hoverColor}; text-decoration: underline; cursor: pointer; }
|
|
38
|
+
}`;
|
|
39
|
+
|
|
40
|
+
const activeStyles = `
|
|
41
|
+
&:active {
|
|
42
|
+
.autopayIcon { fill: ${themeValues.activeColor}; text-decoration: underline; }
|
|
43
|
+
}`;
|
|
44
|
+
|
|
45
|
+
const defaultStyles = `
|
|
46
|
+
.autopayIcon { fill: ${themeValues.color}; text-decoration: underline; }
|
|
47
|
+
`;
|
|
48
|
+
return (
|
|
49
|
+
<Modal
|
|
50
|
+
ModalLink={() =>
|
|
51
|
+
buttonLinkType ? (
|
|
52
|
+
<ButtonWithAction
|
|
53
|
+
text={autoPayActive ? "Manage Autopay" : "Set Up Autopay"}
|
|
54
|
+
variant="tertiary"
|
|
55
|
+
action={() => {
|
|
56
|
+
toggleModal(true);
|
|
57
|
+
}}
|
|
58
|
+
dataQa="Manage Autopay"
|
|
59
|
+
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
60
|
+
/>
|
|
61
|
+
) : (
|
|
62
|
+
<Box
|
|
63
|
+
padding="0"
|
|
64
|
+
onClick={() => {
|
|
65
|
+
toggleModal(true);
|
|
66
|
+
}}
|
|
67
|
+
hoverStyles={hoverStyles}
|
|
68
|
+
activeStyles={activeStyles}
|
|
69
|
+
extraStyles={defaultStyles}
|
|
70
|
+
>
|
|
71
|
+
<Cluster
|
|
72
|
+
justify={isMobile ? "flex-start" : "flex-end"}
|
|
73
|
+
align="center"
|
|
74
|
+
>
|
|
75
|
+
<AutopayOnIcon />
|
|
76
|
+
<ButtonWithAction
|
|
77
|
+
text="Autopay On"
|
|
78
|
+
variant="smallGhost"
|
|
79
|
+
dataQa="Autopay On"
|
|
80
|
+
textExtraStyles={`font-size: 0.875rem; `}
|
|
81
|
+
extraStyles={`min-width: auto; padding: 0 0 0 6px;`}
|
|
82
|
+
/>
|
|
83
|
+
</Cluster>
|
|
84
|
+
</Box>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
showModal={() => toggleModal(true)}
|
|
88
|
+
hideModal={() => toggleModal(false)}
|
|
89
|
+
modalOpen={modalOpen}
|
|
90
|
+
{...modalExtraProps}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const AutopayModalModule = themeComponent(
|
|
96
|
+
AutopayModal,
|
|
97
|
+
"AutopayModal",
|
|
98
|
+
fallbackValues
|
|
99
|
+
);
|