ordering-ui-react-native 0.16.34 → 0.16.35-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 (199) hide show
  1. package/package.json +7 -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/LoginForm/index.tsx +15 -0
  13. package/src/components/Messages/index.tsx +2 -2
  14. package/src/components/NotificationSetting/index.tsx +85 -0
  15. package/src/components/OrderDetails/index.tsx +2 -20
  16. package/src/components/OrdersOption/index.tsx +54 -56
  17. package/src/components/PaymentOptions/index.tsx +335 -365
  18. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  19. package/src/components/ReviewDriver/index.tsx +1 -1
  20. package/src/components/ReviewOrder/index.tsx +2 -1
  21. package/src/components/ReviewProducts/index.tsx +11 -0
  22. package/src/components/SignupForm/index.tsx +15 -0
  23. package/src/components/SingleProductReview/index.tsx +8 -5
  24. package/src/components/StripeElementsForm/index.tsx +25 -16
  25. package/src/components/VerifyPhone/styles.tsx +1 -2
  26. package/src/components/shared/OBottomPopup.tsx +6 -2
  27. package/src/index.tsx +2 -0
  28. package/src/pages/BusinessesListing.tsx +7 -6
  29. package/src/pages/OrderDetails.tsx +1 -1
  30. package/src/pages/ReviewDriver.tsx +2 -2
  31. package/src/pages/ReviewOrder.tsx +2 -2
  32. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  33. package/src/utils/index.tsx +2 -1
  34. package/themes/business/index.tsx +4 -0
  35. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  36. package/themes/business/src/components/Chat/index.tsx +38 -30
  37. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  38. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  39. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  40. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  41. package/themes/business/src/components/MapView/index.tsx +12 -1
  42. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  43. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  44. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  45. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  46. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  47. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  48. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  49. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  50. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  52. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  54. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  55. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  56. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  57. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  58. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  59. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  60. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  61. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  62. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  63. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  64. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  65. package/themes/business/src/components/shared/OModal.tsx +40 -37
  66. package/themes/business/src/types/index.tsx +15 -9
  67. package/themes/business/src/utils/index.tsx +10 -0
  68. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  69. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  70. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  71. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  72. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  73. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  74. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  75. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  76. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  77. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  78. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  79. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  80. package/themes/kiosk/src/types/index.d.ts +2 -0
  81. package/themes/original/index.tsx +4 -0
  82. package/themes/original/src/components/AddressDetails/index.tsx +2 -2
  83. package/themes/original/src/components/AddressForm/index.tsx +151 -140
  84. package/themes/original/src/components/AddressList/index.tsx +1 -1
  85. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  86. package/themes/original/src/components/BusinessBasicInformation/index.tsx +324 -162
  87. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  88. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  89. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  90. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  91. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  92. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  93. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  94. package/themes/original/src/components/BusinessListingSearch/index.tsx +80 -128
  95. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  96. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  97. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  98. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  99. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  100. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -104
  101. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  102. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  103. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  104. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  105. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  106. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +278 -104
  107. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  108. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  109. package/themes/original/src/components/Cart/index.tsx +54 -16
  110. package/themes/original/src/components/Cart/styles.tsx +4 -0
  111. package/themes/original/src/components/CartContent/index.tsx +22 -16
  112. package/themes/original/src/components/Checkout/index.tsx +109 -64
  113. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  114. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  115. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  116. package/themes/original/src/components/Favorite/index.tsx +1 -0
  117. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  120. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  121. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  122. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  123. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  124. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  125. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  126. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -72
  127. package/themes/original/src/components/LoginForm/index.tsx +90 -46
  128. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  129. package/themes/original/src/components/Messages/index.tsx +17 -17
  130. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  132. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  133. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  134. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  135. package/themes/original/src/components/NavBar/index.tsx +15 -9
  136. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  137. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  138. package/themes/original/src/components/Notifications/index.tsx +148 -0
  139. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  140. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  141. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  142. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  143. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  144. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  145. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  146. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  147. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  149. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  150. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  152. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  156. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  157. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +635 -664
  160. package/themes/original/src/components/ProductForm/styles.tsx +9 -8
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  163. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  164. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  165. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  166. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  167. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  168. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  169. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  170. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  171. package/themes/original/src/components/ServiceForm/index.tsx +410 -258
  172. package/themes/original/src/components/SignupForm/index.tsx +350 -206
  173. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  174. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  175. package/themes/original/src/components/SingleProductCard/index.tsx +200 -110
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -10
  177. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  178. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  179. package/themes/original/src/components/StripeElementsForm/index.tsx +18 -7
  180. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  181. package/themes/original/src/components/UserDetails/index.tsx +11 -2
  182. package/themes/original/src/components/UserFormDetails/index.tsx +67 -77
  183. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  184. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  185. package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
  186. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  187. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  188. package/themes/original/src/components/Wallets/index.tsx +176 -164
  189. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  190. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  191. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  192. package/themes/original/src/components/shared/OButton.tsx +10 -3
  193. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  194. package/themes/original/src/components/shared/OInput.tsx +13 -3
  195. package/themes/original/src/layouts/Container.tsx +13 -9
  196. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  197. package/themes/original/src/types/index.tsx +91 -30
  198. package/themes/original/src/utils/index.tsx +121 -10
  199. 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,15 @@ 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
42
  import { SearchBar } from '../../../SearchBar';
39
- import { OIcon, OText } from '../../../shared';
43
+ import { OButton, OIcon, OText, OBottomPopup, OModal } from '../../../shared';
40
44
  import { BusinessesListingParams } from '../../../../types';
41
45
  import { NotFoundSource } from '../../../NotFoundSource';
42
46
  import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
@@ -48,6 +52,8 @@ import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
48
52
  import { getTypesText, convertToRadian } from '../../../../utils';
49
53
  import { OrderProgress } from '../../../OrderProgress';
50
54
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
55
+ import FastImage from 'react-native-fast-image';
56
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
51
57
 
52
58
  const PIXELS_TO_SCROLL = 2000;
53
59
 
@@ -63,13 +69,21 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
63
69
  handleChangeSearch,
64
70
  businessId,
65
71
  isGuestUser,
66
- handleUpdateBusinessList
72
+ handleUpdateBusinessList,
73
+ citiesState,
74
+ actualSlug,
75
+ logosLayout
67
76
  } = props;
68
77
  const theme = useTheme();
78
+ const [orderingTheme] = useOrderingTheme()
69
79
  const isFocused = useIsFocused();
70
80
  const appState = useRef(AppState.currentState)
81
+ const searchBarRef = useRef<any>()
71
82
  const [appStateVisible, setAppStateVisible] = useState(appState.current);
83
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
84
+ const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
72
85
  const [refreshing] = useState(false);
86
+ const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
73
87
  const styles = StyleSheet.create({
74
88
  container: {
75
89
  marginBottom: 0,
@@ -113,13 +127,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
113
127
  backgroundColor: theme.colors.white,
114
128
  borderColor: theme.colors.backgroundGray,
115
129
  borderWidth: 1,
116
- }
130
+ },
131
+ buttonCityStyle: {
132
+ backgroundColor: theme.colors.white,
133
+ borderColor: theme.colors.backgroundGray,
134
+ borderRadius: 8,
135
+ marginHorizontal: 40,
136
+ minHeight: 45,
137
+ paddingVertical: 5,
138
+ paddingHorizontal: 20,
139
+ borderWidth: 1,
140
+ justifyContent: 'center'
141
+ },
142
+ businessSkeleton: {
143
+ borderRadius: 8,
144
+ marginRight: 20,
145
+ width: 56,
146
+ height: 56
147
+ },
117
148
  });
118
149
 
119
150
 
120
151
  const [, t] = useLanguage();
121
152
  const [{ user, auth }] = useSession();
122
- const [orderState] = useOrder();
153
+ const [orderState, { changeCityFilter }] = useOrder();
123
154
  const [{ configs }] = useConfig();
124
155
  const [{ parseDate }] = useUtils();
125
156
 
@@ -129,21 +160,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
129
160
  const [isFarAway, setIsFarAway] = useState(false)
130
161
  const [businessTypes, setBusinessTypes] = useState(null)
131
162
  const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
163
+ const [isOpenCities, setIsOpenCities] = useState(false)
132
164
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
133
165
  Number(configs?.max_days_preorder?.value) > 0
134
166
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
135
167
  const timerId = useRef<any>(false)
136
168
  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
169
+ const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
170
+ const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
147
171
 
148
172
  const handleMomentClick = () => {
149
173
  if (isPreorderEnabled) {
@@ -163,7 +187,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
163
187
  paginationProps.totalPages === paginationProps.currentPage
164
188
  );
165
189
 
166
- if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore) {
190
+ if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore && businessesList?.businesses?.length > 0) {
167
191
  getBusinesses();
168
192
  }
169
193
  };
@@ -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: 57,
317
+ height: 58,
318
+ borderBottomColor: theme.colors.primary,
319
+ borderBottomWidth: business?.slug === actualSlug ? 2 : 0,
320
+ marginRight: 5
321
+ }}
322
+ >
323
+ <FastImage
324
+ style={{
325
+ width: 56,
326
+ height: 56,
327
+ marginRight: 20,
328
+ borderTopLeftRadius: 7.6,
329
+ borderTopRightRadius: 7.6
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={18} 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,124 @@ 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.general.homeHero}
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
+ >
497
+ <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
498
+ {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
499
+ </OText>
500
+ </TouchableOpacity>
501
+ </View>
502
+ )}
503
+ <OrderProgress
504
+ {...props}
505
+ isFocused={isFocused}
506
+ />
372
507
  {
373
508
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
374
509
  <FeaturedWrapper>
@@ -376,7 +511,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
376
511
  <ScrollView
377
512
  showsHorizontalScrollIndicator={false}
378
513
  nestedScrollEnabled
379
- horizontal contentContainerStyle={{ paddingHorizontal: 40 }}>
514
+ horizontal
515
+ contentContainerStyle={{ paddingHorizontal: 40 }}
516
+ >
380
517
  {featuredBusiness.map((bAry: any, idx) => (
381
518
  <View key={'f-listing_' + idx}>
382
519
  <BusinessFeaturedController
@@ -433,6 +570,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
433
570
  (business: any, i: number) => (
434
571
  <BusinessController
435
572
  key={`${business.id}_` + i}
573
+ enableIntersection
436
574
  business={business}
437
575
  isBusinessOpen={business.open}
438
576
  handleCustomClick={handleBusinessClick}
@@ -504,7 +642,43 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
504
642
  </>
505
643
  )}
506
644
  </ListWrapper>
507
- </ScrollView>
645
+ <OModal
646
+ open={isOpenCities}
647
+ onClose={() => setIsOpenCities(false)}
648
+ title={t('SELECT_A_CITY', 'Select a city')}
649
+ >
650
+ <View style={{ padding: 40, width: '100%' }}>
651
+ {citiesState?.cities?.map((city: any) => (
652
+ <TouchableOpacity
653
+ key={city?.id}
654
+ style={{
655
+ padding: 10,
656
+ flexDirection: 'row'
657
+ }}
658
+ onPress={() => handleChangeCity(city?.id)}
659
+ disabled={orderState?.loading}
660
+ >
661
+ {orderState?.options?.city_id === city?.id ? (
662
+ <OIcon
663
+ src={theme.images.general.option_checked}
664
+ width={16}
665
+ style={{ marginEnd: 24 }}
666
+ />
667
+ ) : (
668
+ <OIcon
669
+ src={theme.images.general.option_normal}
670
+ width={16}
671
+ style={{ marginEnd: 24 }}
672
+ />
673
+ )}
674
+ <OText color={theme.colors.black}>
675
+ {city?.name}
676
+ </OText>
677
+ </TouchableOpacity>
678
+ ))}
679
+ </View>
680
+ </OModal>
681
+ </IOScrollView>
508
682
  );
509
683
  };
510
684
 
@@ -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
  `