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