@thecb/components 5.8.1-beta.6 → 5.8.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": "5.8.1-beta.6",
3
+ "version": "5.8.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -25,21 +25,13 @@ const Obligation = ({
25
25
  isPaymentPlan,
26
26
  nextAutopayDate,
27
27
  obligationAssocID,
28
- inactive = false,
28
+ isActive = true,
29
29
  inactiveLookupTitle = "",
30
30
  inactiveLookupInput = "Account",
31
31
  inactiveLookupValue = ""
32
32
  }) => {
33
- /*
34
- The value of obligations is always an array. It can contain:
35
- - A single obligation
36
- - A group of obligations (a "collection")
37
-
38
- The top level desc/subdesc for all obligations in a collection is the same
39
- (Collection accounts look different in the Account Details page)
40
- */
41
- const firstObligation = obligations[0];
42
- const customAttributes = firstObligation?.customAttributes ?? {};
33
+ const obligation = obligations[0];
34
+ const { customAttributes } = obligation;
43
35
  const boxShadowValue =
44
36
  "0px 4px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
45
37
  const activeObligation = (
@@ -48,16 +40,11 @@ const Obligation = ({
48
40
  borderRadius="4px"
49
41
  boxShadow={boxShadowValue}
50
42
  as="section"
51
- aria-label={`${firstObligation?.description ??
52
- "account"} ${firstObligation?.subDescription ?? obligationAssocID}`}
43
+ aria-label={`${obligation.description} ${obligation.subDescription}`}
53
44
  >
54
- <Box background={WHITE} padding="24px 16px">
45
+ <Box background={WHITE}>
55
46
  <Stack childGap="14px">
56
- <Box
57
- key={`${firstObligation?.id}-top`}
58
- padding="0 8px"
59
- minWidth="100%"
60
- >
47
+ <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
61
48
  <Cluster
62
49
  justify="space-between"
63
50
  align="center"
@@ -76,8 +63,8 @@ const Obligation = ({
76
63
  />
77
64
  )}
78
65
  <TitleModule
79
- title={firstObligation?.description}
80
- subtitle={firstObligation?.subDescription}
66
+ title={obligation.description}
67
+ subtitle={obligation.subDescription}
81
68
  titleColor={BRIGHT_GREY}
82
69
  isMobile={isMobile}
83
70
  />
@@ -85,7 +72,7 @@ const Obligation = ({
85
72
  </Box>
86
73
  {!isMobile && (
87
74
  <AmountModule
88
- totalAmountDue={obligations?.reduce(
75
+ totalAmountDue={obligations.reduce(
89
76
  (acc, curr) => acc + curr.amountDue,
90
77
  0
91
78
  )}
@@ -150,7 +137,7 @@ const Obligation = ({
150
137
  >
151
138
  <Box background={ATHENS_GREY}>
152
139
  <Stack childGap="14px">
153
- <Box key={`${obligationAssocID}-top`} padding="0 8px" minWidth="100%">
140
+ <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
154
141
  <Cluster
155
142
  justify="space-between"
156
143
  align="center"
@@ -158,7 +145,7 @@ const Obligation = ({
158
145
  nowrap
159
146
  >
160
147
  <Box padding="0">
161
- <Cluster justify="flex-start" align="center" nowrap>
148
+ <Cluster justify="flex-start" align="center">
162
149
  <IconModule
163
150
  icon={config.icon}
164
151
  iconDefault={config.iconDefault}
@@ -210,7 +197,7 @@ const Obligation = ({
210
197
  </Box>
211
198
  );
212
199
 
213
- return inactive ? inactiveObligation : activeObligation;
200
+ return isActive ? activeObligation : inactiveObligation;
214
201
  };
215
202
 
216
203
  export default Obligation;
@@ -42,7 +42,6 @@ const AmountModule = ({
42
42
  paymentPlanSchedule={paymentPlanSchedule}
43
43
  isPaymentPlan={isPaymentPlan}
44
44
  nextAutopayDate={nextAutopayDate}
45
- controlType="link"
46
45
  />
47
46
  )}
48
47
  </Stack>
@@ -7,7 +7,6 @@ import { Box, Cluster } from "../../../atoms/layouts";
7
7
  import { SEA_GREEN } from "../../../../constants/colors";
8
8
  import { fallbackValues } from "./AutopayModalModule.theme";
9
9
  import { themeComponent } from "../../../../util/themeUtils";
10
- import { render } from "react-dom/cjs/react-dom.production.min";
11
10
 
12
11
  const AutopayModal = ({
13
12
  autoPayActive,
@@ -17,7 +16,7 @@ const AutopayModal = ({
17
16
  modalOpen,
18
17
  deactivatePaymentSchedule,
19
18
  navigateToSettings,
20
- controlType = "tertiary",
19
+ buttonLinkType,
21
20
  isMobile,
22
21
  themeValues,
23
22
  isPaymentPlan,
@@ -63,37 +62,24 @@ const AutopayModal = ({
63
62
  const defaultStyles = `
64
63
  .autopayIcon { fill: ${themeValues.color}; text-decoration: underline; }
65
64
  `;
66
- const renderAutoPayControl = () => {
67
- switch (controlType) {
68
- case "secondary": {
69
- return (
70
- <ButtonWithAction
71
- text={autoPayActive ? `Turn off ${planType}` : `Set Up ${planType}`}
72
- variant="secondary"
73
- action={() => {
74
- toggleModal(true);
75
- }}
76
- dataQa="Turn off Autopay"
77
- extraStyles={
78
- isMobile ? `flex-grow: 1; width: 100%;` : `margin: 0px`
79
- }
80
- />
81
- );
82
- }
83
- case "tertiary": {
84
- return (
85
- <ButtonWithAction
86
- text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
87
- variant="tertiary"
88
- action={() => {
89
- toggleModal(true);
90
- }}
91
- dataQa="Manage Autopay"
92
- extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
93
- />
94
- );
95
- }
96
- case "link": {
65
+ return (
66
+ <Modal
67
+ showModal={() => toggleModal(true)}
68
+ hideModal={() => toggleModal(false)}
69
+ modalOpen={modalOpen}
70
+ {...modalExtraProps}
71
+ >
72
+ {buttonLinkType ? (
73
+ <ButtonWithAction
74
+ text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
75
+ variant="tertiary"
76
+ action={() => {
77
+ toggleModal(true);
78
+ }}
79
+ dataQa="Manage Autopay"
80
+ extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
81
+ />
82
+ ) : (
97
83
  <Box
98
84
  padding="0"
99
85
  onClick={() => {
@@ -125,18 +111,8 @@ const AutopayModal = ({
125
111
  {`${planType} ${nextAutopayDate}`}
126
112
  </Text>
127
113
  </Cluster>
128
- </Box>;
129
- }
130
- }
131
- };
132
- return (
133
- <Modal
134
- showModal={() => toggleModal(true)}
135
- hideModal={() => toggleModal(false)}
136
- modalOpen={modalOpen}
137
- {...modalExtraProps}
138
- >
139
- {renderAutoPayControl()}
114
+ </Box>
115
+ )}
140
116
  </Modal>
141
117
  );
142
118
  };
@@ -25,7 +25,7 @@ const InactiveControlsModule = ({
25
25
  border={isMobile ? `1px solid ${GHOST_GREY}` : `0px`}
26
26
  borderWidthOverride={isMobile ? `1px 0 0 0` : `0px`}
27
27
  >
28
- <Cluster childGap={isMobile ? `8px` : `16px`} nowrap>
28
+ <Cluster childGap={isMobile ? `8px` : `18px`}>
29
29
  {autoPayEnabled && (
30
30
  <Box padding="0" extraStyles={`flex-grow: 1;`}>
31
31
  <AutopayModalModule
@@ -35,24 +35,22 @@ const InactiveControlsModule = ({
35
35
  modalOpen={modalOpen}
36
36
  navigateToSettings={navigateToSettings}
37
37
  deactivatePaymentSchedule={deactivatePaymentSchedule}
38
+ buttonLinkType
38
39
  isMobile={isMobile}
39
40
  paymentPlanSchedule={paymentPlanSchedule}
40
41
  isPaymentPlan={isPaymentPlan}
41
42
  nextAutopayDate={nextAutopayDate}
42
43
  obligationAssocID={obligationAssocID}
43
- controlType="secondary"
44
44
  />
45
45
  </Box>
46
46
  )}
47
47
  <Box padding="0" extraStyles={`flex-grow: 1;`}>
48
48
  <ButtonWithAction
49
- variant="secondary"
49
+ variant="tertiary"
50
50
  text="Remove"
51
51
  action={handleRemoveAccount}
52
52
  dataQa="Remove Account"
53
- extraStyles={
54
- isMobile ? `flex-grow: 1; width: 100%;` : `margin: 0px;`
55
- }
53
+ extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
56
54
  />
57
55
  </Box>
58
56
  </Cluster>
@@ -120,7 +120,7 @@ const PaymentDetailsActions = ({
120
120
  modalOpen={modalOpen}
121
121
  navigateToSettings={navigateToSettings}
122
122
  deactivatePaymentSchedule={deactivatePaymentSchedule}
123
- controlType="tertiary"
123
+ buttonLinkType
124
124
  isMobile={isMobile}
125
125
  paymentPlanSchedule={paymentPlanSchedule}
126
126
  isPaymentPlan={isPaymentPlan}
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file
Binary file