ordering-ui-react-native 0.16.55 → 0.16.56-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 (200) hide show
  1. package/package.json +6 -5
  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/BusinessInformation/index.tsx +33 -4
  6. package/src/components/BusinessInformation/styles.tsx +2 -2
  7. package/src/components/BusinessProductsList/index.tsx +10 -10
  8. package/src/components/BusinessesListing/index.tsx +1 -1
  9. package/src/components/Checkout/index.tsx +2 -1
  10. package/src/components/LanguageSelector/index.tsx +21 -16
  11. package/src/components/Messages/index.tsx +2 -2
  12. package/src/components/NotificationSetting/index.tsx +85 -0
  13. package/src/components/OrdersOption/index.tsx +54 -56
  14. package/src/components/PaymentOptions/index.tsx +298 -345
  15. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  16. package/src/components/SingleProductReview/index.tsx +7 -4
  17. package/src/components/StripeElementsForm/index.tsx +25 -16
  18. package/src/components/VerifyPhone/styles.tsx +1 -2
  19. package/src/components/shared/OBottomPopup.tsx +6 -2
  20. package/src/components/shared/OToast.tsx +4 -4
  21. package/src/index.tsx +2 -0
  22. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  23. package/src/utils/index.tsx +2 -1
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  26. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  27. package/themes/business/src/components/Chat/index.tsx +40 -32
  28. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  29. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  30. package/themes/business/src/components/MapView/index.tsx +12 -1
  31. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  32. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +40 -30
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  35. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  36. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  37. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  38. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  41. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  45. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  46. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  48. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  50. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  51. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  52. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  53. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  54. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  55. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  56. package/themes/business/src/components/shared/OLink.tsx +24 -12
  57. package/themes/business/src/components/shared/OText.tsx +3 -2
  58. package/themes/business/src/types/index.tsx +25 -11
  59. package/themes/business/src/utils/index.tsx +10 -0
  60. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  62. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  63. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  64. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  65. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  66. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  67. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  68. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  69. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  70. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  71. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  72. package/themes/kiosk/src/types/index.d.ts +2 -0
  73. package/themes/original/index.tsx +8 -0
  74. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  75. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  76. package/themes/original/src/components/AddressList/index.tsx +1 -1
  77. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  78. package/themes/original/src/components/BusinessBasicInformation/index.tsx +53 -37
  79. package/themes/original/src/components/BusinessController/index.tsx +112 -48
  80. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  81. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  82. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  83. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  84. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  85. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  86. package/themes/original/src/components/BusinessListingSearch/index.tsx +80 -138
  87. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  88. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  89. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  90. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -61
  91. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  92. package/themes/original/src/components/BusinessProductsListing/index.tsx +177 -81
  93. package/themes/original/src/components/BusinessProductsListing/styles.tsx +14 -12
  94. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  95. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +112 -107
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  98. package/themes/original/src/components/BusinessesListing/index.tsx +17 -10
  99. package/themes/original/src/components/Cart/index.tsx +82 -15
  100. package/themes/original/src/components/Cart/styles.tsx +4 -0
  101. package/themes/original/src/components/CartContent/index.tsx +27 -17
  102. package/themes/original/src/components/CartContent/styles.tsx +1 -1
  103. package/themes/original/src/components/Checkout/index.tsx +115 -118
  104. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  105. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  106. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  107. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  108. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  109. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  110. package/themes/original/src/components/FloatingButton/index.tsx +0 -1
  111. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  112. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  113. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  114. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  115. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  116. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  117. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  118. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  119. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  120. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  121. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  122. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  123. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  124. package/themes/original/src/components/Messages/index.tsx +35 -20
  125. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  126. package/themes/original/src/components/MultiCart/index.tsx +63 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  128. package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
  129. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  130. package/themes/original/src/components/MyOrders/index.tsx +89 -25
  131. package/themes/original/src/components/NavBar/index.tsx +11 -5
  132. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  133. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  134. package/themes/original/src/components/Notifications/index.tsx +148 -0
  135. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  136. package/themes/original/src/components/OrderDetails/index.tsx +132 -18
  137. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  138. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  139. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  140. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  141. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  142. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  143. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  144. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  147. package/themes/original/src/components/OrdersOption/index.tsx +95 -55
  148. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  149. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  150. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  151. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  152. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  153. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  154. package/themes/original/src/components/ProductForm/index.tsx +367 -384
  155. package/themes/original/src/components/ProductForm/styles.tsx +7 -12
  156. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  157. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  158. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  159. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  160. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  161. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  162. package/themes/original/src/components/Promotions/index.tsx +232 -219
  163. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  164. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  165. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  166. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  167. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  168. package/themes/original/src/components/ReviewTrigger/index.tsx +28 -10
  169. package/themes/original/src/components/ReviewTrigger/styles.tsx +10 -3
  170. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  171. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  172. package/themes/original/src/components/ServiceForm/index.tsx +330 -266
  173. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  174. package/themes/original/src/components/SingleOrderCard/index.tsx +219 -129
  175. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  176. package/themes/original/src/components/SingleProductCard/index.tsx +116 -72
  177. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  178. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  179. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  180. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  181. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  182. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  183. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  184. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  185. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  186. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  187. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  188. package/themes/original/src/components/Wallets/index.tsx +176 -164
  189. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  190. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  191. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  192. package/themes/original/src/components/shared/OBottomPopup.tsx +32 -21
  193. package/themes/original/src/components/shared/OButton.tsx +8 -3
  194. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  195. package/themes/original/src/components/shared/OInput.tsx +10 -1
  196. package/themes/original/src/layouts/Container.tsx +13 -9
  197. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  198. package/themes/original/src/types/index.tsx +63 -8
  199. package/themes/original/src/utils/index.tsx +103 -58
  200. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -7,30 +7,32 @@ import {
7
7
  useLanguage,
8
8
  useConfig,
9
9
  useToast,
10
+ useSession,
10
11
  ToastType
11
12
  } from 'ordering-components/native';
12
13
  import { OIcon, OText } from '../shared';
13
- import { StyleSheet, TouchableOpacity, View } from 'react-native';
14
+ import { Dimensions, StyleSheet, Vibration, View } from 'react-native';
14
15
  import { InView } from 'react-native-intersection-observer'
15
16
  import { BusinessControllerParams } from '../../types';
16
17
  import { convertHoursToMinutes, shape } from '../../utils';
18
+
17
19
  import {
18
- Card,
19
20
  BusinessHero,
20
21
  BusinessContent,
21
- BusinessCategory,
22
22
  BusinessInfo,
23
23
  Metadata,
24
24
  BusinessState,
25
25
  BusinessLogo,
26
26
  Reviews,
27
27
  RibbonBox,
28
- ReviewAndFavorite
28
+ ReviewAndFavorite,
29
+ OfferBox
29
30
  } from './styles';
30
31
  import { useTheme } from 'styled-components/native';
31
32
  import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
32
- import IconAntDesign from 'react-native-vector-icons/AntDesign'
33
33
  import FastImage from 'react-native-fast-image'
34
+ import { LottieAnimation } from '../LottieAnimation';
35
+ import { CardAnimation } from '../shared/CardAnimation';
34
36
 
35
37
  export const BusinessControllerUI = (props: BusinessControllerParams) => {
36
38
  const {
@@ -39,6 +41,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
39
41
  navigation,
40
42
  isBusinessOpen,
41
43
  style,
44
+ isCustomLayout,
42
45
  businessHeader,
43
46
  businessFeatured,
44
47
  businessLogo,
@@ -48,16 +51,31 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
48
51
  businessPickupTime,
49
52
  businessDistance,
50
53
  handleFavoriteBusiness,
51
- enableIntersection
54
+ enableIntersection,
55
+ getBusinessOffer
52
56
  } = props;
57
+
53
58
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
54
59
  const [, { showToast }] = useToast()
55
60
  const [orderState] = useOrder();
61
+ const [{ auth }] = useSession()
56
62
  const [configState] = useConfig();
57
63
  const [, t] = useLanguage();
58
64
  const theme = useTheme()
65
+ const windowHeight = Dimensions.get('window').height
59
66
  const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
67
+
68
+ const textSize = isCustomLayout ? 12 : 10
69
+ const cardHeight = windowHeight * 0.3
70
+
60
71
  const styles = StyleSheet.create({
72
+ container: {
73
+ marginVertical: 20,
74
+ borderRadius: 7.6,
75
+ width: '100%',
76
+ position: 'relative',
77
+ height: cardHeight
78
+ },
61
79
  headerStyle: {
62
80
  borderTopLeftRadius: 7.6,
63
81
  borderTopRightRadius: 7.6,
@@ -107,7 +125,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
107
125
  flexDirection: 'row',
108
126
  alignItems: 'center',
109
127
  justifyContent: 'flex-start',
110
- },
128
+ }
111
129
  });
112
130
 
113
131
  const types = ['food', 'laundry', 'alcohol', 'groceries'];
@@ -124,6 +142,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
124
142
  };
125
143
 
126
144
  const handleBusinessClick = (selectedBusiness: any) => {
145
+ Vibration.vibrate()
127
146
  if (business?.open) handleClick && handleClick(selectedBusiness)
128
147
  else {
129
148
  if (configState?.configs?.preorder_status_enabled?.value === '1') {
@@ -135,13 +154,24 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
135
154
  }
136
155
 
137
156
  const handleChangeFavorite = () => {
138
- handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
157
+ if (auth) {
158
+ handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
159
+ } else {
160
+ navigation && navigation.navigate('Login');
161
+ }
162
+ }
163
+
164
+ const handleChangeInterSection = (inView: boolean) => {
165
+ setIsIntersectionObserver(inView)
139
166
  }
140
167
 
141
168
  return (
142
- <InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(inView)}>
169
+ <InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeInterSection(inView)}>
143
170
  {isIntersectionObserver ? (
144
- <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
171
+ <CardAnimation
172
+ style={[style, styles.container]}
173
+ onClick={() => handleBusinessClick(business)}
174
+ >
145
175
  {business?.ribbon?.enabled && (
146
176
  <RibbonBox
147
177
  bgColor={business?.ribbon?.color}
@@ -162,11 +192,11 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
162
192
  )}
163
193
  <BusinessHero>
164
194
  <FastImage
165
- style={{ height: 120 }}
166
- source={{
195
+ style={{ height: isCustomLayout ? cardHeight * 0.66 : 120 }}
196
+ source={(businessHeader || business?.header) ? {
167
197
  uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
168
198
  priority: FastImage.priority.normal,
169
- }}
199
+ } : theme.images.dummies.businessHeader}
170
200
  resizeMode={FastImage.resizeMode.cover}
171
201
  />
172
202
  {(businessFeatured ?? business?.featured) && (
@@ -174,6 +204,18 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
174
204
  <FontAwesomeIcon name="crown" size={26} color="gold" />
175
205
  </View>
176
206
  )}
207
+ {(!isCustomLayout) && (
208
+ getBusinessOffer((business?.offers)) &&
209
+ <OfferBox>
210
+ <OText
211
+ size={10}
212
+ weight={'400'}
213
+ numberOfLines={2}
214
+ ellipsizeMode='tail'
215
+ lineHeight={13}
216
+ >{getBusinessOffer((business?.offers)) || parsePrice(0)}</OText>
217
+ </OfferBox>
218
+ )}
177
219
  <BusinessState>
178
220
  {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
179
221
  <View style={styles.businessStateView}>
@@ -188,49 +230,71 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
188
230
  </BusinessState>
189
231
  </BusinessHero>
190
232
  <BusinessContent>
191
- <BusinessInfo>
233
+ <BusinessInfo style={isCustomLayout && { position: 'absolute', bottom: 85, left: 15 }}>
192
234
  <BusinessLogo style={styles.businessLogo}>
193
235
  <FastImage
194
236
  style={{ width: 56, height: 56 }}
195
- source={{
237
+ source={(businessLogo || business?.logo) ? {
196
238
  uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
197
239
  priority: FastImage.priority.normal,
198
- }}
240
+ } : theme.images.dummies.businessLogo}
199
241
  resizeMode={FastImage.resizeMode.cover}
200
242
  />
201
243
  </BusinessLogo>
202
- <ReviewAndFavorite>
203
- {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
204
- <Reviews>
205
- <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
206
- <OText size={10} style={{ lineHeight: 15 }}>
207
- {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
208
- </OText>
209
- </Reviews>
210
- )}
211
- <TouchableOpacity
212
- onPress={handleChangeFavorite}
213
- >
214
- <IconAntDesign
215
- name={business?.favorite ? 'heart' : 'hearto'}
216
- color={theme.colors.danger5}
217
- size={18}
244
+ {!isCustomLayout && (
245
+ <ReviewAndFavorite>
246
+ {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
247
+ <Reviews>
248
+ <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
249
+ <OText size={10} style={{ lineHeight: 15 }}>
250
+ {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
251
+ </OText>
252
+ </Reviews>
253
+ )}
254
+ <LottieAnimation
255
+ type='favorite'
256
+ onClick={handleChangeFavorite}
257
+ initialValue={business?.favorite ? 0.75 : 0}
258
+ toValue={business?.favorite ? 0 : 0.75}
259
+ disableAnimation={!auth}
260
+ iconProps={{ color: theme.colors.danger5, size: 18 }}
261
+ isActive={business?.favorite}
218
262
  />
219
- </TouchableOpacity>
220
- </ReviewAndFavorite>
263
+ </ReviewAndFavorite>
264
+ )}
221
265
  </BusinessInfo>
222
- <OText
223
- size={12}
224
- style={{ lineHeight: 18, marginBottom: 6 }}
225
- weight={'500'}>
226
- {business?.name}
227
- </OText>
228
- <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
266
+ <View style={isCustomLayout && { width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5 }}>
267
+ <OText
268
+ size={textSize + 2}
269
+ style={{ lineHeight: 18, marginBottom: 6 }}
270
+ weight={'500'}>
271
+ {business?.name}
272
+ </OText>
273
+ {isCustomLayout && (
274
+ <ReviewAndFavorite>
275
+ {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
276
+ <Reviews>
277
+ <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
278
+ <OText size={10} style={{ lineHeight: 15 }}>
279
+ {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
280
+ </OText>
281
+ </Reviews>
282
+ )}
283
+ <LottieAnimation
284
+ type='favorite'
285
+ onClick={handleChangeFavorite}
286
+ initialValue={business?.favorite ? 0.75 : 0}
287
+ toValue={business?.favorite ? 0 : 0.75}
288
+ disableAnimation={!auth}
289
+ iconProps={{ color: theme.colors.danger5, size: 18 }}
290
+ isActive={business?.favorite}
291
+ />
292
+ </ReviewAndFavorite>
293
+ )}
294
+ </View>
295
+ <OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={isCustomLayout ? 1 : 2}>
229
296
  {business?.address}
230
297
  </OText>
231
- {/* <BusinessCategory>
232
- <OText>{getBusinessType()}</OText>
233
- </BusinessCategory> */}
234
298
  <Metadata>
235
299
  {!isBusinessOpen ? (
236
300
  <View style={styles.closed}>
@@ -241,21 +305,21 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
241
305
  ) : (
242
306
  <View style={styles.bullet}>
243
307
  {orderState?.options?.type === 1 && (
244
- <OText size={10} color={theme.colors.textSecondary}>
308
+ <OText size={textSize} color={theme.colors.textSecondary}>
245
309
  {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
246
310
  </OText>
247
311
  )}
248
- <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
312
+ <OText size={textSize} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
249
313
  orderState?.options?.type === 1
250
314
  ? (businessDeliveryTime ?? business?.delivery_time)
251
315
  : (businessPickupTime ?? business?.pickup_time),
252
316
  )} \u2022 `}</OText>
253
- <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
317
+ <OText size={textSize} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
254
318
  </View>
255
319
  )}
256
320
  </Metadata>
257
321
  </BusinessContent>
258
- </Card>
322
+ </CardAnimation>
259
323
  ) : (
260
324
  <Placeholder
261
325
  Animation={Fade}
@@ -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;
@@ -16,7 +9,7 @@ export const BusinessHero = styled.View`
16
9
 
17
10
  export const BusinessContent = styled.View`
18
11
  padding-horizontal: 18px;
19
- padding-bottom: 18px;
12
+ padding-bottom: 10px;
20
13
  border-bottom-left-radius: 7.6px;
21
14
  border-bottom-right-radius: 7.6px;
22
15
  border-width: 1px;
@@ -46,7 +39,7 @@ export const BusinessState = styled.View`
46
39
  `
47
40
 
48
41
  export const BusinessLogo = styled.View`
49
-
42
+
50
43
  `
51
44
 
52
45
  export const ReviewAndFavorite = styled.View`
@@ -80,3 +73,15 @@ export const RibbonBox = styled.View`
80
73
  border-radius: 50px;
81
74
  `}
82
75
  `
76
+
77
+ export const OfferBox = styled.View`
78
+ position: absolute;
79
+ z-index: 1;
80
+ top: 20px;
81
+ right: 10px;
82
+ border-radius: 50px;
83
+ color: ${(props: any) => props.theme.colors.textThird};
84
+ background: ${(props: any) => props.theme.colors.inputBorderColor};
85
+ padding: 3px 8px;
86
+ max-width: 180px;
87
+ `
@@ -16,26 +16,19 @@ import {
16
16
  DivideView,
17
17
  MediaWrapper,
18
18
  } from './styles';
19
- import { Platform, StyleSheet, View } from 'react-native';
19
+ import { StyleSheet, View } from 'react-native';
20
20
  import { BusinessInformationParams } from '../../types';
21
21
  import { GoogleMap } from '../GoogleMap';
22
22
  import { WebView } from 'react-native-webview';
23
23
  import { formatUrlVideo } from '../../utils'
24
+ import { ScheduleAccordion } from '../ScheduleAccordion';
24
25
  const BusinessInformationUI = (props: BusinessInformationParams) => {
25
26
  const { businessState, businessSchedule, businessLocation } = props;
26
27
 
27
28
  const theme = useTheme();
28
29
  const [, t] = useLanguage();
29
30
  const [{ optimizeImage }] = useUtils();
30
- const daysOfWeek = [
31
- t('SUNDAY_ABBREVIATION', 'Sun'),
32
- t('MONDAY_ABBREVIATION', 'Mon'),
33
- t('TUESDAY_ABBREVIATION', 'Tues'),
34
- t('WEDNESDAY_ABBREVIATION', 'Wed'),
35
- t('THURSDAY_ABBREVIATION', 'Thur'),
36
- t('FRIDAY_ABBREVIATION', 'Fri'),
37
- t('SATURDAY_ABBREVIATION', 'Sat'),
38
- ];
31
+
39
32
  const scheduleFormatted = ({
40
33
  hour,
41
34
  minute,
@@ -112,25 +105,11 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
112
105
  <WrapScheduleBlock>
113
106
  {businessSchedule.map((schedule: any, i: number) => (
114
107
  <ScheduleBlock key={i}>
115
- <OText
116
- lineHeight={21}
117
- mBottom={16}
118
- size={14}
119
- weight={Platform.OS === 'android' ? 'bold' : '600'}
120
- style={{ flexBasis: '20%' }}>
121
- {daysOfWeek[i].toUpperCase()}
122
- </OText>
123
- {schedule.enabled ? (
124
- <OText mBottom={16}>
125
- {scheduleFormatted(schedule.lapses[0].open) +
126
- ' - ' +
127
- scheduleFormatted(schedule.lapses[0].close)}
128
- </OText>
129
- ) : (
130
- <OText color={theme.colors.red} mBottom={16}>
131
- {t('CLOSED', 'Closed')}
132
- </OText>
133
- )}
108
+ <ScheduleAccordion
109
+ weekIndex={i}
110
+ scheduleFormatted={scheduleFormatted}
111
+ schedule={schedule}
112
+ />
134
113
  </ScheduleBlock>
135
114
  ))}
136
115
  </WrapScheduleBlock>
@@ -152,10 +131,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
152
131
  style={{ width: 210, height: 127, borderRadius: 7.6 }}
153
132
  javaScriptEnabled={true}
154
133
  domStorageEnabled={true}
155
- source={{
134
+ source={{
156
135
  html: `
157
136
  <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
158
- `,
137
+ `,
159
138
  }}
160
139
  mediaPlaybackRequiresUserAction={true}
161
140
  />
@@ -41,10 +41,16 @@ 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
+
49
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
50
+ if (item?.type === 1)
51
+ return acc = acc + item?.summary?.tax
52
+ return acc = acc
53
+ }, cart?.subtotal)
48
54
 
49
55
  return (
50
56
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
@@ -102,7 +108,7 @@ export const BusinessItemAccordion = (props: any) => {
102
108
  <OText
103
109
  size={12}
104
110
  lineHeight={18}
105
- color={theme.colors.textSecondary}
111
+ color={theme.colors.primary}
106
112
  style={{ textDecorationLine: 'underline' }}
107
113
  >
108
114
  {t('CHANGE_STORE', 'Change store')}
@@ -149,9 +155,9 @@ export const BusinessItemAccordion = (props: any) => {
149
155
  <OButton
150
156
  onClick={handleClickCheckout}
151
157
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
- style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
158
+ style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
159
  text={t('CHECKOUT', 'Checkout')}
154
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
160
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
161
  borderColor={theme.colors.primary}
156
162
  isDisabled={checkoutButtonDisabled}
157
163
  />
@@ -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
+ `