ordering-ui-react-native 0.16.47 → 0.16.48-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 (204) hide show
  1. package/package.json +6 -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/Messages/index.tsx +2 -2
  13. package/src/components/NotificationSetting/index.tsx +85 -0
  14. package/src/components/OrdersOption/index.tsx +54 -56
  15. package/src/components/PaymentOptions/index.tsx +298 -345
  16. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  17. package/src/components/ReviewDriver/index.tsx +1 -1
  18. package/src/components/ReviewOrder/index.tsx +2 -2
  19. package/src/components/ReviewProducts/index.tsx +11 -0
  20. package/src/components/SingleProductReview/index.tsx +8 -5
  21. package/src/components/StripeElementsForm/index.tsx +25 -16
  22. package/src/components/VerifyPhone/styles.tsx +1 -2
  23. package/src/components/shared/OBottomPopup.tsx +6 -2
  24. package/src/components/shared/OToast.tsx +4 -4
  25. package/src/index.tsx +2 -0
  26. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  27. package/src/utils/index.tsx +2 -1
  28. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +259 -238
  29. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  30. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  31. package/themes/business/src/components/Chat/index.tsx +40 -32
  32. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  33. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  34. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  35. package/themes/business/src/components/MapView/index.tsx +12 -1
  36. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  37. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  38. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +33 -23
  39. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  40. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  41. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  42. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  45. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  46. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  47. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  49. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  50. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  51. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  52. package/themes/business/src/components/PreviousOrders/index.tsx +331 -243
  53. package/themes/business/src/components/PreviousOrders/styles.tsx +30 -2
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  55. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  56. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  57. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  58. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  59. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  60. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  61. package/themes/business/src/components/shared/OLink.tsx +24 -12
  62. package/themes/business/src/components/shared/OText.tsx +3 -2
  63. package/themes/business/src/types/index.tsx +25 -11
  64. package/themes/business/src/utils/index.tsx +10 -0
  65. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  67. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  68. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  69. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  70. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  71. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  72. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  73. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  74. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  76. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  77. package/themes/kiosk/src/types/index.d.ts +2 -0
  78. package/themes/original/index.tsx +6 -0
  79. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  80. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  81. package/themes/original/src/components/AddressList/index.tsx +1 -1
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
  84. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  85. package/themes/original/src/components/BusinessController/index.tsx +231 -114
  86. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +175 -80
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  99. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +35 -23
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +275 -120
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  104. package/themes/original/src/components/BusinessesListing/index.tsx +80 -25
  105. package/themes/original/src/components/Cart/index.tsx +82 -15
  106. package/themes/original/src/components/Cart/styles.tsx +4 -0
  107. package/themes/original/src/components/CartContent/index.tsx +22 -16
  108. package/themes/original/src/components/Checkout/index.tsx +113 -117
  109. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  110. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  112. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  113. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  114. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  115. package/themes/original/src/components/FloatingButton/index.tsx +13 -11
  116. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  117. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  118. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  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 +89 -73
  126. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  127. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  128. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  129. package/themes/original/src/components/Messages/index.tsx +35 -20
  130. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  131. package/themes/original/src/components/MultiCart/index.tsx +63 -0
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  133. package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  135. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  136. package/themes/original/src/components/NavBar/index.tsx +11 -5
  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 +200 -39
  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 +77 -66
  147. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  148. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  149. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  150. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  151. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  152. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  153. package/themes/original/src/components/OrdersOption/index.tsx +102 -56
  154. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  155. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  156. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  157. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  158. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  159. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  160. package/themes/original/src/components/ProductForm/index.tsx +639 -664
  161. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  162. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  163. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  164. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  165. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  166. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  167. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  168. package/themes/original/src/components/Promotions/index.tsx +232 -219
  169. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  170. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  171. package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
  172. package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
  173. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  174. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
  175. package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -0
  176. package/themes/original/src/components/ServiceForm/index.tsx +332 -264
  177. package/themes/original/src/components/SignupForm/index.tsx +160 -113
  178. package/themes/original/src/components/SingleOrderCard/index.tsx +266 -183
  179. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  180. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  181. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  182. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  183. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  184. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  186. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  187. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  188. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  189. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  190. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  192. package/themes/original/src/components/Wallets/index.tsx +176 -164
  193. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  194. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  195. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  196. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  197. package/themes/original/src/components/shared/OButton.tsx +10 -3
  198. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  199. package/themes/original/src/components/shared/OInput.tsx +10 -1
  200. package/themes/original/src/layouts/Container.tsx +13 -9
  201. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  202. package/themes/original/src/types/index.tsx +83 -28
  203. package/themes/original/src/utils/index.tsx +103 -58
  204. 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,
@@ -51,7 +52,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
51
52
  brandList,
52
53
  onNavigationRedirect,
53
54
  handleUpdateBusinessList,
54
- handleUpdateProducts
55
+ handleUpdateProducts,
56
+ brandId
55
57
  } = props
56
58
 
57
59
  const screenHeight = Dimensions.get('window').height;
@@ -74,6 +76,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
74
76
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
75
77
  ]
76
78
 
79
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
80
+
77
81
  const priceList = [
78
82
  { level: '1', content: '$' },
79
83
  { level: '2', content: '$$' },
@@ -82,6 +86,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
82
86
  { level: '5', content: '$$$$$' }
83
87
  ]
84
88
 
89
+ const isFocused = useIsFocused();
90
+
85
91
  const styles = StyleSheet.create({
86
92
  container: {
87
93
  paddingHorizontal: 40,
@@ -93,15 +99,11 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
93
99
  width: '100%'
94
100
  },
95
101
  searchInput: {
96
- fontSize: 10,
102
+ fontSize: 12,
97
103
  },
98
104
  productsContainer: {
99
105
  marginTop: 20
100
106
  },
101
- maxContainer: {
102
- flexDirection: 'row',
103
- justifyContent: 'space-between'
104
- },
105
107
  businessTypesContainer: {
106
108
  width: '100%',
107
109
  flexDirection: 'row',
@@ -136,7 +138,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
136
138
  borderWidth: 0
137
139
  },
138
140
  applyButton: {
139
- paddingHorizontal: 40,
141
+ paddingHorizontal: 10,
140
142
  width: '100%',
141
143
  marginTop: 20
142
144
  }
@@ -147,10 +149,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
147
149
  }
148
150
 
149
151
  const handleCloseFilters = () => {
150
- setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
152
+ clearFilters()
151
153
  setOpenFilters(false)
152
154
  }
153
155
 
156
+ const clearFilters = () => {
157
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
158
+ }
159
+
154
160
  const handleChangeActiveBusinessType = (type: any) => {
155
161
  if (type?.id === null) {
156
162
  handleChangeFilters('business_types', [])
@@ -183,6 +189,30 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
183
189
  setOpenFilters(false)
184
190
  }
185
191
 
192
+ const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
193
+
194
+ const onProductClick = (business: any, categoryId: any, productId: any) => {
195
+ if (!isInteger(business?.id) ||
196
+ !isInteger(categoryId) ||
197
+ !isInteger(productId) ||
198
+ !business.slug || !business.header || !business.logo) {
199
+ showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
200
+ return
201
+ }
202
+
203
+ navigation.navigate('ProductDetails', {
204
+ isRedirect: 'business',
205
+ businessId: business?.id,
206
+ categoryId: categoryId,
207
+ productId: productId,
208
+ business: {
209
+ store: business.slug,
210
+ header: business.header,
211
+ logo: business.logo,
212
+ }
213
+ })
214
+ }
215
+
186
216
  useEffect(() => {
187
217
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
188
218
  handleSearchbusinessAndProducts(true)
@@ -193,120 +223,23 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
193
223
  handleSearchbusinessAndProducts(true)
194
224
  }, [])
195
225
 
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
226
 
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
- }
227
+ useEffect(() => {
228
+ handleChangeTermValue('')
229
+ }, [isFocused])
284
230
 
285
231
  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>
232
+ <BContainer>
300
233
  <SearchWrapper>
301
234
  <SearchBar
302
235
  lazyLoad
236
+ {...(isChewLayout && { height: 55 })}
303
237
  inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
304
238
  placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
305
239
  onSearch={(val: string) => handleChangeTermValue(val)}
306
240
  value={termValue}
307
241
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
308
242
  />
309
-
310
243
  </SearchWrapper>
311
244
  {
312
245
  noResults && (
@@ -317,12 +250,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
317
250
  </View>
318
251
  )
319
252
  }
320
- {businessesSearchList.businesses?.length > 0 && (
253
+ {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
321
254
  <MyOrders
322
255
  hideOrders
323
256
  businessesSearchList={businessesSearchList}
324
257
  onNavigationRedirect={onNavigationRedirect}
325
258
  BusinessControllerSkeletons={BusinessControllerSkeletons}
259
+ businessPaginationProps={paginationProps}
260
+ franchiseId={brandId}
261
+ hideBackBtn
262
+ titleStyle={{
263
+ paddingHorizontal: 0,
264
+ marginTop: 0,
265
+ marginLeft: 0
266
+ }}
326
267
  />
327
268
  )}
328
269
 
@@ -331,18 +272,26 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
331
272
  {t('BUSINESSES', 'Businesses')}
332
273
  </OText>
333
274
  </OptionTitle>
334
- <ScrollView horizontal>
275
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
335
276
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
336
- <BusinessController
277
+ <View
337
278
  key={business.id}
338
- business={business}
339
- isBusinessOpen={business.open}
340
- handleCustomClick={() => onBusinessClick(business)}
341
- handleUpdateBusinessList={handleUpdateBusinessList}
342
- orderType={orderState?.options?.type}
343
- style={{ width: screenWidth - 80, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
344
- />
279
+ style={{
280
+ width: screenWidth - 120,
281
+ marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
282
+ }}
283
+ >
284
+ <BusinessController
285
+ business={business}
286
+ isBusinessOpen={business.open}
287
+ enableIntersection={false}
288
+ handleCustomClick={() => onBusinessClick(business)}
289
+ handleUpdateBusinessList={handleUpdateBusinessList}
290
+ orderType={orderState?.options?.type}
291
+ />
292
+ </View>
345
293
  ))}
294
+ {console.log(screenWidth)}
346
295
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
347
296
  <LoadMoreBusinessContainer>
348
297
  <OButton
@@ -355,7 +304,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
355
304
  </LoadMoreBusinessContainer>
356
305
  )}
357
306
  {businessesSearchList.loading && (
358
- <BusinessControllerSkeletons />
307
+ <BusinessControllerSkeletons paginationProps={paginationProps} />
359
308
  )}
360
309
  </ScrollView>
361
310
  <ProductsList>
@@ -402,17 +351,18 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
402
351
  style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
403
352
  />
404
353
  </SingleBusinessContainer>
405
- <ScrollView horizontal style={styles.productsContainer}>
354
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
406
355
  {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
407
356
  <SingleProductCard
408
357
  key={product?.id}
409
358
  isSoldOut={(product.inventoried && !product.quantity)}
410
359
  product={product}
360
+ enableIntersection={false}
411
361
  businessId={business?.id}
412
- onProductClick={() => { }}
362
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
413
363
  productAddedToCartLength={0}
414
364
  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 }}
365
+ style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
416
366
  />
417
367
  )))}
418
368
 
@@ -438,7 +388,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
438
388
  </View>
439
389
  </Placeholder>
440
390
  <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
441
- <View style={{ flexDirection: 'row-reverse' }}>
391
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
442
392
  <PlaceholderLine
443
393
  width={24}
444
394
  height={70}
@@ -555,22 +505,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
555
505
  </PriceFilterWrapper>
556
506
  {orderState?.options?.type === 1 && (
557
507
  <MaxSectionItem
508
+ filters={filters}
558
509
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
559
510
  options={maxDeliveryFeeOptions}
560
511
  filter='max_delivery_price'
512
+ handleChangeFilters={handleChangeFilters}
561
513
  />
562
514
  )}
563
515
  {[1, 2].includes(orderState?.options?.type) && (
564
516
  <MaxSectionItem
517
+ filters={filters}
565
518
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
566
519
  options={maxTimeOptions}
567
520
  filter='max_eta'
521
+ handleChangeFilters={handleChangeFilters}
568
522
  />
569
523
  )}
570
524
  <MaxSectionItem
525
+ filters={filters}
571
526
  title={t('MAX_DISTANCE', 'Max distance')}
572
527
  options={maxDistanceOptions}
573
528
  filter='max_distance'
529
+ handleChangeFilters={handleChangeFilters}
574
530
  />
575
531
  {businessTypes?.length > 0 && (
576
532
  <TagsContainer>
@@ -590,14 +546,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
590
546
  </TagsContainer>
591
547
  )}
592
548
  </ScrollView>
593
- <OButton
594
- text={t('APPLY', 'Apply')}
595
- parentStyle={styles.applyButton}
596
- textStyle={{ color: '#fff' }}
597
- onClick={() => handleApplyFilters()}
598
- />
549
+ <WrapperButtons>
550
+ <View style={{ width: '50%' }}>
551
+ <OButton
552
+ text={t('APPLY', 'Apply')}
553
+ parentStyle={styles.applyButton}
554
+ textStyle={{ color: '#fff' }}
555
+ onClick={() => handleApplyFilters()}
556
+ />
557
+ </View>
558
+ <View style={{ width: '50%' }}>
559
+ <OButton
560
+ text={t('CLEAR_FILTERS', 'Clear')}
561
+ bgColor={theme.colors.white}
562
+ borderColor={theme.colors.primary}
563
+ parentStyle={styles.applyButton}
564
+ textStyle={{ color: theme.colors.primary }}
565
+ onClick={() => clearFilters()}
566
+ />
567
+ </View>
568
+ </WrapperButtons>
599
569
  </OModal>
600
- </ScrollView>
570
+ </BContainer>
601
571
  )
602
572
  }
603
573
 
@@ -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``