ordering-ui-react-native 0.16.53 → 0.16.54-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 (208) 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/SingleProductReview/index.tsx +7 -4
  17. package/src/components/StripeElementsForm/index.tsx +25 -16
  18. package/src/components/VerifyPhone/styles.tsx +1 -2
  19. package/src/components/shared/OBottomPopup.tsx +6 -2
  20. package/src/components/shared/OToast.tsx +4 -4
  21. package/src/index.tsx +2 -0
  22. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  23. package/src/utils/index.tsx +2 -1
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  26. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  27. package/themes/business/src/components/Chat/index.tsx +40 -32
  28. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  29. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  30. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  31. package/themes/business/src/components/MapView/index.tsx +12 -1
  32. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  33. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  34. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +40 -30
  35. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  36. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  37. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  38. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  39. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  42. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  45. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  46. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  47. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  48. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  49. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  50. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  51. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  52. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  53. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  54. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  55. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  56. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  57. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  58. package/themes/business/src/components/shared/OLink.tsx +24 -12
  59. package/themes/business/src/components/shared/OText.tsx +3 -2
  60. package/themes/business/src/types/index.tsx +25 -11
  61. package/themes/business/src/utils/index.tsx +10 -0
  62. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  63. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  64. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  65. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  66. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  67. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  68. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  69. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  70. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  71. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  72. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  73. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  74. package/themes/kiosk/src/types/index.d.ts +2 -0
  75. package/themes/original/index.tsx +8 -6
  76. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  77. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  78. package/themes/original/src/components/AddressList/index.tsx +1 -1
  79. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  80. package/themes/original/src/components/BusinessBasicInformation/index.tsx +53 -37
  81. package/themes/original/src/components/BusinessController/index.tsx +193 -91
  82. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  83. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  84. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  85. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  86. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  87. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  88. package/themes/original/src/components/BusinessListingSearch/index.tsx +85 -137
  89. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  90. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  91. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  92. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -61
  93. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  94. package/themes/original/src/components/BusinessProductsListing/index.tsx +156 -86
  95. package/themes/original/src/components/BusinessProductsListing/styles.tsx +14 -12
  96. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  97. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +28 -29
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +118 -111
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  100. package/themes/original/src/components/BusinessesListing/index.tsx +51 -71
  101. package/themes/original/src/components/Cart/index.tsx +82 -15
  102. package/themes/original/src/components/Cart/styles.tsx +4 -0
  103. package/themes/original/src/components/CartContent/index.tsx +27 -17
  104. package/themes/original/src/components/CartContent/styles.tsx +1 -1
  105. package/themes/original/src/components/Checkout/index.tsx +115 -118
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  112. package/themes/original/src/components/FloatingButton/index.tsx +13 -11
  113. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  114. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  115. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  116. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  117. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  118. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  119. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  120. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  121. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  122. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  123. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  124. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  125. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  126. package/themes/original/src/components/Messages/index.tsx +35 -20
  127. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  128. package/themes/original/src/components/MultiCart/index.tsx +63 -0
  129. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  130. package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  132. package/themes/original/src/components/MyOrders/index.tsx +88 -24
  133. package/themes/original/src/components/NavBar/index.tsx +11 -5
  134. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  135. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  136. package/themes/original/src/components/Notifications/index.tsx +148 -0
  137. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  138. package/themes/original/src/components/OrderDetails/index.tsx +162 -50
  139. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  140. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  141. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  142. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  143. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  144. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  145. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  146. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  147. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  148. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  149. package/themes/original/src/components/OrdersOption/index.tsx +93 -53
  150. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  151. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  152. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  153. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  154. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  155. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  156. package/themes/original/src/components/ProductForm/index.tsx +367 -384
  157. package/themes/original/src/components/ProductForm/styles.tsx +7 -12
  158. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  159. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  160. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  161. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  162. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  163. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  164. package/themes/original/src/components/Promotions/index.tsx +232 -219
  165. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  166. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  167. package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
  168. package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
  169. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  170. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
  171. package/themes/original/src/components/{Reviews/ReviewOrder → ReviewTrigger}/styles.tsx +10 -22
  172. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  173. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  174. package/themes/original/src/components/ServiceForm/index.tsx +330 -266
  175. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  176. package/themes/original/src/components/SingleOrderCard/index.tsx +219 -129
  177. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  178. package/themes/original/src/components/SingleProductCard/index.tsx +194 -128
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  180. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  181. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  182. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  183. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  184. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  185. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  186. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  187. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  188. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  189. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  190. package/themes/original/src/components/Wallets/index.tsx +176 -164
  191. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  192. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  193. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  194. package/themes/original/src/components/shared/OBottomPopup.tsx +36 -22
  195. package/themes/original/src/components/shared/OButton.tsx +8 -3
  196. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  197. package/themes/original/src/components/shared/OInput.tsx +10 -1
  198. package/themes/original/src/layouts/Container.tsx +13 -9
  199. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  200. package/themes/original/src/types/index.tsx +65 -13
  201. package/themes/original/src/utils/index.tsx +103 -58
  202. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  203. package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +0 -301
  204. package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +0 -39
  205. package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +0 -326
  206. package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +0 -101
  207. package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +0 -17
  208. package/themes/original/src/components/Reviews/index.tsx +0 -9
@@ -1,8 +1,5 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
- export const ContainerSafeAreaView = styled.SafeAreaView`
4
- `
5
-
6
3
  export const WrapHeader = styled.View`
7
4
  position: relative;
8
5
  `
@@ -14,7 +11,6 @@ export const TopHeader = styled.View`
14
11
  z-index: 1;
15
12
  height: 60px;
16
13
  min-height: 60px;
17
- margin-top: ${(props : any) => props.isIos ? '0' : '40px'};
18
14
  `
19
15
  export const AddressInput = styled.TouchableOpacity`
20
16
  flex: 1;
@@ -28,7 +24,7 @@ export const WrapSearchBar = styled.View`
28
24
  flex: 1;
29
25
  `
30
26
  export const WrapContent = styled.View`
31
- padding: 10px 40px;
27
+ padding-vertical: 10px;
32
28
  `
33
29
 
34
30
  export const BusinessProductsListingContainer = styled.ScrollView`
@@ -41,18 +37,16 @@ export const BusinessProductsListingContainer = styled.ScrollView`
41
37
  export const FiltProductsContainer = styled.ScrollView`
42
38
  position: absolute;
43
39
  width: 100%;
44
- z-index: 2000;
45
- top: ${(props : any) => props.isIos ? '40px': '80px'};
46
- margin-top: 20px;
40
+ z-index: 20000;
47
41
  `
48
42
 
49
43
  export const BackgroundGray = styled.View`
50
44
  flex: 1;
51
- height: 100%;
45
+ height: ${(props: any) => props.isIos ? '80%' : '100%'};
52
46
  background-color: rgba(0,0,0,0.5);
53
- position: absolute;
54
- margin-top: 100px;
55
- z-index: 100;
47
+ position: absolute;
48
+ margin-top: 100px;
49
+ z-index: 10000;
56
50
  width: 100%;
57
51
  `
58
52
 
@@ -64,4 +58,12 @@ export const ProfessionalFilterWrapper = styled.View`
64
58
  export const NearBusiness = styled.View`
65
59
  width: 100%;
66
60
  padding-left: 20px;
61
+ max-height: 80px;
67
62
  `
63
+
64
+ export const TopActions = styled.TouchableOpacity`
65
+ height: 60px;
66
+ justify-content: center;
67
+ padding-horizontal: 30px;
68
+ width: 100px;
69
+ `;
@@ -38,6 +38,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
38
38
 
39
39
  const theme = useTheme();
40
40
  const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
41
+ const defaultImage = (name : string) => theme.images?.categories?.[name.toLowerCase().replace(' ', '')]
41
42
 
42
43
  useEffect(() => {
43
44
  if(typesState?.types?.length > 0){
@@ -197,9 +198,9 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
197
198
  isOpenAllCategories && setIsOpenAllCategories(false)
198
199
  }}
199
200
  >
200
- {item.image ? (
201
+ {(defaultImage(item.name) || item.image) ? (
201
202
  <OIcon
202
- url={item.image}
203
+ url={typeof item.name === 'number' ? item.image || defaultImage(item.name) : defaultImage(item.name) || item.image}
203
204
  style={styles.logo}
204
205
  />
205
206
  ) : (
@@ -22,6 +22,7 @@ import {
22
22
  } from 'ordering-components/native';
23
23
  import { useTheme } from 'styled-components/native';
24
24
  import Ionicons from 'react-native-vector-icons/Ionicons'
25
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
25
26
 
26
27
  import {
27
28
  Search,
@@ -270,7 +271,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
270
271
  }, [businessesList?.businesses?.length])
271
272
 
272
273
  return (
273
- <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
274
+ <IOScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
274
275
  refreshControl={
275
276
  <RefreshControl
276
277
  refreshing={refreshing}
@@ -283,7 +284,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
283
284
  style={{ paddingTop: top + 20 }}>
284
285
  {!auth && (
285
286
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
286
- <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
287
+ <IconAntDesign name='arrowleft' size={26} />
287
288
  </TouchableOpacity>
288
289
  )}
289
290
  <Search>
@@ -469,32 +470,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
469
470
  )}
470
471
  />
471
472
  )}
472
- <IOScrollView>
473
- {businessesList.businesses?.map(
474
- (business: any, i: number) => (
475
- <BusinessController
476
- key={`${business.id}_` + i}
477
- enableIntersection
478
- business={business}
479
- isBusinessOpen={business.open}
480
- handleCustomClick={handleBusinessClick}
481
- orderType={orderState?.options?.type}
482
- navigation={navigation}
483
- businessHeader={business?.header}
484
- businessFeatured={business?.featured}
485
- businessLogo={business?.logo}
486
- businessReviews={business?.reviews}
487
- businessDeliveryPrice={business?.delivery_price}
488
- businessDeliveryTime={business?.delivery_time}
489
- businessPickupTime={business?.pickup_time}
490
- businessDistance={business?.distance}
491
- handleUpdateBusinessList={handleUpdateBusinessList}
492
- favoriteIds={favoriteIds}
493
- setFavoriteIds={setFavoriteIds}
494
- />
495
- )
496
- )}
497
- </IOScrollView>
473
+ {businessesList.businesses?.map(
474
+ (business: any, i: number) => (
475
+ <BusinessController
476
+ key={`${business.id}_` + i}
477
+ enableIntersection
478
+ business={business}
479
+ isBusinessOpen={business.open}
480
+ handleCustomClick={handleBusinessClick}
481
+ orderType={orderState?.options?.type}
482
+ navigation={navigation}
483
+ businessHeader={business?.header}
484
+ businessFeatured={business?.featured}
485
+ businessLogo={business?.logo}
486
+ businessReviews={business?.reviews}
487
+ businessDeliveryPrice={business?.delivery_price}
488
+ businessDeliveryTime={business?.delivery_time}
489
+ businessPickupTime={business?.pickup_time}
490
+ businessDistance={business?.distance}
491
+ handleUpdateBusinessList={handleUpdateBusinessList}
492
+ favoriteIds={favoriteIds}
493
+ setFavoriteIds={setFavoriteIds}
494
+ />
495
+ )
496
+ )}
498
497
  {businessesList.loading && (
499
498
  <>
500
499
  {[
@@ -547,7 +546,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
547
546
  </>
548
547
  )}
549
548
  </ListWrapper>
550
- </ScrollView>
549
+ </IOScrollView>
551
550
  );
552
551
  };
553
552
 
@@ -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,
@@ -31,7 +32,6 @@ import {
31
32
  HeaderWrapper,
32
33
  ListWrapper,
33
34
  FeaturedWrapper,
34
- OrderProgressWrapper,
35
35
  FarAwayMessage,
36
36
  AddressInputContainer,
37
37
  PreorderInput,
@@ -39,8 +39,7 @@ import {
39
39
  BusinessLogosContainer
40
40
  } from './styles';
41
41
 
42
- import { SearchBar } from '../../../SearchBar';
43
- import { OButton, OIcon, OText, OBottomPopup, OModal } from '../../../shared';
42
+ import { OIcon, OText, OModal } from '../../../shared';
44
43
  import { BusinessesListingParams } from '../../../../types';
45
44
  import { NotFoundSource } from '../../../NotFoundSource';
46
45
  import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
@@ -49,10 +48,12 @@ import { OrderTypeSelector } from '../../../OrderTypeSelector';
49
48
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
50
49
  import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
51
50
  import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
52
- import { getTypesText, convertToRadian } from '../../../../utils';
51
+ import { getTypesText } from '../../../../utils';
53
52
  import { OrderProgress } from '../../../OrderProgress';
54
53
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
55
54
  import FastImage from 'react-native-fast-image';
55
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
56
+ import { CitiesControl } from '../../../CitiesControl'
56
57
 
57
58
  const PIXELS_TO_SCROLL = 2000;
58
59
 
@@ -60,12 +61,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
60
61
  const {
61
62
  navigation,
62
63
  businessesList,
63
- searchValue,
64
64
  getBusinesses,
65
65
  handleChangeBusinessType,
66
66
  handleBusinessClick,
67
67
  paginationProps,
68
- handleChangeSearch,
69
68
  businessId,
70
69
  isGuestUser,
71
70
  handleUpdateBusinessList,
@@ -77,11 +76,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
77
76
  const [orderingTheme] = useOrderingTheme()
78
77
  const isFocused = useIsFocused();
79
78
  const appState = useRef(AppState.currentState)
80
- const searchBarRef = useRef<any>()
81
- const [appStateVisible, setAppStateVisible] = useState(appState.current);
82
- const isChewLayout = theme?.layouts?.header?.components?.layout?.type === 'chew'
83
- const showCities = !orderingTheme?.theme?.business_listing_view?.components?.cities?.hidden
79
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
80
+ const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
84
81
  const [refreshing] = useState(false);
82
+ const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
85
83
  const styles = StyleSheet.create({
86
84
  container: {
87
85
  marginBottom: 0,
@@ -131,8 +129,18 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
131
129
  borderColor: theme.colors.backgroundGray,
132
130
  borderRadius: 8,
133
131
  marginHorizontal: 40,
134
- height: 45
135
- }
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
+ },
136
144
  });
137
145
 
138
146
 
@@ -155,16 +163,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
155
163
  const timerId = useRef<any>(false)
156
164
  const [favoriteIds, setFavoriteIds] = useState<any>([])
157
165
  const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
158
-
159
- // const panResponder = useRef(
160
- // PanResponder.create({
161
- // onMoveShouldSetPanResponder: (e, gestureState) => {
162
- // const { dx, dy } = gestureState;
163
- // resetInactivityTimeout()
164
- // return (Math.abs(dx) > 20) || (Math.abs(dy) > 20);
165
- // },
166
- // })
167
- // ).current
166
+ const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
168
167
 
169
168
  const handleMomentClick = () => {
170
169
  if (isPreorderEnabled) {
@@ -184,11 +183,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
184
183
  paginationProps.totalPages === paginationProps.currentPage
185
184
  );
186
185
 
187
- if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore) {
186
+ if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore && businessesList?.businesses?.length > 0) {
188
187
  getBusinesses();
189
188
  }
190
189
  };
191
190
 
191
+ const convertToRadian = (value: number) => {
192
+ return value * Math.PI / 180
193
+ }
194
+
192
195
  const getDistance = (lat1: any, lon1: any, lat2: any, lon2: any) => {
193
196
  const R = 6371 // km
194
197
  const dLat = convertToRadian(lat2 - lat1)
@@ -201,7 +204,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
201
204
  }
202
205
 
203
206
  const resetInactivityTimeout = () => {
204
- if(!logosLayout){
207
+ if (!logosLayout) {
205
208
  clearTimeout(timerId.current)
206
209
  timerId.current = setInterval(() => {
207
210
  getBusinesses(true)
@@ -209,6 +212,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
209
212
  }
210
213
  }
211
214
 
215
+ const handleChangeCity = (cityId: number | null) => {
216
+ changeCityFilter(orderState?.options?.city_id === cityId ? null : cityId)
217
+ setIsOpenCities(false)
218
+ }
219
+
212
220
  useEffect(() => {
213
221
  if (!businessesList?.loading) {
214
222
  const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
@@ -247,7 +255,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
247
255
  }
248
256
 
249
257
  useEffect(() => {
250
- if(!logosLayout){
258
+ if (!logosLayout) {
251
259
  checkUserLocation()
252
260
  }
253
261
  }, [orderState?.options?.address?.location])
@@ -282,24 +290,44 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
282
290
 
283
291
  if (logosLayout) {
284
292
  return (
285
- <BusinessLogosContainer horizontal>
293
+ <BusinessLogosContainer
294
+ horizontal
295
+ showsHorizontalScrollIndicator={false}
296
+ >
286
297
  {businessesList?.loading ? (
287
- <Placeholder Animation={Fade}>
288
- {[...Array(10).keys()].map(item => (
289
- <PlaceholderLine key={item} width={56} height={56} />
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>
290
304
  ))}
291
- </Placeholder>
305
+ </View>
306
+ </Placeholder>
292
307
  ) : (
293
308
  <>
294
309
  {businessesList.businesses
295
- ?.filter(business => business?.slug !== actualSlug && business?.open)
310
+ ?.filter(business => business?.open)
296
311
  ?.map(business => (
297
312
  <TouchableOpacity
298
313
  key={business?.id}
299
314
  onPress={() => handleBusinessClick && handleBusinessClick(business)}
315
+ style={{
316
+ width: 60,
317
+ height: 60,
318
+ borderRadius: 8,
319
+ marginRight: 5
320
+ }}
300
321
  >
301
322
  <FastImage
302
- style={{ width: 56, height: 56, marginRight: 20, borderRadius: 7.6 }}
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
+ }}
303
331
  source={{
304
332
  uri: business?.logo,
305
333
  priority: FastImage.priority.normal,
@@ -315,7 +343,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
315
343
  }
316
344
 
317
345
  return (
318
- <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
346
+ <IOScrollView
347
+ style={styles.container}
348
+ onScroll={(e) => handleScroll(e)}
349
+ showsVerticalScrollIndicator={false}
319
350
  refreshControl={
320
351
  <RefreshControl
321
352
  refreshing={refreshing}
@@ -323,6 +354,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
323
354
  />
324
355
  }
325
356
  >
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
+ )}
326
364
  <View style={{
327
365
  height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
328
366
  marginTop: Platform.OS == 'ios' ? 0 : 50,
@@ -331,14 +369,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
331
369
  >
332
370
  {isChewLayout && (
333
371
  <View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
334
- <OText size={18} weight={700} color={theme.colors?.white}>
335
- {t('WELCOME', 'Welcome')} {user?.name}!
372
+ <OText size={24} weight={700} color={theme.colors?.white}>
373
+ {t('WELCOME', 'Welcome')} {user?.name}
336
374
  </OText>
337
- <TouchableOpacity
338
- onPress={() => searchBarRef?.current?.focus?.()}
339
- >
340
- <Ionicons name='search' style={{ ...styles.iconStyle, color: theme.colors?.white }} />
341
- </TouchableOpacity>
342
375
  </View>
343
376
  )}
344
377
  <Search isChewLayout={isChewLayout}>
@@ -415,7 +448,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
415
448
  </OrderControlContainer>
416
449
  ) : (
417
450
  <>
418
- {!isPreOrderSetting && (// cambiar
451
+ {isPreOrderSetting && (
419
452
  <View style={{ paddingHorizontal: 30 }}>
420
453
  <PreorderInput
421
454
  isChewLayout={isChewLayout}
@@ -433,13 +466,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
433
466
  </View>
434
467
  {!isChewLayout ? (
435
468
  <HeaderWrapper
436
- source={theme.images.general.homeHero}
469
+ source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
437
470
  style={{ paddingTop: top + 20 }}
438
- resizeMode='stretch'
471
+ resizeMode='cover'
439
472
  >
440
473
  {!auth && (
474
+
441
475
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
442
- <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
476
+ <IconAntDesign name='arrowleft' size={26} />
443
477
  </TouchableOpacity>
444
478
  )}
445
479
  </HeaderWrapper>
@@ -449,47 +483,28 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
449
483
  handleChangeBusinessType={handleChangeBusinessType}
450
484
  isChewLayout
451
485
  chewOrderTypes={chewOrderTypes}
486
+ handleChangeType={setOrderTypeValue}
452
487
  />
453
488
  </OrderTypesContainer>
454
489
  )}
455
- {!businessId && (
456
- <SearchBar
457
- forwardRef={searchBarRef}
458
- onSearch={handleChangeSearch}
459
- searchValue={searchValue}
460
- lazyLoad
461
- hideIcon
462
- isCancelXButtonShow={!!searchValue}
463
- onCancel={() => handleChangeSearch('')}
464
- placeholder={t('SEARCH', 'Search')}
465
- height={50}
466
- isDisabled={!businessTypes}
467
- inputContainerStyles={styles.inputContainerStyles}
468
- containerStyles={{
469
- marginHorizontal: 40,
470
- marginTop: 20
471
- }}
472
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
473
- onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
474
- />
475
- )}
476
490
 
477
- {showCities && (
478
- <View style={{ marginTop: 10 }}>
479
- <OButton
480
- onClick={() => setIsOpenCities(true)}
481
- text={citiesState?.cities?.find((city : any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
482
- style={styles?.buttonCityStyle}
483
- textStyle={{ color: theme.colors.backgroundGray, fontWeight: 'bold', fontSize: 18 }}
484
- />
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>
485
502
  </View>
486
503
  )}
487
- <OrderProgressWrapper>
488
- <OrderProgress
489
- {...props}
490
- isFocused={isFocused}
491
- />
492
- </OrderProgressWrapper>
504
+ <OrderProgress
505
+ {...props}
506
+ isFocused={isFocused}
507
+ />
493
508
  {
494
509
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
495
510
  <FeaturedWrapper>
@@ -522,19 +537,23 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
522
537
  </FeaturedWrapper>
523
538
  )
524
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
+ )}
525
555
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
526
- {
527
- !businessId && !props.franchiseId && (
528
- <HighestRatedBusinesses
529
- onBusinessClick={handleBusinessClick}
530
- navigation={navigation}
531
- favoriteIds={favoriteIds}
532
- setFavoriteIds={setFavoriteIds}
533
- />
534
- )
535
- }
536
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
537
- <ListWrapper>
556
+ <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
538
557
  {!businessId && (
539
558
  <BusinessTypeFilter
540
559
  images={props.images}
@@ -556,6 +575,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
556
575
  (business: any, i: number) => (
557
576
  <BusinessController
558
577
  key={`${business.id}_` + i}
578
+ enableIntersection
579
+ isCustomLayout={isChewLayout}
559
580
  business={business}
560
581
  isBusinessOpen={business.open}
561
582
  handleCustomClick={handleBusinessClick}
@@ -632,27 +653,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
632
653
  onClose={() => setIsOpenCities(false)}
633
654
  title={t('SELECT_A_CITY', 'Select a city')}
634
655
  >
635
- <View style={{ padding: 40, width: '100%' }}>
636
- {citiesState?.cities?.map((city : any) => (
637
- <TouchableOpacity
638
- key={city?.id}
639
- style={{
640
- padding: 10,
641
- borderBottomWidth: 1,
642
- borderBottomColor: orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.backgroundGray,
643
- marginBottom: 10,
644
- }}
645
- onPress={() => changeCityFilter(city?.id)}
646
- disabled={orderState?.loading}
647
- >
648
- <OText color={orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.black}>
649
- {city?.name}
650
- </OText>
651
- </TouchableOpacity>
652
- ))}
653
- </View>
656
+ <CitiesControl
657
+ cities={citiesState?.cities}
658
+ onClose={() => setIsOpenCities(false)}
659
+ handleChangeCity={handleChangeCity}
660
+ />
654
661
  </OModal>
655
- </ScrollView>
662
+ </IOScrollView>
656
663
  );
657
664
  };
658
665
 
@@ -60,28 +60,20 @@ export const WrapMomentOption = styled.TouchableOpacity`
60
60
 
61
61
  export const HeaderWrapper = styled.ImageBackground`
62
62
  width: 100%;
63
- height: 270px;
63
+ height: 270px;
64
64
  padding: 20px 40px;
65
65
  background-color: transparent;
66
66
  `;
67
67
 
68
68
  export const ListWrapper = styled.View`
69
69
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
70
- padding-horizontal: 40px;
71
70
  `;
72
71
 
73
72
  export const FeaturedWrapper = styled.View`
74
73
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
75
- height: 220px;
76
74
  paddingVertical: 30px;
77
75
  `;
78
76
 
79
- export const OrderProgressWrapper = styled.View`
80
- margin-top: 37px;
81
- margin-bottom: 20px;
82
- padding-horizontal: 40px;
83
- `
84
-
85
77
  export const FarAwayMessage = styled.View`
86
78
  flex-direction: row;
87
79
  align-items: center;