ordering-ui-react-native 0.17.85 → 0.17.87
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/business/src/components/MapView/index.tsx +2 -2
- package/themes/business/src/components/ProductItemAccordion/index.tsx +21 -3
- package/themes/original/src/components/AddressForm/index.tsx +26 -22
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +91 -70
- package/themes/original/src/components/BusinessController/index.tsx +71 -49
- package/themes/original/src/components/BusinessProductsListing/index.tsx +32 -44
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +48 -30
- package/themes/original/src/components/Cart/index.tsx +36 -71
- package/themes/original/src/components/CartContent/index.tsx +47 -2
- package/themes/original/src/components/CartContent/styles.tsx +10 -0
- package/themes/original/src/components/Checkout/index.tsx +40 -32
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MultiCart/index.tsx +41 -54
- package/themes/original/src/components/MultiCheckout/index.tsx +2 -7
- package/themes/original/src/components/MyOrders/index.tsx +9 -7
- package/themes/original/src/components/OrderDetails/index.tsx +99 -73
- package/themes/original/src/components/OrderTypeSelector/index.tsx +6 -4
- package/themes/original/src/components/PageBanner/index.tsx +60 -33
- package/themes/original/src/components/PageBanner/styles.tsx +0 -7
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/ProductForm/index.tsx +2 -2
- package/themes/original/src/components/SingleOrderCard/index.tsx +58 -44
- package/themes/original/src/components/SingleProductCard/index.tsx +51 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +11 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +243 -216
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserProfile/index.tsx +82 -53
- package/themes/original/src/components/shared/OButton.tsx +5 -1
- package/themes/original/src/components/shared/OInput.tsx +8 -2
- package/themes/original/src/types/index.tsx +3 -0
- package/themes/original/src/utils/index.tsx +11 -0
package/package.json
CHANGED
|
@@ -103,7 +103,7 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
103
103
|
return () => {
|
|
104
104
|
stopFollowUserLocation();
|
|
105
105
|
};
|
|
106
|
-
}, []);
|
|
106
|
+
}, [isFocused]);
|
|
107
107
|
|
|
108
108
|
useFocusEffect(
|
|
109
109
|
useCallback(() => {
|
|
@@ -252,7 +252,7 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
252
252
|
orderIds={marker.map((order: any) => order.id).join(', ')}
|
|
253
253
|
/>
|
|
254
254
|
))}
|
|
255
|
-
{Object.values(customerMarkerGroups).map((marker: any) =>
|
|
255
|
+
{Object.values(customerMarkerGroups).map((marker: any) => (
|
|
256
256
|
<RenderMarker
|
|
257
257
|
key={marker[0]?.customer_id}
|
|
258
258
|
marker={marker[0]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { View, Animated } from 'react-native';
|
|
1
|
+
import React, { useEffect, useState, useCallback } from 'react';
|
|
2
|
+
import { View, Animated, TouchableOpacity } from 'react-native';
|
|
3
3
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
4
4
|
import { useUtils, useLanguage } from 'ordering-components/native';
|
|
5
5
|
import { useTheme } from 'styled-components/native';
|
|
@@ -36,6 +36,8 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
36
36
|
const [{ parsePrice }] = useUtils();
|
|
37
37
|
|
|
38
38
|
const [isActive, setActiveState] = useState(false);
|
|
39
|
+
const [isReadMore, setIsReadMore] = useState(false);
|
|
40
|
+
const [lengthMore, setLengthMore] = useState(false);
|
|
39
41
|
|
|
40
42
|
const productInfo = () => {
|
|
41
43
|
if (isCartProduct) {
|
|
@@ -108,6 +110,10 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
108
110
|
}
|
|
109
111
|
}, []);
|
|
110
112
|
|
|
113
|
+
const onTextLayout = useCallback((e: any) => {
|
|
114
|
+
setLengthMore(e.nativeEvent.lines.length >= 3); //to check the text is more than 2 lines or not
|
|
115
|
+
},[]);
|
|
116
|
+
|
|
111
117
|
return (
|
|
112
118
|
<AccordionSection>
|
|
113
119
|
<Accordion
|
|
@@ -288,9 +294,21 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
288
294
|
color={theme.colors.unselectText}>
|
|
289
295
|
{t('COMMENT', 'Comment')}
|
|
290
296
|
</OText>
|
|
291
|
-
<OText
|
|
297
|
+
<OText
|
|
298
|
+
size={12}
|
|
299
|
+
style={{ width: '100%', paddingLeft: 10 }}
|
|
300
|
+
color={theme.colors.unselectText}
|
|
301
|
+
onTextLayout={onTextLayout}
|
|
302
|
+
numberOfLines={isReadMore ? 15 : 2}
|
|
303
|
+
ellipsizeMode="tail"
|
|
304
|
+
>
|
|
292
305
|
{product.comment}
|
|
293
306
|
</OText>
|
|
307
|
+
{lengthMore && (
|
|
308
|
+
<TouchableOpacity onPress={() => setIsReadMore(!isReadMore)} style={{ marginLeft: 10 }}>
|
|
309
|
+
<OText size={10} color={theme.colors.statusOrderBlue}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
310
|
+
</TouchableOpacity>
|
|
311
|
+
)}
|
|
294
312
|
</ProductComment>
|
|
295
313
|
)}
|
|
296
314
|
</AccordionContent>
|
|
@@ -160,6 +160,8 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
160
160
|
const maxLimitLocation =
|
|
161
161
|
configState?.configs?.meters_to_change_address?.value;
|
|
162
162
|
const countryCode = configState?.configs?.country_autocomplete?.value
|
|
163
|
+
const isHideMap = theme?.address?.components?.map?.hidden
|
|
164
|
+
const isHideIcons = theme?.address?.components?.icons?.hidden
|
|
163
165
|
const continueAsGuest = () => navigation.navigate('BusinessList', { isGuestUser: true });
|
|
164
166
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack();
|
|
165
167
|
|
|
@@ -631,7 +633,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
631
633
|
)}
|
|
632
634
|
</AutocompleteInput>
|
|
633
635
|
|
|
634
|
-
{(locationChange || formState.changes?.location) && (
|
|
636
|
+
{!isHideMap && (locationChange || formState.changes?.location) && (
|
|
635
637
|
<View
|
|
636
638
|
style={{
|
|
637
639
|
height: 189,
|
|
@@ -789,27 +791,29 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
789
791
|
/>
|
|
790
792
|
)}
|
|
791
793
|
</FormInput>
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
794
|
+
{!isHideIcons && (
|
|
795
|
+
<IconsContainer>
|
|
796
|
+
{tagsName.map((tag) => (
|
|
797
|
+
<TouchableOpacity
|
|
798
|
+
key={tag.value}
|
|
799
|
+
onPress={() => handleAddressTag(tag.value)}>
|
|
800
|
+
<View
|
|
801
|
+
style={{
|
|
802
|
+
...styles.iconContainer,
|
|
803
|
+
}}>
|
|
804
|
+
<OIcon
|
|
805
|
+
src={tag.icon}
|
|
806
|
+
width={24}
|
|
807
|
+
color={
|
|
808
|
+
addressTag === tag.value ?
|
|
809
|
+
theme.colors.primary : theme.colors.disabled
|
|
810
|
+
}
|
|
811
|
+
/>
|
|
812
|
+
</View>
|
|
813
|
+
</TouchableOpacity>
|
|
814
|
+
))}
|
|
815
|
+
</IconsContainer>
|
|
816
|
+
)}
|
|
813
817
|
</View>
|
|
814
818
|
|
|
815
819
|
<View>
|
|
@@ -47,7 +47,15 @@ export const BusinessBasicInformation = (
|
|
|
47
47
|
const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
|
|
48
48
|
const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
|
|
49
49
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
50
|
-
const
|
|
50
|
+
const hideLogo = theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
|
|
51
|
+
const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
|
|
52
|
+
const hideTime = theme?.business_view?.components?.header?.components?.business?.components?.time?.hidden
|
|
53
|
+
const hideReviews = theme?.business_view?.components?.header?.components?.business?.components?.reviews?.hidden
|
|
54
|
+
const hideReviewsPopup = theme?.business_view?.components?.header?.components?.reviews?.hidden
|
|
55
|
+
const hideDistance = theme?.business_view?.components?.header?.components?.business?.components?.distance?.hidden
|
|
56
|
+
const hideInfoIcon = theme?.business_view?.components?.header?.components?.business?.components?.business_info?.hidden
|
|
57
|
+
const hideCity = theme?.business_view?.components?.header?.components?.business?.components?.city?.hidden
|
|
58
|
+
const hideHeader = theme?.business_view?.components?.header?.hidden
|
|
51
59
|
|
|
52
60
|
const styles = StyleSheet.create({
|
|
53
61
|
businesInfoheaderStyle: {
|
|
@@ -249,9 +257,9 @@ export const BusinessBasicInformation = (
|
|
|
249
257
|
iconTitle='snapchat'
|
|
250
258
|
/>
|
|
251
259
|
)}
|
|
252
|
-
{isChewLayout && (
|
|
260
|
+
{isChewLayout && !hideInfoIcon && (
|
|
253
261
|
<TouchableOpacity onPress={() => handleClickBusinessInformation()}>
|
|
254
|
-
<OText
|
|
262
|
+
<OText
|
|
255
263
|
color={theme.colors.primary}
|
|
256
264
|
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
257
265
|
size={12}
|
|
@@ -267,44 +275,46 @@ export const BusinessBasicInformation = (
|
|
|
267
275
|
}
|
|
268
276
|
|
|
269
277
|
return (
|
|
270
|
-
<BusinessContainer isChewLayout={isChewLayout &&
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
<
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
<
|
|
293
|
-
{
|
|
294
|
-
|
|
295
|
-
{business?.city?.name && (
|
|
296
|
-
<OText>
|
|
297
|
-
{business?.city?.name}
|
|
278
|
+
<BusinessContainer isChewLayout={isChewLayout && hideLogo}>
|
|
279
|
+
{!hideHeader && (
|
|
280
|
+
<BusinessHeader
|
|
281
|
+
isChewLayout={isChewLayout}
|
|
282
|
+
style={
|
|
283
|
+
isBusinessInfoShow
|
|
284
|
+
? styles.businesInfoheaderStyle
|
|
285
|
+
: { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
|
|
286
|
+
}
|
|
287
|
+
{...(!loading && {
|
|
288
|
+
source: (header || businessState?.business?.header) ? {
|
|
289
|
+
uri: header || optimizeImage(businessState?.business?.header, 'h_250,c_limit')
|
|
290
|
+
} : theme?.images?.dummies?.businessHeader
|
|
291
|
+
})}
|
|
292
|
+
imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
|
|
293
|
+
>
|
|
294
|
+
{!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
|
|
295
|
+
<WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
|
|
296
|
+
<OIcon src={theme.images.general.info} width={24} />
|
|
297
|
+
</WrapBusinessInfo>
|
|
298
|
+
)}
|
|
299
|
+
{isChewLayout && !loading && (
|
|
300
|
+
<View style={styles.headerChewStyle}>
|
|
301
|
+
<OText size={24} weight={'600'} mBottom={-5}>
|
|
302
|
+
{business?.name}
|
|
298
303
|
</OText>
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
304
|
+
{business?.city?.name && !hideCity && (
|
|
305
|
+
<OText>
|
|
306
|
+
{business?.city?.name}
|
|
307
|
+
</OText>
|
|
308
|
+
)}
|
|
309
|
+
<View style={styles.socialIconsChewContainer}>
|
|
310
|
+
<SocialIcons />
|
|
311
|
+
</View>
|
|
302
312
|
</View>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
313
|
+
)}
|
|
314
|
+
</BusinessHeader>
|
|
315
|
+
)}
|
|
306
316
|
<BusinessInfo style={styles.businessInfo}>
|
|
307
|
-
{
|
|
317
|
+
{!hideLogo && (
|
|
308
318
|
<BusinessLogo isChewLayout={isChewLayout}>
|
|
309
319
|
{!isBusinessInfoShow && (
|
|
310
320
|
logo || businessState?.business?.logo ?
|
|
@@ -384,34 +394,43 @@ export const BusinessBasicInformation = (
|
|
|
384
394
|
</Placeholder>
|
|
385
395
|
)}
|
|
386
396
|
<View style={styles.bullet}>
|
|
387
|
-
|
|
388
|
-
{`${t('DELIVERY_FEE', 'Delivery fee')} ${business && parsePrice(business?.delivery_price || 0)} \u2022 `}
|
|
389
|
-
</OText>
|
|
390
|
-
{orderState?.options?.type === 1 ? (
|
|
397
|
+
{!hideDeliveryFee && (
|
|
391
398
|
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
392
|
-
{
|
|
399
|
+
{`${t('DELIVERY_FEE', 'Delivery fee')} ${business && parsePrice(business?.delivery_price || 0)} \u2022 `}
|
|
393
400
|
</OText>
|
|
394
|
-
)
|
|
401
|
+
)}
|
|
402
|
+
{!hideTime && (
|
|
403
|
+
<>
|
|
404
|
+
{orderState?.options?.type === 1 ? (
|
|
405
|
+
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
406
|
+
{convertHoursToMinutes(business?.delivery_time) + ` \u2022 `}
|
|
407
|
+
</OText>
|
|
408
|
+
) : (
|
|
409
|
+
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
410
|
+
{convertHoursToMinutes(business?.pickup_time) + ` \u2022 `}
|
|
411
|
+
</OText>
|
|
412
|
+
)}
|
|
413
|
+
</>
|
|
414
|
+
)}
|
|
415
|
+
{!hideDistance && (
|
|
395
416
|
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
396
|
-
{
|
|
417
|
+
{parseDistance(business?.distance || 0) + ` \u2022 `}
|
|
397
418
|
</OText>
|
|
398
419
|
)}
|
|
399
|
-
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
400
|
-
{parseDistance(business?.distance || 0) + ` \u2022 `}
|
|
401
|
-
</OText>
|
|
402
|
-
</View>
|
|
403
|
-
|
|
404
|
-
<View style={styles.reviewStyle}>
|
|
405
|
-
<OIcon
|
|
406
|
-
src={theme.images.general.star}
|
|
407
|
-
width={14}
|
|
408
|
-
color={theme.colors.textSecondary}
|
|
409
|
-
style={{ marginTop: -2, marginEnd: 2 }}
|
|
410
|
-
/>
|
|
411
|
-
<OText size={12} color={theme.colors.textSecondary}>
|
|
412
|
-
{business?.reviews?.total}
|
|
413
|
-
</OText>
|
|
414
420
|
</View>
|
|
421
|
+
{!hideReviews && (
|
|
422
|
+
<View style={styles.reviewStyle}>
|
|
423
|
+
<OIcon
|
|
424
|
+
src={theme.images.general.star}
|
|
425
|
+
width={14}
|
|
426
|
+
color={theme.colors.textSecondary}
|
|
427
|
+
style={{ marginTop: -2, marginEnd: 2 }}
|
|
428
|
+
/>
|
|
429
|
+
<OText size={12} color={theme.colors.textSecondary}>
|
|
430
|
+
{business?.reviews?.total}
|
|
431
|
+
</OText>
|
|
432
|
+
</View>
|
|
433
|
+
)}
|
|
415
434
|
</BusinessInfoItem>
|
|
416
435
|
</View>
|
|
417
436
|
<WrapReviews>
|
|
@@ -420,7 +439,7 @@ export const BusinessBasicInformation = (
|
|
|
420
439
|
{isPreOrder && (!business?.professionals || business?.professionals?.length === 0) && (
|
|
421
440
|
<>
|
|
422
441
|
<TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
|
|
423
|
-
<OText
|
|
442
|
+
<OText
|
|
424
443
|
color={theme.colors.primary}
|
|
425
444
|
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
426
445
|
size={12}
|
|
@@ -431,15 +450,17 @@ export const BusinessBasicInformation = (
|
|
|
431
450
|
<OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
432
451
|
</>
|
|
433
452
|
)}
|
|
434
|
-
|
|
435
|
-
<
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
453
|
+
{!hideReviewsPopup && (
|
|
454
|
+
<TouchableOpacity onPress={() => handleClickBusinessReviews()}>
|
|
455
|
+
<OText
|
|
456
|
+
color={theme.colors.primary}
|
|
457
|
+
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
458
|
+
size={12}
|
|
459
|
+
>
|
|
460
|
+
{t('REVIEWS', 'Reviews')}
|
|
461
|
+
</OText>
|
|
462
|
+
</TouchableOpacity>
|
|
463
|
+
)}
|
|
443
464
|
</>
|
|
444
465
|
)}
|
|
445
466
|
</WrapReviews>
|
|
@@ -65,6 +65,16 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
65
65
|
const windowHeight = Dimensions.get('window').height
|
|
66
66
|
const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
|
|
67
67
|
|
|
68
|
+
const hideBusinessLogo = theme?.business_listing_view?.components?.business?.components?.logo?.hidden
|
|
69
|
+
const hideBusinessFee = theme?.business_listing_view?.components?.business?.components?.fee?.hidden
|
|
70
|
+
const hideBusinessTime = theme?.business_listing_view?.components?.business?.components?.time?.hidden
|
|
71
|
+
const hideBusinessDistance = theme?.business_listing_view?.components?.business?.components?.distance?.hidden
|
|
72
|
+
const hideBusinessReviews = theme?.business_listing_view?.components?.business?.components?.reviews?.hidden
|
|
73
|
+
const hideBusinessFavorite = theme?.business_listing_view?.components?.business?.components?.favorite?.hidden
|
|
74
|
+
const hideBusinessOffer = theme?.business_listing_view?.components?.business?.components?.offer?.hidden
|
|
75
|
+
const hideBusinessHeader = theme?.business_listing_view?.components?.business?.components?.header?.hidden
|
|
76
|
+
const hideBusinessFavoriteBadge = theme?.business_listing_view?.components?.business?.components?.featured_badge?.hidden
|
|
77
|
+
|
|
68
78
|
const textSize = isCustomLayout ? 12 : 10
|
|
69
79
|
const cardHeight = windowHeight * 0.3
|
|
70
80
|
|
|
@@ -191,20 +201,22 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
191
201
|
</RibbonBox>
|
|
192
202
|
)}
|
|
193
203
|
<BusinessHero>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
{!hideBusinessHeader && (
|
|
205
|
+
<FastImage
|
|
206
|
+
style={{ height: isCustomLayout ? cardHeight * 0.66 : 120 }}
|
|
207
|
+
source={(businessHeader || business?.header) ? {
|
|
208
|
+
uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
|
|
209
|
+
priority: FastImage.priority.normal,
|
|
210
|
+
} : theme.images.dummies.businessHeader}
|
|
211
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
212
|
+
/>
|
|
213
|
+
)}
|
|
214
|
+
{(businessFeatured ?? business?.featured) && !hideBusinessFavoriteBadge && (
|
|
203
215
|
<View style={styles.featured}>
|
|
204
216
|
<FontAwesomeIcon name="crown" size={26} color="gold" />
|
|
205
217
|
</View>
|
|
206
218
|
)}
|
|
207
|
-
{(!isCustomLayout) && (
|
|
219
|
+
{(!isCustomLayout) && !hideBusinessOffer && (
|
|
208
220
|
getBusinessOffer((business?.offers)) &&
|
|
209
221
|
<OfferBox>
|
|
210
222
|
<OText
|
|
@@ -231,19 +243,21 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
231
243
|
</BusinessHero>
|
|
232
244
|
<BusinessContent>
|
|
233
245
|
<BusinessInfo style={isCustomLayout && { position: 'absolute', bottom: 85, left: 15 }}>
|
|
234
|
-
|
|
235
|
-
<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
{!hideBusinessLogo && (
|
|
247
|
+
<BusinessLogo style={styles.businessLogo}>
|
|
248
|
+
<FastImage
|
|
249
|
+
style={{ width: 56, height: 56 }}
|
|
250
|
+
source={(businessLogo || business?.logo) ? {
|
|
251
|
+
uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
|
|
252
|
+
priority: FastImage.priority.normal,
|
|
253
|
+
} : theme.images.dummies.businessLogo}
|
|
254
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
255
|
+
/>
|
|
256
|
+
</BusinessLogo>
|
|
257
|
+
)}
|
|
258
|
+
{!isCustomLayout && (!hideBusinessFavorite || !hideBusinessReviews) && (
|
|
245
259
|
<ReviewAndFavorite>
|
|
246
|
-
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
|
|
260
|
+
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && !hideBusinessReviews && (
|
|
247
261
|
<Reviews>
|
|
248
262
|
<OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
|
|
249
263
|
<OText size={10} style={{ lineHeight: 15 }}>
|
|
@@ -251,15 +265,17 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
251
265
|
</OText>
|
|
252
266
|
</Reviews>
|
|
253
267
|
)}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
268
|
+
{!hideBusinessFavorite && (
|
|
269
|
+
<LottieAnimation
|
|
270
|
+
type='favorite'
|
|
271
|
+
onClick={handleChangeFavorite}
|
|
272
|
+
initialValue={business?.favorite ? 0.75 : 0}
|
|
273
|
+
toValue={business?.favorite ? 0 : 0.75}
|
|
274
|
+
disableAnimation={!auth}
|
|
275
|
+
iconProps={{ color: theme.colors.danger5, size: 18 }}
|
|
276
|
+
isActive={business?.favorite}
|
|
277
|
+
/>
|
|
278
|
+
)}
|
|
263
279
|
</ReviewAndFavorite>
|
|
264
280
|
)}
|
|
265
281
|
</BusinessInfo>
|
|
@@ -270,9 +286,9 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
270
286
|
weight={'500'}>
|
|
271
287
|
{business?.name}
|
|
272
288
|
</OText>
|
|
273
|
-
{isCustomLayout && (
|
|
289
|
+
{isCustomLayout && (!hideBusinessFavorite || !hideBusinessReviews) && (
|
|
274
290
|
<ReviewAndFavorite>
|
|
275
|
-
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
|
|
291
|
+
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && !hideBusinessReviews && (
|
|
276
292
|
<Reviews>
|
|
277
293
|
<OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
|
|
278
294
|
<OText size={10} style={{ lineHeight: 15 }}>
|
|
@@ -280,15 +296,17 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
280
296
|
</OText>
|
|
281
297
|
</Reviews>
|
|
282
298
|
)}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
299
|
+
{!hideBusinessFavorite && (
|
|
300
|
+
<LottieAnimation
|
|
301
|
+
type='favorite'
|
|
302
|
+
onClick={handleChangeFavorite}
|
|
303
|
+
initialValue={business?.favorite ? 0.75 : 0}
|
|
304
|
+
toValue={business?.favorite ? 0 : 0.75}
|
|
305
|
+
disableAnimation={!auth}
|
|
306
|
+
iconProps={{ color: theme.colors.danger5, size: 18 }}
|
|
307
|
+
isActive={business?.favorite}
|
|
308
|
+
/>
|
|
309
|
+
)}
|
|
292
310
|
</ReviewAndFavorite>
|
|
293
311
|
)}
|
|
294
312
|
</View>
|
|
@@ -304,17 +322,21 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
304
322
|
</View>
|
|
305
323
|
) : (
|
|
306
324
|
<View style={styles.bullet}>
|
|
307
|
-
{orderState?.options?.type === 1 && (
|
|
325
|
+
{orderState?.options?.type === 1 && !hideBusinessFee && (
|
|
308
326
|
<OText size={textSize} color={theme.colors.textSecondary}>
|
|
309
327
|
{`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
|
|
310
328
|
</OText>
|
|
311
329
|
)}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
330
|
+
{!hideBusinessTime && (
|
|
331
|
+
<OText size={textSize} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
|
|
332
|
+
orderState?.options?.type === 1
|
|
333
|
+
? (businessDeliveryTime ?? business?.delivery_time)
|
|
334
|
+
: (businessPickupTime ?? business?.pickup_time),
|
|
335
|
+
)} \u2022 `}</OText>
|
|
336
|
+
)}
|
|
337
|
+
{!hideBusinessDistance && (
|
|
338
|
+
<OText size={textSize} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
|
|
339
|
+
)}
|
|
318
340
|
</View>
|
|
319
341
|
)}
|
|
320
342
|
</Metadata>
|
|
@@ -85,7 +85,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
85
85
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
86
86
|
const showLogo = !theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
|
|
87
87
|
const hideBusinessNearCity = theme?.business_view?.components?.near_business?.hidden ?? true
|
|
88
|
-
|
|
88
|
+
const backgroundColor = theme?.business_view?.components?.style?.backgroundColor
|
|
89
89
|
const styles = StyleSheet.create({
|
|
90
90
|
mainContainer: {
|
|
91
91
|
flex: 1
|
|
@@ -187,47 +187,35 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
187
187
|
const handleUpsellingPage = () => {
|
|
188
188
|
setOpenUpselling(false)
|
|
189
189
|
setCanOpenUpselling(false)
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
screen: 'MultiCheckout'
|
|
220
|
-
})
|
|
221
|
-
} else {
|
|
222
|
-
onRedirect('CheckoutNavigator', {
|
|
223
|
-
screen: 'CheckoutPage',
|
|
224
|
-
cartUuid: currentCart?.uuid,
|
|
225
|
-
businessLogo: logo,
|
|
226
|
-
businessName: business?.name,
|
|
227
|
-
cartTotal: currentCart?.total
|
|
228
|
-
})
|
|
229
|
-
}
|
|
230
|
-
setOpenUpselling(false)
|
|
190
|
+
const cartsAvailable: any = Object.values(orderState?.carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
191
|
+
if (cartsAvailable.length === 1) {
|
|
192
|
+
props.onNavigationRedirect('CheckoutNavigator', {
|
|
193
|
+
screen: 'CheckoutPage',
|
|
194
|
+
cartUuid: cartsAvailable[0]?.uuid,
|
|
195
|
+
businessLogo: cartsAvailable[0]?.business?.logo,
|
|
196
|
+
businessName: cartsAvailable[0]?.business?.name,
|
|
197
|
+
cartTotal: cartsAvailable[0]?.total
|
|
198
|
+
})
|
|
199
|
+
} else {
|
|
200
|
+
const groupKeys: any = {}
|
|
201
|
+
cartsAvailable.forEach((_cart: any) => {
|
|
202
|
+
groupKeys[_cart?.group?.uuid]
|
|
203
|
+
? groupKeys[_cart?.group?.uuid] += 1
|
|
204
|
+
: groupKeys[_cart?.group?.uuid ?? 'null'] = 1
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
if (
|
|
208
|
+
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
209
|
+
Object.keys(groupKeys).length > 1
|
|
210
|
+
) {
|
|
211
|
+
props.onNavigationRedirect('CheckoutNavigator', { screen: 'MultiCart' })
|
|
212
|
+
} else {
|
|
213
|
+
props.onNavigationRedirect('CheckoutNavigator', {
|
|
214
|
+
screen: 'MultiCheckout',
|
|
215
|
+
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
}
|
|
231
219
|
}
|
|
232
220
|
|
|
233
221
|
const handleCloseUpsellingPage = () => {
|
|
@@ -314,7 +302,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
314
302
|
|
|
315
303
|
return (
|
|
316
304
|
<>
|
|
317
|
-
<View style={{ flex: 1 }}>
|
|
305
|
+
<View style={{ flex: 1, backgroundColor: backgroundColor }}>
|
|
318
306
|
<Animated.View style={{ position: 'relative' }}>
|
|
319
307
|
<TopHeader
|
|
320
308
|
style={{
|
|
@@ -460,7 +448,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
460
448
|
/>
|
|
461
449
|
</ProfessionalFilterWrapper>
|
|
462
450
|
)}
|
|
463
|
-
<PageBanner position='app_business_page' />
|
|
451
|
+
<PageBanner position='app_business_page' navigation={navigation} />
|
|
464
452
|
<View
|
|
465
453
|
style={{
|
|
466
454
|
height: 8,
|