ordering-ui-react-native 0.16.49 → 0.16.50-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 (205) 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/BusinessInformation/index.tsx +33 -4
  6. package/src/components/BusinessInformation/styles.tsx +2 -2
  7. package/src/components/BusinessProductsList/index.tsx +10 -10
  8. package/src/components/BusinessesListing/index.tsx +1 -1
  9. package/src/components/Checkout/index.tsx +2 -1
  10. package/src/components/LanguageSelector/index.tsx +21 -16
  11. package/src/components/Messages/index.tsx +2 -2
  12. package/src/components/NotificationSetting/index.tsx +85 -0
  13. package/src/components/OrdersOption/index.tsx +54 -56
  14. package/src/components/PaymentOptions/index.tsx +298 -345
  15. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  16. package/src/components/ReviewProducts/index.tsx +11 -0
  17. package/src/components/SingleProductReview/index.tsx +8 -5
  18. package/src/components/StripeElementsForm/index.tsx +25 -16
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OBottomPopup.tsx +6 -2
  21. package/src/components/shared/OToast.tsx +4 -4
  22. package/src/index.tsx +2 -0
  23. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  24. package/src/utils/index.tsx +2 -1
  25. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +259 -238
  26. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  27. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  28. package/themes/business/src/components/Chat/index.tsx +40 -32
  29. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  30. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  31. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  32. package/themes/business/src/components/MapView/index.tsx +12 -1
  33. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  34. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  35. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +40 -30
  36. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  37. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  38. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  39. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  40. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  43. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  45. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  46. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  47. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  48. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  49. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  50. package/themes/business/src/components/PreviousOrders/index.tsx +332 -244
  51. package/themes/business/src/components/PreviousOrders/styles.tsx +30 -2
  52. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  53. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  54. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  55. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  56. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  57. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  58. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  59. package/themes/business/src/components/shared/OLink.tsx +24 -12
  60. package/themes/business/src/components/shared/OText.tsx +3 -2
  61. package/themes/business/src/types/index.tsx +25 -11
  62. package/themes/business/src/utils/index.tsx +10 -0
  63. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  64. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  65. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  67. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  68. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  69. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  70. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  71. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  72. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  73. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/types/index.d.ts +2 -0
  76. package/themes/original/index.tsx +8 -0
  77. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  78. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  79. package/themes/original/src/components/AddressList/index.tsx +1 -1
  80. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  83. package/themes/original/src/components/BusinessController/index.tsx +203 -94
  84. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  85. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  86. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  87. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  90. package/themes/original/src/components/BusinessListingSearch/index.tsx +85 -137
  91. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  92. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -83
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +19 -12
  98. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +15 -4
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +276 -122
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +48 -11
  103. package/themes/original/src/components/BusinessesListing/index.tsx +82 -28
  104. package/themes/original/src/components/Cart/index.tsx +82 -15
  105. package/themes/original/src/components/Cart/styles.tsx +4 -0
  106. package/themes/original/src/components/CartContent/index.tsx +27 -17
  107. package/themes/original/src/components/CartContent/styles.tsx +1 -1
  108. package/themes/original/src/components/Checkout/index.tsx +114 -118
  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 -24
  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/index.tsx +162 -50
  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 +2 -35
  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 +94 -98
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  152. package/themes/original/src/components/OrdersOption/index.tsx +91 -53
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  156. package/themes/original/src/components/PlaceSpot/index.tsx +249 -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 +645 -664
  160. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  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/ProductOptionSubOption/index.tsx +16 -8
  164. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  167. package/themes/original/src/components/Promotions/index.tsx +232 -219
  168. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  169. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  170. package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
  171. package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
  172. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  173. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
  174. package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -0
  175. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  176. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  177. package/themes/original/src/components/ServiceForm/index.tsx +341 -267
  178. package/themes/original/src/components/SignupForm/index.tsx +160 -113
  179. package/themes/original/src/components/SingleOrderCard/index.tsx +219 -129
  180. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  181. package/themes/original/src/components/SingleProductCard/index.tsx +182 -105
  182. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  183. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  184. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  185. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  186. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  187. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  188. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  189. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  190. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  191. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  192. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  193. package/themes/original/src/components/Wallets/index.tsx +176 -164
  194. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  195. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  197. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  198. package/themes/original/src/components/shared/OButton.tsx +10 -3
  199. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  200. package/themes/original/src/components/shared/OInput.tsx +10 -1
  201. package/themes/original/src/layouts/Container.tsx +13 -9
  202. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  203. package/themes/original/src/types/index.tsx +86 -28
  204. package/themes/original/src/utils/index.tsx +103 -58
  205. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const ProgressBar = styled.View`
4
+ height: 4px;
5
+ background: ${(props: any) => props.theme.colors.textNormal};
6
+ `
7
+
8
+ export const ProgressContentWrapper = styled.View`
9
+ height: 4px;
10
+ background: #F8F9FA;
11
+ margin-bottom: 10px;
12
+ flex: 1;
13
+ `
@@ -3,7 +3,7 @@ import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastTy
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?.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', [])
@@ -217,120 +223,25 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
217
223
  handleSearchbusinessAndProducts(true)
218
224
  }, [])
219
225
 
220
- const MaxSectionItem = ({ title, options, filter }: any) => {
221
- const parseValue = (option: number) => {
222
- return filter === 'max_distance'
223
- ? `${option / 1000} ${t('KM', 'Km')}`
224
- : filter === 'max_eta'
225
- ? `${option} ${t('MIN', 'min')}`
226
- : parsePrice(option)
227
- }
228
- return (
229
- <View style={{ marginBottom: 20 }}>
230
- <OText weight='bold' mBottom={10} size={16}>
231
- {title}
232
- </OText>
233
- <ProgressContentWrapper>
234
- <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
235
- </ProgressContentWrapper>
236
- <View style={styles.maxContainer}>
237
- {options.map((option: any, i: number) => (
238
- <TouchableOpacity
239
- onPress={() => handleChangeFilters(filter, option)}
240
- key={option}
241
- >
242
- <OText
243
- size={12}
244
- weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
245
- >
246
- {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
247
- </OText>
248
- </TouchableOpacity>
249
- ))}
250
- </View>
251
- </View>
252
- )
253
- }
254
226
 
255
- const BusinessControllerSkeletons = () => {
256
- return (
257
- <>
258
- {[
259
- ...Array(
260
- paginationProps.nextPageItems
261
- ? paginationProps.nextPageItems
262
- : 3,
263
- ).keys(),
264
- ].map((item, i) => (
265
- <Placeholder
266
- Animation={Fade}
267
- key={i}
268
- style={{ width: 320, marginRight: 20, marginTop: 20 }}>
269
- <View style={{ width: 320 }}>
270
- <PlaceholderLine
271
- height={155}
272
- style={{ marginBottom: 20, borderRadius: 25 }}
273
- />
274
- <View style={{ paddingHorizontal: 10 }}>
275
- <View
276
- style={{
277
- flexDirection: 'row',
278
- justifyContent: 'space-between',
279
- }}>
280
- <PlaceholderLine
281
- height={25}
282
- width={40}
283
- style={{ marginBottom: 10 }}
284
- />
285
- <PlaceholderLine
286
- height={25}
287
- width={20}
288
- style={{ marginBottom: 10 }}
289
- />
290
- </View>
291
- <PlaceholderLine
292
- height={20}
293
- width={30}
294
- style={{ marginBottom: 10 }}
295
- />
296
- <PlaceholderLine
297
- height={20}
298
- width={80}
299
- style={{ marginBottom: 0 }}
300
- />
301
- </View>
302
- </View>
303
- </Placeholder>
304
- ))}
305
- </>
306
- )
307
- }
227
+ useEffect(() => {
228
+ handleChangeTermValue('')
229
+ }, [isFocused])
308
230
 
309
231
  return (
310
- <ScrollView style={styles.container}>
311
- <WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
312
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', paddingVertical: 20 }}>
313
- <OIcon src={theme.images.general.arrow_left} width={20} />
314
- </TouchableOpacity>
315
- <OText
316
- size={20}
317
- mBottom={15}
318
- weight='bold'
319
- style={{ marginTop: 10 }}
320
- >
321
- {t('SEARCH', 'Search')}
322
- </OText>
323
- </WrapHeader>
232
+ <BContainer
233
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
234
+ >
324
235
  <SearchWrapper>
325
236
  <SearchBar
326
237
  lazyLoad
238
+ {...(isChewLayout && { height: 55 })}
327
239
  inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
328
240
  placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
329
241
  onSearch={(val: string) => handleChangeTermValue(val)}
330
242
  value={termValue}
331
243
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
332
244
  />
333
-
334
245
  </SearchWrapper>
335
246
  {
336
247
  noResults && (
@@ -341,12 +252,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
341
252
  </View>
342
253
  )
343
254
  }
344
- {businessesSearchList.businesses?.length > 0 && (
255
+ {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
345
256
  <MyOrders
346
257
  hideOrders
347
258
  businessesSearchList={businessesSearchList}
348
259
  onNavigationRedirect={onNavigationRedirect}
349
260
  BusinessControllerSkeletons={BusinessControllerSkeletons}
261
+ businessPaginationProps={paginationProps}
262
+ franchiseId={brandId}
263
+ hideBackBtn
264
+ titleStyle={{
265
+ paddingHorizontal: 0,
266
+ marginTop: 0,
267
+ marginLeft: 0
268
+ }}
350
269
  />
351
270
  )}
352
271
 
@@ -355,18 +274,26 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
355
274
  {t('BUSINESSES', 'Businesses')}
356
275
  </OText>
357
276
  </OptionTitle>
358
- <ScrollView horizontal>
277
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
359
278
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
360
- <BusinessController
279
+ <View
361
280
  key={business.id}
362
- business={business}
363
- isBusinessOpen={business.open}
364
- handleCustomClick={() => onBusinessClick(business)}
365
- handleUpdateBusinessList={handleUpdateBusinessList}
366
- orderType={orderState?.options?.type}
367
- style={{ width: screenWidth - 80, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
368
- />
281
+ style={{
282
+ width: screenWidth - 120,
283
+ marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
284
+ }}
285
+ >
286
+ <BusinessController
287
+ business={business}
288
+ isBusinessOpen={business.open}
289
+ enableIntersection={false}
290
+ handleCustomClick={() => onBusinessClick(business)}
291
+ handleUpdateBusinessList={handleUpdateBusinessList}
292
+ orderType={orderState?.options?.type}
293
+ />
294
+ </View>
369
295
  ))}
296
+ {console.log(screenWidth)}
370
297
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
371
298
  <LoadMoreBusinessContainer>
372
299
  <OButton
@@ -379,7 +306,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
379
306
  </LoadMoreBusinessContainer>
380
307
  )}
381
308
  {businessesSearchList.loading && (
382
- <BusinessControllerSkeletons />
309
+ <BusinessControllerSkeletons paginationProps={paginationProps} />
383
310
  )}
384
311
  </ScrollView>
385
312
  <ProductsList>
@@ -426,17 +353,18 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
426
353
  style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
427
354
  />
428
355
  </SingleBusinessContainer>
429
- <ScrollView horizontal style={styles.productsContainer}>
356
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
430
357
  {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
431
358
  <SingleProductCard
432
359
  key={product?.id}
433
360
  isSoldOut={(product.inventoried && !product.quantity)}
434
361
  product={product}
362
+ enableIntersection={false}
435
363
  businessId={business?.id}
436
364
  onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
437
365
  productAddedToCartLength={0}
438
366
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
439
- style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
367
+ style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
440
368
  />
441
369
  )))}
442
370
 
@@ -462,7 +390,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
462
390
  </View>
463
391
  </Placeholder>
464
392
  <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
465
- <View style={{ flexDirection: 'row-reverse' }}>
393
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
466
394
  <PlaceholderLine
467
395
  width={24}
468
396
  height={70}
@@ -579,22 +507,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
579
507
  </PriceFilterWrapper>
580
508
  {orderState?.options?.type === 1 && (
581
509
  <MaxSectionItem
510
+ filters={filters}
582
511
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
583
512
  options={maxDeliveryFeeOptions}
584
513
  filter='max_delivery_price'
514
+ handleChangeFilters={handleChangeFilters}
585
515
  />
586
516
  )}
587
517
  {[1, 2].includes(orderState?.options?.type) && (
588
518
  <MaxSectionItem
519
+ filters={filters}
589
520
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
590
521
  options={maxTimeOptions}
591
522
  filter='max_eta'
523
+ handleChangeFilters={handleChangeFilters}
592
524
  />
593
525
  )}
594
526
  <MaxSectionItem
527
+ filters={filters}
595
528
  title={t('MAX_DISTANCE', 'Max distance')}
596
529
  options={maxDistanceOptions}
597
530
  filter='max_distance'
531
+ handleChangeFilters={handleChangeFilters}
598
532
  />
599
533
  {businessTypes?.length > 0 && (
600
534
  <TagsContainer>
@@ -614,14 +548,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
614
548
  </TagsContainer>
615
549
  )}
616
550
  </ScrollView>
617
- <OButton
618
- text={t('APPLY', 'Apply')}
619
- parentStyle={styles.applyButton}
620
- textStyle={{ color: '#fff' }}
621
- onClick={() => handleApplyFilters()}
622
- />
551
+ <WrapperButtons>
552
+ <View style={{ width: '50%' }}>
553
+ <OButton
554
+ text={t('APPLY', 'Apply')}
555
+ parentStyle={styles.applyButton}
556
+ textStyle={{ color: '#fff' }}
557
+ onClick={() => handleApplyFilters()}
558
+ />
559
+ </View>
560
+ <View style={{ width: '50%' }}>
561
+ <OButton
562
+ text={t('CLEAR_FILTERS', 'Clear')}
563
+ bgColor={theme.colors.white}
564
+ borderColor={theme.colors.primary}
565
+ parentStyle={styles.applyButton}
566
+ textStyle={{ color: theme.colors.primary }}
567
+ onClick={() => clearFilters()}
568
+ />
569
+ </View>
570
+ </WrapperButtons>
623
571
  </OModal>
624
- </ScrollView>
572
+ </BContainer>
625
573
  )
626
574
  }
627
575
 
@@ -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``