@widergy/utilitygo-smart-bill-web 3.10.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -0
  3. package/dist/components/SmartBillSummary/constants.js +12 -1
  4. package/dist/components/SmartBillSummary/index.js +63 -8
  5. package/dist/components/SmartBillSummary/styles.module.scss +5 -0
  6. package/dist/components/SmartBillSummary/tabs/Billing/components/ActionCards/index.js +63 -0
  7. package/dist/components/SmartBillSummary/tabs/Billing/components/ActionCards/styles.module.scss +28 -0
  8. package/dist/components/SmartBillSummary/tabs/Billing/components/BillHeader/index.js +64 -0
  9. package/dist/components/SmartBillSummary/tabs/Billing/components/BillHeader/styles.module.scss +43 -0
  10. package/dist/components/SmartBillSummary/tabs/Billing/components/ColumnRenderer/constants.js +17 -0
  11. package/dist/components/SmartBillSummary/tabs/Billing/components/ColumnRenderer/index.js +35 -0
  12. package/dist/components/SmartBillSummary/tabs/Billing/components/ColumnRenderer/styles.module.scss +23 -0
  13. package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/index.js +13 -3
  14. package/dist/components/SmartBillSummary/tabs/Billing/components/RateCard/styles.module.scss +14 -2
  15. package/dist/components/SmartBillSummary/tabs/Billing/components/TitularCard/index.js +80 -0
  16. package/dist/components/SmartBillSummary/tabs/Billing/components/TitularCard/styles.module.scss +32 -0
  17. package/dist/components/SmartBillSummary/tabs/Billing/components/TotalCard/index.js +52 -0
  18. package/dist/components/SmartBillSummary/tabs/Billing/components/TotalCard/styles.module.scss +15 -0
  19. package/dist/components/SmartBillSummary/tabs/Billing/index.js +44 -138
  20. package/dist/components/SmartBillSummary/tabs/Billing/styles.module.scss +7 -137
  21. package/dist/components/SmartBillSummary/tabs/Consumptions/components/Billing/index.js +1 -1
  22. package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/constants.js +7 -2
  23. package/dist/components/SmartBillSummary/tabs/Consumptions/components/BimestralConsumption/index.js +29 -2
  24. package/dist/components/SmartBillSummary/tabs/Consumptions/index.js +4 -1
  25. package/dist/components/SmartBillSummary/utils.js +30 -4
  26. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ .titularCard {
2
+ background-color: var(--light01);
3
+ border-radius: 8px;
4
+ box-shadow: var(--shadowGrayBottom1);
5
+ display: flex;
6
+ flex-direction: column;
7
+ grid-gap: 24px;
8
+ padding: 24px;
9
+ }
10
+
11
+ .titularDataContainer {
12
+ display: flex;
13
+ flex-direction: column;
14
+ }
15
+
16
+ .titularData {
17
+ display: flex;
18
+ flex: 1;
19
+ flex-direction: column;
20
+ grid-gap: 8px;
21
+ padding: 12px 0;
22
+ }
23
+
24
+ .titularDataTitle {
25
+ padding: 4px 0;
26
+ }
27
+
28
+ .titularFooter {
29
+ display: flex;
30
+ grid-gap: 16px;
31
+ justify-content: space-between;
32
+ }
@@ -0,0 +1,52 @@
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 _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ const TotalCard = _ref => {
13
+ let {
14
+ totalAmountLabel,
15
+ formatAmount,
16
+ totalAmount,
17
+ firstExpiration,
18
+ firstExpirationDate,
19
+ secondExpiration,
20
+ secondExpirationDate
21
+ } = _ref;
22
+ return /*#__PURE__*/_react.default.createElement("div", {
23
+ className: _stylesModule.default.totalCard
24
+ }, /*#__PURE__*/_react.default.createElement("div", {
25
+ className: _stylesModule.default.total
26
+ }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
27
+ variant: "subtitle1",
28
+ weight: "medium"
29
+ }, totalAmountLabel), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
30
+ colorTheme: "accent",
31
+ variant: "title2",
32
+ weight: "medium"
33
+ }, formatAmount?.(totalAmount))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
34
+ colorTheme: "gray",
35
+ variant: "small",
36
+ weight: "medium"
37
+ }, firstExpiration?.(firstExpirationDate)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
38
+ colorTheme: "gray",
39
+ variant: "small",
40
+ weight: "medium"
41
+ }, secondExpiration?.(secondExpirationDate))));
42
+ };
43
+ TotalCard.propTypes = {
44
+ totalAmountLabel: _propTypes.string,
45
+ formatAmount: _propTypes.func,
46
+ totalAmount: _propTypes.string,
47
+ firstExpiration: _propTypes.func,
48
+ firstExpirationDate: _propTypes.string,
49
+ secondExpiration: _propTypes.func,
50
+ secondExpirationDate: _propTypes.string
51
+ };
52
+ var _default = exports.default = TotalCard;
@@ -0,0 +1,15 @@
1
+ .totalCard {
2
+ background-color: var(--light01);
3
+ border-radius: 8px;
4
+ box-shadow: var(--shadowGrayBottom1);
5
+ display: flex;
6
+ flex-direction: column;
7
+ grid-gap: 24px;
8
+ padding: 16px;
9
+ }
10
+
11
+ .total {
12
+ display: flex;
13
+ grid-gap: 8px;
14
+ justify-content: space-between;
15
+ }
@@ -5,18 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
- var _energyUi = require("@widergy/energy-ui");
9
8
  var _propTypes = require("prop-types");
10
9
  var _billDataTypes = require("../../../../shared/types/billDataTypes");
11
- var _DebtStatusLabel = _interopRequireDefault(require("./components/DebtStatusLabel"));
12
10
  var _utils = require("./utils");
13
- var _RateCard = _interopRequireDefault(require("./components/RateCard"));
14
11
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
12
+ var _ColumnRenderer = _interopRequireDefault(require("./components/ColumnRenderer"));
15
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
14
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
17
15
  const Billing = _ref => {
18
16
  let {
19
- assets,
17
+ billingLayout,
20
18
  constants = {},
21
19
  consumptionLevels = [],
22
20
  components,
@@ -38,9 +36,6 @@ const Billing = _ref => {
38
36
  adherenceStatus,
39
37
  subsidyLevels
40
38
  } = constants;
41
- const {
42
- UtilityLogo
43
- } = assets;
44
39
  const {
45
40
  handleAutomaticDebitAdherence = () => {},
46
41
  handleDownloadBill = () => {},
@@ -52,7 +47,6 @@ const Billing = _ref => {
52
47
  automaticDebit = {},
53
48
  digitalBill = {},
54
49
  downloadBill = {},
55
- header = {},
56
50
  notAdhered,
57
51
  rateCard: rateCardTranslations,
58
52
  ratesTableLink,
@@ -60,10 +54,6 @@ const Billing = _ref => {
60
54
  totalAmountLabel,
61
55
  totalCard = {}
62
56
  } = translations;
63
- const {
64
- billIssueDate,
65
- billTypeHelpText
66
- } = header;
67
57
  const {
68
58
  title: digitalBillTitle
69
59
  } = digitalBill;
@@ -81,18 +71,15 @@ const Billing = _ref => {
81
71
  ivaConditionHelpText
82
72
  } = titularCard;
83
73
  const {
84
- firstExpiration
74
+ firstExpiration,
75
+ secondExpiration
85
76
  } = totalCard;
86
77
  const {
87
- bill_number: billNumber,
88
78
  client,
89
- debt_status_label: debtStatusLabel,
90
79
  detail,
91
80
  expirations
92
81
  } = smartBill;
93
- const debtStatusValidation = debtStatusLabel !== null;
94
82
  const currentPeriod = (0, _utils.getCurrentPeriod)(smartBill);
95
- const issuedOnDate = (0, _utils.getFormattedDate)(currentPeriod?.settlements?.current?.issued_on);
96
83
  const isAdheredToDigitalBill = client?.adherence_to_digital_bill;
97
84
  const {
98
85
  account_address: accountAddress,
@@ -102,6 +89,7 @@ const Billing = _ref => {
102
89
  iva_condition: ivaCondition
103
90
  } = client || {};
104
91
  const firstExpirationDate = (0, _utils.getFormattedDate)(expirations?.[0]?.date);
92
+ const secondExpirationDate = (0, _utils.getFormattedDate)(expirations?.[1]?.date);
105
93
  const {
106
94
  total_amount: totalAmount
107
95
  } = detail || {};
@@ -130,127 +118,32 @@ const Billing = _ref => {
130
118
  rightIcon: 'IconDownload',
131
119
  title: downloadBillTitle
132
120
  }];
133
- return /*#__PURE__*/_react.default.createElement("div", {
134
- className: _stylesModule.default.generalContainer
135
- }, /*#__PURE__*/_react.default.createElement("div", {
136
- className: _stylesModule.default.billHeader
137
- }, UtilityLogo && /*#__PURE__*/_react.default.createElement(UtilityLogo, {
138
- className: _stylesModule.default.logo
139
- }), /*#__PURE__*/_react.default.createElement("div", {
140
- className: _stylesModule.default.billHeaderLabels
141
- }, /*#__PURE__*/_react.default.createElement("div", {
142
- className: _stylesModule.default.valueAndHelpText
143
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
144
- variant: "small"
145
- }, billNumber), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
146
- colorTheme: "gray",
147
- variant: "small"
148
- }, billTypeHelpText)), /*#__PURE__*/_react.default.createElement("div", {
149
- className: _stylesModule.default.valueAndHelpText
150
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
151
- variant: "small"
152
- }, issuedOnDate), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
153
- colorTheme: "gray",
154
- variant: "small"
155
- }, billIssueDate)), debtStatusValidation && /*#__PURE__*/_react.default.createElement(_DebtStatusLabel.default, {
156
- debtStatusLabel: debtStatusLabel,
157
- isWarning: smartBill?.warning
158
- }))), /*#__PURE__*/_react.default.createElement("div", {
159
- className: _stylesModule.default.detailColumns
160
- }, /*#__PURE__*/_react.default.createElement("div", {
161
- className: _stylesModule.default.leftColumn
162
- }, actionCards?.map(_ref2 => {
163
- let {
164
- isAdhered,
165
- leftIcon,
166
- leftIconProps = {},
167
- onClick,
168
- rightIcon,
169
- showStatus,
170
- title
171
- } = _ref2;
172
- return /*#__PURE__*/_react.default.createElement(_energyUi.UTTouchableWithoutFeedback, {
173
- className: `${_stylesModule.default.cardContainer} ${!onClick && _stylesModule.default.unclickableCardContainer}`,
174
- disabled: !onClick,
175
- key: title,
176
- onClick: onClick,
177
- withRipple: true
178
- }, isDesktopSize && /*#__PURE__*/_react.default.createElement(_energyUi.UTIcon, _extends({
179
- colorTheme: "gray",
180
- name: leftIcon
181
- }, leftIconProps)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
182
- className: _stylesModule.default.cardTitle,
183
- variant: "subtitle1",
184
- weight: "medium"
185
- }, title), showStatus && /*#__PURE__*/_react.default.createElement(_energyUi.UTStatus, {
186
- type: "light",
187
- variant: isAdhered ? 'success' : 'unassigned',
188
- withoutIcon: !isAdhered
189
- }, isAdhered ? adhered : notAdhered), onClick && /*#__PURE__*/_react.default.createElement("div", {
190
- className: _stylesModule.default.cardIconContainer
191
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTIcon, {
192
- colorTheme: "accent",
193
- name: rightIcon || 'IconChevronRight'
194
- })));
195
- }), /*#__PURE__*/_react.default.createElement("div", {
196
- className: _stylesModule.default.titularCard
197
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
198
- variant: "title2",
199
- weight: "medium"
200
- }, titularCardTitle), /*#__PURE__*/_react.default.createElement("div", {
201
- className: _stylesModule.default.titularDataContainer
202
- }, accountAddress && /*#__PURE__*/_react.default.createElement("div", {
203
- className: _stylesModule.default.titularData
204
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
205
- className: _stylesModule.default.titularDataTitle,
206
- weight: "bold"
207
- }, accountAddress), accountAddress !== postalAddress && /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, null, postalAddress), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
208
- colorTheme: "gray"
209
- }, addressHelpText)), titularName && /*#__PURE__*/_react.default.createElement("div", {
210
- className: _stylesModule.default.titularData
211
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
212
- className: _stylesModule.default.titularDataTitle,
213
- weight: "bold"
214
- }, titularName), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
215
- colorTheme: "gray"
216
- }, titularHelpText)), renderTitularFooter && /*#__PURE__*/_react.default.createElement("div", {
217
- className: _stylesModule.default.titularFooter
218
- }, clientNumber && /*#__PURE__*/_react.default.createElement("div", {
219
- className: _stylesModule.default.titularData
220
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
221
- className: _stylesModule.default.titularDataTitle,
222
- weight: "bold"
223
- }, clientNumberFormatter?.(clientNumber)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
224
- colorTheme: "gray"
225
- }, clientNumberHelpText)), ivaCondition && /*#__PURE__*/_react.default.createElement("div", {
226
- className: _stylesModule.default.titularData
227
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
228
- className: _stylesModule.default.titularDataTitle,
229
- weight: "bold"
230
- }, ivaCondition), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
231
- colorTheme: "gray"
232
- }, ivaConditionHelpText)))))), /*#__PURE__*/_react.default.createElement("div", {
233
- className: _stylesModule.default.rightColumn
234
- }, /*#__PURE__*/_react.default.createElement("div", {
235
- className: _stylesModule.default.totalCard
236
- }, /*#__PURE__*/_react.default.createElement("div", {
237
- className: _stylesModule.default.total
238
- }, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
239
- variant: "subtitle1",
240
- weight: "medium"
241
- }, totalAmountLabel), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
242
- colorTheme: "accent",
243
- variant: "title2",
244
- weight: "medium"
245
- }, formatAmount?.(totalAmount))), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
246
- colorTheme: "gray",
247
- variant: "small",
248
- weight: "medium"
249
- }, firstExpiration?.(firstExpirationDate))), /*#__PURE__*/_react.default.createElement(_RateCard.default, {
121
+ const props = {
122
+ actionCards,
123
+ adhered,
124
+ notAdhered,
125
+ isDesktopSize,
126
+ titularCardTitle,
127
+ accountAddress,
128
+ postalAddress,
129
+ addressHelpText,
130
+ titularName,
131
+ titularHelpText,
132
+ clientNumberFormatter,
133
+ clientNumber,
134
+ clientNumberHelpText,
135
+ ivaCondition,
136
+ ivaConditionHelpText,
137
+ totalAmountLabel,
138
+ formatAmount,
139
+ totalAmount,
140
+ firstExpiration,
141
+ firstExpirationDate,
142
+ secondExpiration,
143
+ secondExpirationDate,
250
144
  consumptionLevels,
251
145
  components,
252
146
  currentPeriod,
253
- formatAmount,
254
147
  normalizedRate,
255
148
  rateCardTranslations,
256
149
  ratesTableLink,
@@ -258,12 +151,25 @@ const Billing = _ref => {
258
151
  subsidy,
259
152
  subsidyLevels,
260
153
  trackRedirectionToExternalLink,
261
- translations
262
- }))));
154
+ translations,
155
+ renderTitularFooter
156
+ };
157
+ return /*#__PURE__*/_react.default.createElement("div", {
158
+ className: _stylesModule.default.generalContainer
159
+ }, /*#__PURE__*/_react.default.createElement("div", {
160
+ className: _stylesModule.default.cardsContainer
161
+ }, billingLayout.map(layoutArray => {
162
+ const filteredLayout = layoutArray.filter(item => item.enabled);
163
+ const layoutKey = `layout-${layoutArray.map(item => item.name).join('-')}`;
164
+ return /*#__PURE__*/_react.default.createElement(_ColumnRenderer.default, _extends({
165
+ column: filteredLayout,
166
+ key: layoutKey
167
+ }, props));
168
+ })));
263
169
  };
264
170
  Billing.propTypes = {
265
- assets: _propTypes.object,
266
171
  constants: _propTypes.object,
172
+ billingLayout: _propTypes.array,
267
173
  consumptionLevels: _propTypes.array,
268
174
  components: (0, _propTypes.shape)({
269
175
  [_propTypes.string]: _propTypes.elementType
@@ -12,146 +12,16 @@
12
12
  }
13
13
  }
14
14
 
15
- .billHeader {
16
- align-items: center;
17
- background-color: var(--light01);
18
- border-radius: 8px;
19
- box-shadow: var(--shadowGrayBottom1);
15
+ .cardsContainer {
16
+ align-items: flex-start;
20
17
  display: flex;
21
- flex-wrap: wrap;
22
- grid-gap: 16px;
23
- justify-content: space-between;
24
- padding: 12px 16px;
25
- }
26
-
27
- .logo {
28
- height: 35px;
29
- object-fit: contain;
30
- width: auto;
31
- }
32
-
33
- .billHeaderLabels {
34
- align-items: center;
35
- display: flex;
36
- flex-wrap: wrap;
37
- grid-gap: 32px;
38
- justify-content: space-between;
39
- padding: 16px 0;
18
+ width: 100%;
40
19
 
41
- @media #{$mobile} {
42
- grid-gap: 16px;
43
- padding: 0;
20
+ @media #{$tablet-mobile} {
21
+ flex-direction: column;
44
22
  }
45
- }
46
23
 
47
- .valueAndHelpText {
48
- display: flex;
49
- flex-direction: column;
50
- grid-gap: 4px;
51
- }
52
-
53
- .detailColumns {
54
- display: flex;
55
- flex: 1;
56
- flex-wrap: wrap;
57
- grid-gap: 32px;
58
-
59
- @media #{$mobile} {
60
- grid-gap: 24px;
24
+ > :last-child {
25
+ margin-right: 0;
61
26
  }
62
27
  }
63
-
64
- %column {
65
- display: flex;
66
- flex: 1;
67
- flex-direction: column;
68
- grid-gap: 24px;
69
- }
70
-
71
- .leftColumn {
72
- @extend %column;
73
-
74
- @media #{$mobile} {
75
- order: 2;
76
- }
77
- }
78
-
79
- .rightColumn {
80
- @extend %column;
81
- }
82
-
83
- .cardContainer {
84
- align-items: center;
85
- background-color: var(--light01);
86
- border-radius: 8px;
87
- box-shadow: var(--shadowGrayBottom1);
88
- display: flex;
89
- grid-gap: 16px;
90
- justify-content: space-between;
91
- padding: 16px;
92
- transition: all 0.2s;
93
- }
94
-
95
- .unclickableCardContainer {
96
- cursor: default;
97
- }
98
-
99
- .cardTitle {
100
- flex: 1;
101
- }
102
-
103
- .cardIconContainer {
104
- align-items: center;
105
- display: flex;
106
- justify-content: center;
107
- padding: 8px;
108
- }
109
-
110
- .titularCard {
111
- background-color: var(--light01);
112
- border-radius: 8px;
113
- box-shadow: var(--shadowGrayBottom1);
114
- display: flex;
115
- flex-direction: column;
116
- grid-gap: 24px;
117
- padding: 24px;
118
- }
119
-
120
- .titularDataContainer {
121
- display: flex;
122
- flex-direction: column;
123
- }
124
-
125
- .titularData {
126
- display: flex;
127
- flex: 1;
128
- flex-direction: column;
129
- grid-gap: 8px;
130
- padding: 12px 0;
131
- }
132
-
133
- .titularDataTitle {
134
- padding: 4px 0;
135
- }
136
-
137
- .titularFooter {
138
- display: flex;
139
- grid-gap: 16px;
140
- justify-content: space-between;
141
- }
142
-
143
- .totalCard {
144
- background-color: var(--light01);
145
- border-radius: 8px;
146
- box-shadow: var(--shadowGrayBottom1);
147
- display: flex;
148
- flex-direction: column;
149
- grid-gap: 24px;
150
- padding: 16px;
151
- }
152
-
153
- .total {
154
- display: flex;
155
- grid-gap: 8px;
156
- justify-content: space-between;
157
- }
@@ -26,7 +26,7 @@ const Billing = _ref => {
26
26
  clarification,
27
27
  periodDetail
28
28
  } = texts?.billing || {};
29
- const currentPeriod = smartBill?.periods.find(period => period.current);
29
+ const currentPeriod = smartBill?.periods?.find(period => period.current);
30
30
  const billingsToShow = (0, _utils.getBillingsToShow)(currentPeriod?.settlements);
31
31
  return /*#__PURE__*/_react.default.createElement("div", {
32
32
  className: _stylesModule.default.container
@@ -3,11 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.CONSUMPTION_CARDS = void 0;
6
+ exports.START = exports.END = exports.DAY = exports.DATE_FORMAT_WITH_YEAR = exports.DATE_FORMAT = exports.CONSUMPTION_CARDS = void 0;
7
7
  const CONSUMPTION_CARDS = exports.CONSUMPTION_CARDS = [{
8
8
  icon: 'EnergyIconConsumptionBoxFilled',
9
9
  key: 'consumptionCalculationCard'
10
10
  }, {
11
11
  icon: 'IconReceipt2',
12
12
  key: 'billingCard'
13
- }];
13
+ }];
14
+ const START = exports.START = 'inicio';
15
+ const END = exports.END = 'fin';
16
+ const DATE_FORMAT = exports.DATE_FORMAT = 'D [de] MMMM';
17
+ const DATE_FORMAT_WITH_YEAR = exports.DATE_FORMAT_WITH_YEAR = 'D [de] MMMM [de] YYYY';
18
+ const DAY = exports.DAY = 'day';
@@ -7,12 +7,14 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _energyUi = require("@widergy/energy-ui");
9
9
  var _propTypes = require("prop-types");
10
+ var _dayjs = _interopRequireDefault(require("dayjs"));
10
11
  var _constants = require("./constants");
11
12
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
14
  const BimestralConsumption = _ref => {
14
15
  let {
15
16
  assets,
17
+ smartBill,
16
18
  texts
17
19
  } = _ref;
18
20
  const bimestralConsumptionTexts = texts?.bimestralConsumption;
@@ -23,6 +25,24 @@ const BimestralConsumption = _ref => {
23
25
  const {
24
26
  BackgroundVector
25
27
  } = assets?.bimestral || {};
28
+ const readingPeriods = smartBill?.reading_periods || [];
29
+ const startDate = readingPeriods.find(period => period.moment === _constants.START)?.date;
30
+ const endDate = readingPeriods.find(period => period.moment === _constants.END)?.date;
31
+ const formatDate = function (dateString) {
32
+ let includeYear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
33
+ if (!dateString) return '';
34
+ const format = includeYear ? _constants.DATE_FORMAT_WITH_YEAR : _constants.DATE_FORMAT;
35
+ return (0, _dayjs.default)(dateString).locale('es').format(format);
36
+ };
37
+ const calculateTotalDays = (start, end) => {
38
+ if (!start || !end) return 0;
39
+ const startMoment = (0, _dayjs.default)(start);
40
+ const endMoment = (0, _dayjs.default)(end);
41
+ return endMoment.diff(startMoment, _constants.DAY);
42
+ };
43
+ const formattedStartDate = formatDate(startDate, false);
44
+ const formattedEndDate = formatDate(endDate, true);
45
+ const totalDays = calculateTotalDays(startDate, endDate);
26
46
  return /*#__PURE__*/_react.default.createElement("div", {
27
47
  className: _stylesModule.default.bimestralConsumption
28
48
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -37,8 +57,14 @@ const BimestralConsumption = _ref => {
37
57
  icon,
38
58
  key
39
59
  } = _ref2;
40
- const title = bimestralConsumptionTexts?.[key]?.title;
41
- const description = bimestralConsumptionTexts?.[key]?.description;
60
+ const {
61
+ title,
62
+ description
63
+ } = bimestralConsumptionTexts?.[key]?.({
64
+ formattedStartDate,
65
+ formattedEndDate,
66
+ totalDays
67
+ });
42
68
  return /*#__PURE__*/_react.default.createElement(_energyUi.UTActionCard, {
43
69
  adornment: {
44
70
  position: 'left',
@@ -73,6 +99,7 @@ const BimestralConsumption = _ref => {
73
99
  };
74
100
  BimestralConsumption.propTypes = {
75
101
  assets: _propTypes.object,
102
+ smartBill: _propTypes.object,
76
103
  texts: _propTypes.object
77
104
  };
78
105
  var _default = exports.default = BimestralConsumption;
@@ -16,6 +16,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
16
16
  const Consumptions = _ref => {
17
17
  let {
18
18
  assets,
19
+ reverseRow = {},
19
20
  smartBill,
20
21
  translations
21
22
  } = _ref;
@@ -27,6 +28,7 @@ const Consumptions = _ref => {
27
28
  className: _stylesModule.default.generalContainer
28
29
  }, /*#__PURE__*/_react.default.createElement(_BimestralConsumption.default, {
29
30
  assets: assets,
31
+ smartBill: smartBill,
30
32
  texts: translations
31
33
  }), /*#__PURE__*/_react.default.createElement("div", {
32
34
  className: _stylesModule.default.consumptionDetail
@@ -36,7 +38,7 @@ const Consumptions = _ref => {
36
38
  variant: "title3",
37
39
  weight: "medium"
38
40
  }, title), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, null, description)), /*#__PURE__*/_react.default.createElement("div", {
39
- className: _stylesModule.default.consumptionDetailColumns
41
+ className: `${_stylesModule.default.consumptionDetailColumns} ${reverseRow}`
40
42
  }, /*#__PURE__*/_react.default.createElement(_CurrentConsumption.default, {
41
43
  assets: assets,
42
44
  smartBill: smartBill,
@@ -48,6 +50,7 @@ const Consumptions = _ref => {
48
50
  };
49
51
  Consumptions.propTypes = {
50
52
  assets: _propTypes.object,
53
+ reverseRow: _propTypes.object,
51
54
  smartBill: _billDataTypes.billDataTypes,
52
55
  translations: _propTypes.object
53
56
  };
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getTabOptions = exports.getDefaultCurrentTab = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _energyUi = require("@widergy/energy-ui");
9
- var _lodash = require("lodash");
9
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
10
10
  var _tabs = require("../../shared/constants/tabs");
11
11
  var _constants = require("./constants");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- const getTabOptions = (isDesktopSize, tabOptions, smartBill) => {
13
+ const getTabOptions = (isDesktopSize, onboardingSteps, tabOptions, smartBill) => {
14
14
  const hasBimestralPeriodicity = smartBill?.periods?.some(period => period.settlements?.periodicity === _constants.BIMESTRAL_PERIODICITY);
15
- return tabOptions.map(tab => ({
15
+ const filteredTabs = tabOptions.map(tab => ({
16
16
  ...tab,
17
17
  icon: isDesktopSize ? /*#__PURE__*/_react.default.createElement(_energyUi.UTIcon, {
18
18
  name: tab.icon
@@ -24,7 +24,33 @@ const getTabOptions = (isDesktopSize, tabOptions, smartBill) => {
24
24
  } = _ref;
25
25
  return enabled && (value !== _tabs.SMARTBILL_TABS.CONSUMPTIONS || hasBimestralPeriodicity);
26
26
  });
27
+ if (!(0, _isEmpty.default)(onboardingSteps)) {
28
+ const tabPositions = {};
29
+ filteredTabs.forEach((tab, index) => {
30
+ tabPositions[tab.value] = index + 1;
31
+ });
32
+ const filteredOnboardingSteps = [...onboardingSteps].reduce((acc, step) => {
33
+ if (step.element && step.element.includes(_constants.TAB_SELECTOR)) {
34
+ const match = step.element.match(_constants.TAB_VALUE_REGEX);
35
+ if (match && tabPositions[match[_constants.CAPTURED_VALUE_REGEX]]) {
36
+ return [...acc, {
37
+ ...step,
38
+ element: `.smartbill-tab:nth-child(${tabPositions[match[_constants.CAPTURED_VALUE_REGEX]]})`
39
+ }];
40
+ }
41
+ }
42
+ return [...acc, step];
43
+ }, []);
44
+ return {
45
+ tabs: filteredTabs,
46
+ onboardingSteps: filteredOnboardingSteps
47
+ };
48
+ }
49
+ return {
50
+ tabs: filteredTabs,
51
+ onboardingSteps
52
+ };
27
53
  };
28
54
  exports.getTabOptions = getTabOptions;
29
- const getDefaultCurrentTab = tabOptions => !(0, _lodash.isEmpty)(tabOptions) && (tabOptions.find(tab => tab?.defaultSelected) || tabOptions?.[0])?.value;
55
+ const getDefaultCurrentTab = tabOptions => !(0, _isEmpty.default)(tabOptions) && (tabOptions.find(tab => tab?.defaultSelected) || tabOptions?.[0])?.value;
30
56
  exports.getDefaultCurrentTab = getDefaultCurrentTab;