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