ordering-ui-react-native 0.15.35 → 0.15.37-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 (187) hide show
  1. package/package.json +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +23 -3
  7. package/src/components/DriverTips/index.tsx +11 -6
  8. package/src/components/LanguageSelector/index.tsx +7 -2
  9. package/src/components/LoginForm/index.tsx +3 -1
  10. package/src/components/OrderDetails/index.tsx +2 -2
  11. package/src/components/PaymentOptions/index.tsx +9 -16
  12. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  13. package/src/components/SignupForm/index.tsx +3 -1
  14. package/src/components/SingleProductCard/index.tsx +16 -4
  15. package/src/components/StripeElementsForm/index.tsx +27 -48
  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/config.json +0 -2
  23. package/src/hooks/useCountdownTimer.tsx +26 -0
  24. package/src/navigators/CheckoutNavigator.tsx +6 -0
  25. package/src/navigators/HomeNavigator.tsx +12 -0
  26. package/src/pages/BusinessProductsList.tsx +1 -0
  27. package/src/pages/BusinessesListing.tsx +1 -1
  28. package/src/pages/Checkout.tsx +1 -1
  29. package/src/pages/MultiCheckout.tsx +31 -0
  30. package/src/pages/MultiOrdersDetails.tsx +27 -0
  31. package/src/pages/Sessions.tsx +22 -0
  32. package/src/types/index.tsx +5 -11
  33. package/src/utils/index.tsx +68 -1
  34. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  35. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  36. package/themes/business/src/components/Chat/index.tsx +38 -86
  37. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  38. package/themes/business/src/components/Home/index.tsx +128 -55
  39. package/themes/business/src/components/Home/styles.tsx +8 -1
  40. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  41. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  42. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  43. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  44. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  45. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  46. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  47. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  48. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  49. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  50. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  51. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  52. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  53. package/themes/business/src/components/shared/OModal.tsx +1 -1
  54. package/themes/business/src/types/index.tsx +5 -1
  55. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  57. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/kiosk/src/components/Cart/index.tsx +99 -25
  59. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  60. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  61. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  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/OrderDetails/index.tsx +165 -65
  65. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  66. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  67. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  68. package/themes/kiosk/src/components/ProductForm/index.tsx +2 -2
  69. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  70. package/themes/kiosk/src/types/index.d.ts +2 -0
  71. package/themes/original/index.tsx +190 -1
  72. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  73. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  74. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  75. package/themes/original/src/components/AddressList/index.tsx +56 -18
  76. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  77. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  78. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  79. package/themes/original/src/components/BusinessController/index.tsx +56 -16
  80. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  81. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  82. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  83. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -3
  84. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  85. package/themes/original/src/components/BusinessListingSearch/index.tsx +200 -58
  86. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  87. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  88. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  89. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  90. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  91. package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
  92. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  93. package/themes/original/src/components/BusinessProductsListing/index.tsx +125 -21
  94. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  95. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  96. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  97. package/themes/original/src/components/BusinessesListing/index.tsx +143 -81
  98. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  99. package/themes/original/src/components/Cart/index.tsx +60 -43
  100. package/themes/original/src/components/CartContent/index.tsx +2 -2
  101. package/themes/original/src/components/Checkout/index.tsx +59 -48
  102. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  103. package/themes/original/src/components/Favorite/index.tsx +91 -0
  104. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  105. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  106. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  107. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  108. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  109. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  110. package/themes/original/src/components/Help/index.tsx +21 -4
  111. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  112. package/themes/original/src/components/Home/index.tsx +1 -1
  113. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  114. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  115. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  116. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  117. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  118. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  119. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  120. package/themes/original/src/components/Messages/index.tsx +6 -1
  121. package/themes/original/src/components/Messages/styles.tsx +1 -3
  122. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  123. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  124. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  125. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  126. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  127. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  128. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  129. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  130. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  131. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  132. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  133. package/themes/original/src/components/OrderDetails/index.tsx +56 -33
  134. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  135. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  136. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  137. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  138. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  139. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  140. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  141. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  142. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  143. package/themes/original/src/components/OrdersOption/index.tsx +133 -41
  144. package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
  145. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  146. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  147. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  148. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  149. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  150. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  151. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  152. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  153. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  154. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  155. package/themes/original/src/components/Promotions/index.tsx +250 -0
  156. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  157. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  158. package/themes/original/src/components/Sessions/index.tsx +160 -0
  159. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  160. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  161. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  162. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  163. package/themes/original/src/components/SingleProductCard/index.tsx +95 -32
  164. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  165. package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
  166. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  167. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  168. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  169. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  170. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  171. package/themes/original/src/components/UserProfile/index.tsx +62 -8
  172. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  173. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  174. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  175. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  176. package/themes/original/src/components/Wallets/index.tsx +76 -9
  177. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  178. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  179. package/themes/original/src/components/shared/OModal.tsx +4 -2
  180. package/themes/original/src/components/shared/index.tsx +2 -0
  181. package/themes/original/src/config/constants.tsx +6 -6
  182. package/themes/original/src/types/index.tsx +132 -9
  183. package/themes/original/src/utils/index.tsx +28 -2
  184. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  185. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  186. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  187. 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,56 +296,72 @@ 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>
302
+ {isPreOrderSetting && (
303
+ <WrapMomentOption
304
+ onPress={() => handleMomentClick()}>
305
+ <OText
306
+ size={12}
307
+ numberOfLines={1}
308
+ ellipsizeMode="tail"
309
+ color={theme.colors.textSecondary}>
310
+ {orderState.options?.moment
311
+ ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
312
+ : t('ASAP_ABBREVIATION', 'ASAP')}
313
+ </OText>
314
+ {isPreorderEnabled && (
315
+ <OIcon
316
+ src={theme.images.general.arrow_down}
317
+ width={10}
318
+ style={{ marginStart: 8 }}
319
+ />
320
+ )}
321
+ </WrapMomentOption>
322
+ )}
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>
263
325
  <OIcon
264
326
  src={theme.images.general.arrow_down}
265
327
  width={10}
266
328
  style={{ marginStart: 8 }}
267
329
  />
268
330
  </WrapMomentOption>
269
- <WrapMomentOption
270
- onPress={() => handleMomentClick()}>
271
- <OText
272
- size={12}
273
- numberOfLines={1}
274
- ellipsizeMode="tail"
275
- color={theme.colors.textSecondary}>
276
- {orderState.options?.momentß
277
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
278
- : t('ASAP_ABBREVIATION', 'ASAP')}
279
- </OText>
280
- {isPreorderEnabled && (
281
- <OIcon
282
- src={theme.images.general.arrow_down}
283
- width={10}
284
- style={{ marginStart: 8 }}
285
- />
286
- )}
287
- </WrapMomentOption>
288
-
289
- {!businessId && (
290
- <SearchBar
291
- onSearch={handleChangeSearch}
292
- searchValue={searchValue}
293
- lazyLoad
294
- isCancelXButtonShow={!!searchValue}
295
- borderStyle={styles.borderStyle}
296
- onCancel={() => handleChangeSearch('')}
297
- placeholder={t('SEARCH', 'Search')}
298
- height={26}
299
- isDisabled={configs?.advanced_business_search_enabled?.value === '1' || !businessTypes}
300
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
301
- onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
302
- />
303
- )}
304
-
305
331
  </View>
306
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
+ )}
307
344
  </HeaderWrapper>
308
-
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
+ )}
309
365
  <OrderProgressWrapper>
310
366
  <OrderProgress
311
367
  {...props}
@@ -316,7 +372,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
316
372
  {
317
373
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
318
374
  <FeaturedWrapper>
319
- <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>
320
376
  <ScrollView
321
377
  showsHorizontalScrollIndicator={false}
322
378
  nestedScrollEnabled
@@ -324,7 +380,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
324
380
  {featuredBusiness.map((bAry: any, idx) => (
325
381
  <View key={'f-listing_' + idx}>
326
382
  <BusinessFeaturedController
327
- key={bAry[0].id}
328
383
  business={bAry[0]}
329
384
  isBusinessOpen={bAry[0]?.open}
330
385
  handleCustomClick={handleBusinessClick}
@@ -332,7 +387,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
332
387
  />
333
388
  {bAry.length > 1 && (
334
389
  <BusinessFeaturedController
335
- key={bAry[1].id}
336
390
  business={bAry[1]}
337
391
  isBusinessOpen={bAry[1]?.open}
338
392
  handleCustomClick={handleBusinessClick}
@@ -348,7 +402,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
348
402
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
349
403
  {
350
404
  !businessId && !props.franchiseId && (
351
- <HighestRatedBusinesses onBusinessClick={handleBusinessClick} navigation={navigation} />
405
+ <HighestRatedBusinesses
406
+ onBusinessClick={handleBusinessClick}
407
+ navigation={navigation}
408
+ favoriteIds={favoriteIds}
409
+ setFavoriteIds={setFavoriteIds}
410
+ />
352
411
  )
353
412
  }
354
413
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
@@ -371,9 +430,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
371
430
  />
372
431
  )}
373
432
  {businessesList.businesses?.map(
374
- (business: any) => (
433
+ (business: any, i: number) => (
375
434
  <BusinessController
376
- key={business.id}
435
+ key={`${business.id}_` + i}
377
436
  business={business}
378
437
  isBusinessOpen={business.open}
379
438
  handleCustomClick={handleBusinessClick}
@@ -387,6 +446,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
387
446
  businessDeliveryTime={business?.delivery_time}
388
447
  businessPickupTime={business?.pickup_time}
389
448
  businessDistance={business?.distance}
449
+ handleUpdateBusinessList={handleUpdateBusinessList}
450
+ favoriteIds={favoriteIds}
451
+ setFavoriteIds={setFavoriteIds}
390
452
  />
391
453
  )
392
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 && (