@widergy/utilitygo-smart-bill-web 3.22.0 → 3.24.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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # [3.24.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.23.0...v3.24.0) (2026-03-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * [EVEP-29] delinquency attachment ([#82](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/82)) ([164a7a0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/164a7a0535089f8c246aecad9f0a4a2d6d66d591))
7
+ * [EVEP-422] change in footer ([#81](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/81)) ([61194aa](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/61194aabebd0d2d357ea942f228c7204d7209559))
8
+ * [EVEP-430] change periods ([#84](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/84)) ([afd95a2](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/afd95a26d54e4800c99a2211499614925dc822dc))
9
+
10
+ # [3.23.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.22.0...v3.23.0) (2026-02-10)
11
+
12
+
13
+ ### Features
14
+
15
+ * [DEV-766] mvp widergy/eslint-config package ([#76](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/76)) ([da619f9](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/da619f9457b2ac69edfd58996e2583239fb05a8a))
16
+
1
17
  # [3.22.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.21.0...v3.22.0) (2026-01-30)
2
18
 
3
19
 
@@ -21,7 +21,6 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
21
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
22
  const SmartBillSummary = _ref => {
23
23
  let {
24
- annex,
25
24
  assets,
26
25
  billingLayout,
27
26
  consumptionLayout,
@@ -90,6 +89,7 @@ const SmartBillSummary = _ref => {
90
89
  const [currentTab, setCurrentTab] = (0, _react.useState)(defaultCurrentTab);
91
90
  const [aiPanelIsOpen, setAiPanelIsOpen] = (0, _react.useState)(false);
92
91
  const [stableLoading, setStableLoading] = (0, _react.useState)(true);
92
+ const [attachmentOpen, setAttachmentOpen] = (0, _react.useState)(false);
93
93
  (0, _react.useEffect)(() => {
94
94
  if (loading) {
95
95
  setStableLoading(true);
@@ -146,20 +146,24 @@ const SmartBillSummary = _ref => {
146
146
  })), /*#__PURE__*/_react.default.createElement("div", {
147
147
  className: _stylesModule.default.contentContainer
148
148
  }, tabs.find(tab => tab.value === currentTab)?.header && /*#__PURE__*/_react.default.createElement(_BillHeader.default, {
149
- annex,
149
+ attachment: smartBill?.attachment,
150
+ attachmentOpen,
151
+ attachmentText: translations.billingTab.header.attachmentText,
150
152
  UtilityLogo: assets.billingTab.UtilityLogo,
151
153
  billNumber: smartBill.bill_number,
152
154
  billType: smartBill.bill_type,
153
155
  billTypeHelpText: translations.billingTab.header.billTypeHelpText,
156
+ delinquency: smartBill?.client?.delinquency,
154
157
  issuedOnDate: (0, _utils2.getFormattedDate)((0, _utils2.getCurrentPeriod)(smartBill)?.settlements?.current?.issued_on),
155
158
  billIssueDate: translations.billingTab.header.billIssueDate,
156
- debtStatusValidation: smartBill.debt_status_label !== null,
159
+ debtStatusValidation: !!smartBill.debt_status_label,
157
160
  debtStatusLabel: smartBill.debt_status_label,
158
161
  downloadSmartbillEnabled,
159
162
  downloadSmartBillLoading,
160
163
  handleDownloadSmartBill,
164
+ setAttachmentOpen,
161
165
  smartBill
162
- }), tabs.find(tab => tab.value === currentTab)?.header && /*#__PURE__*/_react.default.createElement(_SecondHeader.default, {
166
+ }), tabs.find(tab => tab.value === currentTab)?.secondHeader && /*#__PURE__*/_react.default.createElement(_SecondHeader.default, {
163
167
  accountNumber: smartBill.client?.client_number,
164
168
  accountNumberHelpText: translations.billingTab.secondHeader?.accountNumberHelpText,
165
169
  supplyAddress: smartBill.client?.account_address,
@@ -187,7 +191,7 @@ const SmartBillSummary = _ref => {
187
191
  utils,
188
192
  periodSpan,
189
193
  progressBarConcept
190
- })), aiQuestionsPanelEnabled && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTTooltip, {
194
+ })), aiQuestionsPanelEnabled && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTTooltip, {
191
195
  arrow: false,
192
196
  content: isDesktopSize ? widyTooltipContent : '',
193
197
  tippyProps: {
@@ -229,7 +233,6 @@ const SmartBillSummary = _ref => {
229
233
  }));
230
234
  };
231
235
  SmartBillSummary.propTypes = {
232
- annex: _propTypes.bool,
233
236
  assets: _propTypes.object,
234
237
  billingLayout: (0, _propTypes.arrayOf)(_propTypes.object),
235
238
  consumptionLayout: (0, _propTypes.arrayOf)(_propTypes.object),
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _energyUi = require("@widergy/energy-ui");
9
- var _billDataTypes = require("@widergy/utilitygo-smart-bill-web/dist/shared/types/billDataTypes");
10
9
  var _propTypes = require("prop-types");
11
- var _dayjs = _interopRequireDefault(require("dayjs"));
10
+ var _billDataTypes = require("@widergy/utilitygo-smart-bill-web/dist/shared/types/billDataTypes");
12
11
  var _utils = require("./utils");
13
12
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
14
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -24,12 +23,7 @@ const ConsumptionComparison = _ref => {
24
23
  const maxValue = (0, _utils.getMaxValue)(allPeriods);
25
24
  const title = texts?.consumptions?.comparisonTitle;
26
25
  const showComparison = allPeriods?.length > 1;
27
- const sortedCurrentPeriods = [...currentPeriods].sort((a, b) => {
28
- const dateA = (0, _dayjs.default)(a.settlements?.start_date);
29
- const dateB = (0, _dayjs.default)(b.settlements?.start_date);
30
- return dateB.diff(dateA);
31
- });
32
- const currentPeriodsList = sortedCurrentPeriods.map(period => ({
26
+ const currentPeriodsList = currentPeriods.map(period => ({
33
27
  ...period,
34
28
  isCurrent: true
35
29
  }));
@@ -74,7 +68,7 @@ const ConsumptionComparison = _ref => {
74
68
  };
75
69
  const currentCount = currentPeriodsList.length || 1;
76
70
  const referenceCount = referencePeriodsList.length || 1;
77
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
71
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
78
72
  colorTheme: "gray",
79
73
  className: showComparison ? _stylesModule.default.consumptionComparisonLabel : _stylesModule.default.consumptionComparisonLabelNoData,
80
74
  variant: "small"
@@ -14,21 +14,35 @@ const getConsumptionPeriodsToCompare = function () {
14
14
  let periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15
15
  if (!(0, _lodash.isEmpty)(periods)) {
16
16
  const currentPeriod = periods.find(period => period.current);
17
- const previousYearPeriod = periods.find(period => period.number === currentPeriod.number && parseInt(period.year, 10) === parseInt(currentPeriod.year, 10) - 1);
17
+ const previousYearPeriod = periods.find(period => period.reference_period === true) || periods.find(period => period.number === currentPeriod.number && parseInt(period.year, 10) === parseInt(currentPeriod.year, 10) - 1);
18
18
  return [currentPeriod, previousYearPeriod].filter(Boolean);
19
19
  }
20
+ return [];
20
21
  };
21
22
  exports.getConsumptionPeriodsToCompare = getConsumptionPeriodsToCompare;
22
23
  const getPeriodsGroupedByReference = function () {
23
24
  let periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
24
25
  if (!(0, _lodash.isEmpty)(periods)) {
25
- const currentPeriods = periods.filter(period => period.reference_period === false);
26
- const referencePeriods = periods.filter(period => period.reference_period === true);
27
- return {
28
- currentPeriods,
29
- referencePeriods
30
- };
26
+ const currentPeriod = periods.find(period => period.current);
27
+ const hasReferencePeriod = periods.some(period => period.reference_period === true);
28
+ if (hasReferencePeriod) {
29
+ const [referencePeriods, currentPeriods] = (0, _lodash.partition)(periods, period => period.reference_period === true);
30
+ return {
31
+ currentPeriods,
32
+ referencePeriods
33
+ };
34
+ } else if (currentPeriod) {
35
+ const previousYearPeriod = periods.find(period => period.number === currentPeriod.number && parseInt(period.year, 10) === parseInt(currentPeriod.year, 10) - 1);
36
+ return {
37
+ currentPeriods: [currentPeriod],
38
+ referencePeriods: previousYearPeriod ? [previousYearPeriod] : []
39
+ };
40
+ }
31
41
  }
42
+ return {
43
+ currentPeriods: [],
44
+ referencePeriods: []
45
+ };
32
46
  };
33
47
  exports.getPeriodsGroupedByReference = getPeriodsGroupedByReference;
34
48
  const formatDate = date => {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getInfo = void 0;
7
7
  const getValue = (smartBill, magnitudeName) => {
8
- const item = smartBill.periods[0].consumptions.find(c => c.magnitude === magnitudeName);
8
+ const item = smartBill.periods.find(period => period.current).consumptions.find(c => c.magnitude === magnitudeName);
9
9
  if (!item) return null;
10
10
  return {
11
11
  value: item.value,
@@ -13,27 +13,33 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  const BillHeader = _ref => {
15
15
  let {
16
- annex,
16
+ attachment,
17
+ attachmentOpen,
18
+ attachmentText,
17
19
  billIssueDate,
18
20
  billNumber,
19
21
  billType,
20
22
  billTypeHelpText,
21
23
  debtStatusLabel,
22
24
  debtStatusValidation,
25
+ delinquency,
23
26
  downloadSmartbillEnabled,
24
27
  downloadSmartBillLoading,
25
28
  handleDownloadSmartBill,
26
29
  issuedOnDate,
30
+ setAttachmentOpen,
27
31
  smartBill,
28
32
  UtilityLogo
29
33
  } = _ref;
30
- return /*#__PURE__*/_react.default.createElement("div", {
34
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
31
35
  className: _stylesModule.default.billHeader
32
36
  }, /*#__PURE__*/_react.default.createElement("div", {
33
37
  className: _stylesModule.default.billHeaderLabels
34
38
  }, UtilityLogo && /*#__PURE__*/_react.default.createElement(UtilityLogo, {
35
39
  className: _stylesModule.default.logo
36
40
  }), /*#__PURE__*/_react.default.createElement("div", {
41
+ className: _stylesModule.default.billHeaderTopRow
42
+ }, /*#__PURE__*/_react.default.createElement("div", {
37
43
  className: _stylesModule.default.valueAndHelpText
38
44
  }, /*#__PURE__*/_react.default.createElement("div", {
39
45
  className: _stylesModule.default.billTypeAndNumberContainer
@@ -52,31 +58,50 @@ const BillHeader = _ref => {
52
58
  }, issuedOnDate), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
53
59
  colorTheme: "gray",
54
60
  variant: "small"
55
- }, billIssueDate)), debtStatusValidation && /*#__PURE__*/_react.default.createElement(_DebtStatusLabel.default, {
61
+ }, billIssueDate))), /*#__PURE__*/_react.default.createElement("div", {
62
+ className: _stylesModule.default.billHeaderStatusRow
63
+ }, debtStatusValidation && /*#__PURE__*/_react.default.createElement(_DebtStatusLabel.default, {
56
64
  debtStatusLabel: debtStatusLabel,
57
65
  isWarning: smartBill?.warning
58
- })), /*#__PURE__*/_react.default.createElement("div", null, annex && /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
66
+ }), !!delinquency && /*#__PURE__*/_react.default.createElement(_energyUi.UTStatus, {
67
+ type: "light",
68
+ variant: "error"
69
+ }, delinquency?.title))), /*#__PURE__*/_react.default.createElement("div", {
70
+ className: _stylesModule.default.buttons
71
+ }, !!attachment && /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
59
72
  variant: "text",
60
- disabled: true
61
- }, "Anexos"), downloadSmartbillEnabled && /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
73
+ onClick: () => setAttachmentOpen(true)
74
+ }, attachmentText), downloadSmartbillEnabled && /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
62
75
  loading: downloadSmartBillLoading,
63
76
  onClick: handleDownloadSmartBill,
64
77
  Icon: "IconDownload",
65
78
  variant: "text"
66
- })));
79
+ }))), /*#__PURE__*/_react.default.createElement(_energyUi.UTPanel, {
80
+ hideMainButton: true,
81
+ open: attachmentOpen,
82
+ onClose: () => setAttachmentOpen(false),
83
+ panelSide: "right",
84
+ subtitle: attachment?.subtitle,
85
+ title: attachment?.title,
86
+ version: "V1"
87
+ }));
67
88
  };
68
89
  BillHeader.propTypes = {
69
- annex: _propTypes.bool,
90
+ attachment: _propTypes.object,
91
+ attachmentOpen: _propTypes.bool,
92
+ attachmentText: _propTypes.string,
70
93
  billIssueDate: _propTypes.string,
71
94
  billNumber: _propTypes.string,
72
95
  billType: _propTypes.string,
73
96
  billTypeHelpText: _propTypes.string,
74
97
  debtStatusLabel: _propTypes.string,
75
98
  debtStatusValidation: _propTypes.bool,
99
+ delinquency: _propTypes.object,
76
100
  downloadSmartbillEnabled: _propTypes.bool,
77
101
  downloadSmartBillLoading: _propTypes.bool,
78
102
  handleDownloadSmartBill: _propTypes.func,
79
103
  issuedOnDate: _propTypes.string,
104
+ setAttachmentOpen: _propTypes.func,
80
105
  smartBill: _propTypes.object,
81
106
  UtilityLogo: _propTypes.elementType
82
107
  };
@@ -11,8 +11,23 @@
11
11
  justify-content: space-between;
12
12
  padding: 12px 16px;
13
13
  margin: 24px 32px 0 32px;
14
+
14
15
  @media #{$mobile} {
16
+ flex-direction: column;
17
+ align-items: flex-start;
15
18
  margin: 24px 16px 0 16px;
19
+ padding: 16px;
20
+ grid-gap: 16px;
21
+ }
22
+ }
23
+
24
+ .buttons {
25
+ display: flex;
26
+ grid-gap: 8px;
27
+
28
+ @media #{$mobile} {
29
+ width: 100%;
30
+ justify-content: flex-start;
16
31
  }
17
32
  }
18
33
 
@@ -20,6 +35,10 @@
20
35
  height: 30px;
21
36
  object-fit: contain;
22
37
  width: auto;
38
+
39
+ @media #{$mobile} {
40
+ margin-bottom: 8px;
41
+ }
23
42
  }
24
43
 
25
44
  .billHeaderLabels {
@@ -31,11 +50,36 @@
31
50
  padding: 16px 0;
32
51
 
33
52
  @media #{$mobile} {
53
+ width: 100%;
54
+ flex-direction: column;
55
+ align-items: flex-start;
34
56
  grid-gap: 16px;
35
57
  padding: 0;
36
58
  }
37
59
  }
38
60
 
61
+ .billHeaderTopRow {
62
+ display: contents;
63
+
64
+ @media #{$mobile} {
65
+ display: flex;
66
+ width: 100%;
67
+ justify-content: space-between;
68
+ align-items: center;
69
+ }
70
+ }
71
+
72
+ .billHeaderStatusRow {
73
+ display: contents;
74
+
75
+ @media #{$mobile} {
76
+ display: flex;
77
+ width: 100%;
78
+ gap: 8px;
79
+ flex-wrap: wrap;
80
+ }
81
+ }
82
+
39
83
  .valueAndHelpText {
40
84
  display: flex;
41
85
  flex-direction: column;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _energyUi = require("@widergy/energy-ui");
9
+ var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
10
+ var _propTypes = require("prop-types");
11
+ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const Header = _ref => {
14
+ let {
15
+ concept,
16
+ index,
17
+ formatAmount,
18
+ smartBillTestIds
19
+ } = _ref;
20
+ return /*#__PURE__*/_react.default.createElement("div", {
21
+ className: _stylesModule.default.container
22
+ }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
23
+ dataTestId: `${smartBillTestIds.rateCard.detailLabel}.${index}`,
24
+ weight: "medium"
25
+ }, (0, _upperFirst.default)(concept.concept)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
26
+ dataTestId: `${smartBillTestIds.rateCard.detailAmount}.${index}`,
27
+ variant: "subtitle1",
28
+ weight: "medium"
29
+ }, formatAmount?.(concept.amount)));
30
+ };
31
+ Header.propTypes = {
32
+ concept: _propTypes.object,
33
+ index: _propTypes.number,
34
+ formatAmount: _propTypes.func,
35
+ smartBillTestIds: _propTypes.object
36
+ };
37
+ var _default = exports.default = Header;
@@ -0,0 +1,5 @@
1
+ .container {
2
+ align-items: baseline;
3
+ display: flex;
4
+ justify-content: space-between;
5
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _energyUi = require("@widergy/energy-ui");
9
+ var _propTypes = require("prop-types");
10
+ var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
11
+ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const Subconcept = _ref => {
14
+ let {
15
+ subconcept,
16
+ formatAmount
17
+ } = _ref;
18
+ return /*#__PURE__*/_react.default.createElement("div", {
19
+ className: _stylesModule.default.line
20
+ }, /*#__PURE__*/_react.default.createElement("div", {
21
+ className: _stylesModule.default.content
22
+ }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
23
+ colorTheme: "gray"
24
+ }, (0, _upperFirst.default)(subconcept.title))), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
25
+ weight: "medium"
26
+ }, formatAmount?.(subconcept.amount)));
27
+ };
28
+ Subconcept.propTypes = {
29
+ subconcept: (0, _propTypes.shape)({
30
+ title: _propTypes.string,
31
+ amount: _propTypes.number
32
+ }),
33
+ formatAmount: _propTypes.func
34
+ };
35
+ var _default = exports.default = Subconcept;
@@ -0,0 +1,22 @@
1
+ .content {
2
+ display: flex;
3
+ flex-direction: column;
4
+ grid-gap: 8px;
5
+ }
6
+
7
+ .line {
8
+ align-items: center;
9
+ border-bottom: 1px solid var(--light04);
10
+ display: flex;
11
+ justify-content: space-between;
12
+ padding: 16px;
13
+
14
+ &:first-child {
15
+ border-top: 1px solid var(--light04);
16
+ }
17
+
18
+ &:last-child {
19
+ border-bottom: 0;
20
+ padding: 16px 16px 0;
21
+ }
22
+ }
@@ -10,12 +10,13 @@ var _propTypes = require("prop-types");
10
10
  var _numeral = _interopRequireDefault(require("numeral"));
11
11
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
12
12
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
13
- var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
14
13
  var _isNaN = _interopRequireDefault(require("lodash/isNaN"));
15
14
  var _utils = require("../../Consumptions/components/CurrentConsumption/utils");
16
15
  var _testIds = require("../../../../../constants/testIds");
17
16
  var _utils2 = require("./utils");
18
17
  var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
18
+ var _Subconcept = _interopRequireDefault(require("./components/Subconcept"));
19
+ var _Header = _interopRequireDefault(require("./components/Header"));
19
20
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
20
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
22
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -108,6 +109,8 @@ const RateCard = _ref => {
108
109
  debouncedTrackRedirection(link);
109
110
  if (link) window.open(link, '_blank');
110
111
  };
112
+ const [expandedConcept, setExpandedConcept] = (0, _react.useState)();
113
+ const handleConceptClick = concept => setExpandedConcept(concept !== expandedConcept && concept);
111
114
  return /*#__PURE__*/_react.default.createElement("div", {
112
115
  className: _stylesModule.default.container
113
116
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -182,23 +185,38 @@ const RateCard = _ref => {
182
185
  name: "IconHelp"
183
186
  })))), /*#__PURE__*/_react.default.createElement("div", {
184
187
  className: _stylesModule.default.footer
185
- }, seeFooter && charges.map((_ref5, i) => {
186
- let {
187
- concept,
188
- amount
189
- } = _ref5;
190
- return /*#__PURE__*/_react.default.createElement("div", {
191
- className: _stylesModule.default.detail,
192
- "data-testid": `${smartBillTestIds.rateCard.detail}.${i}`,
193
- key: concept
194
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
195
- dataTestId: `${smartBillTestIds.rateCard.detailLabel}.${i}`,
196
- weight: "medium"
197
- }, (0, _upperFirst.default)(concept)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
198
- dataTestId: `${smartBillTestIds.rateCard.detailAmount}.${i}`,
199
- variant: "subtitle1",
200
- weight: "medium"
201
- }, formatAmount?.(amount)));
188
+ }, seeFooter && [...(charges || [])].sort((a, b) => {
189
+ const aHasSubconcepts = !(0, _isEmpty.default)(a.lines);
190
+ const bHasSubconcepts = !(0, _isEmpty.default)(b.lines);
191
+ if (aHasSubconcepts === bHasSubconcepts) return 0;
192
+ return aHasSubconcepts ? 1 : -1;
193
+ }).map((concept, index) => {
194
+ const handleClick = () => handleConceptClick(index);
195
+ const hasEmptySubconcepts = (0, _isEmpty.default)(concept.lines);
196
+ const isExpanded = expandedConcept === index;
197
+ return /*#__PURE__*/_react.default.createElement(_energyUi.UTCard, {
198
+ classNames: {
199
+ base: `${_stylesModule.default.cardContainer} ${hasEmptySubconcepts && _stylesModule.default.nonExpandibleCard} `,
200
+ expandButton: _stylesModule.default.expandIcon,
201
+ expandableContent: _stylesModule.default.expandableContent,
202
+ header: `${isExpanded && _stylesModule.default.cardHeader}`
203
+ },
204
+ header: /*#__PURE__*/_react.default.createElement(_Header.default, {
205
+ concept: concept,
206
+ index: index,
207
+ formatAmount: formatAmount,
208
+ smartBillTestIds: smartBillTestIds
209
+ }),
210
+ horizontal: true,
211
+ isCollapsible: !hasEmptySubconcepts,
212
+ isOpen: isExpanded,
213
+ key: `${concept.concept}-${concept.amount}`,
214
+ onClick: handleClick
215
+ }, !hasEmptySubconcepts && concept.lines.map(subconcept => /*#__PURE__*/_react.default.createElement(_Subconcept.default, {
216
+ key: `${subconcept.title}-${subconcept.amount}`,
217
+ subconcept: subconcept,
218
+ formatAmount: formatAmount
219
+ })));
202
220
  }), /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
203
221
  classNames: {
204
222
  childrenContainer: _stylesModule.default.footerActionChildren,
@@ -42,10 +42,6 @@
42
42
  flex: 1;
43
43
  }
44
44
 
45
- .footer {
46
- width: 100%;
47
- }
48
-
49
45
  .footerAction {
50
46
  align-items: center;
51
47
  background-color: transparent;
@@ -65,15 +61,6 @@
65
61
  justify-content: space-between;
66
62
  }
67
63
 
68
- .detail {
69
- align-items: center;
70
- border-top: 1px solid var(--light04);
71
- display: flex;
72
- grid-gap: 16px;
73
- justify-content: space-between;
74
- padding: 16px;
75
- }
76
-
77
64
  .bannerDetail {
78
65
  align-items: flex-start;
79
66
  background-color: var(--semanticError01);
@@ -100,3 +87,41 @@
100
87
  margin: 0 16px;
101
88
  padding: 24px;
102
89
  }
90
+
91
+ .footer {
92
+ background-color: var(--light01);
93
+ display: flex;
94
+ flex-flow: column;
95
+ }
96
+
97
+ .cardContainer {
98
+ background-color: var(--light01);
99
+ border: 0;
100
+ border-top: 1px solid var(--light04);
101
+ border-radius: 0;
102
+ box-shadow: none;
103
+ }
104
+
105
+ .expandableContent {
106
+ padding: 0;
107
+ }
108
+
109
+ .nonExpandibleCard {
110
+ padding-right: 24px;
111
+ }
112
+
113
+ .expandIcon {
114
+ color: var(--actionNeutral05);
115
+ height: 6px;
116
+ margin-left: 12px;
117
+ width: 24px;
118
+ }
119
+
120
+ .cardHeader {
121
+ padding-bottom: 16px;
122
+ }
123
+
124
+ .lines {
125
+ transform: translateX(-16px);
126
+ width: calc(100% + 32px);
127
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/utilitygo-smart-bill-web",
3
- "version": "3.22.0",
3
+ "version": "3.24.0",
4
4
  "description": "UtilityGO SmartBill Web",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -9,34 +9,46 @@
9
9
  "dist"
10
10
  ],
11
11
  "scripts": {
12
- "start": "react-scripts --openssl-legacy-provider start ",
12
+ "start": "SKIP_PREFLIGHT_CHECK=true DISABLE_ESLINT_PLUGIN=true react-scripts --openssl-legacy-provider start ",
13
13
  "build-example": "react-scripts --openssl-legacy-provider build",
14
- "lint": "./node_modules/eslint/bin/eslint.js src && npm run sass-lint",
15
- "test": "react-scripts test --env=jsdom",
14
+ "lint": "./node_modules/eslint/bin/eslint.js src --cache --prune-suppressions",
15
+ "lint-suppress": "./node_modules/eslint/bin/eslint.js src --cache --suppress-all",
16
+ "test": "SKIP_PREFLIGHT_CHECK=true DISABLE_ESLINT_PLUGIN=true react-scripts test --env=jsdom",
16
17
  "eject": "react-scripts eject",
17
18
  "prebuild": "rimraf dist",
18
19
  "sass-lint": "./node_modules/sass-lint/bin/sass-lint.js -v -q",
19
- "build": "NODE_ENV=production babel src/lib --out-dir dist --copy-files",
20
+ "build": "SKIP_PREFLIGHT_CHECK=true DISABLE_ESLINT_PLUGIN=true NODE_ENV=production babel src/lib --out-dir dist --copy-files",
20
21
  "prepare": "husky install && npm run build"
21
22
  },
22
23
  "devDependencies": {
23
24
  "@babel/cli": "^7.2.3",
24
25
  "@babel/core": "^7.3.4",
26
+ "@babel/eslint-parser": "^7.22.10",
25
27
  "@babel/plugin-proposal-class-properties": "^7.4.0",
26
28
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
27
29
  "@babel/preset-env": "^7.3.4",
28
30
  "@babel/preset-react": "^7.0.0",
29
31
  "@commitlint/cli": "^17.7.1",
30
32
  "@commitlint/config-conventional": "^17.7.0",
33
+ "@eslint/compat": "^1.4.0",
34
+ "@widergy/eslint-config": "^1.0.0",
31
35
  "@widergy/energy-ui": "^3.0.0",
32
36
  "@widergy/semantic-release-package-config": "^1.0.0",
33
37
  "babel-preset-react-app": "^10.0.1",
38
+ "babel-plugin-import-glob": "^2.0.0",
39
+ "babel-plugin-module-resolver": "^5.0.0",
34
40
  "eslint-config-airbnb": "^19.0.4",
35
41
  "eslint-config-prettier": "^9.0.0",
42
+ "eslint-import-resolver-babel-module": "^5.3.0",
43
+ "eslint-import-resolver-typescript": "^4.4.4",
36
44
  "eslint-plugin-flowtype": "^8.0.3",
37
45
  "eslint-plugin-import": "^2.14.0",
38
46
  "eslint-plugin-jsx-a11y": "^6.1.1",
39
47
  "eslint-plugin-prettier": "^5.0.0",
48
+ "eslint-plugin-react": "^7.37.0",
49
+ "eslint-plugin-react-hooks": "^5.2.0",
50
+ "eslint": "^9.38.0",
51
+ "globals": "^16.4.0",
40
52
  "husky": "^8.0.0",
41
53
  "prettier": "^3.0.3",
42
54
  "prettier-eslint": "^15.0.1",
@@ -45,7 +57,9 @@
45
57
  "react-scripts": "^4.0.3",
46
58
  "rimraf": "^2.6.3",
47
59
  "sass-lint": "^1.12.1",
48
- "semantic-release": "^15.13.31"
60
+ "semantic-release": "^15.13.31",
61
+ "typescript": "^5.0.0",
62
+ "typescript-eslint": "^8.46.4"
49
63
  },
50
64
  "browserslist": [
51
65
  ">0.2%",
@@ -57,14 +71,13 @@
57
71
  "@widergy/energy-hooks": "^2.0.0",
58
72
  "@widergy/web-utils": "^2.0.0",
59
73
  "dayjs": "^1.10.7",
60
- "eslint-plugin-react": "^7.33.2",
61
74
  "lodash": ">=4.17.4",
62
- "sass": "^1.80.4",
63
75
  "numeral": ">=2.0.6",
64
76
  "react-jss": "^8.6.1",
65
77
  "react-loading-skeleton": "^3.3.1",
66
78
  "react-perfect-scrollbar": "^1.5.3",
67
79
  "react-responsive": "^4.1.0",
80
+ "sass": "^1.80.4",
68
81
  "sass-loader": "^10.0.5",
69
82
  "seamless-immutable": "^7.1.4",
70
83
  "yarn": "^1.22.10"