@widergy/utilitygo-smart-bill-web 1.10.0 → 1.10.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 (128) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/Advice/index.js +6 -10
  3. package/dist/components/Amount/index.js +21 -26
  4. package/dist/components/Amount/utils.js +5 -1
  5. package/dist/components/Banner/index.js +6 -10
  6. package/dist/components/BarChart/constants.js +3 -3
  7. package/dist/components/BarChart/index.js +25 -28
  8. package/dist/components/BarChart/utils.js +15 -15
  9. package/dist/components/BillCalculation/components/ConceptCard/index.js +48 -47
  10. package/dist/components/BillCalculation/constants.js +1 -1
  11. package/dist/components/BillCalculation/index.js +54 -44
  12. package/dist/components/BillCalculation/utils.js +14 -17
  13. package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +25 -26
  14. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/constants.js +9 -3
  15. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +31 -34
  16. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/styles.module.scss +2 -2
  17. package/dist/components/BillSummary/components/BilledConcepts/constants.js +14 -12
  18. package/dist/components/BillSummary/components/BilledConcepts/index.js +49 -31
  19. package/dist/components/BillSummary/components/BilledConcepts/utils.js +76 -44
  20. package/dist/components/BillSummary/index.js +78 -76
  21. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +8 -8
  22. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +12 -17
  23. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +1 -1
  24. package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +135 -148
  25. package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +14 -16
  26. package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +94 -89
  27. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +11 -21
  28. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +1 -1
  29. package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +16 -21
  30. package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +9 -13
  31. package/dist/components/ConsumptionComparison/index.js +56 -42
  32. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +26 -30
  33. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +13 -18
  34. package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +15 -17
  35. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +17 -21
  36. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +1 -1
  37. package/dist/components/ConsumptionEnergyDetails/index.js +47 -51
  38. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +65 -66
  39. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +13 -11
  40. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +19 -22
  41. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +10 -16
  42. package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +39 -43
  43. package/dist/components/ConsumptionIncluded/index.js +36 -34
  44. package/dist/components/ConsumptionIncluded/utils.js +33 -29
  45. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +10 -14
  46. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +22 -25
  47. package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +34 -18
  48. package/dist/components/ConsumptionPeriod/components/Reading/index.js +34 -37
  49. package/dist/components/ConsumptionPeriod/index.js +8 -12
  50. package/dist/components/ConsumptionPeriod/utils.js +15 -13
  51. package/dist/components/Date/index.js +9 -12
  52. package/dist/components/DebtState/index.js +8 -14
  53. package/dist/components/IconAndDetails/index.js +17 -19
  54. package/dist/components/Magnitude/index.js +12 -15
  55. package/dist/components/Magnitude/utils.js +8 -2
  56. package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +16 -20
  57. package/dist/components/MainBillData/components/BillAlert/index.js +45 -28
  58. package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +11 -19
  59. package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +11 -14
  60. package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +3 -1
  61. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +15 -23
  62. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +1 -1
  63. package/dist/components/MainBillData/components/BillBody/index.js +50 -45
  64. package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +9 -15
  65. package/dist/components/MainBillData/components/BillHeader/index.js +26 -29
  66. package/dist/components/MainBillData/index.js +5 -7
  67. package/dist/components/MainBillData/theme.js +9 -7
  68. package/dist/components/MainBillData/utils.js +5 -1
  69. package/dist/components/Period/index.js +47 -55
  70. package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +11 -15
  71. package/dist/components/PowerProgresBar/index.js +36 -36
  72. package/dist/components/RateAndCategory/index.js +31 -30
  73. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +13 -20
  74. package/dist/components/RatesDefinition/components/BillRate/index.js +14 -24
  75. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +9 -14
  76. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/LimitsLine/index.js +7 -5
  77. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/index.js +12 -18
  78. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/utils.js +3 -1
  79. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/index.js +18 -18
  80. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/index.js +19 -19
  81. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +21 -26
  82. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +12 -15
  83. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +37 -35
  84. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/index.js +23 -26
  85. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +18 -18
  86. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +32 -12
  87. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +20 -12
  88. package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +50 -32
  89. package/dist/components/RatesDefinition/components/PurchasedRate/index.js +13 -19
  90. package/dist/components/RatesDefinition/index.js +15 -20
  91. package/dist/components/SmartBillProvider/index.js +47 -12
  92. package/dist/components/StyledAmount/constants.js +1 -1
  93. package/dist/components/StyledAmount/index.js +35 -19
  94. package/dist/components/WithContextApi/index.js +27 -16
  95. package/dist/components/WithContextApi/layout.js +2 -2
  96. package/dist/components/WithSeason/index.js +9 -5
  97. package/dist/constants/deviceSizes.js +17 -27
  98. package/dist/constants/seasons.js +2 -2
  99. package/dist/index.js +16 -14
  100. package/dist/shared/Context/index.js +3 -5
  101. package/dist/shared/constants/aliases.js +550 -683
  102. package/dist/shared/constants/components.js +2 -1
  103. package/dist/shared/constants/consumptions.js +4 -4
  104. package/dist/shared/constants/periodicities.js +1 -1
  105. package/dist/shared/constants/rates.js +1 -1
  106. package/dist/shared/constants/readings.js +2 -2
  107. package/dist/shared/constants/seasons.js +2 -2
  108. package/dist/shared/constants/stagesGraph.js +4 -4
  109. package/dist/shared/types/assetsTypes.js +1 -1
  110. package/dist/shared/types/billDataTypes.js +4 -4
  111. package/dist/shared/types/componentsTypes.js +13 -18
  112. package/dist/shared/types/formattersTypes.js +1 -1
  113. package/dist/shared/types/rateStagesTypes.js +3 -3
  114. package/dist/shared/types/smartBillTypes.js +10 -5
  115. package/dist/shared/types/textsTypes.js +1 -1
  116. package/dist/shared/utils/billCalculation.js +9 -9
  117. package/dist/shared/utils/consumptions.js +62 -28
  118. package/dist/shared/utils/context.js +8 -7
  119. package/dist/shared/utils/expirations.js +5 -1
  120. package/dist/shared/utils/periods.js +20 -14
  121. package/dist/shared/utils/rates.js +5 -1
  122. package/dist/shared/utils/readings.js +10 -2
  123. package/dist/shared/utils/season.js +5 -1
  124. package/dist/shared/utils/stagesGraph.js +15 -11
  125. package/dist/utils/hooks.js +58 -19
  126. package/dist/utils.js +8 -4
  127. package/package.json +1 -2
  128. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/utils.js +0 -27
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -11,22 +13,55 @@ var _Context = require("../../shared/Context");
11
13
 
12
14
  var _smartBillTypes = require("../../shared/types/smartBillTypes");
13
15
 
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
+
22
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
+
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
+
26
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
+
28
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
+
30
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
31
 
16
- 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; }
32
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
17
33
 
18
- class SmartBillProvider extends _react.PureComponent {
19
- render() {
20
- const {
21
- children,
22
- contextApiInfo
23
- } = this.props;
24
- return /*#__PURE__*/_react.default.createElement(_Context.SmartBillProvider, {
25
- value: contextApiInfo
26
- }, children);
34
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
+
36
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
+
38
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
+
40
+ var SmartBillProvider = /*#__PURE__*/function (_PureComponent) {
41
+ _inherits(SmartBillProvider, _PureComponent);
42
+
43
+ var _super = _createSuper(SmartBillProvider);
44
+
45
+ function SmartBillProvider() {
46
+ _classCallCheck(this, SmartBillProvider);
47
+
48
+ return _super.apply(this, arguments);
27
49
  }
28
50
 
29
- }
51
+ _createClass(SmartBillProvider, [{
52
+ key: "render",
53
+ value: function render() {
54
+ var _this$props = this.props,
55
+ children = _this$props.children,
56
+ contextApiInfo = _this$props.contextApiInfo;
57
+ return /*#__PURE__*/_react.default.createElement(_Context.SmartBillProvider, {
58
+ value: contextApiInfo
59
+ }, children);
60
+ }
61
+ }]);
62
+
63
+ return SmartBillProvider;
64
+ }(_react.PureComponent);
30
65
 
31
66
  SmartBillProvider.propTypes = {
32
67
  contextApiInfo: _smartBillTypes.contextApiInfoTypes
@@ -9,7 +9,7 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
- const VARIANTS = {
12
+ var VARIANTS = {
13
13
  small: {
14
14
  currencyLabelStyle: _stylesModule.default.smallCurrency,
15
15
  decimalLabelStyle: _stylesModule.default.smallDecimalPart
@@ -21,25 +21,41 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
24
- const StyledAmount = _ref => {
25
- let {
26
- contextApiInfo,
27
- currency = '$',
28
- amount,
29
- amountFormat = '0,0.00',
30
- splitChar = ',',
31
- variant = 'medium',
32
- alias,
33
- aliasDecimal
34
- } = _ref;
35
- const {
36
- Label
37
- } = contextApiInfo;
38
- const {
39
- currencyLabelStyle,
40
- decimalLabelStyle
41
- } = _constants.VARIANTS[variant];
42
- const [integerPart, decimalPart] = amount !== null && amount !== undefined && (0, _numeral.default)(amount).format(amountFormat).split(splitChar) || ['-', '-'];
24
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
+
26
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
27
+
28
+ 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); }
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
+
32
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
33
+
34
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
+
36
+ var StyledAmount = function StyledAmount(_ref) {
37
+ var contextApiInfo = _ref.contextApiInfo,
38
+ _ref$currency = _ref.currency,
39
+ currency = _ref$currency === void 0 ? '$' : _ref$currency,
40
+ amount = _ref.amount,
41
+ _ref$amountFormat = _ref.amountFormat,
42
+ amountFormat = _ref$amountFormat === void 0 ? '0,0.00' : _ref$amountFormat,
43
+ _ref$splitChar = _ref.splitChar,
44
+ splitChar = _ref$splitChar === void 0 ? ',' : _ref$splitChar,
45
+ _ref$variant = _ref.variant,
46
+ variant = _ref$variant === void 0 ? 'medium' : _ref$variant,
47
+ alias = _ref.alias,
48
+ aliasDecimal = _ref.aliasDecimal;
49
+ var Label = contextApiInfo.Label;
50
+ var _VARIANTS$variant = _constants.VARIANTS[variant],
51
+ currencyLabelStyle = _VARIANTS$variant.currencyLabelStyle,
52
+ decimalLabelStyle = _VARIANTS$variant.decimalLabelStyle;
53
+
54
+ var _ref2 = amount !== null && amount !== undefined && (0, _numeral.default)(amount).format(amountFormat).split(splitChar) || ['-', '-'],
55
+ _ref3 = _slicedToArray(_ref2, 2),
56
+ integerPart = _ref3[0],
57
+ decimalPart = _ref3[1];
58
+
43
59
  return /*#__PURE__*/_react.default.createElement("div", {
44
60
  className: _stylesModule.default.container
45
61
  }, /*#__PURE__*/_react.default.createElement(Label, {
@@ -19,23 +19,34 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
 
20
20
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
21
 
22
- const withContextApi = retrieveStyle => Component => props => /*#__PURE__*/_react.default.createElement(_Context.SmartBillConsumer, null, contextApiInfo => {
23
- const infoWithUnpackedComponents = { ...contextApiInfo,
24
- ...(0, _context.unpackComponents)(contextApiInfo)
22
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
+
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
+
26
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
+
28
+ var withContextApi = function withContextApi(retrieveStyle) {
29
+ return function (Component) {
30
+ return function (props) {
31
+ return /*#__PURE__*/_react.default.createElement(_Context.SmartBillConsumer, null, function (contextApiInfo) {
32
+ var infoWithUnpackedComponents = _objectSpread(_objectSpread({}, contextApiInfo), (0, _context.unpackComponents)(contextApiInfo));
33
+
34
+ var infoWithDefaultColors = _objectSpread(_objectSpread({}, infoWithUnpackedComponents), {}, {
35
+ config: _objectSpread({
36
+ colors: contextApiInfo.colors || _aliases.DEFAULT_COLORS
37
+ }, contextApiInfo.config)
38
+ });
39
+
40
+ delete infoWithUnpackedComponents.components;
41
+ return /*#__PURE__*/_react.default.createElement(_layout.default, _extends({}, props, {
42
+ Component: Component,
43
+ contextApiInfo: infoWithDefaultColors,
44
+ retrieveStyle: retrieveStyle
45
+ }));
46
+ });
47
+ };
25
48
  };
26
- const infoWithDefaultColors = { ...infoWithUnpackedComponents,
27
- config: {
28
- colors: contextApiInfo.colors || _aliases.DEFAULT_COLORS,
29
- ...contextApiInfo.config
30
- }
31
- };
32
- delete infoWithUnpackedComponents.components;
33
- return /*#__PURE__*/_react.default.createElement(_layout.default, _extends({}, props, {
34
- Component: Component,
35
- contextApiInfo: infoWithDefaultColors,
36
- retrieveStyle: retrieveStyle
37
- }));
38
- });
49
+ };
39
50
 
40
51
  var _default = withContextApi;
41
52
  exports.default = _default;
@@ -17,10 +17,10 @@ var _smartBillTypes = require("../../shared/types/smartBillTypes");
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- const ThemedComponent = props => {
20
+ var ThemedComponent = function ThemedComponent(props) {
21
21
  var _props$contextApiInfo;
22
22
 
23
- const StyledComponent = props.retrieveStyle && (_props$contextApiInfo = props.contextApiInfo) !== null && _props$contextApiInfo !== void 0 && _props$contextApiInfo.theme ? (0, _reactJss.default)(props.retrieveStyle(props.contextApiInfo.theme))(props.Component) : props.Component;
23
+ var StyledComponent = props.retrieveStyle && (_props$contextApiInfo = props.contextApiInfo) !== null && _props$contextApiInfo !== void 0 && _props$contextApiInfo.theme ? (0, _reactJss.default)(props.retrieveStyle(props.contextApiInfo.theme))(props.Component) : props.Component;
24
24
  return /*#__PURE__*/_react.default.createElement(StyledComponent, props);
25
25
  };
26
26
 
@@ -13,11 +13,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
 
14
14
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
15
 
16
- const withSeason = () => Component => props => {
17
- const season = (0, _season.getSeason)(props.monthNumber);
18
- return /*#__PURE__*/_react.default.createElement(Component, _extends({
19
- season: season
20
- }, props));
16
+ var withSeason = function withSeason() {
17
+ return function (Component) {
18
+ return function (props) {
19
+ var season = (0, _season.getSeason)(props.monthNumber);
20
+ return /*#__PURE__*/_react.default.createElement(Component, _extends({
21
+ season: season
22
+ }, props));
23
+ };
24
+ };
21
25
  };
22
26
 
23
27
  var _default = withSeason;
@@ -11,26 +11,24 @@ var _reactResponsive = _interopRequireDefault(require("react-responsive"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
- const TabletBreakpoint = 1024;
14
+ var TabletBreakpoint = 1024;
15
15
  exports.TabletBreakpoint = TabletBreakpoint;
16
- const MobileBreakpoint = 768;
16
+ var MobileBreakpoint = 768;
17
17
  exports.MobileBreakpoint = MobileBreakpoint;
18
- const FullHDBreakpoint = 1920;
18
+ var FullHDBreakpoint = 1920;
19
19
  exports.FullHDBreakpoint = FullHDBreakpoint;
20
- const HDBreakpoint = 1380;
20
+ var HDBreakpoint = 1380;
21
21
  exports.HDBreakpoint = HDBreakpoint;
22
- const DESKTOP = 'desktop';
22
+ var DESKTOP = 'desktop';
23
23
  exports.DESKTOP = DESKTOP;
24
- const MOBILE = 'mobile';
24
+ var MOBILE = 'mobile';
25
25
  exports.MOBILE = MOBILE;
26
- const TABLET = 'tablet'; // For conditional rendering
26
+ var TABLET = 'tablet'; // For conditional rendering
27
27
 
28
28
  exports.TABLET = TABLET;
29
29
 
30
- const DesktopViewport = _ref => {
31
- let {
32
- children
33
- } = _ref;
30
+ var DesktopViewport = function DesktopViewport(_ref) {
31
+ var children = _ref.children;
34
32
  return /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
35
33
  minWidth: TabletBreakpoint
36
34
  }, children);
@@ -38,10 +36,8 @@ const DesktopViewport = _ref => {
38
36
 
39
37
  exports.DesktopViewport = DesktopViewport;
40
38
 
41
- const TabletViewport = _ref2 => {
42
- let {
43
- children
44
- } = _ref2;
39
+ var TabletViewport = function TabletViewport(_ref2) {
40
+ var children = _ref2.children;
45
41
  return /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
46
42
  minWidth: MobileBreakpoint,
47
43
  maxWidth: TabletBreakpoint - 1
@@ -50,10 +46,8 @@ const TabletViewport = _ref2 => {
50
46
 
51
47
  exports.TabletViewport = TabletViewport;
52
48
 
53
- const MobileViewport = _ref3 => {
54
- let {
55
- children
56
- } = _ref3;
49
+ var MobileViewport = function MobileViewport(_ref3) {
50
+ var children = _ref3.children;
57
51
  return /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
58
52
  maxWidth: MobileBreakpoint - 1
59
53
  }, children);
@@ -62,10 +56,8 @@ const MobileViewport = _ref3 => {
62
56
 
63
57
  exports.MobileViewport = MobileViewport;
64
58
 
65
- const DefaultViewport = _ref4 => {
66
- let {
67
- children
68
- } = _ref4;
59
+ var DefaultViewport = function DefaultViewport(_ref4) {
60
+ var children = _ref4.children;
69
61
  return /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
70
62
  minWidth: MobileBreakpoint
71
63
  }, children);
@@ -73,10 +65,8 @@ const DefaultViewport = _ref4 => {
73
65
 
74
66
  exports.DefaultViewport = DefaultViewport;
75
67
 
76
- const TabletMobileViewport = _ref5 => {
77
- let {
78
- children
79
- } = _ref5;
68
+ var TabletMobileViewport = function TabletMobileViewport(_ref5) {
69
+ var children = _ref5.children;
80
70
  return /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
81
71
  maxWidth: TabletBreakpoint - 1
82
72
  }, children);
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SEASON_PERIODS = exports.SEASONS = void 0;
7
- const SEASONS = {
7
+ var SEASONS = {
8
8
  SPRING: 'spring',
9
9
  SUMMER: 'summer',
10
10
  AUTUMN: 'autumn',
11
11
  WINTER: 'winter'
12
12
  };
13
13
  exports.SEASONS = SEASONS;
14
- const SEASON_PERIODS = [{
14
+ var SEASON_PERIODS = [{
15
15
  initMonth: 1,
16
16
  endingMonth: 2,
17
17
  season: SEASONS.SUMMER
package/dist/index.js CHANGED
@@ -1,79 +1,81 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.Aliases = void 0;
7
9
  Object.defineProperty(exports, "BillCalculation", {
8
10
  enumerable: true,
9
- get: function () {
11
+ get: function get() {
10
12
  return _BillCalculation.default;
11
13
  }
12
14
  });
13
15
  Object.defineProperty(exports, "BillSummary", {
14
16
  enumerable: true,
15
- get: function () {
17
+ get: function get() {
16
18
  return _BillSummary.default;
17
19
  }
18
20
  });
19
21
  Object.defineProperty(exports, "ColorAliases", {
20
22
  enumerable: true,
21
- get: function () {
23
+ get: function get() {
22
24
  return Aliases.COLORS;
23
25
  }
24
26
  });
25
27
  exports.ComponentNames = void 0;
26
28
  Object.defineProperty(exports, "ConsumptionComparison", {
27
29
  enumerable: true,
28
- get: function () {
30
+ get: function get() {
29
31
  return _ConsumptionComparison.default;
30
32
  }
31
33
  });
32
34
  Object.defineProperty(exports, "ConsumptionIncluded", {
33
35
  enumerable: true,
34
- get: function () {
36
+ get: function get() {
35
37
  return _ConsumptionIncluded.default;
36
38
  }
37
39
  });
38
40
  Object.defineProperty(exports, "ConsumptionPeriod", {
39
41
  enumerable: true,
40
- get: function () {
42
+ get: function get() {
41
43
  return _ConsumptionPeriod.default;
42
44
  }
43
45
  });
44
46
  Object.defineProperty(exports, "DefaultLabelProps", {
45
47
  enumerable: true,
46
- get: function () {
48
+ get: function get() {
47
49
  return Aliases.DEFAULT_PROPS;
48
50
  }
49
51
  });
50
52
  Object.defineProperty(exports, "MainBillData", {
51
53
  enumerable: true,
52
- get: function () {
54
+ get: function get() {
53
55
  return _MainBillData.default;
54
56
  }
55
57
  });
56
58
  Object.defineProperty(exports, "RatesDefinition", {
57
59
  enumerable: true,
58
- get: function () {
60
+ get: function get() {
59
61
  return _RatesDefinition.default;
60
62
  }
61
63
  });
62
64
  Object.defineProperty(exports, "SmartBillProvider", {
63
65
  enumerable: true,
64
- get: function () {
66
+ get: function get() {
65
67
  return _SmartBillProvider.default;
66
68
  }
67
69
  });
68
70
  Object.defineProperty(exports, "billDataTypes", {
69
71
  enumerable: true,
70
- get: function () {
72
+ get: function get() {
71
73
  return _billDataTypes.billDataTypes;
72
74
  }
73
75
  });
74
76
  Object.defineProperty(exports, "rateStagesTypes", {
75
77
  enumerable: true,
76
- get: function () {
78
+ get: function get() {
77
79
  return _rateStagesTypes.rateStagesTypes;
78
80
  }
79
81
  });
@@ -106,8 +108,8 @@ var _billDataTypes = require("./shared/types/billDataTypes");
106
108
 
107
109
  var _rateStagesTypes = require("./shared/types/rateStagesTypes");
108
110
 
109
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
111
+ 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); }
110
112
 
111
- 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; }
113
+ 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; }
112
114
 
113
115
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -9,11 +9,9 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
- const ContextApi = /*#__PURE__*/_react.default.createContext({});
12
+ var ContextApi = /*#__PURE__*/_react.default.createContext({});
13
13
 
14
- const {
15
- Provider: SmartBillProvider,
16
- Consumer: SmartBillConsumer
17
- } = ContextApi;
14
+ var SmartBillProvider = ContextApi.Provider,
15
+ SmartBillConsumer = ContextApi.Consumer;
18
16
  exports.SmartBillConsumer = SmartBillConsumer;
19
17
  exports.SmartBillProvider = SmartBillProvider;