ordering-ui-react-native 0.16.73 → 0.16.74-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 (216) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +19 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +10 -10
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +2 -1
  9. package/src/components/LanguageSelector/index.tsx +21 -16
  10. package/src/components/Messages/index.tsx +2 -2
  11. package/src/components/OrderCreating/index.tsx +2 -2
  12. package/src/components/OrdersOption/index.tsx +54 -56
  13. package/src/components/PaymentOptions/index.tsx +298 -345
  14. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  15. package/src/components/SingleProductReview/index.tsx +7 -4
  16. package/src/components/StripeElementsForm/index.tsx +25 -16
  17. package/src/components/VerifyPhone/styles.tsx +1 -2
  18. package/src/components/shared/OToast.tsx +4 -4
  19. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  20. package/src/utils/index.tsx +2 -1
  21. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  22. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  23. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  24. package/themes/business/src/components/Chat/index.tsx +31 -31
  25. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  26. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  27. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  28. package/themes/business/src/components/LoginForm/index.tsx +332 -140
  29. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  30. package/themes/business/src/components/MapView/index.tsx +14 -3
  31. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  32. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  35. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  36. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  37. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  40. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  44. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  46. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  47. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  48. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  49. package/themes/business/src/components/ProductItemAccordion/index.tsx +24 -5
  50. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  51. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  52. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  53. package/themes/business/src/components/shared/OLink.tsx +33 -13
  54. package/themes/business/src/components/shared/OText.tsx +8 -2
  55. package/themes/business/src/types/index.tsx +29 -3
  56. package/themes/business/src/utils/index.tsx +26 -0
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  61. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  62. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  63. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  64. package/themes/kiosk/src/components/LoginForm/index.tsx +545 -112
  65. package/themes/kiosk/src/components/LoginForm/styles.tsx +18 -0
  66. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  67. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  68. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  69. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  70. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  71. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  72. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  73. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  74. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  75. package/themes/kiosk/src/types/index.d.ts +15 -0
  76. package/themes/kiosk/src/utils/index.tsx +15 -0
  77. package/themes/original/index.tsx +6 -0
  78. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  79. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  80. package/themes/original/src/components/AddressList/index.tsx +18 -18
  81. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +47 -22
  84. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  85. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  86. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  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 +105 -156
  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 +41 -62
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +561 -496
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  99. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +83 -80
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  103. package/themes/original/src/components/BusinessesListing/index.tsx +7 -6
  104. package/themes/original/src/components/Cart/index.tsx +76 -42
  105. package/themes/original/src/components/CartContent/index.tsx +80 -18
  106. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  107. package/themes/original/src/components/Checkout/index.tsx +96 -108
  108. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  109. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  110. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  111. package/themes/original/src/components/DriverTips/index.tsx +47 -37
  112. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  113. package/themes/original/src/components/Favorite/index.tsx +7 -4
  114. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  115. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  116. package/themes/original/src/components/FloatingButton/index.tsx +1 -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/GPSButton/styles.ts +3 -3
  120. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  121. package/themes/original/src/components/Help/index.tsx +8 -8
  122. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  123. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpGuide/index.tsx +13 -12
  125. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  126. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  127. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  128. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  129. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  130. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  131. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  132. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  133. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  134. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  135. package/themes/original/src/components/Messages/index.tsx +42 -26
  136. package/themes/original/src/components/MomentOption/index.tsx +23 -14
  137. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  138. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  139. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  140. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  141. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  142. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  143. package/themes/original/src/components/MyOrders/index.tsx +86 -20
  144. package/themes/original/src/components/NavBar/index.tsx +7 -6
  145. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  146. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  147. package/themes/original/src/components/Notifications/index.tsx +144 -0
  148. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  149. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  150. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  151. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  152. package/themes/original/src/components/OrderProgress/index.tsx +81 -105
  153. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  154. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  155. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  156. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  157. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  158. package/themes/original/src/components/OrdersOption/index.tsx +97 -100
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  163. package/themes/original/src/components/PlaceSpot/index.tsx +22 -8
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +240 -254
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +20 -9
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +337 -265
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  189. package/themes/original/src/components/SingleProductCard/index.tsx +133 -91
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  191. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  192. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  193. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  198. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  199. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  200. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  201. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  202. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  203. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  204. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  205. package/themes/original/src/components/Wallets/index.tsx +177 -164
  206. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  207. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  208. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  209. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  210. package/themes/original/src/components/shared/OButton.tsx +9 -4
  211. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  212. package/themes/original/src/components/shared/OInput.tsx +10 -1
  213. package/themes/original/src/layouts/Container.tsx +13 -9
  214. package/themes/original/src/types/index.tsx +38 -6
  215. package/themes/original/src/utils/index.tsx +317 -58
  216. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -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,14 +19,14 @@ 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'
@@ -34,8 +34,8 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
34
34
  import { BusinessSearchParams } from '../../types'
35
35
  import { MyOrders } from '../MyOrders'
36
36
  import { useIsFocused } from '@react-navigation/native';
37
-
38
-
37
+ import { MaxSectionItem } from './MaxSectionItem'
38
+ import { BusinessControllerSkeletons } from './BusinessControllerSkeletons'
39
39
  export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
40
40
  const {
41
41
  navigation,
@@ -52,7 +52,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
52
52
  brandList,
53
53
  onNavigationRedirect,
54
54
  handleUpdateBusinessList,
55
- handleUpdateProducts
55
+ handleUpdateProducts,
56
+ brandId
56
57
  } = props
57
58
 
58
59
  const screenHeight = Dimensions.get('window').height;
@@ -75,6 +76,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
75
76
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
76
77
  ]
77
78
 
79
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
80
+
78
81
  const priceList = [
79
82
  { level: '1', content: '$' },
80
83
  { level: '2', content: '$$' },
@@ -96,15 +99,11 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
96
99
  width: '100%'
97
100
  },
98
101
  searchInput: {
99
- fontSize: 10,
102
+ fontSize: 12,
100
103
  },
101
104
  productsContainer: {
102
105
  marginTop: 20
103
106
  },
104
- maxContainer: {
105
- flexDirection: 'row',
106
- justifyContent: 'space-between'
107
- },
108
107
  businessTypesContainer: {
109
108
  width: '100%',
110
109
  flexDirection: 'row',
@@ -139,7 +138,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
139
138
  borderWidth: 0
140
139
  },
141
140
  applyButton: {
142
- paddingHorizontal: 40,
141
+ paddingHorizontal: 10,
143
142
  width: '100%',
144
143
  marginTop: 20
145
144
  }
@@ -150,10 +149,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
150
149
  }
151
150
 
152
151
  const handleCloseFilters = () => {
153
- setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
152
+ clearFilters()
154
153
  setOpenFilters(false)
155
154
  }
156
155
 
156
+ const clearFilters = () => {
157
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
158
+ }
159
+
157
160
  const handleChangeActiveBusinessType = (type: any) => {
158
161
  if (type?.id === null) {
159
162
  handleChangeFilters('business_types', [])
@@ -188,7 +191,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
188
191
 
189
192
  const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
190
193
 
191
- const onProductClick = (business: any, categoryId: any, productId: any) => {
194
+
195
+ const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
192
196
  if (!isInteger(business?.id) ||
193
197
  !isInteger(categoryId) ||
194
198
  !isInteger(productId) ||
@@ -196,17 +200,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
196
200
  showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
197
201
  return
198
202
  }
199
-
203
+ const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
204
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === productId ? Cproduct?.quantity : 0) }, 0) || 0
200
205
  navigation.navigate('ProductDetails', {
201
206
  isRedirect: 'business',
202
207
  businessId: business?.id,
203
208
  categoryId: categoryId,
204
209
  productId: productId,
210
+ product: product,
205
211
  business: {
206
212
  store: business.slug,
207
213
  header: business.header,
208
214
  logo: business.logo,
209
- }
215
+ },
216
+ productAddedToCartLength
210
217
  })
211
218
  }
212
219
 
@@ -220,125 +227,29 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
220
227
  handleSearchbusinessAndProducts(true)
221
228
  }, [])
222
229
 
223
-
230
+
224
231
  useEffect(() => {
225
232
  handleChangeTermValue('')
226
233
  }, [isFocused])
227
234
 
228
- const MaxSectionItem = ({ title, options, filter }: any) => {
229
- const parseValue = (option: number) => {
230
- return filter === 'max_distance'
231
- ? `${option / 1000} ${t('KM', 'Km')}`
232
- : filter === 'max_eta'
233
- ? `${option} ${t('MIN', 'min')}`
234
- : parsePrice(option)
235
- }
236
- return (
237
- <View style={{ marginBottom: 20 }}>
238
- <OText weight='bold' mBottom={10} size={16}>
239
- {title}
240
- </OText>
241
- <ProgressContentWrapper>
242
- <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
243
- </ProgressContentWrapper>
244
- <View style={styles.maxContainer}>
245
- {options.map((option: any, i: number) => (
246
- <TouchableOpacity
247
- onPress={() => handleChangeFilters(filter, option)}
248
- key={option}
249
- >
250
- <OText
251
- size={12}
252
- weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
253
- >
254
- {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
255
- </OText>
256
- </TouchableOpacity>
257
- ))}
258
- </View>
259
- </View>
260
- )
261
- }
262
-
263
- const BusinessControllerSkeletons = () => {
264
- return (
265
- <>
266
- {[
267
- ...Array(
268
- paginationProps.nextPageItems
269
- ? paginationProps.nextPageItems
270
- : 3,
271
- ).keys(),
272
- ].map((item, i) => (
273
- <Placeholder
274
- Animation={Fade}
275
- key={i}
276
- style={{ width: 320, marginRight: 20, marginTop: 20 }}>
277
- <View style={{ width: 320 }}>
278
- <PlaceholderLine
279
- height={155}
280
- style={{ marginBottom: 20, borderRadius: 25 }}
281
- />
282
- <View style={{ paddingHorizontal: 10 }}>
283
- <View
284
- style={{
285
- flexDirection: 'row',
286
- justifyContent: 'space-between',
287
- }}>
288
- <PlaceholderLine
289
- height={25}
290
- width={40}
291
- style={{ marginBottom: 10 }}
292
- />
293
- <PlaceholderLine
294
- height={25}
295
- width={20}
296
- style={{ marginBottom: 10 }}
297
- />
298
- </View>
299
- <PlaceholderLine
300
- height={20}
301
- width={30}
302
- style={{ marginBottom: 10 }}
303
- />
304
- <PlaceholderLine
305
- height={20}
306
- width={80}
307
- style={{ marginBottom: 0 }}
308
- />
309
- </View>
310
- </View>
311
- </Placeholder>
312
- ))}
313
- </>
314
- )
315
- }
316
-
317
235
  return (
318
- <ScrollView style={styles.container}>
319
- <WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
320
- <OText
321
- size={20}
322
- mBottom={15}
323
- weight='bold'
324
- style={{ marginTop: 10 }}
325
- >
326
- {t('SEARCH', 'Search')}
327
- </OText>
328
- </WrapHeader>
236
+ <BContainer
237
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
238
+ >
329
239
  <SearchWrapper>
330
- {isFocused && (
331
- <SearchBar
332
- autoFocus
333
- lazyLoad
334
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
335
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
336
- onSearch={(val: string) => handleChangeTermValue(val)}
337
- value={termValue}
338
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
339
- />
340
- )}
240
+ <SearchBar
241
+ lazyLoad
242
+ {...(isChewLayout && { height: 55 })}
243
+ inputStyle={{ ...styles.searchInput }}
244
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
245
+ onSearch={(val: string) => handleChangeTermValue(val)}
246
+ value={termValue}
247
+ iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
248
+ />
341
249
  </SearchWrapper>
250
+ <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
251
+ {t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
252
+ </OText>
342
253
  {
343
254
  noResults && (
344
255
  <View>
@@ -348,31 +259,48 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
348
259
  </View>
349
260
  )
350
261
  }
351
- {businessesSearchList.businesses?.length > 0 && (
262
+ {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
352
263
  <MyOrders
353
264
  hideOrders
354
265
  businessesSearchList={businessesSearchList}
355
266
  onNavigationRedirect={onNavigationRedirect}
356
267
  BusinessControllerSkeletons={BusinessControllerSkeletons}
268
+ businessPaginationProps={paginationProps}
269
+ franchiseId={brandId}
270
+ hideBackBtn
271
+ titleStyle={{
272
+ paddingHorizontal: 0,
273
+ marginTop: 0,
274
+ marginLeft: 0
275
+ }}
357
276
  />
358
277
  )}
359
278
 
360
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
361
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
362
- {t('BUSINESSES', 'Businesses')}
363
- </OText>
364
- </OptionTitle>
365
- <ScrollView horizontal>
279
+ {businessesSearchList.businesses?.length > 0 && (
280
+ <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
281
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
282
+ {t('BUSINESSES', 'Businesses')}
283
+ </OText>
284
+ </OptionTitle>
285
+ )}
286
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
366
287
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
367
- <BusinessController
288
+ <View
368
289
  key={business.id}
369
- business={business}
370
- isBusinessOpen={business.open}
371
- handleCustomClick={() => onBusinessClick(business)}
372
- handleUpdateBusinessList={handleUpdateBusinessList}
373
- orderType={orderState?.options?.type}
374
- style={{ width: screenWidth - 80, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
375
- />
290
+ style={{
291
+ width: screenWidth - 120,
292
+ marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
293
+ }}
294
+ >
295
+ <BusinessController
296
+ business={business}
297
+ isBusinessOpen={business.open}
298
+ enableIntersection={false}
299
+ handleCustomClick={() => onBusinessClick(business)}
300
+ handleUpdateBusinessList={handleUpdateBusinessList}
301
+ orderType={orderState?.options?.type}
302
+ />
303
+ </View>
376
304
  ))}
377
305
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
378
306
  <LoadMoreBusinessContainer>
@@ -386,7 +314,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
386
314
  </LoadMoreBusinessContainer>
387
315
  )}
388
316
  {businessesSearchList.loading && (
389
- <BusinessControllerSkeletons />
317
+ <BusinessControllerSkeletons paginationProps={paginationProps} />
390
318
  )}
391
319
  </ScrollView>
392
320
  <ProductsList>
@@ -433,17 +361,18 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
433
361
  style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
434
362
  />
435
363
  </SingleBusinessContainer>
436
- <ScrollView horizontal style={styles.productsContainer}>
364
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
437
365
  {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
438
366
  <SingleProductCard
439
367
  key={product?.id}
440
368
  isSoldOut={(product.inventoried && !product.quantity)}
441
369
  product={product}
370
+ enableIntersection={false}
442
371
  businessId={business?.id}
443
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
372
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
444
373
  productAddedToCartLength={0}
445
374
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
446
- style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
375
+ style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
447
376
  />
448
377
  )))}
449
378
 
@@ -469,7 +398,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
469
398
  </View>
470
399
  </Placeholder>
471
400
  <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
472
- <View style={{ flexDirection: 'row-reverse' }}>
401
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
473
402
  <PlaceholderLine
474
403
  width={24}
475
404
  height={70}
@@ -586,22 +515,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
586
515
  </PriceFilterWrapper>
587
516
  {orderState?.options?.type === 1 && (
588
517
  <MaxSectionItem
518
+ filters={filters}
589
519
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
590
520
  options={maxDeliveryFeeOptions}
591
521
  filter='max_delivery_price'
522
+ handleChangeFilters={handleChangeFilters}
592
523
  />
593
524
  )}
594
525
  {[1, 2].includes(orderState?.options?.type) && (
595
526
  <MaxSectionItem
527
+ filters={filters}
596
528
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
597
529
  options={maxTimeOptions}
598
530
  filter='max_eta'
531
+ handleChangeFilters={handleChangeFilters}
599
532
  />
600
533
  )}
601
534
  <MaxSectionItem
535
+ filters={filters}
602
536
  title={t('MAX_DISTANCE', 'Max distance')}
603
537
  options={maxDistanceOptions}
604
538
  filter='max_distance'
539
+ handleChangeFilters={handleChangeFilters}
605
540
  />
606
541
  {businessTypes?.length > 0 && (
607
542
  <TagsContainer>
@@ -621,14 +556,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
621
556
  </TagsContainer>
622
557
  )}
623
558
  </ScrollView>
624
- <OButton
625
- text={t('APPLY', 'Apply')}
626
- parentStyle={styles.applyButton}
627
- textStyle={{ color: '#fff' }}
628
- onClick={() => handleApplyFilters()}
629
- />
559
+ <WrapperButtons>
560
+ <View style={{ width: '50%' }}>
561
+ <OButton
562
+ text={t('APPLY', 'Apply')}
563
+ parentStyle={styles.applyButton}
564
+ textStyle={{ color: '#fff' }}
565
+ onClick={() => handleApplyFilters()}
566
+ />
567
+ </View>
568
+ <View style={{ width: '50%' }}>
569
+ <OButton
570
+ text={t('CLEAR_FILTERS', 'Clear')}
571
+ bgColor={theme.colors.white}
572
+ borderColor={theme.colors.primary}
573
+ parentStyle={styles.applyButton}
574
+ textStyle={{ color: theme.colors.primary }}
575
+ onClick={() => clearFilters()}
576
+ />
577
+ </View>
578
+ </WrapperButtons>
630
579
  </OModal>
631
- </ScrollView>
580
+ </BContainer>
632
581
  )
633
582
  }
634
583
 
@@ -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``