ordering-ui-react-native 0.15.69 → 0.15.70-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 (220) 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 +23 -2
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +6 -2
  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 +67 -50
  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/StripeMethodForm/index.tsx +22 -24
  27. package/src/components/UpsellingProducts/index.tsx +1 -1
  28. package/src/components/UserProfileForm/index.tsx +63 -6
  29. package/src/components/UserProfileForm/styles.tsx +8 -0
  30. package/src/components/VerifyPhone/styles.tsx +1 -2
  31. package/src/components/shared/OBottomPopup.tsx +6 -2
  32. package/src/components/shared/OModal.tsx +1 -1
  33. package/src/hooks/useCountdownTimer.tsx +26 -0
  34. package/src/index.tsx +2 -0
  35. package/src/navigators/CheckoutNavigator.tsx +6 -0
  36. package/src/navigators/HomeNavigator.tsx +12 -0
  37. package/src/pages/BusinessesListing.tsx +7 -6
  38. package/src/pages/MultiCheckout.tsx +31 -0
  39. package/src/pages/MultiOrdersDetails.tsx +27 -0
  40. package/src/pages/OrderDetails.tsx +1 -1
  41. package/src/pages/ReviewDriver.tsx +2 -2
  42. package/src/pages/ReviewOrder.tsx +2 -2
  43. package/src/pages/Sessions.tsx +22 -0
  44. package/src/theme.json +0 -1
  45. package/src/types/index.tsx +18 -11
  46. package/src/utils/index.tsx +68 -2
  47. package/themes/business/index.tsx +4 -0
  48. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  49. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -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/NewOrderNotification/index.tsx +26 -13
  58. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  59. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  60. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  61. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  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 +2 -2
  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 +14 -7
  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 +39 -28
  75. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  76. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  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 +29 -20
  86. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  87. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  88. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  89. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  90. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  91. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  92. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  93. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  94. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  95. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  96. package/themes/kiosk/src/types/index.d.ts +1 -0
  97. package/themes/original/index.tsx +24 -0
  98. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  99. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  100. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  101. package/themes/original/src/components/AddressList/index.tsx +30 -18
  102. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  103. package/themes/original/src/components/BusinessBasicInformation/index.tsx +304 -158
  104. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  105. package/themes/original/src/components/BusinessController/index.tsx +201 -96
  106. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  107. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  108. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  109. package/themes/original/src/components/BusinessListingSearch/index.tsx +231 -63
  110. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  111. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  112. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  113. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  114. package/themes/original/src/components/BusinessProductsList/index.tsx +70 -52
  115. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  116. package/themes/original/src/components/BusinessProductsListing/index.tsx +342 -154
  117. package/themes/original/src/components/BusinessProductsListing/styles.tsx +33 -0
  118. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  119. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  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 +671 -0
  124. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  125. package/themes/original/src/components/BusinessesListing/index.tsx +104 -458
  126. package/themes/original/src/components/Cart/index.tsx +93 -43
  127. package/themes/original/src/components/Cart/styles.tsx +4 -0
  128. package/themes/original/src/components/Checkout/index.tsx +90 -39
  129. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  130. package/themes/original/src/components/Favorite/index.tsx +92 -0
  131. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  132. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  133. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  134. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  135. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  136. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  137. package/themes/original/src/components/Help/index.tsx +21 -4
  138. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  139. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  140. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  141. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  142. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  143. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  144. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  145. package/themes/original/src/components/Messages/index.tsx +1 -1
  146. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  147. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  148. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  149. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  150. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  151. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  152. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  153. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  154. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  155. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  156. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  157. package/themes/original/src/components/NavBar/index.tsx +4 -4
  158. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  159. package/themes/original/src/components/OrderDetails/index.tsx +148 -63
  160. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  161. package/themes/original/src/components/OrderItAgain/index.tsx +72 -0
  162. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  163. package/themes/original/src/components/OrderSummary/index.tsx +5 -5
  164. package/themes/original/src/components/OrderTypeSelector/index.tsx +79 -35
  165. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  166. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  168. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  170. package/themes/original/src/components/OrdersOption/index.tsx +137 -38
  171. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  172. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  173. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  174. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  175. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  176. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  177. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  178. package/themes/original/src/components/ProductForm/index.tsx +718 -679
  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 +18 -12
  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 +151 -133
  188. package/themes/original/src/components/Promotions/styles.tsx +2 -1
  189. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  190. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  191. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  192. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  193. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  194. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  195. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  196. package/themes/original/src/components/Sessions/index.tsx +160 -0
  197. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  198. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  199. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  200. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  201. package/themes/original/src/components/SingleProductCard/index.tsx +214 -90
  202. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  203. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  204. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  205. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  206. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  207. package/themes/original/src/components/UserFormDetails/index.tsx +102 -66
  208. package/themes/original/src/components/UserProfile/index.tsx +10 -1
  209. package/themes/original/src/components/UserProfileForm/index.tsx +32 -25
  210. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  211. package/themes/original/src/components/Wallets/index.tsx +25 -12
  212. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  213. package/themes/original/src/components/shared/OButton.tsx +2 -0
  214. package/themes/original/src/components/shared/OInput.tsx +3 -2
  215. package/themes/original/src/components/shared/OModal.tsx +4 -2
  216. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  217. package/themes/original/src/types/index.tsx +203 -35
  218. package/themes/original/src/utils/index.tsx +94 -1
  219. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  220. 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
- import { View, TouchableOpacity, StyleSheet, SafeAreaView } from 'react-native'
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,
@@ -9,9 +10,12 @@ import {
9
10
  useUtils,
10
11
  ToastType,
11
12
  useToast,
12
- useConfig
13
+ useConfig,
14
+ useOrderingTheme
13
15
  } from 'ordering-components/native'
16
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
14
17
  import { OButton, OIcon, OModal, OText } from '../shared'
18
+ import Alert from '../../providers/AlertProvider'
15
19
  import { BusinessBasicInformation } from '../BusinessBasicInformation'
16
20
  import { SearchBar } from '../SearchBar'
17
21
  import { BusinessProductsCategories } from '../BusinessProductsCategories'
@@ -22,13 +26,20 @@ import {
22
26
  TopHeader,
23
27
  WrapSearchBar,
24
28
  WrapContent,
25
- BusinessProductsListingContainer
29
+ FiltProductsContainer,
30
+ ContainerSafeAreaView,
31
+ BackgroundGray,
32
+ ProfessionalFilterWrapper,
33
+ NearBusiness
26
34
  } from './styles'
27
35
  import { FloatingButton } from '../FloatingButton'
28
36
  import { UpsellingRedirect } from './UpsellingRedirect'
29
37
  import Animated from 'react-native-reanimated'
38
+ import { ProfessionalFilter } from '../ProfessionalFilter';
39
+ import { ServiceForm } from '../ServiceForm';
40
+ import { BusinessesListing } from '../BusinessesListing/Layout/Original'
30
41
 
31
- const PIXELS_TO_SCROLL = 1000
42
+ const PIXELS_TO_SCROLL = 2000
32
43
 
33
44
  const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
34
45
  const {
@@ -45,10 +56,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
45
56
  errorQuantityProducts,
46
57
  header,
47
58
  logo,
59
+ alertState,
60
+ setAlertState,
61
+ multiRemoveProducts,
48
62
  getNextProducts,
63
+ handleUpdateProducts,
64
+ professionalSelected,
65
+ handleChangeProfessionalSelected,
66
+ onBusinessClick
49
67
  } = props
50
68
 
51
69
  const theme = useTheme();
70
+ const [orderingTheme] = useOrderingTheme()
52
71
  const [, t] = useLanguage()
53
72
  const [{ auth }] = useSession()
54
73
  const [orderState, { clearCart }] = useOrder()
@@ -56,9 +75,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
56
75
  const [, { showToast }] = useToast()
57
76
  const [{ configs }] = useConfig()
58
77
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
78
+
79
+ const isChewLayout = orderingTheme?.theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
80
+ const showLogo = !orderingTheme?.theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
81
+ const hideBusinessNearCity = orderingTheme?.theme?.business_view?.components?.near_business?.hidden
82
+
59
83
  const styles = StyleSheet.create({
60
84
  mainContainer: {
61
- flex: 1,
85
+ flex: 1
62
86
  },
63
87
  BackIcon: {
64
88
  paddingRight: 20,
@@ -80,7 +104,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
80
104
  padding: 15,
81
105
  justifyContent: 'center',
82
106
  shadowColor: theme.colors.clear,
83
- }
107
+ },
108
+ businessSkeleton: {
109
+ borderRadius: 8,
110
+ marginRight: 20,
111
+ width: 56,
112
+ height: 56
113
+ },
84
114
  })
85
115
 
86
116
  const { business, loading, error } = businessState
@@ -93,14 +123,23 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
93
123
  const [productListLayout, setProductListLayout] = useState<any>(null)
94
124
  const [isCategoryClicked, setCategoryClicked] = useState(false)
95
125
  const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
126
+ const [openService, setOpenService] = useState(false)
127
+ const [currentProduct, setCurrentProduct] = useState(null)
96
128
 
129
+ const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
97
130
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
98
-
131
+ const isOpenFiltProducts = isOpenSearchBar && !!searchValue
132
+ const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
99
133
  const onRedirect = (route: string, params?: any) => {
100
134
  navigation.navigate(route, params)
101
135
  }
102
136
 
103
137
  const onProductClick = (product: any) => {
138
+ if (product?.type === 'service' && professionalSelected) {
139
+ setCurrentProduct(product)
140
+ setOpenService(true)
141
+ return
142
+ }
104
143
  onRedirect('ProductDetails', {
105
144
  product: product,
106
145
  businessSlug: business.slug,
@@ -114,13 +153,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
114
153
  }
115
154
 
116
155
  const handleUpsellingPage = () => {
117
- onRedirect('CheckoutNavigator', {
118
- screen: 'CheckoutPage',
119
- cartUuid: currentCart?.uuid,
120
- businessLogo: logo,
121
- businessName: business?.name,
122
- cartTotal: currentCart?.total
123
- })
156
+ if (isCheckoutMultiBusinessEnabled) {
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
+ }
124
169
  setOpenUpselling(false)
125
170
  }
126
171
 
@@ -165,106 +210,114 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
165
210
  navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
166
211
  }
167
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
+
168
229
  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'))
230
+ const adjustBusinessId = await _retrieveStoreData('adjust-cart-products')
231
+ if (currentCart && adjustBusinessId) {
232
+ _removeStoreData('adjust-cart-products')
233
+ adjustBusiness(adjustBusinessId)
174
234
  }
175
235
  }
176
236
 
177
237
  useEffect(() => {
178
238
  removeCartByReOrder()
179
- }, [])
239
+ }, [currentCart])
180
240
 
181
241
  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 }}
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, flex: 1 }}>
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}
196
283
  />
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>
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
+ ))}
206
296
  </View>
207
- )}
208
- </>
297
+ </Placeholder>
298
+ </NearBusiness>
209
299
  )}
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}
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}
219
308
  />
220
- </WrapSearchBar>
309
+ </NearBusiness>
221
310
  )}
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
- >
311
+ </Animated.View>
312
+
313
+ {business?.categories?.length > 0 && isOpenFiltProducts && (
314
+ <FiltProductsContainer
315
+ isIos={Platform.OS === 'ios'}
316
+ style={{
317
+ height: Dimensions.get('window').height - filtProductsHeight
318
+ }}
319
+ >
320
+ <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
268
321
  <BusinessProductsList
269
322
  categories={[
270
323
  { id: null, name: t('ALL', 'All') },
@@ -288,66 +341,201 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
288
341
  setCategoriesLayout={setCategoriesLayout}
289
342
  currentCart={currentCart}
290
343
  setSubcategoriesSelected={setSubcategoriesSelected}
344
+ onClickCategory={handleChangeCategory}
345
+ handleUpdateProducts={handleUpdateProducts}
346
+ previouslyProducts={business?.previously_products}
347
+ navigation={navigation}
348
+ isFiltMode
291
349
  />
292
- </WrapContent>
293
- </>
350
+ </View>
351
+ </FiltProductsContainer>
294
352
  )}
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
353
+ {isOpenFiltProducts && (
354
+ <BackgroundGray />
355
+ )}
356
+ <IOScrollView
357
+ stickyHeaderIndices={[2]}
358
+ style={{
359
+ ...styles.mainContainer,
360
+ marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
361
+ 50 : 0
362
+ }}
363
+ ref={scrollViewRef}
364
+ onScroll={handlePageScroll}
365
+ onScrollBeginDrag={handleTouchDrag}
366
+ scrollEventThrottle={16}
367
+ >
368
+ <BusinessBasicInformation
369
+ navigation={navigation}
370
+ businessState={businessState}
371
+ openBusinessInformation={openBusinessInformation}
372
+ header={header}
373
+ logo={logo}
374
+ isPreOrder={isPreOrder}
375
+ />
376
+ {business?.professionals?.length > 0 && (
377
+ <ProfessionalFilterWrapper>
378
+ <OText
379
+ size={16}
380
+ style={{ marginBottom: 16 }}
381
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
382
+ >
383
+ {t('PROFESSIONALS', 'Professionals')}
384
+ </OText>
385
+ <ProfessionalFilter
386
+ professionals={business?.professionals}
387
+ professionalSelected={professionalSelected}
388
+ handleChangeProfessionalSelected={handleChangeProfessionalSelected}
389
+ />
390
+ </ProfessionalFilterWrapper>
391
+ )}
392
+ <View
393
+ style={{
394
+ height: 8,
395
+ backgroundColor: theme.colors.backgroundGray100,
396
+ marginTop: isChewLayout && showLogo ? 10 : 0
397
+ }}
398
+ />
399
+ {!loading && business?.id && (
400
+ <>
401
+ {!(business?.categories?.length === 0) && (
402
+ <BusinessProductsCategories
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)]}
404
+ categorySelected={categorySelected}
405
+ onClickCategory={handleChangeCategory}
406
+ featured={featuredProducts}
407
+ openBusinessInformation={openBusinessInformation}
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}
415
+
416
+ />
417
+ )}
418
+ </>
419
+ )}
420
+ {!loading && business?.id && (
421
+ <>
422
+ <WrapContent
423
+ onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
424
+ >
425
+ <BusinessProductsList
426
+ categories={[
427
+ { id: null, name: t('ALL', 'All') },
428
+ { id: 'featured', name: t('FEATURED', 'Featured') },
429
+ ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
430
+ ]}
431
+ category={categorySelected}
432
+ categoryState={categoryState}
433
+ businessId={business.id}
434
+ errors={errors}
435
+ onProductClick={onProductClick}
436
+ handleSearchRedirect={handleSearchRedirect}
437
+ featured={featuredProducts}
438
+ searchValue={searchValue}
439
+ handleClearSearch={handleChangeSearch}
440
+ errorQuantityProducts={errorQuantityProducts}
441
+ handleCancelSearch={handleCancel}
442
+ categoriesLayout={categoriesLayout}
443
+ subcategoriesSelected={subcategoriesSelected}
444
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
445
+ setCategoriesLayout={setCategoriesLayout}
446
+ currentCart={currentCart}
447
+ setSubcategoriesSelected={setSubcategoriesSelected}
448
+ onClickCategory={handleChangeCategory}
449
+ handleUpdateProducts={handleUpdateProducts}
450
+ navigation={navigation}
451
+ previouslyProducts={business?.previously_products}
452
+ />
453
+ </WrapContent>
454
+ </>
455
+ )}
456
+ {loading && !error && (
457
+ <>
458
+ <BusinessProductsCategories
307
459
  categories={[]}
308
- category={categorySelected}
309
- categoryState={categoryState}
310
- isBusinessLoading={loading}
311
- errorQuantityProducts={errorQuantityProducts}
460
+ categorySelected={categorySelected}
461
+ onClickCategory={handleChangeCategory}
462
+ featured={featuredProducts}
463
+ openBusinessInformation={openBusinessInformation}
464
+ loading={loading}
312
465
  />
313
- </WrapContent>
314
- </>
466
+ <WrapContent>
467
+ <BusinessProductsList
468
+ categories={[]}
469
+ category={categorySelected}
470
+ categoryState={categoryState}
471
+ isBusinessLoading={loading}
472
+ errorQuantityProducts={errorQuantityProducts}
473
+ handleUpdateProducts={handleUpdateProducts}
474
+ navigation={navigation}
475
+ />
476
+ </WrapContent>
477
+ </>
478
+ )}
479
+ </IOScrollView>
480
+ {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
481
+ <FloatingButton
482
+ btnText={
483
+ openUpselling
484
+ ? t('LOADING', 'Loading')
485
+ : currentCart?.subtotal >= currentCart?.minimum
486
+ ? t('VIEW_ORDER', 'View Order')
487
+ : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
488
+ }
489
+ isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
490
+ btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
491
+ btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
492
+ btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
493
+ btnRightValue={parsePrice(currentCart?.total)}
494
+ disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
495
+ handleClick={() => setOpenUpselling(true)}
496
+ />
315
497
  )}
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)}
498
+ {openUpselling && (
499
+ <UpsellingRedirect
500
+ businessId={currentCart?.business_id}
501
+ business={currentCart?.business}
502
+ cartProducts={currentCart?.products}
503
+ cart={currentCart}
504
+ setOpenUpselling={setOpenUpselling}
505
+ handleUpsellingPage={handleUpsellingPage}
506
+ handleCloseUpsellingPage={handleCloseUpsellingPage}
507
+ openUpselling={openUpselling}
508
+ canOpenUpselling={canOpenUpselling}
509
+ setCanOpenUpselling={setCanOpenUpselling}
510
+ onRedirect={onRedirect}
511
+ />
512
+ )}
513
+ <Alert
514
+ open={alertState?.open || false}
515
+ title=''
516
+ content={[t('NOT_AVAILABLE_PRODUCTS', 'These products are not available.')]}
517
+ onAccept={() => setAlertState({ open: false, content: [] })}
518
+ onClose={() => setAlertState({ open: false, content: [] })}
333
519
  />
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}
520
+ </ContainerSafeAreaView>
521
+ <OModal
522
+ open={openService}
523
+ onClose={() => setOpenService(false)}
524
+ entireModal
525
+ >
526
+ <ServiceForm
527
+ navigation={navigation}
528
+ product={currentProduct}
529
+ businessSlug={business.slug}
530
+ businessId={business.id}
531
+ professionalList={business?.professionals}
532
+ professionalSelected={professionalSelected}
533
+ handleChangeProfessional={handleChangeProfessionalSelected}
534
+ onSave={() => setOpenService(false)}
535
+ onClose={() => setOpenService(false)}
348
536
  />
349
- )}
350
- </SafeAreaView>
537
+ </OModal>
538
+ </>
351
539
  )
352
540
  }
353
541
 
@@ -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,32 @@ 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
+ 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