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