@thecb/components 7.6.1-beta.0 → 7.7.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.6.1-beta.0",
3
+ "version": "7.7.0-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -6,7 +6,6 @@ import {
6
6
  ATHENS_GREY,
7
7
  GRECIAN_GREY
8
8
  } from "../../../constants/colors";
9
- import { ACH_METHOD, CC_METHOD, CASH_METHOD } from "../../../constants/general";
10
9
  import {
11
10
  IconModule,
12
11
  TitleModule,
@@ -47,11 +46,6 @@ const Obligation = ({
47
46
  (Collection accounts look different in the Account Details page)
48
47
  */
49
48
  const firstObligation = obligations[0];
50
- const {
51
- allowedPaymentInstruments = [CASH_METHOD, CC_METHOD, ACH_METHOD],
52
- description = "Account",
53
- subDescription = obligationAssocID
54
- } = firstObligation;
55
49
  const customAttributes = firstObligation?.customAttributes ?? {};
56
50
  const boxShadowValue =
57
51
  "0px 2px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
@@ -61,7 +55,8 @@ const Obligation = ({
61
55
  borderRadius="4px"
62
56
  boxShadow={boxShadowValue}
63
57
  as="section"
64
- aria-label={`${description} - ${subDescription}`}
58
+ aria-label={`${firstObligation?.description ??
59
+ "account"} ${firstObligation?.subDescription ?? obligationAssocID}`}
65
60
  border={`1px solid ${GRECIAN_GREY}`}
66
61
  borderWidthOverride="1px 0 0 0"
67
62
  >
@@ -90,8 +85,8 @@ const Obligation = ({
90
85
  />
91
86
  )}
92
87
  <TitleModule
93
- title={description}
94
- subtitle={subDescription}
88
+ title={firstObligation?.description}
89
+ subtitle={firstObligation?.subDescription}
95
90
  titleColor={BRIGHT_GREY}
96
91
  isMobile={isMobile}
97
92
  />
@@ -111,9 +106,6 @@ const Obligation = ({
111
106
  paymentPlanSchedule={paymentPlanSchedule}
112
107
  isPaymentPlan={isPaymentPlan}
113
108
  nextAutopayDate={nextAutopayDate}
114
- description={description}
115
- subDescription={subDescription}
116
- allowedPaymentInstruments={allowedPaymentInstruments}
117
109
  />
118
110
  )}
119
111
  </Cluster>
@@ -134,9 +126,6 @@ const Obligation = ({
134
126
  isPaymentPlan={isPaymentPlan}
135
127
  nextAutopayDate={nextAutopayDate}
136
128
  obligationAssocID={obligationAssocID}
137
- description={description}
138
- subDescription={subDescription}
139
- allowedPaymentInstruments={allowedPaymentInstruments}
140
129
  />
141
130
  )}
142
131
  </Stack>
@@ -157,9 +146,6 @@ const Obligation = ({
157
146
  isPaymentPlan={isPaymentPlan}
158
147
  nextAutopayDate={nextAutopayDate}
159
148
  obligationAssocID={obligationAssocID}
160
- description={description}
161
- subDescription={subDescription}
162
- allowedPaymentInstruments={allowedPaymentInstruments}
163
149
  />
164
150
  )}
165
151
  </Box>
@@ -215,9 +201,6 @@ const Obligation = ({
215
201
  dueDate={dueDate}
216
202
  agencyName={agencyName}
217
203
  configType={config.type}
218
- description={description}
219
- subDescription={subDescription}
220
- allowedPaymentInstruments={allowedPaymentInstruments}
221
204
  />
222
205
  )}
223
206
  </Cluster>
@@ -237,9 +220,6 @@ const Obligation = ({
237
220
  dueDate={dueDate}
238
221
  agencyName={agencyName}
239
222
  configType={config.type}
240
- description={description}
241
- subDescription={subDescription}
242
- allowedPaymentInstruments={allowedPaymentInstruments}
243
223
  />
244
224
  )}
245
225
  </Stack>
@@ -15,10 +15,7 @@ const AmountModule = ({
15
15
  autoPaySchedule,
16
16
  paymentPlanSchedule,
17
17
  isPaymentPlan,
18
- nextAutopayDate,
19
- description,
20
- subDescription,
21
- allowedPaymentInstruments
18
+ nextAutopayDate
22
19
  }) => {
23
20
  const [modalOpen, toggleModal] = useState(false);
24
21
  return (
@@ -46,9 +43,6 @@ const AmountModule = ({
46
43
  isPaymentPlan={isPaymentPlan}
47
44
  nextAutopayDate={nextAutopayDate}
48
45
  controlType="link"
49
- description={description}
50
- subDescription={subDescription}
51
- allowedPaymentInstruments={allowedPaymentInstruments}
52
46
  />
53
47
  )}
54
48
  </Stack>
@@ -5,10 +5,8 @@ import Text from "../../../atoms/text";
5
5
  import { AutopayOnIcon } from "../../../atoms/icons";
6
6
  import { Box, Cluster } from "../../../atoms/layouts";
7
7
  import { SEA_GREEN } from "../../../../constants/colors";
8
- import { ACH_METHOD, CC_METHOD } from "../../../../constants/general";
9
8
  import { fallbackValues } from "./AutopayModalModule.theme";
10
9
  import { themeComponent } from "../../../../util/themeUtils";
11
- import { titleCaseString } from "../../../../util/general";
12
10
 
13
11
  const AutopayModal = ({
14
12
  autoPayActive,
@@ -24,41 +22,27 @@ const AutopayModal = ({
24
22
  isPaymentPlan,
25
23
  nextAutopayDate,
26
24
  dueDate,
27
- inactive,
28
- description,
29
- subDescription,
30
- allowedPaymentInstruments
25
+ inactive
31
26
  }) => {
32
- const generateMethodNeededText = (planText, allowedPaymentInstruments) => {
33
- const allowsCard = allowedPaymentInstruments.includes(CC_METHOD);
34
- const allowsACH = allowedPaymentInstruments.includes(ACH_METHOD);
35
- const methodRequired =
36
- allowsCard && !allowsACH
37
- ? "debit or credit card payment method"
38
- : !allowsCard && allowsACH
39
- ? "checking account payment method"
40
- : "payment method";
41
-
42
- return `To setup ${planText} you must have a saved ${methodRequired} and address in your profile. Do you want to save these now?`;
43
- };
44
- const plan = isPaymentPlan ? "your payment plan" : "autopay";
45
- const shortPlan = isPaymentPlan ? "Payment Plan" : "Autopay";
46
- const deactivateText = `deactivate ${shortPlan} for ${description}: ${subDescription}`;
47
- const activateText = `Set Up ${shortPlan} for ${description}: ${subDescription}`;
27
+ const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
48
28
  const nextDate = dueDate || nextAutopayDate;
49
29
  const modalExtraProps = {
50
30
  modalHeaderText: autoPayActive
51
- ? titleCaseString(deactivateText)
52
- : titleCaseString(activateText),
31
+ ? `Deactivate ${planType}`
32
+ : `Set Up ${planType}`,
53
33
  modalBodyText: autoPayActive
54
- ? `Are you sure you want to deactivate ${plan}? ${
34
+ ? `Are you sure you want to deactivate ${
35
+ isPaymentPlan ? "your payment plan" : "autopay"
36
+ }? ${
55
37
  !inactive && nextDate
56
38
  ? `Your next payment will be due on ${nextDate}.`
57
39
  : ""
58
40
  }`
59
- : generateMethodNeededText(plan, allowedPaymentInstruments),
41
+ : `To set up ${
42
+ isPaymentPlan ? "a payment plan" : "autopay"
43
+ } you must save a payment method and address in your profile. Do you want to save these now?`,
60
44
  continueButtonText: autoPayActive
61
- ? `Disable ${shortPlan}`
45
+ ? `Disable ${planType}`
62
46
  : "Add to Profile",
63
47
  useDangerButton: autoPayActive,
64
48
  continueAction: autoPayActive
@@ -90,9 +74,7 @@ const AutopayModal = ({
90
74
  case "secondary": {
91
75
  return (
92
76
  <ButtonWithAction
93
- text={
94
- autoPayActive ? `Turn off ${shortPlan}` : `Set Up ${shortPlan}`
95
- }
77
+ text={autoPayActive ? `Turn off ${planType}` : `Set Up ${planType}`}
96
78
  variant="secondary"
97
79
  action={() => {
98
80
  toggleModal(true);
@@ -109,7 +91,7 @@ const AutopayModal = ({
109
91
  case "tertiary": {
110
92
  return (
111
93
  <ButtonWithAction
112
- text={autoPayActive ? `Manage ${shortPlan}` : `Set Up ${shortPlan}`}
94
+ text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
113
95
  variant="tertiary"
114
96
  action={() => {
115
97
  toggleModal(true);
@@ -142,13 +124,13 @@ const AutopayModal = ({
142
124
  e.key === "Enter" && toggleModal(true);
143
125
  }}
144
126
  tabIndex="0"
145
- dataQa={`${shortPlan} On`}
127
+ dataQa={`${planType} On`}
146
128
  color={SEA_GREEN}
147
129
  weight={themeValues.fontWeight}
148
130
  hoverStyles={themeValues.modalLinkHoverFocus}
149
131
  extraStyles={`padding-left: 0.25rem;`}
150
132
  >
151
- {`${shortPlan} ${nextAutopayDate}`}
133
+ {`${planType} ${nextAutopayDate}`}
152
134
  </Text>
153
135
  </Cluster>
154
136
  </Box>
@@ -18,10 +18,7 @@ const InactiveControlsModule = ({
18
18
  dueDate,
19
19
  agencyName,
20
20
  configType,
21
- actions,
22
- description,
23
- subDescription,
24
- allowedPaymentInstruments
21
+ actions
25
22
  }) => {
26
23
  const [modalOpen, toggleModal] = useState(false);
27
24
  const { deleteObligationAssoc } = actions;
@@ -55,9 +52,6 @@ const InactiveControlsModule = ({
55
52
  dueDate={dueDate}
56
53
  controlType="secondary"
57
54
  inactive
58
- description={description}
59
- subDescription={subDescription}
60
- allowedPaymentInstruments={allowedPaymentInstruments}
61
55
  />
62
56
  </Box>
63
57
  )}
@@ -20,10 +20,7 @@ const PaymentDetailsActions = ({
20
20
  isPaymentPlan,
21
21
  nextAutopayDate,
22
22
  obligationAssocID,
23
- dueDate,
24
- description,
25
- subDescription,
26
- allowedPaymentInstruments
23
+ dueDate
27
24
  }) => {
28
25
  const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
29
26
  const [isLoading, setIsLoading] = useState(false);
@@ -76,9 +73,6 @@ const PaymentDetailsActions = ({
76
73
  paymentPlanSchedule={paymentPlanSchedule}
77
74
  isPaymentPlan={isPaymentPlan}
78
75
  nextAutopayDate={nextAutopayDate}
79
- description={description}
80
- subDescription={subDescription}
81
- allowedPaymentInstruments={allowedPaymentInstruments}
82
76
  />
83
77
  </Cluster>
84
78
  </Box>
@@ -134,9 +128,6 @@ const PaymentDetailsActions = ({
134
128
  isPaymentPlan={isPaymentPlan}
135
129
  nextAutopayDate={nextAutopayDate}
136
130
  dueDate={dueDate}
137
- description={description}
138
- subDescription={subDescription}
139
- allowedPaymentInstruments={allowedPaymentInstruments}
140
131
  />
141
132
  )}
142
133
  </Box>
@@ -48,10 +48,7 @@ const RadioGroup = ({
48
48
  groupName={groupName}
49
49
  setValue={setValue}
50
50
  handleChange={handleChange}
51
- aria-invalid={
52
- (field.dirty && field.hasErrors) ||
53
- (field.hasErrors && showErrors)
54
- }
51
+ aria-invalid={(field.dirty && field.hasErrors) || field.hasErrors}
55
52
  />
56
53
  ))}
57
54
  </Stack>
@@ -144,18 +144,3 @@ export const throttle = (delay, fn) => {
144
144
  return fn(...args);
145
145
  };
146
146
  };
147
-
148
- export const titleCaseWord = word => {
149
- return word.charAt(0).toUpperCase() + word.slice(1);
150
- };
151
-
152
- export const titleCaseString = string => {
153
- return string
154
- .split(" ")
155
- .map((word, index, string) =>
156
- index === 0 || index === string.length - 1 || word.length > 3
157
- ? titleCaseWord(word.toLowerCase())
158
- : word
159
- )
160
- .join(" ");
161
- };
@@ -1,3 +0,0 @@
1
- export const ACH_METHOD = "BANK_ACCOUNT";
2
- export const CC_METHOD = "CREDIT_CARD";
3
- export const CASH_METHOD = "CASH";