@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
|
@@ -121,8 +121,8 @@ $height-check-icon: 24px;
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
.minicheck {
|
|
124
|
-
position: absolute;
|
|
125
124
|
height: $height-check-icon;
|
|
125
|
+
position: absolute;
|
|
126
126
|
width: $widht-check-icon;
|
|
127
127
|
z-index: 1;
|
|
128
128
|
}
|
|
@@ -152,9 +152,9 @@ $height-check-icon: 24px;
|
|
|
152
152
|
z-index: -999;
|
|
153
153
|
|
|
154
154
|
@media #{$desktop} {
|
|
155
|
+
bottom: -10px;
|
|
155
156
|
height: 30px;
|
|
156
157
|
right: 50%;
|
|
157
|
-
bottom: -10px;
|
|
158
158
|
width: 1px;
|
|
159
159
|
}
|
|
160
160
|
@media #{$tablet-mobile} {
|
|
@@ -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
|
});
|
|
@@ -13,38 +12,38 @@ var _utils = require("./utils");
|
|
|
13
12
|
var _TimelineRow = _interopRequireDefault(require("./components/TimelineRow"));
|
|
14
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function _getRequireWildcardCache(
|
|
17
|
-
function _interopRequireWildcard(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
const ConsumptionIncluded = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
contextApiInfo,
|
|
20
|
+
billData
|
|
21
|
+
} = _ref;
|
|
22
|
+
const {
|
|
23
|
+
config
|
|
24
|
+
} = contextApiInfo;
|
|
25
|
+
const {
|
|
26
|
+
consumptionIncluded
|
|
27
|
+
} = config.texts;
|
|
28
|
+
const data = (0, _react.useMemo)(() => (0, _utils.dataMapper)(billData.periods, consumptionIncluded), [billData.periods, consumptionIncluded]);
|
|
29
|
+
const currentIsFirstSettlement = data.some(item => item.isCurrent && item.settlementNumber === 1);
|
|
30
|
+
const handleRenderTimelineRow = item => /*#__PURE__*/_react.default.createElement(_TimelineRow.default, {
|
|
31
|
+
cardTitle: item.cardTitle,
|
|
32
|
+
cardSubtitle: item.cardSubtitle,
|
|
33
|
+
cardDescription1: item.cardDescription1,
|
|
34
|
+
cardDescription2: item.cardDescription2,
|
|
35
|
+
contextApiInfo: contextApiInfo,
|
|
36
|
+
startDate: item.startDate,
|
|
37
|
+
endDate: item.endDate,
|
|
38
|
+
unit: item.unit,
|
|
39
|
+
value: item.value,
|
|
40
|
+
settlementNumber: item.settlementNumber,
|
|
41
|
+
date: item.date,
|
|
42
|
+
isConsumption: item.isConsumption,
|
|
43
|
+
isCurrent: item.isCurrent,
|
|
44
|
+
isRemaining: item.isRemaining,
|
|
45
|
+
currentIsFirstSettlement: currentIsFirstSettlement
|
|
28
46
|
});
|
|
29
|
-
var handleRenderTimelineRow = function handleRenderTimelineRow(item) {
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement(_TimelineRow.default, {
|
|
31
|
-
cardTitle: item.cardTitle,
|
|
32
|
-
cardSubtitle: item.cardSubtitle,
|
|
33
|
-
cardDescription1: item.cardDescription1,
|
|
34
|
-
cardDescription2: item.cardDescription2,
|
|
35
|
-
contextApiInfo: contextApiInfo,
|
|
36
|
-
startDate: item.startDate,
|
|
37
|
-
endDate: item.endDate,
|
|
38
|
-
unit: item.unit,
|
|
39
|
-
value: item.value,
|
|
40
|
-
settlementNumber: item.settlementNumber,
|
|
41
|
-
date: item.date,
|
|
42
|
-
isConsumption: item.isConsumption,
|
|
43
|
-
isCurrent: item.isCurrent,
|
|
44
|
-
isRemaining: item.isRemaining,
|
|
45
|
-
currentIsFirstSettlement: currentIsFirstSettlement
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
47
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
48
|
className: _stylesModule.default.titleContainer
|
|
50
49
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -55,5 +54,4 @@ ConsumptionIncluded.propTypes = {
|
|
|
55
54
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
56
55
|
billData: _billDataTypes.billDataTypes
|
|
57
56
|
};
|
|
58
|
-
var _default = (0, _WithContextApi.default)()(ConsumptionIncluded);
|
|
59
|
-
exports.default = _default;
|
|
57
|
+
var _default = exports.default = (0, _WithContextApi.default)()(ConsumptionIncluded);
|
|
@@ -10,52 +10,52 @@ var _consumptions = require("../../shared/utils/consumptions");
|
|
|
10
10
|
var _periodicities = require("../../shared/constants/periodicities");
|
|
11
11
|
var _consumptions2 = require("../../shared/constants/consumptions");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const getBimesterDateTitle = (_ref, text) => {
|
|
14
|
+
let {
|
|
15
|
+
year,
|
|
16
|
+
number,
|
|
17
|
+
settlements
|
|
18
|
+
} = _ref;
|
|
19
|
+
const isPeriodicity = (0, _string.stringToCompareWithoutAccentsInclusive)(settlements === null || settlements === void 0 ? void 0 : settlements.periodicity, _periodicities.PERIODICITY.BIMONTHLY);
|
|
18
20
|
if (!number || !year || !isPeriodicity) return '-';
|
|
19
21
|
return "".concat(text.bimester, " ").concat(number, " ").concat(text.of, " ").concat(year.substring(2));
|
|
20
22
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return item.current;
|
|
24
|
-
});
|
|
23
|
+
const getBimesterDate = (periods, text) => {
|
|
24
|
+
const currentPeriod = periods.find(item => item.current);
|
|
25
25
|
if (!currentPeriod) return '-';
|
|
26
26
|
return getBimesterDateTitle(currentPeriod, text);
|
|
27
27
|
};
|
|
28
28
|
exports.getBimesterDate = getBimesterDate;
|
|
29
|
-
|
|
29
|
+
const getTotalDaysDescriptionComsumption = (period, texts) => {
|
|
30
30
|
var _period$settlements;
|
|
31
|
-
|
|
31
|
+
const totalDays = period === null || period === void 0 || (_period$settlements = period.settlements) === null || _period$settlements === void 0 ? void 0 : _period$settlements.total_settlements_days;
|
|
32
32
|
return "".concat(totalDays, " ").concat(texts.days);
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
const getTotalDaysDescriptionSettlement = (period, texts, dataRetriver) => {
|
|
35
35
|
var _period$settlements2;
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const totalDays = period === null || period === void 0 || (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 ? void 0 : _period$settlements2.total_settlements_days;
|
|
37
|
+
const currentConsumptionDays = dataRetriver(period).days;
|
|
38
38
|
return currentConsumptionDays && totalDays ? "".concat(currentConsumptionDays, " ").concat(texts.of, " ").concat(totalDays, " ").concat(texts.days) : '-';
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const getConsumptionDescriptionSettlement = (period, texts) => {
|
|
41
|
+
const totalConsumption = (0, _consumptions.getTotalConsumption)(period, _consumptions2.ENERGY_TYPES.ACTIVE);
|
|
42
42
|
return totalConsumption.unit ? "".concat(texts.of, " ").concat(totalConsumption.value, " ").concat(totalConsumption.unit) : '-';
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
const getCardSubtitleSettlement = (period, text, dataRetriver) => {
|
|
45
45
|
var _period$settlements3;
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const currentSettlement = dataRetriver(period).number || 0;
|
|
47
|
+
const totalSettlements = (period === null || period === void 0 || (_period$settlements3 = period.settlements) === null || _period$settlements3 === void 0 ? void 0 : _period$settlements3.total_settlements) || 0;
|
|
48
48
|
return "".concat(text.settlement, " ").concat(currentSettlement, " ").concat(text.of, " ").concat(totalSettlements);
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
const getCurrent = period => {
|
|
51
51
|
var _period$settlements4;
|
|
52
52
|
return (period === null || period === void 0 || (_period$settlements4 = period.settlements) === null || _period$settlements4 === void 0 ? void 0 : _period$settlements4.current) || {};
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
const getRemaining = period => {
|
|
55
55
|
var _period$settlements5;
|
|
56
56
|
return (period === null || period === void 0 || (_period$settlements5 = period.settlements) === null || _period$settlements5 === void 0 || (_period$settlements5 = _period$settlements5.remaining) === null || _period$settlements5 === void 0 ? void 0 : _period$settlements5[0]) || {};
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
const consumptionMapper = (period, texts) => {
|
|
59
59
|
var _period$settlements6, _period$settlements7;
|
|
60
60
|
return {
|
|
61
61
|
startDate: period !== null && period !== void 0 && (_period$settlements6 = period.settlements) !== null && _period$settlements6 !== void 0 && _period$settlements6.start_date ? (0, _dayjs.default)(period.settlements.start_date).format('DD/MM/YYYY') : '-',
|
|
@@ -69,7 +69,7 @@ var consumptionMapper = function consumptionMapper(period, texts) {
|
|
|
69
69
|
order: 0
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
const settlementCurrentMapper = (period, texts) => {
|
|
73
73
|
var _period$settlements8, _period$settlements9, _period$settlements10;
|
|
74
74
|
return {
|
|
75
75
|
cardTitle: texts.billing,
|
|
@@ -84,7 +84,7 @@ var settlementCurrentMapper = function settlementCurrentMapper(period, texts) {
|
|
|
84
84
|
order: period === null || period === void 0 || (_period$settlements10 = period.settlements) === null || _period$settlements10 === void 0 || (_period$settlements10 = _period$settlements10.current) === null || _period$settlements10 === void 0 ? void 0 : _period$settlements10.number
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
const settlementRemainingMapper = (period, texts) => {
|
|
88
88
|
var _period$settlements11, _period$settlements12, _period$settlements13;
|
|
89
89
|
return {
|
|
90
90
|
cardTitle: texts.billing,
|
|
@@ -99,15 +99,11 @@ var settlementRemainingMapper = function settlementRemainingMapper(period, texts
|
|
|
99
99
|
order: period === null || period === void 0 || (_period$settlements13 = period.settlements) === null || _period$settlements13 === void 0 || (_period$settlements13 = _period$settlements13.remaining) === null || _period$settlements13 === void 0 || (_period$settlements13 = _period$settlements13[0]) === null || _period$settlements13 === void 0 ? void 0 : _period$settlements13.number
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return item.current;
|
|
107
|
-
});
|
|
102
|
+
const dataMapper = function () {
|
|
103
|
+
let periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
104
|
+
let texts = arguments.length > 1 ? arguments[1] : undefined;
|
|
105
|
+
const currentPeriod = periods.find(item => item.current);
|
|
108
106
|
if (!currentPeriod) return [];
|
|
109
|
-
return [consumptionMapper(currentPeriod, texts), settlementCurrentMapper(currentPeriod, texts), settlementRemainingMapper(currentPeriod, texts)].sort(
|
|
110
|
-
return a.order - b.order;
|
|
111
|
-
});
|
|
107
|
+
return [consumptionMapper(currentPeriod, texts), settlementCurrentMapper(currentPeriod, texts), settlementRemainingMapper(currentPeriod, texts)].sort((a, b) => a.order - b.order);
|
|
112
108
|
};
|
|
113
109
|
exports.dataMapper = dataMapper;
|
|
@@ -11,16 +11,20 @@ var _WithContextApi = _interopRequireDefault(require("../../../../../WithContext
|
|
|
11
11
|
var _Magnitude = _interopRequireDefault(require("../../../../../Magnitude"));
|
|
12
12
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
const ReadingRow = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
alias,
|
|
17
|
+
numberAlias,
|
|
18
|
+
unitAlias,
|
|
19
|
+
contextApiInfo,
|
|
20
|
+
text,
|
|
21
|
+
value,
|
|
22
|
+
unit,
|
|
23
|
+
disableUnit
|
|
24
|
+
} = _ref;
|
|
25
|
+
const {
|
|
26
|
+
Label
|
|
27
|
+
} = contextApiInfo;
|
|
24
28
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
29
|
className: _stylesModule.default.container
|
|
26
30
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
@@ -46,5 +50,4 @@ ReadingRow.propTypes = {
|
|
|
46
50
|
numberAlias: _propTypes.string,
|
|
47
51
|
unitAlias: _propTypes.string
|
|
48
52
|
};
|
|
49
|
-
var _default = (0, _WithContextApi.default)()(ReadingRow);
|
|
50
|
-
exports.default = _default;
|
|
53
|
+
var _default = exports.default = (0, _WithContextApi.default)()(ReadingRow);
|
|
@@ -13,26 +13,29 @@ var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"))
|
|
|
13
13
|
var _ReadingRow = _interopRequireDefault(require("./components/ReadingRow"));
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
classes =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
16
|
+
const ConsumptionSummary = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
contextApiInfo,
|
|
19
|
+
periodNumber,
|
|
20
|
+
year,
|
|
21
|
+
initialReadingDate,
|
|
22
|
+
finalReadingDate,
|
|
23
|
+
totalSettlementsDays,
|
|
24
|
+
initialReadingValue,
|
|
25
|
+
finalReadingValue,
|
|
26
|
+
totalConsumptionValue,
|
|
27
|
+
totalConsumptionUnit,
|
|
28
|
+
classes = {}
|
|
29
|
+
} = _ref;
|
|
30
|
+
const {
|
|
31
|
+
config,
|
|
32
|
+
Label
|
|
33
|
+
} = contextApiInfo;
|
|
34
|
+
const {
|
|
35
|
+
texts
|
|
36
|
+
} = config;
|
|
37
|
+
const formatDate = date => (0, _dayjs.default)(date).format('DD/MM/YYYY');
|
|
38
|
+
const daysLabel = totalSettlementsDays ? "(".concat(totalSettlementsDays, " ").concat(texts.consumptionPeriod.days, ")") : '';
|
|
36
39
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
40
|
className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
|
|
38
41
|
}, periodNumber && year && /*#__PURE__*/_react.default.createElement(Label, {
|
|
@@ -85,5 +88,4 @@ ConsumptionSummary.propTypes = {
|
|
|
85
88
|
container: _propTypes.string
|
|
86
89
|
})
|
|
87
90
|
};
|
|
88
|
-
var _default = (0, _WithContextApi.default)()(ConsumptionSummary);
|
|
89
|
-
exports.default = _default;
|
|
91
|
+
var _default = exports.default = (0, _WithContextApi.default)()(ConsumptionSummary);
|
|
@@ -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
|
});
|
|
@@ -15,34 +14,27 @@ var _deviceSizes = require("../../../../constants/deviceSizes");
|
|
|
15
14
|
var _BarChart = _interopRequireDefault(require("../../../BarChart"));
|
|
16
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
setIsDesktopSize = _useState2[1];
|
|
35
|
-
var handleResizeScreen = function handleResizeScreen() {
|
|
36
|
-
return setIsDesktopSize((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint));
|
|
37
|
-
};
|
|
38
|
-
(0, _react.useEffect)(function () {
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && 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; }
|
|
19
|
+
const HistoryGraph = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
billData,
|
|
22
|
+
contextApiInfo
|
|
23
|
+
} = _ref;
|
|
24
|
+
const {
|
|
25
|
+
config
|
|
26
|
+
} = contextApiInfo;
|
|
27
|
+
const {
|
|
28
|
+
showPeriodsInChronologicalOrder
|
|
29
|
+
} = config;
|
|
30
|
+
const [isDesktopSize, setIsDesktopSize] = (0, _react.useState)((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint));
|
|
31
|
+
const handleResizeScreen = () => setIsDesktopSize((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint));
|
|
32
|
+
(0, _react.useEffect)(() => {
|
|
39
33
|
window.addEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
40
34
|
handleResizeScreen();
|
|
41
|
-
return
|
|
42
|
-
return window.removeEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
43
|
-
};
|
|
35
|
+
return () => window.removeEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
44
36
|
}, []);
|
|
45
|
-
|
|
37
|
+
const consumptionHistoryData = (0, _consumptions.getConsumptionHistoryData)(billData, _consumptions2.ENERGY_TYPES.ACTIVE, showPeriodsInChronologicalOrder);
|
|
46
38
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
47
39
|
className: _stylesModule.default.container
|
|
48
40
|
}, /*#__PURE__*/_react.default.createElement(_BarChart.default, {
|
|
@@ -55,5 +47,4 @@ HistoryGraph.propTypes = {
|
|
|
55
47
|
billData: _billDataTypes.billDataTypes,
|
|
56
48
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes
|
|
57
49
|
};
|
|
58
|
-
var _default = HistoryGraph;
|
|
59
|
-
exports.default = _default;
|
|
50
|
+
var _default = exports.default = HistoryGraph;
|
|
@@ -15,38 +15,41 @@ var _IconAndDetails = _interopRequireDefault(require("../../../IconAndDetails"))
|
|
|
15
15
|
var _aliases = require("../../../../shared/constants/aliases");
|
|
16
16
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
classes =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
const Reading = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
contextApiInfo,
|
|
21
|
+
title,
|
|
22
|
+
date,
|
|
23
|
+
readingType,
|
|
24
|
+
readingValue,
|
|
25
|
+
tooltip,
|
|
26
|
+
classes = {}
|
|
27
|
+
} = _ref;
|
|
28
|
+
const {
|
|
29
|
+
assets,
|
|
30
|
+
config,
|
|
31
|
+
Label,
|
|
32
|
+
Tooltip
|
|
33
|
+
} = contextApiInfo;
|
|
34
|
+
const {
|
|
35
|
+
texts,
|
|
36
|
+
colors
|
|
37
|
+
} = config;
|
|
38
|
+
const {
|
|
39
|
+
InfoIcon,
|
|
40
|
+
ReadingDateIcon,
|
|
41
|
+
ReadingTypeIcon,
|
|
42
|
+
EnergyIcon
|
|
43
|
+
} = assets;
|
|
44
|
+
const TitleLabel = () => /*#__PURE__*/_react.default.createElement(Label, {
|
|
45
|
+
alias: _aliases.READING_TITLE,
|
|
46
|
+
className: "".concat(!tooltip && _stylesModule.default.title)
|
|
47
|
+
}, title);
|
|
48
|
+
const EnergyIconStyled = () => /*#__PURE__*/_react.default.createElement(EnergyIcon, {
|
|
49
|
+
style: {
|
|
50
|
+
fill: colors.primary
|
|
51
|
+
}
|
|
52
|
+
});
|
|
50
53
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
51
54
|
className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
|
|
52
55
|
}, tooltip ? /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -101,5 +104,4 @@ Reading.propTypes = {
|
|
|
101
104
|
}),
|
|
102
105
|
tooltip: _propTypes.bool
|
|
103
106
|
};
|
|
104
|
-
var _default = (0, _WithContextApi.default)()(Reading);
|
|
105
|
-
exports.default = _default;
|
|
107
|
+
var _default = exports.default = (0, _WithContextApi.default)()(Reading);
|
|
@@ -18,15 +18,19 @@ var _utils = require("./utils");
|
|
|
18
18
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
-
|
|
21
|
+
const ConsumptionPeriod = _ref => {
|
|
22
22
|
var _currentPeriod$settle, _currentPeriod$settle2;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
let {
|
|
24
|
+
contextApiInfo,
|
|
25
|
+
billData
|
|
26
|
+
} = _ref;
|
|
27
|
+
const {
|
|
28
|
+
texts
|
|
29
|
+
} = contextApiInfo.config;
|
|
30
|
+
const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
|
|
31
|
+
const initialReading = (0, _readings.getReadingPeriod)(billData, _readings2.READING_MOMENTS.INITIAL);
|
|
32
|
+
const finalReading = (0, _readings.getReadingPeriod)(billData, _readings2.READING_MOMENTS.FINAL);
|
|
33
|
+
const consumptionSummaryProps = (0, _utils.getConsumptionSummaryProps)(currentPeriod, initialReading, finalReading);
|
|
30
34
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
35
|
className: _stylesModule.default.container
|
|
32
36
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -65,5 +69,4 @@ ConsumptionPeriod.propTypes = {
|
|
|
65
69
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
66
70
|
billData: _billDataTypes.billDataTypes
|
|
67
71
|
};
|
|
68
|
-
var _default = (0, _WithContextApi.default)()(ConsumptionPeriod);
|
|
69
|
-
exports.default = _default;
|
|
72
|
+
var _default = exports.default = (0, _WithContextApi.default)()(ConsumptionPeriod);
|
|
@@ -8,19 +8,17 @@ var _seamlessImmutable = require("seamless-immutable");
|
|
|
8
8
|
var _consumptions = require("../../shared/utils/consumptions");
|
|
9
9
|
var _readings = require("../../shared/utils/readings");
|
|
10
10
|
var _consumptions2 = require("../../shared/constants/consumptions");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
};
|
|
11
|
+
const getConsumptionSummaryProps = (currentPeriod, initialReading, finalReading) => ({
|
|
12
|
+
periodNumber: currentPeriod.number,
|
|
13
|
+
year: currentPeriod.year,
|
|
14
|
+
initialReadingDate: initialReading.date,
|
|
15
|
+
finalReadingDate: finalReading.date,
|
|
16
|
+
totalSettlementsDays: (0, _seamlessImmutable.getIn)(currentPeriod, ['settlements', 'total_settlements_days']),
|
|
17
|
+
initialReadingValue: (0, _readings.getActiveEnergyRecord)(initialReading).value,
|
|
18
|
+
initialReadingUnit: (0, _readings.getActiveEnergyRecord)(initialReading).unit,
|
|
19
|
+
finalReadingValue: (0, _readings.getActiveEnergyRecord)(finalReading).value,
|
|
20
|
+
finalReadingUnit: (0, _readings.getActiveEnergyRecord)(finalReading).unit,
|
|
21
|
+
totalConsumptionValue: (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.ENERGY_TYPES.ACTIVE).value,
|
|
22
|
+
totalConsumptionUnit: (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.ENERGY_TYPES.ACTIVE).unit
|
|
23
|
+
});
|
|
26
24
|
exports.getConsumptionSummaryProps = getConsumptionSummaryProps;
|
|
@@ -11,15 +11,18 @@ var _smartBillTypes = require("../../shared/types/smartBillTypes");
|
|
|
11
11
|
var _WithContextApi = _interopRequireDefault(require("../WithContextApi"));
|
|
12
12
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
classes =
|
|
20
|
-
mainAlias
|
|
21
|
-
detailAlias
|
|
22
|
-
|
|
14
|
+
const Date = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
contextApiInfo,
|
|
17
|
+
date,
|
|
18
|
+
text,
|
|
19
|
+
classes = {},
|
|
20
|
+
mainAlias,
|
|
21
|
+
detailAlias
|
|
22
|
+
} = _ref;
|
|
23
|
+
const {
|
|
24
|
+
Label
|
|
25
|
+
} = contextApiInfo;
|
|
23
26
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
24
27
|
className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
|
|
25
28
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
@@ -40,5 +43,4 @@ Date.propTypes = {
|
|
|
40
43
|
value: _propTypes.string
|
|
41
44
|
})
|
|
42
45
|
};
|
|
43
|
-
var _default = (0, _WithContextApi.default)()(Date);
|
|
44
|
-
exports.default = _default;
|
|
46
|
+
var _default = exports.default = (0, _WithContextApi.default)()(Date);
|
|
@@ -11,14 +11,20 @@ var _WithContextApi = _interopRequireDefault(require("../WithContextApi"));
|
|
|
11
11
|
var _aliases = require("../../shared/constants/aliases");
|
|
12
12
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const DebtState = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
contextApiInfo,
|
|
17
|
+
debtStatusLabel,
|
|
18
|
+
isWarning
|
|
19
|
+
} = _ref;
|
|
20
|
+
const {
|
|
21
|
+
assets,
|
|
22
|
+
Label
|
|
23
|
+
} = contextApiInfo;
|
|
24
|
+
const {
|
|
25
|
+
PendingDebtIcon,
|
|
26
|
+
AdheredToServiceIcon
|
|
27
|
+
} = assets;
|
|
22
28
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
23
29
|
className: "".concat(_stylesModule.default.container, " ").concat(isWarning ? _stylesModule.default.withDebtsContainer : _stylesModule.default.adheredToAutomaticDebt, " ")
|
|
24
30
|
}, isWarning ? /*#__PURE__*/_react.default.createElement(PendingDebtIcon, null) : /*#__PURE__*/_react.default.createElement(AdheredToServiceIcon, null), /*#__PURE__*/_react.default.createElement(Label, {
|
|
@@ -32,5 +38,4 @@ DebtState.propTypes = {
|
|
|
32
38
|
isWarning: _propTypes.bool,
|
|
33
39
|
debtStatusLabel: _propTypes.string
|
|
34
40
|
};
|
|
35
|
-
var _default = (0, _WithContextApi.default)()(DebtState);
|
|
36
|
-
exports.default = _default;
|
|
41
|
+
var _default = exports.default = (0, _WithContextApi.default)()(DebtState);
|