ordering-ui-react-native 0.17.52 → 0.17.53-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 (217) 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 +191 -6
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +93 -50
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +63 -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 +30 -15
  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 +28 -10
  67. package/themes/original/src/components/AddressForm/index.tsx +73 -42
  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 +25 -15
  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 +97 -91
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -4
  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 +33 -59
  155. package/themes/original/src/components/OrderSummary/index.tsx +85 -57
  156. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  157. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  158. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  159. package/themes/original/src/components/OrdersOption/index.tsx +76 -66
  160. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  161. package/themes/original/src/components/PageBanner/index.tsx +107 -40
  162. package/themes/original/src/components/PageBanner/styles.tsx +4 -1
  163. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  164. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  165. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  166. package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
  167. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  168. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  169. package/themes/original/src/components/ProductForm/index.tsx +110 -33
  170. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  171. package/themes/original/src/components/ProductItemAccordion/index.tsx +22 -19
  172. package/themes/original/src/components/ProductOptionSubOption/index.tsx +24 -14
  173. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +3 -4
  174. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  175. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  176. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  177. package/themes/original/src/components/Promotions/index.tsx +234 -220
  178. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  179. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  180. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  181. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  182. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  183. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  184. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  185. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  186. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  187. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  188. package/themes/original/src/components/Sessions/index.tsx +11 -8
  189. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  190. package/themes/original/src/components/SignupForm/index.tsx +43 -20
  191. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  192. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  193. package/themes/original/src/components/SingleProductCard/index.tsx +71 -34
  194. package/themes/original/src/components/SingleProductCard/styles.tsx +21 -4
  195. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  196. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  197. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  198. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  199. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  200. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  201. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  202. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  203. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  204. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  205. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  206. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  207. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  208. package/themes/original/src/components/Wallets/index.tsx +67 -24
  209. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  210. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  211. package/themes/original/src/components/shared/OButton.tsx +6 -2
  212. package/themes/original/src/components/shared/OInput.tsx +6 -1
  213. package/themes/original/src/components/shared/OModal.tsx +3 -3
  214. package/themes/original/src/layouts/Container.tsx +1 -1
  215. package/themes/original/src/types/index.tsx +40 -11
  216. package/themes/original/src/utils/index.tsx +375 -58
  217. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -11,10 +11,11 @@ import {
11
11
  ToastType
12
12
  } from 'ordering-components/native';
13
13
  import { OIcon, OText } from '../shared';
14
- import { StyleSheet, View } from 'react-native';
14
+ import { Dimensions, StyleSheet, View } from 'react-native';
15
15
  import { InView } from 'react-native-intersection-observer'
16
16
  import { BusinessControllerParams } from '../../types';
17
- import { convertHoursToMinutes, shape } from '../../utils';
17
+ import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
18
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
18
19
 
19
20
  import {
20
21
  BusinessHero,
@@ -25,7 +26,8 @@ import {
25
26
  BusinessLogo,
26
27
  Reviews,
27
28
  RibbonBox,
28
- ReviewAndFavorite
29
+ ReviewAndFavorite,
30
+ OfferBox
29
31
  } from './styles';
30
32
  import { useTheme } from 'styled-components/native';
31
33
  import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
@@ -49,8 +51,10 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
49
51
  businessPickupTime,
50
52
  businessDistance,
51
53
  handleFavoriteBusiness,
52
- enableIntersection
54
+ enableIntersection,
55
+ getBusinessOffer
53
56
  } = props;
57
+
54
58
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
55
59
  const [, { showToast }] = useToast()
56
60
  const [orderState] = useOrder();
@@ -58,14 +62,29 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
58
62
  const [configState] = useConfig();
59
63
  const [, t] = useLanguage();
60
64
  const theme = useTheme()
65
+ const windowHeight = Dimensions.get('window').height
61
66
  const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
62
67
 
68
+ const hideBusinessLogo = theme?.business_listing_view?.components?.business?.components?.logo?.hidden
69
+ const hideBusinessFee = theme?.business_listing_view?.components?.business?.components?.fee?.hidden
70
+ const hideBusinessTime = theme?.business_listing_view?.components?.business?.components?.time?.hidden
71
+ const hideBusinessDistance = theme?.business_listing_view?.components?.business?.components?.distance?.hidden
72
+ const hideBusinessReviews = theme?.business_listing_view?.components?.business?.components?.reviews?.hidden
73
+ const hideBusinessFavorite = theme?.business_listing_view?.components?.business?.components?.favorite?.hidden
74
+ const hideBusinessOffer = theme?.business_listing_view?.components?.business?.components?.offer?.hidden
75
+ const hideBusinessHeader = theme?.business_listing_view?.components?.business?.components?.header?.hidden
76
+ const hideBusinessFavoriteBadge = theme?.business_listing_view?.components?.business?.components?.featured_badge?.hidden
77
+
78
+ const textSize = 12
79
+ const cardHeight = windowHeight * 0.3
80
+
63
81
  const styles = StyleSheet.create({
64
82
  container: {
65
83
  marginVertical: 20,
66
84
  borderRadius: 7.6,
67
85
  width: '100%',
68
- position: 'relative'
86
+ position: 'relative',
87
+ height: cardHeight
69
88
  },
70
89
  headerStyle: {
71
90
  borderTopLeftRadius: 7.6,
@@ -132,7 +151,16 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
132
151
  return _types.join(', ');
133
152
  };
134
153
 
154
+ const vibrateApp = (impact?: string) => {
155
+ const options = {
156
+ enableVibrateFallback: true,
157
+ ignoreAndroidSystemSettings: false
158
+ };
159
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
160
+ }
161
+
135
162
  const handleBusinessClick = (selectedBusiness: any) => {
163
+ vibrateApp()
136
164
  if (business?.open) handleClick && handleClick(selectedBusiness)
137
165
  else {
138
166
  if (configState?.configs?.preorder_status_enabled?.value === '1') {
@@ -159,22 +187,21 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
159
187
  <InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeInterSection(inView)}>
160
188
  {isIntersectionObserver ? (
161
189
  <CardAnimation
190
+ style={[style, styles.container]}
162
191
  onClick={() => handleBusinessClick(business)}
163
- style={[
164
- style,
165
- styles.container
166
- ]}
167
192
  >
168
193
  {business?.ribbon?.enabled && (
169
194
  <RibbonBox
170
195
  bgColor={business?.ribbon?.color}
196
+ colorText={lightenDarkenColor(business?.ribbon?.color)}
197
+ borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
171
198
  isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
172
199
  isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
173
200
  >
174
201
  <OText
175
202
  size={10}
176
203
  weight={'400'}
177
- color={theme.colors.white}
204
+ color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
178
205
  numberOfLines={2}
179
206
  ellipsizeMode='tail'
180
207
  lineHeight={13}
@@ -184,20 +211,38 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
184
211
  </RibbonBox>
185
212
  )}
186
213
  <BusinessHero>
187
- <FastImage
188
- style={{ height: 120 }}
189
- source={(businessHeader || business?.header) ? {
190
- uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
191
- priority: FastImage.priority.normal,
192
- } : theme.images.dummies.businessHeader}
193
- resizeMode={FastImage.resizeMode.cover}
194
- />
195
- {(businessFeatured ?? business?.featured) && (
214
+ {!hideBusinessHeader && (
215
+ <FastImage
216
+ style={{ height: cardHeight * 0.66 }}
217
+ source={(businessHeader || business?.header || typeof theme.images.dummies.businessHeader === 'string') ? {
218
+ uri: optimizeImage(businessHeader || business?.header || theme.images.dummies.businessHeader, 'h_500,c_limit'),
219
+ priority: FastImage.priority.normal,
220
+ } : theme.images.dummies.businessHeader}
221
+ resizeMode={FastImage.resizeMode.cover}
222
+ />
223
+ )}
224
+ {(businessFeatured ?? business?.featured) && !hideBusinessFavoriteBadge && (
196
225
  <View style={styles.featured}>
197
226
  <FontAwesomeIcon name="crown" size={26} color="gold" />
198
227
  </View>
199
228
  )}
200
- <BusinessState>
229
+ {!hideBusinessOffer && (
230
+ getBusinessOffer((business?.offers)) &&
231
+ <OfferBox
232
+ isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}
233
+ isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}
234
+ >
235
+ <OText
236
+ size={10}
237
+ weight={'400'}
238
+ color={theme.colors.textThird}
239
+ numberOfLines={2}
240
+ ellipsizeMode='tail'
241
+ lineHeight={13}
242
+ >{getBusinessOffer((business?.offers)) || parsePrice(0)}</OText>
243
+ </OfferBox>
244
+ )}
245
+ <BusinessState isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}>
201
246
  {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
202
247
  <View style={styles.businessStateView}>
203
248
  <OText
@@ -211,49 +256,54 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
211
256
  </BusinessState>
212
257
  </BusinessHero>
213
258
  <BusinessContent>
214
- <BusinessInfo>
215
- <BusinessLogo style={styles.businessLogo}>
216
- <FastImage
217
- style={{ width: 56, height: 56 }}
218
- source={(businessLogo || business?.logo) ? {
219
- uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
220
- priority: FastImage.priority.normal,
221
- } : theme.images.dummies.businessLogo}
222
- resizeMode={FastImage.resizeMode.cover}
223
- />
224
- </BusinessLogo>
225
- <ReviewAndFavorite>
226
- {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
227
- <Reviews>
228
- <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
229
- <OText size={10} style={{ lineHeight: 15 }}>
230
- {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
231
- </OText>
232
- </Reviews>
233
- )}
234
- <LottieAnimation
235
- type='favorite'
236
- onClick={handleChangeFavorite}
237
- initialValue={business?.favorite ? 0.75 : 0}
238
- toValue={business?.favorite ? 0 : 0.75}
239
- disableAnimation={!auth}
240
- iconProps={{ color: theme.colors.danger5, size: 18 }}
241
- isActive={business?.favorite}
242
- />
243
- </ReviewAndFavorite>
259
+ <BusinessInfo style={{ position: 'absolute', bottom: 85, left: 15 }}>
260
+ {!hideBusinessLogo && (
261
+ <BusinessLogo style={styles.businessLogo}>
262
+ <FastImage
263
+ style={{ width: 56, height: 56 }}
264
+ source={(businessLogo || business?.logo || typeof theme.images.dummies.businessLogo === 'string') ? {
265
+ uri: optimizeImage(businessLogo || business?.logo || theme.images.dummies.businessLogo, 'h_150,c_limit'),
266
+ priority: FastImage.priority.normal,
267
+ } : theme.images.dummies.businessLogo}
268
+ resizeMode={FastImage.resizeMode.cover}
269
+ />
270
+ </BusinessLogo>
271
+ )}
244
272
  </BusinessInfo>
245
- <OText
246
- size={12}
247
- style={{ lineHeight: 18, marginBottom: 6 }}
248
- weight={'500'}>
249
- {business?.name}
250
- </OText>
251
- <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
273
+ <View style={{ width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5 }}>
274
+ <OText
275
+ size={textSize + 2}
276
+ style={{ lineHeight: 18, marginBottom: 6 }}
277
+ weight={'500'}>
278
+ {business?.name}
279
+ </OText>
280
+ {(!hideBusinessFavorite || !hideBusinessReviews) && (
281
+ <ReviewAndFavorite>
282
+ {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && !hideBusinessReviews && (
283
+ <Reviews>
284
+ <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
285
+ <OText size={10} style={{ lineHeight: 15 }}>
286
+ {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
287
+ </OText>
288
+ </Reviews>
289
+ )}
290
+ {!hideBusinessFavorite && (
291
+ <LottieAnimation
292
+ type='favorite'
293
+ onClick={handleChangeFavorite}
294
+ initialValue={business?.favorite ? 0.5 : 0}
295
+ toValue={business?.favorite ? 0 : 0.5}
296
+ disableAnimation={!auth}
297
+ iconProps={{ color: theme.colors.danger5, size: 18 }}
298
+ isActive={business?.favorite}
299
+ />
300
+ )}
301
+ </ReviewAndFavorite>
302
+ )}
303
+ </View>
304
+ <OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={1}>
252
305
  {business?.address}
253
306
  </OText>
254
- {/* <BusinessCategory>
255
- <OText>{getBusinessType()}</OText>
256
- </BusinessCategory> */}
257
307
  <Metadata>
258
308
  {!isBusinessOpen ? (
259
309
  <View style={styles.closed}>
@@ -263,17 +313,21 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
263
313
  </View>
264
314
  ) : (
265
315
  <View style={styles.bullet}>
266
- {orderState?.options?.type === 1 && (
267
- <OText size={10} color={theme.colors.textSecondary}>
316
+ {orderState?.options?.type === 1 && !hideBusinessFee && (
317
+ <OText size={textSize} color={theme.colors.textSecondary}>
268
318
  {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
269
319
  </OText>
270
320
  )}
271
- <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
272
- orderState?.options?.type === 1
273
- ? (businessDeliveryTime ?? business?.delivery_time)
274
- : (businessPickupTime ?? business?.pickup_time),
275
- )} \u2022 `}</OText>
276
- <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
321
+ {!hideBusinessTime && (
322
+ <OText size={textSize} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
323
+ orderState?.options?.type === 1
324
+ ? (businessDeliveryTime ?? business?.delivery_time)
325
+ : (businessPickupTime ?? business?.pickup_time),
326
+ )} \u2022 `}</OText>
327
+ )}
328
+ {!hideBusinessDistance && (
329
+ <OText size={textSize} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
330
+ )}
277
331
  </View>
278
332
  )}
279
333
  </Metadata>
@@ -9,7 +9,7 @@ export const BusinessHero = styled.View`
9
9
 
10
10
  export const BusinessContent = styled.View`
11
11
  padding-horizontal: 18px;
12
- padding-bottom: 18px;
12
+ padding-bottom: 10px;
13
13
  border-bottom-left-radius: 7.6px;
14
14
  border-bottom-right-radius: 7.6px;
15
15
  border-width: 1px;
@@ -34,12 +34,12 @@ 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`
42
-
42
+
43
43
  `
44
44
 
45
45
  export const ReviewAndFavorite = styled.View`
@@ -72,4 +72,23 @@ 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
+ `}
83
+ `
84
+
85
+ export const OfferBox = styled.View`
86
+ position: absolute;
87
+ z-index: 1;
88
+ border-radius: 50px;
89
+ top: ${(props: any) => props.isRibbon ? '32px' : '15px'};
90
+ right: ${(props: any) => props.isClosed ? '110px' : '15px'};
91
+ background: ${(props: any) => props.theme.colors.inputBorderColor};
92
+ padding: 3px 8px;
93
+ max-width: 180px;
75
94
  `
@@ -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
  `