ordering-ui-react-native 0.16.38 → 0.16.39-release

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