@widergy/utilitygo-smart-bill-web 1.10.2 → 1.13.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 +28 -0
- package/dist/components/Amount/styles.module.scss +2 -0
- package/dist/components/BillCalculation/components/Glossary/index.js +133 -0
- package/dist/components/BillCalculation/components/Glossary/styles.module.scss +53 -0
- package/dist/components/BillCalculation/index.js +21 -3
- package/dist/components/BillCalculation/styles.module.scss +2 -1
- package/dist/components/BillCalculation/utils.js +16 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +8 -11
- 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 +4 -49
- 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 +20 -5
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/styles.module.scss +4 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +68 -31
- package/dist/components/RatesDefinition/components/CategoryByConsumption/constants.js +42 -0
- package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +3 -12
- package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +16 -0
- package/dist/shared/constants/aliases.js +9 -4
- package/dist/shared/types/componentsTypes.js +1 -1
- package/dist/shared/types/rateStagesTypes.js +1 -1
- package/dist/utils/hooks.js +5 -76
- package/package.json +2 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/LimitsLine/index.js +0 -23
- 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 -63
- 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 -14
- 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 -80
- 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.13.1](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.13.0...v1.13.1) (2022-02-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* adding flex-wrap to expiration dates, keeping text in container ([#25](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/25)) ([fc34ecf](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/fc34ecf04a4f7b515cf5eb1410e9317875a1996f))
|
|
7
|
+
|
|
8
|
+
# [1.13.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.12.0...v1.13.0) (2022-01-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* glossary modal ([#23](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/23)) ([408df2e](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/408df2ee1f48ba1c5d18e96de6dfee81c3d16f14))
|
|
14
|
+
|
|
15
|
+
# [1.12.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.11.0...v1.12.0) (2022-01-17)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* 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))
|
|
21
|
+
|
|
22
|
+
# [1.11.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.10.2...v1.11.0) (2022-01-04)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* 🌟 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))
|
|
28
|
+
|
|
1
29
|
## [1.10.2](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.10.1...v1.10.2) (2022-01-04)
|
|
2
30
|
|
|
3
31
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = require("prop-types");
|
|
13
|
+
|
|
14
|
+
var _smartBillTypes = require("../../../../shared/types/smartBillTypes");
|
|
15
|
+
|
|
16
|
+
var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"));
|
|
17
|
+
|
|
18
|
+
var _aliases = require("../../../../shared/constants/aliases");
|
|
19
|
+
|
|
20
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
30
|
+
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."); }
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
40
|
+
var Glossary = function Glossary(_ref) {
|
|
41
|
+
var glossaryConcepts = _ref.glossaryConcepts,
|
|
42
|
+
contextApiInfo = _ref.contextApiInfo,
|
|
43
|
+
isDesktopSize = _ref.isDesktopSize;
|
|
44
|
+
var assets = contextApiInfo.assets,
|
|
45
|
+
config = contextApiInfo.config,
|
|
46
|
+
Button = contextApiInfo.Button,
|
|
47
|
+
Label = contextApiInfo.Label,
|
|
48
|
+
Touchable = contextApiInfo.Touchable,
|
|
49
|
+
Dialog = contextApiInfo.Dialog,
|
|
50
|
+
Card = contextApiInfo.Card;
|
|
51
|
+
var texts = config.texts,
|
|
52
|
+
colors = config.colors;
|
|
53
|
+
var _texts$billCalculatio = texts.billCalculation,
|
|
54
|
+
glossaryTitle = _texts$billCalculatio.glossaryTitle,
|
|
55
|
+
seeGlossary = _texts$billCalculatio.seeGlossary;
|
|
56
|
+
var InfoIcon = assets.InfoIcon;
|
|
57
|
+
|
|
58
|
+
var _useState = (0, _react.useState)(),
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
open = _useState2[0],
|
|
61
|
+
setOpen = _useState2[1];
|
|
62
|
+
|
|
63
|
+
var _useState3 = (0, _react.useState)(),
|
|
64
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
65
|
+
openItem = _useState4[0],
|
|
66
|
+
setOpenItem = _useState4[1];
|
|
67
|
+
|
|
68
|
+
var toggleItem = function toggleItem(i) {
|
|
69
|
+
return i === openItem ? setOpenItem() : setOpenItem(i);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Dialog, {
|
|
73
|
+
isOpen: open,
|
|
74
|
+
title: glossaryTitle,
|
|
75
|
+
cancelButton: {
|
|
76
|
+
onPress: function onPress() {
|
|
77
|
+
return setOpen(false);
|
|
78
|
+
},
|
|
79
|
+
text: texts.commons.close
|
|
80
|
+
},
|
|
81
|
+
classNames: {
|
|
82
|
+
content: _stylesModule.default.content,
|
|
83
|
+
container: _stylesModule.default.dialogRoot,
|
|
84
|
+
mainTitle: _stylesModule.default.mainTitle
|
|
85
|
+
}
|
|
86
|
+
}, glossaryConcepts.map(function (concept, i) {
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(Card, {
|
|
88
|
+
horizontal: true,
|
|
89
|
+
isCollapsible: true,
|
|
90
|
+
expandableContentClassName: _stylesModule.default.expandableContent,
|
|
91
|
+
className: _stylesModule.default.itemContainer,
|
|
92
|
+
header: /*#__PURE__*/_react.default.createElement(Label, {
|
|
93
|
+
className: _stylesModule.default.cardTitle
|
|
94
|
+
}, concept.title),
|
|
95
|
+
isOpen: i === openItem,
|
|
96
|
+
onClick: function onClick() {
|
|
97
|
+
return toggleItem(i);
|
|
98
|
+
}
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement(Label, null, concept.description), /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
className: _stylesModule.default.emptySpace
|
|
101
|
+
}));
|
|
102
|
+
})), isDesktopSize ? /*#__PURE__*/_react.default.createElement(Touchable, {
|
|
103
|
+
onClick: function onClick() {
|
|
104
|
+
return setOpen(true);
|
|
105
|
+
},
|
|
106
|
+
className: _stylesModule.default.desktopContainer,
|
|
107
|
+
style: {
|
|
108
|
+
textDecorationColor: colors.secondary
|
|
109
|
+
}
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(InfoIcon, {
|
|
111
|
+
style: {
|
|
112
|
+
fill: colors.tooltipIcon
|
|
113
|
+
},
|
|
114
|
+
className: _stylesModule.default.infoIconTooltip
|
|
115
|
+
}), /*#__PURE__*/_react.default.createElement(Label, {
|
|
116
|
+
alias: _aliases.GLOSSARY_LINK
|
|
117
|
+
}, seeGlossary)) : /*#__PURE__*/_react.default.createElement(Button, {
|
|
118
|
+
onPress: function onPress() {
|
|
119
|
+
return setOpen(true);
|
|
120
|
+
},
|
|
121
|
+
className: _stylesModule.default.button
|
|
122
|
+
}, seeGlossary));
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
Glossary.propTypes = {
|
|
126
|
+
isDesktopSize: _propTypes.bool,
|
|
127
|
+
glossaryConcepts: (0, _propTypes.arrayOf)(_propTypes.any),
|
|
128
|
+
contextApiInfo: _smartBillTypes.contextApiInfoTypes
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
var _default = (0, _WithContextApi.default)()(Glossary);
|
|
132
|
+
|
|
133
|
+
exports.default = _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@import '../../../../scss/variables/_colors';
|
|
2
|
+
|
|
3
|
+
.infoIconTooltip {
|
|
4
|
+
margin-right: 8px;
|
|
5
|
+
outline: none;
|
|
6
|
+
width: 18px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.button {
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
margin-top: 16px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.desktopContainer {
|
|
16
|
+
display: flex;
|
|
17
|
+
text-decoration: underline;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.content {
|
|
21
|
+
margin: 0;
|
|
22
|
+
overflow: overlay;
|
|
23
|
+
padding: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dialogRoot {
|
|
27
|
+
width: 350px;
|
|
28
|
+
|
|
29
|
+
::-webkit-scrollbar {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.itemContainer {
|
|
35
|
+
border-bottom: 1px solid $borders-gray !important;
|
|
36
|
+
border-radius: none;
|
|
37
|
+
box-shadow: none;
|
|
38
|
+
padding: 0 16px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.emptySpace {
|
|
42
|
+
height: 24px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.cardTitle {
|
|
46
|
+
font-weight: 500;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.mainTitle {
|
|
50
|
+
> * {
|
|
51
|
+
font-size: 16px !important;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -19,12 +19,16 @@ var _StyledAmount = _interopRequireDefault(require("../StyledAmount"));
|
|
|
19
19
|
|
|
20
20
|
var _aliases = require("../../shared/constants/aliases");
|
|
21
21
|
|
|
22
|
+
var _hooks = require("../../utils/hooks");
|
|
23
|
+
|
|
22
24
|
var _utils = require("./utils");
|
|
23
25
|
|
|
24
26
|
var _ConceptCard = _interopRequireDefault(require("./components/ConceptCard"));
|
|
25
27
|
|
|
26
28
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
27
29
|
|
|
30
|
+
var _Glossary = _interopRequireDefault(require("./components/Glossary"));
|
|
31
|
+
|
|
28
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
33
|
|
|
30
34
|
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); }
|
|
@@ -62,14 +66,18 @@ var BillCalculation = function BillCalculation(_ref) {
|
|
|
62
66
|
openedConcept = _useState2[0],
|
|
63
67
|
setOpenedConcept = _useState2[1];
|
|
64
68
|
|
|
69
|
+
var _useScreenSize = (0, _hooks.useScreenSize)(),
|
|
70
|
+
isDesktopSize = _useScreenSize.isDesktopSize;
|
|
71
|
+
|
|
65
72
|
var handleClick = function handleClick(index) {
|
|
66
73
|
return setOpenedConcept(openedConcept !== index ? index : null);
|
|
67
74
|
};
|
|
68
75
|
|
|
76
|
+
var glossaryConcepts = (0, _utils.filterGlossaryConcepts)(detail.concepts, showZeroConcepts);
|
|
69
77
|
var title = (0, _utils.periodToTitleMapper)(billData, texts, periodFormatter, withBillCalcTitleDate(billData));
|
|
70
78
|
|
|
71
79
|
var handleRenderConceptCard = function handleRenderConceptCard(concept, index) {
|
|
72
|
-
return (
|
|
80
|
+
return (0, _utils.shouldShowConcept)(concept, showZeroConcepts) && /*#__PURE__*/_react.default.createElement(_ConceptCard.default, {
|
|
73
81
|
titleHeader: concept.title,
|
|
74
82
|
total: concept.total,
|
|
75
83
|
lines: concept.lines,
|
|
@@ -80,12 +88,22 @@ var BillCalculation = function BillCalculation(_ref) {
|
|
|
80
88
|
});
|
|
81
89
|
};
|
|
82
90
|
|
|
91
|
+
var GlossaryRenderer = function GlossaryRenderer() {
|
|
92
|
+
return glossaryConcepts.length > 0 && /*#__PURE__*/_react.default.createElement(_Glossary.default, {
|
|
93
|
+
glossaryConcepts: glossaryConcepts,
|
|
94
|
+
isDesktopSize: isDesktopSize,
|
|
95
|
+
showZeroConcepts: showZeroConcepts
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
83
99
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
84
100
|
className: _stylesModule.default.container
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: _stylesModule.default.headerSection
|
|
85
103
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
86
104
|
alias: _aliases.BILL_CALC_CONCEPT_TITLE,
|
|
87
105
|
className: _stylesModule.default.title
|
|
88
|
-
}, title), detail.concepts.map(handleRenderConceptCard), /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
}, title), isDesktopSize && /*#__PURE__*/_react.default.createElement(GlossaryRenderer, null)), detail.concepts.map(handleRenderConceptCard), /*#__PURE__*/_react.default.createElement("div", {
|
|
89
107
|
className: "".concat(_stylesModule.default.totalAmountContainer, " ").concat(stylesConfig === null || stylesConfig === void 0 ? void 0 : stylesConfig.paymentTotal),
|
|
90
108
|
style: {
|
|
91
109
|
backgroundColor: colors.primary
|
|
@@ -97,7 +115,7 @@ var BillCalculation = function BillCalculation(_ref) {
|
|
|
97
115
|
aliasDecimal: _aliases.BILL_CALC_AMOUNT_DECIMAL,
|
|
98
116
|
variant: "title",
|
|
99
117
|
amount: detail.total_amount
|
|
100
|
-
})));
|
|
118
|
+
})), !isDesktopSize && /*#__PURE__*/_react.default.createElement(GlossaryRenderer, null));
|
|
101
119
|
};
|
|
102
120
|
|
|
103
121
|
BillCalculation.propTypes = {
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
flex-flow: column;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.
|
|
10
|
+
.headerSection {
|
|
11
11
|
align-items: center;
|
|
12
12
|
background: $white;
|
|
13
13
|
border: 1px solid $borders-gray;
|
|
14
14
|
border-bottom: 0;
|
|
15
15
|
border-radius: $default-container-border-radius $default-container-border-radius 0 0;
|
|
16
16
|
display: flex;
|
|
17
|
+
justify-content: space-between;
|
|
17
18
|
min-height: 37px;
|
|
18
19
|
padding: $default-spacing calc(2 * #{$default-spacing});
|
|
19
20
|
@media #{$tablet-mobile} {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.periodToTitleMapper = void 0;
|
|
6
|
+
exports.shouldShowConcept = exports.periodToTitleMapper = exports.filterGlossaryConcepts = void 0;
|
|
7
7
|
|
|
8
8
|
var _string = require("@widergy/web-utils/lib/string");
|
|
9
9
|
|
|
@@ -40,4 +40,18 @@ var periodToTitleMapper = function periodToTitleMapper(billData, texts, periodFo
|
|
|
40
40
|
return '-';
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
exports.periodToTitleMapper = periodToTitleMapper;
|
|
43
|
+
exports.periodToTitleMapper = periodToTitleMapper;
|
|
44
|
+
|
|
45
|
+
var shouldShowConcept = function shouldShowConcept(concept, showZeroConcepts) {
|
|
46
|
+
return concept.total !== 0 || showZeroConcepts;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.shouldShowConcept = shouldShowConcept;
|
|
50
|
+
|
|
51
|
+
var filterGlossaryConcepts = function filterGlossaryConcepts(concepts, showZeroConcepts) {
|
|
52
|
+
return concepts.filter(function (concept) {
|
|
53
|
+
return concept.description && shouldShowConcept(concept, showZeroConcepts);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.filterGlossaryConcepts = filterGlossaryConcepts;
|
|
@@ -15,6 +15,8 @@ var _WithContextApi = _interopRequireDefault(require("../../../../../../../WithC
|
|
|
15
15
|
|
|
16
16
|
var _smartBillTypes = require("../../../../../../../../shared/types/smartBillTypes");
|
|
17
17
|
|
|
18
|
+
var _constants = require("../../../../constants");
|
|
19
|
+
|
|
18
20
|
var _IndicatorLabel = _interopRequireDefault(require("./components/IndicatorLabel"));
|
|
19
21
|
|
|
20
22
|
var _utils = require("./utils");
|
|
@@ -24,22 +26,17 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
28
|
var Indicator = function Indicator(_ref) {
|
|
27
|
-
var
|
|
29
|
+
var indicatorPosition = _ref.indicatorPosition,
|
|
30
|
+
value = _ref.value,
|
|
28
31
|
unit = _ref.unit,
|
|
29
32
|
rateStages = _ref.rateStages,
|
|
30
|
-
isDesktop = _ref.isDesktop,
|
|
31
33
|
contextApiInfo = _ref.contextApiInfo;
|
|
32
34
|
var primary = contextApiInfo.config.colors.primary;
|
|
33
|
-
|
|
34
|
-
var _getIndicatorPosition = (0, _utils.getIndicatorPosition)(value, rateStages, isDesktop),
|
|
35
|
-
containerLeft = _getIndicatorPosition.containerLeft,
|
|
36
|
-
labelOffset = _getIndicatorPosition.labelOffset;
|
|
37
|
-
|
|
38
35
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
39
36
|
className: _stylesModule.default.container
|
|
40
37
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
41
38
|
style: {
|
|
42
|
-
left:
|
|
39
|
+
left: "calc(".concat(indicatorPosition * 100, "% + ").concat(_constants.INITIAL_INDICATOR_POSITION, ")")
|
|
43
40
|
},
|
|
44
41
|
className: _stylesModule.default.indicator
|
|
45
42
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -50,16 +47,16 @@ var Indicator = function Indicator(_ref) {
|
|
|
50
47
|
}), /*#__PURE__*/_react.default.createElement(_IndicatorLabel.default, {
|
|
51
48
|
value: value,
|
|
52
49
|
unit: unit,
|
|
53
|
-
labelOffset:
|
|
50
|
+
labelOffset: (0, _utils.getLabelOffset)(value, rateStages)
|
|
54
51
|
})));
|
|
55
52
|
};
|
|
56
53
|
|
|
57
54
|
Indicator.propTypes = {
|
|
58
55
|
value: _propTypes.number,
|
|
56
|
+
indicatorPosition: _propTypes.number,
|
|
59
57
|
unit: _propTypes.string,
|
|
60
58
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
61
|
-
rateStages: _rateStagesTypes.rateStagesTypes
|
|
62
|
-
isDesktop: _propTypes.bool
|
|
59
|
+
rateStages: _rateStagesTypes.rateStagesTypes
|
|
63
60
|
};
|
|
64
61
|
|
|
65
62
|
var _default = (0, _WithContextApi.default)()(Indicator);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
@import '../../../../../../../../scss/variables/_colorsExport.scss';
|
|
2
|
-
@import '../../../../../../../../scss/variables/_mediaQueries';
|
|
3
|
-
@import '../../../../../../../../scss/variables/_sizes.scss';
|
|
4
|
-
|
|
5
1
|
$arrow-width: 12px;
|
|
6
2
|
$arrow-height: 8px;
|
|
7
3
|
|
|
8
4
|
.container {
|
|
9
5
|
display: flex;
|
|
6
|
+
padding-top: 0 !important;
|
|
10
7
|
width: 100%;
|
|
11
8
|
}
|
|
12
9
|
|
|
@@ -3,35 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getLabelOffset = void 0;
|
|
7
7
|
|
|
8
|
-
var _constants = require("
|
|
8
|
+
var _constants = require("../../../../constants");
|
|
9
9
|
|
|
10
|
-
var _utils = require("
|
|
11
|
-
|
|
12
|
-
var getStageWidth = function getStageWidth(totalStages, isDesktop) {
|
|
13
|
-
var barsMargin = isDesktop ? _constants.BARS_MARGIN_DESKTOP : _constants.BARS_MARGIN_MOBILE;
|
|
14
|
-
var stageMargin = isDesktop ? _constants.STAGE_MARGIN_DESKTOP : _constants.STAGE_MARGIN_MOBILE;
|
|
15
|
-
return "(100% - 2 * ".concat(barsMargin, " - ").concat(totalStages - 1, " * ").concat(stageMargin, ") / ").concat(totalStages);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
var stagePosition = function stagePosition(value, rateStages, isDesktop) {
|
|
19
|
-
var stageMargin = isDesktop ? _constants.STAGE_MARGIN_DESKTOP : _constants.STAGE_MARGIN_MOBILE;
|
|
20
|
-
var exceededStages = rateStages.filter(function (stage) {
|
|
21
|
-
return stage.range[_constants.MAX_VALUE] !== _constants.INFINITE && stage.range[_constants.MAX_VALUE] < value;
|
|
22
|
-
}).length;
|
|
23
|
-
var totalStages = rateStages.length;
|
|
24
|
-
var marginsCorrection = "".concat(exceededStages, " * ").concat(stageMargin);
|
|
25
|
-
return "".concat(getStageWidth(totalStages, isDesktop), " * ").concat(exceededStages, " + ").concat(marginsCorrection);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var subStagePosition = function subStagePosition(value, rateStages, isDesktop) {
|
|
29
|
-
var totalStages = rateStages.length;
|
|
30
|
-
var currentStage = (0, _utils.getCurrentStage)(value, rateStages);
|
|
31
|
-
var currentStageRangeWidth = (0, _utils.getStageRangeWidth)(currentStage);
|
|
32
|
-
var deltaFromStageInit = value - currentStage.range[_constants.MIN_VALUE] <= currentStageRangeWidth ? value - currentStage.range[_constants.MIN_VALUE] : currentStageRangeWidth;
|
|
33
|
-
return "".concat(getStageWidth(totalStages, isDesktop), " * ").concat(deltaFromStageInit, " / ").concat(currentStageRangeWidth);
|
|
34
|
-
};
|
|
10
|
+
var _utils = require("../../../../utils");
|
|
35
11
|
|
|
36
12
|
var relativePorcentageValue = function relativePorcentageValue(value, rateStages) {
|
|
37
13
|
var globalLastSubRate = rateStages.at(-1).sub_rate_stages.at(-1).range;
|
|
@@ -50,25 +26,4 @@ var getLabelOffset = function getLabelOffset(value, rateStages) {
|
|
|
50
26
|
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;
|
|
51
27
|
};
|
|
52
28
|
|
|
53
|
-
|
|
54
|
-
var roundedVal = Math.round(value);
|
|
55
|
-
var currentStage = (0, _utils.getCurrentStage)(value, rateStages);
|
|
56
|
-
|
|
57
|
-
var findRange = function findRange(_ref) {
|
|
58
|
-
var range = _ref.range;
|
|
59
|
-
return roundedVal >= range[0] && (!range[1] || roundedVal <= range[1]);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var currentSubstageIndex = currentStage.sub_rate_stages.findIndex(findRange);
|
|
63
|
-
var stageWidth = getStageWidth(rateStages.length, false);
|
|
64
|
-
return "".concat(stageWidth, " * ").concat((currentSubstageIndex + 0.5) / currentStage.sub_rate_stages.length);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var getIndicatorPosition = function getIndicatorPosition(value, rateStages, isDesktop) {
|
|
68
|
-
return {
|
|
69
|
-
containerLeft: "calc(".concat(isDesktop ? _constants.INITIAL_INDICATOR_POSITION_DESKTOP : _constants.INITIAL_INDICATOR_POSITION_MOBILE, " + ").concat(stagePosition(value, rateStages, isDesktop), " + ").concat(isDesktop ? subStagePosition(value, rateStages, isDesktop) : subStagePositionRounded(value, rateStages), ")"),
|
|
70
|
-
labelOffset: getLabelOffset(value, rateStages)
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
exports.getIndicatorPosition = getIndicatorPosition;
|
|
29
|
+
exports.getLabelOffset = getLabelOffset;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = require("prop-types");
|
|
11
|
+
|
|
12
|
+
var _WithContextApi = _interopRequireDefault(require("../../../../../../../WithContextApi"));
|
|
13
|
+
|
|
14
|
+
var _smartBillTypes = require("../../../../../../../../shared/types/smartBillTypes");
|
|
15
|
+
|
|
16
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
var Legend = function Legend(_ref) {
|
|
21
|
+
var stagesFormattedData = _ref.stagesFormattedData,
|
|
22
|
+
contextApiInfo = _ref.contextApiInfo;
|
|
23
|
+
var Label = contextApiInfo.Label,
|
|
24
|
+
config = contextApiInfo.config;
|
|
25
|
+
var texts = config.texts;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
|
+
className: _stylesModule.default.legendContainer
|
|
28
|
+
}, stagesFormattedData.map(function (stage) {
|
|
29
|
+
return stage.sub_rate_stages.map(function (substage) {
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
+
className: _stylesModule.default.legendLine
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
+
className: _stylesModule.default.leftLabels
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
35
|
+
className: _stylesModule.default.name
|
|
36
|
+
}, substage.name), /*#__PURE__*/_react.default.createElement(Label, null, substage.i === 0 ? texts.ratesDefinition.consumptionUpToDesktop : texts.ratesDefinition.consumptionMoreThanDesktop)), /*#__PURE__*/_react.default.createElement(Label, {
|
|
37
|
+
className: _stylesModule.default.legendValue
|
|
38
|
+
}, substage.legend));
|
|
39
|
+
});
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
Legend.propTypes = {
|
|
44
|
+
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
45
|
+
stagesFormattedData: (0, _propTypes.arrayOf)(_propTypes.any)
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var _default = (0, _WithContextApi.default)()(Legend);
|
|
49
|
+
|
|
50
|
+
exports.default = _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@import '../../../../../../../../scss/variables/_colorsExport.scss';
|
|
2
|
+
@import '../../../../../../../../scss/variables/_mediaQueries';
|
|
3
|
+
|
|
4
|
+
.legendContainer {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
border-top: 1px solid $borders-gray;
|
|
8
|
+
|
|
9
|
+
:last-child {
|
|
10
|
+
margin-bottom: 0;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.legendLine {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
margin-bottom: 16px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.leftLabels {
|
|
21
|
+
display: flex;
|
|
22
|
+
|
|
23
|
+
:first-child {
|
|
24
|
+
margin-right: 4px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.name {
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.legendValue {
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = require("prop-types");
|
|
11
|
+
|
|
12
|
+
var _WithContextApi = _interopRequireDefault(require("../../../../../../../WithContextApi"));
|
|
13
|
+
|
|
14
|
+
var _smartBillTypes = require("../../../../../../../../shared/types/smartBillTypes");
|
|
15
|
+
|
|
16
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
var Stages = function Stages(_ref) {
|
|
21
|
+
var stagesFormattedData = _ref.stagesFormattedData,
|
|
22
|
+
contextApiInfo = _ref.contextApiInfo;
|
|
23
|
+
var Label = contextApiInfo.Label;
|
|
24
|
+
|
|
25
|
+
var toFinalWidth = function toFinalWidth(val) {
|
|
26
|
+
return {
|
|
27
|
+
width: "".concat(val * 100, "%")
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
className: _stylesModule.default.stagesContainer
|
|
33
|
+
}, stagesFormattedData.map(function (stage) {
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
35
|
+
className: _stylesModule.default.stage,
|
|
36
|
+
style: toFinalWidth(stage.width, 0.2)
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
38
|
+
className: _stylesModule.default.group
|
|
39
|
+
}, stage.group), /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: _stylesModule.default.substagesContainer
|
|
41
|
+
}, stage.sub_rate_stages.map(function (substage) {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: _stylesModule.default.substage,
|
|
44
|
+
style: toFinalWidth(substage.width)
|
|
45
|
+
}, substage.label && /*#__PURE__*/_react.default.createElement(Label, {
|
|
46
|
+
withoutMarkdown: true,
|
|
47
|
+
className: _stylesModule.default.substageValue
|
|
48
|
+
}, substage.label), /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
className: _stylesModule.default.substageName,
|
|
50
|
+
style: {
|
|
51
|
+
backgroundColor: substage.color
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(Label, null, substage.name)));
|
|
54
|
+
})));
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
Stages.propTypes = {
|
|
59
|
+
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
60
|
+
stagesFormattedData: (0, _propTypes.arrayOf)(_propTypes.any)
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var _default = (0, _WithContextApi.default)()(Stages);
|
|
64
|
+
|
|
65
|
+
exports.default = _default;
|