ordering-ui-react-native 0.16.0 → 0.16.1-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 (229) 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/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -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 +145 -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/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/index.tsx +2 -0
  35. package/src/navigators/CheckoutNavigator.tsx +6 -0
  36. package/src/navigators/HomeNavigator.tsx +6 -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/theme.json +0 -1
  44. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  45. package/src/types/index.tsx +15 -9
  46. package/src/utils/index.tsx +0 -1
  47. package/themes/business/index.tsx +4 -0
  48. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
  49. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  50. package/themes/business/src/components/Chat/index.tsx +42 -34
  51. package/themes/business/src/components/DriverMap/index.tsx +12 -8
  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 +111 -74
  55. package/themes/business/src/components/MapView/index.tsx +1 -1
  56. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  57. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  58. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  59. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -18
  60. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  61. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  62. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  63. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  65. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  66. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  67. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  70. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  71. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  72. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  73. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  74. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  75. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  76. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  77. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  78. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  79. package/themes/business/src/components/shared/OModal.tsx +41 -38
  80. package/themes/business/src/types/index.tsx +14 -9
  81. package/themes/business/src/utils/index.tsx +10 -0
  82. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  83. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  84. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  85. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  86. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  87. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  88. package/themes/kiosk/src/components/Checkout/index.tsx +18 -3
  89. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  90. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  91. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  92. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  93. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  94. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  95. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  96. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  97. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  98. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  99. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  100. package/themes/kiosk/src/types/index.d.ts +2 -0
  101. package/themes/original/index.tsx +22 -0
  102. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  103. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  104. package/themes/original/src/components/AddressForm/index.tsx +137 -134
  105. package/themes/original/src/components/AddressList/index.tsx +2 -2
  106. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  107. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  108. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  109. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  110. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  111. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  112. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  113. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  114. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  115. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  116. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  117. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  118. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  119. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  120. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  121. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  122. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  123. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  124. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  125. package/themes/original/src/components/BusinessProductsListing/index.tsx +289 -178
  126. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  127. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  128. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  129. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  130. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  131. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  132. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  133. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  134. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  135. package/themes/original/src/components/Cart/index.tsx +82 -37
  136. package/themes/original/src/components/Cart/styles.tsx +4 -0
  137. package/themes/original/src/components/CartContent/index.tsx +22 -16
  138. package/themes/original/src/components/Checkout/index.tsx +107 -67
  139. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  140. package/themes/original/src/components/DriverTips/index.tsx +11 -6
  141. package/themes/original/src/components/Favorite/index.tsx +92 -0
  142. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  143. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  144. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  145. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  146. package/themes/original/src/components/GoogleMap/index.tsx +21 -12
  147. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  148. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  149. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  150. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  151. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  152. package/themes/original/src/components/LoginForm/index.tsx +86 -43
  153. package/themes/original/src/components/Messages/index.tsx +17 -17
  154. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  155. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  156. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  157. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  158. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  159. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  160. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  161. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  162. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  163. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  164. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  165. package/themes/original/src/components/NavBar/index.tsx +11 -5
  166. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  167. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  168. package/themes/original/src/components/OrderDetails/index.tsx +136 -57
  169. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  170. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  171. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  172. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  173. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  174. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  175. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  176. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  177. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  178. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  179. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  180. package/themes/original/src/components/OrdersOption/index.tsx +143 -47
  181. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  182. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
  183. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  184. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  185. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  186. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  187. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  188. package/themes/original/src/components/ProductForm/index.tsx +697 -649
  189. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  190. package/themes/original/src/components/ProductItemAccordion/index.tsx +38 -25
  191. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  192. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  193. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  194. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  195. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  196. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  197. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  198. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  199. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  200. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  201. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  202. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  203. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  204. package/themes/original/src/components/SignupForm/index.tsx +307 -159
  205. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  206. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  207. package/themes/original/src/components/SingleProductCard/index.tsx +215 -95
  208. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  209. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  210. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  211. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  212. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  213. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  214. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  215. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  216. package/themes/original/src/components/UserProfile/index.tsx +4 -0
  217. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  218. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  219. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  220. package/themes/original/src/components/Wallets/index.tsx +176 -162
  221. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  222. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  223. package/themes/original/src/components/shared/OButton.tsx +10 -3
  224. package/themes/original/src/components/shared/OInput.tsx +3 -2
  225. package/themes/original/src/components/shared/OModal.tsx +4 -2
  226. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  227. package/themes/original/src/types/index.tsx +200 -47
  228. package/themes/original/src/utils/index.tsx +77 -0
  229. 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,6 +62,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
53
62
  setAlertState,
54
63
  multiRemoveProducts,
55
64
  getNextProducts,
65
+ handleUpdateProducts,
66
+ professionalSelected,
67
+ handleChangeProfessionalSelected,
68
+ onBusinessClick
56
69
  } = props
57
70
 
58
71
  const theme = useTheme();
@@ -63,9 +76,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
63
76
  const [, { showToast }] = useToast()
64
77
  const [{ configs }] = useConfig()
65
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
+
66
84
  const styles = StyleSheet.create({
67
85
  mainContainer: {
68
- flex: 1,
86
+ flex: 1
69
87
  },
70
88
  BackIcon: {
71
89
  paddingRight: 20,
@@ -87,7 +105,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
87
105
  padding: 15,
88
106
  justifyContent: 'center',
89
107
  shadowColor: theme.colors.clear,
90
- }
108
+ },
109
+ businessSkeleton: {
110
+ borderRadius: 8,
111
+ marginRight: 20,
112
+ width: 56,
113
+ height: 56
114
+ },
91
115
  })
92
116
 
93
117
  const { business, loading, error } = businessState
@@ -100,19 +124,31 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
100
124
  const [productListLayout, setProductListLayout] = useState<any>(null)
101
125
  const [isCategoryClicked, setCategoryClicked] = useState(false)
102
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) || []
103
132
 
104
133
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
105
134
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
106
- const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
135
+ const filtProductsHeight = Platform.OS === 'ios' ? 0 : 100
107
136
  const onRedirect = (route: string, params?: any) => {
108
137
  navigation.navigate(route, params)
109
138
  }
110
139
 
111
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)
142
+ if (product?.type === 'service' && business?.professionals?.length > 0) {
143
+ setCurrentProduct(product)
144
+ setOpenService(true)
145
+ return
146
+ }
112
147
  onRedirect('ProductDetails', {
113
148
  product: product,
114
149
  businessSlug: business.slug,
115
150
  businessId: business.id,
151
+ productAddedToCartLength
116
152
  })
117
153
  }
118
154
 
@@ -122,13 +158,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
122
158
  }
123
159
 
124
160
  const handleUpsellingPage = () => {
125
- onRedirect('CheckoutNavigator', {
126
- screen: 'CheckoutPage',
127
- cartUuid: currentCart?.uuid,
128
- businessLogo: logo,
129
- businessName: business?.name,
130
- cartTotal: currentCart?.total
131
- })
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
+ }
132
174
  setOpenUpselling(false)
133
175
  }
134
176
 
@@ -183,7 +225,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
183
225
  multiRemoveProducts && await multiRemoveProducts(unavailableProducts, _carts)
184
226
  return
185
227
  }
186
-
228
+
187
229
  if (alreadyRemoved === 'removed') {
188
230
  setAlertState({ open: true, content: [t('NOT_AVAILABLE_PRODUCT', 'This product is not available.')] })
189
231
  }
@@ -202,55 +244,77 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
202
244
  }, [currentCart])
203
245
 
204
246
  return (
205
- <ContainerSafeAreaView
206
- style={{ flex: 1 }}
207
- isOpenFiltProducts={isOpenFiltProducts}
208
- >
209
- <Animated.View style={{ position: 'relative' }}>
210
- <TopHeader isIos={Platform.OS === 'ios'}>
211
- {!isOpenSearchBar && (
212
- <>
213
- <View style={{ ...styles.headerItem, flex: 1 }}>
214
- <OButton
215
- imgLeftSrc={theme.images.general.arrow_left}
216
- imgRightSrc={null}
217
- style={styles.btnBackArrow}
218
- onClick={() => handleBackNavigation()}
219
- 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}
220
281
  />
221
- </View>
222
- {!errorQuantityProducts && (
223
- <View style={{ ...styles.headerItem }}>
224
- <TouchableOpacity
225
- onPress={() => setIsOpenSearchBar(true)}
226
- style={styles.searchIcon}
227
- >
228
- <OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={16} />
229
- </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
+ ))}
230
294
  </View>
231
- )}
232
- </>
295
+ </Placeholder>
296
+ </NearBusiness>
233
297
  )}
234
- {isOpenSearchBar && (
235
- <WrapSearchBar>
236
- <SearchBar
237
- onSearch={handleChangeSearch}
238
- onCancel={() => handleCancel()}
239
- isCancelXButtonShow
240
- noBorderShow
241
- placeholder={t('SEARCH_PRODUCTS', 'Search Products')}
242
- 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}
243
306
  />
244
- </WrapSearchBar>
307
+ </NearBusiness>
245
308
  )}
246
- </TopHeader>
247
- </Animated.View>
309
+ </Animated.View>
248
310
 
249
- {business?.categories?.length > 0 && isOpenFiltProducts && (
311
+ {business?.categories?.length > 0 && isOpenFiltProducts && (
250
312
  <FiltProductsContainer
313
+ isIos={Platform.OS === 'ios'}
251
314
  style={{
252
315
  height: Dimensions.get('window').height - filtProductsHeight
253
316
  }}
317
+ contentContainerStyle={{ flexGrow: 1 }}
254
318
  >
255
319
  <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
256
320
  <BusinessProductsList
@@ -277,149 +341,196 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
277
341
  currentCart={currentCart}
278
342
  setSubcategoriesSelected={setSubcategoriesSelected}
279
343
  onClickCategory={handleChangeCategory}
344
+ handleUpdateProducts={handleUpdateProducts}
345
+ previouslyProducts={business?.previously_products}
346
+ navigation={navigation}
280
347
  isFiltMode
281
348
  />
282
349
  </View>
283
350
  </FiltProductsContainer>
284
- )}
285
- {isOpenFiltProducts && (
286
- <BackgroundGray />
287
- )}
288
- <BusinessProductsListingContainer
289
- stickyHeaderIndices={[2]}
290
- style={styles.mainContainer}
291
- ref={scrollViewRef}
292
- isActiveFloatingButtom={currentCart?.products?.length > 0 && categoryState.products.length !== 0}
293
- onScroll={handlePageScroll}
294
- onScrollBeginDrag={handleTouchDrag}
295
- scrollEventThrottle={16}
296
- >
297
- <BusinessBasicInformation
298
- navigation={navigation}
299
- businessState={businessState}
300
- openBusinessInformation={openBusinessInformation}
301
- header={header}
302
- logo={logo}
303
- isPreOrder={isPreOrder}
304
- />
305
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
306
- {!loading && business?.id && (
307
- <>
308
- {!(business?.categories?.length === 0) && (
309
- <BusinessProductsCategories
310
- categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
311
- categorySelected={categorySelected}
312
- onClickCategory={handleChangeCategory}
313
- featured={featuredProducts}
314
- openBusinessInformation={openBusinessInformation}
315
- scrollViewRef={scrollViewRef}
316
- productListLayout={productListLayout}
317
- categoriesLayout={categoriesLayout}
318
- selectedCategoryId={selectedCategoryId}
319
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
320
- setSelectedCategoryId={setSelectedCategoryId}
321
- setCategoryClicked={setCategoryClicked}
322
-
323
- />
324
- )}
325
- </>
326
351
  )}
327
- {!loading && business?.id && (
328
- <>
329
- <WrapContent
330
- onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
331
- >
332
- <BusinessProductsList
333
- categories={[
334
- { id: null, name: t('ALL', 'All') },
335
- { id: 'featured', name: t('FEATURED', 'Featured') },
336
- ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
337
- ]}
338
- category={categorySelected}
339
- categoryState={categoryState}
340
- businessId={business.id}
341
- errors={errors}
342
- onProductClick={onProductClick}
343
- handleSearchRedirect={handleSearchRedirect}
344
- featured={featuredProducts}
345
- searchValue={searchValue}
346
- handleClearSearch={handleChangeSearch}
347
- errorQuantityProducts={errorQuantityProducts}
348
- handleCancelSearch={handleCancel}
349
- categoriesLayout={categoriesLayout}
350
- subcategoriesSelected={subcategoriesSelected}
351
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
352
- setCategoriesLayout={setCategoriesLayout}
353
- currentCart={currentCart}
354
- setSubcategoriesSelected={setSubcategoriesSelected}
355
- onClickCategory={handleChangeCategory}
356
- />
357
- </WrapContent>
358
- </>
352
+ {isOpenFiltProducts && (
353
+ <BackgroundGray />
359
354
  )}
360
- {loading && !error && (
361
- <>
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) && (
362
400
  <BusinessProductsCategories
363
- 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)]}
364
402
  categorySelected={categorySelected}
365
403
  onClickCategory={handleChangeCategory}
366
404
  featured={featuredProducts}
367
405
  openBusinessInformation={openBusinessInformation}
368
- 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}
369
413
  />
370
- <WrapContent>
371
- <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
372
454
  categories={[]}
373
- category={categorySelected}
374
- categoryState={categoryState}
375
- isBusinessLoading={loading}
376
- errorQuantityProducts={errorQuantityProducts}
455
+ categorySelected={categorySelected}
456
+ onClickCategory={handleChangeCategory}
457
+ featured={featuredProducts}
458
+ openBusinessInformation={openBusinessInformation}
459
+ loading={loading}
377
460
  />
378
- </WrapContent>
379
- </>
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
+ />
380
492
  )}
381
- </BusinessProductsListingContainer>
382
- {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
383
- <FloatingButton
384
- btnText={
385
- openUpselling
386
- ? t('LOADING', 'Loading')
387
- : currentCart?.subtotal >= currentCart?.minimum
388
- ? t('VIEW_ORDER', 'View Order')
389
- : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
390
- }
391
- isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
392
- btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
393
- btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
394
- btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
395
- btnRightValue={parsePrice(currentCart?.total)}
396
- disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
397
- 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: [] })}
398
514
  />
399
- )}
400
- {openUpselling && (
401
- <UpsellingRedirect
402
- businessId={currentCart?.business_id}
403
- business={currentCart?.business}
404
- cartProducts={currentCart?.products}
405
- cart={currentCart}
406
- setOpenUpselling={setOpenUpselling}
407
- handleUpsellingPage={handleUpsellingPage}
408
- handleCloseUpsellingPage={handleCloseUpsellingPage}
409
- openUpselling={openUpselling}
410
- canOpenUpselling={canOpenUpselling}
411
- setCanOpenUpselling={setCanOpenUpselling}
412
- 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)}
413
531
  />
414
- )}
415
- <Alert
416
- open={alertState?.open || false}
417
- title=''
418
- content={[t('NOT_AVAILABLE_PRODUCTS', 'These products are not available.')]}
419
- onAccept={() => setAlertState({ open: false, content: [] })}
420
- onClose={() => setAlertState({ open: false, content: [] })}
421
- />
422
- </ContainerSafeAreaView>
532
+ </OModal>
533
+ </>
423
534
  )
424
535
  }
425
536
 
@@ -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