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.
Files changed (217) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/VerifyPhone/styles.tsx +1 -2
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/utils/index.tsx +2 -2
  8. package/themes/business/index.tsx +2 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  12. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  13. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  14. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  16. package/themes/business/src/components/Chat/index.tsx +41 -13
  17. package/themes/business/src/components/DriverMap/index.tsx +4 -2
  18. package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/MapView/index.tsx +11 -7
  21. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +121 -103
  23. package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
  24. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
  25. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +26 -6
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  27. package/themes/business/src/components/OrderSummary/index.tsx +27 -13
  28. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  29. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  30. package/themes/business/src/components/OrdersOption/index.tsx +83 -37
  31. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  32. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  33. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +24 -31
  34. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  36. package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/StoresList/index.tsx +5 -3
  41. package/themes/business/src/components/UserProfileForm/index.tsx +27 -10
  42. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  43. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  44. package/themes/business/src/types/index.tsx +10 -0
  45. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  46. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  47. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
  50. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  51. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  52. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  53. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  54. package/themes/original/index.tsx +7 -3
  55. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  56. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  57. package/themes/original/src/components/AddressList/index.tsx +4 -7
  58. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  59. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  60. package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
  61. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  62. package/themes/original/src/components/BusinessController/index.tsx +9 -6
  63. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  64. package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
  65. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  66. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  69. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  70. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  71. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  72. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
  73. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  74. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  75. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  76. package/themes/original/src/components/BusinessProductsListing/index.tsx +43 -19
  77. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  78. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  81. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  82. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  83. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  84. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  86. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  87. package/themes/original/src/components/Cart/index.tsx +27 -8
  88. package/themes/original/src/components/CartContent/index.tsx +61 -39
  89. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  90. package/themes/original/src/components/Checkout/index.tsx +199 -55
  91. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  92. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  93. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  94. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  95. package/themes/original/src/components/Favorite/index.tsx +4 -9
  96. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  97. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  98. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  99. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  100. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  102. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  104. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  105. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  106. package/themes/original/src/components/GoogleMap/index.tsx +50 -5
  107. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  108. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  109. package/themes/original/src/components/Home/index.tsx +1 -1
  110. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  111. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  112. package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
  113. package/themes/original/src/components/LoginForm/index.tsx +6 -1
  114. package/themes/original/src/components/Messages/index.tsx +9 -4
  115. package/themes/original/src/components/Messages/styles.tsx +1 -1
  116. package/themes/original/src/components/MomentOption/index.tsx +4 -4
  117. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  118. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  119. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
  120. package/themes/original/src/components/MultiCheckout/index.tsx +184 -51
  121. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  122. package/themes/original/src/components/MyOrders/index.tsx +5 -5
  123. package/themes/original/src/components/NavBar/index.tsx +3 -1
  124. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  125. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  126. package/themes/original/src/components/Notifications/index.tsx +4 -8
  127. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  128. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  129. package/themes/original/src/components/OrderDetails/index.tsx +716 -667
  130. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  131. package/themes/original/src/components/OrderProgress/index.tsx +7 -7
  132. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  133. package/themes/original/src/components/OrderSummary/index.tsx +5 -3
  134. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  135. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  136. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  137. package/themes/original/src/components/OrdersOption/index.tsx +4 -3
  138. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  139. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  140. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  141. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  142. package/themes/original/src/components/PaymentOptions/index.tsx +41 -32
  143. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  144. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  145. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  146. package/themes/original/src/components/ProductForm/index.tsx +81 -167
  147. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  148. package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
  149. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  150. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  151. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  152. package/themes/original/src/components/Promotions/index.tsx +4 -4
  153. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  154. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  155. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  156. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  157. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  158. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  159. package/themes/original/src/components/SingleOrderCard/index.tsx +4 -3
  160. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  161. package/themes/original/src/components/StripeCardsList/index.tsx +53 -7
  162. package/themes/original/src/components/StripeElementsForm/index.tsx +1 -1
  163. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  164. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  165. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  166. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  167. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  168. package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
  169. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  170. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  171. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  172. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  173. package/themes/original/src/components/Wallets/index.tsx +8 -9
  174. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  175. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  176. package/themes/original/src/components/shared/OInput.tsx +1 -4
  177. package/themes/original/src/components/shared/OModal.tsx +12 -14
  178. package/themes/original/src/layouts/Container.tsx +5 -3
  179. package/themes/original/src/types/index.tsx +10 -2
  180. package/themes/original/src/utils/index.tsx +124 -0
  181. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  182. package/src/navigators/BottomNavigator.tsx +0 -117
  183. package/src/navigators/CheckoutNavigator.tsx +0 -66
  184. package/src/navigators/HomeNavigator.tsx +0 -202
  185. package/src/navigators/NavigationRef.tsx +0 -7
  186. package/src/navigators/RootNavigator.tsx +0 -269
  187. package/src/pages/Account.tsx +0 -34
  188. package/src/pages/AddressForm.tsx +0 -62
  189. package/src/pages/AddressList.tsx +0 -24
  190. package/src/pages/BusinessProductsList.tsx +0 -81
  191. package/src/pages/BusinessesListing.tsx +0 -43
  192. package/src/pages/CartList.tsx +0 -49
  193. package/src/pages/Checkout.tsx +0 -101
  194. package/src/pages/ForgotPassword.tsx +0 -24
  195. package/src/pages/Help.tsx +0 -23
  196. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  197. package/src/pages/HelpGuide.tsx +0 -23
  198. package/src/pages/HelpOrder.tsx +0 -23
  199. package/src/pages/Home.tsx +0 -36
  200. package/src/pages/IntroductoryTutorial.tsx +0 -170
  201. package/src/pages/Login.tsx +0 -47
  202. package/src/pages/MomentOption.tsx +0 -30
  203. package/src/pages/MultiCheckout.tsx +0 -31
  204. package/src/pages/MultiOrdersDetails.tsx +0 -27
  205. package/src/pages/MyOrders.tsx +0 -40
  206. package/src/pages/NetworkError.tsx +0 -24
  207. package/src/pages/NotFound.tsx +0 -22
  208. package/src/pages/OrderDetails.tsx +0 -25
  209. package/src/pages/ProductDetails.tsx +0 -55
  210. package/src/pages/Profile.tsx +0 -36
  211. package/src/pages/ReviewDriver.tsx +0 -30
  212. package/src/pages/ReviewOrder.tsx +0 -32
  213. package/src/pages/ReviewProducts.tsx +0 -30
  214. package/src/pages/Sessions.tsx +0 -22
  215. package/src/pages/Signup.tsx +0 -53
  216. package/src/pages/SpinnerLoader.tsx +0 -10
  217. 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
+ }
@@ -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
+