ordering-ui-react-native 0.17.97 → 0.17.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 (224) hide show
  1. package/package.json +9 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +163 -123
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  22. package/themes/business/src/components/MapView/index.tsx +14 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -15
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  35. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  36. package/themes/business/src/components/OrdersOption/index.tsx +60 -47
  37. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  38. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  39. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  40. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  41. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  42. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  43. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  46. package/themes/business/src/components/StoresList/index.tsx +3 -4
  47. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  48. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  49. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  50. package/themes/business/src/components/shared/OModal.tsx +16 -9
  51. package/themes/business/src/types/index.tsx +24 -10
  52. package/themes/business/src/utils/index.tsx +29 -2
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  57. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/original/index.tsx +7 -3
  65. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  66. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  67. package/themes/original/src/components/AddressList/index.tsx +5 -8
  68. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  69. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  70. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +72 -36
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  73. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  74. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +21 -23
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  86. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +137 -32
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +36 -403
  94. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  95. package/themes/original/src/components/Cart/index.tsx +44 -81
  96. package/themes/original/src/components/CartContent/index.tsx +70 -30
  97. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  98. package/themes/original/src/components/Checkout/index.tsx +262 -35
  99. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  100. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  101. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  102. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  103. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  104. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  105. package/themes/original/src/components/Favorite/index.tsx +1 -5
  106. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  108. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  110. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  111. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  112. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  113. package/themes/original/src/components/Home/index.tsx +13 -4
  114. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  115. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  117. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  118. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  119. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  120. package/themes/original/src/components/Messages/index.tsx +15 -4
  121. package/themes/original/src/components/MomentOption/index.tsx +41 -36
  122. package/themes/original/src/components/MomentOption/styles.tsx +0 -15
  123. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  124. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  125. package/themes/original/src/components/MultiCheckout/index.tsx +347 -69
  126. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  127. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  128. package/themes/original/src/components/MyOrders/index.tsx +12 -1
  129. package/themes/original/src/components/NavBar/index.tsx +20 -13
  130. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  131. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  132. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  133. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  134. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  135. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  136. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  137. package/themes/original/src/components/OrderSummary/index.tsx +59 -56
  138. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  139. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  140. package/themes/original/src/components/OrdersOption/index.tsx +43 -20
  141. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  142. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  143. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  144. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  145. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  146. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  147. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  148. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  149. package/themes/original/src/components/ProductForm/index.tsx +65 -34
  150. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  151. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  152. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  153. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  154. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  155. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  156. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  157. package/themes/original/src/components/Promotions/index.tsx +2 -2
  158. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  159. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  160. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  161. package/themes/original/src/components/ServiceForm/index.tsx +40 -20
  162. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  165. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  167. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  168. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  169. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  170. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  171. package/themes/original/src/components/UpsellingProducts/index.tsx +3 -8
  172. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  173. package/themes/original/src/components/UserFormDetails/index.tsx +84 -19
  174. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  175. package/themes/original/src/components/UserProfile/index.tsx +7 -25
  176. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  177. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  178. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  179. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  180. package/themes/original/src/components/Wallets/index.tsx +51 -61
  181. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  182. package/themes/original/src/components/shared/OButton.tsx +3 -3
  183. package/themes/original/src/components/shared/OInput.tsx +4 -5
  184. package/themes/original/src/components/shared/OModal.tsx +3 -3
  185. package/themes/original/src/config/constants.tsx +0 -10
  186. package/themes/original/src/types/index.tsx +31 -15
  187. package/themes/original/src/utils/index.tsx +180 -13
  188. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  189. package/src/navigators/BottomNavigator.tsx +0 -117
  190. package/src/navigators/CheckoutNavigator.tsx +0 -66
  191. package/src/navigators/HomeNavigator.tsx +0 -202
  192. package/src/navigators/NavigationRef.tsx +0 -7
  193. package/src/navigators/RootNavigator.tsx +0 -269
  194. package/src/pages/Account.tsx +0 -34
  195. package/src/pages/AddressForm.tsx +0 -62
  196. package/src/pages/AddressList.tsx +0 -24
  197. package/src/pages/BusinessProductsList.tsx +0 -81
  198. package/src/pages/BusinessesListing.tsx +0 -43
  199. package/src/pages/CartList.tsx +0 -49
  200. package/src/pages/Checkout.tsx +0 -101
  201. package/src/pages/ForgotPassword.tsx +0 -24
  202. package/src/pages/Help.tsx +0 -23
  203. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  204. package/src/pages/HelpGuide.tsx +0 -23
  205. package/src/pages/HelpOrder.tsx +0 -23
  206. package/src/pages/Home.tsx +0 -36
  207. package/src/pages/IntroductoryTutorial.tsx +0 -170
  208. package/src/pages/Login.tsx +0 -47
  209. package/src/pages/MomentOption.tsx +0 -30
  210. package/src/pages/MultiCheckout.tsx +0 -31
  211. package/src/pages/MultiOrdersDetails.tsx +0 -27
  212. package/src/pages/MyOrders.tsx +0 -40
  213. package/src/pages/NetworkError.tsx +0 -24
  214. package/src/pages/NotFound.tsx +0 -22
  215. package/src/pages/OrderDetails.tsx +0 -25
  216. package/src/pages/ProductDetails.tsx +0 -55
  217. package/src/pages/Profile.tsx +0 -36
  218. package/src/pages/ReviewDriver.tsx +0 -30
  219. package/src/pages/ReviewOrder.tsx +0 -32
  220. package/src/pages/ReviewProducts.tsx +0 -30
  221. package/src/pages/Sessions.tsx +0 -22
  222. package/src/pages/Signup.tsx +0 -53
  223. package/src/pages/SpinnerLoader.tsx +0 -10
  224. package/src/pages/Splash.tsx +0 -21
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react'
2
- import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Vibration } from 'react-native'
2
+ import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Keyboard, KeyboardEvent, BackHandler } from 'react-native'
3
3
  import { IOScrollView } from 'react-native-intersection-observer'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native';
@@ -11,7 +11,8 @@ import {
11
11
  useUtils,
12
12
  ToastType,
13
13
  useToast,
14
- useConfig
14
+ useConfig,
15
+ useEvent
15
16
  } from 'ordering-components/native'
16
17
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
17
18
  import { OButton, OIcon, OModal, OText } from '../shared'
@@ -24,6 +25,8 @@ import { BusinessProductsListingParams } from '../../types'
24
25
  import { _retrieveStoreData, _removeStoreData } from '../../providers/StoreUtil';
25
26
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
26
27
  import { useIsFocused } from '@react-navigation/native';
28
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
29
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
27
30
 
28
31
  import {
29
32
  TopHeader,
@@ -68,7 +71,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
68
71
  professionalSelected,
69
72
  handleUpdateProfessionals,
70
73
  handleChangeProfessionalSelected,
71
- onBusinessClick
74
+ onBusinessClick,
75
+ businessSingleId
72
76
  } = props
73
77
 
74
78
  const insets = useSafeAreaInsets()
@@ -79,6 +83,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
79
83
  const [{ parsePrice }] = useUtils()
80
84
  const [, { showToast }] = useToast()
81
85
  const [{ configs }] = useConfig()
86
+ const [events] = useEvent()
82
87
  const isFocused = useIsFocused();
83
88
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
84
89
 
@@ -132,31 +137,42 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
132
137
  const [openService, setOpenService] = useState(false)
133
138
  const [currentProduct, setCurrentProduct] = useState(null)
134
139
  const [searchBarHeight, setSearchBarHeight] = useState(60)
140
+ const [keyboardHeight, setKeyboardHeight] = useState(0);
141
+ const [viewedCategory, setViewedCategory] = useState<any>(null)
142
+ const [showTitle, setShowTitle] = useState(false)
135
143
 
136
144
  const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
137
145
  const isQuickAddProduct = configs?.add_product_with_one_click?.value === '1'
138
- 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) || []
139
-
140
146
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
141
147
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
142
- const filtProductsHeight = Platform.OS === 'ios' ? 165 : 100
148
+ const viewOrderButtonVisible = !loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0
149
+
143
150
  const onRedirect = (route: string, params?: any) => {
144
151
  navigation.navigate(route, params)
145
152
  }
153
+ const vibrateApp = (impact?: string) => {
154
+ const options = {
155
+ enableVibrateFallback: true,
156
+ ignoreAndroidSystemSettings: false
157
+ };
158
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
159
+ }
146
160
  const onProductClick = async (product: any) => {
147
- if (product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
161
+ if (product.ingredients?.length === 0 && product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
148
162
  const isProductAddedToCart = currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)
149
163
  const productQuantity = isProductAddedToCart?.quantity
164
+ const minimumPerOrder = product?.minimum_per_order || 1
150
165
  const addCurrentProduct = {
151
166
  ...product,
152
- quantity: 1
167
+ quantity: minimumPerOrder
153
168
  }
154
169
  const updateCurrentProduct = {
170
+ name: product?.name,
155
171
  id: product.id,
156
172
  code: isProductAddedToCart?.code,
157
173
  quantity: productQuantity + 1
158
174
  }
159
- Vibration.vibrate()
175
+ vibrateApp()
160
176
  const cartData = currentCart?.business_id ? currentCart : { business_id: business.id }
161
177
  if (isProductAddedToCart) {
162
178
  await updateProduct(updateCurrentProduct, cartData, isQuickAddProduct)
@@ -177,6 +193,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
177
193
  productAddedToCartLength
178
194
  })
179
195
  }
196
+ events.emit('product_clicked', product)
180
197
  }
181
198
 
182
199
  const handleCancel = () => {
@@ -184,18 +201,23 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
184
201
  handleChangeSearch('')
185
202
  }
186
203
 
187
- const handleUpsellingPage = () => {
204
+ const handleUpsellingPage = (cart: any) => {
205
+ const isProductCartParam = !!cart?.products?.length
188
206
  setOpenUpselling(false)
189
207
  setCanOpenUpselling(false)
190
- const cartsAvailable: any = Object.values(orderState?.carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
191
- if (cartsAvailable.length === 1) {
208
+ const cartsAvailable: any = Object.values(orderState?.carts)
209
+ ?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
210
+ ?.filter((_c: any) => !isProductCartParam ? _c.uuid !== cart?.uuid : _c)
211
+ if (cartsAvailable.length === 1 || !isCheckoutMultiBusinessEnabled) {
212
+ const cart = isCheckoutMultiBusinessEnabled ? cartsAvailable[0] : currentCart
213
+
192
214
  props.onNavigationRedirect('CheckoutNavigator', {
193
215
  screen: 'CheckoutPage',
194
- cartUuid: cartsAvailable[0]?.uuid,
195
- businessLogo: cartsAvailable[0]?.business?.logo,
196
- businessName: cartsAvailable[0]?.business?.name,
197
- cartTotal: cartsAvailable[0]?.total
198
- })
216
+ cartUuid: cart?.uuid,
217
+ businessLogo: cart?.business?.logo,
218
+ businessName: cart?.business?.name,
219
+ cartTotal: cart?.total
220
+ }, true)
199
221
  } else {
200
222
  const groupKeys: any = {}
201
223
  cartsAvailable.forEach((_cart: any) => {
@@ -211,12 +233,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
211
233
  props.onNavigationRedirect('CheckoutNavigator', {
212
234
  screen: 'MultiCheckout',
213
235
  checkCarts: true
214
- })
236
+ }, true)
215
237
  } else {
216
238
  props.onNavigationRedirect('CheckoutNavigator', {
217
239
  screen: 'MultiCheckout',
218
240
  cartUuid: cartsAvailable[0]?.group?.uuid
219
- })
241
+ }, true)
220
242
  }
221
243
  }
222
244
  }
@@ -229,6 +251,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
229
251
 
230
252
  const handlePageScroll = useCallback(({ nativeEvent }: any) => {
231
253
  const scrollOffset = nativeEvent.contentOffset.y
254
+ setShowTitle(scrollOffset > 30)
255
+
232
256
  if (businessState?.business?.lazy_load_products_recommended) {
233
257
  const height = nativeEvent.contentSize.height
234
258
  const hasMore = !(categoryState.pagination.totalPages === categoryState.pagination.currentPage)
@@ -259,7 +283,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
259
283
  }, []);
260
284
 
261
285
  const handleBackNavigation = () => {
262
- navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
286
+ navigation?.canGoBack() && !props.fromMulti ? navigation.goBack() : navigation.navigate('BottomTab')
263
287
  }
264
288
 
265
289
  const adjustBusiness = async (adjustBusinessId: number) => {
@@ -297,12 +321,71 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
297
321
  }
298
322
  }, [isFocused])
299
323
 
324
+
325
+ useEffect(() => {
326
+ function onKeyboardDidShow(e: KeyboardEvent) {
327
+ setKeyboardHeight(e?.endCoordinates?.height);
328
+ }
329
+
330
+ function onKeyboardDidHide() {
331
+ setKeyboardHeight(0);
332
+ }
333
+
334
+ const showSubscription = Keyboard.addListener('keyboardDidShow', onKeyboardDidShow);
335
+ const hideSubscription = Keyboard.addListener('keyboardDidHide', onKeyboardDidHide);
336
+ return () => {
337
+ showSubscription.remove();
338
+ hideSubscription.remove();
339
+ };
340
+ }, []);
341
+
300
342
  const subtotalWithTaxes = currentCart?.taxes?.reduce((acc: any, item: any) => {
301
343
  if (item?.type === 1)
302
344
  return acc = acc + item?.summary?.tax
303
345
  return acc = acc
304
346
  }, currentCart?.subtotal)
305
347
 
348
+ const onChangeSearch = (query: any) => {
349
+ handleChangeSearch(query)
350
+ if (query) {
351
+ events.emit('products_searched', query)
352
+ }
353
+ }
354
+
355
+ useEffect(() => {
356
+ let categoryId: any = null
357
+ if (business?.lazy_load_products_recommended) {
358
+ if (categorySelected?.id) {
359
+ categoryId = categorySelected.id
360
+ }
361
+ } else {
362
+ if (selectedCategoryId) {
363
+ const originCategoryId = selectedCategoryId.replace('cat_', '')
364
+ if (!isNaN(originCategoryId)) {
365
+ categoryId = Number(originCategoryId)
366
+ }
367
+ }
368
+ }
369
+ if (categoryId) {
370
+ const _viewedCategory = business.categories.find(category => category.id === categoryId)
371
+ if (_viewedCategory?.id !== viewedCategory?.id) {
372
+ setViewedCategory(_viewedCategory)
373
+ events.emit('product_list_viewed', _viewedCategory)
374
+ }
375
+ }
376
+ }, [business?.lazy_load_products_recommended, selectedCategoryId, categorySelected?.id, viewedCategory])
377
+
378
+ useEffect(() => {
379
+ const handleArrowBack: any = () => {
380
+ navigation.goBack()
381
+ return true
382
+ }
383
+ BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
384
+ return () => {
385
+ BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
386
+ }
387
+ }, [])
388
+
306
389
  return (
307
390
  <>
308
391
  <View style={{ flex: 1, backgroundColor: backgroundColor }}>
@@ -312,12 +395,29 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
312
395
  marginTop: Platform.OS === 'ios' ? insets.top : 0
313
396
  }}
314
397
  onLayout={(event: any) => setSearchBarHeight(event.nativeEvent.layout.height)}
398
+ hideArrow={(businessSingleId && auth)}
315
399
  >
316
400
  {!isOpenSearchBar && (
317
401
  <>
318
- <TopActions onPress={() => handleBackNavigation()}>
319
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
320
- </TopActions>
402
+ {!(businessSingleId && auth) && (
403
+ <TopActions onPress={() => handleBackNavigation()}>
404
+ <AntDesignIcon
405
+ name='arrowleft'
406
+ size={26}
407
+ />
408
+ </TopActions>
409
+ )}
410
+ {showTitle && (
411
+ <OText
412
+ size={16}
413
+ style={{ flex: 1, textAlign: 'center' }}
414
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
415
+ numberOfLines={2}
416
+ ellipsizeMode='tail'
417
+ >
418
+ {business?.name}
419
+ </OText>
420
+ )}
321
421
  {!errorQuantityProducts && (
322
422
  <View style={{ ...styles.headerItem }}>
323
423
  <TouchableOpacity
@@ -334,12 +434,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
334
434
  <WrapSearchBar>
335
435
  <SearchBar
336
436
  autoFocus
337
- onSearch={handleChangeSearch}
437
+ onSearch={onChangeSearch}
338
438
  onCancel={() => handleCancel()}
339
439
  isCancelXButtonShow
340
440
  noBorderShow
341
441
  placeholder={t('SEARCH_PRODUCTS', 'Search Products')}
342
- lazyLoad={businessState?.business?.lazy_load_products_recommended}
442
+ lazyLoad
343
443
  />
344
444
  </WrapSearchBar>
345
445
  )}
@@ -373,8 +473,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
373
473
  {business?.categories?.length > 0 && isOpenFiltProducts && (
374
474
  <FiltProductsContainer
375
475
  style={{
376
- height: Dimensions.get('window').height - filtProductsHeight,
377
- top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight
476
+ height: Dimensions.get('window').height - (keyboardHeight + (Platform.OS === 'ios' ? 100 : 80)),
477
+ top: Platform.OS === 'ios' ? searchBarHeight + insets.top : searchBarHeight
378
478
  }}
379
479
  contentContainerStyle={{ flexGrow: 1 }}
380
480
  >
@@ -407,15 +507,16 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
407
507
  previouslyProducts={business?.previously_products}
408
508
  navigation={navigation}
409
509
  isFiltMode
510
+ businessSingleId={businessSingleId}
410
511
  />
411
512
  </View>
412
513
  </FiltProductsContainer>
413
514
  )}
414
515
  {isOpenFiltProducts && (
415
- <BackgroundGray isIos={Platform.OS === 'ios'} />
516
+ <BackgroundGray isIos={Platform.OS === 'ios'} style={{ marginTop: insets.top + 60 }} />
416
517
  )}
417
518
  <IOScrollView
418
- stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 2]}
519
+ stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
419
520
  style={{
420
521
  ...styles.mainContainer,
421
522
  marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
@@ -448,6 +549,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
448
549
  professionals={business?.professionals}
449
550
  professionalSelected={professionalSelected}
450
551
  handleChangeProfessionalSelected={handleChangeProfessionalSelected}
552
+ handleUpdateProfessionals={handleUpdateProfessionals}
451
553
  />
452
554
  </ProfessionalFilterWrapper>
453
555
  )}
@@ -508,6 +610,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
508
610
  handleUpdateProducts={handleUpdateProducts}
509
611
  navigation={navigation}
510
612
  previouslyProducts={business?.previously_products}
613
+ businessSingleId={businessSingleId}
511
614
  />
512
615
  </WrapContent>
513
616
  </>
@@ -536,7 +639,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
536
639
  </>
537
640
  )}
538
641
  </IOScrollView>
539
- {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
642
+ {viewOrderButtonVisible && (
540
643
  <View style={{ marginBottom: 0 }}>
541
644
  <FloatingButton
542
645
  btnText={
@@ -587,8 +690,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
587
690
  <ServiceForm
588
691
  navigation={navigation}
589
692
  product={currentProduct}
590
- businessSlug={business.slug}
591
- businessId={business.id}
693
+ businessSlug={business?.slug}
694
+ businessId={business?.id}
592
695
  professionalList={business?.professionals}
593
696
  professionalSelected={professionalSelected}
594
697
  handleChangeProfessional={handleChangeProfessionalSelected}
@@ -606,6 +709,8 @@ export const BusinessProductsListing = (props: BusinessProductsListingParams) =>
606
709
  const businessProductslistingProps = {
607
710
  ...props,
608
711
  isForceSearch: Platform.OS === 'ios',
712
+ isApp: true,
713
+ isFetchAllProducts: true,
609
714
  UIComponent: BusinessProductsListingUI
610
715
  }
611
716
  return (
@@ -7,7 +7,7 @@ export const TopHeader = styled.View`
7
7
  width: 100%;
8
8
  flex-direction: row;
9
9
  align-items: center;
10
- justify-content: space-between;
10
+ justify-content: ${({ hideArrow }: any) => hideArrow ? 'flex-end' : 'space-between'};
11
11
  z-index: 1;
12
12
  height: 60px;
13
13
  min-height: 60px;
@@ -42,10 +42,9 @@ export const FiltProductsContainer = styled.ScrollView`
42
42
 
43
43
  export const BackgroundGray = styled.View`
44
44
  flex: 1;
45
- height: ${(props: any) => props.isIos ? '80%' : '100%'};
45
+ height: 100%;
46
46
  background-color: rgba(0,0,0,0.5);
47
47
  position: absolute;
48
- margin-top: 100px;
49
48
  z-index: 10000;
50
49
  width: 100%;
51
50
  `
@@ -3,6 +3,7 @@ import {
3
3
  BusinessReviews as BusinessReviewController,
4
4
  useLanguage,
5
5
  useOrder,
6
+ useUtils
6
7
  } from 'ordering-components/native';
7
8
  import { useTheme } from 'styled-components/native';
8
9
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
@@ -30,6 +31,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
30
31
  const theme = useTheme();
31
32
  const [searchReview, setSearchReview] = useState('')
32
33
  const [orderState] = useOrder();
34
+ const [{ parseDate }] = useUtils()
33
35
 
34
36
  const styles = StyleSheet.create({
35
37
  starIcon: {
@@ -94,7 +96,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
94
96
  const ReviewItem = ({ comment, created_at, total }: any) => (
95
97
  <View style={{ marginBottom: 30 }}>
96
98
  <OText size={12} color={theme.colors.textSecondary}>
97
- {moment(created_at).format('MMMM d, yyyy • hh:mm')}
99
+ {parseDate(created_at, { outputFormat: 'MMMM D, YYYY • hh:mm A' })}
98
100
  </OText>
99
101
  <OText size={12} color={theme.colors.textNormal}>{comment}</OText>
100
102
  </View>
@@ -0,0 +1,69 @@
1
+ import React from 'react'
2
+ import { ListWrapper } from './styles'
3
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
+ import { View } from 'react-native'
5
+
6
+ export const FlatListBusinessListFooter = (props : any) => {
7
+ const {
8
+ businessesList,
9
+ paginationProps,
10
+ isChewLayout
11
+ } = props
12
+ return (
13
+ <>
14
+ <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
15
+ {(businessesList.loading || !businessesList?.fetched) && (
16
+ <>
17
+ {[
18
+ ...Array(
19
+ paginationProps.nextPageItems
20
+ ? paginationProps.nextPageItems
21
+ : 8,
22
+ ).keys(),
23
+ ].map((item, i) => (
24
+ <Placeholder
25
+ Animation={Fade}
26
+ key={i}
27
+ style={{ marginBottom: 20 }}>
28
+ <View style={{ width: '100%' }}>
29
+ <PlaceholderLine
30
+ height={200}
31
+ style={{ marginBottom: 20, borderRadius: 25 }}
32
+ />
33
+ <View style={{ paddingHorizontal: 10 }}>
34
+ <View
35
+ style={{
36
+ flexDirection: 'row',
37
+ justifyContent: 'space-between',
38
+ }}>
39
+ <PlaceholderLine
40
+ height={25}
41
+ width={40}
42
+ style={{ marginBottom: 10 }}
43
+ />
44
+ <PlaceholderLine
45
+ height={25}
46
+ width={20}
47
+ style={{ marginBottom: 10 }}
48
+ />
49
+ </View>
50
+ <PlaceholderLine
51
+ height={20}
52
+ width={30}
53
+ style={{ marginBottom: 10 }}
54
+ />
55
+ <PlaceholderLine
56
+ height={20}
57
+ width={80}
58
+ style={{ marginBottom: 10 }}
59
+ />
60
+ </View>
61
+ </View>
62
+ </Placeholder>
63
+ ))}
64
+ </>
65
+ )}
66
+ </ListWrapper>
67
+ </>
68
+ )
69
+ }