ordering-ui-react-native 0.19.2-testing → 0.19.3-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 +6 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +41 -13
- package/themes/business/src/components/DriverMap/index.tsx +4 -2
- package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/MapView/index.tsx +11 -7
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +121 -103
- package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +26 -6
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
- package/themes/business/src/components/OrderSummary/index.tsx +27 -13
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +83 -37
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +24 -31
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +5 -3
- package/themes/business/src/components/UserProfileForm/index.tsx +27 -10
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/types/index.tsx +10 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressForm/index.tsx +2 -2
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +4 -7
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +9 -6
- package/themes/original/src/components/BusinessController/styles.tsx +8 -7
- package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +43 -19
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +27 -8
- package/themes/original/src/components/CartContent/index.tsx +61 -39
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +199 -55
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +1 -1
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +50 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
- package/themes/original/src/components/LoginForm/index.tsx +6 -1
- package/themes/original/src/components/Messages/index.tsx +9 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +4 -4
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
- package/themes/original/src/components/MultiCheckout/index.tsx +184 -51
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +5 -5
- package/themes/original/src/components/NavBar/index.tsx +3 -1
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
- package/themes/original/src/components/OrderDetails/index.tsx +716 -667
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderProgress/index.tsx +7 -7
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +5 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +4 -3
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +3 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +41 -32
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +81 -167
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +4 -4
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SingleOrderCard/index.tsx +4 -3
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +53 -7
- package/themes/original/src/components/StripeElementsForm/index.tsx +1 -1
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
- package/themes/original/src/components/UserProfile/index.tsx +1 -1
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +8 -9
- package/themes/original/src/components/Wallets/styles.tsx +1 -1
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +10 -2
- package/themes/original/src/utils/index.tsx +124 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
useLanguage,
|
|
4
|
+
useSession,
|
|
5
|
+
useOrder,
|
|
6
|
+
useConfig,
|
|
7
|
+
useUtils
|
|
8
|
+
} from 'ordering-components/native';
|
|
9
|
+
import { Platform, ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
10
|
+
import { OIcon, OModal, OText } from '../../../shared'
|
|
11
|
+
import { useTheme } from 'styled-components/native';
|
|
12
|
+
import { OrderProgress } from '../../../OrderProgress';
|
|
13
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
14
|
+
import {
|
|
15
|
+
Search,
|
|
16
|
+
OrderControlContainer,
|
|
17
|
+
AddressInput,
|
|
18
|
+
WrapMomentOption,
|
|
19
|
+
HeaderWrapper,
|
|
20
|
+
ListWrapper,
|
|
21
|
+
FeaturedWrapper,
|
|
22
|
+
FarAwayMessage,
|
|
23
|
+
AddressInputContainer,
|
|
24
|
+
PreorderInput,
|
|
25
|
+
OrderTypesContainer
|
|
26
|
+
} from './styles';
|
|
27
|
+
import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
|
|
28
|
+
import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
|
|
29
|
+
import { PageBanner } from '../../../PageBanner';
|
|
30
|
+
import { NotFoundSource } from '../../../NotFoundSource';
|
|
31
|
+
import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
|
|
32
|
+
import { OrderTypeSelector } from '../../../OrderTypeSelector';
|
|
33
|
+
import { getTypesText } from '../../../../utils';
|
|
34
|
+
|
|
35
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
36
|
+
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
37
|
+
import { CitiesControl } from '../../../CitiesControl';
|
|
38
|
+
|
|
39
|
+
export const FlatListBusinessListHeader = (props: any) => {
|
|
40
|
+
const {
|
|
41
|
+
navigation,
|
|
42
|
+
businessesList,
|
|
43
|
+
handleChangeBusinessType,
|
|
44
|
+
handleBusinessClick,
|
|
45
|
+
businessId,
|
|
46
|
+
isGuestUser,
|
|
47
|
+
citiesState,
|
|
48
|
+
enabledPoweredByOrdering,
|
|
49
|
+
orderTypeValue,
|
|
50
|
+
setIsOpenCities,
|
|
51
|
+
allCitiesDisabled,
|
|
52
|
+
featuredBusiness,
|
|
53
|
+
favoriteIds,
|
|
54
|
+
setFavoriteIds,
|
|
55
|
+
setOrderTypeValue,
|
|
56
|
+
isFarAway,
|
|
57
|
+
isOpenCities,
|
|
58
|
+
handleChangeCity
|
|
59
|
+
} = props
|
|
60
|
+
|
|
61
|
+
const theme = useTheme()
|
|
62
|
+
const [{ user, auth }] = useSession()
|
|
63
|
+
const [orderState] = useOrder()
|
|
64
|
+
const [{ configs }] = useConfig()
|
|
65
|
+
const isFocused = useIsFocused()
|
|
66
|
+
const [, t] = useLanguage()
|
|
67
|
+
const [{ parseDate }] = useUtils();
|
|
68
|
+
const { top } = useSafeAreaInsets();
|
|
69
|
+
|
|
70
|
+
const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
|
|
71
|
+
const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
|
|
72
|
+
const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
|
|
73
|
+
const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
|
|
74
|
+
const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
|
|
75
|
+
const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
|
|
76
|
+
const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
|
|
77
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
78
|
+
|
|
79
|
+
const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
|
|
80
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
81
|
+
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
82
|
+
Number(configs?.max_days_preorder?.value) > 0
|
|
83
|
+
const configTypes =
|
|
84
|
+
configs?.order_types_allowed?.value
|
|
85
|
+
.split('|')
|
|
86
|
+
.map((value: any) => Number(value)) || [];
|
|
87
|
+
|
|
88
|
+
const styles = StyleSheet.create({
|
|
89
|
+
container: {
|
|
90
|
+
marginBottom: 0,
|
|
91
|
+
},
|
|
92
|
+
welcome: {
|
|
93
|
+
flex: 1,
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
},
|
|
96
|
+
inputStyle: {
|
|
97
|
+
backgroundColor: theme.colors.inputDisabled,
|
|
98
|
+
flex: 1,
|
|
99
|
+
},
|
|
100
|
+
wrapperOrderOptions: {
|
|
101
|
+
width: '100%',
|
|
102
|
+
flexDirection: 'row',
|
|
103
|
+
justifyContent: 'center',
|
|
104
|
+
marginBottom: 10,
|
|
105
|
+
zIndex: 100,
|
|
106
|
+
},
|
|
107
|
+
borderStyle: {
|
|
108
|
+
borderColor: theme.colors.backgroundGray,
|
|
109
|
+
borderWidth: 1,
|
|
110
|
+
borderRadius: 10,
|
|
111
|
+
},
|
|
112
|
+
searchInput: {
|
|
113
|
+
fontSize: 16,
|
|
114
|
+
backgroundColor: theme.colors.white,
|
|
115
|
+
paddingLeft: 10,
|
|
116
|
+
paddingTop: 7
|
|
117
|
+
},
|
|
118
|
+
iconStyle: {
|
|
119
|
+
fontSize: 18,
|
|
120
|
+
color: theme.colors.warning5,
|
|
121
|
+
marginRight: 8
|
|
122
|
+
},
|
|
123
|
+
farAwayMsg: {
|
|
124
|
+
paddingVertical: 6,
|
|
125
|
+
paddingHorizontal: 20
|
|
126
|
+
},
|
|
127
|
+
inputContainerStyles: {
|
|
128
|
+
backgroundColor: theme.colors.white,
|
|
129
|
+
borderColor: theme.colors.backgroundGray,
|
|
130
|
+
borderWidth: 1,
|
|
131
|
+
},
|
|
132
|
+
buttonCityStyle: {
|
|
133
|
+
backgroundColor: theme.colors.white,
|
|
134
|
+
borderColor: theme.colors.backgroundGray,
|
|
135
|
+
borderRadius: 8,
|
|
136
|
+
marginHorizontal: 20,
|
|
137
|
+
minHeight: 45,
|
|
138
|
+
paddingVertical: 5,
|
|
139
|
+
paddingHorizontal: 20,
|
|
140
|
+
borderWidth: 1,
|
|
141
|
+
justifyContent: 'center'
|
|
142
|
+
},
|
|
143
|
+
businessSkeleton: {
|
|
144
|
+
borderRadius: 8,
|
|
145
|
+
marginRight: 20,
|
|
146
|
+
width: 56,
|
|
147
|
+
height: 56
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const handleMomentClick = () => {
|
|
152
|
+
if (isPreorderEnabled) {
|
|
153
|
+
navigation.navigate('MomentOption')
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<>
|
|
159
|
+
{enabledPoweredByOrdering && auth && (
|
|
160
|
+
<View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', top: 20 }}>
|
|
161
|
+
<OText>
|
|
162
|
+
Powered By Ordering.co
|
|
163
|
+
</OText>
|
|
164
|
+
</View>
|
|
165
|
+
)}
|
|
166
|
+
<View style={{
|
|
167
|
+
height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
|
|
168
|
+
marginTop: 0,
|
|
169
|
+
backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
{isChewLayout && (
|
|
173
|
+
<View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
174
|
+
<OText size={24} weight={700} color={theme.colors?.white}>
|
|
175
|
+
{t('WELCOME', 'Welcome')} {user?.name}
|
|
176
|
+
</OText>
|
|
177
|
+
</View>
|
|
178
|
+
)}
|
|
179
|
+
<Search isChewLayout={isChewLayout}>
|
|
180
|
+
<AddressInput
|
|
181
|
+
isChewLayout={isChewLayout}
|
|
182
|
+
onPress={() =>
|
|
183
|
+
auth
|
|
184
|
+
? navigation.navigate('AddressList', { isFromBusinesses: true })
|
|
185
|
+
: navigation.navigate('AddressForm', {
|
|
186
|
+
address: orderState.options?.address,
|
|
187
|
+
isFromBusinesses: true,
|
|
188
|
+
isGuestUser: isGuestUser
|
|
189
|
+
})
|
|
190
|
+
}>
|
|
191
|
+
<AddressInputContainer isChewLayout={isChewLayout}>
|
|
192
|
+
<OIcon
|
|
193
|
+
src={theme.images.general.pin}
|
|
194
|
+
color={theme.colors.disabled}
|
|
195
|
+
width={16}
|
|
196
|
+
style={{ marginRight: isChewLayout ? 0 : 10 }}
|
|
197
|
+
/>
|
|
198
|
+
<OText size={12} numberOfLines={1} style={{ flex: 1 }}>
|
|
199
|
+
{orderState?.options?.address?.address || t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?')}
|
|
200
|
+
</OText>
|
|
201
|
+
{!isChewLayout && (
|
|
202
|
+
<OIcon
|
|
203
|
+
src={theme.images.general.arrow_down}
|
|
204
|
+
width={10}
|
|
205
|
+
style={{ marginStart: 8 }}
|
|
206
|
+
/>
|
|
207
|
+
)}
|
|
208
|
+
</AddressInputContainer>
|
|
209
|
+
</AddressInput>
|
|
210
|
+
</Search>
|
|
211
|
+
{isFarAway && !isChewLayout && (
|
|
212
|
+
<FarAwayMessage style={styles.farAwayMsg}>
|
|
213
|
+
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
214
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
215
|
+
</FarAwayMessage>
|
|
216
|
+
)}
|
|
217
|
+
{!isChewLayout ? (
|
|
218
|
+
<OrderControlContainer>
|
|
219
|
+
<View style={styles.wrapperOrderOptions}>
|
|
220
|
+
{isPreOrderSetting && (
|
|
221
|
+
<WrapMomentOption
|
|
222
|
+
onPress={() => handleMomentClick()}>
|
|
223
|
+
<OText
|
|
224
|
+
size={12}
|
|
225
|
+
numberOfLines={1}
|
|
226
|
+
ellipsizeMode="tail"
|
|
227
|
+
color={theme.colors.textSecondary}>
|
|
228
|
+
{orderState.options?.moment
|
|
229
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
230
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
231
|
+
</OText>
|
|
232
|
+
{isPreorderEnabled && (
|
|
233
|
+
<OIcon
|
|
234
|
+
src={theme.images.general.arrow_down}
|
|
235
|
+
width={10}
|
|
236
|
+
style={{ marginStart: 8 }}
|
|
237
|
+
/>
|
|
238
|
+
)}
|
|
239
|
+
</WrapMomentOption>
|
|
240
|
+
)}
|
|
241
|
+
<WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
|
|
242
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
243
|
+
<OIcon
|
|
244
|
+
src={theme.images.general.arrow_down}
|
|
245
|
+
width={10}
|
|
246
|
+
style={{ marginStart: 8 }}
|
|
247
|
+
/>
|
|
248
|
+
</WrapMomentOption>
|
|
249
|
+
</View>
|
|
250
|
+
</OrderControlContainer>
|
|
251
|
+
) : (
|
|
252
|
+
<>
|
|
253
|
+
{isPreOrderSetting && (
|
|
254
|
+
<View style={{ paddingHorizontal: 30 }}>
|
|
255
|
+
<PreorderInput
|
|
256
|
+
isChewLayout={isChewLayout}
|
|
257
|
+
onPress={() => handleMomentClick()}
|
|
258
|
+
>
|
|
259
|
+
<OText color={theme.colors.textSecondary}>
|
|
260
|
+
{orderState.options?.moment
|
|
261
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
262
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}</OText>
|
|
263
|
+
</PreorderInput>
|
|
264
|
+
</View>
|
|
265
|
+
)}
|
|
266
|
+
</>
|
|
267
|
+
)}
|
|
268
|
+
</View>
|
|
269
|
+
{!isChewLayout ? (
|
|
270
|
+
<>
|
|
271
|
+
{!hideHero ? (
|
|
272
|
+
<HeaderWrapper
|
|
273
|
+
source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
|
|
274
|
+
style={{ paddingTop: top + 20 }}
|
|
275
|
+
resizeMode='cover'
|
|
276
|
+
bgHeaderHeight={bgHeaderHeight}
|
|
277
|
+
>
|
|
278
|
+
{!auth && (
|
|
279
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 20, paddingVertical: 20 }}>
|
|
280
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
281
|
+
</TouchableOpacity>
|
|
282
|
+
)}
|
|
283
|
+
</HeaderWrapper>
|
|
284
|
+
) : (
|
|
285
|
+
<>
|
|
286
|
+
{!auth && (
|
|
287
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 20, paddingVertical: 20 }}>
|
|
288
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
289
|
+
</TouchableOpacity>
|
|
290
|
+
)}
|
|
291
|
+
</>
|
|
292
|
+
)}
|
|
293
|
+
</>
|
|
294
|
+
) : (
|
|
295
|
+
<OrderTypesContainer>
|
|
296
|
+
<OrderTypeSelector
|
|
297
|
+
handleChangeBusinessType={handleChangeBusinessType}
|
|
298
|
+
isChewLayout
|
|
299
|
+
chewOrderTypes={chewOrderTypes}
|
|
300
|
+
handleChangeType={setOrderTypeValue}
|
|
301
|
+
/>
|
|
302
|
+
</OrderTypesContainer>
|
|
303
|
+
)}
|
|
304
|
+
|
|
305
|
+
{!hideCities && orderTypeValue === 2 && (
|
|
306
|
+
<View style={{ marginTop: 20 }}>
|
|
307
|
+
<TouchableOpacity
|
|
308
|
+
style={styles.buttonCityStyle}
|
|
309
|
+
onPress={() => setIsOpenCities(true)}
|
|
310
|
+
disabled={orderState?.loading}
|
|
311
|
+
>
|
|
312
|
+
<OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
|
|
313
|
+
{citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
|
|
314
|
+
</OText>
|
|
315
|
+
</TouchableOpacity>
|
|
316
|
+
</View>
|
|
317
|
+
)}
|
|
318
|
+
{!hidePreviousOrders && (
|
|
319
|
+
<OrderProgress
|
|
320
|
+
{...props}
|
|
321
|
+
isFocused={isFocused}
|
|
322
|
+
/>
|
|
323
|
+
)}
|
|
324
|
+
{
|
|
325
|
+
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
326
|
+
<FeaturedWrapper>
|
|
327
|
+
<OText size={16} style={{ marginLeft: 20 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
|
|
328
|
+
<ScrollView
|
|
329
|
+
showsHorizontalScrollIndicator={false}
|
|
330
|
+
nestedScrollEnabled
|
|
331
|
+
horizontal
|
|
332
|
+
contentContainerStyle={{ paddingHorizontal: 20 }}
|
|
333
|
+
>
|
|
334
|
+
{featuredBusiness.map((bAry: any, idx: number) => (
|
|
335
|
+
<View key={'f-listing_' + idx}>
|
|
336
|
+
<BusinessFeaturedController
|
|
337
|
+
business={bAry[0]}
|
|
338
|
+
isBusinessOpen={bAry[0]?.open}
|
|
339
|
+
handleCustomClick={handleBusinessClick}
|
|
340
|
+
orderType={orderState?.options?.type}
|
|
341
|
+
/>
|
|
342
|
+
{bAry.length > 1 && (
|
|
343
|
+
<BusinessFeaturedController
|
|
344
|
+
business={bAry[1]}
|
|
345
|
+
isBusinessOpen={bAry[1]?.open}
|
|
346
|
+
handleCustomClick={handleBusinessClick}
|
|
347
|
+
orderType={orderState?.options?.type}
|
|
348
|
+
/>
|
|
349
|
+
)}
|
|
350
|
+
</View>
|
|
351
|
+
))}
|
|
352
|
+
</ScrollView>
|
|
353
|
+
</FeaturedWrapper>
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
{!isChewLayout && !hideHighestBusiness && (
|
|
357
|
+
<>
|
|
358
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
359
|
+
{
|
|
360
|
+
!businessId && !props.franchiseId && (
|
|
361
|
+
<HighestRatedBusinesses
|
|
362
|
+
propsToFetch={props.propsToFetch}
|
|
363
|
+
onBusinessClick={handleBusinessClick}
|
|
364
|
+
navigation={navigation}
|
|
365
|
+
favoriteIds={favoriteIds}
|
|
366
|
+
setFavoriteIds={setFavoriteIds}
|
|
367
|
+
/>
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
</>
|
|
371
|
+
)}
|
|
372
|
+
<PageBanner position='app_business_listing' navigation={navigation} />
|
|
373
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
374
|
+
|
|
375
|
+
<ListWrapper style={{ paddingHorizontal: 20 }}>
|
|
376
|
+
{!businessId && !isAllCategoriesHidden && (
|
|
377
|
+
<BusinessTypeFilter
|
|
378
|
+
images={props.images}
|
|
379
|
+
businessTypes={props.businessTypes}
|
|
380
|
+
defaultBusinessType={props.defaultBusinessType}
|
|
381
|
+
handleChangeBusinessType={handleChangeBusinessType}
|
|
382
|
+
/>
|
|
383
|
+
)}
|
|
384
|
+
{!businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
|
|
385
|
+
<NotFoundSource
|
|
386
|
+
content={t(
|
|
387
|
+
'NOT_FOUND_BUSINESSES',
|
|
388
|
+
'No businesses to delivery / pick up at this address, please change filters or change address.',
|
|
389
|
+
)}
|
|
390
|
+
/>
|
|
391
|
+
)}
|
|
392
|
+
</ListWrapper>
|
|
393
|
+
<OModal
|
|
394
|
+
open={isOpenCities}
|
|
395
|
+
onClose={() => setIsOpenCities(false)}
|
|
396
|
+
title={t('SELECT_A_CITY', 'Select a city')}
|
|
397
|
+
>
|
|
398
|
+
<CitiesControl
|
|
399
|
+
cities={citiesState?.cities}
|
|
400
|
+
onClose={() => setIsOpenCities(false)}
|
|
401
|
+
handleChangeCity={handleChangeCity}
|
|
402
|
+
/>
|
|
403
|
+
</OModal>
|
|
404
|
+
</>
|
|
405
|
+
)
|
|
406
|
+
}
|
package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { FlatList, RefreshControl, View } from 'react-native'
|
|
3
|
+
import { FlatListBusinessListHeader } from './FlatListBusinessListHeader'
|
|
4
|
+
import { FlatListBusinessListFooter } from './FlatListBusinessListFooter'
|
|
5
|
+
import { BusinessController } from '../../../BusinessController'
|
|
6
|
+
import {
|
|
7
|
+
useOrder
|
|
8
|
+
} from 'ordering-components/native';
|
|
9
|
+
import { useTheme } from 'styled-components/native'
|
|
10
|
+
|
|
11
|
+
export const FlatListBusinessListing = (props : any) => {
|
|
12
|
+
const {
|
|
13
|
+
handleScroll,
|
|
14
|
+
businessesList,
|
|
15
|
+
handleBusinessClick,
|
|
16
|
+
navigation,
|
|
17
|
+
handleUpdateBusinessList,
|
|
18
|
+
favoriteIds,
|
|
19
|
+
setFavoriteIds,
|
|
20
|
+
handleOnRefresh,
|
|
21
|
+
isChewLayout
|
|
22
|
+
} = props
|
|
23
|
+
|
|
24
|
+
const [orderState] = useOrder()
|
|
25
|
+
const [refreshing] = useState(false);
|
|
26
|
+
const theme = useTheme()
|
|
27
|
+
return (
|
|
28
|
+
<FlatList
|
|
29
|
+
ListHeaderComponent={
|
|
30
|
+
<FlatListBusinessListHeader
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
}
|
|
34
|
+
ListFooterComponent={
|
|
35
|
+
<FlatListBusinessListFooter {...props} />
|
|
36
|
+
}
|
|
37
|
+
onScroll={(e : any) => handleScroll(e)}
|
|
38
|
+
showsVerticalScrollIndicator={false}
|
|
39
|
+
refreshControl={
|
|
40
|
+
<RefreshControl
|
|
41
|
+
refreshing={refreshing}
|
|
42
|
+
onRefresh={() => handleOnRefresh()}
|
|
43
|
+
/>
|
|
44
|
+
}
|
|
45
|
+
data={businessesList.businesses}
|
|
46
|
+
keyExtractor={(business : any) => business?.id}
|
|
47
|
+
renderItem={({ item: business } : any) =>
|
|
48
|
+
<View style={{
|
|
49
|
+
paddingHorizontal: 20,
|
|
50
|
+
backgroundColor: theme.colors.backgroundLight
|
|
51
|
+
}}>
|
|
52
|
+
<BusinessController
|
|
53
|
+
// enableIntersection
|
|
54
|
+
business={business}
|
|
55
|
+
isBusinessOpen={business.open}
|
|
56
|
+
handleCustomClick={handleBusinessClick}
|
|
57
|
+
orderType={orderState?.options?.type}
|
|
58
|
+
navigation={navigation}
|
|
59
|
+
businessHeader={business?.header}
|
|
60
|
+
businessFeatured={business?.featured}
|
|
61
|
+
businessLogo={business?.logo}
|
|
62
|
+
businessReviews={business?.reviews}
|
|
63
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
64
|
+
businessDeliveryTime={business?.delivery_time}
|
|
65
|
+
businessPickupTime={business?.pickup_time}
|
|
66
|
+
businessDistance={business?.distance}
|
|
67
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
68
|
+
favoriteIds={favoriteIds}
|
|
69
|
+
setFavoriteIds={setFavoriteIds}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
}
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|