@widergy/utilitygo-smart-bill-web 1.10.0 → 1.12.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 +28 -0
- package/dist/components/Advice/index.js +6 -10
- package/dist/components/Amount/index.js +21 -26
- package/dist/components/Amount/utils.js +5 -1
- package/dist/components/Banner/index.js +6 -10
- package/dist/components/BarChart/constants.js +3 -3
- package/dist/components/BarChart/index.js +25 -28
- package/dist/components/BarChart/utils.js +15 -15
- package/dist/components/BillCalculation/components/ConceptCard/index.js +48 -47
- package/dist/components/BillCalculation/constants.js +1 -1
- package/dist/components/BillCalculation/index.js +54 -44
- package/dist/components/BillCalculation/utils.js +14 -17
- package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +25 -26
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/constants.js +9 -3
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +31 -34
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/styles.module.scss +2 -2
- package/dist/components/BillSummary/components/BilledConcepts/constants.js +14 -12
- package/dist/components/BillSummary/components/BilledConcepts/index.js +49 -31
- package/dist/components/BillSummary/components/BilledConcepts/utils.js +76 -44
- package/dist/components/BillSummary/index.js +78 -76
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +8 -8
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +12 -17
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +1 -1
- package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +135 -148
- package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +14 -16
- package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +94 -89
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +11 -21
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +1 -1
- package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +16 -21
- package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +9 -13
- package/dist/components/ConsumptionComparison/index.js +56 -42
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +26 -30
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +13 -18
- package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +15 -17
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +17 -21
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +1 -1
- package/dist/components/ConsumptionEnergyDetails/index.js +47 -51
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +65 -66
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +13 -11
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +19 -22
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +10 -16
- package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +39 -43
- package/dist/components/ConsumptionIncluded/index.js +36 -34
- package/dist/components/ConsumptionIncluded/utils.js +33 -29
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +10 -14
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +22 -25
- package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +34 -18
- package/dist/components/ConsumptionPeriod/components/Reading/index.js +34 -37
- package/dist/components/ConsumptionPeriod/index.js +8 -12
- package/dist/components/ConsumptionPeriod/utils.js +15 -13
- package/dist/components/Date/index.js +9 -12
- package/dist/components/DebtState/index.js +8 -14
- package/dist/components/IconAndDetails/index.js +17 -19
- package/dist/components/Magnitude/index.js +12 -15
- package/dist/components/Magnitude/utils.js +8 -2
- package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +16 -20
- package/dist/components/MainBillData/components/BillAlert/index.js +45 -28
- package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +11 -19
- package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +11 -14
- package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +3 -1
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +15 -23
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +1 -1
- package/dist/components/MainBillData/components/BillBody/index.js +50 -45
- package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +9 -15
- package/dist/components/MainBillData/components/BillHeader/index.js +26 -29
- package/dist/components/MainBillData/index.js +5 -7
- package/dist/components/MainBillData/theme.js +9 -7
- package/dist/components/MainBillData/utils.js +5 -1
- package/dist/components/Period/index.js +47 -55
- package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +11 -15
- package/dist/components/PowerProgresBar/index.js +36 -36
- package/dist/components/RateAndCategory/index.js +31 -30
- package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +13 -20
- package/dist/components/RatesDefinition/components/BillRate/index.js +14 -24
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +9 -14
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +21 -26
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +13 -19
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/styles.module.scss +1 -4
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +13 -56
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +50 -0
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/styles.module.scss +34 -0
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +65 -0
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/styles.module.scss +88 -0
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +6 -37
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +51 -16
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/styles.module.scss +4 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +68 -23
- package/dist/components/RatesDefinition/components/CategoryByConsumption/constants.js +42 -0
- package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +45 -36
- package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +16 -0
- package/dist/components/RatesDefinition/components/PurchasedRate/index.js +13 -19
- package/dist/components/RatesDefinition/index.js +15 -20
- package/dist/components/SmartBillProvider/index.js +47 -12
- package/dist/components/StyledAmount/constants.js +1 -1
- package/dist/components/StyledAmount/index.js +35 -19
- package/dist/components/WithContextApi/index.js +27 -16
- package/dist/components/WithContextApi/layout.js +2 -2
- package/dist/components/WithSeason/index.js +9 -5
- package/dist/constants/deviceSizes.js +17 -27
- package/dist/constants/seasons.js +2 -2
- package/dist/index.js +16 -14
- package/dist/shared/Context/index.js +3 -5
- package/dist/shared/constants/aliases.js +550 -683
- package/dist/shared/constants/components.js +2 -1
- package/dist/shared/constants/consumptions.js +4 -4
- package/dist/shared/constants/periodicities.js +1 -1
- package/dist/shared/constants/rates.js +1 -1
- package/dist/shared/constants/readings.js +2 -2
- package/dist/shared/constants/seasons.js +2 -2
- package/dist/shared/constants/stagesGraph.js +4 -4
- package/dist/shared/types/assetsTypes.js +1 -1
- package/dist/shared/types/billDataTypes.js +4 -4
- package/dist/shared/types/componentsTypes.js +13 -18
- package/dist/shared/types/formattersTypes.js +1 -1
- package/dist/shared/types/rateStagesTypes.js +4 -4
- package/dist/shared/types/smartBillTypes.js +10 -5
- package/dist/shared/types/textsTypes.js +1 -1
- package/dist/shared/utils/billCalculation.js +9 -9
- package/dist/shared/utils/consumptions.js +62 -28
- package/dist/shared/utils/context.js +8 -7
- package/dist/shared/utils/expirations.js +5 -1
- package/dist/shared/utils/periods.js +20 -14
- package/dist/shared/utils/rates.js +5 -1
- package/dist/shared/utils/readings.js +10 -2
- package/dist/shared/utils/season.js +5 -1
- package/dist/shared/utils/stagesGraph.js +15 -11
- package/dist/utils/hooks.js +5 -37
- package/dist/utils.js +8 -4
- package/package.json +2 -2
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/utils.js +0 -27
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/LimitsLine/index.js +0 -21
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/LimitsLine/styles.module.scss +0 -15
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/index.js +0 -69
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/styles.module.scss +0 -5
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/utils.js +0 -12
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/index.js +0 -68
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/styles.module.scss +0 -32
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/index.js +0 -59
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/styles.module.scss +0 -3
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/index.js +0 -83
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/styles.module.scss +0 -57
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# [1.12.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.11.0...v1.12.0) (2022-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* rate stages step redesign and refactor ([#24](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/24)) ([3ac585b](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/3ac585b57ce1e426979cac80bcf4980978399339))
|
|
7
|
+
|
|
8
|
+
# [1.11.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.10.2...v1.11.0) (2022-01-04)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* 🌟 Migrated hooks to library 🌟 ([#17](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/17)) ([464d5c8](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/464d5c8f32de3d1b2255fd8a458a0bee540862bb))
|
|
14
|
+
|
|
15
|
+
## [1.10.2](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.10.1...v1.10.2) (2022-01-04)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* color priority in rate stages ([#22](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/22)) ([7062efa](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/7062efa3dcc0f6ff792e822e0dabf8fa8cd1b5da))
|
|
21
|
+
|
|
22
|
+
## [1.10.1](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.10.0...v1.10.1) (2021-12-10)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* removed recharts ([#20](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/20)) ([01a9e74](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/01a9e74da24ae7788f92c20719690450559985a8))
|
|
28
|
+
|
|
1
29
|
# [1.10.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.9.0...v1.10.0) (2021-11-17)
|
|
2
30
|
|
|
3
31
|
|
|
@@ -19,16 +19,12 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
assets,
|
|
30
|
-
Label
|
|
31
|
-
} = contextApiInfo;
|
|
22
|
+
var Advice = function Advice(_ref) {
|
|
23
|
+
var contextApiInfo = _ref.contextApiInfo,
|
|
24
|
+
title = _ref.title,
|
|
25
|
+
contentText = _ref.contentText;
|
|
26
|
+
var assets = contextApiInfo.assets,
|
|
27
|
+
Label = contextApiInfo.Label;
|
|
32
28
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
33
29
|
className: _stylesModule.default.container
|
|
34
30
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -27,32 +27,25 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
var Amount = function Amount(_ref) {
|
|
31
31
|
var _expirations$;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
firstExpirationDateBrief,
|
|
50
|
-
secondExpirationDateBrief,
|
|
51
|
-
currency
|
|
52
|
-
} = config.texts.commons;
|
|
53
|
-
const isBrief = useBriefExpiration && firstExpirationDateBrief && secondExpirationDateBrief;
|
|
54
|
-
const firstText = isBrief ? firstExpirationDateBrief : firstExpirationDate;
|
|
55
|
-
const expirations = [{
|
|
33
|
+
var contextApiInfo = _ref.contextApiInfo,
|
|
34
|
+
billData = _ref.billData,
|
|
35
|
+
containerClassName = _ref.containerClassName,
|
|
36
|
+
withBottomMargin = _ref.withBottomMargin;
|
|
37
|
+
var config = contextApiInfo.config,
|
|
38
|
+
Label = contextApiInfo.Label;
|
|
39
|
+
var useBriefExpiration = config.useBriefExpiration;
|
|
40
|
+
var _config$texts$commons = config.texts.commons,
|
|
41
|
+
amountTitle = _config$texts$commons.amountTitle,
|
|
42
|
+
firstExpirationDate = _config$texts$commons.firstExpirationDate,
|
|
43
|
+
firstExpirationDateBrief = _config$texts$commons.firstExpirationDateBrief,
|
|
44
|
+
secondExpirationDateBrief = _config$texts$commons.secondExpirationDateBrief,
|
|
45
|
+
currency = _config$texts$commons.currency;
|
|
46
|
+
var isBrief = useBriefExpiration && firstExpirationDateBrief && secondExpirationDateBrief;
|
|
47
|
+
var firstText = isBrief ? firstExpirationDateBrief : firstExpirationDate;
|
|
48
|
+
var expirations = [{
|
|
56
49
|
text: firstText,
|
|
57
50
|
expiration: (0, _expirations.getExpiration)(billData, 1)
|
|
58
51
|
}, isBrief && {
|
|
@@ -60,7 +53,7 @@ const Amount = _ref => {
|
|
|
60
53
|
expiration: (0, _expirations.getExpiration)(billData, 2)
|
|
61
54
|
}];
|
|
62
55
|
|
|
63
|
-
|
|
56
|
+
var getExpirationComponent = function getExpirationComponent(item) {
|
|
64
57
|
var _item$expiration;
|
|
65
58
|
|
|
66
59
|
return (item === null || item === void 0 ? void 0 : (_item$expiration = item.expiration) === null || _item$expiration === void 0 ? void 0 : _item$expiration.date) && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -87,7 +80,9 @@ const Amount = _ref => {
|
|
|
87
80
|
amount: (_expirations$ = expirations[0]) === null || _expirations$ === void 0 ? void 0 : _expirations$.expiration.amount
|
|
88
81
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
89
82
|
className: _stylesModule.default.expirations
|
|
90
|
-
}, expirations.map(
|
|
83
|
+
}, expirations.map(function (exp) {
|
|
84
|
+
return getExpirationComponent(exp);
|
|
85
|
+
})));
|
|
91
86
|
};
|
|
92
87
|
|
|
93
88
|
Amount.propTypes = {
|
|
@@ -7,6 +7,10 @@ exports.getFirstExpiration = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _seamlessImmutable = require("seamless-immutable");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var getFirstExpiration = function getFirstExpiration(billData) {
|
|
11
|
+
return (0, _seamlessImmutable.getIn)(billData, ['expirations'], []).find(function (expiration) {
|
|
12
|
+
return expiration.number === 1;
|
|
13
|
+
}) || {};
|
|
14
|
+
};
|
|
11
15
|
|
|
12
16
|
exports.getFirstExpiration = getFirstExpiration;
|
|
@@ -15,16 +15,12 @@ var _WithContextApi = _interopRequireDefault(require("../WithContextApi"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref;
|
|
25
|
-
const {
|
|
26
|
-
ExternalLink
|
|
27
|
-
} = contextApiInfo;
|
|
18
|
+
var Banner = function Banner(_ref) {
|
|
19
|
+
var contextApiInfo = _ref.contextApiInfo,
|
|
20
|
+
image = _ref.image,
|
|
21
|
+
styleBanner = _ref.styleBanner,
|
|
22
|
+
externalLink = _ref.externalLink;
|
|
23
|
+
var ExternalLink = contextApiInfo.ExternalLink;
|
|
28
24
|
return /*#__PURE__*/_react.default.createElement(ExternalLink, {
|
|
29
25
|
key: externalLink,
|
|
30
26
|
url: externalLink
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RESPONSIVE_BAR_WIDTH = exports.DESKTOP_BAR_WIDTH = exports.BAR_CHART_CONFIG = void 0;
|
|
7
|
-
|
|
7
|
+
var BAR_CHART_CONFIG = {
|
|
8
8
|
spacingOptions: {
|
|
9
9
|
axisPadding: 10,
|
|
10
10
|
scrollPadding: 0,
|
|
@@ -18,7 +18,7 @@ const BAR_CHART_CONFIG = {
|
|
|
18
18
|
hideYAxis: true
|
|
19
19
|
};
|
|
20
20
|
exports.BAR_CHART_CONFIG = BAR_CHART_CONFIG;
|
|
21
|
-
|
|
21
|
+
var DESKTOP_BAR_WIDTH = 40;
|
|
22
22
|
exports.DESKTOP_BAR_WIDTH = DESKTOP_BAR_WIDTH;
|
|
23
|
-
|
|
23
|
+
var RESPONSIVE_BAR_WIDTH = 90;
|
|
24
24
|
exports.RESPONSIVE_BAR_WIDTH = RESPONSIVE_BAR_WIDTH;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -23,40 +25,35 @@ var _constants = require("./constants");
|
|
|
23
25
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
29
|
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
31
|
|
|
30
32
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
var BarChartSection = function BarChartSection(_ref) {
|
|
33
35
|
var _colors$barChart;
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const {
|
|
56
|
-
processedData,
|
|
57
|
-
xAxisDefinition
|
|
58
|
-
} = (0, _react.useMemo)(() => (0, _utils.getProcessedData)(data, colors.barChart), [data]);
|
|
59
|
-
const yAxisLabel = unit && "".concat(texts.consumptionPeriod.consumption, " (").concat(unit, ")");
|
|
37
|
+
var contextApiInfo = _ref.contextApiInfo,
|
|
38
|
+
data = _ref.data,
|
|
39
|
+
isDesktop = _ref.isDesktop,
|
|
40
|
+
unit = _ref.unit;
|
|
41
|
+
var BarChart = contextApiInfo.BarChart,
|
|
42
|
+
Label = contextApiInfo.Label,
|
|
43
|
+
config = contextApiInfo.config,
|
|
44
|
+
assets = contextApiInfo.assets;
|
|
45
|
+
var CalendarIcon = assets.CalendarIcon,
|
|
46
|
+
EnergyIcon = assets.EnergyIcon;
|
|
47
|
+
var texts = config.texts,
|
|
48
|
+
colors = config.colors;
|
|
49
|
+
|
|
50
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
51
|
+
return (0, _utils.getProcessedData)(data, colors.barChart);
|
|
52
|
+
}, [data]),
|
|
53
|
+
processedData = _useMemo.processedData,
|
|
54
|
+
xAxisDefinition = _useMemo.xAxisDefinition;
|
|
55
|
+
|
|
56
|
+
var yAxisLabel = unit && "".concat(texts.consumptionPeriod.consumption, " (").concat(unit, ")");
|
|
60
57
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
61
58
|
className: _stylesModule.default.sectionContainer
|
|
62
59
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
@@ -5,18 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getProcessedData = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
var getProcessedData = function getProcessedData(data) {
|
|
9
|
+
var colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
var getBarColor = function getBarColor(index) {
|
|
12
|
+
return index === 0 ? colors.first : index === data.length - 1 ? colors.last : colors.main;
|
|
13
|
+
};
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
var getLabelColor = function getLabelColor(index) {
|
|
16
|
+
return index === 0 ? colors.valueFirst : index === data.length - 1 ? colors.last : colors.valueMain;
|
|
17
|
+
};
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
consumption
|
|
19
|
-
} = _ref;
|
|
19
|
+
var processedData = data.map(function (_ref, index) {
|
|
20
|
+
var period = _ref.period,
|
|
21
|
+
consumption = _ref.consumption;
|
|
20
22
|
return {
|
|
21
23
|
value: consumption,
|
|
22
24
|
mainLabel: period,
|
|
@@ -25,18 +27,16 @@ const getProcessedData = function (data) {
|
|
|
25
27
|
onTopLabelColor: getLabelColor(index)
|
|
26
28
|
};
|
|
27
29
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
mainLabel
|
|
31
|
-
} = _ref2;
|
|
30
|
+
var xAxisDefinition = processedData.map(function (_ref2, index) {
|
|
31
|
+
var mainLabel = _ref2.mainLabel;
|
|
32
32
|
return {
|
|
33
|
-
mainLabel,
|
|
33
|
+
mainLabel: mainLabel,
|
|
34
34
|
color: getLabelColor(index)
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
38
|
processedData: [processedData],
|
|
39
|
-
xAxisDefinition
|
|
39
|
+
xAxisDefinition: xAxisDefinition
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -23,34 +23,29 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} = assets;
|
|
50
|
-
|
|
51
|
-
const handleOnClick = () => onClick(index);
|
|
52
|
-
|
|
53
|
-
const Header = /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
var ConceptCard = function ConceptCard(_ref) {
|
|
27
|
+
var contextApiInfo = _ref.contextApiInfo,
|
|
28
|
+
isOpen = _ref.isOpen,
|
|
29
|
+
onClick = _ref.onClick,
|
|
30
|
+
index = _ref.index,
|
|
31
|
+
titleHeader = _ref.titleHeader,
|
|
32
|
+
total = _ref.total,
|
|
33
|
+
_ref$lines = _ref.lines,
|
|
34
|
+
lines = _ref$lines === void 0 ? [] : _ref$lines;
|
|
35
|
+
var Card = contextApiInfo.Card,
|
|
36
|
+
Label = contextApiInfo.Label,
|
|
37
|
+
config = contextApiInfo.config,
|
|
38
|
+
assets = contextApiInfo.assets;
|
|
39
|
+
var showZeroConcepts = config.showZeroConcepts,
|
|
40
|
+
colors = config.colors;
|
|
41
|
+
var ArrowDownwardIcon = assets.ArrowDownwardIcon,
|
|
42
|
+
ArrowUpwardIcon = assets.ArrowUpwardIcon;
|
|
43
|
+
|
|
44
|
+
var handleOnClick = function handleOnClick() {
|
|
45
|
+
return onClick(index);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var Header = /*#__PURE__*/_react.default.createElement("div", {
|
|
54
49
|
className: _stylesModule.default.headerContainer
|
|
55
50
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
56
51
|
alias: _aliases.BILL_CALC_CONCEPT
|
|
@@ -61,30 +56,36 @@ const ConceptCard = _ref => {
|
|
|
61
56
|
variant: "xlarge"
|
|
62
57
|
}));
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
var handleRenderLines = function handleRenderLines(list) {
|
|
60
|
+
return (list.amount !== 0 || showZeroConcepts) && /*#__PURE__*/_react.default.createElement("div", {
|
|
61
|
+
className: _stylesModule.default.lineContainer,
|
|
62
|
+
key: list.title
|
|
63
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
className: _stylesModule.default.conceptLineContainer
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
66
|
+
alias: _aliases.CONCEPT_TITLE
|
|
67
|
+
}, list.title), /*#__PURE__*/_react.default.createElement(_StyledAmount.default, {
|
|
68
|
+
alias: _aliases.CONCEPT_LIST_AMOUNT,
|
|
69
|
+
aliasDecimal: _aliases.CONCEPT_LIST_AMOUNT_DECIMAL,
|
|
70
|
+
amount: list.amount,
|
|
71
|
+
variant: "large"
|
|
72
|
+
})), list.description && /*#__PURE__*/_react.default.createElement(Label, {
|
|
73
|
+
alias: _aliases.LINE_DESCRIPTION
|
|
74
|
+
}, list.description));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var iconsStyle = {
|
|
81
78
|
fill: colors.primary
|
|
82
79
|
};
|
|
83
80
|
return /*#__PURE__*/_react.default.createElement(Card, {
|
|
84
81
|
className: "".concat(_stylesModule.default.container, " ").concat((0, _array.isEmpty)(lines) && _stylesModule.default.containerWithoutLines),
|
|
85
82
|
expandableIconButtonClassName: _stylesModule.default.expandIcon,
|
|
86
|
-
ExpandedIcon: ArrowUpwardIcon && (
|
|
87
|
-
|
|
83
|
+
ExpandedIcon: ArrowUpwardIcon && function () {
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(ArrowUpwardIcon, iconsStyle);
|
|
85
|
+
},
|
|
86
|
+
NonExpandedIcon: ArrowDownwardIcon && function () {
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(ArrowDownwardIcon, iconsStyle);
|
|
88
|
+
},
|
|
88
89
|
expandableContentClassName: "".concat(isOpen && _stylesModule.default.expandableContent),
|
|
89
90
|
header: Header,
|
|
90
91
|
horizontal: true,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -25,50 +27,58 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
25
27
|
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
36
|
+
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."); }
|
|
37
|
+
|
|
38
|
+
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); }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
43
|
+
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
46
|
+
var BillCalculation = function BillCalculation(_ref) {
|
|
47
|
+
var billData = _ref.billData,
|
|
48
|
+
contextApiInfo = _ref.contextApiInfo;
|
|
49
|
+
var Label = contextApiInfo.Label,
|
|
50
|
+
config = contextApiInfo.config;
|
|
51
|
+
var texts = config.texts,
|
|
52
|
+
showZeroConcepts = config.showZeroConcepts,
|
|
53
|
+
stylesConfig = config.stylesConfig,
|
|
54
|
+
formatters = config.formatters,
|
|
55
|
+
colors = config.colors;
|
|
56
|
+
var periodFormatter = formatters.periodFormatter;
|
|
57
|
+
var withBillCalcTitleDate = config.validations.withBillCalcTitleDate;
|
|
58
|
+
var detail = billData.detail;
|
|
59
|
+
|
|
60
|
+
var _useState = (0, _react.useState)(null),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
openedConcept = _useState2[0],
|
|
63
|
+
setOpenedConcept = _useState2[1];
|
|
64
|
+
|
|
65
|
+
var handleClick = function handleClick(index) {
|
|
66
|
+
return setOpenedConcept(openedConcept !== index ? index : null);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var title = (0, _utils.periodToTitleMapper)(billData, texts, periodFormatter, withBillCalcTitleDate(billData));
|
|
70
|
+
|
|
71
|
+
var handleRenderConceptCard = function handleRenderConceptCard(concept, index) {
|
|
72
|
+
return (concept.total !== 0 || showZeroConcepts) && /*#__PURE__*/_react.default.createElement(_ConceptCard.default, {
|
|
73
|
+
titleHeader: concept.title,
|
|
74
|
+
total: concept.total,
|
|
75
|
+
lines: concept.lines,
|
|
76
|
+
index: index,
|
|
77
|
+
isOpen: openedConcept === index,
|
|
78
|
+
onClick: handleClick,
|
|
79
|
+
key: concept.title
|
|
80
|
+
});
|
|
81
|
+
};
|
|
72
82
|
|
|
73
83
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
74
84
|
className: _stylesModule.default.container
|
|
@@ -15,25 +15,22 @@ var _periods = require("../../shared/utils/periods");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
var periodToTitleMapper = function periodToTitleMapper(billData, texts, periodFormatter, withBillCalcTitleDate) {
|
|
19
19
|
var _settlements$current, _settlements$current2;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = texts.commons;
|
|
35
|
-
const issueedDate = settlements === null || settlements === void 0 ? void 0 : (_settlements$current2 = settlements.current) === null || _settlements$current2 === void 0 ? void 0 : _settlements$current2.issued_on;
|
|
36
|
-
const issuedDateLabel = withBillCalcTitleDate ? " (".concat((0, _dayjs.default)(issueedDate, 'YYYY-MM-DD').format('MM/YYYY'), ")") : '';
|
|
21
|
+
var currentPeriod = (0, _periods.getCurrentPeriod)(billData) || {};
|
|
22
|
+
var settlements = currentPeriod.settlements;
|
|
23
|
+
var periodicity = settlements === null || settlements === void 0 ? void 0 : settlements.periodicity;
|
|
24
|
+
var currentSettlement = (settlements === null || settlements === void 0 ? void 0 : (_settlements$current = settlements.current) === null || _settlements$current === void 0 ? void 0 : _settlements$current.number) || '-';
|
|
25
|
+
var totalSettlements = (settlements === null || settlements === void 0 ? void 0 : settlements.total_settlements) || '-';
|
|
26
|
+
var periodNumber = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.number) || '-';
|
|
27
|
+
var year = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.year) || '-';
|
|
28
|
+
var _texts$commons = texts.commons,
|
|
29
|
+
settlement = _texts$commons.settlement,
|
|
30
|
+
period = _texts$commons.period,
|
|
31
|
+
bimester = _texts$commons.bimester;
|
|
32
|
+
var issueedDate = settlements === null || settlements === void 0 ? void 0 : (_settlements$current2 = settlements.current) === null || _settlements$current2 === void 0 ? void 0 : _settlements$current2.issued_on;
|
|
33
|
+
var issuedDateLabel = withBillCalcTitleDate ? " (".concat((0, _dayjs.default)(issueedDate, 'YYYY-MM-DD').format('MM/YYYY'), ")") : '';
|
|
37
34
|
if (periodFormatter) return periodFormatter({
|
|
38
35
|
startDate: settlements === null || settlements === void 0 ? void 0 : settlements.start_date,
|
|
39
36
|
endDate: settlements === null || settlements === void 0 ? void 0 : settlements.end_date
|