ordering-ui-react-native 0.18.2 → 0.18.3-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 (263) 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 +19 -17
  16. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  17. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  18. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  19. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  20. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  21. package/themes/business/src/components/Chat/index.tsx +163 -123
  22. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  23. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  24. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  25. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  26. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  27. package/themes/business/src/components/MapView/index.tsx +14 -10
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
  35. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
  36. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  37. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  38. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  39. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  40. package/themes/business/src/components/OrdersOption/index.tsx +43 -32
  41. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  42. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  43. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  44. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  45. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  46. package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
  47. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  48. package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
  49. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  50. package/themes/business/src/components/StoresList/index.tsx +6 -5
  51. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  52. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  53. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  54. package/themes/business/src/components/shared/OModal.tsx +16 -9
  55. package/themes/business/src/types/index.tsx +8 -0
  56. package/themes/business/src/utils/index.tsx +4 -4
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  61. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  62. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/original/index.tsx +7 -3
  69. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  70. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  71. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  72. package/themes/original/src/components/AddressList/index.tsx +5 -8
  73. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  74. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  75. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  76. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  77. package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
  78. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
  79. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  80. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  81. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  82. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  83. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  84. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  85. package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
  86. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  87. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
  90. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
  91. package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
  92. package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
  93. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  96. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
  99. package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  106. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  107. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  108. package/themes/original/src/components/Cart/index.tsx +49 -47
  109. package/themes/original/src/components/CartContent/index.tsx +99 -38
  110. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  111. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  112. package/themes/original/src/components/Checkout/index.tsx +324 -43
  113. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  114. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  115. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  116. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  117. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  118. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  119. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  120. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  121. package/themes/original/src/components/Favorite/index.tsx +4 -9
  122. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  123. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  124. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  125. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  126. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  127. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
  128. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  129. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  131. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  132. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  133. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  134. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  135. package/themes/original/src/components/Home/index.tsx +14 -5
  136. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  137. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  138. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  139. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  140. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  141. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  142. package/themes/original/src/components/Messages/index.tsx +15 -4
  143. package/themes/original/src/components/Messages/styles.tsx +1 -1
  144. package/themes/original/src/components/MomentOption/index.tsx +9 -10
  145. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  146. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  148. package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
  149. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  150. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  151. package/themes/original/src/components/MyOrders/index.tsx +16 -5
  152. package/themes/original/src/components/NavBar/index.tsx +20 -13
  153. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  154. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  155. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  156. package/themes/original/src/components/Notifications/index.tsx +4 -8
  157. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  158. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  159. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
  160. package/themes/original/src/components/OrderDetails/index.tsx +721 -670
  161. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  162. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  163. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  164. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  165. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  166. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  168. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  170. package/themes/original/src/components/OrdersOption/index.tsx +44 -21
  171. package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
  172. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  173. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  174. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  175. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  177. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  178. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  179. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  180. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  181. package/themes/original/src/components/ProductForm/index.tsx +106 -170
  182. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  183. package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
  184. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  185. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  186. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  187. package/themes/original/src/components/Promotions/index.tsx +6 -6
  188. package/themes/original/src/components/Promotions/styles.tsx +3 -3
  189. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  190. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  191. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  192. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  193. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  194. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  195. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  196. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  197. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  198. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  199. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  200. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  201. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  202. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  203. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  204. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  205. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  206. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  207. package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
  208. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  209. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  210. package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
  211. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  212. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  213. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  214. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  215. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  216. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  217. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  218. package/themes/original/src/components/Wallets/index.tsx +48 -60
  219. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  220. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  221. package/themes/original/src/components/shared/OButton.tsx +3 -3
  222. package/themes/original/src/components/shared/OInput.tsx +4 -5
  223. package/themes/original/src/components/shared/OModal.tsx +15 -17
  224. package/themes/original/src/layouts/Container.tsx +5 -3
  225. package/themes/original/src/types/index.tsx +28 -6
  226. package/themes/original/src/utils/index.tsx +180 -13
  227. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  228. package/src/navigators/BottomNavigator.tsx +0 -117
  229. package/src/navigators/CheckoutNavigator.tsx +0 -66
  230. package/src/navigators/HomeNavigator.tsx +0 -202
  231. package/src/navigators/NavigationRef.tsx +0 -7
  232. package/src/navigators/RootNavigator.tsx +0 -269
  233. package/src/pages/Account.tsx +0 -34
  234. package/src/pages/AddressForm.tsx +0 -62
  235. package/src/pages/AddressList.tsx +0 -24
  236. package/src/pages/BusinessProductsList.tsx +0 -81
  237. package/src/pages/BusinessesListing.tsx +0 -43
  238. package/src/pages/CartList.tsx +0 -49
  239. package/src/pages/Checkout.tsx +0 -101
  240. package/src/pages/ForgotPassword.tsx +0 -24
  241. package/src/pages/Help.tsx +0 -23
  242. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  243. package/src/pages/HelpGuide.tsx +0 -23
  244. package/src/pages/HelpOrder.tsx +0 -23
  245. package/src/pages/Home.tsx +0 -36
  246. package/src/pages/IntroductoryTutorial.tsx +0 -170
  247. package/src/pages/Login.tsx +0 -47
  248. package/src/pages/MomentOption.tsx +0 -30
  249. package/src/pages/MultiCheckout.tsx +0 -31
  250. package/src/pages/MultiOrdersDetails.tsx +0 -27
  251. package/src/pages/MyOrders.tsx +0 -40
  252. package/src/pages/NetworkError.tsx +0 -24
  253. package/src/pages/NotFound.tsx +0 -22
  254. package/src/pages/OrderDetails.tsx +0 -25
  255. package/src/pages/ProductDetails.tsx +0 -55
  256. package/src/pages/Profile.tsx +0 -36
  257. package/src/pages/ReviewDriver.tsx +0 -30
  258. package/src/pages/ReviewOrder.tsx +0 -32
  259. package/src/pages/ReviewProducts.tsx +0 -30
  260. package/src/pages/Sessions.tsx +0 -22
  261. package/src/pages/Signup.tsx +0 -53
  262. package/src/pages/SpinnerLoader.tsx +0 -10
  263. 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,
@@ -42,6 +45,7 @@ import { ProfessionalFilter } from '../ProfessionalFilter';
42
45
  import { ServiceForm } from '../ServiceForm';
43
46
  import { BusinessesListing } from '../BusinessesListing/Layout/Original'
44
47
  import { PageBanner } from '../PageBanner'
48
+ import { NavBack } from 'ordering-ui-react-native/src/components/OrderDetails/styles';
45
49
 
46
50
  const PIXELS_TO_SCROLL = 2000
47
51
 
@@ -68,7 +72,9 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
68
72
  professionalSelected,
69
73
  handleUpdateProfessionals,
70
74
  handleChangeProfessionalSelected,
71
- onBusinessClick
75
+ onBusinessClick,
76
+ businessSingleId,
77
+ productModal
72
78
  } = props
73
79
 
74
80
  const insets = useSafeAreaInsets()
@@ -79,6 +85,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
79
85
  const [{ parsePrice }] = useUtils()
80
86
  const [, { showToast }] = useToast()
81
87
  const [{ configs }] = useConfig()
88
+ const [events] = useEvent()
82
89
  const isFocused = useIsFocused();
83
90
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
84
91
 
@@ -107,7 +114,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
107
114
  },
108
115
  searchIcon: {
109
116
  borderWidth: 0,
110
- padding: 15,
117
+ padding: 10,
111
118
  justifyContent: 'center',
112
119
  shadowColor: theme.colors.clear,
113
120
  },
@@ -132,31 +139,44 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
132
139
  const [openService, setOpenService] = useState(false)
133
140
  const [currentProduct, setCurrentProduct] = useState(null)
134
141
  const [searchBarHeight, setSearchBarHeight] = useState(60)
142
+ const [keyboardHeight, setKeyboardHeight] = useState(0);
143
+ const [viewedCategory, setViewedCategory] = useState<any>(null)
144
+ const [showTitle, setShowTitle] = useState(false)
135
145
 
136
146
  const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
137
147
  const isQuickAddProduct = configs?.add_product_with_one_click?.value === '1'
138
148
  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
149
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
141
150
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
142
- const filtProductsHeight = Platform.OS === 'ios' ? 165 : 100
151
+ const filtProductsHeight = Platform.OS === 'ios' ? 65 : 30
152
+ const viewOrderButtonVisible = !loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0
153
+
143
154
  const onRedirect = (route: string, params?: any) => {
144
155
  navigation.navigate(route, params)
145
156
  }
157
+ const vibrateApp = (impact?: string) => {
158
+ const options = {
159
+ enableVibrateFallback: true,
160
+ ignoreAndroidSystemSettings: false
161
+ };
162
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
163
+ }
146
164
  const onProductClick = async (product: any) => {
147
- if (product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
165
+ if (product.ingredients?.length === 0 && product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
148
166
  const isProductAddedToCart = currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)
149
167
  const productQuantity = isProductAddedToCart?.quantity
168
+ const minimumPerOrder = product?.minimum_per_order || 1
150
169
  const addCurrentProduct = {
151
170
  ...product,
152
- quantity: 1
171
+ quantity: minimumPerOrder
153
172
  }
154
173
  const updateCurrentProduct = {
174
+ name: product?.name,
155
175
  id: product.id,
156
176
  code: isProductAddedToCart?.code,
157
177
  quantity: productQuantity + 1
158
178
  }
159
- Vibration.vibrate()
179
+ vibrateApp()
160
180
  const cartData = currentCart?.business_id ? currentCart : { business_id: business.id }
161
181
  if (isProductAddedToCart) {
162
182
  await updateProduct(updateCurrentProduct, cartData, isQuickAddProduct)
@@ -173,10 +193,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
173
193
  onRedirect('ProductDetails', {
174
194
  product: product,
175
195
  businessSlug: business.slug,
176
- businessId: business.id,
177
- productAddedToCartLength
196
+ businessId: business.id || product?.category?.business_id,
197
+ productAddedToCartLength,
198
+ isRedirect: false
178
199
  })
179
200
  }
201
+ events.emit('product_clicked', product)
180
202
  }
181
203
 
182
204
  const handleCancel = () => {
@@ -184,18 +206,23 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
184
206
  handleChangeSearch('')
185
207
  }
186
208
 
187
- const handleUpsellingPage = () => {
209
+ const handleUpsellingPage = (cart: any) => {
210
+ const isProductCartParam = !!cart?.products?.length
188
211
  setOpenUpselling(false)
189
212
  setCanOpenUpselling(false)
190
- const cartsAvailable: any = Object.values(orderState?.carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
191
- if (cartsAvailable.length === 1) {
213
+ const cartsAvailable: any = Object.values(orderState?.carts)
214
+ ?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
215
+ ?.filter((_c: any) => !isProductCartParam ? _c.uuid !== cart?.uuid : _c)
216
+ if (cartsAvailable.length === 1 || !isCheckoutMultiBusinessEnabled) {
217
+ const cart = isCheckoutMultiBusinessEnabled ? cartsAvailable[0] : currentCart
218
+
192
219
  props.onNavigationRedirect('CheckoutNavigator', {
193
220
  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
- })
221
+ cartUuid: cart?.uuid,
222
+ businessLogo: cart?.business?.logo,
223
+ businessName: cart?.business?.name,
224
+ cartTotal: cart?.total
225
+ }, true)
199
226
  } else {
200
227
  const groupKeys: any = {}
201
228
  cartsAvailable.forEach((_cart: any) => {
@@ -211,12 +238,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
211
238
  props.onNavigationRedirect('CheckoutNavigator', {
212
239
  screen: 'MultiCheckout',
213
240
  checkCarts: true
214
- })
241
+ }, true)
215
242
  } else {
216
243
  props.onNavigationRedirect('CheckoutNavigator', {
217
244
  screen: 'MultiCheckout',
218
245
  cartUuid: cartsAvailable[0]?.group?.uuid
219
- })
246
+ }, true)
220
247
  }
221
248
  }
222
249
  }
@@ -229,6 +256,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
229
256
 
230
257
  const handlePageScroll = useCallback(({ nativeEvent }: any) => {
231
258
  const scrollOffset = nativeEvent.contentOffset.y
259
+ setShowTitle(scrollOffset > 30)
260
+
232
261
  if (businessState?.business?.lazy_load_products_recommended) {
233
262
  const height = nativeEvent.contentSize.height
234
263
  const hasMore = !(categoryState.pagination.totalPages === categoryState.pagination.currentPage)
@@ -259,7 +288,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
259
288
  }, []);
260
289
 
261
290
  const handleBackNavigation = () => {
262
- navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
291
+ navigation?.canGoBack() && !props.fromMulti ? navigation.goBack() : navigation.navigate('BottomTab')
263
292
  }
264
293
 
265
294
  const adjustBusiness = async (adjustBusinessId: number) => {
@@ -297,12 +326,84 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
297
326
  }
298
327
  }, [isFocused])
299
328
 
329
+
330
+ useEffect(() => {
331
+ function onKeyboardDidShow(e: KeyboardEvent) {
332
+ setKeyboardHeight(e?.endCoordinates?.height);
333
+ }
334
+
335
+ function onKeyboardDidHide() {
336
+ setKeyboardHeight(0);
337
+ }
338
+
339
+ const showSubscription = Keyboard.addListener('keyboardDidShow', onKeyboardDidShow);
340
+ const hideSubscription = Keyboard.addListener('keyboardDidHide', onKeyboardDidHide);
341
+ return () => {
342
+ showSubscription.remove();
343
+ hideSubscription.remove();
344
+ };
345
+ }, []);
346
+
300
347
  const subtotalWithTaxes = currentCart?.taxes?.reduce((acc: any, item: any) => {
301
348
  if (item?.type === 1)
302
349
  return acc = acc + item?.summary?.tax
303
350
  return acc = acc
304
351
  }, currentCart?.subtotal)
305
352
 
353
+ const onChangeSearch = (query: any) => {
354
+ handleChangeSearch(query)
355
+ if (query) {
356
+ events.emit('products_searched', query)
357
+ }
358
+ }
359
+
360
+ useEffect(() => {
361
+ let categoryId: any = null
362
+ if (business?.lazy_load_products_recommended) {
363
+ if (categorySelected?.id) {
364
+ categoryId = categorySelected.id
365
+ }
366
+ } else {
367
+ if (selectedCategoryId) {
368
+ const originCategoryId = selectedCategoryId.replace('cat_', '')
369
+ if (!isNaN(originCategoryId)) {
370
+ categoryId = Number(originCategoryId)
371
+ }
372
+ }
373
+ }
374
+ if (categoryId) {
375
+ const _viewedCategory = business.categories.find(category => category.id === categoryId)
376
+ if (_viewedCategory?.id !== viewedCategory?.id) {
377
+ setViewedCategory(_viewedCategory)
378
+ events.emit('product_list_viewed', _viewedCategory)
379
+ }
380
+ }
381
+ }, [business?.lazy_load_products_recommended, selectedCategoryId, categorySelected?.id, viewedCategory])
382
+
383
+ useEffect(() => {
384
+ const handleArrowBack: any = () => {
385
+ navigation.goBack()
386
+ return true
387
+ }
388
+ BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
389
+ return () => {
390
+ BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
391
+ }
392
+ }, [])
393
+
394
+ useEffect(() => {
395
+ if (!business && !loading && !error) {
396
+ showToast(ToastType.Error, t('BUSINESS_NOT_FOUND', 'Business not found'))
397
+ navigation.navigate('BusinessList')
398
+ }
399
+ }, [business, error, loading])
400
+
401
+ useEffect(() => {
402
+ if (productModal?.product && !productModal?.loading && !productModal?.error) {
403
+ onProductClick(props?.productModal?.product)
404
+ }
405
+ }, [productModal])
406
+
306
407
  return (
307
408
  <>
308
409
  <View style={{ flex: 1, backgroundColor: backgroundColor }}>
@@ -312,12 +413,29 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
312
413
  marginTop: Platform.OS === 'ios' ? insets.top : 0
313
414
  }}
314
415
  onLayout={(event: any) => setSearchBarHeight(event.nativeEvent.layout.height)}
416
+ hideArrow={(businessSingleId && auth)}
315
417
  >
316
418
  {!isOpenSearchBar && (
317
419
  <>
318
- <TopActions onPress={() => handleBackNavigation()}>
319
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
320
- </TopActions>
420
+ {!(businessSingleId && auth) && (
421
+ <TopActions onPress={() => handleBackNavigation()}>
422
+ <AntDesignIcon
423
+ name='arrowleft'
424
+ size={26}
425
+ />
426
+ </TopActions>
427
+ )}
428
+ {showTitle && (
429
+ <OText
430
+ size={16}
431
+ style={{ flex: 1, textAlign: 'center' }}
432
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
433
+ numberOfLines={2}
434
+ ellipsizeMode='tail'
435
+ >
436
+ {business?.name}
437
+ </OText>
438
+ )}
321
439
  {!errorQuantityProducts && (
322
440
  <View style={{ ...styles.headerItem }}>
323
441
  <TouchableOpacity
@@ -334,12 +452,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
334
452
  <WrapSearchBar>
335
453
  <SearchBar
336
454
  autoFocus
337
- onSearch={handleChangeSearch}
455
+ onSearch={onChangeSearch}
338
456
  onCancel={() => handleCancel()}
339
457
  isCancelXButtonShow
340
458
  noBorderShow
341
459
  placeholder={t('SEARCH_PRODUCTS', 'Search Products')}
342
- lazyLoad={businessState?.business?.lazy_load_products_recommended}
460
+ lazyLoad
343
461
  />
344
462
  </WrapSearchBar>
345
463
  )}
@@ -373,8 +491,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
373
491
  {business?.categories?.length > 0 && isOpenFiltProducts && (
374
492
  <FiltProductsContainer
375
493
  style={{
376
- height: Dimensions.get('window').height - filtProductsHeight,
377
- top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight
494
+ height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ? 55 : 0),
495
+ top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight,
378
496
  }}
379
497
  contentContainerStyle={{ flexGrow: 1 }}
380
498
  >
@@ -407,15 +525,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
407
525
  previouslyProducts={business?.previously_products}
408
526
  navigation={navigation}
409
527
  isFiltMode
528
+ businessSingleId={businessSingleId}
410
529
  />
411
530
  </View>
412
531
  </FiltProductsContainer>
413
532
  )}
414
- {isOpenFiltProducts && (
415
- <BackgroundGray isIos={Platform.OS === 'ios'} />
416
- )}
417
533
  <IOScrollView
418
- stickyHeaderIndices={[business?.professionals?.length > 0 ? 3 : 2]}
534
+ stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
419
535
  style={{
420
536
  ...styles.mainContainer,
421
537
  marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
@@ -452,7 +568,9 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
452
568
  />
453
569
  </ProfessionalFilterWrapper>
454
570
  )}
455
- <PageBanner position='app_business_page' navigation={navigation} />
571
+ {businessState?.business?.id && (
572
+ <PageBanner position='app_business_page' businessId={businessState?.business?.id} navigation={navigation} />
573
+ )}
456
574
  <View
457
575
  style={{
458
576
  height: 8,
@@ -480,7 +598,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
480
598
  <>
481
599
  <WrapContent
482
600
  onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
483
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
601
+ style={{ paddingHorizontal: 20 }}
484
602
  >
485
603
  <BusinessProductsList
486
604
  categories={[
@@ -509,6 +627,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
509
627
  handleUpdateProducts={handleUpdateProducts}
510
628
  navigation={navigation}
511
629
  previouslyProducts={business?.previously_products}
630
+ businessSingleId={businessSingleId}
512
631
  />
513
632
  </WrapContent>
514
633
  </>
@@ -536,8 +655,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
536
655
  </WrapContent>
537
656
  </>
538
657
  )}
658
+ {isOpenFiltProducts && (
659
+ <BackgroundGray isIos={Platform.OS === 'ios'} />
660
+ )}
539
661
  </IOScrollView>
540
- {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
662
+ {viewOrderButtonVisible && (
541
663
  <View style={{ marginBottom: 0 }}>
542
664
  <FloatingButton
543
665
  btnText={
@@ -588,12 +710,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
588
710
  <ServiceForm
589
711
  navigation={navigation}
590
712
  product={currentProduct}
591
- businessSlug={business.slug}
592
- businessId={business.id}
713
+ businessSlug={business?.slug}
714
+ businessId={business?.id}
593
715
  professionalList={business?.professionals}
594
716
  professionalSelected={professionalSelected}
595
717
  handleChangeProfessional={handleChangeProfessionalSelected}
596
- handleChangeProfessional={handleChangeProfessionalSelected}
597
718
  handleUpdateProfessionals={handleUpdateProfessionals}
598
719
  onSave={() => setOpenService(false)}
599
720
  onClose={() => setOpenService(false)}
@@ -607,6 +728,8 @@ export const BusinessProductsListing = (props: BusinessProductsListingParams) =>
607
728
  const businessProductslistingProps = {
608
729
  ...props,
609
730
  isForceSearch: Platform.OS === 'ios',
731
+ isApp: true,
732
+ isFetchAllProducts: true,
610
733
  UIComponent: BusinessProductsListingUI
611
734
  }
612
735
  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,16 +42,15 @@ 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
  `
52
51
 
53
52
  export const ProfessionalFilterWrapper = styled.View`
54
- padding-left: 40px;
53
+ padding-left: 20px;
55
54
  margin-bottom: 35px;
56
55
  `
57
56
 
@@ -64,6 +63,6 @@ export const NearBusiness = styled.View`
64
63
  export const TopActions = styled.TouchableOpacity`
65
64
  height: 60px;
66
65
  justify-content: center;
67
- padding-horizontal: 30px;
66
+ padding-horizontal: 20px;
68
67
  width: 100px;
69
68
  `;
@@ -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>
@@ -107,7 +109,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
107
109
  return (
108
110
  <BusinessReviewsContainer>
109
111
  <BusinessReviewContent
110
- contentContainerStyle={{ paddingHorizontal: 40, paddingVertical: 27 }}>
112
+ contentContainerStyle={{ paddingHorizontal: 20, paddingVertical: 27 }}>
111
113
  {reviewsList.error ? (
112
114
  <OText size={16}>{t('ERROR_UNKNOWN', 'An error has ocurred')}</OText>
113
115
  ) : (
@@ -415,7 +415,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
415
415
  <ScrollView
416
416
  showsHorizontalScrollIndicator={false}
417
417
  nestedScrollEnabled
418
- horizontal contentContainerStyle={{ paddingHorizontal: 40 }}>
418
+ horizontal contentContainerStyle={{ paddingHorizontal: 20 }}>
419
419
  {featuredBusiness.map((bAry: any, idx) => (
420
420
  <View key={'f-listing_' + idx}>
421
421
  <BusinessFeaturedController
@@ -54,13 +54,13 @@ export const WrapMomentOption = styled.TouchableOpacity`
54
54
  export const HeaderWrapper = styled.ImageBackground`
55
55
  width: 100%;
56
56
  height: 370px;
57
- padding: 20px 40px;
57
+ padding: 20px;
58
58
  background-color: transparent;
59
59
  `;
60
60
 
61
61
  export const ListWrapper = styled.View`
62
62
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
63
- padding-horizontal: 40px;
63
+ padding-horizontal: 20px;
64
64
  `;
65
65
 
66
66
  export const FeaturedWrapper = styled.View`
@@ -72,7 +72,7 @@ export const FeaturedWrapper = styled.View`
72
72
  export const OrderProgressWrapper = styled.View`
73
73
  margin-top: 37px;
74
74
  margin-bottom: 20px;
75
- padding-horizontal: 40px;
75
+ padding-horizontal: 20px;
76
76
  `
77
77
 
78
78
  export const FarAwayMessage = styled.View`
@@ -98,10 +98,10 @@ export const FilterWrapper = styled.View`
98
98
  `
99
99
 
100
100
  export const ServiceWrapper = styled.View`
101
- padding-horizontal: 40px;
101
+ padding-horizontal: 20px;
102
102
  `
103
103
 
104
104
  export const PriceWrapper = styled.View`
105
- padding-horizontal: 40px;
105
+ padding-horizontal: 20px;
106
106
  margin-top: 30px;
107
107
  `
@@ -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: 20 }}>
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
+ }