@widergy/utilitygo-smart-bill-mobile 2.4.0 → 2.4.2

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.4.2](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/compare/v2.4.1...v2.4.2) (2025-05-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * configurable ai drawer ([#35](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/issues/35)) ([ba8f400](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/commit/ba8f4001fde2bf15687202fd4e6231c75be84e3a))
7
+
8
+ ## [2.4.1](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/compare/v2.4.0...v2.4.1) (2025-05-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * smartbill consumption comparison ([#33](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/issues/33)) ([9686b13](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/commit/9686b13ac715e38086ffb288d726955b3123ec6f))
14
+
1
15
  # [2.4.0](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/compare/v2.3.0...v2.4.0) (2025-05-14)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/utilitygo-smart-bill-mobile",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "UtilityGO SmartBill Mobile",
5
5
  "license": "MIT",
6
6
  "main": "src/lib/index.js",
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable react/forbid-prop-types */
2
- import React, { useEffect, useState } from 'react';
2
+ /* eslint-disable react/jsx-fragments */
3
+ import React, { Fragment, useEffect, useState } from 'react';
3
4
  import { UTButton, UTLoading, UTTabs } from '@widergy/mobile-ui';
4
5
  import { View } from 'react-native';
5
6
  import { arrayOf, bool, func, object, shape, string } from 'prop-types';
@@ -23,6 +24,7 @@ const SmartBillSummary = ({
23
24
  }) => {
24
25
  const {
25
26
  aiQuestionsList,
27
+ aiQuestionsPanelEnabled,
26
28
  glossaryError,
27
29
  glossaryLoading,
28
30
  notEnoughBillsErrorType,
@@ -79,26 +81,30 @@ const SmartBillSummary = ({
79
81
  })}
80
82
  </View>
81
83
 
82
- <UTButton
83
- colorTheme="primary"
84
- Icon="EnergyIconChatSparkFilled"
85
- onPress={openAIDrawer}
86
- style={{ icon: styles.AIFloatButtonIcon, root: styles.AIFloatButton }}
87
- />
84
+ {aiQuestionsPanelEnabled && (
85
+ <Fragment>
86
+ <UTButton
87
+ colorTheme="primary"
88
+ Icon="EnergyIconChatSparkFilled"
89
+ onPress={openAIDrawer}
90
+ style={{ icon: styles.AIFloatButtonIcon, root: styles.AIFloatButton }}
91
+ />
88
92
 
89
- <AIDrawer
90
- aiQuestionsList={aiQuestionsList}
91
- answer={smartBillAIAnswer}
92
- colors={colors}
93
- components={components}
94
- error={smartBillAIAnswerError}
95
- getAnswer={getSmartBillAIAnswer}
96
- isOpen={aiDrawerIsOpen}
97
- loading={smartBillAIAnswerLoading}
98
- notEnoughBillsErrorType={notEnoughBillsErrorType}
99
- onClose={closeAIDrawer}
100
- translations={translations}
101
- />
93
+ <AIDrawer
94
+ aiQuestionsList={aiQuestionsList}
95
+ answer={smartBillAIAnswer}
96
+ colors={colors}
97
+ components={components}
98
+ error={smartBillAIAnswerError}
99
+ getAnswer={getSmartBillAIAnswer}
100
+ isOpen={aiDrawerIsOpen}
101
+ loading={smartBillAIAnswerLoading}
102
+ notEnoughBillsErrorType={notEnoughBillsErrorType}
103
+ onClose={closeAIDrawer}
104
+ translations={translations}
105
+ />
106
+ </Fragment>
107
+ )}
102
108
  </UTLoading>
103
109
  );
104
110
  };
@@ -13,33 +13,39 @@ const ConsumptionComparison = ({ colors, periodsToCompare = [], texts }) => {
13
13
  const styles = createStyles(colors);
14
14
  const maxValue = getMaxValue(periodsToCompare);
15
15
  const title = texts?.consumptions?.comparisonTitle;
16
+ const showComparison = periodsToCompare?.length > 1;
16
17
 
17
18
  return (
18
19
  <Fragment>
19
- <UTLabel style={styles.consumptionComparisonLabel} colorTheme="gray" variant="small">
20
+ <UTLabel
21
+ colorTheme="gray"
22
+ style={showComparison ? styles.consumptionComparisonLabel : styles.consumptionComparisonLabelNoData}
23
+ variant="small">
20
24
  {title}
21
25
  </UTLabel>
22
- <View style={styles.container}>
23
- {periodsToCompare.map(({ consumptions, current, number, settlements, year }) => {
24
- const { value, unit } = consumptions?.[0] || {};
25
- const barHeight = getBarHeight(maxValue, value);
26
+ {showComparison && (
27
+ <View style={styles.container}>
28
+ {periodsToCompare.map(({ consumptions, current, number, settlements, year }) => {
29
+ const { value, unit } = consumptions?.[0] || {};
30
+ const barHeight = getBarHeight(maxValue, value);
26
31
 
27
- return (
28
- <View key={number + year} style={styles.barContainer}>
29
- <UTLabel style={styles.value} variant="small">
30
- {getFormattedValue(value, unit)}
31
- </UTLabel>
32
- <GradientBar colors={colors} height={barHeight} isCurrent={current} />
33
- <UTLabel style={styles.year} variant="small" weight="medium">
34
- {year}
35
- </UTLabel>
36
- <UTLabel style={styles.period} colorTheme="gray" variant="small">
37
- {getPeriod(settlements)}
38
- </UTLabel>
39
- </View>
40
- );
41
- })}
42
- </View>
32
+ return (
33
+ <View key={number + year} style={styles.barContainer}>
34
+ <UTLabel style={styles.value} variant="small">
35
+ {getFormattedValue(value, unit)}
36
+ </UTLabel>
37
+ <GradientBar colors={colors} height={barHeight} isCurrent={current} />
38
+ <UTLabel style={styles.year} variant="small" weight="medium">
39
+ {year}
40
+ </UTLabel>
41
+ <UTLabel style={styles.period} colorTheme="gray" variant="small">
42
+ {getPeriod(settlements)}
43
+ </UTLabel>
44
+ </View>
45
+ );
46
+ })}
47
+ </View>
48
+ )}
43
49
  </Fragment>
44
50
  );
45
51
  };
@@ -5,6 +5,10 @@ export const createStyles = colors =>
5
5
  consumptionComparisonLabel: {
6
6
  marginVertical: 12
7
7
  },
8
+ consumptionComparisonLabelNoData: {
9
+ marginBottom: -20,
10
+ marginTop: 12
11
+ },
8
12
  container: {
9
13
  alignItems: 'flex-end',
10
14
  flexDirection: 'row',
@@ -12,11 +12,16 @@ const ConsumptionEvolution = ({ assets, colors, periods, texts }) => {
12
12
  const { consumptionEvolution: backgroundImages } = assets || {};
13
13
  const { consumptionEvolution: consumptionEvolutionLabels } = texts || {};
14
14
  const { title } = consumptionEvolutionLabels || {};
15
- const { colorTheme, description, icon, Image, percentage, period } = getConsumptionComparison(
16
- backgroundImages,
17
- consumptionEvolutionLabels,
18
- periods
19
- );
15
+ const {
16
+ colorTheme,
17
+ description,
18
+ icon,
19
+ Image,
20
+ percentage,
21
+ period,
22
+ shade = '04',
23
+ size = 24
24
+ } = getConsumptionComparison(backgroundImages, consumptionEvolutionLabels, periods);
20
25
 
21
26
  return (
22
27
  <UTActionCard
@@ -28,7 +33,7 @@ const ConsumptionEvolution = ({ assets, colors, periods, texts }) => {
28
33
  surfaceElevation={0}>
29
34
  <View style={styles.childrenContainer}>
30
35
  <View style={styles.chipContainer}>
31
- <UTIcon area colorTheme={colorTheme} name={icon} shade="04" size={24} />
36
+ <UTIcon area colorTheme={colorTheme} name={icon} shade={shade} size={size} />
32
37
  {percentage && (
33
38
  <UTLabel colorTheme={colorTheme} variant="title2" weight="medium">
34
39
  {percentage}
@@ -28,7 +28,8 @@ export const getConsumptionComparison = (backgroundImages, labels, periods) => {
28
28
  icon: 'IconEyeOff',
29
29
  Image: LightEvolutionImage,
30
30
  percentage: null,
31
- period: noData
31
+ period: noData,
32
+ shade: '05'
32
33
  };
33
34
  }
34
35