ordering-ui-react-native 0.16.31 → 0.16.32-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/AddressForm/index.tsx +4 -1
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessInformation/index.tsx +33 -4
  8. package/src/components/BusinessInformation/styles.tsx +2 -2
  9. package/src/components/BusinessProductsList/index.tsx +10 -10
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/LanguageSelector/index.tsx +21 -16
  13. package/src/components/LoginForm/index.tsx +15 -0
  14. package/src/components/Messages/index.tsx +2 -2
  15. package/src/components/NotificationSetting/index.tsx +85 -0
  16. package/src/components/OrderDetails/index.tsx +2 -20
  17. package/src/components/OrdersOption/index.tsx +54 -56
  18. package/src/components/PaymentOptions/index.tsx +335 -365
  19. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  20. package/src/components/ReviewDriver/index.tsx +1 -1
  21. package/src/components/ReviewOrder/index.tsx +2 -1
  22. package/src/components/ReviewProducts/index.tsx +11 -0
  23. package/src/components/SignupForm/index.tsx +15 -0
  24. package/src/components/SingleProductReview/index.tsx +8 -5
  25. package/src/components/StripeElementsForm/index.tsx +25 -16
  26. package/src/components/VerifyPhone/styles.tsx +1 -2
  27. package/src/components/shared/OBottomPopup.tsx +6 -2
  28. package/src/index.tsx +2 -0
  29. package/src/pages/BusinessesListing.tsx +7 -6
  30. package/src/pages/OrderDetails.tsx +1 -1
  31. package/src/pages/ReviewDriver.tsx +2 -2
  32. package/src/pages/ReviewOrder.tsx +2 -2
  33. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  34. package/src/utils/index.tsx +2 -1
  35. package/themes/business/index.tsx +4 -0
  36. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  37. package/themes/business/src/components/Chat/index.tsx +42 -34
  38. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  39. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  40. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  41. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  42. package/themes/business/src/components/MapView/index.tsx +12 -1
  43. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  44. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  45. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  46. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  47. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  48. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  49. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  50. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  52. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  53. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  54. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  55. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  56. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  57. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  58. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  59. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  60. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  61. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  62. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  63. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  64. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  65. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  66. package/themes/business/src/components/shared/OModal.tsx +40 -37
  67. package/themes/business/src/types/index.tsx +15 -9
  68. package/themes/business/src/utils/index.tsx +10 -0
  69. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  70. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  71. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  72. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  73. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  74. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  75. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  76. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  77. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  78. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  79. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  80. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  81. package/themes/kiosk/src/types/index.d.ts +2 -0
  82. package/themes/original/index.tsx +4 -0
  83. package/themes/original/src/components/AddressDetails/index.tsx +1 -1
  84. package/themes/original/src/components/AddressForm/index.tsx +139 -135
  85. package/themes/original/src/components/AddressList/index.tsx +1 -1
  86. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  87. package/themes/original/src/components/BusinessBasicInformation/index.tsx +311 -161
  88. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  89. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  90. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  91. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -4
  92. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  93. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  94. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  95. package/themes/original/src/components/BusinessListingSearch/index.tsx +80 -128
  96. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  97. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  98. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  99. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  100. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  101. package/themes/original/src/components/BusinessProductsListing/index.tsx +172 -103
  102. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  103. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  104. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  105. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  106. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  107. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +254 -97
  108. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +46 -2
  109. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  110. package/themes/original/src/components/Cart/index.tsx +44 -12
  111. package/themes/original/src/components/Cart/styles.tsx +4 -0
  112. package/themes/original/src/components/CartContent/index.tsx +22 -16
  113. package/themes/original/src/components/Checkout/index.tsx +101 -61
  114. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  115. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  116. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  117. package/themes/original/src/components/Favorite/index.tsx +1 -0
  118. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  119. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  120. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  121. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  122. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  123. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  124. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  125. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -72
  128. package/themes/original/src/components/LoginForm/index.tsx +83 -45
  129. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  130. package/themes/original/src/components/Messages/index.tsx +17 -17
  131. package/themes/original/src/components/MomentOption/index.tsx +1 -1
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  133. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  135. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  136. package/themes/original/src/components/NavBar/index.tsx +15 -9
  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 +192 -37
  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 +8 -2
  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 +633 -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 +6 -6
  166. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  167. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  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 +199 -110
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -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 +15 -7
  180. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  181. package/themes/original/src/components/UserDetails/index.tsx +31 -17
  182. package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
  183. package/themes/original/src/components/UserProfile/index.tsx +54 -29
  184. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  185. package/themes/original/src/components/UserProfileForm/index.tsx +15 -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 +3 -2
  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 +66 -0
  199. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
3
+ import { IOScrollView } from 'react-native-intersection-observer'
3
4
  import Geolocation from '@react-native-community/geolocation'
4
5
  import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
5
6
  import {
@@ -21,6 +22,7 @@ import {
21
22
  } from 'ordering-components/native';
22
23
  import { useTheme } from 'styled-components/native';
23
24
  import Ionicons from 'react-native-vector-icons/Ionicons'
25
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
24
26
 
25
27
  import {
26
28
  Search,
@@ -32,7 +34,7 @@ import {
32
34
  FeaturedWrapper,
33
35
  OrderProgressWrapper,
34
36
  FarAwayMessage,
35
- SearchBarWrapper,
37
+ SearchBarWrapper,
36
38
  MomentWrapper,
37
39
  FilterWrapper,
38
40
  ServiceWrapper,
@@ -70,8 +72,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
70
72
  isGuestUser,
71
73
  handleUpdateBusinessList,
72
74
  priceLevelSelected,
73
- handleChangePriceLevel,
74
- businessTypeSelected
75
+ handleChangePriceLevel,
76
+ businessTypeSelected
75
77
  } = props;
76
78
  const theme = useTheme();
77
79
  const isFocused = useIsFocused();
@@ -104,8 +106,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
104
106
  },
105
107
  searchInput: {
106
108
  fontSize: 12,
107
- // backgroundColor: theme.colors.white,
108
- paddingLeft: 10,
109
+ paddingLeft: 0,
110
+ paddingRight: 17,
109
111
  paddingTop: 7
110
112
  },
111
113
  iconStyle: {
@@ -269,7 +271,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
269
271
  }, [businessesList?.businesses?.length])
270
272
 
271
273
  return (
272
- <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
274
+ <IOScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
273
275
  refreshControl={
274
276
  <RefreshControl
275
277
  refreshing={refreshing}
@@ -282,7 +284,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
282
284
  style={{ paddingTop: top + 20 }}>
283
285
  {!auth && (
284
286
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
285
- <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
287
+ <IconAntDesign name='arrowleft' size={26} />
286
288
  </TouchableOpacity>
287
289
  )}
288
290
  <Search>
@@ -319,7 +321,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
319
321
  </MomentWrapper>
320
322
  <View style={styles.wrapperOrderOptions}>
321
323
  <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
322
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
324
+ <OText
325
+ size={12}
326
+ numberOfLines={1}
327
+ ellipsizeMode={'tail'}
328
+ color={theme.colors.textSecondary}
329
+ style={{ textAlign: 'left' }}
330
+ >
331
+ {t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}
332
+ </OText>
323
333
  <OIcon
324
334
  src={theme.images.general.arrow_down}
325
335
  width={10}
@@ -327,22 +337,23 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
327
337
  />
328
338
  </WrapMomentOption>
329
339
  {!businessId && (
330
- <SearchBarWrapper>
331
- <SearchBar
332
- onSearch={handleChangeSearch}
333
- searchValue={searchValue}
334
- lazyLoad
335
- isCancelXButtonShow={!!searchValue}
336
- borderStyle={styles.borderStyle}
337
- onCancel={() => handleChangeSearch('')}
338
- placeholder={t('SEARCH', 'Search')}
339
- height={80}
340
- isAppointment
341
- isDisabled={!businessTypes}
342
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
343
- onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
344
- />
345
- </SearchBarWrapper>
340
+ <SearchBarWrapper>
341
+ <SearchBar
342
+ onSearch={handleChangeSearch}
343
+ searchValue={searchValue}
344
+ lazyLoad
345
+ isCancelXButtonShow={!!searchValue}
346
+ borderStyle={styles.borderStyle}
347
+ onCancel={() => handleChangeSearch('')}
348
+ placeholder={t('SEARCH', 'Search')}
349
+ height={80}
350
+ isAppointment
351
+ isDisabled={!businessTypes || configs?.advanced_business_search_enabled?.value === '1'}
352
+ inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
353
+ onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
354
+ onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
355
+ />
356
+ </SearchBarWrapper>
346
357
  )}
347
358
  </View>
348
359
  </OrderControlContainer>
@@ -463,6 +474,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
463
474
  (business: any, i: number) => (
464
475
  <BusinessController
465
476
  key={`${business.id}_` + i}
477
+ enableIntersection
466
478
  business={business}
467
479
  isBusinessOpen={business.open}
468
480
  handleCustomClick={handleBusinessClick}
@@ -534,7 +546,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
534
546
  </>
535
547
  )}
536
548
  </ListWrapper>
537
- </ScrollView>
549
+ </IOScrollView>
538
550
  );
539
551
  };
540
552
 
@@ -43,8 +43,9 @@ export const WrapMomentOption = styled.TouchableOpacity`
43
43
  font-size: 12px;
44
44
  max-width: 240px;
45
45
  height: 26px;
46
+ width: 130px;
46
47
  align-items: center;
47
- justify-content: center;
48
+ justify-content: space-between;
48
49
  padding-horizontal: 8px;
49
50
  flex-direction: row;
50
51
  margin-end: 12px;
@@ -84,7 +85,7 @@ export const FarAwayMessage = styled.View`
84
85
  `
85
86
 
86
87
  export const SearchBarWrapper = styled.View`
87
- width: 100px;
88
+ width: 130px;
88
89
  `
89
90
 
90
91
  export const MomentWrapper = styled.View`
@@ -97,10 +98,10 @@ export const FilterWrapper = styled.View`
97
98
  `
98
99
 
99
100
  export const ServiceWrapper = styled.View`
100
- padding-left: 40px;
101
+ padding-horizontal: 40px;
101
102
  `
102
103
 
103
104
  export const PriceWrapper = styled.View`
104
- padding-left: 40px;
105
+ padding-horizontal: 40px;
105
106
  margin-top: 30px;
106
107
  `
@@ -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'
@@ -32,11 +34,14 @@ import {
32
34
  FeaturedWrapper,
33
35
  OrderProgressWrapper,
34
36
  FarAwayMessage,
35
- AddressInputContainer
37
+ AddressInputContainer,
38
+ PreorderInput,
39
+ OrderTypesContainer,
40
+ BusinessLogosContainer
36
41
  } from './styles';
37
42
 
38
43
  import { SearchBar } from '../../../SearchBar';
39
- import { OIcon, OText } from '../../../shared';
44
+ import { OButton, OIcon, OText, OBottomPopup, OModal } from '../../../shared';
40
45
  import { BusinessesListingParams } from '../../../../types';
41
46
  import { NotFoundSource } from '../../../NotFoundSource';
42
47
  import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
@@ -48,6 +53,8 @@ import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
48
53
  import { getTypesText, convertToRadian } from '../../../../utils';
49
54
  import { OrderProgress } from '../../../OrderProgress';
50
55
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
56
+ import FastImage from 'react-native-fast-image';
57
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
51
58
 
52
59
  const PIXELS_TO_SCROLL = 2000;
53
60
 
@@ -63,13 +70,21 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
63
70
  handleChangeSearch,
64
71
  businessId,
65
72
  isGuestUser,
66
- handleUpdateBusinessList
73
+ handleUpdateBusinessList,
74
+ citiesState,
75
+ actualSlug,
76
+ logosLayout
67
77
  } = props;
68
78
  const theme = useTheme();
79
+ const [orderingTheme] = useOrderingTheme()
69
80
  const isFocused = useIsFocused();
70
81
  const appState = useRef(AppState.currentState)
82
+ const searchBarRef = useRef<any>()
71
83
  const [appStateVisible, setAppStateVisible] = useState(appState.current);
84
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
85
+ const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
72
86
  const [refreshing] = useState(false);
87
+ const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
73
88
  const styles = StyleSheet.create({
74
89
  container: {
75
90
  marginBottom: 0,
@@ -113,13 +128,29 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
113
128
  backgroundColor: theme.colors.white,
114
129
  borderColor: theme.colors.backgroundGray,
115
130
  borderWidth: 1,
116
- }
131
+ },
132
+ buttonCityStyle: {
133
+ backgroundColor: theme.colors.white,
134
+ borderColor: theme.colors.backgroundGray,
135
+ borderRadius: 8,
136
+ marginHorizontal: 40,
137
+ minHeight: 45,
138
+ paddingVertical: 5,
139
+ paddingHorizontal: 20,
140
+ borderWidth: 1
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,13 @@ 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 }]
147
170
 
148
171
  const handleMomentClick = () => {
149
172
  if (isPreorderEnabled) {
@@ -163,7 +186,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
163
186
  paginationProps.totalPages === paginationProps.currentPage
164
187
  );
165
188
 
166
- if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore) {
189
+ if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore && businessesList?.businesses?.length > 0) {
167
190
  getBusinesses();
168
191
  }
169
192
  };
@@ -180,10 +203,17 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
180
203
  }
181
204
 
182
205
  const resetInactivityTimeout = () => {
183
- clearTimeout(timerId.current)
184
- timerId.current = setInterval(() => {
185
- getBusinesses(true)
186
- }, 120000)
206
+ if (!logosLayout) {
207
+ clearTimeout(timerId.current)
208
+ timerId.current = setInterval(() => {
209
+ getBusinesses(true)
210
+ }, 120000)
211
+ }
212
+ }
213
+
214
+ const handleChangeCity = (cityId: number | null) => {
215
+ changeCityFilter(orderState?.options?.city_id === cityId ? null : cityId)
216
+ setIsOpenCities(false)
187
217
  }
188
218
 
189
219
  useEffect(() => {
@@ -224,7 +254,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
224
254
  }
225
255
 
226
256
  useEffect(() => {
227
- checkUserLocation()
257
+ if (!logosLayout) {
258
+ checkUserLocation()
259
+ }
228
260
  }, [orderState?.options?.address?.location])
229
261
 
230
262
  useEffect(() => {
@@ -251,8 +283,69 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
251
283
  setFavoriteIds([...new Set(ids)])
252
284
  }, [businessesList?.businesses?.length])
253
285
 
286
+ useEffect(() => {
287
+ setIsOpenCities(false)
288
+ }, [orderState?.options?.city_id])
289
+
290
+ if (logosLayout) {
291
+ return (
292
+ <BusinessLogosContainer
293
+ horizontal
294
+ showsHorizontalScrollIndicator={false}
295
+ >
296
+ {businessesList?.loading ? (
297
+ <Placeholder Animation={Fade}>
298
+ <View style={{ flexDirection: 'row' }}>
299
+ {[...Array(10).keys()].map(i => (
300
+ <View style={styles.businessSkeleton} key={i}>
301
+ <PlaceholderLine style={{ width: '100%', height: '100%' }} />
302
+ </View>
303
+ ))}
304
+ </View>
305
+ </Placeholder>
306
+ ) : (
307
+ <>
308
+ {businessesList.businesses
309
+ ?.filter(business => business?.open)
310
+ ?.map(business => (
311
+ <TouchableOpacity
312
+ key={business?.id}
313
+ onPress={() => handleBusinessClick && handleBusinessClick(business)}
314
+ style={{
315
+ width: 57,
316
+ height: 58,
317
+ borderBottomColor: theme.colors.primary,
318
+ borderBottomWidth: business?.slug === actualSlug ? 2 : 0,
319
+ marginRight: 5
320
+ }}
321
+ >
322
+ <FastImage
323
+ style={{
324
+ width: 56,
325
+ height: 56,
326
+ marginRight: 20,
327
+ borderTopLeftRadius: 7.6,
328
+ borderTopRightRadius: 7.6
329
+ }}
330
+ source={{
331
+ uri: business?.logo,
332
+ priority: FastImage.priority.normal,
333
+ }}
334
+ resizeMode={FastImage.resizeMode.cover}
335
+ />
336
+ </TouchableOpacity>
337
+ ))}
338
+ </>
339
+ )}
340
+ </BusinessLogosContainer>
341
+ )
342
+ }
343
+
254
344
  return (
255
- <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
345
+ <IOScrollView
346
+ style={styles.container}
347
+ onScroll={(e) => handleScroll(e)}
348
+ showsVerticalScrollIndicator={false}
256
349
  refreshControl={
257
350
  <RefreshControl
258
351
  refreshing={refreshing}
@@ -260,9 +353,22 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
260
353
  />
261
354
  }
262
355
  >
263
- <View style={{ height: isFarAway ? 150 : 100, marginTop: Platform.OS == 'ios' ? 0 : 50 }}>
264
- <Search>
356
+ <View style={{
357
+ height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
358
+ marginTop: Platform.OS == 'ios' ? 0 : 50,
359
+ backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
360
+ }}
361
+ >
362
+ {isChewLayout && (
363
+ <View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
364
+ <OText size={18} weight={700} color={theme.colors?.white}>
365
+ {t('WELCOME', 'Welcome')} {user?.name}!
366
+ </OText>
367
+ </View>
368
+ )}
369
+ <Search isChewLayout={isChewLayout}>
265
370
  <AddressInput
371
+ isChewLayout={isChewLayout}
266
372
  onPress={() =>
267
373
  auth
268
374
  ? navigation.navigate('AddressList', { isFromBusinesses: true })
@@ -272,95 +378,119 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
272
378
  isGuestUser: isGuestUser
273
379
  })
274
380
  }>
275
- <AddressInputContainer>
381
+ <AddressInputContainer isChewLayout={isChewLayout}>
276
382
  <OIcon
277
383
  src={theme.images.general.pin}
278
384
  color={theme.colors.disabled}
279
385
  width={16}
280
- style={{ marginRight: 10 }}
386
+ style={{ marginRight: isChewLayout ? 0 : 10 }}
281
387
  />
282
- <OText size={12} numberOfLines={1}>
388
+ <OText size={12} numberOfLines={1} style={{ flex: 1 }}>
283
389
  {orderState?.options?.address?.address}
284
390
  </OText>
285
- <OIcon
286
- src={theme.images.general.arrow_down}
287
- width={10}
288
- style={{ marginStart: 8 }}
289
- />
391
+ {!isChewLayout && (
392
+ <OIcon
393
+ src={theme.images.general.arrow_down}
394
+ width={10}
395
+ style={{ marginStart: 8 }}
396
+ />
397
+ )}
290
398
  </AddressInputContainer>
291
399
  </AddressInput>
292
400
  </Search>
293
- {isFarAway && (
401
+ {isFarAway && !isChewLayout && (
294
402
  <FarAwayMessage style={styles.farAwayMsg}>
295
403
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
296
404
  <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
405
  </FarAwayMessage>
298
406
  )}
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
- )}
407
+ {!isChewLayout ? (
408
+ <OrderControlContainer>
409
+ <View style={styles.wrapperOrderOptions}>
410
+ {isPreOrderSetting && (
411
+ <WrapMomentOption
412
+ onPress={() => handleMomentClick()}>
413
+ <OText
414
+ size={12}
415
+ numberOfLines={1}
416
+ ellipsizeMode="tail"
417
+ color={theme.colors.textSecondary}>
418
+ {orderState.options?.moment
419
+ ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
420
+ : t('ASAP_ABBREVIATION', 'ASAP')}
421
+ </OText>
422
+ {isPreorderEnabled && (
423
+ <OIcon
424
+ src={theme.images.general.arrow_down}
425
+ width={10}
426
+ style={{ marginStart: 8 }}
427
+ />
428
+ )}
429
+ </WrapMomentOption>
430
+ )}
431
+ <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
432
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
433
+ <OIcon
434
+ src={theme.images.general.arrow_down}
435
+ width={10}
436
+ style={{ marginStart: 8 }}
437
+ />
321
438
  </WrapMomentOption>
439
+ </View>
440
+ </OrderControlContainer>
441
+ ) : (
442
+ <>
443
+ {isPreOrderSetting && (
444
+ <View style={{ paddingHorizontal: 30 }}>
445
+ <PreorderInput
446
+ isChewLayout={isChewLayout}
447
+ onPress={() => handleMomentClick()}
448
+ >
449
+ <OText color={theme.colors.textSecondary}>
450
+ {orderState.options?.moment
451
+ ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
452
+ : t('ASAP_ABBREVIATION', 'ASAP')}</OText>
453
+ </PreorderInput>
454
+ </View>
322
455
  )}
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>
456
+ </>
457
+ )}
333
458
  </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 }} />
459
+ {!isChewLayout ? (
460
+ <HeaderWrapper
461
+ source={bgHeader ? {uri: bgHeader} : theme.images.backgrounds.business_list_header}
462
+ style={{ paddingTop: top + 20 }}
463
+ resizeMode='cover'
464
+ >
465
+ {!auth && (
466
+
467
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
468
+ <IconAntDesign name='arrowleft' size={26} />
469
+ </TouchableOpacity>
470
+ )}
471
+ </HeaderWrapper>
472
+ ) : (
473
+ <OrderTypesContainer>
474
+ <OrderTypeSelector
475
+ handleChangeBusinessType={handleChangeBusinessType}
476
+ isChewLayout
477
+ chewOrderTypes={chewOrderTypes}
478
+ handleChangeType={setOrderTypeValue}
479
+ />
480
+ </OrderTypesContainer>
481
+ )}
482
+
483
+ {!hideCities && orderTypeValue === 2 && (
484
+ <View style={{ marginTop: 20 }}>
485
+ <TouchableOpacity
486
+ style={styles.buttonCityStyle}
487
+ onPress={() => setIsOpenCities(true)}
488
+ >
489
+ <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
490
+ {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
491
+ </OText>
342
492
  </TouchableOpacity>
343
- )}
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
- />
493
+ </View>
364
494
  )}
365
495
  <OrderProgressWrapper>
366
496
  <OrderProgress
@@ -368,7 +498,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
368
498
  isFocused={isFocused}
369
499
  />
370
500
  </OrderProgressWrapper>
371
-
372
501
  {
373
502
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
374
503
  <FeaturedWrapper>
@@ -376,7 +505,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
376
505
  <ScrollView
377
506
  showsHorizontalScrollIndicator={false}
378
507
  nestedScrollEnabled
379
- horizontal contentContainerStyle={{ paddingHorizontal: 40 }}>
508
+ horizontal
509
+ contentContainerStyle={{ paddingHorizontal: 40 }}
510
+ >
380
511
  {featuredBusiness.map((bAry: any, idx) => (
381
512
  <View key={'f-listing_' + idx}>
382
513
  <BusinessFeaturedController
@@ -433,6 +564,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
433
564
  (business: any, i: number) => (
434
565
  <BusinessController
435
566
  key={`${business.id}_` + i}
567
+ enableIntersection
436
568
  business={business}
437
569
  isBusinessOpen={business.open}
438
570
  handleCustomClick={handleBusinessClick}
@@ -504,7 +636,32 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
504
636
  </>
505
637
  )}
506
638
  </ListWrapper>
507
- </ScrollView>
639
+ <OModal
640
+ open={isOpenCities}
641
+ onClose={() => setIsOpenCities(false)}
642
+ title={t('SELECT_A_CITY', 'Select a city')}
643
+ >
644
+ <View style={{ padding: 40, width: '100%' }}>
645
+ {citiesState?.cities?.map((city: any) => (
646
+ <TouchableOpacity
647
+ key={city?.id}
648
+ style={{
649
+ padding: 10,
650
+ borderBottomWidth: 1,
651
+ borderBottomColor: orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.backgroundGray,
652
+ marginBottom: 10,
653
+ }}
654
+ onPress={() => handleChangeCity(city?.id)}
655
+ disabled={orderState?.loading}
656
+ >
657
+ <OText color={orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.black}>
658
+ {city?.name}
659
+ </OText>
660
+ </TouchableOpacity>
661
+ ))}
662
+ </View>
663
+ </OModal>
664
+ </IOScrollView>
508
665
  );
509
666
  };
510
667