ordering-ui-react-native 0.16.41 → 0.16.42-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 (199) hide show
  1. package/package.json +7 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/Messages/index.tsx +2 -2
  13. package/src/components/NotificationSetting/index.tsx +85 -0
  14. package/src/components/OrdersOption/index.tsx +54 -56
  15. package/src/components/PaymentOptions/index.tsx +298 -345
  16. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  17. package/src/components/ReviewDriver/index.tsx +1 -1
  18. package/src/components/ReviewOrder/index.tsx +1 -1
  19. package/src/components/ReviewProducts/index.tsx +11 -0
  20. package/src/components/SingleProductReview/index.tsx +8 -5
  21. package/src/components/StripeElementsForm/index.tsx +25 -16
  22. package/src/components/VerifyPhone/styles.tsx +1 -2
  23. package/src/components/shared/OBottomPopup.tsx +6 -2
  24. package/src/index.tsx +2 -0
  25. package/src/pages/BusinessesListing.tsx +7 -6
  26. package/src/pages/OrderDetails.tsx +1 -1
  27. package/src/pages/ReviewDriver.tsx +2 -2
  28. package/src/pages/ReviewOrder.tsx +2 -2
  29. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  30. package/src/utils/index.tsx +2 -1
  31. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  32. package/themes/business/src/components/Chat/index.tsx +40 -32
  33. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  34. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  35. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  36. package/themes/business/src/components/MapView/index.tsx +12 -1
  37. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  38. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  39. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  40. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  41. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  42. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  43. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  44. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  45. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  46. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  47. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  49. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  50. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  51. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  52. package/themes/business/src/components/PreviousOrders/index.tsx +22 -24
  53. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  54. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  55. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  56. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  57. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  58. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  59. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  60. package/themes/business/src/types/index.tsx +15 -9
  61. package/themes/business/src/utils/index.tsx +10 -0
  62. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  63. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  64. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  65. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  66. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  67. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  68. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  69. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  70. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  71. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  72. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  73. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  74. package/themes/kiosk/src/types/index.d.ts +2 -0
  75. package/themes/original/index.tsx +4 -0
  76. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  77. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  78. package/themes/original/src/components/AddressList/index.tsx +1 -1
  79. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  80. package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
  81. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  82. package/themes/original/src/components/BusinessController/index.tsx +216 -113
  83. package/themes/original/src/components/BusinessController/styles.tsx +1 -8
  84. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  85. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  86. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  87. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  88. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  89. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  90. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  91. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  92. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  93. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  94. package/themes/original/src/components/BusinessProductsListing/index.tsx +210 -115
  95. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  96. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  97. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +260 -109
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  101. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  102. package/themes/original/src/components/Cart/index.tsx +53 -15
  103. package/themes/original/src/components/Cart/styles.tsx +4 -0
  104. package/themes/original/src/components/CartContent/index.tsx +22 -16
  105. package/themes/original/src/components/Checkout/index.tsx +114 -118
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/FavoriteList/index.tsx +19 -0
  112. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  113. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  114. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  115. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  116. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  117. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  118. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  119. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  120. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  121. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -73
  122. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  123. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  124. package/themes/original/src/components/Messages/index.tsx +20 -20
  125. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  126. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  127. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  128. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  129. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  130. package/themes/original/src/components/NavBar/index.tsx +15 -9
  131. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  132. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  133. package/themes/original/src/components/Notifications/index.tsx +148 -0
  134. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  135. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  136. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  137. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  138. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  139. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  140. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  141. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  142. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  143. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  144. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  147. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  148. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  149. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  150. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  151. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  152. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  153. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  154. package/themes/original/src/components/ProductForm/index.tsx +639 -664
  155. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  156. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  157. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  158. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  159. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  160. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  161. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  162. package/themes/original/src/components/Promotions/index.tsx +232 -219
  163. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  164. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  165. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  166. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  167. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  168. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  169. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  170. package/themes/original/src/components/ServiceForm/index.tsx +410 -258
  171. package/themes/original/src/components/SignupForm/index.tsx +160 -113
  172. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  173. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  174. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  175. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  176. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  177. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  178. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  179. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  180. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  181. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  182. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  183. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  184. package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
  185. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  186. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  187. package/themes/original/src/components/Wallets/index.tsx +176 -164
  188. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  189. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  190. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  191. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  192. package/themes/original/src/components/shared/OButton.tsx +10 -3
  193. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  194. package/themes/original/src/components/shared/OInput.tsx +13 -3
  195. package/themes/original/src/layouts/Container.tsx +13 -9
  196. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  197. package/themes/original/src/types/index.tsx +82 -28
  198. package/themes/original/src/utils/index.tsx +103 -58
  199. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,5 +1,7 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react'
2
2
  import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView } from 'react-native'
3
+ import { IOScrollView } from 'react-native-intersection-observer'
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
3
5
  import { useTheme } from 'styled-components/native';
4
6
  import {
5
7
  BusinessAndProductList,
@@ -11,6 +13,7 @@ import {
11
13
  useToast,
12
14
  useConfig
13
15
  } from 'ordering-components/native'
16
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
14
17
  import { OButton, OIcon, OModal, OText } from '../shared'
15
18
  import Alert from '../../providers/AlertProvider'
16
19
  import { BusinessBasicInformation } from '../BusinessBasicInformation'
@@ -19,21 +22,26 @@ import { BusinessProductsCategories } from '../BusinessProductsCategories'
19
22
  import { BusinessProductsList } from '../BusinessProductsList'
20
23
  import { BusinessProductsListingParams } from '../../types'
21
24
  import { _retrieveStoreData, _removeStoreData } from '../../providers/StoreUtil';
25
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
26
+ import { useIsFocused } from '@react-navigation/native';
27
+
22
28
  import {
23
29
  TopHeader,
24
30
  WrapSearchBar,
25
31
  WrapContent,
26
- BusinessProductsListingContainer,
27
32
  FiltProductsContainer,
28
33
  ContainerSafeAreaView,
29
34
  BackgroundGray,
30
- ProfessionalFilterWrapper
35
+ ProfessionalFilterWrapper,
36
+ NearBusiness,
37
+ TopActions
31
38
  } from './styles'
32
39
  import { FloatingButton } from '../FloatingButton'
33
40
  import { UpsellingRedirect } from './UpsellingRedirect'
34
41
  import Animated from 'react-native-reanimated'
35
42
  import { ProfessionalFilter } from '../ProfessionalFilter';
36
43
  import { ServiceForm } from '../ServiceForm';
44
+ import { BusinessesListing } from '../BusinessesListing/Layout/Original'
37
45
 
38
46
  const PIXELS_TO_SCROLL = 2000
39
47
 
@@ -58,20 +66,28 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
58
66
  getNextProducts,
59
67
  handleUpdateProducts,
60
68
  professionalSelected,
61
- handleChangeProfessionalSelected
69
+ handleChangeProfessionalSelected,
70
+ onBusinessClick
62
71
  } = props
63
72
 
73
+ const insets = useSafeAreaInsets()
64
74
  const theme = useTheme();
65
75
  const [, t] = useLanguage()
66
76
  const [{ auth }] = useSession()
67
- const [orderState, { clearCart }] = useOrder()
77
+ const [orderState, { addProduct, updateProduct }] = useOrder()
68
78
  const [{ parsePrice }] = useUtils()
69
79
  const [, { showToast }] = useToast()
70
80
  const [{ configs }] = useConfig()
81
+ const isFocused = useIsFocused();
71
82
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
83
+
84
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
85
+ const showLogo = !theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
86
+ const hideBusinessNearCity = theme?.business_view?.components?.near_business?.hidden ?? true
87
+
72
88
  const styles = StyleSheet.create({
73
89
  mainContainer: {
74
- flex: 1,
90
+ flex: 1
75
91
  },
76
92
  BackIcon: {
77
93
  paddingRight: 20,
@@ -93,7 +109,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
93
109
  padding: 15,
94
110
  justifyContent: 'center',
95
111
  shadowColor: theme.colors.clear,
96
- }
112
+ },
113
+ businessSkeleton: {
114
+ borderRadius: 8,
115
+ marginRight: 20,
116
+ width: 56,
117
+ height: 56
118
+ },
97
119
  })
98
120
 
99
121
  const { business, loading, error } = businessState
@@ -108,26 +130,51 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
108
130
  const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
109
131
  const [openService, setOpenService] = useState(false)
110
132
  const [currentProduct, setCurrentProduct] = useState(null)
133
+ const [searchBarHeight, setSearchBarHeight] = useState(60)
111
134
 
112
135
  const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
136
+ const isQuickAddProduct = configs?.add_product_with_one_click?.value === '1'
137
+ const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
138
+
113
139
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
114
140
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
115
- const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
141
+ const filtProductsHeight = Platform.OS === 'ios' ? 0 : 100
116
142
  const onRedirect = (route: string, params?: any) => {
117
143
  navigation.navigate(route, params)
118
144
  }
119
-
120
- const onProductClick = (product: any) => {
121
- if (product?.type === 'service' && professionalSelected) {
122
- setCurrentProduct(product)
123
- setOpenService(true)
124
- return
145
+ const onProductClick = async (product: any) => {
146
+ if (product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
147
+ const isProductAddedToCart = currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)
148
+ const productQuantity = isProductAddedToCart?.quantity
149
+ const addCurrentProduct = {
150
+ ...product,
151
+ quantity: 1
152
+ }
153
+ const updateCurrentProduct = {
154
+ id: product.id,
155
+ code: isProductAddedToCart?.code,
156
+ quantity: productQuantity + 1
157
+ }
158
+ const cartData = currentCart?.business_id ? currentCart : { business_id: business.id }
159
+ if (isProductAddedToCart) {
160
+ await updateProduct(updateCurrentProduct, cartData, isQuickAddProduct)
161
+ } else {
162
+ await addProduct(addCurrentProduct, cartData, isQuickAddProduct)
163
+ }
164
+ } else {
165
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0) || 0
166
+ if (product?.type === 'service' && business?.professionals?.length > 0) {
167
+ setCurrentProduct(product)
168
+ setOpenService(true)
169
+ return
170
+ }
171
+ onRedirect('ProductDetails', {
172
+ product: product,
173
+ businessSlug: business.slug,
174
+ businessId: business.id,
175
+ productAddedToCartLength
176
+ })
125
177
  }
126
- onRedirect('ProductDetails', {
127
- product: product,
128
- businessSlug: business.slug,
129
- businessId: business.id,
130
- })
131
178
  }
132
179
 
133
180
  const handleCancel = () => {
@@ -136,7 +183,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
136
183
  }
137
184
 
138
185
  const handleUpsellingPage = () => {
139
- if (isCheckoutMultiBusinessEnabled) {
186
+ if (isCheckoutMultiBusinessEnabled && openCarts.length > 1) {
140
187
  onRedirect('CheckoutNavigator', {
141
188
  screen: 'MultiCheckout'
142
189
  })
@@ -203,7 +250,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
203
250
  multiRemoveProducts && await multiRemoveProducts(unavailableProducts, _carts)
204
251
  return
205
252
  }
206
-
253
+
207
254
  if (alreadyRemoved === 'removed') {
208
255
  setAlertState({ open: true, content: [t('NOT_AVAILABLE_PRODUCT', 'This product is not available.')] })
209
256
  }
@@ -221,32 +268,41 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
221
268
  removeCartByReOrder()
222
269
  }, [currentCart])
223
270
 
271
+ useEffect(() => {
272
+ if (!isFocused) {
273
+ handleChangeSearch('')
274
+ setIsOpenSearchBar(false)
275
+ }
276
+ }, [isFocused])
277
+
278
+ const subtotalWithTaxes = currentCart?.taxes?.reduce((acc: any, item: any) => {
279
+ if (item?.type === 1)
280
+ return acc = acc + item?.summary?.tax
281
+ return acc = acc
282
+ }, currentCart?.subtotal)
283
+
224
284
  return (
225
285
  <>
226
- <ContainerSafeAreaView
227
- style={{ flex: 1 }}
228
- isOpenFiltProducts={isOpenFiltProducts}
229
- >
286
+ <View style={{ flex: 1 }}>
230
287
  <Animated.View style={{ position: 'relative' }}>
231
- <TopHeader isIos={Platform.OS === 'ios'}>
288
+ <TopHeader
289
+ style={{
290
+ marginTop: Platform.OS === 'ios' ? insets.top : 0
291
+ }}
292
+ onLayout={(event: any) => setSearchBarHeight(event.nativeEvent.layout.height)}
293
+ >
232
294
  {!isOpenSearchBar && (
233
295
  <>
234
- <View style={{ ...styles.headerItem, flex: 1 }}>
235
- <OButton
236
- imgLeftSrc={theme.images.general.arrow_left}
237
- imgRightSrc={null}
238
- style={styles.btnBackArrow}
239
- onClick={() => handleBackNavigation()}
240
- imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
241
- />
242
- </View>
296
+ <TopActions onPress={() => handleBackNavigation()}>
297
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
298
+ </TopActions>
243
299
  {!errorQuantityProducts && (
244
300
  <View style={{ ...styles.headerItem }}>
245
301
  <TouchableOpacity
246
302
  onPress={() => setIsOpenSearchBar(true)}
247
303
  style={styles.searchIcon}
248
304
  >
249
- <OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={16} />
305
+ <OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={20} />
250
306
  </TouchableOpacity>
251
307
  </View>
252
308
  )}
@@ -255,6 +311,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
255
311
  {isOpenSearchBar && (
256
312
  <WrapSearchBar>
257
313
  <SearchBar
314
+ autoFocus
258
315
  onSearch={handleChangeSearch}
259
316
  onCancel={() => handleCancel()}
260
317
  isCancelXButtonShow
@@ -265,57 +322,88 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
265
322
  </WrapSearchBar>
266
323
  )}
267
324
  </TopHeader>
325
+ {!hideBusinessNearCity && loading && (
326
+ <NearBusiness style={{ paddingBottom: 10 }}>
327
+ <Placeholder Animation={Fade}>
328
+ <View style={{ flexDirection: 'row' }}>
329
+ {[...Array(10).keys()].map(i => (
330
+ <View style={styles.businessSkeleton} key={i}>
331
+ <PlaceholderLine style={{ width: '100%', height: '100%' }} />
332
+ </View>
333
+ ))}
334
+ </View>
335
+ </Placeholder>
336
+ </NearBusiness>
337
+ )}
338
+ {!loading && !hideBusinessNearCity && businessState?.business?.city_id && (
339
+ <NearBusiness>
340
+ <BusinessesListing
341
+ logosLayout
342
+ propsToFetch={['id', 'logo', 'location', 'timezone', 'schedule', 'open', 'slug']}
343
+ cityId={businessState?.business?.city_id}
344
+ onBusinessClick={onBusinessClick}
345
+ actualSlug={businessState?.business?.slug}
346
+ />
347
+ </NearBusiness>
348
+ )}
268
349
  </Animated.View>
269
350
 
270
351
  {business?.categories?.length > 0 && isOpenFiltProducts && (
271
- <FiltProductsContainer
272
- isIos={Platform.OS === 'ios'}
273
- style={{
274
- height: Dimensions.get('window').height - filtProductsHeight
275
- }}
276
- >
277
- <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
278
- <BusinessProductsList
279
- categories={[
280
- { id: null, name: t('ALL', 'All') },
281
- { id: 'featured', name: t('FEATURED', 'Featured') },
282
- ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
283
- ]}
284
- category={categorySelected}
285
- categoryState={categoryState}
286
- businessId={business.id}
287
- errors={errors}
288
- onProductClick={onProductClick}
289
- handleSearchRedirect={handleSearchRedirect}
290
- featured={featuredProducts}
291
- searchValue={searchValue}
292
- handleClearSearch={handleChangeSearch}
293
- errorQuantityProducts={errorQuantityProducts}
294
- handleCancelSearch={handleCancel}
295
- categoriesLayout={categoriesLayout}
296
- subcategoriesSelected={subcategoriesSelected}
297
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
298
- setCategoriesLayout={setCategoriesLayout}
299
- currentCart={currentCart}
300
- setSubcategoriesSelected={setSubcategoriesSelected}
301
- onClickCategory={handleChangeCategory}
302
- handleUpdateProducts={handleUpdateProducts}
303
- isFiltMode
304
- />
305
- </View>
306
- </FiltProductsContainer>
352
+ <FiltProductsContainer
353
+ style={{
354
+ height: Dimensions.get('window').height - filtProductsHeight,
355
+ top: Platform.OS === 'ios' ? searchBarHeight + insets.top : searchBarHeight
356
+ }}
357
+ contentContainerStyle={{ flexGrow: 1 }}
358
+ >
359
+ <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
360
+ <BusinessProductsList
361
+ categories={[
362
+ { id: null, name: t('ALL', 'All') },
363
+ { id: 'featured', name: t('FEATURED', 'Featured') },
364
+ ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
365
+ ]}
366
+ category={categorySelected}
367
+ categoryState={categoryState}
368
+ businessId={business.id}
369
+ errors={errors}
370
+ onProductClick={onProductClick}
371
+ handleSearchRedirect={handleSearchRedirect}
372
+ featured={featuredProducts}
373
+ searchValue={searchValue}
374
+ handleClearSearch={handleChangeSearch}
375
+ errorQuantityProducts={errorQuantityProducts}
376
+ handleCancelSearch={handleCancel}
377
+ categoriesLayout={categoriesLayout}
378
+ subcategoriesSelected={subcategoriesSelected}
379
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
380
+ setCategoriesLayout={setCategoriesLayout}
381
+ currentCart={currentCart}
382
+ setSubcategoriesSelected={setSubcategoriesSelected}
383
+ onClickCategory={handleChangeCategory}
384
+ handleUpdateProducts={handleUpdateProducts}
385
+ previouslyProducts={business?.previously_products}
386
+ navigation={navigation}
387
+ isFiltMode
388
+ />
389
+ </View>
390
+ </FiltProductsContainer>
307
391
  )}
308
392
  {isOpenFiltProducts && (
309
- <BackgroundGray />
393
+ <BackgroundGray isIos={Platform.OS === 'ios'} />
310
394
  )}
311
- <BusinessProductsListingContainer
312
- stickyHeaderIndices={[2]}
313
- style={styles.mainContainer}
395
+ <IOScrollView
396
+ stickyHeaderIndices={[business?.professionals?.length > 0 ? 3 : 2]}
397
+ style={{
398
+ ...styles.mainContainer,
399
+ marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
400
+ 50 : 0
401
+ }}
314
402
  ref={scrollViewRef}
315
- isActiveFloatingButtom={currentCart?.products?.length > 0 && categoryState.products.length !== 0}
316
403
  onScroll={handlePageScroll}
317
404
  onScrollBeginDrag={handleTouchDrag}
318
405
  scrollEventThrottle={16}
406
+ bounces={false}
319
407
  >
320
408
  <BusinessBasicInformation
321
409
  navigation={navigation}
@@ -341,27 +429,28 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
341
429
  />
342
430
  </ProfessionalFilterWrapper>
343
431
  )}
344
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
345
- {!loading && business?.id && (
346
- <>
347
- {!(business?.categories?.length === 0) && (
348
- <BusinessProductsCategories
349
- categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
350
- categorySelected={categorySelected}
351
- onClickCategory={handleChangeCategory}
352
- featured={featuredProducts}
353
- openBusinessInformation={openBusinessInformation}
354
- scrollViewRef={scrollViewRef}
355
- productListLayout={productListLayout}
356
- categoriesLayout={categoriesLayout}
357
- selectedCategoryId={selectedCategoryId}
358
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
359
- setSelectedCategoryId={setSelectedCategoryId}
360
- setCategoryClicked={setCategoryClicked}
361
-
362
- />
363
- )}
364
- </>
432
+ <View
433
+ style={{
434
+ height: 8,
435
+ backgroundColor: theme.colors.backgroundGray100,
436
+ marginTop: isChewLayout && showLogo ? 10 : 0
437
+ }}
438
+ />
439
+ {!loading && business?.id && !(business?.categories?.length === 0) && (
440
+ <BusinessProductsCategories
441
+ categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
442
+ categorySelected={categorySelected}
443
+ onClickCategory={handleChangeCategory}
444
+ featured={featuredProducts}
445
+ openBusinessInformation={openBusinessInformation}
446
+ scrollViewRef={scrollViewRef}
447
+ productListLayout={productListLayout}
448
+ categoriesLayout={categoriesLayout}
449
+ selectedCategoryId={selectedCategoryId}
450
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
451
+ setSelectedCategoryId={setSelectedCategoryId}
452
+ setCategoryClicked={setCategoryClicked}
453
+ />
365
454
  )}
366
455
  {!loading && business?.id && (
367
456
  <>
@@ -393,6 +482,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
393
482
  setSubcategoriesSelected={setSubcategoriesSelected}
394
483
  onClickCategory={handleChangeCategory}
395
484
  handleUpdateProducts={handleUpdateProducts}
485
+ navigation={navigation}
486
+ previouslyProducts={business?.previously_products}
396
487
  />
397
488
  </WrapContent>
398
489
  </>
@@ -415,28 +506,31 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
415
506
  isBusinessLoading={loading}
416
507
  errorQuantityProducts={errorQuantityProducts}
417
508
  handleUpdateProducts={handleUpdateProducts}
509
+ navigation={navigation}
418
510
  />
419
511
  </WrapContent>
420
512
  </>
421
513
  )}
422
- </BusinessProductsListingContainer>
514
+ </IOScrollView>
423
515
  {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
424
- <FloatingButton
425
- btnText={
426
- openUpselling
427
- ? t('LOADING', 'Loading')
428
- : currentCart?.subtotal >= currentCart?.minimum
429
- ? t('VIEW_ORDER', 'View Order')
430
- : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
431
- }
432
- isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
433
- btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
434
- btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
435
- btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
436
- btnRightValue={parsePrice(currentCart?.total)}
437
- disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
438
- handleClick={() => setOpenUpselling(true)}
439
- />
516
+ <View style={{ marginBottom: Platform.OS === 'ios' ? 20 : 0 }}>
517
+ <FloatingButton
518
+ btnText={
519
+ openUpselling
520
+ ? t('LOADING', 'Loading')
521
+ : subtotalWithTaxes >= currentCart?.minimum
522
+ ? t('VIEW_ORDER', 'View Order')
523
+ : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
524
+ }
525
+ isSecondaryBtn={subtotalWithTaxes < currentCart?.minimum || openUpselling}
526
+ btnLeftValueShow={subtotalWithTaxes >= currentCart?.minimum && currentCart?.products?.length > 0}
527
+ btnRightValueShow={subtotalWithTaxes >= currentCart?.minimum && currentCart?.products?.length > 0}
528
+ btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
529
+ btnRightValue={parsePrice(currentCart?.total)}
530
+ disabled={subtotalWithTaxes < currentCart?.minimum || openUpselling}
531
+ handleClick={() => setOpenUpselling(true)}
532
+ />
533
+ </View>
440
534
  )}
441
535
  {openUpselling && (
442
536
  <UpsellingRedirect
@@ -460,7 +554,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
460
554
  onAccept={() => setAlertState({ open: false, content: [] })}
461
555
  onClose={() => setAlertState({ open: false, content: [] })}
462
556
  />
463
- </ContainerSafeAreaView>
557
+ </View>
464
558
  <OModal
465
559
  open={openService}
466
560
  onClose={() => setOpenService(false)}
@@ -485,6 +579,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
485
579
  export const BusinessProductsListing = (props: BusinessProductsListingParams) => {
486
580
  const businessProductslistingProps = {
487
581
  ...props,
582
+ isForceSearch: Platform.OS === 'ios',
488
583
  UIComponent: BusinessProductsListingUI
489
584
  }
490
585
  return (
@@ -1,8 +1,5 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
- export const ContainerSafeAreaView = styled.SafeAreaView`
4
- `
5
-
6
3
  export const WrapHeader = styled.View`
7
4
  position: relative;
8
5
  `
@@ -14,7 +11,6 @@ export const TopHeader = styled.View`
14
11
  z-index: 1;
15
12
  height: 60px;
16
13
  min-height: 60px;
17
- margin-top: ${(props : any) => props.isIos ? '0' : '40px'};
18
14
  `
19
15
  export const AddressInput = styled.TouchableOpacity`
20
16
  flex: 1;
@@ -41,18 +37,16 @@ export const BusinessProductsListingContainer = styled.ScrollView`
41
37
  export const FiltProductsContainer = styled.ScrollView`
42
38
  position: absolute;
43
39
  width: 100%;
44
- z-index: 2000;
45
- top: ${(props : any) => props.isIos ? '40px': '80px'};
46
- margin-top: 20px;
40
+ z-index: 20000;
47
41
  `
48
42
 
49
43
  export const BackgroundGray = styled.View`
50
44
  flex: 1;
51
- height: 100%;
45
+ height: ${(props: any) => props.isIos ? '80%' : '100%'};
52
46
  background-color: rgba(0,0,0,0.5);
53
- position: absolute;
54
- margin-top: 100px;
55
- z-index: 100;
47
+ position: absolute;
48
+ margin-top: 100px;
49
+ z-index: 10000;
56
50
  width: 100%;
57
51
  `
58
52
 
@@ -60,3 +54,16 @@ export const ProfessionalFilterWrapper = styled.View`
60
54
  padding-left: 40px;
61
55
  margin-bottom: 35px;
62
56
  `
57
+
58
+ export const NearBusiness = styled.View`
59
+ width: 100%;
60
+ padding-left: 20px;
61
+ max-height: 80px;
62
+ `
63
+
64
+ export const TopActions = styled.TouchableOpacity`
65
+ height: 60px;
66
+ justify-content: center;
67
+ padding-horizontal: 30px;
68
+ width: 100px;
69
+ `;
@@ -38,6 +38,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
38
38
 
39
39
  const theme = useTheme();
40
40
  const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
41
+ const defaultImage = (name : string) => theme.images?.categories?.[name.toLowerCase().replace(' ', '')]
41
42
 
42
43
  useEffect(() => {
43
44
  if(typesState?.types?.length > 0){
@@ -197,9 +198,9 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
197
198
  isOpenAllCategories && setIsOpenAllCategories(false)
198
199
  }}
199
200
  >
200
- {item.image ? (
201
+ {(defaultImage(item.name) || item.image) ? (
201
202
  <OIcon
202
- url={item.image}
203
+ url={typeof item.name === 'number' ? item.image || defaultImage(item.name) : defaultImage(item.name) || item.image}
203
204
  style={styles.logo}
204
205
  />
205
206
  ) : (