@widergy/utilitygo-smart-bill-mobile 3.1.0 → 3.1.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,19 @@
1
+ ## [3.1.2](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/compare/v3.1.1...v3.1.2) (2025-10-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [UGDESA-2724] smart bill visual fixes ([#47](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/issues/47)) ([65d24b5](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/commit/65d24b50e156e77da64a336c693de1ce4a216b10))
7
+
8
+ ## [3.1.1](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/compare/v3.1.0...v3.1.1) (2025-10-06)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * [CX-1176] widy fab ([a209a11](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/commit/a209a11b733f1b9f13d7a3cf6aed360ce37c4cbb))
14
+ * fix ([85e8728](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/commit/85e8728c808e40b83ec40678fca0ab0eacd96488))
15
+ * fix ([cfd62a3](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/commit/cfd62a312d1f038833d6bad74677a4b03493c859))
16
+
1
17
  # [3.1.0](https://github.com/widergy/UtilityGO-Smart-Bill-Mobile/compare/v3.0.0...v3.1.0) (2025-09-23)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/utilitygo-smart-bill-mobile",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "UtilityGO SmartBill Mobile",
5
5
  "license": "MIT",
6
6
  "main": "src/lib/index.js",
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable react/jsx-fragments */
3
3
  import React, { Fragment, useEffect, useState, useMemo } from 'react';
4
4
  import { UTButton, UTLoading, UTTabs } from '@widergy/mobile-ui';
5
- import { ScrollView } from 'react-native';
5
+ import { ScrollView, View } from 'react-native';
6
6
  import { array, arrayOf, bool, func, object, shape, string } from 'prop-types';
7
7
  import isEmpty from 'lodash/isEmpty';
8
8
  import debounce from 'lodash/debounce';
@@ -19,6 +19,7 @@ const SmartBillSummary = ({
19
19
  colors,
20
20
  components,
21
21
  constants = {},
22
+ FabComponent,
22
23
  handlers,
23
24
  loading,
24
25
  smartBill,
@@ -36,7 +37,8 @@ const SmartBillSummary = ({
36
37
  notEnoughBillsErrorType,
37
38
  smartBillAIAnswer = {},
38
39
  smartBillAIAnswerError,
39
- smartBillAIAnswerLoading
40
+ smartBillAIAnswerLoading,
41
+ showFab
40
42
  } = constants;
41
43
  const {
42
44
  getSmartBillAIAnswer,
@@ -120,11 +122,12 @@ const SmartBillSummary = ({
120
122
  {filteredTabOptions.find(tab => tab.value === currentTab)?.header && (
121
123
  <BillHeader
122
124
  assets={assets}
125
+ billNumber={smartBill?.bill_number}
126
+ billType={smartBill?.bill_type}
123
127
  colors={colors}
124
- header={translations?.billingTab.header}
125
128
  debtStatusLabel={smartBill?.debt_status_label}
129
+ header={translations?.billingTab.header}
126
130
  smartBill={smartBill}
127
- billNumber={smartBill?.bill_number}
128
131
  />
129
132
  )}
130
133
  {TAB_COMPONENT_MAPPER?.[currentTab]?.({
@@ -143,12 +146,18 @@ const SmartBillSummary = ({
143
146
 
144
147
  {aiQuestionsPanelEnabled && (
145
148
  <Fragment>
146
- <UTButton
147
- colorTheme="primary"
148
- Icon="EnergyIconChatSparkFilled"
149
- onPress={openAIDrawer}
150
- style={{ icon: styles.AIFloatButtonIcon, root: styles.AIFloatButton }}
151
- />
149
+ {showFab && FabComponent ? (
150
+ <View style={styles.AIFloatButton}>
151
+ <FabComponent onPress={openAIDrawer} />
152
+ </View>
153
+ ) : (
154
+ <UTButton
155
+ colorTheme="primary"
156
+ Icon="EnergyIconChatSparkFilled"
157
+ onPress={openAIDrawer}
158
+ style={{ icon: styles.AIFloatButtonIcon, root: styles.AIFloatButton }}
159
+ />
160
+ )}
152
161
 
153
162
  <AIDrawer
154
163
  aiQuestionsList={aiQuestionsList}
@@ -178,6 +187,7 @@ SmartBillSummary.propTypes = {
178
187
  colors: object,
179
188
  components: object,
180
189
  constants: object,
190
+ FabComponent: object,
181
191
  handlers: shape({ [string]: func }),
182
192
  loading: bool,
183
193
  smartBill: object,
@@ -0,0 +1,45 @@
1
+ /* eslint-disable react/forbid-prop-types */
2
+ import React from 'react';
3
+ import { Surface, UTLabel } from '@widergy/mobile-ui';
4
+ import { View } from 'react-native';
5
+ import { object, string } from 'prop-types';
6
+
7
+ import { createStyles } from './styles';
8
+
9
+ const AccountCard = ({ accountCard, colors, meterNumber, readingType }) => {
10
+ const styles = createStyles(colors);
11
+ const { title: accountCardTitle, meterNumberHelpText, readingTypeHelpText } = accountCard;
12
+
13
+ return (
14
+ <Surface elevation={1} style={styles.accountCard}>
15
+ <UTLabel variant="title3" weight="medium">
16
+ {accountCardTitle}
17
+ </UTLabel>
18
+
19
+ <View style={styles.container}>
20
+ {!!meterNumber && (
21
+ <View style={styles.content}>
22
+ <UTLabel weight="bold">{meterNumber}</UTLabel>
23
+ <UTLabel colorTheme="gray">{meterNumberHelpText}</UTLabel>
24
+ </View>
25
+ )}
26
+
27
+ {!!readingType && (
28
+ <View style={styles.content}>
29
+ <UTLabel weight="bold">{readingType}</UTLabel>
30
+ <UTLabel colorTheme="gray">{readingTypeHelpText}</UTLabel>
31
+ </View>
32
+ )}
33
+ </View>
34
+ </Surface>
35
+ );
36
+ };
37
+
38
+ AccountCard.propTypes = {
39
+ accountCard: object,
40
+ colors: object,
41
+ meterNumber: string,
42
+ readingType: string
43
+ };
44
+
45
+ export default AccountCard;
@@ -0,0 +1,21 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export const createStyles = colors =>
4
+ StyleSheet.create({
5
+ accountCard: {
6
+ backgroundColor: colors.light01,
7
+ borderRadius: 8,
8
+ padding: 16,
9
+ flexDirection: 'column',
10
+ gap: 24
11
+ },
12
+ container: {
13
+ flexDirection: 'row'
14
+ },
15
+ content: {
16
+ flex: 1,
17
+ flexDirection: 'column',
18
+ gap: 8,
19
+ paddingVertical: 12
20
+ }
21
+ });
@@ -6,34 +6,33 @@ import { arrayOf, object } from 'prop-types';
6
6
 
7
7
  import styles from './styles';
8
8
 
9
- const ActionCards = ({ actionCards }) => {
10
- return (
11
- <View style={styles.actionCardsContainer}>
12
- {actionCards?.map(({ onPress, Icon = 'IconChevronRight', statusAttributes = {}, title }) => (
13
- <UTActionCard
14
- classNames={{ headerTitles: styles.headerAndChildrenContainer }}
15
- disabled={!onPress}
16
- headerActions={
17
- onPress
18
- ? [
19
- {
20
- colorTheme: 'accent',
21
- Icon,
22
- isPrimary: true
23
- }
24
- ]
25
- : []
26
- }
27
- key={title}
28
- mainAction={onPress}
29
- title={title}
30
- titleProps={{ style: styles.titleActionCard }}
31
- {...statusAttributes}
32
- />
33
- ))}
34
- </View>
35
- );
36
- };
9
+ const ActionCards = ({ actionCards }) => (
10
+ <View style={styles.actionCardsContainer}>
11
+ {actionCards?.map(({ onPress, Icon = 'IconChevronRight', statusAttributes = {}, title, description }) => (
12
+ <UTActionCard
13
+ classNames={{ headerTitles: styles.headerAndChildrenContainer }}
14
+ disabled={!onPress}
15
+ headerActions={
16
+ onPress
17
+ ? [
18
+ {
19
+ colorTheme: 'accent',
20
+ Icon,
21
+ isPrimary: true
22
+ }
23
+ ]
24
+ : []
25
+ }
26
+ key={title}
27
+ mainAction={onPress}
28
+ title={title}
29
+ description={description}
30
+ titleProps={{ style: styles.titleActionCard }}
31
+ {...statusAttributes}
32
+ />
33
+ ))}
34
+ </View>
35
+ );
37
36
 
38
37
  ActionCards.propTypes = {
39
38
  actionCards: arrayOf(object),
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable react/forbid-prop-types */
2
2
  import React from 'react';
3
- import { Surface, UTLabel } from '@widergy/mobile-ui';
3
+ import { Surface, UTLabel, UTStatus } from '@widergy/mobile-ui';
4
4
  import { View, Image } from 'react-native';
5
5
  import { string, object } from 'prop-types';
6
6
 
@@ -9,7 +9,7 @@ import { getCurrentPeriod, getFormattedDate } from '../../utils';
9
9
 
10
10
  import { createStyles } from './styles';
11
11
 
12
- const BillHeader = ({ assets, colors, header, debtStatusLabel, smartBill, billNumber }) => {
12
+ const BillHeader = ({ assets, colors, header, debtStatusLabel, smartBill, billNumber, billType }) => {
13
13
  const styles = createStyles(colors);
14
14
  const { UtilityLogo } = assets.billingTab;
15
15
 
@@ -22,7 +22,14 @@ const BillHeader = ({ assets, colors, header, debtStatusLabel, smartBill, billNu
22
22
  {UtilityLogo && <Image resizeMode="contain" source={UtilityLogo} height={35} />}
23
23
  <View style={styles.billHeaderLabels}>
24
24
  <View style={styles.valueAndHelpText}>
25
- <UTLabel variant="small">{billNumber}</UTLabel>
25
+ <View style={styles.billTypeAndNumber}>
26
+ {!!billType && (
27
+ <UTStatus variant="gray" withoutIcon labelProps={{ colorTheme: 'dark' }}>
28
+ {billType}
29
+ </UTStatus>
30
+ )}
31
+ <UTLabel variant="small">{billNumber}</UTLabel>
32
+ </View>
26
33
  <UTLabel colorTheme="gray" variant="small">
27
34
  {billTypeHelpText}
28
35
  </UTLabel>
@@ -45,11 +52,12 @@ const BillHeader = ({ assets, colors, header, debtStatusLabel, smartBill, billNu
45
52
 
46
53
  BillHeader.propTypes = {
47
54
  assets: object,
55
+ billNumber: string,
56
+ billType: string,
48
57
  colors: object,
49
- header: object,
50
58
  debtStatusLabel: string,
51
- smartBill: object,
52
- billNumber: string
59
+ header: object,
60
+ smartBill: object
53
61
  };
54
62
 
55
63
  export default BillHeader;
@@ -24,5 +24,10 @@ export const createStyles = colors =>
24
24
  padding: 16,
25
25
  marginHorizontal: 16,
26
26
  marginTop: 16
27
+ },
28
+ billTypeAndNumber: {
29
+ alignItems: 'center',
30
+ flexDirection: 'row',
31
+ gap: 4
27
32
  }
28
33
  });
@@ -2,10 +2,12 @@ import ActionCards from './components/ActionCards';
2
2
  import TotalCard from './components/TotalCard';
3
3
  import RateCard from './components/RateCard';
4
4
  import TitularCard from './components/TitularCard';
5
+ import AccountCard from './components/AccountCard';
5
6
 
6
7
  export const COMPONENTS = {
8
+ AccountCard,
7
9
  ActionCards,
8
- TotalCard,
9
10
  RateCard,
10
- TitularCard
11
+ TitularCard,
12
+ TotalCard
11
13
  };
@@ -26,9 +26,12 @@ const Billing = ({
26
26
  client,
27
27
  debt_status_label: debtStatusLabel,
28
28
  detail,
29
- expirations
29
+ expirations,
30
+ meter_number: meterNumber,
31
+ reading_periods: readingPeriods
30
32
  } = smartBill;
31
33
  const {
34
+ accountCard = {},
32
35
  adhered,
33
36
  automaticDebit = {},
34
37
  digitalBill = {},
@@ -58,13 +61,16 @@ const Billing = ({
58
61
  const { title: automaticDebitTitle } = automaticDebit;
59
62
  const isAdheredToDigitalBill = client?.adherence_to_digital_bill;
60
63
  const isAdheredToAutomaticDebit = adherenceToAutomaticDebit === adherenceStatus?.subscribed;
64
+ const emailDigitalBill = client?.email_digital_bill;
65
+ const readingType = readingPeriods?.[0]?.type;
61
66
 
62
67
  const actionCards = [
63
68
  {
64
69
  isAdhered: isAdheredToDigitalBill,
65
70
  onPress: !isAdheredToDigitalBill && handleGoToDigitalBill,
66
71
  showStatus: true,
67
- title: digitalBillTitle
72
+ title: digitalBillTitle,
73
+ description: emailDigitalBill
68
74
  },
69
75
  {
70
76
  isAdhered: isAdheredToAutomaticDebit,
@@ -94,6 +100,7 @@ const Billing = ({
94
100
  };
95
101
  });
96
102
  const props = {
103
+ accountCard,
97
104
  actionCards,
98
105
  assets,
99
106
  billNumber,
@@ -109,13 +116,15 @@ const Billing = ({
109
116
  formatAmount,
110
117
  handlers,
111
118
  header,
119
+ meterNumber,
112
120
  normalizedRate,
113
121
  rateCardTranslations,
114
122
  ratesTableLink,
115
- titularCard,
123
+ readingType,
116
124
  smartBill,
117
125
  subsidy,
118
126
  subsidyLevels,
127
+ titularCard,
119
128
  totalAmountLabel,
120
129
  totalCard,
121
130
  trackRedirectionToExternalLink,