ordering-ui-react-native 0.16.75-release → 0.16.76-release
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/themes/original/index.tsx +2 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +53 -31
- package/themes/original/src/components/Cart/index.tsx +7 -6
- package/themes/original/src/components/PageBanner/index.tsx +146 -0
- package/themes/original/src/components/PageBanner/styles.tsx +11 -0
- package/themes/original/src/types/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -97,6 +97,7 @@ import { UserFormDetailsUI } from './src/components/UserFormDetails';
|
|
|
97
97
|
import { WalletTransactionItem } from './src/components/WalletTransactionItem';
|
|
98
98
|
import { Promotions } from './src/components/Promotions'
|
|
99
99
|
import { MultiCart } from './src/components/MultiCart'
|
|
100
|
+
import { PageBanner } from './src/components/PageBanner'
|
|
100
101
|
import { USER_TYPE, ORDER_TYPES } from './src/config/constants'
|
|
101
102
|
|
|
102
103
|
import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from './src/components/OrderSummary/styles';
|
|
@@ -260,6 +261,7 @@ export {
|
|
|
260
261
|
UserFormDetailsUI,
|
|
261
262
|
WalletTransactionItem,
|
|
262
263
|
Promotions,
|
|
264
|
+
PageBanner,
|
|
263
265
|
MyOrders,
|
|
264
266
|
MultiCart,
|
|
265
267
|
ORDER_TYPES,
|
|
@@ -41,6 +41,7 @@ import Animated from 'react-native-reanimated'
|
|
|
41
41
|
import { ProfessionalFilter } from '../ProfessionalFilter';
|
|
42
42
|
import { ServiceForm } from '../ServiceForm';
|
|
43
43
|
import { BusinessesListing } from '../BusinessesListing/Layout/Original'
|
|
44
|
+
import { PageBanner } from '../PageBanner'
|
|
44
45
|
|
|
45
46
|
const PIXELS_TO_SCROLL = 2000
|
|
46
47
|
|
|
@@ -414,7 +415,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
414
415
|
<BackgroundGray isIos={Platform.OS === 'ios'} />
|
|
415
416
|
)}
|
|
416
417
|
<IOScrollView
|
|
417
|
-
stickyHeaderIndices={[business?.professionals?.length > 0 ?
|
|
418
|
+
stickyHeaderIndices={[business?.professionals?.length > 0 ? 3 : 2]}
|
|
418
419
|
style={{
|
|
419
420
|
...styles.mainContainer,
|
|
420
421
|
marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
|
|
@@ -451,6 +452,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
451
452
|
/>
|
|
452
453
|
</ProfessionalFilterWrapper>
|
|
453
454
|
)}
|
|
455
|
+
<PageBanner position='app_business_page' navigation={navigation} />
|
|
454
456
|
<View
|
|
455
457
|
style={{
|
|
456
458
|
height: 8,
|
|
@@ -591,7 +593,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
591
593
|
professionalList={business?.professionals}
|
|
592
594
|
professionalSelected={professionalSelected}
|
|
593
595
|
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
594
|
-
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
595
596
|
handleUpdateProfessionals={handleUpdateProfessionals}
|
|
596
597
|
onSave={() => setOpenService(false)}
|
|
597
598
|
onClose={() => setOpenService(false)}
|
|
@@ -18,8 +18,7 @@ import {
|
|
|
18
18
|
useSession,
|
|
19
19
|
useOrder,
|
|
20
20
|
useConfig,
|
|
21
|
-
useUtils
|
|
22
|
-
useOrderingTheme
|
|
21
|
+
useUtils
|
|
23
22
|
} from 'ordering-components/native';
|
|
24
23
|
import { useTheme } from 'styled-components/native';
|
|
25
24
|
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
@@ -53,6 +52,7 @@ import { OrderProgress } from '../../../OrderProgress';
|
|
|
53
52
|
import { useFocusEffect, useIsFocused } from '@react-navigation/native';
|
|
54
53
|
import FastImage from 'react-native-fast-image';
|
|
55
54
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
55
|
+
import { PageBanner } from '../../../PageBanner'
|
|
56
56
|
import { CitiesControl } from '../../../CitiesControl'
|
|
57
57
|
|
|
58
58
|
const PIXELS_TO_SCROLL = 2000;
|
|
@@ -73,13 +73,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
73
73
|
logosLayout
|
|
74
74
|
} = props;
|
|
75
75
|
const theme = useTheme();
|
|
76
|
-
const [orderingTheme] = useOrderingTheme()
|
|
77
76
|
const isFocused = useIsFocused();
|
|
77
|
+
|
|
78
|
+
const [, t] = useLanguage();
|
|
79
|
+
const [{ user, auth }] = useSession();
|
|
80
|
+
const [orderState, { changeCityFilter }] = useOrder();
|
|
81
|
+
const [{ configs }] = useConfig();
|
|
82
|
+
const [{ parseDate }] = useUtils();
|
|
83
|
+
|
|
78
84
|
const appState = useRef(AppState.currentState)
|
|
79
|
-
|
|
80
|
-
const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
|
|
85
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
81
86
|
const [refreshing] = useState(false);
|
|
82
|
-
const
|
|
87
|
+
const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
|
|
88
|
+
const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
|
|
89
|
+
const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
|
|
90
|
+
const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
|
|
91
|
+
const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
|
|
92
|
+
const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
|
|
93
|
+
const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
|
|
94
|
+
|
|
83
95
|
const styles = StyleSheet.create({
|
|
84
96
|
container: {
|
|
85
97
|
marginBottom: 0,
|
|
@@ -143,19 +155,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
143
155
|
},
|
|
144
156
|
});
|
|
145
157
|
|
|
146
|
-
|
|
147
|
-
const [, t] = useLanguage();
|
|
148
|
-
const [{ user, auth }] = useSession();
|
|
149
|
-
const [orderState, { changeCityFilter }] = useOrder();
|
|
150
|
-
const [{ configs }] = useConfig();
|
|
151
|
-
const [{ parseDate }] = useUtils();
|
|
152
|
-
|
|
153
158
|
const { top } = useSafeAreaInsets();
|
|
154
159
|
|
|
155
160
|
const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
|
|
156
161
|
const [isFarAway, setIsFarAway] = useState(false)
|
|
157
162
|
const [businessTypes, setBusinessTypes] = useState(null)
|
|
158
|
-
const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options
|
|
163
|
+
const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options?.value)
|
|
159
164
|
const [isOpenCities, setIsOpenCities] = useState(false)
|
|
160
165
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
161
166
|
Number(configs?.max_days_preorder?.value) > 0
|
|
@@ -465,18 +470,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
465
470
|
)}
|
|
466
471
|
</View>
|
|
467
472
|
{!isChewLayout ? (
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
473
|
+
<>
|
|
474
|
+
{!hideHero ? (
|
|
475
|
+
<HeaderWrapper
|
|
476
|
+
source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
|
|
477
|
+
style={{ paddingTop: top + 20 }}
|
|
478
|
+
resizeMode='cover'
|
|
479
|
+
bgHeaderHeight={bgHeaderHeight}
|
|
480
|
+
>
|
|
481
|
+
{!auth && (
|
|
482
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
483
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
484
|
+
</TouchableOpacity>
|
|
485
|
+
)}
|
|
486
|
+
</HeaderWrapper>
|
|
487
|
+
) : (
|
|
488
|
+
<>
|
|
489
|
+
{!auth && (
|
|
490
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
491
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
492
|
+
</TouchableOpacity>
|
|
493
|
+
)}
|
|
494
|
+
</>
|
|
478
495
|
)}
|
|
479
|
-
|
|
496
|
+
</>
|
|
480
497
|
) : (
|
|
481
498
|
<OrderTypesContainer>
|
|
482
499
|
<OrderTypeSelector
|
|
@@ -501,10 +518,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
501
518
|
</TouchableOpacity>
|
|
502
519
|
</View>
|
|
503
520
|
)}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
521
|
+
{!hidePreviousOrders && (
|
|
522
|
+
<OrderProgress
|
|
523
|
+
{...props}
|
|
524
|
+
isFocused={isFocused}
|
|
525
|
+
/>
|
|
526
|
+
)}
|
|
508
527
|
{
|
|
509
528
|
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
510
529
|
<FeaturedWrapper>
|
|
@@ -537,7 +556,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
537
556
|
</FeaturedWrapper>
|
|
538
557
|
)
|
|
539
558
|
}
|
|
540
|
-
{!isChewLayout && (
|
|
559
|
+
{!isChewLayout && !hideHighestBusiness && (
|
|
541
560
|
<>
|
|
542
561
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
543
562
|
{
|
|
@@ -552,9 +571,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
552
571
|
}
|
|
553
572
|
</>
|
|
554
573
|
)}
|
|
574
|
+
|
|
575
|
+
<PageBanner position='app_business_listing' navigation={navigation} />
|
|
576
|
+
|
|
555
577
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
556
578
|
<ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
557
|
-
{!businessId && (
|
|
579
|
+
{!businessId && !isAllCategoriesHidden && (
|
|
558
580
|
<BusinessTypeFilter
|
|
559
581
|
images={props.images}
|
|
560
582
|
businessTypes={props.businessTypes}
|
|
@@ -100,17 +100,18 @@ const CartUI = (props: any) => {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
const handleUpsellingPage = () => {
|
|
103
|
+
const handleUpsellingPage = (individualCart : any) => {
|
|
104
104
|
setOpenUpselling(false)
|
|
105
105
|
setCanOpenUpselling(false)
|
|
106
106
|
const cartsAvailable: any = Object.values(orderState?.carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
107
|
-
if (cartsAvailable.length === 1) {
|
|
107
|
+
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
108
|
+
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
108
109
|
onNavigationRedirect('CheckoutNavigator', {
|
|
109
110
|
screen: 'CheckoutPage',
|
|
110
|
-
cartUuid:
|
|
111
|
-
businessLogo:
|
|
112
|
-
businessName:
|
|
113
|
-
cartTotal:
|
|
111
|
+
cartUuid: cart?.uuid,
|
|
112
|
+
businessLogo: cart?.business?.logo,
|
|
113
|
+
businessName: cart?.business?.name,
|
|
114
|
+
cartTotal: cart?.total
|
|
114
115
|
})
|
|
115
116
|
} else {
|
|
116
117
|
const groupKeys: any = {}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import React, { useRef } from 'react'
|
|
2
|
+
import { useUtils, PageBanner as PageBannerController } from 'ordering-components/native'
|
|
3
|
+
import { View, StyleSheet, Dimensions, TouchableOpacity } from 'react-native'
|
|
4
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
|
+
import Carousel from 'react-native-snap-carousel'
|
|
6
|
+
import FastImage from 'react-native-fast-image';
|
|
7
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
|
+
import { useTheme } from 'styled-components/native';
|
|
9
|
+
import { PageBannerWrapper } from './styles'
|
|
10
|
+
|
|
11
|
+
const PageBannerUI = (props: any) => {
|
|
12
|
+
const {
|
|
13
|
+
pageBannerState,
|
|
14
|
+
navigation
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const [{ optimizeImage }] = useUtils();
|
|
19
|
+
const carouselRef = useRef(null)
|
|
20
|
+
|
|
21
|
+
const windowWidth = Dimensions.get('window').width;
|
|
22
|
+
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
mainSwiper: {
|
|
25
|
+
height: 300,
|
|
26
|
+
},
|
|
27
|
+
swiperButton: {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
zIndex: 100,
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
width: 32,
|
|
33
|
+
height: 32,
|
|
34
|
+
borderRadius: 16,
|
|
35
|
+
backgroundColor: 'rgba(208,208,208,0.5)'
|
|
36
|
+
},
|
|
37
|
+
sliderWrapper: {
|
|
38
|
+
width: '100%',
|
|
39
|
+
height: 300
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const onRedirect = (route: string, params?: any) => {
|
|
44
|
+
navigation.navigate(route, params)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const handleGoToPage = (action: any) => {
|
|
48
|
+
if (!action?.url) return
|
|
49
|
+
let slug
|
|
50
|
+
if (action.type === 'business') {
|
|
51
|
+
slug = action.url.split('store/')[1]
|
|
52
|
+
onRedirect('Business', {
|
|
53
|
+
store: slug
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
if (action.type === 'product') {
|
|
57
|
+
slug = action.url.split('store/')[1]?.split('?')[0]
|
|
58
|
+
onRedirect('ProductDetails', {
|
|
59
|
+
businessSlug: slug,
|
|
60
|
+
businessId: action.business_id,
|
|
61
|
+
categoryId: action.category_id,
|
|
62
|
+
productId: action.product_id
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const renderItem = ({ item, index }) => {
|
|
68
|
+
return (
|
|
69
|
+
<TouchableOpacity
|
|
70
|
+
onPress={() => handleGoToPage(item.action)}
|
|
71
|
+
>
|
|
72
|
+
<View style={styles.sliderWrapper}>
|
|
73
|
+
<FastImage
|
|
74
|
+
style={{ height: '100%', width: '100%' }}
|
|
75
|
+
resizeMode='cover'
|
|
76
|
+
source={{ uri: optimizeImage(item.url, 'h_300,c_limit') }}
|
|
77
|
+
/>
|
|
78
|
+
</View>
|
|
79
|
+
</TouchableOpacity>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
{pageBannerState.loading ? (
|
|
86
|
+
<PageBannerWrapper>
|
|
87
|
+
<Placeholder
|
|
88
|
+
Animation={Fade}
|
|
89
|
+
>
|
|
90
|
+
<PlaceholderLine
|
|
91
|
+
height={300}
|
|
92
|
+
style={{ marginBottom: 20, borderRadius: 8 }}
|
|
93
|
+
/>
|
|
94
|
+
</Placeholder>
|
|
95
|
+
</PageBannerWrapper>
|
|
96
|
+
) : (
|
|
97
|
+
<>
|
|
98
|
+
{pageBannerState.banner?.items && pageBannerState.banner?.items.length > 0 && (
|
|
99
|
+
<PageBannerWrapper>
|
|
100
|
+
<TouchableOpacity
|
|
101
|
+
style={[styles.swiperButton, { left: 25 }]}
|
|
102
|
+
onPress={() => carouselRef.current.snapToPrev()}
|
|
103
|
+
>
|
|
104
|
+
<IconAntDesign
|
|
105
|
+
name="caretleft"
|
|
106
|
+
color={theme.colors.white}
|
|
107
|
+
size={13}
|
|
108
|
+
/>
|
|
109
|
+
</TouchableOpacity>
|
|
110
|
+
<TouchableOpacity
|
|
111
|
+
style={[styles.swiperButton, { right: 25 }]}
|
|
112
|
+
onPress={() => carouselRef.current.snapToNext()}
|
|
113
|
+
>
|
|
114
|
+
<IconAntDesign
|
|
115
|
+
name="caretright"
|
|
116
|
+
color={theme.colors.white}
|
|
117
|
+
size={13}
|
|
118
|
+
/>
|
|
119
|
+
</TouchableOpacity>
|
|
120
|
+
<Carousel
|
|
121
|
+
ref={carouselRef}
|
|
122
|
+
loop={pageBannerState.banner?.items.length > 1}
|
|
123
|
+
data={pageBannerState.banner?.items}
|
|
124
|
+
renderItem={renderItem}
|
|
125
|
+
sliderWidth={windowWidth - 80}
|
|
126
|
+
itemWidth={windowWidth - 80}
|
|
127
|
+
inactiveSlideScale={1}
|
|
128
|
+
pagingEnabled
|
|
129
|
+
removeClippedSubviews={false}
|
|
130
|
+
inactiveSlideOpacity={1}
|
|
131
|
+
/>
|
|
132
|
+
</PageBannerWrapper>
|
|
133
|
+
)}
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
136
|
+
</>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const PageBanner = (props: any) => {
|
|
141
|
+
const pageBannerProps = {
|
|
142
|
+
...props,
|
|
143
|
+
UIComponent: PageBannerUI
|
|
144
|
+
}
|
|
145
|
+
return <PageBannerController {...pageBannerProps} />
|
|
146
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const PageBannerWrapper = styled.View`
|
|
4
|
+
margin-horizontal: 40px;
|
|
5
|
+
border-radius: 8px;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
margin-vertical: 30px;
|
|
8
|
+
position: relative;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
align-items: center;
|
|
11
|
+
`
|
|
@@ -584,7 +584,7 @@ export interface UpsellingProductsParams {
|
|
|
584
584
|
business?: any;
|
|
585
585
|
businessId?: number;
|
|
586
586
|
cartProducts?: Array<any>;
|
|
587
|
-
handleUpsellingPage: () => void;
|
|
587
|
+
handleUpsellingPage: (cart ?: any) => void;
|
|
588
588
|
openUpselling: boolean;
|
|
589
589
|
canOpenUpselling?: boolean;
|
|
590
590
|
setCanOpenUpselling?: (value: any) => void;
|