@widergy/utilitygo-smart-bill-web 2.2.2 → 3.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 (141) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/Advice/index.js +10 -6
  3. package/dist/components/Amount/index.js +26 -21
  4. package/dist/components/Amount/utils.js +2 -5
  5. package/dist/components/Banner/index.js +10 -6
  6. package/dist/components/BarChart/constants.js +3 -3
  7. package/dist/components/BarChart/index.js +28 -22
  8. package/dist/components/BarChart/utils.js +17 -16
  9. package/dist/components/BillCalculation/components/ConceptCard/index.js +52 -45
  10. package/dist/components/BillCalculation/components/Glossary/index.js +48 -64
  11. package/dist/components/BillCalculation/components/Glossary/styles.module.scss +1 -0
  12. package/dist/components/BillCalculation/constants.js +1 -1
  13. package/dist/components/BillCalculation/index.js +48 -51
  14. package/dist/components/BillCalculation/utils.js +22 -22
  15. package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +25 -22
  16. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/constants.js +1 -1
  17. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +15 -15
  18. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/styles.module.scss +3 -3
  19. package/dist/components/BillSummary/components/BilledConcepts/constants.js +13 -14
  20. package/dist/components/BillSummary/components/BilledConcepts/index.js +29 -39
  21. package/dist/components/BillSummary/components/BilledConcepts/utils.js +50 -69
  22. package/dist/components/BillSummary/index.js +70 -69
  23. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +8 -8
  24. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +17 -10
  25. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +3 -2
  26. package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +147 -133
  27. package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +16 -14
  28. package/dist/components/ConsumptionComparison/components/ComparisonTable/styles.module.scss +1 -0
  29. package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +88 -89
  30. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +21 -11
  31. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +3 -2
  32. package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +21 -14
  33. package/dist/components/ConsumptionComparison/components/PercentageComparison/styles.module.scss +1 -0
  34. package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +15 -10
  35. package/dist/components/ConsumptionComparison/index.js +41 -45
  36. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +27 -22
  37. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/styles.module.scss +1 -1
  38. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +18 -13
  39. package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +15 -12
  40. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +21 -15
  41. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +3 -2
  42. package/dist/components/ConsumptionEnergyDetails/index.js +46 -41
  43. package/dist/components/ConsumptionEnergyDetails/styles.module.scss +2 -2
  44. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +64 -60
  45. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +12 -13
  46. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +20 -17
  47. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +16 -10
  48. package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +42 -37
  49. package/dist/components/ConsumptionIncluded/components/TimelineRow/styles.module.scss +2 -2
  50. package/dist/components/ConsumptionIncluded/index.js +31 -32
  51. package/dist/components/ConsumptionIncluded/utils.js +32 -34
  52. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +14 -10
  53. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/styles.module.scss +1 -0
  54. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +23 -20
  55. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/styles.module.scss +1 -0
  56. package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +18 -26
  57. package/dist/components/ConsumptionPeriod/components/Reading/index.js +35 -32
  58. package/dist/components/ConsumptionPeriod/index.js +12 -8
  59. package/dist/components/ConsumptionPeriod/styles.module.scss +1 -0
  60. package/dist/components/ConsumptionPeriod/utils.js +14 -15
  61. package/dist/components/Date/index.js +12 -9
  62. package/dist/components/DebtState/index.js +14 -8
  63. package/dist/components/IconAndDetails/index.js +19 -17
  64. package/dist/components/Magnitude/index.js +15 -12
  65. package/dist/components/Magnitude/utils.js +3 -8
  66. package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +18 -14
  67. package/dist/components/MainBillData/components/BillAlert/index.js +24 -31
  68. package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +19 -11
  69. package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +14 -11
  70. package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +2 -3
  71. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +23 -15
  72. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/styles.module.scss +3 -2
  73. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +3 -2
  74. package/dist/components/MainBillData/components/BillBody/index.js +42 -44
  75. package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +16 -11
  76. package/dist/components/MainBillData/components/BillHeader/index.js +29 -24
  77. package/dist/components/MainBillData/components/BillHeader/styles.module.scss +1 -1
  78. package/dist/components/MainBillData/index.js +7 -5
  79. package/dist/components/MainBillData/theme.js +8 -9
  80. package/dist/components/MainBillData/utils.js +2 -5
  81. package/dist/components/Period/index.js +54 -43
  82. package/dist/components/Period/styles.module.scss +0 -6
  83. package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +15 -11
  84. package/dist/components/PowerProgresBar/index.js +31 -30
  85. package/dist/components/RateAndCategory/index.js +25 -27
  86. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +20 -13
  87. package/dist/components/RatesDefinition/components/BillRate/index.js +24 -14
  88. package/dist/components/RatesDefinition/components/BillRate/styles.module.scss +1 -1
  89. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +14 -9
  90. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +26 -21
  91. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +11 -7
  92. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/styles.module.scss +1 -1
  93. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +11 -10
  94. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +21 -19
  95. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +34 -36
  96. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +2 -2
  97. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +17 -30
  98. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +37 -48
  99. package/dist/components/RatesDefinition/components/CategoryByConsumption/constants.js +18 -18
  100. package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +23 -31
  101. package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +2 -5
  102. package/dist/components/RatesDefinition/components/PurchasedRate/index.js +19 -13
  103. package/dist/components/RatesDefinition/index.js +20 -15
  104. package/dist/components/RatesDefinition/styles.module.scss +1 -1
  105. package/dist/components/SmartBillProvider/index.js +12 -34
  106. package/dist/components/StyledAmount/constants.js +1 -1
  107. package/dist/components/StyledAmount/index.js +19 -27
  108. package/dist/components/WithContextApi/index.js +18 -25
  109. package/dist/components/WithContextApi/layout.js +2 -2
  110. package/dist/components/WithSeason/index.js +6 -9
  111. package/dist/constants/deviceSizes.js +33 -18
  112. package/dist/constants/seasons.js +2 -2
  113. package/dist/index.js +14 -15
  114. package/dist/scss/variables/commonColors.module.scss +1 -1
  115. package/dist/shared/Context/index.js +7 -3
  116. package/dist/shared/constants/aliases.js +691 -556
  117. package/dist/shared/constants/consumptions.js +4 -4
  118. package/dist/shared/constants/periodicities.js +1 -1
  119. package/dist/shared/constants/rates.js +1 -1
  120. package/dist/shared/constants/readings.js +2 -2
  121. package/dist/shared/constants/seasons.js +2 -2
  122. package/dist/shared/constants/stagesGraph.js +4 -4
  123. package/dist/shared/types/assetsTypes.js +1 -1
  124. package/dist/shared/types/billDataTypes.js +5 -5
  125. package/dist/shared/types/componentsTypes.js +18 -10
  126. package/dist/shared/types/formattersTypes.js +1 -1
  127. package/dist/shared/types/rateStagesTypes.js +3 -3
  128. package/dist/shared/types/smartBillTypes.js +5 -10
  129. package/dist/shared/types/textsTypes.js +1 -1
  130. package/dist/shared/utils/billCalculation.js +11 -10
  131. package/dist/shared/utils/consumptions.js +34 -56
  132. package/dist/shared/utils/context.js +8 -6
  133. package/dist/shared/utils/expirations.js +2 -5
  134. package/dist/shared/utils/periods.js +20 -21
  135. package/dist/shared/utils/rates.js +2 -5
  136. package/dist/shared/utils/readings.js +4 -10
  137. package/dist/shared/utils/season.js +2 -5
  138. package/dist/shared/utils/stagesGraph.js +15 -15
  139. package/dist/utils/hooks.js +1 -1
  140. package/dist/utils.js +7 -8
  141. package/package.json +26 -63
@@ -4,20 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.POWER_TYPES = exports.POWER_FACTORS = exports.ENERGY_TYPES = exports.CONSUMPTION_TYPES = void 0;
7
- var CONSUMPTION_TYPES = exports.CONSUMPTION_TYPES = {
7
+ const CONSUMPTION_TYPES = exports.CONSUMPTION_TYPES = {
8
8
  TOTAL: 'total',
9
9
  DAILY: 'diario'
10
10
  };
11
- var ENERGY_TYPES = exports.ENERGY_TYPES = {
11
+ const ENERGY_TYPES = exports.ENERGY_TYPES = {
12
12
  ACTIVE: 'Energía activa',
13
13
  REACTIVE: 'Energía reactiva'
14
14
  };
15
- var POWER_TYPES = exports.POWER_TYPES = {
15
+ const POWER_TYPES = exports.POWER_TYPES = {
16
16
  REGISTERED: 'Potencia registrada',
17
17
  PURCHASED: 'Potencia convenida',
18
18
  EXCEEDED: 'Potencia excedida'
19
19
  };
20
- var POWER_FACTORS = exports.POWER_FACTORS = {
20
+ const POWER_FACTORS = exports.POWER_FACTORS = {
21
21
  COSINE_PHI: 'Coseno fi',
22
22
  TANGENT_PHI: 'Tangente fi'
23
23
  };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PERIODICITY = void 0;
7
- var PERIODICITY = exports.PERIODICITY = {
7
+ const PERIODICITY = exports.PERIODICITY = {
8
8
  MONTHLY: 'MENSUAL',
9
9
  BIMONTHLY: 'BIMESTRAL'
10
10
  };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.CHARGE_TYPES = void 0;
7
- var CHARGE_TYPES = exports.CHARGE_TYPES = {
7
+ const CHARGE_TYPES = exports.CHARGE_TYPES = {
8
8
  FIXED: 'cargo fijo',
9
9
  VARIABLE: 'cargo variable'
10
10
  };
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.READING_TYPES = exports.READING_MOMENTS = void 0;
7
- var READING_TYPES = exports.READING_TYPES = {
7
+ const READING_TYPES = exports.READING_TYPES = {
8
8
  FACE_TO_FACE: 'Real',
9
9
  ESTIMATED: 'Est',
10
10
  TELEMEDITION: 'Telemedición'
11
11
  };
12
- var READING_MOMENTS = exports.READING_MOMENTS = {
12
+ const READING_MOMENTS = exports.READING_MOMENTS = {
13
13
  INITIAL: 'inicio',
14
14
  FINAL: 'fin'
15
15
  };
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SEASON_PERIODS = exports.SEASONS = void 0;
7
- var SEASONS = exports.SEASONS = {
7
+ const SEASONS = exports.SEASONS = {
8
8
  SPRING: 'spring',
9
9
  SUMMER: 'summer',
10
10
  AUTUMN: 'autumn',
11
11
  WINTER: 'winter'
12
12
  };
13
- var SEASON_PERIODS = exports.SEASON_PERIODS = [{
13
+ const SEASON_PERIODS = exports.SEASON_PERIODS = [{
14
14
  initMonth: 1,
15
15
  endingMonth: 2,
16
16
  season: SEASONS.SUMMER
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MIN_VALUE = exports.MAX_VALUE = exports.INFINITE = exports.DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH = void 0;
7
- var INFINITE = exports.INFINITE = null;
8
- var MAX_VALUE = exports.MAX_VALUE = 1;
9
- var MIN_VALUE = exports.MIN_VALUE = 0;
10
- var DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH = exports.DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH = 200;
7
+ const INFINITE = exports.INFINITE = null;
8
+ const MAX_VALUE = exports.MAX_VALUE = 1;
9
+ const MIN_VALUE = exports.MIN_VALUE = 0;
10
+ const DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH = exports.DEFAULT_INFINITE_SUB_STAGE_RANGE_WIDTH = 200;
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.assetsTypes = void 0;
7
7
  var _propTypes = require("prop-types");
8
8
  var _componentsTypes = require("./componentsTypes");
9
- var assetsTypes = exports.assetsTypes = (0, _propTypes.objectOf)(_componentsTypes.componentTypes);
9
+ const assetsTypes = exports.assetsTypes = (0, _propTypes.objectOf)(_componentsTypes.componentTypes);
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.settlementsTypes = exports.periodsTypes = exports.periodTypes = exports.consumptionTypes = exports.billDataTypes = void 0;
7
7
  var _propTypes = require("prop-types");
8
- var consumptionTypes = exports.consumptionTypes = (0, _propTypes.shape)({
8
+ const consumptionTypes = exports.consumptionTypes = (0, _propTypes.shape)({
9
9
  magnitude: _propTypes.string,
10
10
  type: _propTypes.string,
11
11
  unit: _propTypes.string,
12
12
  value: _propTypes.number
13
13
  });
14
- var settlementsTypes = exports.settlementsTypes = (0, _propTypes.shape)({
14
+ const settlementsTypes = exports.settlementsTypes = (0, _propTypes.shape)({
15
15
  periodicity: _propTypes.string,
16
16
  total_settlements: _propTypes.number,
17
17
  total_settlements_days: _propTypes.number,
@@ -37,15 +37,15 @@ var settlementsTypes = exports.settlementsTypes = (0, _propTypes.shape)({
37
37
  })
38
38
  }))
39
39
  });
40
- var periodTypes = exports.periodTypes = (0, _propTypes.shape)({
40
+ const periodTypes = exports.periodTypes = (0, _propTypes.shape)({
41
41
  current: _propTypes.bool,
42
42
  number: _propTypes.string,
43
43
  year: _propTypes.string,
44
44
  settlements: settlementsTypes,
45
45
  consumptions: (0, _propTypes.arrayOf)(consumptionTypes)
46
46
  });
47
- var periodsTypes = exports.periodsTypes = (0, _propTypes.arrayOf)(periodTypes);
48
- var billDataTypes = exports.billDataTypes = (0, _propTypes.shape)({
47
+ const periodsTypes = exports.periodsTypes = (0, _propTypes.arrayOf)(periodTypes);
48
+ const billDataTypes = exports.billDataTypes = (0, _propTypes.shape)({
49
49
  bill_type: _propTypes.string,
50
50
  bill_number: _propTypes.string,
51
51
  pending_debt: _propTypes.bool,
@@ -6,16 +6,24 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.unpackedComponentsTypes = exports.componentsTypes = exports.componentTypes = void 0;
7
7
  var _propTypes = require("prop-types");
8
8
  var COMPONENTS = _interopRequireWildcard(require("../constants/components"));
9
- var _shape;
10
- 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); }
11
- 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; }
12
- 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); }
13
- 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; }
14
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
- 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); }
16
- var componentTypes = exports.componentTypes = (0, _propTypes.oneOfType)([_propTypes.element, _propTypes.node, _propTypes.func, _propTypes.any]);
17
- var componentsTypes = exports.componentsTypes = (0, _propTypes.shape)((_shape = {}, _defineProperty(_shape, COMPONENTS.BUTTON, componentTypes), _defineProperty(_shape, COMPONENTS.DIALOG, componentTypes), _defineProperty(_shape, COMPONENTS.EXTERNAL_LINK, componentTypes), _defineProperty(_shape, COMPONENTS.LABEL, componentTypes), _defineProperty(_shape, COMPONENTS.PROGRESS_BAR, componentTypes), _defineProperty(_shape, COMPONENTS.TOOLTIP, componentTypes), _defineProperty(_shape, COMPONENTS.TOUCHABLE, componentTypes), _defineProperty(_shape, COMPONENTS.CARD, componentTypes), _defineProperty(_shape, COMPONENTS.MARKDOWN, componentTypes), _defineProperty(_shape, COMPONENTS.TOGGLE, componentTypes), _defineProperty(_shape, COMPONENTS.BAR_CHART, componentTypes), _defineProperty(_shape, COMPONENTS.PIE_CHART, componentTypes), _shape));
18
- var unpackedComponentsTypes = exports.unpackedComponentsTypes = {
9
+ 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); }
10
+ 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; }
11
+ const componentTypes = exports.componentTypes = (0, _propTypes.oneOfType)([_propTypes.element, _propTypes.node, _propTypes.func, _propTypes.any]);
12
+ const componentsTypes = exports.componentsTypes = (0, _propTypes.shape)({
13
+ [COMPONENTS.BUTTON]: componentTypes,
14
+ [COMPONENTS.DIALOG]: componentTypes,
15
+ [COMPONENTS.EXTERNAL_LINK]: componentTypes,
16
+ [COMPONENTS.LABEL]: componentTypes,
17
+ [COMPONENTS.PROGRESS_BAR]: componentTypes,
18
+ [COMPONENTS.TOOLTIP]: componentTypes,
19
+ [COMPONENTS.TOUCHABLE]: componentTypes,
20
+ [COMPONENTS.CARD]: componentTypes,
21
+ [COMPONENTS.MARKDOWN]: componentTypes,
22
+ [COMPONENTS.TOGGLE]: componentTypes,
23
+ [COMPONENTS.BAR_CHART]: componentTypes,
24
+ [COMPONENTS.PIE_CHART]: componentTypes
25
+ });
26
+ const unpackedComponentsTypes = exports.unpackedComponentsTypes = {
19
27
  Button: componentTypes,
20
28
  Dialog: componentTypes,
21
29
  Label: componentTypes,
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.formattersTypes = void 0;
7
7
  var _propTypes = require("prop-types");
8
- var formattersTypes = exports.formattersTypes = (0, _propTypes.shape)({
8
+ const formattersTypes = exports.formattersTypes = (0, _propTypes.shape)({
9
9
  billNumberFormatter: _propTypes.func,
10
10
  clientNumberFormatter: _propTypes.func
11
11
  });
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.subStageType = exports.stageType = exports.rateStagesTypes = void 0;
7
7
  var _propTypes = require("prop-types");
8
- var subStageType = exports.subStageType = (0, _propTypes.shape)({
8
+ const subStageType = exports.subStageType = (0, _propTypes.shape)({
9
9
  category: _propTypes.number,
10
10
  name: _propTypes.string,
11
11
  color: _propTypes.string,
12
12
  range: (0, _propTypes.arrayOf)(_propTypes.number)
13
13
  });
14
- var stageType = exports.stageType = (0, _propTypes.shape)({
14
+ const stageType = exports.stageType = (0, _propTypes.shape)({
15
15
  group: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
16
16
  range: (0, _propTypes.arrayOf)(_propTypes.number),
17
17
  unit: _propTypes.string,
18
18
  sub_rate_stages: (0, _propTypes.arrayOf)(subStageType)
19
19
  });
20
- var rateStagesTypes = exports.rateStagesTypes = (0, _propTypes.arrayOf)(stageType);
20
+ const rateStagesTypes = exports.rateStagesTypes = (0, _propTypes.arrayOf)(stageType);
@@ -9,19 +9,14 @@ var _assetsTypes = require("./assetsTypes");
9
9
  var _textsTypes = require("./textsTypes");
10
10
  var _formattersTypes = require("./formattersTypes");
11
11
  var _componentsTypes = require("./componentsTypes");
12
- 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); }
13
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
- 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; }
16
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
- 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); }
18
- var configTypes = (0, _propTypes.shape)({
12
+ const configTypes = (0, _propTypes.shape)({
19
13
  texts: _textsTypes.textsTypes,
20
14
  formatters: _formattersTypes.formattersTypes
21
15
  });
22
- var contextApiInfoTypes = exports.contextApiInfoTypes = (0, _propTypes.shape)(_objectSpread({
16
+ const contextApiInfoTypes = exports.contextApiInfoTypes = (0, _propTypes.shape)({
23
17
  assets: _assetsTypes.assetsTypes,
24
18
  components: _componentsTypes.componentsTypes,
25
19
  config: configTypes,
26
- theme: _propTypes.any
27
- }, _componentsTypes.unpackedComponentsTypes));
20
+ theme: _propTypes.any,
21
+ ..._componentsTypes.unpackedComponentsTypes
22
+ });
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.textsTypes = void 0;
7
7
  var _propTypes = require("prop-types");
8
- var textsTypes = exports.textsTypes = (0, _propTypes.shape)({
8
+ const textsTypes = exports.textsTypes = (0, _propTypes.shape)({
9
9
  commons: (0, _propTypes.shape)({
10
10
  accept: _propTypes.string,
11
11
  bimester: _propTypes.string,
@@ -7,18 +7,19 @@ exports.titleMapper = void 0;
7
7
  var _string = require("@widergy/web-utils/lib/string");
8
8
  var _periodicities = require("../constants/periodicities");
9
9
  var _periods = require("./periods");
10
- var titleMapper = exports.titleMapper = function titleMapper(billData, texts) {
10
+ const titleMapper = (billData, texts) => {
11
11
  var _currentPeriod$settle, _currentPeriod$settle2, _currentPeriod$settle3;
12
- var currentPeriod = (0, _periods.getCurrentPeriod)(billData);
13
- var periodicity = currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle = currentPeriod.settlements) === null || _currentPeriod$settle === void 0 ? void 0 : _currentPeriod$settle.periodicity;
14
- var currentSettlement = (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.number) || '-';
15
- var totalSettlements = (currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle3 = currentPeriod.settlements) === null || _currentPeriod$settle3 === void 0 ? void 0 : _currentPeriod$settle3.total_settlements) || '-';
16
- var periodYear = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.year) || '-';
12
+ const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
13
+ const periodicity = currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle = currentPeriod.settlements) === null || _currentPeriod$settle === void 0 ? void 0 : _currentPeriod$settle.periodicity;
14
+ const currentSettlement = (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.number) || '-';
15
+ const totalSettlements = (currentPeriod === null || currentPeriod === void 0 || (_currentPeriod$settle3 = currentPeriod.settlements) === null || _currentPeriod$settle3 === void 0 ? void 0 : _currentPeriod$settle3.total_settlements) || '-';
16
+ const periodYear = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.year) || '-';
17
17
  return {
18
18
  periodicity: (0, _string.stringToCompareWithoutAccentsInclusive)(periodicity, _periodicities.PERIODICITY.BIMONTHLY) ? texts.commons.bimester : '-',
19
- currentSettlement: currentSettlement,
20
- totalSettlements: totalSettlements,
19
+ currentSettlement,
20
+ totalSettlements,
21
21
  periodNumber: (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.number) || '-',
22
- periodYear: periodYear
22
+ periodYear
23
23
  };
24
- };
24
+ };
25
+ exports.titleMapper = titleMapper;
@@ -10,75 +10,53 @@ var _string = require("@widergy/web-utils/lib/string");
10
10
  var _consumptions = require("../constants/consumptions");
11
11
  var _periods = require("./periods");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
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."); }
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); }
16
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
17
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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; }
19
- var getCurrentConsumption = exports.getCurrentConsumption = function getCurrentConsumption(period, energyType) {
13
+ const getCurrentConsumption = (period, energyType) => {
20
14
  var _period$settlements;
21
- return (period === null || period === void 0 || (_period$settlements = period.settlements) === null || _period$settlements === void 0 || (_period$settlements = _period$settlements.current) === null || _period$settlements === void 0 || (_period$settlements = _period$settlements.consumptions) === null || _period$settlements === void 0 ? void 0 : _period$settlements.find(function (consumption) {
22
- return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType);
23
- })) || {};
15
+ return (period === null || period === void 0 || (_period$settlements = period.settlements) === null || _period$settlements === void 0 || (_period$settlements = _period$settlements.current) === null || _period$settlements === void 0 || (_period$settlements = _period$settlements.consumptions) === null || _period$settlements === void 0 ? void 0 : _period$settlements.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType))) || {};
24
16
  };
25
- var getRemainingConsumption = exports.getRemainingConsumption = function getRemainingConsumption(period, energyType) {
17
+ exports.getCurrentConsumption = getCurrentConsumption;
18
+ const getRemainingConsumption = (period, energyType) => {
26
19
  var _period$settlements2;
27
- var remaining = (period === null || period === void 0 || (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 || (_period$settlements2 = _period$settlements2.remaining) === null || _period$settlements2 === void 0 || (_period$settlements2 = _period$settlements2[0]) === null || _period$settlements2 === void 0 ? void 0 : _period$settlements2.consumptions) || [];
28
- return remaining.find(function (item) {
29
- return (0, _string.stringToCompareWithoutAccentsInclusive)(item.magnitude, energyType);
30
- }) || {};
20
+ const remaining = (period === null || period === void 0 || (_period$settlements2 = period.settlements) === null || _period$settlements2 === void 0 || (_period$settlements2 = _period$settlements2.remaining) === null || _period$settlements2 === void 0 || (_period$settlements2 = _period$settlements2[0]) === null || _period$settlements2 === void 0 ? void 0 : _period$settlements2.consumptions) || [];
21
+ return remaining.find(item => (0, _string.stringToCompareWithoutAccentsInclusive)(item.magnitude, energyType)) || {};
31
22
  };
32
- var getTotalConsumption = exports.getTotalConsumption = function getTotalConsumption(period, energyOrPowerType) {
23
+ exports.getRemainingConsumption = getRemainingConsumption;
24
+ const getTotalConsumption = (period, energyOrPowerType) => {
33
25
  var _period$consumptions;
34
- return (period === null || period === void 0 || (_period$consumptions = period.consumptions) === null || _period$consumptions === void 0 ? void 0 : _period$consumptions.find(function (consumption) {
35
- return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.TOTAL) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyOrPowerType);
36
- })) || {};
26
+ return (period === null || period === void 0 || (_period$consumptions = period.consumptions) === null || _period$consumptions === void 0 ? void 0 : _period$consumptions.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.TOTAL) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyOrPowerType))) || {};
37
27
  };
38
- var getDailyConsumption = exports.getDailyConsumption = function getDailyConsumption(period, energyType) {
28
+ exports.getTotalConsumption = getTotalConsumption;
29
+ const getDailyConsumption = (period, energyType) => {
39
30
  var _period$consumptions2;
40
- return (period === null || period === void 0 || (_period$consumptions2 = period.consumptions) === null || _period$consumptions2 === void 0 ? void 0 : _period$consumptions2.find(function (consumption) {
41
- return (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.DAILY) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType);
42
- })) || {};
31
+ return (period === null || period === void 0 || (_period$consumptions2 = period.consumptions) === null || _period$consumptions2 === void 0 ? void 0 : _period$consumptions2.find(consumption => (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.type, _consumptions.CONSUMPTION_TYPES.DAILY) && (0, _string.stringToCompareWithoutAccentsInclusive)(consumption.magnitude, energyType))) || {};
43
32
  };
44
- var formatPeriod = function formatPeriod(period) {
45
- return period.number && period.year && "".concat(period.number, "/").concat((0, _dayjs.default)(period.year, 'YYYY').format('YY'));
46
- };
47
- var getConsumptionHistoryData = exports.getConsumptionHistoryData = function getConsumptionHistoryData(billDataParameter, energyType, showPeriodsInChronologicalOrder) {
33
+ exports.getDailyConsumption = getDailyConsumption;
34
+ const formatPeriod = period => period.number && period.year && "".concat(period.number, "/").concat((0, _dayjs.default)(period.year, 'YYYY').format('YY'));
35
+ const getConsumptionHistoryData = (billDataParameter, energyType, showPeriodsInChronologicalOrder) => {
48
36
  var _billData$periods;
49
- var billData = _lodash.default.cloneDeep(billDataParameter);
50
- var currentPeriod = (0, _periods.getCurrentPeriod)(billData);
51
- var lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
52
- var otherPeriods = billData === null || billData === void 0 || (_billData$periods = billData.periods) === null || _billData$periods === void 0 ? void 0 : _billData$periods.filter(function (period) {
53
- return !(0, _periods.areSamePeriods)(period, currentPeriod) && !(0, _periods.areSamePeriods)(period, lastYearPeriod) && period.consumptions;
54
- }).sort(_periods.comparePeriods);
55
- var periods = [].concat(_toConsumableArray(lastYearPeriod.consumptions && showPeriodsInChronologicalOrder ? [lastYearPeriod] : []), _toConsumableArray(otherPeriods), _toConsumableArray(currentPeriod.consumptions ? [currentPeriod] : []), _toConsumableArray(lastYearPeriod.consumptions && !showPeriodsInChronologicalOrder ? [lastYearPeriod] : [])).filter(function (period) {
56
- return getTotalConsumption(period, energyType).value === 0 || getTotalConsumption(period, energyType).value;
57
- }).map(function (period) {
58
- return {
59
- period: formatPeriod(period),
60
- consumption: getTotalConsumption(period, energyType).value,
61
- unit: getTotalConsumption(period, energyType).unit
62
- };
63
- });
37
+ const billData = _lodash.default.cloneDeep(billDataParameter);
38
+ const currentPeriod = (0, _periods.getCurrentPeriod)(billData);
39
+ const lastYearPeriod = (0, _periods.getLastYearPeriod)(billData);
40
+ const otherPeriods = billData === null || billData === void 0 || (_billData$periods = billData.periods) === null || _billData$periods === void 0 ? void 0 : _billData$periods.filter(period => !(0, _periods.areSamePeriods)(period, currentPeriod) && !(0, _periods.areSamePeriods)(period, lastYearPeriod) && period.consumptions).sort(_periods.comparePeriods);
41
+ const periods = [...(lastYearPeriod.consumptions && showPeriodsInChronologicalOrder ? [lastYearPeriod] : []), ...otherPeriods, ...(currentPeriod.consumptions ? [currentPeriod] : []), ...(lastYearPeriod.consumptions && !showPeriodsInChronologicalOrder ? [lastYearPeriod] : [])].filter(period => getTotalConsumption(period, energyType).value === 0 || getTotalConsumption(period, energyType).value).map(period => ({
42
+ period: formatPeriod(period),
43
+ consumption: getTotalConsumption(period, energyType).value,
44
+ unit: getTotalConsumption(period, energyType).unit
45
+ }));
64
46
  return {
65
- periods: periods,
47
+ periods,
66
48
  currentPeriod: formatPeriod(currentPeriod),
67
49
  lastYearPeriod: formatPeriod(lastYearPeriod),
68
50
  unit: getTotalConsumption(currentPeriod, energyType).unit
69
51
  };
70
52
  };
71
- var consumptionDataMapper = exports.consumptionDataMapper = function consumptionDataMapper() {
72
- var periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
73
- var texts = arguments.length > 1 ? arguments[1] : undefined;
74
- var dataMappers = arguments.length > 2 ? arguments[2] : undefined;
75
- var currentPeriod = periods.find(function (item) {
76
- return item.current;
77
- });
53
+ exports.getConsumptionHistoryData = getConsumptionHistoryData;
54
+ const consumptionDataMapper = function () {
55
+ let periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
56
+ let texts = arguments.length > 1 ? arguments[1] : undefined;
57
+ let dataMappers = arguments.length > 2 ? arguments[2] : undefined;
58
+ const currentPeriod = periods.find(item => item.current);
78
59
  if (!currentPeriod) return [];
79
- return dataMappers.map(function (dataMapper) {
80
- return dataMapper(currentPeriod, texts);
81
- }).sort(function (a, b) {
82
- return a.order - b.order;
83
- });
84
- };
60
+ return dataMappers.map(dataMapper => dataMapper(currentPeriod, texts)).sort((a, b) => a.order - b.order);
61
+ };
62
+ exports.consumptionDataMapper = consumptionDataMapper;
@@ -1,15 +1,16 @@
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
  });
7
6
  exports.unpackComponents = void 0;
8
7
  var COMPONENTS = _interopRequireWildcard(require("../constants/components"));
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); }
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; }
11
- var unpackComponents = exports.unpackComponents = function unpackComponents(contextApiInfo) {
12
- var components = contextApiInfo.components;
8
+ 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); }
9
+ 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; }
10
+ const unpackComponents = contextApiInfo => {
11
+ const {
12
+ components
13
+ } = contextApiInfo;
13
14
  return {
14
15
  Button: components[COMPONENTS.BUTTON],
15
16
  Dialog: components[COMPONENTS.DIALOG],
@@ -24,4 +25,5 @@ var unpackComponents = exports.unpackComponents = function unpackComponents(cont
24
25
  BarChart: components[COMPONENTS.BAR_CHART],
25
26
  PieChart: components[COMPONENTS.PIE_CHART]
26
27
  };
27
- };
28
+ };
29
+ exports.unpackComponents = unpackComponents;
@@ -5,8 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getExpiration = void 0;
7
7
  var _seamlessImmutable = require("seamless-immutable");
8
- var getExpiration = exports.getExpiration = function getExpiration(billData, number) {
9
- return (0, _seamlessImmutable.getIn)(billData, ['expirations'], []).find(function (expiration) {
10
- return expiration.number === number;
11
- }) || {};
12
- };
8
+ const getExpiration = (billData, number) => (0, _seamlessImmutable.getIn)(billData, ['expirations'], []).find(expiration => expiration.number === number) || {};
9
+ exports.getExpiration = getExpiration;
@@ -5,39 +5,38 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getSavingsPercentage = exports.getLastYearPeriod = exports.getCurrentPeriod = exports.comparePeriods = exports.areSamePeriods = void 0;
7
7
  var _seamlessImmutable = require("seamless-immutable");
8
- var getCurrentPeriod = exports.getCurrentPeriod = function getCurrentPeriod(billData) {
9
- return (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(function (period) {
10
- return period.current;
11
- }) || {};
8
+ const getCurrentPeriod = billData => (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(period => period.current) || {};
9
+ exports.getCurrentPeriod = getCurrentPeriod;
10
+ const getLastYearPeriod = billData => {
11
+ const currentPeriod = getCurrentPeriod(billData);
12
+ const lastYear = "".concat(parseInt(currentPeriod.year, 10) - 1);
13
+ return (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(period => period.number === currentPeriod.number && period.year === lastYear) || {};
12
14
  };
13
- var getLastYearPeriod = exports.getLastYearPeriod = function getLastYearPeriod(billData) {
14
- var currentPeriod = getCurrentPeriod(billData);
15
- var lastYear = "".concat(parseInt(currentPeriod.year, 10) - 1);
16
- return (0, _seamlessImmutable.getIn)(billData, ['periods'], []).find(function (period) {
17
- return period.number === currentPeriod.number && period.year === lastYear;
18
- }) || {};
19
- };
20
- var areSamePeriods = exports.areSamePeriods = function areSamePeriods() {
21
- var period1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
- var period2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15
+ exports.getLastYearPeriod = getLastYearPeriod;
16
+ const areSamePeriods = function () {
17
+ let period1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
+ let period2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23
19
  if (period1.number && period1.year && period2.number && period2.year) {
24
20
  return period1.number === period2.number && period1.year === period2.year;
25
21
  }
26
22
  return false;
27
23
  };
28
- var comparePeriods = exports.comparePeriods = function comparePeriods(period1, period2) {
24
+ exports.areSamePeriods = areSamePeriods;
25
+ const comparePeriods = (period1, period2) => {
29
26
  if (period1 && period1.number && period1.year && period2 && period2.number && period2.year) {
30
- var number1 = parseInt(period1.number, 10);
31
- var number2 = parseInt(period2.number, 10);
32
- var year1 = parseInt(period1.year, 10);
33
- var year2 = parseInt(period2.year, 10);
27
+ const number1 = parseInt(period1.number, 10);
28
+ const number2 = parseInt(period2.number, 10);
29
+ const year1 = parseInt(period1.year, 10);
30
+ const year2 = parseInt(period2.year, 10);
34
31
  if (year1 > year2) return 1;
35
32
  if (year1 === year2 && number1 > number2) return 1;
36
33
  return -1;
37
34
  }
38
35
  return 0;
39
36
  };
40
- var getSavingsPercentage = exports.getSavingsPercentage = function getSavingsPercentage(period) {
37
+ exports.comparePeriods = comparePeriods;
38
+ const getSavingsPercentage = period => {
41
39
  var _period$additional_in;
42
40
  return period === null || period === void 0 || (_period$additional_in = period.additional_information) === null || _period$additional_in === void 0 ? void 0 : _period$additional_in.savings_percentage;
43
- };
41
+ };
42
+ exports.getSavingsPercentage = getSavingsPercentage;
@@ -6,8 +6,5 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getCharge = void 0;
7
7
  var _seamlessImmutable = require("seamless-immutable");
8
8
  var _string = require("@widergy/web-utils/lib/string");
9
- var getCharge = exports.getCharge = function getCharge(billData, concept) {
10
- return (0, _seamlessImmutable.getIn)(billData, ['client', 'rate', 'charges'], []).find(function (charge) {
11
- return (0, _string.stringCompare)(charge.concept, concept);
12
- }) || {};
13
- };
9
+ const getCharge = (billData, concept) => (0, _seamlessImmutable.getIn)(billData, ['client', 'rate', 'charges'], []).find(charge => (0, _string.stringCompare)(charge.concept, concept)) || {};
10
+ exports.getCharge = getCharge;
@@ -7,13 +7,7 @@ exports.getReadingPeriod = exports.getActiveEnergyRecord = void 0;
7
7
  var _seamlessImmutable = require("seamless-immutable");
8
8
  var _string = require("@widergy/web-utils/lib/string");
9
9
  var _consumptions = require("../constants/consumptions");
10
- var getReadingPeriod = exports.getReadingPeriod = function getReadingPeriod(billData, moment) {
11
- return (0, _seamlessImmutable.getIn)(billData, ['reading_periods'], []).find(function (readingPeriod) {
12
- return (0, _string.stringCompare)(readingPeriod.moment, moment);
13
- }) || {};
14
- };
15
- var getActiveEnergyRecord = exports.getActiveEnergyRecord = function getActiveEnergyRecord(readingPeriod) {
16
- return (0, _seamlessImmutable.getIn)(readingPeriod, ['records'], []).find(function (record) {
17
- return (0, _string.stringToCompareWithoutAccentsInclusive)(record.magnitude, _consumptions.ENERGY_TYPES.ACTIVE);
18
- }) || {};
19
- };
10
+ const getReadingPeriod = (billData, moment) => (0, _seamlessImmutable.getIn)(billData, ['reading_periods'], []).find(readingPeriod => (0, _string.stringCompare)(readingPeriod.moment, moment)) || {};
11
+ exports.getReadingPeriod = getReadingPeriod;
12
+ const getActiveEnergyRecord = readingPeriod => (0, _seamlessImmutable.getIn)(readingPeriod, ['records'], []).find(record => (0, _string.stringToCompareWithoutAccentsInclusive)(record.magnitude, _consumptions.ENERGY_TYPES.ACTIVE)) || {};
13
+ exports.getActiveEnergyRecord = getActiveEnergyRecord;
@@ -5,8 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getSeason = void 0;
7
7
  var _seasons = require("../constants/seasons");
8
- var getSeason = exports.getSeason = function getSeason(monthNumber) {
9
- return (_seasons.SEASON_PERIODS.find(function (seasonPeriod) {
10
- return seasonPeriod.initMonth <= monthNumber && seasonPeriod.endingMonth >= monthNumber;
11
- }) || {}).season;
12
- };
8
+ const getSeason = monthNumber => (_seasons.SEASON_PERIODS.find(seasonPeriod => seasonPeriod.initMonth <= monthNumber && seasonPeriod.endingMonth >= monthNumber) || {}).season;
9
+ exports.getSeason = getSeason;
@@ -5,24 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getSubStageWidth = exports.getSubStageRangeWidth = exports.getStageRangeWidth = exports.getCurrentStage = void 0;
7
7
  var _stagesGraph = require("../constants/stagesGraph");
8
- var getCurrentStage = exports.getCurrentStage = function getCurrentStage(value, rateStages) {
9
- return rateStages.find(function (stage) {
10
- return stage.range[_stagesGraph.MIN_VALUE] <= value && (value <= stage.range[_stagesGraph.MAX_VALUE] || stage.range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE);
11
- });
12
- };
13
- var getSubStageRangeWidth = exports.getSubStageRangeWidth = function getSubStageRangeWidth(subStage) {
14
- var range = subStage.range;
8
+ const getCurrentStage = (value, rateStages) => rateStages.find(stage => stage.range[_stagesGraph.MIN_VALUE] <= value && (value <= stage.range[_stagesGraph.MAX_VALUE] || stage.range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE));
9
+ exports.getCurrentStage = getCurrentStage;
10
+ const getSubStageRangeWidth = subStage => {
11
+ const {
12
+ range
13
+ } = subStage;
15
14
  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];
16
15
  };
17
- var getStageRangeWidth = exports.getStageRangeWidth = function getStageRangeWidth(stage) {
18
- var range = stage.range;
16
+ exports.getSubStageRangeWidth = getSubStageRangeWidth;
17
+ const getStageRangeWidth = stage => {
18
+ const {
19
+ range
20
+ } = stage;
19
21
  if (range[_stagesGraph.MAX_VALUE] === _stagesGraph.INFINITE || !range[_stagesGraph.MAX_VALUE]) {
20
- return stage.sub_rate_stages.reduce(function (totalWidth, subStage) {
21
- return totalWidth + getSubStageRangeWidth(subStage);
22
- }, 0);
22
+ return stage.sub_rate_stages.reduce((totalWidth, subStage) => totalWidth + getSubStageRangeWidth(subStage), 0);
23
23
  }
24
24
  return range[_stagesGraph.MAX_VALUE] - range[_stagesGraph.MIN_VALUE];
25
25
  };
26
- var getSubStageWidth = exports.getSubStageWidth = function getSubStageWidth(stage, subStage) {
27
- return getSubStageRangeWidth(subStage) / getStageRangeWidth(stage) * 100;
28
- };
26
+ exports.getStageRangeWidth = getStageRangeWidth;
27
+ const getSubStageWidth = (stage, subStage) => getSubStageRangeWidth(subStage) / getStageRangeWidth(stage) * 100;
28
+ exports.getSubStageWidth = getSubStageWidth;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useScreenSize = void 0;
7
7
  var _energyHooks = require("@widergy/energy-hooks");
8
- var useScreenSize = exports.useScreenSize = (0, _energyHooks.createUseScreenSize)({
8
+ const useScreenSize = exports.useScreenSize = (0, _energyHooks.createUseScreenSize)({
9
9
  mobileBP: 767,
10
10
  tabletBP: 1024
11
11
  });