ordering-ui-react-native 0.17.51 → 0.17.52-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 (218) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  6. package/src/components/PhoneInputNumber/index.tsx +6 -2
  7. package/src/components/StripeMethodForm/index.tsx +136 -102
  8. package/src/components/VerifyPhone/styles.tsx +1 -2
  9. package/src/components/shared/OToast.tsx +4 -4
  10. package/src/types/index.tsx +5 -0
  11. package/src/utils/index.tsx +5 -0
  12. package/themes/business/index.tsx +2 -0
  13. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  14. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +125 -113
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +29 -2
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  21. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  22. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  23. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  24. package/themes/business/src/components/MapView/index.tsx +10 -10
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  26. package/themes/business/src/components/OrderDetails/Delivery.tsx +31 -5
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +93 -50
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  30. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  31. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  32. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  33. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  34. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +249 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  36. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  38. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  39. package/themes/business/src/components/ReviewCustomer/index.tsx +29 -14
  40. package/themes/business/src/components/StoresList/index.tsx +2 -2
  41. package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
  42. package/themes/business/src/components/shared/OLink.tsx +33 -13
  43. package/themes/business/src/components/shared/OModal.tsx +16 -9
  44. package/themes/business/src/components/shared/OText.tsx +8 -2
  45. package/themes/business/src/types/index.tsx +32 -2
  46. package/themes/business/src/utils/index.tsx +44 -1
  47. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  49. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  51. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  52. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  53. package/themes/kiosk/src/components/LoginForm/index.tsx +480 -156
  54. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  59. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  60. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  61. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  62. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  63. package/themes/kiosk/src/types/index.d.ts +13 -0
  64. package/themes/kiosk/src/utils/index.tsx +15 -0
  65. package/themes/original/index.tsx +4 -0
  66. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  67. package/themes/original/src/components/AddressForm/index.tsx +79 -44
  68. package/themes/original/src/components/AddressList/index.tsx +27 -22
  69. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  70. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  71. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  72. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  73. package/themes/original/src/components/BusinessBasicInformation/index.tsx +160 -91
  74. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
  75. package/themes/original/src/components/BusinessController/index.tsx +122 -68
  76. package/themes/original/src/components/BusinessController/styles.tsx +23 -4
  77. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  78. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  79. package/themes/original/src/components/BusinessInformation/index.tsx +110 -108
  80. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +352 -326
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +23 -14
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  86. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +668 -514
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +95 -80
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -11
  93. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  94. package/themes/original/src/components/Cart/index.tsx +100 -67
  95. package/themes/original/src/components/CartContent/index.tsx +115 -19
  96. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  97. package/themes/original/src/components/Checkout/index.tsx +367 -174
  98. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  99. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  100. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  101. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  102. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  103. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  104. package/themes/original/src/components/Favorite/index.tsx +8 -9
  105. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  106. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  107. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  108. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  109. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  110. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  111. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  112. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  113. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  114. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  115. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  116. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  117. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  118. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  119. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  120. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  121. package/themes/original/src/components/Help/index.tsx +8 -8
  122. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  123. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  124. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  125. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  126. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  127. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  128. package/themes/original/src/components/Home/index.tsx +13 -4
  129. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  130. package/themes/original/src/components/LoginForm/Otp/index.tsx +55 -13
  131. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  132. package/themes/original/src/components/LoginForm/index.tsx +64 -26
  133. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  134. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  135. package/themes/original/src/components/Messages/index.tsx +32 -10
  136. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  137. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  138. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +151 -49
  139. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  140. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  141. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  142. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  143. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  144. package/themes/original/src/components/MyOrders/index.tsx +77 -52
  145. package/themes/original/src/components/NavBar/index.tsx +18 -18
  146. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  147. package/themes/original/src/components/Notifications/index.tsx +46 -50
  148. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  149. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  150. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  151. package/themes/original/src/components/OrderDetails/index.tsx +190 -358
  152. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  153. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  154. package/themes/original/src/components/OrderProgress/index.tsx +93 -114
  155. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  156. package/themes/original/src/components/OrderSummary/index.tsx +85 -57
  157. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  158. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  159. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  160. package/themes/original/src/components/OrdersOption/index.tsx +76 -66
  161. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  162. package/themes/original/src/components/PageBanner/index.tsx +107 -40
  163. package/themes/original/src/components/PageBanner/styles.tsx +4 -1
  164. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  165. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  166. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  167. package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
  168. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  169. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  170. package/themes/original/src/components/ProductForm/index.tsx +114 -36
  171. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  172. package/themes/original/src/components/ProductItemAccordion/index.tsx +22 -19
  173. package/themes/original/src/components/ProductOptionSubOption/index.tsx +24 -14
  174. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +3 -4
  175. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  176. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  177. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  178. package/themes/original/src/components/Promotions/index.tsx +234 -220
  179. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  180. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  181. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  182. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  183. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  184. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  185. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  186. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  187. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  188. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  189. package/themes/original/src/components/Sessions/index.tsx +11 -8
  190. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  191. package/themes/original/src/components/SignupForm/index.tsx +43 -20
  192. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  193. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  194. package/themes/original/src/components/SingleProductCard/index.tsx +72 -34
  195. package/themes/original/src/components/SingleProductCard/styles.tsx +22 -4
  196. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  197. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  198. package/themes/original/src/components/StripeElementsForm/index.tsx +51 -34
  199. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  200. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  201. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  202. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  203. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  204. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  205. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  206. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  207. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  208. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  209. package/themes/original/src/components/Wallets/index.tsx +67 -24
  210. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  211. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  212. package/themes/original/src/components/shared/OButton.tsx +6 -2
  213. package/themes/original/src/components/shared/OInput.tsx +16 -2
  214. package/themes/original/src/components/shared/OModal.tsx +3 -3
  215. package/themes/original/src/layouts/Container.tsx +1 -1
  216. package/themes/original/src/types/index.tsx +40 -11
  217. package/themes/original/src/utils/index.tsx +375 -58
  218. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -7,7 +7,7 @@ export const TopHeader = styled.View`
7
7
  width: 100%;
8
8
  flex-direction: row;
9
9
  align-items: center;
10
- justify-content: space-between;
10
+ justify-content: ${({ hideArrow }: any) => hideArrow ? 'flex-end' : 'space-between'};
11
11
  z-index: 1;
12
12
  height: 60px;
13
13
  min-height: 60px;
@@ -24,7 +24,7 @@ export const WrapSearchBar = styled.View`
24
24
  flex: 1;
25
25
  `
26
26
  export const WrapContent = styled.View`
27
- padding: 10px 40px;
27
+ padding-vertical: 10px;
28
28
  `
29
29
 
30
30
  export const BusinessProductsListingContainer = styled.ScrollView`
@@ -3,6 +3,7 @@ import {
3
3
  BusinessReviews as BusinessReviewController,
4
4
  useLanguage,
5
5
  useOrder,
6
+ useUtils
6
7
  } from 'ordering-components/native';
7
8
  import { useTheme } from 'styled-components/native';
8
9
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
@@ -30,6 +31,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
30
31
  const theme = useTheme();
31
32
  const [searchReview, setSearchReview] = useState('')
32
33
  const [orderState] = useOrder();
34
+ const [{ parseDate }] = useUtils()
33
35
 
34
36
  const styles = StyleSheet.create({
35
37
  starIcon: {
@@ -94,7 +96,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
94
96
  const ReviewItem = ({ comment, created_at, total }: any) => (
95
97
  <View style={{ marginBottom: 30 }}>
96
98
  <OText size={12} color={theme.colors.textSecondary}>
97
- {moment(created_at).format('MMMM d, yyyy • hh:mm')}
99
+ {parseDate(created_at, { outputFormat: 'MMMM D, YYYY • hh:mm A' })}
98
100
  </OText>
99
101
  <OText size={12} color={theme.colors.textNormal}>{comment}</OText>
100
102
  </View>
@@ -284,7 +284,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
284
284
  style={{ paddingTop: top + 20 }}>
285
285
  {!auth && (
286
286
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
287
- <IconAntDesign name='arrowleft' size={26} />
287
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
288
288
  </TouchableOpacity>
289
289
  )}
290
290
  <Search>
@@ -18,8 +18,7 @@ import {
18
18
  useSession,
19
19
  useOrder,
20
20
  useConfig,
21
- useUtils,
22
- useOrderingTheme
21
+ useUtils
23
22
  } from 'ordering-components/native';
24
23
  import { useTheme } from 'styled-components/native';
25
24
  import Ionicons from 'react-native-vector-icons/Ionicons'
@@ -32,7 +31,6 @@ import {
32
31
  HeaderWrapper,
33
32
  ListWrapper,
34
33
  FeaturedWrapper,
35
- OrderProgressWrapper,
36
34
  FarAwayMessage,
37
35
  AddressInputContainer,
38
36
  PreorderInput,
@@ -40,8 +38,7 @@ import {
40
38
  BusinessLogosContainer
41
39
  } from './styles';
42
40
 
43
- import { SearchBar } from '../../../SearchBar';
44
- import { OButton, OIcon, OText, OBottomPopup, OModal } from '../../../shared';
41
+ import { OIcon, OText, OModal } from '../../../shared';
45
42
  import { BusinessesListingParams } from '../../../../types';
46
43
  import { NotFoundSource } from '../../../NotFoundSource';
47
44
  import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
@@ -50,12 +47,13 @@ import { OrderTypeSelector } from '../../../OrderTypeSelector';
50
47
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
51
48
  import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
52
49
  import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
53
- import { getTypesText, convertToRadian } from '../../../../utils';
50
+ import { getTypesText } from '../../../../utils';
54
51
  import { OrderProgress } from '../../../OrderProgress';
55
52
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
56
53
  import FastImage from 'react-native-fast-image';
57
54
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
58
55
  import { PageBanner } from '../../../PageBanner'
56
+ import { CitiesControl } from '../../../CitiesControl'
59
57
 
60
58
  const PIXELS_TO_SCROLL = 2000;
61
59
 
@@ -63,12 +61,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
63
61
  const {
64
62
  navigation,
65
63
  businessesList,
66
- searchValue,
67
64
  getBusinesses,
68
65
  handleChangeBusinessType,
69
66
  handleBusinessClick,
70
67
  paginationProps,
71
- handleChangeSearch,
72
68
  businessId,
73
69
  isGuestUser,
74
70
  handleUpdateBusinessList,
@@ -77,15 +73,26 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
77
73
  logosLayout
78
74
  } = props;
79
75
  const theme = useTheme();
80
- const [orderingTheme] = useOrderingTheme()
81
76
  const isFocused = useIsFocused();
77
+
78
+ const [, t] = useLanguage();
79
+ const [{ user, auth }] = useSession();
80
+ const [orderState, { changeCityFilter }] = useOrder();
81
+ const [{ configs }] = useConfig();
82
+ const [{ parseDate }] = useUtils();
83
+
82
84
  const appState = useRef(AppState.currentState)
83
- const searchBarRef = useRef<any>()
84
- const [appStateVisible, setAppStateVisible] = useState(appState.current);
85
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
86
- const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
85
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
87
86
  const [refreshing] = useState(false);
88
- const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
87
+ const allCitiesDisabled = citiesState?.cities?.every((city: any) => !city.enabled)
88
+ const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
89
+ const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
90
+ const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
91
+ const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
92
+ const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
93
+ const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
94
+ const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
95
+
89
96
  const styles = StyleSheet.create({
90
97
  container: {
91
98
  marginBottom: 0,
@@ -138,7 +145,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
138
145
  minHeight: 45,
139
146
  paddingVertical: 5,
140
147
  paddingHorizontal: 20,
141
- borderWidth: 1
148
+ borderWidth: 1,
149
+ justifyContent: 'center'
142
150
  },
143
151
  businessSkeleton: {
144
152
  borderRadius: 8,
@@ -148,19 +156,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
148
156
  },
149
157
  });
150
158
 
151
-
152
- const [, t] = useLanguage();
153
- const [{ user, auth }] = useSession();
154
- const [orderState, { changeCityFilter }] = useOrder();
155
- const [{ configs }] = useConfig();
156
- const [{ parseDate }] = useUtils();
157
-
158
159
  const { top } = useSafeAreaInsets();
159
160
 
160
161
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
161
162
  const [isFarAway, setIsFarAway] = useState(false)
162
163
  const [businessTypes, setBusinessTypes] = useState(null)
163
- const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
164
+ const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options?.value)
164
165
  const [isOpenCities, setIsOpenCities] = useState(false)
165
166
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
166
167
  Number(configs?.max_days_preorder?.value) > 0
@@ -193,6 +194,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
193
194
  }
194
195
  };
195
196
 
197
+ const convertToRadian = (value: number) => {
198
+ return value * Math.PI / 180
199
+ }
200
+
196
201
  const getDistance = (lat1: any, lon1: any, lat2: any, lon2: any) => {
197
202
  const R = 6371 // km
198
203
  const dLat = convertToRadian(lat2 - lat1)
@@ -220,7 +225,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
220
225
 
221
226
  useEffect(() => {
222
227
  if (!businessesList?.loading) {
223
- const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
228
+ const fb = businessesList.businesses.filter((b) => b?.featured && b?.open);
224
229
  const ary = [];
225
230
  while (fb.length > 0) {
226
231
  ary.push(fb.splice(0, 2));
@@ -289,6 +294,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
289
294
  setIsOpenCities(false)
290
295
  }, [orderState?.options?.city_id])
291
296
 
297
+ useEffect(() => {
298
+ if (!citiesState?.cities?.length || !orderState?.options?.city_id) return
299
+ const selectedCity = citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)
300
+ if (!selectedCity || !selectedCity?.enabled) changeCityFilter(null)
301
+ }, [citiesState, orderState?.options?.city_id])
302
+
292
303
  if (logosLayout) {
293
304
  return (
294
305
  <BusinessLogosContainer
@@ -314,10 +325,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
314
325
  key={business?.id}
315
326
  onPress={() => handleBusinessClick && handleBusinessClick(business)}
316
327
  style={{
317
- width: 57,
318
- height: 58,
319
- borderBottomColor: theme.colors.primary,
320
- borderBottomWidth: business?.slug === actualSlug ? 2 : 0,
328
+ width: 60,
329
+ height: 60,
330
+ borderRadius: 8,
321
331
  marginRight: 5
322
332
  }}
323
333
  >
@@ -326,8 +336,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
326
336
  width: 56,
327
337
  height: 56,
328
338
  marginRight: 20,
329
- borderTopLeftRadius: 7.6,
330
- borderTopRightRadius: 7.6
339
+ borderRadius: 8,
340
+ borderColor: theme.colors.primary,
341
+ borderWidth: business?.slug === actualSlug ? 2 : 0
331
342
  }}
332
343
  source={{
333
344
  uri: business?.logo,
@@ -370,8 +381,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
370
381
  >
371
382
  {isChewLayout && (
372
383
  <View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
373
- <OText size={18} weight={700} color={theme.colors?.white}>
374
- {t('WELCOME', 'Welcome')} {user?.name}!
384
+ <OText size={24} weight={700} color={theme.colors?.white}>
385
+ {t('WELCOME', 'Welcome')} {user?.name}
375
386
  </OText>
376
387
  </View>
377
388
  )}
@@ -466,18 +477,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
466
477
  )}
467
478
  </View>
468
479
  {!isChewLayout ? (
469
- <HeaderWrapper
470
- source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
471
- style={{ paddingTop: top + 20 }}
472
- resizeMode='stretch'
473
- >
474
- {!auth && (
475
-
476
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
477
- <IconAntDesign name='arrowleft' size={26} />
478
- </TouchableOpacity>
480
+ <>
481
+ {!hideHero ? (
482
+ <HeaderWrapper
483
+ source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
484
+ style={{ paddingTop: top + 20 }}
485
+ resizeMode='cover'
486
+ bgHeaderHeight={bgHeaderHeight}
487
+ >
488
+ {!auth && (
489
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
490
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
491
+ </TouchableOpacity>
492
+ )}
493
+ </HeaderWrapper>
494
+ ) : (
495
+ <>
496
+ {!auth && (
497
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
498
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
499
+ </TouchableOpacity>
500
+ )}
501
+ </>
479
502
  )}
480
- </HeaderWrapper>
503
+ </>
481
504
  ) : (
482
505
  <OrderTypesContainer>
483
506
  <OrderTypeSelector
@@ -494,6 +517,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
494
517
  <TouchableOpacity
495
518
  style={styles.buttonCityStyle}
496
519
  onPress={() => setIsOpenCities(true)}
520
+ disabled={orderState?.loading}
497
521
  >
498
522
  <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
499
523
  {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
@@ -501,12 +525,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
501
525
  </TouchableOpacity>
502
526
  </View>
503
527
  )}
504
- <OrderProgressWrapper>
528
+ {!hidePreviousOrders && (
505
529
  <OrderProgress
506
530
  {...props}
507
531
  isFocused={isFocused}
508
532
  />
509
- </OrderProgressWrapper>
533
+ )}
510
534
  {
511
535
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
512
536
  <FeaturedWrapper>
@@ -539,23 +563,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
539
563
  </FeaturedWrapper>
540
564
  )
541
565
  }
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
- }
566
+ {!isChewLayout && !hideHighestBusiness && (
567
+ <>
568
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
569
+ {
570
+ !businessId && !props.franchiseId && (
571
+ <HighestRatedBusinesses
572
+ onBusinessClick={handleBusinessClick}
573
+ navigation={navigation}
574
+ favoriteIds={favoriteIds}
575
+ setFavoriteIds={setFavoriteIds}
576
+ />
577
+ )
578
+ }
579
+ </>
580
+ )}
553
581
 
554
- <PageBanner position='app_business_listing' />
582
+ <PageBanner position='app_business_listing' navigation={navigation} />
555
583
 
556
584
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
557
- <ListWrapper>
558
- {!businessId && (
585
+ <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
586
+ {!businessId && !isAllCategoriesHidden && (
559
587
  <BusinessTypeFilter
560
588
  images={props.images}
561
589
  businessTypes={props.businessTypes}
@@ -564,7 +592,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
564
592
  setBusinessTypes={setBusinessTypes}
565
593
  />
566
594
  )}
567
- {!businessesList.loading && businessesList.businesses.length === 0 && (
595
+ {!businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
568
596
  <NotFoundSource
569
597
  content={t(
570
598
  'NOT_FOUND_BUSINESSES',
@@ -577,6 +605,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
577
605
  <BusinessController
578
606
  key={`${business.id}_` + i}
579
607
  enableIntersection
608
+ isCustomLayout={isChewLayout}
580
609
  business={business}
581
610
  isBusinessOpen={business.open}
582
611
  handleCustomClick={handleBusinessClick}
@@ -596,7 +625,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
596
625
  />
597
626
  )
598
627
  )}
599
- {businessesList.loading && (
628
+ {(businessesList.loading || !businessesList?.fetched) && (
600
629
  <>
601
630
  {[
602
631
  ...Array(
@@ -653,25 +682,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
653
682
  onClose={() => setIsOpenCities(false)}
654
683
  title={t('SELECT_A_CITY', 'Select a city')}
655
684
  >
656
- <View style={{ padding: 40, width: '100%' }}>
657
- {citiesState?.cities?.map((city: any) => (
658
- <TouchableOpacity
659
- key={city?.id}
660
- style={{
661
- padding: 10,
662
- borderBottomWidth: 1,
663
- borderBottomColor: orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.backgroundGray,
664
- marginBottom: 10,
665
- }}
666
- onPress={() => handleChangeCity(city?.id)}
667
- disabled={orderState?.loading}
668
- >
669
- <OText color={orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.black}>
670
- {city?.name}
671
- </OText>
672
- </TouchableOpacity>
673
- ))}
674
- </View>
685
+ <CitiesControl
686
+ cities={citiesState?.cities}
687
+ onClose={() => setIsOpenCities(false)}
688
+ handleChangeCity={handleChangeCity}
689
+ />
675
690
  </OModal>
676
691
  </IOScrollView>
677
692
  );
@@ -60,30 +60,20 @@ export const WrapMomentOption = styled.TouchableOpacity`
60
60
 
61
61
  export const HeaderWrapper = styled.ImageBackground`
62
62
  width: 100%;
63
- height: 5%;
64
- min-height: 270px;
65
- max-height: 400px;
63
+ height: 270px;
66
64
  padding: 20px 40px;
67
65
  background-color: transparent;
68
66
  `;
69
67
 
70
68
  export const ListWrapper = styled.View`
71
69
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
72
- padding-horizontal: 40px;
73
70
  `;
74
71
 
75
72
  export const FeaturedWrapper = styled.View`
76
73
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
77
- height: 220px;
78
74
  paddingVertical: 30px;
79
75
  `;
80
76
 
81
- export const OrderProgressWrapper = styled.View`
82
- margin-top: 37px;
83
- margin-bottom: 20px;
84
- padding-horizontal: 40px;
85
- `
86
-
87
77
  export const FarAwayMessage = styled.View`
88
78
  flex-direction: row;
89
79
  align-items: center;
@@ -1,4 +1,3 @@
1
-
2
1
  import React, { useState, useEffect } from 'react'
3
2
  import { useOrder, useSession, useLanguage, useConfig } from 'ordering-components/native';
4
3