ordering-ui-react-native 0.15.39 → 0.15.40-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 (197) hide show
  1. package/package.json +8 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +8 -2
  5. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +23 -2
  8. package/src/components/DriverTips/index.tsx +11 -6
  9. package/src/components/LanguageSelector/index.tsx +7 -2
  10. package/src/components/LoginForm/index.tsx +3 -1
  11. package/src/components/OrderDetails/index.tsx +2 -2
  12. package/src/components/PaymentOptions/index.tsx +1 -1
  13. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  14. package/src/components/SignupForm/index.tsx +3 -1
  15. package/src/components/SingleProductCard/index.tsx +16 -4
  16. package/src/components/StripeMethodForm/index.tsx +1 -2
  17. package/src/components/UpsellingProducts/index.tsx +1 -1
  18. package/src/components/UserProfileForm/index.tsx +63 -6
  19. package/src/components/UserProfileForm/styles.tsx +8 -0
  20. package/src/components/VerifyPhone/styles.tsx +1 -2
  21. package/src/components/shared/OModal.tsx +1 -1
  22. package/src/hooks/useCountdownTimer.tsx +26 -0
  23. package/src/navigators/CheckoutNavigator.tsx +6 -0
  24. package/src/navigators/HomeNavigator.tsx +12 -0
  25. package/src/pages/BusinessProductsList.tsx +1 -0
  26. package/src/pages/BusinessesListing.tsx +1 -1
  27. package/src/pages/MultiCheckout.tsx +31 -0
  28. package/src/pages/MultiOrdersDetails.tsx +27 -0
  29. package/src/pages/Sessions.tsx +22 -0
  30. package/src/theme.json +0 -1
  31. package/src/types/index.tsx +5 -2
  32. package/src/utils/index.tsx +68 -1
  33. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  34. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  35. package/themes/business/src/components/Chat/index.tsx +38 -86
  36. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  37. package/themes/business/src/components/Home/index.tsx +128 -55
  38. package/themes/business/src/components/Home/styles.tsx +8 -1
  39. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  40. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  41. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  42. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  43. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  44. package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -18
  45. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  46. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  47. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  48. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  49. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  50. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  51. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  52. package/themes/business/src/components/shared/OModal.tsx +1 -1
  53. package/themes/business/src/types/index.tsx +5 -1
  54. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  56. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  58. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  59. package/themes/kiosk/src/components/Cart/index.tsx +99 -26
  60. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  61. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  62. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  63. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  64. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  65. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  66. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  67. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  68. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  69. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  70. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  71. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  72. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  73. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  74. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +8 -9
  76. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  77. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  78. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  79. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  80. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  81. package/themes/kiosk/src/types/index.d.ts +3 -0
  82. package/themes/original/index.tsx +180 -1
  83. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  84. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  85. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  86. package/themes/original/src/components/AddressList/index.tsx +56 -18
  87. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  88. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  89. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  90. package/themes/original/src/components/BusinessController/index.tsx +51 -16
  91. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  92. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  93. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  94. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  95. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  96. package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
  97. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  98. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -2
  99. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  100. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  101. package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
  102. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  103. package/themes/original/src/components/BusinessProductsListing/index.tsx +116 -26
  104. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  105. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  106. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  107. package/themes/original/src/components/BusinessesListing/index.tsx +127 -67
  108. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  109. package/themes/original/src/components/Cart/index.tsx +60 -43
  110. package/themes/original/src/components/CartContent/index.tsx +2 -2
  111. package/themes/original/src/components/Checkout/index.tsx +50 -33
  112. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  113. package/themes/original/src/components/Favorite/index.tsx +91 -0
  114. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  115. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  116. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  117. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  118. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  119. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  120. package/themes/original/src/components/Help/index.tsx +21 -4
  121. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  122. package/themes/original/src/components/Home/index.tsx +1 -1
  123. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  124. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  125. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  126. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  127. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  128. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  129. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  130. package/themes/original/src/components/Messages/index.tsx +6 -1
  131. package/themes/original/src/components/Messages/styles.tsx +1 -3
  132. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  133. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  134. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  135. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  136. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  137. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  138. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  140. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  141. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  142. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  143. package/themes/original/src/components/OrderDetails/index.tsx +55 -37
  144. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  145. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  146. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  147. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  149. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  150. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  152. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  153. package/themes/original/src/components/OrdersOption/index.tsx +133 -41
  154. package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
  155. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  156. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  157. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  158. package/themes/original/src/components/PaymentOptions/index.tsx +19 -15
  159. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  160. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  161. package/themes/original/src/components/ProductForm/index.tsx +74 -66
  162. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  163. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  164. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  165. package/themes/original/src/components/Promotions/index.tsx +250 -0
  166. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  167. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  168. package/themes/original/src/components/Sessions/index.tsx +160 -0
  169. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  170. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  171. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  172. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  173. package/themes/original/src/components/SingleProductCard/index.tsx +95 -32
  174. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  175. package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
  176. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  177. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  178. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  179. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  180. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  181. package/themes/original/src/components/UserProfile/index.tsx +62 -8
  182. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  183. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  184. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  185. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  186. package/themes/original/src/components/Wallets/index.tsx +76 -9
  187. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  188. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  189. package/themes/original/src/components/shared/OModal.tsx +4 -2
  190. package/themes/original/src/components/shared/index.tsx +2 -0
  191. package/themes/original/src/config/constants.tsx +6 -6
  192. package/themes/original/src/types/index.tsx +132 -9
  193. package/themes/original/src/utils/index.tsx +28 -2
  194. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  195. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  196. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  197. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,6 +1,7 @@
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 { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
4
5
  import {
5
6
  View,
6
7
  StyleSheet,
@@ -30,7 +31,8 @@ import {
30
31
  ListWrapper,
31
32
  FeaturedWrapper,
32
33
  OrderProgressWrapper,
33
- FarAwayMessage
34
+ FarAwayMessage,
35
+ AddressInputContainer
34
36
  } from './styles';
35
37
 
36
38
  import { SearchBar } from '../SearchBar';
@@ -47,7 +49,7 @@ import { getTypesText, convertToRadian } from '../../utils';
47
49
  import { OrderProgress } from '../OrderProgress';
48
50
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
49
51
 
50
- const PIXELS_TO_SCROLL = 1000;
52
+ const PIXELS_TO_SCROLL = 2000;
51
53
 
52
54
  const BusinessesListingUI = (props: BusinessesListingParams) => {
53
55
  const {
@@ -59,9 +61,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
59
61
  handleBusinessClick,
60
62
  paginationProps,
61
63
  handleChangeSearch,
62
- businessId
64
+ businessId,
65
+ isGuestUser,
66
+ handleUpdateBusinessList
63
67
  } = props;
64
-
65
68
  const theme = useTheme();
66
69
  const isFocused = useIsFocused();
67
70
  const appState = useRef(AppState.currentState)
@@ -82,7 +85,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
82
85
  wrapperOrderOptions: {
83
86
  width: '100%',
84
87
  flexDirection: 'row',
85
- justifyContent: 'space-between',
88
+ justifyContent: 'center',
86
89
  marginBottom: 10,
87
90
  zIndex: 100,
88
91
  },
@@ -92,7 +95,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
92
95
  borderRadius: 10,
93
96
  },
94
97
  searchInput: {
95
- fontSize: 12,
98
+ fontSize: 16,
99
+ backgroundColor: theme.colors.white,
100
+ paddingLeft: 10,
101
+ paddingTop: 7
96
102
  },
97
103
  iconStyle: {
98
104
  fontSize: 18,
@@ -102,6 +108,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
102
108
  farAwayMsg: {
103
109
  paddingVertical: 6,
104
110
  paddingHorizontal: 20
111
+ },
112
+ inputContainerStyles: {
113
+ backgroundColor: theme.colors.white,
114
+ borderColor: theme.colors.backgroundGray,
115
+ borderWidth: 1,
105
116
  }
106
117
  });
107
118
 
@@ -117,11 +128,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
117
128
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
118
129
  const [isFarAway, setIsFarAway] = useState(false)
119
130
  const [businessTypes, setBusinessTypes] = useState(null)
120
-
131
+ const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
121
132
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
122
133
  Number(configs?.max_days_preorder?.value) > 0
123
134
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
124
135
  const timerId = useRef<any>(false)
136
+ const [favoriteIds, setFavoriteIds] = useState<any>([])
137
+
125
138
  // const panResponder = useRef(
126
139
  // PanResponder.create({
127
140
  // onMoveShouldSetPanResponder: (e, gestureState) => {
@@ -191,19 +204,35 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
191
204
  }
192
205
  }
193
206
 
207
+ const checkUserLocation = async () => {
208
+ let trackingStatus = await getTrackingStatus()
209
+ if (trackingStatus === 'not-determined') {
210
+ trackingStatus = await requestTrackingPermission()
211
+ }
212
+ if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
213
+ Geolocation.getCurrentPosition((pos) => {
214
+ const crd = pos.coords
215
+ const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
216
+ if (distance > 20) setIsFarAway(true)
217
+ else setIsFarAway(false)
218
+ }, (err) => {
219
+ console.log(`ERROR(${err.code}): ${err.message}`)
220
+ }, {
221
+ enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
222
+ })
223
+ }
224
+ }
225
+
194
226
  useEffect(() => {
195
- Geolocation.getCurrentPosition((pos) => {
196
- const crd = pos.coords
197
- const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
198
- if (distance > 20) setIsFarAway(true)
199
- else setIsFarAway(false)
200
- }, (err) => {
201
- console.log(`ERROR(${err.code}): ${err.message}`)
202
- }, {
203
- enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
204
- })
227
+ checkUserLocation()
205
228
  }, [orderState?.options?.address?.location])
206
229
 
230
+ useEffect(() => {
231
+ if (!orderState?.loading) {
232
+ setOrderTypeValue(orderState?.options?.type)
233
+ }
234
+ }, [orderState?.options?.type])
235
+
207
236
  useFocusEffect(
208
237
  useCallback(() => {
209
238
  resetInactivityTimeout()
@@ -211,6 +240,17 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
211
240
  }, [navigation])
212
241
  )
213
242
 
243
+ useEffect(() => {
244
+ if (!businessesList?.businesses?.length) return
245
+ const ids = [...favoriteIds]
246
+ businessesList.businesses.forEach((business: any) => {
247
+ if (business?.favorite) {
248
+ ids.push(business?.id)
249
+ }
250
+ })
251
+ setFavoriteIds([...new Set(ids)])
252
+ }, [businessesList?.businesses?.length])
253
+
214
254
  return (
215
255
  <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
216
256
  refreshControl={
@@ -220,15 +260,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
220
260
  />
221
261
  }
222
262
  >
223
- <HeaderWrapper
224
- source={theme.images.backgrounds.business_list_header}
225
- style={{ paddingTop: top + 20 }}>
226
- {!auth && (
227
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
228
- <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
229
- </TouchableOpacity>
230
- )}
231
-
263
+ <View style={{ height: isFarAway ? 150 : 100, marginTop: Platform.OS == 'ios' ? 0 : 50 }}>
232
264
  <Search>
233
265
  <AddressInput
234
266
  onPress={() =>
@@ -237,17 +269,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
237
269
  : navigation.navigate('AddressForm', {
238
270
  address: orderState.options?.address,
239
271
  isFromBusinesses: true,
272
+ isGuestUser: isGuestUser
240
273
  })
241
274
  }>
242
- <OIcon
243
- src={theme.images.general.pin}
244
- color={theme.colors.disabled}
245
- width={16}
246
- style={{ marginRight: 10 }}
247
- />
248
- <OText size={12} numberOfLines={1} style={{ width: '90%' }}>
249
- {orderState?.options?.address?.address}
250
- </OText>
275
+ <AddressInputContainer>
276
+ <OIcon
277
+ src={theme.images.general.pin}
278
+ color={theme.colors.disabled}
279
+ width={16}
280
+ style={{ marginRight: 10 }}
281
+ />
282
+ <OText size={12} numberOfLines={1}>
283
+ {orderState?.options?.address?.address}
284
+ </OText>
285
+ <OIcon
286
+ src={theme.images.general.arrow_down}
287
+ width={10}
288
+ style={{ marginStart: 8 }}
289
+ />
290
+ </AddressInputContainer>
251
291
  </AddressInput>
252
292
  </Search>
253
293
  {isFarAway && (
@@ -256,16 +296,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
256
296
  <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
257
297
  </FarAwayMessage>
258
298
  )}
299
+
259
300
  <OrderControlContainer>
260
301
  <View style={styles.wrapperOrderOptions}>
261
- <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
262
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderState?.options?.type || 1), 'Delivery')}</OText>
263
- <OIcon
264
- src={theme.images.general.arrow_down}
265
- width={10}
266
- style={{ marginStart: 8 }}
267
- />
268
- </WrapMomentOption>
269
302
  {isPreOrderSetting && (
270
303
  <WrapMomentOption
271
304
  onPress={() => handleMomentClick()}>
@@ -274,7 +307,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
274
307
  numberOfLines={1}
275
308
  ellipsizeMode="tail"
276
309
  color={theme.colors.textSecondary}>
277
- {orderState.options?.momentß
310
+ {orderState.options?.moment
278
311
  ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
279
312
  : t('ASAP_ABBREVIATION', 'ASAP')}
280
313
  </OText>
@@ -287,27 +320,48 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
287
320
  )}
288
321
  </WrapMomentOption>
289
322
  )}
290
-
291
- {!businessId && (
292
- <SearchBar
293
- onSearch={handleChangeSearch}
294
- searchValue={searchValue}
295
- lazyLoad
296
- isCancelXButtonShow={!!searchValue}
297
- borderStyle={styles.borderStyle}
298
- onCancel={() => handleChangeSearch('')}
299
- placeholder={t('SEARCH', 'Search')}
300
- height={26}
301
- isDisabled={configs?.advanced_business_search_enabled?.value === '1' || !businessTypes}
302
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
303
- onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
323
+ <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
324
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
325
+ <OIcon
326
+ src={theme.images.general.arrow_down}
327
+ width={10}
328
+ style={{ marginStart: 8 }}
304
329
  />
305
- )}
306
-
330
+ </WrapMomentOption>
307
331
  </View>
308
332
  </OrderControlContainer>
333
+ </View>
334
+ <HeaderWrapper
335
+ source={theme.images.backgrounds.business_list_header}
336
+ style={{ paddingTop: top + 20 }}
337
+ resizeMode='stretch'
338
+ >
339
+ {!auth && (
340
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
341
+ <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
342
+ </TouchableOpacity>
343
+ )}
309
344
  </HeaderWrapper>
310
-
345
+ {!businessId && (
346
+ <SearchBar
347
+ onSearch={handleChangeSearch}
348
+ searchValue={searchValue}
349
+ lazyLoad
350
+ hideIcon
351
+ isCancelXButtonShow={!!searchValue}
352
+ onCancel={() => handleChangeSearch('')}
353
+ placeholder={t('SEARCH', 'Search')}
354
+ height={50}
355
+ isDisabled={!businessTypes}
356
+ inputContainerStyles={styles.inputContainerStyles}
357
+ containerStyles={{
358
+ marginHorizontal: 40,
359
+ marginTop: 20
360
+ }}
361
+ inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
362
+ onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
363
+ />
364
+ )}
311
365
  <OrderProgressWrapper>
312
366
  <OrderProgress
313
367
  {...props}
@@ -318,7 +372,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
318
372
  {
319
373
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
320
374
  <FeaturedWrapper>
321
- <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
375
+ <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
322
376
  <ScrollView
323
377
  showsHorizontalScrollIndicator={false}
324
378
  nestedScrollEnabled
@@ -326,7 +380,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
326
380
  {featuredBusiness.map((bAry: any, idx) => (
327
381
  <View key={'f-listing_' + idx}>
328
382
  <BusinessFeaturedController
329
- key={bAry[0].id}
330
383
  business={bAry[0]}
331
384
  isBusinessOpen={bAry[0]?.open}
332
385
  handleCustomClick={handleBusinessClick}
@@ -334,7 +387,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
334
387
  />
335
388
  {bAry.length > 1 && (
336
389
  <BusinessFeaturedController
337
- key={bAry[1].id}
338
390
  business={bAry[1]}
339
391
  isBusinessOpen={bAry[1]?.open}
340
392
  handleCustomClick={handleBusinessClick}
@@ -350,7 +402,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
350
402
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
351
403
  {
352
404
  !businessId && !props.franchiseId && (
353
- <HighestRatedBusinesses onBusinessClick={handleBusinessClick} navigation={navigation} />
405
+ <HighestRatedBusinesses
406
+ onBusinessClick={handleBusinessClick}
407
+ navigation={navigation}
408
+ favoriteIds={favoriteIds}
409
+ setFavoriteIds={setFavoriteIds}
410
+ />
354
411
  )
355
412
  }
356
413
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
@@ -373,9 +430,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
373
430
  />
374
431
  )}
375
432
  {businessesList.businesses?.map(
376
- (business: any) => (
433
+ (business: any, i: number) => (
377
434
  <BusinessController
378
- key={business.id}
435
+ key={`${business.id}_` + i}
379
436
  business={business}
380
437
  isBusinessOpen={business.open}
381
438
  handleCustomClick={handleBusinessClick}
@@ -389,6 +446,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
389
446
  businessDeliveryTime={business?.delivery_time}
390
447
  businessPickupTime={business?.pickup_time}
391
448
  businessDistance={business?.distance}
449
+ handleUpdateBusinessList={handleUpdateBusinessList}
450
+ favoriteIds={favoriteIds}
451
+ setFavoriteIds={setFavoriteIds}
392
452
  />
393
453
  )
394
454
  )}
@@ -15,6 +15,7 @@ export const Search = styled.View`
15
15
  justify-content: flex-end;
16
16
  align-items: center;
17
17
  margin-vertical: 10px;
18
+ margin-horizontal: 20px;
18
19
  `
19
20
 
20
21
  export const AddressInput = styled.TouchableOpacity`
@@ -39,7 +40,7 @@ export const OrderControlContainer = styled.View`
39
40
  `
40
41
 
41
42
  export const WrapMomentOption = styled.TouchableOpacity`
42
- background-color: ${(props: any) => props.theme.colors.backgroundGray100};
43
+ background-color: ${(props: any) => props.theme.colors.white};
43
44
  border-radius: 7.6px;
44
45
  font-size: 12px;
45
46
  max-width: 240px;
@@ -53,7 +54,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
53
54
 
54
55
  export const HeaderWrapper = styled.ImageBackground`
55
56
  width: 100%;
56
- height: 370px;
57
+ height: 270px;
57
58
  padding: 20px 40px;
58
59
  background-color: transparent;
59
60
  `;
@@ -79,7 +80,14 @@ export const FarAwayMessage = styled.View`
79
80
  flex-direction: row;
80
81
  align-items: center;
81
82
  background-color: ${(props: any) => props.theme.colors.warning1};
82
- margin-bottom: 25px;
83
+ margin-bottom: 10px;
83
84
  border-radius: 7.6px;
84
85
  border: 1px solid ${(props: any) => props.theme.colors.warning5};
85
86
  `
87
+
88
+ export const AddressInputContainer = styled.View`
89
+ flex-direction: row;
90
+ width: 100%;
91
+ align-items: center;
92
+ justify-content: center
93
+ `
@@ -39,7 +39,8 @@ const CartUI = (props: any) => {
39
39
  handleChangeComment,
40
40
  commentState,
41
41
  onNavigationRedirect,
42
- handleRemoveOfferClick
42
+ handleRemoveOfferClick,
43
+ isMultiCheckout
43
44
  } = props
44
45
 
45
46
  const theme = useTheme();
@@ -59,6 +60,7 @@ const CartUI = (props: any) => {
59
60
 
60
61
  const isCartPending = cart?.status === 2
61
62
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
63
+ const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
62
64
 
63
65
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
64
66
  const businessId = business?.business_id ?? null
@@ -96,17 +98,23 @@ const CartUI = (props: any) => {
96
98
  const handleUpsellingPage = () => {
97
99
  setOpenUpselling(false)
98
100
  setCanOpenUpselling(false)
99
- props.onNavigationRedirect('CheckoutNavigator', {
100
- screen: 'CheckoutPage',
101
- cartUuid: cart?.uuid,
102
- businessLogo: cart?.business?.logo,
103
- businessName: cart?.business?.name,
104
- cartTotal: cart?.total
105
- })
101
+ if (isCheckoutMultiBusinessEnabled) {
102
+ props.onNavigationRedirect('CheckoutNavigator', {
103
+ screen: 'MultiCheckout'
104
+ })
105
+ } else {
106
+ props.onNavigationRedirect('CheckoutNavigator', {
107
+ screen: 'CheckoutPage',
108
+ cartUuid: cart?.uuid,
109
+ businessLogo: cart?.business?.logo,
110
+ businessName: cart?.business?.name,
111
+ cartTotal: cart?.total
112
+ })
113
+ }
106
114
  }
107
115
 
108
116
  const getIncludedTaxes = () => {
109
- if (cart?.taxes === null) {
117
+ if (cart?.taxes === null || !cart?.taxes) {
110
118
  return cart.business.tax_type === 1 ? cart?.tax : 0
111
119
  } else {
112
120
  return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
@@ -162,13 +170,14 @@ const CartUI = (props: any) => {
162
170
  handleClearProducts={handleClearProducts}
163
171
  handleCartOpen={handleCartOpen}
164
172
  onNavigationRedirect={props.onNavigationRedirect}
165
- handleChangeStore={props.isFranchiseApp ? () => setOpenChangeStore(true) : null}
173
+ handleChangeStore={() => setOpenChangeStore(true)}
166
174
  handleClickCheckout={() => setOpenUpselling(true)}
167
175
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
176
+ isMultiCheckout={isMultiCheckout}
168
177
  >
169
- {cart?.products?.length > 0 && cart?.products.map((product: any) => (
178
+ {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
170
179
  <ProductItemAccordion
171
- key={product.code}
180
+ key={`${product.code}_${i}`}
172
181
  isCartPending={isCartPending}
173
182
  isCartProduct
174
183
  product={product}
@@ -202,8 +211,8 @@ const CartUI = (props: any) => {
202
211
  </OSTable>
203
212
  )}
204
213
  {
205
- cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
206
- <OSTable key={offer.id}>
214
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
215
+ <OSTable key={`${offer.id}_${i}`}>
207
216
  <OSRow>
208
217
  <OText size={12} lineHeight={18}>{offer.name}</OText>
209
218
  {offer.rate_type === 1 && (
@@ -234,8 +243,8 @@ const CartUI = (props: any) => {
234
243
  </OSTable>
235
244
  )}
236
245
  {
237
- cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
238
- <OSTable key={tax.id}>
246
+ cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
247
+ <OSTable key={`${tax.id}_${i}`}>
239
248
  <OSRow>
240
249
  <OText size={12} lineHeight={18} numberOfLines={1} >
241
250
  {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
@@ -250,12 +259,12 @@ const CartUI = (props: any) => {
250
259
  ))
251
260
  }
252
261
  {
253
- cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
254
- <OSTable key={fee?.id}>
262
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
263
+ <OSTable key={`${fee.id}_${i}`}>
255
264
  <OSRow>
256
265
  <OText size={12} lineHeight={18} numberOfLines={1}>
257
266
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
258
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
267
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
259
268
  </OText>
260
269
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
261
270
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -293,8 +302,8 @@ const CartUI = (props: any) => {
293
302
  </OSTable>
294
303
  )}
295
304
  {
296
- cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
297
- <OSTable key={offer.id}>
305
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
306
+ <OSTable key={`${offer.id}_${i}`}>
298
307
  <OSRow>
299
308
  <OText size={12} lineHeight={18}>{offer.name}</OText>
300
309
  {offer.rate_type === 1 && (
@@ -409,30 +418,40 @@ const CartUI = (props: any) => {
409
418
  )}
410
419
  </OSBill>
411
420
  )}
412
- {cart?.valid_products && (
413
- <CheckoutAction>
414
- <OButton
415
- text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
416
- !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
417
- ) : !cart?.valid_address ? (
418
- `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
419
- ) : (
420
- `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
421
- )}
422
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
423
- isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
424
- borderColor={theme.colors.primary}
425
- imgRightSrc={null}
426
- textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
427
- onClick={() => setOpenUpselling(true)}
428
- style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
429
- />
430
- </CheckoutAction>
421
+ {!isMultiCheckout && (
422
+ <>
423
+ {cart?.valid_products ? (
424
+ <CheckoutAction>
425
+ <OButton
426
+ text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
427
+ !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
428
+ ) : !cart?.valid_address ? (
429
+ `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
430
+ ) : (
431
+ `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
432
+ )}
433
+ bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
434
+ isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
435
+ borderColor={theme.colors.primary}
436
+ imgRightSrc={null}
437
+ textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
438
+ onClick={() => setOpenUpselling(true)}
439
+ style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
440
+ />
441
+ </CheckoutAction>
442
+ ) : (
443
+ <View style={{ alignItems: 'center', width: '100%' }}>
444
+ <OText size={12} color={theme.colors.red} style={{ textAlign: 'center', marginTop: 5 }}>
445
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
446
+ </OText>
447
+ </View>
448
+ )}
449
+ </>
431
450
  )}
432
451
  </BusinessItemAccordion>
433
452
 
434
453
  <OModal
435
- open={openChangeStore && props.isFranchiseApp}
454
+ open={openChangeStore}
436
455
  entireModal
437
456
  customClose
438
457
  onClose={() => setOpenChangeStore(false)}
@@ -446,8 +465,6 @@ const CartUI = (props: any) => {
446
465
  open={openTaxModal.open}
447
466
  onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
448
467
  entireModal
449
- title={`${openTaxModal.data?.name ||
450
- t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
451
468
  >
452
469
  <TaxInformation
453
470
  type={openTaxModal.type}
@@ -22,9 +22,9 @@ export const CartContent = (props: any) => {
22
22
  <CCContainer>
23
23
  {isOrderStateCarts && carts?.length > 0 && (
24
24
  <>
25
- <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
25
+ {/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
26
26
  {carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
27
- </OText>
27
+ </OText> */}
28
28
  {carts.map((cart: any, i: number) => (
29
29
  <CCList key={i} style={{ overflow: 'visible' }}>
30
30
  {cart.products.length > 0 && (