@widergy/utilitygo-smart-bill-web 3.14.1 → 3.15.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,17 @@
1
+ # [3.15.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.14.2...v3.15.0) (2025-10-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * prod settings ([#68](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/68)) ([52994b7](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/52994b75e0cd5b65d31ee3607cc66e8c3870ea25))
7
+
8
+ ## [3.14.2](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.14.1...v3.14.2) (2025-10-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * [EVEP-179] monthly comsumption ([#67](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/67)) ([5e1ea8a](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/5e1ea8ac9dca1fd52d2fe0a02b4d4962bffd0481))
14
+
1
15
  ## [3.14.1](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.14.0...v3.14.1) (2025-10-14)
2
16
 
3
17
 
@@ -18,7 +18,8 @@ const ComparisonTable = _ref => {
18
18
  let {
19
19
  contextApiInfo,
20
20
  billData,
21
- isDesktopSize
21
+ isDesktopSize,
22
+ temporalyDisabled
22
23
  } = _ref;
23
24
  const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
24
25
  const lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
@@ -31,11 +32,12 @@ const ComparisonTable = _ref => {
31
32
  const expand = !(!withPowerComparison || currentPeriodAverageTemperature || lastYearPeriodAverageTemperature);
32
33
  return /*#__PURE__*/_react.default.createElement("div", {
33
34
  className: `${_stylesModule.default.container} ${expand && _stylesModule.default.expand}`
34
- }, getTableLines(contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktopSize, withPowerComparison(billData)).map(line => line.Component));
35
+ }, getTableLines(contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktopSize, withPowerComparison(billData), temporalyDisabled).map(line => line.Component));
35
36
  };
36
37
  ComparisonTable.propTypes = {
37
38
  contextApiInfo: _smartBillTypes.contextApiInfoTypes,
38
39
  billData: _billDataTypes.billDataTypes,
39
- isDesktopSize: _propTypes.bool
40
+ isDesktopSize: _propTypes.bool,
41
+ temporalyDisabled: _propTypes.bool
40
42
  };
41
43
  var _default = exports.default = (0, _WithContextApi.default)()(ComparisonTable);
@@ -39,10 +39,12 @@ const getPeriodFields = function (contextApiInfo, period, periodAverageTemperatu
39
39
  const mobileCurrentYearPeriodFormatted = period.currentPeriod?.number && period.currentPeriod?.year && `${period.currentPeriod?.number}/${period.currentPeriod?.year}`;
40
40
  let noDataLastYearPeriod = false;
41
41
  let noDataCurrentPeriod = false;
42
- if (!isDesktop && Object.keys(period?.lastYearPeriod).length === 0) {
43
- noDataLastYearPeriod = true;
42
+ if (!isDesktop) {
43
+ if (!period.lastYearPeriod || Object.keys(period.lastYearPeriod).length === 0) {
44
+ noDataLastYearPeriod = true;
45
+ }
44
46
  }
45
- if (!isDesktop && Object.keys(period.currentPeriod).length === 0) {
47
+ if (!isDesktop && period?.currentPeriod && Object.keys(period.currentPeriod).length === 0) {
46
48
  noDataCurrentPeriod = true;
47
49
  }
48
50
  const mobileNoPeriodData = (0, _constants.noPeriodData)(primary, noData, contextApiInfo);
@@ -67,7 +69,7 @@ const getPeriodFields = function (contextApiInfo, period, periodAverageTemperatu
67
69
  data
68
70
  }, contextApiInfo)[fieldId] : mobileNoPeriodData;
69
71
  const {
70
- lastYearPeriodAverageTemperature,
72
+ lastYearPeriodAverageTemperature = {},
71
73
  currentPeriodAverageTemperature
72
74
  } = periodAverageTemperature || {};
73
75
  return isDesktop ? [desktopFields(formattedPeriod, _constants.FIELD_PERIOD_COMPARISION), desktopFields(period, _constants.FIELD_PERIOD_DATES), desktopFields({
@@ -100,7 +102,7 @@ const renderDataLine = (contextApiInfo, mobilePeriod, mobilePeriodAverageTempera
100
102
  }, data),
101
103
  isDesktop: isDesktop
102
104
  });
103
- const desktopGetTableLines = (contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktop, withPowerComparison) => {
105
+ const desktopGetTableLines = (contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktop, withPowerComparison, temporalyDisabled) => {
104
106
  const showTemp = currentPeriodAverageTemperature && lastYearPeriodAverageTemperature;
105
107
  return [{
106
108
  Component: /*#__PURE__*/_react.default.createElement(_DataLine.default, {
@@ -121,7 +123,7 @@ const desktopGetTableLines = (contextApiInfo, currentPeriod, currentPeriodAverag
121
123
  isDesktop: isDesktop,
122
124
  key: "current_period"
123
125
  })
124
- }, {
126
+ }, ...(temporalyDisabled ? [] : [{
125
127
  Component: /*#__PURE__*/_react.default.createElement(_DataLine.default, {
126
128
  fields: getPeriodFields(contextApiInfo, lastYearPeriod, showTemp && lastYearPeriodAverageTemperature, withPowerComparison, isDesktop, {
127
129
  gray: true
@@ -130,17 +132,21 @@ const desktopGetTableLines = (contextApiInfo, currentPeriod, currentPeriodAverag
130
132
  isDesktop: isDesktop,
131
133
  key: "last_year_period"
132
134
  })
133
- }];
135
+ }])];
134
136
  };
135
137
  exports.desktopGetTableLines = desktopGetTableLines;
136
- const mobileGetTableLines = (contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktop, withPowerComparison) => {
138
+ const mobileGetTableLines = (contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktop, withPowerComparison, temporalyDisabled) => {
137
139
  const mobilePeriod = {
138
140
  currentPeriod,
139
- lastYearPeriod
141
+ ...(temporalyDisabled ? {} : {
142
+ lastYearPeriod
143
+ })
140
144
  };
141
145
  const mobilePeriodAverageTemperature = {
142
146
  currentPeriodAverageTemperature,
143
- lastYearPeriodAverageTemperature
147
+ ...(temporalyDisabled ? {} : {
148
+ lastYearPeriodAverageTemperature
149
+ })
144
150
  };
145
151
  return [{
146
152
  Component: /*#__PURE__*/_react.default.createElement("div", null, _constants.dataFieldDictonary.map(data => renderDataLine(contextApiInfo, mobilePeriod, mobilePeriodAverageTemperature, withPowerComparison, isDesktop, data)))
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _browser = require("@widergy/web-utils/lib/browser");
9
9
  var _reactPerfectScrollbar = _interopRequireDefault(require("react-perfect-scrollbar"));
10
10
  require("react-perfect-scrollbar/dist/css/styles.css");
11
+ var _propTypes = require("prop-types");
11
12
  var _aliases = require("../../shared/constants/aliases");
12
13
  var _smartBillTypes = require("../../shared/types/smartBillTypes");
13
14
  var _periods = require("../../shared/utils/periods");
@@ -25,7 +26,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
25
26
  const ConsumptionComparison = _ref => {
26
27
  let {
27
28
  billData,
28
- contextApiInfo
29
+ contextApiInfo,
30
+ temporalyDisabled
29
31
  } = _ref;
30
32
  const {
31
33
  Label,
@@ -60,7 +62,8 @@ const ConsumptionComparison = _ref => {
60
62
  const ComparisonTableRender = () => /*#__PURE__*/_react.default.createElement(_ComparisonTable.default, {
61
63
  billData: billData,
62
64
  multipleSettlements: multipleSettlements,
63
- isDesktopSize: isDesktopSize
65
+ isDesktopSize: isDesktopSize,
66
+ temporalyDisabled: temporalyDisabled
64
67
  });
65
68
  const scrollbarRef = (0, _react.useRef)();
66
69
  (0, _react.useEffect)(() => {
@@ -89,6 +92,7 @@ const ConsumptionComparison = _ref => {
89
92
  };
90
93
  ConsumptionComparison.propTypes = {
91
94
  billData: _billDataTypes.billDataTypes,
92
- contextApiInfo: _smartBillTypes.contextApiInfoTypes
95
+ contextApiInfo: _smartBillTypes.contextApiInfoTypes,
96
+ temporalyDisabled: _propTypes.bool
93
97
  };
94
98
  var _default = exports.default = (0, _WithContextApi.default)()(ConsumptionComparison);
@@ -37,7 +37,8 @@ const ConsumptionEnergyComparison = _ref => {
37
37
  periodNumber,
38
38
  year,
39
39
  savingsPercentage,
40
- currentIsFirstSettlement
40
+ currentIsFirstSettlement,
41
+ temporalyDisabled
41
42
  } = _ref;
42
43
  const {
43
44
  config,
@@ -83,7 +84,7 @@ const ConsumptionEnergyComparison = _ref => {
83
84
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Label, {
84
85
  alias: _aliases.TITLE,
85
86
  className: _stylesModule.default.title
86
- }, texts.billSummary.consumptionTitle), /*#__PURE__*/_react.default.createElement("div", {
87
+ }, texts.billSummary.consumptionTitle), !temporalyDisabled && /*#__PURE__*/_react.default.createElement("div", {
87
88
  className: _stylesModule.default.multipleSettlementsInfo
88
89
  }, currentIsFirstSettlement && /*#__PURE__*/_react.default.createElement(CurrentSettlement, null), /*#__PURE__*/_react.default.createElement(RemainingSettlement, null), !currentIsFirstSettlement && /*#__PURE__*/_react.default.createElement(CurrentSettlement, null)), /*#__PURE__*/_react.default.createElement("div", {
89
90
  className: _stylesModule.default.totalConsumptionContainer
@@ -120,6 +121,7 @@ ConsumptionEnergyComparison.propTypes = {
120
121
  periodNumber: _propTypes.string,
121
122
  year: _propTypes.string,
122
123
  savingsPercentage: _propTypes.number,
123
- currentIsFirstSettlement: _propTypes.bool
124
+ currentIsFirstSettlement: _propTypes.bool,
125
+ temporalyDisabled: _propTypes.bool
124
126
  };
125
127
  var _default = exports.default = (0, _WithContextApi.default)()(ConsumptionEnergyComparison);
@@ -33,7 +33,8 @@ const ConsumptionEnergyDetails = _ref => {
33
33
  billData,
34
34
  multipleSettlements,
35
35
  consumptionComparison,
36
- withPercentage
36
+ withPercentage,
37
+ temporalyDisabled
37
38
  } = _ref;
38
39
  const {
39
40
  config,
@@ -85,7 +86,8 @@ const ConsumptionEnergyDetails = _ref => {
85
86
  periodNumber: periodNumber,
86
87
  year: year,
87
88
  savingsPercentage: savingsPercentage,
88
- currentIsFirstSettlement: currentIsFirstSettlement
89
+ currentIsFirstSettlement: currentIsFirstSettlement,
90
+ temporalyDisabled: temporalyDisabled
89
91
  }) : /*#__PURE__*/_react.default.createElement("div", {
90
92
  className: _stylesModule.default.multipleSettlementsInfo && _stylesModule.default.percentageContainer && showSingleSettlementDays(billData) && _stylesModule.default.singleSettlementDays
91
93
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -145,6 +147,7 @@ ConsumptionEnergyDetails.propTypes = {
145
147
  billData: _billDataTypes.billDataTypes,
146
148
  multipleSettlements: _propTypes.bool,
147
149
  consumptionComparison: _propTypes.bool,
148
- withPercentage: _propTypes.bool
150
+ withPercentage: _propTypes.bool,
151
+ temporalyDisabled: _propTypes.bool
149
152
  };
150
153
  var _default = exports.default = (0, _WithContextApi.default)()(ConsumptionEnergyDetails);
@@ -20,7 +20,8 @@ const Consumption = _ref => {
20
20
  let {
21
21
  billData,
22
22
  multipleSettlements,
23
- contextApiInfo
23
+ contextApiInfo,
24
+ temporalyDisabled
24
25
  } = _ref;
25
26
  const {
26
27
  showPower,
@@ -34,7 +35,8 @@ const Consumption = _ref => {
34
35
  currentPeriod: currentPeriod,
35
36
  multipleSettlements: multipleSettlements,
36
37
  billData: billData,
37
- consumptionComparison: showActiveReactiveComparison(billData)
38
+ consumptionComparison: showActiveReactiveComparison(billData),
39
+ temporalyDisabled: temporalyDisabled
38
40
  }), showPower(billData) && (0, _utils.validateConsumptions)(hiredPowerConsumption?.value, registeredPowerConsumption?.value) && /*#__PURE__*/_react.default.createElement(_PowerProgresBar.default, {
39
41
  hiredPowerConsumption: hiredPowerConsumption,
40
42
  registeredPowerConsumption: registeredPowerConsumption,
@@ -44,6 +46,7 @@ const Consumption = _ref => {
44
46
  Consumption.propTypes = {
45
47
  billData: _billDataTypes.billDataTypes,
46
48
  contextApiInfo: _smartBillTypes.contextApiInfoTypes,
47
- multipleSettlements: _propTypes.bool
49
+ multipleSettlements: _propTypes.bool,
50
+ temporalyDisabled: _propTypes.bool
48
51
  };
49
52
  var _default = exports.default = (0, _WithContextApi.default)()(Consumption);
@@ -32,7 +32,8 @@ const BillBody = _ref => {
32
32
  let {
33
33
  billData,
34
34
  multipleSettlements,
35
- contextApiInfo
35
+ contextApiInfo,
36
+ temporalyDisabled
36
37
  } = _ref;
37
38
  const {
38
39
  isDesktopSize
@@ -68,7 +69,8 @@ const BillBody = _ref => {
68
69
  isDesktopSize: isDesktopSize
69
70
  }), /*#__PURE__*/_react.default.createElement(_Consumption.default, {
70
71
  billData: billData,
71
- multipleSettlements: multipleSettlements
72
+ multipleSettlements: multipleSettlements,
73
+ temporalyDisabled: temporalyDisabled
72
74
  }));
73
75
  return /*#__PURE__*/_react.default.createElement("div", {
74
76
  className: _stylesModule.default.container
@@ -87,6 +89,7 @@ const BillBody = _ref => {
87
89
  BillBody.propTypes = {
88
90
  billData: _billDataTypes.billDataTypes,
89
91
  contextApiInfo: _smartBillTypes.contextApiInfoTypes,
90
- multipleSettlements: _propTypes.bool
92
+ multipleSettlements: _propTypes.bool,
93
+ temporalyDisabled: _propTypes.bool
91
94
  };
92
95
  var _default = exports.default = (0, _WithContextApi.default)()(BillBody);
@@ -17,7 +17,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
17
17
  const MainBillData = _ref => {
18
18
  let {
19
19
  billData,
20
- classes
20
+ classes,
21
+ temporalyDisabled
21
22
  } = _ref;
22
23
  const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
23
24
  const multipleSettlements = currentPeriod?.settlements?.total_settlements > 1;
@@ -27,13 +28,15 @@ const MainBillData = _ref => {
27
28
  billData: billData
28
29
  }), /*#__PURE__*/_react.default.createElement(_BillBody.default, {
29
30
  billData: billData,
30
- multipleSettlements: multipleSettlements
31
+ multipleSettlements: multipleSettlements,
32
+ temporalyDisabled: temporalyDisabled
31
33
  }));
32
34
  };
33
35
  MainBillData.propTypes = {
34
36
  billData: _billDataTypes.billDataTypes,
35
37
  classes: (0, _propTypes.shape)({
36
38
  container: _propTypes.string
37
- })
39
+ }),
40
+ temporalyDisabled: _propTypes.bool
38
41
  };
39
42
  var _default = exports.default = (0, _WithContextApi.default)(_theme.retrieveStyle)(MainBillData);
@@ -36,7 +36,8 @@ const SmartBillSummary = _ref => {
36
36
  smartBill,
37
37
  tabOptions,
38
38
  translations,
39
- utils
39
+ utils,
40
+ periodSpan
40
41
  } = _ref;
41
42
  const {
42
43
  aiQuestionsList,
@@ -169,7 +170,8 @@ const SmartBillSummary = _ref => {
169
170
  reverseRow,
170
171
  smartBill,
171
172
  translations,
172
- utils
173
+ utils,
174
+ periodSpan
173
175
  })), aiQuestionsPanelEnabled && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTTooltip, {
174
176
  arrow: false,
175
177
  content: isDesktopSize ? widyTooltipContent : '',
@@ -235,6 +237,7 @@ SmartBillSummary.propTypes = {
235
237
  value: _propTypes.string
236
238
  })),
237
239
  translations: _propTypes.object,
238
- utils: _propTypes.object
240
+ utils: _propTypes.object,
241
+ periodSpan: _propTypes.string
239
242
  };
240
243
  var _default = exports.default = SmartBillSummary;
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TAG_ICON_SIZE = exports.RIGHT_UNIT_ALIGNMENT = exports.DEFAULT_TAG_ICON = exports.DEFAULT_TAG_COLOR_THEME = void 0;
6
+ exports.TAG_ICON_SIZE = exports.RIGHT_UNIT_ALIGNMENT = exports.MONTHLY_SPAN = exports.DEFAULT_TAG_ICON = exports.DEFAULT_TAG_COLOR_THEME = exports.BIMESTRAL_SPAN = void 0;
7
7
  const DEFAULT_TAG_ICON = exports.DEFAULT_TAG_ICON = 'IconCalendarEvent';
8
8
  const TAG_ICON_SIZE = exports.TAG_ICON_SIZE = 14;
9
9
  const DEFAULT_TAG_COLOR_THEME = exports.DEFAULT_TAG_COLOR_THEME = 'gray';
10
- const RIGHT_UNIT_ALIGNMENT = exports.RIGHT_UNIT_ALIGNMENT = 'right';
10
+ const RIGHT_UNIT_ALIGNMENT = exports.RIGHT_UNIT_ALIGNMENT = 'right';
11
+ const BIMESTRAL_SPAN = exports.BIMESTRAL_SPAN = 'bimestral';
12
+ const MONTHLY_SPAN = exports.MONTHLY_SPAN = 'monthly';
@@ -18,7 +18,8 @@ const Billing = _ref => {
18
18
  smartBill,
19
19
  texts,
20
20
  unitAlignment = _constants.RIGHT_UNIT_ALIGNMENT,
21
- unit
21
+ unit,
22
+ periodSpan = _constants.BIMESTRAL_SPAN
22
23
  } = _ref;
23
24
  const {
24
25
  title,
@@ -27,12 +28,12 @@ const Billing = _ref => {
27
28
  periodDetail
28
29
  } = texts?.billing || {};
29
30
  const currentPeriod = smartBill?.periods?.find(period => period.current);
30
- const billingsToShow = (0, _utils.getBillingsToShow)(currentPeriod?.settlements);
31
+ const billingsToShow = (0, _utils.getBillingsToShow)(currentPeriod?.settlements, periodSpan);
31
32
  return /*#__PURE__*/_react.default.createElement("div", {
32
33
  className: _stylesModule.default.container
33
34
  }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
34
35
  colorTheme: "gray",
35
- variant: "small"
36
+ variant: "subtitle1"
36
37
  }, title), /*#__PURE__*/_react.default.createElement("div", {
37
38
  className: _stylesModule.default.details
38
39
  }, billingsToShow.map(_ref2 => {
@@ -89,6 +90,7 @@ Billing.propTypes = {
89
90
  smartBill: _billDataTypes.billDataTypes,
90
91
  texts: _propTypes.object,
91
92
  unitAlignment: _propTypes.string,
92
- unit: _propTypes.string
93
+ unit: _propTypes.string,
94
+ periodSpan: _propTypes.string
93
95
  };
94
96
  var _default = exports.default = Billing;
@@ -6,9 +6,19 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getMonthName = exports.getConsumptionLabel = exports.getBillingsToShow = void 0;
7
7
  var _dayjs = _interopRequireDefault(require("dayjs"));
8
8
  require("dayjs/locale/es");
9
+ var _constants = require("./constants");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  _dayjs.default.locale('es');
11
- const getBillingsToShow = settlements => {
12
+ const getBillingsToShow = (settlements, periodSpan) => {
13
+ if (periodSpan === _constants.MONTHLY_SPAN) {
14
+ const currentBilling = {
15
+ ...settlements?.current,
16
+ colorTheme: 'success',
17
+ current: true,
18
+ icon: 'IconCheck'
19
+ };
20
+ return [currentBilling];
21
+ }
12
22
  const currentBilling = {
13
23
  ...settlements?.current,
14
24
  colorTheme: 'success',
@@ -18,7 +18,8 @@ const Consumptions = _ref => {
18
18
  assets,
19
19
  reverseRow = {},
20
20
  smartBill,
21
- translations
21
+ translations,
22
+ periodSpan
22
23
  } = _ref;
23
24
  const {
24
25
  title,
@@ -45,11 +46,13 @@ const Consumptions = _ref => {
45
46
  texts: translations
46
47
  }), /*#__PURE__*/_react.default.createElement(_Billing.default, {
47
48
  smartBill: smartBill,
48
- texts: translations
49
+ texts: translations,
50
+ periodSpan: periodSpan
49
51
  }))));
50
52
  };
51
53
  Consumptions.propTypes = {
52
54
  assets: _propTypes.object,
55
+ periodSpan: _propTypes.string,
53
56
  reverseRow: _propTypes.object,
54
57
  smartBill: _billDataTypes.billDataTypes,
55
58
  translations: _propTypes.object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/utilitygo-smart-bill-web",
3
- "version": "3.14.1",
3
+ "version": "3.15.0",
4
4
  "description": "UtilityGO SmartBill Web",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",