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