ordering-ui-react-native 0.16.33 → 0.16.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 (199) hide show
  1. package/package.json +7 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/LoginForm/index.tsx +15 -0
  13. package/src/components/Messages/index.tsx +2 -2
  14. package/src/components/NotificationSetting/index.tsx +85 -0
  15. package/src/components/OrderDetails/index.tsx +2 -20
  16. package/src/components/OrdersOption/index.tsx +54 -56
  17. package/src/components/PaymentOptions/index.tsx +335 -365
  18. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  19. package/src/components/ReviewDriver/index.tsx +1 -1
  20. package/src/components/ReviewOrder/index.tsx +2 -1
  21. package/src/components/ReviewProducts/index.tsx +11 -0
  22. package/src/components/SignupForm/index.tsx +15 -0
  23. package/src/components/SingleProductReview/index.tsx +8 -5
  24. package/src/components/StripeElementsForm/index.tsx +25 -16
  25. package/src/components/VerifyPhone/styles.tsx +1 -2
  26. package/src/components/shared/OBottomPopup.tsx +6 -2
  27. package/src/index.tsx +2 -0
  28. package/src/pages/BusinessesListing.tsx +7 -6
  29. package/src/pages/OrderDetails.tsx +1 -1
  30. package/src/pages/ReviewDriver.tsx +2 -2
  31. package/src/pages/ReviewOrder.tsx +2 -2
  32. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  33. package/src/utils/index.tsx +2 -1
  34. package/themes/business/index.tsx +4 -0
  35. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  36. package/themes/business/src/components/Chat/index.tsx +38 -30
  37. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  38. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  39. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  40. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  41. package/themes/business/src/components/MapView/index.tsx +12 -1
  42. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  43. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  44. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  45. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  46. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  47. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  48. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  49. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  50. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  52. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  54. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  55. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  56. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  57. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  58. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  59. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  60. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  61. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  62. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  63. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  64. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  65. package/themes/business/src/components/shared/OModal.tsx +40 -37
  66. package/themes/business/src/types/index.tsx +15 -9
  67. package/themes/business/src/utils/index.tsx +10 -0
  68. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  69. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  70. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  71. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  72. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  73. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  74. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  75. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  76. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  77. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  78. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  79. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  80. package/themes/kiosk/src/types/index.d.ts +2 -0
  81. package/themes/original/index.tsx +4 -0
  82. package/themes/original/src/components/AddressDetails/index.tsx +2 -2
  83. package/themes/original/src/components/AddressForm/index.tsx +151 -140
  84. package/themes/original/src/components/AddressList/index.tsx +1 -1
  85. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  86. package/themes/original/src/components/BusinessBasicInformation/index.tsx +311 -161
  87. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  88. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  89. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  90. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -4
  91. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  92. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  93. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  94. package/themes/original/src/components/BusinessListingSearch/index.tsx +80 -128
  95. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  96. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  97. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  98. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  99. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  100. package/themes/original/src/components/BusinessProductsListing/index.tsx +173 -104
  101. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  102. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  103. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  104. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  105. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  106. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +278 -104
  107. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  108. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  109. package/themes/original/src/components/Cart/index.tsx +44 -12
  110. package/themes/original/src/components/Cart/styles.tsx +4 -0
  111. package/themes/original/src/components/CartContent/index.tsx +22 -16
  112. package/themes/original/src/components/Checkout/index.tsx +101 -61
  113. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  114. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  115. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  116. package/themes/original/src/components/Favorite/index.tsx +1 -0
  117. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  120. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  121. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  122. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  123. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  124. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  125. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  126. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -72
  127. package/themes/original/src/components/LoginForm/index.tsx +90 -46
  128. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  129. package/themes/original/src/components/Messages/index.tsx +17 -17
  130. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  132. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  133. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  134. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  135. package/themes/original/src/components/NavBar/index.tsx +15 -9
  136. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  137. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  138. package/themes/original/src/components/Notifications/index.tsx +148 -0
  139. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  140. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  141. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  142. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  143. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  144. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  145. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  146. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  147. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  149. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  150. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  152. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  156. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  157. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +635 -664
  160. package/themes/original/src/components/ProductForm/styles.tsx +9 -8
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  163. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  164. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  165. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  166. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  167. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  168. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  169. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  170. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  171. package/themes/original/src/components/ServiceForm/index.tsx +410 -258
  172. package/themes/original/src/components/SignupForm/index.tsx +350 -206
  173. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  174. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  175. package/themes/original/src/components/SingleProductCard/index.tsx +200 -110
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -10
  177. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  178. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  179. package/themes/original/src/components/StripeElementsForm/index.tsx +18 -7
  180. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  181. package/themes/original/src/components/UserDetails/index.tsx +31 -17
  182. package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
  183. package/themes/original/src/components/UserProfile/index.tsx +54 -29
  184. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  185. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  186. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  187. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  188. package/themes/original/src/components/Wallets/index.tsx +176 -164
  189. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  190. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  191. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  192. package/themes/original/src/components/shared/OButton.tsx +10 -3
  193. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  194. package/themes/original/src/components/shared/OInput.tsx +13 -3
  195. package/themes/original/src/layouts/Container.tsx +13 -9
  196. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  197. package/themes/original/src/types/index.tsx +91 -30
  198. package/themes/original/src/utils/index.tsx +121 -10
  199. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,9 +1,9 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
2
+ import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
3
3
  import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { OButton, OIcon, OModal, OText } from '../shared'
6
+ import { OButton, OModal, OText } from '../shared'
7
7
  import { SearchBar } from '../SearchBar';
8
8
  import { BusinessController } from '../BusinessController'
9
9
  import { NotFoundSource } from '../NotFoundSource'
@@ -19,22 +19,23 @@ import {
19
19
  Metadata,
20
20
  SingleBusinessContainer,
21
21
  LoadMoreBusinessContainer,
22
- ProgressContentWrapper,
23
- ProgressBar,
24
22
  TagsContainer,
25
23
  SortContainer,
26
24
  BrandContainer,
27
25
  BrandItem,
28
26
  PriceFilterWrapper,
29
- OptionTitle
27
+ OptionTitle,
28
+ BContainer,
29
+ WrapperButtons
30
30
  } from './styles'
31
31
  import FastImage from 'react-native-fast-image'
32
32
  import { convertHoursToMinutes } from '../../utils'
33
33
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
34
34
  import { BusinessSearchParams } from '../../types'
35
35
  import { MyOrders } from '../MyOrders'
36
-
37
-
36
+ import { useIsFocused } from '@react-navigation/native';
37
+ import { MaxSectionItem } from './MaxSectionItem'
38
+ import { BusinessControllerSkeletons } from './BusinessControllerSkeletons'
38
39
  export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
39
40
  const {
40
41
  navigation,
@@ -82,6 +83,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
82
83
  { level: '5', content: '$$$$$' }
83
84
  ]
84
85
 
86
+ const isFocused = useIsFocused();
87
+
85
88
  const styles = StyleSheet.create({
86
89
  container: {
87
90
  paddingHorizontal: 40,
@@ -98,10 +101,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
98
101
  productsContainer: {
99
102
  marginTop: 20
100
103
  },
101
- maxContainer: {
102
- flexDirection: 'row',
103
- justifyContent: 'space-between'
104
- },
105
104
  businessTypesContainer: {
106
105
  width: '100%',
107
106
  flexDirection: 'row',
@@ -136,7 +135,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
136
135
  borderWidth: 0
137
136
  },
138
137
  applyButton: {
139
- paddingHorizontal: 40,
138
+ paddingHorizontal: 10,
140
139
  width: '100%',
141
140
  marginTop: 20
142
141
  }
@@ -147,10 +146,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
147
146
  }
148
147
 
149
148
  const handleCloseFilters = () => {
150
- setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
149
+ clearFilters()
151
150
  setOpenFilters(false)
152
151
  }
153
152
 
153
+ const clearFilters = () => {
154
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
155
+ }
156
+
154
157
  const handleChangeActiveBusinessType = (type: any) => {
155
158
  if (type?.id === null) {
156
159
  handleChangeFilters('business_types', [])
@@ -183,6 +186,30 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
183
186
  setOpenFilters(false)
184
187
  }
185
188
 
189
+ const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
190
+
191
+ const onProductClick = (business: any, categoryId: any, productId: any) => {
192
+ if (!isInteger(business?.id) ||
193
+ !isInteger(categoryId) ||
194
+ !isInteger(productId) ||
195
+ !business.slug || !business.header || !business.logo) {
196
+ showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
197
+ return
198
+ }
199
+
200
+ navigation.navigate('ProductDetails', {
201
+ isRedirect: 'business',
202
+ businessId: business?.id,
203
+ categoryId: categoryId,
204
+ productId: productId,
205
+ business: {
206
+ store: business.slug,
207
+ header: business.header,
208
+ logo: business.logo,
209
+ }
210
+ })
211
+ }
212
+
186
213
  useEffect(() => {
187
214
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
188
215
  handleSearchbusinessAndProducts(true)
@@ -193,110 +220,13 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
193
220
  handleSearchbusinessAndProducts(true)
194
221
  }, [])
195
222
 
196
- const MaxSectionItem = ({ title, options, filter }: any) => {
197
- const parseValue = (option: number) => {
198
- return filter === 'max_distance'
199
- ? `${option / 1000} ${t('KM', 'Km')}`
200
- : filter === 'max_eta'
201
- ? `${option} ${t('MIN', 'min')}`
202
- : parsePrice(option)
203
- }
204
- return (
205
- <View style={{ marginBottom: 20 }}>
206
- <OText weight='bold' mBottom={10} size={16}>
207
- {title}
208
- </OText>
209
- <ProgressContentWrapper>
210
- <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
211
- </ProgressContentWrapper>
212
- <View style={styles.maxContainer}>
213
- {options.map((option: any, i: number) => (
214
- <TouchableOpacity
215
- onPress={() => handleChangeFilters(filter, option)}
216
- key={option}
217
- >
218
- <OText
219
- size={12}
220
- weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
221
- >
222
- {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
223
- </OText>
224
- </TouchableOpacity>
225
- ))}
226
- </View>
227
- </View>
228
- )
229
- }
230
223
 
231
- const BusinessControllerSkeletons = () => {
232
- return (
233
- <>
234
- {[
235
- ...Array(
236
- paginationProps.nextPageItems
237
- ? paginationProps.nextPageItems
238
- : 3,
239
- ).keys(),
240
- ].map((item, i) => (
241
- <Placeholder
242
- Animation={Fade}
243
- key={i}
244
- style={{ width: 320, marginRight: 20, marginTop: 20 }}>
245
- <View style={{ width: 320 }}>
246
- <PlaceholderLine
247
- height={155}
248
- style={{ marginBottom: 20, borderRadius: 25 }}
249
- />
250
- <View style={{ paddingHorizontal: 10 }}>
251
- <View
252
- style={{
253
- flexDirection: 'row',
254
- justifyContent: 'space-between',
255
- }}>
256
- <PlaceholderLine
257
- height={25}
258
- width={40}
259
- style={{ marginBottom: 10 }}
260
- />
261
- <PlaceholderLine
262
- height={25}
263
- width={20}
264
- style={{ marginBottom: 10 }}
265
- />
266
- </View>
267
- <PlaceholderLine
268
- height={20}
269
- width={30}
270
- style={{ marginBottom: 10 }}
271
- />
272
- <PlaceholderLine
273
- height={20}
274
- width={80}
275
- style={{ marginBottom: 0 }}
276
- />
277
- </View>
278
- </View>
279
- </Placeholder>
280
- ))}
281
- </>
282
- )
283
- }
224
+ useEffect(() => {
225
+ handleChangeTermValue('')
226
+ }, [isFocused])
284
227
 
285
228
  return (
286
- <ScrollView style={styles.container}>
287
- <WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
288
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', paddingVertical: 20 }}>
289
- <OIcon src={theme.images.general.arrow_left} width={20} />
290
- </TouchableOpacity>
291
- <OText
292
- size={20}
293
- mBottom={15}
294
- weight='bold'
295
- style={{ marginTop: 10 }}
296
- >
297
- {t('SEARCH', 'Search')}
298
- </OText>
299
- </WrapHeader>
229
+ <BContainer>
300
230
  <SearchWrapper>
301
231
  <SearchBar
302
232
  lazyLoad
@@ -306,7 +236,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
306
236
  value={termValue}
307
237
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
308
238
  />
309
-
310
239
  </SearchWrapper>
311
240
  {
312
241
  noResults && (
@@ -317,12 +246,13 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
317
246
  </View>
318
247
  )
319
248
  }
320
- {businessesSearchList.businesses?.length > 0 && (
249
+ {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
321
250
  <MyOrders
322
251
  hideOrders
323
252
  businessesSearchList={businessesSearchList}
324
253
  onNavigationRedirect={onNavigationRedirect}
325
254
  BusinessControllerSkeletons={BusinessControllerSkeletons}
255
+ businessPaginationProps={paginationProps}
326
256
  />
327
257
  )}
328
258
 
@@ -337,10 +267,11 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
337
267
  key={business.id}
338
268
  business={business}
339
269
  isBusinessOpen={business.open}
270
+ enableIntersection={false}
340
271
  handleCustomClick={() => onBusinessClick(business)}
341
272
  handleUpdateBusinessList={handleUpdateBusinessList}
342
273
  orderType={orderState?.options?.type}
343
- style={{ width: screenWidth - 80, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
274
+ style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
344
275
  />
345
276
  ))}
346
277
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
@@ -355,7 +286,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
355
286
  </LoadMoreBusinessContainer>
356
287
  )}
357
288
  {businessesSearchList.loading && (
358
- <BusinessControllerSkeletons />
289
+ <BusinessControllerSkeletons paginationProps={paginationProps} />
359
290
  )}
360
291
  </ScrollView>
361
292
  <ProductsList>
@@ -402,17 +333,18 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
402
333
  style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
403
334
  />
404
335
  </SingleBusinessContainer>
405
- <ScrollView horizontal style={styles.productsContainer}>
336
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
406
337
  {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
407
338
  <SingleProductCard
408
339
  key={product?.id}
409
340
  isSoldOut={(product.inventoried && !product.quantity)}
410
341
  product={product}
342
+ enableIntersection={false}
411
343
  businessId={business?.id}
412
- onProductClick={() => { }}
344
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
413
345
  productAddedToCartLength={0}
414
346
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
415
- style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
347
+ style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
416
348
  />
417
349
  )))}
418
350
 
@@ -555,22 +487,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
555
487
  </PriceFilterWrapper>
556
488
  {orderState?.options?.type === 1 && (
557
489
  <MaxSectionItem
490
+ filters={filters}
558
491
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
559
492
  options={maxDeliveryFeeOptions}
560
493
  filter='max_delivery_price'
494
+ handleChangeFilters={handleChangeFilters}
561
495
  />
562
496
  )}
563
497
  {[1, 2].includes(orderState?.options?.type) && (
564
498
  <MaxSectionItem
499
+ filters={filters}
565
500
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
566
501
  options={maxTimeOptions}
567
502
  filter='max_eta'
503
+ handleChangeFilters={handleChangeFilters}
568
504
  />
569
505
  )}
570
506
  <MaxSectionItem
507
+ filters={filters}
571
508
  title={t('MAX_DISTANCE', 'Max distance')}
572
509
  options={maxDistanceOptions}
573
510
  filter='max_distance'
511
+ handleChangeFilters={handleChangeFilters}
574
512
  />
575
513
  {businessTypes?.length > 0 && (
576
514
  <TagsContainer>
@@ -590,14 +528,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
590
528
  </TagsContainer>
591
529
  )}
592
530
  </ScrollView>
593
- <OButton
594
- text={t('APPLY', 'Apply')}
595
- parentStyle={styles.applyButton}
596
- textStyle={{ color: '#fff' }}
597
- onClick={() => handleApplyFilters()}
598
- />
531
+ <WrapperButtons>
532
+ <View style={{ width: '50%' }}>
533
+ <OButton
534
+ text={t('APPLY', 'Apply')}
535
+ parentStyle={styles.applyButton}
536
+ textStyle={{ color: '#fff' }}
537
+ onClick={() => handleApplyFilters()}
538
+ />
539
+ </View>
540
+ <View style={{ width: '50%' }}>
541
+ <OButton
542
+ text={t('CLEAR_FILTERS', 'Clear')}
543
+ bgColor={theme.colors.white}
544
+ borderColor={theme.colors.primary}
545
+ parentStyle={styles.applyButton}
546
+ textStyle={{ color: theme.colors.primary }}
547
+ onClick={() => clearFilters()}
548
+ />
549
+ </View>
550
+ </WrapperButtons>
599
551
  </OModal>
600
- </ScrollView>
552
+ </BContainer>
601
553
  )
602
554
  }
603
555
 
@@ -1,5 +1,9 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
+ export const BContainer = styled.View`
4
+ padding: 20px 40px;
5
+ `
6
+
3
7
  export const WrapHeader = styled.View`
4
8
  width: 100%;
5
9
  padding-vertical: 20px;
@@ -55,18 +59,6 @@ export const LoadMoreBusinessContainer = styled.View`
55
59
  margin-left: 20px;
56
60
  `
57
61
 
58
- export const ProgressBar = styled.View`
59
- height: 4px;
60
- background: ${(props: any) => props.theme.colors.textNormal};
61
- `
62
-
63
- export const ProgressContentWrapper = styled.View`
64
- height: 4px;
65
- background: #F8F9FA;
66
- margin-bottom: 10px;
67
- flex: 1;
68
- `
69
-
70
62
  export const TagsContainer = styled.View`
71
63
  padding-bottom: 10px;
72
64
  `
@@ -94,3 +86,9 @@ export const OptionTitle = styled.View`
94
86
  margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
95
87
  `}
96
88
  `
89
+
90
+ export const WrapperButtons = styled.View`
91
+ flex-direction: row;
92
+ width: 100%;
93
+ justify-content: space-between;
94
+ `
@@ -0,0 +1,87 @@
1
+ import React from 'react'
2
+ import { useTheme } from 'styled-components/native'
3
+ import { StyleSheet } from 'react-native'
4
+ import { SubCategoriesContainer, ContainerButton } from './styles'
5
+ import { OButton } from '../../shared'
6
+ import { useLanguage } from 'ordering-components/native'
7
+
8
+ function SubcategoriesComponentPropsAreEqual(prev: any, next: any) {
9
+ return prev.subcategoriesSelected === next.subcategoriesSelected &&
10
+ prev.category === next.category
11
+ }
12
+
13
+ interface SubcategoriesComponentParams {
14
+ subcategoriesSelected?: any,
15
+ category?: any,
16
+ onClickSubcategory: any
17
+ }
18
+
19
+ const SubcategoriesComponent = (props : SubcategoriesComponentParams) => {
20
+ const {
21
+ subcategoriesSelected,
22
+ category,
23
+ onClickSubcategory
24
+ } = props
25
+
26
+ const theme = useTheme()
27
+ const [, t] = useLanguage()
28
+ const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
29
+
30
+ const bpStyles = StyleSheet.create({
31
+ catWrap: { flexDirection: 'row', alignItems: 'center', marginBottom: 19 },
32
+ catIcon: {
33
+ borderRadius: 7.6,
34
+ shadowColor: '#000000',
35
+ shadowOpacity: 0.1,
36
+ shadowOffset: { width: 0, height: 0 },
37
+ shadowRadius: 1,
38
+ marginEnd: 13,
39
+ },
40
+ categoryButtonStyle: {
41
+ borderWidth: 0,
42
+ marginLeft: 5,
43
+ marginRight: 5,
44
+ marginBottom: 10,
45
+ height: 35,
46
+ paddingLeft: 3,
47
+ paddingRight: 3,
48
+ }
49
+ });
50
+
51
+
52
+ return (
53
+ <SubCategoriesContainer>
54
+ <ContainerButton
55
+ isSelected={allsubcategorySelected}
56
+ >
57
+ <OButton
58
+ onClick={() => onClickSubcategory(null, category)}
59
+ bgColor={allsubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
60
+ text={`${t('ALL', 'All')} ${allsubcategorySelected ? 'X' : ''}`}
61
+ style={bpStyles.categoryButtonStyle}
62
+ textStyle={{ color: allsubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
63
+ />
64
+ </ContainerButton>
65
+ {category?.subcategories?.map((subcategory: any) => {
66
+ const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
67
+ return (
68
+ <ContainerButton
69
+ key={subcategory?.id}
70
+ isSelected={isSubcategorySelected}
71
+ >
72
+ <OButton
73
+ onClick={() => onClickSubcategory(subcategory, category)}
74
+ bgColor={isSubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
75
+ text={`${subcategory?.name} ${isSubcategorySelected ? 'X' : ''}`}
76
+ style={bpStyles.categoryButtonStyle}
77
+ textStyle={{ color: isSubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
78
+ />
79
+ </ContainerButton>
80
+ )
81
+ }
82
+ )}
83
+ </SubCategoriesContainer>
84
+ )
85
+ }
86
+
87
+ export const SubcategoriesComponentMemoized = React.memo(SubcategoriesComponent, SubcategoriesComponentPropsAreEqual)
@@ -0,0 +1,12 @@
1
+ import styled from "styled-components/native";
2
+
3
+ export const SubCategoriesContainer = styled.View`
4
+ flex-direction: row;
5
+ flex-wrap: wrap;
6
+ margin-bottom: 10px;
7
+ `
8
+
9
+ export const ContainerButton = styled.View`
10
+ `
11
+
12
+ export const HeaderWrapper = styled.View``
@@ -11,6 +11,8 @@ import { StyleSheet } from 'react-native';
11
11
  import { useTheme } from 'styled-components/native';
12
12
  import { shape } from '../../utils'
13
13
  import { CategoryDescriptionMemoized } from './CategoryDescription';
14
+ import { OrderItAgain } from '../OrderItAgain'
15
+ import { SubcategoriesComponentMemoized } from './SubcategoriesComponent';
14
16
 
15
17
  const BusinessProductsListUI = (props: BusinessProductsListParams) => {
16
18
  const {
@@ -35,7 +37,9 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
35
37
  onClickCategory,
36
38
  lazyLoadProductsRecommended,
37
39
  handleUpdateProducts,
38
- isFiltMode
40
+ previouslyProducts,
41
+ isFiltMode,
42
+ navigation
39
43
  } = props;
40
44
 
41
45
  const [, t] = useLanguage();
@@ -67,51 +71,29 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
67
71
  }
68
72
  }
69
73
 
70
- const SubcategoriesComponent = ({ category }: any) => {
71
- const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
72
-
73
- return (
74
- <SubCategoriesContainer>
75
- <ContainerButton
76
- isSelected={allsubcategorySelected}
77
- >
78
- <OButton
79
- onClick={() => onClickSubcategory(null, category)}
80
- bgColor={allsubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
81
- text={`${t('ALL', 'All')} ${allsubcategorySelected ? 'X' : ''}`}
82
- style={bpStyles.categoryButtonStyle}
83
- textStyle={{ color: allsubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
84
- />
85
- </ContainerButton>
86
- {category?.subcategories?.map((subcategory: any) => {
87
- const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
88
- return (
89
- <ContainerButton
90
- key={subcategory?.id}
91
- isSelected={isSubcategorySelected}
92
- >
93
- <OButton
94
- onClick={() => onClickSubcategory(subcategory, category)}
95
- bgColor={isSubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
96
- text={`${subcategory?.name} ${isSubcategorySelected ? 'X' : ''}`}
97
- style={bpStyles.categoryButtonStyle}
98
- textStyle={{ color: isSubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
99
- />
100
- </ContainerButton>
101
- )
102
- }
103
- )}
104
- </SubCategoriesContainer>
105
- )
106
- }
107
-
108
74
  return (
109
75
  <ProductsContainer renderToHardwareTextureAndroid={categoryState.loading || isBusinessLoading}>
110
76
  <HeaderWrapper>
111
77
  {category?.subcategories?.length > 0 && (
112
- <SubcategoriesComponent category={category} />
78
+ <SubcategoriesComponentMemoized
79
+ category={category}
80
+ subcategoriesSelected={subcategoriesSelected}
81
+ onClickSubcategory={onClickSubcategory}
82
+ />
113
83
  )}
114
84
  </HeaderWrapper>
85
+ {previouslyProducts?.length > 0 && (
86
+ <OrderItAgain
87
+ onProductClick={onProductClick}
88
+ productList={previouslyProducts}
89
+ businessId={businessId}
90
+ categoryState={categoryState}
91
+ navigation={navigation}
92
+ handleUpdateProducts={handleUpdateProducts}
93
+ currentCart={currentCart}
94
+ searchValue={searchValue}
95
+ />
96
+ )}
115
97
  {category.id &&
116
98
  categoryState.products
117
99
  ?.filter((product: any) =>
@@ -122,12 +104,14 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
122
104
  <SingleProductCard
123
105
  key={'prod_' + product.id + `_${i}`}
124
106
  isSoldOut={product.inventoried && !product.quantity}
107
+ enableIntersection={!isFiltMode && categoryState.products?.length < 80}
125
108
  product={product}
126
109
  businessId={businessId}
127
110
  categoryState={categoryState}
128
111
  onProductClick={() => onProductClick(product)}
129
112
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
130
113
  handleUpdateProducts={handleUpdateProducts}
114
+ navigation={navigation}
131
115
  />
132
116
  ))
133
117
  }
@@ -148,11 +132,13 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
148
132
  key={'feat_' + product.id + `_${i}`}
149
133
  isSoldOut={product.inventoried && !product.quantity}
150
134
  product={product}
135
+ enableIntersection={!isFiltMode && categoryState.products?.length < 80}
151
136
  businessId={businessId}
152
137
  categoryState={categoryState}
153
138
  onProductClick={onProductClick}
154
139
  handleUpdateProducts={handleUpdateProducts}
155
140
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
141
+ navigation={navigation}
156
142
  />
157
143
  ),
158
144
  )}
@@ -233,18 +219,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
233
219
  </View>
234
220
  )}
235
221
  {category?.subcategories?.length > 0 && !isFiltMode && (
236
- <SubcategoriesComponent category={category} />
222
+ <SubcategoriesComponentMemoized
223
+ category={category}
224
+ subcategoriesSelected={subcategoriesSelected}
225
+ onClickSubcategory={onClickSubcategory}
226
+ />
237
227
  )}
238
228
  <>
239
229
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
240
230
  <SingleProductCard
241
231
  key={`${product?.id}_${i}`}
232
+ enableIntersection={!isFiltMode && categoryState.products?.length < 80}
242
233
  isSoldOut={product.inventoried && !product.quantity}
243
234
  businessId={businessId}
244
235
  product={product}
245
236
  categoryState={categoryState}
246
237
  onProductClick={onProductClick}
247
238
  handleUpdateProducts={handleUpdateProducts}
239
+ navigation={navigation}
248
240
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
249
241
  />
250
242
  ))}
@@ -259,19 +251,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
259
251
  <>
260
252
  {[...Array(categoryState?.pagination?.nextPageItems).keys()].map(
261
253
  (item, i) => (
262
- <Placeholder key={i} style={{ padding: 5 }} Animation={Fade}>
263
- <View style={{ flexDirection: 'row' }}>
254
+ <View style={{ minHeight: 165, marginBottom: 28, padding: 12 }} key={i}>
255
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
256
+ <View style={{ flexDirection: 'row' }}>
257
+ <Placeholder style={{ paddingVertical: 10, flex: 1 }}>
258
+ <PlaceholderLine width={60} style={{ marginBottom: 15 }} />
259
+ <PlaceholderLine width={20} />
260
+ </Placeholder>
261
+ <PlaceholderLine
262
+ width={24}
263
+ height={70}
264
+ style={{ marginLeft: 10, marginBottom: 10 }}
265
+ />
266
+ </View>
264
267
  <PlaceholderLine
265
- width={24}
266
- height={70}
267
- style={{ marginRight: 10, marginBottom: 10 }}
268
+ height={52}
268
269
  />
269
- <Placeholder style={{ paddingVertical: 10 }}>
270
- <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
271
- <PlaceholderLine width={20} />
272
- </Placeholder>
273
- </View>
274
- </Placeholder>
270
+ </Placeholder>
271
+ </View>
275
272
  ),
276
273
  )}
277
274
  </>