@widergy/utilitygo-smart-bill-web 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) 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 +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/Indicator/components/IndicatorLabel/index.js +21 -26
  77. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +13 -19
  78. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/styles.module.scss +1 -4
  79. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +13 -56
  80. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +50 -0
  81. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/styles.module.scss +34 -0
  82. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +65 -0
  83. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/styles.module.scss +88 -0
  84. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +6 -37
  85. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +51 -16
  86. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/styles.module.scss +4 -1
  87. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +68 -23
  88. package/dist/components/RatesDefinition/components/CategoryByConsumption/constants.js +42 -0
  89. package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +45 -36
  90. package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +16 -0
  91. package/dist/components/RatesDefinition/components/PurchasedRate/index.js +13 -19
  92. package/dist/components/RatesDefinition/index.js +15 -20
  93. package/dist/components/SmartBillProvider/index.js +47 -12
  94. package/dist/components/StyledAmount/constants.js +1 -1
  95. package/dist/components/StyledAmount/index.js +35 -19
  96. package/dist/components/WithContextApi/index.js +27 -16
  97. package/dist/components/WithContextApi/layout.js +2 -2
  98. package/dist/components/WithSeason/index.js +9 -5
  99. package/dist/constants/deviceSizes.js +17 -27
  100. package/dist/constants/seasons.js +2 -2
  101. package/dist/index.js +16 -14
  102. package/dist/shared/Context/index.js +3 -5
  103. package/dist/shared/constants/aliases.js +550 -683
  104. package/dist/shared/constants/components.js +2 -1
  105. package/dist/shared/constants/consumptions.js +4 -4
  106. package/dist/shared/constants/periodicities.js +1 -1
  107. package/dist/shared/constants/rates.js +1 -1
  108. package/dist/shared/constants/readings.js +2 -2
  109. package/dist/shared/constants/seasons.js +2 -2
  110. package/dist/shared/constants/stagesGraph.js +4 -4
  111. package/dist/shared/types/assetsTypes.js +1 -1
  112. package/dist/shared/types/billDataTypes.js +4 -4
  113. package/dist/shared/types/componentsTypes.js +13 -18
  114. package/dist/shared/types/formattersTypes.js +1 -1
  115. package/dist/shared/types/rateStagesTypes.js +4 -4
  116. package/dist/shared/types/smartBillTypes.js +10 -5
  117. package/dist/shared/types/textsTypes.js +1 -1
  118. package/dist/shared/utils/billCalculation.js +9 -9
  119. package/dist/shared/utils/consumptions.js +62 -28
  120. package/dist/shared/utils/context.js +8 -7
  121. package/dist/shared/utils/expirations.js +5 -1
  122. package/dist/shared/utils/periods.js +20 -14
  123. package/dist/shared/utils/rates.js +5 -1
  124. package/dist/shared/utils/readings.js +10 -2
  125. package/dist/shared/utils/season.js +5 -1
  126. package/dist/shared/utils/stagesGraph.js +15 -11
  127. package/dist/utils/hooks.js +5 -37
  128. package/dist/utils.js +8 -4
  129. package/package.json +2 -2
  130. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/utils.js +0 -27
  131. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/LimitsLine/index.js +0 -21
  132. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/LimitsLine/styles.module.scss +0 -15
  133. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/index.js +0 -69
  134. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/styles.module.scss +0 -5
  135. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/utils.js +0 -12
  136. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/index.js +0 -68
  137. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/styles.module.scss +0 -32
  138. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/index.js +0 -59
  139. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/styles.module.scss +0 -3
  140. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/index.js +0 -83
  141. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/styles.module.scss +0 -57
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ # [1.12.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.11.0...v1.12.0) (2022-01-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * rate stages step redesign and refactor ([#24](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/24)) ([3ac585b](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/3ac585b57ce1e426979cac80bcf4980978399339))
7
+
8
+ # [1.11.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.10.2...v1.11.0) (2022-01-04)
9
+
10
+
11
+ ### Features
12
+
13
+ * 🌟 Migrated hooks to library 🌟 ([#17](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/17)) ([464d5c8](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/464d5c8f32de3d1b2255fd8a458a0bee540862bb))
14
+
15
+ ## [1.10.2](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.10.1...v1.10.2) (2022-01-04)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * color priority in rate stages ([#22](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/22)) ([7062efa](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/7062efa3dcc0f6ff792e822e0dabf8fa8cd1b5da))
21
+
22
+ ## [1.10.1](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.10.0...v1.10.1) (2021-12-10)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * removed recharts ([#20](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/20)) ([01a9e74](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/01a9e74da24ae7788f92c20719690450559985a8))
28
+
1
29
  # [1.10.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v1.9.0...v1.10.0) (2021-11-17)
2
30
 
3
31
 
@@ -19,16 +19,12 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
- const Advice = _ref => {
23
- let {
24
- contextApiInfo,
25
- title,
26
- contentText
27
- } = _ref;
28
- const {
29
- assets,
30
- Label
31
- } = contextApiInfo;
22
+ var Advice = function Advice(_ref) {
23
+ var contextApiInfo = _ref.contextApiInfo,
24
+ title = _ref.title,
25
+ contentText = _ref.contentText;
26
+ var assets = contextApiInfo.assets,
27
+ Label = contextApiInfo.Label;
32
28
  return /*#__PURE__*/_react.default.createElement("div", {
33
29
  className: _stylesModule.default.container
34
30
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -27,32 +27,25 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
27
27
 
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
29
 
30
- const Amount = _ref => {
30
+ var Amount = function Amount(_ref) {
31
31
  var _expirations$;
32
32
 
33
- let {
34
- contextApiInfo,
35
- billData,
36
- containerClassName,
37
- withBottomMargin
38
- } = _ref;
39
- const {
40
- config,
41
- Label
42
- } = contextApiInfo;
43
- const {
44
- useBriefExpiration
45
- } = config;
46
- const {
47
- amountTitle,
48
- firstExpirationDate,
49
- firstExpirationDateBrief,
50
- secondExpirationDateBrief,
51
- currency
52
- } = config.texts.commons;
53
- const isBrief = useBriefExpiration && firstExpirationDateBrief && secondExpirationDateBrief;
54
- const firstText = isBrief ? firstExpirationDateBrief : firstExpirationDate;
55
- const expirations = [{
33
+ var contextApiInfo = _ref.contextApiInfo,
34
+ billData = _ref.billData,
35
+ containerClassName = _ref.containerClassName,
36
+ withBottomMargin = _ref.withBottomMargin;
37
+ var config = contextApiInfo.config,
38
+ Label = contextApiInfo.Label;
39
+ var useBriefExpiration = config.useBriefExpiration;
40
+ var _config$texts$commons = config.texts.commons,
41
+ amountTitle = _config$texts$commons.amountTitle,
42
+ firstExpirationDate = _config$texts$commons.firstExpirationDate,
43
+ firstExpirationDateBrief = _config$texts$commons.firstExpirationDateBrief,
44
+ secondExpirationDateBrief = _config$texts$commons.secondExpirationDateBrief,
45
+ currency = _config$texts$commons.currency;
46
+ var isBrief = useBriefExpiration && firstExpirationDateBrief && secondExpirationDateBrief;
47
+ var firstText = isBrief ? firstExpirationDateBrief : firstExpirationDate;
48
+ var expirations = [{
56
49
  text: firstText,
57
50
  expiration: (0, _expirations.getExpiration)(billData, 1)
58
51
  }, isBrief && {
@@ -60,7 +53,7 @@ const Amount = _ref => {
60
53
  expiration: (0, _expirations.getExpiration)(billData, 2)
61
54
  }];
62
55
 
63
- const getExpirationComponent = item => {
56
+ var getExpirationComponent = function getExpirationComponent(item) {
64
57
  var _item$expiration;
65
58
 
66
59
  return (item === null || item === void 0 ? void 0 : (_item$expiration = item.expiration) === null || _item$expiration === void 0 ? void 0 : _item$expiration.date) && /*#__PURE__*/_react.default.createElement("div", {
@@ -87,7 +80,9 @@ const Amount = _ref => {
87
80
  amount: (_expirations$ = expirations[0]) === null || _expirations$ === void 0 ? void 0 : _expirations$.expiration.amount
88
81
  })), /*#__PURE__*/_react.default.createElement("div", {
89
82
  className: _stylesModule.default.expirations
90
- }, expirations.map(exp => getExpirationComponent(exp))));
83
+ }, expirations.map(function (exp) {
84
+ return getExpirationComponent(exp);
85
+ })));
91
86
  };
92
87
 
93
88
  Amount.propTypes = {
@@ -7,6 +7,10 @@ exports.getFirstExpiration = void 0;
7
7
 
8
8
  var _seamlessImmutable = require("seamless-immutable");
9
9
 
10
- const getFirstExpiration = billData => (0, _seamlessImmutable.getIn)(billData, ['expirations'], []).find(expiration => expiration.number === 1) || {};
10
+ var getFirstExpiration = function getFirstExpiration(billData) {
11
+ return (0, _seamlessImmutable.getIn)(billData, ['expirations'], []).find(function (expiration) {
12
+ return expiration.number === 1;
13
+ }) || {};
14
+ };
11
15
 
12
16
  exports.getFirstExpiration = getFirstExpiration;
@@ -15,16 +15,12 @@ var _WithContextApi = _interopRequireDefault(require("../WithContextApi"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- const Banner = _ref => {
19
- let {
20
- contextApiInfo,
21
- image,
22
- styleBanner,
23
- externalLink
24
- } = _ref;
25
- const {
26
- ExternalLink
27
- } = contextApiInfo;
18
+ var Banner = function Banner(_ref) {
19
+ var contextApiInfo = _ref.contextApiInfo,
20
+ image = _ref.image,
21
+ styleBanner = _ref.styleBanner,
22
+ externalLink = _ref.externalLink;
23
+ var ExternalLink = contextApiInfo.ExternalLink;
28
24
  return /*#__PURE__*/_react.default.createElement(ExternalLink, {
29
25
  key: externalLink,
30
26
  url: externalLink
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RESPONSIVE_BAR_WIDTH = exports.DESKTOP_BAR_WIDTH = exports.BAR_CHART_CONFIG = void 0;
7
- const BAR_CHART_CONFIG = {
7
+ var BAR_CHART_CONFIG = {
8
8
  spacingOptions: {
9
9
  axisPadding: 10,
10
10
  scrollPadding: 0,
@@ -18,7 +18,7 @@ const BAR_CHART_CONFIG = {
18
18
  hideYAxis: true
19
19
  };
20
20
  exports.BAR_CHART_CONFIG = BAR_CHART_CONFIG;
21
- const DESKTOP_BAR_WIDTH = 40;
21
+ var DESKTOP_BAR_WIDTH = 40;
22
22
  exports.DESKTOP_BAR_WIDTH = DESKTOP_BAR_WIDTH;
23
- const RESPONSIVE_BAR_WIDTH = 90;
23
+ var RESPONSIVE_BAR_WIDTH = 90;
24
24
  exports.RESPONSIVE_BAR_WIDTH = RESPONSIVE_BAR_WIDTH;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -23,40 +25,35 @@ var _constants = require("./constants");
23
25
 
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
27
 
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
29
 
28
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || 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; }
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
31
 
30
32
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
31
33
 
32
- const BarChartSection = _ref => {
34
+ var BarChartSection = function BarChartSection(_ref) {
33
35
  var _colors$barChart;
34
36
 
35
- let {
36
- contextApiInfo,
37
- data,
38
- isDesktop,
39
- unit
40
- } = _ref;
41
- const {
42
- BarChart,
43
- Label,
44
- config,
45
- assets
46
- } = contextApiInfo;
47
- const {
48
- CalendarIcon,
49
- EnergyIcon
50
- } = assets;
51
- const {
52
- texts,
53
- colors
54
- } = config;
55
- const {
56
- processedData,
57
- xAxisDefinition
58
- } = (0, _react.useMemo)(() => (0, _utils.getProcessedData)(data, colors.barChart), [data]);
59
- const yAxisLabel = unit && "".concat(texts.consumptionPeriod.consumption, " (").concat(unit, ")");
37
+ var contextApiInfo = _ref.contextApiInfo,
38
+ data = _ref.data,
39
+ isDesktop = _ref.isDesktop,
40
+ unit = _ref.unit;
41
+ var BarChart = contextApiInfo.BarChart,
42
+ Label = contextApiInfo.Label,
43
+ config = contextApiInfo.config,
44
+ assets = contextApiInfo.assets;
45
+ var CalendarIcon = assets.CalendarIcon,
46
+ EnergyIcon = assets.EnergyIcon;
47
+ var texts = config.texts,
48
+ colors = config.colors;
49
+
50
+ var _useMemo = (0, _react.useMemo)(function () {
51
+ return (0, _utils.getProcessedData)(data, colors.barChart);
52
+ }, [data]),
53
+ processedData = _useMemo.processedData,
54
+ xAxisDefinition = _useMemo.xAxisDefinition;
55
+
56
+ var yAxisLabel = unit && "".concat(texts.consumptionPeriod.consumption, " (").concat(unit, ")");
60
57
  return /*#__PURE__*/_react.default.createElement("div", {
61
58
  className: _stylesModule.default.sectionContainer
62
59
  }, /*#__PURE__*/_react.default.createElement(Label, {
@@ -5,18 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getProcessedData = void 0;
7
7
 
8
- const getProcessedData = function (data) {
9
- let colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8
+ var getProcessedData = function getProcessedData(data) {
9
+ var colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10
10
 
11
- const getBarColor = index => index === 0 ? colors.first : index === data.length - 1 ? colors.last : colors.main;
11
+ var getBarColor = function getBarColor(index) {
12
+ return index === 0 ? colors.first : index === data.length - 1 ? colors.last : colors.main;
13
+ };
12
14
 
13
- const getLabelColor = index => index === 0 ? colors.valueFirst : index === data.length - 1 ? colors.last : colors.valueMain;
15
+ var getLabelColor = function getLabelColor(index) {
16
+ return index === 0 ? colors.valueFirst : index === data.length - 1 ? colors.last : colors.valueMain;
17
+ };
14
18
 
15
- const processedData = data.map((_ref, index) => {
16
- let {
17
- period,
18
- consumption
19
- } = _ref;
19
+ var processedData = data.map(function (_ref, index) {
20
+ var period = _ref.period,
21
+ consumption = _ref.consumption;
20
22
  return {
21
23
  value: consumption,
22
24
  mainLabel: period,
@@ -25,18 +27,16 @@ const getProcessedData = function (data) {
25
27
  onTopLabelColor: getLabelColor(index)
26
28
  };
27
29
  });
28
- const xAxisDefinition = processedData.map((_ref2, index) => {
29
- let {
30
- mainLabel
31
- } = _ref2;
30
+ var xAxisDefinition = processedData.map(function (_ref2, index) {
31
+ var mainLabel = _ref2.mainLabel;
32
32
  return {
33
- mainLabel,
33
+ mainLabel: mainLabel,
34
34
  color: getLabelColor(index)
35
35
  };
36
36
  });
37
37
  return {
38
38
  processedData: [processedData],
39
- xAxisDefinition
39
+ xAxisDefinition: xAxisDefinition
40
40
  };
41
41
  };
42
42
 
@@ -23,34 +23,29 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
26
- const ConceptCard = _ref => {
27
- let {
28
- contextApiInfo,
29
- isOpen,
30
- onClick,
31
- index,
32
- titleHeader,
33
- total,
34
- lines = []
35
- } = _ref;
36
- const {
37
- Card,
38
- Label,
39
- config,
40
- assets
41
- } = contextApiInfo;
42
- const {
43
- showZeroConcepts,
44
- colors
45
- } = config;
46
- const {
47
- ArrowDownwardIcon,
48
- ArrowUpwardIcon
49
- } = assets;
50
-
51
- const handleOnClick = () => onClick(index);
52
-
53
- const Header = /*#__PURE__*/_react.default.createElement("div", {
26
+ var ConceptCard = function ConceptCard(_ref) {
27
+ var contextApiInfo = _ref.contextApiInfo,
28
+ isOpen = _ref.isOpen,
29
+ onClick = _ref.onClick,
30
+ index = _ref.index,
31
+ titleHeader = _ref.titleHeader,
32
+ total = _ref.total,
33
+ _ref$lines = _ref.lines,
34
+ lines = _ref$lines === void 0 ? [] : _ref$lines;
35
+ var Card = contextApiInfo.Card,
36
+ Label = contextApiInfo.Label,
37
+ config = contextApiInfo.config,
38
+ assets = contextApiInfo.assets;
39
+ var showZeroConcepts = config.showZeroConcepts,
40
+ colors = config.colors;
41
+ var ArrowDownwardIcon = assets.ArrowDownwardIcon,
42
+ ArrowUpwardIcon = assets.ArrowUpwardIcon;
43
+
44
+ var handleOnClick = function handleOnClick() {
45
+ return onClick(index);
46
+ };
47
+
48
+ var Header = /*#__PURE__*/_react.default.createElement("div", {
54
49
  className: _stylesModule.default.headerContainer
55
50
  }, /*#__PURE__*/_react.default.createElement(Label, {
56
51
  alias: _aliases.BILL_CALC_CONCEPT
@@ -61,30 +56,36 @@ const ConceptCard = _ref => {
61
56
  variant: "xlarge"
62
57
  }));
63
58
 
64
- const handleRenderLines = list => (list.amount !== 0 || showZeroConcepts) && /*#__PURE__*/_react.default.createElement("div", {
65
- className: _stylesModule.default.lineContainer,
66
- key: list.title
67
- }, /*#__PURE__*/_react.default.createElement("div", {
68
- className: _stylesModule.default.conceptLineContainer
69
- }, /*#__PURE__*/_react.default.createElement(Label, {
70
- alias: _aliases.CONCEPT_TITLE
71
- }, list.title), /*#__PURE__*/_react.default.createElement(_StyledAmount.default, {
72
- alias: _aliases.CONCEPT_LIST_AMOUNT,
73
- aliasDecimal: _aliases.CONCEPT_LIST_AMOUNT_DECIMAL,
74
- amount: list.amount,
75
- variant: "large"
76
- })), list.description && /*#__PURE__*/_react.default.createElement(Label, {
77
- alias: _aliases.LINE_DESCRIPTION
78
- }, list.description));
79
-
80
- const iconsStyle = {
59
+ var handleRenderLines = function handleRenderLines(list) {
60
+ return (list.amount !== 0 || showZeroConcepts) && /*#__PURE__*/_react.default.createElement("div", {
61
+ className: _stylesModule.default.lineContainer,
62
+ key: list.title
63
+ }, /*#__PURE__*/_react.default.createElement("div", {
64
+ className: _stylesModule.default.conceptLineContainer
65
+ }, /*#__PURE__*/_react.default.createElement(Label, {
66
+ alias: _aliases.CONCEPT_TITLE
67
+ }, list.title), /*#__PURE__*/_react.default.createElement(_StyledAmount.default, {
68
+ alias: _aliases.CONCEPT_LIST_AMOUNT,
69
+ aliasDecimal: _aliases.CONCEPT_LIST_AMOUNT_DECIMAL,
70
+ amount: list.amount,
71
+ variant: "large"
72
+ })), list.description && /*#__PURE__*/_react.default.createElement(Label, {
73
+ alias: _aliases.LINE_DESCRIPTION
74
+ }, list.description));
75
+ };
76
+
77
+ var iconsStyle = {
81
78
  fill: colors.primary
82
79
  };
83
80
  return /*#__PURE__*/_react.default.createElement(Card, {
84
81
  className: "".concat(_stylesModule.default.container, " ").concat((0, _array.isEmpty)(lines) && _stylesModule.default.containerWithoutLines),
85
82
  expandableIconButtonClassName: _stylesModule.default.expandIcon,
86
- ExpandedIcon: ArrowUpwardIcon && (() => /*#__PURE__*/_react.default.createElement(ArrowUpwardIcon, iconsStyle)),
87
- NonExpandedIcon: ArrowDownwardIcon && (() => /*#__PURE__*/_react.default.createElement(ArrowDownwardIcon, iconsStyle)),
83
+ ExpandedIcon: ArrowUpwardIcon && function () {
84
+ return /*#__PURE__*/_react.default.createElement(ArrowUpwardIcon, iconsStyle);
85
+ },
86
+ NonExpandedIcon: ArrowDownwardIcon && function () {
87
+ return /*#__PURE__*/_react.default.createElement(ArrowDownwardIcon, iconsStyle);
88
+ },
88
89
  expandableContentClassName: "".concat(isOpen && _stylesModule.default.expandableContent),
89
90
  header: Header,
90
91
  horizontal: true,
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SQUARE_SIZE = void 0;
7
- const SQUARE_SIZE = 10;
7
+ var SQUARE_SIZE = 10;
8
8
  exports.SQUARE_SIZE = SQUARE_SIZE;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -25,50 +27,58 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
25
27
 
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
-
30
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || 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; }
31
-
32
- const BillCalculation = _ref => {
33
- let {
34
- billData,
35
- contextApiInfo
36
- } = _ref;
37
- const {
38
- Label,
39
- config
40
- } = contextApiInfo;
41
- const {
42
- texts,
43
- showZeroConcepts,
44
- stylesConfig,
45
- formatters,
46
- colors
47
- } = config;
48
- const {
49
- periodFormatter
50
- } = formatters;
51
- const {
52
- withBillCalcTitleDate
53
- } = config.validations;
54
- const {
55
- detail
56
- } = billData;
57
- const [openedConcept, setOpenedConcept] = (0, _react.useState)(null);
58
-
59
- const handleClick = index => setOpenedConcept(openedConcept !== index ? index : null);
60
-
61
- const title = (0, _utils.periodToTitleMapper)(billData, texts, periodFormatter, withBillCalcTitleDate(billData));
62
-
63
- const handleRenderConceptCard = (concept, index) => (concept.total !== 0 || showZeroConcepts) && /*#__PURE__*/_react.default.createElement(_ConceptCard.default, {
64
- titleHeader: concept.title,
65
- total: concept.total,
66
- lines: concept.lines,
67
- index: index,
68
- isOpen: openedConcept === index,
69
- onClick: handleClick,
70
- key: concept.title
71
- });
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
+
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+
34
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
35
+
36
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
37
+
38
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
39
+
40
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
41
+
42
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
43
+
44
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
45
+
46
+ var BillCalculation = function BillCalculation(_ref) {
47
+ var billData = _ref.billData,
48
+ contextApiInfo = _ref.contextApiInfo;
49
+ var Label = contextApiInfo.Label,
50
+ config = contextApiInfo.config;
51
+ var texts = config.texts,
52
+ showZeroConcepts = config.showZeroConcepts,
53
+ stylesConfig = config.stylesConfig,
54
+ formatters = config.formatters,
55
+ colors = config.colors;
56
+ var periodFormatter = formatters.periodFormatter;
57
+ var withBillCalcTitleDate = config.validations.withBillCalcTitleDate;
58
+ var detail = billData.detail;
59
+
60
+ var _useState = (0, _react.useState)(null),
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ openedConcept = _useState2[0],
63
+ setOpenedConcept = _useState2[1];
64
+
65
+ var handleClick = function handleClick(index) {
66
+ return setOpenedConcept(openedConcept !== index ? index : null);
67
+ };
68
+
69
+ var title = (0, _utils.periodToTitleMapper)(billData, texts, periodFormatter, withBillCalcTitleDate(billData));
70
+
71
+ var handleRenderConceptCard = function handleRenderConceptCard(concept, index) {
72
+ return (concept.total !== 0 || showZeroConcepts) && /*#__PURE__*/_react.default.createElement(_ConceptCard.default, {
73
+ titleHeader: concept.title,
74
+ total: concept.total,
75
+ lines: concept.lines,
76
+ index: index,
77
+ isOpen: openedConcept === index,
78
+ onClick: handleClick,
79
+ key: concept.title
80
+ });
81
+ };
72
82
 
73
83
  return /*#__PURE__*/_react.default.createElement("div", {
74
84
  className: _stylesModule.default.container
@@ -15,25 +15,22 @@ var _periods = require("../../shared/utils/periods");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- const periodToTitleMapper = (billData, texts, periodFormatter, withBillCalcTitleDate) => {
18
+ var periodToTitleMapper = function periodToTitleMapper(billData, texts, periodFormatter, withBillCalcTitleDate) {
19
19
  var _settlements$current, _settlements$current2;
20
20
 
21
- const currentPeriod = (0, _periods.getCurrentPeriod)(billData) || {};
22
- const {
23
- settlements
24
- } = currentPeriod;
25
- const periodicity = settlements === null || settlements === void 0 ? void 0 : settlements.periodicity;
26
- const currentSettlement = (settlements === null || settlements === void 0 ? void 0 : (_settlements$current = settlements.current) === null || _settlements$current === void 0 ? void 0 : _settlements$current.number) || '-';
27
- const totalSettlements = (settlements === null || settlements === void 0 ? void 0 : settlements.total_settlements) || '-';
28
- const periodNumber = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.number) || '-';
29
- const year = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.year) || '-';
30
- const {
31
- settlement,
32
- period,
33
- bimester
34
- } = texts.commons;
35
- const issueedDate = settlements === null || settlements === void 0 ? void 0 : (_settlements$current2 = settlements.current) === null || _settlements$current2 === void 0 ? void 0 : _settlements$current2.issued_on;
36
- const issuedDateLabel = withBillCalcTitleDate ? " (".concat((0, _dayjs.default)(issueedDate, 'YYYY-MM-DD').format('MM/YYYY'), ")") : '';
21
+ var currentPeriod = (0, _periods.getCurrentPeriod)(billData) || {};
22
+ var settlements = currentPeriod.settlements;
23
+ var periodicity = settlements === null || settlements === void 0 ? void 0 : settlements.periodicity;
24
+ var currentSettlement = (settlements === null || settlements === void 0 ? void 0 : (_settlements$current = settlements.current) === null || _settlements$current === void 0 ? void 0 : _settlements$current.number) || '-';
25
+ var totalSettlements = (settlements === null || settlements === void 0 ? void 0 : settlements.total_settlements) || '-';
26
+ var periodNumber = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.number) || '-';
27
+ var year = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.year) || '-';
28
+ var _texts$commons = texts.commons,
29
+ settlement = _texts$commons.settlement,
30
+ period = _texts$commons.period,
31
+ bimester = _texts$commons.bimester;
32
+ var issueedDate = settlements === null || settlements === void 0 ? void 0 : (_settlements$current2 = settlements.current) === null || _settlements$current2 === void 0 ? void 0 : _settlements$current2.issued_on;
33
+ var issuedDateLabel = withBillCalcTitleDate ? " (".concat((0, _dayjs.default)(issueedDate, 'YYYY-MM-DD').format('MM/YYYY'), ")") : '';
37
34
  if (periodFormatter) return periodFormatter({
38
35
  startDate: settlements === null || settlements === void 0 ? void 0 : settlements.start_date,
39
36
  endDate: settlements === null || settlements === void 0 ? void 0 : settlements.end_date