ordering-ui-react-native 0.15.89 → 0.15.92
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 +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/utils/index.tsx +28 -28
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +100 -60
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
- package/themes/business/src/components/OrderDetails/Delivery.tsx +11 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +1 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +5 -2
- package/themes/business/src/types/index.tsx +3 -0
- package/themes/original/src/components/AppleLogin/index.tsx +2 -4
- package/themes/original/src/components/BusinessListingSearch/index.tsx +117 -7
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +3 -1
- package/themes/original/src/components/Cart/index.tsx +1 -1
- package/themes/original/src/components/Checkout/index.tsx +37 -29
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +42 -9
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/OrderDetails/index.tsx +18 -21
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
- package/themes/original/src/components/ProductForm/index.tsx +48 -40
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
- package/themes/original/src/components/Promotions/index.tsx +18 -2
- package/themes/original/src/types/index.tsx +3 -1
|
@@ -14,7 +14,8 @@ Sound.setCategory('Playback')
|
|
|
14
14
|
|
|
15
15
|
const windowWidth = Dimensions.get('screen').width
|
|
16
16
|
|
|
17
|
-
const NewOrderNotificationUI = () => {
|
|
17
|
+
const NewOrderNotificationUI = (props: any) => {
|
|
18
|
+
const { isBusinessApp } = props
|
|
18
19
|
const [events] = useEvent()
|
|
19
20
|
const theme = useTheme()
|
|
20
21
|
const [, t] = useLanguage()
|
|
@@ -22,7 +23,7 @@ const NewOrderNotificationUI = () => {
|
|
|
22
23
|
const [ordering] = useApi()
|
|
23
24
|
const { getCurrentLocation } = useLocation();
|
|
24
25
|
const [soundTimeout, setSoundTimeout] = useState<any>(null)
|
|
25
|
-
|
|
26
|
+
let [currentEvent, setCurrentEvent] = useState<any>(null)
|
|
26
27
|
|
|
27
28
|
const evtList: any = {
|
|
28
29
|
1: {
|
|
@@ -45,6 +46,7 @@ const NewOrderNotificationUI = () => {
|
|
|
45
46
|
const notificationSound = new Sound(theme.sounds.notification, (e) => { console.log(e) });
|
|
46
47
|
|
|
47
48
|
const handlePlayNotificationSound = () => {
|
|
49
|
+
if (currentEvent) return
|
|
48
50
|
let times = 0
|
|
49
51
|
const _timeout = setInterval(function () {
|
|
50
52
|
notificationSound.play(success => {
|
|
@@ -62,29 +64,40 @@ const NewOrderNotificationUI = () => {
|
|
|
62
64
|
|
|
63
65
|
const handleCloseModal = () => {
|
|
64
66
|
clearInterval(soundTimeout)
|
|
67
|
+
currentEvent = null
|
|
65
68
|
setCurrentEvent({ evt: null })
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
const handleEventNotification = async (evtType: number, value: any) => {
|
|
69
72
|
if (value?.driver) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
try {
|
|
74
|
+
const location = await getCurrentLocation()
|
|
75
|
+
await fetch(`${ordering.root}/users/${user.id}/locations`, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
body: JSON.stringify({
|
|
78
|
+
location: JSON.stringify({location: `{lat: ${location.latitude}, lng: ${location.longitude}}`})
|
|
79
|
+
}),
|
|
80
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
|
|
81
|
+
})
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.log(error)
|
|
84
|
+
}
|
|
85
|
+
const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
|
|
86
|
+
const assignedSecondsDiff = duration.asSeconds()
|
|
87
|
+
if (assignedSecondsDiff < 5 && !isBusinessApp) {
|
|
80
88
|
handlePlayNotificationSound()
|
|
81
89
|
clearInterval(soundTimeout)
|
|
90
|
+
currentEvent = { evt: 2, orderId: value?.id }
|
|
82
91
|
setCurrentEvent({ evt: 2, orderId: value?.id })
|
|
83
92
|
}
|
|
84
|
-
return
|
|
85
93
|
}
|
|
94
|
+
if (evtType === 3 || value.author_id === user.id) return
|
|
86
95
|
handlePlayNotificationSound()
|
|
87
96
|
clearInterval(soundTimeout)
|
|
97
|
+
currentEvent = {
|
|
98
|
+
evt: evtType,
|
|
99
|
+
orderId: evtList[evtType].event === 'messages' ? value?.order_id : value?.id
|
|
100
|
+
}
|
|
88
101
|
setCurrentEvent({
|
|
89
102
|
evt: evtType,
|
|
90
103
|
orderId: evtList[evtType].event === 'messages' ? value?.order_id : value?.id
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//React & React Native
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import { StyleSheet, View
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
4
|
|
|
5
5
|
// Thirds
|
|
6
6
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
@@ -29,7 +29,6 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
29
29
|
import { getOrderStatus } from '../../utils';
|
|
30
30
|
import { OrderHeaderComponent } from './OrderHeaderComponent';
|
|
31
31
|
import { OrderContentComponent } from './OrderContentComponent';
|
|
32
|
-
|
|
33
32
|
//Styles
|
|
34
33
|
import { OrderDetailsContainer, Pickup } from './styles';
|
|
35
34
|
|
|
@@ -52,7 +51,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
52
51
|
appTitle,
|
|
53
52
|
handleClickLogisticOrder,
|
|
54
53
|
forceUpdate,
|
|
55
|
-
getPermissions
|
|
54
|
+
getPermissions,
|
|
55
|
+
isGrantedPermissions
|
|
56
56
|
} = props;
|
|
57
57
|
const [, { showToast }] = useToast();
|
|
58
58
|
const { order } = props.order
|
|
@@ -102,6 +102,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
const handleOpenMapView = async () => {
|
|
105
|
+
if (!isGrantedPermissions) {
|
|
106
|
+
navigation.navigate('RequestPermissions')
|
|
107
|
+
return
|
|
108
|
+
}
|
|
105
109
|
const _permissions = await getPermissions()
|
|
106
110
|
|
|
107
111
|
const isBlocked = _permissions.some((_permission: string) => permissions?.locationStatus?.[_permission] === 'blocked')
|
|
@@ -128,6 +132,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
128
132
|
};
|
|
129
133
|
|
|
130
134
|
const handleViewActionOrder = (action: string) => {
|
|
135
|
+
if (!isGrantedPermissions) {
|
|
136
|
+
navigation.navigate('RequestPermissions')
|
|
137
|
+
return
|
|
138
|
+
}
|
|
131
139
|
if (openModalForMapView) {
|
|
132
140
|
setOpenModalForMapView(false);
|
|
133
141
|
}
|
|
@@ -617,7 +617,7 @@ const OrdersListManagerUI = (props: OrdersOptionParams) => {
|
|
|
617
617
|
</RightSide>
|
|
618
618
|
</Sides>
|
|
619
619
|
|
|
620
|
-
<NewOrderNotification />
|
|
620
|
+
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
621
621
|
{(openSearchModal || openSLASettingModal) && (
|
|
622
622
|
<OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
|
|
623
623
|
<ModalContainer
|
|
@@ -725,8 +725,11 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
725
725
|
</ScrollView>
|
|
726
726
|
</View>
|
|
727
727
|
{/* </GestureRecognizer> */}
|
|
728
|
-
|
|
729
|
-
|
|
728
|
+
|
|
729
|
+
{isBusinessApp && (
|
|
730
|
+
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
731
|
+
)}
|
|
732
|
+
|
|
730
733
|
{(openSearchModal || openSLASettingModal) && (
|
|
731
734
|
<OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
|
|
732
735
|
<ModalContainer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Platform, Text, StyleSheet } from 'react-native';
|
|
3
|
-
import { useApi, useSession, useLanguage, useConfig
|
|
3
|
+
import { useApi, useSession, useLanguage, useConfig } from 'ordering-components/native';
|
|
4
4
|
import { appleAuthAndroid, appleAuth } from '@invertase/react-native-apple-authentication';
|
|
5
5
|
import uuid from 'react-native-uuid';
|
|
6
6
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
|
@@ -19,14 +19,13 @@ export const AppleLogin = (props: any) => {
|
|
|
19
19
|
const [{ auth }] = useSession();
|
|
20
20
|
const [, t] = useLanguage();
|
|
21
21
|
const [{ configs }] = useConfig();
|
|
22
|
-
const [, {showToast}] = useToast()
|
|
23
22
|
const [credentialStateForUser, updateCredentialStateForUser] = useState<any>(-1);
|
|
24
23
|
|
|
25
24
|
let user : any= null
|
|
26
25
|
|
|
27
26
|
const buttonText = auth
|
|
28
27
|
? t('CONTINUE_WITH_APPLE', 'Logout with Apple')
|
|
29
|
-
: t('
|
|
28
|
+
: t('CONTINUE_WITH_APPLE', 'Continue with Apple');
|
|
30
29
|
|
|
31
30
|
const performAppleLogin = async (code: string) => {
|
|
32
31
|
try {
|
|
@@ -88,7 +87,6 @@ export const AppleLogin = (props: any) => {
|
|
|
88
87
|
);
|
|
89
88
|
|
|
90
89
|
if (identityToken && authorizationCode) {
|
|
91
|
-
showToast(ToastType.Success, `Apple Authentication Completed, ${email}`)
|
|
92
90
|
performAppleLogin(authorizationCode)
|
|
93
91
|
} else {
|
|
94
92
|
handleErrors && handleErrors('UNABLE_LOGIN_TOKEN', 'Unable to login, no token found')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
|
|
3
|
-
import { ScrollView, StyleSheet, TouchableOpacity, Platform, View } from 'react-native'
|
|
3
|
+
import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
5
|
import { useTheme } from 'styled-components/native'
|
|
6
6
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
@@ -22,15 +22,18 @@ import {
|
|
|
22
22
|
ProgressContentWrapper,
|
|
23
23
|
ProgressBar,
|
|
24
24
|
TagsContainer,
|
|
25
|
-
SortContainer
|
|
25
|
+
SortContainer,
|
|
26
|
+
BrandContainer,
|
|
27
|
+
BrandItem,
|
|
28
|
+
PriceFilterWrapper
|
|
26
29
|
} from './styles'
|
|
27
30
|
import FastImage from 'react-native-fast-image'
|
|
28
31
|
import { convertHoursToMinutes } from '../../utils'
|
|
29
32
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
30
33
|
import { BusinessSearchParams } from '../../types'
|
|
31
34
|
|
|
32
|
-
export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
33
35
|
|
|
36
|
+
export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
34
37
|
const {
|
|
35
38
|
navigation,
|
|
36
39
|
businessesSearchList,
|
|
@@ -42,9 +45,11 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
42
45
|
handleChangeFilters,
|
|
43
46
|
filters,
|
|
44
47
|
businessTypes,
|
|
45
|
-
setFilters
|
|
48
|
+
setFilters,
|
|
49
|
+
brandList
|
|
46
50
|
} = props
|
|
47
|
-
|
|
51
|
+
|
|
52
|
+
const screenHeight = Dimensions.get('window').height;
|
|
48
53
|
const theme = useTheme()
|
|
49
54
|
const [orderState] = useOrder()
|
|
50
55
|
const { top } = useSafeAreaInsets();
|
|
@@ -63,11 +68,24 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
63
68
|
{ text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
|
|
64
69
|
]
|
|
65
70
|
|
|
71
|
+
const priceList = [
|
|
72
|
+
{ level: '1', content: '$' },
|
|
73
|
+
{ level: '2', content: '$$' },
|
|
74
|
+
{ level: '3', content: '$$$' },
|
|
75
|
+
{ level: '4', content: '$$$$' },
|
|
76
|
+
{ level: '5', content: '$$$$$' }
|
|
77
|
+
]
|
|
78
|
+
|
|
66
79
|
const styles = StyleSheet.create({
|
|
67
80
|
container: {
|
|
68
81
|
paddingHorizontal: 40,
|
|
69
82
|
width: '100%'
|
|
70
83
|
},
|
|
84
|
+
filterContainer: {
|
|
85
|
+
maxHeight: screenHeight - 150,
|
|
86
|
+
paddingHorizontal: 40,
|
|
87
|
+
width: '100%'
|
|
88
|
+
},
|
|
71
89
|
searchInput: {
|
|
72
90
|
fontSize: 10,
|
|
73
91
|
},
|
|
@@ -84,6 +102,12 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
84
102
|
flexWrap: 'wrap',
|
|
85
103
|
justifyContent: 'center'
|
|
86
104
|
},
|
|
105
|
+
priceContainer: {
|
|
106
|
+
width: '100%',
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
flexWrap: 'wrap',
|
|
109
|
+
justifyContent: 'space-between'
|
|
110
|
+
},
|
|
87
111
|
categoryStyle: {
|
|
88
112
|
marginRight: 10,
|
|
89
113
|
marginTop: 10,
|
|
@@ -95,6 +119,16 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
95
119
|
height: 28,
|
|
96
120
|
borderWidth: 0
|
|
97
121
|
},
|
|
122
|
+
priceItem: {
|
|
123
|
+
marginRight: 10,
|
|
124
|
+
marginTop: 10,
|
|
125
|
+
borderRadius: 50,
|
|
126
|
+
paddingVertical: 4,
|
|
127
|
+
paddingLeft: 5,
|
|
128
|
+
paddingRight: 5,
|
|
129
|
+
height: 27,
|
|
130
|
+
borderWidth: 0
|
|
131
|
+
},
|
|
98
132
|
applyButton: {
|
|
99
133
|
paddingHorizontal: 40,
|
|
100
134
|
width: '100%',
|
|
@@ -107,7 +141,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
107
141
|
}
|
|
108
142
|
|
|
109
143
|
const handleCloseFilters = () => {
|
|
110
|
-
setFilters({ business_types: [], orderBy: 'default' })
|
|
144
|
+
setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
|
|
111
145
|
setOpenFilters(false)
|
|
112
146
|
}
|
|
113
147
|
|
|
@@ -126,6 +160,18 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
126
160
|
}
|
|
127
161
|
}
|
|
128
162
|
|
|
163
|
+
const handleChangeBrandFilter = (brandId: number) => {
|
|
164
|
+
let franchiseIds = [...filters?.franchise_ids]
|
|
165
|
+
if (filters?.franchise_ids?.includes(brandId)) franchiseIds = filters?.franchise_ids?.filter((item: any) => item !== brandId)
|
|
166
|
+
else franchiseIds.push(brandId)
|
|
167
|
+
handleChangeFilters && handleChangeFilters('franchise_ids', franchiseIds)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const handleChangePriceRange = (value: string) => {
|
|
171
|
+
if (value === filters?.price_level) handleChangeFilters('price_level', null)
|
|
172
|
+
else handleChangeFilters('price_level', value)
|
|
173
|
+
}
|
|
174
|
+
|
|
129
175
|
const handleApplyFilters = () => {
|
|
130
176
|
handleSearchbusinessAndProducts(true)
|
|
131
177
|
setOpenFilters(false)
|
|
@@ -388,7 +434,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
388
434
|
onCancel={() => handleCloseFilters()}
|
|
389
435
|
onClose={() => handleCloseFilters()}
|
|
390
436
|
>
|
|
391
|
-
<ScrollView style={styles.
|
|
437
|
+
<ScrollView style={styles.filterContainer}>
|
|
392
438
|
<OText
|
|
393
439
|
size={20}
|
|
394
440
|
mBottom={15}
|
|
@@ -415,6 +461,70 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
415
461
|
</TouchableOpacity>
|
|
416
462
|
))}
|
|
417
463
|
</SortContainer>
|
|
464
|
+
<BrandContainer>
|
|
465
|
+
<OText
|
|
466
|
+
size={16}
|
|
467
|
+
weight='bold'
|
|
468
|
+
lineHeight={24}
|
|
469
|
+
style={{ marginBottom: 10 }}
|
|
470
|
+
>
|
|
471
|
+
{t('BRANDS', 'Brands')}
|
|
472
|
+
</OText>
|
|
473
|
+
{!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
|
|
474
|
+
<ScrollView
|
|
475
|
+
style={{ maxHeight: 300, marginBottom: 10 }}
|
|
476
|
+
showsVerticalScrollIndicator={true}
|
|
477
|
+
nestedScrollEnabled={true}
|
|
478
|
+
>
|
|
479
|
+
{brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
|
|
480
|
+
<BrandItem
|
|
481
|
+
key={i}
|
|
482
|
+
onPress={() => handleChangeBrandFilter(brand?.id)}
|
|
483
|
+
>
|
|
484
|
+
<OText
|
|
485
|
+
size={14}
|
|
486
|
+
weight={'400'}
|
|
487
|
+
lineHeight={24}
|
|
488
|
+
>
|
|
489
|
+
{brand?.name}
|
|
490
|
+
</OText>
|
|
491
|
+
{filters?.franchise_ids?.includes(brand?.id) && (
|
|
492
|
+
<AntDesignIcon
|
|
493
|
+
name='check'
|
|
494
|
+
color={theme.colors.success500}
|
|
495
|
+
size={16}
|
|
496
|
+
/>
|
|
497
|
+
)}
|
|
498
|
+
</BrandItem>
|
|
499
|
+
))}
|
|
500
|
+
</ScrollView>
|
|
501
|
+
)}
|
|
502
|
+
{!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
|
|
503
|
+
<OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
|
|
504
|
+
)}
|
|
505
|
+
</BrandContainer>
|
|
506
|
+
<PriceFilterWrapper>
|
|
507
|
+
<OText
|
|
508
|
+
size={16}
|
|
509
|
+
weight='bold'
|
|
510
|
+
lineHeight={24}
|
|
511
|
+
style={{ marginBottom: 5 }}
|
|
512
|
+
>
|
|
513
|
+
{t('PRICE_RANGE', 'Price range')}
|
|
514
|
+
</OText>
|
|
515
|
+
<View style={styles.priceContainer}>
|
|
516
|
+
{priceList.map((price: any, i: number) => (
|
|
517
|
+
<OButton
|
|
518
|
+
key={i}
|
|
519
|
+
bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
520
|
+
onClick={() => handleChangePriceRange(price?.level)}
|
|
521
|
+
text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
|
|
522
|
+
style={styles.priceItem}
|
|
523
|
+
textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
|
|
524
|
+
/>
|
|
525
|
+
))}
|
|
526
|
+
</View>
|
|
527
|
+
</PriceFilterWrapper>
|
|
418
528
|
{orderState?.options?.type === 1 && (
|
|
419
529
|
<MaxSectionItem
|
|
420
530
|
title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
|
|
@@ -68,9 +68,22 @@ export const ProgressContentWrapper = styled.View`
|
|
|
68
68
|
`
|
|
69
69
|
|
|
70
70
|
export const TagsContainer = styled.View`
|
|
71
|
-
|
|
71
|
+
padding-bottom: 10px;
|
|
72
72
|
`
|
|
73
73
|
|
|
74
74
|
export const SortContainer = styled.View`
|
|
75
75
|
margin-bottom: 10px;
|
|
76
76
|
`
|
|
77
|
+
|
|
78
|
+
export const BrandContainer = styled.View``
|
|
79
|
+
|
|
80
|
+
export const BrandItem = styled.TouchableOpacity`
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
margin-bottom: 4px;
|
|
84
|
+
align-items: center;
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
export const PriceFilterWrapper = styled.View`
|
|
88
|
+
margin-bottom: 20px;
|
|
89
|
+
`
|
|
@@ -59,7 +59,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
59
59
|
handleBusinessClick,
|
|
60
60
|
paginationProps,
|
|
61
61
|
handleChangeSearch,
|
|
62
|
-
businessId
|
|
62
|
+
businessId,
|
|
63
|
+
isGuestUser
|
|
63
64
|
} = props;
|
|
64
65
|
const theme = useTheme();
|
|
65
66
|
const isFocused = useIsFocused();
|
|
@@ -242,6 +243,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
242
243
|
: navigation.navigate('AddressForm', {
|
|
243
244
|
address: orderState.options?.address,
|
|
244
245
|
isFromBusinesses: true,
|
|
246
|
+
isGuestUser: isGuestUser
|
|
245
247
|
})
|
|
246
248
|
}>
|
|
247
249
|
<OIcon
|
|
@@ -113,7 +113,10 @@ const CheckoutUI = (props: any) => {
|
|
|
113
113
|
right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
|
|
114
114
|
position: 'absolute',
|
|
115
115
|
fontSize: 20
|
|
116
|
-
}
|
|
116
|
+
},
|
|
117
|
+
wrapperNavbar: Platform.OS === 'ios'
|
|
118
|
+
? { paddingVertical: 0, paddingHorizontal: 40 }
|
|
119
|
+
: { paddingVertical: 20, paddingHorizontal: 40 }
|
|
117
120
|
})
|
|
118
121
|
|
|
119
122
|
const [, { showToast }] = useToast();
|
|
@@ -133,20 +136,20 @@ const CheckoutUI = (props: any) => {
|
|
|
133
136
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
134
137
|
const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
|
|
135
138
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
136
|
-
|
|
139
|
+
|
|
137
140
|
const placeSpotTypes = [3, 4]
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
142
|
+
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
143
|
+
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
144
|
+
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
142
145
|
|
|
143
146
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
144
147
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
149
|
+
(options.type === 1 &&
|
|
150
|
+
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
151
|
+
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
152
|
+
(Number(cart?.driver_tip) <= 0))
|
|
150
153
|
|
|
151
154
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
152
155
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -248,7 +251,7 @@ const CheckoutUI = (props: any) => {
|
|
|
248
251
|
|
|
249
252
|
useEffect(() => {
|
|
250
253
|
if (cart?.products?.length === 0) {
|
|
251
|
-
onNavigationRedirect('Business', { store: cart?.business?.slug })
|
|
254
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
252
255
|
}
|
|
253
256
|
}, [cart?.products])
|
|
254
257
|
|
|
@@ -259,13 +262,18 @@ const CheckoutUI = (props: any) => {
|
|
|
259
262
|
return (
|
|
260
263
|
<>
|
|
261
264
|
<Container noPadding>
|
|
262
|
-
<
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
<View style={styles.wrapperNavbar}>
|
|
266
|
+
<NavBar
|
|
267
|
+
title={t('CHECKOUT', 'Checkout')}
|
|
268
|
+
titleAlign={'center'}
|
|
269
|
+
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
270
|
+
showCall={false}
|
|
271
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
272
|
+
style={{ flexDirection: 'column', alignItems: 'flex-start', marginTop: Platform.OS === 'ios' ? 0 : 20 }}
|
|
273
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
274
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
275
|
+
/>
|
|
276
|
+
</View>
|
|
269
277
|
<ChContainer style={styles.pagePadding}>
|
|
270
278
|
<ChSection style={{ paddingTop: 0 }}>
|
|
271
279
|
<ChHeader>
|
|
@@ -668,16 +676,16 @@ const CheckoutUI = (props: any) => {
|
|
|
668
676
|
</OText>
|
|
669
677
|
)}
|
|
670
678
|
{options.type === 1 &&
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
679
|
+
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
680
|
+
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
681
|
+
(Number(cart?.driver_tip) <= 0) && (
|
|
682
|
+
<OText
|
|
683
|
+
color={theme.colors.error}
|
|
684
|
+
size={12}
|
|
685
|
+
>
|
|
686
|
+
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
687
|
+
</OText>
|
|
688
|
+
)}
|
|
681
689
|
</ChErrors>
|
|
682
690
|
</View>
|
|
683
691
|
)}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { RefreshControl } from 'react-native'
|
|
2
3
|
import { HelpParams } from '../../types'
|
|
3
4
|
import { useLanguage } from 'ordering-components/native'
|
|
4
5
|
import NavBar from '../NavBar'
|
|
5
6
|
import { OText } from '../shared'
|
|
6
7
|
import { LastOrders } from '../LastOrders'
|
|
8
|
+
import { Container } from '../../layouts/Container'
|
|
7
9
|
|
|
8
10
|
import {
|
|
9
11
|
HelpSubItem,
|
|
@@ -15,13 +17,28 @@ export const Help = (props: HelpParams) => {
|
|
|
15
17
|
navigation
|
|
16
18
|
} = props
|
|
17
19
|
const [, t] = useLanguage()
|
|
20
|
+
const [refreshing] = useState(false);
|
|
21
|
+
const [refresh, setRefresh] = useState(false)
|
|
18
22
|
|
|
19
23
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
20
24
|
const onRedirect = (route: string, params?: any) => {
|
|
21
25
|
navigation.navigate(route, params)
|
|
22
26
|
}
|
|
27
|
+
|
|
28
|
+
const handleOnRefresh = () => {
|
|
29
|
+
setRefresh(true)
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
return (
|
|
24
|
-
|
|
33
|
+
<Container
|
|
34
|
+
noPadding
|
|
35
|
+
refreshControl={
|
|
36
|
+
<RefreshControl
|
|
37
|
+
refreshing={refreshing}
|
|
38
|
+
onRefresh={() => handleOnRefresh()}
|
|
39
|
+
/>
|
|
40
|
+
}
|
|
41
|
+
>
|
|
25
42
|
<NavBar
|
|
26
43
|
title={t('HELP', 'Help')}
|
|
27
44
|
titleAlign={'center'}
|
|
@@ -48,8 +65,8 @@ export const Help = (props: HelpParams) => {
|
|
|
48
65
|
|
|
49
66
|
<LastOrdersContainer>
|
|
50
67
|
<OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
|
|
51
|
-
<LastOrders {...props} onRedirect={onRedirect} />
|
|
68
|
+
<LastOrders {...props} onRedirect={onRedirect} refresh={refresh} setRefresh={setRefresh} />
|
|
52
69
|
</LastOrdersContainer>
|
|
53
|
-
|
|
70
|
+
</Container>
|
|
54
71
|
)
|
|
55
72
|
}
|
|
@@ -18,11 +18,15 @@ import {
|
|
|
18
18
|
OrderContainer,
|
|
19
19
|
OrderInfo
|
|
20
20
|
} from './styles'
|
|
21
|
+
import { useEffect } from 'react'
|
|
21
22
|
|
|
22
23
|
const LastOrdersUI = (props: LastOrdersParams) => {
|
|
23
24
|
const {
|
|
24
25
|
orderList,
|
|
25
|
-
onRedirect
|
|
26
|
+
onRedirect,
|
|
27
|
+
loadOrders,
|
|
28
|
+
refresh,
|
|
29
|
+
setRefresh
|
|
26
30
|
} = props
|
|
27
31
|
const { loading, error, orders } = orderList
|
|
28
32
|
|
|
@@ -46,6 +50,13 @@ const LastOrdersUI = (props: LastOrdersParams) => {
|
|
|
46
50
|
onRedirect && onRedirect('OrderDetails', { orderId: uuid })
|
|
47
51
|
}
|
|
48
52
|
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if(refresh){
|
|
55
|
+
loadOrders(false, false, false, true)
|
|
56
|
+
setRefresh && setRefresh(false)
|
|
57
|
+
}
|
|
58
|
+
}, [refresh])
|
|
59
|
+
|
|
49
60
|
return (
|
|
50
61
|
<>
|
|
51
62
|
{loading ? (
|
|
@@ -66,7 +66,6 @@ export const Otp = (props: otpParams) => {
|
|
|
66
66
|
<OTPInputView
|
|
67
67
|
style={{ width: '100%', height: 150 }}
|
|
68
68
|
pinCount={6}
|
|
69
|
-
autoFocusOnLoad
|
|
70
69
|
codeInputFieldStyle={loginStyle.underlineStyleBase}
|
|
71
70
|
codeInputHighlightStyle={loginStyle.underlineStyleHighLighted}
|
|
72
71
|
onCodeFilled={(code: string) => handleLoginOtp(code)}
|