ordering-ui-react-native 0.14.59 → 0.14.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.14.59",
3
+ "version": "0.14.62",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -45,6 +45,15 @@ export const OrderContentComponent = (props: OrderContent) => {
45
45
 
46
46
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
47
47
 
48
+ const walletName: any = {
49
+ cash: {
50
+ name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
51
+ },
52
+ credit_point: {
53
+ name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
54
+ }
55
+ }
56
+
48
57
  const styles = StyleSheet.create({
49
58
  linkWithIcons: {
50
59
  flexDirection: 'row',
@@ -441,7 +450,7 @@ export const OrderContentComponent = (props: OrderContent) => {
441
450
  )
442
451
  }
443
452
 
444
- <Total>
453
+ <Total style={{ paddingBottom: 10 }}>
445
454
  <Table>
446
455
  <OText mBottom={4} style={styles.textBold}>
447
456
  {t('TOTAL', 'Total')}
@@ -455,6 +464,52 @@ export const OrderContentComponent = (props: OrderContent) => {
455
464
  </OText>
456
465
  </Table>
457
466
  </Total>
467
+
468
+ {order?.payment_events?.length > 0 && (
469
+ <View>
470
+ <OText size={14} color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
471
+ <View
472
+ style={{
473
+ width: '100%',
474
+ marginTop: 5
475
+ }}
476
+ >
477
+ {order?.payment_events?.map((event: any) => (
478
+ <View
479
+ key={event.id}
480
+ style={{
481
+ display: 'flex',
482
+ flexDirection: 'row',
483
+ justifyContent: 'space-between',
484
+ alignItems: 'center',
485
+ marginBottom: 10
486
+ }}
487
+ >
488
+ <View
489
+ style={{
490
+ display: 'flex',
491
+ flexDirection: 'column',
492
+ }}
493
+ >
494
+ <OText>
495
+ {event?.wallet_event
496
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
497
+ : event?.paymethod?.name}
498
+ </OText>
499
+ {event?.data?.charge_id && (
500
+ <OText>
501
+ {`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
502
+ </OText>
503
+ )}
504
+ </View>
505
+ <OText>
506
+ -{parsePrice(event.amount)}
507
+ </OText>
508
+ </View>
509
+ ))}
510
+ </View>
511
+ </View>
512
+ )}
458
513
  </OrderBill >
459
514
  <OModal
460
515
  open={openReviewModal}
@@ -14,7 +14,7 @@ import {
14
14
  } from '../shared'
15
15
 
16
16
  import { useTheme } from 'styled-components/native';
17
- import { StyleSheet } from 'react-native';
17
+ import { StyleSheet, View } from 'react-native';
18
18
 
19
19
  import {
20
20
  useLanguage,
@@ -84,6 +84,25 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
84
84
  17: theme.colors.statusOrderRed,
85
85
  };
86
86
 
87
+ const walletName: any = {
88
+ cash: {
89
+ name: t('CASH_WALLET', 'Cash Wallet'),
90
+ },
91
+ credit_point: {
92
+ name: t('CREDITS_POINTS_WALLET', 'Credit Points Wallet'),
93
+ }
94
+ }
95
+
96
+ const orderTypes = (type: number) => type === 1
97
+ ? t('DELIVERY', 'Delivery')
98
+ : order.delivery_type === 2
99
+ ? t('PICKUP', 'Pickup')
100
+ : order.delivery_type === 3
101
+ ? t('EAT_IN', 'Eat in')
102
+ : order.delivery_type === 4
103
+ ? t('CURBSIDE', 'Curbside')
104
+ : t('DRIVER_THRU', 'Driver thru')
105
+
87
106
  return (
88
107
  <>
89
108
  <Header>
@@ -176,18 +195,30 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
176
195
  </>
177
196
  </OText>
178
197
  {!order?.isLogistic && order?.delivery_type && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
179
- <OText size={13}>
180
- {`${order?.paymethod?.name} - ${order.delivery_type === 1
181
- ? t('DELIVERY', 'Delivery')
182
- : order.delivery_type === 2
183
- ? t('PICKUP', 'Pickup')
184
- : order.delivery_type === 3
185
- ? t('EAT_IN', 'Eat in')
186
- : order.delivery_type === 4
187
- ? t('CURBSIDE', 'Curbside')
188
- : t('DRIVER_THRU', 'Driver thru')
189
- }`}
190
- </OText>
198
+ <>
199
+ <OText size={13}>
200
+ <OText size={13} weight='bold'>{`${t('ORDER_TYPE', 'Order Type')}: `}</OText>
201
+ {orderTypes(order.delivery_type)}
202
+ </OText>
203
+ {order?.payment_events?.length > 0 && (
204
+ <View>
205
+ <OText size={13}>
206
+ <OText size={13} weight='bold'>
207
+ {`${t('PAYMENT_METHODS', 'Payment methods')}: `}
208
+ </OText>
209
+ {order?.payment_events?.map((event: any, idx: number) => {
210
+ return event?.wallet_event
211
+ ? idx < order?.payment_events?.length - 1
212
+ ? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
213
+ : walletName[event?.wallet_event?.wallet?.type]?.name
214
+ : idx < order?.payment_events?.length - 1
215
+ ? `${event?.paymethod?.name} - `
216
+ : event?.paymethod?.name
217
+ })}
218
+ </OText>
219
+ </View>
220
+ )}
221
+ </>
191
222
  )}
192
223
  </OrderHeader>
193
224
  </>
@@ -1,9 +1,12 @@
1
- import React from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import { StyleSheet, TouchableOpacity, View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
+ import moment from 'moment'
4
5
  import { useLanguage, useUtils } from 'ordering-components/native';
5
6
  import { OButton, OIcon, OText } from '../shared';
6
- import { Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder } from './styles';
7
+ import {
8
+ Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder, Timestatus
9
+ } from './styles';
7
10
  import EntypoIcon from 'react-native-vector-icons/Entypo'
8
11
 
9
12
  export const PreviousOrders = (props: any) => {
@@ -18,6 +21,7 @@ export const PreviousOrders = (props: any) => {
18
21
  const [, t] = useLanguage();
19
22
  const [{ parseDate, optimizeImage }] = useUtils();
20
23
  const theme = useTheme();
24
+ const [currentTime, setCurrentTime] = useState()
21
25
 
22
26
  const handlePressOrder = (order: any) => {
23
27
  if (order?.locked && isLogisticOrder) return
@@ -39,17 +43,15 @@ export const PreviousOrders = (props: any) => {
39
43
  height: 75,
40
44
  },
41
45
  logo: {
42
- width: 78,
43
- height: 78,
44
- borderRadius: 25,
45
- shadowColor: 'rgba(0.0, 0.0, 0.0, 0.5)',
46
+ borderRadius: 10,
47
+ shadowColor: "#000",
46
48
  shadowOffset: {
47
49
  width: 0,
48
- height: 1.5,
50
+ height: 1,
49
51
  },
50
- shadowOpacity: 0.21,
51
- shadowRadius: 5,
52
- elevation: 7,
52
+ shadowOpacity: 0.20,
53
+ shadowRadius: 1.41,
54
+ elevation: 2,
53
55
  justifyContent: 'center',
54
56
  alignItems: 'center',
55
57
  marginLeft: 3,
@@ -67,11 +69,10 @@ export const PreviousOrders = (props: any) => {
67
69
  fontFamily: 'Poppins',
68
70
  fontStyle: 'normal',
69
71
  fontWeight: 'normal',
70
- fontSize: 15,
71
- color: theme.colors.unselectText,
72
+ fontSize: 12,
72
73
  },
73
74
  orderType: {
74
- fontSize: 15,
75
+ fontSize: 12,
75
76
  fontFamily: 'Poppins',
76
77
  fontStyle: 'normal',
77
78
  fontWeight: 'normal',
@@ -79,6 +80,32 @@ export const PreviousOrders = (props: any) => {
79
80
  },
80
81
  });
81
82
 
83
+ const getDelayTime = (order: any) => {
84
+ // targetMin = delivery_datetime + eta_time - now()
85
+ const _delivery = order?.delivery_datetime_utc
86
+ const _eta = order?.eta_time
87
+ const tagetedMin = moment(_delivery).add(_eta, 'minutes').diff(moment().utc(), 'minutes')
88
+ let day = Math.floor(tagetedMin / 1440)
89
+ const restMinOfTargetedMin = tagetedMin - 1440 * day
90
+ let restHours: any = Math.floor(restMinOfTargetedMin / 60)
91
+ let restMins: any = restMinOfTargetedMin - 60 * restHours
92
+
93
+ if (order?.time_status === 'in_time' || order?.time_status === 'at_risk') day = Math.abs(day)
94
+ if (restHours < 10) restHours = ('0' + restHours)
95
+ if (restMins < 10) restMins = ('0' + restMins)
96
+ const finalTaget = day + 'day ' + restHours + ':' + restMins
97
+ return finalTaget
98
+ }
99
+
100
+ useEffect(() => {
101
+ const interval = setInterval(() => {
102
+ const date:any = Date.now()
103
+ setCurrentTime(date)
104
+ }, 60000)
105
+
106
+ return () => clearInterval(interval)
107
+ }, [])
108
+
82
109
  let hash: any = {};
83
110
 
84
111
  return (
@@ -103,6 +130,7 @@ export const PreviousOrders = (props: any) => {
103
130
  activeOpacity={1}
104
131
  >
105
132
  <Card key={order.id}>
133
+ <Timestatus style={{backgroundColor: order?.time_status === 'in_time' ? '#00D27A' : order?.time_status === 'at_risk' ? '#FFC700' : order?.time_status === 'delayed' ? '#E63757' : '' }}/>
106
134
  {
107
135
  order.business?.logo && (
108
136
  <Logo style={styles.logo}>
@@ -135,16 +163,20 @@ export const PreviousOrders = (props: any) => {
135
163
  />
136
164
  </NotificationIcon>
137
165
  )}
138
- <OText
139
- style={styles.date}
140
- numberOfLines={1}
141
- adjustsFontSizeToFit
142
- size={20}>
143
- {(order?.order_group_id && order?.order_group && isLogisticOrder ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}` : (t('INVOICE_ORDER_NO', 'Order No.') + order.id)) + ' · '}
144
- {order?.delivery_datetime_utc
145
- ? parseDate(order?.delivery_datetime_utc)
146
- : parseDate(order?.delivery_datetime, { utc: false })}
147
- </OText>
166
+ <View style={{flexDirection: 'row'}}>
167
+ <OText
168
+ style={styles.date}
169
+ color={theme.colors.unselectText}
170
+ numberOfLines={1}
171
+ adjustsFontSizeToFit
172
+ >
173
+ {(order?.order_group_id && order?.order_group && isLogisticOrder ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}` : (t('NO', 'Order No.') + order.id)) + ' · '}
174
+ {order?.delivery_datetime_utc
175
+ ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
176
+ : parseDate(order?.delivery_datetime, { utc: false })}{' · '}
177
+ </OText>
178
+ <OText style={styles.date} color={order?.time_status === 'in_time' ? '#00D27A' : order?.time_status === 'at_risk' ? '#FFC700' : order?.time_status === 'delayed' ? '#E63757' : '' } >{getDelayTime(order)}</OText>
179
+ </View>
148
180
  {!isLogisticOrder && (
149
181
  <MyOrderOptions>
150
182
  <OText
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components/native';
1
+ import styled, { css } from 'styled-components/native';
2
2
 
3
3
  export const Card = styled.View`
4
4
  flex: 1;
@@ -35,4 +35,16 @@ export const AcceptOrRejectOrder = styled.View`
35
35
  justify-content: space-between;
36
36
  flex: 1;
37
37
  margin: 10px;
38
+ `
39
+ export const Timestatus = styled.View`
40
+ position: relative;;
41
+ width: 4px;
42
+ height: 65px;
43
+ border-radius: 20px;
44
+ top: 5px;
45
+ margin-right: 5px;
46
+ ${(props: any) => props.theme?.rtl && css`
47
+ left: unset;
48
+ right: -5px;
49
+ `}
38
50
  `
@@ -95,7 +95,7 @@ interface Props {
95
95
  style?: ViewStyle;
96
96
  bgImage: ImageSourcePropType;
97
97
  innerStyle?: ViewStyle;
98
- icon: ImageSourcePropType;
98
+ icon?: ImageSourcePropType;
99
99
  iconStyle?: ImageStyle;
100
100
  callToActionText: string;
101
101
  callToActionTextStyle?: TextStyle;
@@ -15,6 +15,8 @@ import { Container } from '../../layouts/Container'
15
15
  import NavBar from '../NavBar'
16
16
  import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'
17
17
  import GridContainer from '../../layouts/GridContainer'
18
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
19
+ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
18
20
 
19
21
  const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
20
22
  const {
@@ -27,7 +29,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
27
29
  callback
28
30
  } = props
29
31
 
30
- const theme = useTheme();
32
+ const theme = useTheme();
31
33
  const [, t] = useLanguage();
32
34
  const [orientationState] = useDeviceOrientation();
33
35
  const [orderState] = useOrder()
@@ -45,7 +47,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
45
47
  }
46
48
 
47
49
  useEffect(() => {
48
- if(isCardCliked){
50
+ if (isCardCliked) {
49
51
  callback?.()
50
52
  setIsCardClicked(false)
51
53
  setIsLoadingCard(null)
@@ -57,8 +59,8 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
57
59
  <Container>
58
60
  <NavBar
59
61
  title={t('ORDER_TYPE_X_ID', 'Order type')}
60
- {...(goBack && { onActionLeft: goBack } )}
61
- btnStyle={{paddingLeft: 0}}
62
+ {...(goBack && { onActionLeft: goBack })}
63
+ btnStyle={{ paddingLeft: 0 }}
62
64
  />
63
65
 
64
66
  <View style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
@@ -83,13 +85,13 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
83
85
  style={cardStyle}
84
86
  isDisabled={isCardCliked}
85
87
  isLoading={isLoadingCard === 'Eat In'}
86
- title={t('EAT_IN','Eat In')}
88
+ title={t('EAT_IN', 'Eat In')}
87
89
  description={t('EAT_IN_DESCRIPTION', 'We are very glad to have you here. Bon appetit!')}
88
90
  bgImage={theme.images.general.eatIn}
89
- icon={theme.images.general.pushPin}
91
+ VectorIcon={() => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />}
90
92
  callToActionText={t('START_MY_ORDER', 'Start my order')}
91
93
  onClick={() => {
92
- if(_eatIn?.value !== orderState?.options?.type){
94
+ if (_eatIn?.value !== orderState?.options?.type) {
93
95
  handleChangeOrderType(_eatIn?.value);
94
96
  setIsCardClicked(true)
95
97
  setIsLoadingCard('Eat In')
@@ -106,15 +108,15 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
106
108
 
107
109
  <OptionCard
108
110
  style={cardStyle}
109
- title={t('TAKE_OUT','Take out')}
111
+ title={t('TAKE_OUT', 'Take out')}
110
112
  isDisabled={isCardCliked}
111
113
  isLoading={isLoadingCard === 'Take out'}
112
114
  description={t('TAKE_OUT_DESCRIPTION', 'You are very welcome anytime you visit us!')}
113
115
  bgImage={theme.images.general.takeOut}
114
- icon={theme.images.general.shoppingCart}
116
+ VectorIcon={() => <AntDesignIcon name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />}
115
117
  callToActionText={t('START_MY_ORDER', 'Start my order')}
116
118
  onClick={() => {
117
- if(_takeOut?.value !== orderState?.options?.type){
119
+ if (_takeOut?.value !== orderState?.options?.type) {
118
120
  handleChangeOrderType(_takeOut?.value);
119
121
  setIsCardClicked(true)
120
122
  setIsLoadingCard('Take out')
@@ -246,8 +246,9 @@ export const ProductOptionsUI = (props: any) => {
246
246
  {...navBarProps}
247
247
  titleColor={theme.colors.white}
248
248
  btnStyle={{
249
- width: 66,
250
- height: 66,
249
+ width: 55,
250
+ height: 55,
251
+ overflow: 'scroll',
251
252
  backgroundColor: 'black',
252
253
  borderRadius: 100,
253
254
  color: 'white',
@@ -125,7 +125,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
125
125
  {product.name}
126
126
  </OText>
127
127
 
128
- {product?.price && (
128
+ {!!product?.price && (
129
129
  <OText>
130
130
  <OText
131
131
  color={theme.colors.primary}
@@ -200,7 +200,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
200
200
  {product.name}
201
201
  </OText>
202
202
 
203
- {product?.price && (
203
+ {!!product?.price && (
204
204
  <OText>
205
205
  <OText
206
206
  color={theme.colors.primary}
@@ -127,7 +127,7 @@ const CheckoutUI = (props: any) => {
127
127
  const [openChangeStore, setOpenChangeStore] = useState(false)
128
128
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
129
129
 
130
- const isWalletEnabled = configs?.wallet_enabled?.value === '1'
130
+ const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
131
131
 
132
132
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
133
133
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -569,7 +569,7 @@ const CheckoutUI = (props: any) => {
569
569
  </OText>
570
570
  )}
571
571
 
572
- {!paymethodSelected && cart?.status !== 2 && cart?.valid && (
572
+ {(!paymethodSelected && cart?.balance > 0) && cart?.status !== 2 && cart?.valid && (
573
573
  <OText
574
574
  color={theme.colors.error}
575
575
  size={12}
@@ -605,8 +605,8 @@ const CheckoutUI = (props: any) => {
605
605
  {!cartState.loading && cart && cart?.status !== 2 && (
606
606
  <FloatingButton
607
607
  handleClick={() => handlePlaceOrder()}
608
- isSecondaryBtn={loading || !cart?.valid || !paymethodSelected || placing || errorCash || cart?.subtotal < cart?.minimum}
609
- disabled={loading || !cart?.valid || !paymethodSelected || placing || errorCash || cart?.subtotal < cart?.minimum}
608
+ isSecondaryBtn={loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum}
609
+ disabled={loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum}
610
610
  btnText={cart?.subtotal >= cart?.minimum
611
611
  ? (
612
612
  placing
@@ -7,7 +7,8 @@ import {
7
7
  PaymentOptionWallet as PaymentOptionWalletController,
8
8
  useLanguage,
9
9
  useUtils,
10
- useOrder
10
+ useOrder,
11
+ useConfig
11
12
  } from 'ordering-components/native'
12
13
 
13
14
  import {
@@ -27,11 +28,15 @@ const PaymentOptionWalletUI = (props: any) => {
27
28
 
28
29
  const theme = useTheme()
29
30
  const [, t] = useLanguage()
31
+ const [{ configs }] = useConfig()
30
32
  const [{ carts }] = useOrder()
31
33
  const [{ parsePrice }] = useUtils()
32
34
 
33
35
  const cart = carts?.[`businessId:${businessId}`] ?? {}
34
36
 
37
+ const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
38
+ const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
39
+
35
40
  const styles = StyleSheet.create({
36
41
  checkBoxStyle: {
37
42
  width: 25,
@@ -48,9 +53,11 @@ const PaymentOptionWalletUI = (props: any) => {
48
53
  const walletName: any = {
49
54
  cash: {
50
55
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
56
+ isActive: isWalletCashEnabled
51
57
  },
52
58
  credit_point: {
53
59
  name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
60
+ isActive: isWalletPointsEnabled
54
61
  }
55
62
  }
56
63
 
@@ -85,7 +92,7 @@ const PaymentOptionWalletUI = (props: any) => {
85
92
  walletsState.result?.length > 0 &&
86
93
  (
87
94
  <>
88
- {walletsState.result?.map((wallet: any, idx: any) => wallet.valid && wallet.balance >= 0 && (
95
+ {walletsState.result?.map((wallet: any, idx: any) => wallet.valid && wallet.balance >= 0 && walletName[wallet.type]?.isActive && (
89
96
  <Container
90
97
  key={wallet.id}
91
98
  isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
@@ -99,7 +99,7 @@ const ProfileListUI = (props: ProfileParams) => {
99
99
  const { height } = useWindowDimensions();
100
100
  const { top, bottom } = useSafeAreaInsets();
101
101
 
102
- const isWalletEnabled = configs?.wallet_enabled?.value === '1'
102
+ const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
103
103
 
104
104
  const onRedirect = (route: string, params?: any) => {
105
105
  navigation.navigate(route, params)
@@ -35,19 +35,25 @@ const WalletsUI = (props: any) => {
35
35
  const theme = useTheme()
36
36
  const [{ parsePrice, parseDate }] = useUtils()
37
37
  const [{ configs }] = useConfig()
38
+ const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
39
+ const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
38
40
 
39
- const [tabSelected, setTabSelected] = useState('cash')
41
+ const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
42
+
43
+ const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
40
44
 
41
45
  const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
42
46
 
43
47
  const walletName: any = {
44
48
  cash: {
45
49
  name: t('CASH_WALLET', 'Cash Wallet'),
46
- value: 0
50
+ value: 0,
51
+ isActive: isWalletCashEnabled
47
52
  },
48
53
  credit_point: {
49
54
  name: t('CREDITS_POINTS_WALLET', 'Credit Points Wallet'),
50
- value: 1
55
+ value: 1,
56
+ isActive: isWalletPointsEnabled
51
57
  }
52
58
  }
53
59
 
@@ -61,7 +67,7 @@ const WalletsUI = (props: any) => {
61
67
  }
62
68
 
63
69
  useEffect(() => {
64
- if (configs?.wallet_enabled?.value === '0') {
70
+ if (!isWalletEnabled) {
65
71
  navigation.navigate('BottomTab', {
66
72
  screen: 'Profile'
67
73
  })
@@ -85,7 +91,7 @@ const WalletsUI = (props: any) => {
85
91
  (
86
92
  <>
87
93
  <OTabs>
88
- {walletList.wallets?.map((wallet: any) =>(
94
+ {walletList.wallets?.map((wallet: any) => walletName[wallet.type]?.isActive && (
89
95
  <Pressable
90
96
  key={wallet.id}
91
97
  onPress={() => handleChangeTab(wallet)}