ordering-ui-react-native 0.15.37 → 0.15.38-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 (189) hide show
  1. package/package.json +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +8 -2
  5. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +23 -3
  8. package/src/components/DriverTips/index.tsx +11 -6
  9. package/src/components/LanguageSelector/index.tsx +7 -2
  10. package/src/components/LoginForm/index.tsx +3 -1
  11. package/src/components/OrderDetails/index.tsx +2 -2
  12. package/src/components/PaymentOptions/index.tsx +9 -16
  13. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  14. package/src/components/SignupForm/index.tsx +3 -1
  15. package/src/components/SingleProductCard/index.tsx +16 -4
  16. package/src/components/StripeElementsForm/index.tsx +27 -48
  17. package/src/components/StripeMethodForm/index.tsx +1 -2
  18. package/src/components/UpsellingProducts/index.tsx +1 -1
  19. package/src/components/UserProfileForm/index.tsx +63 -6
  20. package/src/components/UserProfileForm/styles.tsx +8 -0
  21. package/src/components/VerifyPhone/styles.tsx +1 -2
  22. package/src/components/shared/OModal.tsx +1 -1
  23. package/src/config.json +0 -2
  24. package/src/hooks/useCountdownTimer.tsx +26 -0
  25. package/src/navigators/CheckoutNavigator.tsx +6 -0
  26. package/src/navigators/HomeNavigator.tsx +12 -0
  27. package/src/pages/BusinessProductsList.tsx +1 -0
  28. package/src/pages/BusinessesListing.tsx +1 -1
  29. package/src/pages/Checkout.tsx +1 -1
  30. package/src/pages/MultiCheckout.tsx +31 -0
  31. package/src/pages/MultiOrdersDetails.tsx +27 -0
  32. package/src/pages/Sessions.tsx +22 -0
  33. package/src/theme.json +0 -1
  34. package/src/types/index.tsx +5 -11
  35. package/src/utils/index.tsx +68 -1
  36. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  37. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  38. package/themes/business/src/components/Chat/index.tsx +38 -86
  39. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  40. package/themes/business/src/components/Home/index.tsx +128 -55
  41. package/themes/business/src/components/Home/styles.tsx +8 -1
  42. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  43. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  44. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  45. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  46. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  47. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  48. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  49. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  50. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  51. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  52. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  53. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/shared/OModal.tsx +1 -1
  56. package/themes/business/src/types/index.tsx +5 -1
  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/Cart/index.tsx +99 -25
  61. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  62. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  63. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  64. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  65. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  66. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  67. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  68. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  69. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  70. package/themes/kiosk/src/components/ProductForm/index.tsx +2 -2
  71. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  72. package/themes/kiosk/src/types/index.d.ts +2 -0
  73. package/themes/original/index.tsx +180 -1
  74. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  75. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  76. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  77. package/themes/original/src/components/AddressList/index.tsx +56 -18
  78. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  79. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  80. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  81. package/themes/original/src/components/BusinessController/index.tsx +56 -19
  82. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  83. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  84. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  85. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  86. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  87. package/themes/original/src/components/BusinessListingSearch/index.tsx +200 -58
  88. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  89. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  90. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  91. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  92. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +116 -26
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  97. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  98. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  99. package/themes/original/src/components/BusinessesListing/index.tsx +127 -67
  100. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  101. package/themes/original/src/components/Cart/index.tsx +60 -43
  102. package/themes/original/src/components/CartContent/index.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +49 -35
  104. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  105. package/themes/original/src/components/Favorite/index.tsx +91 -0
  106. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  107. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  108. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  109. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  110. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  111. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  112. package/themes/original/src/components/Help/index.tsx +21 -4
  113. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  114. package/themes/original/src/components/Home/index.tsx +1 -1
  115. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  117. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  118. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  119. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  120. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  121. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  122. package/themes/original/src/components/Messages/index.tsx +6 -1
  123. package/themes/original/src/components/Messages/styles.tsx +1 -3
  124. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  125. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  126. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  128. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  129. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  130. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  132. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  133. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  134. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  135. package/themes/original/src/components/OrderDetails/index.tsx +50 -35
  136. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  137. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  138. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  139. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  140. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  141. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  142. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  143. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  144. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  145. package/themes/original/src/components/OrdersOption/index.tsx +133 -41
  146. package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
  147. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  148. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  149. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  150. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  151. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  152. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  153. package/themes/original/src/components/ProductForm/index.tsx +74 -66
  154. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  155. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  156. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  157. package/themes/original/src/components/Promotions/index.tsx +250 -0
  158. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  159. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  160. package/themes/original/src/components/Sessions/index.tsx +160 -0
  161. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  162. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  165. package/themes/original/src/components/SingleProductCard/index.tsx +95 -32
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  167. package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
  168. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  169. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  170. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  171. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  172. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  173. package/themes/original/src/components/UserProfile/index.tsx +62 -8
  174. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  175. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  176. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  177. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  178. package/themes/original/src/components/Wallets/index.tsx +76 -9
  179. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  180. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  181. package/themes/original/src/components/shared/OModal.tsx +4 -2
  182. package/themes/original/src/components/shared/index.tsx +2 -0
  183. package/themes/original/src/config/constants.tsx +6 -6
  184. package/themes/original/src/types/index.tsx +132 -9
  185. package/themes/original/src/utils/index.tsx +28 -2
  186. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  187. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  188. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  189. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -9,7 +9,7 @@ import { useTheme } from 'styled-components/native';
9
9
  import { OIcon, OText } from '../shared';
10
10
  import { StyleSheet, useWindowDimensions, View } from 'react-native';
11
11
  import { BusinessControllerParams } from '../../types';
12
- import { convertHoursToMinutes } from '../../utils';
12
+ import { convertHoursToMinutes, shape } from '../../utils';
13
13
  import {
14
14
  Card,
15
15
  BusinessHero,
@@ -20,6 +20,7 @@ import {
20
20
  BusinessState,
21
21
  BusinessLogo,
22
22
  Reviews,
23
+ RibbonBox
23
24
  } from './styles';
24
25
 
25
26
  export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
@@ -97,6 +98,24 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
97
98
 
98
99
  return (
99
100
  <Card activeOpacity={1} onPress={() => handleClick(business)}>
101
+ {business?.ribbon?.enabled && (
102
+ <RibbonBox
103
+ bgColor={business?.ribbon?.color}
104
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
105
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
106
+ >
107
+ <OText
108
+ size={10}
109
+ weight={'400'}
110
+ color={theme.colors.white}
111
+ numberOfLines={2}
112
+ ellipsizeMode='tail'
113
+ lineHeight={13}
114
+ >
115
+ {business?.ribbon?.text}
116
+ </OText>
117
+ </RibbonBox>
118
+ )}
100
119
  <BusinessHero>
101
120
  <BusinessLogo>
102
121
  <OIcon
@@ -4,6 +4,7 @@ export const Card = styled.TouchableOpacity`
4
4
  margin-vertical: 4px;
5
5
  height: 60px;
6
6
  overflow: hidden;
7
+ position: relative;
7
8
  `;
8
9
 
9
10
  export const BusinessHero = styled.View`
@@ -48,3 +49,25 @@ export const BusinessLogo = styled.View`
48
49
  export const Reviews = styled.View`
49
50
  flex-direction: row;
50
51
  `
52
+
53
+ export const RibbonBox = styled.View`
54
+ position: absolute;
55
+ z-index: 1;
56
+ top: 0px;
57
+ right: 5px;
58
+ background-color: ${(props: any) => props.theme.colors.primary};
59
+ padding: 1px 8px;
60
+ max-width: 160px;
61
+
62
+ ${(props: any) => props.bgColor && css`
63
+ background-color: ${props.bgColor};
64
+ `}
65
+
66
+ ${(props: any) => props.isRoundRect && css`
67
+ border-radius: 7.6px;
68
+ `}
69
+
70
+ ${(props: any) => props.isCapsule && css`
71
+ border-radius: 50px;
72
+ `}
73
+ `
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
2
  import { TouchableOpacity, View } from 'react-native';
3
- import { useOrder, useLanguage, useUtils } from 'ordering-components/native';
3
+ import { useOrder, useLanguage, useUtils, useConfig } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
6
6
  BIContainer,
@@ -21,17 +21,20 @@ export const BusinessItemAccordion = (props: any) => {
21
21
  singleBusiness,
22
22
  handleClearProducts,
23
23
  handleClickCheckout,
24
- checkoutButtonDisabled
24
+ checkoutButtonDisabled,
25
+ isMultiCheckout
25
26
  } = props
26
27
 
27
28
  const [orderState] = useOrder();
28
29
  const [, t] = useLanguage();
29
30
  const [{ parsePrice }] = useUtils();
31
+ const [{ configs }] = useConfig()
30
32
  const theme = useTheme();
31
33
 
32
34
  const isCartPending = cart?.status === 2
33
35
  const isClosed = !cart?.valid_schedule
34
36
  const isProducts = cart?.products?.length
37
+ const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
35
38
 
36
39
  const [isActive, setActiveState] = useState(!!singleBusiness)
37
40
 
@@ -44,7 +47,7 @@ export const BusinessItemAccordion = (props: any) => {
44
47
  }, [orderState?.carts])
45
48
 
46
49
  return (
47
- <BIContainer isClosed={isClosed} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
50
+ <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
48
51
  <BIHeader
49
52
  isClosed={isClosed}
50
53
  onPress={() => !isClosed ? setActiveState(!isActive) : isClosed}
@@ -90,7 +93,7 @@ export const BusinessItemAccordion = (props: any) => {
90
93
  </OAlert>
91
94
  </>
92
95
  )}
93
- {props.handleChangeStore && (
96
+ {isBusinessChangeEnabled && props.handleChangeStore && (
94
97
  <>
95
98
  <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
96
99
  <TouchableOpacity
@@ -139,7 +142,7 @@ export const BusinessItemAccordion = (props: any) => {
139
142
  )}
140
143
  </BIActions>
141
144
  </BIHeader>
142
- {!isActive && !isClosed && !!isProducts && (
145
+ {!isActive && !isClosed && !!isProducts && !isMultiCheckout && (
143
146
  <PriceContainer>
144
147
  <OText>{parsePrice(cart?.total)}</OText>
145
148
  {cart?.valid_products && (
@@ -7,7 +7,9 @@ export const BIContainer = styled.View`
7
7
  opacity: 1;
8
8
  border-radius: 7.6px;
9
9
  overflow: hidden;
10
- min-height: 120px;
10
+ ${(props: any) => !props.isMultiCheckout && css`
11
+ min-height: 120px;
12
+ `}
11
13
  ${(props: any) => props.isClosed && css`
12
14
  opacity: 0.5;
13
15
  min-height: 60px;
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
3
- import { ScrollView, StyleSheet, TouchableOpacity, Platform, View } from 'react-native'
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
6
  import { OButton, OIcon, OModal, OText } from '../shared'
@@ -22,15 +22,20 @@ import {
22
22
  ProgressContentWrapper,
23
23
  ProgressBar,
24
24
  TagsContainer,
25
- SortContainer
25
+ SortContainer,
26
+ BrandContainer,
27
+ BrandItem,
28
+ PriceFilterWrapper,
29
+ OptionTitle
26
30
  } from './styles'
27
31
  import FastImage from 'react-native-fast-image'
28
32
  import { convertHoursToMinutes } from '../../utils'
29
33
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
30
34
  import { BusinessSearchParams } from '../../types'
35
+ import { MyOrders } from '../MyOrders'
31
36
 
32
- export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
33
37
 
38
+ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
34
39
  const {
35
40
  navigation,
36
41
  businessesSearchList,
@@ -42,9 +47,15 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
42
47
  handleChangeFilters,
43
48
  filters,
44
49
  businessTypes,
45
- setFilters
50
+ setFilters,
51
+ brandList,
52
+ onNavigationRedirect,
53
+ handleUpdateBusinessList,
54
+ handleUpdateProducts
46
55
  } = props
47
56
 
57
+ const screenHeight = Dimensions.get('window').height;
58
+ const screenWidth = Dimensions.get('window').width;
48
59
  const theme = useTheme()
49
60
  const [orderState] = useOrder()
50
61
  const { top } = useSafeAreaInsets();
@@ -63,11 +74,24 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
63
74
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
64
75
  ]
65
76
 
77
+ const priceList = [
78
+ { level: '1', content: '$' },
79
+ { level: '2', content: '$$' },
80
+ { level: '3', content: '$$$' },
81
+ { level: '4', content: '$$$$' },
82
+ { level: '5', content: '$$$$$' }
83
+ ]
84
+
66
85
  const styles = StyleSheet.create({
67
86
  container: {
68
87
  paddingHorizontal: 40,
69
88
  width: '100%'
70
89
  },
90
+ filterContainer: {
91
+ maxHeight: screenHeight - 150,
92
+ paddingHorizontal: 40,
93
+ width: '100%'
94
+ },
71
95
  searchInput: {
72
96
  fontSize: 10,
73
97
  },
@@ -84,6 +108,12 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
84
108
  flexWrap: 'wrap',
85
109
  justifyContent: 'center'
86
110
  },
111
+ priceContainer: {
112
+ width: '100%',
113
+ flexDirection: 'row',
114
+ flexWrap: 'wrap',
115
+ justifyContent: 'space-between'
116
+ },
87
117
  categoryStyle: {
88
118
  marginRight: 10,
89
119
  marginTop: 10,
@@ -95,6 +125,16 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
95
125
  height: 28,
96
126
  borderWidth: 0
97
127
  },
128
+ priceItem: {
129
+ marginRight: 10,
130
+ marginTop: 10,
131
+ borderRadius: 50,
132
+ paddingVertical: 4,
133
+ paddingLeft: 5,
134
+ paddingRight: 5,
135
+ height: 27,
136
+ borderWidth: 0
137
+ },
98
138
  applyButton: {
99
139
  paddingHorizontal: 40,
100
140
  width: '100%',
@@ -107,7 +147,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
107
147
  }
108
148
 
109
149
  const handleCloseFilters = () => {
110
- setFilters({ business_types: [], orderBy: 'default' })
150
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
111
151
  setOpenFilters(false)
112
152
  }
113
153
 
@@ -126,6 +166,18 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
126
166
  }
127
167
  }
128
168
 
169
+ const handleChangeBrandFilter = (brandId: number) => {
170
+ let franchiseIds = [...filters?.franchise_ids]
171
+ if (filters?.franchise_ids?.includes(brandId)) franchiseIds = filters?.franchise_ids?.filter((item: any) => item !== brandId)
172
+ else franchiseIds.push(brandId)
173
+ handleChangeFilters && handleChangeFilters('franchise_ids', franchiseIds)
174
+ }
175
+
176
+ const handleChangePriceRange = (value: string) => {
177
+ if (value === filters?.price_level) handleChangeFilters('price_level', null)
178
+ else handleChangeFilters('price_level', value)
179
+ }
180
+
129
181
  const handleApplyFilters = () => {
130
182
  handleSearchbusinessAndProducts(true)
131
183
  setOpenFilters(false)
@@ -137,6 +189,10 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
137
189
  }
138
190
  }, [filters, openFilters])
139
191
 
192
+ useEffect(() => {
193
+ handleSearchbusinessAndProducts(true)
194
+ }, [])
195
+
140
196
  const MaxSectionItem = ({ title, options, filter }: any) => {
141
197
  const parseValue = (option: number) => {
142
198
  return filter === 'max_distance'
@@ -172,6 +228,60 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
172
228
  )
173
229
  }
174
230
 
231
+ const BusinessControllerSkeletons = () => {
232
+ return (
233
+ <>
234
+ {[
235
+ ...Array(
236
+ paginationProps.nextPageItems
237
+ ? paginationProps.nextPageItems
238
+ : 3,
239
+ ).keys(),
240
+ ].map((item, i) => (
241
+ <Placeholder
242
+ Animation={Fade}
243
+ key={i}
244
+ style={{ width: 320, marginRight: 20, marginTop: 20 }}>
245
+ <View style={{ width: 320 }}>
246
+ <PlaceholderLine
247
+ height={155}
248
+ style={{ marginBottom: 20, borderRadius: 25 }}
249
+ />
250
+ <View style={{ paddingHorizontal: 10 }}>
251
+ <View
252
+ style={{
253
+ flexDirection: 'row',
254
+ justifyContent: 'space-between',
255
+ }}>
256
+ <PlaceholderLine
257
+ height={25}
258
+ width={40}
259
+ style={{ marginBottom: 10 }}
260
+ />
261
+ <PlaceholderLine
262
+ height={25}
263
+ width={20}
264
+ style={{ marginBottom: 10 }}
265
+ />
266
+ </View>
267
+ <PlaceholderLine
268
+ height={20}
269
+ width={30}
270
+ style={{ marginBottom: 10 }}
271
+ />
272
+ <PlaceholderLine
273
+ height={20}
274
+ width={80}
275
+ style={{ marginBottom: 0 }}
276
+ />
277
+ </View>
278
+ </View>
279
+ </Placeholder>
280
+ ))}
281
+ </>
282
+ )
283
+ }
284
+
175
285
  return (
176
286
  <ScrollView style={styles.container}>
177
287
  <WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
@@ -207,6 +317,20 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
207
317
  </View>
208
318
  )
209
319
  }
320
+ {businessesSearchList.businesses?.length > 0 && (
321
+ <MyOrders
322
+ hideOrders
323
+ businessesSearchList={businessesSearchList}
324
+ onNavigationRedirect={onNavigationRedirect}
325
+ BusinessControllerSkeletons={BusinessControllerSkeletons}
326
+ />
327
+ )}
328
+
329
+ <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
330
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
331
+ {t('BUSINESSES', 'Businesses')}
332
+ </OText>
333
+ </OptionTitle>
210
334
  <ScrollView horizontal>
211
335
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
212
336
  <BusinessController
@@ -214,8 +338,9 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
214
338
  business={business}
215
339
  isBusinessOpen={business.open}
216
340
  handleCustomClick={() => onBusinessClick(business)}
341
+ handleUpdateBusinessList={handleUpdateBusinessList}
217
342
  orderType={orderState?.options?.type}
218
- style={{ width: 320, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
343
+ style={{ width: screenWidth - 80, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
219
344
  />
220
345
  ))}
221
346
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
@@ -230,55 +355,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
230
355
  </LoadMoreBusinessContainer>
231
356
  )}
232
357
  {businessesSearchList.loading && (
233
- <>
234
- {[
235
- ...Array(
236
- paginationProps.nextPageItems
237
- ? paginationProps.nextPageItems
238
- : 3,
239
- ).keys(),
240
- ].map((item, i) => (
241
- <Placeholder
242
- Animation={Fade}
243
- key={i}
244
- style={{ width: 320, marginRight: 20, marginTop: 20 }}>
245
- <View style={{ width: 320 }}>
246
- <PlaceholderLine
247
- height={155}
248
- style={{ marginBottom: 20, borderRadius: 25 }}
249
- />
250
- <View style={{ paddingHorizontal: 10 }}>
251
- <View
252
- style={{
253
- flexDirection: 'row',
254
- justifyContent: 'space-between',
255
- }}>
256
- <PlaceholderLine
257
- height={25}
258
- width={40}
259
- style={{ marginBottom: 10 }}
260
- />
261
- <PlaceholderLine
262
- height={25}
263
- width={20}
264
- style={{ marginBottom: 10 }}
265
- />
266
- </View>
267
- <PlaceholderLine
268
- height={20}
269
- width={30}
270
- style={{ marginBottom: 10 }}
271
- />
272
- <PlaceholderLine
273
- height={20}
274
- width={80}
275
- style={{ marginBottom: 0 }}
276
- />
277
- </View>
278
- </View>
279
- </Placeholder>
280
- ))}
281
- </>
358
+ <BusinessControllerSkeletons />
282
359
  )}
283
360
  </ScrollView>
284
361
  <ProductsList>
@@ -334,7 +411,8 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
334
411
  businessId={business?.id}
335
412
  onProductClick={() => { }}
336
413
  productAddedToCartLength={0}
337
- style={{ width: 320, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
414
+ handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
415
+ style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
338
416
  />
339
417
  )))}
340
418
 
@@ -384,7 +462,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
384
462
  onCancel={() => handleCloseFilters()}
385
463
  onClose={() => handleCloseFilters()}
386
464
  >
387
- <ScrollView style={styles.container}>
465
+ <ScrollView style={styles.filterContainer}>
388
466
  <OText
389
467
  size={20}
390
468
  mBottom={15}
@@ -402,7 +480,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
402
480
  onPress={() => handleChangeFilters('orderBy', item?.value)}
403
481
  style={{ marginBottom: 7 }}
404
482
  >
405
- <OText
483
+ <OText
406
484
  weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
407
485
  mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
408
486
  >
@@ -411,6 +489,70 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
411
489
  </TouchableOpacity>
412
490
  ))}
413
491
  </SortContainer>
492
+ <BrandContainer>
493
+ <OText
494
+ size={16}
495
+ weight='bold'
496
+ lineHeight={24}
497
+ style={{ marginBottom: 10 }}
498
+ >
499
+ {t('BRANDS', 'Brands')}
500
+ </OText>
501
+ {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
502
+ <ScrollView
503
+ style={{ maxHeight: 300, marginBottom: 10 }}
504
+ showsVerticalScrollIndicator={true}
505
+ nestedScrollEnabled={true}
506
+ >
507
+ {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
508
+ <BrandItem
509
+ key={i}
510
+ onPress={() => handleChangeBrandFilter(brand?.id)}
511
+ >
512
+ <OText
513
+ size={14}
514
+ weight={'400'}
515
+ lineHeight={24}
516
+ >
517
+ {brand?.name}
518
+ </OText>
519
+ {filters?.franchise_ids?.includes(brand?.id) && (
520
+ <AntDesignIcon
521
+ name='check'
522
+ color={theme.colors.success500}
523
+ size={16}
524
+ />
525
+ )}
526
+ </BrandItem>
527
+ ))}
528
+ </ScrollView>
529
+ )}
530
+ {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
531
+ <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
532
+ )}
533
+ </BrandContainer>
534
+ <PriceFilterWrapper>
535
+ <OText
536
+ size={16}
537
+ weight='bold'
538
+ lineHeight={24}
539
+ style={{ marginBottom: 5 }}
540
+ >
541
+ {t('PRICE_RANGE', 'Price range')}
542
+ </OText>
543
+ <View style={styles.priceContainer}>
544
+ {priceList.map((price: any, i: number) => (
545
+ <OButton
546
+ key={i}
547
+ bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
548
+ onClick={() => handleChangePriceRange(price?.level)}
549
+ text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
550
+ style={styles.priceItem}
551
+ textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
552
+ />
553
+ ))}
554
+ </View>
555
+ </PriceFilterWrapper>
414
556
  {orderState?.options?.type === 1 && (
415
557
  <MaxSectionItem
416
558
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components/native'
1
+ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const WrapHeader = styled.View`
4
4
  width: 100%;
@@ -68,9 +68,29 @@ export const ProgressContentWrapper = styled.View`
68
68
  `
69
69
 
70
70
  export const TagsContainer = styled.View`
71
-
71
+ padding-bottom: 10px;
72
72
  `
73
73
 
74
74
  export const SortContainer = styled.View`
75
75
  margin-bottom: 10px;
76
76
  `
77
+
78
+ export const BrandContainer = styled.View``
79
+
80
+ export const BrandItem = styled.TouchableOpacity`
81
+ flex-direction: row;
82
+ justify-content: space-between;
83
+ margin-bottom: 4px;
84
+ align-items: center;
85
+ `
86
+
87
+ export const PriceFilterWrapper = styled.View`
88
+ margin-bottom: 20px;
89
+ `
90
+
91
+ export const OptionTitle = styled.View`
92
+ margin-top: 24px;
93
+ ${(props: any) => props.titleContent && css`
94
+ margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
95
+ `}
96
+ `
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import { useLanguage, BusinessMenuListing } from 'ordering-components/native'
3
3
  import { OText } from '../shared'
4
4
  import { BusinessMenuListParams } from '../../types'
@@ -19,7 +19,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
19
19
 
20
20
  const [, t] = useLanguage()
21
21
  const theme = useTheme()
22
- const {top} = useSafeAreaInsets()
22
+ const { top } = useSafeAreaInsets()
23
23
 
24
24
  const styles = StyleSheet.create({
25
25
  container: {
@@ -36,7 +36,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
36
36
  height: 44,
37
37
  width: '100%'
38
38
  }
39
- })
39
+ })
40
40
 
41
41
  const dropDownIcon = () => {
42
42
  return (
@@ -48,12 +48,18 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
48
48
  )
49
49
  }
50
50
 
51
+ useEffect(() => {
52
+ if (!businessMenuList?.loading && businessMenuList?.menus?.length === 1){
53
+ setMenu(businessMenuList?.menus[0])
54
+ }
55
+ }, [businessMenuList?.menus])
56
+
51
57
  return (
52
58
  <>
53
59
  {businessMenuList.loading ? (
54
60
  <Placeholder Animation={Fade}>
55
61
  <View>
56
- <PlaceholderLine height={44}/>
62
+ <PlaceholderLine height={44} />
57
63
  </View>
58
64
  </Placeholder>
59
65
  ) : (
@@ -67,6 +73,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
67
73
  onSelect={(selectedItem, index) => {
68
74
  setMenu(selectedItem)
69
75
  }}
76
+ defaultValue={businessMenuList?.menus?.length === 1 && businessMenuList?.menus[0]}
70
77
  buttonTextAfterSelection={(selectedItem, index) => {
71
78
  return selectedItem.name
72
79
  }}