@widergy/utilitygo-smart-bill-web 2.2.1 → 3.0.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 (136) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/Advice/index.js +11 -8
  3. package/dist/components/Amount/index.js +27 -23
  4. package/dist/components/Amount/utils.js +1 -5
  5. package/dist/components/Banner/index.js +11 -8
  6. package/dist/components/BarChart/constants.js +3 -6
  7. package/dist/components/BarChart/index.js +29 -24
  8. package/dist/components/BarChart/utils.js +15 -15
  9. package/dist/components/BillCalculation/components/ConceptCard/index.js +53 -47
  10. package/dist/components/BillCalculation/components/Glossary/index.js +49 -66
  11. package/dist/components/BillCalculation/components/Glossary/styles.module.scss +1 -0
  12. package/dist/components/BillCalculation/constants.js +1 -2
  13. package/dist/components/BillCalculation/index.js +49 -53
  14. package/dist/components/BillCalculation/utils.js +19 -22
  15. package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +26 -24
  16. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/constants.js +2 -3
  17. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +16 -17
  18. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/styles.module.scss +3 -3
  19. package/dist/components/BillSummary/components/BilledConcepts/constants.js +12 -17
  20. package/dist/components/BillSummary/components/BilledConcepts/index.js +30 -41
  21. package/dist/components/BillSummary/components/BilledConcepts/utils.js +44 -68
  22. package/dist/components/BillSummary/index.js +71 -71
  23. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +9 -10
  24. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +18 -12
  25. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +1 -1
  26. package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +144 -143
  27. package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +17 -16
  28. package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +84 -88
  29. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +22 -13
  30. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +1 -1
  31. package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +22 -16
  32. package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +13 -9
  33. package/dist/components/ConsumptionComparison/index.js +42 -47
  34. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +28 -24
  35. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/styles.module.scss +1 -1
  36. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +19 -15
  37. package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +16 -14
  38. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +22 -17
  39. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +1 -1
  40. package/dist/components/ConsumptionEnergyDetails/index.js +47 -43
  41. package/dist/components/ConsumptionEnergyDetails/styles.module.scss +2 -2
  42. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +65 -62
  43. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +11 -13
  44. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +21 -19
  45. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +17 -12
  46. package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +43 -39
  47. package/dist/components/ConsumptionIncluded/components/TimelineRow/styles.module.scss +2 -2
  48. package/dist/components/ConsumptionIncluded/index.js +32 -34
  49. package/dist/components/ConsumptionIncluded/utils.js +29 -33
  50. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +15 -12
  51. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +24 -22
  52. package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +19 -28
  53. package/dist/components/ConsumptionPeriod/components/Reading/index.js +36 -34
  54. package/dist/components/ConsumptionPeriod/index.js +13 -10
  55. package/dist/components/ConsumptionPeriod/utils.js +13 -15
  56. package/dist/components/Date/index.js +13 -11
  57. package/dist/components/DebtState/index.js +15 -10
  58. package/dist/components/IconAndDetails/index.js +20 -19
  59. package/dist/components/Magnitude/index.js +16 -14
  60. package/dist/components/Magnitude/utils.js +2 -8
  61. package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +19 -16
  62. package/dist/components/MainBillData/components/BillAlert/index.js +25 -33
  63. package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +20 -13
  64. package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +15 -13
  65. package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +1 -3
  66. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +24 -17
  67. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/styles.module.scss +2 -2
  68. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +1 -1
  69. package/dist/components/MainBillData/components/BillBody/index.js +43 -46
  70. package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +17 -13
  71. package/dist/components/MainBillData/components/BillHeader/index.js +30 -26
  72. package/dist/components/MainBillData/components/BillHeader/styles.module.scss +1 -1
  73. package/dist/components/MainBillData/index.js +8 -7
  74. package/dist/components/MainBillData/theme.js +7 -9
  75. package/dist/components/MainBillData/utils.js +1 -5
  76. package/dist/components/Period/index.js +55 -45
  77. package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +16 -13
  78. package/dist/components/PowerProgresBar/index.js +32 -32
  79. package/dist/components/RateAndCategory/index.js +26 -29
  80. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +21 -15
  81. package/dist/components/RatesDefinition/components/BillRate/index.js +25 -16
  82. package/dist/components/RatesDefinition/components/BillRate/styles.module.scss +1 -1
  83. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +15 -11
  84. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +27 -23
  85. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +12 -9
  86. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/styles.module.scss +1 -1
  87. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +9 -9
  88. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +22 -21
  89. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +35 -38
  90. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/styles.module.scss +0 -1
  91. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +2 -4
  92. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +18 -32
  93. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +35 -47
  94. package/dist/components/RatesDefinition/components/CategoryByConsumption/constants.js +18 -36
  95. package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +24 -33
  96. package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +1 -5
  97. package/dist/components/RatesDefinition/components/PurchasedRate/index.js +20 -15
  98. package/dist/components/RatesDefinition/index.js +21 -17
  99. package/dist/components/RatesDefinition/styles.module.scss +1 -1
  100. package/dist/components/SmartBillProvider/index.js +13 -36
  101. package/dist/components/StyledAmount/constants.js +2 -3
  102. package/dist/components/StyledAmount/index.js +20 -29
  103. package/dist/components/WithContextApi/index.js +19 -27
  104. package/dist/components/WithContextApi/layout.js +3 -4
  105. package/dist/components/WithSeason/index.js +7 -11
  106. package/dist/constants/deviceSizes.js +27 -24
  107. package/dist/constants/seasons.js +3 -5
  108. package/dist/index.js +19 -19
  109. package/dist/scss/variables/commonColors.module.scss +1 -1
  110. package/dist/shared/Context/index.js +5 -3
  111. package/dist/shared/constants/aliases.js +691 -694
  112. package/dist/shared/constants/consumptions.js +5 -9
  113. package/dist/shared/constants/periodicities.js +2 -3
  114. package/dist/shared/constants/rates.js +2 -3
  115. package/dist/shared/constants/readings.js +3 -5
  116. package/dist/shared/constants/seasons.js +3 -5
  117. package/dist/shared/constants/stagesGraph.js +4 -8
  118. package/dist/shared/types/assetsTypes.js +1 -2
  119. package/dist/shared/types/billDataTypes.js +6 -11
  120. package/dist/shared/types/componentsTypes.js +19 -14
  121. package/dist/shared/types/formattersTypes.js +2 -3
  122. package/dist/shared/types/rateStagesTypes.js +3 -6
  123. package/dist/shared/types/smartBillTypes.js +5 -11
  124. package/dist/shared/types/textsTypes.js +2 -3
  125. package/dist/shared/utils/billCalculation.js +9 -9
  126. package/dist/shared/utils/consumptions.js +27 -55
  127. package/dist/shared/utils/context.js +6 -5
  128. package/dist/shared/utils/expirations.js +1 -5
  129. package/dist/shared/utils/periods.js +14 -20
  130. package/dist/shared/utils/rates.js +1 -5
  131. package/dist/shared/utils/readings.js +2 -10
  132. package/dist/shared/utils/season.js +1 -5
  133. package/dist/shared/utils/stagesGraph.js +11 -15
  134. package/dist/utils/hooks.js +2 -3
  135. package/dist/utils.js +4 -8
  136. package/package.json +26 -63
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -23,75 +22,77 @@ var _aliases = require("../../shared/constants/aliases");
23
22
  var _BilledConcepts = _interopRequireDefault(require("./components/BilledConcepts"));
24
23
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
25
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
- 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
- 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; }
28
- var BillSummary = function BillSummary(_ref) {
25
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
26
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
+ const BillSummary = _ref => {
29
28
  var _billData$client, _billData$client2, _currentPeriod$settle, _currentPeriod$settle2;
30
- var contextApiInfo = _ref.contextApiInfo,
31
- billData = _ref.billData;
32
- var config = contextApiInfo.config,
33
- assets = contextApiInfo.assets;
34
- var consumptionDetail = config.externalLinks.consumptionDetail;
35
- var _config$validations = config.validations,
36
- showBillSummaryBanner = _config$validations.showBillSummaryBanner,
37
- showPower = _config$validations.showPower,
38
- showCategory = _config$validations.showCategory;
39
- var texts = config.texts;
40
- var ConsumptionBannerIcon = assets.ConsumptionBannerIcon,
41
- ConsumptionBannerResponsiveIcon = assets.ConsumptionBannerResponsiveIcon;
42
- var currentPeriod = (0, _periods.getCurrentPeriod)(billData);
43
- var hiredPowerConsumption = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.PURCHASED);
44
- var registeredPowerConsumption = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.REGISTERED);
45
- var exceededPower = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.EXCEEDED);
46
- var rate = billData === null || billData === void 0 || (_billData$client = billData.client) === null || _billData$client === void 0 || (_billData$client = _billData$client.rate) === null || _billData$client === void 0 ? void 0 : _billData$client.purchased;
47
- var category = billData === null || billData === void 0 || (_billData$client2 = billData.client) === null || _billData$client2 === void 0 || (_billData$client2 = _billData$client2.rate) === null || _billData$client2 === void 0 ? void 0 : _billData$client2.category;
48
- var multipleSettlements = (currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle = currentPeriod.settlements) === null || _currentPeriod$settle === void 0 ? void 0 : _currentPeriod$settle.total_settlements) > 1;
49
- var issuedDate = currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle2 = currentPeriod.settlements) === null || _currentPeriod$settle2 === void 0 || (_currentPeriod$settle2 = _currentPeriod$settle2.current) === null || _currentPeriod$settle2 === void 0 ? void 0 : _currentPeriod$settle2.issued_on;
50
- var _useScreenSize = (0, _hooks.useScreenSize)(),
51
- isDesktopSize = _useScreenSize.isDesktopSize;
52
- var withBanner = showBillSummaryBanner(billData);
53
- var RenderPeriod = function RenderPeriod() {
54
- return /*#__PURE__*/_react.default.createElement(_Period.default, {
55
- billData: billData,
56
- alias: _aliases.SUMMARY_PERIOD,
57
- currentPeriod: currentPeriod,
58
- multipleSettlements: multipleSettlements,
59
- issuedDate: issuedDate
60
- });
61
- };
62
- var RenderConsumptionEnergyDetails = function RenderConsumptionEnergyDetails() {
63
- return /*#__PURE__*/_react.default.createElement(_ConsumptionEnergyDetails.default, {
64
- billData: billData,
65
- currentPeriod: currentPeriod,
66
- multipleSettlements: multipleSettlements,
67
- withPercentage: true
68
- });
69
- };
70
- var RenderRateAndCategory = function RenderRateAndCategory() {
71
- return /*#__PURE__*/_react.default.createElement(_RateAndCategory.default, {
72
- rate: rate,
73
- category: category,
74
- title: texts.billSummary.rateTitle,
75
- classes: {
76
- container: _stylesModule.default.rateContainer,
77
- purchasedRate: _stylesModule.default.purchasedRate,
78
- category: _stylesModule.default.category
79
- },
80
- showCategory: showCategory(billData)
81
- });
82
- };
83
- var RenderPowerProgresBar = function RenderPowerProgresBar() {
84
- return /*#__PURE__*/_react.default.createElement(_PowerProgresBar.default, {
85
- hiredPowerConsumption: hiredPowerConsumption,
86
- registeredPowerConsumption: registeredPowerConsumption,
87
- exceededPower: exceededPower
88
- });
89
- };
90
- var RenderBilledConcepts = function RenderBilledConcepts() {
91
- return /*#__PURE__*/_react.default.createElement(_BilledConcepts.default, {
92
- billData: billData
93
- });
94
- };
29
+ let {
30
+ contextApiInfo,
31
+ billData
32
+ } = _ref;
33
+ const {
34
+ config,
35
+ assets
36
+ } = contextApiInfo;
37
+ const {
38
+ consumptionDetail
39
+ } = config.externalLinks;
40
+ const {
41
+ showBillSummaryBanner,
42
+ showPower,
43
+ showCategory
44
+ } = config.validations;
45
+ const {
46
+ texts
47
+ } = config;
48
+ const {
49
+ ConsumptionBannerIcon,
50
+ ConsumptionBannerResponsiveIcon
51
+ } = assets;
52
+ const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
53
+ const hiredPowerConsumption = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.PURCHASED);
54
+ const registeredPowerConsumption = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.REGISTERED);
55
+ const exceededPower = (0, _consumptions.getTotalConsumption)(currentPeriod, _consumptions2.POWER_TYPES.EXCEEDED);
56
+ const rate = billData === null || billData === void 0 || (_billData$client = billData.client) === null || _billData$client === void 0 || (_billData$client = _billData$client.rate) === null || _billData$client === void 0 ? void 0 : _billData$client.purchased;
57
+ const category = billData === null || billData === void 0 || (_billData$client2 = billData.client) === null || _billData$client2 === void 0 || (_billData$client2 = _billData$client2.rate) === null || _billData$client2 === void 0 ? void 0 : _billData$client2.category;
58
+ const multipleSettlements = (currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle = currentPeriod.settlements) === null || _currentPeriod$settle === void 0 ? void 0 : _currentPeriod$settle.total_settlements) > 1;
59
+ const issuedDate = currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle2 = currentPeriod.settlements) === null || _currentPeriod$settle2 === void 0 || (_currentPeriod$settle2 = _currentPeriod$settle2.current) === null || _currentPeriod$settle2 === void 0 ? void 0 : _currentPeriod$settle2.issued_on;
60
+ const {
61
+ isDesktopSize
62
+ } = (0, _hooks.useScreenSize)();
63
+ const withBanner = showBillSummaryBanner(billData);
64
+ const RenderPeriod = () => /*#__PURE__*/_react.default.createElement(_Period.default, {
65
+ billData: billData,
66
+ alias: _aliases.SUMMARY_PERIOD,
67
+ currentPeriod: currentPeriod,
68
+ multipleSettlements: multipleSettlements,
69
+ issuedDate: issuedDate
70
+ });
71
+ const RenderConsumptionEnergyDetails = () => /*#__PURE__*/_react.default.createElement(_ConsumptionEnergyDetails.default, {
72
+ billData: billData,
73
+ currentPeriod: currentPeriod,
74
+ multipleSettlements: multipleSettlements,
75
+ withPercentage: true
76
+ });
77
+ const RenderRateAndCategory = () => /*#__PURE__*/_react.default.createElement(_RateAndCategory.default, {
78
+ rate: rate,
79
+ category: category,
80
+ title: texts.billSummary.rateTitle,
81
+ classes: {
82
+ container: _stylesModule.default.rateContainer,
83
+ purchasedRate: _stylesModule.default.purchasedRate,
84
+ category: _stylesModule.default.category
85
+ },
86
+ showCategory: showCategory(billData)
87
+ });
88
+ const RenderPowerProgresBar = () => /*#__PURE__*/_react.default.createElement(_PowerProgresBar.default, {
89
+ hiredPowerConsumption: hiredPowerConsumption,
90
+ registeredPowerConsumption: registeredPowerConsumption,
91
+ exceededPower: exceededPower
92
+ });
93
+ const RenderBilledConcepts = () => /*#__PURE__*/_react.default.createElement(_BilledConcepts.default, {
94
+ billData: billData
95
+ });
95
96
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, isDesktopSize ? /*#__PURE__*/_react.default.createElement("div", {
96
97
  className: _stylesModule.default.container
97
98
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -118,5 +119,4 @@ BillSummary.propTypes = {
118
119
  contextApiInfo: _smartBillTypes.contextApiInfoTypes,
119
120
  billData: _billDataTypes.billDataTypes
120
121
  };
121
- var _default = (0, _WithContextApi.default)()(BillSummary);
122
- exports.default = _default;
122
+ var _default = exports.default = (0, _WithContextApi.default)()(BillSummary);
@@ -10,16 +10,16 @@ var _object = require("@widergy/web-utils/lib/object");
10
10
  var _componentsTypes = require("../../../../../../shared/types/componentsTypes");
11
11
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- var DataLine = function DataLine(_ref) {
14
- var fields = _ref.fields;
13
+ const DataLine = _ref => {
14
+ let {
15
+ fields
16
+ } = _ref;
15
17
  return !(0, _object.objectIsEmpty)(fields) && /*#__PURE__*/_react.default.createElement("div", {
16
18
  className: _stylesModule.default.container
17
- }, fields === null || fields === void 0 ? void 0 : fields.map(function (field) {
18
- return field && /*#__PURE__*/_react.default.createElement("div", {
19
- key: field.id,
20
- className: _stylesModule.default.cell
21
- }, field.Component);
22
- }));
19
+ }, fields === null || fields === void 0 ? void 0 : fields.map(field => field && /*#__PURE__*/_react.default.createElement("div", {
20
+ key: field.id,
21
+ className: _stylesModule.default.cell
22
+ }, field.Component)));
23
23
  };
24
24
  DataLine.propTypes = {
25
25
  fields: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
@@ -29,5 +29,4 @@ DataLine.propTypes = {
29
29
  showOnMobile: _propTypes.bool
30
30
  }))
31
31
  };
32
- var _default = DataLine;
33
- exports.default = _default;
32
+ var _default = exports.default = DataLine;
@@ -13,16 +13,23 @@ var _aliases = require("../../../../../../shared/constants/aliases");
13
13
  var _utils = require("./utils");
14
14
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- var Season = function Season(_ref) {
17
- var contextApiInfo = _ref.contextApiInfo,
18
- season = _ref.season;
19
- var assets = contextApiInfo.assets,
20
- config = contextApiInfo.config,
21
- Label = contextApiInfo.Label;
22
- var texts = config.texts;
23
- var _getSeasonProps = (0, _utils.getSeasonProps)(season, texts, assets),
24
- Icon = _getSeasonProps.Icon,
25
- text = _getSeasonProps.text;
16
+ const Season = _ref => {
17
+ let {
18
+ contextApiInfo,
19
+ season
20
+ } = _ref;
21
+ const {
22
+ assets,
23
+ config,
24
+ Label
25
+ } = contextApiInfo;
26
+ const {
27
+ texts
28
+ } = config;
29
+ const {
30
+ Icon,
31
+ text
32
+ } = (0, _utils.getSeasonProps)(season, texts, assets);
26
33
  return Icon && text ? /*#__PURE__*/_react.default.createElement("div", {
27
34
  className: _stylesModule.default.container
28
35
  }, /*#__PURE__*/_react.default.createElement(Icon, {
@@ -35,5 +42,4 @@ Season.propTypes = {
35
42
  contextApiInfo: _smartBillTypes.contextApiInfoTypes,
36
43
  season: _propTypes.string
37
44
  };
38
- var _default = (0, _WithContextApi.default)()((0, _WithSeason.default)()(Season));
39
- exports.default = _default;
45
+ var _default = exports.default = (0, _WithContextApi.default)()((0, _WithSeason.default)()(Season));
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getSeasonProps = void 0;
7
7
  var _seasons = require("../../../../../../shared/constants/seasons");
8
- var getSeasonProps = function getSeasonProps(season, texts, assets) {
8
+ const getSeasonProps = (season, texts, assets) => {
9
9
  switch (season) {
10
10
  case _seasons.SEASONS.AUTUMN:
11
11
  return {
@@ -13,43 +13,32 @@ var _utils = require("../../../../utils");
13
13
  var _aliases = require("../../../../shared/constants/aliases");
14
14
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
17
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
- var FIELD_PERIOD_COMPARISION = 'period_comparison';
21
- exports.FIELD_PERIOD_COMPARISION = FIELD_PERIOD_COMPARISION;
22
- var FIELD_PERIOD_DATES = 'period_dates';
23
- exports.FIELD_PERIOD_DATES = FIELD_PERIOD_DATES;
24
- var FIELD_SETTLEMENTS_DAYS = 'settlements_days';
25
- exports.FIELD_SETTLEMENTS_DAYS = FIELD_SETTLEMENTS_DAYS;
26
- var FIELD_ENERGY_CONSUMPTION = 'energy_consumption';
27
- exports.FIELD_ENERGY_CONSUMPTION = FIELD_ENERGY_CONSUMPTION;
28
- var FIELD_POWER_CONSUMPTION = 'power_consumption';
29
- exports.FIELD_POWER_CONSUMPTION = FIELD_POWER_CONSUMPTION;
30
- var FIELD_TOTAL_CONSUMPTIONS = 'total_consumptions';
31
- exports.FIELD_TOTAL_CONSUMPTIONS = FIELD_TOTAL_CONSUMPTIONS;
32
- var FIELD_DAILY_CONSUMPTIONS = 'daily_consumptions';
33
- exports.FIELD_DAILY_CONSUMPTIONS = FIELD_DAILY_CONSUMPTIONS;
34
- var FIELD_AVERAGE_TEMPERATURE = 'average_temperature';
35
- exports.FIELD_AVERAGE_TEMPERATURE = FIELD_AVERAGE_TEMPERATURE;
36
- var NO_DATA_FIELD = 'no_data_cell';
37
- exports.NO_DATA_FIELD = NO_DATA_FIELD;
38
- var dataFieldDictonary = ['period_comparison', 'period_dates', 'settlements_days', 'total_consumptions', 'energy_consumption', 'power_consumption', 'daily_consumptions', 'average_temperature'];
39
- exports.dataFieldDictonary = dataFieldDictonary;
40
- var desktopGetHeaderFields = function desktopGetHeaderFields(contextApiInfo, withPowerComparison, showTemp) {
41
- var config = contextApiInfo.config,
42
- Label = contextApiInfo.Label;
43
- var _config$texts$consump = config.texts.consumptionComparison,
44
- periodDates = _config$texts$consump.periodDates,
45
- settlementDays = _config$texts$consump.settlementDays,
46
- energyConsumption = _config$texts$consump.energyConsumption,
47
- powerConsumption = _config$texts$consump.powerConsumption,
48
- totalConsumption = _config$texts$consump.totalConsumption,
49
- dailyConsumption = _config$texts$consump.dailyConsumption,
50
- averageTemperature = _config$texts$consump.averageTemperature,
51
- yearOrBimester = _config$texts$consump.yearOrBimester,
52
- yearOrPeriod = _config$texts$consump.yearOrPeriod;
16
+ const FIELD_PERIOD_COMPARISION = exports.FIELD_PERIOD_COMPARISION = 'period_comparison';
17
+ const FIELD_PERIOD_DATES = exports.FIELD_PERIOD_DATES = 'period_dates';
18
+ const FIELD_SETTLEMENTS_DAYS = exports.FIELD_SETTLEMENTS_DAYS = 'settlements_days';
19
+ const FIELD_ENERGY_CONSUMPTION = exports.FIELD_ENERGY_CONSUMPTION = 'energy_consumption';
20
+ const FIELD_POWER_CONSUMPTION = exports.FIELD_POWER_CONSUMPTION = 'power_consumption';
21
+ const FIELD_TOTAL_CONSUMPTIONS = exports.FIELD_TOTAL_CONSUMPTIONS = 'total_consumptions';
22
+ const FIELD_DAILY_CONSUMPTIONS = exports.FIELD_DAILY_CONSUMPTIONS = 'daily_consumptions';
23
+ const FIELD_AVERAGE_TEMPERATURE = exports.FIELD_AVERAGE_TEMPERATURE = 'average_temperature';
24
+ const NO_DATA_FIELD = exports.NO_DATA_FIELD = 'no_data_cell';
25
+ const dataFieldDictonary = exports.dataFieldDictonary = ['period_comparison', 'period_dates', 'settlements_days', 'total_consumptions', 'energy_consumption', 'power_consumption', 'daily_consumptions', 'average_temperature'];
26
+ const desktopGetHeaderFields = (contextApiInfo, withPowerComparison, showTemp) => {
27
+ const {
28
+ config,
29
+ Label
30
+ } = contextApiInfo;
31
+ const {
32
+ periodDates,
33
+ settlementDays,
34
+ energyConsumption,
35
+ powerConsumption,
36
+ totalConsumption,
37
+ dailyConsumption,
38
+ averageTemperature,
39
+ yearOrBimester,
40
+ yearOrPeriod
41
+ } = config.texts.consumptionComparison;
53
42
  return [{
54
43
  id: 'season',
55
44
  Component: /*#__PURE__*/_react.default.createElement(Label, {
@@ -93,117 +82,129 @@ var desktopGetHeaderFields = function desktopGetHeaderFields(contextApiInfo, wit
93
82
  }];
94
83
  };
95
84
  exports.desktopGetHeaderFields = desktopGetHeaderFields;
96
- var formatInterval = function formatInterval(period) {
85
+ const formatInterval = period => {
97
86
  var _period$settlements, _period$settlements2;
98
- var startDate = period === null || period === void 0 || (_period$settlements = period.settlements) === null || _period$settlements === void 0 ? void 0 : _period$settlements.start_date;
99
- var endDate = period === null || period === void 0 || (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 ? void 0 : _period$settlements2.end_date;
87
+ const startDate = period === null || period === void 0 || (_period$settlements = period.settlements) === null || _period$settlements === void 0 ? void 0 : _period$settlements.start_date;
88
+ const endDate = period === null || period === void 0 || (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 ? void 0 : _period$settlements2.end_date;
100
89
  return startDate && endDate && "".concat((0, _dayjs.default)(startDate).format('DD/MM'), " - ").concat((0, _dayjs.default)(endDate).format('DD/MM'));
101
90
  };
102
- var getField = function getField() {
103
- var _data$period, _getDailyConsumption$, _ref;
104
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
105
- var contextApiInfo = arguments.length > 1 ? arguments[1] : undefined;
106
- var Label = contextApiInfo.Label;
107
- var isHeader = options.isHeader,
108
- data = options.data,
109
- primary = options.primary,
110
- text = options.text;
111
- var textLabel = /*#__PURE__*/_react.default.createElement(Label, {
91
+ const getField = function () {
92
+ var _data$period, _getDailyConsumption$;
93
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
94
+ let contextApiInfo = arguments.length > 1 ? arguments[1] : undefined;
95
+ const {
96
+ Label
97
+ } = contextApiInfo;
98
+ const {
99
+ isHeader,
100
+ data,
101
+ primary,
102
+ text
103
+ } = options;
104
+ const textLabel = /*#__PURE__*/_react.default.createElement(Label, {
112
105
  alias: _aliases.DETAIL
113
106
  }, text);
114
- var textAlias = primary ? _aliases.PERIOD_COMPARISON_TEXT : _aliases.PERIOD_COMPARISON_TEXT_PREV;
115
- var magnitudeAlias = primary ? _aliases.PERIOD_COMPARISON_NUMBER : _aliases.PERIOD_COMPARISON_NUMBER_PREV;
116
- var unitAlias = primary ? _aliases.PERIOD_COMPARISON_UNIT : _aliases.PERIOD_COMPARISON_UNIT_PREV;
117
- return _ref = {}, _defineProperty(_ref, FIELD_PERIOD_COMPARISION, {
118
- id: FIELD_PERIOD_COMPARISION,
119
- Component: !isHeader ? /*#__PURE__*/_react.default.createElement(Label, {
120
- alias: textAlias
121
- }, text || (0, _utils.stringOrDash)(data)) : textLabel
122
- }), _defineProperty(_ref, FIELD_PERIOD_DATES, {
123
- id: FIELD_PERIOD_DATES,
124
- Component: !isHeader ? /*#__PURE__*/_react.default.createElement(Label, {
125
- alias: textAlias
126
- }, text || (0, _utils.stringOrDash)(formatInterval(data))) : textLabel
127
- }), _defineProperty(_ref, FIELD_SETTLEMENTS_DAYS, {
128
- id: FIELD_SETTLEMENTS_DAYS,
129
- Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
130
- numberAlias: magnitudeAlias,
131
- unitAlias: unitAlias,
132
- value: (_data$period = data.period) === null || _data$period === void 0 || (_data$period = _data$period.settlements) === null || _data$period === void 0 ? void 0 : _data$period.total_settlements_days,
133
- unit: data.daysUnit,
134
- classes: {
135
- numberAndUnit: _stylesModule.default.numberAndUnit
136
- }
137
- }) : textLabel
138
- }), _defineProperty(_ref, FIELD_TOTAL_CONSUMPTIONS, {
139
- id: FIELD_TOTAL_CONSUMPTIONS,
140
- Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
141
- numberAlias: magnitudeAlias,
142
- unitAlias: unitAlias,
143
- value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value,
144
- unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
145
- classes: {
146
- numberAndUnit: _stylesModule.default.numberAndUnit
147
- }
148
- }) : textLabel
149
- }), _defineProperty(_ref, FIELD_ENERGY_CONSUMPTION, {
150
- id: FIELD_ENERGY_CONSUMPTION,
151
- Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
152
- numberAlias: magnitudeAlias,
153
- unitAlias: unitAlias,
154
- value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value,
155
- unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
156
- classes: {
157
- numberAndUnit: _stylesModule.default.numberAndUnit
158
- }
159
- }) : textLabel
160
- }), _defineProperty(_ref, FIELD_POWER_CONSUMPTION, {
161
- id: FIELD_POWER_CONSUMPTION,
162
- Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
163
- numberAlias: magnitudeAlias,
164
- unitAlias: unitAlias,
165
- value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.POWER_TYPES.REGISTERED).value,
166
- unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.POWER_TYPES.REGISTERED).unit,
167
- classes: {
168
- numberAndUnit: _stylesModule.default.numberAndUnit
169
- }
170
- }) : textLabel
171
- }), _defineProperty(_ref, FIELD_DAILY_CONSUMPTIONS, {
172
- id: FIELD_DAILY_CONSUMPTIONS,
173
- Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
174
- numberAlias: magnitudeAlias,
175
- unitAlias: unitAlias,
176
- value: (_getDailyConsumption$ = (0, _consumptions.getDailyConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value) === null || _getDailyConsumption$ === void 0 ? void 0 : _getDailyConsumption$.toFixed(1).toString().replace(/\./, ','),
177
- unit: (0, _consumptions.getDailyConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
178
- classes: {
179
- numberAndUnit: _stylesModule.default.numberAndUnit
180
- }
181
- }) : /*#__PURE__*/_react.default.createElement(Label, {
182
- alias: _aliases.DETAIL
183
- }, text)
184
- }), _defineProperty(_ref, FIELD_AVERAGE_TEMPERATURE, {
185
- id: FIELD_AVERAGE_TEMPERATURE,
186
- Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
187
- numberAlias: magnitudeAlias,
188
- unitAlias: unitAlias,
189
- value: Math.round(data.periodAverageTemperature || data.period),
190
- unit: data.temperatureUnit,
191
- classes: {
192
- numberAndUnit: _stylesModule.default.numberAndUnit
193
- }
194
- }) : textLabel
195
- }), _defineProperty(_ref, NO_DATA_FIELD, {
196
- id: NO_DATA_FIELD,
197
- Component: /*#__PURE__*/_react.default.createElement(Label, {
198
- alias: textAlias
199
- }, data)
200
- }), _ref;
107
+ const textAlias = primary ? _aliases.PERIOD_COMPARISON_TEXT : _aliases.PERIOD_COMPARISON_TEXT_PREV;
108
+ const magnitudeAlias = primary ? _aliases.PERIOD_COMPARISON_NUMBER : _aliases.PERIOD_COMPARISON_NUMBER_PREV;
109
+ const unitAlias = primary ? _aliases.PERIOD_COMPARISON_UNIT : _aliases.PERIOD_COMPARISON_UNIT_PREV;
110
+ return {
111
+ [FIELD_PERIOD_COMPARISION]: {
112
+ id: FIELD_PERIOD_COMPARISION,
113
+ Component: !isHeader ? /*#__PURE__*/_react.default.createElement(Label, {
114
+ alias: textAlias
115
+ }, text || (0, _utils.stringOrDash)(data)) : textLabel
116
+ },
117
+ [FIELD_PERIOD_DATES]: {
118
+ id: FIELD_PERIOD_DATES,
119
+ Component: !isHeader ? /*#__PURE__*/_react.default.createElement(Label, {
120
+ alias: textAlias
121
+ }, text || (0, _utils.stringOrDash)(formatInterval(data))) : textLabel
122
+ },
123
+ [FIELD_SETTLEMENTS_DAYS]: {
124
+ id: FIELD_SETTLEMENTS_DAYS,
125
+ Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
126
+ numberAlias: magnitudeAlias,
127
+ unitAlias: unitAlias,
128
+ value: (_data$period = data.period) === null || _data$period === void 0 || (_data$period = _data$period.settlements) === null || _data$period === void 0 ? void 0 : _data$period.total_settlements_days,
129
+ unit: data.daysUnit,
130
+ classes: {
131
+ numberAndUnit: _stylesModule.default.numberAndUnit
132
+ }
133
+ }) : textLabel
134
+ },
135
+ [FIELD_TOTAL_CONSUMPTIONS]: {
136
+ id: FIELD_TOTAL_CONSUMPTIONS,
137
+ Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
138
+ numberAlias: magnitudeAlias,
139
+ unitAlias: unitAlias,
140
+ value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value,
141
+ unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
142
+ classes: {
143
+ numberAndUnit: _stylesModule.default.numberAndUnit
144
+ }
145
+ }) : textLabel
146
+ },
147
+ [FIELD_ENERGY_CONSUMPTION]: {
148
+ id: FIELD_ENERGY_CONSUMPTION,
149
+ Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
150
+ numberAlias: magnitudeAlias,
151
+ unitAlias: unitAlias,
152
+ value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value,
153
+ unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
154
+ classes: {
155
+ numberAndUnit: _stylesModule.default.numberAndUnit
156
+ }
157
+ }) : textLabel
158
+ },
159
+ [FIELD_POWER_CONSUMPTION]: {
160
+ id: FIELD_POWER_CONSUMPTION,
161
+ Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
162
+ numberAlias: magnitudeAlias,
163
+ unitAlias: unitAlias,
164
+ value: (0, _consumptions.getTotalConsumption)(data, _consumptions2.POWER_TYPES.REGISTERED).value,
165
+ unit: (0, _consumptions.getTotalConsumption)(data, _consumptions2.POWER_TYPES.REGISTERED).unit,
166
+ classes: {
167
+ numberAndUnit: _stylesModule.default.numberAndUnit
168
+ }
169
+ }) : textLabel
170
+ },
171
+ [FIELD_DAILY_CONSUMPTIONS]: {
172
+ id: FIELD_DAILY_CONSUMPTIONS,
173
+ Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
174
+ numberAlias: magnitudeAlias,
175
+ unitAlias: unitAlias,
176
+ value: (_getDailyConsumption$ = (0, _consumptions.getDailyConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).value) === null || _getDailyConsumption$ === void 0 ? void 0 : _getDailyConsumption$.toFixed(1).toString().replace(/\./, ','),
177
+ unit: (0, _consumptions.getDailyConsumption)(data, _consumptions2.ENERGY_TYPES.ACTIVE).unit,
178
+ classes: {
179
+ numberAndUnit: _stylesModule.default.numberAndUnit
180
+ }
181
+ }) : /*#__PURE__*/_react.default.createElement(Label, {
182
+ alias: _aliases.DETAIL
183
+ }, text)
184
+ },
185
+ [FIELD_AVERAGE_TEMPERATURE]: {
186
+ id: FIELD_AVERAGE_TEMPERATURE,
187
+ Component: data ? /*#__PURE__*/_react.default.createElement(_Magnitude.default, {
188
+ numberAlias: magnitudeAlias,
189
+ unitAlias: unitAlias,
190
+ value: Math.round(data.periodAverageTemperature || data.period),
191
+ unit: data.temperatureUnit,
192
+ classes: {
193
+ numberAndUnit: _stylesModule.default.numberAndUnit
194
+ }
195
+ }) : textLabel
196
+ },
197
+ [NO_DATA_FIELD]: {
198
+ id: NO_DATA_FIELD,
199
+ Component: /*#__PURE__*/_react.default.createElement(Label, {
200
+ alias: textAlias
201
+ }, data)
202
+ }
203
+ };
201
204
  };
202
205
  exports.getField = getField;
203
- var noPeriodData = function noPeriodData(primary, noData, contextApiInfo) {
204
- return getField({
205
- primary: primary,
206
- data: noData
207
- }, contextApiInfo)[NO_DATA_FIELD];
208
- };
206
+ const noPeriodData = (primary, noData, contextApiInfo) => getField({
207
+ primary,
208
+ data: noData
209
+ }, contextApiInfo)[NO_DATA_FIELD];
209
210
  exports.noPeriodData = noPeriodData;
@@ -14,27 +14,28 @@ var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"))
14
14
  var _utils = require("./utils");
15
15
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
- var ComparisonTable = function ComparisonTable(_ref) {
18
- var contextApiInfo = _ref.contextApiInfo,
19
- billData = _ref.billData,
20
- isDesktopSize = _ref.isDesktopSize;
21
- var currentPeriod = (0, _periods.getCurrentPeriod)(billData);
22
- var lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
23
- var withPowerComparison = contextApiInfo.config.validations.withPowerComparison;
24
- var currentPeriodAverageTemperature = (0, _seamlessImmutable.getIn)(billData, ['current_period_avg_temperature']);
25
- var lastYearPeriodAverageTemperature = (0, _seamlessImmutable.getIn)(billData, ['previous_period_avg_temperature']);
26
- var getTableLines = isDesktopSize ? _utils.desktopGetTableLines : _utils.mobileGetTableLines;
27
- var expand = !(!withPowerComparison || currentPeriodAverageTemperature || lastYearPeriodAverageTemperature);
17
+ const ComparisonTable = _ref => {
18
+ let {
19
+ contextApiInfo,
20
+ billData,
21
+ isDesktopSize
22
+ } = _ref;
23
+ const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
24
+ const lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
25
+ const {
26
+ withPowerComparison
27
+ } = contextApiInfo.config.validations;
28
+ const currentPeriodAverageTemperature = (0, _seamlessImmutable.getIn)(billData, ['current_period_avg_temperature']);
29
+ const lastYearPeriodAverageTemperature = (0, _seamlessImmutable.getIn)(billData, ['previous_period_avg_temperature']);
30
+ const getTableLines = isDesktopSize ? _utils.desktopGetTableLines : _utils.mobileGetTableLines;
31
+ const expand = !(!withPowerComparison || currentPeriodAverageTemperature || lastYearPeriodAverageTemperature);
28
32
  return /*#__PURE__*/_react.default.createElement("div", {
29
33
  className: "".concat(_stylesModule.default.container, " ").concat(expand && _stylesModule.default.expand)
30
- }, getTableLines(contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktopSize, withPowerComparison(billData)).map(function (line) {
31
- return line.Component;
32
- }));
34
+ }, getTableLines(contextApiInfo, currentPeriod, currentPeriodAverageTemperature, lastYearPeriod, lastYearPeriodAverageTemperature, isDesktopSize, withPowerComparison(billData)).map(line => line.Component));
33
35
  };
34
36
  ComparisonTable.propTypes = {
35
37
  contextApiInfo: _smartBillTypes.contextApiInfoTypes,
36
38
  billData: _billDataTypes.billDataTypes,
37
39
  isDesktopSize: _propTypes.bool
38
40
  };
39
- var _default = (0, _WithContextApi.default)()(ComparisonTable);
40
- exports.default = _default;
41
+ var _default = exports.default = (0, _WithContextApi.default)()(ComparisonTable);