@thecb/components 11.1.3 → 11.1.4
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 +115 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +115 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/obligation/Obligation.js +111 -2
- package/src/components/molecules/obligation/Obligation.stories.js +61 -0
- package/src/components/molecules/obligation/modules/AmountModule.js +64 -38
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +3 -1
- package/src/components/atoms/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -44,7 +44,8 @@ const Obligation = ({
|
|
|
44
44
|
cartEnabled = false,
|
|
45
45
|
cartConfig = undefined,
|
|
46
46
|
multiCartParams = undefined,
|
|
47
|
-
isInCart = false
|
|
47
|
+
isInCart = false,
|
|
48
|
+
isLoading = false
|
|
48
49
|
}) => {
|
|
49
50
|
/*
|
|
50
51
|
The value of obligations is always an array. It can contain:
|
|
@@ -63,6 +64,110 @@ const Obligation = ({
|
|
|
63
64
|
const customAttributes = firstObligation?.customAttributes ?? {};
|
|
64
65
|
const boxShadowValue =
|
|
65
66
|
"0px 2px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
|
|
67
|
+
|
|
68
|
+
const loadingObligation = (
|
|
69
|
+
<Box
|
|
70
|
+
padding="0"
|
|
71
|
+
borderRadius="4px"
|
|
72
|
+
boxShadow={boxShadowValue}
|
|
73
|
+
as="section"
|
|
74
|
+
aria-label={`${description} - ${subDescription}`}
|
|
75
|
+
border={`1px solid ${GRECIAN_GREY}`}
|
|
76
|
+
borderWidthOverride="1px 0 0 0"
|
|
77
|
+
>
|
|
78
|
+
<Box background={WHITE} padding={isMobile ? "16px" : "24px 16px"}>
|
|
79
|
+
<Stack childGap="24px">
|
|
80
|
+
<Box
|
|
81
|
+
key={`${firstObligation?.id}-top`}
|
|
82
|
+
padding="0 8px"
|
|
83
|
+
minWidth="100%"
|
|
84
|
+
>
|
|
85
|
+
<Cluster
|
|
86
|
+
justify="space-between"
|
|
87
|
+
align="center"
|
|
88
|
+
childGap="4px"
|
|
89
|
+
nowrap
|
|
90
|
+
>
|
|
91
|
+
<Box padding="0">
|
|
92
|
+
<Cluster justify="flex-start" align="center">
|
|
93
|
+
{!isMobile && (
|
|
94
|
+
<IconModule
|
|
95
|
+
icon={config.icon}
|
|
96
|
+
iconDefault={config.iconDefault}
|
|
97
|
+
configIconMap={config.iconMap}
|
|
98
|
+
iconValue={config.iconValue}
|
|
99
|
+
customAttributes={customAttributes}
|
|
100
|
+
iconColor={themeValues.iconColor}
|
|
101
|
+
/>
|
|
102
|
+
)}
|
|
103
|
+
<TitleModule
|
|
104
|
+
title={description}
|
|
105
|
+
subtitle={subDescription}
|
|
106
|
+
titleColor={BRIGHT_GREY}
|
|
107
|
+
isMobile={isMobile}
|
|
108
|
+
/>
|
|
109
|
+
</Cluster>
|
|
110
|
+
</Box>
|
|
111
|
+
{!isMobile && (
|
|
112
|
+
<AmountModule
|
|
113
|
+
isMobile={isMobile}
|
|
114
|
+
disableActions={true}
|
|
115
|
+
isLoading={true}
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
118
|
+
</Cluster>
|
|
119
|
+
</Box>
|
|
120
|
+
{!isMobile && (
|
|
121
|
+
<PaymentDetailsActions
|
|
122
|
+
obligations={obligations}
|
|
123
|
+
autoPayEnabled={autoPayEnabled}
|
|
124
|
+
autoPayAvailable={autoPayAvailable}
|
|
125
|
+
handleAutopayAction={handleAutopayAction}
|
|
126
|
+
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
127
|
+
autoPaySchedule={autoPaySchedule}
|
|
128
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
129
|
+
navigateToSettings={navigateToSettings}
|
|
130
|
+
config={config}
|
|
131
|
+
actions={actions}
|
|
132
|
+
isMobile={isMobile}
|
|
133
|
+
description={description}
|
|
134
|
+
subDescription={subDescription}
|
|
135
|
+
disableActions={true}
|
|
136
|
+
cartEnabled={cartEnabled}
|
|
137
|
+
cartConfig={cartConfig}
|
|
138
|
+
multiCartParams={multiCartParams}
|
|
139
|
+
isInCart={isInCart}
|
|
140
|
+
isContentLoading={true}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
</Stack>
|
|
144
|
+
</Box>
|
|
145
|
+
{isMobile && (
|
|
146
|
+
<PaymentDetailsActions
|
|
147
|
+
obligations={obligations}
|
|
148
|
+
autoPayEnabled={autoPayEnabled}
|
|
149
|
+
autoPayAvailable={autoPayAvailable}
|
|
150
|
+
handleAutopayAction={handleAutopayAction}
|
|
151
|
+
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
152
|
+
autoPaySchedule={autoPaySchedule}
|
|
153
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
154
|
+
navigateToSettings={navigateToSettings}
|
|
155
|
+
config={config}
|
|
156
|
+
actions={actions}
|
|
157
|
+
isMobile={isMobile}
|
|
158
|
+
description={description}
|
|
159
|
+
subDescription={subDescription}
|
|
160
|
+
disableActions={true}
|
|
161
|
+
cartEnabled={cartEnabled}
|
|
162
|
+
cartConfig={cartConfig}
|
|
163
|
+
multiCartParams={multiCartParams}
|
|
164
|
+
isInCart={isInCart}
|
|
165
|
+
isContentLoading={true}
|
|
166
|
+
/>
|
|
167
|
+
)}
|
|
168
|
+
</Box>
|
|
169
|
+
);
|
|
170
|
+
|
|
66
171
|
const activeObligation = (
|
|
67
172
|
<Box
|
|
68
173
|
padding="0"
|
|
@@ -270,7 +375,11 @@ const Obligation = ({
|
|
|
270
375
|
</Box>
|
|
271
376
|
);
|
|
272
377
|
|
|
273
|
-
return
|
|
378
|
+
return isLoading
|
|
379
|
+
? loadingObligation
|
|
380
|
+
: inactive
|
|
381
|
+
? inactiveObligation
|
|
382
|
+
: activeObligation;
|
|
274
383
|
};
|
|
275
384
|
|
|
276
385
|
export default themeComponent(Obligation, "Obligation", fallbackValues);
|
|
@@ -570,3 +570,64 @@ export const CartEnabledObligation = {
|
|
|
570
570
|
</Box>
|
|
571
571
|
)
|
|
572
572
|
};
|
|
573
|
+
|
|
574
|
+
export const LoadingObligation = {
|
|
575
|
+
args: {
|
|
576
|
+
config: { ...obligationConfig, icon: "ACCOUNTS_HEALTH" },
|
|
577
|
+
obligations: [
|
|
578
|
+
{
|
|
579
|
+
allowedPaymentInstruments: ["CASH", "CREDIT_CARD", "BANK_ACCOUNT"],
|
|
580
|
+
amountDue: 5438,
|
|
581
|
+
customAttributes: {
|
|
582
|
+
account_number: "1006",
|
|
583
|
+
city: "Cityville",
|
|
584
|
+
client_slug: "Cityville",
|
|
585
|
+
customer_name: "Shadout Mapes",
|
|
586
|
+
name: "Shadout Mapes",
|
|
587
|
+
service_type: "water",
|
|
588
|
+
sub_client_slug: "cityville-water",
|
|
589
|
+
utility_type: "water",
|
|
590
|
+
zip_code: "79221"
|
|
591
|
+
},
|
|
592
|
+
id: "1006",
|
|
593
|
+
kind: "FEE",
|
|
594
|
+
description: "Cityville Water Management",
|
|
595
|
+
subDescription: "Account: 1006",
|
|
596
|
+
details: {
|
|
597
|
+
description: "Cityville Water Management",
|
|
598
|
+
subDescription: "Account: 1006"
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
],
|
|
602
|
+
actions: {
|
|
603
|
+
createPaymentFromProfile: fn(),
|
|
604
|
+
configureMultiCart: fn(),
|
|
605
|
+
addToMultiCart: fn(),
|
|
606
|
+
openCartSlider: fn(),
|
|
607
|
+
setDetailedObligation: fn(),
|
|
608
|
+
navigateToDetailedObligation: fn(),
|
|
609
|
+
deleteObligationAssoc: fn()
|
|
610
|
+
},
|
|
611
|
+
autoPayEnabled: false,
|
|
612
|
+
autoPayAvailable: true,
|
|
613
|
+
handleAutopayAction: fn(),
|
|
614
|
+
navigateToSettings: fn(),
|
|
615
|
+
deactivatePaymentSchedule: fn(),
|
|
616
|
+
isMobile: false,
|
|
617
|
+
nextAutopayDate: "",
|
|
618
|
+
obligationAssocID: "046d66b9-5cea-4ccf-895a-97f21f314b72",
|
|
619
|
+
dueDate: "2024-09-01",
|
|
620
|
+
agencyName: "Health Service System",
|
|
621
|
+
isInCustomerManagement: false,
|
|
622
|
+
inactive: false,
|
|
623
|
+
inactiveLookupInput: undefined,
|
|
624
|
+
inactiveLookupTitle: "Health Service System",
|
|
625
|
+
inactiveLookupValue: "012856",
|
|
626
|
+
isLoading: true
|
|
627
|
+
},
|
|
628
|
+
render: args => (
|
|
629
|
+
<Box minWidth="800px">
|
|
630
|
+
<Obligation {...args} />
|
|
631
|
+
</Box>
|
|
632
|
+
)
|
|
633
|
+
};
|
|
@@ -5,6 +5,8 @@ import Text from "../../../atoms/text";
|
|
|
5
5
|
import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
|
|
6
6
|
import { displayCurrency, noop } from "../../../../util/general";
|
|
7
7
|
import AutopayModalModule from "./AutopayModalModule";
|
|
8
|
+
import LoadingLine from "../../../atoms/loading-line";
|
|
9
|
+
import { GRECIAN_GREY } from "../../../../constants/colors";
|
|
8
10
|
|
|
9
11
|
const AmountModule = ({
|
|
10
12
|
totalAmountDue,
|
|
@@ -19,7 +21,8 @@ const AmountModule = ({
|
|
|
19
21
|
description,
|
|
20
22
|
subDescription,
|
|
21
23
|
allowedPaymentInstruments,
|
|
22
|
-
disableActions = false
|
|
24
|
+
disableActions = false,
|
|
25
|
+
isLoading = false
|
|
23
26
|
}) => {
|
|
24
27
|
const [modalOpen, toggleModal] = useState(false);
|
|
25
28
|
return (
|
|
@@ -30,43 +33,66 @@ const AmountModule = ({
|
|
|
30
33
|
Amount Due
|
|
31
34
|
</Text>
|
|
32
35
|
)}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
36
|
+
{isLoading ? (
|
|
37
|
+
<>
|
|
38
|
+
<LoadingLine
|
|
39
|
+
minWidth={"70"}
|
|
40
|
+
maxWidth={"80"}
|
|
41
|
+
height={"26px"}
|
|
42
|
+
margin={isMobile ? "0" : "0 0 0 auto"}
|
|
43
|
+
foregroundColor={GRECIAN_GREY}
|
|
44
|
+
style={{ borderRadius: "0.125rem" }}
|
|
45
|
+
/>
|
|
46
|
+
<LoadingLine
|
|
47
|
+
minWidth={"134"}
|
|
48
|
+
maxWidth={"178"}
|
|
49
|
+
height={"21px"}
|
|
50
|
+
margin={isMobile ? "0.25rem 0 0 0" : "0.25rem 0 0 auto"}
|
|
51
|
+
foregroundColor={GRECIAN_GREY}
|
|
52
|
+
style={{ borderRadius: "0.125rem" }}
|
|
53
|
+
/>
|
|
54
|
+
</>
|
|
55
|
+
) : (
|
|
56
|
+
<>
|
|
57
|
+
<AmountCallout
|
|
58
|
+
amount={displayCurrency(totalAmountDue)}
|
|
59
|
+
textAlign={isMobile ? "left" : "right"}
|
|
60
|
+
/>
|
|
61
|
+
{autoPayEnabled && (
|
|
62
|
+
<AutopayModalModule
|
|
63
|
+
autoPayActive={autoPayEnabled}
|
|
64
|
+
autoPaySchedule={autoPaySchedule}
|
|
65
|
+
toggleModal={toggleModal}
|
|
66
|
+
modalOpen={modalOpen}
|
|
67
|
+
navigateToSettings={navigateToSettings}
|
|
68
|
+
deactivatePaymentSchedule={deactivatePaymentSchedule}
|
|
69
|
+
isMobile={isMobile}
|
|
70
|
+
paymentPlanSchedule={paymentPlanSchedule}
|
|
71
|
+
isPaymentPlan={isPaymentPlan}
|
|
72
|
+
nextAutopayDate={nextAutopayDate}
|
|
73
|
+
controlType="link"
|
|
74
|
+
description={description}
|
|
75
|
+
subDescription={subDescription}
|
|
76
|
+
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
77
|
+
disableActions={disableActions}
|
|
78
|
+
action={disableActions ? noop : () => toggleModal(true)}
|
|
79
|
+
onClick={
|
|
80
|
+
disableActions
|
|
81
|
+
? noop
|
|
82
|
+
: () => {
|
|
83
|
+
toggleModal(true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
onKeyPress={
|
|
87
|
+
disableActions
|
|
88
|
+
? noop
|
|
89
|
+
: e => {
|
|
90
|
+
e.key === "Enter" && toggleModal(true);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
95
|
+
</>
|
|
70
96
|
)}
|
|
71
97
|
</Stack>
|
|
72
98
|
</Box>
|
|
@@ -28,7 +28,8 @@ const PaymentDetailsActions = ({
|
|
|
28
28
|
disableActions = false,
|
|
29
29
|
cartEnabled,
|
|
30
30
|
cartConfig,
|
|
31
|
-
isInCart
|
|
31
|
+
isInCart,
|
|
32
|
+
isContentLoading
|
|
32
33
|
}) => {
|
|
33
34
|
const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
|
|
34
35
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -110,6 +111,7 @@ const PaymentDetailsActions = ({
|
|
|
110
111
|
subDescription={subDescription}
|
|
111
112
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
112
113
|
isInCustomerManagement={disableActions}
|
|
114
|
+
isLoading={isContentLoading}
|
|
113
115
|
/>
|
|
114
116
|
</Cluster>
|
|
115
117
|
</Box>
|
|
Binary file
|