ordering-ui-react-native 0.16.27 → 0.16.28-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 (202) hide show
  1. package/package.json +8 -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/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessInformation/index.tsx +33 -4
  8. package/src/components/BusinessInformation/styles.tsx +2 -2
  9. package/src/components/BusinessProductsList/index.tsx +10 -10
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/LanguageSelector/index.tsx +21 -16
  13. package/src/components/LoginForm/index.tsx +15 -0
  14. package/src/components/Messages/index.tsx +2 -2
  15. package/src/components/NotificationSetting/index.tsx +85 -0
  16. package/src/components/OrderDetails/index.tsx +2 -20
  17. package/src/components/OrdersOption/index.tsx +54 -56
  18. package/src/components/PaymentOptions/index.tsx +335 -365
  19. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  20. package/src/components/ReviewDriver/index.tsx +1 -1
  21. package/src/components/ReviewOrder/index.tsx +2 -1
  22. package/src/components/ReviewProducts/index.tsx +11 -0
  23. package/src/components/SignupForm/index.tsx +15 -0
  24. package/src/components/SingleProductReview/index.tsx +8 -5
  25. package/src/components/StripeElementsForm/index.tsx +25 -16
  26. package/src/components/VerifyPhone/styles.tsx +1 -2
  27. package/src/components/shared/OBottomPopup.tsx +6 -2
  28. package/src/index.tsx +2 -0
  29. package/src/pages/BusinessesListing.tsx +7 -6
  30. package/src/pages/OrderDetails.tsx +1 -1
  31. package/src/pages/ReviewDriver.tsx +2 -2
  32. package/src/pages/ReviewOrder.tsx +2 -2
  33. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  34. package/src/utils/index.tsx +0 -1
  35. package/themes/business/index.tsx +4 -0
  36. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  37. package/themes/business/src/components/Chat/index.tsx +42 -34
  38. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  39. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  40. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  41. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  42. package/themes/business/src/components/MapView/index.tsx +12 -1
  43. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  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 +5 -4
  59. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  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/Checkout/index.tsx +6 -0
  72. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  73. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  74. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  75. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  76. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  77. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  78. package/themes/kiosk/src/types/index.d.ts +2 -0
  79. package/themes/original/index.tsx +12 -0
  80. package/themes/original/src/components/AddressDetails/index.tsx +1 -1
  81. package/themes/original/src/components/AddressForm/index.tsx +139 -135
  82. package/themes/original/src/components/AddressList/index.tsx +1 -1
  83. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  84. package/themes/original/src/components/BusinessBasicInformation/index.tsx +311 -161
  85. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  86. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  87. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  88. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -4
  89. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  91. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  92. package/themes/original/src/components/BusinessListingSearch/index.tsx +81 -128
  93. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  95. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  96. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  97. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  98. package/themes/original/src/components/BusinessProductsListing/index.tsx +293 -177
  99. package/themes/original/src/components/BusinessProductsListing/styles.tsx +23 -11
  100. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  101. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  102. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  104. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -10
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  106. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  107. package/themes/original/src/components/BusinessesListing/index.tsx +105 -519
  108. package/themes/original/src/components/Cart/index.tsx +44 -12
  109. package/themes/original/src/components/Cart/styles.tsx +4 -0
  110. package/themes/original/src/components/CartContent/index.tsx +22 -16
  111. package/themes/original/src/components/Checkout/index.tsx +101 -61
  112. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  113. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  114. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  115. package/themes/original/src/components/Favorite/index.tsx +1 -0
  116. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  117. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  118. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  119. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  123. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  124. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  125. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -72
  126. package/themes/original/src/components/LoginForm/index.tsx +83 -45
  127. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  128. package/themes/original/src/components/Messages/index.tsx +17 -17
  129. package/themes/original/src/components/MomentOption/index.tsx +1 -1
  130. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  131. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  133. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  135. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  136. package/themes/original/src/components/NavBar/index.tsx +15 -9
  137. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  138. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  139. package/themes/original/src/components/Notifications/index.tsx +148 -0
  140. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  141. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  142. package/themes/original/src/components/OrderDetails/index.tsx +190 -35
  143. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  144. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  145. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  146. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  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 +100 -106
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
  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 +4 -10
  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 +633 -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 +129 -0
  164. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  165. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  166. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  167. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  168. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  169. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  170. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  171. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  172. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  173. package/themes/original/src/components/ServiceForm/index.tsx +637 -0
  174. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  175. package/themes/original/src/components/SignupForm/index.tsx +350 -206
  176. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  177. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  178. package/themes/original/src/components/SingleProductCard/index.tsx +199 -110
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -10
  180. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  181. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  182. package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
  183. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  184. package/themes/original/src/components/UserDetails/index.tsx +31 -17
  185. package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
  186. package/themes/original/src/components/UserProfile/index.tsx +54 -29
  187. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  188. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  189. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  190. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  191. package/themes/original/src/components/Wallets/index.tsx +176 -164
  192. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  193. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  194. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  195. package/themes/original/src/components/shared/OButton.tsx +10 -3
  196. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  197. package/themes/original/src/components/shared/OInput.tsx +3 -2
  198. package/themes/original/src/layouts/Container.tsx +13 -9
  199. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  200. package/themes/original/src/types/index.tsx +121 -30
  201. package/themes/original/src/utils/index.tsx +77 -0
  202. 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,
@@ -55,6 +56,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
55
56
  } = props
56
57
 
57
58
  const screenHeight = Dimensions.get('window').height;
59
+ const screenWidth = Dimensions.get('window').width;
58
60
  const theme = useTheme()
59
61
  const [orderState] = useOrder()
60
62
  const { top } = useSafeAreaInsets();
@@ -81,6 +83,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
81
83
  { level: '5', content: '$$$$$' }
82
84
  ]
83
85
 
86
+ const isFocused = useIsFocused();
87
+
84
88
  const styles = StyleSheet.create({
85
89
  container: {
86
90
  paddingHorizontal: 40,
@@ -97,10 +101,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
97
101
  productsContainer: {
98
102
  marginTop: 20
99
103
  },
100
- maxContainer: {
101
- flexDirection: 'row',
102
- justifyContent: 'space-between'
103
- },
104
104
  businessTypesContainer: {
105
105
  width: '100%',
106
106
  flexDirection: 'row',
@@ -135,7 +135,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
135
135
  borderWidth: 0
136
136
  },
137
137
  applyButton: {
138
- paddingHorizontal: 40,
138
+ paddingHorizontal: 10,
139
139
  width: '100%',
140
140
  marginTop: 20
141
141
  }
@@ -146,10 +146,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
146
146
  }
147
147
 
148
148
  const handleCloseFilters = () => {
149
- setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
149
+ clearFilters()
150
150
  setOpenFilters(false)
151
151
  }
152
152
 
153
+ const clearFilters = () => {
154
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
155
+ }
156
+
153
157
  const handleChangeActiveBusinessType = (type: any) => {
154
158
  if (type?.id === null) {
155
159
  handleChangeFilters('business_types', [])
@@ -182,6 +186,30 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
182
186
  setOpenFilters(false)
183
187
  }
184
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
+
185
213
  useEffect(() => {
186
214
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
187
215
  handleSearchbusinessAndProducts(true)
@@ -192,110 +220,13 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
192
220
  handleSearchbusinessAndProducts(true)
193
221
  }, [])
194
222
 
195
- const MaxSectionItem = ({ title, options, filter }: any) => {
196
- const parseValue = (option: number) => {
197
- return filter === 'max_distance'
198
- ? `${option / 1000} ${t('KM', 'Km')}`
199
- : filter === 'max_eta'
200
- ? `${option} ${t('MIN', 'min')}`
201
- : parsePrice(option)
202
- }
203
- return (
204
- <View style={{ marginBottom: 20 }}>
205
- <OText weight='bold' mBottom={10} size={16}>
206
- {title}
207
- </OText>
208
- <ProgressContentWrapper>
209
- <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
210
- </ProgressContentWrapper>
211
- <View style={styles.maxContainer}>
212
- {options.map((option: any, i: number) => (
213
- <TouchableOpacity
214
- onPress={() => handleChangeFilters(filter, option)}
215
- key={option}
216
- >
217
- <OText
218
- size={12}
219
- weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
220
- >
221
- {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
222
- </OText>
223
- </TouchableOpacity>
224
- ))}
225
- </View>
226
- </View>
227
- )
228
- }
229
223
 
230
- const BusinessControllerSkeletons = () => {
231
- return (
232
- <>
233
- {[
234
- ...Array(
235
- paginationProps.nextPageItems
236
- ? paginationProps.nextPageItems
237
- : 3,
238
- ).keys(),
239
- ].map((item, i) => (
240
- <Placeholder
241
- Animation={Fade}
242
- key={i}
243
- style={{ width: 320, marginRight: 20, marginTop: 20 }}>
244
- <View style={{ width: 320 }}>
245
- <PlaceholderLine
246
- height={155}
247
- style={{ marginBottom: 20, borderRadius: 25 }}
248
- />
249
- <View style={{ paddingHorizontal: 10 }}>
250
- <View
251
- style={{
252
- flexDirection: 'row',
253
- justifyContent: 'space-between',
254
- }}>
255
- <PlaceholderLine
256
- height={25}
257
- width={40}
258
- style={{ marginBottom: 10 }}
259
- />
260
- <PlaceholderLine
261
- height={25}
262
- width={20}
263
- style={{ marginBottom: 10 }}
264
- />
265
- </View>
266
- <PlaceholderLine
267
- height={20}
268
- width={30}
269
- style={{ marginBottom: 10 }}
270
- />
271
- <PlaceholderLine
272
- height={20}
273
- width={80}
274
- style={{ marginBottom: 0 }}
275
- />
276
- </View>
277
- </View>
278
- </Placeholder>
279
- ))}
280
- </>
281
- )
282
- }
224
+ useEffect(() => {
225
+ handleChangeTermValue('')
226
+ }, [isFocused])
283
227
 
284
228
  return (
285
- <ScrollView style={styles.container}>
286
- <WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
287
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', paddingVertical: 20 }}>
288
- <OIcon src={theme.images.general.arrow_left} width={20} />
289
- </TouchableOpacity>
290
- <OText
291
- size={20}
292
- mBottom={15}
293
- weight='bold'
294
- style={{ marginTop: 10 }}
295
- >
296
- {t('SEARCH', 'Search')}
297
- </OText>
298
- </WrapHeader>
229
+ <BContainer>
299
230
  <SearchWrapper>
300
231
  <SearchBar
301
232
  lazyLoad
@@ -305,7 +236,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
305
236
  value={termValue}
306
237
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
307
238
  />
308
-
309
239
  </SearchWrapper>
310
240
  {
311
241
  noResults && (
@@ -316,12 +246,13 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
316
246
  </View>
317
247
  )
318
248
  }
319
- {businessesSearchList.businesses?.length > 0 && (
249
+ {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
320
250
  <MyOrders
321
251
  hideOrders
322
252
  businessesSearchList={businessesSearchList}
323
253
  onNavigationRedirect={onNavigationRedirect}
324
254
  BusinessControllerSkeletons={BusinessControllerSkeletons}
255
+ businessPaginationProps={paginationProps}
325
256
  />
326
257
  )}
327
258
 
@@ -336,10 +267,11 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
336
267
  key={business.id}
337
268
  business={business}
338
269
  isBusinessOpen={business.open}
270
+ enableIntersection={false}
339
271
  handleCustomClick={() => onBusinessClick(business)}
340
272
  handleUpdateBusinessList={handleUpdateBusinessList}
341
273
  orderType={orderState?.options?.type}
342
- style={{ width: 320, 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 }}
343
275
  />
344
276
  ))}
345
277
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
@@ -354,7 +286,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
354
286
  </LoadMoreBusinessContainer>
355
287
  )}
356
288
  {businessesSearchList.loading && (
357
- <BusinessControllerSkeletons />
289
+ <BusinessControllerSkeletons paginationProps={paginationProps} />
358
290
  )}
359
291
  </ScrollView>
360
292
  <ProductsList>
@@ -401,17 +333,18 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
401
333
  style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
402
334
  />
403
335
  </SingleBusinessContainer>
404
- <ScrollView horizontal style={styles.productsContainer}>
336
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
405
337
  {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
406
338
  <SingleProductCard
407
339
  key={product?.id}
408
340
  isSoldOut={(product.inventoried && !product.quantity)}
409
341
  product={product}
342
+ enableIntersection={false}
410
343
  businessId={business?.id}
411
- onProductClick={() => { }}
344
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
412
345
  productAddedToCartLength={0}
413
346
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
414
- style={{ width: 320, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
347
+ style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
415
348
  />
416
349
  )))}
417
350
 
@@ -554,22 +487,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
554
487
  </PriceFilterWrapper>
555
488
  {orderState?.options?.type === 1 && (
556
489
  <MaxSectionItem
490
+ filters={filters}
557
491
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
558
492
  options={maxDeliveryFeeOptions}
559
493
  filter='max_delivery_price'
494
+ handleChangeFilters={handleChangeFilters}
560
495
  />
561
496
  )}
562
497
  {[1, 2].includes(orderState?.options?.type) && (
563
498
  <MaxSectionItem
499
+ filters={filters}
564
500
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
565
501
  options={maxTimeOptions}
566
502
  filter='max_eta'
503
+ handleChangeFilters={handleChangeFilters}
567
504
  />
568
505
  )}
569
506
  <MaxSectionItem
507
+ filters={filters}
570
508
  title={t('MAX_DISTANCE', 'Max distance')}
571
509
  options={maxDistanceOptions}
572
510
  filter='max_distance'
511
+ handleChangeFilters={handleChangeFilters}
573
512
  />
574
513
  {businessTypes?.length > 0 && (
575
514
  <TagsContainer>
@@ -589,14 +528,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
589
528
  </TagsContainer>
590
529
  )}
591
530
  </ScrollView>
592
- <OButton
593
- text={t('APPLY', 'Apply')}
594
- parentStyle={styles.applyButton}
595
- textStyle={{ color: '#fff' }}
596
- onClick={() => handleApplyFilters()}
597
- />
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>
598
551
  </OModal>
599
- </ScrollView>
552
+ </BContainer>
600
553
  )
601
554
  }
602
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
  </>