@widergy/utilitygo-smart-bill-web 3.7.0 → 3.8.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 +14 -0
- package/dist/components/SmartBillSummary/components/AIPanel/index.js +12 -3
- package/dist/components/SmartBillSummary/index.js +9 -2
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/index.js +37 -19
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/styles.module.scss +11 -8
- package/dist/components/SmartBillSummary/tabs/Billing/index.js +3 -8
- package/dist/components/SmartBillSummary/tabs/Glossary/index.js +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.8.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.7.1...v3.8.0) (2025-06-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [CX-833, CX-851] smartbill analytics ([#55](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/55)) ([312e83b](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/312e83b9ffe4c350164667f2628ae10f0b2eab7e))
|
|
7
|
+
|
|
8
|
+
## [3.7.1](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.7.0...v3.7.1) (2025-06-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* levels loop fixed ([#54](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/54)) ([44442d6](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/44442d647ab8db6eb56e52426ab75de2215c2634))
|
|
14
|
+
|
|
1
15
|
# [3.7.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.6.2...v3.7.0) (2025-05-28)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -20,6 +20,7 @@ const AIPanel = _ref => {
|
|
|
20
20
|
answer,
|
|
21
21
|
error,
|
|
22
22
|
getAnswer,
|
|
23
|
+
handlers = {},
|
|
23
24
|
isOpen,
|
|
24
25
|
loading,
|
|
25
26
|
notEnoughBillsErrorType,
|
|
@@ -30,12 +31,19 @@ const AIPanel = _ref => {
|
|
|
30
31
|
generatedByLabel,
|
|
31
32
|
title: panelTitle
|
|
32
33
|
} = translations?.AIPanel || {};
|
|
34
|
+
const {
|
|
35
|
+
trackOpenAIQuestion
|
|
36
|
+
} = handlers;
|
|
33
37
|
const [openCards, setOpenCards] = (0, _react.useState)([]);
|
|
34
|
-
const toggleCard = id => {
|
|
38
|
+
const toggleCard = (id, question) => {
|
|
35
39
|
if (!answer?.[id] && !openCards.includes(id)) {
|
|
36
40
|
getAnswer(id);
|
|
37
41
|
}
|
|
38
|
-
setOpenCards(prevOpenCards =>
|
|
42
|
+
setOpenCards(prevOpenCards => {
|
|
43
|
+
if (prevOpenCards.includes(id)) return prevOpenCards.filter(openId => openId !== id);
|
|
44
|
+
trackOpenAIQuestion?.(question);
|
|
45
|
+
return [...prevOpenCards, id];
|
|
46
|
+
});
|
|
39
47
|
};
|
|
40
48
|
const handleClose = () => {
|
|
41
49
|
onClose?.();
|
|
@@ -82,7 +90,7 @@ const AIPanel = _ref => {
|
|
|
82
90
|
isCollapsible: true,
|
|
83
91
|
isOpen: openCards.includes(id),
|
|
84
92
|
key: id,
|
|
85
|
-
onClick: () => toggleCard(id)
|
|
93
|
+
onClick: () => toggleCard(id, question)
|
|
86
94
|
}, renderAnswer ? /*#__PURE__*/_react.default.createElement("div", {
|
|
87
95
|
className: `${_stylesModule.default.answer} ${errorContent && !isLoading ? notEnoughBills ? _stylesModule.default.notEnoughBillsContainer : _stylesModule.default.errorAnswer : ''}`
|
|
88
96
|
}, isLoading ? /*#__PURE__*/_react.default.createElement("section", null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
@@ -129,6 +137,7 @@ AIPanel.propTypes = {
|
|
|
129
137
|
answer: _propTypes.object,
|
|
130
138
|
error: _propTypes.object,
|
|
131
139
|
getAnswer: _propTypes.func,
|
|
140
|
+
handlers: _propTypes.object,
|
|
132
141
|
isOpen: _propTypes.bool,
|
|
133
142
|
loading: _propTypes.object,
|
|
134
143
|
notEnoughBillsErrorType: _propTypes.string,
|
|
@@ -48,7 +48,9 @@ const SmartBillSummary = _ref => {
|
|
|
48
48
|
getGlossaryData,
|
|
49
49
|
getSmartBillAIAnswer,
|
|
50
50
|
getSmartBillAIQuestions,
|
|
51
|
-
resetSmartBillAIAnswers
|
|
51
|
+
resetSmartBillAIAnswers,
|
|
52
|
+
trackAIFloatingButtonClick,
|
|
53
|
+
trackTabChange
|
|
52
54
|
} = handlers;
|
|
53
55
|
const filteredTabOptions = loading ? [] : (0, _utils.getTabOptions)(isDesktopSize, tabOptions, smartBill);
|
|
54
56
|
const defaultCurrentTab = (0, _utils.getDefaultCurrentTab)(filteredTabOptions);
|
|
@@ -56,6 +58,7 @@ const SmartBillSummary = _ref => {
|
|
|
56
58
|
const [aiPanelIsOpen, setAiPanelIsOpen] = (0, _react.useState)(false);
|
|
57
59
|
const changeCurrentTab = newTab => setCurrentTab(newTab);
|
|
58
60
|
const openAIPanel = () => {
|
|
61
|
+
trackAIFloatingButtonClick();
|
|
59
62
|
if ((0, _isEmpty.default)(aiQuestionsList)) getSmartBillAIQuestions();
|
|
60
63
|
setAiPanelIsOpen(true);
|
|
61
64
|
};
|
|
@@ -80,7 +83,10 @@ const SmartBillSummary = _ref => {
|
|
|
80
83
|
baseSelected: _stylesModule.default.baseSelected,
|
|
81
84
|
flexContainer: _stylesModule.default.tabsContainer
|
|
82
85
|
},
|
|
83
|
-
onChange:
|
|
86
|
+
onChange: newTab => {
|
|
87
|
+
trackTabChange(newTab);
|
|
88
|
+
changeCurrentTab(newTab);
|
|
89
|
+
},
|
|
84
90
|
options: filteredTabOptions,
|
|
85
91
|
tabsProps: {
|
|
86
92
|
orientation: 'horizontal',
|
|
@@ -118,6 +124,7 @@ const SmartBillSummary = _ref => {
|
|
|
118
124
|
answer: smartBillAIAnswer,
|
|
119
125
|
error: smartBillAIAnswerError,
|
|
120
126
|
getAnswer: getSmartBillAIAnswer,
|
|
127
|
+
handlers: handlers,
|
|
121
128
|
isOpen: aiPanelIsOpen,
|
|
122
129
|
loading: smartBillAIAnswerLoading,
|
|
123
130
|
notEnoughBillsErrorType: notEnoughBillsErrorType,
|
|
@@ -4,14 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _energyUi = require("@widergy/energy-ui");
|
|
9
9
|
var _propTypes = require("prop-types");
|
|
10
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
11
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
10
12
|
var _utils = require("../../../Consumptions/components/CurrentConsumption/utils");
|
|
11
13
|
var _utils2 = require("./utils");
|
|
12
14
|
var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
|
|
13
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
14
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
15
19
|
const RateCard = _ref => {
|
|
16
20
|
let {
|
|
17
21
|
components,
|
|
@@ -23,7 +27,8 @@ const RateCard = _ref => {
|
|
|
23
27
|
ratesTableLink,
|
|
24
28
|
smartBill = {},
|
|
25
29
|
subsidy = '',
|
|
26
|
-
subsidyLevels
|
|
30
|
+
subsidyLevels,
|
|
31
|
+
trackRedirectionToExternalLink
|
|
27
32
|
} = _ref;
|
|
28
33
|
const {
|
|
29
34
|
helpText,
|
|
@@ -73,6 +78,20 @@ const RateCard = _ref => {
|
|
|
73
78
|
const limitRateValue = Array.isArray(currentRate?.range) && currentRate.range.length > 0 && currentRate.range[currentRate.range.length - 1];
|
|
74
79
|
const charges = client?.rate?.charges || [];
|
|
75
80
|
const isT1 = purchasedRate.includes('T1');
|
|
81
|
+
const noLevels = (0, _isEmpty.default)(consumptionLevels);
|
|
82
|
+
const showRateLabel = !isT1 || startRateValue === false || limitRateValue === false;
|
|
83
|
+
const debouncedTrackRedirection = (0, _react.useMemo)(() => (0, _debounce.default)(link => {
|
|
84
|
+
trackRedirectionToExternalLink(link);
|
|
85
|
+
}, 300), [trackRedirectionToExternalLink]);
|
|
86
|
+
(0, _react.useEffect)(() => {
|
|
87
|
+
return () => {
|
|
88
|
+
debouncedTrackRedirection.cancel();
|
|
89
|
+
};
|
|
90
|
+
}, [debouncedTrackRedirection]);
|
|
91
|
+
const handleClickButton = () => {
|
|
92
|
+
debouncedTrackRedirection(ratesTableLink);
|
|
93
|
+
if (ratesTableLink) window.open(ratesTableLink, '_blank');
|
|
94
|
+
};
|
|
76
95
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
77
96
|
className: _stylesModule.default.container
|
|
78
97
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -82,7 +101,7 @@ const RateCard = _ref => {
|
|
|
82
101
|
weight: "medium"
|
|
83
102
|
}, title), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
84
103
|
colorTheme: "gray"
|
|
85
|
-
}, helpText)), /*#__PURE__*/_react.default.createElement(_ProgressBar.default, {
|
|
104
|
+
}, helpText)), !noLevels && /*#__PURE__*/_react.default.createElement(_ProgressBar.default, {
|
|
86
105
|
components: components,
|
|
87
106
|
currentPeriod: currentPeriod,
|
|
88
107
|
data: rates,
|
|
@@ -93,7 +112,7 @@ const RateCard = _ref => {
|
|
|
93
112
|
translations: rateCardTranslations,
|
|
94
113
|
value: totalConsumption
|
|
95
114
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
96
|
-
className: _stylesModule.default.consumptionDataContainer
|
|
115
|
+
className: `${_stylesModule.default.consumptionDataContainer} ${noLevels ? _stylesModule.default.noLevels : ''}`
|
|
97
116
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
98
117
|
className: _stylesModule.default.consumptionContent
|
|
99
118
|
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
@@ -102,7 +121,7 @@ const RateCard = _ref => {
|
|
|
102
121
|
}, (0, _utils2.getCurrentRate)(purchasedRate, currentRate)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
103
122
|
colorTheme: "gray",
|
|
104
123
|
variant: "small"
|
|
105
|
-
},
|
|
124
|
+
}, showRateLabel ? yourRate : limitRateValue === 'Infinity' ? startRateValueLabel?.(startRateValue) : limitRateValueLabel?.(limitRateValue))), /*#__PURE__*/_react.default.createElement("div", {
|
|
106
125
|
className: _stylesModule.default.consumptionContent
|
|
107
126
|
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
108
127
|
variant: "title3",
|
|
@@ -126,19 +145,17 @@ const RateCard = _ref => {
|
|
|
126
145
|
variant: "subtitle1",
|
|
127
146
|
weight: "medium"
|
|
128
147
|
}, formatAmount?.(amount)));
|
|
129
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
size: 20
|
|
141
|
-
}))));
|
|
148
|
+
}), /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
|
|
149
|
+
classNames: {
|
|
150
|
+
childrenContainer: _stylesModule.default.footerActionChildren,
|
|
151
|
+
root: _stylesModule.default.footerAction
|
|
152
|
+
},
|
|
153
|
+
colorTheme: "secondary",
|
|
154
|
+
Icon: "IconChevronRight",
|
|
155
|
+
iconPlacement: "right",
|
|
156
|
+
onClick: handleClickButton,
|
|
157
|
+
variant: "text"
|
|
158
|
+
}, seeRatesTable)));
|
|
142
159
|
};
|
|
143
160
|
RateCard.propTypes = {
|
|
144
161
|
components: _propTypes.object,
|
|
@@ -150,6 +167,7 @@ RateCard.propTypes = {
|
|
|
150
167
|
ratesTableLink: _propTypes.string,
|
|
151
168
|
smartBill: _propTypes.object,
|
|
152
169
|
subsidy: _propTypes.string,
|
|
153
|
-
subsidyLevels: (0, _propTypes.objectOf)(_propTypes.string)
|
|
170
|
+
subsidyLevels: (0, _propTypes.objectOf)(_propTypes.string),
|
|
171
|
+
trackRedirectionToExternalLink: _propTypes.func
|
|
154
172
|
};
|
|
155
173
|
var _default = exports.default = RateCard;
|
package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/styles.module.scss
CHANGED
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
padding: 24px 24px 0;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
.noLevels {
|
|
26
|
+
padding-top: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
.consumptionContent {
|
|
26
30
|
flex: 1;
|
|
27
31
|
}
|
|
@@ -34,20 +38,19 @@
|
|
|
34
38
|
align-items: center;
|
|
35
39
|
background-color: transparent;
|
|
36
40
|
border-top: 1px solid var(--light04);
|
|
41
|
+
border-top-left-radius: 0;
|
|
42
|
+
border-top-right-radius: 0;
|
|
37
43
|
display: flex;
|
|
38
44
|
grid-gap: 8px;
|
|
39
45
|
justify-content: space-between;
|
|
40
46
|
padding: 16px;
|
|
41
47
|
text-decoration: none;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
&:hover {
|
|
45
|
-
background-color: var(--light03);
|
|
46
|
-
}
|
|
48
|
+
width: 100%;
|
|
49
|
+
}
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
.footerActionChildren {
|
|
52
|
+
flex: 1;
|
|
53
|
+
justify-content: space-between;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
.detail {
|
|
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _energyUi = require("@widergy/energy-ui");
|
|
9
|
-
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
10
9
|
var _propTypes = require("prop-types");
|
|
11
10
|
var _billDataTypes = require("../../../../shared/types/billDataTypes");
|
|
12
11
|
var _DebtStatusLabel = _interopRequireDefault(require("./components/DebtStatusLabel"));
|
|
@@ -14,8 +13,6 @@ var _utils = require("./utils");
|
|
|
14
13
|
var _RateCard = _interopRequireDefault(require("./components/RateCard"));
|
|
15
14
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
16
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
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); }
|
|
18
|
-
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; }
|
|
19
16
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
17
|
const Billing = _ref => {
|
|
21
18
|
let {
|
|
@@ -48,7 +45,7 @@ const Billing = _ref => {
|
|
|
48
45
|
handleAutomaticDebitAdherence = () => {},
|
|
49
46
|
handleDownloadBill = () => {},
|
|
50
47
|
handleGoToDigitalBill = () => {},
|
|
51
|
-
|
|
48
|
+
trackRedirectionToExternalLink = () => {}
|
|
52
49
|
} = handlers;
|
|
53
50
|
const {
|
|
54
51
|
adhered,
|
|
@@ -132,9 +129,6 @@ const Billing = _ref => {
|
|
|
132
129
|
rightIcon: 'IconDownload',
|
|
133
130
|
title: downloadBillTitle
|
|
134
131
|
}];
|
|
135
|
-
(0, _react.useEffect)(() => {
|
|
136
|
-
if ((0, _isEmpty.default)(consumptionLevels)) getConsumptionLevels();
|
|
137
|
-
}, []);
|
|
138
132
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
139
133
|
className: _stylesModule.default.generalContainer
|
|
140
134
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -262,6 +256,7 @@ const Billing = _ref => {
|
|
|
262
256
|
smartBill,
|
|
263
257
|
subsidy,
|
|
264
258
|
subsidyLevels,
|
|
259
|
+
trackRedirectionToExternalLink,
|
|
265
260
|
translations
|
|
266
261
|
}))));
|
|
267
262
|
};
|
|
@@ -16,6 +16,7 @@ const Glossary = _ref => {
|
|
|
16
16
|
getGlossaryData,
|
|
17
17
|
glossaryData,
|
|
18
18
|
glossaryLoading,
|
|
19
|
+
handlers,
|
|
19
20
|
translations
|
|
20
21
|
} = _ref;
|
|
21
22
|
const {
|
|
@@ -32,15 +33,17 @@ const Glossary = _ref => {
|
|
|
32
33
|
size: 80,
|
|
33
34
|
thickness: 5
|
|
34
35
|
})) : /*#__PURE__*/_react.default.createElement(_energyUi.UTDocumentWizard, {
|
|
36
|
+
handlers: handlers,
|
|
37
|
+
labels: translations,
|
|
35
38
|
pages: pages,
|
|
36
|
-
sections: sections
|
|
37
|
-
labels: translations
|
|
39
|
+
sections: sections
|
|
38
40
|
});
|
|
39
41
|
};
|
|
40
42
|
Glossary.propTypes = {
|
|
41
43
|
getGlossaryData: _propTypes.func,
|
|
42
44
|
glossaryData: undefined || _propTypes.object,
|
|
43
45
|
glossaryLoading: _propTypes.bool,
|
|
46
|
+
handlers: _propTypes.object,
|
|
44
47
|
translations: _propTypes.object
|
|
45
48
|
};
|
|
46
49
|
var _default = exports.default = Glossary;
|