@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import '_sizes.scss';
|
|
2
|
+
|
|
3
|
+
$max-content-width: 1264px;
|
|
4
|
+
$tab-height: 48px;
|
|
5
|
+
|
|
6
|
+
.tabsContainer {
|
|
7
|
+
> button {
|
|
8
|
+
border-bottom: 1px solid var(--light04);
|
|
9
|
+
height: $tab-height;
|
|
10
|
+
max-width: unset;
|
|
11
|
+
min-height: $tab-height;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.contentContainer {
|
|
16
|
+
flex: 1;
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
max-height: calc(100vh - var(--workflowTopbarHeight) - #{$tab-height});
|
|
19
|
+
max-width: $max-content-width;
|
|
20
|
+
overflow-y: auto;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.tabLabel {
|
|
25
|
+
align-items: center;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
grid-gap: 8px;
|
|
29
|
+
|
|
30
|
+
svg {
|
|
31
|
+
margin-bottom: 0 !important;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.baseSelected {
|
|
36
|
+
svg {
|
|
37
|
+
stroke: var(--actionAccent04);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.loadingContainer {
|
|
42
|
+
align-items: center;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex: 1;
|
|
45
|
+
height: 100%;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TAG_ICON_SIZE = exports.DEFAULT_TAG_ICON = exports.DEFAULT_TAG_COLOR_THEME = void 0;
|
|
7
|
+
const DEFAULT_TAG_ICON = exports.DEFAULT_TAG_ICON = 'IconCalendarEvent';
|
|
8
|
+
const TAG_ICON_SIZE = exports.TAG_ICON_SIZE = 14;
|
|
9
|
+
const DEFAULT_TAG_COLOR_THEME = exports.DEFAULT_TAG_COLOR_THEME = 'gray';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _energyUi = require("@widergy/energy-ui");
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
var _billDataTypes = require("../../../../../../shared/types/billDataTypes");
|
|
12
|
+
var _utils = require("./utils");
|
|
13
|
+
var _constants = require("./constants");
|
|
14
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const Billing = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
smartBill,
|
|
19
|
+
texts
|
|
20
|
+
} = _ref;
|
|
21
|
+
const {
|
|
22
|
+
title,
|
|
23
|
+
tagLabel,
|
|
24
|
+
clarification,
|
|
25
|
+
periodDetail
|
|
26
|
+
} = texts?.billing || {};
|
|
27
|
+
const currentPeriod = smartBill?.periods.find(period => period.current);
|
|
28
|
+
const billingsToShow = (0, _utils.getBillingsToShow)(currentPeriod?.settlements);
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
+
className: _stylesModule.default.container
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
32
|
+
colorTheme: "gray",
|
|
33
|
+
variant: "small"
|
|
34
|
+
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
35
|
+
className: _stylesModule.default.details
|
|
36
|
+
}, billingsToShow.map(_ref2 => {
|
|
37
|
+
let {
|
|
38
|
+
colorTheme,
|
|
39
|
+
consumptions,
|
|
40
|
+
current,
|
|
41
|
+
icon,
|
|
42
|
+
issued_on: issuedOn,
|
|
43
|
+
number
|
|
44
|
+
} = _ref2;
|
|
45
|
+
const monthName = (0, _utils.getMonthName)(issuedOn);
|
|
46
|
+
const consumptionValue = consumptions?.[0].value;
|
|
47
|
+
const consumptionUnit = consumptions?.[0].unit;
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
key: issuedOn,
|
|
50
|
+
className: `${_stylesModule.default.billing} ${current ? _stylesModule.default.currentBilling : ''}`
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
+
className: _stylesModule.default.consumptionDetail
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
+
className: _stylesModule.default.consumption
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
56
|
+
variant: "title3",
|
|
57
|
+
weight: "medium"
|
|
58
|
+
}, consumptionValue), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
59
|
+
variant: "subtitle1",
|
|
60
|
+
weight: "medium"
|
|
61
|
+
}, consumptionUnit)), /*#__PURE__*/_react.default.createElement("div", {
|
|
62
|
+
className: `${_stylesModule.default.tag} ${current ? _stylesModule.default.billedTag : ''}`
|
|
63
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTIcon, {
|
|
64
|
+
colorTheme: colorTheme || _constants.DEFAULT_TAG_COLOR_THEME,
|
|
65
|
+
name: icon || _constants.DEFAULT_TAG_ICON,
|
|
66
|
+
size: _constants.TAG_ICON_SIZE
|
|
67
|
+
}), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
68
|
+
colorTheme: current ? 'success' : 'gray',
|
|
69
|
+
variant: "xsmall",
|
|
70
|
+
weight: "medium",
|
|
71
|
+
withMarkdown: true
|
|
72
|
+
}, tagLabel(current)))), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
73
|
+
colorTheme: "gray"
|
|
74
|
+
}, periodDetail({
|
|
75
|
+
monthName,
|
|
76
|
+
number
|
|
77
|
+
})));
|
|
78
|
+
})), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
79
|
+
className: _stylesModule.default.clarifications,
|
|
80
|
+
withMarkdown: true
|
|
81
|
+
}, clarification({
|
|
82
|
+
firstMonth: (0, _lodash.capitalize)((0, _utils.getMonthName)(billingsToShow?.[1]?.issued_on)),
|
|
83
|
+
secondMonth: (0, _lodash.capitalize)((0, _utils.getMonthName)(billingsToShow?.[0]?.issued_on))
|
|
84
|
+
})));
|
|
85
|
+
};
|
|
86
|
+
Billing.propTypes = {
|
|
87
|
+
smartBill: _billDataTypes.billDataTypes,
|
|
88
|
+
texts: _propTypes.object
|
|
89
|
+
};
|
|
90
|
+
var _default = exports.default = Billing;
|
package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/styles.module.scss
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
background-color: var(--light01);
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
box-shadow: var(--shadowGrayBottom1);
|
|
5
|
+
flex: 1;
|
|
6
|
+
height: fit-content;
|
|
7
|
+
padding: 24px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.details {
|
|
11
|
+
margin: 24px -24px 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.billing {
|
|
15
|
+
border-bottom: 1px solid var(--light04);
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
grid-gap: 12px;
|
|
19
|
+
padding: 16px 24px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.currentBilling {
|
|
23
|
+
background-color: var(--semanticSuccess01);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.consumption {
|
|
27
|
+
align-items: flex-end;
|
|
28
|
+
display: flex;
|
|
29
|
+
grid-gap: 8px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.consumptionDetail {
|
|
33
|
+
align-items: center;
|
|
34
|
+
display: flex;
|
|
35
|
+
grid-gap: 12px;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.tag {
|
|
40
|
+
align-items: center;
|
|
41
|
+
background-color: var(--light04);
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
display: flex;
|
|
44
|
+
grid-gap: 4px;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
padding: 4px 8px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.billedTag {
|
|
50
|
+
background-color: var(--semanticSuccess02);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.clarifications {
|
|
54
|
+
padding: 16px 0;
|
|
55
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getMonthName = exports.getConsumptionLabel = exports.getBillingsToShow = void 0;
|
|
7
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
8
|
+
require("dayjs/locale/es");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
_dayjs.default.locale('es');
|
|
11
|
+
const getBillingsToShow = settlements => {
|
|
12
|
+
const currentBilling = {
|
|
13
|
+
...settlements?.current,
|
|
14
|
+
colorTheme: 'success',
|
|
15
|
+
current: true,
|
|
16
|
+
icon: 'IconCheck'
|
|
17
|
+
};
|
|
18
|
+
const remainingBillings = settlements?.remaining || [];
|
|
19
|
+
return [currentBilling, ...remainingBillings];
|
|
20
|
+
};
|
|
21
|
+
exports.getBillingsToShow = getBillingsToShow;
|
|
22
|
+
const getMonthName = date => (0, _dayjs.default)(date).format('MMMM');
|
|
23
|
+
exports.getMonthName = getMonthName;
|
|
24
|
+
const getConsumptionLabel = consumptions => {
|
|
25
|
+
const consumption = consumptions?.[0];
|
|
26
|
+
const {
|
|
27
|
+
value,
|
|
28
|
+
unit
|
|
29
|
+
} = consumption || {};
|
|
30
|
+
return `${value} ${unit}`;
|
|
31
|
+
};
|
|
32
|
+
exports.getConsumptionLabel = getConsumptionLabel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CONSUMPTION_CARDS = void 0;
|
|
7
|
+
const CONSUMPTION_CARDS = exports.CONSUMPTION_CARDS = [{
|
|
8
|
+
icon: 'EnergyIconConsumptionBoxFilled',
|
|
9
|
+
key: 'consumptionCalculationCard'
|
|
10
|
+
}, {
|
|
11
|
+
icon: 'IconReceipt2',
|
|
12
|
+
key: 'billingCard'
|
|
13
|
+
}];
|
package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _energyUi = require("@widergy/energy-ui");
|
|
9
|
+
var _propTypes = require("prop-types");
|
|
10
|
+
var _constants = require("./constants");
|
|
11
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const BimestralConsumption = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
assets,
|
|
16
|
+
texts
|
|
17
|
+
} = _ref;
|
|
18
|
+
const bimestralConsumptionTexts = texts?.bimestralConsumption;
|
|
19
|
+
const {
|
|
20
|
+
title: bimestralTitle,
|
|
21
|
+
description: bimestralDescription
|
|
22
|
+
} = bimestralConsumptionTexts || {};
|
|
23
|
+
const {
|
|
24
|
+
BackgroundVector
|
|
25
|
+
} = assets?.bimestral || {};
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
|
+
className: _stylesModule.default.bimestralConsumption
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
29
|
+
className: _stylesModule.default.bimestralConsumptionTitles
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
31
|
+
variant: "title3",
|
|
32
|
+
weight: "medium"
|
|
33
|
+
}, bimestralTitle), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, null, bimestralDescription)), /*#__PURE__*/_react.default.createElement("div", {
|
|
34
|
+
className: _stylesModule.default.bimestralConsumptionCards
|
|
35
|
+
}, _constants.CONSUMPTION_CARDS.map(_ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
icon,
|
|
38
|
+
key
|
|
39
|
+
} = _ref2;
|
|
40
|
+
const title = bimestralConsumptionTexts?.[key]?.title;
|
|
41
|
+
const description = bimestralConsumptionTexts?.[key]?.description;
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_energyUi.UTActionCard, {
|
|
43
|
+
adornment: {
|
|
44
|
+
position: 'left',
|
|
45
|
+
type: 'icon',
|
|
46
|
+
props: {
|
|
47
|
+
colorTheme: 'accent',
|
|
48
|
+
name: icon,
|
|
49
|
+
shade: '04',
|
|
50
|
+
size: 100
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
BackgroundImage: BackgroundVector,
|
|
54
|
+
classNames: {
|
|
55
|
+
backgroundImage: _stylesModule.default.backgroundImage,
|
|
56
|
+
container: _stylesModule.default.bimestralConsumptionCardContainer,
|
|
57
|
+
header: _stylesModule.default.bimestralConsumptionCardHeader
|
|
58
|
+
},
|
|
59
|
+
description: description,
|
|
60
|
+
descriptionProps: {
|
|
61
|
+
className: _stylesModule.default.bimestralConsumptionCardDescription,
|
|
62
|
+
withMarkdown: true
|
|
63
|
+
},
|
|
64
|
+
key: key,
|
|
65
|
+
size: "small",
|
|
66
|
+
title: title,
|
|
67
|
+
titleProps: {
|
|
68
|
+
variant: 'subtitle2',
|
|
69
|
+
weight: 'medium'
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
})));
|
|
73
|
+
};
|
|
74
|
+
BimestralConsumption.propTypes = {
|
|
75
|
+
assets: _propTypes.object,
|
|
76
|
+
texts: _propTypes.object
|
|
77
|
+
};
|
|
78
|
+
var _default = exports.default = BimestralConsumption;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
$bimestral-consumption-card-min-width: 328px;
|
|
2
|
+
|
|
3
|
+
.bimestralConsumption {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
grid-gap: 24px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.bimestralConsumptionTitles {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
grid-gap: 8px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.bimestralConsumptionCards {
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
grid-gap: 32px;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.bimestralConsumptionCardHeader {
|
|
24
|
+
align-items: center;
|
|
25
|
+
grid-gap: 12px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.bimestralConsumptionCardContainer {
|
|
29
|
+
flex: 1;
|
|
30
|
+
min-width: $bimestral-consumption-card-min-width;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.bimestralConsumptionCardDescription {
|
|
34
|
+
strong {
|
|
35
|
+
color: var(--actionAccent05);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.backgroundImage {
|
|
40
|
+
height: 120%;
|
|
41
|
+
object-fit: cover;
|
|
42
|
+
right: -20%;
|
|
43
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SCALE_FACTOR = exports.MIN_HEIGHT = exports.MAX_HEIGHT = void 0;
|
|
7
|
+
const MIN_HEIGHT = exports.MIN_HEIGHT = 8;
|
|
8
|
+
const MAX_HEIGHT = exports.MAX_HEIGHT = 160;
|
|
9
|
+
const SCALE_FACTOR = exports.SCALE_FACTOR = 6;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _energyUi = require("@widergy/energy-ui");
|
|
9
|
+
var _billDataTypes = require("@widergy/utilitygo-smart-bill-web/dist/shared/types/billDataTypes");
|
|
10
|
+
var _propTypes = require("prop-types");
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
const ConsumptionComparison = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
periodsToCompare = [],
|
|
19
|
+
texts
|
|
20
|
+
} = _ref;
|
|
21
|
+
const maxValue = (0, _utils.getMaxValue)(periodsToCompare);
|
|
22
|
+
const title = texts?.consumptions?.comparisonTitle;
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
24
|
+
className: _stylesModule.default.consumptionComparisonLabel,
|
|
25
|
+
colorTheme: "gray",
|
|
26
|
+
variant: "small"
|
|
27
|
+
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
+
className: _stylesModule.default.container
|
|
29
|
+
}, periodsToCompare.map(_ref2 => {
|
|
30
|
+
let {
|
|
31
|
+
consumptions,
|
|
32
|
+
current,
|
|
33
|
+
number,
|
|
34
|
+
settlements,
|
|
35
|
+
year
|
|
36
|
+
} = _ref2;
|
|
37
|
+
const {
|
|
38
|
+
value,
|
|
39
|
+
unit
|
|
40
|
+
} = consumptions?.[0] || {};
|
|
41
|
+
const barHeight = (0, _utils.getBarHeight)(maxValue, value);
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
key: number + year,
|
|
44
|
+
className: _stylesModule.default.barContainer
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
46
|
+
className: _stylesModule.default.value,
|
|
47
|
+
variant: "small"
|
|
48
|
+
}, (0, _utils.getFormattedValue)(value, unit)), /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
className: `${_stylesModule.default.bar} ${current ? _stylesModule.default.currentBar : ''}`,
|
|
50
|
+
style: {
|
|
51
|
+
height: `${barHeight}px`
|
|
52
|
+
}
|
|
53
|
+
}), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
54
|
+
className: _stylesModule.default.year,
|
|
55
|
+
variant: "small",
|
|
56
|
+
weight: "medium"
|
|
57
|
+
}, year), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
58
|
+
className: _stylesModule.default.period,
|
|
59
|
+
colorTheme: "gray",
|
|
60
|
+
variant: "small"
|
|
61
|
+
}, (0, _utils.getPeriod)(settlements)));
|
|
62
|
+
})));
|
|
63
|
+
};
|
|
64
|
+
ConsumptionComparison.propTypes = {
|
|
65
|
+
periodsToCompare: _billDataTypes.periodsTypes,
|
|
66
|
+
texts: _propTypes.object
|
|
67
|
+
};
|
|
68
|
+
var _default = exports.default = ConsumptionComparison;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.consumptionComparisonLabel {
|
|
2
|
+
margin: 12px 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
align-items: flex-end;
|
|
7
|
+
display: flex;
|
|
8
|
+
grid-gap: 16px;
|
|
9
|
+
height: 240px;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.barContainer {
|
|
14
|
+
align-items: center;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex: 1;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
height: 100%;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.bar {
|
|
23
|
+
background: var(--chartGradientVertical2);
|
|
24
|
+
border-radius: 6px 6px 0 0;
|
|
25
|
+
transition: height 0.3s ease;
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.currentBar {
|
|
30
|
+
background: var(--chartGradientVertical1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.value {
|
|
34
|
+
margin: 12px 0 4px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.year {
|
|
38
|
+
margin-top: 12px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.period {
|
|
42
|
+
color: var(--gray02);
|
|
43
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getPeriod = exports.getMaxValue = exports.getFormattedValue = exports.getBarHeight = void 0;
|
|
7
|
+
var _lodash = require("lodash");
|
|
8
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
+
var _numeral = _interopRequireDefault(require("numeral"));
|
|
10
|
+
require("dayjs/locale/es");
|
|
11
|
+
var _constants = require("./constants");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
_dayjs.default.locale('es');
|
|
14
|
+
const getMaxValue = consumptionData => Math.max(...consumptionData.map(d => d.consumptions?.[0]?.value || 0));
|
|
15
|
+
exports.getMaxValue = getMaxValue;
|
|
16
|
+
const getBarHeight = (maxValue, value) => {
|
|
17
|
+
const adjustedValue = value ** _constants.SCALE_FACTOR;
|
|
18
|
+
const adjustedMax = maxValue ** _constants.SCALE_FACTOR;
|
|
19
|
+
return _constants.MIN_HEIGHT + adjustedValue / adjustedMax * (_constants.MAX_HEIGHT - _constants.MIN_HEIGHT);
|
|
20
|
+
};
|
|
21
|
+
exports.getBarHeight = getBarHeight;
|
|
22
|
+
const getPeriod = function () {
|
|
23
|
+
let settlements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
24
|
+
const {
|
|
25
|
+
end_date: endDate,
|
|
26
|
+
start_date: startDate
|
|
27
|
+
} = settlements;
|
|
28
|
+
const previousMonth = (0, _dayjs.default)(startDate);
|
|
29
|
+
const currentMonth = (0, _dayjs.default)(endDate);
|
|
30
|
+
const formattedPeriod = `${(0, _lodash.capitalize)(previousMonth.format('MMM'))} - ${(0, _lodash.capitalize)(currentMonth.format('MMM'))}`;
|
|
31
|
+
return formattedPeriod;
|
|
32
|
+
};
|
|
33
|
+
exports.getPeriod = getPeriod;
|
|
34
|
+
const getFormattedValue = (value, unit) => value ? `${(0, _numeral.default)(value).format('0,0.[00]')} ${unit || ''}` : '-';
|
|
35
|
+
exports.getFormattedValue = getFormattedValue;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _energyUi = require("@widergy/energy-ui");
|
|
9
|
+
var _propTypes = require("prop-types");
|
|
10
|
+
var _billDataTypes = require("@widergy/utilitygo-smart-bill-web/dist/shared/types/billDataTypes");
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const ConsumptionEvolution = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
assets,
|
|
17
|
+
periods,
|
|
18
|
+
texts
|
|
19
|
+
} = _ref;
|
|
20
|
+
const {
|
|
21
|
+
consumptionEvolution: backgroundImages
|
|
22
|
+
} = assets || {};
|
|
23
|
+
const {
|
|
24
|
+
consumptionEvolution: consumptionEvolutionLabels
|
|
25
|
+
} = texts || {};
|
|
26
|
+
const {
|
|
27
|
+
title
|
|
28
|
+
} = consumptionEvolutionLabels || {};
|
|
29
|
+
const {
|
|
30
|
+
colorTheme,
|
|
31
|
+
description,
|
|
32
|
+
icon,
|
|
33
|
+
Image,
|
|
34
|
+
percentage,
|
|
35
|
+
period
|
|
36
|
+
} = (0, _utils.getConsumptionComparison)(backgroundImages, consumptionEvolutionLabels, periods);
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_energyUi.UTActionCard, {
|
|
38
|
+
BackgroundImage: Image,
|
|
39
|
+
classNames: {
|
|
40
|
+
container: _stylesModule.default.container,
|
|
41
|
+
backgroundImage: _stylesModule.default.backgroundImage
|
|
42
|
+
},
|
|
43
|
+
description: description,
|
|
44
|
+
title: title,
|
|
45
|
+
titleProps: {
|
|
46
|
+
variant: 'subtitle1',
|
|
47
|
+
weight: 'medium'
|
|
48
|
+
}
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
50
|
+
className: _stylesModule.default.childrenContainer
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
+
className: _stylesModule.default.chipContainer
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTIcon, {
|
|
54
|
+
area: true,
|
|
55
|
+
colorTheme: colorTheme,
|
|
56
|
+
name: icon,
|
|
57
|
+
shade: "04",
|
|
58
|
+
size: 24
|
|
59
|
+
}), percentage && /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
60
|
+
colorTheme: colorTheme,
|
|
61
|
+
variant: "title2",
|
|
62
|
+
weight: "medium"
|
|
63
|
+
}, percentage)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
64
|
+
colorTheme: colorTheme
|
|
65
|
+
}, period)));
|
|
66
|
+
};
|
|
67
|
+
ConsumptionEvolution.propTypes = {
|
|
68
|
+
assets: _propTypes.object,
|
|
69
|
+
periods: _billDataTypes.periodsTypes,
|
|
70
|
+
texts: _propTypes.object
|
|
71
|
+
};
|
|
72
|
+
var _default = exports.default = ConsumptionEvolution;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
background-color: var(--light02);
|
|
3
|
+
box-shadow: none;
|
|
4
|
+
margin-top: 32px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.backgroundImage {
|
|
8
|
+
right: 0;
|
|
9
|
+
width: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.chipContainer {
|
|
13
|
+
align-items: center;
|
|
14
|
+
background-color: var(--light01);
|
|
15
|
+
border-radius: 100px;
|
|
16
|
+
box-shadow: var(--shadow);
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
grid-gap: 8px;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
padding: 4px 8px;
|
|
22
|
+
width: fit-content;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.childrenContainer {
|
|
26
|
+
align-items: center;
|
|
27
|
+
display: flex;
|
|
28
|
+
grid-gap: 12px;
|
|
29
|
+
}
|