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