@thecb/components 10.4.0-beta.11 → 10.4.0-beta.13

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": "10.4.0-beta.11",
3
+ "version": "10.4.0-beta.13",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -3,9 +3,8 @@ 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
- import { noop } from "../../../../util/general";
9
8
 
10
9
  const AmountModule = ({
11
10
  totalAmountDue,
@@ -52,8 +51,14 @@ const AmountModule = ({
52
51
  subDescription={subDescription}
53
52
  allowedPaymentInstruments={allowedPaymentInstruments}
54
53
  disableActions={disableActions}
55
- action={() => (disableActions ? noop : toggleModal(true))}
56
- onClick={() => (disableActions ? noop : toggleModal(true))}
54
+ action={disableActions ? () => noop : () => toggleModal(true)}
55
+ onClick={
56
+ disableActions
57
+ ? () => noop
58
+ : () => {
59
+ toggleModal(true);
60
+ }
61
+ }
57
62
  onKeyPress={
58
63
  disableActions
59
64
  ? () => noop
@@ -88,9 +88,7 @@ const AutopayModal = ({
88
88
  autoPayActive ? `Turn off ${shortPlan}` : `Set Up ${shortPlan}`
89
89
  }
90
90
  variant="secondary"
91
- action={() => {
92
- action || toggleModal(true);
93
- }}
91
+ action={action || (() => toggleModal(true))}
94
92
  dataQa="Turn off Autopay"
95
93
  extraStyles={
96
94
  isMobile
@@ -106,9 +104,7 @@ const AutopayModal = ({
106
104
  <ButtonWithAction
107
105
  text={autoPayActive ? `Manage ${shortPlan}` : `Set Up ${shortPlan}`}
108
106
  variant="tertiary"
109
- action={() => {
110
- action || toggleModal(true);
111
- }}
107
+ action={action || (() => toggleModal(true))}
112
108
  dataQa="Manage Autopay"
113
109
  extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
114
110
  disabled={disableActions}
@@ -119,9 +115,12 @@ const AutopayModal = ({
119
115
  return (
120
116
  <Box
121
117
  padding="0"
122
- onClick={() => {
123
- onClick || toggleModal(true);
124
- }}
118
+ onClick={
119
+ onClick ||
120
+ (() => {
121
+ toggleModal(true);
122
+ })
123
+ }
125
124
  hoverStyles={hoverStyles}
126
125
  activeStyles={activeStyles}
127
126
  extraStyles={"cursor: pointer;"}
@@ -133,7 +132,7 @@ const AutopayModal = ({
133
132
  <AutopayOnIcon />
134
133
  <Text
135
134
  variant="pS"
136
- onClick={() => onClick || toggleModal(true)}
135
+ onClick={onClick || (() => toggleModal(true))}
137
136
  onKeyPress={
138
137
  onKeyPress ||
139
138
  (e => {
@@ -158,8 +157,8 @@ const AutopayModal = ({
158
157
  };
159
158
  return (
160
159
  <Modal
161
- showModal={disableActions ? noop : () => toggleModal(true)}
162
- hideModal={disableActions ? noop : () => toggleModal(false)}
160
+ showModal={() => toggleModal(true)}
161
+ hideModal={() => toggleModal(false)}
163
162
  modalOpen={modalOpen}
164
163
  {...modalExtraProps}
165
164
  >
@@ -60,15 +60,6 @@ const InactiveControlsModule = ({
60
60
  subDescription={subDescription}
61
61
  allowedPaymentInstruments={allowedPaymentInstruments}
62
62
  disableActions={disableActions}
63
- action={() => (disableActions ? noop : toggleModal(true))}
64
- onClick={() => (disableActions ? noop : toggleModal(true))}
65
- onKeyPress={
66
- disableActions
67
- ? () => noop
68
- : e => {
69
- e.key === "Enter" && toggleModal(true);
70
- }
71
- }
72
63
  />
73
64
  </Box>
74
65
  )}
@@ -78,7 +69,7 @@ const InactiveControlsModule = ({
78
69
  removeAccount={disableActions ? noop : handleRemoveAccount}
79
70
  accountType={configType === "ACCOUNT" ? "Account" : "Property"}
80
71
  isMobile={isMobile}
81
- disableActions={disableActions}
72
+ isInCustomerManagement={disableActions}
82
73
  />
83
74
  </Box>
84
75
  </Cluster>
@@ -81,7 +81,7 @@ const PaymentDetailsActions = ({
81
81
  description={description}
82
82
  subDescription={subDescription}
83
83
  allowedPaymentInstruments={allowedPaymentInstruments}
84
- disableActions={disableActions}
84
+ isInCustomerManagement={disableActions}
85
85
  />
86
86
  </Cluster>
87
87
  </Box>
@@ -103,7 +103,7 @@ const PaymentDetailsActions = ({
103
103
  ? "Account Details"
104
104
  : "Property Details"
105
105
  }
106
- action={disableActions ? noop : handleDetailsClick}
106
+ action={handleDetailsClick}
107
107
  dataQa="Account Details"
108
108
  extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
109
109
  />
@@ -117,14 +117,8 @@ const PaymentDetailsActions = ({
117
117
  variant="tertiary"
118
118
  text={`Set Up ${planType}`}
119
119
  action={() => {
120
- if (!disableActions) {
121
- setDetailedObligation(
122
- obligations,
123
- config,
124
- obligationAssocID
125
- );
126
- handleAutopayAction();
127
- }
120
+ setDetailedObligation(obligations, config, obligationAssocID);
121
+ handleAutopayAction();
128
122
  }}
129
123
  dataQa="Set Up Autopay"
130
124
  extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
@@ -148,15 +142,6 @@ const PaymentDetailsActions = ({
148
142
  subDescription={subDescription}
149
143
  allowedPaymentInstruments={allowedPaymentInstruments}
150
144
  disableActions={disableActions}
151
- action={() => (disableActions ? noop : toggleModal(true))}
152
- onClick={() => (disableActions ? noop : toggleModal(true))}
153
- onKeyPress={
154
- disableActions
155
- ? () => noop
156
- : e => {
157
- e.key === "Enter" && toggleModal(true);
158
- }
159
- }
160
145
  />
161
146
  )}
162
147
  </Box>
@@ -9,7 +9,7 @@ const RemoveAccountModalModule = ({
9
9
  removeAccount,
10
10
  accountType,
11
11
  isMobile,
12
- disableActions = false
12
+ isInCustomerManagement = false
13
13
  }) => {
14
14
  const [modalIsOpen, setModalIsOpen] = useState(false);
15
15
  const lastItem = [...obligations].pop();
@@ -32,8 +32,8 @@ const RemoveAccountModalModule = ({
32
32
 
33
33
  return (
34
34
  <Modal
35
- showModal={disableActions ? noop : () => setModalIsOpen(true)}
36
- hideModal={disableActions ? noop : () => setModalIsOpen(false)}
35
+ showModal={() => setModalIsOpen(true)}
36
+ hideModal={() => setModalIsOpen(false)}
37
37
  modalOpen={modalIsOpen}
38
38
  modalHeaderText={`Remove ${accountType}`}
39
39
  modalBodyText={`Are you sure you want to remove the ${identifier} ${accounts}? Any autopay scheduled against ${
@@ -41,10 +41,8 @@ const RemoveAccountModalModule = ({
41
41
  } will be deactivated.`}
42
42
  continueButtonText="Remove"
43
43
  continueAction={() => {
44
- if (!disableActions) {
45
- removeAccount();
46
- setModalIsOpen(false);
47
- }
44
+ removeAccount();
45
+ setModalIsOpen(false);
48
46
  }}
49
47
  useDangerButton
50
48
  >
@@ -52,12 +50,12 @@ const RemoveAccountModalModule = ({
52
50
  <ButtonWithAction
53
51
  text="Remove"
54
52
  variant="secondary"
55
- action={disableActions ? noop : () => setModalIsOpen(true)}
53
+ action={isInCustomerManagement ? noop : () => setModalIsOpen(true)}
56
54
  dataQa="Remove Account"
57
55
  extraStyles={
58
56
  isMobile ? `flex-grow: 1; width: 100%; margin: 0;` : `flex-grow: 1;`
59
57
  }
60
- disabled={disableActions}
58
+ disabled={isInCustomerManagement}
61
59
  />
62
60
  </Box>
63
61
  </Modal>