@thecb/components 10.4.0-beta.8 → 10.4.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/dist/index.cjs.js +108 -88
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +108 -88
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.js +1 -1
- package/src/components/atoms/layouts/Box.js +0 -1
- package/src/components/molecules/link-card/LinkCard.js +2 -0
- package/src/components/molecules/modal/Modal.js +6 -2
- package/src/components/molecules/modal/Modal.stories.js +2 -0
- package/src/components/molecules/obligation/Obligation.js +5 -5
- package/src/components/molecules/obligation/modules/AmountModule.js +18 -3
- package/src/components/molecules/obligation/modules/AmountModule.stories.js +3 -0
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +22 -23
- package/src/components/molecules/obligation/modules/InactiveControlsModule.js +4 -4
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +8 -10
- package/src/components/molecules/obligation/modules/RemoveAccountModalModule.js +8 -5
package/package.json
CHANGED
|
@@ -135,7 +135,7 @@ const ButtonWithAction = forwardRef(
|
|
|
135
135
|
disabledStyles={disabledStyles}
|
|
136
136
|
aria-disabled={disabled}
|
|
137
137
|
as="button"
|
|
138
|
-
onClick={isLoading || disabled ?
|
|
138
|
+
onClick={isLoading || disabled ? noop : action}
|
|
139
139
|
borderRadius="2px"
|
|
140
140
|
theme={themeContext}
|
|
141
141
|
extraStyles={`margin: 0.5rem; ${extraStyles}`}
|
|
@@ -46,7 +46,8 @@ const Modal = ({
|
|
|
46
46
|
buttonExtraStyles,
|
|
47
47
|
children,
|
|
48
48
|
dataQa = null,
|
|
49
|
-
initialFocusSelector = ""
|
|
49
|
+
initialFocusSelector = "",
|
|
50
|
+
blurUnderlay = true
|
|
50
51
|
}) => {
|
|
51
52
|
const { isMobile } = useContext(ThemeContext);
|
|
52
53
|
const modalContainerRef = useRef(null);
|
|
@@ -66,7 +67,10 @@ const Modal = ({
|
|
|
66
67
|
display: "flex",
|
|
67
68
|
flexDirection: "column",
|
|
68
69
|
justifyContent: "center",
|
|
69
|
-
alignItems: "center"
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
background: "rgba(41, 42, 51, 0.45)",
|
|
72
|
+
backdropFilter: blurUnderlay ? "blur(4px)" : "none",
|
|
73
|
+
WebkitBackdropFilter: blurUnderlay ? "blur(4px)" : "none"
|
|
70
74
|
}}
|
|
71
75
|
dialogStyle={{
|
|
72
76
|
width: customWidth || "615px",
|
|
@@ -35,6 +35,7 @@ export const modal = () => (
|
|
|
35
35
|
defaultWrapper={boolean("defaultWrapper", true, groupId)}
|
|
36
36
|
onlyCloseButton={boolean("onlyCloseButton", false, groupId)}
|
|
37
37
|
maxHeight={text("maxHeight", null, groupId)}
|
|
38
|
+
blurUnderlay={boolean("blurUnderlay", true, groupId)}
|
|
38
39
|
/>
|
|
39
40
|
);
|
|
40
41
|
|
|
@@ -80,6 +81,7 @@ export const modalWithoutButtons = () => {
|
|
|
80
81
|
defaultWrapper={boolean("defaultWrapper", true, groupId)}
|
|
81
82
|
noButtons={boolean("noButtons", true, groupId)}
|
|
82
83
|
maxHeight={text("maxHeight", null, groupId)}
|
|
84
|
+
blurUnderlay={boolean("blurUnderlay", false, groupId)}
|
|
83
85
|
/>
|
|
84
86
|
);
|
|
85
87
|
};
|
|
@@ -115,7 +115,7 @@ const Obligation = ({
|
|
|
115
115
|
description={description}
|
|
116
116
|
subDescription={subDescription}
|
|
117
117
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
118
|
-
|
|
118
|
+
disableActions={isInCustomerManagement}
|
|
119
119
|
/>
|
|
120
120
|
)}
|
|
121
121
|
</Cluster>
|
|
@@ -139,7 +139,7 @@ const Obligation = ({
|
|
|
139
139
|
description={description}
|
|
140
140
|
subDescription={subDescription}
|
|
141
141
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
142
|
-
|
|
142
|
+
disableActions={isInCustomerManagement}
|
|
143
143
|
/>
|
|
144
144
|
)}
|
|
145
145
|
</Stack>
|
|
@@ -163,7 +163,7 @@ const Obligation = ({
|
|
|
163
163
|
description={description}
|
|
164
164
|
subDescription={subDescription}
|
|
165
165
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
166
|
-
|
|
166
|
+
disableActions={isInCustomerManagement}
|
|
167
167
|
/>
|
|
168
168
|
)}
|
|
169
169
|
</Box>
|
|
@@ -222,7 +222,7 @@ const Obligation = ({
|
|
|
222
222
|
description={description}
|
|
223
223
|
subDescription={subDescription}
|
|
224
224
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
225
|
-
|
|
225
|
+
disableActions={isInCustomerManagement}
|
|
226
226
|
/>
|
|
227
227
|
)}
|
|
228
228
|
</Cluster>
|
|
@@ -245,7 +245,7 @@ const Obligation = ({
|
|
|
245
245
|
description={description}
|
|
246
246
|
subDescription={subDescription}
|
|
247
247
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
248
|
-
|
|
248
|
+
disableActions={isInCustomerManagement}
|
|
249
249
|
/>
|
|
250
250
|
)}
|
|
251
251
|
</Stack>
|
|
@@ -3,7 +3,7 @@ import AmountCallout from "../../../atoms/amount-callout";
|
|
|
3
3
|
import { Box, Stack } from "../../../atoms/layouts";
|
|
4
4
|
import Text from "../../../atoms/text";
|
|
5
5
|
import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
|
|
6
|
-
import { displayCurrency } from "../../../../util/general";
|
|
6
|
+
import { displayCurrency, noop } from "../../../../util/general";
|
|
7
7
|
import { AutopayModalModule } from "./AutopayModalModule";
|
|
8
8
|
|
|
9
9
|
const AmountModule = ({
|
|
@@ -19,7 +19,7 @@ const AmountModule = ({
|
|
|
19
19
|
description,
|
|
20
20
|
subDescription,
|
|
21
21
|
allowedPaymentInstruments,
|
|
22
|
-
|
|
22
|
+
disableActions = false
|
|
23
23
|
}) => {
|
|
24
24
|
const [modalOpen, toggleModal] = useState(false);
|
|
25
25
|
return (
|
|
@@ -50,7 +50,22 @@ const AmountModule = ({
|
|
|
50
50
|
description={description}
|
|
51
51
|
subDescription={subDescription}
|
|
52
52
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
53
|
-
|
|
53
|
+
disableActions={disableActions}
|
|
54
|
+
action={disableActions ? noop : () => toggleModal(true)}
|
|
55
|
+
onClick={
|
|
56
|
+
disableActions
|
|
57
|
+
? noop
|
|
58
|
+
: () => {
|
|
59
|
+
toggleModal(true);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
onKeyPress={
|
|
63
|
+
disableActions
|
|
64
|
+
? noop
|
|
65
|
+
: e => {
|
|
66
|
+
e.key === "Enter" && toggleModal(true);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
54
69
|
/>
|
|
55
70
|
)}
|
|
56
71
|
</Stack>
|
|
@@ -17,6 +17,9 @@ export const amountModule = () => (
|
|
|
17
17
|
autoPaySchedule={{}}
|
|
18
18
|
paymentPlanSchedule={{}}
|
|
19
19
|
isPaymentPlan={boolean("isPaymentPlan", false, groupId)}
|
|
20
|
+
disableActions={boolean("disableActions", false, groupId)}
|
|
21
|
+
subDescription="Amount Module Subdescription"
|
|
22
|
+
description="Amount Module Description"
|
|
20
23
|
/>
|
|
21
24
|
);
|
|
22
25
|
|
|
@@ -28,7 +28,10 @@ const AutopayModal = ({
|
|
|
28
28
|
description,
|
|
29
29
|
subDescription,
|
|
30
30
|
allowedPaymentInstruments,
|
|
31
|
-
|
|
31
|
+
disableActions = false,
|
|
32
|
+
action,
|
|
33
|
+
onClick,
|
|
34
|
+
onKeyPress
|
|
32
35
|
}) => {
|
|
33
36
|
const generateMethodNeededText = (planText, allowedPaymentInstruments) => {
|
|
34
37
|
const allowsCard = allowedPaymentInstruments.includes(CC_METHOD);
|
|
@@ -85,16 +88,14 @@ const AutopayModal = ({
|
|
|
85
88
|
autoPayActive ? `Turn off ${shortPlan}` : `Set Up ${shortPlan}`
|
|
86
89
|
}
|
|
87
90
|
variant="secondary"
|
|
88
|
-
action={() =>
|
|
89
|
-
isInCustomerManagement ? noop : toggleModal(true);
|
|
90
|
-
}}
|
|
91
|
+
action={action || (() => toggleModal(true))}
|
|
91
92
|
dataQa="Turn off Autopay"
|
|
92
93
|
extraStyles={
|
|
93
94
|
isMobile
|
|
94
95
|
? `flex-grow: 1; width: 100%; margin: 0;`
|
|
95
96
|
: `flex-grow: 1; min-width: 165px;`
|
|
96
97
|
}
|
|
97
|
-
disabled={
|
|
98
|
+
disabled={disableActions}
|
|
98
99
|
/>
|
|
99
100
|
);
|
|
100
101
|
}
|
|
@@ -103,12 +104,10 @@ const AutopayModal = ({
|
|
|
103
104
|
<ButtonWithAction
|
|
104
105
|
text={autoPayActive ? `Manage ${shortPlan}` : `Set Up ${shortPlan}`}
|
|
105
106
|
variant="tertiary"
|
|
106
|
-
action={() =>
|
|
107
|
-
isInCustomerManagement ? noop : toggleModal(true);
|
|
108
|
-
}}
|
|
107
|
+
action={action || (() => toggleModal(true))}
|
|
109
108
|
dataQa="Manage Autopay"
|
|
110
109
|
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
111
|
-
disabled={
|
|
110
|
+
disabled={disableActions}
|
|
112
111
|
/>
|
|
113
112
|
);
|
|
114
113
|
}
|
|
@@ -116,9 +115,12 @@ const AutopayModal = ({
|
|
|
116
115
|
return (
|
|
117
116
|
<Box
|
|
118
117
|
padding="0"
|
|
119
|
-
onClick={
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
onClick={
|
|
119
|
+
onClick ||
|
|
120
|
+
(() => {
|
|
121
|
+
toggleModal(true);
|
|
122
|
+
})
|
|
123
|
+
}
|
|
122
124
|
hoverStyles={hoverStyles}
|
|
123
125
|
activeStyles={activeStyles}
|
|
124
126
|
extraStyles={"cursor: pointer;"}
|
|
@@ -130,15 +132,12 @@ const AutopayModal = ({
|
|
|
130
132
|
<AutopayOnIcon />
|
|
131
133
|
<Text
|
|
132
134
|
variant="pS"
|
|
133
|
-
onClick={() =>
|
|
134
|
-
isInCustomerManagement ? noop : toggleModal(true)
|
|
135
|
-
}
|
|
135
|
+
onClick={onClick || (() => toggleModal(true))}
|
|
136
136
|
onKeyPress={
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
137
|
+
onKeyPress ||
|
|
138
|
+
(e => {
|
|
139
|
+
e.key === "Enter" && toggleModal(true);
|
|
140
|
+
})
|
|
142
141
|
}
|
|
143
142
|
tabIndex="0"
|
|
144
143
|
dataQa={`${shortPlan} On`}
|
|
@@ -146,7 +145,7 @@ const AutopayModal = ({
|
|
|
146
145
|
weight={themeValues.fontWeight}
|
|
147
146
|
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
148
147
|
extraStyles={`padding-left: 0.25rem;`}
|
|
149
|
-
disabled={
|
|
148
|
+
disabled={disableActions}
|
|
150
149
|
>
|
|
151
150
|
{`${shortPlan} ${nextAutopayDate}`}
|
|
152
151
|
</Text>
|
|
@@ -158,8 +157,8 @@ const AutopayModal = ({
|
|
|
158
157
|
};
|
|
159
158
|
return (
|
|
160
159
|
<Modal
|
|
161
|
-
showModal={
|
|
162
|
-
hideModal={
|
|
160
|
+
showModal={() => toggleModal(true)}
|
|
161
|
+
hideModal={() => toggleModal(false)}
|
|
163
162
|
modalOpen={modalOpen}
|
|
164
163
|
{...modalExtraProps}
|
|
165
164
|
>
|
|
@@ -22,7 +22,7 @@ const InactiveControlsModule = ({
|
|
|
22
22
|
description,
|
|
23
23
|
subDescription,
|
|
24
24
|
allowedPaymentInstruments,
|
|
25
|
-
|
|
25
|
+
disableActions = false
|
|
26
26
|
}) => {
|
|
27
27
|
const [modalOpen, toggleModal] = useState(false);
|
|
28
28
|
const { deleteObligationAssoc } = actions;
|
|
@@ -59,17 +59,17 @@ const InactiveControlsModule = ({
|
|
|
59
59
|
description={description}
|
|
60
60
|
subDescription={subDescription}
|
|
61
61
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
62
|
-
|
|
62
|
+
disableActions={disableActions}
|
|
63
63
|
/>
|
|
64
64
|
</Box>
|
|
65
65
|
)}
|
|
66
66
|
<Box padding="0" extraStyles={`flex-grow: 1;`}>
|
|
67
67
|
<RemoveAccountModalModule
|
|
68
68
|
agencyName={agencyName}
|
|
69
|
-
removeAccount={
|
|
69
|
+
removeAccount={disableActions ? noop : handleRemoveAccount}
|
|
70
70
|
accountType={configType === "ACCOUNT" ? "Account" : "Property"}
|
|
71
71
|
isMobile={isMobile}
|
|
72
|
-
|
|
72
|
+
disableActions={disableActions}
|
|
73
73
|
/>
|
|
74
74
|
</Box>
|
|
75
75
|
</Cluster>
|
|
@@ -25,7 +25,7 @@ const PaymentDetailsActions = ({
|
|
|
25
25
|
description,
|
|
26
26
|
subDescription,
|
|
27
27
|
allowedPaymentInstruments,
|
|
28
|
-
|
|
28
|
+
disableActions = false
|
|
29
29
|
}) => {
|
|
30
30
|
const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
|
|
31
31
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -81,7 +81,7 @@ const PaymentDetailsActions = ({
|
|
|
81
81
|
description={description}
|
|
82
82
|
subDescription={subDescription}
|
|
83
83
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
84
|
-
isInCustomerManagement={
|
|
84
|
+
isInCustomerManagement={disableActions}
|
|
85
85
|
/>
|
|
86
86
|
</Cluster>
|
|
87
87
|
</Box>
|
|
@@ -122,7 +122,7 @@ const PaymentDetailsActions = ({
|
|
|
122
122
|
}}
|
|
123
123
|
dataQa="Set Up Autopay"
|
|
124
124
|
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
125
|
-
disabled={
|
|
125
|
+
disabled={disableActions}
|
|
126
126
|
/>
|
|
127
127
|
) : (
|
|
128
128
|
<AutopayModalModule
|
|
@@ -141,7 +141,7 @@ const PaymentDetailsActions = ({
|
|
|
141
141
|
description={description}
|
|
142
142
|
subDescription={subDescription}
|
|
143
143
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
144
|
-
|
|
144
|
+
disableActions={disableActions}
|
|
145
145
|
/>
|
|
146
146
|
)}
|
|
147
147
|
</Box>
|
|
@@ -149,13 +149,11 @@ const PaymentDetailsActions = ({
|
|
|
149
149
|
<Box padding={"0"}>
|
|
150
150
|
<ButtonWithAction
|
|
151
151
|
isLoading={isLoading}
|
|
152
|
-
action={
|
|
153
|
-
isInCustomerManagement ? noop : () => handleClick(obligations)
|
|
154
|
-
}
|
|
152
|
+
action={disableActions ? noop : () => handleClick(obligations)}
|
|
155
153
|
text="Pay Now"
|
|
156
154
|
variant={isMobile ? "smallSecondary" : "secondary"}
|
|
157
155
|
dataQa="Pay Now"
|
|
158
|
-
disabled={
|
|
156
|
+
disabled={disableActions}
|
|
159
157
|
/>
|
|
160
158
|
</Box>
|
|
161
159
|
)}
|
|
@@ -165,13 +163,13 @@ const PaymentDetailsActions = ({
|
|
|
165
163
|
<ButtonWithAction
|
|
166
164
|
isLoading={isLoading}
|
|
167
165
|
action={() =>
|
|
168
|
-
|
|
166
|
+
disableActions ? noop : () => handleClick(obligations)
|
|
169
167
|
}
|
|
170
168
|
text="Pay Now"
|
|
171
169
|
variant={isMobile ? "smallSecondary" : "secondary"}
|
|
172
170
|
dataQa="Pay Now"
|
|
173
171
|
extraStyles={isMobile && `flex-grow: 1; width: 100%; margin: 0;`}
|
|
174
|
-
disabled={
|
|
172
|
+
disabled={disableActions}
|
|
175
173
|
/>
|
|
176
174
|
</Box>
|
|
177
175
|
)}
|
|
@@ -2,6 +2,7 @@ import React, { useState } from "react";
|
|
|
2
2
|
import Modal from "../../modal";
|
|
3
3
|
import ButtonWithAction from "../../../atoms/button-with-action";
|
|
4
4
|
import { Box } from "../../../atoms/layouts";
|
|
5
|
+
import { noop } from "../../../../util/general";
|
|
5
6
|
|
|
6
7
|
const RemoveAccountModalModule = ({
|
|
7
8
|
agencyName,
|
|
@@ -9,7 +10,7 @@ const RemoveAccountModalModule = ({
|
|
|
9
10
|
removeAccount,
|
|
10
11
|
accountType,
|
|
11
12
|
isMobile,
|
|
12
|
-
|
|
13
|
+
disableActions = false
|
|
13
14
|
}) => {
|
|
14
15
|
const [modalIsOpen, setModalIsOpen] = useState(false);
|
|
15
16
|
const lastItem = [...obligations].pop();
|
|
@@ -41,8 +42,10 @@ const RemoveAccountModalModule = ({
|
|
|
41
42
|
} will be deactivated.`}
|
|
42
43
|
continueButtonText="Remove"
|
|
43
44
|
continueAction={() => {
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
if (!disableActions) {
|
|
46
|
+
removeAccount();
|
|
47
|
+
setModalIsOpen(false);
|
|
48
|
+
}
|
|
46
49
|
}}
|
|
47
50
|
useDangerButton
|
|
48
51
|
>
|
|
@@ -50,12 +53,12 @@ const RemoveAccountModalModule = ({
|
|
|
50
53
|
<ButtonWithAction
|
|
51
54
|
text="Remove"
|
|
52
55
|
variant="secondary"
|
|
53
|
-
action={
|
|
56
|
+
action={disableActions ? noop : () => setModalIsOpen(true)}
|
|
54
57
|
dataQa="Remove Account"
|
|
55
58
|
extraStyles={
|
|
56
59
|
isMobile ? `flex-grow: 1; width: 100%; margin: 0;` : `flex-grow: 1;`
|
|
57
60
|
}
|
|
58
|
-
disabled={
|
|
61
|
+
disabled={disableActions}
|
|
59
62
|
/>
|
|
60
63
|
</Box>
|
|
61
64
|
</Modal>
|