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