ordering-ui-react-native 0.21.53 → 0.21.54-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 +8 -8
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +72 -27
- package/themes/business/src/components/BusinessProductList/index.tsx +57 -25
- package/themes/business/src/components/DriverMap/index.tsx +36 -23
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +30 -15
- package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
- package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +42 -23
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +36 -22
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +240 -76
- package/themes/business/src/components/OrdersOption/index.tsx +245 -112
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +29 -19
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +4 -3
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +22 -5
- package/themes/business/src/utils/index.tsx +5 -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/Checkout/index.tsx +6 -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/original/index.tsx +6 -2
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
- package/themes/original/src/components/BusinessController/index.tsx +18 -10
- package/themes/original/src/components/BusinessController/styles.tsx +8 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -7
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +316 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +94 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +48 -359
- package/themes/original/src/components/BusinessPreorder/index.tsx +20 -16
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +29 -14
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +26 -9
- package/themes/original/src/components/CartContent/index.tsx +60 -45
- package/themes/original/src/components/Checkout/index.tsx +106 -64
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DatePicker/index.tsx +18 -2
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +9 -11
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
- package/themes/original/src/components/Home/index.tsx +2 -10
- package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -19
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +124 -63
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
- package/themes/original/src/components/MyOrders/index.tsx +21 -26
- package/themes/original/src/components/NavBar/index.tsx +4 -2
- package/themes/original/src/components/NetworkError/index.tsx +2 -8
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/Notifications/index.tsx +2 -4
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
- package/themes/original/src/components/OrderDetails/index.tsx +5 -7
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +2 -4
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +47 -6
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +16 -19
- package/themes/original/src/components/ProductForm/index.tsx +123 -112
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +65 -67
- package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +12 -36
- package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserFormDetails/index.tsx +88 -91
- package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/Wallets/index.tsx +7 -4
- package/themes/original/src/components/Wallets/styles.tsx +1 -1
- package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +8 -7
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/layouts/Container.tsx +4 -2
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -21,7 +21,7 @@ export const AppleLogin = (props: any) => {
|
|
|
21
21
|
const [{ configs }] = useConfig();
|
|
22
22
|
const [credentialStateForUser, updateCredentialStateForUser] = useState<any>(-1);
|
|
23
23
|
|
|
24
|
-
let user
|
|
24
|
+
let user: any = null
|
|
25
25
|
|
|
26
26
|
const buttonText = auth
|
|
27
27
|
? t('CONTINUE_WITH_APPLE', 'Logout with Apple')
|
|
@@ -53,7 +53,7 @@ export const AppleLogin = (props: any) => {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const fetchAndUpdateCredentialState = async (updateCredentialStateForUser
|
|
56
|
+
const fetchAndUpdateCredentialState = async (updateCredentialStateForUser: any) => {
|
|
57
57
|
if (user === null) {
|
|
58
58
|
updateCredentialStateForUser('N/A');
|
|
59
59
|
} else {
|
|
@@ -66,7 +66,7 @@ export const AppleLogin = (props: any) => {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const onIOSButtonPress = async (updateCredentialStateForUser
|
|
69
|
+
const onIOSButtonPress = async (updateCredentialStateForUser: any) => {
|
|
70
70
|
try {
|
|
71
71
|
const appleAuthRequestResponse = await appleAuth.performRequest({
|
|
72
72
|
requestedOperation: appleAuth.Operation.LOGIN,
|
|
@@ -79,7 +79,7 @@ export const AppleLogin = (props: any) => {
|
|
|
79
79
|
identityToken,
|
|
80
80
|
authorizationCode
|
|
81
81
|
} = appleAuthRequestResponse;
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
user = newUser;
|
|
84
84
|
|
|
85
85
|
fetchAndUpdateCredentialState(updateCredentialStateForUser).catch(error =>
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
SocialListWrapper
|
|
27
27
|
} from './styles';
|
|
28
28
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
29
|
-
const types = ['food', 'laundry', 'alcohol', 'groceries'];
|
|
30
29
|
|
|
31
30
|
let BusinessInformation: null | React.ElementType = null
|
|
32
31
|
let BusinessReviews: null | React.ElementType = null
|
|
@@ -36,6 +35,7 @@ export const BusinessBasicInformation = (
|
|
|
36
35
|
) => {
|
|
37
36
|
const { navigation, businessState, isBusinessInfoShow, logo, header, isPreOrder } = props;
|
|
38
37
|
const { business, loading } = businessState;
|
|
38
|
+
const types = business?.types && business?.types?.filter(({ enabled }) => (enabled)).map(({ name }) => (name))
|
|
39
39
|
|
|
40
40
|
const theme = useTheme();
|
|
41
41
|
const [orderState] = useOrder();
|
|
@@ -146,14 +146,11 @@ export const BusinessBasicInformation = (
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
const getBusinessType = () => {
|
|
149
|
-
if (
|
|
149
|
+
if (!types) return t('GENERAL', 'General');
|
|
150
150
|
const _types: any = [];
|
|
151
151
|
types.forEach(
|
|
152
|
-
(type) =>
|
|
153
|
-
|
|
154
|
-
_types.push(
|
|
155
|
-
t(`BUSINESS_TYPE_${type?.replace(/\s/g, '_')?.toUpperCase()}`, type),
|
|
156
|
-
),
|
|
152
|
+
(type: any) =>
|
|
153
|
+
_types.push(type)
|
|
157
154
|
);
|
|
158
155
|
return _types.join(', ');
|
|
159
156
|
};
|
|
@@ -247,7 +244,7 @@ export const BusinessBasicInformation = (
|
|
|
247
244
|
<View style={styles.tiktokIcon}>
|
|
248
245
|
<OIcon
|
|
249
246
|
src={theme.images.general.tiktok}
|
|
250
|
-
style={{ width: 10, height: 12 }}
|
|
247
|
+
style={{ width: 10, height: 12, bottom: 1 }}
|
|
251
248
|
cover
|
|
252
249
|
/>
|
|
253
250
|
</View>
|
|
@@ -455,7 +452,7 @@ export const BusinessBasicInformation = (
|
|
|
455
452
|
</BusinessInfoItem>
|
|
456
453
|
</View>
|
|
457
454
|
<WrapReviews>
|
|
458
|
-
{!isBusinessInfoShow && (
|
|
455
|
+
{!isBusinessInfoShow && !loading && (
|
|
459
456
|
<>
|
|
460
457
|
{isPreOrder && (!business?.professionals || business?.professionals?.length === 0) && (
|
|
461
458
|
<>
|
|
@@ -35,7 +35,12 @@ import FastImage from 'react-native-fast-image'
|
|
|
35
35
|
import { LottieAnimation } from '../LottieAnimation';
|
|
36
36
|
import { CardAnimation } from '../shared/CardAnimation';
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
function BusinessControllerPropsAreEqual(prevProps: any, nextProps: any) {
|
|
39
|
+
return JSON.stringify(prevProps.business) === JSON.stringify(nextProps.business) &&
|
|
40
|
+
prevProps.isBusinessOpen === nextProps.isBusinessOpen
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const BusinessControllerUI = React.memo((props: BusinessControllerParams) => {
|
|
39
44
|
const {
|
|
40
45
|
business,
|
|
41
46
|
handleClick,
|
|
@@ -76,7 +81,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
76
81
|
const hideBusinessFavoriteBadge = theme?.business_listing_view?.components?.business?.components?.featured_badge?.hidden
|
|
77
82
|
|
|
78
83
|
const textSize = 12
|
|
79
|
-
const cardHeight = windowHeight * 0.
|
|
84
|
+
const cardHeight = windowHeight * 0.34
|
|
80
85
|
|
|
81
86
|
const styles = StyleSheet.create({
|
|
82
87
|
container: {
|
|
@@ -184,7 +189,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
184
189
|
}
|
|
185
190
|
|
|
186
191
|
return (
|
|
187
|
-
<
|
|
192
|
+
<View style={{ minHeight: 200 }}>
|
|
188
193
|
{isIntersectionObserver ? (
|
|
189
194
|
<CardAnimation
|
|
190
195
|
style={[style, styles.container]}
|
|
@@ -227,7 +232,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
227
232
|
</View>
|
|
228
233
|
)}
|
|
229
234
|
{!hideBusinessOffer && (
|
|
230
|
-
getBusinessOffer((business?.offers)) &&
|
|
235
|
+
!!getBusinessOffer((business?.offers)) &&
|
|
231
236
|
<OfferBox
|
|
232
237
|
isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}
|
|
233
238
|
isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}
|
|
@@ -239,7 +244,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
239
244
|
numberOfLines={2}
|
|
240
245
|
ellipsizeMode='tail'
|
|
241
246
|
lineHeight={13}
|
|
242
|
-
>{getBusinessOffer((business?.offers))
|
|
247
|
+
>{t('DISCOUNT', 'Discount')}{' '}{getBusinessOffer((business?.offers))}</OText>
|
|
243
248
|
</OfferBox>
|
|
244
249
|
)}
|
|
245
250
|
<BusinessState isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}>
|
|
@@ -256,7 +261,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
256
261
|
</BusinessState>
|
|
257
262
|
</BusinessHero>
|
|
258
263
|
<BusinessContent>
|
|
259
|
-
<BusinessInfo style={{ position: 'absolute',
|
|
264
|
+
<BusinessInfo style={{ position: 'absolute', top: -26, left: 15 }}>
|
|
260
265
|
{!hideBusinessLogo && (
|
|
261
266
|
<BusinessLogo style={styles.businessLogo}>
|
|
262
267
|
<FastImage
|
|
@@ -274,7 +279,10 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
274
279
|
<OText
|
|
275
280
|
size={textSize + 2}
|
|
276
281
|
style={{ lineHeight: 18, marginBottom: 6, width: '90%' }}
|
|
277
|
-
weight={'500'}
|
|
282
|
+
weight={'500'}
|
|
283
|
+
numberOfLines={1}
|
|
284
|
+
ellipsizeMode='tail'
|
|
285
|
+
>
|
|
278
286
|
{business?.name}
|
|
279
287
|
</OText>
|
|
280
288
|
{(!hideBusinessFavorite || !hideBusinessReviews) && (
|
|
@@ -301,7 +309,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
301
309
|
</ReviewAndFavorite>
|
|
302
310
|
)}
|
|
303
311
|
</View>
|
|
304
|
-
<OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={1}>
|
|
312
|
+
<OText size={textSize} style={{ lineHeight: 15, marginBottom: 3, fontFamily: undefined }} numberOfLines={1}>
|
|
305
313
|
{business?.address}
|
|
306
314
|
</OText>
|
|
307
315
|
<Metadata>
|
|
@@ -373,9 +381,9 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
373
381
|
</View>
|
|
374
382
|
</Placeholder>
|
|
375
383
|
)}
|
|
376
|
-
</
|
|
384
|
+
</View>
|
|
377
385
|
);
|
|
378
|
-
};
|
|
386
|
+
}, BusinessControllerPropsAreEqual);
|
|
379
387
|
|
|
380
388
|
export const BusinessController = (props: BusinessControllerParams) => {
|
|
381
389
|
const BusinessControllerProps = {
|
|
@@ -8,13 +8,14 @@ export const BusinessHero = styled.View`
|
|
|
8
8
|
`
|
|
9
9
|
|
|
10
10
|
export const BusinessContent = styled.View`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
position: relative;
|
|
12
|
+
padding-horizontal: 18px;
|
|
13
|
+
padding-bottom: 10px;
|
|
14
|
+
border-bottom-left-radius: 7.6px;
|
|
15
|
+
border-bottom-right-radius: 7.6px;
|
|
16
|
+
border-width: 1px;
|
|
17
|
+
border-color: ${(props: any) => props.theme.colors.border};
|
|
18
|
+
overflow: visible;
|
|
18
19
|
`;
|
|
19
20
|
|
|
20
21
|
export const BusinessInfo = styled.View`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { TouchableOpacity, View, Vibration } from 'react-native';
|
|
3
3
|
import { useOrder, useLanguage, useUtils, useConfig, useEvent } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import {
|
|
@@ -47,7 +47,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
47
47
|
const cartsArray = Object.values(orderState?.carts)
|
|
48
48
|
const cartsLength = cartsArray.filter((cart: any) => cart.products.length > 0).length ?? 0
|
|
49
49
|
if (cartsLength === 1) {
|
|
50
|
-
changeActiveState(!isClosed, cart?.uuid)
|
|
50
|
+
changeActiveState && changeActiveState(!isClosed, cart?.uuid)
|
|
51
51
|
}
|
|
52
52
|
}, [orderState?.carts, isClosed])
|
|
53
53
|
|
|
@@ -57,6 +57,9 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
57
57
|
return acc = acc
|
|
58
58
|
}, cart?.subtotal)
|
|
59
59
|
|
|
60
|
+
const bgStyle = (subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary
|
|
61
|
+
const textStyles = (subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.black : theme.colors.white
|
|
62
|
+
|
|
60
63
|
useEffect(() => {
|
|
61
64
|
if (isActive && !isFromUpselling) {
|
|
62
65
|
if (cart?.uuid !== viewedCart?.uuid) {
|
|
@@ -66,11 +69,16 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
66
69
|
}
|
|
67
70
|
}, [isActive, viewedCart])
|
|
68
71
|
|
|
72
|
+
const handleGoToStore = () => {
|
|
73
|
+
Vibration.vibrate(100)
|
|
74
|
+
props.onNavigationRedirect('Business', { store: cart?.business?.slug })
|
|
75
|
+
}
|
|
76
|
+
|
|
69
77
|
return (
|
|
70
78
|
<BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
|
|
71
79
|
<BIHeader
|
|
72
80
|
isClosed={isClosed}
|
|
73
|
-
onPress={() => !isClosed ? changeActiveState(!isClosed, cart?.uuid) : isClosed}
|
|
81
|
+
onPress={() => !isClosed ? changeActiveState && changeActiveState(!isClosed, cart?.uuid) : isClosed}
|
|
74
82
|
activeOpacity={1}
|
|
75
83
|
>
|
|
76
84
|
<BIInfo>
|
|
@@ -79,7 +87,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
79
87
|
<View style={{ flexDirection: 'row' }}>
|
|
80
88
|
{props.onNavigationRedirect && !isClosed && !isGiftCart && (
|
|
81
89
|
<>
|
|
82
|
-
<TouchableOpacity onPress={() =>
|
|
90
|
+
<TouchableOpacity onPress={() => handleGoToStore()}>
|
|
83
91
|
<OText color={theme.colors.primary} size={12} lineHeight={18} style={{ textDecorationLine: 'underline' }}>{t('GO_TO_STORE', 'Go to store')}</OText>
|
|
84
92
|
</TouchableOpacity>
|
|
85
93
|
</>
|
|
@@ -153,11 +161,11 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
153
161
|
{cart?.valid_products && (
|
|
154
162
|
<OButton
|
|
155
163
|
onClick={handleClickCheckout}
|
|
156
|
-
textStyle={{ color:
|
|
164
|
+
textStyle={{ color: textStyles, textAlign: 'center', flex: 1 }}
|
|
157
165
|
style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
158
166
|
text={t('CHECKOUT', 'Checkout')}
|
|
159
|
-
bgColor={
|
|
160
|
-
borderColor={
|
|
167
|
+
bgColor={bgStyle}
|
|
168
|
+
borderColor={bgStyle}
|
|
161
169
|
isDisabled={checkoutButtonDisabled}
|
|
162
170
|
/>
|
|
163
171
|
)}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { useLanguage, useOrder } from 'ordering-components/native'
|
|
3
|
+
import { ScrollView, StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native'
|
|
4
|
+
import { useTheme } from 'styled-components/native'
|
|
5
|
+
import { OButton, OModal, OText } from '../shared'
|
|
6
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
7
|
+
import {
|
|
8
|
+
ProductsList,
|
|
9
|
+
TagsContainer,
|
|
10
|
+
SortContainer,
|
|
11
|
+
BrandContainer,
|
|
12
|
+
BrandItem,
|
|
13
|
+
PriceFilterWrapper,
|
|
14
|
+
BContainer,
|
|
15
|
+
WrapperButtons
|
|
16
|
+
} from './styles'
|
|
17
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
18
|
+
import { MaxSectionItem } from './MaxSectionItem'
|
|
19
|
+
|
|
20
|
+
export const BusinessSearchFooter = (props: any) => {
|
|
21
|
+
const {
|
|
22
|
+
businessesSearchList,
|
|
23
|
+
handleCloseFilters,
|
|
24
|
+
handleChangeFilters,
|
|
25
|
+
brandList,
|
|
26
|
+
filters,
|
|
27
|
+
handleChangeBrandFilter,
|
|
28
|
+
handleChangePriceRange,
|
|
29
|
+
businessTypes,
|
|
30
|
+
handleApplyFilters,
|
|
31
|
+
clearFilters,
|
|
32
|
+
handleChangeActiveBusinessType,
|
|
33
|
+
openFilters
|
|
34
|
+
} = props
|
|
35
|
+
|
|
36
|
+
const screenHeight = Dimensions.get('window').height;
|
|
37
|
+
const theme = useTheme()
|
|
38
|
+
const [orderState] = useOrder()
|
|
39
|
+
|
|
40
|
+
const [, t] = useLanguage()
|
|
41
|
+
|
|
42
|
+
const maxDeliveryFeeOptions = [15, 25, 35, 'default']
|
|
43
|
+
// const maxProductPriceOptions = [5, 10, 15, 'default']
|
|
44
|
+
const maxDistanceOptions = [1000, 2000, 5000, 'default']
|
|
45
|
+
const maxTimeOptions = [5, 15, 30, 'default']
|
|
46
|
+
const sortItems = [
|
|
47
|
+
{ text: t('PICKED_FOR_YOU', 'Picked for you (default)'), value: 'distance' },
|
|
48
|
+
{ text: t('DELIVERY_TIME', 'Delivery time'), value: 'delivery_time' },
|
|
49
|
+
{ text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
const priceList = [
|
|
53
|
+
{ level: '1', content: '$' },
|
|
54
|
+
{ level: '2', content: '$$' },
|
|
55
|
+
{ level: '3', content: '$$$' },
|
|
56
|
+
{ level: '4', content: '$$$$' },
|
|
57
|
+
{ level: '5', content: '$$$$$' }
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
container: {
|
|
62
|
+
paddingHorizontal: 40,
|
|
63
|
+
width: '100%'
|
|
64
|
+
},
|
|
65
|
+
filterContainer: {
|
|
66
|
+
maxHeight: screenHeight - 150,
|
|
67
|
+
paddingHorizontal: 20,
|
|
68
|
+
width: '100%'
|
|
69
|
+
},
|
|
70
|
+
businessTypesContainer: {
|
|
71
|
+
width: '100%',
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
flexWrap: 'wrap',
|
|
74
|
+
justifyContent: 'center'
|
|
75
|
+
},
|
|
76
|
+
priceContainer: {
|
|
77
|
+
width: '100%',
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
flexWrap: 'wrap',
|
|
80
|
+
justifyContent: 'space-between'
|
|
81
|
+
},
|
|
82
|
+
categoryStyle: {
|
|
83
|
+
marginRight: 10,
|
|
84
|
+
marginTop: 10,
|
|
85
|
+
borderRadius: 50,
|
|
86
|
+
paddingHorizontal: 10,
|
|
87
|
+
paddingVertical: 4,
|
|
88
|
+
paddingLeft: 0,
|
|
89
|
+
paddingRight: 0,
|
|
90
|
+
height: 28,
|
|
91
|
+
borderWidth: 0
|
|
92
|
+
},
|
|
93
|
+
priceItem: {
|
|
94
|
+
marginRight: 10,
|
|
95
|
+
marginTop: 10,
|
|
96
|
+
borderRadius: 50,
|
|
97
|
+
paddingVertical: 4,
|
|
98
|
+
paddingLeft: 5,
|
|
99
|
+
paddingRight: 5,
|
|
100
|
+
height: 27,
|
|
101
|
+
borderWidth: 0
|
|
102
|
+
},
|
|
103
|
+
applyButton: {
|
|
104
|
+
paddingHorizontal: 10,
|
|
105
|
+
width: '100%',
|
|
106
|
+
marginTop: 20
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<>
|
|
112
|
+
<BContainer
|
|
113
|
+
style={{ paddingHorizontal: 20 }}
|
|
114
|
+
>
|
|
115
|
+
<ProductsList>
|
|
116
|
+
{businessesSearchList?.loading && (
|
|
117
|
+
<>
|
|
118
|
+
{[...Array(3).keys()].map(
|
|
119
|
+
(item, i) => (
|
|
120
|
+
<View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
|
|
121
|
+
<Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
|
|
122
|
+
<View style={{ flexDirection: 'row' }}>
|
|
123
|
+
<PlaceholderLine
|
|
124
|
+
width={24}
|
|
125
|
+
height={70}
|
|
126
|
+
style={{ marginRight: 10, marginBottom: 10 }}
|
|
127
|
+
/>
|
|
128
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
129
|
+
<PlaceholderLine width={20} style={{ marginBottom: 25 }} />
|
|
130
|
+
<PlaceholderLine width={60} />
|
|
131
|
+
</Placeholder>
|
|
132
|
+
</View>
|
|
133
|
+
</Placeholder>
|
|
134
|
+
<Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
|
|
135
|
+
<View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
|
|
136
|
+
<PlaceholderLine
|
|
137
|
+
width={24}
|
|
138
|
+
height={70}
|
|
139
|
+
style={{ marginRight: 10, marginBottom: 5 }}
|
|
140
|
+
/>
|
|
141
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
142
|
+
<PlaceholderLine width={60} height={10} />
|
|
143
|
+
<PlaceholderLine width={50} height={10} />
|
|
144
|
+
<PlaceholderLine width={70} height={10} />
|
|
145
|
+
</Placeholder>
|
|
146
|
+
</View>
|
|
147
|
+
</Placeholder>
|
|
148
|
+
</View>
|
|
149
|
+
),
|
|
150
|
+
)}
|
|
151
|
+
</>
|
|
152
|
+
)}
|
|
153
|
+
</ProductsList>
|
|
154
|
+
</BContainer>
|
|
155
|
+
<OModal
|
|
156
|
+
open={openFilters}
|
|
157
|
+
onCancel={() => handleCloseFilters()}
|
|
158
|
+
onClose={() => handleCloseFilters()}
|
|
159
|
+
>
|
|
160
|
+
<ScrollView style={styles.filterContainer}>
|
|
161
|
+
<OText
|
|
162
|
+
size={20}
|
|
163
|
+
mBottom={15}
|
|
164
|
+
style={{ marginTop: 10 }}
|
|
165
|
+
>
|
|
166
|
+
{t('FILTER', 'Filter')}
|
|
167
|
+
</OText>
|
|
168
|
+
<SortContainer>
|
|
169
|
+
<OText weight='bold' mBottom={7} size={16}>
|
|
170
|
+
{t('SORT', 'Sort')}
|
|
171
|
+
</OText>
|
|
172
|
+
{sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
|
|
173
|
+
<TouchableOpacity
|
|
174
|
+
key={item?.value}
|
|
175
|
+
onPress={() => handleChangeFilters('orderBy', item?.value)}
|
|
176
|
+
style={{ marginBottom: 7 }}
|
|
177
|
+
>
|
|
178
|
+
<OText
|
|
179
|
+
weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
|
|
180
|
+
mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
|
|
181
|
+
>
|
|
182
|
+
{item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
|
|
183
|
+
</OText>
|
|
184
|
+
</TouchableOpacity>
|
|
185
|
+
))}
|
|
186
|
+
</SortContainer>
|
|
187
|
+
<BrandContainer>
|
|
188
|
+
<OText
|
|
189
|
+
size={16}
|
|
190
|
+
weight='bold'
|
|
191
|
+
lineHeight={24}
|
|
192
|
+
style={{ marginBottom: 10 }}
|
|
193
|
+
>
|
|
194
|
+
{t('BRANDS', 'Brands')}
|
|
195
|
+
</OText>
|
|
196
|
+
{!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
|
|
197
|
+
<ScrollView
|
|
198
|
+
style={{ maxHeight: 300, marginBottom: 10 }}
|
|
199
|
+
showsVerticalScrollIndicator={true}
|
|
200
|
+
nestedScrollEnabled={true}
|
|
201
|
+
>
|
|
202
|
+
{brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
|
|
203
|
+
<BrandItem
|
|
204
|
+
key={i}
|
|
205
|
+
onPress={() => handleChangeBrandFilter(brand?.id)}
|
|
206
|
+
>
|
|
207
|
+
<OText
|
|
208
|
+
size={14}
|
|
209
|
+
weight={'400'}
|
|
210
|
+
lineHeight={24}
|
|
211
|
+
>
|
|
212
|
+
{brand?.name}
|
|
213
|
+
</OText>
|
|
214
|
+
{filters?.franchise_ids?.includes(brand?.id) && (
|
|
215
|
+
<AntDesignIcon
|
|
216
|
+
name='check'
|
|
217
|
+
color={theme.colors.success500}
|
|
218
|
+
size={16}
|
|
219
|
+
/>
|
|
220
|
+
)}
|
|
221
|
+
</BrandItem>
|
|
222
|
+
))}
|
|
223
|
+
</ScrollView>
|
|
224
|
+
)}
|
|
225
|
+
{!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
|
|
226
|
+
<OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
|
|
227
|
+
)}
|
|
228
|
+
</BrandContainer>
|
|
229
|
+
<PriceFilterWrapper>
|
|
230
|
+
<OText
|
|
231
|
+
size={16}
|
|
232
|
+
weight='bold'
|
|
233
|
+
lineHeight={24}
|
|
234
|
+
style={{ marginBottom: 5 }}
|
|
235
|
+
>
|
|
236
|
+
{t('PRICE_RANGE', 'Price range')}
|
|
237
|
+
</OText>
|
|
238
|
+
<View style={styles.priceContainer}>
|
|
239
|
+
{priceList.map((price: any, i: number) => (
|
|
240
|
+
<OButton
|
|
241
|
+
key={i}
|
|
242
|
+
bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
243
|
+
onClick={() => handleChangePriceRange(price?.level)}
|
|
244
|
+
text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
|
|
245
|
+
style={styles.priceItem}
|
|
246
|
+
textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.white : theme.colors.textNormal }}
|
|
247
|
+
/>
|
|
248
|
+
))}
|
|
249
|
+
</View>
|
|
250
|
+
</PriceFilterWrapper>
|
|
251
|
+
{orderState?.options?.type === 1 && (
|
|
252
|
+
<MaxSectionItem
|
|
253
|
+
filters={filters}
|
|
254
|
+
title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
|
|
255
|
+
options={maxDeliveryFeeOptions}
|
|
256
|
+
filter='max_delivery_price'
|
|
257
|
+
handleChangeFilters={handleChangeFilters}
|
|
258
|
+
/>
|
|
259
|
+
)}
|
|
260
|
+
{[1, 2].includes(orderState?.options?.type) && (
|
|
261
|
+
<MaxSectionItem
|
|
262
|
+
filters={filters}
|
|
263
|
+
title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
|
|
264
|
+
options={maxTimeOptions}
|
|
265
|
+
filter='max_eta'
|
|
266
|
+
handleChangeFilters={handleChangeFilters}
|
|
267
|
+
/>
|
|
268
|
+
)}
|
|
269
|
+
<MaxSectionItem
|
|
270
|
+
filters={filters}
|
|
271
|
+
title={t('MAX_DISTANCE', 'Max distance')}
|
|
272
|
+
options={maxDistanceOptions}
|
|
273
|
+
filter='max_distance'
|
|
274
|
+
handleChangeFilters={handleChangeFilters}
|
|
275
|
+
/>
|
|
276
|
+
{businessTypes?.length > 0 && (
|
|
277
|
+
<TagsContainer>
|
|
278
|
+
<OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
|
|
279
|
+
<View style={styles.businessTypesContainer}>
|
|
280
|
+
{businessTypes.map((type: any, i: number) => type.enabled && (
|
|
281
|
+
<OButton
|
|
282
|
+
key={type?.id}
|
|
283
|
+
bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
284
|
+
onClick={() => handleChangeActiveBusinessType(type)}
|
|
285
|
+
text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
|
|
286
|
+
style={styles.categoryStyle}
|
|
287
|
+
textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.white : theme.colors.textNormal }}
|
|
288
|
+
/>
|
|
289
|
+
))}
|
|
290
|
+
</View>
|
|
291
|
+
</TagsContainer>
|
|
292
|
+
)}
|
|
293
|
+
</ScrollView>
|
|
294
|
+
<WrapperButtons>
|
|
295
|
+
<View style={{ width: '50%' }}>
|
|
296
|
+
<OButton
|
|
297
|
+
text={t('APPLY', 'Apply')}
|
|
298
|
+
parentStyle={styles.applyButton}
|
|
299
|
+
onClick={() => handleApplyFilters()}
|
|
300
|
+
/>
|
|
301
|
+
</View>
|
|
302
|
+
<View style={{ width: '50%' }}>
|
|
303
|
+
<OButton
|
|
304
|
+
text={t('CLEAR_FILTERS', 'Clear')}
|
|
305
|
+
bgColor={theme.colors.white}
|
|
306
|
+
borderColor={theme.colors.primary}
|
|
307
|
+
parentStyle={styles.applyButton}
|
|
308
|
+
textStyle={{ color: theme.colors.primary }}
|
|
309
|
+
onClick={() => clearFilters()}
|
|
310
|
+
/>
|
|
311
|
+
</View>
|
|
312
|
+
</WrapperButtons>
|
|
313
|
+
</OModal>
|
|
314
|
+
</>
|
|
315
|
+
)
|
|
316
|
+
}
|