@widergy/utilitygo-smart-bill-web 1.10.0 → 1.10.1
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 +7 -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/Bars/components/Stage/components/LimitsLine/index.js +7 -5
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/index.js +12 -18
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/utils.js +3 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/index.js +18 -18
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/index.js +19 -19
- 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 +12 -15
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +37 -35
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/index.js +23 -26
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +18 -18
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +32 -12
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +20 -12
- package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +50 -32
- 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 +3 -3
- 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 +58 -19
- package/dist/utils.js +8 -4
- package/package.json +1 -2
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/utils.js +0 -27
|
@@ -10,4 +10,5 @@ exports.TOUCHABLE = 'Components::Touchable';
|
|
|
10
10
|
exports.CARD = 'Components::Card';
|
|
11
11
|
exports.MARKDOWN = 'Components::Markdown';
|
|
12
12
|
exports.TOGGLE = 'Components::Toggle';
|
|
13
|
-
exports.BAR_CHART = 'Components::BarChart';
|
|
13
|
+
exports.BAR_CHART = 'Components::BarChart';
|
|
14
|
+
exports.PIE_CHART = 'Components::PieChart';
|
|
@@ -4,23 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.POWER_TYPES = exports.POWER_FACTORS = exports.ENERGY_TYPES = exports.CONSUMPTION_TYPES = void 0;
|
|
7
|
-
|
|
7
|
+
var CONSUMPTION_TYPES = {
|
|
8
8
|
TOTAL: 'total',
|
|
9
9
|
DAILY: 'diario'
|
|
10
10
|
};
|
|
11
11
|
exports.CONSUMPTION_TYPES = CONSUMPTION_TYPES;
|
|
12
|
-
|
|
12
|
+
var ENERGY_TYPES = {
|
|
13
13
|
ACTIVE: 'Energía activa',
|
|
14
14
|
REACTIVE: 'Energía reactiva'
|
|
15
15
|
};
|
|
16
16
|
exports.ENERGY_TYPES = ENERGY_TYPES;
|
|
17
|
-
|
|
17
|
+
var POWER_TYPES = {
|
|
18
18
|
REGISTERED: 'Potencia registrada',
|
|
19
19
|
PURCHASED: 'Potencia convenida',
|
|
20
20
|
EXCEEDED: 'Potencia excedida'
|
|
21
21
|
};
|
|
22
22
|
exports.POWER_TYPES = POWER_TYPES;
|
|
23
|
-
|
|
23
|
+
var POWER_FACTORS = {
|
|
24
24
|
COSINE_PHI: 'Coseno fi',
|
|
25
25
|
TANGENT_PHI: 'Tangente fi'
|
|
26
26
|
};
|
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.READING_TYPES = exports.READING_MOMENTS = void 0;
|
|
7
|
-
|
|
7
|
+
var READING_TYPES = {
|
|
8
8
|
FACE_TO_FACE: 'Real',
|
|
9
9
|
ESTIMATED: 'Est',
|
|
10
10
|
TELEMEDITION: 'Telemedición'
|
|
11
11
|
};
|
|
12
12
|
exports.READING_TYPES = READING_TYPES;
|
|
13
|
-
|
|
13
|
+
var READING_MOMENTS = {
|
|
14
14
|
INITIAL: 'inicio',
|
|
15
15
|
FINAL: 'fin'
|
|
16
16
|
};
|
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SEASON_PERIODS = exports.SEASONS = void 0;
|
|
7
|
-
|
|
7
|
+
var SEASONS = {
|
|
8
8
|
SPRING: 'spring',
|
|
9
9
|
SUMMER: 'summer',
|
|
10
10
|
AUTUMN: 'autumn',
|
|
11
11
|
WINTER: 'winter'
|
|
12
12
|
};
|
|
13
13
|
exports.SEASONS = SEASONS;
|
|
14
|
-
|
|
14
|
+
var SEASON_PERIODS = [{
|
|
15
15
|
initMonth: 1,
|
|
16
16
|
endingMonth: 2,
|
|
17
17
|
season: SEASONS.SUMMER
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MIN_VALUE = exports.MAX_VALUE = exports.INFINITE = exports.DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH = void 0;
|
|
7
|
-
|
|
7
|
+
var INFINITE = null;
|
|
8
8
|
exports.INFINITE = INFINITE;
|
|
9
|
-
|
|
9
|
+
var MAX_VALUE = 1;
|
|
10
10
|
exports.MAX_VALUE = MAX_VALUE;
|
|
11
|
-
|
|
11
|
+
var MIN_VALUE = 0;
|
|
12
12
|
exports.MIN_VALUE = MIN_VALUE;
|
|
13
|
-
|
|
13
|
+
var DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH = 200;
|
|
14
14
|
exports.DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH = DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH;
|
|
@@ -9,5 +9,5 @@ var _propTypes = require("prop-types");
|
|
|
9
9
|
|
|
10
10
|
var _componentsTypes = require("./componentsTypes");
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
var assetsTypes = (0, _propTypes.objectOf)(_componentsTypes.componentTypes);
|
|
13
13
|
exports.assetsTypes = assetsTypes;
|
|
@@ -7,14 +7,14 @@ exports.settlementsTypes = exports.periodTypes = exports.consumptionTypes = expo
|
|
|
7
7
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var consumptionTypes = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
11
11
|
magnitude: _propTypes.string,
|
|
12
12
|
type: _propTypes.string,
|
|
13
13
|
unit: _propTypes.string,
|
|
14
14
|
value: _propTypes.number
|
|
15
15
|
}));
|
|
16
16
|
exports.consumptionTypes = consumptionTypes;
|
|
17
|
-
|
|
17
|
+
var settlementsTypes = (0, _propTypes.shape)({
|
|
18
18
|
periodicity: _propTypes.string,
|
|
19
19
|
total_settlements: _propTypes.number,
|
|
20
20
|
total_settlements_days: _propTypes.number,
|
|
@@ -41,7 +41,7 @@ const settlementsTypes = (0, _propTypes.shape)({
|
|
|
41
41
|
}))
|
|
42
42
|
});
|
|
43
43
|
exports.settlementsTypes = settlementsTypes;
|
|
44
|
-
|
|
44
|
+
var periodTypes = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
45
45
|
current: _propTypes.bool,
|
|
46
46
|
number: _propTypes.string,
|
|
47
47
|
year: _propTypes.string,
|
|
@@ -49,7 +49,7 @@ const periodTypes = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
|
49
49
|
consumptions: consumptionTypes
|
|
50
50
|
}));
|
|
51
51
|
exports.periodTypes = periodTypes;
|
|
52
|
-
|
|
52
|
+
var billDataTypes = (0, _propTypes.shape)({
|
|
53
53
|
bill_type: _propTypes.string,
|
|
54
54
|
bill_number: _propTypes.string,
|
|
55
55
|
pending_debt: _propTypes.bool,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -9,27 +11,19 @@ var _propTypes = require("prop-types");
|
|
|
9
11
|
|
|
10
12
|
var COMPONENTS = _interopRequireWildcard(require("../constants/components"));
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
var _shape;
|
|
15
|
+
|
|
16
|
+
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); }
|
|
13
17
|
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
18
|
+
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; }
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
var componentTypes = (0, _propTypes.oneOfType)([_propTypes.element, _propTypes.node, _propTypes.func, _propTypes.any]);
|
|
17
23
|
exports.componentTypes = componentTypes;
|
|
18
|
-
|
|
19
|
-
[COMPONENTS.BUTTON]: componentTypes,
|
|
20
|
-
[COMPONENTS.DIALOG]: componentTypes,
|
|
21
|
-
[COMPONENTS.EXTERNAL_LINK]: componentTypes,
|
|
22
|
-
[COMPONENTS.LABEL]: componentTypes,
|
|
23
|
-
[COMPONENTS.PROGRESS_BAR]: componentTypes,
|
|
24
|
-
[COMPONENTS.TOOLTIP]: componentTypes,
|
|
25
|
-
[COMPONENTS.TOUCHABLE]: componentTypes,
|
|
26
|
-
[COMPONENTS.CARD]: componentTypes,
|
|
27
|
-
[COMPONENTS.MARKDOWN]: componentTypes,
|
|
28
|
-
[COMPONENTS.TOGGLE]: componentTypes,
|
|
29
|
-
[COMPONENTS.BAR_CHART]: componentTypes
|
|
30
|
-
});
|
|
24
|
+
var componentsTypes = (0, _propTypes.shape)((_shape = {}, _defineProperty(_shape, COMPONENTS.BUTTON, componentTypes), _defineProperty(_shape, COMPONENTS.DIALOG, componentTypes), _defineProperty(_shape, COMPONENTS.EXTERNAL_LINK, componentTypes), _defineProperty(_shape, COMPONENTS.LABEL, componentTypes), _defineProperty(_shape, COMPONENTS.PROGRESS_BAR, componentTypes), _defineProperty(_shape, COMPONENTS.TOOLTIP, componentTypes), _defineProperty(_shape, COMPONENTS.TOUCHABLE, componentTypes), _defineProperty(_shape, COMPONENTS.CARD, componentTypes), _defineProperty(_shape, COMPONENTS.MARKDOWN, componentTypes), _defineProperty(_shape, COMPONENTS.TOGGLE, componentTypes), _defineProperty(_shape, COMPONENTS.BAR_CHART, componentTypes), _shape));
|
|
31
25
|
exports.componentsTypes = componentsTypes;
|
|
32
|
-
|
|
26
|
+
var unpackedComponentsTypes = {
|
|
33
27
|
Button: componentTypes,
|
|
34
28
|
Dialog: componentTypes,
|
|
35
29
|
Label: componentTypes,
|
|
@@ -39,6 +33,7 @@ const unpackedComponentsTypes = {
|
|
|
39
33
|
Card: componentTypes,
|
|
40
34
|
Markdown: componentTypes,
|
|
41
35
|
Toggle: componentTypes,
|
|
42
|
-
BarChart: componentTypes
|
|
36
|
+
BarChart: componentTypes,
|
|
37
|
+
PieChart: componentTypes
|
|
43
38
|
};
|
|
44
39
|
exports.unpackedComponentsTypes = unpackedComponentsTypes;
|
|
@@ -7,7 +7,7 @@ exports.formattersTypes = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var formattersTypes = (0, _propTypes.shape)({
|
|
11
11
|
billNumberFormatter: _propTypes.func,
|
|
12
12
|
clientNumberFormatter: _propTypes.func
|
|
13
13
|
});
|
|
@@ -7,19 +7,19 @@ exports.subStageType = exports.stageType = exports.rateStagesTypes = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var subStageType = (0, _propTypes.shape)({
|
|
11
11
|
category: _propTypes.number,
|
|
12
12
|
name: _propTypes.string,
|
|
13
13
|
color: _propTypes.string,
|
|
14
14
|
range: (0, _propTypes.arrayOf)(_propTypes.number)
|
|
15
15
|
});
|
|
16
16
|
exports.subStageType = subStageType;
|
|
17
|
-
|
|
17
|
+
var stageType = (0, _propTypes.shape)({
|
|
18
18
|
group: _propTypes.number,
|
|
19
19
|
range: (0, _propTypes.arrayOf)(_propTypes.number),
|
|
20
20
|
unit: _propTypes.string,
|
|
21
21
|
sub_rate_stages: (0, _propTypes.arrayOf)(subStageType)
|
|
22
22
|
});
|
|
23
23
|
exports.stageType = stageType;
|
|
24
|
-
|
|
24
|
+
var rateStagesTypes = (0, _propTypes.arrayOf)(stageType);
|
|
25
25
|
exports.rateStagesTypes = rateStagesTypes;
|
|
@@ -15,15 +15,20 @@ var _formattersTypes = require("./formattersTypes");
|
|
|
15
15
|
|
|
16
16
|
var _componentsTypes = require("./componentsTypes");
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var configTypes = (0, _propTypes.shape)({
|
|
19
25
|
texts: _textsTypes.textsTypes,
|
|
20
26
|
formatters: _formattersTypes.formattersTypes
|
|
21
27
|
});
|
|
22
|
-
|
|
28
|
+
var contextApiInfoTypes = (0, _propTypes.shape)(_objectSpread({
|
|
23
29
|
assets: _assetsTypes.assetsTypes,
|
|
24
30
|
components: _componentsTypes.componentsTypes,
|
|
25
31
|
config: configTypes,
|
|
26
|
-
theme: _propTypes.any
|
|
27
|
-
|
|
28
|
-
});
|
|
32
|
+
theme: _propTypes.any
|
|
33
|
+
}, _componentsTypes.unpackedComponentsTypes));
|
|
29
34
|
exports.contextApiInfoTypes = contextApiInfoTypes;
|
|
@@ -11,20 +11,20 @@ var _periodicities = require("../constants/periodicities");
|
|
|
11
11
|
|
|
12
12
|
var _periods = require("./periods");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
var titleMapper = function titleMapper(billData, texts) {
|
|
15
15
|
var _currentPeriod$settle, _currentPeriod$settle2, _currentPeriod$settle3, _currentPeriod$settle4;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
var currentPeriod = (0, _periods.getCurrentPeriod)(billData);
|
|
18
|
+
var periodicity = currentPeriod === null || currentPeriod === void 0 ? void 0 : (_currentPeriod$settle = currentPeriod.settlements) === null || _currentPeriod$settle === void 0 ? void 0 : _currentPeriod$settle.periodicity;
|
|
19
|
+
var currentSettlement = (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.number) || '-';
|
|
20
|
+
var totalSettlements = (currentPeriod === null || currentPeriod === void 0 ? void 0 : (_currentPeriod$settle4 = currentPeriod.settlements) === null || _currentPeriod$settle4 === void 0 ? void 0 : _currentPeriod$settle4.total_settlements) || '-';
|
|
21
|
+
var periodYear = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.year) || '-';
|
|
22
22
|
return {
|
|
23
23
|
periodicity: (0, _string.stringToCompareWithoutAccentsInclusive)(periodicity, _periodicities.PERIODICITY.BIMONTHLY) ? texts.commons.bimester : '-',
|
|
24
|
-
currentSettlement,
|
|
25
|
-
totalSettlements,
|
|
24
|
+
currentSettlement: currentSettlement,
|
|
25
|
+
totalSettlements: totalSettlements,
|
|
26
26
|
periodNumber: (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.number) || '-',
|
|
27
|
-
periodYear
|
|
27
|
+
periodYear: periodYear
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -17,56 +17,84 @@ var _periods = require("./periods");
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
|
+
|
|
22
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
|
+
|
|
24
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
+
|
|
26
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
27
|
+
|
|
28
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
29
|
+
|
|
30
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
31
|
+
|
|
32
|
+
var getCurrentConsumption = function getCurrentConsumption(period, energyType) {
|
|
21
33
|
var _period$settlements, _period$settlements$c, _period$settlements$c2;
|
|
22
34
|
|
|
23
|
-
return (period === null || period === void 0 ? void 0 : (_period$settlements = period.settlements) === null || _period$settlements === void 0 ? void 0 : (_period$settlements$c = _period$settlements.current) === null || _period$settlements$c === void 0 ? void 0 : (_period$settlements$c2 = _period$settlements$c.consumptions) === null || _period$settlements$c2 === void 0 ? void 0 : _period$settlements$c2.find(
|
|
35
|
+
return (period === null || period === void 0 ? void 0 : (_period$settlements = period.settlements) === null || _period$settlements === void 0 ? void 0 : (_period$settlements$c = _period$settlements.current) === null || _period$settlements$c === void 0 ? void 0 : (_period$settlements$c2 = _period$settlements$c.consumptions) === null || _period$settlements$c2 === void 0 ? void 0 : _period$settlements$c2.find(function (consumption) {
|
|
36
|
+
return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType);
|
|
37
|
+
})) || {};
|
|
24
38
|
};
|
|
25
39
|
|
|
26
40
|
exports.getCurrentConsumption = getCurrentConsumption;
|
|
27
41
|
|
|
28
|
-
|
|
42
|
+
var getRemainingConsumption = function getRemainingConsumption(period, energyType) {
|
|
29
43
|
var _period$settlements2, _period$settlements2$, _period$settlements2$2;
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
return remaining.find(
|
|
45
|
+
var remaining = (period === null || period === void 0 ? void 0 : (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 ? void 0 : (_period$settlements2$ = _period$settlements2.remaining) === null || _period$settlements2$ === void 0 ? void 0 : (_period$settlements2$2 = _period$settlements2$[0]) === null || _period$settlements2$2 === void 0 ? void 0 : _period$settlements2$2.consumptions) || [];
|
|
46
|
+
return remaining.find(function (item) {
|
|
47
|
+
return (0, _string.stringToCompareWithoutAccentsInclusive)(item.magnitude, energyType);
|
|
48
|
+
}) || {};
|
|
33
49
|
};
|
|
34
50
|
|
|
35
51
|
exports.getRemainingConsumption = getRemainingConsumption;
|
|
36
52
|
|
|
37
|
-
|
|
53
|
+
var getTotalConsumption = function getTotalConsumption(period, energyOrPowerType) {
|
|
38
54
|
var _period$consumptions;
|
|
39
55
|
|
|
40
|
-
return (period === null || period === void 0 ? void 0 : (_period$consumptions = period.consumptions) === null || _period$consumptions === void 0 ? void 0 : _period$consumptions.find(
|
|
56
|
+
return (period === null || period === void 0 ? void 0 : (_period$consumptions = period.consumptions) === null || _period$consumptions === void 0 ? void 0 : _period$consumptions.find(function (consumption) {
|
|
57
|
+
return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.TOTAL) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyOrPowerType);
|
|
58
|
+
})) || {};
|
|
41
59
|
};
|
|
42
60
|
|
|
43
61
|
exports.getTotalConsumption = getTotalConsumption;
|
|
44
62
|
|
|
45
|
-
|
|
63
|
+
var getDailyConsumption = function getDailyConsumption(period, energyType) {
|
|
46
64
|
var _period$consumptions2;
|
|
47
65
|
|
|
48
|
-
return (period === null || period === void 0 ? void 0 : (_period$consumptions2 = period.consumptions) === null || _period$consumptions2 === void 0 ? void 0 : _period$consumptions2.find(
|
|
66
|
+
return (period === null || period === void 0 ? void 0 : (_period$consumptions2 = period.consumptions) === null || _period$consumptions2 === void 0 ? void 0 : _period$consumptions2.find(function (consumption) {
|
|
67
|
+
return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.DAILY) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType);
|
|
68
|
+
})) || {};
|
|
49
69
|
};
|
|
50
70
|
|
|
51
71
|
exports.getDailyConsumption = getDailyConsumption;
|
|
52
72
|
|
|
53
|
-
|
|
73
|
+
var formatPeriod = function formatPeriod(period) {
|
|
74
|
+
return period.number && period.year && "".concat(period.number, "/").concat((0, _dayjs.default)(period.year, 'YYYY').format('YY'));
|
|
75
|
+
};
|
|
54
76
|
|
|
55
|
-
|
|
77
|
+
var getConsumptionHistoryData = function getConsumptionHistoryData(billDataParameter, energyType, showPeriodsInChronologicalOrder) {
|
|
56
78
|
var _billData$periods;
|
|
57
79
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}))
|
|
80
|
+
var billData = _lodash.default.cloneDeep(billDataParameter);
|
|
81
|
+
|
|
82
|
+
var currentPeriod = (0, _periods.getCurrentPeriod)(billData);
|
|
83
|
+
var lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
|
|
84
|
+
var otherPeriods = billData === null || billData === void 0 ? void 0 : (_billData$periods = billData.periods) === null || _billData$periods === void 0 ? void 0 : _billData$periods.filter(function (period) {
|
|
85
|
+
return !(0, _periods.areSamePeriods)(period, currentPeriod) && !(0, _periods.areSamePeriods)(period, lastYearPeriod) && period.consumptions;
|
|
86
|
+
}).sort(_periods.comparePeriods);
|
|
87
|
+
var periods = [].concat(_toConsumableArray(lastYearPeriod.consumptions && showPeriodsInChronologicalOrder ? [lastYearPeriod] : []), _toConsumableArray(otherPeriods), _toConsumableArray(currentPeriod.consumptions ? [currentPeriod] : []), _toConsumableArray(lastYearPeriod.consumptions && !showPeriodsInChronologicalOrder ? [lastYearPeriod] : [])).filter(function (period) {
|
|
88
|
+
return getTotalConsumption(period, energyType).value === 0 || getTotalConsumption(period, energyType).value;
|
|
89
|
+
}).map(function (period) {
|
|
90
|
+
return {
|
|
91
|
+
period: formatPeriod(period),
|
|
92
|
+
consumption: getTotalConsumption(period, energyType).value,
|
|
93
|
+
unit: getTotalConsumption(period, energyType).unit
|
|
94
|
+
};
|
|
95
|
+
});
|
|
68
96
|
return {
|
|
69
|
-
periods,
|
|
97
|
+
periods: periods,
|
|
70
98
|
currentPeriod: formatPeriod(currentPeriod),
|
|
71
99
|
lastYearPeriod: formatPeriod(lastYearPeriod),
|
|
72
100
|
unit: getTotalConsumption(currentPeriod, energyType).unit
|
|
@@ -75,13 +103,19 @@ const getConsumptionHistoryData = (billDataParameter, energyType, showPeriodsInC
|
|
|
75
103
|
|
|
76
104
|
exports.getConsumptionHistoryData = getConsumptionHistoryData;
|
|
77
105
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
var consumptionDataMapper = function consumptionDataMapper() {
|
|
107
|
+
var periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
108
|
+
var texts = arguments.length > 1 ? arguments[1] : undefined;
|
|
109
|
+
var dataMappers = arguments.length > 2 ? arguments[2] : undefined;
|
|
110
|
+
var currentPeriod = periods.find(function (item) {
|
|
111
|
+
return item.current;
|
|
112
|
+
});
|
|
83
113
|
if (!currentPeriod) return [];
|
|
84
|
-
return dataMappers.map(
|
|
114
|
+
return dataMappers.map(function (dataMapper) {
|
|
115
|
+
return dataMapper(currentPeriod, texts);
|
|
116
|
+
}).sort(function (a, b) {
|
|
117
|
+
return a.order - b.order;
|
|
118
|
+
});
|
|
85
119
|
};
|
|
86
120
|
|
|
87
121
|
exports.consumptionDataMapper = consumptionDataMapper;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -7,14 +9,12 @@ exports.unpackComponents = void 0;
|
|
|
7
9
|
|
|
8
10
|
var COMPONENTS = _interopRequireWildcard(require("../constants/components"));
|
|
9
11
|
|
|
10
|
-
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); }
|
|
12
|
+
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); }
|
|
11
13
|
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
14
|
+
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; }
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
components
|
|
17
|
-
} = contextApiInfo;
|
|
16
|
+
var unpackComponents = function unpackComponents(contextApiInfo) {
|
|
17
|
+
var components = contextApiInfo.components;
|
|
18
18
|
return {
|
|
19
19
|
Button: components[COMPONENTS.BUTTON],
|
|
20
20
|
Dialog: components[COMPONENTS.DIALOG],
|
|
@@ -26,7 +26,8 @@ const unpackComponents = contextApiInfo => {
|
|
|
26
26
|
Card: components[COMPONENTS.CARD],
|
|
27
27
|
Markdown: components[COMPONENTS.MARKDOWN],
|
|
28
28
|
Toggle: components[COMPONENTS.TOGGLE],
|
|
29
|
-
BarChart: components[COMPONENTS.BAR_CHART]
|
|
29
|
+
BarChart: components[COMPONENTS.BAR_CHART],
|
|
30
|
+
PieChart: components[COMPONENTS.PIE_CHART]
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -7,6 +7,10 @@ exports.getExpiration = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _seamlessImmutable = require("seamless-immutable");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var getExpiration = function getExpiration(billData, number) {
|
|
11
|
+
return (0, _seamlessImmutable.getIn)(billData, ['expirations'], []).find(function (expiration) {
|
|
12
|
+
return expiration.number === number;
|
|
13
|
+
}) || {};
|
|
14
|
+
};
|
|
11
15
|
|
|
12
16
|
exports.getExpiration = getExpiration;
|
|
@@ -7,21 +7,27 @@ exports.getSavingsPercentage = exports.getLastYearPeriod = exports.getCurrentPer
|
|
|
7
7
|
|
|
8
8
|
var _seamlessImmutable = require("seamless-immutable");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var getCurrentPeriod = function getCurrentPeriod(billData) {
|
|
11
|
+
return (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(function (period) {
|
|
12
|
+
return period.current;
|
|
13
|
+
}) || {};
|
|
14
|
+
};
|
|
11
15
|
|
|
12
16
|
exports.getCurrentPeriod = getCurrentPeriod;
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(
|
|
18
|
+
var getLastYearPeriod = function getLastYearPeriod(billData) {
|
|
19
|
+
var currentPeriod = getCurrentPeriod(billData);
|
|
20
|
+
var lastYear = "".concat(parseInt(currentPeriod.year, 10) - 1);
|
|
21
|
+
return (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(function (period) {
|
|
22
|
+
return period.number === currentPeriod.number && period.year === lastYear;
|
|
23
|
+
}) || {};
|
|
18
24
|
};
|
|
19
25
|
|
|
20
26
|
exports.getLastYearPeriod = getLastYearPeriod;
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
var areSamePeriods = function areSamePeriods() {
|
|
29
|
+
var period1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
30
|
+
var period2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
31
|
|
|
26
32
|
if (period1.number && period1.year && period2.number && period2.year) {
|
|
27
33
|
return period1.number === period2.number && period1.year === period2.year;
|
|
@@ -32,12 +38,12 @@ const areSamePeriods = function () {
|
|
|
32
38
|
|
|
33
39
|
exports.areSamePeriods = areSamePeriods;
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
var comparePeriods = function comparePeriods(period1, period2) {
|
|
36
42
|
if (period1 && period1.number && period1.year && period2 && period2.number && period2.year) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
var number1 = parseInt(period1.number, 10);
|
|
44
|
+
var number2 = parseInt(period2.number, 10);
|
|
45
|
+
var year1 = parseInt(period1.year, 10);
|
|
46
|
+
var year2 = parseInt(period2.year, 10);
|
|
41
47
|
if (year1 > year2) return 1;
|
|
42
48
|
if (year1 === year2 && number1 > number2) return 1;
|
|
43
49
|
return -1;
|
|
@@ -48,7 +54,7 @@ const comparePeriods = (period1, period2) => {
|
|
|
48
54
|
|
|
49
55
|
exports.comparePeriods = comparePeriods;
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
var getSavingsPercentage = function getSavingsPercentage(period) {
|
|
52
58
|
var _period$additional_in;
|
|
53
59
|
|
|
54
60
|
return period === null || period === void 0 ? void 0 : (_period$additional_in = period.additional_information) === null || _period$additional_in === void 0 ? void 0 : _period$additional_in.savings_percentage;
|
|
@@ -9,6 +9,10 @@ var _seamlessImmutable = require("seamless-immutable");
|
|
|
9
9
|
|
|
10
10
|
var _string = require("@widergy/web-utils/lib/string");
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
var getCharge = function getCharge(billData, concept) {
|
|
13
|
+
return (0, _seamlessImmutable.getIn)(billData, ['client', 'rate', 'charges'], []).find(function (charge) {
|
|
14
|
+
return (0, _string.stringCompare)(charge.concept, concept);
|
|
15
|
+
}) || {};
|
|
16
|
+
};
|
|
13
17
|
|
|
14
18
|
exports.getCharge = getCharge;
|
|
@@ -11,10 +11,18 @@ var _string = require("@widergy/web-utils/lib/string");
|
|
|
11
11
|
|
|
12
12
|
var _consumptions = require("../constants/consumptions");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
var getReadingPeriod = function getReadingPeriod(billData, moment) {
|
|
15
|
+
return (0, _seamlessImmutable.getIn)(billData, ['reading_periods'], []).find(function (readingPeriod) {
|
|
16
|
+
return (0, _string.stringCompare)(readingPeriod.moment, moment);
|
|
17
|
+
}) || {};
|
|
18
|
+
};
|
|
15
19
|
|
|
16
20
|
exports.getReadingPeriod = getReadingPeriod;
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
var getActiveEnergyRecord = function getActiveEnergyRecord(readingPeriod) {
|
|
23
|
+
return (0, _seamlessImmutable.getIn)(readingPeriod, ['records'], []).find(function (record) {
|
|
24
|
+
return (0, _string.stringToCompareWithoutAccentsInclusive)(record.magnitude, _consumptions.ENERGY_TYPES.ACTIVE);
|
|
25
|
+
}) || {};
|
|
26
|
+
};
|
|
19
27
|
|
|
20
28
|
exports.getActiveEnergyRecord = getActiveEnergyRecord;
|
|
@@ -7,6 +7,10 @@ exports.getSeason = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _seasons = require("../constants/seasons");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var getSeason = function getSeason(monthNumber) {
|
|
11
|
+
return (_seasons.SEASON_PERIODS.find(function (seasonPeriod) {
|
|
12
|
+
return seasonPeriod.initMonth <= monthNumber && seasonPeriod.endingMonth >= monthNumber;
|
|
13
|
+
}) || {}).season;
|
|
14
|
+
};
|
|
11
15
|
|
|
12
16
|
exports.getSeason = getSeason;
|