@widergy/utilitygo-smart-bill-web 3.6.0 → 3.6.2

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,17 @@
1
+ ## [3.6.2](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.6.1...v3.6.2) (2025-05-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [CX-689] smartbill visual fixes ([#51](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/51)) ([1f9a1b9](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/1f9a1b9cce714a9ada91faee97c47b33b0b787df))
7
+
8
+ ## [3.6.1](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.6.0...v3.6.1) (2025-05-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * configurable ai panel ([#50](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/50)) ([f79ae3a](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/f79ae3a25aff49e80125b754b7fccc5c512d5528))
14
+
1
15
  # [3.6.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.5.3...v3.6.0) (2025-05-16)
2
16
 
3
17
 
@@ -94,6 +94,7 @@ const AIPanel = _ref => {
94
94
  name: notEnoughBills ? 'IconFileX' : 'IconCircleX',
95
95
  shade: "04"
96
96
  }), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, null, notEnoughBills ? notEnoughBillsContent : errorContent)) : answerContent ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
97
+ className: _stylesModule.default.answerContent,
97
98
  withMarkdown: true
98
99
  }, answerContent), /*#__PURE__*/_react.default.createElement("div", {
99
100
  className: _stylesModule.default.generatedByLabel
@@ -80,3 +80,7 @@ $ia-panel-width: 600px;
80
80
  display: flex;
81
81
  grid-gap: 8px;
82
82
  }
83
+
84
+ .answerContent {
85
+ padding-bottom: 12px;
86
+ }
@@ -19,14 +19,8 @@ const SmartBillSummary = _ref => {
19
19
  let {
20
20
  assets,
21
21
  constants,
22
- consumptionLevels,
23
22
  components,
24
- currentAccount,
25
- getGlossaryData,
26
- glossaryData,
27
- glossaryLoading,
28
23
  handlers,
29
- isDesktopSize,
30
24
  loading,
31
25
  smartBill,
32
26
  tabOptions,
@@ -35,16 +29,24 @@ const SmartBillSummary = _ref => {
35
29
  } = _ref;
36
30
  const {
37
31
  aiQuestionsList,
32
+ aiQuestionsPanelEnabled,
33
+ consumptionLevels,
34
+ currentAccount,
35
+ glossaryData,
36
+ glossaryError,
37
+ glossaryLoading,
38
+ isDesktopSize,
38
39
  notEnoughBillsErrorType,
39
40
  smartBillAIAnswer = {},
40
41
  smartBillAIAnswerError,
41
42
  smartBillAIAnswerLoading
42
43
  } = constants;
43
44
  const {
45
+ getGlossaryData,
44
46
  getSmartBillAIAnswer,
45
47
  resetSmartBillAIAnswers
46
48
  } = handlers;
47
- const filteredTabOptions = loading ? [] : (0, _utils.getTabOptions)(tabOptions, smartBill);
49
+ const filteredTabOptions = loading ? [] : (0, _utils.getTabOptions)(isDesktopSize, tabOptions, smartBill);
48
50
  const defaultCurrentTab = (0, _utils.getDefaultCurrentTab)(filteredTabOptions);
49
51
  const [currentTab, setCurrentTab] = (0, _react.useState)(defaultCurrentTab);
50
52
  const [aiPanelIsOpen, setAiPanelIsOpen] = (0, _react.useState)(false);
@@ -57,6 +59,11 @@ const SmartBillSummary = _ref => {
57
59
  (0, _react.useEffect)(() => {
58
60
  if (defaultCurrentTab) changeCurrentTab(defaultCurrentTab);
59
61
  }, [defaultCurrentTab]);
62
+ (0, _react.useEffect)(() => {
63
+ if (glossaryError && !glossaryLoading && defaultCurrentTab) {
64
+ changeCurrentTab(defaultCurrentTab);
65
+ }
66
+ }, [defaultCurrentTab, glossaryError, glossaryLoading]);
60
67
  return /*#__PURE__*/_react.default.createElement(_energyUi.UTLoading, {
61
68
  className: _stylesModule.default.loadingContainer,
62
69
  loading: loading
@@ -90,7 +97,7 @@ const SmartBillSummary = _ref => {
90
97
  smartBill,
91
98
  translations,
92
99
  utils
93
- })), /*#__PURE__*/_react.default.createElement(_energyUi.UTTouchableWithoutFeedback, {
100
+ })), aiQuestionsPanelEnabled && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTTouchableWithoutFeedback, {
94
101
  className: _stylesModule.default.AIFloatButton,
95
102
  onClick: openAIPanel,
96
103
  withRipple: true
@@ -106,23 +113,17 @@ const SmartBillSummary = _ref => {
106
113
  loading: smartBillAIAnswerLoading,
107
114
  notEnoughBillsErrorType: notEnoughBillsErrorType,
108
115
  onClose: closeAIPanel
109
- }));
116
+ })));
110
117
  };
111
118
  SmartBillSummary.propTypes = {
112
119
  assets: _propTypes.object,
113
120
  constants: _propTypes.object,
114
- consumptionLevels: _propTypes.array,
115
121
  components: (0, _propTypes.shape)({
116
122
  [_propTypes.string]: _propTypes.elementType
117
123
  }),
118
- currentAccount: _propTypes.array,
119
- getGlossaryData: undefined || _propTypes.object,
120
- glossaryData: undefined || _propTypes.object,
121
- glossaryLoading: _propTypes.bool,
122
124
  handlers: (0, _propTypes.shape)({
123
125
  [_propTypes.string]: _propTypes.func
124
126
  }),
125
- isDesktopSize: _propTypes.bool,
126
127
  loading: _propTypes.bool,
127
128
  smartBill: _billDataTypes.billDataTypes,
128
129
  tabOptions: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
@@ -46,7 +46,7 @@ const ProgressBar = _ref => {
46
46
  value
47
47
  }) || {};
48
48
  const consumptionPercentage = (0, _utils.getConsumptionPercentage)(value, limitValue, isOverLimit) || _constants.MAX_VALUE_PROGRESS;
49
- const shouldRenderDynamicLabel = value > 0 && limitValue > 0;
49
+ const shouldRenderDynamicLabel = value > 0 && limitValue > 0 && limitValue !== 'Infinity';
50
50
  const [limitLabelWidth, setLimitLabelWidth] = (0, _react.useState)(0);
51
51
  const limitLabelRef = (0, _react.useRef)(null);
52
52
  (0, _react.useEffect)(() => {
@@ -94,7 +94,7 @@ const ProgressBar = _ref => {
94
94
  className: _stylesModule.default.consumptionComparison
95
95
  }, value >= 0 && /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
96
96
  variant: "subtitle1"
97
- }, currentValueLabel), value >= 0 && limitValue > 0 && /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
97
+ }, currentValueLabel), value >= 0 && limitValue > 0 && limitValue !== 'Infinity' && /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
98
98
  colorTheme: "gray",
99
99
  variant: "small"
100
100
  }, contrastValueLabel)), tooltipContent && /*#__PURE__*/_react.default.createElement(_energyUi.UTTooltip, {
@@ -34,7 +34,7 @@ const formatLabels = _ref => {
34
34
  return {
35
35
  initialLabel: _constants.MIN_VALUE_PROGRESS,
36
36
  dynamicLabel: isOverLimit ? contrastValueFormatted : currentValueFormatted,
37
- finalLabel: isOverLimit || !limitValue ? currentValueFormatted : contrastValueFormatted,
37
+ finalLabel: isOverLimit || !limitValue || limitValue === 'Infinity' ? currentValueFormatted : contrastValueFormatted,
38
38
  currentValueLabel: currentValueWithUnitLabel?.({
39
39
  value: currentValueFormatted,
40
40
  day: formatMaxPowerRegisteredDate(maxConsumptionDay)
@@ -38,13 +38,13 @@ const RateCard = _ref => {
38
38
  } = rateCardTranslations;
39
39
  const {
40
40
  client,
41
- detail,
42
41
  periods
43
42
  } = smartBill;
44
43
  const purchasedRate = client?.rate?.purchased || '';
45
44
  const periodsToCompare = (0, _utils.getConsumptionPeriodsToCompare)(periods);
46
45
  const {
47
- totalConsumption
46
+ totalConsumption,
47
+ totalConsumptionFormatted
48
48
  } = (0, _utils.getConsumptionLabels)(periodsToCompare) || {};
49
49
  const {
50
50
  levels = []
@@ -71,17 +71,7 @@ const RateCard = _ref => {
71
71
  const currentRate = rates[currentIndex] ?? {};
72
72
  const startRateValue = Array.isArray(currentRate?.range) && currentRate.range[0];
73
73
  const limitRateValue = Array.isArray(currentRate?.range) && currentRate.range.length > 0 && currentRate.range[currentRate.range.length - 1];
74
- const concepts = detail?.concepts?.[0]?.lines;
75
- const fixedCharges = concepts?.[0];
76
- const variableCharges = concepts?.[1];
77
- const {
78
- title: fixedChargeTitle,
79
- amount: fixedChargeValue
80
- } = fixedCharges || {};
81
- const {
82
- title: variableChargeTitle,
83
- amount: variableChargeValue
84
- } = variableCharges || {};
74
+ const charges = client?.rate?.charges || [];
85
75
  const isT1 = purchasedRate.includes('T1');
86
76
  return /*#__PURE__*/_react.default.createElement("div", {
87
77
  className: _stylesModule.default.container
@@ -117,26 +107,26 @@ const RateCard = _ref => {
117
107
  }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
118
108
  variant: "title3",
119
109
  weight: "medium"
120
- }, totalConsumption, " ", unit), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
110
+ }, totalConsumptionFormatted, " ", unit), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
121
111
  colorTheme: "gray",
122
112
  variant: "small"
123
113
  }, yourConsumption))), /*#__PURE__*/_react.default.createElement("div", {
124
114
  className: _stylesModule.default.footer
125
- }, /*#__PURE__*/_react.default.createElement("div", {
126
- className: _stylesModule.default.detail
127
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
128
- weight: "medium"
129
- }, fixedChargeTitle), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
130
- variant: "subtitle1",
131
- weight: "medium"
132
- }, formatAmount?.(fixedChargeValue))), /*#__PURE__*/_react.default.createElement("div", {
133
- className: _stylesModule.default.detail
134
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
135
- weight: "medium"
136
- }, variableChargeTitle), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
137
- variant: "subtitle1",
138
- weight: "medium"
139
- }, formatAmount?.(variableChargeValue))), /*#__PURE__*/_react.default.createElement("a", {
115
+ }, charges.map(_ref5 => {
116
+ let {
117
+ concept,
118
+ amount
119
+ } = _ref5;
120
+ return /*#__PURE__*/_react.default.createElement("div", {
121
+ className: _stylesModule.default.detail,
122
+ key: concept
123
+ }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
124
+ weight: "medium"
125
+ }, concept), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
126
+ variant: "subtitle1",
127
+ weight: "medium"
128
+ }, formatAmount?.(amount)));
129
+ }), /*#__PURE__*/_react.default.createElement("a", {
140
130
  className: _stylesModule.default.footerAction,
141
131
  href: ratesTableLink,
142
132
  rel: "noopener noreferrer",
@@ -128,10 +128,6 @@ const Billing = _ref => {
128
128
  title: automaticDebitTitle
129
129
  }, {
130
130
  leftIcon: 'IconReceipt2',
131
- leftIconProps: {
132
- area: true,
133
- size: 28
134
- },
135
131
  onClick: handleDownloadBill,
136
132
  rightIcon: 'IconDownload',
137
133
  title: downloadBillTitle
@@ -7,6 +7,7 @@
7
7
  padding: 24px 32px;
8
8
 
9
9
  @media #{$mobile} {
10
+ grid-gap: 24px;
10
11
  padding: 24px 16px;
11
12
  }
12
13
  }
@@ -14,8 +15,10 @@
14
15
  .billHeader {
15
16
  align-items: center;
16
17
  background-color: var(--light01);
18
+ border-radius: 8px;
17
19
  box-shadow: var(--shadowGrayBottom1);
18
20
  display: flex;
21
+ flex-wrap: wrap;
19
22
  grid-gap: 16px;
20
23
  justify-content: space-between;
21
24
  padding: 12px 16px;
@@ -30,9 +33,15 @@
30
33
  .billHeaderLabels {
31
34
  align-items: center;
32
35
  display: flex;
36
+ flex-wrap: wrap;
33
37
  grid-gap: 32px;
34
38
  justify-content: space-between;
35
39
  padding: 16px 0;
40
+
41
+ @media #{$mobile} {
42
+ grid-gap: 16px;
43
+ padding: 0;
44
+ }
36
45
  }
37
46
 
38
47
  .valueAndHelpText {
@@ -46,6 +55,10 @@
46
55
  flex: 1;
47
56
  flex-wrap: wrap;
48
57
  grid-gap: 32px;
58
+
59
+ @media #{$mobile} {
60
+ grid-gap: 24px;
61
+ }
49
62
  }
50
63
 
51
64
  .column {
@@ -117,7 +130,7 @@
117
130
 
118
131
  .totalCard {
119
132
  background-color: var(--light01);
120
- border-radius: 4px;
133
+ border-radius: 8px;
121
134
  box-shadow: var(--shadowGrayBottom1);
122
135
  display: flex;
123
136
  flex-direction: column;
@@ -1,3 +1,5 @@
1
+ @import '../../../../../../scss/variables/mediaQueries.module.scss';
2
+
1
3
  $bimestral-consumption-card-min-width: 328px;
2
4
 
3
5
  .bimestralConsumption {
@@ -18,6 +20,10 @@ $bimestral-consumption-card-min-width: 328px;
18
20
  flex-wrap: wrap;
19
21
  grid-gap: 32px;
20
22
  justify-content: space-between;
23
+
24
+ @media #{$mobile} {
25
+ grid-gap: 24px;
26
+ }
21
27
  }
22
28
 
23
29
  .bimestralConsumptionCardHeader {
@@ -24,7 +24,7 @@ const CurrentConsumption = _ref => {
24
24
  } = smartBill || {};
25
25
  const periodsToCompare = (0, _utils.getConsumptionPeriodsToCompare)(periods);
26
26
  const {
27
- totalConsumption,
27
+ totalConsumptionFormatted,
28
28
  unit,
29
29
  description
30
30
  } = (0, _utils.getConsumptionLabels)(periodsToCompare, texts) || {};
@@ -41,7 +41,7 @@ const CurrentConsumption = _ref => {
41
41
  }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
42
42
  variant: "title1",
43
43
  weight: "medium"
44
- }, totalConsumption), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
44
+ }, totalConsumptionFormatted), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
45
45
  variant: "subtitle1",
46
46
  weight: "medium"
47
47
  }, unit)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
@@ -49,7 +49,8 @@ const getConsumptionLabels = function () {
49
49
  });
50
50
  return {
51
51
  description,
52
- totalConsumption: (0, _numeral.default)(totalConsumptionValue).format('0,0.[00]'),
52
+ totalConsumption: Number(totalConsumptionValue),
53
+ totalConsumptionFormatted: (0, _numeral.default)(totalConsumptionValue).format('0,0.[00]'),
53
54
  unit: totalConsumptionUnit
54
55
  };
55
56
  };
@@ -7,6 +7,7 @@
7
7
  padding: 24px 32px;
8
8
 
9
9
  @media #{$mobile} {
10
+ grid-gap: 24px;
10
11
  padding: 24px 16px;
11
12
  }
12
13
  }
@@ -22,6 +23,10 @@
22
23
  flex: 1;
23
24
  flex-wrap: wrap;
24
25
  grid-gap: 32px;
26
+
27
+ @media #{$mobile} {
28
+ grid-gap: 24px;
29
+ }
25
30
  }
26
31
 
27
32
  .consumptionDetail {
@@ -10,13 +10,13 @@ var _lodash = require("lodash");
10
10
  var _tabs = require("../../shared/constants/tabs");
11
11
  var _constants = require("./constants");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- const getTabOptions = (tabOptions, smartBill) => {
13
+ const getTabOptions = (isDesktopSize, tabOptions, smartBill) => {
14
14
  const hasBimestralPeriodicity = smartBill?.periods?.some(period => period.settlements?.periodicity === _constants.BIMESTRAL_PERIODICITY);
15
15
  return tabOptions.map(tab => ({
16
16
  ...tab,
17
- icon: /*#__PURE__*/_react.default.createElement(_energyUi.UTIcon, {
17
+ icon: isDesktopSize ? /*#__PURE__*/_react.default.createElement(_energyUi.UTIcon, {
18
18
  name: tab.icon
19
- })
19
+ }) : null
20
20
  })).filter(_ref => {
21
21
  let {
22
22
  enabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/utilitygo-smart-bill-web",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "UtilityGO SmartBill Web",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",