ordering-ui-react-native 0.21.21 → 0.21.22-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 (239) hide show
  1. package/package.json +7 -6
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +4 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +2 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +4 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +23 -14
  18. package/themes/business/src/components/DriverMap/index.tsx +4 -3
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/Home/index.tsx +5 -1
  21. package/themes/business/src/components/LanguageSelector/index.tsx +4 -2
  22. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  23. package/themes/business/src/components/MapView/index.tsx +11 -7
  24. package/themes/business/src/components/MessagesOption/index.tsx +2 -1
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +163 -113
  26. package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +60 -53
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +54 -23
  30. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  32. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  33. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  34. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  35. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  36. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +33 -36
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
  39. package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  41. package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
  42. package/themes/business/src/components/PrinterSettings/styles.tsx +17 -0
  43. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  44. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  45. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  46. package/themes/business/src/components/Sessions/index.tsx +187 -0
  47. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  48. package/themes/business/src/components/StoresList/index.tsx +5 -3
  49. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  50. package/themes/business/src/components/UserProfileForm/index.tsx +98 -44
  51. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  52. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  53. package/themes/business/src/components/shared/OInput.tsx +2 -0
  54. package/themes/business/src/hooks/useLocation.tsx +5 -4
  55. package/themes/business/src/types/index.tsx +15 -2
  56. package/themes/business/src/utils/index.tsx +5 -0
  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/LoginForm/index.tsx +7 -4
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  65. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  66. package/themes/original/index.tsx +9 -4
  67. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  68. package/themes/original/src/components/AddressForm/index.tsx +10 -6
  69. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  70. package/themes/original/src/components/AddressList/index.tsx +4 -7
  71. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  72. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  73. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  74. package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  76. package/themes/original/src/components/BusinessController/index.tsx +20 -12
  77. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  78. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  79. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  80. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  81. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  82. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  83. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  84. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  85. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
  86. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  88. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +51 -20
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  91. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  100. package/themes/original/src/components/Cart/index.tsx +32 -9
  101. package/themes/original/src/components/CartContent/index.tsx +96 -58
  102. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +190 -66
  104. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  105. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  106. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  107. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  108. package/themes/original/src/components/Favorite/index.tsx +4 -9
  109. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  110. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  111. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  112. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  113. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  114. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  115. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  116. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  117. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  118. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  119. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  120. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  121. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  122. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  123. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  124. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  125. package/themes/original/src/components/GoogleMap/index.tsx +6 -5
  126. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  127. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  128. package/themes/original/src/components/Home/index.tsx +2 -1
  129. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  130. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  131. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  132. package/themes/original/src/components/Messages/index.tsx +9 -4
  133. package/themes/original/src/components/Messages/styles.tsx +1 -1
  134. package/themes/original/src/components/MomentOption/index.tsx +4 -3
  135. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  136. package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
  137. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  139. package/themes/original/src/components/MyOrders/index.tsx +24 -29
  140. package/themes/original/src/components/NavBar/index.tsx +3 -1
  141. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  142. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  143. package/themes/original/src/components/Notifications/index.tsx +4 -8
  144. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  146. package/themes/original/src/components/OrderDetails/index.tsx +716 -668
  147. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  148. package/themes/original/src/components/OrderProgress/index.tsx +28 -6
  149. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  150. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  154. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  155. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  156. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  157. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  158. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  159. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  160. package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
  161. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  162. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  163. package/themes/original/src/components/ProductForm/index.tsx +74 -165
  164. package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
  165. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  166. package/themes/original/src/components/ProductOptionSubOption/index.tsx +123 -82
  167. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +6 -1
  168. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  169. package/themes/original/src/components/Promotions/index.tsx +4 -4
  170. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  171. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  172. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  173. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  174. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  175. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  176. package/themes/original/src/components/SignupForm/index.tsx +60 -58
  177. package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
  178. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  180. package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +72 -59
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
  183. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  184. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  186. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  187. package/themes/original/src/components/UserFormDetails/index.tsx +125 -77
  188. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  189. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  190. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  192. package/themes/original/src/components/Wallets/index.tsx +8 -9
  193. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  194. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  195. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  197. package/themes/original/src/components/shared/OButton.tsx +5 -5
  198. package/themes/original/src/components/shared/OInput.tsx +1 -4
  199. package/themes/original/src/components/shared/OModal.tsx +12 -14
  200. package/themes/original/src/layouts/Container.tsx +5 -3
  201. package/themes/original/src/types/index.tsx +1 -0
  202. package/themes/original/src/utils/index.tsx +125 -1
  203. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  204. package/src/navigators/BottomNavigator.tsx +0 -117
  205. package/src/navigators/CheckoutNavigator.tsx +0 -66
  206. package/src/navigators/HomeNavigator.tsx +0 -202
  207. package/src/navigators/NavigationRef.tsx +0 -7
  208. package/src/navigators/RootNavigator.tsx +0 -269
  209. package/src/pages/Account.tsx +0 -34
  210. package/src/pages/AddressForm.tsx +0 -62
  211. package/src/pages/AddressList.tsx +0 -24
  212. package/src/pages/BusinessProductsList.tsx +0 -81
  213. package/src/pages/BusinessesListing.tsx +0 -43
  214. package/src/pages/CartList.tsx +0 -49
  215. package/src/pages/Checkout.tsx +0 -101
  216. package/src/pages/ForgotPassword.tsx +0 -24
  217. package/src/pages/Help.tsx +0 -23
  218. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  219. package/src/pages/HelpGuide.tsx +0 -23
  220. package/src/pages/HelpOrder.tsx +0 -23
  221. package/src/pages/Home.tsx +0 -36
  222. package/src/pages/IntroductoryTutorial.tsx +0 -170
  223. package/src/pages/Login.tsx +0 -47
  224. package/src/pages/MomentOption.tsx +0 -30
  225. package/src/pages/MultiCheckout.tsx +0 -31
  226. package/src/pages/MultiOrdersDetails.tsx +0 -27
  227. package/src/pages/MyOrders.tsx +0 -40
  228. package/src/pages/NetworkError.tsx +0 -24
  229. package/src/pages/NotFound.tsx +0 -22
  230. package/src/pages/OrderDetails.tsx +0 -25
  231. package/src/pages/ProductDetails.tsx +0 -55
  232. package/src/pages/Profile.tsx +0 -36
  233. package/src/pages/ReviewDriver.tsx +0 -30
  234. package/src/pages/ReviewOrder.tsx +0 -32
  235. package/src/pages/ReviewProducts.tsx +0 -30
  236. package/src/pages/Sessions.tsx +0 -22
  237. package/src/pages/Signup.tsx +0 -53
  238. package/src/pages/SpinnerLoader.tsx +0 -10
  239. package/src/pages/Splash.tsx +0 -21
@@ -1,59 +1,29 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
3
3
  import Geolocation from '@react-native-community/geolocation'
4
- import { IOScrollView } from 'react-native-intersection-observer'
5
4
  import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
6
5
  import {
7
6
  View,
8
7
  StyleSheet,
9
- ScrollView,
10
8
  Platform,
11
9
  TouchableOpacity,
12
- RefreshControl,
13
- AppState
14
10
  } from 'react-native';
11
+
15
12
  import {
16
13
  BusinessList as BusinessesListingController,
17
- useLanguage,
18
- useSession,
19
14
  useOrder,
20
15
  useConfig,
21
- useUtils
22
16
  } from 'ordering-components/native';
23
17
  import { useTheme } from 'styled-components/native';
24
- import Ionicons from 'react-native-vector-icons/Ionicons'
25
18
 
26
19
  import {
27
- Search,
28
- OrderControlContainer,
29
- AddressInput,
30
- WrapMomentOption,
31
- HeaderWrapper,
32
- ListWrapper,
33
- FeaturedWrapper,
34
- FarAwayMessage,
35
- AddressInputContainer,
36
- PreorderInput,
37
- OrderTypesContainer,
38
20
  BusinessLogosContainer
39
21
  } from './styles';
40
22
 
41
- import { OIcon, OText, OModal } from '../../../shared';
42
23
  import { BusinessesListingParams } from '../../../../types';
43
- import { NotFoundSource } from '../../../NotFoundSource';
44
- import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
45
- import { BusinessController } from '../../../BusinessController';
46
- import { OrderTypeSelector } from '../../../OrderTypeSelector';
47
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
48
- import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
49
- import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
50
- import { getTypesText } from '../../../../utils';
51
- import { OrderProgress } from '../../../OrderProgress';
52
- import { useFocusEffect, useIsFocused } from '@react-navigation/native';
24
+ import { useFocusEffect } from '@react-navigation/native';
53
25
  import FastImage from 'react-native-fast-image';
54
- import IconAntDesign from 'react-native-vector-icons/AntDesign';
55
- import { PageBanner } from '../../../PageBanner'
56
- import { CitiesControl } from '../../../CitiesControl'
26
+ import { FlatListBusinessListing } from './FlatListBusinessListing'
57
27
 
58
28
  const PIXELS_TO_SCROLL = 2000;
59
29
 
@@ -62,36 +32,19 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
62
32
  navigation,
63
33
  businessesList,
64
34
  getBusinesses,
65
- handleChangeBusinessType,
66
35
  handleBusinessClick,
67
36
  paginationProps,
68
- businessId,
69
- isGuestUser,
70
- handleUpdateBusinessList,
71
37
  citiesState,
72
38
  actualSlug,
73
39
  logosLayout
74
40
  } = props;
75
41
  const theme = useTheme();
76
- const isFocused = useIsFocused();
77
42
 
78
- const [, t] = useLanguage();
79
- const [{ user, auth }] = useSession();
80
43
  const [orderState, { changeCityFilter }] = useOrder();
81
44
  const [{ configs }] = useConfig();
82
- const [{ parseDate }] = useUtils();
83
45
 
84
- const appState = useRef(AppState.currentState)
85
46
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
86
- const [refreshing] = useState(false);
87
47
  const allCitiesDisabled = citiesState?.cities?.every((city: any) => !city.enabled)
88
- const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
89
- const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
90
- const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
91
- const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
92
- const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
93
- const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
94
- const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
95
48
 
96
49
  const styles = StyleSheet.create({
97
50
  container: {
@@ -141,7 +94,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
141
94
  backgroundColor: theme.colors.white,
142
95
  borderColor: theme.colors.backgroundGray,
143
96
  borderRadius: 8,
144
- marginHorizontal: 40,
97
+ marginHorizontal: 20,
145
98
  minHeight: 45,
146
99
  paddingVertical: 5,
147
100
  paddingHorizontal: 20,
@@ -156,32 +109,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
156
109
  },
157
110
  });
158
111
 
159
- const { top } = useSafeAreaInsets();
160
-
161
112
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
162
113
  const [isFarAway, setIsFarAway] = useState(false)
163
- const [businessTypes, setBusinessTypes] = useState(null)
164
114
  const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options?.value)
165
115
  const [isOpenCities, setIsOpenCities] = useState(false)
166
- const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
167
- Number(configs?.max_days_preorder?.value) > 0
168
- const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
169
116
  const timerId = useRef<any>(false)
170
117
  const [favoriteIds, setFavoriteIds] = useState<any>([])
171
- const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
172
118
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
173
119
 
174
- const handleMomentClick = () => {
175
- if (isPreorderEnabled) {
176
- navigation.navigate('MomentOption')
177
- }
178
- }
179
-
180
- const configTypes =
181
- configs?.order_types_allowed?.value
182
- .split('|')
183
- .map((value: any) => Number(value)) || [];
184
-
185
120
  const handleScroll = ({ nativeEvent }: any) => {
186
121
  const y = nativeEvent.contentOffset.y;
187
122
  const height = nativeEvent.contentSize.height;
@@ -233,7 +168,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
233
168
  setFeaturedBusinesses(ary);
234
169
  }
235
170
  resetInactivityTimeout()
236
- }, [businessesList.loading])
171
+ }, [businessesList.loading, businessesList?.businesses])
237
172
 
238
173
  const handleOnRefresh = () => {
239
174
  if (!businessesList.loading) {
@@ -355,340 +290,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
355
290
  }
356
291
 
357
292
  return (
358
- <IOScrollView
359
- style={styles.container}
360
- onScroll={(e) => handleScroll(e)}
361
- showsVerticalScrollIndicator={false}
362
- refreshControl={
363
- <RefreshControl
364
- refreshing={refreshing}
365
- onRefresh={() => handleOnRefresh()}
366
- />
367
- }
368
- >
369
- {enabledPoweredByOrdering && auth && (
370
- <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', top: 20 }}>
371
- <OText>
372
- Powered By Ordering.co
373
- </OText>
374
- </View>
375
- )}
376
- <View style={{
377
- height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
378
- marginTop: isChewLayout ? 0 : Platform.OS == 'ios' ? 0 : 50,
379
- backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
380
- }}
381
- >
382
- {isChewLayout && (
383
- <View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
384
- <OText size={24} weight={700} color={theme.colors?.white}>
385
- {t('WELCOME', 'Welcome')} {user?.name}
386
- </OText>
387
- </View>
388
- )}
389
- <Search isChewLayout={isChewLayout}>
390
- <AddressInput
391
- isChewLayout={isChewLayout}
392
- onPress={() =>
393
- auth
394
- ? navigation.navigate('AddressList', { isFromBusinesses: true })
395
- : navigation.navigate('AddressForm', {
396
- address: orderState.options?.address,
397
- isFromBusinesses: true,
398
- isGuestUser: isGuestUser
399
- })
400
- }>
401
- <AddressInputContainer isChewLayout={isChewLayout}>
402
- <OIcon
403
- src={theme.images.general.pin}
404
- color={theme.colors.disabled}
405
- width={16}
406
- style={{ marginRight: isChewLayout ? 0 : 10 }}
407
- />
408
- <OText size={12} numberOfLines={1} style={{ flex: 1 }}>
409
- {orderState?.options?.address?.address || t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?')}
410
- </OText>
411
- {!isChewLayout && (
412
- <OIcon
413
- src={theme.images.general.arrow_down}
414
- width={10}
415
- style={{ marginStart: 8 }}
416
- />
417
- )}
418
- </AddressInputContainer>
419
- </AddressInput>
420
- </Search>
421
- {isFarAway && !isChewLayout && (
422
- <FarAwayMessage style={styles.farAwayMsg}>
423
- <Ionicons name='md-warning-outline' style={styles.iconStyle} />
424
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
425
- </FarAwayMessage>
426
- )}
427
- {!isChewLayout ? (
428
- <OrderControlContainer>
429
- <View style={styles.wrapperOrderOptions}>
430
- {isPreOrderSetting && (
431
- <WrapMomentOption
432
- onPress={() => handleMomentClick()}>
433
- <OText
434
- size={12}
435
- numberOfLines={1}
436
- ellipsizeMode="tail"
437
- color={theme.colors.textSecondary}>
438
- {orderState.options?.moment
439
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
440
- : t('ASAP_ABBREVIATION', 'ASAP')}
441
- </OText>
442
- {isPreorderEnabled && (
443
- <OIcon
444
- src={theme.images.general.arrow_down}
445
- width={10}
446
- style={{ marginStart: 8 }}
447
- />
448
- )}
449
- </WrapMomentOption>
450
- )}
451
- <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
452
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
453
- <OIcon
454
- src={theme.images.general.arrow_down}
455
- width={10}
456
- style={{ marginStart: 8 }}
457
- />
458
- </WrapMomentOption>
459
- </View>
460
- </OrderControlContainer>
461
- ) : (
462
- <>
463
- {isPreOrderSetting && (
464
- <View style={{ paddingHorizontal: 30 }}>
465
- <PreorderInput
466
- isChewLayout={isChewLayout}
467
- onPress={() => handleMomentClick()}
468
- >
469
- <OText color={theme.colors.textSecondary}>
470
- {orderState.options?.moment
471
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
472
- : t('ASAP_ABBREVIATION', 'ASAP')}</OText>
473
- </PreorderInput>
474
- </View>
475
- )}
476
- </>
477
- )}
478
- </View>
479
- {!isChewLayout ? (
480
- <>
481
- {!hideHero ? (
482
- <HeaderWrapper
483
- source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
484
- style={{ paddingTop: top + 20 }}
485
- resizeMode='cover'
486
- bgHeaderHeight={bgHeaderHeight}
487
- >
488
- {!auth && (
489
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
490
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
491
- </TouchableOpacity>
492
- )}
493
- </HeaderWrapper>
494
- ) : (
495
- <>
496
- {!auth && (
497
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
498
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
499
- </TouchableOpacity>
500
- )}
501
- </>
502
- )}
503
- </>
504
- ) : (
505
- <OrderTypesContainer>
506
- <OrderTypeSelector
507
- handleChangeBusinessType={handleChangeBusinessType}
508
- isChewLayout
509
- chewOrderTypes={chewOrderTypes}
510
- handleChangeType={setOrderTypeValue}
511
- />
512
- </OrderTypesContainer>
513
- )}
514
-
515
- {!hideCities && orderTypeValue === 2 && (
516
- <View style={{ marginTop: 20 }}>
517
- <TouchableOpacity
518
- style={styles.buttonCityStyle}
519
- onPress={() => setIsOpenCities(true)}
520
- disabled={orderState?.loading}
521
- >
522
- <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
523
- {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
524
- </OText>
525
- </TouchableOpacity>
526
- </View>
527
- )}
528
- {!hidePreviousOrders && (
529
- <OrderProgress
530
- {...props}
531
- isFocused={isFocused}
532
- />
533
- )}
534
- {
535
- !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
536
- <FeaturedWrapper>
537
- <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
538
- <ScrollView
539
- showsHorizontalScrollIndicator={false}
540
- nestedScrollEnabled
541
- horizontal
542
- contentContainerStyle={{ paddingHorizontal: 40 }}
543
- >
544
- {featuredBusiness.map((bAry: any, idx) => (
545
- <View key={'f-listing_' + idx}>
546
- <BusinessFeaturedController
547
- business={bAry[0]}
548
- isBusinessOpen={bAry[0]?.open}
549
- handleCustomClick={handleBusinessClick}
550
- orderType={orderState?.options?.type}
551
- />
552
- {bAry.length > 1 && (
553
- <BusinessFeaturedController
554
- business={bAry[1]}
555
- isBusinessOpen={bAry[1]?.open}
556
- handleCustomClick={handleBusinessClick}
557
- orderType={orderState?.options?.type}
558
- />
559
- )}
560
- </View>
561
- ))}
562
- </ScrollView>
563
- </FeaturedWrapper>
564
- )
565
- }
566
- {!isChewLayout && !hideHighestBusiness && (
567
- <>
568
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
569
- {
570
- !businessId && !props.franchiseId && (
571
- <HighestRatedBusinesses
572
- propsToFetch={props.propsToFetch}
573
- onBusinessClick={handleBusinessClick}
574
- navigation={navigation}
575
- favoriteIds={favoriteIds}
576
- setFavoriteIds={setFavoriteIds}
577
- />
578
- )
579
- }
580
- </>
581
- )}
582
-
583
- <PageBanner position='app_business_listing' navigation={navigation} />
584
-
585
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
586
- <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
587
- {!businessId && !isAllCategoriesHidden && (
588
- <BusinessTypeFilter
589
- images={props.images}
590
- businessTypes={props.businessTypes}
591
- defaultBusinessType={props.defaultBusinessType}
592
- handleChangeBusinessType={handleChangeBusinessType}
593
- setBusinessTypes={setBusinessTypes}
594
- />
595
- )}
596
- {!businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
597
- <NotFoundSource
598
- content={t(
599
- 'NOT_FOUND_BUSINESSES',
600
- 'No businesses to delivery / pick up at this address, please change filters or change address.',
601
- )}
602
- />
603
- )}
604
- {businessesList.businesses?.map(
605
- (business: any, i: number) => (
606
- <BusinessController
607
- key={`${business.id}_` + i}
608
- enableIntersection
609
- business={business}
610
- isBusinessOpen={business.open}
611
- handleCustomClick={handleBusinessClick}
612
- orderType={orderState?.options?.type}
613
- navigation={navigation}
614
- businessHeader={business?.header}
615
- businessFeatured={business?.featured}
616
- businessLogo={business?.logo}
617
- businessReviews={business?.reviews}
618
- businessDeliveryPrice={business?.delivery_price}
619
- businessDeliveryTime={business?.delivery_time}
620
- businessPickupTime={business?.pickup_time}
621
- businessDistance={business?.distance}
622
- handleUpdateBusinessList={handleUpdateBusinessList}
623
- favoriteIds={favoriteIds}
624
- setFavoriteIds={setFavoriteIds}
625
- />
626
- )
627
- )}
628
- {(businessesList.loading || !businessesList?.fetched) && (
629
- <>
630
- {[
631
- ...Array(
632
- paginationProps.nextPageItems
633
- ? paginationProps.nextPageItems
634
- : 8,
635
- ).keys(),
636
- ].map((item, i) => (
637
- <Placeholder
638
- Animation={Fade}
639
- key={i}
640
- style={{ marginBottom: 20 }}>
641
- <View style={{ width: '100%' }}>
642
- <PlaceholderLine
643
- height={200}
644
- style={{ marginBottom: 20, borderRadius: 25 }}
645
- />
646
- <View style={{ paddingHorizontal: 10 }}>
647
- <View
648
- style={{
649
- flexDirection: 'row',
650
- justifyContent: 'space-between',
651
- }}>
652
- <PlaceholderLine
653
- height={25}
654
- width={40}
655
- style={{ marginBottom: 10 }}
656
- />
657
- <PlaceholderLine
658
- height={25}
659
- width={20}
660
- style={{ marginBottom: 10 }}
661
- />
662
- </View>
663
- <PlaceholderLine
664
- height={20}
665
- width={30}
666
- style={{ marginBottom: 10 }}
667
- />
668
- <PlaceholderLine
669
- height={20}
670
- width={80}
671
- style={{ marginBottom: 10 }}
672
- />
673
- </View>
674
- </View>
675
- </Placeholder>
676
- ))}
677
- </>
678
- )}
679
- </ListWrapper>
680
- <OModal
681
- open={isOpenCities}
682
- onClose={() => setIsOpenCities(false)}
683
- title={t('SELECT_A_CITY', 'Select a city')}
684
- >
685
- <CitiesControl
686
- cities={citiesState?.cities}
687
- onClose={() => setIsOpenCities(false)}
688
- handleChangeCity={handleChangeCity}
689
- />
690
- </OModal>
691
- </IOScrollView>
293
+ <FlatListBusinessListing
294
+ {...props}
295
+ navigation={navigation}
296
+ businessesList={businessesList}
297
+ enabledPoweredByOrdering={enabledPoweredByOrdering}
298
+ orderTypeValue={orderTypeValue}
299
+ allCitiesDisabled={allCitiesDisabled}
300
+ featuredBusiness={featuredBusiness}
301
+ favoriteIds={favoriteIds}
302
+ isFarAway={isFarAway}
303
+ isOpenCities={isOpenCities}
304
+ isChewLayout={isChewLayout}
305
+ handleScroll={handleScroll}
306
+ setIsOpenCities={setIsOpenCities}
307
+ setFavoriteIds={setFavoriteIds}
308
+ handleOnRefresh={handleOnRefresh}
309
+ setOrderTypeValue={setOrderTypeValue}
310
+ handleChangeCity={handleChangeCity}
311
+ />
692
312
  );
693
313
  };
694
314
 
@@ -61,7 +61,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
61
61
  export const HeaderWrapper = styled.ImageBackground`
62
62
  width: 100%;
63
63
  height: 270px;
64
- padding: 20px 40px;
64
+ padding: 20px;
65
65
  background-color: transparent;
66
66
  `;
67
67
 
@@ -1,4 +1,3 @@
1
-
2
1
  import React, { useState, useEffect } from 'react'
3
2
  import { useOrder, useSession, useLanguage, useConfig } from 'ordering-components/native';
4
3
 
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useState, useRef } from 'react';
2
2
  import {
3
3
  Cart as CartController,
4
4
  useOrder,
@@ -52,7 +52,11 @@ const CartUI = (props: any) => {
52
52
  preorderMaximumDays,
53
53
  preorderMinimumDays,
54
54
  cateringTypes,
55
- isFromUpselling
55
+ isFromUpselling,
56
+ cartsOpened,
57
+ setCartsOpened,
58
+ changeActiveState,
59
+ isActive
56
60
  } = props
57
61
 
58
62
  const theme = useTheme();
@@ -62,7 +66,7 @@ const CartUI = (props: any) => {
62
66
  const [{ configs }] = useConfig();
63
67
  const [{ parsePrice, parseNumber, parseDate }] = useUtils()
64
68
  const [validationFields] = useValidationFields()
65
-
69
+ const commentRef = useRef()
66
70
  const [openUpselling, setOpenUpselling] = useState(false)
67
71
  const [openChangeStore, setOpenChangeStore] = useState(false)
68
72
  const [canOpenUpselling, setCanOpenUpselling] = useState(false)
@@ -109,7 +113,7 @@ const CartUI = (props: any) => {
109
113
  }
110
114
  }
111
115
 
112
- const handleUpsellingPage = (individualCart : any) => {
116
+ const handleUpsellingPage = (individualCart: any) => {
113
117
  const isProductCartParam = !!individualCart?.products?.length
114
118
  setOpenUpselling(false)
115
119
  setCanOpenUpselling(false)
@@ -117,7 +121,7 @@ const CartUI = (props: any) => {
117
121
  const cartsAvailable: any = Object.values(orderState?.carts)
118
122
  ?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
119
123
  ?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
120
- if (cartsAvailable.length === 1 || !isMultiCheckout) {
124
+ if (cartsAvailable.length === 1 || !isMultiCheckout || !cart?.business_id) {
121
125
  const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
122
126
  onNavigationRedirect('CheckoutNavigator', {
123
127
  screen: 'CheckoutPage',
@@ -192,6 +196,18 @@ const CartUI = (props: any) => {
192
196
  return acc = acc
193
197
  }, cart?.subtotal)
194
198
 
199
+ const handleClickCheckout = () => {
200
+ if (cart?.business_id) {
201
+ setOpenUpselling(true)
202
+ } else {
203
+ onNavigationRedirect('CheckoutNavigator', {
204
+ screen: 'CheckoutPage',
205
+ cartUuid: cart?.uuid,
206
+ cartTotal: cart?.total
207
+ }, true)
208
+ }
209
+ }
210
+
195
211
  useEffect(() => {
196
212
  const limitDays = parseInt(preorderMaximumDays ?? configs?.max_days_preorder?.value, 10)
197
213
  const currentDate = new Date()
@@ -207,7 +223,7 @@ const CartUI = (props: any) => {
207
223
 
208
224
  return (
209
225
  <CContainer>
210
- {openUpselling && (
226
+ {!!openUpselling && (
211
227
  <UpsellingProducts
212
228
  handleUpsellingPage={handleUpsellingPage}
213
229
  openUpselling={openUpselling}
@@ -228,10 +244,15 @@ const CartUI = (props: any) => {
228
244
  handleCartOpen={handleCartOpen}
229
245
  onNavigationRedirect={props.onNavigationRedirect}
230
246
  handleChangeStore={() => setOpenChangeStore(true)}
231
- handleClickCheckout={() => setOpenUpselling(true)}
247
+ handleClickCheckout={() => handleClickCheckout()}
232
248
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
233
249
  isMultiCheckout={isMultiCheckout}
234
250
  isFromUpselling={isFromUpselling}
251
+ cartsOpened={cartsOpened}
252
+ setCartsOpened={setCartsOpened}
253
+ changeActiveState={changeActiveState}
254
+ isActive={isActive}
255
+ isGiftCart={!cart?.business_id}
235
256
  >
236
257
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
237
258
  <ProductItemAccordion
@@ -423,6 +444,7 @@ const CartUI = (props: any) => {
423
444
  cart?.status !== 2 &&
424
445
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
425
446
  driverTipsOptions && driverTipsOptions?.length > 0 &&
447
+ cart?.business_id &&
426
448
  (
427
449
  <DriverTipsContainer>
428
450
  <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
@@ -489,6 +511,7 @@ const CartUI = (props: any) => {
489
511
  marginTop: 10,
490
512
  borderRadius: 7.6
491
513
  }}
514
+ forwardRef={commentRef}
492
515
  multiline
493
516
  />
494
517
  {commentState?.loading && (
@@ -521,7 +544,7 @@ const CartUI = (props: any) => {
521
544
  />
522
545
  </View>
523
546
  )}
524
- {!isMultiCheckout && (
547
+ {(!isMultiCheckout || !cart?.business_id) && (
525
548
  <>
526
549
  {cart?.valid_products ? (
527
550
  <CheckoutAction>
@@ -538,7 +561,7 @@ const CartUI = (props: any) => {
538
561
  borderColor={theme.colors.primary}
539
562
  imgRightSrc={null}
540
563
  textStyle={{ color: '#fff', textAlign: 'center', flex: 1 }}
541
- onClick={() => setOpenUpselling(true)}
564
+ onClick={() => handleClickCheckout()}
542
565
  style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
543
566
  />
544
567
  </CheckoutAction>