ordering-ui-react-native 0.18.2 → 0.18.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 (263) hide show
  1. package/package.json +9 -7
  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/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  16. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  17. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  18. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  19. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  20. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  21. package/themes/business/src/components/Chat/index.tsx +163 -123
  22. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  23. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  24. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  25. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  26. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  27. package/themes/business/src/components/MapView/index.tsx +14 -10
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
  35. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
  36. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  37. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  38. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  39. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  40. package/themes/business/src/components/OrdersOption/index.tsx +43 -32
  41. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  42. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  43. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  44. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  45. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  46. package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
  47. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  48. package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
  49. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  50. package/themes/business/src/components/StoresList/index.tsx +6 -5
  51. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  52. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  53. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  54. package/themes/business/src/components/shared/OModal.tsx +16 -9
  55. package/themes/business/src/types/index.tsx +8 -0
  56. package/themes/business/src/utils/index.tsx +4 -4
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  61. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  62. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/original/index.tsx +7 -3
  69. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  70. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  71. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  72. package/themes/original/src/components/AddressList/index.tsx +5 -8
  73. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  74. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  75. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  76. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  77. package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
  78. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
  79. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  80. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  81. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  82. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  83. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  84. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  85. package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
  86. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  87. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
  90. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
  91. package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
  92. package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
  93. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  96. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
  99. package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  106. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  107. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  108. package/themes/original/src/components/Cart/index.tsx +49 -47
  109. package/themes/original/src/components/CartContent/index.tsx +99 -38
  110. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  111. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  112. package/themes/original/src/components/Checkout/index.tsx +324 -43
  113. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  114. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  115. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  116. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  117. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  118. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  119. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  120. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  121. package/themes/original/src/components/Favorite/index.tsx +4 -9
  122. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  123. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  124. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  125. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  126. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  127. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
  128. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  129. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  131. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  132. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  133. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  134. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  135. package/themes/original/src/components/Home/index.tsx +14 -5
  136. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  137. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  138. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  139. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  140. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  141. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  142. package/themes/original/src/components/Messages/index.tsx +15 -4
  143. package/themes/original/src/components/Messages/styles.tsx +1 -1
  144. package/themes/original/src/components/MomentOption/index.tsx +9 -10
  145. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  146. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  148. package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
  149. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  150. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  151. package/themes/original/src/components/MyOrders/index.tsx +16 -5
  152. package/themes/original/src/components/NavBar/index.tsx +20 -13
  153. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  154. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  155. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  156. package/themes/original/src/components/Notifications/index.tsx +4 -8
  157. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  158. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  159. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
  160. package/themes/original/src/components/OrderDetails/index.tsx +721 -670
  161. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  162. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  163. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  164. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  165. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  166. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  168. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  170. package/themes/original/src/components/OrdersOption/index.tsx +44 -21
  171. package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
  172. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  173. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  174. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  175. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  177. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  178. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  179. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  180. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  181. package/themes/original/src/components/ProductForm/index.tsx +106 -170
  182. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  183. package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
  184. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  185. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  186. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  187. package/themes/original/src/components/Promotions/index.tsx +6 -6
  188. package/themes/original/src/components/Promotions/styles.tsx +3 -3
  189. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  190. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  191. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  192. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  193. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  194. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  195. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  196. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  197. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  198. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  199. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  200. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  201. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  202. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  203. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  204. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  205. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  206. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  207. package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
  208. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  209. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  210. package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
  211. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  212. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  213. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  214. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  215. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  216. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  217. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  218. package/themes/original/src/components/Wallets/index.tsx +48 -60
  219. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  220. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  221. package/themes/original/src/components/shared/OButton.tsx +3 -3
  222. package/themes/original/src/components/shared/OInput.tsx +4 -5
  223. package/themes/original/src/components/shared/OModal.tsx +15 -17
  224. package/themes/original/src/layouts/Container.tsx +5 -3
  225. package/themes/original/src/types/index.tsx +28 -6
  226. package/themes/original/src/utils/index.tsx +180 -13
  227. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  228. package/src/navigators/BottomNavigator.tsx +0 -117
  229. package/src/navigators/CheckoutNavigator.tsx +0 -66
  230. package/src/navigators/HomeNavigator.tsx +0 -202
  231. package/src/navigators/NavigationRef.tsx +0 -7
  232. package/src/navigators/RootNavigator.tsx +0 -269
  233. package/src/pages/Account.tsx +0 -34
  234. package/src/pages/AddressForm.tsx +0 -62
  235. package/src/pages/AddressList.tsx +0 -24
  236. package/src/pages/BusinessProductsList.tsx +0 -81
  237. package/src/pages/BusinessesListing.tsx +0 -43
  238. package/src/pages/CartList.tsx +0 -49
  239. package/src/pages/Checkout.tsx +0 -101
  240. package/src/pages/ForgotPassword.tsx +0 -24
  241. package/src/pages/Help.tsx +0 -23
  242. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  243. package/src/pages/HelpGuide.tsx +0 -23
  244. package/src/pages/HelpOrder.tsx +0 -23
  245. package/src/pages/Home.tsx +0 -36
  246. package/src/pages/IntroductoryTutorial.tsx +0 -170
  247. package/src/pages/Login.tsx +0 -47
  248. package/src/pages/MomentOption.tsx +0 -30
  249. package/src/pages/MultiCheckout.tsx +0 -31
  250. package/src/pages/MultiOrdersDetails.tsx +0 -27
  251. package/src/pages/MyOrders.tsx +0 -40
  252. package/src/pages/NetworkError.tsx +0 -24
  253. package/src/pages/NotFound.tsx +0 -22
  254. package/src/pages/OrderDetails.tsx +0 -25
  255. package/src/pages/ProductDetails.tsx +0 -55
  256. package/src/pages/Profile.tsx +0 -36
  257. package/src/pages/ReviewDriver.tsx +0 -30
  258. package/src/pages/ReviewOrder.tsx +0 -32
  259. package/src/pages/ReviewProducts.tsx +0 -30
  260. package/src/pages/Sessions.tsx +0 -22
  261. package/src/pages/Signup.tsx +0 -53
  262. package/src/pages/SpinnerLoader.tsx +0 -10
  263. 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,35 +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
- const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
88
- const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
89
- const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
90
- const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
91
- const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
92
- const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
93
- const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
47
+ const allCitiesDisabled = citiesState?.cities?.every((city: any) => !city.enabled)
94
48
 
95
49
  const styles = StyleSheet.create({
96
50
  container: {
@@ -140,7 +94,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
140
94
  backgroundColor: theme.colors.white,
141
95
  borderColor: theme.colors.backgroundGray,
142
96
  borderRadius: 8,
143
- marginHorizontal: 40,
97
+ marginHorizontal: 20,
144
98
  minHeight: 45,
145
99
  paddingVertical: 5,
146
100
  paddingHorizontal: 20,
@@ -155,32 +109,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
155
109
  },
156
110
  });
157
111
 
158
- const { top } = useSafeAreaInsets();
159
-
160
112
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
161
113
  const [isFarAway, setIsFarAway] = useState(false)
162
- const [businessTypes, setBusinessTypes] = useState(null)
163
114
  const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options?.value)
164
115
  const [isOpenCities, setIsOpenCities] = useState(false)
165
- const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
166
- Number(configs?.max_days_preorder?.value) > 0
167
- const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
168
116
  const timerId = useRef<any>(false)
169
117
  const [favoriteIds, setFavoriteIds] = useState<any>([])
170
- const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
171
118
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
172
119
 
173
- const handleMomentClick = () => {
174
- if (isPreorderEnabled) {
175
- navigation.navigate('MomentOption')
176
- }
177
- }
178
-
179
- const configTypes =
180
- configs?.order_types_allowed?.value
181
- .split('|')
182
- .map((value: any) => Number(value)) || [];
183
-
184
120
  const handleScroll = ({ nativeEvent }: any) => {
185
121
  const y = nativeEvent.contentOffset.y;
186
122
  const height = nativeEvent.contentSize.height;
@@ -224,7 +160,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
224
160
 
225
161
  useEffect(() => {
226
162
  if (!businessesList?.loading) {
227
- const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
163
+ const fb = businessesList.businesses.filter((b) => b?.featured && b?.open);
228
164
  const ary = [];
229
165
  while (fb.length > 0) {
230
166
  ary.push(fb.splice(0, 2));
@@ -293,6 +229,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
293
229
  setIsOpenCities(false)
294
230
  }, [orderState?.options?.city_id])
295
231
 
232
+ useEffect(() => {
233
+ if (!citiesState?.cities?.length || !orderState?.options?.city_id) return
234
+ const selectedCity = citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)
235
+ if (!selectedCity || !selectedCity?.enabled) changeCityFilter(null)
236
+ }, [citiesState, orderState?.options?.city_id])
237
+
296
238
  if (logosLayout) {
297
239
  return (
298
240
  <BusinessLogosContainer
@@ -348,348 +290,39 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
348
290
  }
349
291
 
350
292
  return (
351
- <IOScrollView
352
- style={styles.container}
353
- onScroll={(e) => handleScroll(e)}
354
- showsVerticalScrollIndicator={false}
355
- refreshControl={
356
- <RefreshControl
357
- refreshing={refreshing}
358
- onRefresh={() => handleOnRefresh()}
359
- />
360
- }
361
- >
362
- {enabledPoweredByOrdering && auth && (
363
- <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', top: 20 }}>
364
- <OText>
365
- Powered By Ordering.co
366
- </OText>
367
- </View>
368
- )}
369
- <View style={{
370
- height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
371
- marginTop: Platform.OS == 'ios' ? 0 : 50,
372
- backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
373
- }}
374
- >
375
- {isChewLayout && (
376
- <View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
377
- <OText size={24} weight={700} color={theme.colors?.white}>
378
- {t('WELCOME', 'Welcome')} {user?.name}
379
- </OText>
380
- </View>
381
- )}
382
- <Search isChewLayout={isChewLayout}>
383
- <AddressInput
384
- isChewLayout={isChewLayout}
385
- onPress={() =>
386
- auth
387
- ? navigation.navigate('AddressList', { isFromBusinesses: true })
388
- : navigation.navigate('AddressForm', {
389
- address: orderState.options?.address,
390
- isFromBusinesses: true,
391
- isGuestUser: isGuestUser
392
- })
393
- }>
394
- <AddressInputContainer isChewLayout={isChewLayout}>
395
- <OIcon
396
- src={theme.images.general.pin}
397
- color={theme.colors.disabled}
398
- width={16}
399
- style={{ marginRight: isChewLayout ? 0 : 10 }}
400
- />
401
- <OText size={12} numberOfLines={1} style={{ flex: 1 }}>
402
- {orderState?.options?.address?.address}
403
- </OText>
404
- {!isChewLayout && (
405
- <OIcon
406
- src={theme.images.general.arrow_down}
407
- width={10}
408
- style={{ marginStart: 8 }}
409
- />
410
- )}
411
- </AddressInputContainer>
412
- </AddressInput>
413
- </Search>
414
- {isFarAway && !isChewLayout && (
415
- <FarAwayMessage style={styles.farAwayMsg}>
416
- <Ionicons name='md-warning-outline' style={styles.iconStyle} />
417
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
418
- </FarAwayMessage>
419
- )}
420
- {!isChewLayout ? (
421
- <OrderControlContainer>
422
- <View style={styles.wrapperOrderOptions}>
423
- {isPreOrderSetting && (
424
- <WrapMomentOption
425
- onPress={() => handleMomentClick()}>
426
- <OText
427
- size={12}
428
- numberOfLines={1}
429
- ellipsizeMode="tail"
430
- color={theme.colors.textSecondary}>
431
- {orderState.options?.moment
432
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
433
- : t('ASAP_ABBREVIATION', 'ASAP')}
434
- </OText>
435
- {isPreorderEnabled && (
436
- <OIcon
437
- src={theme.images.general.arrow_down}
438
- width={10}
439
- style={{ marginStart: 8 }}
440
- />
441
- )}
442
- </WrapMomentOption>
443
- )}
444
- <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
445
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
446
- <OIcon
447
- src={theme.images.general.arrow_down}
448
- width={10}
449
- style={{ marginStart: 8 }}
450
- />
451
- </WrapMomentOption>
452
- </View>
453
- </OrderControlContainer>
454
- ) : (
455
- <>
456
- {isPreOrderSetting && (
457
- <View style={{ paddingHorizontal: 30 }}>
458
- <PreorderInput
459
- isChewLayout={isChewLayout}
460
- onPress={() => handleMomentClick()}
461
- >
462
- <OText color={theme.colors.textSecondary}>
463
- {orderState.options?.moment
464
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
465
- : t('ASAP_ABBREVIATION', 'ASAP')}</OText>
466
- </PreorderInput>
467
- </View>
468
- )}
469
- </>
470
- )}
471
- </View>
472
- {!isChewLayout ? (
473
- <>
474
- {!hideHero ? (
475
- <HeaderWrapper
476
- source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
477
- style={{ paddingTop: top + 20 }}
478
- resizeMode='cover'
479
- bgHeaderHeight={bgHeaderHeight}
480
- >
481
- {!auth && (
482
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
483
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
484
- </TouchableOpacity>
485
- )}
486
- </HeaderWrapper>
487
- ) : (
488
- <>
489
- {!auth && (
490
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
491
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
492
- </TouchableOpacity>
493
- )}
494
- </>
495
- )}
496
- </>
497
- ) : (
498
- <OrderTypesContainer>
499
- <OrderTypeSelector
500
- handleChangeBusinessType={handleChangeBusinessType}
501
- isChewLayout
502
- chewOrderTypes={chewOrderTypes}
503
- handleChangeType={setOrderTypeValue}
504
- />
505
- </OrderTypesContainer>
506
- )}
507
-
508
- {!hideCities && orderTypeValue === 2 && (
509
- <View style={{ marginTop: 20 }}>
510
- <TouchableOpacity
511
- style={styles.buttonCityStyle}
512
- onPress={() => setIsOpenCities(true)}
513
- disabled={orderState?.loading}
514
- >
515
- <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
516
- {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
517
- </OText>
518
- </TouchableOpacity>
519
- </View>
520
- )}
521
- {!hidePreviousOrders && (
522
- <OrderProgress
523
- {...props}
524
- isFocused={isFocused}
525
- />
526
- )}
527
- {
528
- !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
529
- <FeaturedWrapper>
530
- <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
531
- <ScrollView
532
- showsHorizontalScrollIndicator={false}
533
- nestedScrollEnabled
534
- horizontal
535
- contentContainerStyle={{ paddingHorizontal: 40 }}
536
- >
537
- {featuredBusiness.map((bAry: any, idx) => (
538
- <View key={'f-listing_' + idx}>
539
- <BusinessFeaturedController
540
- business={bAry[0]}
541
- isBusinessOpen={bAry[0]?.open}
542
- handleCustomClick={handleBusinessClick}
543
- orderType={orderState?.options?.type}
544
- />
545
- {bAry.length > 1 && (
546
- <BusinessFeaturedController
547
- business={bAry[1]}
548
- isBusinessOpen={bAry[1]?.open}
549
- handleCustomClick={handleBusinessClick}
550
- orderType={orderState?.options?.type}
551
- />
552
- )}
553
- </View>
554
- ))}
555
- </ScrollView>
556
- </FeaturedWrapper>
557
- )
558
- }
559
- {!isChewLayout && !hideHighestBusiness && (
560
- <>
561
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
562
- {
563
- !businessId && !props.franchiseId && (
564
- <HighestRatedBusinesses
565
- onBusinessClick={handleBusinessClick}
566
- navigation={navigation}
567
- favoriteIds={favoriteIds}
568
- setFavoriteIds={setFavoriteIds}
569
- />
570
- )
571
- }
572
- </>
573
- )}
574
-
575
- <PageBanner position='app_business_listing' navigation={navigation} />
576
-
577
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
578
- <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
579
- {!businessId && !isAllCategoriesHidden && (
580
- <BusinessTypeFilter
581
- images={props.images}
582
- businessTypes={props.businessTypes}
583
- defaultBusinessType={props.defaultBusinessType}
584
- handleChangeBusinessType={handleChangeBusinessType}
585
- setBusinessTypes={setBusinessTypes}
586
- />
587
- )}
588
- {!businessesList.loading && businessesList.businesses.length === 0 && (
589
- <NotFoundSource
590
- content={t(
591
- 'NOT_FOUND_BUSINESSES',
592
- 'No businesses to delivery / pick up at this address, please change filters or change address.',
593
- )}
594
- />
595
- )}
596
- {businessesList.businesses?.map(
597
- (business: any, i: number) => (
598
- <BusinessController
599
- key={`${business.id}_` + i}
600
- enableIntersection
601
- isCustomLayout={isChewLayout}
602
- business={business}
603
- isBusinessOpen={business.open}
604
- handleCustomClick={handleBusinessClick}
605
- orderType={orderState?.options?.type}
606
- navigation={navigation}
607
- businessHeader={business?.header}
608
- businessFeatured={business?.featured}
609
- businessLogo={business?.logo}
610
- businessReviews={business?.reviews}
611
- businessDeliveryPrice={business?.delivery_price}
612
- businessDeliveryTime={business?.delivery_time}
613
- businessPickupTime={business?.pickup_time}
614
- businessDistance={business?.distance}
615
- handleUpdateBusinessList={handleUpdateBusinessList}
616
- favoriteIds={favoriteIds}
617
- setFavoriteIds={setFavoriteIds}
618
- />
619
- )
620
- )}
621
- {businessesList.loading && (
622
- <>
623
- {[
624
- ...Array(
625
- paginationProps.nextPageItems
626
- ? paginationProps.nextPageItems
627
- : 8,
628
- ).keys(),
629
- ].map((item, i) => (
630
- <Placeholder
631
- Animation={Fade}
632
- key={i}
633
- style={{ marginBottom: 20 }}>
634
- <View style={{ width: '100%' }}>
635
- <PlaceholderLine
636
- height={200}
637
- style={{ marginBottom: 20, borderRadius: 25 }}
638
- />
639
- <View style={{ paddingHorizontal: 10 }}>
640
- <View
641
- style={{
642
- flexDirection: 'row',
643
- justifyContent: 'space-between',
644
- }}>
645
- <PlaceholderLine
646
- height={25}
647
- width={40}
648
- style={{ marginBottom: 10 }}
649
- />
650
- <PlaceholderLine
651
- height={25}
652
- width={20}
653
- style={{ marginBottom: 10 }}
654
- />
655
- </View>
656
- <PlaceholderLine
657
- height={20}
658
- width={30}
659
- style={{ marginBottom: 10 }}
660
- />
661
- <PlaceholderLine
662
- height={20}
663
- width={80}
664
- style={{ marginBottom: 10 }}
665
- />
666
- </View>
667
- </View>
668
- </Placeholder>
669
- ))}
670
- </>
671
- )}
672
- </ListWrapper>
673
- <OModal
674
- open={isOpenCities}
675
- onClose={() => setIsOpenCities(false)}
676
- title={t('SELECT_A_CITY', 'Select a city')}
677
- >
678
- <CitiesControl
679
- cities={citiesState?.cities}
680
- onClose={() => setIsOpenCities(false)}
681
- handleChangeCity={handleChangeCity}
682
- />
683
- </OModal>
684
- </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
+ />
685
312
  );
686
313
  };
687
314
 
688
315
  export const BusinessesListing = (props: BusinessesListingParams) => {
316
+
689
317
  const BusinessesListingProps = {
690
318
  ...props,
691
319
  isForceSearch: Platform.OS === 'ios',
692
320
  UIComponent: BusinessesListingUI,
321
+ paginationSettings: {
322
+ initialPage: 1,
323
+ pageSize: 50,
324
+ controlType: 'infinity'
325
+ }
693
326
  };
694
327
 
695
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