@widergy/utilitygo-smart-bill-web 3.0.4 → 3.1.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 +12 -0
- package/dist/components/Advice/index.js +1 -1
- package/dist/components/Amount/index.js +24 -20
- package/dist/components/Banner/index.js +4 -2
- package/dist/components/BarChart/index.js +10 -8
- package/dist/components/BillCalculation/components/ConceptCard/index.js +21 -14
- package/dist/components/BillCalculation/components/Glossary/index.js +1 -1
- package/dist/components/BillCalculation/index.js +13 -9
- package/dist/components/BillCalculation/utils.js +12 -13
- package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +30 -23
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +2 -2
- package/dist/components/BillSummary/components/BilledConcepts/index.js +15 -16
- package/dist/components/BillSummary/components/BilledConcepts/utils.js +11 -10
- package/dist/components/BillSummary/index.js +5 -6
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +9 -5
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +1 -1
- package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +6 -8
- package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +2 -2
- package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +15 -14
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +2 -2
- package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +3 -3
- package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +1 -1
- package/dist/components/ConsumptionComparison/index.js +2 -3
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +51 -50
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +23 -19
- package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +3 -3
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +3 -3
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +1 -1
- package/dist/components/ConsumptionEnergyDetails/index.js +24 -22
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +15 -12
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +3 -3
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +3 -3
- package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +9 -9
- package/dist/components/ConsumptionIncluded/index.js +1 -1
- package/dist/components/ConsumptionIncluded/utils.js +47 -65
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +22 -18
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +37 -30
- package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +1 -1
- package/dist/components/ConsumptionPeriod/components/Reading/index.js +35 -26
- package/dist/components/ConsumptionPeriod/index.js +24 -18
- package/dist/components/Date/index.js +17 -13
- package/dist/components/DebtState/index.js +9 -6
- package/dist/components/IconAndDetails/index.js +22 -17
- package/dist/components/Magnitude/index.js +14 -8
- package/dist/components/Magnitude/utils.js +1 -1
- package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +3 -3
- package/dist/components/MainBillData/components/BillAlert/index.js +8 -6
- package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +38 -29
- package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +2 -2
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +34 -28
- package/dist/components/MainBillData/components/BillBody/index.js +15 -13
- package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +11 -7
- package/dist/components/MainBillData/components/BillHeader/index.js +19 -15
- package/dist/components/MainBillData/index.js +3 -4
- package/dist/components/Period/index.js +42 -35
- package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +7 -4
- package/dist/components/PowerProgresBar/index.js +2 -2
- package/dist/components/RateAndCategory/index.js +12 -8
- package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +1 -1
- package/dist/components/RatesDefinition/components/BillRate/index.js +2 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +2 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +3 -3
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +2 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +2 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +1 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +2 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +1 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +5 -5
- package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +1 -1
- package/dist/components/RatesDefinition/components/PurchasedRate/index.js +2 -2
- package/dist/components/RatesDefinition/index.js +1 -1
- package/dist/components/StyledAmount/constants.js +1 -1
- package/dist/components/StyledAmount/index.js +18 -13
- package/dist/components/WithContextApi/index.js +2 -2
- package/dist/components/WithContextApi/layout.js +2 -3
- package/dist/components/WithSeason/index.js +2 -2
- package/dist/constants/deviceSizes.js +1 -1
- package/dist/constants/testsIds.js +136 -0
- package/dist/index.js +1 -1
- package/dist/shared/Context/index.js +1 -1
- package/dist/shared/utils/billCalculation.js +5 -6
- package/dist/shared/utils/consumptions.js +9 -20
- package/dist/shared/utils/periods.js +2 -5
- package/dist/utils.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.smartBill = void 0;
|
|
7
|
+
const ID_CONSTANTS = {
|
|
8
|
+
AMOUNT: 'amount',
|
|
9
|
+
BILLED_CONCEPTS: 'billedConcepts',
|
|
10
|
+
BILL_BODY: 'billBody',
|
|
11
|
+
BILL_CALCULATION: 'billCalculation',
|
|
12
|
+
BILL_HEADER: 'billHeader',
|
|
13
|
+
CLIENT_DATA: 'clientData',
|
|
14
|
+
CONCEPT: 'concept',
|
|
15
|
+
CONCEPT_CARD: 'conceptCard',
|
|
16
|
+
CONSUMPTION_ENERGY_COMPARISON: 'consumptionEnergyComparison',
|
|
17
|
+
CONSUMPTION_ENERGY_DETAILS: 'consumptionEnergyDetails',
|
|
18
|
+
CONSUMPTION_IN_DAYS_LABEL: 'consumptionInDaysLabel',
|
|
19
|
+
CONSUMPTION_PERIOD: 'consumptionPeriod',
|
|
20
|
+
CONSUMPTION_PERIODICITY: 'consumptionPeriodicity',
|
|
21
|
+
CURRENT_CONSUMPTION: 'currentConsumption',
|
|
22
|
+
ICON_AND_DETAILS: 'iconAndDetails',
|
|
23
|
+
MAIN_BILL_DATA: 'mainBillData',
|
|
24
|
+
PERIOD: 'period',
|
|
25
|
+
RATE_AND_CATEGORY: 'rateAndCategory',
|
|
26
|
+
REDING_DETAILS: 'readingDetails',
|
|
27
|
+
REMAINING_CONSUMPTION: 'remainingConsumption',
|
|
28
|
+
SMART_BILL: 'smartBill',
|
|
29
|
+
TITLE: 'title',
|
|
30
|
+
TYPE_AND_NUMBER: 'typeAndNumber'
|
|
31
|
+
};
|
|
32
|
+
const smartBill = exports.smartBill = {
|
|
33
|
+
banner: `${ID_CONSTANTS.SMART_BILL}.banner`,
|
|
34
|
+
barChart: {
|
|
35
|
+
title: `${ID_CONSTANTS.SMART_BILL}.barChart.${ID_CONSTANTS.TITLE}`,
|
|
36
|
+
yAxisLabel: `${ID_CONSTANTS.SMART_BILL}.barChart.yAxisLabel`
|
|
37
|
+
},
|
|
38
|
+
billCalculation: {
|
|
39
|
+
conceptCard: {
|
|
40
|
+
card: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILL_CALCULATION}.${ID_CONSTANTS.CONCEPT_CARD}.card.`,
|
|
41
|
+
expandButton: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILL_CALCULATION}.${ID_CONSTANTS.CONCEPT_CARD}.expandButton.`,
|
|
42
|
+
footer: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILL_CALCULATION}.${ID_CONSTANTS.CONCEPT_CARD}.footer.`,
|
|
43
|
+
header: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILL_CALCULATION}.${ID_CONSTANTS.CONCEPT_CARD}.header.`,
|
|
44
|
+
line: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILL_CALCULATION}.${ID_CONSTANTS.CONCEPT_CARD}.line.`
|
|
45
|
+
},
|
|
46
|
+
title: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILL_CALCULATION}.${ID_CONSTANTS.TITLE}`
|
|
47
|
+
},
|
|
48
|
+
billedConcepts: {
|
|
49
|
+
concept: {
|
|
50
|
+
amount: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILLED_CONCEPTS}.${ID_CONSTANTS.CONCEPT}.${ID_CONSTANTS.AMOUNT}.`,
|
|
51
|
+
progressBar: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILLED_CONCEPTS}.${ID_CONSTANTS.CONCEPT}.progressBar.`,
|
|
52
|
+
title: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILLED_CONCEPTS}.${ID_CONSTANTS.CONCEPT}.${ID_CONSTANTS.TITLE}.`,
|
|
53
|
+
toggle: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILLED_CONCEPTS}.${ID_CONSTANTS.CONCEPT}.toggle.`
|
|
54
|
+
},
|
|
55
|
+
title: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.BILLED_CONCEPTS}.${ID_CONSTANTS.TITLE}`
|
|
56
|
+
},
|
|
57
|
+
card: `${ID_CONSTANTS.SMART_BILL}.card.`,
|
|
58
|
+
clientData: {
|
|
59
|
+
adheredToDigitalBill: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CLIENT_DATA}.adheredToDigitalBill`,
|
|
60
|
+
clientDataLocation: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CLIENT_DATA}.clientDataLocation.`,
|
|
61
|
+
clientDataPostalAdress: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CLIENT_DATA}.clientDataPostalAdress.`,
|
|
62
|
+
clientDataTitle: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CLIENT_DATA}.clientDataTitle`,
|
|
63
|
+
clientNumber: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CLIENT_DATA}.clientNumber.`,
|
|
64
|
+
emailDigitalBill: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CLIENT_DATA}.emailDigitalBill.`,
|
|
65
|
+
holderName: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CLIENT_DATA}.holderName.`,
|
|
66
|
+
ivaCondition: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CLIENT_DATA}.ivaCondition.`
|
|
67
|
+
},
|
|
68
|
+
consumptionComparison: {
|
|
69
|
+
comparisonTable: {
|
|
70
|
+
dataLine: `${ID_CONSTANTS.SMART_BILL}.consumptionComparison.comparisonTable.dataLine.`
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
consumptionEnergyDetails: {
|
|
74
|
+
consumptionEnergyComparison: {
|
|
75
|
+
consumptionInDaysLabel: {
|
|
76
|
+
consumptionPeriodicity: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_ENERGY_DETAILS}.${ID_CONSTANTS.CONSUMPTION_ENERGY_COMPARISON}.${ID_CONSTANTS.CONSUMPTION_IN_DAYS_LABEL}.${ID_CONSTANTS.CONSUMPTION_PERIODICITY}.`,
|
|
77
|
+
currentConsumption: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_ENERGY_DETAILS}.${ID_CONSTANTS.CONSUMPTION_ENERGY_COMPARISON}.${ID_CONSTANTS.CONSUMPTION_IN_DAYS_LABEL}.${ID_CONSTANTS.CURRENT_CONSUMPTION}.`,
|
|
78
|
+
remainingConsumption: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_ENERGY_DETAILS}.${ID_CONSTANTS.CONSUMPTION_ENERGY_COMPARISON}.${ID_CONSTANTS.CONSUMPTION_IN_DAYS_LABEL}.${ID_CONSTANTS.REMAINING_CONSUMPTION}.`
|
|
79
|
+
},
|
|
80
|
+
consumptionPeriodicity: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_ENERGY_DETAILS}.${ID_CONSTANTS.CONSUMPTION_ENERGY_COMPARISON}.${ID_CONSTANTS.CONSUMPTION_PERIODICITY}`,
|
|
81
|
+
currentConsumption: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_ENERGY_DETAILS}.${ID_CONSTANTS.CONSUMPTION_ENERGY_COMPARISON}.${ID_CONSTANTS.CURRENT_CONSUMPTION}`,
|
|
82
|
+
remainingConsumption: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_ENERGY_DETAILS}.${ID_CONSTANTS.CONSUMPTION_ENERGY_COMPARISON}.${ID_CONSTANTS.REMAINING_CONSUMPTION}`
|
|
83
|
+
},
|
|
84
|
+
consumptionTitle: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_ENERGY_DETAILS}.consumptionTitle`
|
|
85
|
+
},
|
|
86
|
+
consumptionPeriod: {
|
|
87
|
+
consumptionSummary: {
|
|
88
|
+
desktop: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_PERIOD}.consumptionSummary.desktop.`,
|
|
89
|
+
mobile: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_PERIOD}.consumptionSummary.mobile.`
|
|
90
|
+
},
|
|
91
|
+
reading: {
|
|
92
|
+
finalReading: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_PERIOD}.reading.finalReading`,
|
|
93
|
+
initialReading: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.CONSUMPTION_PERIOD}.reading.initialReading`
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
mainBillData: {
|
|
97
|
+
billAlert: {
|
|
98
|
+
particularConditionsAlert: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.billAlert.particularConditionsAlert`
|
|
99
|
+
},
|
|
100
|
+
billBody: {
|
|
101
|
+
amount: {
|
|
102
|
+
amount: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_BODY}.${ID_CONSTANTS.AMOUNT}.${ID_CONSTANTS.AMOUNT}.`,
|
|
103
|
+
expiration: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_BODY}.${ID_CONSTANTS.AMOUNT}.expiration.`
|
|
104
|
+
},
|
|
105
|
+
readingDetails: {
|
|
106
|
+
iconAndDetails: {
|
|
107
|
+
feederLine: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_BODY}.${ID_CONSTANTS.REDING_DETAILS}.${ID_CONSTANTS.ICON_AND_DETAILS}.feederLine.`,
|
|
108
|
+
meterNumber: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_BODY}.${ID_CONSTANTS.REDING_DETAILS}.${ID_CONSTANTS.ICON_AND_DETAILS}.meterNumber.`,
|
|
109
|
+
readingType: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_BODY}.${ID_CONSTANTS.REDING_DETAILS}.${ID_CONSTANTS.ICON_AND_DETAILS}.readingType.`,
|
|
110
|
+
transformationCenter: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_BODY}.${ID_CONSTANTS.REDING_DETAILS}.${ID_CONSTANTS.ICON_AND_DETAILS}.transformationCenter.`
|
|
111
|
+
},
|
|
112
|
+
readingTitle: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_BODY}.${ID_CONSTANTS.REDING_DETAILS}.readingTitle`
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
billHeader: {
|
|
116
|
+
debtState: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_HEADER}.debtState`,
|
|
117
|
+
issuedOnDate: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_HEADER}.issuedOnDate.`,
|
|
118
|
+
typeAndNumber: {
|
|
119
|
+
billNumber: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_HEADER}.${ID_CONSTANTS.TYPE_AND_NUMBER}.billNumber`,
|
|
120
|
+
billType: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_HEADER}.${ID_CONSTANTS.TYPE_AND_NUMBER}.billType`,
|
|
121
|
+
billTypeAndNumber: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_HEADER}.${ID_CONSTANTS.TYPE_AND_NUMBER}.billTypeAndNumber`
|
|
122
|
+
},
|
|
123
|
+
utilityLogo: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.MAIN_BILL_DATA}.${ID_CONSTANTS.BILL_HEADER}.utilityLogo`
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
period: {
|
|
127
|
+
periodLabel: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.PERIOD}.periodLabel`,
|
|
128
|
+
periodTooltip: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.PERIOD}.periodTooltip`,
|
|
129
|
+
tooltipIcon: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.PERIOD}.tooltipIcon`
|
|
130
|
+
},
|
|
131
|
+
rateAndCategory: {
|
|
132
|
+
category: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.RATE_AND_CATEGORY}.category`,
|
|
133
|
+
rate: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.RATE_AND_CATEGORY}.rate`,
|
|
134
|
+
title: `${ID_CONSTANTS.SMART_BILL}.${ID_CONSTANTS.RATE_AND_CATEGORY}.${ID_CONSTANTS.TITLE}`
|
|
135
|
+
}
|
|
136
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -94,4 +94,4 @@ var _billDataTypes = require("./shared/types/billDataTypes");
|
|
|
94
94
|
var _rateStagesTypes = require("./shared/types/rateStagesTypes");
|
|
95
95
|
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); }
|
|
96
96
|
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 && {}.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; }
|
|
97
|
-
function _interopRequireDefault(
|
|
97
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SmartBillProvider = exports.SmartBillConsumer = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const ContextApi = /*#__PURE__*/_react.default.createContext({});
|
|
10
10
|
const {
|
|
11
11
|
Provider: SmartBillProvider,
|
|
@@ -8,17 +8,16 @@ var _string = require("@widergy/web-utils/lib/string");
|
|
|
8
8
|
var _periodicities = require("../constants/periodicities");
|
|
9
9
|
var _periods = require("./periods");
|
|
10
10
|
const titleMapper = (billData, texts) => {
|
|
11
|
-
var _currentPeriod$settle, _currentPeriod$settle2, _currentPeriod$settle3;
|
|
12
11
|
const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
|
|
13
|
-
const periodicity = currentPeriod
|
|
14
|
-
const currentSettlement =
|
|
15
|
-
const totalSettlements =
|
|
16
|
-
const periodYear =
|
|
12
|
+
const periodicity = currentPeriod?.settlements?.periodicity;
|
|
13
|
+
const currentSettlement = currentPeriod?.settlements?.current?.number || '-';
|
|
14
|
+
const totalSettlements = currentPeriod?.settlements?.total_settlements || '-';
|
|
15
|
+
const periodYear = currentPeriod?.year || '-';
|
|
17
16
|
return {
|
|
18
17
|
periodicity: (0, _string.stringToCompareWithoutAccentsInclusive)(periodicity, _periodicities.PERIODICITY.BIMONTHLY) ? texts.Base.bimester : '-',
|
|
19
18
|
currentSettlement,
|
|
20
19
|
totalSettlements,
|
|
21
|
-
periodNumber:
|
|
20
|
+
periodNumber: currentPeriod?.number || '-',
|
|
22
21
|
periodYear
|
|
23
22
|
};
|
|
24
23
|
};
|
|
@@ -5,39 +5,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getTotalConsumption = exports.getRemainingConsumption = exports.getDailyConsumption = exports.getCurrentConsumption = exports.getConsumptionHistoryData = exports.consumptionDataMapper = void 0;
|
|
7
7
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
8
|
-
var
|
|
8
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
9
9
|
var _string = require("@widergy/web-utils/lib/string");
|
|
10
10
|
var _consumptions = require("../constants/consumptions");
|
|
11
11
|
var _periods = require("./periods");
|
|
12
|
-
function _interopRequireDefault(
|
|
13
|
-
const getCurrentConsumption = (period, energyType) => {
|
|
14
|
-
var _period$settlements;
|
|
15
|
-
return (period === null || period === void 0 || (_period$settlements = period.settlements) === null || _period$settlements === void 0 || (_period$settlements = _period$settlements.current) === null || _period$settlements === void 0 || (_period$settlements = _period$settlements.consumptions) === null || _period$settlements === void 0 ? void 0 : _period$settlements.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType))) || {};
|
|
16
|
-
};
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const getCurrentConsumption = (period, energyType) => period?.settlements?.current?.consumptions?.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType)) || {};
|
|
17
14
|
exports.getCurrentConsumption = getCurrentConsumption;
|
|
18
15
|
const getRemainingConsumption = (period, energyType) => {
|
|
19
|
-
|
|
20
|
-
const remaining = (period === null || period === void 0 || (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 || (_period$settlements2 = _period$settlements2.remaining) === null || _period$settlements2 === void 0 || (_period$settlements2 = _period$settlements2[0]) === null || _period$settlements2 === void 0 ? void 0 : _period$settlements2.consumptions) || [];
|
|
16
|
+
const remaining = period?.settlements?.remaining?.[0]?.consumptions || [];
|
|
21
17
|
return remaining.find(item => (0, _string.stringToCompareWithoutAccentsInclusive)(item.magnitude, energyType)) || {};
|
|
22
18
|
};
|
|
23
19
|
exports.getRemainingConsumption = getRemainingConsumption;
|
|
24
|
-
const getTotalConsumption = (period, energyOrPowerType) => {
|
|
25
|
-
var _period$consumptions;
|
|
26
|
-
return (period === null || period === void 0 || (_period$consumptions = period.consumptions) === null || _period$consumptions === void 0 ? void 0 : _period$consumptions.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.TOTAL) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyOrPowerType))) || {};
|
|
27
|
-
};
|
|
20
|
+
const getTotalConsumption = (period, energyOrPowerType) => period?.consumptions?.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.TOTAL) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyOrPowerType)) || {};
|
|
28
21
|
exports.getTotalConsumption = getTotalConsumption;
|
|
29
|
-
const getDailyConsumption = (period, energyType) => {
|
|
30
|
-
var _period$consumptions2;
|
|
31
|
-
return (period === null || period === void 0 || (_period$consumptions2 = period.consumptions) === null || _period$consumptions2 === void 0 ? void 0 : _period$consumptions2.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.DAILY) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType))) || {};
|
|
32
|
-
};
|
|
22
|
+
const getDailyConsumption = (period, energyType) => period?.consumptions?.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.DAILY) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType)) || {};
|
|
33
23
|
exports.getDailyConsumption = getDailyConsumption;
|
|
34
|
-
const formatPeriod = period => period.number && period.year &&
|
|
24
|
+
const formatPeriod = period => period.number && period.year && `${period.number}/${(0, _dayjs.default)(period.year, 'YYYY').format('YY')}`;
|
|
35
25
|
const getConsumptionHistoryData = (billDataParameter, energyType, showPeriodsInChronologicalOrder) => {
|
|
36
|
-
|
|
37
|
-
const billData = _lodash.default.cloneDeep(billDataParameter);
|
|
26
|
+
const billData = (0, _cloneDeep.default)(billDataParameter);
|
|
38
27
|
const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
|
|
39
28
|
const lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
|
|
40
|
-
const otherPeriods = billData
|
|
29
|
+
const otherPeriods = billData?.periods?.filter(period => !(0, _periods.areSamePeriods)(period, currentPeriod) && !(0, _periods.areSamePeriods)(period, lastYearPeriod) && period.consumptions).sort(_periods.comparePeriods);
|
|
41
30
|
const periods = [...(lastYearPeriod.consumptions && showPeriodsInChronologicalOrder ? [lastYearPeriod] : []), ...otherPeriods, ...(currentPeriod.consumptions ? [currentPeriod] : []), ...(lastYearPeriod.consumptions && !showPeriodsInChronologicalOrder ? [lastYearPeriod] : [])].filter(period => getTotalConsumption(period, energyType).value === 0 || getTotalConsumption(period, energyType).value).map(period => ({
|
|
42
31
|
period: formatPeriod(period),
|
|
43
32
|
consumption: getTotalConsumption(period, energyType).value,
|
|
@@ -9,7 +9,7 @@ const getCurrentPeriod = billData => (0, _seamlessImmutable.getIn)(billData, ['p
|
|
|
9
9
|
exports.getCurrentPeriod = getCurrentPeriod;
|
|
10
10
|
const getLastYearPeriod = billData => {
|
|
11
11
|
const currentPeriod = getCurrentPeriod(billData);
|
|
12
|
-
const lastYear =
|
|
12
|
+
const lastYear = `${parseInt(currentPeriod.year, 10) - 1}`;
|
|
13
13
|
return (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(period => period.number === currentPeriod.number && period.year === lastYear) || {};
|
|
14
14
|
};
|
|
15
15
|
exports.getLastYearPeriod = getLastYearPeriod;
|
|
@@ -35,8 +35,5 @@ const comparePeriods = (period1, period2) => {
|
|
|
35
35
|
return 0;
|
|
36
36
|
};
|
|
37
37
|
exports.comparePeriods = comparePeriods;
|
|
38
|
-
const getSavingsPercentage = period =>
|
|
39
|
-
var _period$additional_in;
|
|
40
|
-
return period === null || period === void 0 || (_period$additional_in = period.additional_information) === null || _period$additional_in === void 0 ? void 0 : _period$additional_in.savings_percentage;
|
|
41
|
-
};
|
|
38
|
+
const getSavingsPercentage = period => period?.additional_information?.savings_percentage;
|
|
42
39
|
exports.getSavingsPercentage = getSavingsPercentage;
|
package/dist/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.stringOrDash = exports.numberOrDash = exports.formatNumber = void 0;
|
|
7
7
|
var _numeral = _interopRequireDefault(require("config/numeral"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const formatNumber = value => (0, _numeral.default)(value).format('0.[00]');
|
|
10
10
|
exports.formatNumber = formatNumber;
|
|
11
11
|
const numberOrDash = function (number) {
|