@widergy/utilitygo-smart-bill-web 1.13.4 → 2.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 +21 -0
- package/dist/components/Advice/index.js +3 -14
- package/dist/components/Amount/index.js +11 -29
- package/dist/components/Amount/styles.module.scss +1 -2
- package/dist/components/Amount/utils.js +0 -3
- package/dist/components/Banner/index.js +3 -12
- package/dist/components/BarChart/index.js +12 -32
- package/dist/components/BarChart/styles.module.scss +5 -5
- package/dist/components/BarChart/utils.js +1 -6
- package/dist/components/BillCalculation/components/ConceptCard/index.js +31 -36
- package/dist/components/BillCalculation/components/Glossary/index.js +30 -50
- package/dist/components/BillCalculation/components/Glossary/styles.module.scss +0 -6
- package/dist/components/BillCalculation/index.js +13 -46
- package/dist/components/BillCalculation/utils.js +3 -15
- package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +11 -29
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +2 -15
- package/dist/components/BillSummary/components/BilledConcepts/constants.js +0 -4
- package/dist/components/BillSummary/components/BilledConcepts/index.js +11 -40
- package/dist/components/BillSummary/components/BilledConcepts/styles.module.scss +1 -1
- package/dist/components/BillSummary/components/BilledConcepts/utils.js +13 -38
- package/dist/components/BillSummary/index.js +7 -42
- package/dist/components/BillSummary/styles.module.scss +0 -4
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +0 -8
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +5 -20
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +0 -7
- package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +18 -39
- package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +2 -16
- package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +15 -37
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +8 -16
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +0 -7
- package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +12 -25
- package/dist/components/ConsumptionComparison/components/PercentageComparison/styles.module.scss +0 -10
- package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +4 -11
- package/dist/components/ConsumptionComparison/index.js +9 -44
- package/dist/components/ConsumptionComparison/styles.module.scss +0 -5
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +13 -38
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +9 -20
- package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +14 -26
- package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/styles.module.scss +0 -6
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +10 -24
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +0 -6
- package/dist/components/ConsumptionEnergyDetails/index.js +14 -41
- package/dist/components/ConsumptionEnergyDetails/styles.module.scss +2 -6
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +39 -55
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/styles.module.scss +2 -8
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +0 -3
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +7 -23
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/styles.module.scss +0 -4
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +4 -15
- package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +16 -33
- package/dist/components/ConsumptionIncluded/index.js +1 -18
- package/dist/components/ConsumptionIncluded/utils.js +2 -30
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +7 -19
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +12 -27
- package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +6 -30
- package/dist/components/ConsumptionPeriod/components/Reading/index.js +15 -33
- package/dist/components/ConsumptionPeriod/components/Reading/styles.module.scss +0 -1
- package/dist/components/ConsumptionPeriod/index.js +1 -20
- package/dist/components/ConsumptionPeriod/utils.js +0 -6
- package/dist/components/Date/index.js +6 -17
- package/dist/components/Date/styles.module.scss +2 -4
- package/dist/components/DebtState/index.js +6 -16
- package/dist/components/DebtState/styles.module.scss +2 -11
- package/dist/components/IconAndDetails/index.js +13 -26
- package/dist/components/Magnitude/index.js +18 -39
- package/dist/components/Magnitude/utils.js +0 -29
- package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +6 -17
- package/dist/components/MainBillData/components/BillAlert/index.js +12 -39
- package/dist/components/MainBillData/components/BillAlert/styles.module.scss +4 -1
- package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +5 -19
- package/dist/components/MainBillData/components/BillBody/components/ClientData/styles.module.scss +1 -3
- package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +4 -20
- package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +0 -2
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +16 -30
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +0 -5
- package/dist/components/MainBillData/components/BillBody/index.js +3 -35
- package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +7 -19
- package/dist/components/MainBillData/components/BillHeader/index.js +4 -27
- package/dist/components/MainBillData/index.js +1 -16
- package/dist/components/MainBillData/theme.js +0 -3
- package/dist/components/MainBillData/utils.js +0 -3
- package/dist/components/Period/index.js +18 -44
- package/dist/components/Period/styles.module.scss +9 -9
- package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +21 -28
- package/dist/components/PowerProgresBar/components/PowerConsumption/styles.module.scss +0 -7
- package/dist/components/PowerProgresBar/index.js +8 -29
- package/dist/components/PowerProgresBar/styles.module.scss +5 -9
- package/dist/components/RateAndCategory/index.js +8 -26
- package/dist/components/RateAndCategory/styles.module.scss +1 -4
- package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +11 -23
- package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/styles.module.scss +0 -1
- package/dist/components/RatesDefinition/components/BillRate/index.js +8 -20
- package/dist/components/RatesDefinition/components/BillRate/styles.module.scss +1 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +5 -17
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/styles.module.scss +2 -4
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +8 -22
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +4 -18
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +0 -7
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +4 -14
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/styles.module.scss +1 -9
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +8 -16
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/styles.module.scss +0 -4
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +0 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +12 -39
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +14 -24
- package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +11 -38
- package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +0 -3
- package/dist/components/RatesDefinition/components/PurchasedRate/index.js +11 -23
- package/dist/components/RatesDefinition/components/PurchasedRate/styles.module.scss +5 -4
- package/dist/components/RatesDefinition/index.js +4 -25
- package/dist/components/SmartBillProvider/index.js +5 -26
- package/dist/components/StyledAmount/constants.js +0 -3
- package/dist/components/StyledAmount/index.js +18 -38
- package/dist/components/StyledAmount/styles.module.scss +2 -3
- package/dist/components/WithContextApi/index.js +4 -15
- package/dist/components/WithContextApi/layout.js +0 -9
- package/dist/components/WithSeason/index.js +0 -6
- package/dist/constants/deviceSizes.js +4 -16
- package/dist/index.js +0 -18
- package/dist/scss/variables/_colors.scss +0 -6
- package/dist/scss/variables/_colorsExport.scss +0 -6
- package/dist/shared/Context/index.js +1 -5
- package/dist/shared/constants/aliases.js +84 -82
- package/dist/shared/types/assetsTypes.js +0 -3
- package/dist/shared/types/billDataTypes.js +13 -13
- package/dist/shared/types/componentsTypes.js +4 -10
- package/dist/shared/types/formattersTypes.js +0 -2
- package/dist/shared/types/rateStagesTypes.js +0 -2
- package/dist/shared/types/smartBillTypes.js +4 -10
- package/dist/shared/types/textsTypes.js +0 -2
- package/dist/shared/utils/billCalculation.js +0 -6
- package/dist/shared/utils/consumptions.js +1 -32
- package/dist/shared/utils/context.js +0 -6
- package/dist/shared/utils/expirations.js +0 -3
- package/dist/shared/utils/periods.js +0 -15
- package/dist/shared/utils/rates.js +0 -4
- package/dist/shared/utils/readings.js +0 -7
- package/dist/shared/utils/season.js +0 -3
- package/dist/shared/utils/stagesGraph.js +0 -11
- package/dist/utils/hooks.js +0 -2
- package/dist/utils.js +0 -8
- package/package.json +1 -1
|
@@ -4,37 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = require("prop-types");
|
|
11
|
-
|
|
12
9
|
var _smartBillTypes = require("../../../../../../../../../../shared/types/smartBillTypes");
|
|
13
|
-
|
|
14
10
|
var _WithContextApi = _interopRequireDefault(require("../../../../../../../../../WithContextApi"));
|
|
15
|
-
|
|
16
11
|
var _Magnitude = _interopRequireDefault(require("../../../../../../../../../Magnitude"));
|
|
17
|
-
|
|
18
12
|
var _aliases = require("../../../../../../../../../../shared/constants/aliases");
|
|
19
|
-
|
|
20
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
var IndicatorLabel = function IndicatorLabel(_ref) {
|
|
25
16
|
var contextApiInfo = _ref.contextApiInfo,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
value = _ref.value,
|
|
18
|
+
unit = _ref.unit,
|
|
19
|
+
labelOffset = _ref.labelOffset,
|
|
20
|
+
_ref$classes = _ref.classes,
|
|
21
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
31
22
|
var assets = contextApiInfo.assets,
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
config = contextApiInfo.config,
|
|
24
|
+
Label = contextApiInfo.Label;
|
|
34
25
|
var texts = config.texts,
|
|
35
|
-
|
|
26
|
+
colors = config.colors;
|
|
36
27
|
var indicatorLabel = texts.ratesDefinition.indicatorLabel;
|
|
37
|
-
|
|
38
28
|
var EnergyIcon = function EnergyIcon() {
|
|
39
29
|
return /*#__PURE__*/_react.default.createElement(assets.EnergyIcon, {
|
|
40
30
|
className: _stylesModule.default.icon,
|
|
@@ -43,7 +33,6 @@ var IndicatorLabel = function IndicatorLabel(_ref) {
|
|
|
43
33
|
}
|
|
44
34
|
});
|
|
45
35
|
};
|
|
46
|
-
|
|
47
36
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
48
37
|
style: {
|
|
49
38
|
transform: "translate(".concat(labelOffset, ")")
|
|
@@ -61,7 +50,6 @@ var IndicatorLabel = function IndicatorLabel(_ref) {
|
|
|
61
50
|
alias: _aliases.RATE_LABEL_INDICATOR
|
|
62
51
|
}, indicatorLabel)));
|
|
63
52
|
};
|
|
64
|
-
|
|
65
53
|
IndicatorLabel.propTypes = {
|
|
66
54
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
67
55
|
value: _propTypes.number,
|
|
@@ -71,7 +59,5 @@ IndicatorLabel.propTypes = {
|
|
|
71
59
|
container: _propTypes.string
|
|
72
60
|
})
|
|
73
61
|
};
|
|
74
|
-
|
|
75
62
|
var _default = (0, _WithContextApi.default)()(IndicatorLabel);
|
|
76
|
-
|
|
77
63
|
exports.default = _default;
|
|
@@ -4,33 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = require("prop-types");
|
|
11
|
-
|
|
12
9
|
var _rateStagesTypes = require("../../../../../../../../shared/types/rateStagesTypes");
|
|
13
|
-
|
|
14
10
|
var _WithContextApi = _interopRequireDefault(require("../../../../../../../WithContextApi"));
|
|
15
|
-
|
|
16
11
|
var _smartBillTypes = require("../../../../../../../../shared/types/smartBillTypes");
|
|
17
|
-
|
|
18
12
|
var _constants = require("../../../../constants");
|
|
19
|
-
|
|
20
13
|
var _IndicatorLabel = _interopRequireDefault(require("./components/IndicatorLabel"));
|
|
21
|
-
|
|
22
14
|
var _utils = require("./utils");
|
|
23
|
-
|
|
24
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
17
|
var Indicator = function Indicator(_ref) {
|
|
29
18
|
var indicatorPosition = _ref.indicatorPosition,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
value = _ref.value,
|
|
20
|
+
unit = _ref.unit,
|
|
21
|
+
rateStages = _ref.rateStages,
|
|
22
|
+
contextApiInfo = _ref.contextApiInfo;
|
|
34
23
|
var primary = contextApiInfo.config.colors.primary;
|
|
35
24
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
25
|
className: _stylesModule.default.container
|
|
@@ -50,7 +39,6 @@ var Indicator = function Indicator(_ref) {
|
|
|
50
39
|
labelOffset: (0, _utils.getLabelOffset)(value, rateStages)
|
|
51
40
|
})));
|
|
52
41
|
};
|
|
53
|
-
|
|
54
42
|
Indicator.propTypes = {
|
|
55
43
|
value: _propTypes.number,
|
|
56
44
|
indicatorPosition: _propTypes.number,
|
|
@@ -58,7 +46,5 @@ Indicator.propTypes = {
|
|
|
58
46
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
59
47
|
rateStages: _rateStagesTypes.rateStagesTypes
|
|
60
48
|
};
|
|
61
|
-
|
|
62
49
|
var _default = (0, _WithContextApi.default)()(Indicator);
|
|
63
|
-
|
|
64
50
|
exports.default = _default;
|
|
@@ -4,20 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getLabelOffset = void 0;
|
|
7
|
-
|
|
8
7
|
var _constants = require("../../../../constants");
|
|
9
|
-
|
|
10
8
|
var _utils = require("../../../../utils");
|
|
11
|
-
|
|
12
9
|
var relativePorcentageValue = function relativePorcentageValue(value, rateStages) {
|
|
13
10
|
var globalLastSubRate = rateStages.at(-1).sub_rate_stages.at(-1).range;
|
|
14
|
-
|
|
15
11
|
var globalMaxValue = globalLastSubRate.at(-1) || globalLastSubRate.at(0) + _constants.DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH;
|
|
16
|
-
|
|
17
12
|
var clippedMaxValue = value > globalMaxValue ? globalMaxValue : value;
|
|
18
13
|
return clippedMaxValue / globalMaxValue * 100;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
var getLabelOffset = function getLabelOffset(value, rateStages) {
|
|
22
16
|
var rateIndex = rateStages.indexOf((0, _utils.getCurrentStage)(value, rateStages));
|
|
23
17
|
var isFirstRate = rateIndex === 0;
|
|
@@ -25,5 +19,4 @@ var getLabelOffset = function getLabelOffset(value, rateStages) {
|
|
|
25
19
|
var baseOffset = "".concat(relativePorcentageValue(value, rateStages), "%");
|
|
26
20
|
return isLastRate ? "calc(-".concat(baseOffset, " + ").concat(_constants.INDICATOR_LABEL_LAST_OFFSET, ")") : isFirstRate ? "calc(-".concat(baseOffset, " - ").concat(_constants.INDICATOR_LABEL_FIRST_OFFSET, ")") : _constants.INDICATOR_LABEL_DEFAULT_OFFSET;
|
|
27
21
|
};
|
|
28
|
-
|
|
29
22
|
exports.getLabelOffset = getLabelOffset;
|
|
@@ -4,24 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = require("prop-types");
|
|
11
|
-
|
|
12
9
|
var _WithContextApi = _interopRequireDefault(require("../../../../../../../WithContextApi"));
|
|
13
|
-
|
|
14
10
|
var _smartBillTypes = require("../../../../../../../../shared/types/smartBillTypes");
|
|
15
|
-
|
|
16
11
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
var Legend = function Legend(_ref) {
|
|
21
14
|
var stagesFormattedData = _ref.stagesFormattedData,
|
|
22
|
-
|
|
15
|
+
contextApiInfo = _ref.contextApiInfo;
|
|
23
16
|
var Label = contextApiInfo.Label,
|
|
24
|
-
|
|
17
|
+
config = contextApiInfo.config;
|
|
25
18
|
var texts = config.texts;
|
|
26
19
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
20
|
className: _stylesModule.default.legendContainer
|
|
@@ -32,19 +25,16 @@ var Legend = function Legend(_ref) {
|
|
|
32
25
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
33
26
|
className: _stylesModule.default.leftLabels
|
|
34
27
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
35
|
-
|
|
28
|
+
weight: "medium"
|
|
36
29
|
}, substage.name), /*#__PURE__*/_react.default.createElement(Label, null, substage.i === 0 ? texts.ratesDefinition.consumptionUpToDesktop : texts.ratesDefinition.consumptionMoreThanDesktop)), /*#__PURE__*/_react.default.createElement(Label, {
|
|
37
|
-
|
|
30
|
+
weight: "medium"
|
|
38
31
|
}, substage.legend));
|
|
39
32
|
});
|
|
40
33
|
}));
|
|
41
34
|
};
|
|
42
|
-
|
|
43
35
|
Legend.propTypes = {
|
|
44
36
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
45
37
|
stagesFormattedData: (0, _propTypes.arrayOf)(_propTypes.any)
|
|
46
38
|
};
|
|
47
|
-
|
|
48
39
|
var _default = (0, _WithContextApi.default)()(Legend);
|
|
49
|
-
|
|
50
40
|
exports.default = _default;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
@import '../../../../../../../../scss/variables/_mediaQueries';
|
|
3
3
|
|
|
4
4
|
.legendContainer {
|
|
5
|
+
border-top: 1px solid $borders-gray;
|
|
5
6
|
display: flex;
|
|
6
7
|
flex-direction: column;
|
|
7
|
-
border-top: 1px solid $borders-gray;
|
|
8
8
|
|
|
9
9
|
:last-child {
|
|
10
10
|
margin-bottom: 0;
|
|
@@ -24,11 +24,3 @@
|
|
|
24
24
|
margin-right: 4px;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
.name {
|
|
29
|
-
font-weight: 500;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.legendValue {
|
|
33
|
-
font-weight: 500;
|
|
34
|
-
}
|
|
@@ -4,30 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = require("prop-types");
|
|
11
|
-
|
|
12
9
|
var _WithContextApi = _interopRequireDefault(require("../../../../../../../WithContextApi"));
|
|
13
|
-
|
|
14
10
|
var _smartBillTypes = require("../../../../../../../../shared/types/smartBillTypes");
|
|
15
|
-
|
|
16
11
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
var Stages = function Stages(_ref) {
|
|
21
14
|
var stagesFormattedData = _ref.stagesFormattedData,
|
|
22
|
-
|
|
15
|
+
contextApiInfo = _ref.contextApiInfo;
|
|
23
16
|
var Label = contextApiInfo.Label;
|
|
24
|
-
|
|
25
17
|
var toFinalWidth = function toFinalWidth(val) {
|
|
26
18
|
return {
|
|
27
19
|
width: "".concat(val * 100, "%")
|
|
28
20
|
};
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
23
|
className: _stylesModule.default.stagesContainer
|
|
33
24
|
}, stagesFormattedData.map(function (stage) {
|
|
@@ -35,7 +26,8 @@ var Stages = function Stages(_ref) {
|
|
|
35
26
|
className: _stylesModule.default.stage,
|
|
36
27
|
style: toFinalWidth(stage.width, 0.2)
|
|
37
28
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
38
|
-
className: _stylesModule.default.group
|
|
29
|
+
className: _stylesModule.default.group,
|
|
30
|
+
weight: "medium"
|
|
39
31
|
}, stage.group), /*#__PURE__*/_react.default.createElement("div", {
|
|
40
32
|
className: _stylesModule.default.substagesContainer
|
|
41
33
|
}, stage.sub_rate_stages.map(function (substage) {
|
|
@@ -43,8 +35,11 @@ var Stages = function Stages(_ref) {
|
|
|
43
35
|
className: _stylesModule.default.substage,
|
|
44
36
|
style: toFinalWidth(substage.width)
|
|
45
37
|
}, substage.label && /*#__PURE__*/_react.default.createElement(Label, {
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
className: _stylesModule.default.substageValue,
|
|
39
|
+
colorTheme: "gray",
|
|
40
|
+
variant: "small",
|
|
41
|
+
weight: "medium",
|
|
42
|
+
withoutMarkdown: true
|
|
48
43
|
}, substage.label), /*#__PURE__*/_react.default.createElement("div", {
|
|
49
44
|
className: _stylesModule.default.substageName,
|
|
50
45
|
style: {
|
|
@@ -54,12 +49,9 @@ var Stages = function Stages(_ref) {
|
|
|
54
49
|
})));
|
|
55
50
|
}));
|
|
56
51
|
};
|
|
57
|
-
|
|
58
52
|
Stages.propTypes = {
|
|
59
53
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
60
54
|
stagesFormattedData: (0, _propTypes.arrayOf)(_propTypes.any)
|
|
61
55
|
};
|
|
62
|
-
|
|
63
56
|
var _default = (0, _WithContextApi.default)()(Stages);
|
|
64
|
-
|
|
65
57
|
exports.default = _default;
|
|
@@ -14,7 +14,6 @@ $substage-spacing-responsive: 2px;
|
|
|
14
14
|
|
|
15
15
|
.group {
|
|
16
16
|
background-color: $light-gray;
|
|
17
|
-
font-weight: 500;
|
|
18
17
|
margin-bottom: 8px;
|
|
19
18
|
padding: 8px;
|
|
20
19
|
text-align: center;
|
|
@@ -61,11 +60,8 @@ $substage-spacing-responsive: 2px;
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
.substageValue {
|
|
64
|
-
color: $gray;
|
|
65
63
|
display: flex;
|
|
66
64
|
font-family: 'Swiss';
|
|
67
|
-
font-size: 13px;
|
|
68
|
-
font-weight: 500;
|
|
69
65
|
justify-content: center;
|
|
70
66
|
padding: 12px 0;
|
|
71
67
|
text-align: center;
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.MIN_STAGE_WIDTH = exports.DEFAULT_LAST_INFINITE_RANGE = void 0;
|
|
7
7
|
var DEFAULT_LAST_INFINITE_RANGE = 200; // kWh
|
|
8
|
-
|
|
9
8
|
exports.DEFAULT_LAST_INFINITE_RANGE = DEFAULT_LAST_INFINITE_RANGE;
|
|
10
9
|
var MIN_STAGE_WIDTH = 0.2;
|
|
11
10
|
exports.MIN_STAGE_WIDTH = MIN_STAGE_WIDTH;
|
|
@@ -1,65 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
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
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = require("prop-types");
|
|
13
|
-
|
|
14
10
|
var _browser = require("@widergy/web-utils/lib/browser");
|
|
15
|
-
|
|
16
11
|
var _rateStagesTypes = require("../../../../../../shared/types/rateStagesTypes");
|
|
17
|
-
|
|
18
12
|
var _deviceSizes = require("../../../../../../constants/deviceSizes");
|
|
19
|
-
|
|
20
13
|
var _Stages = _interopRequireDefault(require("./components/Stages"));
|
|
21
|
-
|
|
22
14
|
var _Indicator = _interopRequireDefault(require("./components/Indicator"));
|
|
23
|
-
|
|
24
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
25
|
-
|
|
26
16
|
var _utils = require("./utils");
|
|
27
|
-
|
|
28
17
|
var _Legend = _interopRequireDefault(require("./components/Legend"));
|
|
29
|
-
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
19
|
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); }
|
|
33
|
-
|
|
34
20
|
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; }
|
|
35
|
-
|
|
36
21
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
|
-
|
|
38
22
|
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."); }
|
|
39
|
-
|
|
40
23
|
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); }
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
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; }
|
|
45
|
-
|
|
24
|
+
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; }
|
|
25
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
46
26
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
|
-
|
|
48
27
|
var RateStagesGraph = function RateStagesGraph(_ref) {
|
|
49
28
|
var value = _ref.value,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
29
|
+
unit = _ref.unit,
|
|
30
|
+
rateStages = _ref.rateStages,
|
|
31
|
+
getStageColor = _ref.getStageColor;
|
|
54
32
|
var _useState = (0, _react.useState)((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint)),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
isDesktopSize = _useState2[0],
|
|
35
|
+
setIsDesktopSize = _useState2[1];
|
|
59
36
|
var handleResizeScreen = function handleResizeScreen() {
|
|
60
37
|
return setIsDesktopSize((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint));
|
|
61
38
|
};
|
|
62
|
-
|
|
63
39
|
(0, _react.useEffect)(function () {
|
|
64
40
|
window.addEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
65
41
|
handleResizeScreen();
|
|
@@ -67,13 +43,11 @@ var RateStagesGraph = function RateStagesGraph(_ref) {
|
|
|
67
43
|
return window.removeEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
68
44
|
};
|
|
69
45
|
}, []);
|
|
70
|
-
|
|
71
46
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
47
|
+
return (0, _utils.getStagesFormattedData)(value, rateStages, getStageColor, isDesktopSize);
|
|
48
|
+
}, [isDesktopSize, value, rateStages, getStageColor]),
|
|
49
|
+
stagesFormattedData = _useMemo.stagesFormattedData,
|
|
50
|
+
indicatorPosition = _useMemo.indicatorPosition;
|
|
77
51
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
78
52
|
className: _stylesModule.default.container
|
|
79
53
|
}, /*#__PURE__*/_react.default.createElement(_Stages.default, {
|
|
@@ -88,7 +62,6 @@ var RateStagesGraph = function RateStagesGraph(_ref) {
|
|
|
88
62
|
stagesFormattedData: stagesFormattedData
|
|
89
63
|
}));
|
|
90
64
|
};
|
|
91
|
-
|
|
92
65
|
RateStagesGraph.propTypes = {
|
|
93
66
|
value: _propTypes.number,
|
|
94
67
|
unit: _propTypes.string,
|
|
@@ -4,48 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getStagesFormattedData = void 0;
|
|
7
|
-
|
|
8
7
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
-
|
|
10
8
|
var _constants = require("./constants");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
10
|
+
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); }
|
|
14
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
16
|
var getResponsiveStageWidth = function getResponsiveStageWidth(rateStages, stage, totalSubStages) {
|
|
21
|
-
var totalWidth = 1;
|
|
22
|
-
|
|
17
|
+
var totalWidth = 1;
|
|
18
|
+
// if we have only one rate, then return max width.
|
|
23
19
|
if (rateStages.length === 1) {
|
|
24
20
|
return totalWidth;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
}
|
|
22
|
+
// We sort the stages based in sub stages in cases that former stages are larger than later ones.
|
|
28
23
|
var sortedRateStages = _lodash.default.sortBy(rateStages, function (_stage) {
|
|
29
24
|
return _stage.sub_rate_stages.length;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
});
|
|
26
|
+
// Iterate over the sorted array until finished.
|
|
33
27
|
for (var index = 0; index < sortedRateStages.length; index += 1) {
|
|
34
28
|
// If we reached our stage then we break, we need to know the space former ones ocuppy and not the laters.
|
|
35
29
|
if (sortedRateStages[index].group === stage.group) {
|
|
36
30
|
break;
|
|
37
31
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
var currentSubStages = sortedRateStages[index].sub_rate_stages.length;
|
|
33
|
+
// Maximum a stage can ocuppy (since minimum is MIN_STAGE_WIDTH), is MIN_STAGE_WIDTH times the other stages.
|
|
41
34
|
var width = Math.min(Math.max(currentSubStages / totalSubStages, _constants.MIN_STAGE_WIDTH), _constants.MIN_STAGE_WIDTH * rateStages.length);
|
|
42
35
|
totalWidth -= width;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
}
|
|
37
|
+
// Final width will be the minimum value between the calculated width and the total width left.
|
|
46
38
|
return Math.min(Math.max(stage.sub_rate_stages.length / totalSubStages, _constants.MIN_STAGE_WIDTH), totalWidth);
|
|
47
39
|
};
|
|
48
|
-
|
|
49
40
|
var getStagesFormattedData = function getStagesFormattedData(value, rateStages, getStageColor, isDesktop) {
|
|
50
41
|
var totalSubstagesCount = rateStages.reduce(function (count, stage) {
|
|
51
42
|
return count += stage.sub_rate_stages.length;
|
|
@@ -82,5 +73,4 @@ var getStagesFormattedData = function getStagesFormattedData(value, rateStages,
|
|
|
82
73
|
indicatorPosition: indicatorPosition
|
|
83
74
|
};
|
|
84
75
|
};
|
|
85
|
-
|
|
86
76
|
exports.getStagesFormattedData = getStagesFormattedData;
|
|
@@ -1,70 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
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
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = require("prop-types");
|
|
13
|
-
|
|
14
10
|
var _browser = require("@widergy/web-utils/lib/browser");
|
|
15
|
-
|
|
16
11
|
var _smartBillTypes = require("../../../../shared/types/smartBillTypes");
|
|
17
|
-
|
|
18
12
|
var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"));
|
|
19
|
-
|
|
20
13
|
var _aliases = require("../../../../shared/constants/aliases");
|
|
21
|
-
|
|
22
14
|
var _deviceSizes = require("../../../../constants/deviceSizes");
|
|
23
|
-
|
|
24
15
|
var _RateStagesGraph = _interopRequireDefault(require("./components/RateStagesGraph"));
|
|
25
|
-
|
|
26
16
|
var _Category = _interopRequireDefault(require("./components/Category"));
|
|
27
|
-
|
|
28
17
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
29
|
-
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
19
|
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); }
|
|
33
|
-
|
|
34
20
|
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; }
|
|
35
|
-
|
|
36
21
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
|
-
|
|
38
22
|
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."); }
|
|
39
|
-
|
|
40
23
|
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); }
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
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; }
|
|
45
|
-
|
|
24
|
+
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; }
|
|
25
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
46
26
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
|
-
|
|
48
27
|
var CategoryByConsumption = function CategoryByConsumption(_ref) {
|
|
49
28
|
var contextApiInfo = _ref.contextApiInfo,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
value = _ref.value,
|
|
30
|
+
unit = _ref.unit,
|
|
31
|
+
category = _ref.category;
|
|
53
32
|
var config = contextApiInfo.config,
|
|
54
|
-
|
|
33
|
+
Label = contextApiInfo.Label;
|
|
55
34
|
var rateStages = config.rateStages,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
texts = config.texts,
|
|
36
|
+
getStageColor = config.getStageColor;
|
|
59
37
|
var _useState = (0, _react.useState)((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint)),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
isDesktopSize = _useState2[0],
|
|
40
|
+
setIsDesktopSize = _useState2[1];
|
|
64
41
|
var handleResizeScreen = function handleResizeScreen() {
|
|
65
42
|
return setIsDesktopSize((0, _browser.isDesktop)(_deviceSizes.TabletBreakpoint));
|
|
66
43
|
};
|
|
67
|
-
|
|
68
44
|
(0, _react.useEffect)(function () {
|
|
69
45
|
window.addEventListener(_browser.RESIZE_EVENT, handleResizeScreen);
|
|
70
46
|
handleResizeScreen();
|
|
@@ -93,14 +69,11 @@ var CategoryByConsumption = function CategoryByConsumption(_ref) {
|
|
|
93
69
|
rateStages: rateStages
|
|
94
70
|
})));
|
|
95
71
|
};
|
|
96
|
-
|
|
97
72
|
CategoryByConsumption.propTypes = {
|
|
98
73
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
99
74
|
value: _propTypes.number,
|
|
100
75
|
unit: _propTypes.string,
|
|
101
76
|
category: _propTypes.string
|
|
102
77
|
};
|
|
103
|
-
|
|
104
78
|
var _default = (0, _WithContextApi.default)()(CategoryByConsumption);
|
|
105
|
-
|
|
106
79
|
exports.default = _default;
|
|
@@ -4,13 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCurrentStage = void 0;
|
|
7
|
-
|
|
8
7
|
var _constants = require("./constants");
|
|
9
|
-
|
|
10
8
|
var getCurrentStage = function getCurrentStage(value, rateStages) {
|
|
11
9
|
return rateStages.find(function (stage) {
|
|
12
10
|
return stage.range[_constants.MIN_VALUE] <= value && (value <= stage.range[_constants.MAX_VALUE] || stage.range[_constants.MAX_VALUE] === _constants.INFINITE);
|
|
13
11
|
});
|
|
14
12
|
};
|
|
15
|
-
|
|
16
13
|
exports.getCurrentStage = getCurrentStage;
|