@thecb/components 5.8.1-beta.0 → 5.8.1-beta.3

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.0",
3
+ "version": "5.8.1-beta.3",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -31,7 +31,7 @@ const Obligation = ({
31
31
  inactiveLookupValue = ""
32
32
  }) => {
33
33
  const obligation = obligations[0];
34
- const { customAttributes } = obligation;
34
+ const customAttributes = obligation?.customAttributes ?? {};
35
35
  const boxShadowValue =
36
36
  "0px 4px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
37
37
  const activeObligation = (
@@ -42,6 +42,7 @@ const AmountModule = ({
42
42
  paymentPlanSchedule={paymentPlanSchedule}
43
43
  isPaymentPlan={isPaymentPlan}
44
44
  nextAutopayDate={nextAutopayDate}
45
+ controlType="link"
45
46
  />
46
47
  )}
47
48
  </Stack>
@@ -7,6 +7,7 @@ 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";
10
11
 
11
12
  const AutopayModal = ({
12
13
  autoPayActive,
@@ -16,7 +17,7 @@ const AutopayModal = ({
16
17
  modalOpen,
17
18
  deactivatePaymentSchedule,
18
19
  navigateToSettings,
19
- buttonLinkType,
20
+ controlType = "tertiary",
20
21
  isMobile,
21
22
  themeValues,
22
23
  isPaymentPlan,
@@ -62,24 +63,35 @@ const AutopayModal = ({
62
63
  const defaultStyles = `
63
64
  .autopayIcon { fill: ${themeValues.color}; text-decoration: underline; }
64
65
  `;
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
- ) : (
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={isMobile && `flex-grow: 1; width: 100%;`}
78
+ />
79
+ );
80
+ }
81
+ case "tertiary": {
82
+ return (
83
+ <ButtonWithAction
84
+ text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
85
+ variant="tertiary"
86
+ action={() => {
87
+ toggleModal(true);
88
+ }}
89
+ dataQa="Manage Autopay"
90
+ extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
91
+ />
92
+ );
93
+ }
94
+ case "link": {
83
95
  <Box
84
96
  padding="0"
85
97
  onClick={() => {
@@ -111,8 +123,18 @@ const AutopayModal = ({
111
123
  {`${planType} ${nextAutopayDate}`}
112
124
  </Text>
113
125
  </Cluster>
114
- </Box>
115
- )}
126
+ </Box>;
127
+ }
128
+ }
129
+ };
130
+ return (
131
+ <Modal
132
+ showModal={() => toggleModal(true)}
133
+ hideModal={() => toggleModal(false)}
134
+ modalOpen={modalOpen}
135
+ {...modalExtraProps}
136
+ >
137
+ {renderAutoPayControl()}
116
138
  </Modal>
117
139
  );
118
140
  };
@@ -40,12 +40,13 @@ const InactiveControlsModule = ({
40
40
  isPaymentPlan={isPaymentPlan}
41
41
  nextAutopayDate={nextAutopayDate}
42
42
  obligationAssocID={obligationAssocID}
43
+ controlType="secondary"
43
44
  />
44
45
  </Box>
45
46
  )}
46
47
  <Box padding="0" extraStyles={`flex-grow: 1;`}>
47
48
  <ButtonWithAction
48
- variant="tertiary"
49
+ variant="secondary"
49
50
  text="Remove"
50
51
  action={handleRemoveAccount}
51
52
  dataQa="Remove Account"
@@ -120,7 +120,7 @@ const PaymentDetailsActions = ({
120
120
  modalOpen={modalOpen}
121
121
  navigateToSettings={navigateToSettings}
122
122
  deactivatePaymentSchedule={deactivatePaymentSchedule}
123
- buttonLinkType
123
+ controlType="tertiary"
124
124
  isMobile={isMobile}
125
125
  paymentPlanSchedule={paymentPlanSchedule}
126
126
  isPaymentPlan={isPaymentPlan}