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
@@ -1,59 +1,29 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
3
3
  import Geolocation from '@react-native-community/geolocation'
4
- import { IOScrollView } from 'react-native-intersection-observer'
5
4
  import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
6
5
  import {
7
6
  View,
8
7
  StyleSheet,
9
- ScrollView,
10
8
  Platform,
11
9
  TouchableOpacity,
12
- RefreshControl,
13
- AppState
14
10
  } from 'react-native';
11
+
15
12
  import {
16
13
  BusinessList as BusinessesListingController,
17
- useLanguage,
18
- useSession,
19
14
  useOrder,
20
15
  useConfig,
21
- useUtils
22
16
  } from 'ordering-components/native';
23
17
  import { useTheme } from 'styled-components/native';
24
- import Ionicons from 'react-native-vector-icons/Ionicons'
25
18
 
26
19
  import {
27
- Search,
28
- OrderControlContainer,
29
- AddressInput,
30
- WrapMomentOption,
31
- HeaderWrapper,
32
- ListWrapper,
33
- FeaturedWrapper,
34
- FarAwayMessage,
35
- AddressInputContainer,
36
- PreorderInput,
37
- OrderTypesContainer,
38
20
  BusinessLogosContainer
39
21
  } from './styles';
40
22
 
41
- import { OIcon, OText, OModal } from '../../../shared';
42
23
  import { BusinessesListingParams } from '../../../../types';
43
- import { NotFoundSource } from '../../../NotFoundSource';
44
- import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
45
- import { BusinessController } from '../../../BusinessController';
46
- import { OrderTypeSelector } from '../../../OrderTypeSelector';
47
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
48
- import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
49
- import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
50
- import { getTypesText } from '../../../../utils';
51
- import { OrderProgress } from '../../../OrderProgress';
52
- import { useFocusEffect, useIsFocused } from '@react-navigation/native';
24
+ import { useFocusEffect } from '@react-navigation/native';
53
25
  import FastImage from 'react-native-fast-image';
54
- import IconAntDesign from 'react-native-vector-icons/AntDesign';
55
- import { PageBanner } from '../../../PageBanner'
56
- import { CitiesControl } from '../../../CitiesControl'
26
+ import { FlatListBusinessListing } from './FlatListBusinessListing'
57
27
 
58
28
  const PIXELS_TO_SCROLL = 2000;
59
29
 
@@ -62,36 +32,19 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
62
32
  navigation,
63
33
  businessesList,
64
34
  getBusinesses,
65
- handleChangeBusinessType,
66
35
  handleBusinessClick,
67
36
  paginationProps,
68
- businessId,
69
- isGuestUser,
70
- handleUpdateBusinessList,
71
37
  citiesState,
72
38
  actualSlug,
73
39
  logosLayout
74
40
  } = props;
75
41
  const theme = useTheme();
76
- const isFocused = useIsFocused();
77
42
 
78
- const [, t] = useLanguage();
79
- const [{ user, auth }] = useSession();
80
43
  const [orderState, { changeCityFilter }] = useOrder();
81
44
  const [{ configs }] = useConfig();
82
- const [{ parseDate }] = useUtils();
83
45
 
84
- const appState = useRef(AppState.currentState)
85
46
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
86
- const [refreshing] = useState(false);
87
47
  const allCitiesDisabled = citiesState?.cities?.every((city: any) => !city.enabled)
88
- const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
89
- const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
90
- const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
91
- const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
92
- const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
93
- const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
94
- const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
95
48
 
96
49
  const styles = StyleSheet.create({
97
50
  container: {
@@ -141,7 +94,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
141
94
  backgroundColor: theme.colors.white,
142
95
  borderColor: theme.colors.backgroundGray,
143
96
  borderRadius: 8,
144
- marginHorizontal: 40,
97
+ marginHorizontal: 20,
145
98
  minHeight: 45,
146
99
  paddingVertical: 5,
147
100
  paddingHorizontal: 20,
@@ -156,32 +109,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
156
109
  },
157
110
  });
158
111
 
159
- const { top } = useSafeAreaInsets();
160
-
161
112
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
162
113
  const [isFarAway, setIsFarAway] = useState(false)
163
- const [businessTypes, setBusinessTypes] = useState(null)
164
114
  const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options?.value)
165
115
  const [isOpenCities, setIsOpenCities] = useState(false)
166
- const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
167
- Number(configs?.max_days_preorder?.value) > 0
168
- const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
169
116
  const timerId = useRef<any>(false)
170
117
  const [favoriteIds, setFavoriteIds] = useState<any>([])
171
- const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
172
118
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
173
119
 
174
- const handleMomentClick = () => {
175
- if (isPreorderEnabled) {
176
- navigation.navigate('MomentOption')
177
- }
178
- }
179
-
180
- const configTypes =
181
- configs?.order_types_allowed?.value
182
- .split('|')
183
- .map((value: any) => Number(value)) || [];
184
-
185
120
  const handleScroll = ({ nativeEvent }: any) => {
186
121
  const y = nativeEvent.contentOffset.y;
187
122
  const height = nativeEvent.contentSize.height;
@@ -355,347 +290,39 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
355
290
  }
356
291
 
357
292
  return (
358
- <IOScrollView
359
- style={styles.container}
360
- onScroll={(e) => handleScroll(e)}
361
- showsVerticalScrollIndicator={false}
362
- refreshControl={
363
- <RefreshControl
364
- refreshing={refreshing}
365
- onRefresh={() => handleOnRefresh()}
366
- />
367
- }
368
- >
369
- {enabledPoweredByOrdering && auth && (
370
- <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', top: 20 }}>
371
- <OText>
372
- Powered By Ordering.co
373
- </OText>
374
- </View>
375
- )}
376
- <View style={{
377
- height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
378
- marginTop: Platform.OS == 'ios' ? 0 : 50,
379
- backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
380
- }}
381
- >
382
- {isChewLayout && (
383
- <View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
384
- <OText size={24} weight={700} color={theme.colors?.white}>
385
- {t('WELCOME', 'Welcome')} {user?.name}
386
- </OText>
387
- </View>
388
- )}
389
- <Search isChewLayout={isChewLayout}>
390
- <AddressInput
391
- isChewLayout={isChewLayout}
392
- onPress={() =>
393
- auth
394
- ? navigation.navigate('AddressList', { isFromBusinesses: true })
395
- : navigation.navigate('AddressForm', {
396
- address: orderState.options?.address,
397
- isFromBusinesses: true,
398
- isGuestUser: isGuestUser
399
- })
400
- }>
401
- <AddressInputContainer isChewLayout={isChewLayout}>
402
- <OIcon
403
- src={theme.images.general.pin}
404
- color={theme.colors.disabled}
405
- width={16}
406
- style={{ marginRight: isChewLayout ? 0 : 10 }}
407
- />
408
- <OText size={12} numberOfLines={1} style={{ flex: 1 }}>
409
- {orderState?.options?.address?.address || t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?')}
410
- </OText>
411
- {!isChewLayout && (
412
- <OIcon
413
- src={theme.images.general.arrow_down}
414
- width={10}
415
- style={{ marginStart: 8 }}
416
- />
417
- )}
418
- </AddressInputContainer>
419
- </AddressInput>
420
- </Search>
421
- {isFarAway && !isChewLayout && (
422
- <FarAwayMessage style={styles.farAwayMsg}>
423
- <Ionicons name='md-warning-outline' style={styles.iconStyle} />
424
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
425
- </FarAwayMessage>
426
- )}
427
- {!isChewLayout ? (
428
- <OrderControlContainer>
429
- <View style={styles.wrapperOrderOptions}>
430
- {isPreOrderSetting && (
431
- <WrapMomentOption
432
- onPress={() => handleMomentClick()}>
433
- <OText
434
- size={12}
435
- numberOfLines={1}
436
- ellipsizeMode="tail"
437
- color={theme.colors.textSecondary}>
438
- {orderState.options?.moment
439
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
440
- : t('ASAP_ABBREVIATION', 'ASAP')}
441
- </OText>
442
- {isPreorderEnabled && (
443
- <OIcon
444
- src={theme.images.general.arrow_down}
445
- width={10}
446
- style={{ marginStart: 8 }}
447
- />
448
- )}
449
- </WrapMomentOption>
450
- )}
451
- <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
452
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
453
- <OIcon
454
- src={theme.images.general.arrow_down}
455
- width={10}
456
- style={{ marginStart: 8 }}
457
- />
458
- </WrapMomentOption>
459
- </View>
460
- </OrderControlContainer>
461
- ) : (
462
- <>
463
- {isPreOrderSetting && (
464
- <View style={{ paddingHorizontal: 30 }}>
465
- <PreorderInput
466
- isChewLayout={isChewLayout}
467
- onPress={() => handleMomentClick()}
468
- >
469
- <OText color={theme.colors.textSecondary}>
470
- {orderState.options?.moment
471
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
472
- : t('ASAP_ABBREVIATION', 'ASAP')}</OText>
473
- </PreorderInput>
474
- </View>
475
- )}
476
- </>
477
- )}
478
- </View>
479
- {!isChewLayout ? (
480
- <>
481
- {!hideHero ? (
482
- <HeaderWrapper
483
- source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
484
- style={{ paddingTop: top + 20 }}
485
- resizeMode='cover'
486
- bgHeaderHeight={bgHeaderHeight}
487
- >
488
- {!auth && (
489
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
490
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
491
- </TouchableOpacity>
492
- )}
493
- </HeaderWrapper>
494
- ) : (
495
- <>
496
- {!auth && (
497
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
498
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
499
- </TouchableOpacity>
500
- )}
501
- </>
502
- )}
503
- </>
504
- ) : (
505
- <OrderTypesContainer>
506
- <OrderTypeSelector
507
- handleChangeBusinessType={handleChangeBusinessType}
508
- isChewLayout
509
- chewOrderTypes={chewOrderTypes}
510
- handleChangeType={setOrderTypeValue}
511
- />
512
- </OrderTypesContainer>
513
- )}
514
-
515
- {!hideCities && orderTypeValue === 2 && (
516
- <View style={{ marginTop: 20 }}>
517
- <TouchableOpacity
518
- style={styles.buttonCityStyle}
519
- onPress={() => setIsOpenCities(true)}
520
- disabled={orderState?.loading}
521
- >
522
- <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
523
- {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
524
- </OText>
525
- </TouchableOpacity>
526
- </View>
527
- )}
528
- {!hidePreviousOrders && (
529
- <OrderProgress
530
- {...props}
531
- isFocused={isFocused}
532
- />
533
- )}
534
- {
535
- !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
536
- <FeaturedWrapper>
537
- <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
538
- <ScrollView
539
- showsHorizontalScrollIndicator={false}
540
- nestedScrollEnabled
541
- horizontal
542
- contentContainerStyle={{ paddingHorizontal: 40 }}
543
- >
544
- {featuredBusiness.map((bAry: any, idx) => (
545
- <View key={'f-listing_' + idx}>
546
- <BusinessFeaturedController
547
- business={bAry[0]}
548
- isBusinessOpen={bAry[0]?.open}
549
- handleCustomClick={handleBusinessClick}
550
- orderType={orderState?.options?.type}
551
- />
552
- {bAry.length > 1 && (
553
- <BusinessFeaturedController
554
- business={bAry[1]}
555
- isBusinessOpen={bAry[1]?.open}
556
- handleCustomClick={handleBusinessClick}
557
- orderType={orderState?.options?.type}
558
- />
559
- )}
560
- </View>
561
- ))}
562
- </ScrollView>
563
- </FeaturedWrapper>
564
- )
565
- }
566
- {!isChewLayout && !hideHighestBusiness && (
567
- <>
568
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
569
- {
570
- !businessId && !props.franchiseId && (
571
- <HighestRatedBusinesses
572
- onBusinessClick={handleBusinessClick}
573
- navigation={navigation}
574
- favoriteIds={favoriteIds}
575
- setFavoriteIds={setFavoriteIds}
576
- />
577
- )
578
- }
579
- </>
580
- )}
581
-
582
- <PageBanner position='app_business_listing' navigation={navigation} />
583
-
584
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
585
- <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
586
- {!businessId && !isAllCategoriesHidden && (
587
- <BusinessTypeFilter
588
- images={props.images}
589
- businessTypes={props.businessTypes}
590
- defaultBusinessType={props.defaultBusinessType}
591
- handleChangeBusinessType={handleChangeBusinessType}
592
- setBusinessTypes={setBusinessTypes}
593
- />
594
- )}
595
- {!businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
596
- <NotFoundSource
597
- content={t(
598
- 'NOT_FOUND_BUSINESSES',
599
- 'No businesses to delivery / pick up at this address, please change filters or change address.',
600
- )}
601
- />
602
- )}
603
- {businessesList.businesses?.map(
604
- (business: any, i: number) => (
605
- <BusinessController
606
- key={`${business.id}_` + i}
607
- enableIntersection
608
- business={business}
609
- isBusinessOpen={business.open}
610
- handleCustomClick={handleBusinessClick}
611
- orderType={orderState?.options?.type}
612
- navigation={navigation}
613
- businessHeader={business?.header}
614
- businessFeatured={business?.featured}
615
- businessLogo={business?.logo}
616
- businessReviews={business?.reviews}
617
- businessDeliveryPrice={business?.delivery_price}
618
- businessDeliveryTime={business?.delivery_time}
619
- businessPickupTime={business?.pickup_time}
620
- businessDistance={business?.distance}
621
- handleUpdateBusinessList={handleUpdateBusinessList}
622
- favoriteIds={favoriteIds}
623
- setFavoriteIds={setFavoriteIds}
624
- />
625
- )
626
- )}
627
- {(businessesList.loading || !businessesList?.fetched) && (
628
- <>
629
- {[
630
- ...Array(
631
- paginationProps.nextPageItems
632
- ? paginationProps.nextPageItems
633
- : 8,
634
- ).keys(),
635
- ].map((item, i) => (
636
- <Placeholder
637
- Animation={Fade}
638
- key={i}
639
- style={{ marginBottom: 20 }}>
640
- <View style={{ width: '100%' }}>
641
- <PlaceholderLine
642
- height={200}
643
- style={{ marginBottom: 20, borderRadius: 25 }}
644
- />
645
- <View style={{ paddingHorizontal: 10 }}>
646
- <View
647
- style={{
648
- flexDirection: 'row',
649
- justifyContent: 'space-between',
650
- }}>
651
- <PlaceholderLine
652
- height={25}
653
- width={40}
654
- style={{ marginBottom: 10 }}
655
- />
656
- <PlaceholderLine
657
- height={25}
658
- width={20}
659
- style={{ marginBottom: 10 }}
660
- />
661
- </View>
662
- <PlaceholderLine
663
- height={20}
664
- width={30}
665
- style={{ marginBottom: 10 }}
666
- />
667
- <PlaceholderLine
668
- height={20}
669
- width={80}
670
- style={{ marginBottom: 10 }}
671
- />
672
- </View>
673
- </View>
674
- </Placeholder>
675
- ))}
676
- </>
677
- )}
678
- </ListWrapper>
679
- <OModal
680
- open={isOpenCities}
681
- onClose={() => setIsOpenCities(false)}
682
- title={t('SELECT_A_CITY', 'Select a city')}
683
- >
684
- <CitiesControl
685
- cities={citiesState?.cities}
686
- onClose={() => setIsOpenCities(false)}
687
- handleChangeCity={handleChangeCity}
688
- />
689
- </OModal>
690
- </IOScrollView>
293
+ <FlatListBusinessListing
294
+ {...props}
295
+ navigation={navigation}
296
+ businessesList={businessesList}
297
+ enabledPoweredByOrdering={enabledPoweredByOrdering}
298
+ orderTypeValue={orderTypeValue}
299
+ allCitiesDisabled={allCitiesDisabled}
300
+ featuredBusiness={featuredBusiness}
301
+ favoriteIds={favoriteIds}
302
+ isFarAway={isFarAway}
303
+ isOpenCities={isOpenCities}
304
+ isChewLayout={isChewLayout}
305
+ handleScroll={handleScroll}
306
+ setIsOpenCities={setIsOpenCities}
307
+ setFavoriteIds={setFavoriteIds}
308
+ handleOnRefresh={handleOnRefresh}
309
+ setOrderTypeValue={setOrderTypeValue}
310
+ handleChangeCity={handleChangeCity}
311
+ />
691
312
  );
692
313
  };
693
314
 
694
315
  export const BusinessesListing = (props: BusinessesListingParams) => {
316
+
695
317
  const BusinessesListingProps = {
696
318
  ...props,
697
319
  isForceSearch: Platform.OS === 'ios',
698
320
  UIComponent: BusinessesListingUI,
321
+ paginationSettings: {
322
+ initialPage: 1,
323
+ pageSize: 50,
324
+ controlType: 'infinity'
325
+ }
699
326
  };
700
327
 
701
328
  return <BusinessesListingController {...BusinessesListingProps} />;
@@ -61,7 +61,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
61
61
  export const HeaderWrapper = styled.ImageBackground`
62
62
  width: 100%;
63
63
  height: 270px;
64
- padding: 20px 40px;
64
+ padding: 20px;
65
65
  background-color: transparent;
66
66
  `;
67
67
 
@@ -1,4 +1,3 @@
1
-
2
1
  import React, { useState, useEffect } from 'react'
3
2
  import { useOrder, useSession, useLanguage, useConfig } from 'ordering-components/native';
4
3
 
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useState, useRef } from 'react';
2
2
  import {
3
3
  Cart as CartController,
4
4
  useOrder,
@@ -52,7 +52,11 @@ const CartUI = (props: any) => {
52
52
  preorderMaximumDays,
53
53
  preorderMinimumDays,
54
54
  cateringTypes,
55
- isFromUpselling
55
+ isFromUpselling,
56
+ cartsOpened,
57
+ setCartsOpened,
58
+ changeActiveState,
59
+ isActive
56
60
  } = props
57
61
 
58
62
  const theme = useTheme();
@@ -62,7 +66,7 @@ const CartUI = (props: any) => {
62
66
  const [{ configs }] = useConfig();
63
67
  const [{ parsePrice, parseNumber, parseDate }] = useUtils()
64
68
  const [validationFields] = useValidationFields()
65
-
69
+ const commentRef = useRef()
66
70
  const [openUpselling, setOpenUpselling] = useState(false)
67
71
  const [openChangeStore, setOpenChangeStore] = useState(false)
68
72
  const [canOpenUpselling, setCanOpenUpselling] = useState(false)
@@ -109,7 +113,7 @@ const CartUI = (props: any) => {
109
113
  }
110
114
  }
111
115
 
112
- const handleUpsellingPage = (individualCart : any) => {
116
+ const handleUpsellingPage = (individualCart: any) => {
113
117
  const isProductCartParam = !!individualCart?.products?.length
114
118
  setOpenUpselling(false)
115
119
  setCanOpenUpselling(false)
@@ -117,7 +121,7 @@ const CartUI = (props: any) => {
117
121
  const cartsAvailable: any = Object.values(orderState?.carts)
118
122
  ?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
119
123
  ?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
120
- if (cartsAvailable.length === 1 || !isMultiCheckout) {
124
+ if (cartsAvailable.length === 1 || !isMultiCheckout || !cart?.business_id) {
121
125
  const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
122
126
  onNavigationRedirect('CheckoutNavigator', {
123
127
  screen: 'CheckoutPage',
@@ -192,6 +196,14 @@ const CartUI = (props: any) => {
192
196
  return acc = acc
193
197
  }, cart?.subtotal)
194
198
 
199
+ const handleClickCheckout = () => {
200
+ if (cart?.business_id) {
201
+ setOpenUpselling(true)
202
+ } else {
203
+ handleUpsellingPage(cart)
204
+ }
205
+ }
206
+
195
207
  useEffect(() => {
196
208
  const limitDays = parseInt(preorderMaximumDays ?? configs?.max_days_preorder?.value, 10)
197
209
  const currentDate = new Date()
@@ -228,10 +240,15 @@ const CartUI = (props: any) => {
228
240
  handleCartOpen={handleCartOpen}
229
241
  onNavigationRedirect={props.onNavigationRedirect}
230
242
  handleChangeStore={() => setOpenChangeStore(true)}
231
- handleClickCheckout={() => setOpenUpselling(true)}
243
+ handleClickCheckout={() => handleClickCheckout()}
232
244
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
233
245
  isMultiCheckout={isMultiCheckout}
234
246
  isFromUpselling={isFromUpselling}
247
+ cartsOpened={cartsOpened}
248
+ setCartsOpened={setCartsOpened}
249
+ changeActiveState={changeActiveState}
250
+ isActive={isActive}
251
+ isGiftCart={!cart?.business_id}
235
252
  >
236
253
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
237
254
  <ProductItemAccordion
@@ -423,6 +440,7 @@ const CartUI = (props: any) => {
423
440
  cart?.status !== 2 &&
424
441
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
425
442
  driverTipsOptions && driverTipsOptions?.length > 0 &&
443
+ cart?.business_id &&
426
444
  (
427
445
  <DriverTipsContainer>
428
446
  <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
@@ -489,6 +507,7 @@ const CartUI = (props: any) => {
489
507
  marginTop: 10,
490
508
  borderRadius: 7.6
491
509
  }}
510
+ forwardRef={commentRef}
492
511
  multiline
493
512
  />
494
513
  {commentState?.loading && (
@@ -521,7 +540,7 @@ const CartUI = (props: any) => {
521
540
  />
522
541
  </View>
523
542
  )}
524
- {!isMultiCheckout && (
543
+ {(!isMultiCheckout || !cart?.business_id) && (
525
544
  <>
526
545
  {cart?.valid_products ? (
527
546
  <CheckoutAction>
@@ -538,7 +557,7 @@ const CartUI = (props: any) => {
538
557
  borderColor={theme.colors.primary}
539
558
  imgRightSrc={null}
540
559
  textStyle={{ color: '#fff', textAlign: 'center', flex: 1 }}
541
- onClick={() => setOpenUpselling(true)}
560
+ onClick={() => handleClickCheckout()}
542
561
  style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
543
562
  />
544
563
  </CheckoutAction>