ordering-ui-react-native 0.15.97 → 0.15.98-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 (231) 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 +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/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 +1 -2
  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/Chat/index.tsx +14 -6
  51. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  52. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  53. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  54. package/themes/business/src/components/LoginForm/index.tsx +110 -74
  55. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  56. package/themes/business/src/components/MapView/index.tsx +1 -1
  57. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  58. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  59. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  60. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -18
  61. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  62. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  63. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  64. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  65. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  66. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  67. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  70. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  71. package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
  72. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  73. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  74. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  75. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  76. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  77. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  78. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  79. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  80. package/themes/business/src/components/shared/OModal.tsx +41 -38
  81. package/themes/business/src/types/index.tsx +14 -9
  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/CartBottomSheet/index.tsx +9 -2
  87. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  88. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  89. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +70 -31
  90. package/themes/kiosk/src/components/Checkout/index.tsx +18 -3
  91. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  92. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  93. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  94. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  95. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  96. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  97. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  98. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  99. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  100. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  101. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  102. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  103. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  104. package/themes/kiosk/src/types/index.d.ts +3 -0
  105. package/themes/original/index.tsx +22 -0
  106. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  107. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  108. package/themes/original/src/components/AddressForm/index.tsx +137 -134
  109. package/themes/original/src/components/AddressList/index.tsx +2 -2
  110. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  111. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  112. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  113. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  114. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  115. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
  116. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  117. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  118. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  119. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  120. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  121. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  122. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  123. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  124. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  125. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  126. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  127. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  128. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  129. package/themes/original/src/components/BusinessProductsListing/index.tsx +296 -178
  130. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  131. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  132. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  133. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  134. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  135. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  136. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  137. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  138. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  139. package/themes/original/src/components/Cart/index.tsx +82 -37
  140. package/themes/original/src/components/Cart/styles.tsx +4 -0
  141. package/themes/original/src/components/CartContent/index.tsx +22 -16
  142. package/themes/original/src/components/Checkout/index.tsx +107 -67
  143. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  144. package/themes/original/src/components/DriverTips/index.tsx +11 -6
  145. package/themes/original/src/components/Favorite/index.tsx +92 -0
  146. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  147. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  148. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  149. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  150. package/themes/original/src/components/GoogleMap/index.tsx +21 -12
  151. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  152. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  153. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  154. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  155. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  156. package/themes/original/src/components/LoginForm/index.tsx +86 -43
  157. package/themes/original/src/components/Messages/index.tsx +17 -17
  158. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  159. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  160. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  161. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  162. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  163. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  164. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  165. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  166. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  167. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  168. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  169. package/themes/original/src/components/NavBar/index.tsx +11 -5
  170. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  171. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  172. package/themes/original/src/components/OrderDetails/index.tsx +138 -58
  173. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  174. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  175. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  176. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  177. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  178. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  179. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  180. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  181. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  182. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  183. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  184. package/themes/original/src/components/OrdersOption/index.tsx +140 -46
  185. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  186. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
  187. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  188. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  189. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  190. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  191. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  192. package/themes/original/src/components/ProductForm/index.tsx +694 -647
  193. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  194. package/themes/original/src/components/ProductItemAccordion/index.tsx +38 -25
  195. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  196. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  197. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  198. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  199. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  200. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  201. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  202. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  203. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  204. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  205. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  206. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  207. package/themes/original/src/components/SignupForm/index.tsx +307 -159
  208. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  209. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  210. package/themes/original/src/components/SingleProductCard/index.tsx +204 -95
  211. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  212. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  213. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  214. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  215. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  216. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  217. package/themes/original/src/components/UserProfile/index.tsx +4 -0
  218. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  219. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  220. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  221. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  222. package/themes/original/src/components/Wallets/index.tsx +176 -162
  223. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  224. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  225. package/themes/original/src/components/shared/OButton.tsx +10 -3
  226. package/themes/original/src/components/shared/OInput.tsx +3 -2
  227. package/themes/original/src/components/shared/OModal.tsx +4 -2
  228. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  229. package/themes/original/src/types/index.tsx +200 -47
  230. package/themes/original/src/utils/index.tsx +77 -0
  231. 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,15 +124,25 @@ 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
+ if (product?.type === 'service' && professionalSelected) {
142
+ setCurrentProduct(product)
143
+ setOpenService(true)
144
+ return
145
+ }
112
146
  onRedirect('ProductDetails', {
113
147
  product: product,
114
148
  businessSlug: business.slug,
@@ -122,13 +156,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
122
156
  }
123
157
 
124
158
  const handleUpsellingPage = () => {
125
- onRedirect('CheckoutNavigator', {
126
- screen: 'CheckoutPage',
127
- cartUuid: currentCart?.uuid,
128
- businessLogo: logo,
129
- businessName: business?.name,
130
- cartTotal: currentCart?.total
131
- })
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
+ }
132
172
  setOpenUpselling(false)
133
173
  }
134
174
 
@@ -177,7 +217,16 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
177
217
  const _carts = orderState?.carts?.[adjustBusinessId]
178
218
  const products = _carts?.products
179
219
  const unavailableProducts = products.filter((product: any) => product.valid !== true)
180
- unavailableProducts.length > 0 && multiRemoveProducts && multiRemoveProducts(unavailableProducts, _carts)
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
+ }
181
230
  }
182
231
 
183
232
  const removeCartByReOrder = async () => {
@@ -193,55 +242,77 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
193
242
  }, [currentCart])
194
243
 
195
244
  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 }}
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}
211
279
  />
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>
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
+ ))}
221
292
  </View>
222
- )}
223
- </>
293
+ </Placeholder>
294
+ </NearBusiness>
224
295
  )}
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}
296
+ {!loading && !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}
234
304
  />
235
- </WrapSearchBar>
305
+ </NearBusiness>
236
306
  )}
237
- </TopHeader>
238
- </Animated.View>
307
+ </Animated.View>
239
308
 
240
- {business?.categories?.length > 0 && isOpenFiltProducts && (
309
+ {business?.categories?.length > 0 && isOpenFiltProducts && (
241
310
  <FiltProductsContainer
311
+ isIos={Platform.OS === 'ios'}
242
312
  style={{
243
313
  height: Dimensions.get('window').height - filtProductsHeight
244
314
  }}
315
+ contentContainerStyle={{ flexGrow: 1 }}
245
316
  >
246
317
  <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
247
318
  <BusinessProductsList
@@ -268,149 +339,196 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
268
339
  currentCart={currentCart}
269
340
  setSubcategoriesSelected={setSubcategoriesSelected}
270
341
  onClickCategory={handleChangeCategory}
342
+ handleUpdateProducts={handleUpdateProducts}
343
+ previouslyProducts={business?.previously_products}
344
+ navigation={navigation}
271
345
  isFiltMode
272
346
  />
273
347
  </View>
274
348
  </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
349
  )}
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
- </>
350
+ {isOpenFiltProducts && (
351
+ <BackgroundGray />
350
352
  )}
351
- {loading && !error && (
352
- <>
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) && (
353
398
  <BusinessProductsCategories
354
- 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)]}
355
400
  categorySelected={categorySelected}
356
401
  onClickCategory={handleChangeCategory}
357
402
  featured={featuredProducts}
358
403
  openBusinessInformation={openBusinessInformation}
359
- 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}
360
411
  />
361
- <WrapContent>
362
- <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
363
452
  categories={[]}
364
- category={categorySelected}
365
- categoryState={categoryState}
366
- isBusinessLoading={loading}
367
- errorQuantityProducts={errorQuantityProducts}
453
+ categorySelected={categorySelected}
454
+ onClickCategory={handleChangeCategory}
455
+ featured={featuredProducts}
456
+ openBusinessInformation={openBusinessInformation}
457
+ loading={loading}
368
458
  />
369
- </WrapContent>
370
- </>
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
+ />
371
490
  )}
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)}
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: [] })}
389
512
  />
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}
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)}
404
529
  />
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>
530
+ </OModal>
531
+ </>
414
532
  )
415
533
  }
416
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