ordering-ui-react-native 0.16.12 → 0.16.13-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 (213) 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/BusinessProductsList/index.tsx +10 -10
  10. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  11. package/src/components/BusinessesListing/index.tsx +1 -1
  12. package/src/components/Checkout/index.tsx +2 -1
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +118 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +143 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  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 +16 -0
  94. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  95. package/themes/original/src/components/AddressList/index.tsx +1 -1
  96. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  97. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  98. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  99. package/themes/original/src/components/BusinessController/index.tsx +173 -108
  100. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  101. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  102. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  103. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  104. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  105. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  106. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  107. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  108. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  109. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  110. package/themes/original/src/components/BusinessProductsList/index.tsx +60 -77
  111. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  112. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -181
  113. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  114. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  115. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  116. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  117. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  118. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  119. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  121. package/themes/original/src/components/BusinessesListing/index.tsx +100 -484
  122. package/themes/original/src/components/Cart/index.tsx +81 -36
  123. package/themes/original/src/components/Cart/styles.tsx +4 -0
  124. package/themes/original/src/components/CartContent/index.tsx +22 -16
  125. package/themes/original/src/components/Checkout/index.tsx +106 -66
  126. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  127. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  128. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  129. package/themes/original/src/components/Favorite/index.tsx +1 -0
  130. package/themes/original/src/components/Favorite/styles.tsx +1 -0
  131. package/themes/original/src/components/FavoriteList/index.tsx +143 -94
  132. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  133. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  134. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  135. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  136. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  137. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  138. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  139. package/themes/original/src/components/Messages/index.tsx +17 -17
  140. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  141. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  142. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  143. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  144. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  145. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  146. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  147. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  148. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  149. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  150. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  151. package/themes/original/src/components/NavBar/index.tsx +11 -5
  152. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  153. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  154. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  155. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  156. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  157. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  158. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  159. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  160. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  161. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  162. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  163. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  164. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  165. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  166. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  167. package/themes/original/src/components/OrdersOption/index.tsx +126 -37
  168. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  169. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  170. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  171. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  172. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  173. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  174. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  175. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  176. package/themes/original/src/components/ProductItemAccordion/index.tsx +40 -27
  177. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  178. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  179. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  180. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  181. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  182. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  183. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  184. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  185. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  186. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  187. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  188. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  189. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  190. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  191. package/themes/original/src/components/SingleOrderCard/index.tsx +213 -177
  192. package/themes/original/src/components/SingleProductCard/index.tsx +198 -110
  193. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  194. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  195. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  196. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  197. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  198. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  199. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  200. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  201. package/themes/original/src/components/UserProfile/index.tsx +8 -1
  202. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  203. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  204. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  205. package/themes/original/src/components/Wallets/index.tsx +174 -162
  206. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  207. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  208. package/themes/original/src/components/shared/OButton.tsx +10 -3
  209. package/themes/original/src/components/shared/OInput.tsx +3 -2
  210. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  211. package/themes/original/src/types/index.tsx +160 -47
  212. package/themes/original/src/utils/index.tsx +77 -0
  213. 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, TouchableOpacity, 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 {
@@ -43,13 +48,18 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
43
48
  businessDeliveryTime,
44
49
  businessPickupTime,
45
50
  businessDistance,
46
- handleFavoriteBusiness
51
+ handleFavoriteBusiness,
52
+ enableIntersection
47
53
  } = props;
48
54
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
55
+ const [, { showToast }] = useToast()
49
56
  const [orderState] = useOrder();
57
+ const [ { auth }] = useSession()
50
58
  const [configState] = useConfig();
51
59
  const [, t] = useLanguage();
52
60
  const theme = useTheme()
61
+ const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
62
+
53
63
  const styles = StyleSheet.create({
54
64
  headerStyle: {
55
65
  borderTopLeftRadius: 7.6,
@@ -119,130 +129,185 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
119
129
  const handleBusinessClick = (selectedBusiness: any) => {
120
130
  if (business?.open) handleClick && handleClick(selectedBusiness)
121
131
  else {
122
- 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');
123
145
  }
124
146
  }
125
147
 
126
- const handleChangeFavorite = () => {
127
- handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
128
- }
148
+ const handleChangeInterSection = (inView: boolean) => {
149
+ setIsIntersectionObserver(inView)
150
+ }
129
151
 
130
152
  return (
131
- <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
132
- {business?.ribbon?.enabled && (
133
- <RibbonBox
134
- bgColor={business?.ribbon?.color}
135
- isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
136
- isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
137
- >
138
- <OText
139
- size={10}
140
- weight={'400'}
141
- color={theme.colors.white}
142
- numberOfLines={2}
143
- ellipsizeMode='tail'
144
- lineHeight={13}
145
- >
146
- {business?.ribbon?.text}
147
- </OText>
148
- </RibbonBox>
149
- )}
150
- <BusinessHero>
151
- <FastImage
152
- style={{ height: 120 }}
153
- source={{
154
- uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
155
- priority: FastImage.priority.normal,
156
- }}
157
- resizeMode={FastImage.resizeMode.cover}
158
- />
159
- {(businessFeatured ?? business?.featured) && (
160
- <View style={styles.featured}>
161
- <FontAwesomeIcon name="crown" size={26} color="gold" />
162
- </View>
163
- )}
164
- <BusinessState>
165
- {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
166
- <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
+ >
167
162
  <OText
168
- color={theme.colors.textThird}
169
163
  size={10}
170
- style={styles.businessStateText}>
171
- {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}
172
171
  </OText>
173
- </View>
172
+ </RibbonBox>
174
173
  )}
175
- </BusinessState>
176
- </BusinessHero>
177
- <BusinessContent>
178
- <BusinessInfo>
179
- <BusinessLogo style={styles.businessLogo}>
174
+ <BusinessHero>
180
175
  <FastImage
181
- style={{ width: 56, height: 56 }}
176
+ style={{ height: 120 }}
182
177
  source={{
183
- uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
178
+ uri: optimizeImage(businessHeader || business?.header || theme.images.dummies.businessHeader, 'h_500,c_limit'),
184
179
  priority: FastImage.priority.normal,
185
180
  }}
186
181
  resizeMode={FastImage.resizeMode.cover}
187
182
  />
188
- </BusinessLogo>
189
- <ReviewAndFavorite>
190
- {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
191
- <Reviews>
192
- <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
193
- <OText size={10} style={{ lineHeight: 15 }}>
194
- {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
195
- </OText>
196
- </Reviews>
183
+ {(businessFeatured ?? business?.featured) && (
184
+ <View style={styles.featured}>
185
+ <FontAwesomeIcon name="crown" size={26} color="gold" />
186
+ </View>
197
187
  )}
198
- <TouchableOpacity
199
- onPress={handleChangeFavorite}
200
- >
201
- <IconAntDesign
202
- name={business?.favorite ? 'heart' : 'hearto'}
203
- color={theme.colors.danger5}
204
- size={18}
205
- />
206
- </TouchableOpacity>
207
- </ReviewAndFavorite>
208
- </BusinessInfo>
209
- <OText
210
- size={12}
211
- style={{ lineHeight: 18, marginBottom: 6 }}
212
- weight={'500'}>
213
- {business?.name}
214
- </OText>
215
- <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
216
- {business?.address}
217
- </OText>
218
- {/* <BusinessCategory>
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 || theme.images.dummies.businessLogo, '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>
219
243
  <OText>{getBusinessType()}</OText>
220
244
  </BusinessCategory> */}
221
- <Metadata>
222
- {!isBusinessOpen ? (
223
- <View style={styles.closed}>
224
- <OText size={10} color={theme.colors.red}>
225
- {t('CLOSED', 'Closed')}
226
- </OText>
227
- </View>
228
- ) : (
229
- <View style={styles.bullet}>
230
- {orderState?.options?.type === 1 && (
231
- <OText size={10} color={theme.colors.textSecondary}>
232
- {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
233
- </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>
234
266
  )}
235
- <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
236
- orderState?.options?.type === 1
237
- ? (businessDeliveryTime ?? business?.delivery_time)
238
- : (businessPickupTime ?? business?.pickup_time),
239
- )} \u2022 `}</OText>
240
- <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
+ />
241
306
  </View>
242
- )}
243
- </Metadata>
244
- </BusinessContent>
245
- </Card>
307
+ </View>
308
+ </Placeholder>
309
+ )}
310
+ </InView>
246
311
  );
247
312
  };
248
313
 
@@ -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
+ `