@widergy/utilitygo-smart-bill-web 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +28 -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 +55 -52
  38. package/dist/components/ConsumptionEnergyDetails/styles.module.scss +12 -0
  39. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +65 -66
  40. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +13 -11
  41. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +19 -22
  42. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +10 -16
  43. package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +39 -43
  44. package/dist/components/ConsumptionIncluded/index.js +36 -34
  45. package/dist/components/ConsumptionIncluded/utils.js +33 -29
  46. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +10 -14
  47. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +22 -25
  48. package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +34 -18
  49. package/dist/components/ConsumptionPeriod/components/Reading/index.js +34 -37
  50. package/dist/components/ConsumptionPeriod/index.js +8 -12
  51. package/dist/components/ConsumptionPeriod/utils.js +15 -13
  52. package/dist/components/Date/index.js +9 -12
  53. package/dist/components/DebtState/index.js +8 -14
  54. package/dist/components/IconAndDetails/index.js +17 -19
  55. package/dist/components/Magnitude/index.js +12 -15
  56. package/dist/components/Magnitude/utils.js +8 -2
  57. package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +16 -20
  58. package/dist/components/MainBillData/components/BillAlert/index.js +45 -28
  59. package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +11 -19
  60. package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +11 -14
  61. package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +3 -1
  62. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +15 -23
  63. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +1 -1
  64. package/dist/components/MainBillData/components/BillBody/index.js +50 -45
  65. package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +9 -15
  66. package/dist/components/MainBillData/components/BillHeader/index.js +26 -29
  67. package/dist/components/MainBillData/index.js +5 -7
  68. package/dist/components/MainBillData/theme.js +9 -7
  69. package/dist/components/MainBillData/utils.js +5 -1
  70. package/dist/components/Period/index.js +47 -55
  71. package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +11 -15
  72. package/dist/components/PowerProgresBar/index.js +36 -36
  73. package/dist/components/RateAndCategory/index.js +31 -30
  74. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +13 -20
  75. package/dist/components/RatesDefinition/components/BillRate/index.js +14 -24
  76. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +9 -14
  77. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/LimitsLine/index.js +7 -5
  78. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/index.js +13 -19
  79. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/utils.js +3 -1
  80. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/index.js +18 -18
  81. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/index.js +19 -19
  82. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +21 -26
  83. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +12 -15
  84. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +37 -35
  85. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/index.js +25 -25
  86. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +18 -18
  87. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +32 -12
  88. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +20 -12
  89. package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +50 -32
  90. package/dist/components/RatesDefinition/components/PurchasedRate/index.js +13 -19
  91. package/dist/components/RatesDefinition/index.js +15 -20
  92. package/dist/components/SmartBillProvider/index.js +47 -12
  93. package/dist/components/StyledAmount/constants.js +1 -1
  94. package/dist/components/StyledAmount/index.js +35 -19
  95. package/dist/components/WithContextApi/index.js +27 -16
  96. package/dist/components/WithContextApi/layout.js +2 -2
  97. package/dist/components/WithSeason/index.js +9 -5
  98. package/dist/constants/deviceSizes.js +17 -27
  99. package/dist/constants/seasons.js +2 -2
  100. package/dist/index.js +16 -14
  101. package/dist/shared/Context/index.js +3 -5
  102. package/dist/shared/constants/aliases.js +550 -682
  103. package/dist/shared/constants/components.js +2 -1
  104. package/dist/shared/constants/consumptions.js +4 -4
  105. package/dist/shared/constants/periodicities.js +1 -1
  106. package/dist/shared/constants/rates.js +1 -1
  107. package/dist/shared/constants/readings.js +2 -2
  108. package/dist/shared/constants/seasons.js +2 -2
  109. package/dist/shared/constants/stagesGraph.js +4 -4
  110. package/dist/shared/types/assetsTypes.js +1 -1
  111. package/dist/shared/types/billDataTypes.js +4 -4
  112. package/dist/shared/types/componentsTypes.js +13 -18
  113. package/dist/shared/types/formattersTypes.js +1 -1
  114. package/dist/shared/types/rateStagesTypes.js +3 -3
  115. package/dist/shared/types/smartBillTypes.js +10 -5
  116. package/dist/shared/types/textsTypes.js +1 -1
  117. package/dist/shared/utils/billCalculation.js +9 -9
  118. package/dist/shared/utils/consumptions.js +62 -28
  119. package/dist/shared/utils/context.js +8 -7
  120. package/dist/shared/utils/expirations.js +5 -1
  121. package/dist/shared/utils/periods.js +20 -14
  122. package/dist/shared/utils/rates.js +5 -1
  123. package/dist/shared/utils/readings.js +10 -2
  124. package/dist/shared/utils/season.js +5 -1
  125. package/dist/shared/utils/stagesGraph.js +15 -11
  126. package/dist/utils/hooks.js +5 -37
  127. package/dist/utils.js +8 -4
  128. package/package.json +2 -2
  129. 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;
@@ -5,42 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useScreenSize = void 0;
7
7
 
8
- var _react = require("react");
9
-
10
- var _browser = require("@widergy/web-utils/lib/browser");
11
-
12
- var _function = require("@widergy/web-utils/lib/function");
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)(() => {
25
- setScreenWidth(_browser.retrieveWidth);
26
- setIsMobileSize((0, _browser.isMobile)(mobileBP));
27
- setIsTabletSize((0, _browser.isTablet)(mobileBP, tabletBP));
28
- setIsDesktopSize((0, _browser.isDesktop)(tabletBP));
29
- setIsMobileOrTablet((0, _browser.isMobile)(mobileBP) || (0, _browser.isTablet)(mobileBP, tabletBP));
30
- setIsTabletOrDesktop((0, _browser.isTablet)(mobileBP, tabletBP) || (0, _browser.isDesktop)(tabletBP));
31
- }, [mobileBP, tabletBP]);
32
- (0, _react.useEffect)(() => {
33
- window.addEventListener(_browser.RESIZE_EVENT, (0, _function.debounce)(handleUpdateScreen));
34
- return () => window.removeEventListener(_browser.RESIZE_EVENT, (0, _function.debounce)(handleUpdateScreen));
35
- }, [handleUpdateScreen]);
36
- return {
37
- isMobileSize,
38
- isTabletSize,
39
- isDesktopSize,
40
- isMobileOrTablet,
41
- isTabletOrDesktop,
42
- screenWidth
43
- };
44
- };
8
+ var _energyHooks = require("@widergy/energy-hooks");
45
9
 
10
+ var useScreenSize = (0, _energyHooks.createUseScreenSize)({
11
+ mobileBP: 767,
12
+ tabletBP: 1024
13
+ });
46
14
  exports.useScreenSize = useScreenSize;
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.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "UtilityGO SmartBill Web",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -51,6 +51,7 @@
51
51
  "not op_mini all"
52
52
  ],
53
53
  "dependencies": {
54
+ "@widergy/energy-hooks": "^1.0.0",
54
55
  "@widergy/web-utils": ">=0.4.1",
55
56
  "dayjs": "^1.10.7",
56
57
  "lodash": ">=4.17.4",
@@ -59,7 +60,6 @@
59
60
  "react-jss": "^8.6.1",
60
61
  "react-perfect-scrollbar": "^1.5.3",
61
62
  "react-responsive": "^4.1.0",
62
- "recharts": "github:widergy/recharts#master",
63
63
  "sass-loader": "^7.1.0",
64
64
  "seamless-immutable": "^7.1.4",
65
65
  "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;