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