ordering-ui-react-native 0.16.19 → 0.16.20-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.
- package/package.json +7 -4
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessController/index.tsx +10 -8
- package/src/components/BusinessInformation/index.tsx +33 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- package/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +2 -1
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/LoginForm/index.tsx +118 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrderDetails/index.tsx +2 -20
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +335 -365
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -1
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SignupForm/index.tsx +143 -61
- package/src/components/SingleProductReview/index.tsx +8 -5
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/index.tsx +2 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/theme.json +0 -1
- package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/types/index.tsx +13 -9
- package/src/utils/index.tsx +0 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +42 -34
- package/themes/business/src/components/DriverMap/index.tsx +7 -5
- package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
- package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
- package/themes/business/src/components/LoginForm/index.tsx +111 -74
- package/themes/business/src/components/MapView/index.tsx +12 -1
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
- package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
- package/themes/business/src/components/OrdersOption/index.tsx +65 -21
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
- package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
- package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
- package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
- package/themes/business/src/components/shared/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OModal.tsx +40 -37
- package/themes/business/src/types/index.tsx +15 -9
- package/themes/business/src/utils/index.tsx +10 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
- package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +12 -0
- package/themes/original/src/components/AddressForm/index.tsx +136 -133
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +173 -108
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +287 -175
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -8
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -10
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +105 -519
- package/themes/original/src/components/Cart/index.tsx +42 -10
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/CartContent/index.tsx +22 -16
- package/themes/original/src/components/Checkout/index.tsx +106 -66
- package/themes/original/src/components/Checkout/styles.tsx +0 -1
- package/themes/original/src/components/DriverTips/index.tsx +4 -4
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -0
- package/themes/original/src/components/Favorite/styles.tsx +1 -0
- package/themes/original/src/components/FavoriteList/index.tsx +142 -93
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GoogleMap/index.tsx +20 -12
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
- package/themes/original/src/components/HelpGuide/index.tsx +8 -3
- package/themes/original/src/components/HelpOrder/index.tsx +8 -3
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
- package/themes/original/src/components/LoginForm/index.tsx +82 -44
- package/themes/original/src/components/Messages/index.tsx +17 -17
- package/themes/original/src/components/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
- package/themes/original/src/components/MyOrders/index.tsx +68 -6
- package/themes/original/src/components/NavBar/index.tsx +15 -9
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +148 -0
- package/themes/original/src/components/Notifications/styles.tsx +17 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +200 -42
- package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderProgress/index.tsx +8 -2
- package/themes/original/src/components/OrderSummary/index.tsx +1 -34
- package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
- package/themes/original/src/components/OrdersOption/index.tsx +71 -55
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
- package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +712 -655
- package/themes/original/src/components/ProductForm/styles.tsx +9 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +170 -128
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
- package/themes/original/src/components/SearchBar/index.tsx +5 -3
- package/themes/original/src/components/ServiceForm/index.tsx +631 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/SignupForm/index.tsx +350 -206
- package/themes/original/src/components/SingleOrderCard/index.tsx +214 -179
- package/themes/original/src/components/SingleProductCard/index.tsx +194 -108
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
- package/themes/original/src/components/UserDetails/index.tsx +31 -17
- package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
- package/themes/original/src/components/UserProfile/index.tsx +57 -29
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +174 -162
- package/themes/original/src/components/Wallets/styles.tsx +10 -8
- package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
- package/themes/original/src/components/shared/OButton.tsx +10 -3
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +124 -30
- package/themes/original/src/utils/index.tsx +77 -0
- 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
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
148
|
+
const handleChangeInterSection = (inView: boolean) => {
|
|
149
|
+
setIsIntersectionObserver(inView)
|
|
150
|
+
}
|
|
129
151
|
|
|
130
152
|
return (
|
|
131
|
-
<
|
|
132
|
-
{
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
171
|
-
{
|
|
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
|
-
</
|
|
172
|
+
</RibbonBox>
|
|
174
173
|
)}
|
|
175
|
-
|
|
176
|
-
</BusinessHero>
|
|
177
|
-
<BusinessContent>
|
|
178
|
-
<BusinessInfo>
|
|
179
|
-
<BusinessLogo style={styles.businessLogo}>
|
|
174
|
+
<BusinessHero>
|
|
180
175
|
<FastImage
|
|
181
|
-
style={{
|
|
176
|
+
style={{ height: 120 }}
|
|
182
177
|
source={{
|
|
183
|
-
uri: optimizeImage(
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
<
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
</
|
|
244
|
-
|
|
245
|
-
</
|
|
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,
|
|
@@ -28,21 +28,23 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
28
28
|
const [orderState] = useOrder();
|
|
29
29
|
const [, t] = useLanguage();
|
|
30
30
|
const [{ parsePrice }] = useUtils();
|
|
31
|
+
const [{ configs }] = useConfig()
|
|
31
32
|
const theme = useTheme();
|
|
32
33
|
|
|
33
34
|
const isCartPending = cart?.status === 2
|
|
34
35
|
const isClosed = !cart?.valid_schedule
|
|
35
36
|
const isProducts = cart?.products?.length
|
|
37
|
+
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
36
38
|
|
|
37
39
|
const [isActive, setActiveState] = useState(!!singleBusiness)
|
|
38
40
|
|
|
39
41
|
useEffect(() => {
|
|
40
42
|
const cartsArray = Object.values(orderState?.carts)
|
|
41
43
|
const cartsLength = cartsArray.filter((cart: any) => cart.products.length > 0).length ?? 0
|
|
42
|
-
if (
|
|
43
|
-
setActiveState(
|
|
44
|
+
if (cartsLength === 1) {
|
|
45
|
+
setActiveState(!isClosed)
|
|
44
46
|
}
|
|
45
|
-
}, [orderState?.carts])
|
|
47
|
+
}, [orderState?.carts, isClosed])
|
|
46
48
|
|
|
47
49
|
return (
|
|
48
50
|
<BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
|
|
@@ -91,7 +93,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
91
93
|
</OAlert>
|
|
92
94
|
</>
|
|
93
95
|
)}
|
|
94
|
-
{props.handleChangeStore && (
|
|
96
|
+
{isBusinessChangeEnabled && props.handleChangeStore && (
|
|
95
97
|
<>
|
|
96
98
|
<OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
97
99
|
<TouchableOpacity
|
|
@@ -147,7 +149,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
147
149
|
<OButton
|
|
148
150
|
onClick={handleClickCheckout}
|
|
149
151
|
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
150
|
-
style={{ width:
|
|
152
|
+
style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
151
153
|
text={t('CHECKOUT', 'Checkout')}
|
|
152
154
|
bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
153
155
|
borderColor={theme.colors.primary}
|
package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx
ADDED
|
@@ -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
|
+
`
|