ordering-ui-react-native 0.16.24 → 0.16.25-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 (201) hide show
  1. package/package.json +7 -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 +33 -4
  9. package/src/components/BusinessInformation/styles.tsx +2 -2
  10. package/src/components/BusinessProductsList/index.tsx +10 -10
  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 +2 -20
  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/pages/BusinessesListing.tsx +7 -6
  32. package/src/pages/OrderDetails.tsx +1 -1
  33. package/src/pages/ReviewDriver.tsx +2 -2
  34. package/src/pages/ReviewOrder.tsx +2 -2
  35. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  36. package/src/types/index.tsx +13 -9
  37. package/src/utils/index.tsx +0 -1
  38. package/themes/business/index.tsx +4 -0
  39. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  40. package/themes/business/src/components/Chat/index.tsx +42 -34
  41. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  42. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  43. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  44. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  45. package/themes/business/src/components/MapView/index.tsx +12 -1
  46. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  47. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  48. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  49. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  50. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  51. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  52. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  54. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  55. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  56. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  57. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  58. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  59. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  60. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  61. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  62. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  63. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  64. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  65. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  66. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  67. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  68. package/themes/business/src/components/shared/OModal.tsx +40 -37
  69. package/themes/business/src/types/index.tsx +15 -9
  70. package/themes/business/src/utils/index.tsx +10 -0
  71. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  72. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  73. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  74. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  75. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  76. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  77. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  78. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  79. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  80. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  81. package/themes/kiosk/src/types/index.d.ts +2 -0
  82. package/themes/original/index.tsx +12 -0
  83. package/themes/original/src/components/AddressForm/index.tsx +139 -135
  84. package/themes/original/src/components/AddressList/index.tsx +1 -1
  85. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  86. package/themes/original/src/components/BusinessBasicInformation/index.tsx +311 -161
  87. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  88. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  89. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  90. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -4
  91. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  92. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  93. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  94. package/themes/original/src/components/BusinessListingSearch/index.tsx +101 -125
  95. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  96. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  97. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  98. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  99. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  100. package/themes/original/src/components/BusinessProductsListing/index.tsx +287 -175
  101. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -8
  102. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  103. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  104. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  105. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  106. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -10
  107. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  108. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  109. package/themes/original/src/components/BusinessesListing/index.tsx +105 -519
  110. package/themes/original/src/components/Cart/index.tsx +42 -10
  111. package/themes/original/src/components/Cart/styles.tsx +4 -0
  112. package/themes/original/src/components/CartContent/index.tsx +22 -16
  113. package/themes/original/src/components/Checkout/index.tsx +90 -53
  114. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  115. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  116. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  117. package/themes/original/src/components/Favorite/index.tsx +1 -0
  118. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  119. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  120. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  121. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  122. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  123. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  124. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  125. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  126. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  127. package/themes/original/src/components/LoginForm/index.tsx +82 -44
  128. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  129. package/themes/original/src/components/Messages/index.tsx +17 -17
  130. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  131. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  133. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  135. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  136. package/themes/original/src/components/NavBar/index.tsx +15 -9
  137. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  138. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  139. package/themes/original/src/components/Notifications/index.tsx +148 -0
  140. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  141. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  142. package/themes/original/src/components/OrderDetails/index.tsx +190 -35
  143. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  144. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  145. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  146. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  147. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  149. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  150. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
  152. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +42 -24
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  156. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  157. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +710 -653
  160. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  163. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  164. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  165. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  166. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  167. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  168. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  169. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  170. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  171. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  172. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  173. package/themes/original/src/components/ServiceForm/index.tsx +631 -0
  174. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  175. package/themes/original/src/components/SignupForm/index.tsx +350 -206
  176. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  177. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  178. package/themes/original/src/components/SingleProductCard/index.tsx +207 -107
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -10
  180. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  181. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  182. package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
  183. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  184. package/themes/original/src/components/UserDetails/index.tsx +31 -17
  185. package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
  186. package/themes/original/src/components/UserProfile/index.tsx +54 -29
  187. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  188. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  189. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  190. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  191. package/themes/original/src/components/Wallets/index.tsx +174 -162
  192. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  193. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  194. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  195. package/themes/original/src/components/shared/OButton.tsx +10 -3
  196. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  197. package/themes/original/src/components/shared/OInput.tsx +3 -2
  198. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  199. package/themes/original/src/types/index.tsx +122 -30
  200. package/themes/original/src/utils/index.tsx +77 -0
  201. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,20 +1,24 @@
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, View } from 'react-native';
15
+ import { InView } from 'react-native-intersection-observer'
11
16
  import { BusinessControllerParams } from '../../types';
12
17
  import { convertHoursToMinutes, shape } from '../../utils';
18
+
13
19
  import {
14
- Card,
15
20
  BusinessHero,
16
21
  BusinessContent,
17
- BusinessCategory,
18
22
  BusinessInfo,
19
23
  Metadata,
20
24
  BusinessState,
@@ -25,8 +29,9 @@ import {
25
29
  } from './styles';
26
30
  import { useTheme } from 'styled-components/native';
27
31
  import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
28
- import IconAntDesign from 'react-native-vector-icons/AntDesign'
29
32
  import FastImage from 'react-native-fast-image'
33
+ import { LottieAnimation } from '../LottieAnimation';
34
+ import { CardAnimation } from '../shared/CardAnimation';
30
35
 
31
36
  export const BusinessControllerUI = (props: BusinessControllerParams) => {
32
37
  const {
@@ -43,14 +48,25 @@ 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({
64
+ container: {
65
+ marginVertical: 20,
66
+ borderRadius: 7.6,
67
+ width: '100%',
68
+ position: 'relative'
69
+ },
54
70
  headerStyle: {
55
71
  borderTopLeftRadius: 7.6,
56
72
  borderTopRightRadius: 7.6,
@@ -100,7 +116,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
100
116
  flexDirection: 'row',
101
117
  alignItems: 'center',
102
118
  justifyContent: 'flex-start',
103
- },
119
+ }
104
120
  });
105
121
 
106
122
  const types = ['food', 'laundry', 'alcohol', 'groceries'];
@@ -119,130 +135,191 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
119
135
  const handleBusinessClick = (selectedBusiness: any) => {
120
136
  if (business?.open) handleClick && handleClick(selectedBusiness)
121
137
  else {
122
- navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
138
+ if (configState?.configs?.preorder_status_enabled?.value === '1') {
139
+ navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
140
+ return
141
+ }
142
+ showToast(ToastType.Info, t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment'));
123
143
  }
124
144
  }
125
145
 
126
- const handleChangeFavorite = () => {
127
- handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
128
- }
146
+ const handleChangeFavorite = () => {
147
+ if (auth) {
148
+ handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
149
+ } else {
150
+ navigation && navigation.navigate('Login');
151
+ }
152
+ }
153
+
154
+ const handleChangeInterSection = (inView: boolean) => {
155
+ setIsIntersectionObserver(inView)
156
+ }
129
157
 
130
158
  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}
159
+ <InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeInterSection(inView)}>
160
+ {isIntersectionObserver ? (
161
+ <CardAnimation
162
+ onClick={() => handleBusinessClick(business)}
163
+ style={[
164
+ style,
165
+ styles.container
166
+ ]}
137
167
  >
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}>
168
+ {business?.ribbon?.enabled && (
169
+ <RibbonBox
170
+ bgColor={business?.ribbon?.color}
171
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
172
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
173
+ >
167
174
  <OText
168
- color={theme.colors.textThird}
169
175
  size={10}
170
- style={styles.businessStateText}>
171
- {t('PREORDER', 'PREORDER')}
176
+ weight={'400'}
177
+ color={theme.colors.white}
178
+ numberOfLines={2}
179
+ ellipsizeMode='tail'
180
+ lineHeight={13}
181
+ >
182
+ {business?.ribbon?.text}
172
183
  </OText>
173
- </View>
184
+ </RibbonBox>
174
185
  )}
175
- </BusinessState>
176
- </BusinessHero>
177
- <BusinessContent>
178
- <BusinessInfo>
179
- <BusinessLogo style={styles.businessLogo}>
186
+ <BusinessHero>
180
187
  <FastImage
181
- style={{ width: 56, height: 56 }}
182
- source={{
183
- uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
188
+ style={{ height: 120 }}
189
+ source={(businessHeader || business?.header) ? {
190
+ uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
184
191
  priority: FastImage.priority.normal,
185
- }}
192
+ } : theme.images.dummies.businessHeader}
186
193
  resizeMode={FastImage.resizeMode.cover}
187
194
  />
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>
195
+ {(businessFeatured ?? business?.featured) && (
196
+ <View style={styles.featured}>
197
+ <FontAwesomeIcon name="crown" size={26} color="gold" />
198
+ </View>
197
199
  )}
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>
200
+ <BusinessState>
201
+ {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
202
+ <View style={styles.businessStateView}>
203
+ <OText
204
+ color={theme.colors.textThird}
205
+ size={10}
206
+ style={styles.businessStateText}>
207
+ {t('PREORDER', 'PREORDER')}
208
+ </OText>
209
+ </View>
210
+ )}
211
+ </BusinessState>
212
+ </BusinessHero>
213
+ <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>
244
+ </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 }}>
252
+ {business?.address}
253
+ </OText>
254
+ {/* <BusinessCategory>
219
255
  <OText>{getBusinessType()}</OText>
220
256
  </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>
257
+ <Metadata>
258
+ {!isBusinessOpen ? (
259
+ <View style={styles.closed}>
260
+ <OText size={10} color={theme.colors.red}>
261
+ {t('CLOSED', 'Closed')}
262
+ </OText>
263
+ </View>
264
+ ) : (
265
+ <View style={styles.bullet}>
266
+ {orderState?.options?.type === 1 && (
267
+ <OText size={10} color={theme.colors.textSecondary}>
268
+ {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
269
+ </OText>
270
+ )}
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>
277
+ </View>
234
278
  )}
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>
279
+ </Metadata>
280
+ </BusinessContent>
281
+ </CardAnimation>
282
+ ) : (
283
+ <Placeholder
284
+ Animation={Fade}
285
+ style={{ marginBottom: 20 }}>
286
+ <View style={{ width: '100%' }}>
287
+ <PlaceholderLine
288
+ height={200}
289
+ style={{ marginBottom: 20, borderRadius: 25 }}
290
+ />
291
+ <View style={{ paddingHorizontal: 10 }}>
292
+ <View
293
+ style={{
294
+ flexDirection: 'row',
295
+ justifyContent: 'space-between',
296
+ }}>
297
+ <PlaceholderLine
298
+ height={25}
299
+ width={40}
300
+ style={{ marginBottom: 10 }}
301
+ />
302
+ <PlaceholderLine
303
+ height={25}
304
+ width={20}
305
+ style={{ marginBottom: 10 }}
306
+ />
307
+ </View>
308
+ <PlaceholderLine
309
+ height={20}
310
+ width={30}
311
+ style={{ marginBottom: 10 }}
312
+ />
313
+ <PlaceholderLine
314
+ height={20}
315
+ width={80}
316
+ style={{ marginBottom: 10 }}
317
+ />
241
318
  </View>
242
- )}
243
- </Metadata>
244
- </BusinessContent>
245
- </Card>
319
+ </View>
320
+ </Placeholder>
321
+ )}
322
+ </InView>
246
323
  );
247
324
  };
248
325
 
@@ -1,12 +1,5 @@
1
1
  import styled, { css } from 'styled-components/native';
2
2
 
3
- export const Card = styled.TouchableOpacity`
4
- margin-vertical: 20px;
5
- border-radius: 7.6px;
6
- width: 100%;
7
- position: relative;
8
- `
9
-
10
3
  export const BusinessHero = styled.View`
11
4
  position: relative;
12
5
  border-top-right-radius: 7.6px;
@@ -41,10 +41,10 @@ export const BusinessItemAccordion = (props: any) => {
41
41
  useEffect(() => {
42
42
  const cartsArray = Object.values(orderState?.carts)
43
43
  const cartsLength = cartsArray.filter((cart: any) => cart.products.length > 0).length ?? 0
44
- if ((cartsLength === 1) && !isClosed) {
45
- setActiveState(true)
44
+ if (cartsLength === 1) {
45
+ setActiveState(!isClosed)
46
46
  }
47
- }, [orderState?.carts])
47
+ }, [orderState?.carts, isClosed])
48
48
 
49
49
  return (
50
50
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
@@ -149,7 +149,7 @@ export const BusinessItemAccordion = (props: any) => {
149
149
  <OButton
150
150
  onClick={handleClickCheckout}
151
151
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
- 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 }}
153
153
  text={t('CHECKOUT', 'Checkout')}
154
154
  bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
155
  borderColor={theme.colors.primary}
@@ -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
+ `