ordering-ui-react-native 0.20.0 → 0.20.2-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 (221) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/VerifyPhone/styles.tsx +1 -2
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/utils/index.tsx +2 -2
  8. package/themes/business/index.tsx +2 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  12. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  13. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  14. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  16. package/themes/business/src/components/Chat/index.tsx +41 -13
  17. package/themes/business/src/components/DriverMap/index.tsx +4 -2
  18. package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/MapView/index.tsx +11 -7
  21. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +138 -106
  23. package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
  24. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
  25. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +36 -16
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  27. package/themes/business/src/components/OrderSummary/index.tsx +27 -13
  28. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  29. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  30. package/themes/business/src/components/OrdersOption/index.tsx +83 -37
  31. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  32. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  33. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +24 -31
  34. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  36. package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  38. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  39. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  40. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  41. package/themes/business/src/components/StoresList/index.tsx +5 -3
  42. package/themes/business/src/components/UserProfileForm/index.tsx +49 -28
  43. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  44. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  45. package/themes/business/src/types/index.tsx +10 -0
  46. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  48. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  50. package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
  51. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  52. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  53. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  54. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  55. package/themes/original/index.tsx +7 -3
  56. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  57. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  58. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  59. package/themes/original/src/components/AddressList/index.tsx +4 -7
  60. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  61. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  62. package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
  63. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  64. package/themes/original/src/components/BusinessController/index.tsx +9 -6
  65. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  66. package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
  67. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  68. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  69. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  70. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  71. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  72. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  73. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  74. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
  75. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  76. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  77. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  78. package/themes/original/src/components/BusinessProductsListing/index.tsx +43 -19
  79. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  80. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  81. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  82. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  83. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  84. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  88. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  89. package/themes/original/src/components/Cart/index.tsx +27 -8
  90. package/themes/original/src/components/CartContent/index.tsx +76 -39
  91. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  92. package/themes/original/src/components/Checkout/index.tsx +199 -55
  93. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  94. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  95. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  96. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  97. package/themes/original/src/components/Favorite/index.tsx +4 -9
  98. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  99. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  100. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  101. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  103. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  104. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  105. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  106. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  107. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  108. package/themes/original/src/components/GoogleMap/index.tsx +50 -5
  109. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  110. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  111. package/themes/original/src/components/Home/index.tsx +1 -1
  112. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  113. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  114. package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
  115. package/themes/original/src/components/LoginForm/index.tsx +6 -1
  116. package/themes/original/src/components/Messages/index.tsx +9 -4
  117. package/themes/original/src/components/Messages/styles.tsx +1 -1
  118. package/themes/original/src/components/MomentOption/index.tsx +4 -4
  119. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  120. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  121. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
  122. package/themes/original/src/components/MultiCheckout/index.tsx +226 -52
  123. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  124. package/themes/original/src/components/MultiOrdersDetails/index.tsx +19 -14
  125. package/themes/original/src/components/MyOrders/index.tsx +5 -5
  126. package/themes/original/src/components/NavBar/index.tsx +3 -1
  127. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  128. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  129. package/themes/original/src/components/Notifications/index.tsx +4 -8
  130. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  131. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  132. package/themes/original/src/components/OrderDetails/index.tsx +716 -667
  133. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  134. package/themes/original/src/components/OrderProgress/index.tsx +18 -8
  135. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  136. package/themes/original/src/components/OrderSummary/index.tsx +5 -3
  137. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  138. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  139. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  140. package/themes/original/src/components/OrdersOption/index.tsx +4 -3
  141. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  142. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  143. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  144. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  145. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  146. package/themes/original/src/components/PaymentOptions/index.tsx +75 -33
  147. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  148. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  149. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  150. package/themes/original/src/components/ProductForm/index.tsx +81 -167
  151. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  152. package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
  153. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  154. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  155. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  156. package/themes/original/src/components/Promotions/index.tsx +4 -4
  157. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  158. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  159. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  160. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  161. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  162. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +4 -3
  164. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  165. package/themes/original/src/components/StripeCardsList/index.tsx +23 -8
  166. package/themes/original/src/components/StripeElementsForm/index.tsx +5 -3
  167. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  168. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  169. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  170. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  171. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  172. package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
  173. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  174. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  175. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  176. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  177. package/themes/original/src/components/Wallets/index.tsx +8 -9
  178. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  179. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  180. package/themes/original/src/components/shared/OInput.tsx +1 -4
  181. package/themes/original/src/components/shared/OModal.tsx +12 -14
  182. package/themes/original/src/layouts/Container.tsx +5 -3
  183. package/themes/original/src/types/index.tsx +10 -2
  184. package/themes/original/src/utils/index.tsx +124 -0
  185. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  186. package/src/navigators/BottomNavigator.tsx +0 -117
  187. package/src/navigators/CheckoutNavigator.tsx +0 -66
  188. package/src/navigators/HomeNavigator.tsx +0 -202
  189. package/src/navigators/NavigationRef.tsx +0 -7
  190. package/src/navigators/RootNavigator.tsx +0 -269
  191. package/src/pages/Account.tsx +0 -34
  192. package/src/pages/AddressForm.tsx +0 -62
  193. package/src/pages/AddressList.tsx +0 -24
  194. package/src/pages/BusinessProductsList.tsx +0 -81
  195. package/src/pages/BusinessesListing.tsx +0 -43
  196. package/src/pages/CartList.tsx +0 -49
  197. package/src/pages/Checkout.tsx +0 -101
  198. package/src/pages/ForgotPassword.tsx +0 -24
  199. package/src/pages/Help.tsx +0 -23
  200. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  201. package/src/pages/HelpGuide.tsx +0 -23
  202. package/src/pages/HelpOrder.tsx +0 -23
  203. package/src/pages/Home.tsx +0 -36
  204. package/src/pages/IntroductoryTutorial.tsx +0 -170
  205. package/src/pages/Login.tsx +0 -47
  206. package/src/pages/MomentOption.tsx +0 -30
  207. package/src/pages/MultiCheckout.tsx +0 -31
  208. package/src/pages/MultiOrdersDetails.tsx +0 -27
  209. package/src/pages/MyOrders.tsx +0 -40
  210. package/src/pages/NetworkError.tsx +0 -24
  211. package/src/pages/NotFound.tsx +0 -22
  212. package/src/pages/OrderDetails.tsx +0 -25
  213. package/src/pages/ProductDetails.tsx +0 -55
  214. package/src/pages/Profile.tsx +0 -36
  215. package/src/pages/ReviewDriver.tsx +0 -30
  216. package/src/pages/ReviewOrder.tsx +0 -32
  217. package/src/pages/ReviewProducts.tsx +0 -30
  218. package/src/pages/Sessions.tsx +0 -22
  219. package/src/pages/Signup.tsx +0 -53
  220. package/src/pages/SpinnerLoader.tsx +0 -10
  221. package/src/pages/Splash.tsx +0 -21
@@ -21,7 +21,7 @@ export const AppleLogin = (props: any) => {
21
21
  const [{ configs }] = useConfig();
22
22
  const [credentialStateForUser, updateCredentialStateForUser] = useState<any>(-1);
23
23
 
24
- let user : any= null
24
+ let user: any = null
25
25
 
26
26
  const buttonText = auth
27
27
  ? t('CONTINUE_WITH_APPLE', 'Logout with Apple')
@@ -53,7 +53,7 @@ export const AppleLogin = (props: any) => {
53
53
  }
54
54
  }
55
55
 
56
- const fetchAndUpdateCredentialState = async (updateCredentialStateForUser : any) => {
56
+ const fetchAndUpdateCredentialState = async (updateCredentialStateForUser: any) => {
57
57
  if (user === null) {
58
58
  updateCredentialStateForUser('N/A');
59
59
  } else {
@@ -66,7 +66,7 @@ export const AppleLogin = (props: any) => {
66
66
  }
67
67
  }
68
68
 
69
- const onIOSButtonPress = async (updateCredentialStateForUser : any) => {
69
+ const onIOSButtonPress = async (updateCredentialStateForUser: any) => {
70
70
  try {
71
71
  const appleAuthRequestResponse = await appleAuth.performRequest({
72
72
  requestedOperation: appleAuth.Operation.LOGIN,
@@ -79,7 +79,7 @@ export const AppleLogin = (props: any) => {
79
79
  identityToken,
80
80
  authorizationCode
81
81
  } = appleAuthRequestResponse;
82
-
82
+
83
83
  user = newUser;
84
84
 
85
85
  fetchAndUpdateCredentialState(updateCredentialStateForUser).catch(error =>
@@ -72,7 +72,7 @@ export const BusinessBasicInformation = (
72
72
  alignItems: 'flex-start'
73
73
  },
74
74
  businessInfo: {
75
- paddingHorizontal: 40,
75
+ paddingHorizontal: 20,
76
76
  paddingTop: isChewLayout ? 0 : 56,
77
77
  },
78
78
  bullet: {
@@ -95,7 +95,7 @@ export const BusinessBasicInformation = (
95
95
  width: '100%',
96
96
  top: 0,
97
97
  zIndex: 100,
98
- left: 40
98
+ left: 20
99
99
  },
100
100
  socialIcon: {
101
101
  borderRadius: 3,
@@ -217,7 +217,7 @@ export const BusinessBasicInformation = (
217
217
  <Placeholder Animation={Fade}>
218
218
  <View style={{ flexDirection: 'row' }}>
219
219
  {[...Array(5).keys()].map(i => (
220
- <View style={styles.socialIcon} key={i}>
220
+ <View style={{ ...styles.socialIcon, borderWidth: 0 }} key={i}>
221
221
  <PlaceholderLine width={100} height={20} style={{ marginBottom: 0 }} />
222
222
  </View>
223
223
  ))}
@@ -11,7 +11,7 @@ export const BusinessHeader = styled.ImageBackground`
11
11
  `;
12
12
  export const BusinessLogo = styled.View`
13
13
  position: absolute;
14
- start: 40px;
14
+ start: 20px;
15
15
  top: -36px;
16
16
  z-index: 50;
17
17
  box-shadow: 0 0 2px ${Platform.OS == 'android' ? '#000000DD' : '#0000001A'};
@@ -76,7 +76,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
76
76
  const hideBusinessFavoriteBadge = theme?.business_listing_view?.components?.business?.components?.featured_badge?.hidden
77
77
 
78
78
  const textSize = 12
79
- const cardHeight = windowHeight * 0.3
79
+ const cardHeight = windowHeight * 0.34
80
80
 
81
81
  const styles = StyleSheet.create({
82
82
  container: {
@@ -256,7 +256,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
256
256
  </BusinessState>
257
257
  </BusinessHero>
258
258
  <BusinessContent>
259
- <BusinessInfo style={{ position: 'absolute', bottom: 85, left: 15 }}>
259
+ <BusinessInfo style={{ position: 'absolute', top: -26, left: 15 }}>
260
260
  {!hideBusinessLogo && (
261
261
  <BusinessLogo style={styles.businessLogo}>
262
262
  <FastImage
@@ -270,11 +270,14 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
270
270
  </BusinessLogo>
271
271
  )}
272
272
  </BusinessInfo>
273
- <View style={{ width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5 }}>
273
+ <View style={{ width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5, alignItems: 'flex-start' }}>
274
274
  <OText
275
275
  size={textSize + 2}
276
- style={{ lineHeight: 18, marginBottom: 6 }}
277
- weight={'500'}>
276
+ style={{ lineHeight: 18, marginBottom: 6, width: '90%' }}
277
+ weight={'500'}
278
+ numberOfLines={1}
279
+ ellipsizeMode='tail'
280
+ >
278
281
  {business?.name}
279
282
  </OText>
280
283
  {(!hideBusinessFavorite || !hideBusinessReviews) && (
@@ -301,7 +304,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
301
304
  </ReviewAndFavorite>
302
305
  )}
303
306
  </View>
304
- <OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={1}>
307
+ <OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={2}>
305
308
  {business?.address}
306
309
  </OText>
307
310
  <Metadata>
@@ -8,13 +8,14 @@ export const BusinessHero = styled.View`
8
8
  `
9
9
 
10
10
  export const BusinessContent = styled.View`
11
- padding-horizontal: 18px;
12
- padding-bottom: 10px;
13
- border-bottom-left-radius: 7.6px;
14
- border-bottom-right-radius: 7.6px;
15
- border-width: 1px;
16
- border-color: ${(props: any) => props.theme.colors.border};
17
- overflow: visible;
11
+ position: relative;
12
+ padding-horizontal: 18px;
13
+ padding-bottom: 10px;
14
+ border-bottom-left-radius: 7.6px;
15
+ border-bottom-right-radius: 7.6px;
16
+ border-width: 1px;
17
+ border-color: ${(props: any) => props.theme.colors.border};
18
+ overflow: visible;
18
19
  `;
19
20
 
20
21
  export const BusinessInfo = styled.View`
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState, useCallback } from 'react';
2
2
  import {
3
3
  BusinessInformation as BusinessInformationController,
4
4
  useLanguage, useUtils, useConfig,
@@ -16,13 +16,16 @@ import {
16
16
  DivideView,
17
17
  MediaWrapper,
18
18
  } from './styles';
19
- import { StyleSheet, View } from 'react-native';
19
+ import { StyleSheet, View, TouchableOpacity } from 'react-native';
20
20
  import { BusinessInformationParams } from '../../types';
21
21
  import { GoogleMap } from '../GoogleMap';
22
22
  import { WebView } from 'react-native-webview';
23
23
  import { formatUrlVideo } from '../../utils'
24
24
  import { ScheduleAccordion } from '../ScheduleAccordion';
25
25
  import moment from 'moment';
26
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
27
+ const { useDeviceOrientation } = DeviceOrientationMethods
28
+
26
29
  const BusinessInformationUI = (props: BusinessInformationParams) => {
27
30
  const { businessState, businessSchedule, businessLocation } = props;
28
31
 
@@ -30,6 +33,11 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
30
33
  const [, t] = useLanguage();
31
34
  const [{ optimizeImage }] = useUtils();
32
35
  const [{ configs }] = useConfig()
36
+ const [orientationState] = useDeviceOrientation();
37
+
38
+ const [isReadMore, setIsReadMore] = useState(false)
39
+ const [lengthMore, setLengthMore] = useState(false)
40
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
33
41
 
34
42
  const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
35
43
  const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
@@ -73,6 +81,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
73
81
  return iAry;
74
82
  };
75
83
 
84
+ const onTextLayout = useCallback((e: any) => {
85
+ setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
86
+ }, [])
87
+
76
88
  return (
77
89
  <BusinessInformationContainer>
78
90
  <WrapMainContent contentContainerStyle={{}}>
@@ -93,16 +105,36 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
93
105
  readOnly
94
106
  location={businessLocation.location}
95
107
  markerTitle={businessState?.business?.name}
108
+ businessZones={businessState?.business?.zones}
96
109
  />
97
110
  </WrapBusinessMap>
98
111
  )}
99
112
  </>
100
113
  )}
101
114
  {!hideAddress && (
102
- <OText size={12} mBottom={20}>
115
+ <OText size={12} mBottom={10}>
103
116
  {businessState?.business?.address}
104
117
  </OText>
105
118
  )}
119
+ {businessState?.business?.address_notes && (
120
+ <>
121
+ <OText
122
+ size={12}
123
+ mBottom={10}
124
+ numberOfLines={isReadMore ? 20 : 3}
125
+ onTextLayout={onTextLayout}
126
+ >
127
+ {businessState?.business?.address_notes}
128
+ </OText>
129
+ {lengthMore && (
130
+ <TouchableOpacity
131
+ onPress={() => setIsReadMore(!isReadMore)}
132
+ >
133
+ <OText size={12} mBottom={20} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
134
+ </TouchableOpacity>
135
+ )}
136
+ </>
137
+ )}
106
138
  <DivideView />
107
139
  {!hideSchedule && (
108
140
  <>
@@ -17,7 +17,7 @@ export const MediaWrapper = styled.ScrollView`
17
17
  height: 127px;
18
18
  `
19
19
  export const InnerContent = styled.View`
20
- padding: 20px 40px;
20
+ padding: 20px;
21
21
  `
22
22
  export const WrapScheduleBlock = styled.View`
23
23
  margin: 20px 0;
@@ -36,4 +36,4 @@ export const DivideView = styled.View`
36
36
  height: 8px;
37
37
  background-color: ${(props: any) => props.theme.colors.backgroundGray100};
38
38
  margin-horizontal: -40px;
39
- `;
39
+ `;
@@ -23,7 +23,10 @@ export const BusinessItemAccordion = (props: any) => {
23
23
  handleClickCheckout,
24
24
  checkoutButtonDisabled,
25
25
  isMultiCheckout,
26
- isFromUpselling
26
+ isFromUpselling,
27
+ changeActiveState,
28
+ isActive,
29
+ isGiftCart
27
30
  } = props
28
31
 
29
32
  const [orderState] = useOrder();
@@ -38,14 +41,13 @@ export const BusinessItemAccordion = (props: any) => {
38
41
  const isProducts = cart?.products?.length
39
42
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
40
43
 
41
- const [isActive, setActiveState] = useState(!!singleBusiness)
42
44
  const [viewedCart, setViewedCart] = useState<any>(null)
43
45
 
44
46
  useEffect(() => {
45
47
  const cartsArray = Object.values(orderState?.carts)
46
48
  const cartsLength = cartsArray.filter((cart: any) => cart.products.length > 0).length ?? 0
47
49
  if (cartsLength === 1) {
48
- setActiveState(!isClosed)
50
+ changeActiveState && changeActiveState(!isClosed, cart?.uuid)
49
51
  }
50
52
  }, [orderState?.carts, isClosed])
51
53
 
@@ -68,14 +70,14 @@ export const BusinessItemAccordion = (props: any) => {
68
70
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
69
71
  <BIHeader
70
72
  isClosed={isClosed}
71
- onPress={() => !isClosed ? setActiveState(!isActive) : isClosed}
73
+ onPress={() => !isClosed ? changeActiveState && changeActiveState(!isClosed, cart?.uuid) : isClosed}
72
74
  activeOpacity={1}
73
75
  >
74
76
  <BIInfo>
75
77
  <BIContentInfo>
76
78
  <OText size={16} lineHeight={24} weight={'600'}>{cart?.business?.name}</OText>
77
79
  <View style={{ flexDirection: 'row' }}>
78
- {props.onNavigationRedirect && !isClosed && (
80
+ {props.onNavigationRedirect && !isClosed && !isGiftCart && (
79
81
  <>
80
82
  <TouchableOpacity onPress={() => props.onNavigationRedirect('Business', { store: cart?.business?.slug })}>
81
83
  <OText color={theme.colors.primary} size={12} lineHeight={18} style={{ textDecorationLine: 'underline' }}>{t('GO_TO_STORE', 'Go to store')}</OText>
@@ -84,7 +86,9 @@ export const BusinessItemAccordion = (props: any) => {
84
86
  )}
85
87
  {!isCartPending && (
86
88
  <>
87
- <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
89
+ {!isGiftCart && (
90
+ <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
91
+ )}
88
92
  <OAlert
89
93
  title={t('DELETE_CART', 'Delete Cart')}
90
94
  message={t('QUESTION_DELETE_CART', 'Are you sure to you wants delete the selected cart')}
@@ -94,7 +98,7 @@ export const BusinessItemAccordion = (props: any) => {
94
98
  </OAlert>
95
99
  </>
96
100
  )}
97
- {isBusinessChangeEnabled && props.handleChangeStore && (
101
+ {isBusinessChangeEnabled && props.handleChangeStore && !isGiftCart && (
98
102
  <>
99
103
  <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
100
104
  <TouchableOpacity
@@ -0,0 +1,317 @@
1
+ import React, { useState } from 'react'
2
+ import { useLanguage, useOrder } from 'ordering-components/native'
3
+ import { ScrollView, StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native'
4
+ import { useTheme } from 'styled-components/native'
5
+ import { OButton, OModal, OText } from '../shared'
6
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
7
+ import {
8
+ ProductsList,
9
+ TagsContainer,
10
+ SortContainer,
11
+ BrandContainer,
12
+ BrandItem,
13
+ PriceFilterWrapper,
14
+ BContainer,
15
+ WrapperButtons
16
+ } from './styles'
17
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
18
+ import { MaxSectionItem } from './MaxSectionItem'
19
+
20
+ export const BusinessSearchFooter = (props: any) => {
21
+ const {
22
+ businessesSearchList,
23
+ handleCloseFilters,
24
+ handleChangeFilters,
25
+ brandList,
26
+ filters,
27
+ handleChangeBrandFilter,
28
+ handleChangePriceRange,
29
+ businessTypes,
30
+ handleApplyFilters,
31
+ clearFilters,
32
+ handleChangeActiveBusinessType,
33
+ openFilters
34
+ } = props
35
+
36
+ const screenHeight = Dimensions.get('window').height;
37
+ const theme = useTheme()
38
+ const [orderState] = useOrder()
39
+
40
+ const [, t] = useLanguage()
41
+
42
+ const maxDeliveryFeeOptions = [15, 25, 35, 'default']
43
+ // const maxProductPriceOptions = [5, 10, 15, 'default']
44
+ const maxDistanceOptions = [1000, 2000, 5000, 'default']
45
+ const maxTimeOptions = [5, 15, 30, 'default']
46
+ const sortItems = [
47
+ { text: t('PICKED_FOR_YOU', 'Picked for you (default)'), value: 'distance' },
48
+ { text: t('DELIVERY_TIME', 'Delivery time'), value: 'delivery_time' },
49
+ { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
50
+ ]
51
+
52
+ const priceList = [
53
+ { level: '1', content: '$' },
54
+ { level: '2', content: '$$' },
55
+ { level: '3', content: '$$$' },
56
+ { level: '4', content: '$$$$' },
57
+ { level: '5', content: '$$$$$' }
58
+ ]
59
+
60
+ const styles = StyleSheet.create({
61
+ container: {
62
+ paddingHorizontal: 40,
63
+ width: '100%'
64
+ },
65
+ filterContainer: {
66
+ maxHeight: screenHeight - 150,
67
+ paddingHorizontal: 20,
68
+ width: '100%'
69
+ },
70
+ businessTypesContainer: {
71
+ width: '100%',
72
+ flexDirection: 'row',
73
+ flexWrap: 'wrap',
74
+ justifyContent: 'center'
75
+ },
76
+ priceContainer: {
77
+ width: '100%',
78
+ flexDirection: 'row',
79
+ flexWrap: 'wrap',
80
+ justifyContent: 'space-between'
81
+ },
82
+ categoryStyle: {
83
+ marginRight: 10,
84
+ marginTop: 10,
85
+ borderRadius: 50,
86
+ paddingHorizontal: 10,
87
+ paddingVertical: 4,
88
+ paddingLeft: 0,
89
+ paddingRight: 0,
90
+ height: 28,
91
+ borderWidth: 0
92
+ },
93
+ priceItem: {
94
+ marginRight: 10,
95
+ marginTop: 10,
96
+ borderRadius: 50,
97
+ paddingVertical: 4,
98
+ paddingLeft: 5,
99
+ paddingRight: 5,
100
+ height: 27,
101
+ borderWidth: 0
102
+ },
103
+ applyButton: {
104
+ paddingHorizontal: 10,
105
+ width: '100%',
106
+ marginTop: 20
107
+ }
108
+ });
109
+
110
+ return (
111
+ <>
112
+ <BContainer
113
+ style={{ paddingHorizontal: 20 }}
114
+ >
115
+ <ProductsList>
116
+ {businessesSearchList?.loading && (
117
+ <>
118
+ {[...Array(3).keys()].map(
119
+ (item, i) => (
120
+ <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
121
+ <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
122
+ <View style={{ flexDirection: 'row' }}>
123
+ <PlaceholderLine
124
+ width={24}
125
+ height={70}
126
+ style={{ marginRight: 10, marginBottom: 10 }}
127
+ />
128
+ <Placeholder style={{ paddingVertical: 10 }}>
129
+ <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
130
+ <PlaceholderLine width={60} />
131
+ </Placeholder>
132
+ </View>
133
+ </Placeholder>
134
+ <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
135
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
136
+ <PlaceholderLine
137
+ width={24}
138
+ height={70}
139
+ style={{ marginRight: 10, marginBottom: 5 }}
140
+ />
141
+ <Placeholder style={{ paddingVertical: 10 }}>
142
+ <PlaceholderLine width={60} height={10} />
143
+ <PlaceholderLine width={50} height={10} />
144
+ <PlaceholderLine width={70} height={10} />
145
+ </Placeholder>
146
+ </View>
147
+ </Placeholder>
148
+ </View>
149
+ ),
150
+ )}
151
+ </>
152
+ )}
153
+ </ProductsList>
154
+ </BContainer>
155
+ <OModal
156
+ open={openFilters}
157
+ onCancel={() => handleCloseFilters()}
158
+ onClose={() => handleCloseFilters()}
159
+ >
160
+ <ScrollView style={styles.filterContainer}>
161
+ <OText
162
+ size={20}
163
+ mBottom={15}
164
+ style={{ marginTop: 10 }}
165
+ >
166
+ {t('FILTER', 'Filter')}
167
+ </OText>
168
+ <SortContainer>
169
+ <OText weight='bold' mBottom={7} size={16}>
170
+ {t('SORT', 'Sort')}
171
+ </OText>
172
+ {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
173
+ <TouchableOpacity
174
+ key={item?.value}
175
+ onPress={() => handleChangeFilters('orderBy', item?.value)}
176
+ style={{ marginBottom: 7 }}
177
+ >
178
+ <OText
179
+ weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
180
+ mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
181
+ >
182
+ {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
183
+ </OText>
184
+ </TouchableOpacity>
185
+ ))}
186
+ </SortContainer>
187
+ <BrandContainer>
188
+ <OText
189
+ size={16}
190
+ weight='bold'
191
+ lineHeight={24}
192
+ style={{ marginBottom: 10 }}
193
+ >
194
+ {t('BRANDS', 'Brands')}
195
+ </OText>
196
+ {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
197
+ <ScrollView
198
+ style={{ maxHeight: 300, marginBottom: 10 }}
199
+ showsVerticalScrollIndicator={true}
200
+ nestedScrollEnabled={true}
201
+ >
202
+ {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
203
+ <BrandItem
204
+ key={i}
205
+ onPress={() => handleChangeBrandFilter(brand?.id)}
206
+ >
207
+ <OText
208
+ size={14}
209
+ weight={'400'}
210
+ lineHeight={24}
211
+ >
212
+ {brand?.name}
213
+ </OText>
214
+ {filters?.franchise_ids?.includes(brand?.id) && (
215
+ <AntDesignIcon
216
+ name='check'
217
+ color={theme.colors.success500}
218
+ size={16}
219
+ />
220
+ )}
221
+ </BrandItem>
222
+ ))}
223
+ </ScrollView>
224
+ )}
225
+ {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
226
+ <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
227
+ )}
228
+ </BrandContainer>
229
+ <PriceFilterWrapper>
230
+ <OText
231
+ size={16}
232
+ weight='bold'
233
+ lineHeight={24}
234
+ style={{ marginBottom: 5 }}
235
+ >
236
+ {t('PRICE_RANGE', 'Price range')}
237
+ </OText>
238
+ <View style={styles.priceContainer}>
239
+ {priceList.map((price: any, i: number) => (
240
+ <OButton
241
+ key={i}
242
+ bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
243
+ onClick={() => handleChangePriceRange(price?.level)}
244
+ text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
245
+ style={styles.priceItem}
246
+ textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
247
+ />
248
+ ))}
249
+ </View>
250
+ </PriceFilterWrapper>
251
+ {orderState?.options?.type === 1 && (
252
+ <MaxSectionItem
253
+ filters={filters}
254
+ title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
255
+ options={maxDeliveryFeeOptions}
256
+ filter='max_delivery_price'
257
+ handleChangeFilters={handleChangeFilters}
258
+ />
259
+ )}
260
+ {[1, 2].includes(orderState?.options?.type) && (
261
+ <MaxSectionItem
262
+ filters={filters}
263
+ title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
264
+ options={maxTimeOptions}
265
+ filter='max_eta'
266
+ handleChangeFilters={handleChangeFilters}
267
+ />
268
+ )}
269
+ <MaxSectionItem
270
+ filters={filters}
271
+ title={t('MAX_DISTANCE', 'Max distance')}
272
+ options={maxDistanceOptions}
273
+ filter='max_distance'
274
+ handleChangeFilters={handleChangeFilters}
275
+ />
276
+ {businessTypes?.length > 0 && (
277
+ <TagsContainer>
278
+ <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
279
+ <View style={styles.businessTypesContainer}>
280
+ {businessTypes.map((type: any, i: number) => type.enabled && (
281
+ <OButton
282
+ key={type?.id}
283
+ bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
284
+ onClick={() => handleChangeActiveBusinessType(type)}
285
+ text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
286
+ style={styles.categoryStyle}
287
+ textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
288
+ />
289
+ ))}
290
+ </View>
291
+ </TagsContainer>
292
+ )}
293
+ </ScrollView>
294
+ <WrapperButtons>
295
+ <View style={{ width: '50%' }}>
296
+ <OButton
297
+ text={t('APPLY', 'Apply')}
298
+ parentStyle={styles.applyButton}
299
+ textStyle={{ color: '#fff' }}
300
+ onClick={() => handleApplyFilters()}
301
+ />
302
+ </View>
303
+ <View style={{ width: '50%' }}>
304
+ <OButton
305
+ text={t('CLEAR_FILTERS', 'Clear')}
306
+ bgColor={theme.colors.white}
307
+ borderColor={theme.colors.primary}
308
+ parentStyle={styles.applyButton}
309
+ textStyle={{ color: theme.colors.primary }}
310
+ onClick={() => clearFilters()}
311
+ />
312
+ </View>
313
+ </WrapperButtons>
314
+ </OModal>
315
+ </>
316
+ )
317
+ }