ordering-ui-react-native 0.15.33 → 0.15.34-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 (169) 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/UpsellingProducts/index.tsx +1 -1
  17. package/src/components/UserProfileForm/index.tsx +63 -6
  18. package/src/components/UserProfileForm/styles.tsx +8 -0
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OModal.tsx +1 -1
  21. package/src/config.json +0 -2
  22. package/src/hooks/useCountdownTimer.tsx +26 -0
  23. package/src/navigators/HomeNavigator.tsx +6 -0
  24. package/src/pages/BusinessProductsList.tsx +1 -0
  25. package/src/pages/BusinessesListing.tsx +1 -1
  26. package/src/pages/Checkout.tsx +1 -1
  27. package/src/pages/Sessions.tsx +22 -0
  28. package/src/types/index.tsx +5 -11
  29. package/src/utils/index.tsx +68 -1
  30. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  31. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  32. package/themes/business/src/components/Chat/index.tsx +38 -86
  33. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  34. package/themes/business/src/components/Home/index.tsx +128 -55
  35. package/themes/business/src/components/Home/styles.tsx +8 -1
  36. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  37. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  38. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  39. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  40. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  41. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  42. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  43. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  44. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  45. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  46. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  47. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  48. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  49. package/themes/business/src/components/shared/OModal.tsx +1 -1
  50. package/themes/business/src/types/index.tsx +5 -1
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Cart/index.tsx +99 -25
  55. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  56. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  57. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  58. package/themes/kiosk/src/components/Intro/index.tsx +12 -12
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  62. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  63. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  64. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  65. package/themes/kiosk/src/components/ProductForm/index.tsx +2 -2
  66. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/kiosk/src/types/index.d.ts +2 -0
  69. package/themes/original/index.tsx +184 -1
  70. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  71. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  72. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  73. package/themes/original/src/components/AddressList/index.tsx +56 -18
  74. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +56 -16
  78. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +125 -7
  82. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  83. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  84. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  85. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  86. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
  88. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +111 -14
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  91. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  92. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  93. package/themes/original/src/components/BusinessesListing/index.tsx +85 -45
  94. package/themes/original/src/components/Cart/index.tsx +21 -17
  95. package/themes/original/src/components/CartContent/index.tsx +2 -2
  96. package/themes/original/src/components/Checkout/index.tsx +59 -48
  97. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  98. package/themes/original/src/components/Favorite/index.tsx +91 -0
  99. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  100. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  101. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  102. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  103. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  104. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  105. package/themes/original/src/components/Help/index.tsx +21 -4
  106. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  107. package/themes/original/src/components/Home/index.tsx +1 -1
  108. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  109. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  110. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  111. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  112. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  113. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  114. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  115. package/themes/original/src/components/Messages/index.tsx +6 -1
  116. package/themes/original/src/components/Messages/styles.tsx +1 -3
  117. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  118. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  119. package/themes/original/src/components/OrderDetails/index.tsx +56 -33
  120. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  121. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  122. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  123. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  124. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  125. package/themes/original/src/components/OrdersOption/index.tsx +57 -56
  126. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  127. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  128. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  129. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  130. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  131. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  132. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  133. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  134. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  135. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  136. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  137. package/themes/original/src/components/Promotions/index.tsx +250 -0
  138. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  139. package/themes/original/src/components/SearchBar/index.tsx +4 -1
  140. package/themes/original/src/components/Sessions/index.tsx +160 -0
  141. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  142. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  143. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  144. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  145. package/themes/original/src/components/SingleProductCard/index.tsx +82 -30
  146. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  147. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
  148. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  149. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  150. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  151. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  152. package/themes/original/src/components/UserProfile/index.tsx +62 -8
  153. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  154. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  155. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  156. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  157. package/themes/original/src/components/Wallets/index.tsx +76 -9
  158. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  159. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  160. package/themes/original/src/components/shared/OModal.tsx +4 -2
  161. package/themes/original/src/components/shared/index.tsx +2 -0
  162. package/themes/original/src/config/constants.tsx +6 -6
  163. package/themes/original/src/types/index.tsx +107 -9
  164. package/themes/original/src/utils/index.tsx +28 -2
  165. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  166. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  167. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  168. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  169. package/src/components/StripeMethodForm/index.tsx +0 -174
@@ -90,33 +90,12 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
90
90
  </View>
91
91
  );
92
92
 
93
- const ReviewItem = ({ comment, created_at, total, customer }: any) => (
93
+ const ReviewItem = ({ comment, created_at, total }: any) => (
94
94
  <View style={{ marginBottom: 30 }}>
95
- <View
96
- style={{ flexDirection: 'row', marginBottom: 19, alignItems: 'center' }}>
97
- <OIcon
98
- url={theme.images.dummies.customerPhoto}
99
- width={38}
100
- height={38}
101
- style={{
102
- borderRadius: 7.6,
103
- borderWidth: 1,
104
- borderColor: theme.colors.border,
105
- marginEnd: 9,
106
- }}
107
- />
108
- <View>
109
- <OText size={12} color={theme.colors.textNormal} weight={'500'}>
110
- {customer?.name || 'Jane Cooper'}
111
- </OText>
112
- <OText size={10} color={theme.colors.textSecondary}>
113
- {moment(created_at).format('MMMM d, yyyy • hh:mm')}
114
- </OText>
115
- </View>
116
- </View>
117
- <OText size={10} color={theme.colors.textNormal}>
118
- {comment}
95
+ <OText size={12} color={theme.colors.textSecondary}>
96
+ {moment(created_at).format('MMMM d, yyyy hh:mm')}
119
97
  </OText>
98
+ <OText size={12} color={theme.colors.textNormal}>{comment}</OText>
120
99
  </View>
121
100
  );
122
101
 
@@ -45,7 +45,6 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
45
45
  const renderTypes = ({ item }: any) => {
46
46
  return (
47
47
  <TouchableOpacity
48
- key={item.id}
49
48
  onPress={() => handleChangeBusinessType(item.id)}
50
49
  style={{
51
50
  height: 34,
@@ -103,7 +102,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
103
102
  showsHorizontalScrollIndicator={false}
104
103
  data={typesState?.types}
105
104
  renderItem={renderTypes}
106
- keyExtractor={(type) => type.name}
105
+ keyExtractor={(type, index) => `${type.name}_${index}`}
107
106
  />
108
107
  <TouchableOpacity
109
108
  style={{ marginLeft: 15 }}
@@ -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,
@@ -47,7 +48,7 @@ import { getTypesText, convertToRadian } from '../../utils';
47
48
  import { OrderProgress } from '../OrderProgress';
48
49
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
49
50
 
50
- const PIXELS_TO_SCROLL = 1000;
51
+ const PIXELS_TO_SCROLL = 2000;
51
52
 
52
53
  const BusinessesListingUI = (props: BusinessesListingParams) => {
53
54
  const {
@@ -59,9 +60,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
59
60
  handleBusinessClick,
60
61
  paginationProps,
61
62
  handleChangeSearch,
62
- businessId
63
+ businessId,
64
+ isGuestUser,
65
+ handleUpdateBusinessList
63
66
  } = props;
64
-
65
67
  const theme = useTheme();
66
68
  const isFocused = useIsFocused();
67
69
  const appState = useRef(AppState.currentState)
@@ -117,11 +119,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
117
119
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
118
120
  const [isFarAway, setIsFarAway] = useState(false)
119
121
  const [businessTypes, setBusinessTypes] = useState(null)
120
-
122
+ const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
121
123
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
122
124
  Number(configs?.max_days_preorder?.value) > 0
123
-
125
+ const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
124
126
  const timerId = useRef<any>(false)
127
+ const [favoriteIds, setFavoriteIds] = useState<any>([])
128
+
125
129
  // const panResponder = useRef(
126
130
  // PanResponder.create({
127
131
  // onMoveShouldSetPanResponder: (e, gestureState) => {
@@ -191,19 +195,35 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
191
195
  }
192
196
  }
193
197
 
198
+ const checkUserLocation = async () => {
199
+ let trackingStatus = await getTrackingStatus()
200
+ if (trackingStatus === 'not-determined') {
201
+ trackingStatus = await requestTrackingPermission()
202
+ }
203
+ if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
204
+ Geolocation.getCurrentPosition((pos) => {
205
+ const crd = pos.coords
206
+ const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
207
+ if (distance > 20) setIsFarAway(true)
208
+ else setIsFarAway(false)
209
+ }, (err) => {
210
+ console.log(`ERROR(${err.code}): ${err.message}`)
211
+ }, {
212
+ enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
213
+ })
214
+ }
215
+ }
216
+
194
217
  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
- })
218
+ checkUserLocation()
205
219
  }, [orderState?.options?.address?.location])
206
220
 
221
+ useEffect(() => {
222
+ if(!orderState?.loading){
223
+ setOrderTypeValue(orderState?.options?.type)
224
+ }
225
+ }, [orderState?.options?.type])
226
+
207
227
  useFocusEffect(
208
228
  useCallback(() => {
209
229
  resetInactivityTimeout()
@@ -211,6 +231,17 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
211
231
  }, [navigation])
212
232
  )
213
233
 
234
+ useEffect(() => {
235
+ if (!businessesList?.businesses?.length) return
236
+ const ids = [...favoriteIds]
237
+ businessesList.businesses.forEach((business: any) => {
238
+ if (business?.favorite) {
239
+ ids.push(business?.id)
240
+ }
241
+ })
242
+ setFavoriteIds([...new Set(ids)])
243
+ }, [businessesList?.businesses?.length])
244
+
214
245
  return (
215
246
  <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
216
247
  refreshControl={
@@ -221,7 +252,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
221
252
  }
222
253
  >
223
254
  <HeaderWrapper
224
- source={theme.images.backgrounds.business_list_header}
255
+ source={theme.images.general.homeHero}
225
256
  style={{ paddingTop: top + 20 }}>
226
257
  {!auth && (
227
258
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
@@ -237,6 +268,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
237
268
  : navigation.navigate('AddressForm', {
238
269
  address: orderState.options?.address,
239
270
  isFromBusinesses: true,
271
+ isGuestUser: isGuestUser
240
272
  })
241
273
  }>
242
274
  <OIcon
@@ -258,33 +290,35 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
258
290
  )}
259
291
  <OrderControlContainer>
260
292
  <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>
293
+ <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
294
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
263
295
  <OIcon
264
296
  src={theme.images.general.arrow_down}
265
297
  width={10}
266
298
  style={{ marginStart: 8 }}
267
299
  />
268
300
  </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>
301
+ {isPreOrderSetting && (
302
+ <WrapMomentOption
303
+ onPress={() => handleMomentClick()}>
304
+ <OText
305
+ size={12}
306
+ numberOfLines={1}
307
+ ellipsizeMode="tail"
308
+ color={theme.colors.textSecondary}>
309
+ {orderState.options?.moment
310
+ ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
311
+ : t('ASAP_ABBREVIATION', 'ASAP')}
312
+ </OText>
313
+ {isPreorderEnabled && (
314
+ <OIcon
315
+ src={theme.images.general.arrow_down}
316
+ width={10}
317
+ style={{ marginStart: 8 }}
318
+ />
319
+ )}
320
+ </WrapMomentOption>
321
+ )}
288
322
 
289
323
  {!businessId && (
290
324
  <SearchBar
@@ -296,9 +330,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
296
330
  onCancel={() => handleChangeSearch('')}
297
331
  placeholder={t('SEARCH', 'Search')}
298
332
  height={26}
299
- isDisabled={configs?.advanced_business_search_enabled?.value === '1' || !businessTypes}
333
+ isDisabled={!businessTypes}
300
334
  inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
301
- onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
335
+ onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
302
336
  />
303
337
  )}
304
338
 
@@ -316,7 +350,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
316
350
  {
317
351
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
318
352
  <FeaturedWrapper>
319
- <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
353
+ <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
320
354
  <ScrollView
321
355
  showsHorizontalScrollIndicator={false}
322
356
  nestedScrollEnabled
@@ -324,7 +358,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
324
358
  {featuredBusiness.map((bAry: any, idx) => (
325
359
  <View key={'f-listing_' + idx}>
326
360
  <BusinessFeaturedController
327
- key={bAry[0].id}
328
361
  business={bAry[0]}
329
362
  isBusinessOpen={bAry[0]?.open}
330
363
  handleCustomClick={handleBusinessClick}
@@ -332,7 +365,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
332
365
  />
333
366
  {bAry.length > 1 && (
334
367
  <BusinessFeaturedController
335
- key={bAry[1].id}
336
368
  business={bAry[1]}
337
369
  isBusinessOpen={bAry[1]?.open}
338
370
  handleCustomClick={handleBusinessClick}
@@ -348,7 +380,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
348
380
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
349
381
  {
350
382
  !businessId && !props.franchiseId && (
351
- <HighestRatedBusinesses onBusinessClick={handleBusinessClick} navigation={navigation} />
383
+ <HighestRatedBusinesses
384
+ onBusinessClick={handleBusinessClick}
385
+ navigation={navigation}
386
+ favoriteIds={favoriteIds}
387
+ setFavoriteIds={setFavoriteIds}
388
+ />
352
389
  )
353
390
  }
354
391
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
@@ -371,9 +408,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
371
408
  />
372
409
  )}
373
410
  {businessesList.businesses?.map(
374
- (business: any) => (
411
+ (business: any, i : number) => (
375
412
  <BusinessController
376
- key={business.id}
413
+ key={`${business.id}_` + i}
377
414
  business={business}
378
415
  isBusinessOpen={business.open}
379
416
  handleCustomClick={handleBusinessClick}
@@ -387,6 +424,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
387
424
  businessDeliveryTime={business?.delivery_time}
388
425
  businessPickupTime={business?.pickup_time}
389
426
  businessDistance={business?.distance}
427
+ handleUpdateBusinessList={handleUpdateBusinessList}
428
+ favoriteIds={favoriteIds}
429
+ setFavoriteIds={setFavoriteIds}
390
430
  />
391
431
  )
392
432
  )}
@@ -106,7 +106,7 @@ const CartUI = (props: any) => {
106
106
  }
107
107
 
108
108
  const getIncludedTaxes = () => {
109
- if (cart?.taxes === null) {
109
+ if (cart?.taxes === null || !cart?.taxes) {
110
110
  return cart.business.tax_type === 1 ? cart?.tax : 0
111
111
  } else {
112
112
  return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
@@ -162,13 +162,13 @@ const CartUI = (props: any) => {
162
162
  handleClearProducts={handleClearProducts}
163
163
  handleCartOpen={handleCartOpen}
164
164
  onNavigationRedirect={props.onNavigationRedirect}
165
- handleChangeStore={props.isFranchiseApp ? () => setOpenChangeStore(true) : null}
165
+ handleChangeStore={() => setOpenChangeStore(true)}
166
166
  handleClickCheckout={() => setOpenUpselling(true)}
167
167
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
168
168
  >
169
- {cart?.products?.length > 0 && cart?.products.map((product: any) => (
169
+ {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
170
170
  <ProductItemAccordion
171
- key={product.code}
171
+ key={`${product.code}_${i}`}
172
172
  isCartPending={isCartPending}
173
173
  isCartProduct
174
174
  product={product}
@@ -202,8 +202,8 @@ const CartUI = (props: any) => {
202
202
  </OSTable>
203
203
  )}
204
204
  {
205
- cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
206
- <OSTable key={offer.id}>
205
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
206
+ <OSTable key={`${offer.id}_${i}`}>
207
207
  <OSRow>
208
208
  <OText size={12} lineHeight={18}>{offer.name}</OText>
209
209
  {offer.rate_type === 1 && (
@@ -234,8 +234,8 @@ const CartUI = (props: any) => {
234
234
  </OSTable>
235
235
  )}
236
236
  {
237
- cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
238
- <OSTable key={tax.id}>
237
+ cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
238
+ <OSTable key={`${tax.id}_${i}`}>
239
239
  <OSRow>
240
240
  <OText size={12} lineHeight={18} numberOfLines={1} >
241
241
  {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
@@ -250,12 +250,12 @@ const CartUI = (props: any) => {
250
250
  ))
251
251
  }
252
252
  {
253
- cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
254
- <OSTable key={fee?.id}>
253
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
254
+ <OSTable key={`${fee.id}_${i}`}>
255
255
  <OSRow>
256
256
  <OText size={12} lineHeight={18} numberOfLines={1}>
257
257
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
258
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
258
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
259
259
  </OText>
260
260
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
261
261
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -293,8 +293,8 @@ const CartUI = (props: any) => {
293
293
  </OSTable>
294
294
  )}
295
295
  {
296
- cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
297
- <OSTable key={offer.id}>
296
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
297
+ <OSTable key={`${offer.id}_${i}`}>
298
298
  <OSRow>
299
299
  <OText size={12} lineHeight={18}>{offer.name}</OText>
300
300
  {offer.rate_type === 1 && (
@@ -409,7 +409,7 @@ const CartUI = (props: any) => {
409
409
  )}
410
410
  </OSBill>
411
411
  )}
412
- {cart?.valid_products && (
412
+ {cart?.valid_products ? (
413
413
  <CheckoutAction>
414
414
  <OButton
415
415
  text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
@@ -428,11 +428,17 @@ const CartUI = (props: any) => {
428
428
  style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
429
429
  />
430
430
  </CheckoutAction>
431
+ ) : (
432
+ <View style={{ alignItems: 'center', width: '100%' }}>
433
+ <OText size={12} color={theme.colors.red} style={{ textAlign: 'center', marginTop: 5 }}>
434
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
435
+ </OText>
436
+ </View>
431
437
  )}
432
438
  </BusinessItemAccordion>
433
439
 
434
440
  <OModal
435
- open={openChangeStore && props.isFranchiseApp}
441
+ open={openChangeStore}
436
442
  entireModal
437
443
  customClose
438
444
  onClose={() => setOpenChangeStore(false)}
@@ -446,8 +452,6 @@ const CartUI = (props: any) => {
446
452
  open={openTaxModal.open}
447
453
  onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
448
454
  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
455
  >
452
456
  <TaxInformation
453
457
  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 && (
@@ -85,8 +85,7 @@ const CheckoutUI = (props: any) => {
85
85
  deliveryOptionSelected,
86
86
  instructionsOptions,
87
87
  handleChangeDeliveryOption,
88
- currency,
89
- merchantId
88
+ currency
90
89
  } = props
91
90
 
92
91
  const theme = useTheme();
@@ -113,7 +112,10 @@ const CheckoutUI = (props: any) => {
113
112
  right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
114
113
  position: 'absolute',
115
114
  fontSize: 20
116
- }
115
+ },
116
+ wrapperNavbar: Platform.OS === 'ios'
117
+ ? { paddingVertical: 0, paddingHorizontal: 40 }
118
+ : { paddingVertical: 20, paddingHorizontal: 40 }
117
119
  })
118
120
 
119
121
  const [, { showToast }] = useToast();
@@ -133,11 +135,20 @@ const CheckoutUI = (props: any) => {
133
135
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
134
136
  const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
135
137
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
136
-
138
+
137
139
  const placeSpotTypes = [3, 4]
138
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
140
+ const businessConfigs = businessDetails?.business?.configs ?? []
141
+ const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
142
+ const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
143
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
144
+
139
145
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
140
- const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place)
146
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
147
+ cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
148
+ (options.type === 1 &&
149
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
150
+ validationFields?.fields?.checkout?.driver_tip?.required &&
151
+ (Number(cart?.driver_tip) <= 0))
141
152
 
142
153
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
143
154
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -239,7 +250,7 @@ const CheckoutUI = (props: any) => {
239
250
 
240
251
  useEffect(() => {
241
252
  if (cart?.products?.length === 0) {
242
- navigation?.canGoBack() && navigation.goBack();
253
+ onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
243
254
  }
244
255
  }, [cart?.products])
245
256
 
@@ -250,13 +261,18 @@ const CheckoutUI = (props: any) => {
250
261
  return (
251
262
  <>
252
263
  <Container noPadding>
253
- <NavBar
254
- isVertical
255
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
256
- title={t('CHECKOUT', 'Checkout')}
257
- titleStyle={{ marginLeft: 0, marginRight: 0, paddingLeft: 40 }}
258
- btnStyle={{ marginLeft: 40, padding: 40 }}
259
- />
264
+ <View style={styles.wrapperNavbar}>
265
+ <NavBar
266
+ title={t('CHECKOUT', 'Checkout')}
267
+ titleAlign={'center'}
268
+ onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
269
+ showCall={false}
270
+ btnStyle={{ paddingLeft: 0 }}
271
+ style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
272
+ titleWrapStyle={{ paddingHorizontal: 0 }}
273
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
274
+ />
275
+ </View>
260
276
  <ChContainer style={styles.pagePadding}>
261
277
  <ChSection style={{ paddingTop: 0 }}>
262
278
  <ChHeader>
@@ -547,18 +563,17 @@ const CheckoutUI = (props: any) => {
547
563
  onNavigationRedirect={onNavigationRedirect}
548
564
  paySelected={paymethodSelected}
549
565
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
550
- handlePlaceOrder={handlePlaceOrder}
551
- merchantId={merchantId}
552
566
  />
553
567
  </ChPaymethods>
554
568
  </ChSection>
555
569
  )}
556
570
 
557
- {!cartState.loading && cart && isWalletEnabled && (
571
+ {!cartState.loading && cart && isWalletEnabled && businessDetails?.business?.configs && (
558
572
  <WalletPaymentOptionContainer>
559
573
  <PaymentOptionWallet
560
574
  cart={cart}
561
575
  businessId={cart?.business_id}
576
+ businessConfigs={businessDetails?.business?.configs}
562
577
  />
563
578
  </WalletPaymentOptionContainer>
564
579
  )}
@@ -596,21 +611,19 @@ const CheckoutUI = (props: any) => {
596
611
  </OText>
597
612
  </TouchableOpacity>
598
613
  </CartHeader>
599
- {props.isFranchiseApp && (
600
- <TouchableOpacity
601
- onPress={() => setOpenChangeStore(true)}
602
- style={{ alignSelf: 'flex-start' }}
614
+ <TouchableOpacity
615
+ onPress={() => setOpenChangeStore(true)}
616
+ style={{ alignSelf: 'flex-start' }}
617
+ >
618
+ <OText
619
+ size={12}
620
+ lineHeight={18}
621
+ color={theme.colors.textSecondary}
622
+ style={{ textDecorationLine: 'underline' }}
603
623
  >
604
- <OText
605
- size={12}
606
- lineHeight={18}
607
- color={theme.colors.textSecondary}
608
- style={{ textDecorationLine: 'underline' }}
609
- >
610
- {t('CHANGE_STORE', 'Change store')}
611
- </OText>
612
- </TouchableOpacity>
613
- )}
624
+ {t('CHANGE_STORE', 'Change store')}
625
+ </OText>
626
+ </TouchableOpacity>
614
627
  <OrderSummary
615
628
  cart={cart}
616
629
  isCartPending={cart?.status === 2}
@@ -624,7 +637,7 @@ const CheckoutUI = (props: any) => {
624
637
 
625
638
  {!cartState.loading && cart && (
626
639
  <View>
627
- <ChErrors style={{ marginBottom: 0 }}>
640
+ <ChErrors style={{ marginBottom: 10 }}>
628
641
  {!cart?.valid_address && cart?.status !== 2 && (
629
642
  <OText
630
643
  color={theme.colors.error}
@@ -648,7 +661,7 @@ const CheckoutUI = (props: any) => {
648
661
  color={theme.colors.error}
649
662
  size={12}
650
663
  >
651
- {t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')}
664
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
652
665
  </OText>
653
666
  )}
654
667
  {placeSpotTypes.includes(options?.type) && !cart?.place && (
@@ -659,11 +672,22 @@ const CheckoutUI = (props: any) => {
659
672
  {t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
660
673
  </OText>
661
674
  )}
675
+ {options.type === 1 &&
676
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
677
+ validationFields?.fields?.checkout?.driver_tip?.required &&
678
+ (Number(cart?.driver_tip) <= 0) && (
679
+ <OText
680
+ color={theme.colors.error}
681
+ size={12}
682
+ >
683
+ {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
684
+ </OText>
685
+ )}
662
686
  </ChErrors>
663
687
  </View>
664
688
  )}
665
689
  <OModal
666
- open={openChangeStore && props.isFranchiseApp}
690
+ open={openChangeStore}
667
691
  entireModal
668
692
  customClose
669
693
  onClose={() => setOpenChangeStore(false)}
@@ -707,19 +731,6 @@ const CheckoutUI = (props: any) => {
707
731
  setShowGateway={setShowGateway}
708
732
  />
709
733
  )}
710
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
711
- <PaymentOptionsWebView
712
- onNavigationRedirect={onNavigationRedirect}
713
- uri={`https://test-square-f50f7.web.app`}
714
- user={user}
715
- token={token}
716
- cart={cart}
717
- currency={currency}
718
- webviewPaymethod={webviewPaymethod}
719
- setShowGateway={setShowGateway}
720
- locationId={'L1NGAY5M6KJRX'}
721
- />
722
- )}
723
734
  </>
724
735
  )
725
736
  }
@@ -872,7 +883,7 @@ export const Checkout = (props: any) => {
872
883
  ...props,
873
884
  UIComponent: CheckoutUI,
874
885
  cartState,
875
- [props.isFranchiseApp ? 'uuid' : 'businessId']: props.isFranchiseApp ? cartUuid : cartState.cart?.business_id
886
+ uuid: cartUuid
876
887
  }
877
888
 
878
889
  return (