@widergy/utilitygo-smart-bill-web 1.13.4 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/Advice/index.js +3 -14
  3. package/dist/components/Amount/index.js +11 -29
  4. package/dist/components/Amount/styles.module.scss +1 -2
  5. package/dist/components/Amount/utils.js +0 -3
  6. package/dist/components/Banner/index.js +3 -12
  7. package/dist/components/BarChart/index.js +12 -32
  8. package/dist/components/BarChart/styles.module.scss +5 -5
  9. package/dist/components/BarChart/utils.js +1 -6
  10. package/dist/components/BillCalculation/components/ConceptCard/index.js +31 -36
  11. package/dist/components/BillCalculation/components/Glossary/index.js +30 -50
  12. package/dist/components/BillCalculation/components/Glossary/styles.module.scss +0 -6
  13. package/dist/components/BillCalculation/index.js +13 -46
  14. package/dist/components/BillCalculation/utils.js +3 -15
  15. package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +11 -29
  16. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +2 -15
  17. package/dist/components/BillSummary/components/BilledConcepts/constants.js +0 -4
  18. package/dist/components/BillSummary/components/BilledConcepts/index.js +11 -40
  19. package/dist/components/BillSummary/components/BilledConcepts/styles.module.scss +1 -1
  20. package/dist/components/BillSummary/components/BilledConcepts/utils.js +13 -38
  21. package/dist/components/BillSummary/index.js +7 -42
  22. package/dist/components/BillSummary/styles.module.scss +0 -4
  23. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +0 -8
  24. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +5 -20
  25. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +0 -7
  26. package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +18 -39
  27. package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +2 -16
  28. package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +15 -37
  29. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +8 -16
  30. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +0 -7
  31. package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +12 -25
  32. package/dist/components/ConsumptionComparison/components/PercentageComparison/styles.module.scss +0 -10
  33. package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +4 -11
  34. package/dist/components/ConsumptionComparison/index.js +9 -44
  35. package/dist/components/ConsumptionComparison/styles.module.scss +0 -5
  36. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +13 -38
  37. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +9 -20
  38. package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +14 -26
  39. package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/styles.module.scss +0 -6
  40. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +10 -24
  41. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +0 -6
  42. package/dist/components/ConsumptionEnergyDetails/index.js +14 -41
  43. package/dist/components/ConsumptionEnergyDetails/styles.module.scss +2 -6
  44. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +39 -55
  45. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/styles.module.scss +2 -8
  46. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +0 -3
  47. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +7 -23
  48. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/styles.module.scss +0 -4
  49. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +4 -15
  50. package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +16 -33
  51. package/dist/components/ConsumptionIncluded/index.js +1 -18
  52. package/dist/components/ConsumptionIncluded/utils.js +2 -30
  53. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +7 -19
  54. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +12 -27
  55. package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +6 -30
  56. package/dist/components/ConsumptionPeriod/components/Reading/index.js +15 -33
  57. package/dist/components/ConsumptionPeriod/components/Reading/styles.module.scss +0 -1
  58. package/dist/components/ConsumptionPeriod/index.js +1 -20
  59. package/dist/components/ConsumptionPeriod/utils.js +0 -6
  60. package/dist/components/Date/index.js +6 -17
  61. package/dist/components/Date/styles.module.scss +2 -4
  62. package/dist/components/DebtState/index.js +6 -16
  63. package/dist/components/DebtState/styles.module.scss +2 -11
  64. package/dist/components/IconAndDetails/index.js +13 -26
  65. package/dist/components/Magnitude/index.js +18 -39
  66. package/dist/components/Magnitude/utils.js +0 -29
  67. package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +6 -17
  68. package/dist/components/MainBillData/components/BillAlert/index.js +12 -39
  69. package/dist/components/MainBillData/components/BillAlert/styles.module.scss +4 -1
  70. package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +5 -19
  71. package/dist/components/MainBillData/components/BillBody/components/ClientData/styles.module.scss +1 -3
  72. package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +4 -20
  73. package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +0 -2
  74. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +16 -30
  75. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +0 -5
  76. package/dist/components/MainBillData/components/BillBody/index.js +3 -35
  77. package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +7 -19
  78. package/dist/components/MainBillData/components/BillHeader/index.js +4 -27
  79. package/dist/components/MainBillData/index.js +1 -16
  80. package/dist/components/MainBillData/theme.js +0 -3
  81. package/dist/components/MainBillData/utils.js +0 -3
  82. package/dist/components/Period/index.js +18 -44
  83. package/dist/components/Period/styles.module.scss +9 -9
  84. package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +21 -28
  85. package/dist/components/PowerProgresBar/components/PowerConsumption/styles.module.scss +0 -7
  86. package/dist/components/PowerProgresBar/index.js +8 -29
  87. package/dist/components/PowerProgresBar/styles.module.scss +5 -9
  88. package/dist/components/RateAndCategory/index.js +8 -26
  89. package/dist/components/RateAndCategory/styles.module.scss +1 -4
  90. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +11 -23
  91. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/styles.module.scss +0 -1
  92. package/dist/components/RatesDefinition/components/BillRate/index.js +8 -20
  93. package/dist/components/RatesDefinition/components/BillRate/styles.module.scss +1 -2
  94. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +5 -17
  95. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/styles.module.scss +2 -4
  96. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +8 -22
  97. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +4 -18
  98. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +0 -7
  99. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +4 -14
  100. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/styles.module.scss +1 -9
  101. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +8 -16
  102. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/styles.module.scss +0 -4
  103. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +0 -1
  104. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +12 -39
  105. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +14 -24
  106. package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +11 -38
  107. package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +0 -3
  108. package/dist/components/RatesDefinition/components/PurchasedRate/index.js +11 -23
  109. package/dist/components/RatesDefinition/components/PurchasedRate/styles.module.scss +5 -4
  110. package/dist/components/RatesDefinition/index.js +4 -25
  111. package/dist/components/SmartBillProvider/index.js +5 -26
  112. package/dist/components/StyledAmount/constants.js +0 -3
  113. package/dist/components/StyledAmount/index.js +18 -38
  114. package/dist/components/StyledAmount/styles.module.scss +2 -3
  115. package/dist/components/WithContextApi/index.js +4 -15
  116. package/dist/components/WithContextApi/layout.js +0 -9
  117. package/dist/components/WithSeason/index.js +0 -6
  118. package/dist/constants/deviceSizes.js +4 -16
  119. package/dist/index.js +0 -18
  120. package/dist/scss/variables/_colors.scss +0 -6
  121. package/dist/scss/variables/_colorsExport.scss +0 -6
  122. package/dist/shared/Context/index.js +1 -5
  123. package/dist/shared/constants/aliases.js +84 -82
  124. package/dist/shared/types/assetsTypes.js +0 -3
  125. package/dist/shared/types/billDataTypes.js +13 -13
  126. package/dist/shared/types/componentsTypes.js +4 -10
  127. package/dist/shared/types/formattersTypes.js +0 -2
  128. package/dist/shared/types/rateStagesTypes.js +0 -2
  129. package/dist/shared/types/smartBillTypes.js +4 -10
  130. package/dist/shared/types/textsTypes.js +0 -2
  131. package/dist/shared/utils/billCalculation.js +0 -6
  132. package/dist/shared/utils/consumptions.js +1 -32
  133. package/dist/shared/utils/context.js +0 -6
  134. package/dist/shared/utils/expirations.js +0 -3
  135. package/dist/shared/utils/periods.js +0 -15
  136. package/dist/shared/utils/rates.js +0 -4
  137. package/dist/shared/utils/readings.js +0 -7
  138. package/dist/shared/utils/season.js +0 -3
  139. package/dist/shared/utils/stagesGraph.js +0 -11
  140. package/dist/utils/hooks.js +0 -2
  141. package/dist/utils.js +0 -8
  142. package/package.json +1 -1
@@ -4,16 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.titleMapper = void 0;
7
-
8
7
  var _string = require("@widergy/web-utils/lib/string");
9
-
10
8
  var _periodicities = require("../constants/periodicities");
11
-
12
9
  var _periods = require("./periods");
13
-
14
10
  var titleMapper = function titleMapper(billData, texts) {
15
11
  var _currentPeriod$settle, _currentPeriod$settle2, _currentPeriod$settle3, _currentPeriod$settle4;
16
-
17
12
  var currentPeriod = (0, _periods.getCurrentPeriod)(billData);
18
13
  var periodicity = currentPeriod === null || currentPeriod === void 0 ? void 0 : (_currentPeriod$settle = currentPeriod.settlements) === null || _currentPeriod$settle === void 0 ? void 0 : _currentPeriod$settle.periodicity;
19
14
  var currentSettlement = (currentPeriod === null || currentPeriod === void 0 ? void 0 : (_currentPeriod$settle2 = currentPeriod.settlements) === null || _currentPeriod$settle2 === void 0 ? void 0 : (_currentPeriod$settle3 = _currentPeriod$settle2.current) === null || _currentPeriod$settle3 === void 0 ? void 0 : _currentPeriod$settle3.number) || '-';
@@ -27,5 +22,4 @@ var titleMapper = function titleMapper(billData, texts) {
27
22
  periodYear: periodYear
28
23
  };
29
24
  };
30
-
31
25
  exports.titleMapper = titleMapper;
@@ -4,81 +4,53 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getTotalConsumption = exports.getRemainingConsumption = exports.getDailyConsumption = exports.getCurrentConsumption = exports.getConsumptionHistoryData = exports.consumptionDataMapper = void 0;
7
-
8
7
  var _dayjs = _interopRequireDefault(require("dayjs"));
9
-
10
8
  var _lodash = _interopRequireDefault(require("lodash"));
11
-
12
9
  var _string = require("@widergy/web-utils/lib/string");
13
-
14
10
  var _consumptions = require("../constants/consumptions");
15
-
16
11
  var _periods = require("./periods");
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
13
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
-
22
14
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
-
24
15
  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); }
25
-
26
16
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
27
-
28
17
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
29
-
30
- 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; }
31
-
18
+ 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; }
32
19
  var getCurrentConsumption = function getCurrentConsumption(period, energyType) {
33
20
  var _period$settlements, _period$settlements$c, _period$settlements$c2;
34
-
35
21
  return (period === null || period === void 0 ? void 0 : (_period$settlements = period.settlements) === null || _period$settlements === void 0 ? void 0 : (_period$settlements$c = _period$settlements.current) === null || _period$settlements$c === void 0 ? void 0 : (_period$settlements$c2 = _period$settlements$c.consumptions) === null || _period$settlements$c2 === void 0 ? void 0 : _period$settlements$c2.find(function (consumption) {
36
22
  return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType);
37
23
  })) || {};
38
24
  };
39
-
40
25
  exports.getCurrentConsumption = getCurrentConsumption;
41
-
42
26
  var getRemainingConsumption = function getRemainingConsumption(period, energyType) {
43
27
  var _period$settlements2, _period$settlements2$, _period$settlements2$2;
44
-
45
28
  var remaining = (period === null || period === void 0 ? void 0 : (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 ? void 0 : (_period$settlements2$ = _period$settlements2.remaining) === null || _period$settlements2$ === void 0 ? void 0 : (_period$settlements2$2 = _period$settlements2$[0]) === null || _period$settlements2$2 === void 0 ? void 0 : _period$settlements2$2.consumptions) || [];
46
29
  return remaining.find(function (item) {
47
30
  return (0, _string.stringToCompareWithoutAccentsInclusive)(item.magnitude, energyType);
48
31
  }) || {};
49
32
  };
50
-
51
33
  exports.getRemainingConsumption = getRemainingConsumption;
52
-
53
34
  var getTotalConsumption = function getTotalConsumption(period, energyOrPowerType) {
54
35
  var _period$consumptions;
55
-
56
36
  return (period === null || period === void 0 ? void 0 : (_period$consumptions = period.consumptions) === null || _period$consumptions === void 0 ? void 0 : _period$consumptions.find(function (consumption) {
57
37
  return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.TOTAL) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyOrPowerType);
58
38
  })) || {};
59
39
  };
60
-
61
40
  exports.getTotalConsumption = getTotalConsumption;
62
-
63
41
  var getDailyConsumption = function getDailyConsumption(period, energyType) {
64
42
  var _period$consumptions2;
65
-
66
43
  return (period === null || period === void 0 ? void 0 : (_period$consumptions2 = period.consumptions) === null || _period$consumptions2 === void 0 ? void 0 : _period$consumptions2.find(function (consumption) {
67
44
  return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.DAILY) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType);
68
45
  })) || {};
69
46
  };
70
-
71
47
  exports.getDailyConsumption = getDailyConsumption;
72
-
73
48
  var formatPeriod = function formatPeriod(period) {
74
49
  return period.number && period.year && "".concat(period.number, "/").concat((0, _dayjs.default)(period.year, 'YYYY').format('YY'));
75
50
  };
76
-
77
51
  var getConsumptionHistoryData = function getConsumptionHistoryData(billDataParameter, energyType, showPeriodsInChronologicalOrder) {
78
52
  var _billData$periods;
79
-
80
53
  var billData = _lodash.default.cloneDeep(billDataParameter);
81
-
82
54
  var currentPeriod = (0, _periods.getCurrentPeriod)(billData);
83
55
  var lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
84
56
  var otherPeriods = billData === null || billData === void 0 ? void 0 : (_billData$periods = billData.periods) === null || _billData$periods === void 0 ? void 0 : _billData$periods.filter(function (period) {
@@ -100,9 +72,7 @@ var getConsumptionHistoryData = function getConsumptionHistoryData(billDataParam
100
72
  unit: getTotalConsumption(currentPeriod, energyType).unit
101
73
  };
102
74
  };
103
-
104
75
  exports.getConsumptionHistoryData = getConsumptionHistoryData;
105
-
106
76
  var consumptionDataMapper = function consumptionDataMapper() {
107
77
  var periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
108
78
  var texts = arguments.length > 1 ? arguments[1] : undefined;
@@ -117,5 +87,4 @@ var consumptionDataMapper = function consumptionDataMapper() {
117
87
  return a.order - b.order;
118
88
  });
119
89
  };
120
-
121
90
  exports.consumptionDataMapper = consumptionDataMapper;
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.unpackComponents = void 0;
9
-
10
8
  var COMPONENTS = _interopRequireWildcard(require("../constants/components"));
11
-
12
9
  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); }
13
-
14
10
  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; }
15
-
16
11
  var unpackComponents = function unpackComponents(contextApiInfo) {
17
12
  var components = contextApiInfo.components;
18
13
  return {
@@ -30,5 +25,4 @@ var unpackComponents = function unpackComponents(contextApiInfo) {
30
25
  PieChart: components[COMPONENTS.PIE_CHART]
31
26
  };
32
27
  };
33
-
34
28
  exports.unpackComponents = unpackComponents;
@@ -4,13 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getExpiration = void 0;
7
-
8
7
  var _seamlessImmutable = require("seamless-immutable");
9
-
10
8
  var getExpiration = function getExpiration(billData, number) {
11
9
  return (0, _seamlessImmutable.getIn)(billData, ['expirations'], []).find(function (expiration) {
12
10
  return expiration.number === number;
13
11
  }) || {};
14
12
  };
15
-
16
13
  exports.getExpiration = getExpiration;
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getSavingsPercentage = exports.getLastYearPeriod = exports.getCurrentPeriod = exports.comparePeriods = exports.areSamePeriods = void 0;
7
-
8
7
  var _seamlessImmutable = require("seamless-immutable");
9
-
10
8
  var getCurrentPeriod = function getCurrentPeriod(billData) {
11
9
  return (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(function (period) {
12
10
  return period.current;
13
11
  }) || {};
14
12
  };
15
-
16
13
  exports.getCurrentPeriod = getCurrentPeriod;
17
-
18
14
  var getLastYearPeriod = function getLastYearPeriod(billData) {
19
15
  var currentPeriod = getCurrentPeriod(billData);
20
16
  var lastYear = "".concat(parseInt(currentPeriod.year, 10) - 1);
@@ -22,22 +18,16 @@ var getLastYearPeriod = function getLastYearPeriod(billData) {
22
18
  return period.number === currentPeriod.number && period.year === lastYear;
23
19
  }) || {};
24
20
  };
25
-
26
21
  exports.getLastYearPeriod = getLastYearPeriod;
27
-
28
22
  var areSamePeriods = function areSamePeriods() {
29
23
  var period1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
30
24
  var period2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31
-
32
25
  if (period1.number && period1.year && period2.number && period2.year) {
33
26
  return period1.number === period2.number && period1.year === period2.year;
34
27
  }
35
-
36
28
  return false;
37
29
  };
38
-
39
30
  exports.areSamePeriods = areSamePeriods;
40
-
41
31
  var comparePeriods = function comparePeriods(period1, period2) {
42
32
  if (period1 && period1.number && period1.year && period2 && period2.number && period2.year) {
43
33
  var number1 = parseInt(period1.number, 10);
@@ -48,16 +38,11 @@ var comparePeriods = function comparePeriods(period1, period2) {
48
38
  if (year1 === year2 && number1 > number2) return 1;
49
39
  return -1;
50
40
  }
51
-
52
41
  return 0;
53
42
  };
54
-
55
43
  exports.comparePeriods = comparePeriods;
56
-
57
44
  var getSavingsPercentage = function getSavingsPercentage(period) {
58
45
  var _period$additional_in;
59
-
60
46
  return period === null || period === void 0 ? void 0 : (_period$additional_in = period.additional_information) === null || _period$additional_in === void 0 ? void 0 : _period$additional_in.savings_percentage;
61
47
  };
62
-
63
48
  exports.getSavingsPercentage = getSavingsPercentage;
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getCharge = void 0;
7
-
8
7
  var _seamlessImmutable = require("seamless-immutable");
9
-
10
8
  var _string = require("@widergy/web-utils/lib/string");
11
-
12
9
  var getCharge = function getCharge(billData, concept) {
13
10
  return (0, _seamlessImmutable.getIn)(billData, ['client', 'rate', 'charges'], []).find(function (charge) {
14
11
  return (0, _string.stringCompare)(charge.concept, concept);
15
12
  }) || {};
16
13
  };
17
-
18
14
  exports.getCharge = getCharge;
@@ -4,25 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getReadingPeriod = exports.getActiveEnergyRecord = void 0;
7
-
8
7
  var _seamlessImmutable = require("seamless-immutable");
9
-
10
8
  var _string = require("@widergy/web-utils/lib/string");
11
-
12
9
  var _consumptions = require("../constants/consumptions");
13
-
14
10
  var getReadingPeriod = function getReadingPeriod(billData, moment) {
15
11
  return (0, _seamlessImmutable.getIn)(billData, ['reading_periods'], []).find(function (readingPeriod) {
16
12
  return (0, _string.stringCompare)(readingPeriod.moment, moment);
17
13
  }) || {};
18
14
  };
19
-
20
15
  exports.getReadingPeriod = getReadingPeriod;
21
-
22
16
  var getActiveEnergyRecord = function getActiveEnergyRecord(readingPeriod) {
23
17
  return (0, _seamlessImmutable.getIn)(readingPeriod, ['records'], []).find(function (record) {
24
18
  return (0, _string.stringToCompareWithoutAccentsInclusive)(record.magnitude, _consumptions.ENERGY_TYPES.ACTIVE);
25
19
  }) || {};
26
20
  };
27
-
28
21
  exports.getActiveEnergyRecord = getActiveEnergyRecord;
@@ -4,13 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getSeason = void 0;
7
-
8
7
  var _seasons = require("../constants/seasons");
9
-
10
8
  var getSeason = function getSeason(monthNumber) {
11
9
  return (_seasons.SEASON_PERIODS.find(function (seasonPeriod) {
12
10
  return seasonPeriod.initMonth <= monthNumber && seasonPeriod.endingMonth >= monthNumber;
13
11
  }) || {}).season;
14
12
  };
15
-
16
13
  exports.getSeason = getSeason;
@@ -4,40 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getSubStageWidth = exports.getSubStageRangeWidth = exports.getStageRangeWidth = exports.getCurrentStage = void 0;
7
-
8
7
  var _stagesGraph = require("../constants/stagesGraph");
9
-
10
8
  var getCurrentStage = function getCurrentStage(value, rateStages) {
11
9
  return rateStages.find(function (stage) {
12
10
  return stage.range[_stagesGraph.MIN_VALUE] <= value && (value <= stage.range[_stagesGraph.MAX_VALUE] || stage.range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE);
13
11
  });
14
12
  };
15
-
16
13
  exports.getCurrentStage = getCurrentStage;
17
-
18
14
  var getSubStageRangeWidth = function getSubStageRangeWidth(subStage) {
19
15
  var range = subStage.range;
20
16
  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];
21
17
  };
22
-
23
18
  exports.getSubStageRangeWidth = getSubStageRangeWidth;
24
-
25
19
  var getStageRangeWidth = function getStageRangeWidth(stage) {
26
20
  var range = stage.range;
27
-
28
21
  if (range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE || !range[_stagesGraph.MAX_VALUE]) {
29
22
  return stage.sub_rate_stages.reduce(function (totalWidth, subStage) {
30
23
  return totalWidth + getSubStageRangeWidth(subStage);
31
24
  }, 0);
32
25
  }
33
-
34
26
  return range[_stagesGraph.MAX_VALUE] - range[_stagesGraph.MIN_VALUE];
35
27
  };
36
-
37
28
  exports.getStageRangeWidth = getStageRangeWidth;
38
-
39
29
  var getSubStageWidth = function getSubStageWidth(stage, subStage) {
40
30
  return getSubStageRangeWidth(subStage) / getStageRangeWidth(stage) * 100;
41
31
  };
42
-
43
32
  exports.getSubStageWidth = getSubStageWidth;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useScreenSize = void 0;
7
-
8
7
  var _energyHooks = require("@widergy/energy-hooks");
9
-
10
8
  var useScreenSize = (0, _energyHooks.createUseScreenSize)({
11
9
  mobileBP: 767,
12
10
  tabletBP: 1024
package/dist/utils.js CHANGED
@@ -4,26 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.stringOrDash = exports.numberOrDash = exports.formatNumber = void 0;
7
-
8
7
  var _numeral = _interopRequireDefault(require("config/numeral"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  var stringOrDash = function stringOrDash(str) {
13
10
  return str || '-';
14
11
  };
15
-
16
12
  exports.stringOrDash = stringOrDash;
17
-
18
13
  var numberOrDash = function numberOrDash(number) {
19
14
  var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0,0';
20
15
  return number !== undefined && number !== null ? (0, _numeral.default)(number).format(format) : '-';
21
16
  };
22
-
23
17
  exports.numberOrDash = numberOrDash;
24
-
25
18
  var formatNumber = function formatNumber(value) {
26
19
  return (0, _numeral.default)(value).format('0.[00]');
27
20
  };
28
-
29
21
  exports.formatNumber = formatNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/utilitygo-smart-bill-web",
3
- "version": "1.13.4",
3
+ "version": "2.0.1",
4
4
  "description": "UtilityGO SmartBill Web",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",