ordering-ui-react-native 0.18.3 → 0.18.4-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 (261) 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 +1 -1
  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 +64 -36
  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 +15 -17
  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/types/index.tsx +8 -0
  55. package/themes/business/src/utils/index.tsx +4 -4
  56. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  58. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  59. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  60. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  61. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  65. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  66. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  67. package/themes/original/index.tsx +7 -3
  68. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  69. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  70. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  71. package/themes/original/src/components/AddressList/index.tsx +5 -8
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  73. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  74. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  75. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  76. package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
  77. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
  78. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  79. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  80. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  81. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  82. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  83. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  84. package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
  85. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  86. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  87. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
  89. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
  90. package/themes/original/src/components/BusinessPreorder/index.tsx +11 -9
  91. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  92. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  93. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  94. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
  97. package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  105. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  106. package/themes/original/src/components/Cart/index.tsx +49 -47
  107. package/themes/original/src/components/CartContent/index.tsx +99 -38
  108. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  109. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  110. package/themes/original/src/components/Checkout/index.tsx +324 -43
  111. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  112. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  113. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  114. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  115. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  116. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  117. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  118. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  119. package/themes/original/src/components/Favorite/index.tsx +4 -9
  120. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  121. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  122. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  123. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  124. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  125. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
  126. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  127. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  128. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  129. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  130. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  131. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  132. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  133. package/themes/original/src/components/Home/index.tsx +14 -5
  134. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  135. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  136. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  137. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  138. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  139. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  140. package/themes/original/src/components/Messages/index.tsx +15 -4
  141. package/themes/original/src/components/Messages/styles.tsx +1 -1
  142. package/themes/original/src/components/MomentOption/index.tsx +9 -10
  143. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  144. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  145. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  146. package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
  147. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  148. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  149. package/themes/original/src/components/MyOrders/index.tsx +16 -5
  150. package/themes/original/src/components/NavBar/index.tsx +20 -13
  151. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  152. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  153. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  154. package/themes/original/src/components/Notifications/index.tsx +4 -8
  155. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  156. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  157. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
  158. package/themes/original/src/components/OrderDetails/index.tsx +721 -670
  159. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  160. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  161. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  162. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  163. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  164. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  165. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  166. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  167. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  168. package/themes/original/src/components/OrdersOption/index.tsx +44 -21
  169. package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
  170. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  171. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  172. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  173. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  174. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  175. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  176. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  177. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  178. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  179. package/themes/original/src/components/ProductForm/index.tsx +106 -170
  180. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  181. package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
  182. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  183. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  184. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  185. package/themes/original/src/components/Promotions/index.tsx +6 -6
  186. package/themes/original/src/components/Promotions/styles.tsx +3 -3
  187. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  188. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  189. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  190. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  191. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  192. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  193. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  194. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  195. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  196. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  197. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  198. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  199. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  200. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  201. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  202. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  203. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  204. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  205. package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
  206. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  207. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  208. package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
  209. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  210. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  211. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  212. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  213. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  214. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  215. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  216. package/themes/original/src/components/Wallets/index.tsx +48 -60
  217. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  218. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  219. package/themes/original/src/components/shared/OButton.tsx +3 -3
  220. package/themes/original/src/components/shared/OInput.tsx +4 -5
  221. package/themes/original/src/components/shared/OModal.tsx +15 -17
  222. package/themes/original/src/layouts/Container.tsx +5 -3
  223. package/themes/original/src/types/index.tsx +26 -7
  224. package/themes/original/src/utils/index.tsx +180 -13
  225. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  226. package/src/navigators/BottomNavigator.tsx +0 -117
  227. package/src/navigators/CheckoutNavigator.tsx +0 -66
  228. package/src/navigators/HomeNavigator.tsx +0 -202
  229. package/src/navigators/NavigationRef.tsx +0 -7
  230. package/src/navigators/RootNavigator.tsx +0 -269
  231. package/src/pages/Account.tsx +0 -34
  232. package/src/pages/AddressForm.tsx +0 -62
  233. package/src/pages/AddressList.tsx +0 -24
  234. package/src/pages/BusinessProductsList.tsx +0 -81
  235. package/src/pages/BusinessesListing.tsx +0 -43
  236. package/src/pages/CartList.tsx +0 -49
  237. package/src/pages/Checkout.tsx +0 -101
  238. package/src/pages/ForgotPassword.tsx +0 -24
  239. package/src/pages/Help.tsx +0 -23
  240. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  241. package/src/pages/HelpGuide.tsx +0 -23
  242. package/src/pages/HelpOrder.tsx +0 -23
  243. package/src/pages/Home.tsx +0 -36
  244. package/src/pages/IntroductoryTutorial.tsx +0 -170
  245. package/src/pages/Login.tsx +0 -47
  246. package/src/pages/MomentOption.tsx +0 -30
  247. package/src/pages/MultiCheckout.tsx +0 -31
  248. package/src/pages/MultiOrdersDetails.tsx +0 -27
  249. package/src/pages/MyOrders.tsx +0 -40
  250. package/src/pages/NetworkError.tsx +0 -24
  251. package/src/pages/NotFound.tsx +0 -22
  252. package/src/pages/OrderDetails.tsx +0 -25
  253. package/src/pages/ProductDetails.tsx +0 -55
  254. package/src/pages/Profile.tsx +0 -36
  255. package/src/pages/ReviewDriver.tsx +0 -30
  256. package/src/pages/ReviewOrder.tsx +0 -32
  257. package/src/pages/ReviewProducts.tsx +0 -30
  258. package/src/pages/Sessions.tsx +0 -22
  259. package/src/pages/Signup.tsx +0 -53
  260. package/src/pages/SpinnerLoader.tsx +0 -10
  261. package/src/pages/Splash.tsx +0 -21
@@ -1,41 +1,28 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
3
- import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
4
- import { useSafeAreaInsets } from 'react-native-safe-area-context'
2
+ import { useLanguage, BusinessSearchList, useOrder, useUtils, useEvent, showToast, ToastType } from 'ordering-components/native'
3
+ import { ScrollView, StyleSheet, Dimensions, FlatList } from 'react-native'
5
4
  import { useTheme } from 'styled-components/native'
6
- import { OButton, OModal, OText } from '../shared'
7
- import { SearchBar } from '../SearchBar';
8
- import { BusinessController } from '../BusinessController'
9
- import { NotFoundSource } from '../NotFoundSource'
5
+ import { OButton, OText } from '../shared'
6
+
10
7
  import { SingleProductCard } from '../SingleProductCard'
11
- import AntDesignIcon from 'react-native-vector-icons/AntDesign'
12
8
  import {
13
- SearchWrapper,
14
- WrapHeader,
15
- ProductsList,
16
9
  SingleBusinessSearch,
17
10
  BusinessInfo,
18
11
  BusinessInfoItem,
19
12
  Metadata,
20
13
  SingleBusinessContainer,
21
- LoadMoreBusinessContainer,
22
- TagsContainer,
23
- SortContainer,
24
- BrandContainer,
25
- BrandItem,
26
- PriceFilterWrapper,
27
- OptionTitle,
28
14
  BContainer,
29
- WrapperButtons
30
15
  } from './styles'
31
16
  import FastImage from 'react-native-fast-image'
32
17
  import { convertHoursToMinutes } from '../../utils'
33
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
34
18
  import { BusinessSearchParams } from '../../types'
35
- import { MyOrders } from '../MyOrders'
36
19
  import { useIsFocused } from '@react-navigation/native';
37
- import { MaxSectionItem } from './MaxSectionItem'
38
- import { BusinessControllerSkeletons } from './BusinessControllerSkeletons'
20
+
21
+ import { BusinessSearchHeader } from './BusinessSearchHeader'
22
+ import { BusinessSearchFooter } from './BusinessSearchFooter'
23
+
24
+ const PIXELS_TO_SCROLL = 1000
25
+
39
26
  export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
40
27
  const {
41
28
  navigation,
@@ -43,104 +30,30 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
43
30
  onBusinessClick,
44
31
  handleChangeTermValue,
45
32
  termValue,
46
- paginationProps,
47
33
  handleSearchbusinessAndProducts,
48
34
  handleChangeFilters,
49
35
  filters,
50
36
  businessTypes,
51
37
  setFilters,
52
38
  brandList,
53
- onNavigationRedirect,
54
- handleUpdateBusinessList,
55
- handleUpdateProducts,
56
- brandId
39
+ paginationProps,
40
+ handleUpdateProducts
57
41
  } = props
58
42
 
59
- const screenHeight = Dimensions.get('window').height;
60
43
  const screenWidth = Dimensions.get('window').width;
61
44
  const theme = useTheme()
62
45
  const [orderState] = useOrder()
63
- const { top } = useSafeAreaInsets();
46
+ const [events] = useEvent()
64
47
  const [, t] = useLanguage()
65
48
  const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
66
49
 
67
50
  const [openFilters, setOpenFilters] = useState(false)
68
- const noResults = (!businessesSearchList.loading && !businessesSearchList.lengthError && businessesSearchList?.businesses?.length === 0)
69
- const maxDeliveryFeeOptions = [15, 25, 35, 'default']
70
- // const maxProductPriceOptions = [5, 10, 15, 'default']
71
- const maxDistanceOptions = [1000, 2000, 5000, 'default']
72
- const maxTimeOptions = [5, 15, 30, 'default']
73
- const sortItems = [
74
- { text: t('PICKED_FOR_YOU', 'Picked for you (default)'), value: 'distance' },
75
- { text: t('DELIVERY_TIME', 'Delivery time'), value: 'delivery_time' },
76
- { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
77
- ]
78
-
79
- const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
80
-
81
- const priceList = [
82
- { level: '1', content: '$' },
83
- { level: '2', content: '$$' },
84
- { level: '3', content: '$$$' },
85
- { level: '4', content: '$$$$' },
86
- { level: '5', content: '$$$$$' }
87
- ]
88
51
 
89
52
  const isFocused = useIsFocused();
90
53
 
91
54
  const styles = StyleSheet.create({
92
- container: {
93
- paddingHorizontal: 40,
94
- width: '100%'
95
- },
96
- filterContainer: {
97
- maxHeight: screenHeight - 150,
98
- paddingHorizontal: 40,
99
- width: '100%'
100
- },
101
- searchInput: {
102
- fontSize: 12,
103
- },
104
55
  productsContainer: {
105
56
  marginTop: 20
106
- },
107
- businessTypesContainer: {
108
- width: '100%',
109
- flexDirection: 'row',
110
- flexWrap: 'wrap',
111
- justifyContent: 'center'
112
- },
113
- priceContainer: {
114
- width: '100%',
115
- flexDirection: 'row',
116
- flexWrap: 'wrap',
117
- justifyContent: 'space-between'
118
- },
119
- categoryStyle: {
120
- marginRight: 10,
121
- marginTop: 10,
122
- borderRadius: 50,
123
- paddingHorizontal: 10,
124
- paddingVertical: 4,
125
- paddingLeft: 0,
126
- paddingRight: 0,
127
- height: 28,
128
- borderWidth: 0
129
- },
130
- priceItem: {
131
- marginRight: 10,
132
- marginTop: 10,
133
- borderRadius: 50,
134
- paddingVertical: 4,
135
- paddingLeft: 5,
136
- paddingRight: 5,
137
- height: 27,
138
- borderWidth: 0
139
- },
140
- applyButton: {
141
- paddingHorizontal: 10,
142
- width: '100%',
143
- marginTop: 20
144
57
  }
145
58
  });
146
59
 
@@ -217,6 +130,25 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
217
130
  })
218
131
  }
219
132
 
133
+ const handleScroll = ({ nativeEvent }: any) => {
134
+ const y = nativeEvent.contentOffset.y;
135
+ const height = nativeEvent.contentSize.height;
136
+ const hasMore = !(
137
+ paginationProps.totalPages === paginationProps.currentPage
138
+ );
139
+
140
+ if (y + PIXELS_TO_SCROLL > height && !businessesSearchList.loading && hasMore && businessesSearchList?.businesses?.length > 0) {
141
+ handleSearchbusinessAndProducts();
142
+ }
143
+ };
144
+
145
+ const onChangeTermValue = (query: any) => {
146
+ handleChangeTermValue(query)
147
+ if (query) {
148
+ events.emit('products_searched', query)
149
+ }
150
+ }
151
+
220
152
  useEffect(() => {
221
153
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
222
154
  handleSearchbusinessAndProducts(true)
@@ -233,351 +165,114 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
233
165
  }, [isFocused])
234
166
 
235
167
  return (
236
- <BContainer
237
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
238
- >
239
- <SearchWrapper>
240
- <SearchBar
241
- lazyLoad
242
- {...(isChewLayout && { height: 55 })}
243
- inputStyle={{ ...styles.searchInput }}
244
- placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
245
- onSearch={(val: string) => handleChangeTermValue(val)}
246
- value={termValue}
247
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
248
- />
249
- </SearchWrapper>
250
- <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
251
- {t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
252
- </OText>
253
- {
254
- noResults && (
255
- <View>
256
- <NotFoundSource
257
- content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
258
- />
259
- </View>
260
- )
261
- }
262
- {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
263
- <MyOrders
264
- hideOrders
168
+ <>
169
+ <FlatList
170
+ data={businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0)}
171
+ ListFooterComponent={<BusinessSearchFooter
265
172
  businessesSearchList={businessesSearchList}
266
- onNavigationRedirect={onNavigationRedirect}
267
- BusinessControllerSkeletons={BusinessControllerSkeletons}
268
- businessPaginationProps={paginationProps}
269
- franchiseId={brandId}
270
- hideBackBtn
271
- titleStyle={{
272
- paddingHorizontal: 0,
273
- marginTop: 0,
274
- marginLeft: 0
275
- }}
276
- />
277
- )}
278
-
279
- {businessesSearchList.businesses?.length > 0 && (
280
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
281
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
282
- {t('BUSINESSES', 'Businesses')}
283
- </OText>
284
- </OptionTitle>
285
- )}
286
- <ScrollView horizontal showsHorizontalScrollIndicator={false}>
287
- {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
288
- <View
289
- key={business.id}
290
- style={{
291
- width: screenWidth - 120,
292
- marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
293
- }}
173
+ handleCloseFilters={handleCloseFilters}
174
+ handleChangeFilters={handleChangeFilters}
175
+ brandList={brandList}
176
+ filters={filters}
177
+ handleChangeBrandFilter={handleChangeBrandFilter}
178
+ handleChangePriceRange={handleChangePriceRange}
179
+ businessTypes={businessTypes}
180
+ handleApplyFilters={handleApplyFilters}
181
+ clearFilters={clearFilters}
182
+ handleChangeActiveBusinessType={handleChangeActiveBusinessType}
183
+ openFilters={openFilters}
184
+ />}
185
+ ListHeaderComponent={<BusinessSearchHeader
186
+ businessesSearchList={businessesSearchList}
187
+ onChangeTermValue={onChangeTermValue}
188
+ termValue={termValue}
189
+ handleOpenfilters={handleOpenfilters}
190
+ />}
191
+ onScroll={(e: any) => handleScroll(e)}
192
+ showsVerticalScrollIndicator={false}
193
+ keyExtractor={(business: any, index: number) => `card-${business?.id}-${index}`}
194
+ renderItem={({ item: business }: any) => (
195
+ <BContainer
196
+ style={{ paddingHorizontal: 20, paddingTop: 0, paddingBottom: 0 }}
294
197
  >
295
- <BusinessController
296
- business={business}
297
- isBusinessOpen={business.open}
298
- enableIntersection={false}
299
- handleCustomClick={() => onBusinessClick(business)}
300
- handleUpdateBusinessList={handleUpdateBusinessList}
301
- orderType={orderState?.options?.type}
302
- />
303
- </View>
304
- ))}
305
- {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
306
- <LoadMoreBusinessContainer>
307
- <OButton
308
- bgColor='transparent'
309
- borderColor={theme.colors.primary}
310
- onClick={() => handleSearchbusinessAndProducts()}
311
- text={t('LOAD_MORE_BUSINESS', 'Load more business')}
312
- textStyle={{ color: theme.colors.primary }}
313
- />
314
- </LoadMoreBusinessContainer>
315
- )}
316
- {businessesSearchList.loading && (
317
- <BusinessControllerSkeletons paginationProps={paginationProps} />
318
- )}
319
- </ScrollView>
320
- <ProductsList>
321
- {businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
322
- <SingleBusinessSearch key={`card-${business?.id}`}>
323
- <SingleBusinessContainer>
324
- <BusinessInfo>
325
- {(business?.logo || theme.images?.dummies?.businessLogo) && (
326
- <FastImage
327
- style={{ height: 48, width: 48 }}
328
- source={{
329
- uri: optimizeImage(business?.logo, 'h_120,c_limit'),
330
- priority: FastImage.priority.normal,
331
- }}
332
- resizeMode={FastImage.resizeMode.cover}
333
- />
334
- )}
335
- </BusinessInfo>
336
- <BusinessInfoItem>
337
- <OText size={12}>{business?.name}</OText>
338
- <Metadata>
339
- {orderState?.options?.type === 1 && (
340
- <>
341
- <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
342
- <OText size={10} mRight={3}>
343
- {business && parsePrice(business?.delivery_price)}
344
- </OText>
345
- </>
198
+ <SingleBusinessSearch>
199
+ <SingleBusinessContainer>
200
+ <BusinessInfo>
201
+ {(business?.logo || theme.images?.dummies?.businessLogo) && (
202
+ <FastImage
203
+ style={{ height: 48, width: 48 }}
204
+ source={{
205
+ uri: optimizeImage(business?.logo, 'h_120,c_limit'),
206
+ priority: FastImage.priority.normal,
207
+ }}
208
+ resizeMode={FastImage.resizeMode.cover}
209
+ />
346
210
  )}
347
- <OText size={10} mRight={3}>
348
- {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
349
- </OText>
350
- <OText size={10}>
351
- {parseDistance(business?.distance)}
352
- </OText>
353
- </Metadata>
354
- </BusinessInfoItem>
355
- <OButton
356
- onClick={() => onBusinessClick(business)}
357
- textStyle={{ color: theme.colors.primary, fontSize: 10 }}
358
- text={t('GO_TO_STORE', 'Go to store')}
359
- bgColor='#F5F9FF'
360
- borderColor='#fff'
361
- style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
362
- />
363
- </SingleBusinessContainer>
364
- <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
365
- {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
366
- <SingleProductCard
367
- key={product?.id}
368
- isSoldOut={(product.inventoried && !product.quantity)}
369
- product={product}
370
- enableIntersection={false}
371
- businessId={business?.id}
372
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
373
- productAddedToCartLength={0}
374
- handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
375
- style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
376
- />
377
- )))}
378
-
379
- </ScrollView>
380
- </SingleBusinessSearch>
381
- ))}
382
- {businessesSearchList?.loading && (
383
- <>
384
- {[...Array(3).keys()].map(
385
- (item, i) => (
386
- <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
387
- <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
388
- <View style={{ flexDirection: 'row' }}>
389
- <PlaceholderLine
390
- width={24}
391
- height={70}
392
- style={{ marginRight: 10, marginBottom: 10 }}
393
- />
394
- <Placeholder style={{ paddingVertical: 10 }}>
395
- <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
396
- <PlaceholderLine width={60} />
397
- </Placeholder>
398
- </View>
399
- </Placeholder>
400
- <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
401
- <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
402
- <PlaceholderLine
403
- width={24}
404
- height={70}
405
- style={{ marginRight: 10, marginBottom: 5 }}
406
- />
407
- <Placeholder style={{ paddingVertical: 10 }}>
408
- <PlaceholderLine width={60} height={10} />
409
- <PlaceholderLine width={50} height={10} />
410
- <PlaceholderLine width={70} height={10} />
411
- </Placeholder>
412
- </View>
413
- </Placeholder>
414
- </View>
415
- ),
416
- )}
417
- </>
418
- )}
419
- </ProductsList>
420
- <OModal
421
- open={openFilters}
422
- onCancel={() => handleCloseFilters()}
423
- onClose={() => handleCloseFilters()}
424
- >
425
- <ScrollView style={styles.filterContainer}>
426
- <OText
427
- size={20}
428
- mBottom={15}
429
- style={{ marginTop: 10 }}
430
- >
431
- {t('FILTER', 'Filter')}
432
- </OText>
433
- <SortContainer>
434
- <OText weight='bold' mBottom={7} size={16}>
435
- {t('SORT', 'Sort')}
436
- </OText>
437
- {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
438
- <TouchableOpacity
439
- key={item?.value}
440
- onPress={() => handleChangeFilters('orderBy', item?.value)}
441
- style={{ marginBottom: 7 }}
442
- >
443
- <OText
444
- weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
445
- mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
446
- >
447
- {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
448
- </OText>
449
- </TouchableOpacity>
450
- ))}
451
- </SortContainer>
452
- <BrandContainer>
453
- <OText
454
- size={16}
455
- weight='bold'
456
- lineHeight={24}
457
- style={{ marginBottom: 10 }}
458
- >
459
- {t('BRANDS', 'Brands')}
460
- </OText>
461
- {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
462
- <ScrollView
463
- style={{ maxHeight: 300, marginBottom: 10 }}
464
- showsVerticalScrollIndicator={true}
465
- nestedScrollEnabled={true}
466
- >
467
- {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
468
- <BrandItem
469
- key={i}
470
- onPress={() => handleChangeBrandFilter(brand?.id)}
471
- >
472
- <OText
473
- size={14}
474
- weight={'400'}
475
- lineHeight={24}
476
- >
477
- {brand?.name}
478
- </OText>
479
- {filters?.franchise_ids?.includes(brand?.id) && (
480
- <AntDesignIcon
481
- name='check'
482
- color={theme.colors.success500}
483
- size={16}
484
- />
211
+ </BusinessInfo>
212
+ <BusinessInfoItem>
213
+ <OText size={12}>{business?.name}</OText>
214
+ <Metadata>
215
+ {orderState?.options?.type === 1 && (
216
+ <>
217
+ <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
218
+ <OText size={10} mRight={3}>
219
+ {business && parsePrice(business?.delivery_price)}
220
+ </OText>
221
+ </>
485
222
  )}
486
- </BrandItem>
487
- ))}
488
- </ScrollView>
489
- )}
490
- {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
491
- <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
492
- )}
493
- </BrandContainer>
494
- <PriceFilterWrapper>
495
- <OText
496
- size={16}
497
- weight='bold'
498
- lineHeight={24}
499
- style={{ marginBottom: 5 }}
500
- >
501
- {t('PRICE_RANGE', 'Price range')}
502
- </OText>
503
- <View style={styles.priceContainer}>
504
- {priceList.map((price: any, i: number) => (
223
+ <OText size={10} mRight={3}>
224
+ {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
225
+ </OText>
226
+ <OText size={10}>
227
+ {parseDistance(business?.distance)}
228
+ </OText>
229
+ </Metadata>
230
+ </BusinessInfoItem>
505
231
  <OButton
506
- key={i}
507
- bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
508
- onClick={() => handleChangePriceRange(price?.level)}
509
- text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
510
- style={styles.priceItem}
511
- textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
232
+ onClick={() => onBusinessClick(business)}
233
+ textStyle={{ color: theme.colors.primary, fontSize: 10 }}
234
+ text={t('GO_TO_STORE', 'Go to store')}
235
+ style={{
236
+ borderRadius: 23,
237
+ paddingLeft: 10,
238
+ paddingRight: 10,
239
+ height: 23,
240
+ shadowOpacity: 0,
241
+ backgroundColor: theme.colors.primaryContrast,
242
+ borderWidth: 0
243
+ }}
512
244
  />
513
- ))}
514
- </View>
515
- </PriceFilterWrapper>
516
- {orderState?.options?.type === 1 && (
517
- <MaxSectionItem
518
- filters={filters}
519
- title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
520
- options={maxDeliveryFeeOptions}
521
- filter='max_delivery_price'
522
- handleChangeFilters={handleChangeFilters}
523
- />
524
- )}
525
- {[1, 2].includes(orderState?.options?.type) && (
526
- <MaxSectionItem
527
- filters={filters}
528
- title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
529
- options={maxTimeOptions}
530
- filter='max_eta'
531
- handleChangeFilters={handleChangeFilters}
532
- />
533
- )}
534
- <MaxSectionItem
535
- filters={filters}
536
- title={t('MAX_DISTANCE', 'Max distance')}
537
- options={maxDistanceOptions}
538
- filter='max_distance'
539
- handleChangeFilters={handleChangeFilters}
540
- />
541
- {businessTypes?.length > 0 && (
542
- <TagsContainer>
543
- <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
544
- <View style={styles.businessTypesContainer}>
545
- {businessTypes.map((type: any, i: number) => type.enabled && (
546
- <OButton
547
- key={type?.id}
548
- bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
549
- onClick={() => handleChangeActiveBusinessType(type)}
550
- text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
551
- style={styles.categoryStyle}
552
- textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
245
+ </SingleBusinessContainer>
246
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
247
+ {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
248
+ <SingleProductCard
249
+ key={product?.id}
250
+ isSoldOut={(product.inventoried && !product.quantity)}
251
+ product={product}
252
+ enableIntersection={false}
253
+ businessId={business?.id}
254
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
255
+ productAddedToCartLength={0}
256
+ handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
257
+ style={{
258
+ width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
259
+ maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
260
+ marginRight: 20
261
+ }}
553
262
  />
554
- ))}
555
- </View>
556
- </TagsContainer>
557
- )}
558
- </ScrollView>
559
- <WrapperButtons>
560
- <View style={{ width: '50%' }}>
561
- <OButton
562
- text={t('APPLY', 'Apply')}
563
- parentStyle={styles.applyButton}
564
- textStyle={{ color: '#fff' }}
565
- onClick={() => handleApplyFilters()}
566
- />
567
- </View>
568
- <View style={{ width: '50%' }}>
569
- <OButton
570
- text={t('CLEAR_FILTERS', 'Clear')}
571
- bgColor={theme.colors.white}
572
- borderColor={theme.colors.primary}
573
- parentStyle={styles.applyButton}
574
- textStyle={{ color: theme.colors.primary }}
575
- onClick={() => clearFilters()}
576
- />
577
- </View>
578
- </WrapperButtons>
579
- </OModal>
580
- </BContainer>
263
+ )))}
264
+ </ScrollView>
265
+ </SingleBusinessSearch>
266
+ </BContainer>
267
+ )}
268
+ />
269
+ {/* <IOScrollView
270
+ onScroll={(e: any) => handleScroll(e)}
271
+ showsVerticalScrollIndicator={false}
272
+ >
273
+
274
+ </IOScrollView> */}
275
+ </>
581
276
  )
582
277
  }
583
278