ordering-ui-react-native 0.16.68 → 0.16.69-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 (201) 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 +19 -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/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/index.tsx +111 -74
  27. package/themes/business/src/components/MapView/index.tsx +14 -3
  28. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  30. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
  31. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  32. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  33. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  34. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  35. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  36. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  37. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  41. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  42. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  43. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  44. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  45. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  46. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  47. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  48. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  49. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  50. package/themes/business/src/components/shared/OLink.tsx +33 -13
  51. package/themes/business/src/components/shared/OText.tsx +8 -2
  52. package/themes/business/src/types/index.tsx +14 -3
  53. package/themes/business/src/utils/index.tsx +10 -0
  54. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  56. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  58. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  59. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  60. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  61. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  62. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  63. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  64. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  65. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  66. package/themes/kiosk/src/types/index.d.ts +2 -0
  67. package/themes/original/index.tsx +6 -0
  68. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  69. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  70. package/themes/original/src/components/AddressList/index.tsx +18 -18
  71. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  72. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  73. package/themes/original/src/components/BusinessBasicInformation/index.tsx +49 -33
  74. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  75. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  76. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  77. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  78. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  80. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -142
  82. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  83. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  84. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  85. package/themes/original/src/components/BusinessProductsList/index.tsx +41 -62
  86. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +561 -479
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  89. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  90. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +93 -98
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  93. package/themes/original/src/components/BusinessesListing/index.tsx +8 -8
  94. package/themes/original/src/components/Cart/index.tsx +63 -38
  95. package/themes/original/src/components/CartContent/index.tsx +80 -18
  96. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  97. package/themes/original/src/components/Checkout/index.tsx +110 -114
  98. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  99. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  100. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  101. package/themes/original/src/components/DriverTips/index.tsx +47 -37
  102. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  103. package/themes/original/src/components/Favorite/index.tsx +7 -4
  104. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  105. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  106. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  107. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  108. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  109. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  110. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  111. package/themes/original/src/components/Help/index.tsx +7 -7
  112. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  113. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  114. package/themes/original/src/components/HelpGuide/index.tsx +12 -11
  115. package/themes/original/src/components/HelpGuide/styles.tsx +5 -0
  116. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  117. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  118. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  119. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  120. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  121. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  122. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  123. package/themes/original/src/components/MessageListing/index.tsx +7 -7
  124. package/themes/original/src/components/Messages/index.tsx +35 -20
  125. package/themes/original/src/components/MomentOption/index.tsx +17 -11
  126. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  128. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  129. package/themes/original/src/components/MultiOrdersDetails/index.tsx +60 -33
  130. package/themes/original/src/components/MyOrders/index.tsx +86 -20
  131. package/themes/original/src/components/NavBar/index.tsx +7 -6
  132. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  133. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  134. package/themes/original/src/components/Notifications/index.tsx +144 -0
  135. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  136. package/themes/original/src/components/OrderDetails/index.tsx +114 -15
  137. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  138. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  139. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  140. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  141. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  142. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  143. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  144. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  145. package/themes/original/src/components/OrdersOption/index.tsx +97 -55
  146. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  147. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  148. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  149. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  150. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  151. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  152. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  153. package/themes/original/src/components/ProductForm/index.tsx +212 -253
  154. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  155. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  156. package/themes/original/src/components/ProductOptionSubOption/index.tsx +17 -9
  157. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  158. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  159. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  160. package/themes/original/src/components/Promotions/index.tsx +234 -220
  161. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  162. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  163. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  164. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  165. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  166. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  167. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  168. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  169. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  170. package/themes/original/src/components/ServiceForm/index.tsx +328 -264
  171. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  172. package/themes/original/src/components/SingleOrderCard/index.tsx +129 -54
  173. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  174. package/themes/original/src/components/SingleProductCard/index.tsx +85 -82
  175. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  176. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  177. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  178. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  179. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  180. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  181. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  182. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  183. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  184. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  185. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  186. package/themes/original/src/components/UserProfileForm/index.tsx +19 -28
  187. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  188. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  189. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  190. package/themes/original/src/components/Wallets/index.tsx +176 -164
  191. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  192. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  193. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  194. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  195. package/themes/original/src/components/shared/OButton.tsx +9 -4
  196. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  197. package/themes/original/src/components/shared/OInput.tsx +10 -1
  198. package/themes/original/src/layouts/Container.tsx +13 -9
  199. package/themes/original/src/types/index.tsx +44 -6
  200. package/themes/original/src/utils/index.tsx +103 -58
  201. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,57 @@
1
+ import React from 'react'
2
+ import { View } from 'react-native'
3
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
+
5
+ export const BusinessControllerSkeletons = ({ paginationProps }: any) => {
6
+ return (
7
+ <>
8
+ {[
9
+ ...Array(
10
+ paginationProps.nextPageItems
11
+ ? paginationProps.nextPageItems
12
+ : 3,
13
+ ).keys(),
14
+ ].map((item, i) => (
15
+ <Placeholder
16
+ Animation={Fade}
17
+ key={i}
18
+ style={{ width: 320, marginRight: 20, marginTop: 20 }}>
19
+ <View style={{ width: 320 }}>
20
+ <PlaceholderLine
21
+ height={155}
22
+ style={{ marginBottom: 20, borderRadius: 25 }}
23
+ />
24
+ <View style={{ paddingHorizontal: 10 }}>
25
+ <View
26
+ style={{
27
+ flexDirection: 'row',
28
+ justifyContent: 'space-between',
29
+ }}>
30
+ <PlaceholderLine
31
+ height={25}
32
+ width={40}
33
+ style={{ marginBottom: 10 }}
34
+ />
35
+ <PlaceholderLine
36
+ height={25}
37
+ width={20}
38
+ style={{ marginBottom: 10 }}
39
+ />
40
+ </View>
41
+ <PlaceholderLine
42
+ height={20}
43
+ width={30}
44
+ style={{ marginBottom: 10 }}
45
+ />
46
+ <PlaceholderLine
47
+ height={20}
48
+ width={80}
49
+ style={{ marginBottom: 0 }}
50
+ />
51
+ </View>
52
+ </View>
53
+ </Placeholder>
54
+ ))}
55
+ </>
56
+ )
57
+ }
@@ -0,0 +1,59 @@
1
+ import { useLanguage, useUtils } from 'ordering-components/native'
2
+ import React from 'react'
3
+ import { View, TouchableOpacity, StyleSheet } from 'react-native'
4
+ import { OText } from '../../shared'
5
+
6
+ import { ProgressContentWrapper, ProgressBar } from './styles'
7
+
8
+ export const MaxSectionItem = (props: any) => {
9
+ const {
10
+ filters,
11
+ handleChangeFilters,
12
+ title,
13
+ options,
14
+ filter
15
+ } = props
16
+
17
+ const [, t] = useLanguage()
18
+ const [{ parsePrice }] = useUtils();
19
+
20
+ const styles = StyleSheet.create({
21
+ maxContainer: {
22
+ flexDirection: 'row',
23
+ justifyContent: 'space-between'
24
+ }
25
+ });
26
+
27
+ const parseValue = (option: number) => {
28
+ return filter === 'max_distance'
29
+ ? `${option / 1000} ${t('KM', 'Km')}`
30
+ : filter === 'max_eta'
31
+ ? `${option} ${t('MIN', 'min')}`
32
+ : parsePrice(option)
33
+ }
34
+ return (
35
+ <View style={{ marginBottom: 20 }}>
36
+ <OText weight='bold' mBottom={10} size={16}>
37
+ {title}
38
+ </OText>
39
+ <ProgressContentWrapper>
40
+ <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
41
+ </ProgressContentWrapper>
42
+ <View style={styles.maxContainer}>
43
+ {options.map((option: any, i: number) => (
44
+ <TouchableOpacity
45
+ onPress={() => handleChangeFilters(filter, option)}
46
+ key={option}
47
+ >
48
+ <OText
49
+ size={12}
50
+ weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
51
+ >
52
+ {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
53
+ </OText>
54
+ </TouchableOpacity>
55
+ ))}
56
+ </View>
57
+ </View>
58
+ )
59
+ }
@@ -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,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,123 +227,25 @@ 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
240
  <SearchBar
331
- autoFocus
332
241
  lazyLoad
242
+ {...(isChewLayout && { height: 55 })}
333
243
  inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
334
244
  placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
335
245
  onSearch={(val: string) => handleChangeTermValue(val)}
336
246
  value={termValue}
337
247
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
338
248
  />
339
-
340
249
  </SearchWrapper>
341
250
  {
342
251
  noResults && (
@@ -347,12 +256,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
347
256
  </View>
348
257
  )
349
258
  }
350
- {businessesSearchList.businesses?.length > 0 && (
259
+ {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
351
260
  <MyOrders
352
261
  hideOrders
353
262
  businessesSearchList={businessesSearchList}
354
263
  onNavigationRedirect={onNavigationRedirect}
355
264
  BusinessControllerSkeletons={BusinessControllerSkeletons}
265
+ businessPaginationProps={paginationProps}
266
+ franchiseId={brandId}
267
+ hideBackBtn
268
+ titleStyle={{
269
+ paddingHorizontal: 0,
270
+ marginTop: 0,
271
+ marginLeft: 0
272
+ }}
356
273
  />
357
274
  )}
358
275
 
@@ -361,17 +278,24 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
361
278
  {t('BUSINESSES', 'Businesses')}
362
279
  </OText>
363
280
  </OptionTitle>
364
- <ScrollView horizontal>
281
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
365
282
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
366
- <BusinessController
283
+ <View
367
284
  key={business.id}
368
- business={business}
369
- isBusinessOpen={business.open}
370
- handleCustomClick={() => onBusinessClick(business)}
371
- handleUpdateBusinessList={handleUpdateBusinessList}
372
- orderType={orderState?.options?.type}
373
- style={{ width: screenWidth - 80, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
374
- />
285
+ style={{
286
+ width: screenWidth - 120,
287
+ marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
288
+ }}
289
+ >
290
+ <BusinessController
291
+ business={business}
292
+ isBusinessOpen={business.open}
293
+ enableIntersection={false}
294
+ handleCustomClick={() => onBusinessClick(business)}
295
+ handleUpdateBusinessList={handleUpdateBusinessList}
296
+ orderType={orderState?.options?.type}
297
+ />
298
+ </View>
375
299
  ))}
376
300
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
377
301
  <LoadMoreBusinessContainer>
@@ -385,7 +309,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
385
309
  </LoadMoreBusinessContainer>
386
310
  )}
387
311
  {businessesSearchList.loading && (
388
- <BusinessControllerSkeletons />
312
+ <BusinessControllerSkeletons paginationProps={paginationProps} />
389
313
  )}
390
314
  </ScrollView>
391
315
  <ProductsList>
@@ -432,17 +356,18 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
432
356
  style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
433
357
  />
434
358
  </SingleBusinessContainer>
435
- <ScrollView horizontal style={styles.productsContainer}>
359
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
436
360
  {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
437
361
  <SingleProductCard
438
362
  key={product?.id}
439
363
  isSoldOut={(product.inventoried && !product.quantity)}
440
364
  product={product}
365
+ enableIntersection={false}
441
366
  businessId={business?.id}
442
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
367
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
443
368
  productAddedToCartLength={0}
444
369
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
445
- style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
370
+ style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
446
371
  />
447
372
  )))}
448
373
 
@@ -468,7 +393,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
468
393
  </View>
469
394
  </Placeholder>
470
395
  <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
471
- <View style={{ flexDirection: 'row-reverse' }}>
396
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
472
397
  <PlaceholderLine
473
398
  width={24}
474
399
  height={70}
@@ -585,22 +510,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
585
510
  </PriceFilterWrapper>
586
511
  {orderState?.options?.type === 1 && (
587
512
  <MaxSectionItem
513
+ filters={filters}
588
514
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
589
515
  options={maxDeliveryFeeOptions}
590
516
  filter='max_delivery_price'
517
+ handleChangeFilters={handleChangeFilters}
591
518
  />
592
519
  )}
593
520
  {[1, 2].includes(orderState?.options?.type) && (
594
521
  <MaxSectionItem
522
+ filters={filters}
595
523
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
596
524
  options={maxTimeOptions}
597
525
  filter='max_eta'
526
+ handleChangeFilters={handleChangeFilters}
598
527
  />
599
528
  )}
600
529
  <MaxSectionItem
530
+ filters={filters}
601
531
  title={t('MAX_DISTANCE', 'Max distance')}
602
532
  options={maxDistanceOptions}
603
533
  filter='max_distance'
534
+ handleChangeFilters={handleChangeFilters}
604
535
  />
605
536
  {businessTypes?.length > 0 && (
606
537
  <TagsContainer>
@@ -620,14 +551,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
620
551
  </TagsContainer>
621
552
  )}
622
553
  </ScrollView>
623
- <OButton
624
- text={t('APPLY', 'Apply')}
625
- parentStyle={styles.applyButton}
626
- textStyle={{ color: '#fff' }}
627
- onClick={() => handleApplyFilters()}
628
- />
554
+ <WrapperButtons>
555
+ <View style={{ width: '50%' }}>
556
+ <OButton
557
+ text={t('APPLY', 'Apply')}
558
+ parentStyle={styles.applyButton}
559
+ textStyle={{ color: '#fff' }}
560
+ onClick={() => handleApplyFilters()}
561
+ />
562
+ </View>
563
+ <View style={{ width: '50%' }}>
564
+ <OButton
565
+ text={t('CLEAR_FILTERS', 'Clear')}
566
+ bgColor={theme.colors.white}
567
+ borderColor={theme.colors.primary}
568
+ parentStyle={styles.applyButton}
569
+ textStyle={{ color: theme.colors.primary }}
570
+ onClick={() => clearFilters()}
571
+ />
572
+ </View>
573
+ </WrapperButtons>
629
574
  </OModal>
630
- </ScrollView>
575
+ </BContainer>
631
576
  )
632
577
  }
633
578
 
@@ -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``