ordering-ui-react-native 0.15.59 → 0.15.61-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 (207) hide show
  1. package/package.json +6 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +16 -8
  5. package/src/components/BusinessInformation/index.tsx +14 -0
  6. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +23 -2
  9. package/src/components/DriverTips/index.tsx +11 -6
  10. package/src/components/LanguageSelector/index.tsx +7 -2
  11. package/src/components/LoginForm/index.tsx +120 -30
  12. package/src/components/LoginForm/styles.tsx +6 -0
  13. package/src/components/OrderDetails/index.tsx +7 -21
  14. package/src/components/PaymentOptions/index.tsx +67 -50
  15. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  16. package/src/components/ReviewDriver/index.tsx +1 -1
  17. package/src/components/ReviewOrder/index.tsx +2 -1
  18. package/src/components/ReviewProducts/index.tsx +11 -0
  19. package/src/components/SignupForm/index.tsx +145 -61
  20. package/src/components/SingleProductCard/index.tsx +16 -4
  21. package/src/components/SingleProductReview/index.tsx +1 -1
  22. package/src/components/StripeMethodForm/index.tsx +1 -2
  23. package/src/components/UpsellingProducts/index.tsx +1 -1
  24. package/src/components/UserProfileForm/index.tsx +63 -6
  25. package/src/components/UserProfileForm/styles.tsx +8 -0
  26. package/src/components/VerifyPhone/styles.tsx +1 -2
  27. package/src/components/shared/OModal.tsx +1 -1
  28. package/src/hooks/useCountdownTimer.tsx +26 -0
  29. package/src/navigators/CheckoutNavigator.tsx +6 -0
  30. package/src/navigators/HomeNavigator.tsx +12 -0
  31. package/src/pages/BusinessesListing.tsx +7 -6
  32. package/src/pages/MultiCheckout.tsx +31 -0
  33. package/src/pages/MultiOrdersDetails.tsx +27 -0
  34. package/src/pages/OrderDetails.tsx +1 -1
  35. package/src/pages/ReviewDriver.tsx +2 -2
  36. package/src/pages/ReviewOrder.tsx +2 -2
  37. package/src/pages/Sessions.tsx +22 -0
  38. package/src/theme.json +0 -1
  39. package/src/types/index.tsx +18 -11
  40. package/src/utils/index.tsx +68 -1
  41. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  42. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  43. package/themes/business/src/components/Chat/index.tsx +42 -90
  44. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  45. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  46. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  47. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  48. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  49. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  50. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  51. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  52. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  53. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  54. package/themes/business/src/components/OrdersOption/index.tsx +8 -4
  55. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  56. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  57. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  58. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  59. package/themes/business/src/components/shared/OModal.tsx +1 -1
  60. package/themes/business/src/types/index.tsx +8 -2
  61. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  63. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  64. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  65. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  66. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  67. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  68. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  69. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  70. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  71. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  72. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  73. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  74. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  75. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  76. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  77. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  78. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  79. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  80. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  81. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  82. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  83. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  84. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  85. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  86. package/themes/kiosk/src/types/index.d.ts +1 -0
  87. package/themes/original/index.tsx +30 -8
  88. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  89. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  90. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  91. package/themes/original/src/components/AddressList/index.tsx +30 -18
  92. package/themes/original/src/components/AppleLogin/index.tsx +9 -13
  93. package/themes/original/src/components/BusinessBasicInformation/index.tsx +137 -46
  94. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
  95. package/themes/original/src/components/BusinessController/index.tsx +29 -11
  96. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  97. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  98. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  99. package/themes/original/src/components/BusinessListingSearch/index.tsx +205 -61
  100. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  101. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  102. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  103. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  104. package/themes/original/src/components/BusinessProductsList/index.tsx +51 -53
  105. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  106. package/themes/original/src/components/BusinessProductsListing/index.tsx +301 -170
  107. package/themes/original/src/components/BusinessProductsListing/styles.tsx +27 -0
  108. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  109. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  110. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  111. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +557 -0
  112. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +107 -0
  113. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +519 -0
  114. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Original/styles.tsx} +11 -3
  115. package/themes/original/src/components/BusinessesListing/index.tsx +97 -457
  116. package/themes/original/src/components/Cart/index.tsx +61 -42
  117. package/themes/original/src/components/Checkout/index.tsx +88 -38
  118. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  119. package/themes/original/src/components/Favorite/index.tsx +92 -0
  120. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  121. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  122. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  123. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  124. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  125. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  126. package/themes/original/src/components/Help/index.tsx +21 -4
  127. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  128. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  129. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  130. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  131. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  132. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  133. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  134. package/themes/original/src/components/Messages/index.tsx +1 -1
  135. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  136. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  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 +243 -0
  140. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  141. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  142. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  143. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  144. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  145. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  146. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  147. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  148. package/themes/original/src/components/NavBar/index.tsx +4 -4
  149. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  150. package/themes/original/src/components/OrderDetails/index.tsx +151 -65
  151. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  152. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  155. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  156. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  157. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  158. package/themes/original/src/components/OrdersOption/index.tsx +130 -38
  159. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  160. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  162. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  163. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  164. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  165. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  166. package/themes/original/src/components/ProductForm/index.tsx +70 -62
  167. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  168. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  169. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  170. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  171. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  173. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  174. package/themes/original/src/components/Promotions/index.tsx +151 -133
  175. package/themes/original/src/components/Promotions/styles.tsx +3 -23
  176. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  177. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  178. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  179. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  180. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  181. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  182. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  183. package/themes/original/src/components/Sessions/index.tsx +160 -0
  184. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  185. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  186. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  187. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  188. package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
  189. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  190. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  191. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  192. package/themes/original/src/components/UserDetails/index.tsx +15 -81
  193. package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
  194. package/themes/original/src/components/UserProfile/index.tsx +52 -5
  195. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  196. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  197. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  198. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  199. package/themes/original/src/components/Wallets/index.tsx +76 -9
  200. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  201. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  202. package/themes/original/src/components/shared/OModal.tsx +4 -2
  203. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  204. package/themes/original/src/types/index.tsx +186 -35
  205. package/themes/original/src/utils/index.tsx +96 -2
  206. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  207. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react'
2
- import { View, TouchableOpacity, StyleSheet, SafeAreaView } from 'react-native'
2
+ import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView } from 'react-native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import {
5
5
  BusinessAndProductList,
@@ -12,6 +12,7 @@ import {
12
12
  useConfig
13
13
  } from 'ordering-components/native'
14
14
  import { OButton, OIcon, OModal, OText } from '../shared'
15
+ import Alert from '../../providers/AlertProvider'
15
16
  import { BusinessBasicInformation } from '../BusinessBasicInformation'
16
17
  import { SearchBar } from '../SearchBar'
17
18
  import { BusinessProductsCategories } from '../BusinessProductsCategories'
@@ -22,13 +23,19 @@ import {
22
23
  TopHeader,
23
24
  WrapSearchBar,
24
25
  WrapContent,
25
- BusinessProductsListingContainer
26
+ BusinessProductsListingContainer,
27
+ FiltProductsContainer,
28
+ ContainerSafeAreaView,
29
+ BackgroundGray,
30
+ ProfessionalFilterWrapper
26
31
  } from './styles'
27
32
  import { FloatingButton } from '../FloatingButton'
28
33
  import { UpsellingRedirect } from './UpsellingRedirect'
29
34
  import Animated from 'react-native-reanimated'
35
+ import { ProfessionalFilter } from '../ProfessionalFilter';
36
+ import { ServiceForm } from '../ServiceForm';
30
37
 
31
- const PIXELS_TO_SCROLL = 1000
38
+ const PIXELS_TO_SCROLL = 2000
32
39
 
33
40
  const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
34
41
  const {
@@ -45,7 +52,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
45
52
  errorQuantityProducts,
46
53
  header,
47
54
  logo,
55
+ alertState,
56
+ setAlertState,
57
+ multiRemoveProducts,
48
58
  getNextProducts,
59
+ handleUpdateProducts,
60
+ professionalSelected,
61
+ handleChangeProfessionalSelected
49
62
  } = props
50
63
 
51
64
  const theme = useTheme();
@@ -93,14 +106,23 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
93
106
  const [productListLayout, setProductListLayout] = useState<any>(null)
94
107
  const [isCategoryClicked, setCategoryClicked] = useState(false)
95
108
  const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
109
+ const [openService, setOpenService] = useState(false)
110
+ const [currentProduct, setCurrentProduct] = useState(null)
96
111
 
112
+ const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
97
113
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
98
-
114
+ const isOpenFiltProducts = isOpenSearchBar && !!searchValue
115
+ const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
99
116
  const onRedirect = (route: string, params?: any) => {
100
117
  navigation.navigate(route, params)
101
118
  }
102
119
 
103
120
  const onProductClick = (product: any) => {
121
+ if (product?.type === 'service' && professionalSelected) {
122
+ setCurrentProduct(product)
123
+ setOpenService(true)
124
+ return
125
+ }
104
126
  onRedirect('ProductDetails', {
105
127
  product: product,
106
128
  businessSlug: business.slug,
@@ -114,13 +136,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
114
136
  }
115
137
 
116
138
  const handleUpsellingPage = () => {
117
- onRedirect('CheckoutNavigator', {
118
- screen: 'CheckoutPage',
119
- cartUuid: currentCart?.uuid,
120
- businessLogo: logo,
121
- businessName: business?.name,
122
- cartTotal: currentCart?.total
123
- })
139
+ if (isCheckoutMultiBusinessEnabled) {
140
+ onRedirect('CheckoutNavigator', {
141
+ screen: 'MultiCheckout'
142
+ })
143
+ } else {
144
+ onRedirect('CheckoutNavigator', {
145
+ screen: 'CheckoutPage',
146
+ cartUuid: currentCart?.uuid,
147
+ businessLogo: logo,
148
+ businessName: business?.name,
149
+ cartTotal: currentCart?.total
150
+ })
151
+ }
124
152
  setOpenUpselling(false)
125
153
  }
126
154
 
@@ -165,189 +193,292 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
165
193
  navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
166
194
  }
167
195
 
196
+ const adjustBusiness = async (adjustBusinessId: number) => {
197
+ const _carts = orderState?.carts?.[adjustBusinessId]
198
+ const products = _carts?.products
199
+ const unavailableProducts = products.filter((product: any) => product.valid !== true)
200
+ const alreadyRemoved = await _retrieveStoreData('already-removed')
201
+ _removeStoreData('already-removed')
202
+ if (unavailableProducts.length > 0) {
203
+ multiRemoveProducts && await multiRemoveProducts(unavailableProducts, _carts)
204
+ return
205
+ }
206
+
207
+ if (alreadyRemoved === 'removed') {
208
+ setAlertState({ open: true, content: [t('NOT_AVAILABLE_PRODUCT', 'This product is not available.')] })
209
+ }
210
+ }
211
+
168
212
  const removeCartByReOrder = async () => {
169
- const removeCardId = await _retrieveStoreData('remove-cartId')
170
- if (currentCart && removeCardId) {
171
- clearCart(removeCardId)
172
- _removeStoreData('remove-cartId')
173
- showToast(ToastType.Info, t('PRODUCT_REMOVED', 'Products removed from cart'))
213
+ const adjustBusinessId = await _retrieveStoreData('adjust-cart-products')
214
+ if (currentCart && adjustBusinessId) {
215
+ _removeStoreData('adjust-cart-products')
216
+ adjustBusiness(adjustBusinessId)
174
217
  }
175
218
  }
176
219
 
177
220
  useEffect(() => {
178
221
  removeCartByReOrder()
179
- }, [])
222
+ }, [currentCart])
180
223
 
181
224
  return (
182
- <SafeAreaView
183
- style={{ flex: 1 }}
184
- >
185
- <Animated.View style={{ position: 'relative' }}>
186
- <TopHeader>
187
- {!isOpenSearchBar && (
188
- <>
189
- <View style={{ ...styles.headerItem, flex: 1 }}>
190
- <OButton
191
- imgLeftSrc={theme.images.general.arrow_left}
192
- imgRightSrc={null}
193
- style={styles.btnBackArrow}
194
- onClick={() => handleBackNavigation()}
195
- imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
225
+ <>
226
+ <ContainerSafeAreaView
227
+ style={{ flex: 1 }}
228
+ isOpenFiltProducts={isOpenFiltProducts}
229
+ >
230
+ <Animated.View style={{ position: 'relative' }}>
231
+ <TopHeader isIos={Platform.OS === 'ios'}>
232
+ {!isOpenSearchBar && (
233
+ <>
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>
243
+ {!errorQuantityProducts && (
244
+ <View style={{ ...styles.headerItem }}>
245
+ <TouchableOpacity
246
+ onPress={() => setIsOpenSearchBar(true)}
247
+ style={styles.searchIcon}
248
+ >
249
+ <OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={16} />
250
+ </TouchableOpacity>
251
+ </View>
252
+ )}
253
+ </>
254
+ )}
255
+ {isOpenSearchBar && (
256
+ <WrapSearchBar>
257
+ <SearchBar
258
+ onSearch={handleChangeSearch}
259
+ onCancel={() => handleCancel()}
260
+ isCancelXButtonShow
261
+ noBorderShow
262
+ placeholder={t('SEARCH_PRODUCTS', 'Search Products')}
263
+ lazyLoad={businessState?.business?.lazy_load_products_recommended}
264
+ />
265
+ </WrapSearchBar>
266
+ )}
267
+ </TopHeader>
268
+ </Animated.View>
269
+
270
+ {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
196
304
  />
197
305
  </View>
198
- {!errorQuantityProducts && (
199
- <View style={{ ...styles.headerItem }}>
200
- <TouchableOpacity
201
- onPress={() => setIsOpenSearchBar(true)}
202
- style={styles.searchIcon}
203
- >
204
- <OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={16} />
205
- </TouchableOpacity>
206
- </View>
306
+ </FiltProductsContainer>
307
+ )}
308
+ {isOpenFiltProducts && (
309
+ <BackgroundGray />
310
+ )}
311
+ <BusinessProductsListingContainer
312
+ stickyHeaderIndices={[2]}
313
+ style={styles.mainContainer}
314
+ ref={scrollViewRef}
315
+ isActiveFloatingButtom={currentCart?.products?.length > 0 && categoryState.products.length !== 0}
316
+ onScroll={handlePageScroll}
317
+ onScrollBeginDrag={handleTouchDrag}
318
+ scrollEventThrottle={16}
319
+ >
320
+ <BusinessBasicInformation
321
+ navigation={navigation}
322
+ businessState={businessState}
323
+ openBusinessInformation={openBusinessInformation}
324
+ header={header}
325
+ logo={logo}
326
+ isPreOrder={isPreOrder}
327
+ />
328
+ {business?.professionals?.length > 0 && (
329
+ <ProfessionalFilterWrapper>
330
+ <OText
331
+ size={16}
332
+ style={{ marginBottom: 16 }}
333
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
334
+ >
335
+ {t('PROFESSIONALS', 'Professionals')}
336
+ </OText>
337
+ <ProfessionalFilter
338
+ professionals={business?.professionals}
339
+ professionalSelected={professionalSelected}
340
+ handleChangeProfessionalSelected={handleChangeProfessionalSelected}
341
+ />
342
+ </ProfessionalFilterWrapper>
343
+ )}
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
+ />
207
363
  )}
208
364
  </>
209
365
  )}
210
- {isOpenSearchBar && (
211
- <WrapSearchBar>
212
- <SearchBar
213
- onSearch={handleChangeSearch}
214
- onCancel={() => handleCancel()}
215
- isCancelXButtonShow
216
- noBorderShow
217
- placeholder={t('SEARCH_PRODUCTS', 'Search Products')}
218
- lazyLoad={businessState?.business?.lazy_load_products_recommended}
219
- />
220
- </WrapSearchBar>
366
+ {!loading && business?.id && (
367
+ <>
368
+ <WrapContent
369
+ onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
370
+ >
371
+ <BusinessProductsList
372
+ categories={[
373
+ { id: null, name: t('ALL', 'All') },
374
+ { id: 'featured', name: t('FEATURED', 'Featured') },
375
+ ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
376
+ ]}
377
+ category={categorySelected}
378
+ categoryState={categoryState}
379
+ businessId={business.id}
380
+ errors={errors}
381
+ onProductClick={onProductClick}
382
+ handleSearchRedirect={handleSearchRedirect}
383
+ featured={featuredProducts}
384
+ searchValue={searchValue}
385
+ handleClearSearch={handleChangeSearch}
386
+ errorQuantityProducts={errorQuantityProducts}
387
+ handleCancelSearch={handleCancel}
388
+ categoriesLayout={categoriesLayout}
389
+ subcategoriesSelected={subcategoriesSelected}
390
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
391
+ setCategoriesLayout={setCategoriesLayout}
392
+ currentCart={currentCart}
393
+ setSubcategoriesSelected={setSubcategoriesSelected}
394
+ onClickCategory={handleChangeCategory}
395
+ handleUpdateProducts={handleUpdateProducts}
396
+ />
397
+ </WrapContent>
398
+ </>
221
399
  )}
222
- </TopHeader>
223
- </Animated.View>
224
- <BusinessProductsListingContainer
225
- stickyHeaderIndices={[2]}
226
- style={styles.mainContainer}
227
- ref={scrollViewRef}
228
- isActiveFloatingButtom={currentCart?.products?.length > 0 && categoryState.products.length !== 0}
229
- onScroll={handlePageScroll}
230
- onScrollBeginDrag={handleTouchDrag}
231
- scrollEventThrottle={16}
232
- >
233
- <BusinessBasicInformation
234
- navigation={navigation}
235
- businessState={businessState}
236
- openBusinessInformation={openBusinessInformation}
237
- header={header}
238
- logo={logo}
239
- isPreOrder={isPreOrder}
240
- />
241
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
242
- {!loading && business?.id && (
243
- <>
244
- {!(business?.categories?.length === 0) && (
400
+ {loading && !error && (
401
+ <>
245
402
  <BusinessProductsCategories
246
- categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
403
+ categories={[]}
247
404
  categorySelected={categorySelected}
248
405
  onClickCategory={handleChangeCategory}
249
406
  featured={featuredProducts}
250
407
  openBusinessInformation={openBusinessInformation}
251
- scrollViewRef={scrollViewRef}
252
- productListLayout={productListLayout}
253
- categoriesLayout={categoriesLayout}
254
- selectedCategoryId={selectedCategoryId}
255
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
256
- setSelectedCategoryId={setSelectedCategoryId}
257
- setCategoryClicked={setCategoryClicked}
258
-
408
+ loading={loading}
259
409
  />
260
- )}
261
- </>
262
- )}
263
- {!loading && business?.id && (
264
- <>
265
- <WrapContent
266
- onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
267
- >
268
- <BusinessProductsList
269
- categories={[
270
- { id: null, name: t('ALL', 'All') },
271
- { id: 'featured', name: t('FEATURED', 'Featured') },
272
- ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
273
- ]}
274
- category={categorySelected}
275
- categoryState={categoryState}
276
- businessId={business.id}
277
- errors={errors}
278
- onProductClick={onProductClick}
279
- handleSearchRedirect={handleSearchRedirect}
280
- featured={featuredProducts}
281
- searchValue={searchValue}
282
- handleClearSearch={handleChangeSearch}
283
- errorQuantityProducts={errorQuantityProducts}
284
- handleCancelSearch={handleCancel}
285
- categoriesLayout={categoriesLayout}
286
- subcategoriesSelected={subcategoriesSelected}
287
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
288
- setCategoriesLayout={setCategoriesLayout}
289
- currentCart={currentCart}
290
- setSubcategoriesSelected={setSubcategoriesSelected}
291
- />
292
- </WrapContent>
293
- </>
410
+ <WrapContent>
411
+ <BusinessProductsList
412
+ categories={[]}
413
+ category={categorySelected}
414
+ categoryState={categoryState}
415
+ isBusinessLoading={loading}
416
+ errorQuantityProducts={errorQuantityProducts}
417
+ handleUpdateProducts={handleUpdateProducts}
418
+ />
419
+ </WrapContent>
420
+ </>
421
+ )}
422
+ </BusinessProductsListingContainer>
423
+ {!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
+ />
294
440
  )}
295
- {loading && !error && (
296
- <>
297
- <BusinessProductsCategories
298
- categories={[]}
299
- categorySelected={categorySelected}
300
- onClickCategory={handleChangeCategory}
301
- featured={featuredProducts}
302
- openBusinessInformation={openBusinessInformation}
303
- loading={loading}
304
- />
305
- <WrapContent>
306
- <BusinessProductsList
307
- categories={[]}
308
- category={categorySelected}
309
- categoryState={categoryState}
310
- isBusinessLoading={loading}
311
- errorQuantityProducts={errorQuantityProducts}
312
- />
313
- </WrapContent>
314
- </>
441
+ {openUpselling && (
442
+ <UpsellingRedirect
443
+ businessId={currentCart?.business_id}
444
+ business={currentCart?.business}
445
+ cartProducts={currentCart?.products}
446
+ cart={currentCart}
447
+ setOpenUpselling={setOpenUpselling}
448
+ handleUpsellingPage={handleUpsellingPage}
449
+ handleCloseUpsellingPage={handleCloseUpsellingPage}
450
+ openUpselling={openUpselling}
451
+ canOpenUpselling={canOpenUpselling}
452
+ setCanOpenUpselling={setCanOpenUpselling}
453
+ onRedirect={onRedirect}
454
+ />
315
455
  )}
316
- </BusinessProductsListingContainer>
317
- {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
318
- <FloatingButton
319
- btnText={
320
- openUpselling
321
- ? t('LOADING', 'Loading')
322
- : currentCart?.subtotal >= currentCart?.minimum
323
- ? t('VIEW_ORDER', 'View Order')
324
- : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
325
- }
326
- isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
327
- btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
328
- btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
329
- btnLeftValue={currentCart?.products?.length}
330
- btnRightValue={parsePrice(currentCart?.total)}
331
- disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
332
- handleClick={() => setOpenUpselling(true)}
456
+ <Alert
457
+ open={alertState?.open || false}
458
+ title=''
459
+ content={[t('NOT_AVAILABLE_PRODUCTS', 'These products are not available.')]}
460
+ onAccept={() => setAlertState({ open: false, content: [] })}
461
+ onClose={() => setAlertState({ open: false, content: [] })}
333
462
  />
334
- )}
335
- {openUpselling && (
336
- <UpsellingRedirect
337
- businessId={currentCart?.business_id}
338
- business={currentCart?.business}
339
- cartProducts={currentCart?.products}
340
- cart={currentCart}
341
- setOpenUpselling={setOpenUpselling}
342
- handleUpsellingPage={handleUpsellingPage}
343
- handleCloseUpsellingPage={handleCloseUpsellingPage}
344
- openUpselling={openUpselling}
345
- canOpenUpselling={canOpenUpselling}
346
- setCanOpenUpselling={setCanOpenUpselling}
347
- onRedirect={onRedirect}
463
+ </ContainerSafeAreaView>
464
+ <OModal
465
+ open={openService}
466
+ onClose={() => setOpenService(false)}
467
+ entireModal
468
+ >
469
+ <ServiceForm
470
+ navigation={navigation}
471
+ product={currentProduct}
472
+ businessSlug={business.slug}
473
+ businessId={business.id}
474
+ professionalList={business?.professionals}
475
+ professionalSelected={professionalSelected}
476
+ handleChangeProfessional={handleChangeProfessionalSelected}
477
+ onSave={() => setOpenService(false)}
478
+ onClose={() => setOpenService(false)}
348
479
  />
349
- )}
350
- </SafeAreaView>
480
+ </OModal>
481
+ </>
351
482
  )
352
483
  }
353
484
 
@@ -1,5 +1,8 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
+ export const ContainerSafeAreaView = styled.SafeAreaView`
4
+ `
5
+
3
6
  export const WrapHeader = styled.View`
4
7
  position: relative;
5
8
  `
@@ -11,6 +14,7 @@ export const TopHeader = styled.View`
11
14
  z-index: 1;
12
15
  height: 60px;
13
16
  min-height: 60px;
17
+ margin-top: ${(props : any) => props.isIos ? '0' : '40px'};
14
18
  `
15
19
  export const AddressInput = styled.TouchableOpacity`
16
20
  flex: 1;
@@ -33,3 +37,26 @@ export const BusinessProductsListingContainer = styled.ScrollView`
33
37
  margin-bottom: 50px;
34
38
  `}
35
39
  `
40
+
41
+ export const FiltProductsContainer = styled.ScrollView`
42
+ position: absolute;
43
+ width: 100%;
44
+ z-index: 2000;
45
+ top: ${(props : any) => props.isIos ? '40px': '80px'};
46
+ margin-top: 20px;
47
+ `
48
+
49
+ export const BackgroundGray = styled.View`
50
+ flex: 1;
51
+ height: 100%;
52
+ background-color: rgba(0,0,0,0.5);
53
+ position: absolute;
54
+ margin-top: 100px;
55
+ z-index: 100;
56
+ width: 100%;
57
+ `
58
+
59
+ export const ProfessionalFilterWrapper = styled.View`
60
+ padding-left: 40px;
61
+ margin-bottom: 35px;
62
+ `
@@ -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