ordering-ui-react-native 0.15.85 → 0.15.86-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 (241) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +1 -1
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +16 -8
  8. package/src/components/BusinessInformation/index.tsx +14 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +25 -3
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/PaymentOptions/index.tsx +335 -365
  20. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  21. package/src/components/ReviewDriver/index.tsx +1 -1
  22. package/src/components/ReviewOrder/index.tsx +2 -1
  23. package/src/components/ReviewProducts/index.tsx +11 -0
  24. package/src/components/SignupForm/index.tsx +145 -61
  25. package/src/components/SingleProductCard/index.tsx +16 -4
  26. package/src/components/SingleProductReview/index.tsx +1 -1
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/StripeMethodForm/index.tsx +22 -24
  29. package/src/components/UpsellingProducts/index.tsx +1 -1
  30. package/src/components/UserProfileForm/index.tsx +63 -6
  31. package/src/components/UserProfileForm/styles.tsx +8 -0
  32. package/src/components/VerifyPhone/styles.tsx +1 -2
  33. package/src/components/shared/OBottomPopup.tsx +6 -2
  34. package/src/components/shared/OModal.tsx +1 -1
  35. package/src/hooks/useCountdownTimer.tsx +26 -0
  36. package/src/index.tsx +2 -0
  37. package/src/navigators/CheckoutNavigator.tsx +6 -0
  38. package/src/navigators/HomeNavigator.tsx +6 -0
  39. package/src/pages/BusinessesListing.tsx +7 -6
  40. package/src/pages/MultiCheckout.tsx +31 -0
  41. package/src/pages/MultiOrdersDetails.tsx +27 -0
  42. package/src/pages/OrderDetails.tsx +1 -1
  43. package/src/pages/ReviewDriver.tsx +2 -2
  44. package/src/pages/ReviewOrder.tsx +2 -2
  45. package/src/theme.json +0 -1
  46. package/src/types/index.tsx +18 -11
  47. package/src/utils/index.tsx +28 -29
  48. package/themes/business/index.tsx +4 -0
  49. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +100 -60
  50. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  51. package/themes/business/src/components/Chat/index.tsx +52 -92
  52. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  53. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  54. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  55. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  56. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  57. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  58. package/themes/business/src/components/MapView/index.tsx +1 -1
  59. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  60. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  61. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  62. package/themes/business/src/components/OrderDetails/Delivery.tsx +17 -7
  63. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +26 -18
  64. package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
  65. package/themes/business/src/components/OrdersOption/index.tsx +66 -20
  66. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  67. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  70. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  71. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  72. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  73. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  74. package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
  75. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  76. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  77. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  78. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  79. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  80. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  81. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  82. package/themes/business/src/components/shared/OModal.tsx +41 -38
  83. package/themes/business/src/types/index.tsx +15 -7
  84. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  85. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  86. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  87. package/themes/kiosk/src/components/BusinessMenu/index.tsx +25 -26
  88. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  89. package/themes/kiosk/src/components/Cart/index.tsx +10 -11
  90. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  91. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  92. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  93. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  94. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  95. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  96. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  97. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  98. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  99. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  100. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  101. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  102. package/themes/kiosk/src/components/PaymentOptions/index.tsx +55 -53
  103. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  104. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  105. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  106. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  107. package/themes/kiosk/src/types/index.d.ts +1 -0
  108. package/themes/original/index.tsx +22 -0
  109. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  110. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  111. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  112. package/themes/original/src/components/AddressList/index.tsx +1 -1
  113. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  114. package/themes/original/src/components/BusinessBasicInformation/index.tsx +291 -150
  115. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  116. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  117. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  118. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
  119. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  120. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  121. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  122. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  123. package/themes/original/src/components/BusinessListingSearch/index.tsx +185 -120
  124. package/themes/original/src/components/BusinessListingSearch/styles.tsx +23 -11
  125. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  126. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  127. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  128. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  129. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  130. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  131. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  132. package/themes/original/src/components/BusinessProductsListing/index.tsx +311 -176
  133. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  134. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  135. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  136. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  137. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  138. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  139. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +663 -0
  140. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  141. package/themes/original/src/components/BusinessesListing/index.tsx +104 -462
  142. package/themes/original/src/components/Cart/index.tsx +83 -38
  143. package/themes/original/src/components/Cart/styles.tsx +4 -0
  144. package/themes/original/src/components/CartContent/index.tsx +3 -3
  145. package/themes/original/src/components/Checkout/index.tsx +128 -67
  146. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  147. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  148. package/themes/original/src/components/Favorite/index.tsx +92 -0
  149. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  150. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  151. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  152. package/themes/original/src/components/ForgotPasswordForm/index.tsx +13 -4
  153. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  154. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  155. package/themes/original/src/components/Help/index.tsx +21 -4
  156. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  157. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  158. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  159. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  160. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  161. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  162. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  163. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  164. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  165. package/themes/original/src/components/Messages/index.tsx +17 -17
  166. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  167. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  168. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  169. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  170. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  171. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  172. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  173. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  174. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  175. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  176. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  177. package/themes/original/src/components/NavBar/index.tsx +11 -5
  178. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  179. package/themes/original/src/components/OrderDetails/index.tsx +164 -81
  180. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  181. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  182. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  183. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  184. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  185. package/themes/original/src/components/OrderTypeSelector/index.tsx +78 -35
  186. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  187. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  188. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  189. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  190. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  191. package/themes/original/src/components/OrdersOption/index.tsx +138 -46
  192. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  193. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  194. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -22
  195. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  196. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  197. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  198. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  199. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  200. package/themes/original/src/components/ProductForm/index.tsx +714 -673
  201. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  202. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  203. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  204. package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
  205. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  206. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  207. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  208. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  209. package/themes/original/src/components/Promotions/index.tsx +22 -6
  210. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  211. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  212. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  213. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  214. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  215. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  216. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  217. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  218. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  219. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  220. package/themes/original/src/components/SingleProductCard/index.tsx +197 -95
  221. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  222. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  223. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  224. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  225. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  226. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  227. package/themes/original/src/components/UserProfile/index.tsx +5 -1
  228. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  229. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  230. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  231. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  232. package/themes/original/src/components/Wallets/index.tsx +177 -163
  233. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  234. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  235. package/themes/original/src/components/shared/OButton.tsx +10 -3
  236. package/themes/original/src/components/shared/OInput.tsx +3 -2
  237. package/themes/original/src/components/shared/OModal.tsx +4 -2
  238. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  239. package/themes/original/src/types/index.tsx +212 -44
  240. package/themes/original/src/utils/index.tsx +94 -1
  241. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,9 +1,9 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
3
- import { ScrollView, StyleSheet, TouchableOpacity, Platform, View } from 'react-native'
2
+ import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
3
+ import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { OButton, OIcon, OModal, OText } from '../shared'
6
+ import { OButton, OModal, OText } from '../shared'
7
7
  import { SearchBar } from '../SearchBar';
8
8
  import { BusinessController } from '../BusinessController'
9
9
  import { NotFoundSource } from '../NotFoundSource'
@@ -19,18 +19,23 @@ import {
19
19
  Metadata,
20
20
  SingleBusinessContainer,
21
21
  LoadMoreBusinessContainer,
22
- ProgressContentWrapper,
23
- ProgressBar,
24
22
  TagsContainer,
25
- SortContainer
23
+ SortContainer,
24
+ BrandContainer,
25
+ BrandItem,
26
+ PriceFilterWrapper,
27
+ OptionTitle,
28
+ BContainer
26
29
  } from './styles'
27
30
  import FastImage from 'react-native-fast-image'
28
31
  import { convertHoursToMinutes } from '../../utils'
29
32
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
30
33
  import { BusinessSearchParams } from '../../types'
31
-
32
- export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
33
-
34
+ import { MyOrders } from '../MyOrders'
35
+ import { useIsFocused } from '@react-navigation/native';
36
+ import { MaxSectionItem } from './MaxSectionItem'
37
+ import { BusinessControllerSkeletons } from './BusinessControllerSkeletons'
38
+ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
34
39
  const {
35
40
  navigation,
36
41
  businessesSearchList,
@@ -42,9 +47,15 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
42
47
  handleChangeFilters,
43
48
  filters,
44
49
  businessTypes,
45
- setFilters
50
+ setFilters,
51
+ brandList,
52
+ onNavigationRedirect,
53
+ handleUpdateBusinessList,
54
+ handleUpdateProducts
46
55
  } = props
47
56
 
57
+ const screenHeight = Dimensions.get('window').height;
58
+ const screenWidth = Dimensions.get('window').width;
48
59
  const theme = useTheme()
49
60
  const [orderState] = useOrder()
50
61
  const { top } = useSafeAreaInsets();
@@ -63,27 +74,44 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
63
74
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
64
75
  ]
65
76
 
77
+ const priceList = [
78
+ { level: '1', content: '$' },
79
+ { level: '2', content: '$$' },
80
+ { level: '3', content: '$$$' },
81
+ { level: '4', content: '$$$$' },
82
+ { level: '5', content: '$$$$$' }
83
+ ]
84
+
85
+ const isFocused = useIsFocused();
86
+
66
87
  const styles = StyleSheet.create({
67
88
  container: {
68
89
  paddingHorizontal: 40,
69
90
  width: '100%'
70
91
  },
92
+ filterContainer: {
93
+ maxHeight: screenHeight - 150,
94
+ paddingHorizontal: 40,
95
+ width: '100%'
96
+ },
71
97
  searchInput: {
72
98
  fontSize: 10,
73
99
  },
74
100
  productsContainer: {
75
101
  marginTop: 20
76
102
  },
77
- maxContainer: {
78
- flexDirection: 'row',
79
- justifyContent: 'space-between'
80
- },
81
103
  businessTypesContainer: {
82
104
  width: '100%',
83
105
  flexDirection: 'row',
84
106
  flexWrap: 'wrap',
85
107
  justifyContent: 'center'
86
108
  },
109
+ priceContainer: {
110
+ width: '100%',
111
+ flexDirection: 'row',
112
+ flexWrap: 'wrap',
113
+ justifyContent: 'space-between'
114
+ },
87
115
  categoryStyle: {
88
116
  marginRight: 10,
89
117
  marginTop: 10,
@@ -95,6 +123,16 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
95
123
  height: 28,
96
124
  borderWidth: 0
97
125
  },
126
+ priceItem: {
127
+ marginRight: 10,
128
+ marginTop: 10,
129
+ borderRadius: 50,
130
+ paddingVertical: 4,
131
+ paddingLeft: 5,
132
+ paddingRight: 5,
133
+ height: 27,
134
+ borderWidth: 0
135
+ },
98
136
  applyButton: {
99
137
  paddingHorizontal: 40,
100
138
  width: '100%',
@@ -107,7 +145,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
107
145
  }
108
146
 
109
147
  const handleCloseFilters = () => {
110
- setFilters({ business_types: [], orderBy: 'default' })
148
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
111
149
  setOpenFilters(false)
112
150
  }
113
151
 
@@ -126,11 +164,47 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
126
164
  }
127
165
  }
128
166
 
167
+ const handleChangeBrandFilter = (brandId: number) => {
168
+ let franchiseIds = [...filters?.franchise_ids]
169
+ if (filters?.franchise_ids?.includes(brandId)) franchiseIds = filters?.franchise_ids?.filter((item: any) => item !== brandId)
170
+ else franchiseIds.push(brandId)
171
+ handleChangeFilters && handleChangeFilters('franchise_ids', franchiseIds)
172
+ }
173
+
174
+ const handleChangePriceRange = (value: string) => {
175
+ if (value === filters?.price_level) handleChangeFilters('price_level', null)
176
+ else handleChangeFilters('price_level', value)
177
+ }
178
+
129
179
  const handleApplyFilters = () => {
130
180
  handleSearchbusinessAndProducts(true)
131
181
  setOpenFilters(false)
132
182
  }
133
183
 
184
+ const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
185
+
186
+ const onProductClick = (business: any, categoryId: any, productId: any) => {
187
+ if (!isInteger(business?.id) ||
188
+ !isInteger(categoryId) ||
189
+ !isInteger(productId) ||
190
+ !business.slug || !business.header || !business.logo) {
191
+ showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
192
+ return
193
+ }
194
+
195
+ navigation.navigate('ProductDetails', {
196
+ isRedirect: 'business',
197
+ businessId: business?.id,
198
+ categoryId: categoryId,
199
+ productId: productId,
200
+ business: {
201
+ store: business.slug,
202
+ header: business.header,
203
+ logo: business.logo,
204
+ }
205
+ })
206
+ }
207
+
134
208
  useEffect(() => {
135
209
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
136
210
  handleSearchbusinessAndProducts(true)
@@ -141,56 +215,13 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
141
215
  handleSearchbusinessAndProducts(true)
142
216
  }, [])
143
217
 
144
- const MaxSectionItem = ({ title, options, filter }: any) => {
145
- const parseValue = (option: number) => {
146
- return filter === 'max_distance'
147
- ? `${option / 1000} ${t('KM', 'Km')}`
148
- : filter === 'max_eta'
149
- ? `${option} ${t('MIN', 'min')}`
150
- : parsePrice(option)
151
- }
152
- return (
153
- <View style={{ marginBottom: 20 }}>
154
- <OText weight='bold' mBottom={10} size={16}>
155
- {title}
156
- </OText>
157
- <ProgressContentWrapper>
158
- <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
159
- </ProgressContentWrapper>
160
- <View style={styles.maxContainer}>
161
- {options.map((option: any, i: number) => (
162
- <TouchableOpacity
163
- onPress={() => handleChangeFilters(filter, option)}
164
- key={option}
165
- >
166
- <OText
167
- size={12}
168
- weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
169
- >
170
- {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
171
- </OText>
172
- </TouchableOpacity>
173
- ))}
174
- </View>
175
- </View>
176
- )
177
- }
218
+
219
+ useEffect(() => {
220
+ handleChangeTermValue('')
221
+ }, [isFocused])
178
222
 
179
223
  return (
180
- <ScrollView style={styles.container}>
181
- <WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
182
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', paddingVertical: 20 }}>
183
- <OIcon src={theme.images.general.arrow_left} width={20} />
184
- </TouchableOpacity>
185
- <OText
186
- size={20}
187
- mBottom={15}
188
- weight='bold'
189
- style={{ marginTop: 10 }}
190
- >
191
- {t('SEARCH', 'Search')}
192
- </OText>
193
- </WrapHeader>
224
+ <BContainer>
194
225
  <SearchWrapper>
195
226
  <SearchBar
196
227
  lazyLoad
@@ -200,7 +231,6 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
200
231
  value={termValue}
201
232
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
202
233
  />
203
-
204
234
  </SearchWrapper>
205
235
  {
206
236
  noResults && (
@@ -211,15 +241,32 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
211
241
  </View>
212
242
  )
213
243
  }
244
+ {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
245
+ <MyOrders
246
+ hideOrders
247
+ businessesSearchList={businessesSearchList}
248
+ onNavigationRedirect={onNavigationRedirect}
249
+ BusinessControllerSkeletons={BusinessControllerSkeletons}
250
+ businessPaginationProps={paginationProps}
251
+ />
252
+ )}
253
+
254
+ <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
255
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
256
+ {t('BUSINESSES', 'Businesses')}
257
+ </OText>
258
+ </OptionTitle>
214
259
  <ScrollView horizontal>
215
260
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
216
261
  <BusinessController
217
262
  key={business.id}
218
263
  business={business}
219
264
  isBusinessOpen={business.open}
265
+ enableIntersection={false}
220
266
  handleCustomClick={() => onBusinessClick(business)}
267
+ handleUpdateBusinessList={handleUpdateBusinessList}
221
268
  orderType={orderState?.options?.type}
222
- style={{ width: 320, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
269
+ style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
223
270
  />
224
271
  ))}
225
272
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
@@ -234,55 +281,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
234
281
  </LoadMoreBusinessContainer>
235
282
  )}
236
283
  {businessesSearchList.loading && (
237
- <>
238
- {[
239
- ...Array(
240
- paginationProps.nextPageItems
241
- ? paginationProps.nextPageItems
242
- : 3,
243
- ).keys(),
244
- ].map((item, i) => (
245
- <Placeholder
246
- Animation={Fade}
247
- key={i}
248
- style={{ width: 320, marginRight: 20, marginTop: 20 }}>
249
- <View style={{ width: 320 }}>
250
- <PlaceholderLine
251
- height={155}
252
- style={{ marginBottom: 20, borderRadius: 25 }}
253
- />
254
- <View style={{ paddingHorizontal: 10 }}>
255
- <View
256
- style={{
257
- flexDirection: 'row',
258
- justifyContent: 'space-between',
259
- }}>
260
- <PlaceholderLine
261
- height={25}
262
- width={40}
263
- style={{ marginBottom: 10 }}
264
- />
265
- <PlaceholderLine
266
- height={25}
267
- width={20}
268
- style={{ marginBottom: 10 }}
269
- />
270
- </View>
271
- <PlaceholderLine
272
- height={20}
273
- width={30}
274
- style={{ marginBottom: 10 }}
275
- />
276
- <PlaceholderLine
277
- height={20}
278
- width={80}
279
- style={{ marginBottom: 0 }}
280
- />
281
- </View>
282
- </View>
283
- </Placeholder>
284
- ))}
285
- </>
284
+ <BusinessControllerSkeletons paginationProps={paginationProps} />
286
285
  )}
287
286
  </ScrollView>
288
287
  <ProductsList>
@@ -329,16 +328,18 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
329
328
  style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
330
329
  />
331
330
  </SingleBusinessContainer>
332
- <ScrollView horizontal style={styles.productsContainer}>
331
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
333
332
  {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
334
333
  <SingleProductCard
335
334
  key={product?.id}
336
335
  isSoldOut={(product.inventoried && !product.quantity)}
337
336
  product={product}
337
+ enableIntersection={false}
338
338
  businessId={business?.id}
339
- onProductClick={() => { }}
339
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
340
340
  productAddedToCartLength={0}
341
- style={{ width: 320, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
341
+ handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
342
+ style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
342
343
  />
343
344
  )))}
344
345
 
@@ -388,7 +389,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
388
389
  onCancel={() => handleCloseFilters()}
389
390
  onClose={() => handleCloseFilters()}
390
391
  >
391
- <ScrollView style={styles.container}>
392
+ <ScrollView style={styles.filterContainer}>
392
393
  <OText
393
394
  size={20}
394
395
  mBottom={15}
@@ -406,7 +407,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
406
407
  onPress={() => handleChangeFilters('orderBy', item?.value)}
407
408
  style={{ marginBottom: 7 }}
408
409
  >
409
- <OText
410
+ <OText
410
411
  weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
411
412
  mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
412
413
  >
@@ -415,6 +416,70 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
415
416
  </TouchableOpacity>
416
417
  ))}
417
418
  </SortContainer>
419
+ <BrandContainer>
420
+ <OText
421
+ size={16}
422
+ weight='bold'
423
+ lineHeight={24}
424
+ style={{ marginBottom: 10 }}
425
+ >
426
+ {t('BRANDS', 'Brands')}
427
+ </OText>
428
+ {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
429
+ <ScrollView
430
+ style={{ maxHeight: 300, marginBottom: 10 }}
431
+ showsVerticalScrollIndicator={true}
432
+ nestedScrollEnabled={true}
433
+ >
434
+ {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
435
+ <BrandItem
436
+ key={i}
437
+ onPress={() => handleChangeBrandFilter(brand?.id)}
438
+ >
439
+ <OText
440
+ size={14}
441
+ weight={'400'}
442
+ lineHeight={24}
443
+ >
444
+ {brand?.name}
445
+ </OText>
446
+ {filters?.franchise_ids?.includes(brand?.id) && (
447
+ <AntDesignIcon
448
+ name='check'
449
+ color={theme.colors.success500}
450
+ size={16}
451
+ />
452
+ )}
453
+ </BrandItem>
454
+ ))}
455
+ </ScrollView>
456
+ )}
457
+ {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
458
+ <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
459
+ )}
460
+ </BrandContainer>
461
+ <PriceFilterWrapper>
462
+ <OText
463
+ size={16}
464
+ weight='bold'
465
+ lineHeight={24}
466
+ style={{ marginBottom: 5 }}
467
+ >
468
+ {t('PRICE_RANGE', 'Price range')}
469
+ </OText>
470
+ <View style={styles.priceContainer}>
471
+ {priceList.map((price: any, i: number) => (
472
+ <OButton
473
+ key={i}
474
+ bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
475
+ onClick={() => handleChangePriceRange(price?.level)}
476
+ text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
477
+ style={styles.priceItem}
478
+ textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
479
+ />
480
+ ))}
481
+ </View>
482
+ </PriceFilterWrapper>
418
483
  {orderState?.options?.type === 1 && (
419
484
  <MaxSectionItem
420
485
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
@@ -459,7 +524,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
459
524
  onClick={() => handleApplyFilters()}
460
525
  />
461
526
  </OModal>
462
- </ScrollView>
527
+ </BContainer>
463
528
  )
464
529
  }
465
530
 
@@ -1,4 +1,8 @@
1
- import styled from 'styled-components/native'
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const BContainer = styled.View`
4
+ padding: 20px 40px;
5
+ `
2
6
 
3
7
  export const WrapHeader = styled.View`
4
8
  width: 100%;
@@ -55,22 +59,30 @@ export const LoadMoreBusinessContainer = styled.View`
55
59
  margin-left: 20px;
56
60
  `
57
61
 
58
- export const ProgressBar = styled.View`
59
- height: 4px;
60
- background: ${(props: any) => props.theme.colors.textNormal};
62
+ export const TagsContainer = styled.View`
63
+ padding-bottom: 10px;
61
64
  `
62
65
 
63
- export const ProgressContentWrapper = styled.View`
64
- height: 4px;
65
- background: #F8F9FA;
66
+ export const SortContainer = styled.View`
66
67
  margin-bottom: 10px;
67
- flex: 1;
68
68
  `
69
69
 
70
- export const TagsContainer = styled.View`
70
+ export const BrandContainer = styled.View``
71
+
72
+ export const BrandItem = styled.TouchableOpacity`
73
+ flex-direction: row;
74
+ justify-content: space-between;
75
+ margin-bottom: 4px;
76
+ align-items: center;
77
+ `
71
78
 
79
+ export const PriceFilterWrapper = styled.View`
80
+ margin-bottom: 20px;
72
81
  `
73
82
 
74
- export const SortContainer = styled.View`
75
- margin-bottom: 10px;
83
+ export const OptionTitle = styled.View`
84
+ margin-top: 24px;
85
+ ${(props: any) => props.titleContent && css`
86
+ margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
87
+ `}
76
88
  `
@@ -144,7 +144,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
144
144
 
145
145
  const validateSelectedDate = (curdate: any, menu: any) => {
146
146
  const day = moment(curdate).format('d')
147
- setIsEnabled(menu?.schedule[day]?.enabled || false)
147
+ setIsEnabled(menu?.schedule?.[day]?.enabled || false)
148
148
  }
149
149
 
150
150
  const getTimes = (curdate: any, menu: any) => {
@@ -57,12 +57,12 @@ const BusinessProductsCategoriesUI = (props: any) => {
57
57
 
58
58
  if (!lazyLoadProductsRecommended) {
59
59
  if (category?.id) {
60
- scrollViewRef.current.scrollTo({
60
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
61
61
  y: categoriesLayout[`cat_${category?.id}`]?.y + productListLayout?.y - 70,
62
62
  animated: true
63
63
  })
64
64
  } else {
65
- scrollViewRef.current.scrollTo({
65
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
66
66
  y: productListLayout?.y - 70,
67
67
  animated: true
68
68
  })
@@ -0,0 +1,44 @@
1
+ import React from 'react'
2
+ import { OModal, OText, OIcon } from '../../shared'
3
+ import { ScrollView } from 'react-native'
4
+ import { useUtils } from 'ordering-components/native'
5
+
6
+ interface CategoryDescriptionParams {
7
+ openDescription?: {name: string, image: string, description: string} | null,
8
+ setOpenDescription: any;
9
+ }
10
+
11
+ function categoryDescriptionPropsAreEqual(prev : any, next : any) {
12
+ return prev.openDescription === next.openDescription
13
+ }
14
+
15
+ const CategoryDescription = (props : CategoryDescriptionParams) => {
16
+ const [{ optimizeImage }] = useUtils()
17
+ return (
18
+ <OModal
19
+ open={!!props.openDescription}
20
+ onClose={() => props.setOpenDescription(null)}
21
+ styleContainerCloseButton={{
22
+ marginLeft: -37,
23
+ width: 55,
24
+ height: 55,
25
+ marginTop: 2
26
+ }}
27
+ >
28
+ <OText size={20} style={{ paddingLeft: 70, paddingRight: 20, bottom: 25 }}>{props.openDescription?.name}</OText>
29
+ <ScrollView style={{ padding: 20 }}>
30
+ {!!props.openDescription?.image && (
31
+ <OIcon
32
+ url={optimizeImage(props.openDescription?.image, 'h_100,c_limit')}
33
+ width={240}
34
+ height={240}
35
+ style={{ borderRadius: 7.6 }}
36
+ />
37
+ )}
38
+ <OText mBottom={60}>{props.openDescription?.description}</OText>
39
+ </ScrollView>
40
+ </OModal>
41
+ )
42
+ }
43
+
44
+ export const CategoryDescriptionMemoized = React.memo(CategoryDescription,categoryDescriptionPropsAreEqual)
@@ -0,0 +1,87 @@
1
+ import React from 'react'
2
+ import { useTheme } from 'styled-components/native'
3
+ import { StyleSheet } from 'react-native'
4
+ import { SubCategoriesContainer, ContainerButton } from './styles'
5
+ import { OButton } from '../../shared'
6
+ import { useLanguage } from 'ordering-components/native'
7
+
8
+ function SubcategoriesComponentPropsAreEqual(prev: any, next: any) {
9
+ return prev.subcategoriesSelected === next.subcategoriesSelected &&
10
+ prev.category === next.category
11
+ }
12
+
13
+ interface SubcategoriesComponentParams {
14
+ subcategoriesSelected?: any,
15
+ category?: any,
16
+ onClickSubcategory: any
17
+ }
18
+
19
+ const SubcategoriesComponent = (props : SubcategoriesComponentParams) => {
20
+ const {
21
+ subcategoriesSelected,
22
+ category,
23
+ onClickSubcategory
24
+ } = props
25
+
26
+ const theme = useTheme()
27
+ const [, t] = useLanguage()
28
+ const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
29
+
30
+ const bpStyles = StyleSheet.create({
31
+ catWrap: { flexDirection: 'row', alignItems: 'center', marginBottom: 19 },
32
+ catIcon: {
33
+ borderRadius: 7.6,
34
+ shadowColor: '#000000',
35
+ shadowOpacity: 0.1,
36
+ shadowOffset: { width: 0, height: 0 },
37
+ shadowRadius: 1,
38
+ marginEnd: 13,
39
+ },
40
+ categoryButtonStyle: {
41
+ borderWidth: 0,
42
+ marginLeft: 5,
43
+ marginRight: 5,
44
+ marginBottom: 10,
45
+ height: 35,
46
+ paddingLeft: 3,
47
+ paddingRight: 3,
48
+ }
49
+ });
50
+
51
+
52
+ return (
53
+ <SubCategoriesContainer>
54
+ <ContainerButton
55
+ isSelected={allsubcategorySelected}
56
+ >
57
+ <OButton
58
+ onClick={() => onClickSubcategory(null, category)}
59
+ bgColor={allsubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
60
+ text={`${t('ALL', 'All')} ${allsubcategorySelected ? 'X' : ''}`}
61
+ style={bpStyles.categoryButtonStyle}
62
+ textStyle={{ color: allsubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
63
+ />
64
+ </ContainerButton>
65
+ {category?.subcategories?.map((subcategory: any) => {
66
+ const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
67
+ return (
68
+ <ContainerButton
69
+ key={subcategory?.id}
70
+ isSelected={isSubcategorySelected}
71
+ >
72
+ <OButton
73
+ onClick={() => onClickSubcategory(subcategory, category)}
74
+ bgColor={isSubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
75
+ text={`${subcategory?.name} ${isSubcategorySelected ? 'X' : ''}`}
76
+ style={bpStyles.categoryButtonStyle}
77
+ textStyle={{ color: isSubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
78
+ />
79
+ </ContainerButton>
80
+ )
81
+ }
82
+ )}
83
+ </SubCategoriesContainer>
84
+ )
85
+ }
86
+
87
+ export const SubcategoriesComponentMemoized = React.memo(SubcategoriesComponent, SubcategoriesComponentPropsAreEqual)
@@ -0,0 +1,12 @@
1
+ import styled from "styled-components/native";
2
+
3
+ export const SubCategoriesContainer = styled.View`
4
+ flex-direction: row;
5
+ flex-wrap: wrap;
6
+ margin-bottom: 10px;
7
+ `
8
+
9
+ export const ContainerButton = styled.View`
10
+ `
11
+
12
+ export const HeaderWrapper = styled.View``