@widergy/utilitygo-smart-bill-web 1.10.0 → 1.10.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.
Files changed (128) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/Advice/index.js +6 -10
  3. package/dist/components/Amount/index.js +21 -26
  4. package/dist/components/Amount/utils.js +5 -1
  5. package/dist/components/Banner/index.js +6 -10
  6. package/dist/components/BarChart/constants.js +3 -3
  7. package/dist/components/BarChart/index.js +25 -28
  8. package/dist/components/BarChart/utils.js +15 -15
  9. package/dist/components/BillCalculation/components/ConceptCard/index.js +48 -47
  10. package/dist/components/BillCalculation/constants.js +1 -1
  11. package/dist/components/BillCalculation/index.js +54 -44
  12. package/dist/components/BillCalculation/utils.js +14 -17
  13. package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +25 -26
  14. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/constants.js +9 -3
  15. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +31 -34
  16. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/styles.module.scss +2 -2
  17. package/dist/components/BillSummary/components/BilledConcepts/constants.js +14 -12
  18. package/dist/components/BillSummary/components/BilledConcepts/index.js +49 -31
  19. package/dist/components/BillSummary/components/BilledConcepts/utils.js +76 -44
  20. package/dist/components/BillSummary/index.js +78 -76
  21. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +8 -8
  22. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +12 -17
  23. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +1 -1
  24. package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +135 -148
  25. package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +14 -16
  26. package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +94 -89
  27. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +11 -21
  28. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +1 -1
  29. package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +16 -21
  30. package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +9 -13
  31. package/dist/components/ConsumptionComparison/index.js +56 -42
  32. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +26 -30
  33. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +13 -18
  34. package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +15 -17
  35. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +17 -21
  36. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +1 -1
  37. package/dist/components/ConsumptionEnergyDetails/index.js +47 -51
  38. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +65 -66
  39. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +13 -11
  40. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +19 -22
  41. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +10 -16
  42. package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +39 -43
  43. package/dist/components/ConsumptionIncluded/index.js +36 -34
  44. package/dist/components/ConsumptionIncluded/utils.js +33 -29
  45. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +10 -14
  46. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +22 -25
  47. package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +34 -18
  48. package/dist/components/ConsumptionPeriod/components/Reading/index.js +34 -37
  49. package/dist/components/ConsumptionPeriod/index.js +8 -12
  50. package/dist/components/ConsumptionPeriod/utils.js +15 -13
  51. package/dist/components/Date/index.js +9 -12
  52. package/dist/components/DebtState/index.js +8 -14
  53. package/dist/components/IconAndDetails/index.js +17 -19
  54. package/dist/components/Magnitude/index.js +12 -15
  55. package/dist/components/Magnitude/utils.js +8 -2
  56. package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +16 -20
  57. package/dist/components/MainBillData/components/BillAlert/index.js +45 -28
  58. package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +11 -19
  59. package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +11 -14
  60. package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +3 -1
  61. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +15 -23
  62. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +1 -1
  63. package/dist/components/MainBillData/components/BillBody/index.js +50 -45
  64. package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +9 -15
  65. package/dist/components/MainBillData/components/BillHeader/index.js +26 -29
  66. package/dist/components/MainBillData/index.js +5 -7
  67. package/dist/components/MainBillData/theme.js +9 -7
  68. package/dist/components/MainBillData/utils.js +5 -1
  69. package/dist/components/Period/index.js +47 -55
  70. package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +11 -15
  71. package/dist/components/PowerProgresBar/index.js +36 -36
  72. package/dist/components/RateAndCategory/index.js +31 -30
  73. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +13 -20
  74. package/dist/components/RatesDefinition/components/BillRate/index.js +14 -24
  75. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +9 -14
  76. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/LimitsLine/index.js +7 -5
  77. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/index.js +12 -18
  78. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/utils.js +3 -1
  79. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/index.js +18 -18
  80. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/index.js +19 -19
  81. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +21 -26
  82. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +12 -15
  83. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +37 -35
  84. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/index.js +23 -26
  85. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +18 -18
  86. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +32 -12
  87. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +20 -12
  88. package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +50 -32
  89. package/dist/components/RatesDefinition/components/PurchasedRate/index.js +13 -19
  90. package/dist/components/RatesDefinition/index.js +15 -20
  91. package/dist/components/SmartBillProvider/index.js +47 -12
  92. package/dist/components/StyledAmount/constants.js +1 -1
  93. package/dist/components/StyledAmount/index.js +35 -19
  94. package/dist/components/WithContextApi/index.js +27 -16
  95. package/dist/components/WithContextApi/layout.js +2 -2
  96. package/dist/components/WithSeason/index.js +9 -5
  97. package/dist/constants/deviceSizes.js +17 -27
  98. package/dist/constants/seasons.js +2 -2
  99. package/dist/index.js +16 -14
  100. package/dist/shared/Context/index.js +3 -5
  101. package/dist/shared/constants/aliases.js +550 -683
  102. package/dist/shared/constants/components.js +2 -1
  103. package/dist/shared/constants/consumptions.js +4 -4
  104. package/dist/shared/constants/periodicities.js +1 -1
  105. package/dist/shared/constants/rates.js +1 -1
  106. package/dist/shared/constants/readings.js +2 -2
  107. package/dist/shared/constants/seasons.js +2 -2
  108. package/dist/shared/constants/stagesGraph.js +4 -4
  109. package/dist/shared/types/assetsTypes.js +1 -1
  110. package/dist/shared/types/billDataTypes.js +4 -4
  111. package/dist/shared/types/componentsTypes.js +13 -18
  112. package/dist/shared/types/formattersTypes.js +1 -1
  113. package/dist/shared/types/rateStagesTypes.js +3 -3
  114. package/dist/shared/types/smartBillTypes.js +10 -5
  115. package/dist/shared/types/textsTypes.js +1 -1
  116. package/dist/shared/utils/billCalculation.js +9 -9
  117. package/dist/shared/utils/consumptions.js +62 -28
  118. package/dist/shared/utils/context.js +8 -7
  119. package/dist/shared/utils/expirations.js +5 -1
  120. package/dist/shared/utils/periods.js +20 -14
  121. package/dist/shared/utils/rates.js +5 -1
  122. package/dist/shared/utils/readings.js +10 -2
  123. package/dist/shared/utils/season.js +5 -1
  124. package/dist/shared/utils/stagesGraph.js +15 -11
  125. package/dist/utils/hooks.js +58 -19
  126. package/dist/utils.js +8 -4
  127. package/package.json +1 -2
  128. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/utils.js +0 -27
@@ -7,26 +7,28 @@ exports.getSubStageWidth = exports.getSubStageRangeWidth = exports.getStageRange
7
7
 
8
8
  var _stagesGraph = require("../constants/stagesGraph");
9
9
 
10
- const getCurrentStage = (value, rateStages) => rateStages.find(stage => stage.range[_stagesGraph.MIN_VALUE] <= value && (value <= stage.range[_stagesGraph.MAX_VALUE] || stage.range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE));
10
+ var getCurrentStage = function getCurrentStage(value, rateStages) {
11
+ return rateStages.find(function (stage) {
12
+ return stage.range[_stagesGraph.MIN_VALUE] <= value && (value <= stage.range[_stagesGraph.MAX_VALUE] || stage.range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE);
13
+ });
14
+ };
11
15
 
12
16
  exports.getCurrentStage = getCurrentStage;
13
17
 
14
- const getSubStageRangeWidth = subStage => {
15
- const {
16
- range
17
- } = subStage;
18
+ var getSubStageRangeWidth = function getSubStageRangeWidth(subStage) {
19
+ var range = subStage.range;
18
20
  return range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE || !range[_stagesGraph.MAX_VALUE] ? _stagesGraph.DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH : range[_stagesGraph.MAX_VALUE] - range[_stagesGraph.MIN_VALUE];
19
21
  };
20
22
 
21
23
  exports.getSubStageRangeWidth = getSubStageRangeWidth;
22
24
 
23
- const getStageRangeWidth = stage => {
24
- const {
25
- range
26
- } = stage;
25
+ var getStageRangeWidth = function getStageRangeWidth(stage) {
26
+ var range = stage.range;
27
27
 
28
28
  if (range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE || !range[_stagesGraph.MAX_VALUE]) {
29
- return stage.sub_rate_stages.reduce((totalWidth, subStage) => totalWidth + getSubStageRangeWidth(subStage), 0);
29
+ return stage.sub_rate_stages.reduce(function (totalWidth, subStage) {
30
+ return totalWidth + getSubStageRangeWidth(subStage);
31
+ }, 0);
30
32
  }
31
33
 
32
34
  return range[_stagesGraph.MAX_VALUE] - range[_stagesGraph.MIN_VALUE];
@@ -34,6 +36,8 @@ const getStageRangeWidth = stage => {
34
36
 
35
37
  exports.getStageRangeWidth = getStageRangeWidth;
36
38
 
37
- const getSubStageWidth = (stage, subStage) => getSubStageRangeWidth(subStage) / getStageRangeWidth(stage) * 100;
39
+ var getSubStageWidth = function getSubStageWidth(stage, subStage) {
40
+ return getSubStageRangeWidth(subStage) / getStageRangeWidth(stage) * 100;
41
+ };
38
42
 
39
43
  exports.getSubStageWidth = getSubStageWidth;
@@ -11,17 +11,54 @@ var _browser = require("@widergy/web-utils/lib/browser");
11
11
 
12
12
  var _function = require("@widergy/web-utils/lib/function");
13
13
 
14
- const useScreenSize = function () {
15
- let sizes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
- const mobileBP = sizes.mobileBreakpoint || 767;
17
- const tabletBP = sizes.tabletBreakpoint || 1023;
18
- const [screenWidth, setScreenWidth] = (0, _react.useState)(_browser.retrieveWidth);
19
- const [isMobileSize, setIsMobileSize] = (0, _react.useState)((0, _browser.isMobile)(mobileBP));
20
- const [isTabletSize, setIsTabletSize] = (0, _react.useState)((0, _browser.isTablet)(mobileBP, tabletBP));
21
- const [isDesktopSize, setIsDesktopSize] = (0, _react.useState)((0, _browser.isDesktop)(tabletBP));
22
- const [isMobileOrTablet, setIsMobileOrTablet] = (0, _react.useState)((0, _browser.isMobile)(mobileBP) || (0, _browser.isTablet)(mobileBP, tabletBP));
23
- const [isTabletOrDesktop, setIsTabletOrDesktop] = (0, _react.useState)((0, _browser.isTablet)(mobileBP, tabletBP) || (0, _browser.isDesktop)(tabletBP));
24
- const handleUpdateScreen = (0, _react.useCallback)(() => {
14
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
+
16
+ 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."); }
17
+
18
+ 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); }
19
+
20
+ 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; }
21
+
22
+ 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; }
23
+
24
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
+
26
+ var useScreenSize = function useScreenSize() {
27
+ var sizes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
+ var mobileBP = sizes.mobileBreakpoint || 767;
29
+ var tabletBP = sizes.tabletBreakpoint || 1023;
30
+
31
+ var _useState = (0, _react.useState)(_browser.retrieveWidth),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ screenWidth = _useState2[0],
34
+ setScreenWidth = _useState2[1];
35
+
36
+ var _useState3 = (0, _react.useState)((0, _browser.isMobile)(mobileBP)),
37
+ _useState4 = _slicedToArray(_useState3, 2),
38
+ isMobileSize = _useState4[0],
39
+ setIsMobileSize = _useState4[1];
40
+
41
+ var _useState5 = (0, _react.useState)((0, _browser.isTablet)(mobileBP, tabletBP)),
42
+ _useState6 = _slicedToArray(_useState5, 2),
43
+ isTabletSize = _useState6[0],
44
+ setIsTabletSize = _useState6[1];
45
+
46
+ var _useState7 = (0, _react.useState)((0, _browser.isDesktop)(tabletBP)),
47
+ _useState8 = _slicedToArray(_useState7, 2),
48
+ isDesktopSize = _useState8[0],
49
+ setIsDesktopSize = _useState8[1];
50
+
51
+ var _useState9 = (0, _react.useState)((0, _browser.isMobile)(mobileBP) || (0, _browser.isTablet)(mobileBP, tabletBP)),
52
+ _useState10 = _slicedToArray(_useState9, 2),
53
+ isMobileOrTablet = _useState10[0],
54
+ setIsMobileOrTablet = _useState10[1];
55
+
56
+ var _useState11 = (0, _react.useState)((0, _browser.isTablet)(mobileBP, tabletBP) || (0, _browser.isDesktop)(tabletBP)),
57
+ _useState12 = _slicedToArray(_useState11, 2),
58
+ isTabletOrDesktop = _useState12[0],
59
+ setIsTabletOrDesktop = _useState12[1];
60
+
61
+ var handleUpdateScreen = (0, _react.useCallback)(function () {
25
62
  setScreenWidth(_browser.retrieveWidth);
26
63
  setIsMobileSize((0, _browser.isMobile)(mobileBP));
27
64
  setIsTabletSize((0, _browser.isTablet)(mobileBP, tabletBP));
@@ -29,17 +66,19 @@ const useScreenSize = function () {
29
66
  setIsMobileOrTablet((0, _browser.isMobile)(mobileBP) || (0, _browser.isTablet)(mobileBP, tabletBP));
30
67
  setIsTabletOrDesktop((0, _browser.isTablet)(mobileBP, tabletBP) || (0, _browser.isDesktop)(tabletBP));
31
68
  }, [mobileBP, tabletBP]);
32
- (0, _react.useEffect)(() => {
69
+ (0, _react.useEffect)(function () {
33
70
  window.addEventListener(_browser.RESIZE_EVENT, (0, _function.debounce)(handleUpdateScreen));
34
- return () => window.removeEventListener(_browser.RESIZE_EVENT, (0, _function.debounce)(handleUpdateScreen));
71
+ return function () {
72
+ return window.removeEventListener(_browser.RESIZE_EVENT, (0, _function.debounce)(handleUpdateScreen));
73
+ };
35
74
  }, [handleUpdateScreen]);
36
75
  return {
37
- isMobileSize,
38
- isTabletSize,
39
- isDesktopSize,
40
- isMobileOrTablet,
41
- isTabletOrDesktop,
42
- screenWidth
76
+ isMobileSize: isMobileSize,
77
+ isTabletSize: isTabletSize,
78
+ isDesktopSize: isDesktopSize,
79
+ isMobileOrTablet: isMobileOrTablet,
80
+ isTabletOrDesktop: isTabletOrDesktop,
81
+ screenWidth: screenWidth
43
82
  };
44
83
  };
45
84
 
package/dist/utils.js CHANGED
@@ -9,17 +9,21 @@ var _numeral = _interopRequireDefault(require("config/numeral"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
- const stringOrDash = str => str || '-';
12
+ var stringOrDash = function stringOrDash(str) {
13
+ return str || '-';
14
+ };
13
15
 
14
16
  exports.stringOrDash = stringOrDash;
15
17
 
16
- const numberOrDash = function (number) {
17
- let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0,0';
18
+ var numberOrDash = function numberOrDash(number) {
19
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0,0';
18
20
  return number !== undefined && number !== null ? (0, _numeral.default)(number).format(format) : '-';
19
21
  };
20
22
 
21
23
  exports.numberOrDash = numberOrDash;
22
24
 
23
- const formatNumber = value => (0, _numeral.default)(value).format('0.[00]');
25
+ var formatNumber = function formatNumber(value) {
26
+ return (0, _numeral.default)(value).format('0.[00]');
27
+ };
24
28
 
25
29
  exports.formatNumber = formatNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/utilitygo-smart-bill-web",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "UtilityGO SmartBill Web",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -59,7 +59,6 @@
59
59
  "react-jss": "^8.6.1",
60
60
  "react-perfect-scrollbar": "^1.5.3",
61
61
  "react-responsive": "^4.1.0",
62
- "recharts": "github:widergy/recharts#master",
63
62
  "sass-loader": "^7.1.0",
64
63
  "seamless-immutable": "^7.1.4",
65
64
  "yarn": "^1.22.10"
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.renderCustomizedLabel = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _constants = require("./constants");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- const renderCustomizedLabel = (cx, cy, midAngle, innerRadius, outerRadius, percent) => {
15
- const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
16
- const x = cx + radius * Math.cos(-midAngle * _constants.RADIAN);
17
- const y = cy + radius * Math.sin(-midAngle * _constants.RADIAN);
18
- return /*#__PURE__*/_react.default.createElement("text", {
19
- x: x,
20
- y: y,
21
- fill: "white",
22
- textAnchor: x > cx ? 'start' : 'end',
23
- dominantBaseline: "central"
24
- }, "".concat((percent * 100).toFixed(0), "%"));
25
- };
26
-
27
- exports.renderCustomizedLabel = renderCustomizedLabel;