@widergy/utilitygo-smart-bill-web 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/SmartBillSummary/constants.js +24 -0
- package/dist/components/SmartBillSummary/index.js +95 -0
- package/dist/components/SmartBillSummary/styles.module.scss +48 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/DebtStatusLabel/constants.js +9 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/DebtStatusLabel/index.js +34 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/DebtStatusLabel/styles.module.scss +16 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/components/ProgressBar/constants.js +8 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/components/ProgressBar/index.js +154 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/components/ProgressBar/styles.module.scss +174 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/components/ProgressBar/utils.js +88 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/index.js +165 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/styles.module.scss +60 -0
- package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/utils.js +14 -0
- package/dist/components/SmartBillSummary/tabs/Billing/index.js +288 -0
- package/dist/components/SmartBillSummary/tabs/Billing/styles.module.scss +132 -0
- package/dist/components/SmartBillSummary/tabs/Billing/utils.js +13 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/constants.js +9 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/index.js +90 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/styles.module.scss +55 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/utils.js +32 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/constants.js +13 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/index.js +78 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/styles.module.scss +43 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/constants.js +9 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/index.js +68 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/styles.module.scss +43 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/utils.js +35 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionEvolution/index.js +72 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionEvolution/styles.module.scss +29 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionEvolution/utils.js +71 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/index.js +64 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/styles.module.scss +22 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/utils.js +56 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/index.js +54 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/styles.module.scss +31 -0
- package/dist/components/SmartBillSummary/utils.js +30 -0
- package/dist/index.js +14 -0
- package/dist/shared/constants/tabs.js +11 -0
- package/package.json +1 -1
package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _energyUi = require("@widergy/energy-ui");
|
|
9
|
+
var _propTypes = require("prop-types");
|
|
10
|
+
var _billDataTypes = require("../../../../../../shared/types/billDataTypes");
|
|
11
|
+
var _ConsumptionComparison = _interopRequireDefault(require("./components/ConsumptionComparison"));
|
|
12
|
+
var _ConsumptionEvolution = _interopRequireDefault(require("./components/ConsumptionEvolution"));
|
|
13
|
+
var _utils = require("./utils");
|
|
14
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const CurrentConsumption = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
assets,
|
|
19
|
+
smartBill,
|
|
20
|
+
texts
|
|
21
|
+
} = _ref;
|
|
22
|
+
const {
|
|
23
|
+
periods
|
|
24
|
+
} = smartBill || {};
|
|
25
|
+
const periodsToCompare = (0, _utils.getConsumptionPeriodsToCompare)(periods);
|
|
26
|
+
const {
|
|
27
|
+
totalConsumption,
|
|
28
|
+
unit,
|
|
29
|
+
description
|
|
30
|
+
} = (0, _utils.getConsumptionLabels)(periodsToCompare, texts) || {};
|
|
31
|
+
const title = texts?.consumptions?.youConsumedTitle;
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
+
className: _stylesModule.default.container
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
35
|
+
colorTheme: "gray",
|
|
36
|
+
variant: "small"
|
|
37
|
+
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
+
className: _stylesModule.default.details
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: _stylesModule.default.consumption
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
42
|
+
variant: "title1",
|
|
43
|
+
weight: "medium"
|
|
44
|
+
}, totalConsumption), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
45
|
+
variant: "subtitle1",
|
|
46
|
+
weight: "medium"
|
|
47
|
+
}, unit)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
48
|
+
colorTheme: "gray",
|
|
49
|
+
withMarkdown: true
|
|
50
|
+
}, description)), /*#__PURE__*/_react.default.createElement(_ConsumptionComparison.default, {
|
|
51
|
+
periodsToCompare: periodsToCompare,
|
|
52
|
+
texts: texts
|
|
53
|
+
}), /*#__PURE__*/_react.default.createElement(_ConsumptionEvolution.default, {
|
|
54
|
+
assets: assets,
|
|
55
|
+
periods: periodsToCompare,
|
|
56
|
+
texts: texts
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
CurrentConsumption.propTypes = {
|
|
60
|
+
assets: _propTypes.object,
|
|
61
|
+
smartBill: _billDataTypes.billDataTypes,
|
|
62
|
+
texts: _propTypes.object
|
|
63
|
+
};
|
|
64
|
+
var _default = exports.default = CurrentConsumption;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
background-color: var(--light01);
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
box-shadow: var(--shadowGrayBottom1);
|
|
5
|
+
flex: 1;
|
|
6
|
+
padding: 24px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.details {
|
|
10
|
+
border-bottom: 1px solid var(--light04);
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
grid-gap: 12px;
|
|
14
|
+
margin: 0 -24px;
|
|
15
|
+
padding: 24px 24px 12px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.consumption {
|
|
19
|
+
align-items: flex-end;
|
|
20
|
+
display: flex;
|
|
21
|
+
grid-gap: 8px;
|
|
22
|
+
}
|
package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/utils.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getConsumptionPeriodsToCompare = exports.getConsumptionLabels = void 0;
|
|
7
|
+
var _lodash = require("lodash");
|
|
8
|
+
var _numeral = _interopRequireDefault(require("numeral"));
|
|
9
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
10
|
+
require("dayjs/locale/es");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
_dayjs.default.locale('es');
|
|
13
|
+
const getConsumptionPeriodsToCompare = function () {
|
|
14
|
+
let periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
15
|
+
if (!(0, _lodash.isEmpty)(periods)) {
|
|
16
|
+
const currentPeriod = periods.find(period => period.current);
|
|
17
|
+
const previousYearPeriod = periods.find(period => period.number === currentPeriod.number && parseInt(period.year, 10) === parseInt(currentPeriod.year, 10) - 1);
|
|
18
|
+
return [currentPeriod, previousYearPeriod];
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.getConsumptionPeriodsToCompare = getConsumptionPeriodsToCompare;
|
|
22
|
+
const formatDate = date => {
|
|
23
|
+
if (!date) return '';
|
|
24
|
+
const day = (0, _dayjs.default)(date).format('D');
|
|
25
|
+
const month = (0, _lodash.capitalize)((0, _dayjs.default)(date).format('MMM'));
|
|
26
|
+
return `${day} de ${month}`;
|
|
27
|
+
};
|
|
28
|
+
const getConsumptionLabels = function () {
|
|
29
|
+
let periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
30
|
+
let texts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
31
|
+
const currentPeriod = periods?.find(period => period?.current);
|
|
32
|
+
const totalConsumption = currentPeriod?.consumptions?.[0];
|
|
33
|
+
const dailyConsumption = currentPeriod?.consumptions?.[1];
|
|
34
|
+
const {
|
|
35
|
+
value: totalConsumptionValue,
|
|
36
|
+
unit: totalConsumptionUnit
|
|
37
|
+
} = totalConsumption || {};
|
|
38
|
+
const {
|
|
39
|
+
value: dailyConsumptionValue,
|
|
40
|
+
unit: dailyConsumptionUnit
|
|
41
|
+
} = dailyConsumption || {};
|
|
42
|
+
const startDate = currentPeriod?.settlements?.start_date;
|
|
43
|
+
const endDate = currentPeriod?.settlements?.end_date;
|
|
44
|
+
const description = texts?.consumptions?.youConsumedDescription?.({
|
|
45
|
+
dailyConsumptionUnit,
|
|
46
|
+
dailyConsumptionValue: (0, _numeral.default)(dailyConsumptionValue).format('0,0.[00]'),
|
|
47
|
+
endDate: formatDate(endDate),
|
|
48
|
+
startDate: formatDate(startDate)
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
description,
|
|
52
|
+
totalConsumption: (0, _numeral.default)(totalConsumptionValue).format('0,0.[00]'),
|
|
53
|
+
unit: totalConsumptionUnit
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
exports.getConsumptionLabels = getConsumptionLabels;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _energyUi = require("@widergy/energy-ui");
|
|
9
|
+
var _propTypes = require("prop-types");
|
|
10
|
+
var _billDataTypes = require("../../../../shared/types/billDataTypes");
|
|
11
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
|
+
var _BimestralConsumption = _interopRequireDefault(require("./components/BimestralConsumption"));
|
|
13
|
+
var _CurrentConsumption = _interopRequireDefault(require("./components/CurrentConsumption"));
|
|
14
|
+
var _Billing = _interopRequireDefault(require("./components/Billing"));
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const Consumptions = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
assets,
|
|
19
|
+
smartBill,
|
|
20
|
+
translations
|
|
21
|
+
} = _ref;
|
|
22
|
+
const {
|
|
23
|
+
title,
|
|
24
|
+
description
|
|
25
|
+
} = translations?.consumptions || {};
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
|
+
className: _stylesModule.default.generalContainer
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement(_BimestralConsumption.default, {
|
|
29
|
+
assets: assets,
|
|
30
|
+
texts: translations
|
|
31
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
className: _stylesModule.default.consumptionDetail
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
34
|
+
className: _stylesModule.default.consumptionDetailTitles
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
36
|
+
variant: "title3",
|
|
37
|
+
weight: "medium"
|
|
38
|
+
}, title), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, null, description)), /*#__PURE__*/_react.default.createElement("div", {
|
|
39
|
+
className: _stylesModule.default.consumptionDetailColumns
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(_CurrentConsumption.default, {
|
|
41
|
+
assets: assets,
|
|
42
|
+
smartBill: smartBill,
|
|
43
|
+
texts: translations
|
|
44
|
+
}), /*#__PURE__*/_react.default.createElement(_Billing.default, {
|
|
45
|
+
smartBill: smartBill,
|
|
46
|
+
texts: translations
|
|
47
|
+
}))));
|
|
48
|
+
};
|
|
49
|
+
Consumptions.propTypes = {
|
|
50
|
+
assets: _propTypes.object,
|
|
51
|
+
smartBill: _billDataTypes.billDataTypes,
|
|
52
|
+
translations: _propTypes.object
|
|
53
|
+
};
|
|
54
|
+
var _default = exports.default = Consumptions;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import '../../../../scss/variables/mediaQueries.module.scss';
|
|
2
|
+
|
|
3
|
+
.generalContainer {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
grid-gap: 32px;
|
|
7
|
+
padding: 24px 32px;
|
|
8
|
+
|
|
9
|
+
@media #{$mobile} {
|
|
10
|
+
padding: 24px 16px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.consumptionDetailTitles {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
grid-gap: 8px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.consumptionDetailColumns {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex: 1;
|
|
23
|
+
flex-wrap: wrap;
|
|
24
|
+
grid-gap: 32px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.consumptionDetail {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
grid-gap: 24px;
|
|
31
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTabOptions = exports.getDefaultCurrentTab = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _energyUi = require("@widergy/energy-ui");
|
|
9
|
+
var _lodash = require("lodash");
|
|
10
|
+
var _tabs = require("../../shared/constants/tabs");
|
|
11
|
+
var _constants = require("./constants");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const getTabOptions = (tabOptions, smartBill) => {
|
|
14
|
+
const hasBimestralPeriodicity = smartBill?.periods?.some(period => period.settlements?.periodicity === _constants.BIMESTRAL_PERIODICITY);
|
|
15
|
+
return tabOptions.map(tab => ({
|
|
16
|
+
...tab,
|
|
17
|
+
icon: /*#__PURE__*/_react.default.createElement(_energyUi.UTIcon, {
|
|
18
|
+
name: tab.icon
|
|
19
|
+
})
|
|
20
|
+
})).filter(_ref => {
|
|
21
|
+
let {
|
|
22
|
+
enabled,
|
|
23
|
+
value
|
|
24
|
+
} = _ref;
|
|
25
|
+
return enabled && (value !== _tabs.SMARTBILL_TABS.CONSUMPTIONS || hasBimestralPeriodicity);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.getTabOptions = getTabOptions;
|
|
29
|
+
const getDefaultCurrentTab = tabOptions => !(0, _lodash.isEmpty)(tabOptions) && (tabOptions.find(tab => tab?.defaultSelected) || tabOptions?.[0])?.value;
|
|
30
|
+
exports.getDefaultCurrentTab = getDefaultCurrentTab;
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,18 @@ Object.defineProperty(exports, "SmartBillProvider", {
|
|
|
65
65
|
return _SmartBillProvider.default;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
+
Object.defineProperty(exports, "SmartBillSummary", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () {
|
|
71
|
+
return _SmartBillSummary.default;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "Tabs", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () {
|
|
77
|
+
return _tabs.SMARTBILL_TABS;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
68
80
|
Object.defineProperty(exports, "billDataTypes", {
|
|
69
81
|
enumerable: true,
|
|
70
82
|
get: function () {
|
|
@@ -77,6 +89,7 @@ Object.defineProperty(exports, "rateStagesTypes", {
|
|
|
77
89
|
return _rateStagesTypes.rateStagesTypes;
|
|
78
90
|
}
|
|
79
91
|
});
|
|
92
|
+
var _SmartBillSummary = _interopRequireDefault(require("./components/SmartBillSummary"));
|
|
80
93
|
var _SmartBillProvider = _interopRequireDefault(require("./components/SmartBillProvider"));
|
|
81
94
|
var _MainBillData = _interopRequireDefault(require("./components/MainBillData"));
|
|
82
95
|
var _ConsumptionPeriod = _interopRequireDefault(require("./components/ConsumptionPeriod"));
|
|
@@ -92,6 +105,7 @@ var Aliases = _aliases;
|
|
|
92
105
|
exports.Aliases = _aliases;
|
|
93
106
|
var _billDataTypes = require("./shared/types/billDataTypes");
|
|
94
107
|
var _rateStagesTypes = require("./shared/types/rateStagesTypes");
|
|
108
|
+
var _tabs = require("./shared/constants/tabs");
|
|
95
109
|
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); }
|
|
96
110
|
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 && {}.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; }
|
|
97
111
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SMARTBILL_TABS = void 0;
|
|
7
|
+
const SMARTBILL_TABS = exports.SMARTBILL_TABS = {
|
|
8
|
+
CONSUMPTIONS: 'consumptionsTab',
|
|
9
|
+
BILLING: 'billingTab',
|
|
10
|
+
GLOSSARY: 'glossaryTab'
|
|
11
|
+
};
|