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