@widergy/utilitygo-smart-bill-web 2.2.2 → 3.0.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 +20 -0
- package/dist/components/Advice/index.js +10 -6
- package/dist/components/Amount/index.js +26 -21
- package/dist/components/Amount/utils.js +2 -5
- package/dist/components/Banner/index.js +10 -6
- package/dist/components/BarChart/constants.js +3 -3
- package/dist/components/BarChart/index.js +28 -22
- package/dist/components/BarChart/utils.js +17 -16
- package/dist/components/BillCalculation/components/ConceptCard/index.js +52 -45
- package/dist/components/BillCalculation/components/Glossary/index.js +48 -64
- package/dist/components/BillCalculation/components/Glossary/styles.module.scss +1 -0
- package/dist/components/BillCalculation/constants.js +1 -1
- package/dist/components/BillCalculation/index.js +48 -51
- package/dist/components/BillCalculation/utils.js +22 -22
- package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +25 -22
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/constants.js +1 -1
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +15 -15
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/styles.module.scss +3 -3
- package/dist/components/BillSummary/components/BilledConcepts/constants.js +13 -14
- package/dist/components/BillSummary/components/BilledConcepts/index.js +29 -39
- package/dist/components/BillSummary/components/BilledConcepts/utils.js +50 -69
- package/dist/components/BillSummary/index.js +70 -69
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +8 -8
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +17 -10
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +3 -2
- package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +147 -133
- package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +16 -14
- package/dist/components/ConsumptionComparison/components/ComparisonTable/styles.module.scss +1 -0
- package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +88 -89
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +21 -11
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +3 -2
- package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +21 -14
- package/dist/components/ConsumptionComparison/components/PercentageComparison/styles.module.scss +1 -0
- package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +15 -10
- package/dist/components/ConsumptionComparison/index.js +41 -45
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +27 -22
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/styles.module.scss +1 -1
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +18 -13
- package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +15 -12
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +21 -15
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +3 -2
- package/dist/components/ConsumptionEnergyDetails/index.js +46 -41
- package/dist/components/ConsumptionEnergyDetails/styles.module.scss +2 -2
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +64 -60
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +12 -13
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +20 -17
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +16 -10
- package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +42 -37
- package/dist/components/ConsumptionIncluded/components/TimelineRow/styles.module.scss +2 -2
- package/dist/components/ConsumptionIncluded/index.js +31 -32
- package/dist/components/ConsumptionIncluded/utils.js +32 -34
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +14 -10
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/styles.module.scss +1 -0
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +23 -20
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/styles.module.scss +1 -0
- package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +18 -26
- package/dist/components/ConsumptionPeriod/components/Reading/index.js +35 -32
- package/dist/components/ConsumptionPeriod/index.js +12 -8
- package/dist/components/ConsumptionPeriod/styles.module.scss +1 -0
- package/dist/components/ConsumptionPeriod/utils.js +14 -15
- package/dist/components/Date/index.js +12 -9
- package/dist/components/DebtState/index.js +14 -8
- package/dist/components/IconAndDetails/index.js +19 -17
- package/dist/components/Magnitude/index.js +15 -12
- package/dist/components/Magnitude/utils.js +3 -8
- package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +18 -14
- package/dist/components/MainBillData/components/BillAlert/index.js +24 -31
- package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +19 -11
- package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +14 -11
- package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +2 -3
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +23 -15
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/styles.module.scss +3 -2
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +3 -2
- package/dist/components/MainBillData/components/BillBody/index.js +42 -44
- package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +16 -11
- package/dist/components/MainBillData/components/BillHeader/index.js +29 -24
- package/dist/components/MainBillData/components/BillHeader/styles.module.scss +1 -1
- package/dist/components/MainBillData/index.js +7 -5
- package/dist/components/MainBillData/theme.js +8 -9
- package/dist/components/MainBillData/utils.js +2 -5
- package/dist/components/Period/index.js +54 -43
- package/dist/components/Period/styles.module.scss +0 -6
- package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +15 -11
- package/dist/components/PowerProgresBar/index.js +31 -30
- package/dist/components/RateAndCategory/index.js +25 -27
- package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +20 -13
- package/dist/components/RatesDefinition/components/BillRate/index.js +24 -14
- package/dist/components/RatesDefinition/components/BillRate/styles.module.scss +1 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +14 -9
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +26 -21
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +11 -7
- 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 +11 -10
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +21 -19
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +34 -36
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +2 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +17 -30
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +37 -48
- package/dist/components/RatesDefinition/components/CategoryByConsumption/constants.js +18 -18
- package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +23 -31
- package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +2 -5
- package/dist/components/RatesDefinition/components/PurchasedRate/index.js +19 -13
- package/dist/components/RatesDefinition/index.js +20 -15
- package/dist/components/RatesDefinition/styles.module.scss +1 -1
- package/dist/components/SmartBillProvider/index.js +12 -34
- package/dist/components/StyledAmount/constants.js +1 -1
- package/dist/components/StyledAmount/index.js +19 -27
- package/dist/components/WithContextApi/index.js +18 -25
- package/dist/components/WithContextApi/layout.js +2 -2
- package/dist/components/WithSeason/index.js +6 -9
- package/dist/constants/deviceSizes.js +33 -18
- package/dist/constants/seasons.js +2 -2
- package/dist/index.js +14 -15
- package/dist/scss/variables/commonColors.module.scss +1 -1
- package/dist/shared/Context/index.js +7 -3
- package/dist/shared/constants/aliases.js +691 -556
- 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 +5 -5
- package/dist/shared/types/componentsTypes.js +18 -10
- package/dist/shared/types/formattersTypes.js +1 -1
- package/dist/shared/types/rateStagesTypes.js +3 -3
- package/dist/shared/types/smartBillTypes.js +5 -10
- package/dist/shared/types/textsTypes.js +1 -1
- package/dist/shared/utils/billCalculation.js +11 -10
- package/dist/shared/utils/consumptions.js +34 -56
- package/dist/shared/utils/context.js +8 -6
- package/dist/shared/utils/expirations.js +2 -5
- package/dist/shared/utils/periods.js +20 -21
- package/dist/shared/utils/rates.js +2 -5
- package/dist/shared/utils/readings.js +4 -10
- package/dist/shared/utils/season.js +2 -5
- package/dist/shared/utils/stagesGraph.js +15 -15
- package/dist/utils/hooks.js +1 -1
- package/dist/utils.js +7 -8
- package/package.json +26 -63
|
@@ -9,109 +9,108 @@ var _aliases = require("../../../../shared/constants/aliases");
|
|
|
9
9
|
var _DataLine = _interopRequireDefault(require("./components/DataLine"));
|
|
10
10
|
var _constants = require("./constants");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
12
|
+
const getPeriodFields = function (contextApiInfo, period, periodAverageTemperature, withPowerComparison, isDesktop) {
|
|
13
13
|
var _period$lastYearPerio, _period$lastYearPerio2, _period$lastYearPerio3, _period$lastYearPerio4, _period$currentPeriod, _period$currentPeriod2, _period$currentPeriod3, _period$currentPeriod4;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
14
|
+
let stylingOptions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
15
|
+
let options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
|
|
16
|
+
const {
|
|
17
|
+
config,
|
|
18
|
+
Label
|
|
19
|
+
} = contextApiInfo;
|
|
20
|
+
const {
|
|
21
|
+
daysUnit,
|
|
22
|
+
temperatureUnit,
|
|
23
|
+
periodDates,
|
|
24
|
+
settlementDays,
|
|
25
|
+
energyConsumption,
|
|
26
|
+
powerConsumption,
|
|
27
|
+
totalConsumption,
|
|
28
|
+
dailyConsumption,
|
|
29
|
+
averageTemperature,
|
|
30
|
+
yearOrPeriodMobile
|
|
31
|
+
} = config.texts.consumptionComparison;
|
|
32
|
+
const {
|
|
33
|
+
noData
|
|
34
|
+
} = config.texts.commons;
|
|
35
|
+
const {
|
|
36
|
+
primary,
|
|
37
|
+
gray,
|
|
38
|
+
semibold
|
|
39
|
+
} = stylingOptions;
|
|
40
|
+
const formattedPeriod = period.number && period.year && "".concat(period.number, "/").concat(period.year);
|
|
41
|
+
const mobileLastYearPeriodFormatted = ((_period$lastYearPerio = period.lastYearPeriod) === null || _period$lastYearPerio === void 0 ? void 0 : _period$lastYearPerio.number) && ((_period$lastYearPerio2 = period.lastYearPeriod) === null || _period$lastYearPerio2 === void 0 ? void 0 : _period$lastYearPerio2.year) && "".concat((_period$lastYearPerio3 = period.lastYearPeriod) === null || _period$lastYearPerio3 === void 0 ? void 0 : _period$lastYearPerio3.number, "/").concat((_period$lastYearPerio4 = period.lastYearPeriod) === null || _period$lastYearPerio4 === void 0 ? void 0 : _period$lastYearPerio4.year);
|
|
42
|
+
const mobileCurrentYearPeriodFormatted = ((_period$currentPeriod = period.currentPeriod) === null || _period$currentPeriod === void 0 ? void 0 : _period$currentPeriod.number) && ((_period$currentPeriod2 = period.currentPeriod) === null || _period$currentPeriod2 === void 0 ? void 0 : _period$currentPeriod2.year) && "".concat((_period$currentPeriod3 = period.currentPeriod) === null || _period$currentPeriod3 === void 0 ? void 0 : _period$currentPeriod3.number, "/").concat((_period$currentPeriod4 = period.currentPeriod) === null || _period$currentPeriod4 === void 0 ? void 0 : _period$currentPeriod4.year);
|
|
36
43
|
if (isDesktop && Object.keys(period).length === 0) return [{
|
|
37
44
|
id: 'no_data_cell',
|
|
38
45
|
Component: /*#__PURE__*/_react.default.createElement(Label, {
|
|
39
46
|
alias: _aliases.GET_PERIOD_FIELDS_NO_DATA
|
|
40
47
|
}, noData)
|
|
41
48
|
}];
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
let noDataLastYearPeriod = false;
|
|
50
|
+
let noDataCurrentPeriod = false;
|
|
44
51
|
if (!isDesktop && Object.keys(period === null || period === void 0 ? void 0 : period.lastYearPeriod).length === 0) {
|
|
45
52
|
noDataLastYearPeriod = true;
|
|
46
53
|
}
|
|
47
54
|
if (!isDesktop && Object.keys(period.currentPeriod).length === 0) {
|
|
48
55
|
noDataCurrentPeriod = true;
|
|
49
56
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
semibold: semibold,
|
|
76
|
-
data: data
|
|
77
|
-
}, contextApiInfo)[fieldId] : mobileNoPeriodData;
|
|
78
|
-
};
|
|
79
|
-
var _ref = periodAverageTemperature || {},
|
|
80
|
-
lastYearPeriodAverageTemperature = _ref.lastYearPeriodAverageTemperature,
|
|
81
|
-
currentPeriodAverageTemperature = _ref.currentPeriodAverageTemperature;
|
|
57
|
+
const mobileNoPeriodData = (0, _constants.noPeriodData)(primary, noData, contextApiInfo);
|
|
58
|
+
const desktopFields = (data, fieldId) => (0, _constants.getField)({
|
|
59
|
+
primary,
|
|
60
|
+
gray,
|
|
61
|
+
semibold,
|
|
62
|
+
isDesktop,
|
|
63
|
+
data
|
|
64
|
+
}, contextApiInfo)[fieldId];
|
|
65
|
+
const mobileFieldsLastYear = (data, fieldId) => !noDataLastYearPeriod ? (0, _constants.getField)({
|
|
66
|
+
data
|
|
67
|
+
}, contextApiInfo)[fieldId] : mobileNoPeriodData;
|
|
68
|
+
const mobileTextField = (text, fieldId) => (0, _constants.getField)({
|
|
69
|
+
gray,
|
|
70
|
+
text,
|
|
71
|
+
isHeader: true
|
|
72
|
+
}, contextApiInfo)[fieldId];
|
|
73
|
+
const mobileFieldCurrentYear = (data, fieldId) => !noDataCurrentPeriod ? (0, _constants.getField)({
|
|
74
|
+
primary,
|
|
75
|
+
semibold,
|
|
76
|
+
data
|
|
77
|
+
}, contextApiInfo)[fieldId] : mobileNoPeriodData;
|
|
78
|
+
const {
|
|
79
|
+
lastYearPeriodAverageTemperature,
|
|
80
|
+
currentPeriodAverageTemperature
|
|
81
|
+
} = periodAverageTemperature || {};
|
|
82
82
|
return isDesktop ? [desktopFields(formattedPeriod, _constants.FIELD_PERIOD_COMPARISION), desktopFields(period, _constants.FIELD_PERIOD_DATES), desktopFields({
|
|
83
|
-
period
|
|
84
|
-
daysUnit
|
|
83
|
+
period,
|
|
84
|
+
daysUnit
|
|
85
85
|
}, _constants.FIELD_SETTLEMENTS_DAYS), withPowerComparison && desktopFields(period, _constants.FIELD_TOTAL_CONSUMPTIONS), !withPowerComparison && desktopFields(period, _constants.FIELD_ENERGY_CONSUMPTION), !withPowerComparison && desktopFields(period, _constants.FIELD_POWER_CONSUMPTION), desktopFields(period, _constants.FIELD_DAILY_CONSUMPTIONS), periodAverageTemperature && desktopFields({
|
|
86
|
-
periodAverageTemperature
|
|
87
|
-
temperatureUnit
|
|
86
|
+
periodAverageTemperature,
|
|
87
|
+
temperatureUnit
|
|
88
88
|
}, _constants.FIELD_AVERAGE_TEMPERATURE)] : options === 'period_comparison' ? [mobileFieldsLastYear(mobileLastYearPeriodFormatted, _constants.FIELD_PERIOD_COMPARISION), mobileTextField(yearOrPeriodMobile, _constants.FIELD_PERIOD_COMPARISION), mobileFieldCurrentYear(mobileCurrentYearPeriodFormatted, _constants.FIELD_PERIOD_COMPARISION)] : options === 'period_dates' ? [mobileFieldsLastYear(period.lastYearPeriod, _constants.FIELD_PERIOD_DATES), mobileTextField(periodDates, _constants.FIELD_PERIOD_DATES), mobileFieldCurrentYear(period.currentPeriod, _constants.FIELD_PERIOD_DATES)] : options === 'settlements_days' ? [mobileFieldsLastYear({
|
|
89
89
|
period: period.lastYearPeriod,
|
|
90
|
-
daysUnit
|
|
90
|
+
daysUnit
|
|
91
91
|
}, _constants.FIELD_SETTLEMENTS_DAYS), mobileTextField(settlementDays, _constants.FIELD_SETTLEMENTS_DAYS), mobileFieldCurrentYear({
|
|
92
92
|
period: period.currentPeriod,
|
|
93
|
-
daysUnit
|
|
93
|
+
daysUnit
|
|
94
94
|
}, _constants.FIELD_SETTLEMENTS_DAYS)] : withPowerComparison && options === 'total_consumptions' ? [mobileFieldsLastYear(period.lastYearPeriod, _constants.FIELD_TOTAL_CONSUMPTIONS), mobileTextField(totalConsumption, _constants.FIELD_TOTAL_CONSUMPTIONS), mobileFieldCurrentYear(period.currentPeriod, _constants.FIELD_TOTAL_CONSUMPTIONS)] : !withPowerComparison && options === 'energy_consumption' ? [mobileFieldsLastYear(period.lastYearPeriod, _constants.FIELD_ENERGY_CONSUMPTION), mobileTextField(energyConsumption, _constants.FIELD_ENERGY_CONSUMPTION), mobileFieldCurrentYear(period.currentPeriod, _constants.FIELD_ENERGY_CONSUMPTION)] : !withPowerComparison && options === 'power_consumption' ? [mobileFieldsLastYear(period.lastYearPeriod, _constants.FIELD_POWER_CONSUMPTION), mobileTextField(powerConsumption, _constants.FIELD_POWER_CONSUMPTION), mobileFieldCurrentYear(period.currentPeriod, _constants.FIELD_POWER_CONSUMPTION)] : options === 'daily_consumptions' ? [mobileFieldsLastYear(period.lastYearPeriod, _constants.FIELD_DAILY_CONSUMPTIONS), mobileTextField(dailyConsumption, _constants.FIELD_DAILY_CONSUMPTIONS), mobileFieldCurrentYear(period.currentPeriod, _constants.FIELD_DAILY_CONSUMPTIONS)] : options === 'average_temperature' && (lastYearPeriodAverageTemperature || currentPeriodAverageTemperature) ? [mobileFieldsLastYear({
|
|
95
95
|
period: lastYearPeriodAverageTemperature,
|
|
96
|
-
temperatureUnit
|
|
96
|
+
temperatureUnit
|
|
97
97
|
}, _constants.FIELD_AVERAGE_TEMPERATURE), mobileTextField(averageTemperature, _constants.FIELD_AVERAGE_TEMPERATURE), mobileFieldCurrentYear({
|
|
98
98
|
period: currentPeriodAverageTemperature,
|
|
99
|
-
temperatureUnit
|
|
99
|
+
temperatureUnit
|
|
100
100
|
}, _constants.FIELD_AVERAGE_TEMPERATURE)] : {};
|
|
101
101
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var showTemp = currentPeriodAverageTemperature && lastYearPeriodAverageTemperature;
|
|
102
|
+
exports.getPeriodFields = getPeriodFields;
|
|
103
|
+
const renderDataLine = (contextApiInfo, mobilePeriod, mobilePeriodAverageTemperature, withPowerComparison, isDesktop, data) => /*#__PURE__*/_react.default.createElement(_DataLine.default, {
|
|
104
|
+
key: "",
|
|
105
|
+
fields: getPeriodFields(contextApiInfo, mobilePeriod, mobilePeriodAverageTemperature, withPowerComparison, isDesktop, {
|
|
106
|
+
primary: true,
|
|
107
|
+
gray: true,
|
|
108
|
+
semibold: true
|
|
109
|
+
}, data),
|
|
110
|
+
isDesktop: isDesktop
|
|
111
|
+
});
|
|
112
|
+
const desktopGetTableLines = (contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktop, withPowerComparison) => {
|
|
113
|
+
const showTemp = currentPeriodAverageTemperature && lastYearPeriodAverageTemperature;
|
|
115
114
|
return [{
|
|
116
115
|
Component: /*#__PURE__*/_react.default.createElement(_DataLine.default, {
|
|
117
116
|
key: "header",
|
|
@@ -139,18 +138,18 @@ var desktopGetTableLines = exports.desktopGetTableLines = function desktopGetTab
|
|
|
139
138
|
})
|
|
140
139
|
}];
|
|
141
140
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
exports.desktopGetTableLines = desktopGetTableLines;
|
|
142
|
+
const mobileGetTableLines = (contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktop, withPowerComparison) => {
|
|
143
|
+
const mobilePeriod = {
|
|
144
|
+
currentPeriod,
|
|
145
|
+
lastYearPeriod
|
|
146
146
|
};
|
|
147
|
-
|
|
148
|
-
currentPeriodAverageTemperature
|
|
149
|
-
lastYearPeriodAverageTemperature
|
|
147
|
+
const mobilePeriodAverageTemperature = {
|
|
148
|
+
currentPeriodAverageTemperature,
|
|
149
|
+
lastYearPeriodAverageTemperature
|
|
150
150
|
};
|
|
151
151
|
return [{
|
|
152
|
-
Component: /*#__PURE__*/_react.default.createElement("div", null, _constants.dataFieldDictonary.map(
|
|
153
|
-
return renderDataLine(contextApiInfo, mobilePeriod, mobilePeriodAverageTemperature, withPowerComparison, isDesktop, data);
|
|
154
|
-
}))
|
|
152
|
+
Component: /*#__PURE__*/_react.default.createElement("div", null, _constants.dataFieldDictonary.map(data => renderDataLine(contextApiInfo, mobilePeriod, mobilePeriodAverageTemperature, withPowerComparison, isDesktop, data)))
|
|
155
153
|
}];
|
|
156
|
-
};
|
|
154
|
+
};
|
|
155
|
+
exports.mobileGetTableLines = mobileGetTableLines;
|
|
@@ -10,17 +10,27 @@ var _smartBillTypes = require("../../../../shared/types/smartBillTypes");
|
|
|
10
10
|
var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"));
|
|
11
11
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const ConsumptionAdvice = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
contextApiInfo
|
|
16
|
+
} = _ref;
|
|
17
|
+
const {
|
|
18
|
+
config,
|
|
19
|
+
assets,
|
|
20
|
+
Label,
|
|
21
|
+
Button,
|
|
22
|
+
ExternalLink
|
|
23
|
+
} = contextApiInfo;
|
|
24
|
+
const {
|
|
25
|
+
texts,
|
|
26
|
+
stylesConfig
|
|
27
|
+
} = config;
|
|
28
|
+
const {
|
|
29
|
+
consumptionSimulator
|
|
30
|
+
} = config.externalLinks;
|
|
31
|
+
const {
|
|
32
|
+
LightBulbIcon
|
|
33
|
+
} = assets;
|
|
24
34
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
35
|
className: "".concat(_stylesModule.default.container, " ").concat(stylesConfig === null || stylesConfig === void 0 ? void 0 : stylesConfig.adviceContainer)
|
|
26
36
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getSeasonProps = void 0;
|
|
7
7
|
var _seasons = require("../../../../shared/constants/seasons");
|
|
8
|
-
|
|
8
|
+
const getSeasonProps = (season, texts) => {
|
|
9
9
|
switch (season) {
|
|
10
10
|
case _seasons.SEASONS.AUTUMN:
|
|
11
11
|
return {
|
|
@@ -30,4 +30,5 @@ var getSeasonProps = exports.getSeasonProps = function getSeasonProps(season, te
|
|
|
30
30
|
default:
|
|
31
31
|
return {};
|
|
32
32
|
}
|
|
33
|
-
};
|
|
33
|
+
};
|
|
34
|
+
exports.getSeasonProps = getSeasonProps;
|
|
@@ -12,20 +12,27 @@ var _aliases = require("../../../../shared/constants/aliases");
|
|
|
12
12
|
var _utils = require("./utils");
|
|
13
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
const PercentageComparison = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
contextApiInfo,
|
|
18
|
+
savingsPercentage,
|
|
19
|
+
multipleSettlements
|
|
20
|
+
} = _ref;
|
|
21
|
+
const {
|
|
22
|
+
assets,
|
|
23
|
+
config,
|
|
24
|
+
Label
|
|
25
|
+
} = contextApiInfo;
|
|
26
|
+
const {
|
|
27
|
+
texts
|
|
28
|
+
} = config;
|
|
29
|
+
const {
|
|
30
|
+
Icon,
|
|
31
|
+
sign,
|
|
32
|
+
value,
|
|
33
|
+
background,
|
|
34
|
+
text
|
|
35
|
+
} = (0, _utils.getProps)(savingsPercentage, assets, texts, multipleSettlements);
|
|
29
36
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
37
|
className: "".concat(_stylesModule.default.container, " ").concat(background)
|
|
31
38
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -6,15 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getProps = void 0;
|
|
7
7
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const getProps = (savingsPercentage, assets, texts, multipleSettlements) => {
|
|
10
|
+
const {
|
|
11
|
+
consumptionComparison
|
|
12
|
+
} = texts;
|
|
13
|
+
const {
|
|
14
|
+
lastYearBimesterPercentageComparisonDescended,
|
|
15
|
+
lastYearPercentageComparisonDescended,
|
|
16
|
+
lastYearBimesterPercentageComparisonRise,
|
|
17
|
+
lastYearPercentageComparisonRise,
|
|
18
|
+
lastYearPercentageStatic
|
|
19
|
+
} = consumptionComparison;
|
|
20
|
+
const reductionText = multipleSettlements ? lastYearBimesterPercentageComparisonDescended : lastYearPercentageComparisonDescended;
|
|
21
|
+
const incrementText = multipleSettlements ? lastYearBimesterPercentageComparisonRise : lastYearPercentageComparisonRise;
|
|
18
22
|
if (savingsPercentage > 0) {
|
|
19
23
|
return {
|
|
20
24
|
Icon: assets.ConsumptionReductionIcon,
|
|
@@ -40,4 +44,5 @@ var getProps = exports.getProps = function getProps(savingsPercentage, assets, t
|
|
|
40
44
|
background: _stylesModule.default.consumptionInvariantBackground,
|
|
41
45
|
text: lastYearPercentageStatic
|
|
42
46
|
};
|
|
43
|
-
};
|
|
47
|
+
};
|
|
48
|
+
exports.getProps = getProps;
|
|
@@ -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
|
});
|
|
@@ -21,54 +20,51 @@ var _ConsumptionAdvice = _interopRequireDefault(require("./components/Consumptio
|
|
|
21
20
|
var _PercentageComparison = _interopRequireDefault(require("./components/PercentageComparison"));
|
|
22
21
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
23
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
function _getRequireWildcardCache(
|
|
25
|
-
function _interopRequireWildcard(
|
|
26
|
-
|
|
27
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
-
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); }
|
|
29
|
-
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; }
|
|
30
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
31
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
-
var ConsumptionComparison = function ConsumptionComparison(_ref) {
|
|
23
|
+
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); }
|
|
24
|
+
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; }
|
|
25
|
+
const ConsumptionComparison = _ref => {
|
|
33
26
|
var _currentPeriod$settle;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
27
|
+
let {
|
|
28
|
+
billData,
|
|
29
|
+
contextApiInfo
|
|
30
|
+
} = _ref;
|
|
31
|
+
const {
|
|
32
|
+
Label,
|
|
33
|
+
config,
|
|
34
|
+
assets
|
|
35
|
+
} = contextApiInfo;
|
|
36
|
+
const {
|
|
37
|
+
consumptionSimulatorFromBanner
|
|
38
|
+
} = config.externalLinks;
|
|
39
|
+
const {
|
|
40
|
+
showConsumptionComparisonBanner
|
|
41
|
+
} = config.validations;
|
|
42
|
+
const {
|
|
43
|
+
texts
|
|
44
|
+
} = config;
|
|
45
|
+
const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
|
|
46
|
+
const {
|
|
47
|
+
SimulatorBannerIcon,
|
|
48
|
+
SimulatorBannerResponsiveIcon
|
|
49
|
+
} = assets;
|
|
50
|
+
const withBanner = showConsumptionComparisonBanner(billData);
|
|
51
|
+
const [isDesktopSize, setIsDesktopSize] = (0, _react.useState)((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint));
|
|
52
|
+
const handleResizeScreen = () => setIsDesktopSize((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint));
|
|
53
|
+
(0, _react.useEffect)(() => {
|
|
54
54
|
window.addEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
55
55
|
handleResizeScreen();
|
|
56
|
-
return
|
|
57
|
-
return window.removeEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
58
|
-
};
|
|
56
|
+
return () => window.removeEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
59
57
|
}, []);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var scrollbarRef = (0, _react.useRef)();
|
|
71
|
-
(0, _react.useEffect)(function () {
|
|
58
|
+
const savingsPercentage = (0, _periods.getSavingsPercentage)(currentPeriod);
|
|
59
|
+
const showTemp = billData.previous_period_avg_temperature && billData.current_period_avg_temperature;
|
|
60
|
+
const multipleSettlements = (currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle = currentPeriod.settlements) === null || _currentPeriod$settle === void 0 ? void 0 : _currentPeriod$settle.total_settlements) > 1;
|
|
61
|
+
const ComparisonTableRender = () => /*#__PURE__*/_react.default.createElement(_ComparisonTable.default, {
|
|
62
|
+
billData: billData,
|
|
63
|
+
multipleSettlements: multipleSettlements,
|
|
64
|
+
isDesktopSize: isDesktopSize
|
|
65
|
+
});
|
|
66
|
+
const scrollbarRef = (0, _react.useRef)();
|
|
67
|
+
(0, _react.useEffect)(() => {
|
|
72
68
|
if (scrollbarRef.current) scrollbarRef.current.updateScroll();
|
|
73
69
|
}, [scrollbarRef]);
|
|
74
70
|
return /*#__PURE__*/_react.default.createElement("div", {
|
package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js
CHANGED
|
@@ -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
|
});
|
|
@@ -18,26 +17,32 @@ var _smartBillTypes = require("../../../../shared/types/smartBillTypes");
|
|
|
18
17
|
var _billDataTypes = require("../../../../shared/types/billDataTypes");
|
|
19
18
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
20
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
function _getRequireWildcardCache(
|
|
22
|
-
function _interopRequireWildcard(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
22
|
+
const ConsumptionEnergyComparison = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
contextApiInfo,
|
|
25
|
+
multipleSettlements,
|
|
26
|
+
withPercentage,
|
|
27
|
+
dataValidation,
|
|
28
|
+
currentConsumption,
|
|
29
|
+
remainingConsumption,
|
|
30
|
+
totalConsumption,
|
|
31
|
+
settlements,
|
|
32
|
+
periodicity,
|
|
33
|
+
periodNumber,
|
|
34
|
+
year,
|
|
35
|
+
savingsPercentage,
|
|
36
|
+
currentIsFirstSettlement
|
|
37
|
+
} = _ref;
|
|
38
|
+
const {
|
|
39
|
+
config,
|
|
40
|
+
Label
|
|
41
|
+
} = contextApiInfo;
|
|
42
|
+
const {
|
|
43
|
+
texts
|
|
44
|
+
} = config;
|
|
45
|
+
const CurrentSettlement = () => {
|
|
41
46
|
var _settlements$current;
|
|
42
47
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
48
|
className: _stylesModule.default.currentConsumptionContainer
|
|
@@ -55,7 +60,7 @@ var ConsumptionEnergyComparison = function ConsumptionEnergyComparison(_ref) {
|
|
|
55
60
|
alias: _aliases.CONSUMPTION_ACTUAL_DETAIL
|
|
56
61
|
}, texts.mainBillData.currentConsumption));
|
|
57
62
|
};
|
|
58
|
-
|
|
63
|
+
const RemainingSettlement = () => {
|
|
59
64
|
var _settlements$remainin;
|
|
60
65
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
61
66
|
className: _stylesModule.default.remainingConsumptionContainer
|
|
@@ -70,8 +70,8 @@ $border-radius: 5px;
|
|
|
70
70
|
.firstSettlementRemainingConsumptionLabel {
|
|
71
71
|
@extend %consumption-labels;
|
|
72
72
|
border: 1px solid $borders-gray;
|
|
73
|
-
border-right: 0;
|
|
74
73
|
border-bottom-left-radius: $border-radius;
|
|
74
|
+
border-right: 0;
|
|
75
75
|
border-top-left-radius: $border-radius;
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -11,19 +11,24 @@ var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"))
|
|
|
11
11
|
var _utils = require("../../../../utils");
|
|
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
|
-
classes =
|
|
21
|
-
numberAlias
|
|
22
|
-
unitAlias
|
|
23
|
-
daysAlias
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
const ConsumptionInDaysLabel = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
contextApiInfo,
|
|
17
|
+
consumption,
|
|
18
|
+
unit,
|
|
19
|
+
totalDays,
|
|
20
|
+
classes = {},
|
|
21
|
+
numberAlias,
|
|
22
|
+
unitAlias,
|
|
23
|
+
daysAlias
|
|
24
|
+
} = _ref;
|
|
25
|
+
const {
|
|
26
|
+
config,
|
|
27
|
+
Label
|
|
28
|
+
} = contextApiInfo;
|
|
29
|
+
const {
|
|
30
|
+
texts
|
|
31
|
+
} = config;
|
|
27
32
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
28
33
|
className: "".concat(classes.container)
|
|
29
34
|
}, /*#__PURE__*/_react.default.createElement("div", {
|