ordering-ui-react-native 0.16.50 → 0.16.51-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 (205) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessInformation/index.tsx +33 -4
  6. package/src/components/BusinessInformation/styles.tsx +2 -2
  7. package/src/components/BusinessProductsList/index.tsx +10 -10
  8. package/src/components/BusinessesListing/index.tsx +1 -1
  9. package/src/components/Checkout/index.tsx +2 -1
  10. package/src/components/LanguageSelector/index.tsx +21 -16
  11. package/src/components/Messages/index.tsx +2 -2
  12. package/src/components/NotificationSetting/index.tsx +85 -0
  13. package/src/components/OrdersOption/index.tsx +54 -56
  14. package/src/components/PaymentOptions/index.tsx +298 -345
  15. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  16. package/src/components/ReviewProducts/index.tsx +11 -0
  17. package/src/components/SingleProductReview/index.tsx +8 -5
  18. package/src/components/StripeElementsForm/index.tsx +25 -16
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OBottomPopup.tsx +6 -2
  21. package/src/components/shared/OToast.tsx +4 -4
  22. package/src/index.tsx +2 -0
  23. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  24. package/src/utils/index.tsx +2 -1
  25. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +259 -238
  26. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  27. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  28. package/themes/business/src/components/Chat/index.tsx +40 -32
  29. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  30. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  31. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  32. package/themes/business/src/components/MapView/index.tsx +12 -1
  33. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  34. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  35. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +40 -30
  36. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  37. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  38. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  39. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  40. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  43. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  45. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  46. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  47. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  48. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  49. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  50. package/themes/business/src/components/PreviousOrders/index.tsx +332 -244
  51. package/themes/business/src/components/PreviousOrders/styles.tsx +30 -2
  52. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  53. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  54. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  55. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  56. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  57. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  58. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  59. package/themes/business/src/components/shared/OLink.tsx +24 -12
  60. package/themes/business/src/components/shared/OText.tsx +3 -2
  61. package/themes/business/src/types/index.tsx +25 -11
  62. package/themes/business/src/utils/index.tsx +10 -0
  63. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  64. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  65. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  67. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  68. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  69. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  70. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  71. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  72. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  73. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/types/index.d.ts +2 -0
  76. package/themes/original/index.tsx +8 -0
  77. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  78. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  79. package/themes/original/src/components/AddressList/index.tsx +1 -1
  80. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  83. package/themes/original/src/components/BusinessController/index.tsx +192 -91
  84. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  85. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  86. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  87. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  90. package/themes/original/src/components/BusinessListingSearch/index.tsx +85 -137
  91. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  92. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -61
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -83
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +19 -12
  98. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -30
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +299 -148
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -11
  103. package/themes/original/src/components/BusinessesListing/index.tsx +80 -25
  104. package/themes/original/src/components/Cart/index.tsx +82 -15
  105. package/themes/original/src/components/Cart/styles.tsx +4 -0
  106. package/themes/original/src/components/CartContent/index.tsx +27 -17
  107. package/themes/original/src/components/CartContent/styles.tsx +1 -1
  108. package/themes/original/src/components/Checkout/index.tsx +114 -118
  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 -24
  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/index.tsx +162 -50
  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 +2 -35
  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 +94 -98
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  152. package/themes/original/src/components/OrdersOption/index.tsx +91 -53
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  156. package/themes/original/src/components/PlaceSpot/index.tsx +249 -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 +365 -384
  160. package/themes/original/src/components/ProductForm/styles.tsx +7 -12
  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/ProductOptionSubOption/index.tsx +16 -8
  164. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  167. package/themes/original/src/components/Promotions/index.tsx +232 -219
  168. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  169. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  170. package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
  171. package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
  172. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  173. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
  174. package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -0
  175. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  176. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  177. package/themes/original/src/components/ServiceForm/index.tsx +341 -267
  178. package/themes/original/src/components/SignupForm/index.tsx +160 -113
  179. package/themes/original/src/components/SingleOrderCard/index.tsx +219 -129
  180. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  181. package/themes/original/src/components/SingleProductCard/index.tsx +180 -104
  182. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  183. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  184. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  185. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  186. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  187. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  188. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  189. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  190. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  191. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  192. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  193. package/themes/original/src/components/Wallets/index.tsx +176 -164
  194. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  195. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  197. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  198. package/themes/original/src/components/shared/OButton.tsx +10 -3
  199. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  200. package/themes/original/src/components/shared/OInput.tsx +10 -1
  201. package/themes/original/src/layouts/Container.tsx +13 -9
  202. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  203. package/themes/original/src/types/index.tsx +79 -23
  204. package/themes/original/src/utils/index.tsx +103 -58
  205. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -19,6 +19,7 @@ import {
19
19
  useOrder,
20
20
  useConfig,
21
21
  useUtils,
22
+ useOrderingTheme
22
23
  } from 'ordering-components/native';
23
24
  import { useTheme } from 'styled-components/native';
24
25
  import Ionicons from 'react-native-vector-icons/Ionicons'
@@ -31,13 +32,14 @@ import {
31
32
  HeaderWrapper,
32
33
  ListWrapper,
33
34
  FeaturedWrapper,
34
- OrderProgressWrapper,
35
35
  FarAwayMessage,
36
- AddressInputContainer
36
+ AddressInputContainer,
37
+ PreorderInput,
38
+ OrderTypesContainer,
39
+ BusinessLogosContainer
37
40
  } from './styles';
38
41
 
39
- import { SearchBar } from '../../../SearchBar';
40
- import { OIcon, OText } from '../../../shared';
42
+ import { OIcon, OText, OModal } from '../../../shared';
41
43
  import { BusinessesListingParams } from '../../../../types';
42
44
  import { NotFoundSource } from '../../../NotFoundSource';
43
45
  import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
@@ -46,9 +48,12 @@ import { OrderTypeSelector } from '../../../OrderTypeSelector';
46
48
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
47
49
  import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
48
50
  import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
49
- import { getTypesText, convertToRadian } from '../../../../utils';
51
+ import { getTypesText } from '../../../../utils';
50
52
  import { OrderProgress } from '../../../OrderProgress';
51
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'
52
57
 
53
58
  const PIXELS_TO_SCROLL = 2000;
54
59
 
@@ -56,21 +61,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
56
61
  const {
57
62
  navigation,
58
63
  businessesList,
59
- searchValue,
60
64
  getBusinesses,
61
65
  handleChangeBusinessType,
62
66
  handleBusinessClick,
63
67
  paginationProps,
64
- handleChangeSearch,
65
68
  businessId,
66
69
  isGuestUser,
67
- handleUpdateBusinessList
70
+ handleUpdateBusinessList,
71
+ citiesState,
72
+ actualSlug,
73
+ logosLayout
68
74
  } = props;
69
75
  const theme = useTheme();
76
+ const [orderingTheme] = useOrderingTheme()
70
77
  const isFocused = useIsFocused();
71
78
  const appState = useRef(AppState.currentState)
72
- 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
73
81
  const [refreshing] = useState(false);
82
+ const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
74
83
  const styles = StyleSheet.create({
75
84
  container: {
76
85
  marginBottom: 0,
@@ -114,13 +123,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
114
123
  backgroundColor: theme.colors.white,
115
124
  borderColor: theme.colors.backgroundGray,
116
125
  borderWidth: 1,
117
- }
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
+ },
118
144
  });
119
145
 
120
146
 
121
147
  const [, t] = useLanguage();
122
148
  const [{ user, auth }] = useSession();
123
- const [orderState] = useOrder();
149
+ const [orderState, { changeCityFilter }] = useOrder();
124
150
  const [{ configs }] = useConfig();
125
151
  const [{ parseDate }] = useUtils();
126
152
 
@@ -130,21 +156,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
130
156
  const [isFarAway, setIsFarAway] = useState(false)
131
157
  const [businessTypes, setBusinessTypes] = useState(null)
132
158
  const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
159
+ const [isOpenCities, setIsOpenCities] = useState(false)
133
160
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
134
161
  Number(configs?.max_days_preorder?.value) > 0
135
162
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
136
163
  const timerId = useRef<any>(false)
137
164
  const [favoriteIds, setFavoriteIds] = useState<any>([])
138
-
139
- // const panResponder = useRef(
140
- // PanResponder.create({
141
- // onMoveShouldSetPanResponder: (e, gestureState) => {
142
- // const { dx, dy } = gestureState;
143
- // resetInactivityTimeout()
144
- // return (Math.abs(dx) > 20) || (Math.abs(dy) > 20);
145
- // },
146
- // })
147
- // ).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
148
167
 
149
168
  const handleMomentClick = () => {
150
169
  if (isPreorderEnabled) {
@@ -163,11 +182,16 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
163
182
  const hasMore = !(
164
183
  paginationProps.totalPages === paginationProps.currentPage
165
184
  );
166
- if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore) {
185
+
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,104 +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 || configs?.advanced_business_search_enabled?.value === '1'}
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
- onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
363
- onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
364
- />
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>
365
489
  )}
366
- <OrderProgressWrapper>
367
- <OrderProgress
368
- {...props}
369
- isFocused={isFocused}
370
- />
371
- </OrderProgressWrapper>
372
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
+ />
373
508
  {
374
509
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
375
510
  <FeaturedWrapper>
@@ -377,7 +512,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
377
512
  <ScrollView
378
513
  showsHorizontalScrollIndicator={false}
379
514
  nestedScrollEnabled
380
- horizontal contentContainerStyle={{ paddingHorizontal: 40 }}>
515
+ horizontal
516
+ contentContainerStyle={{ paddingHorizontal: 40 }}
517
+ >
381
518
  {featuredBusiness.map((bAry: any, idx) => (
382
519
  <View key={'f-listing_' + idx}>
383
520
  <BusinessFeaturedController
@@ -400,19 +537,23 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
400
537
  </FeaturedWrapper>
401
538
  )
402
539
  }
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
+ )}
403
555
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
404
- {
405
- !businessId && !props.franchiseId && (
406
- <HighestRatedBusinesses
407
- onBusinessClick={handleBusinessClick}
408
- navigation={navigation}
409
- favoriteIds={favoriteIds}
410
- setFavoriteIds={setFavoriteIds}
411
- />
412
- )
413
- }
414
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
415
- <ListWrapper>
556
+ <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
416
557
  {!businessId && (
417
558
  <BusinessTypeFilter
418
559
  images={props.images}
@@ -430,32 +571,31 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
430
571
  )}
431
572
  />
432
573
  )}
433
- <IOScrollView>
434
- {businessesList.businesses?.map(
435
- (business: any, i: number) => (
436
- <BusinessController
437
- key={`${business.id}_` + i}
438
- enableIntersection
439
- business={business}
440
- isBusinessOpen={business.open}
441
- handleCustomClick={handleBusinessClick}
442
- orderType={orderState?.options?.type}
443
- navigation={navigation}
444
- businessHeader={business?.header}
445
- businessFeatured={business?.featured}
446
- businessLogo={business?.logo}
447
- businessReviews={business?.reviews}
448
- businessDeliveryPrice={business?.delivery_price}
449
- businessDeliveryTime={business?.delivery_time}
450
- businessPickupTime={business?.pickup_time}
451
- businessDistance={business?.distance}
452
- handleUpdateBusinessList={handleUpdateBusinessList}
453
- favoriteIds={favoriteIds}
454
- setFavoriteIds={setFavoriteIds}
455
- />
456
- )
457
- )}
458
- </IOScrollView>
574
+ {businessesList.businesses?.map(
575
+ (business: any, i: number) => (
576
+ <BusinessController
577
+ key={`${business.id}_` + i}
578
+ enableIntersection
579
+ isCustomLayout={isChewLayout}
580
+ business={business}
581
+ isBusinessOpen={business.open}
582
+ handleCustomClick={handleBusinessClick}
583
+ orderType={orderState?.options?.type}
584
+ navigation={navigation}
585
+ businessHeader={business?.header}
586
+ businessFeatured={business?.featured}
587
+ businessLogo={business?.logo}
588
+ businessReviews={business?.reviews}
589
+ businessDeliveryPrice={business?.delivery_price}
590
+ businessDeliveryTime={business?.delivery_time}
591
+ businessPickupTime={business?.pickup_time}
592
+ businessDistance={business?.distance}
593
+ handleUpdateBusinessList={handleUpdateBusinessList}
594
+ favoriteIds={favoriteIds}
595
+ setFavoriteIds={setFavoriteIds}
596
+ />
597
+ )
598
+ )}
459
599
  {businessesList.loading && (
460
600
  <>
461
601
  {[
@@ -508,7 +648,18 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
508
648
  </>
509
649
  )}
510
650
  </ListWrapper>
511
- </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>
512
663
  );
513
664
  };
514
665