ordering-ui-react-native 0.15.57 → 0.15.59-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 (186) hide show
  1. package/package.json +5 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +16 -8
  5. package/src/components/BusinessTypeFilter/index.tsx +3 -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 +120 -30
  11. package/src/components/LoginForm/styles.tsx +6 -0
  12. package/src/components/OrderDetails/index.tsx +7 -21
  13. package/src/components/PaymentOptions/index.tsx +67 -50
  14. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  15. package/src/components/ReviewDriver/index.tsx +1 -1
  16. package/src/components/ReviewOrder/index.tsx +2 -1
  17. package/src/components/ReviewProducts/index.tsx +11 -0
  18. package/src/components/SignupForm/index.tsx +145 -61
  19. package/src/components/SingleProductCard/index.tsx +16 -4
  20. package/src/components/SingleProductReview/index.tsx +1 -1
  21. package/src/components/StripeMethodForm/index.tsx +1 -2
  22. package/src/components/UpsellingProducts/index.tsx +1 -1
  23. package/src/components/UserProfileForm/index.tsx +63 -6
  24. package/src/components/UserProfileForm/styles.tsx +8 -0
  25. package/src/components/VerifyPhone/styles.tsx +1 -2
  26. package/src/components/shared/OModal.tsx +1 -1
  27. package/src/hooks/useCountdownTimer.tsx +26 -0
  28. package/src/navigators/CheckoutNavigator.tsx +6 -0
  29. package/src/navigators/HomeNavigator.tsx +12 -0
  30. package/src/pages/BusinessesListing.tsx +1 -1
  31. package/src/pages/MultiCheckout.tsx +31 -0
  32. package/src/pages/MultiOrdersDetails.tsx +27 -0
  33. package/src/pages/Sessions.tsx +22 -0
  34. package/src/theme.json +0 -1
  35. package/src/types/index.tsx +18 -11
  36. package/src/utils/index.tsx +68 -1
  37. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  38. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  39. package/themes/business/src/components/Chat/index.tsx +42 -90
  40. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  41. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  42. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  43. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  44. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  45. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  46. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  47. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +41 -7
  48. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  49. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  50. package/themes/business/src/components/OrdersOption/index.tsx +5 -2
  51. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  52. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  53. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  54. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  55. package/themes/business/src/components/shared/OModal.tsx +1 -1
  56. package/themes/business/src/types/index.tsx +6 -1
  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/BusinessMenu/index.tsx +39 -28
  61. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  62. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  63. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  64. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  65. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  66. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  67. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  68. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  69. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  70. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  71. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  72. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  73. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  74. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  75. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  76. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  77. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  78. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  79. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  80. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  81. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  82. package/themes/kiosk/src/types/index.d.ts +1 -0
  83. package/themes/original/index.tsx +22 -8
  84. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  85. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  86. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  87. package/themes/original/src/components/AddressList/index.tsx +30 -18
  88. package/themes/original/src/components/AppleLogin/index.tsx +9 -13
  89. package/themes/original/src/components/BusinessBasicInformation/index.tsx +136 -45
  90. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
  91. package/themes/original/src/components/BusinessController/index.tsx +48 -11
  92. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  93. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  94. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  95. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  96. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  97. package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
  98. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  99. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  100. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  101. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  102. package/themes/original/src/components/BusinessProductsList/index.tsx +51 -53
  103. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  104. package/themes/original/src/components/BusinessProductsListing/index.tsx +105 -22
  105. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  106. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  107. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  108. package/themes/original/src/components/BusinessesListing/index.tsx +126 -65
  109. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  110. package/themes/original/src/components/Cart/index.tsx +60 -41
  111. package/themes/original/src/components/Checkout/index.tsx +48 -32
  112. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  113. package/themes/original/src/components/Favorite/index.tsx +92 -0
  114. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  115. package/themes/original/src/components/FavoriteList/index.tsx +298 -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 +11 -11
  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/LastOrders/index.tsx +12 -1
  123. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  124. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  125. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  126. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  127. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  128. package/themes/original/src/components/Messages/index.tsx +1 -1
  129. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  130. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  133. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  134. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  135. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  136. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  137. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  138. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  139. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  140. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  141. package/themes/original/src/components/OrderDetails/index.tsx +135 -49
  142. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  143. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  146. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  147. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  148. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  149. package/themes/original/src/components/OrdersOption/index.tsx +130 -38
  150. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  151. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  152. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  153. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  154. package/themes/original/src/components/PaymentOptions/index.tsx +57 -36
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  156. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  157. package/themes/original/src/components/ProductForm/index.tsx +70 -62
  158. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  159. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  160. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  161. package/themes/original/src/components/Promotions/index.tsx +151 -133
  162. package/themes/original/src/components/Promotions/styles.tsx +3 -23
  163. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  164. package/themes/original/src/components/Sessions/index.tsx +160 -0
  165. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  166. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  167. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  168. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  169. package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
  170. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  171. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  172. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  173. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  174. package/themes/original/src/components/UserFormDetails/index.tsx +25 -26
  175. package/themes/original/src/components/UserProfile/index.tsx +52 -5
  176. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  177. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  178. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  179. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  180. package/themes/original/src/components/Wallets/index.tsx +76 -9
  181. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  182. package/themes/original/src/components/shared/OModal.tsx +4 -2
  183. package/themes/original/src/types/index.tsx +189 -35
  184. package/themes/original/src/utils/index.tsx +85 -2
  185. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  186. 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,7 +61,9 @@ 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
68
  const theme = useTheme();
65
69
  const isFocused = useIsFocused();
@@ -81,7 +85,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
81
85
  wrapperOrderOptions: {
82
86
  width: '100%',
83
87
  flexDirection: 'row',
84
- justifyContent: 'space-between',
88
+ justifyContent: 'center',
85
89
  marginBottom: 10,
86
90
  zIndex: 100,
87
91
  },
@@ -91,7 +95,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
91
95
  borderRadius: 10,
92
96
  },
93
97
  searchInput: {
94
- fontSize: 12,
98
+ fontSize: 16,
99
+ backgroundColor: theme.colors.white,
100
+ paddingLeft: 10,
101
+ paddingTop: 7
95
102
  },
96
103
  iconStyle: {
97
104
  fontSize: 18,
@@ -101,6 +108,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
101
108
  farAwayMsg: {
102
109
  paddingVertical: 6,
103
110
  paddingHorizontal: 20
111
+ },
112
+ inputContainerStyles: {
113
+ backgroundColor: theme.colors.white,
114
+ borderColor: theme.colors.backgroundGray,
115
+ borderWidth: 1,
104
116
  }
105
117
  });
106
118
 
@@ -116,11 +128,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
116
128
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
117
129
  const [isFarAway, setIsFarAway] = useState(false)
118
130
  const [businessTypes, setBusinessTypes] = useState(null)
119
-
131
+ const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
120
132
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
121
133
  Number(configs?.max_days_preorder?.value) > 0
122
134
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
123
135
  const timerId = useRef<any>(false)
136
+ const [favoriteIds, setFavoriteIds] = useState<any>([])
137
+
124
138
  // const panResponder = useRef(
125
139
  // PanResponder.create({
126
140
  // onMoveShouldSetPanResponder: (e, gestureState) => {
@@ -190,19 +204,35 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
190
204
  }
191
205
  }
192
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
+
193
226
  useEffect(() => {
194
- Geolocation.getCurrentPosition((pos) => {
195
- const crd = pos.coords
196
- const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
197
- if (distance > 20) setIsFarAway(true)
198
- else setIsFarAway(false)
199
- }, (err) => {
200
- console.log(`ERROR(${err.code}): ${err.message}`)
201
- }, {
202
- enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
203
- })
227
+ checkUserLocation()
204
228
  }, [orderState?.options?.address?.location])
205
229
 
230
+ useEffect(() => {
231
+ if (!orderState?.loading) {
232
+ setOrderTypeValue(orderState?.options?.type)
233
+ }
234
+ }, [orderState?.options?.type])
235
+
206
236
  useFocusEffect(
207
237
  useCallback(() => {
208
238
  resetInactivityTimeout()
@@ -210,6 +240,17 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
210
240
  }, [navigation])
211
241
  )
212
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
+
213
254
  return (
214
255
  <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
215
256
  refreshControl={
@@ -219,15 +260,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
219
260
  />
220
261
  }
221
262
  >
222
- <HeaderWrapper
223
- source={theme.images.backgrounds.business_list_header}
224
- style={{ paddingTop: top + 20 }}>
225
- {!auth && (
226
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
227
- <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
228
- </TouchableOpacity>
229
- )}
230
-
263
+ <View style={{ height: isFarAway ? 150 : 100, marginTop: Platform.OS == 'ios' ? 0 : 50 }}>
231
264
  <Search>
232
265
  <AddressInput
233
266
  onPress={() =>
@@ -236,17 +269,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
236
269
  : navigation.navigate('AddressForm', {
237
270
  address: orderState.options?.address,
238
271
  isFromBusinesses: true,
272
+ isGuestUser: isGuestUser
239
273
  })
240
274
  }>
241
- <OIcon
242
- src={theme.images.general.pin}
243
- color={theme.colors.disabled}
244
- width={16}
245
- style={{ marginRight: 10 }}
246
- />
247
- <OText size={12} numberOfLines={1} style={{ width: '90%' }}>
248
- {orderState?.options?.address?.address}
249
- </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>
250
291
  </AddressInput>
251
292
  </Search>
252
293
  {isFarAway && (
@@ -255,16 +296,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
255
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>
256
297
  </FarAwayMessage>
257
298
  )}
299
+
258
300
  <OrderControlContainer>
259
301
  <View style={styles.wrapperOrderOptions}>
260
- <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
261
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderState?.options?.type || 1), 'Delivery')}</OText>
262
- <OIcon
263
- src={theme.images.general.arrow_down}
264
- width={10}
265
- style={{ marginStart: 8 }}
266
- />
267
- </WrapMomentOption>
268
302
  {isPreOrderSetting && (
269
303
  <WrapMomentOption
270
304
  onPress={() => handleMomentClick()}>
@@ -273,7 +307,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
273
307
  numberOfLines={1}
274
308
  ellipsizeMode="tail"
275
309
  color={theme.colors.textSecondary}>
276
- {orderState.options?.momentß
310
+ {orderState.options?.moment
277
311
  ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
278
312
  : t('ASAP_ABBREVIATION', 'ASAP')}
279
313
  </OText>
@@ -286,27 +320,48 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
286
320
  )}
287
321
  </WrapMomentOption>
288
322
  )}
289
-
290
- {!businessId && (
291
- <SearchBar
292
- onSearch={handleChangeSearch}
293
- searchValue={searchValue}
294
- lazyLoad
295
- isCancelXButtonShow={!!searchValue}
296
- borderStyle={styles.borderStyle}
297
- onCancel={() => handleChangeSearch('')}
298
- placeholder={t('SEARCH', 'Search')}
299
- height={26}
300
- isDisabled={configs?.advanced_business_search_enabled?.value === '1' || !businessTypes}
301
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
302
- 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 }}
303
329
  />
304
- )}
305
-
330
+ </WrapMomentOption>
306
331
  </View>
307
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
+ )}
308
344
  </HeaderWrapper>
309
-
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
+ )}
310
365
  <OrderProgressWrapper>
311
366
  <OrderProgress
312
367
  {...props}
@@ -325,7 +380,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
325
380
  {featuredBusiness.map((bAry: any, idx) => (
326
381
  <View key={'f-listing_' + idx}>
327
382
  <BusinessFeaturedController
328
- key={bAry[0].id}
329
383
  business={bAry[0]}
330
384
  isBusinessOpen={bAry[0]?.open}
331
385
  handleCustomClick={handleBusinessClick}
@@ -333,7 +387,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
333
387
  />
334
388
  {bAry.length > 1 && (
335
389
  <BusinessFeaturedController
336
- key={bAry[1].id}
337
390
  business={bAry[1]}
338
391
  isBusinessOpen={bAry[1]?.open}
339
392
  handleCustomClick={handleBusinessClick}
@@ -349,7 +402,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
349
402
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
350
403
  {
351
404
  !businessId && !props.franchiseId && (
352
- <HighestRatedBusinesses onBusinessClick={handleBusinessClick} navigation={navigation} />
405
+ <HighestRatedBusinesses
406
+ onBusinessClick={handleBusinessClick}
407
+ navigation={navigation}
408
+ favoriteIds={favoriteIds}
409
+ setFavoriteIds={setFavoriteIds}
410
+ />
353
411
  )
354
412
  }
355
413
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
@@ -372,9 +430,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
372
430
  />
373
431
  )}
374
432
  {businessesList.businesses?.map(
375
- (business: any) => (
433
+ (business: any, i: number) => (
376
434
  <BusinessController
377
- key={business.id}
435
+ key={`${business.id}_` + i}
378
436
  business={business}
379
437
  isBusinessOpen={business.open}
380
438
  handleCustomClick={handleBusinessClick}
@@ -388,6 +446,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
388
446
  businessDeliveryTime={business?.delivery_time}
389
447
  businessPickupTime={business?.pickup_time}
390
448
  businessDistance={business?.distance}
449
+ handleUpdateBusinessList={handleUpdateBusinessList}
450
+ favoriteIds={favoriteIds}
451
+ setFavoriteIds={setFavoriteIds}
391
452
  />
392
453
  )
393
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)}