@widergy/utilitygo-smart-bill-web 2.2.1 → 3.0.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 +20 -0
- package/dist/components/Advice/index.js +11 -8
- package/dist/components/Amount/index.js +27 -23
- package/dist/components/Amount/utils.js +1 -5
- package/dist/components/Banner/index.js +11 -8
- package/dist/components/BarChart/constants.js +3 -6
- package/dist/components/BarChart/index.js +29 -24
- package/dist/components/BarChart/utils.js +15 -15
- package/dist/components/BillCalculation/components/ConceptCard/index.js +53 -47
- package/dist/components/BillCalculation/components/Glossary/index.js +49 -66
- package/dist/components/BillCalculation/components/Glossary/styles.module.scss +1 -0
- package/dist/components/BillCalculation/constants.js +1 -2
- package/dist/components/BillCalculation/index.js +49 -53
- package/dist/components/BillCalculation/utils.js +19 -22
- package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +26 -24
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/constants.js +2 -3
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +16 -17
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/styles.module.scss +3 -3
- package/dist/components/BillSummary/components/BilledConcepts/constants.js +12 -17
- package/dist/components/BillSummary/components/BilledConcepts/index.js +30 -41
- package/dist/components/BillSummary/components/BilledConcepts/utils.js +44 -68
- package/dist/components/BillSummary/index.js +71 -71
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +9 -10
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +18 -12
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +1 -1
- package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +144 -143
- package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +17 -16
- package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +84 -88
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +22 -13
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +1 -1
- package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +22 -16
- package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +13 -9
- package/dist/components/ConsumptionComparison/index.js +42 -47
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +28 -24
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/styles.module.scss +1 -1
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +19 -15
- package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +16 -14
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +22 -17
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +1 -1
- package/dist/components/ConsumptionEnergyDetails/index.js +47 -43
- package/dist/components/ConsumptionEnergyDetails/styles.module.scss +2 -2
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +65 -62
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +11 -13
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +21 -19
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +17 -12
- package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +43 -39
- package/dist/components/ConsumptionIncluded/components/TimelineRow/styles.module.scss +2 -2
- package/dist/components/ConsumptionIncluded/index.js +32 -34
- package/dist/components/ConsumptionIncluded/utils.js +29 -33
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +15 -12
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +24 -22
- package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +19 -28
- package/dist/components/ConsumptionPeriod/components/Reading/index.js +36 -34
- package/dist/components/ConsumptionPeriod/index.js +13 -10
- package/dist/components/ConsumptionPeriod/utils.js +13 -15
- package/dist/components/Date/index.js +13 -11
- package/dist/components/DebtState/index.js +15 -10
- package/dist/components/IconAndDetails/index.js +20 -19
- package/dist/components/Magnitude/index.js +16 -14
- package/dist/components/Magnitude/utils.js +2 -8
- package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +19 -16
- package/dist/components/MainBillData/components/BillAlert/index.js +25 -33
- package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +20 -13
- package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +15 -13
- package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +1 -3
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +24 -17
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/styles.module.scss +2 -2
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +1 -1
- package/dist/components/MainBillData/components/BillBody/index.js +43 -46
- package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +17 -13
- package/dist/components/MainBillData/components/BillHeader/index.js +30 -26
- package/dist/components/MainBillData/components/BillHeader/styles.module.scss +1 -1
- package/dist/components/MainBillData/index.js +8 -7
- package/dist/components/MainBillData/theme.js +7 -9
- package/dist/components/MainBillData/utils.js +1 -5
- package/dist/components/Period/index.js +55 -45
- package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +16 -13
- package/dist/components/PowerProgresBar/index.js +32 -32
- package/dist/components/RateAndCategory/index.js +26 -29
- package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +21 -15
- package/dist/components/RatesDefinition/components/BillRate/index.js +25 -16
- package/dist/components/RatesDefinition/components/BillRate/styles.module.scss +1 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +15 -11
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +27 -23
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +12 -9
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/styles.module.scss +1 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +9 -9
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +22 -21
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +35 -38
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/styles.module.scss +0 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +2 -4
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +18 -32
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +35 -47
- package/dist/components/RatesDefinition/components/CategoryByConsumption/constants.js +18 -36
- package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +24 -33
- package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +1 -5
- package/dist/components/RatesDefinition/components/PurchasedRate/index.js +20 -15
- package/dist/components/RatesDefinition/index.js +21 -17
- package/dist/components/RatesDefinition/styles.module.scss +1 -1
- package/dist/components/SmartBillProvider/index.js +13 -36
- package/dist/components/StyledAmount/constants.js +2 -3
- package/dist/components/StyledAmount/index.js +20 -29
- package/dist/components/WithContextApi/index.js +19 -27
- package/dist/components/WithContextApi/layout.js +3 -4
- package/dist/components/WithSeason/index.js +7 -11
- package/dist/constants/deviceSizes.js +27 -24
- package/dist/constants/seasons.js +3 -5
- package/dist/index.js +19 -19
- package/dist/scss/variables/commonColors.module.scss +1 -1
- package/dist/shared/Context/index.js +5 -3
- package/dist/shared/constants/aliases.js +691 -694
- package/dist/shared/constants/consumptions.js +5 -9
- package/dist/shared/constants/periodicities.js +2 -3
- package/dist/shared/constants/rates.js +2 -3
- package/dist/shared/constants/readings.js +3 -5
- package/dist/shared/constants/seasons.js +3 -5
- package/dist/shared/constants/stagesGraph.js +4 -8
- package/dist/shared/types/assetsTypes.js +1 -2
- package/dist/shared/types/billDataTypes.js +6 -11
- package/dist/shared/types/componentsTypes.js +19 -14
- package/dist/shared/types/formattersTypes.js +2 -3
- package/dist/shared/types/rateStagesTypes.js +3 -6
- package/dist/shared/types/smartBillTypes.js +5 -11
- package/dist/shared/types/textsTypes.js +2 -3
- package/dist/shared/utils/billCalculation.js +9 -9
- package/dist/shared/utils/consumptions.js +27 -55
- package/dist/shared/utils/context.js +6 -5
- package/dist/shared/utils/expirations.js +1 -5
- package/dist/shared/utils/periods.js +14 -20
- package/dist/shared/utils/rates.js +1 -5
- package/dist/shared/utils/readings.js +2 -10
- package/dist/shared/utils/season.js +1 -5
- package/dist/shared/utils/stagesGraph.js +11 -15
- package/dist/utils/hooks.js +2 -3
- package/dist/utils.js +4 -8
- package/package.json +26 -63
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -23,75 +22,77 @@ var _aliases = require("../../shared/constants/aliases");
|
|
|
23
22
|
var _BilledConcepts = _interopRequireDefault(require("./components/BilledConcepts"));
|
|
24
23
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
25
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
-
function _getRequireWildcardCache(
|
|
27
|
-
function _interopRequireWildcard(
|
|
28
|
-
|
|
25
|
+
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); }
|
|
26
|
+
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 && Object.prototype.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; }
|
|
27
|
+
const BillSummary = _ref => {
|
|
29
28
|
var _billData$client, _billData$client2, _currentPeriod$settle, _currentPeriod$settle2;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
29
|
+
let {
|
|
30
|
+
contextApiInfo,
|
|
31
|
+
billData
|
|
32
|
+
} = _ref;
|
|
33
|
+
const {
|
|
34
|
+
config,
|
|
35
|
+
assets
|
|
36
|
+
} = contextApiInfo;
|
|
37
|
+
const {
|
|
38
|
+
consumptionDetail
|
|
39
|
+
} = config.externalLinks;
|
|
40
|
+
const {
|
|
41
|
+
showBillSummaryBanner,
|
|
42
|
+
showPower,
|
|
43
|
+
showCategory
|
|
44
|
+
} = config.validations;
|
|
45
|
+
const {
|
|
46
|
+
texts
|
|
47
|
+
} = config;
|
|
48
|
+
const {
|
|
49
|
+
ConsumptionBannerIcon,
|
|
50
|
+
ConsumptionBannerResponsiveIcon
|
|
51
|
+
} = assets;
|
|
52
|
+
const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
|
|
53
|
+
const hiredPowerConsumption = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.PURCHASED);
|
|
54
|
+
const registeredPowerConsumption = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.REGISTERED);
|
|
55
|
+
const exceededPower = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.EXCEEDED);
|
|
56
|
+
const rate = billData === null || billData === void 0 || (_billData$client = billData.client) === null || _billData$client === void 0 || (_billData$client = _billData$client.rate) === null || _billData$client === void 0 ? void 0 : _billData$client.purchased;
|
|
57
|
+
const category = billData === null || billData === void 0 || (_billData$client2 = billData.client) === null || _billData$client2 === void 0 || (_billData$client2 = _billData$client2.rate) === null || _billData$client2 === void 0 ? void 0 : _billData$client2.category;
|
|
58
|
+
const multipleSettlements = (currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle = currentPeriod.settlements) === null || _currentPeriod$settle === void 0 ? void 0 : _currentPeriod$settle.total_settlements) > 1;
|
|
59
|
+
const issuedDate = currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle2 = currentPeriod.settlements) === null || _currentPeriod$settle2 === void 0 || (_currentPeriod$settle2 = _currentPeriod$settle2.current) === null || _currentPeriod$settle2 === void 0 ? void 0 : _currentPeriod$settle2.issued_on;
|
|
60
|
+
const {
|
|
61
|
+
isDesktopSize
|
|
62
|
+
} = (0, _hooks.useScreenSize)();
|
|
63
|
+
const withBanner = showBillSummaryBanner(billData);
|
|
64
|
+
const RenderPeriod = () => /*#__PURE__*/_react.default.createElement(_Period.default, {
|
|
65
|
+
billData: billData,
|
|
66
|
+
alias: _aliases.SUMMARY_PERIOD,
|
|
67
|
+
currentPeriod: currentPeriod,
|
|
68
|
+
multipleSettlements: multipleSettlements,
|
|
69
|
+
issuedDate: issuedDate
|
|
70
|
+
});
|
|
71
|
+
const RenderConsumptionEnergyDetails = () => /*#__PURE__*/_react.default.createElement(_ConsumptionEnergyDetails.default, {
|
|
72
|
+
billData: billData,
|
|
73
|
+
currentPeriod: currentPeriod,
|
|
74
|
+
multipleSettlements: multipleSettlements,
|
|
75
|
+
withPercentage: true
|
|
76
|
+
});
|
|
77
|
+
const RenderRateAndCategory = () => /*#__PURE__*/_react.default.createElement(_RateAndCategory.default, {
|
|
78
|
+
rate: rate,
|
|
79
|
+
category: category,
|
|
80
|
+
title: texts.billSummary.rateTitle,
|
|
81
|
+
classes: {
|
|
82
|
+
container: _stylesModule.default.rateContainer,
|
|
83
|
+
purchasedRate: _stylesModule.default.purchasedRate,
|
|
84
|
+
category: _stylesModule.default.category
|
|
85
|
+
},
|
|
86
|
+
showCategory: showCategory(billData)
|
|
87
|
+
});
|
|
88
|
+
const RenderPowerProgresBar = () => /*#__PURE__*/_react.default.createElement(_PowerProgresBar.default, {
|
|
89
|
+
hiredPowerConsumption: hiredPowerConsumption,
|
|
90
|
+
registeredPowerConsumption: registeredPowerConsumption,
|
|
91
|
+
exceededPower: exceededPower
|
|
92
|
+
});
|
|
93
|
+
const RenderBilledConcepts = () => /*#__PURE__*/_react.default.createElement(_BilledConcepts.default, {
|
|
94
|
+
billData: billData
|
|
95
|
+
});
|
|
95
96
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, isDesktopSize ? /*#__PURE__*/_react.default.createElement("div", {
|
|
96
97
|
className: _stylesModule.default.container
|
|
97
98
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -118,5 +119,4 @@ BillSummary.propTypes = {
|
|
|
118
119
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
119
120
|
billData: _billDataTypes.billDataTypes
|
|
120
121
|
};
|
|
121
|
-
var _default = (0, _WithContextApi.default)()(BillSummary);
|
|
122
|
-
exports.default = _default;
|
|
122
|
+
var _default = exports.default = (0, _WithContextApi.default)()(BillSummary);
|
|
@@ -10,16 +10,16 @@ var _object = require("@widergy/web-utils/lib/object");
|
|
|
10
10
|
var _componentsTypes = require("../../../../../../shared/types/componentsTypes");
|
|
11
11
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const DataLine = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
fields
|
|
16
|
+
} = _ref;
|
|
15
17
|
return !(0, _object.objectIsEmpty)(fields) && /*#__PURE__*/_react.default.createElement("div", {
|
|
16
18
|
className: _stylesModule.default.container
|
|
17
|
-
}, fields === null || fields === void 0 ? void 0 : fields.map(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, field.Component);
|
|
22
|
-
}));
|
|
19
|
+
}, fields === null || fields === void 0 ? void 0 : fields.map(field => field && /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
key: field.id,
|
|
21
|
+
className: _stylesModule.default.cell
|
|
22
|
+
}, field.Component)));
|
|
23
23
|
};
|
|
24
24
|
DataLine.propTypes = {
|
|
25
25
|
fields: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
@@ -29,5 +29,4 @@ DataLine.propTypes = {
|
|
|
29
29
|
showOnMobile: _propTypes.bool
|
|
30
30
|
}))
|
|
31
31
|
};
|
|
32
|
-
var _default = DataLine;
|
|
33
|
-
exports.default = _default;
|
|
32
|
+
var _default = exports.default = DataLine;
|
package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js
CHANGED
|
@@ -13,16 +13,23 @@ var _aliases = require("../../../../../../shared/constants/aliases");
|
|
|
13
13
|
var _utils = require("./utils");
|
|
14
14
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const Season = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
contextApiInfo,
|
|
19
|
+
season
|
|
20
|
+
} = _ref;
|
|
21
|
+
const {
|
|
22
|
+
assets,
|
|
23
|
+
config,
|
|
24
|
+
Label
|
|
25
|
+
} = contextApiInfo;
|
|
26
|
+
const {
|
|
27
|
+
texts
|
|
28
|
+
} = config;
|
|
29
|
+
const {
|
|
30
|
+
Icon,
|
|
31
|
+
text
|
|
32
|
+
} = (0, _utils.getSeasonProps)(season, texts, assets);
|
|
26
33
|
return Icon && text ? /*#__PURE__*/_react.default.createElement("div", {
|
|
27
34
|
className: _stylesModule.default.container
|
|
28
35
|
}, /*#__PURE__*/_react.default.createElement(Icon, {
|
|
@@ -35,5 +42,4 @@ Season.propTypes = {
|
|
|
35
42
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
36
43
|
season: _propTypes.string
|
|
37
44
|
};
|
|
38
|
-
var _default = (0, _WithContextApi.default)()((0, _WithSeason.default)()(Season));
|
|
39
|
-
exports.default = _default;
|
|
45
|
+
var _default = exports.default = (0, _WithContextApi.default)()((0, _WithSeason.default)()(Season));
|
package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getSeasonProps = void 0;
|
|
7
7
|
var _seasons = require("../../../../../../shared/constants/seasons");
|
|
8
|
-
|
|
8
|
+
const getSeasonProps = (season, texts, assets) => {
|
|
9
9
|
switch (season) {
|
|
10
10
|
case _seasons.SEASONS.AUTUMN:
|
|
11
11
|
return {
|
|
@@ -13,43 +13,32 @@ var _utils = require("../../../../utils");
|
|
|
13
13
|
var _aliases = require("../../../../shared/constants/aliases");
|
|
14
14
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exports.
|
|
22
|
-
|
|
23
|
-
exports.
|
|
24
|
-
|
|
25
|
-
exports.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Label = contextApiInfo.Label;
|
|
43
|
-
var _config$texts$consump = config.texts.consumptionComparison,
|
|
44
|
-
periodDates = _config$texts$consump.periodDates,
|
|
45
|
-
settlementDays = _config$texts$consump.settlementDays,
|
|
46
|
-
energyConsumption = _config$texts$consump.energyConsumption,
|
|
47
|
-
powerConsumption = _config$texts$consump.powerConsumption,
|
|
48
|
-
totalConsumption = _config$texts$consump.totalConsumption,
|
|
49
|
-
dailyConsumption = _config$texts$consump.dailyConsumption,
|
|
50
|
-
averageTemperature = _config$texts$consump.averageTemperature,
|
|
51
|
-
yearOrBimester = _config$texts$consump.yearOrBimester,
|
|
52
|
-
yearOrPeriod = _config$texts$consump.yearOrPeriod;
|
|
16
|
+
const FIELD_PERIOD_COMPARISION = exports.FIELD_PERIOD_COMPARISION = 'period_comparison';
|
|
17
|
+
const FIELD_PERIOD_DATES = exports.FIELD_PERIOD_DATES = 'period_dates';
|
|
18
|
+
const FIELD_SETTLEMENTS_DAYS = exports.FIELD_SETTLEMENTS_DAYS = 'settlements_days';
|
|
19
|
+
const FIELD_ENERGY_CONSUMPTION = exports.FIELD_ENERGY_CONSUMPTION = 'energy_consumption';
|
|
20
|
+
const FIELD_POWER_CONSUMPTION = exports.FIELD_POWER_CONSUMPTION = 'power_consumption';
|
|
21
|
+
const FIELD_TOTAL_CONSUMPTIONS = exports.FIELD_TOTAL_CONSUMPTIONS = 'total_consumptions';
|
|
22
|
+
const FIELD_DAILY_CONSUMPTIONS = exports.FIELD_DAILY_CONSUMPTIONS = 'daily_consumptions';
|
|
23
|
+
const FIELD_AVERAGE_TEMPERATURE = exports.FIELD_AVERAGE_TEMPERATURE = 'average_temperature';
|
|
24
|
+
const NO_DATA_FIELD = exports.NO_DATA_FIELD = 'no_data_cell';
|
|
25
|
+
const dataFieldDictonary = exports.dataFieldDictonary = ['period_comparison', 'period_dates', 'settlements_days', 'total_consumptions', 'energy_consumption', 'power_consumption', 'daily_consumptions', 'average_temperature'];
|
|
26
|
+
const desktopGetHeaderFields = (contextApiInfo, withPowerComparison, showTemp) => {
|
|
27
|
+
const {
|
|
28
|
+
config,
|
|
29
|
+
Label
|
|
30
|
+
} = contextApiInfo;
|
|
31
|
+
const {
|
|
32
|
+
periodDates,
|
|
33
|
+
settlementDays,
|
|
34
|
+
energyConsumption,
|
|
35
|
+
powerConsumption,
|
|
36
|
+
totalConsumption,
|
|
37
|
+
dailyConsumption,
|
|
38
|
+
averageTemperature,
|
|
39
|
+
yearOrBimester,
|
|
40
|
+
yearOrPeriod
|
|
41
|
+
} = config.texts.consumptionComparison;
|
|
53
42
|
return [{
|
|
54
43
|
id: 'season',
|
|
55
44
|
Component: /*#__PURE__*/_react.default.createElement(Label, {
|
|
@@ -93,117 +82,129 @@ var desktopGetHeaderFields = function desktopGetHeaderFields(contextApiInfo, wit
|
|
|
93
82
|
}];
|
|
94
83
|
};
|
|
95
84
|
exports.desktopGetHeaderFields = desktopGetHeaderFields;
|
|
96
|
-
|
|
85
|
+
const formatInterval = period => {
|
|
97
86
|
var _period$settlements, _period$settlements2;
|
|
98
|
-
|
|
99
|
-
|
|
87
|
+
const startDate = period === null || period === void 0 || (_period$settlements = period.settlements) === null || _period$settlements === void 0 ? void 0 : _period$settlements.start_date;
|
|
88
|
+
const endDate = period === null || period === void 0 || (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 ? void 0 : _period$settlements2.end_date;
|
|
100
89
|
return startDate && endDate && "".concat((0, _dayjs.default)(startDate).format('DD/MM'), " - ").concat((0, _dayjs.default)(endDate).format('DD/MM'));
|
|
101
90
|
};
|
|
102
|
-
|
|
103
|
-
var _data$period, _getDailyConsumption
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
91
|
+
const getField = function () {
|
|
92
|
+
var _data$period, _getDailyConsumption$;
|
|
93
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
94
|
+
let contextApiInfo = arguments.length > 1 ? arguments[1] : undefined;
|
|
95
|
+
const {
|
|
96
|
+
Label
|
|
97
|
+
} = contextApiInfo;
|
|
98
|
+
const {
|
|
99
|
+
isHeader,
|
|
100
|
+
data,
|
|
101
|
+
primary,
|
|
102
|
+
text
|
|
103
|
+
} = options;
|
|
104
|
+
const textLabel = /*#__PURE__*/_react.default.createElement(Label, {
|
|
112
105
|
alias: _aliases.DETAIL
|
|
113
106
|
}, text);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
107
|
+
const textAlias = primary ? _aliases.PERIOD_COMPARISON_TEXT : _aliases.PERIOD_COMPARISON_TEXT_PREV;
|
|
108
|
+
const magnitudeAlias = primary ? _aliases.PERIOD_COMPARISON_NUMBER : _aliases.PERIOD_COMPARISON_NUMBER_PREV;
|
|
109
|
+
const unitAlias = primary ? _aliases.PERIOD_COMPARISON_UNIT : _aliases.PERIOD_COMPARISON_UNIT_PREV;
|
|
110
|
+
return {
|
|
111
|
+
[FIELD_PERIOD_COMPARISION]: {
|
|
112
|
+
id: FIELD_PERIOD_COMPARISION,
|
|
113
|
+
Component: !isHeader ? /*#__PURE__*/_react.default.createElement(Label, {
|
|
114
|
+
alias: textAlias
|
|
115
|
+
}, text || (0, _utils.stringOrDash)(data)) : textLabel
|
|
116
|
+
},
|
|
117
|
+
[FIELD_PERIOD_DATES]: {
|
|
118
|
+
id: FIELD_PERIOD_DATES,
|
|
119
|
+
Component: !isHeader ? /*#__PURE__*/_react.default.createElement(Label, {
|
|
120
|
+
alias: textAlias
|
|
121
|
+
}, text || (0, _utils.stringOrDash)(formatInterval(data))) : textLabel
|
|
122
|
+
},
|
|
123
|
+
[FIELD_SETTLEMENTS_DAYS]: {
|
|
124
|
+
id: FIELD_SETTLEMENTS_DAYS,
|
|
125
|
+
Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
|
|
126
|
+
numberAlias: magnitudeAlias,
|
|
127
|
+
unitAlias: unitAlias,
|
|
128
|
+
value: (_data$period = data.period) === null || _data$period === void 0 || (_data$period = _data$period.settlements) === null || _data$period === void 0 ? void 0 : _data$period.total_settlements_days,
|
|
129
|
+
unit: data.daysUnit,
|
|
130
|
+
classes: {
|
|
131
|
+
numberAndUnit: _stylesModule.default.numberAndUnit
|
|
132
|
+
}
|
|
133
|
+
}) : textLabel
|
|
134
|
+
},
|
|
135
|
+
[FIELD_TOTAL_CONSUMPTIONS]: {
|
|
136
|
+
id: FIELD_TOTAL_CONSUMPTIONS,
|
|
137
|
+
Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
|
|
138
|
+
numberAlias: magnitudeAlias,
|
|
139
|
+
unitAlias: unitAlias,
|
|
140
|
+
value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value,
|
|
141
|
+
unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
|
|
142
|
+
classes: {
|
|
143
|
+
numberAndUnit: _stylesModule.default.numberAndUnit
|
|
144
|
+
}
|
|
145
|
+
}) : textLabel
|
|
146
|
+
},
|
|
147
|
+
[FIELD_ENERGY_CONSUMPTION]: {
|
|
148
|
+
id: FIELD_ENERGY_CONSUMPTION,
|
|
149
|
+
Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
|
|
150
|
+
numberAlias: magnitudeAlias,
|
|
151
|
+
unitAlias: unitAlias,
|
|
152
|
+
value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value,
|
|
153
|
+
unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
|
|
154
|
+
classes: {
|
|
155
|
+
numberAndUnit: _stylesModule.default.numberAndUnit
|
|
156
|
+
}
|
|
157
|
+
}) : textLabel
|
|
158
|
+
},
|
|
159
|
+
[FIELD_POWER_CONSUMPTION]: {
|
|
160
|
+
id: FIELD_POWER_CONSUMPTION,
|
|
161
|
+
Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
|
|
162
|
+
numberAlias: magnitudeAlias,
|
|
163
|
+
unitAlias: unitAlias,
|
|
164
|
+
value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.POWER_TYPES.REGISTERED).value,
|
|
165
|
+
unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.POWER_TYPES.REGISTERED).unit,
|
|
166
|
+
classes: {
|
|
167
|
+
numberAndUnit: _stylesModule.default.numberAndUnit
|
|
168
|
+
}
|
|
169
|
+
}) : textLabel
|
|
170
|
+
},
|
|
171
|
+
[FIELD_DAILY_CONSUMPTIONS]: {
|
|
172
|
+
id: FIELD_DAILY_CONSUMPTIONS,
|
|
173
|
+
Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
|
|
174
|
+
numberAlias: magnitudeAlias,
|
|
175
|
+
unitAlias: unitAlias,
|
|
176
|
+
value: (_getDailyConsumption$ = (0, _consumptions.getDailyConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value) === null || _getDailyConsumption$ === void 0 ? void 0 : _getDailyConsumption$.toFixed(1).toString().replace(/\./, ','),
|
|
177
|
+
unit: (0, _consumptions.getDailyConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
|
|
178
|
+
classes: {
|
|
179
|
+
numberAndUnit: _stylesModule.default.numberAndUnit
|
|
180
|
+
}
|
|
181
|
+
}) : /*#__PURE__*/_react.default.createElement(Label, {
|
|
182
|
+
alias: _aliases.DETAIL
|
|
183
|
+
}, text)
|
|
184
|
+
},
|
|
185
|
+
[FIELD_AVERAGE_TEMPERATURE]: {
|
|
186
|
+
id: FIELD_AVERAGE_TEMPERATURE,
|
|
187
|
+
Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
|
|
188
|
+
numberAlias: magnitudeAlias,
|
|
189
|
+
unitAlias: unitAlias,
|
|
190
|
+
value: Math.round(data.periodAverageTemperature || data.period),
|
|
191
|
+
unit: data.temperatureUnit,
|
|
192
|
+
classes: {
|
|
193
|
+
numberAndUnit: _stylesModule.default.numberAndUnit
|
|
194
|
+
}
|
|
195
|
+
}) : textLabel
|
|
196
|
+
},
|
|
197
|
+
[NO_DATA_FIELD]: {
|
|
198
|
+
id: NO_DATA_FIELD,
|
|
199
|
+
Component: /*#__PURE__*/_react.default.createElement(Label, {
|
|
200
|
+
alias: textAlias
|
|
201
|
+
}, data)
|
|
202
|
+
}
|
|
203
|
+
};
|
|
201
204
|
};
|
|
202
205
|
exports.getField = getField;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}, contextApiInfo)[NO_DATA_FIELD];
|
|
208
|
-
};
|
|
206
|
+
const noPeriodData = (primary, noData, contextApiInfo) => getField({
|
|
207
|
+
primary,
|
|
208
|
+
data: noData
|
|
209
|
+
}, contextApiInfo)[NO_DATA_FIELD];
|
|
209
210
|
exports.noPeriodData = noPeriodData;
|
|
@@ -14,27 +14,28 @@ var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"))
|
|
|
14
14
|
var _utils = require("./utils");
|
|
15
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
const ComparisonTable = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
contextApiInfo,
|
|
20
|
+
billData,
|
|
21
|
+
isDesktopSize
|
|
22
|
+
} = _ref;
|
|
23
|
+
const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
|
|
24
|
+
const lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
|
|
25
|
+
const {
|
|
26
|
+
withPowerComparison
|
|
27
|
+
} = contextApiInfo.config.validations;
|
|
28
|
+
const currentPeriodAverageTemperature = (0, _seamlessImmutable.getIn)(billData, ['current_period_avg_temperature']);
|
|
29
|
+
const lastYearPeriodAverageTemperature = (0, _seamlessImmutable.getIn)(billData, ['previous_period_avg_temperature']);
|
|
30
|
+
const getTableLines = isDesktopSize ? _utils.desktopGetTableLines : _utils.mobileGetTableLines;
|
|
31
|
+
const expand = !(!withPowerComparison || currentPeriodAverageTemperature || lastYearPeriodAverageTemperature);
|
|
28
32
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
29
33
|
className: "".concat(_stylesModule.default.container, " ").concat(expand && _stylesModule.default.expand)
|
|
30
|
-
}, getTableLines(contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktopSize, withPowerComparison(billData)).map(
|
|
31
|
-
return line.Component;
|
|
32
|
-
}));
|
|
34
|
+
}, getTableLines(contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktopSize, withPowerComparison(billData)).map(line => line.Component));
|
|
33
35
|
};
|
|
34
36
|
ComparisonTable.propTypes = {
|
|
35
37
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
36
38
|
billData: _billDataTypes.billDataTypes,
|
|
37
39
|
isDesktopSize: _propTypes.bool
|
|
38
40
|
};
|
|
39
|
-
var _default = (0, _WithContextApi.default)()(ComparisonTable);
|
|
40
|
-
exports.default = _default;
|
|
41
|
+
var _default = exports.default = (0, _WithContextApi.default)()(ComparisonTable);
|