@widergy/utilitygo-smart-bill-web 3.0.4 → 3.2.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 +19 -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/SmartBillSummary/constants.js +25 -0
- package/dist/components/SmartBillSummary/index.js +70 -0
- package/dist/components/SmartBillSummary/styles.module.scss +48 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/constants.js +9 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/index.js +90 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/styles.module.scss +55 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/utils.js +32 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/constants.js +13 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/index.js +78 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/styles.module.scss +43 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/constants.js +9 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/index.js +68 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/styles.module.scss +43 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/utils.js +35 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionEvolution/index.js +72 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionEvolution/styles.module.scss +29 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionEvolution/utils.js +71 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/index.js +64 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/styles.module.scss +22 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/utils.js +56 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/index.js +54 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/styles.module.scss +31 -0
- package/dist/components/SmartBillSummary/utils.js +30 -0
- 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 +15 -1
- package/dist/shared/Context/index.js +1 -1
- package/dist/shared/constants/tabs.js +11 -0
- 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
|
@@ -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) {
|