ordering-ui-react-native 0.16.17 → 0.16.20
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/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +1 -1
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +4 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +80 -58
- package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +7 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
- package/themes/original/src/components/SearchBar/index.tsx +7 -4
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { StyleSheet, View, ScrollView, Dimensions, Platform, PlatformIOSStatic,
|
|
2
|
+
import { StyleSheet, View, ScrollView, Dimensions, Platform, PlatformIOSStatic, TouchableOpacity } from 'react-native'
|
|
3
3
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
4
4
|
import { BusinessTypeFilter as BusinessTypeFilterController, useLanguage } from 'ordering-components/native'
|
|
5
5
|
|
|
@@ -9,7 +9,6 @@ import { BusinessTypeFilterParams } from '../../types'
|
|
|
9
9
|
import { useTheme } from 'styled-components/native'
|
|
10
10
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
11
11
|
import DeviceInfo from 'react-native-device-info';
|
|
12
|
-
import { TouchableOpacity } from 'react-native-gesture-handler'
|
|
13
12
|
|
|
14
13
|
const windowWidth = Dimensions.get('window').width;
|
|
15
14
|
|
|
@@ -45,7 +45,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
45
45
|
}, [orderState?.carts])
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<BIContainer isClosed={isClosed} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
|
|
48
|
+
<BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
|
|
49
49
|
<BIHeader
|
|
50
50
|
isClosed={isClosed}
|
|
51
51
|
onPress={() => !isClosed ? setActiveState(!isActive) : isClosed}
|
|
@@ -7,8 +7,12 @@ export const BIContainer = styled.View`
|
|
|
7
7
|
opacity: 1;
|
|
8
8
|
border-radius: 7.6px;
|
|
9
9
|
overflow: hidden;
|
|
10
|
+
${(props: any) => !props.isMultiCheckout && css`
|
|
11
|
+
min-height: 120px;
|
|
12
|
+
`}
|
|
10
13
|
${(props: any) => props.isClosed && css`
|
|
11
14
|
opacity: 0.5;
|
|
15
|
+
min-height: 60px;
|
|
12
16
|
`}
|
|
13
17
|
`
|
|
14
18
|
|
|
@@ -31,7 +31,8 @@ import {
|
|
|
31
31
|
ListWrapper,
|
|
32
32
|
FeaturedWrapper,
|
|
33
33
|
OrderProgressWrapper,
|
|
34
|
-
FarAwayMessage
|
|
34
|
+
FarAwayMessage,
|
|
35
|
+
AddressInputContainer
|
|
35
36
|
} from './styles';
|
|
36
37
|
|
|
37
38
|
import { SearchBar } from '../SearchBar';
|
|
@@ -84,7 +85,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
84
85
|
wrapperOrderOptions: {
|
|
85
86
|
width: '100%',
|
|
86
87
|
flexDirection: 'row',
|
|
87
|
-
justifyContent: '
|
|
88
|
+
justifyContent: 'center',
|
|
88
89
|
marginBottom: 10,
|
|
89
90
|
zIndex: 100,
|
|
90
91
|
},
|
|
@@ -94,7 +95,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
94
95
|
borderRadius: 10,
|
|
95
96
|
},
|
|
96
97
|
searchInput: {
|
|
97
|
-
fontSize:
|
|
98
|
+
fontSize: 16,
|
|
99
|
+
backgroundColor: theme.colors.white,
|
|
100
|
+
paddingLeft: 10,
|
|
101
|
+
paddingTop: 7
|
|
98
102
|
},
|
|
99
103
|
iconStyle: {
|
|
100
104
|
fontSize: 18,
|
|
@@ -104,6 +108,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
104
108
|
farAwayMsg: {
|
|
105
109
|
paddingVertical: 6,
|
|
106
110
|
paddingHorizontal: 20
|
|
111
|
+
},
|
|
112
|
+
inputContainerStyles: {
|
|
113
|
+
backgroundColor: theme.colors.white,
|
|
114
|
+
borderColor: theme.colors.backgroundGray,
|
|
115
|
+
borderWidth: 1,
|
|
107
116
|
}
|
|
108
117
|
});
|
|
109
118
|
|
|
@@ -124,7 +133,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
124
133
|
Number(configs?.max_days_preorder?.value) > 0
|
|
125
134
|
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
126
135
|
const timerId = useRef<any>(false)
|
|
127
|
-
|
|
136
|
+
const [favoriteIds, setFavoriteIds] = useState<any>([])
|
|
128
137
|
|
|
129
138
|
// const panResponder = useRef(
|
|
130
139
|
// PanResponder.create({
|
|
@@ -219,7 +228,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
219
228
|
}, [orderState?.options?.address?.location])
|
|
220
229
|
|
|
221
230
|
useEffect(() => {
|
|
222
|
-
if(!orderState?.loading){
|
|
231
|
+
if (!orderState?.loading) {
|
|
223
232
|
setOrderTypeValue(orderState?.options?.type)
|
|
224
233
|
}
|
|
225
234
|
}, [orderState?.options?.type])
|
|
@@ -232,15 +241,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
232
241
|
)
|
|
233
242
|
|
|
234
243
|
useEffect(() => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
+
if (!businessesList?.businesses?.length) return
|
|
245
|
+
const ids = [...favoriteIds]
|
|
246
|
+
businessesList.businesses.forEach((business: any) => {
|
|
247
|
+
if (business?.favorite) {
|
|
248
|
+
ids.push(business?.id)
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
setFavoriteIds([...new Set(ids)])
|
|
252
|
+
}, [businessesList?.businesses?.length])
|
|
244
253
|
|
|
245
254
|
return (
|
|
246
255
|
<ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
|
|
@@ -251,15 +260,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
251
260
|
/>
|
|
252
261
|
}
|
|
253
262
|
>
|
|
254
|
-
<
|
|
255
|
-
source={theme.images.backgrounds.business_list_header}
|
|
256
|
-
style={{ paddingTop: top + 20 }}>
|
|
257
|
-
{!auth && (
|
|
258
|
-
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
259
|
-
<OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
|
|
260
|
-
</TouchableOpacity>
|
|
261
|
-
)}
|
|
262
|
-
|
|
263
|
+
<View style={{ height: isFarAway ? 150 : 100, marginTop: Platform.OS == 'ios' ? 0 : 50 }}>
|
|
263
264
|
<Search>
|
|
264
265
|
<AddressInput
|
|
265
266
|
onPress={() =>
|
|
@@ -271,15 +272,22 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
271
272
|
isGuestUser: isGuestUser
|
|
272
273
|
})
|
|
273
274
|
}>
|
|
274
|
-
<
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
{
|
|
282
|
-
|
|
275
|
+
<AddressInputContainer>
|
|
276
|
+
<OIcon
|
|
277
|
+
src={theme.images.general.pin}
|
|
278
|
+
color={theme.colors.disabled}
|
|
279
|
+
width={16}
|
|
280
|
+
style={{ marginRight: 10 }}
|
|
281
|
+
/>
|
|
282
|
+
<OText size={12} numberOfLines={1}>
|
|
283
|
+
{orderState?.options?.address?.address}
|
|
284
|
+
</OText>
|
|
285
|
+
<OIcon
|
|
286
|
+
src={theme.images.general.arrow_down}
|
|
287
|
+
width={10}
|
|
288
|
+
style={{ marginStart: 8 }}
|
|
289
|
+
/>
|
|
290
|
+
</AddressInputContainer>
|
|
283
291
|
</AddressInput>
|
|
284
292
|
</Search>
|
|
285
293
|
{isFarAway && (
|
|
@@ -288,16 +296,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
288
296
|
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
289
297
|
</FarAwayMessage>
|
|
290
298
|
)}
|
|
299
|
+
|
|
291
300
|
<OrderControlContainer>
|
|
292
301
|
<View style={styles.wrapperOrderOptions}>
|
|
293
|
-
<WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
|
|
294
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
295
|
-
<OIcon
|
|
296
|
-
src={theme.images.general.arrow_down}
|
|
297
|
-
width={10}
|
|
298
|
-
style={{ marginStart: 8 }}
|
|
299
|
-
/>
|
|
300
|
-
</WrapMomentOption>
|
|
301
302
|
{isPreOrderSetting && (
|
|
302
303
|
<WrapMomentOption
|
|
303
304
|
onPress={() => handleMomentClick()}>
|
|
@@ -319,27 +320,48 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
319
320
|
)}
|
|
320
321
|
</WrapMomentOption>
|
|
321
322
|
)}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
<
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
isCancelXButtonShow={!!searchValue}
|
|
329
|
-
borderStyle={styles.borderStyle}
|
|
330
|
-
onCancel={() => handleChangeSearch('')}
|
|
331
|
-
placeholder={t('SEARCH', 'Search')}
|
|
332
|
-
height={26}
|
|
333
|
-
isDisabled={!businessTypes}
|
|
334
|
-
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
|
|
335
|
-
onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
|
|
323
|
+
<WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
|
|
324
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
325
|
+
<OIcon
|
|
326
|
+
src={theme.images.general.arrow_down}
|
|
327
|
+
width={10}
|
|
328
|
+
style={{ marginStart: 8 }}
|
|
336
329
|
/>
|
|
337
|
-
|
|
338
|
-
|
|
330
|
+
</WrapMomentOption>
|
|
339
331
|
</View>
|
|
340
332
|
</OrderControlContainer>
|
|
333
|
+
</View>
|
|
334
|
+
<HeaderWrapper
|
|
335
|
+
source={theme.images.backgrounds.business_list_header}
|
|
336
|
+
style={{ paddingTop: top + 20 }}
|
|
337
|
+
resizeMode='stretch'
|
|
338
|
+
>
|
|
339
|
+
{!auth && (
|
|
340
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
341
|
+
<OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
|
|
342
|
+
</TouchableOpacity>
|
|
343
|
+
)}
|
|
341
344
|
</HeaderWrapper>
|
|
342
|
-
|
|
345
|
+
{!businessId && (
|
|
346
|
+
<SearchBar
|
|
347
|
+
onSearch={handleChangeSearch}
|
|
348
|
+
searchValue={searchValue}
|
|
349
|
+
lazyLoad
|
|
350
|
+
hideIcon
|
|
351
|
+
isCancelXButtonShow={!!searchValue}
|
|
352
|
+
onCancel={() => handleChangeSearch('')}
|
|
353
|
+
placeholder={t('SEARCH', 'Search')}
|
|
354
|
+
height={50}
|
|
355
|
+
isDisabled={!businessTypes}
|
|
356
|
+
inputContainerStyles={styles.inputContainerStyles}
|
|
357
|
+
containerStyles={{
|
|
358
|
+
marginHorizontal: 40,
|
|
359
|
+
marginTop: 20
|
|
360
|
+
}}
|
|
361
|
+
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
|
|
362
|
+
onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
|
|
363
|
+
/>
|
|
364
|
+
)}
|
|
343
365
|
<OrderProgressWrapper>
|
|
344
366
|
<OrderProgress
|
|
345
367
|
{...props}
|
|
@@ -408,7 +430,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
408
430
|
/>
|
|
409
431
|
)}
|
|
410
432
|
{businessesList.businesses?.map(
|
|
411
|
-
(business: any, i
|
|
433
|
+
(business: any, i: number) => (
|
|
412
434
|
<BusinessController
|
|
413
435
|
key={`${business.id}_` + i}
|
|
414
436
|
business={business}
|
|
@@ -15,6 +15,7 @@ export const Search = styled.View`
|
|
|
15
15
|
justify-content: flex-end;
|
|
16
16
|
align-items: center;
|
|
17
17
|
margin-vertical: 10px;
|
|
18
|
+
margin-horizontal: 20px;
|
|
18
19
|
`
|
|
19
20
|
|
|
20
21
|
export const AddressInput = styled.TouchableOpacity`
|
|
@@ -39,7 +40,7 @@ export const OrderControlContainer = styled.View`
|
|
|
39
40
|
`
|
|
40
41
|
|
|
41
42
|
export const WrapMomentOption = styled.TouchableOpacity`
|
|
42
|
-
background-color: ${(props: any) => props.theme.colors.
|
|
43
|
+
background-color: ${(props: any) => props.theme.colors.white};
|
|
43
44
|
border-radius: 7.6px;
|
|
44
45
|
font-size: 12px;
|
|
45
46
|
max-width: 240px;
|
|
@@ -53,7 +54,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
|
|
|
53
54
|
|
|
54
55
|
export const HeaderWrapper = styled.ImageBackground`
|
|
55
56
|
width: 100%;
|
|
56
|
-
height:
|
|
57
|
+
height: 270px;
|
|
57
58
|
padding: 20px 40px;
|
|
58
59
|
background-color: transparent;
|
|
59
60
|
`;
|
|
@@ -79,7 +80,14 @@ export const FarAwayMessage = styled.View`
|
|
|
79
80
|
flex-direction: row;
|
|
80
81
|
align-items: center;
|
|
81
82
|
background-color: ${(props: any) => props.theme.colors.warning1};
|
|
82
|
-
margin-bottom:
|
|
83
|
+
margin-bottom: 10px;
|
|
83
84
|
border-radius: 7.6px;
|
|
84
85
|
border: 1px solid ${(props: any) => props.theme.colors.warning5};
|
|
85
86
|
`
|
|
87
|
+
|
|
88
|
+
export const AddressInputContainer = styled.View`
|
|
89
|
+
flex-direction: row;
|
|
90
|
+
width: 100%;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center
|
|
93
|
+
`
|
|
@@ -77,7 +77,8 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
77
77
|
|
|
78
78
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
79
79
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
80
|
-
const
|
|
80
|
+
const maximumCarts = 5
|
|
81
|
+
const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || openCarts.length > maximumCarts
|
|
81
82
|
|
|
82
83
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
83
84
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
@@ -265,6 +266,11 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
265
266
|
</OText>
|
|
266
267
|
</ChCartsTotal>
|
|
267
268
|
)}
|
|
269
|
+
{openCarts.length > maximumCarts && (
|
|
270
|
+
<OText size={14} color={theme.colors.danger5} style={{ marginVertical: 20 }}>
|
|
271
|
+
{t('WARNING_MAXIMUM_CARTS', 'You can only pay for a maximum of 5 carts, please discard one or more to continue.')}
|
|
272
|
+
</OText>
|
|
273
|
+
)}
|
|
268
274
|
</ChCarts>
|
|
269
275
|
</ChSection>
|
|
270
276
|
</ChContainer>
|
|
@@ -22,7 +22,10 @@ export const SearchBar = (props: any) => {
|
|
|
22
22
|
isDisabled,
|
|
23
23
|
iconCustomRight,
|
|
24
24
|
onSubmitEditing,
|
|
25
|
-
blurOnSubmit
|
|
25
|
+
blurOnSubmit,
|
|
26
|
+
inputContainerStyles,
|
|
27
|
+
containerStyles,
|
|
28
|
+
hideIcon
|
|
26
29
|
} = props
|
|
27
30
|
|
|
28
31
|
const theme = useTheme();
|
|
@@ -77,13 +80,13 @@ export const SearchBar = (props: any) => {
|
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
return (
|
|
80
|
-
<Pressable style={[styles.container, { height: height }]}>
|
|
83
|
+
<Pressable style={[styles.container, containerStyles, { height: height }]}>
|
|
81
84
|
<OInput
|
|
82
85
|
value={searchValue}
|
|
83
86
|
onChange={onChangeSearch}
|
|
84
|
-
style={styles.inputStyle}
|
|
87
|
+
style={{...styles.inputStyle, ...inputContainerStyles}}
|
|
85
88
|
placeholder={placeholder}
|
|
86
|
-
icon={theme.images.general.search}
|
|
89
|
+
icon={!hideIcon && theme.images.general.search}
|
|
87
90
|
isDisabled={isDisabled}
|
|
88
91
|
iconStyle={{ width: 12 }}
|
|
89
92
|
returnKeyType='done'
|