ordering-ui-react-native 0.16.47 → 0.16.48-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/Messages/index.tsx +2 -2
  13. package/src/components/NotificationSetting/index.tsx +85 -0
  14. package/src/components/OrdersOption/index.tsx +54 -56
  15. package/src/components/PaymentOptions/index.tsx +298 -345
  16. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  17. package/src/components/ReviewDriver/index.tsx +1 -1
  18. package/src/components/ReviewOrder/index.tsx +2 -2
  19. package/src/components/ReviewProducts/index.tsx +11 -0
  20. package/src/components/SingleProductReview/index.tsx +8 -5
  21. package/src/components/StripeElementsForm/index.tsx +25 -16
  22. package/src/components/VerifyPhone/styles.tsx +1 -2
  23. package/src/components/shared/OBottomPopup.tsx +6 -2
  24. package/src/components/shared/OToast.tsx +4 -4
  25. package/src/index.tsx +2 -0
  26. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  27. package/src/utils/index.tsx +2 -1
  28. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +259 -238
  29. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  30. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  31. package/themes/business/src/components/Chat/index.tsx +40 -32
  32. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  33. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  34. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  35. package/themes/business/src/components/MapView/index.tsx +12 -1
  36. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  37. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  38. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +33 -23
  39. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  40. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  41. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  42. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  45. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  46. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  47. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  49. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  50. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  51. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  52. package/themes/business/src/components/PreviousOrders/index.tsx +331 -243
  53. package/themes/business/src/components/PreviousOrders/styles.tsx +30 -2
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  55. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  56. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  57. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  58. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  59. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  60. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  61. package/themes/business/src/components/shared/OLink.tsx +24 -12
  62. package/themes/business/src/components/shared/OText.tsx +3 -2
  63. package/themes/business/src/types/index.tsx +25 -11
  64. package/themes/business/src/utils/index.tsx +10 -0
  65. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  67. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  68. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  69. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  70. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  71. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  72. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  73. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  74. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  76. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  77. package/themes/kiosk/src/types/index.d.ts +2 -0
  78. package/themes/original/index.tsx +6 -0
  79. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  80. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  81. package/themes/original/src/components/AddressList/index.tsx +1 -1
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
  84. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  85. package/themes/original/src/components/BusinessController/index.tsx +231 -114
  86. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +175 -80
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  99. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +35 -23
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +275 -120
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  104. package/themes/original/src/components/BusinessesListing/index.tsx +80 -25
  105. package/themes/original/src/components/Cart/index.tsx +82 -15
  106. package/themes/original/src/components/Cart/styles.tsx +4 -0
  107. package/themes/original/src/components/CartContent/index.tsx +22 -16
  108. package/themes/original/src/components/Checkout/index.tsx +113 -117
  109. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  110. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  112. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  113. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  114. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  115. package/themes/original/src/components/FloatingButton/index.tsx +13 -11
  116. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  117. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  118. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  119. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  123. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  124. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  125. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  126. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  127. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  128. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  129. package/themes/original/src/components/Messages/index.tsx +35 -20
  130. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  131. package/themes/original/src/components/MultiCart/index.tsx +63 -0
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  133. package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  135. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  136. package/themes/original/src/components/NavBar/index.tsx +11 -5
  137. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  138. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  139. package/themes/original/src/components/Notifications/index.tsx +148 -0
  140. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  141. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  142. package/themes/original/src/components/OrderDetails/index.tsx +200 -39
  143. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  144. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  145. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  146. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  147. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  148. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  149. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  150. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  151. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  152. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  153. package/themes/original/src/components/OrdersOption/index.tsx +102 -56
  154. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  155. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  156. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  157. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  158. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  159. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  160. package/themes/original/src/components/ProductForm/index.tsx +639 -664
  161. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  162. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  163. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  164. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  165. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  166. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  167. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  168. package/themes/original/src/components/Promotions/index.tsx +232 -219
  169. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  170. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  171. package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
  172. package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
  173. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  174. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
  175. package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -0
  176. package/themes/original/src/components/ServiceForm/index.tsx +332 -264
  177. package/themes/original/src/components/SignupForm/index.tsx +160 -113
  178. package/themes/original/src/components/SingleOrderCard/index.tsx +266 -183
  179. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  180. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  181. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  182. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  183. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  184. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  186. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  187. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  188. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  189. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  190. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  192. package/themes/original/src/components/Wallets/index.tsx +176 -164
  193. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  194. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  195. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  196. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  197. package/themes/original/src/components/shared/OButton.tsx +10 -3
  198. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  199. package/themes/original/src/components/shared/OInput.tsx +10 -1
  200. package/themes/original/src/layouts/Container.tsx +13 -9
  201. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  202. package/themes/original/src/types/index.tsx +83 -28
  203. package/themes/original/src/utils/index.tsx +103 -58
  204. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,6 +1,7 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
3
3
  import Geolocation from '@react-native-community/geolocation'
4
+ import { IOScrollView } from 'react-native-intersection-observer'
4
5
  import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
5
6
  import {
6
7
  View,
@@ -18,6 +19,7 @@ import {
18
19
  useOrder,
19
20
  useConfig,
20
21
  useUtils,
22
+ useOrderingTheme
21
23
  } from 'ordering-components/native';
22
24
  import { useTheme } from 'styled-components/native';
23
25
  import Ionicons from 'react-native-vector-icons/Ionicons'
@@ -30,13 +32,14 @@ import {
30
32
  HeaderWrapper,
31
33
  ListWrapper,
32
34
  FeaturedWrapper,
33
- OrderProgressWrapper,
34
35
  FarAwayMessage,
35
- AddressInputContainer
36
+ AddressInputContainer,
37
+ PreorderInput,
38
+ OrderTypesContainer,
39
+ BusinessLogosContainer
36
40
  } from './styles';
37
41
 
38
- import { SearchBar } from '../../../SearchBar';
39
- import { OIcon, OText } from '../../../shared';
42
+ import { OIcon, OText, OModal } from '../../../shared';
40
43
  import { BusinessesListingParams } from '../../../../types';
41
44
  import { NotFoundSource } from '../../../NotFoundSource';
42
45
  import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
@@ -45,9 +48,12 @@ import { OrderTypeSelector } from '../../../OrderTypeSelector';
45
48
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
46
49
  import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
47
50
  import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
48
- import { getTypesText, convertToRadian } from '../../../../utils';
51
+ import { getTypesText } from '../../../../utils';
49
52
  import { OrderProgress } from '../../../OrderProgress';
50
53
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
54
+ import FastImage from 'react-native-fast-image';
55
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
56
+ import { CitiesControl } from '../../../CitiesControl'
51
57
 
52
58
  const PIXELS_TO_SCROLL = 2000;
53
59
 
@@ -55,21 +61,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
55
61
  const {
56
62
  navigation,
57
63
  businessesList,
58
- searchValue,
59
64
  getBusinesses,
60
65
  handleChangeBusinessType,
61
66
  handleBusinessClick,
62
67
  paginationProps,
63
- handleChangeSearch,
64
68
  businessId,
65
69
  isGuestUser,
66
- handleUpdateBusinessList
70
+ handleUpdateBusinessList,
71
+ citiesState,
72
+ actualSlug,
73
+ logosLayout
67
74
  } = props;
68
75
  const theme = useTheme();
76
+ const [orderingTheme] = useOrderingTheme()
69
77
  const isFocused = useIsFocused();
70
78
  const appState = useRef(AppState.currentState)
71
- const [appStateVisible, setAppStateVisible] = useState(appState.current);
79
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
80
+ const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
72
81
  const [refreshing] = useState(false);
82
+ const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
73
83
  const styles = StyleSheet.create({
74
84
  container: {
75
85
  marginBottom: 0,
@@ -113,13 +123,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
113
123
  backgroundColor: theme.colors.white,
114
124
  borderColor: theme.colors.backgroundGray,
115
125
  borderWidth: 1,
116
- }
126
+ },
127
+ buttonCityStyle: {
128
+ backgroundColor: theme.colors.white,
129
+ borderColor: theme.colors.backgroundGray,
130
+ borderRadius: 8,
131
+ marginHorizontal: 40,
132
+ minHeight: 45,
133
+ paddingVertical: 5,
134
+ paddingHorizontal: 20,
135
+ borderWidth: 1,
136
+ justifyContent: 'center'
137
+ },
138
+ businessSkeleton: {
139
+ borderRadius: 8,
140
+ marginRight: 20,
141
+ width: 56,
142
+ height: 56
143
+ },
117
144
  });
118
145
 
119
146
 
120
147
  const [, t] = useLanguage();
121
148
  const [{ user, auth }] = useSession();
122
- const [orderState] = useOrder();
149
+ const [orderState, { changeCityFilter }] = useOrder();
123
150
  const [{ configs }] = useConfig();
124
151
  const [{ parseDate }] = useUtils();
125
152
 
@@ -129,21 +156,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
129
156
  const [isFarAway, setIsFarAway] = useState(false)
130
157
  const [businessTypes, setBusinessTypes] = useState(null)
131
158
  const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
159
+ const [isOpenCities, setIsOpenCities] = useState(false)
132
160
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
133
161
  Number(configs?.max_days_preorder?.value) > 0
134
162
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
135
163
  const timerId = useRef<any>(false)
136
164
  const [favoriteIds, setFavoriteIds] = useState<any>([])
137
-
138
- // const panResponder = useRef(
139
- // PanResponder.create({
140
- // onMoveShouldSetPanResponder: (e, gestureState) => {
141
- // const { dx, dy } = gestureState;
142
- // resetInactivityTimeout()
143
- // return (Math.abs(dx) > 20) || (Math.abs(dy) > 20);
144
- // },
145
- // })
146
- // ).current
165
+ const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
166
+ const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
147
167
 
148
168
  const handleMomentClick = () => {
149
169
  if (isPreorderEnabled) {
@@ -163,11 +183,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
163
183
  paginationProps.totalPages === paginationProps.currentPage
164
184
  );
165
185
 
166
- if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore) {
186
+ if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore && businessesList?.businesses?.length > 0) {
167
187
  getBusinesses();
168
188
  }
169
189
  };
170
190
 
191
+ const convertToRadian = (value: number) => {
192
+ return value * Math.PI / 180
193
+ }
194
+
171
195
  const getDistance = (lat1: any, lon1: any, lat2: any, lon2: any) => {
172
196
  const R = 6371 // km
173
197
  const dLat = convertToRadian(lat2 - lat1)
@@ -180,10 +204,17 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
180
204
  }
181
205
 
182
206
  const resetInactivityTimeout = () => {
183
- clearTimeout(timerId.current)
184
- timerId.current = setInterval(() => {
185
- getBusinesses(true)
186
- }, 120000)
207
+ if (!logosLayout) {
208
+ clearTimeout(timerId.current)
209
+ timerId.current = setInterval(() => {
210
+ getBusinesses(true)
211
+ }, 120000)
212
+ }
213
+ }
214
+
215
+ const handleChangeCity = (cityId: number | null) => {
216
+ changeCityFilter(orderState?.options?.city_id === cityId ? null : cityId)
217
+ setIsOpenCities(false)
187
218
  }
188
219
 
189
220
  useEffect(() => {
@@ -224,7 +255,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
224
255
  }
225
256
 
226
257
  useEffect(() => {
227
- checkUserLocation()
258
+ if (!logosLayout) {
259
+ checkUserLocation()
260
+ }
228
261
  }, [orderState?.options?.address?.location])
229
262
 
230
263
  useEffect(() => {
@@ -251,8 +284,69 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
251
284
  setFavoriteIds([...new Set(ids)])
252
285
  }, [businessesList?.businesses?.length])
253
286
 
287
+ useEffect(() => {
288
+ setIsOpenCities(false)
289
+ }, [orderState?.options?.city_id])
290
+
291
+ if (logosLayout) {
292
+ return (
293
+ <BusinessLogosContainer
294
+ horizontal
295
+ showsHorizontalScrollIndicator={false}
296
+ >
297
+ {businessesList?.loading ? (
298
+ <Placeholder Animation={Fade}>
299
+ <View style={{ flexDirection: 'row' }}>
300
+ {[...Array(10).keys()].map(i => (
301
+ <View style={styles.businessSkeleton} key={i}>
302
+ <PlaceholderLine style={{ width: '100%', height: '100%' }} />
303
+ </View>
304
+ ))}
305
+ </View>
306
+ </Placeholder>
307
+ ) : (
308
+ <>
309
+ {businessesList.businesses
310
+ ?.filter(business => business?.open)
311
+ ?.map(business => (
312
+ <TouchableOpacity
313
+ key={business?.id}
314
+ onPress={() => handleBusinessClick && handleBusinessClick(business)}
315
+ style={{
316
+ width: 60,
317
+ height: 60,
318
+ borderRadius: 8,
319
+ marginRight: 5
320
+ }}
321
+ >
322
+ <FastImage
323
+ style={{
324
+ width: 56,
325
+ height: 56,
326
+ marginRight: 20,
327
+ borderRadius: 8,
328
+ borderColor: theme.colors.primary,
329
+ borderWidth: business?.slug === actualSlug ? 2 : 0
330
+ }}
331
+ source={{
332
+ uri: business?.logo,
333
+ priority: FastImage.priority.normal,
334
+ }}
335
+ resizeMode={FastImage.resizeMode.cover}
336
+ />
337
+ </TouchableOpacity>
338
+ ))}
339
+ </>
340
+ )}
341
+ </BusinessLogosContainer>
342
+ )
343
+ }
344
+
254
345
  return (
255
- <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
346
+ <IOScrollView
347
+ style={styles.container}
348
+ onScroll={(e) => handleScroll(e)}
349
+ showsVerticalScrollIndicator={false}
256
350
  refreshControl={
257
351
  <RefreshControl
258
352
  refreshing={refreshing}
@@ -260,9 +354,29 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
260
354
  />
261
355
  }
262
356
  >
263
- <View style={{ height: isFarAway ? 150 : 100, marginTop: Platform.OS == 'ios' ? 0 : 50 }}>
264
- <Search>
357
+ {enabledPoweredByOrdering && auth && (
358
+ <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', top: 20 }}>
359
+ <OText>
360
+ Powered By Ordering.co
361
+ </OText>
362
+ </View>
363
+ )}
364
+ <View style={{
365
+ height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
366
+ marginTop: Platform.OS == 'ios' ? 0 : 50,
367
+ backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
368
+ }}
369
+ >
370
+ {isChewLayout && (
371
+ <View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
372
+ <OText size={24} weight={700} color={theme.colors?.white}>
373
+ {t('WELCOME', 'Welcome')} {user?.name}
374
+ </OText>
375
+ </View>
376
+ )}
377
+ <Search isChewLayout={isChewLayout}>
265
378
  <AddressInput
379
+ isChewLayout={isChewLayout}
266
380
  onPress={() =>
267
381
  auth
268
382
  ? navigation.navigate('AddressList', { isFromBusinesses: true })
@@ -272,103 +386,125 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
272
386
  isGuestUser: isGuestUser
273
387
  })
274
388
  }>
275
- <AddressInputContainer>
389
+ <AddressInputContainer isChewLayout={isChewLayout}>
276
390
  <OIcon
277
391
  src={theme.images.general.pin}
278
392
  color={theme.colors.disabled}
279
393
  width={16}
280
- style={{ marginRight: 10 }}
394
+ style={{ marginRight: isChewLayout ? 0 : 10 }}
281
395
  />
282
- <OText size={12} numberOfLines={1}>
396
+ <OText size={12} numberOfLines={1} style={{ flex: 1 }}>
283
397
  {orderState?.options?.address?.address}
284
398
  </OText>
285
- <OIcon
286
- src={theme.images.general.arrow_down}
287
- width={10}
288
- style={{ marginStart: 8 }}
289
- />
399
+ {!isChewLayout && (
400
+ <OIcon
401
+ src={theme.images.general.arrow_down}
402
+ width={10}
403
+ style={{ marginStart: 8 }}
404
+ />
405
+ )}
290
406
  </AddressInputContainer>
291
407
  </AddressInput>
292
408
  </Search>
293
- {isFarAway && (
409
+ {isFarAway && !isChewLayout && (
294
410
  <FarAwayMessage style={styles.farAwayMsg}>
295
411
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
296
412
  <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
297
413
  </FarAwayMessage>
298
414
  )}
299
-
300
- <OrderControlContainer>
301
- <View style={styles.wrapperOrderOptions}>
302
- {isPreOrderSetting && (
303
- <WrapMomentOption
304
- onPress={() => handleMomentClick()}>
305
- <OText
306
- size={12}
307
- numberOfLines={1}
308
- ellipsizeMode="tail"
309
- color={theme.colors.textSecondary}>
310
- {orderState.options?.moment
311
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
312
- : t('ASAP_ABBREVIATION', 'ASAP')}
313
- </OText>
314
- {isPreorderEnabled && (
315
- <OIcon
316
- src={theme.images.general.arrow_down}
317
- width={10}
318
- style={{ marginStart: 8 }}
319
- />
320
- )}
415
+ {!isChewLayout ? (
416
+ <OrderControlContainer>
417
+ <View style={styles.wrapperOrderOptions}>
418
+ {isPreOrderSetting && (
419
+ <WrapMomentOption
420
+ onPress={() => handleMomentClick()}>
421
+ <OText
422
+ size={12}
423
+ numberOfLines={1}
424
+ ellipsizeMode="tail"
425
+ color={theme.colors.textSecondary}>
426
+ {orderState.options?.moment
427
+ ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
428
+ : t('ASAP_ABBREVIATION', 'ASAP')}
429
+ </OText>
430
+ {isPreorderEnabled && (
431
+ <OIcon
432
+ src={theme.images.general.arrow_down}
433
+ width={10}
434
+ style={{ marginStart: 8 }}
435
+ />
436
+ )}
437
+ </WrapMomentOption>
438
+ )}
439
+ <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
440
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
441
+ <OIcon
442
+ src={theme.images.general.arrow_down}
443
+ width={10}
444
+ style={{ marginStart: 8 }}
445
+ />
321
446
  </WrapMomentOption>
447
+ </View>
448
+ </OrderControlContainer>
449
+ ) : (
450
+ <>
451
+ {isPreOrderSetting && (
452
+ <View style={{ paddingHorizontal: 30 }}>
453
+ <PreorderInput
454
+ isChewLayout={isChewLayout}
455
+ onPress={() => handleMomentClick()}
456
+ >
457
+ <OText color={theme.colors.textSecondary}>
458
+ {orderState.options?.moment
459
+ ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
460
+ : t('ASAP_ABBREVIATION', 'ASAP')}</OText>
461
+ </PreorderInput>
462
+ </View>
322
463
  )}
323
- <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
324
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
325
- <OIcon
326
- src={theme.images.general.arrow_down}
327
- width={10}
328
- style={{ marginStart: 8 }}
329
- />
330
- </WrapMomentOption>
331
- </View>
332
- </OrderControlContainer>
333
- </View>
334
- <HeaderWrapper
335
- source={theme.images.backgrounds.business_list_header}
336
- style={{ paddingTop: top + 20 }}
337
- resizeMode='stretch'
338
- >
339
- {!auth && (
340
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
341
- <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
342
- </TouchableOpacity>
464
+ </>
343
465
  )}
344
- </HeaderWrapper>
345
- {!businessId && (
346
- <SearchBar
347
- onSearch={handleChangeSearch}
348
- searchValue={searchValue}
349
- lazyLoad
350
- hideIcon
351
- isCancelXButtonShow={!!searchValue}
352
- onCancel={() => handleChangeSearch('')}
353
- placeholder={t('SEARCH', 'Search')}
354
- height={50}
355
- isDisabled={!businessTypes}
356
- inputContainerStyles={styles.inputContainerStyles}
357
- containerStyles={{
358
- marginHorizontal: 40,
359
- marginTop: 20
360
- }}
361
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
362
- onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
363
- />
466
+ </View>
467
+ {!isChewLayout ? (
468
+ <HeaderWrapper
469
+ source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
470
+ style={{ paddingTop: top + 20 }}
471
+ resizeMode='cover'
472
+ >
473
+ {!auth && (
474
+
475
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
476
+ <IconAntDesign name='arrowleft' size={26} />
477
+ </TouchableOpacity>
478
+ )}
479
+ </HeaderWrapper>
480
+ ) : (
481
+ <OrderTypesContainer>
482
+ <OrderTypeSelector
483
+ handleChangeBusinessType={handleChangeBusinessType}
484
+ isChewLayout
485
+ chewOrderTypes={chewOrderTypes}
486
+ handleChangeType={setOrderTypeValue}
487
+ />
488
+ </OrderTypesContainer>
364
489
  )}
365
- <OrderProgressWrapper>
366
- <OrderProgress
367
- {...props}
368
- isFocused={isFocused}
369
- />
370
- </OrderProgressWrapper>
371
490
 
491
+ {!hideCities && orderTypeValue === 2 && (
492
+ <View style={{ marginTop: 20 }}>
493
+ <TouchableOpacity
494
+ style={styles.buttonCityStyle}
495
+ onPress={() => setIsOpenCities(true)}
496
+ disabled={orderState?.loading}
497
+ >
498
+ <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
499
+ {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
500
+ </OText>
501
+ </TouchableOpacity>
502
+ </View>
503
+ )}
504
+ <OrderProgress
505
+ {...props}
506
+ isFocused={isFocused}
507
+ />
372
508
  {
373
509
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
374
510
  <FeaturedWrapper>
@@ -376,7 +512,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
376
512
  <ScrollView
377
513
  showsHorizontalScrollIndicator={false}
378
514
  nestedScrollEnabled
379
- horizontal contentContainerStyle={{ paddingHorizontal: 40 }}>
515
+ horizontal
516
+ contentContainerStyle={{ paddingHorizontal: 40 }}
517
+ >
380
518
  {featuredBusiness.map((bAry: any, idx) => (
381
519
  <View key={'f-listing_' + idx}>
382
520
  <BusinessFeaturedController
@@ -399,17 +537,21 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
399
537
  </FeaturedWrapper>
400
538
  )
401
539
  }
402
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
403
- {
404
- !businessId && !props.franchiseId && (
405
- <HighestRatedBusinesses
406
- onBusinessClick={handleBusinessClick}
407
- navigation={navigation}
408
- favoriteIds={favoriteIds}
409
- setFavoriteIds={setFavoriteIds}
410
- />
411
- )
412
- }
540
+ {!isChewLayout && (
541
+ <>
542
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
543
+ {
544
+ !businessId && !props.franchiseId && (
545
+ <HighestRatedBusinesses
546
+ onBusinessClick={handleBusinessClick}
547
+ navigation={navigation}
548
+ favoriteIds={favoriteIds}
549
+ setFavoriteIds={setFavoriteIds}
550
+ />
551
+ )
552
+ }
553
+ </>
554
+ )}
413
555
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
414
556
  <ListWrapper>
415
557
  {!businessId && (
@@ -433,6 +575,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
433
575
  (business: any, i: number) => (
434
576
  <BusinessController
435
577
  key={`${business.id}_` + i}
578
+ enableIntersection
579
+ isCustomLayout={isChewLayout}
436
580
  business={business}
437
581
  isBusinessOpen={business.open}
438
582
  handleCustomClick={handleBusinessClick}
@@ -504,7 +648,18 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
504
648
  </>
505
649
  )}
506
650
  </ListWrapper>
507
- </ScrollView>
651
+ <OModal
652
+ open={isOpenCities}
653
+ onClose={() => setIsOpenCities(false)}
654
+ title={t('SELECT_A_CITY', 'Select a city')}
655
+ >
656
+ <CitiesControl
657
+ cities={citiesState?.cities}
658
+ onClose={() => setIsOpenCities(false)}
659
+ handleChangeCity={handleChangeCity}
660
+ />
661
+ </OModal>
662
+ </IOScrollView>
508
663
  );
509
664
  };
510
665
 
@@ -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 WelcomeTitle = styled.View`
4
4
  flex: 1;
@@ -16,6 +16,9 @@ export const Search = styled.View`
16
16
  align-items: center;
17
17
  margin-vertical: 10px;
18
18
  margin-horizontal: 20px;
19
+ ${(props: any) => props.isChewLayout && css`
20
+ margin-horizontal: 30px;
21
+ `}
19
22
  `
20
23
 
21
24
  export const AddressInput = styled.TouchableOpacity`
@@ -27,6 +30,9 @@ export const AddressInput = styled.TouchableOpacity`
27
30
  width: 100%;
28
31
  height: 44px;
29
32
  max-height: 44px;
33
+ ${(props: any) => props.isChewLayout && css`
34
+ border-radius: 8px;
35
+ `}
30
36
  `
31
37
 
32
38
  export const OrderControlContainer = styled.View`
@@ -54,7 +60,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
54
60
 
55
61
  export const HeaderWrapper = styled.ImageBackground`
56
62
  width: 100%;
57
- height: 270px;
63
+ height: 270px;
58
64
  padding: 20px 40px;
59
65
  background-color: transparent;
60
66
  `;
@@ -66,16 +72,9 @@ export const ListWrapper = styled.View`
66
72
 
67
73
  export const FeaturedWrapper = styled.View`
68
74
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
69
- height: 220px;
70
75
  paddingVertical: 30px;
71
76
  `;
72
77
 
73
- export const OrderProgressWrapper = styled.View`
74
- margin-top: 37px;
75
- margin-bottom: 20px;
76
- padding-horizontal: 40px;
77
- `
78
-
79
78
  export const FarAwayMessage = styled.View`
80
79
  flex-direction: row;
81
80
  align-items: center;
@@ -89,5 +88,43 @@ export const AddressInputContainer = styled.View`
89
88
  flex-direction: row;
90
89
  width: 100%;
91
90
  align-items: center;
92
- justify-content: center
91
+ justify-content: center;
92
+ ${(props: any) => props.isChewLayout && css`
93
+ flex-direction: row-reverse;
94
+ `}
95
+ `
96
+
97
+ export const PreorderInput = styled(AddressInput)`
98
+ justify-content: center;
99
+ `
100
+
101
+ export const OTabs = styled.View`
102
+ flex-direction: row;
103
+ justify-content: space-between;
104
+ align-items: center;
105
+ margin-bottom: -1px;
106
+ width: 100%;
107
+ `;
108
+
109
+ export const OTab = styled.TouchableOpacity`
110
+ padding-bottom: 10px;
111
+ border-bottom-width: 1px;
112
+ margin-end: 14px;
113
+ padding-horizontal: 5px;
114
+ `;
115
+
116
+ export const OrderTypesContainer = styled.View`
117
+ flex-direction: row;
118
+ font-size: 14px;
119
+ width: 180px;
120
+ justify-content: space-between;
121
+ align-items: center;
122
+ border-bottom-width: 1px;
123
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
124
+ margin-top: 10px;
125
+ align-self: center;
126
+ `
127
+
128
+ export const BusinessLogosContainer = styled.ScrollView`
129
+ padding-bottom: 10px;
93
130
  `