ordering-ui-react-native 0.14.52 → 0.14.53

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.52",
3
+ "version": "0.14.53",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -127,6 +127,8 @@ 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'
131
+
130
132
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
131
133
  ? JSON.parse(configs?.driver_tip_options?.value) || []
132
134
  : configs?.driver_tip_options?.value || []
@@ -506,7 +508,7 @@ const CheckoutUI = (props: any) => {
506
508
  </ChSection>
507
509
  )}
508
510
 
509
- {!cartState.loading && cart && (
511
+ {!cartState.loading && cart && isWalletEnabled && (
510
512
  <WalletPaymentOptionContainer>
511
513
  <PaymentOptionWallet
512
514
  cart={cart}
@@ -55,7 +55,7 @@ const PaymentOptionWalletUI = (props: any) => {
55
55
  }
56
56
 
57
57
  const handleOnChange = (position: any, wallet: any) => {
58
- const updatedCheckedState = checkedState.map((item, index) =>
58
+ const updatedCheckedState = checkedState.map((item: any, index: any) =>
59
59
  index === position ? !item : item
60
60
  );
61
61
 
@@ -85,7 +85,7 @@ const PaymentOptionWalletUI = (props: any) => {
85
85
  walletsState.result?.length > 0 &&
86
86
  (
87
87
  <>
88
- {walletsState.result?.map((wallet: any, idx: any) => wallet.valid && (
88
+ {walletsState.result?.map((wallet: any, idx: any) => wallet.valid && wallet.balance >= 0 && (
89
89
  <Container
90
90
  key={wallet.id}
91
91
  isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
@@ -5,6 +5,7 @@ import {
5
5
  useLanguage,
6
6
  ToastType,
7
7
  useToast,
8
+ useConfig
8
9
  } from 'ordering-components/native';
9
10
  import { useTheme } from 'styled-components/native';
10
11
  import { useForm } from 'react-hook-form';
@@ -91,12 +92,15 @@ const ProfileListUI = (props: ProfileParams) => {
91
92
 
92
93
  const [{ user }] = useSession();
93
94
  const [, t] = useLanguage();
95
+ const [{ configs }] = useConfig();
94
96
  const [, { showToast }] = useToast();
95
97
  const { errors } = useForm();
96
98
 
97
99
  const { height } = useWindowDimensions();
98
100
  const { top, bottom } = useSafeAreaInsets();
99
101
 
102
+ const isWalletEnabled = configs?.wallet_enabled?.value === '1'
103
+
100
104
  const onRedirect = (route: string, params?: any) => {
101
105
  navigation.navigate(route, params)
102
106
  }
@@ -161,10 +165,12 @@ const ProfileListUI = (props: ProfileParams) => {
161
165
  <MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
162
166
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MESSAGES', 'Messages')}</OText>
163
167
  </ListItem>
164
- <ListItem onPress={() => onRedirect('Wallets', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
165
- <Ionicons name='wallet-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
166
- <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('WALLETS', 'Wallets')}</OText>
167
- </ListItem>
168
+ {!isWalletEnabled && (
169
+ <ListItem onPress={() => onRedirect('Wallets', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
170
+ <Ionicons name='wallet-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
171
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('WALLETS', 'Wallets')}</OText>
172
+ </ListItem>
173
+ )}
168
174
  <ListItem onPress={() => navigation.navigate('Help', {})} activeOpacity={0.7}>
169
175
  <OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
170
176
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react'
1
+ import React, { useState, useEffect } from 'react'
2
2
  import { Pressable, View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
@@ -60,6 +60,14 @@ const WalletsUI = (props: any) => {
60
60
  navigation?.canGoBack() && navigation.goBack()
61
61
  }
62
62
 
63
+ useEffect(() => {
64
+ if (configs?.wallet_enabled?.value === '0') {
65
+ navigation.navigate('BottomTab', {
66
+ screen: 'Profile'
67
+ })
68
+ }
69
+ }, [configs])
70
+
63
71
  return (
64
72
  <Container>
65
73
  <NavBar