ordering-ui-react-native 0.17.73 → 0.17.74-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 (231) hide show
  1. package/package.json +8 -7
  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/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +28 -25
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +149 -118
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +37 -21
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +103 -39
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +17 -15
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +139 -174
  41. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  42. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  43. package/themes/business/src/components/StoresList/index.tsx +3 -4
  44. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  45. package/themes/business/src/components/shared/OLink.tsx +11 -3
  46. package/themes/business/src/components/shared/OModal.tsx +16 -9
  47. package/themes/business/src/components/shared/OText.tsx +6 -1
  48. package/themes/business/src/types/index.tsx +25 -10
  49. package/themes/business/src/utils/index.tsx +29 -2
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  54. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  55. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  59. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  60. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  61. package/themes/original/index.tsx +1 -1
  62. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  63. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  64. package/themes/original/src/components/AddressList/index.tsx +25 -24
  65. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  66. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  67. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  68. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  69. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  70. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  71. package/themes/original/src/components/BusinessController/index.tsx +80 -66
  72. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  73. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  74. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  75. package/themes/original/src/components/BusinessInformation/index.tsx +139 -85
  76. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  77. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  78. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  79. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  80. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  81. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  82. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  83. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  84. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -557
  85. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  86. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  89. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  90. package/themes/original/src/components/Cart/index.tsx +76 -79
  91. package/themes/original/src/components/CartContent/index.tsx +117 -20
  92. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  93. package/themes/original/src/components/Checkout/index.tsx +274 -54
  94. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  95. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  96. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  97. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  98. package/themes/original/src/components/Favorite/index.tsx +2 -6
  99. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  100. package/themes/original/src/components/FloatingButton/index.tsx +10 -13
  101. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +7 -3
  103. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  104. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +19 -6
  105. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  106. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  107. package/themes/original/src/components/Help/index.tsx +2 -2
  108. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  109. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  110. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  111. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  112. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  113. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  114. package/themes/original/src/components/Home/index.tsx +13 -4
  115. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  117. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  118. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  119. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  120. package/themes/original/src/components/Messages/index.tsx +14 -7
  121. package/themes/original/src/components/MomentOption/index.tsx +193 -90
  122. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  123. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  124. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  125. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  126. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  127. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  128. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  129. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  130. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  131. package/themes/original/src/components/NavBar/index.tsx +20 -17
  132. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  133. package/themes/original/src/components/Notifications/index.tsx +42 -52
  134. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  135. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  136. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  137. package/themes/original/src/components/OrderDetails/index.tsx +28 -233
  138. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  139. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  140. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  141. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  142. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  143. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  144. package/themes/original/src/components/OrdersOption/index.tsx +67 -85
  145. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  146. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  147. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  148. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  149. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  150. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  151. package/themes/original/src/components/PaymentOptions/index.tsx +77 -34
  152. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  153. package/themes/original/src/components/ProductForm/index.tsx +104 -29
  154. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  155. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  156. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  157. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  158. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  159. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  160. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  161. package/themes/original/src/components/Promotions/index.tsx +2 -2
  162. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  163. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  164. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  165. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  166. package/themes/original/src/components/Sessions/index.tsx +11 -8
  167. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  168. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  169. package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
  170. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  171. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  172. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  173. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  174. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  175. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  176. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  177. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  178. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  179. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  180. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  181. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  182. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  183. package/themes/original/src/components/UserProfileForm/index.tsx +17 -21
  184. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  185. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  186. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  187. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  188. package/themes/original/src/components/Wallets/index.tsx +56 -33
  189. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  190. package/themes/original/src/components/shared/OButton.tsx +6 -2
  191. package/themes/original/src/components/shared/OInput.tsx +6 -1
  192. package/themes/original/src/components/shared/OModal.tsx +3 -3
  193. package/themes/original/src/types/index.tsx +38 -10
  194. package/themes/original/src/utils/index.tsx +273 -1
  195. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  196. package/src/navigators/BottomNavigator.tsx +0 -117
  197. package/src/navigators/CheckoutNavigator.tsx +0 -66
  198. package/src/navigators/HomeNavigator.tsx +0 -202
  199. package/src/navigators/NavigationRef.tsx +0 -7
  200. package/src/navigators/RootNavigator.tsx +0 -269
  201. package/src/pages/Account.tsx +0 -34
  202. package/src/pages/AddressForm.tsx +0 -62
  203. package/src/pages/AddressList.tsx +0 -24
  204. package/src/pages/BusinessProductsList.tsx +0 -81
  205. package/src/pages/BusinessesListing.tsx +0 -43
  206. package/src/pages/CartList.tsx +0 -49
  207. package/src/pages/Checkout.tsx +0 -101
  208. package/src/pages/ForgotPassword.tsx +0 -24
  209. package/src/pages/Help.tsx +0 -23
  210. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  211. package/src/pages/HelpGuide.tsx +0 -23
  212. package/src/pages/HelpOrder.tsx +0 -23
  213. package/src/pages/Home.tsx +0 -36
  214. package/src/pages/IntroductoryTutorial.tsx +0 -170
  215. package/src/pages/Login.tsx +0 -47
  216. package/src/pages/MomentOption.tsx +0 -30
  217. package/src/pages/MultiCheckout.tsx +0 -31
  218. package/src/pages/MultiOrdersDetails.tsx +0 -27
  219. package/src/pages/MyOrders.tsx +0 -40
  220. package/src/pages/NetworkError.tsx +0 -24
  221. package/src/pages/NotFound.tsx +0 -22
  222. package/src/pages/OrderDetails.tsx +0 -25
  223. package/src/pages/ProductDetails.tsx +0 -55
  224. package/src/pages/Profile.tsx +0 -36
  225. package/src/pages/ReviewDriver.tsx +0 -30
  226. package/src/pages/ReviewOrder.tsx +0 -32
  227. package/src/pages/ReviewProducts.tsx +0 -30
  228. package/src/pages/Sessions.tsx +0 -22
  229. package/src/pages/Signup.tsx +0 -53
  230. package/src/pages/SpinnerLoader.tsx +0 -10
  231. package/src/pages/Splash.tsx +0 -21
@@ -34,8 +34,8 @@ export const Metadata = styled.View`
34
34
 
35
35
  export const BusinessState = styled.View`
36
36
  position: absolute;
37
- top: 13px;
38
- end: 18px;
37
+ top: ${(props: any) => props.isRibbon ? '32px' : '15px'};
38
+ right: 15px;
39
39
  `
40
40
 
41
41
  export const BusinessLogo = styled.View`
@@ -72,15 +72,22 @@ export const RibbonBox = styled.View`
72
72
  ${(props: any) => props.isCapsule && css`
73
73
  border-radius: 50px;
74
74
  `}
75
+
76
+ ${(props: any) => props.colorText && css`
77
+ color: ${props.colorText ? 'black' : 'white'};
78
+ `}
79
+
80
+ ${(props: any) => props.borderRibbon && css`
81
+ border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
82
+ `}
75
83
  `
76
84
 
77
85
  export const OfferBox = styled.View`
78
86
  position: absolute;
79
87
  z-index: 1;
80
- top: 20px;
81
- right: 10px;
82
88
  border-radius: 50px;
83
- color: ${(props: any) => props.theme.colors.textThird};
89
+ top: ${(props: any) => props.isRibbon ? '32px' : '15px'};
90
+ right: ${(props: any) => props.isClosed ? '110px' : '15px'};
84
91
  background: ${(props: any) => props.theme.colors.inputBorderColor};
85
92
  padding: 3px 8px;
86
93
  max-width: 180px;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { StyleSheet, useWindowDimensions, View } from 'react-native';
2
3
  import {
3
4
  BusinessController as BusinessSingleCard,
4
5
  useUtils,
@@ -6,33 +7,29 @@ import {
6
7
  useLanguage,
7
8
  } from 'ordering-components/native';
8
9
  import { useTheme } from 'styled-components/native';
9
- import { OIcon, OText } from '../shared';
10
- import { StyleSheet, useWindowDimensions, View } from 'react-native';
10
+ import FastImage from 'react-native-fast-image'
11
+
12
+ import { OText } from '../shared';
11
13
  import { BusinessControllerParams } from '../../types';
12
- import { convertHoursToMinutes, shape } from '../../utils';
14
+ import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
13
15
  import {
14
16
  Card,
15
17
  BusinessHero,
16
18
  BusinessContent,
17
- BusinessCategory,
18
19
  BusinessInfo,
19
20
  Metadata,
20
- BusinessState,
21
21
  BusinessLogo,
22
- Reviews,
23
22
  RibbonBox
24
23
  } from './styles';
25
24
 
26
25
  export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
27
26
  const { business, handleClick, isBusinessOpen } = props;
28
- const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
29
- useUtils();
27
+
28
+ const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
30
29
  const [orderState] = useOrder();
31
30
  const [, t] = useLanguage();
32
-
33
31
  const theme = useTheme();
34
32
 
35
-
36
33
  const styles = StyleSheet.create({
37
34
  headerStyle: {
38
35
  borderTopLeftRadius: 25,
@@ -79,35 +76,28 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
79
76
  justifyContent: 'flex-start',
80
77
  width: '100%',
81
78
  },
79
+ productStyle: {
80
+ height: 40,
81
+ width: 40
82
+ }
82
83
  });
83
84
 
84
- const types = ['food', 'laundry', 'alcohol', 'groceries'];
85
-
86
85
  const { width } = useWindowDimensions();
87
86
 
88
- const getBusinessType = () => {
89
- if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
90
- const _types: any = [];
91
- types.forEach((type) => {
92
- if (business[type]) {
93
- _types.push(t(type.toUpperCase(), type));
94
- }
95
- });
96
- return _types.join(', ');
97
- };
98
-
99
87
  return (
100
88
  <Card activeOpacity={1} onPress={() => handleClick(business)}>
101
89
  {business?.ribbon?.enabled && (
102
90
  <RibbonBox
103
91
  bgColor={business?.ribbon?.color}
92
+ colorText={lightenDarkenColor(business?.ribbon?.color)}
93
+ borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
104
94
  isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
105
95
  isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
106
96
  >
107
97
  <OText
108
98
  size={10}
109
99
  weight={'400'}
110
- color={theme.colors.white}
100
+ color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
111
101
  numberOfLines={2}
112
102
  ellipsizeMode='tail'
113
103
  lineHeight={13}
@@ -118,10 +108,13 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
118
108
  )}
119
109
  <BusinessHero>
120
110
  <BusinessLogo>
121
- <OIcon
122
- url={optimizeImage(business?.logo, 'h_100,c_limit')}
123
- width={40}
124
- height={40}
111
+ <FastImage
112
+ style={styles.productStyle}
113
+ source={{
114
+ uri: optimizeImage(business?.logo, 'h_100,c_limit'),
115
+ priority: FastImage.priority.normal,
116
+ }}
117
+ resizeMode={FastImage.resizeMode.cover}
125
118
  />
126
119
  </BusinessLogo>
127
120
  <BusinessContent style={{ width: width * 0.6 }}>
@@ -129,23 +122,7 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
129
122
  <OText size={12} ellipsizeMode={'tail'} numberOfLines={2}>
130
123
  {business?.name}
131
124
  </OText>
132
- {/* {business?.reviews?.total > 0 && (
133
- <Reviews>
134
- <IconAntDesign
135
- name="star"
136
- color={theme.colors.primary}
137
- size={16}
138
- style={styles.starIcon}
139
- />
140
- <OText>
141
- {parseNumber(business?.reviews?.total, { separator: '.' })}
142
- </OText>
143
- </Reviews>
144
- )} */}
145
125
  </BusinessInfo>
146
- {/* <BusinessCategory>
147
- <OText>{getBusinessType()}</OText>
148
- </BusinessCategory> */}
149
126
  <Metadata>
150
127
  {!isBusinessOpen ? (
151
128
  <View style={styles.closed}>
@@ -155,7 +132,6 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
155
132
  </View>
156
133
  ) : (
157
134
  <View style={styles.bullet}>
158
- {/* <MaterialComIcon name="alarm" size={16} /> */}
159
135
  <OText size={10} color={theme.colors.textSecondary}>
160
136
  {t('DELIVERY_FEE', 'Delivery Fee')}
161
137
  </OText>
@@ -184,15 +160,6 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
184
160
  )}
185
161
  </Metadata>
186
162
  </BusinessContent>
187
- {/* <BusinessState>
188
- {!business?.open && (
189
- <View style={styles.businessStateView}>
190
- <OText color={theme.colors.white} size={20} style={styles.businessStateText}>
191
- {t('PREORDER', 'PREORDER')}
192
- </OText>
193
- </View>
194
- )}
195
- </BusinessState> */}
196
163
  </BusinessHero>
197
164
  </Card>
198
165
  );
@@ -70,4 +70,12 @@ export const RibbonBox = styled.View`
70
70
  ${(props: any) => props.isCapsule && css`
71
71
  border-radius: 50px;
72
72
  `}
73
+
74
+ ${(props: any) => props.colorText && css`
75
+ color: ${props.colorText ? 'black' : 'white'};
76
+ `}
77
+
78
+ ${(props: any) => props.borderRibbon && css`
79
+ border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
80
+ `}
73
81
  `
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React, { useState, useCallback } from 'react';
2
2
  import {
3
3
  BusinessInformation as BusinessInformationController,
4
- useLanguage, useUtils
4
+ useLanguage, useUtils, useConfig,
5
5
  } from 'ordering-components/native';
6
6
  import { useTheme } from 'styled-components/native';
7
7
  import { OIcon, OText } from '../shared';
@@ -16,31 +16,41 @@ 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
+ import moment from 'moment';
26
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
27
+ const { useDeviceOrientation } = DeviceOrientationMethods
28
+
25
29
  const BusinessInformationUI = (props: BusinessInformationParams) => {
26
30
  const { businessState, businessSchedule, businessLocation } = props;
27
31
 
28
32
  const theme = useTheme();
29
33
  const [, t] = useLanguage();
30
34
  const [{ optimizeImage }] = useUtils();
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
41
+
42
+ const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
43
+ const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
44
+ const hideVideos = theme?.business_view?.components?.information?.components?.videos?.hidden
45
+ const hideImages = theme?.business_view?.components?.information?.components?.images?.hidden
46
+ const hideAddress = theme?.business_view?.components?.information?.components?.address?.hidden
47
+ const formatTime = configs?.general_hour_format?.value
48
+
49
+ const checkTime = (val: number) => (val < 10 ? `0${val}` : val);
50
+ const timeFormated = (time: any) => {
51
+ return moment(`1900-01-01 ${checkTime(time.hour)}:${checkTime(time.minute)}`).format(formatTime)
52
+ }
31
53
 
32
- const scheduleFormatted = ({
33
- hour,
34
- minute,
35
- }: {
36
- hour: number | string;
37
- minute: number | string;
38
- }) => {
39
- const checkTime = (val: number | string) => (val < 10 ? `0${val}` : val);
40
- const zz = hour > 12 ? 'PM' : 'AM';
41
- const h = parseInt(`${hour}`);
42
- return `${h > 12 ? h - 12 : h}:${checkTime(minute)} ${zz}`;
43
- };
44
54
  const businessCoordinate = {
45
55
  lat: businessState?.business?.location?.lat,
46
56
  lng: businessState?.business?.location?.lng,
@@ -71,6 +81,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
71
81
  return iAry;
72
82
  };
73
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
+
74
88
  return (
75
89
  <BusinessInformationContainer>
76
90
  <WrapMainContent contentContainerStyle={{}}>
@@ -78,87 +92,127 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
78
92
  <OText size={24} weight={'600'}>
79
93
  {businessState?.business?.name}
80
94
  </OText>
81
- <GrayBackground>
82
- <OText size={16} weight="500">
83
- {t('BUSINESS_LOCATION', 'Business Location')}
95
+ {!hideLocation && (
96
+ <>
97
+ <GrayBackground>
98
+ <OText size={16} weight="500">
99
+ {t('BUSINESS_LOCATION', 'Business Location')}
100
+ </OText>
101
+ </GrayBackground>
102
+ {businessLocation.location && (
103
+ <WrapBusinessMap style={styles.wrapMapStyle}>
104
+ <GoogleMap
105
+ readOnly
106
+ location={businessLocation.location}
107
+ markerTitle={businessState?.business?.name}
108
+ />
109
+ </WrapBusinessMap>
110
+ )}
111
+ </>
112
+ )}
113
+ {!hideAddress && (
114
+ <OText size={12} mBottom={10}>
115
+ {businessState?.business?.address}
84
116
  </OText>
85
- </GrayBackground>
86
- {businessLocation.location && (
87
- <WrapBusinessMap style={styles.wrapMapStyle}>
88
- <GoogleMap
89
- readOnly
90
- location={businessLocation.location}
91
- markerTitle={businessState?.business?.name}
92
- />
93
- </WrapBusinessMap>
94
117
  )}
95
- <OText size={12} mBottom={20}>
96
- {businessState?.business?.address}
97
- </OText>
118
+ {businessState?.business?.address_notes && (
119
+ <>
120
+ <OText
121
+ size={12}
122
+ mBottom={10}
123
+ numberOfLines={isReadMore ? 20 : 3}
124
+ onTextLayout={onTextLayout}
125
+ >
126
+ {businessState?.business?.address_notes}
127
+ </OText>
128
+ {lengthMore && (
129
+ <TouchableOpacity
130
+ onPress={() => setIsReadMore(!isReadMore)}
131
+ >
132
+ <OText size={12} mBottom={20} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
133
+ </TouchableOpacity>
134
+ )}
135
+ </>
136
+ )}
98
137
  <DivideView />
99
- <GrayBackground>
100
- <OText size={16} weight="500">
101
- {t('OPENING_TIME', 'Opening Time')}
102
- </OText>
103
- </GrayBackground>
104
- {businessSchedule && businessSchedule?.length > 0 && (
105
- <WrapScheduleBlock>
106
- {businessSchedule.map((schedule: any, i: number) => (
107
- <ScheduleBlock key={i}>
108
- <ScheduleAccordion
109
- weekIndex={i}
110
- scheduleFormatted={scheduleFormatted}
111
- schedule={schedule}
112
- />
113
- </ScheduleBlock>
114
- ))}
115
- </WrapScheduleBlock>
138
+ {!hideSchedule && (
139
+ <>
140
+ <GrayBackground>
141
+ <OText size={16} weight="500">
142
+ {t('OPENING_TIME', 'Opening Time')}
143
+ </OText>
144
+ </GrayBackground>
145
+ {businessSchedule && businessSchedule?.length > 0 && (
146
+ <WrapScheduleBlock>
147
+ {businessSchedule.map((schedule: any, i: number) => (
148
+ <ScheduleBlock key={i}>
149
+ <ScheduleAccordion
150
+ weekIndex={i}
151
+ timeFormated={timeFormated}
152
+ schedule={schedule}
153
+ />
154
+ </ScheduleBlock>
155
+ ))}
156
+ </WrapScheduleBlock>
157
+ )}
158
+ </>
116
159
  )}
160
+
117
161
  {/* {businessState?.business?.gallery?.length > 0 && ( */}
162
+
118
163
  <>
119
- {bVideos().length > 0 && (
164
+ {!hideVideos && (
120
165
  <>
121
- <DivideView />
122
- <GrayBackground>
123
- <OText size={16} weight="500">
124
- {t('VIDEOS', 'Videos')}
125
- </OText>
126
- </GrayBackground>
127
- <MediaWrapper horizontal>
128
- {bVideos().map((v: any) => (
129
- <WebView
130
- key={`vid_id_${v.id}`}
131
- style={{ width: 210, height: 127, borderRadius: 7.6 }}
132
- javaScriptEnabled={true}
133
- domStorageEnabled={true}
134
- source={{
135
- html: `
136
- <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
166
+ {bVideos().length > 0 && (
167
+ <>
168
+ <DivideView />
169
+ <GrayBackground>
170
+ <OText size={16} weight="500">
171
+ {t('VIDEOS', 'Videos')}
172
+ </OText>
173
+ </GrayBackground>
174
+ <MediaWrapper horizontal>
175
+ {bVideos().map((v: any) => (
176
+ <WebView
177
+ key={`vid_id_${v.id}`}
178
+ style={{ width: 210, height: 127, borderRadius: 7.6 }}
179
+ javaScriptEnabled={true}
180
+ domStorageEnabled={true}
181
+ source={{
182
+ html: `
183
+ <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
137
184
  `,
138
- }}
139
- mediaPlaybackRequiresUserAction={true}
140
- />
141
- ))}
142
- </MediaWrapper>
185
+ }}
186
+ mediaPlaybackRequiresUserAction={true}
187
+ />
188
+ ))}
189
+ </MediaWrapper>
190
+ </>
191
+ )}
143
192
  </>
144
193
  )}
145
- {bImages().length > 0 && (
194
+
195
+ {!hideImages && (
146
196
  <>
147
- <DivideView />
148
- <GrayBackground>
149
- <OText size={16} weight="500">
150
- {t('IMAGES', 'Images')}
151
- </OText>
152
- </GrayBackground>
153
- <MediaWrapper horizontal>
154
- {bImages().map((i: any) => (
155
- i.file != null &&
156
- <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
157
- <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
158
- {/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
159
- </View>
160
- ))}
161
- </MediaWrapper>
197
+ {bImages().length > 0 && (
198
+ <>
199
+ <DivideView />
200
+ <GrayBackground>
201
+ <OText size={16} weight="500">
202
+ {t('IMAGES', 'Images')}
203
+ </OText>
204
+ </GrayBackground>
205
+ <MediaWrapper horizontal>
206
+ {bImages().map((i: any) => (
207
+ i.file != null &&
208
+ <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
209
+ <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
210
+ {/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
211
+ </View>
212
+ ))}
213
+ </MediaWrapper>
214
+ </>
215
+ )}
162
216
  </>
163
217
  )}
164
218
  </>
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
2
  import { TouchableOpacity, View } from 'react-native';
3
- import { useOrder, useLanguage, useUtils, useConfig } from 'ordering-components/native';
3
+ import { useOrder, useLanguage, useUtils, useConfig, useEvent } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
6
6
  BIContainer,
@@ -22,7 +22,8 @@ export const BusinessItemAccordion = (props: any) => {
22
22
  handleClearProducts,
23
23
  handleClickCheckout,
24
24
  checkoutButtonDisabled,
25
- isMultiCheckout
25
+ isMultiCheckout,
26
+ isFromUpselling
26
27
  } = props
27
28
 
28
29
  const [orderState] = useOrder();
@@ -30,6 +31,7 @@ export const BusinessItemAccordion = (props: any) => {
30
31
  const [{ parsePrice }] = useUtils();
31
32
  const [{ configs }] = useConfig()
32
33
  const theme = useTheme();
34
+ const [events] = useEvent()
33
35
 
34
36
  const isCartPending = cart?.status === 2
35
37
  const isClosed = !cart?.valid_schedule
@@ -37,6 +39,7 @@ export const BusinessItemAccordion = (props: any) => {
37
39
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
38
40
 
39
41
  const [isActive, setActiveState] = useState(!!singleBusiness)
42
+ const [viewedCart, setViewedCart] = useState<any>(null)
40
43
 
41
44
  useEffect(() => {
42
45
  const cartsArray = Object.values(orderState?.carts)
@@ -52,6 +55,15 @@ export const BusinessItemAccordion = (props: any) => {
52
55
  return acc = acc
53
56
  }, cart?.subtotal)
54
57
 
58
+ useEffect(() => {
59
+ if (isActive && !isFromUpselling) {
60
+ if (cart?.uuid !== viewedCart?.uuid) {
61
+ setViewedCart(cart)
62
+ events.emit('cart_viewed', cart)
63
+ }
64
+ }
65
+ }, [isActive, viewedCart])
66
+
55
67
  return (
56
68
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
57
69
  <BIHeader
@@ -62,23 +74,6 @@ export const BusinessItemAccordion = (props: any) => {
62
74
  <BIInfo>
63
75
  <BIContentInfo>
64
76
  <OText size={16} lineHeight={24} weight={'600'}>{cart?.business?.name}</OText>
65
- {/* {orderState?.options?.type === 1 ? (
66
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
67
- <MaterialCommunityIcon
68
- name='clock-outline'
69
- size={24}
70
- />
71
- <OText>{convertHoursToMinutes(cart?.business?.delivery_time)}</OText>
72
- </View>
73
- ) : (
74
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
75
- <MaterialCommunityIcon
76
- name='clock-outline'
77
- size={24}
78
- />
79
- <OText>{convertHoursToMinutes(cart?.business?.pickup_time)}</OText>
80
- </View>
81
- )} */}
82
77
  <View style={{ flexDirection: 'row' }}>
83
78
  {props.onNavigationRedirect && !isClosed && (
84
79
  <>
@@ -87,7 +82,7 @@ export const BusinessItemAccordion = (props: any) => {
87
82
  </TouchableOpacity>
88
83
  </>
89
84
  )}
90
- {!isCartPending && !isClosed && (
85
+ {!isCartPending && (
91
86
  <>
92
87
  <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
93
88
  <OAlert