ordering-ui-react-native 0.16.9 → 0.16.10-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 (219) hide show
  1. package/package.json +8 -4
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/LanguageSelector/index.tsx +21 -16
  13. package/src/components/LoginForm/index.tsx +118 -30
  14. package/src/components/LoginForm/styles.tsx +6 -0
  15. package/src/components/Messages/index.tsx +2 -2
  16. package/src/components/NotificationSetting/index.tsx +85 -0
  17. package/src/components/OrderDetails/index.tsx +7 -21
  18. package/src/components/OrdersOption/index.tsx +54 -56
  19. package/src/components/PaymentOptions/index.tsx +335 -365
  20. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  21. package/src/components/ReviewDriver/index.tsx +1 -1
  22. package/src/components/ReviewOrder/index.tsx +2 -1
  23. package/src/components/ReviewProducts/index.tsx +11 -0
  24. package/src/components/SignupForm/index.tsx +143 -61
  25. package/src/components/SingleProductReview/index.tsx +8 -5
  26. package/src/components/StripeElementsForm/index.tsx +25 -16
  27. package/src/components/StripeMethodForm/index.tsx +1 -2
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/navigators/CheckoutNavigator.tsx +6 -0
  32. package/src/navigators/HomeNavigator.tsx +6 -0
  33. package/src/pages/BusinessesListing.tsx +7 -6
  34. package/src/pages/MultiCheckout.tsx +31 -0
  35. package/src/pages/MultiOrdersDetails.tsx +27 -0
  36. package/src/pages/OrderDetails.tsx +1 -1
  37. package/src/pages/ReviewDriver.tsx +2 -2
  38. package/src/pages/ReviewOrder.tsx +2 -2
  39. package/src/theme.json +0 -1
  40. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  41. package/src/types/index.tsx +13 -9
  42. package/src/utils/index.tsx +0 -1
  43. package/themes/business/index.tsx +4 -0
  44. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  45. package/themes/business/src/components/Chat/index.tsx +42 -34
  46. package/themes/business/src/components/DriverMap/index.tsx +13 -10
  47. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  48. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  49. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  50. package/themes/business/src/components/MapView/index.tsx +1 -1
  51. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  52. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  53. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  54. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
  55. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  56. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  57. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  58. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  61. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  62. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  65. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  66. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  67. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  68. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  69. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  70. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  71. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  72. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  73. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  74. package/themes/business/src/components/shared/OModal.tsx +40 -37
  75. package/themes/business/src/types/index.tsx +14 -9
  76. package/themes/business/src/utils/index.tsx +10 -0
  77. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  78. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  79. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  80. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  81. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  82. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  83. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  84. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  85. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  86. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  87. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  88. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  89. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  90. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  91. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  92. package/themes/kiosk/src/types/index.d.ts +2 -0
  93. package/themes/original/index.tsx +22 -0
  94. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  95. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  96. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  97. package/themes/original/src/components/AddressList/index.tsx +1 -1
  98. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  99. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  100. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  101. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  102. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  103. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  104. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  105. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  106. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  107. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  108. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  109. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  110. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  111. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  112. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  113. package/themes/original/src/components/BusinessProductsList/index.tsx +65 -72
  114. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  115. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -178
  116. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  117. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  118. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  119. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  121. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  122. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  123. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  124. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  125. package/themes/original/src/components/Cart/index.tsx +81 -36
  126. package/themes/original/src/components/Cart/styles.tsx +4 -0
  127. package/themes/original/src/components/CartContent/index.tsx +22 -16
  128. package/themes/original/src/components/Checkout/index.tsx +106 -66
  129. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  130. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  131. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  132. package/themes/original/src/components/Favorite/index.tsx +92 -0
  133. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  134. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  135. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  136. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  137. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  138. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  139. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  140. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  141. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  142. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  143. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  144. package/themes/original/src/components/Messages/index.tsx +17 -17
  145. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  146. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  148. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  149. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  150. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  151. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  152. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  153. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  154. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  155. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  156. package/themes/original/src/components/NavBar/index.tsx +11 -5
  157. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  158. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  159. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  160. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  161. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  162. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  163. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  164. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  165. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  166. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  168. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  170. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  171. package/themes/original/src/components/OrdersOption/index.tsx +130 -37
  172. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  173. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  174. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  175. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  176. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  177. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  178. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  179. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  180. package/themes/original/src/components/ProductItemAccordion/index.tsx +37 -24
  181. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  182. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  183. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  184. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  185. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  186. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  187. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  188. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  189. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  190. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  191. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  192. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  193. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  194. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  195. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  196. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  197. package/themes/original/src/components/SingleProductCard/index.tsx +215 -95
  198. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  199. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  200. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  201. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  202. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  203. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  204. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  205. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  206. package/themes/original/src/components/UserProfile/index.tsx +12 -1
  207. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  208. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  209. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  210. package/themes/original/src/components/Wallets/index.tsx +176 -162
  211. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  212. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  213. package/themes/original/src/components/shared/OButton.tsx +10 -3
  214. package/themes/original/src/components/shared/OInput.tsx +3 -2
  215. package/themes/original/src/components/shared/OModal.tsx +3 -1
  216. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  217. package/themes/original/src/types/index.tsx +200 -46
  218. package/themes/original/src/utils/index.tsx +77 -0
  219. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,13 +1,18 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
2
3
  import {
3
4
  BusinessController as BusinessSingleCard,
4
5
  useUtils,
5
6
  useOrder,
6
7
  useLanguage,
7
- useConfig
8
+ useConfig,
9
+ useToast,
10
+ useSession,
11
+ ToastType
8
12
  } from 'ordering-components/native';
9
13
  import { OIcon, OText } from '../shared';
10
- import { StyleSheet, View } from 'react-native';
14
+ import { StyleSheet, TouchableOpacity, View, Animated } from 'react-native';
15
+ import { InView } from 'react-native-intersection-observer'
11
16
  import { BusinessControllerParams } from '../../types';
12
17
  import { convertHoursToMinutes, shape } from '../../utils';
13
18
  import {
@@ -20,10 +25,12 @@ import {
20
25
  BusinessState,
21
26
  BusinessLogo,
22
27
  Reviews,
23
- RibbonBox
28
+ RibbonBox,
29
+ ReviewAndFavorite
24
30
  } from './styles';
25
31
  import { useTheme } from 'styled-components/native';
26
32
  import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
33
+ import IconAntDesign from 'react-native-vector-icons/AntDesign'
27
34
  import FastImage from 'react-native-fast-image'
28
35
 
29
36
  export const BusinessControllerUI = (props: BusinessControllerParams) => {
@@ -40,13 +47,19 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
40
47
  businessDeliveryPrice,
41
48
  businessDeliveryTime,
42
49
  businessPickupTime,
43
- businessDistance
50
+ businessDistance,
51
+ handleFavoriteBusiness,
52
+ enableIntersection
44
53
  } = props;
45
54
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
55
+ const [, { showToast }] = useToast()
46
56
  const [orderState] = useOrder();
57
+ const [ { auth }] = useSession()
47
58
  const [configState] = useConfig();
48
59
  const [, t] = useLanguage();
49
60
  const theme = useTheme()
61
+ const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
62
+
50
63
  const styles = StyleSheet.create({
51
64
  headerStyle: {
52
65
  borderTopLeftRadius: 7.6,
@@ -116,115 +129,185 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
116
129
  const handleBusinessClick = (selectedBusiness: any) => {
117
130
  if (business?.open) handleClick && handleClick(selectedBusiness)
118
131
  else {
119
- navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
132
+ if (configState?.configs?.preorder_status_enabled?.value === '1') {
133
+ navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
134
+ return
135
+ }
136
+ showToast(ToastType.Info, t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment'));
137
+ }
138
+ }
139
+
140
+ const handleChangeFavorite = () => {
141
+ if (auth) {
142
+ handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
143
+ } else {
144
+ navigation && navigation.navigate('Login');
120
145
  }
121
146
  }
122
147
 
148
+ const handleChangeInterSection = (inView: boolean) => {
149
+ setIsIntersectionObserver(inView)
150
+ }
151
+
123
152
  return (
124
- <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
125
- {business?.ribbon?.enabled && (
126
- <RibbonBox
127
- bgColor={business?.ribbon?.color}
128
- isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
129
- isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
130
- >
131
- <OText
132
- size={10}
133
- weight={'400'}
134
- color={theme.colors.white}
135
- numberOfLines={2}
136
- ellipsizeMode='tail'
137
- lineHeight={13}
138
- >
139
- {business?.ribbon?.text}
140
- </OText>
141
- </RibbonBox>
142
- )}
143
- <BusinessHero>
144
- <FastImage
145
- style={{ height: 120 }}
146
- source={{
147
- uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
148
- priority: FastImage.priority.normal,
149
- }}
150
- resizeMode={FastImage.resizeMode.cover}
151
- />
152
- {(businessFeatured ?? business?.featured) && (
153
- <View style={styles.featured}>
154
- <FontAwesomeIcon name="crown" size={26} color="gold" />
155
- </View>
156
- )}
157
- <BusinessState>
158
- {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
159
- <View style={styles.businessStateView}>
153
+ <InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeInterSection(inView)}>
154
+ {isIntersectionObserver ? (
155
+ <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
156
+ {business?.ribbon?.enabled && (
157
+ <RibbonBox
158
+ bgColor={business?.ribbon?.color}
159
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
160
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
161
+ >
160
162
  <OText
161
- color={theme.colors.textThird}
162
163
  size={10}
163
- style={styles.businessStateText}>
164
- {t('PREORDER', 'PREORDER')}
164
+ weight={'400'}
165
+ color={theme.colors.white}
166
+ numberOfLines={2}
167
+ ellipsizeMode='tail'
168
+ lineHeight={13}
169
+ >
170
+ {business?.ribbon?.text}
165
171
  </OText>
166
- </View>
172
+ </RibbonBox>
167
173
  )}
168
- </BusinessState>
169
- </BusinessHero>
170
- <BusinessContent>
171
- <BusinessInfo>
172
- <BusinessLogo style={styles.businessLogo}>
174
+ <BusinessHero>
173
175
  <FastImage
174
- style={{ width: 56, height: 56 }}
176
+ style={{ height: 120 }}
175
177
  source={{
176
- uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
178
+ uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
177
179
  priority: FastImage.priority.normal,
178
180
  }}
179
181
  resizeMode={FastImage.resizeMode.cover}
180
182
  />
181
- </BusinessLogo>
182
- {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
183
- <Reviews>
184
- <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
185
- <OText size={10} style={{ lineHeight: 15 }}>
186
- {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
187
- </OText>
188
- </Reviews>
189
- )}
190
- </BusinessInfo>
191
- <OText
192
- size={12}
193
- style={{ lineHeight: 18, marginBottom: 6 }}
194
- weight={'500'}>
195
- {business?.name}
196
- </OText>
197
- <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
198
- {business?.address}
199
- </OText>
200
- {/* <BusinessCategory>
183
+ {(businessFeatured ?? business?.featured) && (
184
+ <View style={styles.featured}>
185
+ <FontAwesomeIcon name="crown" size={26} color="gold" />
186
+ </View>
187
+ )}
188
+ <BusinessState>
189
+ {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
190
+ <View style={styles.businessStateView}>
191
+ <OText
192
+ color={theme.colors.textThird}
193
+ size={10}
194
+ style={styles.businessStateText}>
195
+ {t('PREORDER', 'PREORDER')}
196
+ </OText>
197
+ </View>
198
+ )}
199
+ </BusinessState>
200
+ </BusinessHero>
201
+ <BusinessContent>
202
+ <BusinessInfo>
203
+ <BusinessLogo style={styles.businessLogo}>
204
+ <FastImage
205
+ style={{ width: 56, height: 56 }}
206
+ source={{
207
+ uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
208
+ priority: FastImage.priority.normal,
209
+ }}
210
+ resizeMode={FastImage.resizeMode.cover}
211
+ />
212
+ </BusinessLogo>
213
+ <ReviewAndFavorite>
214
+ {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
215
+ <Reviews>
216
+ <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
217
+ <OText size={10} style={{ lineHeight: 15 }}>
218
+ {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
219
+ </OText>
220
+ </Reviews>
221
+ )}
222
+ <TouchableOpacity
223
+ onPress={handleChangeFavorite}
224
+ >
225
+ <IconAntDesign
226
+ name={business?.favorite ? 'heart' : 'hearto'}
227
+ color={theme.colors.danger5}
228
+ size={18}
229
+ />
230
+ </TouchableOpacity>
231
+ </ReviewAndFavorite>
232
+ </BusinessInfo>
233
+ <OText
234
+ size={12}
235
+ style={{ lineHeight: 18, marginBottom: 6 }}
236
+ weight={'500'}>
237
+ {business?.name}
238
+ </OText>
239
+ <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
240
+ {business?.address}
241
+ </OText>
242
+ {/* <BusinessCategory>
201
243
  <OText>{getBusinessType()}</OText>
202
244
  </BusinessCategory> */}
203
- <Metadata>
204
- {!isBusinessOpen ? (
205
- <View style={styles.closed}>
206
- <OText size={10} color={theme.colors.red}>
207
- {t('CLOSED', 'Closed')}
208
- </OText>
209
- </View>
210
- ) : (
211
- <View style={styles.bullet}>
212
- {orderState?.options?.type === 1 && (
213
- <OText size={10} color={theme.colors.textSecondary}>
214
- {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
215
- </OText>
245
+ <Metadata>
246
+ {!isBusinessOpen ? (
247
+ <View style={styles.closed}>
248
+ <OText size={10} color={theme.colors.red}>
249
+ {t('CLOSED', 'Closed')}
250
+ </OText>
251
+ </View>
252
+ ) : (
253
+ <View style={styles.bullet}>
254
+ {orderState?.options?.type === 1 && (
255
+ <OText size={10} color={theme.colors.textSecondary}>
256
+ {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
257
+ </OText>
258
+ )}
259
+ <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
260
+ orderState?.options?.type === 1
261
+ ? (businessDeliveryTime ?? business?.delivery_time)
262
+ : (businessPickupTime ?? business?.pickup_time),
263
+ )} \u2022 `}</OText>
264
+ <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
265
+ </View>
216
266
  )}
217
- <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
218
- orderState?.options?.type === 1
219
- ? (businessDeliveryTime ?? business?.delivery_time)
220
- : (businessPickupTime ?? business?.pickup_time),
221
- )} \u2022 `}</OText>
222
- <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
267
+ </Metadata>
268
+ </BusinessContent>
269
+ </Card>
270
+ ) : (
271
+ <Placeholder
272
+ Animation={Fade}
273
+ style={{ marginBottom: 20 }}>
274
+ <View style={{ width: '100%' }}>
275
+ <PlaceholderLine
276
+ height={200}
277
+ style={{ marginBottom: 20, borderRadius: 25 }}
278
+ />
279
+ <View style={{ paddingHorizontal: 10 }}>
280
+ <View
281
+ style={{
282
+ flexDirection: 'row',
283
+ justifyContent: 'space-between',
284
+ }}>
285
+ <PlaceholderLine
286
+ height={25}
287
+ width={40}
288
+ style={{ marginBottom: 10 }}
289
+ />
290
+ <PlaceholderLine
291
+ height={25}
292
+ width={20}
293
+ style={{ marginBottom: 10 }}
294
+ />
295
+ </View>
296
+ <PlaceholderLine
297
+ height={20}
298
+ width={30}
299
+ style={{ marginBottom: 10 }}
300
+ />
301
+ <PlaceholderLine
302
+ height={20}
303
+ width={80}
304
+ style={{ marginBottom: 10 }}
305
+ />
223
306
  </View>
224
- )}
225
- </Metadata>
226
- </BusinessContent>
227
- </Card>
307
+ </View>
308
+ </Placeholder>
309
+ )}
310
+ </InView>
228
311
  );
229
312
  };
230
313
 
@@ -49,6 +49,11 @@ export const BusinessLogo = styled.View`
49
49
 
50
50
  `
51
51
 
52
+ export const ReviewAndFavorite = styled.View`
53
+ flex-direction: row;
54
+ align-items: center;
55
+ `
56
+
52
57
  export const Reviews = styled.View`
53
58
  flex-direction: row;
54
59
  align-items: center;
@@ -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 } from 'ordering-components/native';
3
+ import { useOrder, useLanguage, useUtils, useConfig } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
6
6
  BIContainer,
@@ -21,30 +21,33 @@ export const BusinessItemAccordion = (props: any) => {
21
21
  singleBusiness,
22
22
  handleClearProducts,
23
23
  handleClickCheckout,
24
- checkoutButtonDisabled
24
+ checkoutButtonDisabled,
25
+ isMultiCheckout
25
26
  } = props
26
27
 
27
28
  const [orderState] = useOrder();
28
29
  const [, t] = useLanguage();
29
30
  const [{ parsePrice }] = useUtils();
31
+ const [{ configs }] = useConfig()
30
32
  const theme = useTheme();
31
33
 
32
34
  const isCartPending = cart?.status === 2
33
35
  const isClosed = !cart?.valid_schedule
34
36
  const isProducts = cart?.products?.length
37
+ const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
35
38
 
36
39
  const [isActive, setActiveState] = useState(!!singleBusiness)
37
40
 
38
41
  useEffect(() => {
39
42
  const cartsArray = Object.values(orderState?.carts)
40
43
  const cartsLength = cartsArray.filter((cart: any) => cart.products.length > 0).length ?? 0
41
- if ((cartsLength === 1) && !isClosed) {
42
- setActiveState(true)
44
+ if (cartsLength === 1) {
45
+ setActiveState(!isClosed)
43
46
  }
44
- }, [orderState?.carts])
47
+ }, [orderState?.carts, isClosed])
45
48
 
46
49
  return (
47
- <BIContainer isClosed={isClosed} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
50
+ <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
48
51
  <BIHeader
49
52
  isClosed={isClosed}
50
53
  onPress={() => !isClosed ? setActiveState(!isActive) : isClosed}
@@ -90,7 +93,7 @@ export const BusinessItemAccordion = (props: any) => {
90
93
  </OAlert>
91
94
  </>
92
95
  )}
93
- {props.handleChangeStore && (
96
+ {isBusinessChangeEnabled && props.handleChangeStore && (
94
97
  <>
95
98
  <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
96
99
  <TouchableOpacity
@@ -139,14 +142,14 @@ export const BusinessItemAccordion = (props: any) => {
139
142
  )}
140
143
  </BIActions>
141
144
  </BIHeader>
142
- {!isActive && !isClosed && !!isProducts && (
145
+ {!isActive && !isClosed && !!isProducts && !isMultiCheckout && (
143
146
  <PriceContainer>
144
147
  <OText>{parsePrice(cart?.total)}</OText>
145
148
  {cart?.valid_products && (
146
149
  <OButton
147
150
  onClick={handleClickCheckout}
148
151
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
149
- style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
152
+ style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
150
153
  text={t('CHECKOUT', 'Checkout')}
151
154
  bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
152
155
  borderColor={theme.colors.primary}
@@ -7,7 +7,9 @@ export const BIContainer = styled.View`
7
7
  opacity: 1;
8
8
  border-radius: 7.6px;
9
9
  overflow: hidden;
10
- min-height: 120px;
10
+ ${(props: any) => !props.isMultiCheckout && css`
11
+ min-height: 120px;
12
+ `}
11
13
  ${(props: any) => props.isClosed && css`
12
14
  opacity: 0.5;
13
15
  min-height: 60px;
@@ -0,0 +1,57 @@
1
+ import React from 'react'
2
+ import { View } from 'react-native'
3
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
+
5
+ export const BusinessControllerSkeletons = ({ paginationProps }: any) => {
6
+ return (
7
+ <>
8
+ {[
9
+ ...Array(
10
+ paginationProps.nextPageItems
11
+ ? paginationProps.nextPageItems
12
+ : 3,
13
+ ).keys(),
14
+ ].map((item, i) => (
15
+ <Placeholder
16
+ Animation={Fade}
17
+ key={i}
18
+ style={{ width: 320, marginRight: 20, marginTop: 20 }}>
19
+ <View style={{ width: 320 }}>
20
+ <PlaceholderLine
21
+ height={155}
22
+ style={{ marginBottom: 20, borderRadius: 25 }}
23
+ />
24
+ <View style={{ paddingHorizontal: 10 }}>
25
+ <View
26
+ style={{
27
+ flexDirection: 'row',
28
+ justifyContent: 'space-between',
29
+ }}>
30
+ <PlaceholderLine
31
+ height={25}
32
+ width={40}
33
+ style={{ marginBottom: 10 }}
34
+ />
35
+ <PlaceholderLine
36
+ height={25}
37
+ width={20}
38
+ style={{ marginBottom: 10 }}
39
+ />
40
+ </View>
41
+ <PlaceholderLine
42
+ height={20}
43
+ width={30}
44
+ style={{ marginBottom: 10 }}
45
+ />
46
+ <PlaceholderLine
47
+ height={20}
48
+ width={80}
49
+ style={{ marginBottom: 0 }}
50
+ />
51
+ </View>
52
+ </View>
53
+ </Placeholder>
54
+ ))}
55
+ </>
56
+ )
57
+ }
@@ -0,0 +1,59 @@
1
+ import { useLanguage, useUtils } from 'ordering-components/native'
2
+ import React from 'react'
3
+ import { View, TouchableOpacity, StyleSheet } from 'react-native'
4
+ import { OText } from '../../shared'
5
+
6
+ import { ProgressContentWrapper, ProgressBar } from './styles'
7
+
8
+ export const MaxSectionItem = (props: any) => {
9
+ const {
10
+ filters,
11
+ handleChangeFilters,
12
+ title,
13
+ options,
14
+ filter
15
+ } = props
16
+
17
+ const [, t] = useLanguage()
18
+ const [{ parsePrice }] = useUtils();
19
+
20
+ const styles = StyleSheet.create({
21
+ maxContainer: {
22
+ flexDirection: 'row',
23
+ justifyContent: 'space-between'
24
+ }
25
+ });
26
+
27
+ const parseValue = (option: number) => {
28
+ return filter === 'max_distance'
29
+ ? `${option / 1000} ${t('KM', 'Km')}`
30
+ : filter === 'max_eta'
31
+ ? `${option} ${t('MIN', 'min')}`
32
+ : parsePrice(option)
33
+ }
34
+ return (
35
+ <View style={{ marginBottom: 20 }}>
36
+ <OText weight='bold' mBottom={10} size={16}>
37
+ {title}
38
+ </OText>
39
+ <ProgressContentWrapper>
40
+ <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
41
+ </ProgressContentWrapper>
42
+ <View style={styles.maxContainer}>
43
+ {options.map((option: any, i: number) => (
44
+ <TouchableOpacity
45
+ onPress={() => handleChangeFilters(filter, option)}
46
+ key={option}
47
+ >
48
+ <OText
49
+ size={12}
50
+ weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
51
+ >
52
+ {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
53
+ </OText>
54
+ </TouchableOpacity>
55
+ ))}
56
+ </View>
57
+ </View>
58
+ )
59
+ }
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const ProgressBar = styled.View`
4
+ height: 4px;
5
+ background: ${(props: any) => props.theme.colors.textNormal};
6
+ `
7
+
8
+ export const ProgressContentWrapper = styled.View`
9
+ height: 4px;
10
+ background: #F8F9FA;
11
+ margin-bottom: 10px;
12
+ flex: 1;
13
+ `