ordering-ui-react-native 0.21.50 → 0.21.51-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/BusinessController/index.tsx +19 -17
- 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 +40 -20
- 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 +263 -135
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +37 -40
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- 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 +5 -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 +23 -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 +41 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +18 -4
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- 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 +7 -10
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- 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/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +47 -358
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +4 -3
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +30 -18
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +7 -7
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +2 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +30 -9
- package/themes/original/src/components/CartContent/index.tsx +96 -58
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +144 -62
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +18 -2
- package/themes/original/src/components/Favorite/index.tsx +9 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
- package/themes/original/src/components/GPSButton/index.tsx +1 -1
- 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/PurchaseGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- 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 +83 -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 +7 -0
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
- package/themes/original/src/components/HelpGuide/index.tsx +5 -0
- package/themes/original/src/components/HelpOrder/index.tsx +5 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +3 -8
- package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
- package/themes/original/src/components/LoginForm/index.tsx +9 -3
- package/themes/original/src/components/MessageListing/index.tsx +6 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +19 -4
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +126 -61
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
- package/themes/original/src/components/MyOrders/index.tsx +28 -28
- package/themes/original/src/components/NavBar/index.tsx +5 -0
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/Notifications/index.tsx +9 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +701 -662
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +3 -1
- package/themes/original/src/components/OrderTypeSelector/index.tsx +10 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +3 -5
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +47 -4
- package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
- package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +170 -252
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -44
- 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/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +13 -11
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ServiceForm/index.tsx +1 -1
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/Sessions/index.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +67 -59
- package/themes/original/src/components/SingleOrderCard/index.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +4 -3
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +12 -35
- package/themes/original/src/components/StripeElementsForm/index.tsx +79 -59
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -86
- package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
- package/themes/original/src/components/UserProfile/index.tsx +3 -2
- package/themes/original/src/components/UserProfileForm/index.tsx +5 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +7 -4
- package/themes/original/src/components/Wallets/styles.tsx +2 -1
- package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -5
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +6 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -109,7 +109,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
109
109
|
return (
|
|
110
110
|
<BusinessReviewsContainer>
|
|
111
111
|
<BusinessReviewContent
|
|
112
|
-
contentContainerStyle={{ paddingHorizontal:
|
|
112
|
+
contentContainerStyle={{ paddingHorizontal: 20, paddingVertical: 27 }}>
|
|
113
113
|
{reviewsList.error ? (
|
|
114
114
|
<OText size={16}>{t('ERROR_UNKNOWN', 'An error has ocurred')}</OText>
|
|
115
115
|
) : (
|
|
@@ -415,7 +415,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
415
415
|
<ScrollView
|
|
416
416
|
showsHorizontalScrollIndicator={false}
|
|
417
417
|
nestedScrollEnabled
|
|
418
|
-
horizontal contentContainerStyle={{ paddingHorizontal:
|
|
418
|
+
horizontal contentContainerStyle={{ paddingHorizontal: 20 }}>
|
|
419
419
|
{featuredBusiness.map((bAry: any, idx) => (
|
|
420
420
|
<View key={'f-listing_' + idx}>
|
|
421
421
|
<BusinessFeaturedController
|
|
@@ -54,13 +54,13 @@ export const WrapMomentOption = styled.TouchableOpacity`
|
|
|
54
54
|
export const HeaderWrapper = styled.ImageBackground`
|
|
55
55
|
width: 100%;
|
|
56
56
|
height: 370px;
|
|
57
|
-
padding: 20px
|
|
57
|
+
padding: 20px;
|
|
58
58
|
background-color: transparent;
|
|
59
59
|
`;
|
|
60
60
|
|
|
61
61
|
export const ListWrapper = styled.View`
|
|
62
62
|
background-color: ${(props: any) => props.theme.colors.backgroundLight};
|
|
63
|
-
padding-horizontal:
|
|
63
|
+
padding-horizontal: 20px;
|
|
64
64
|
`;
|
|
65
65
|
|
|
66
66
|
export const FeaturedWrapper = styled.View`
|
|
@@ -72,7 +72,7 @@ export const FeaturedWrapper = styled.View`
|
|
|
72
72
|
export const OrderProgressWrapper = styled.View`
|
|
73
73
|
margin-top: 37px;
|
|
74
74
|
margin-bottom: 20px;
|
|
75
|
-
padding-horizontal:
|
|
75
|
+
padding-horizontal: 20px;
|
|
76
76
|
`
|
|
77
77
|
|
|
78
78
|
export const FarAwayMessage = styled.View`
|
|
@@ -98,10 +98,10 @@ export const FilterWrapper = styled.View`
|
|
|
98
98
|
`
|
|
99
99
|
|
|
100
100
|
export const ServiceWrapper = styled.View`
|
|
101
|
-
padding-horizontal:
|
|
101
|
+
padding-horizontal: 20px;
|
|
102
102
|
`
|
|
103
103
|
|
|
104
104
|
export const PriceWrapper = styled.View`
|
|
105
|
-
padding-horizontal:
|
|
105
|
+
padding-horizontal: 20px;
|
|
106
106
|
margin-top: 30px;
|
|
107
107
|
`
|
|
@@ -11,7 +11,7 @@ export const FlatListBusinessListFooter = (props : any) => {
|
|
|
11
11
|
} = props
|
|
12
12
|
return (
|
|
13
13
|
<>
|
|
14
|
-
<ListWrapper style={{ paddingHorizontal:
|
|
14
|
+
<ListWrapper style={{ paddingHorizontal: 20 }}>
|
|
15
15
|
{(businessesList.loading || !businessesList?.fetched) && (
|
|
16
16
|
<>
|
|
17
17
|
{[
|
|
@@ -133,7 +133,7 @@ export const FlatListBusinessListHeader = (props: any) => {
|
|
|
133
133
|
backgroundColor: theme.colors.white,
|
|
134
134
|
borderColor: theme.colors.backgroundGray,
|
|
135
135
|
borderRadius: 8,
|
|
136
|
-
marginHorizontal:
|
|
136
|
+
marginHorizontal: 20,
|
|
137
137
|
minHeight: 45,
|
|
138
138
|
paddingVertical: 5,
|
|
139
139
|
paddingHorizontal: 20,
|
|
@@ -165,7 +165,7 @@ export const FlatListBusinessListHeader = (props: any) => {
|
|
|
165
165
|
)}
|
|
166
166
|
<View style={{
|
|
167
167
|
height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
|
|
168
|
-
marginTop:
|
|
168
|
+
marginTop: 0,
|
|
169
169
|
backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
|
|
170
170
|
}}
|
|
171
171
|
>
|
|
@@ -276,7 +276,7 @@ export const FlatListBusinessListHeader = (props: any) => {
|
|
|
276
276
|
bgHeaderHeight={bgHeaderHeight}
|
|
277
277
|
>
|
|
278
278
|
{!auth && (
|
|
279
|
-
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart:
|
|
279
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 20, paddingVertical: 20 }}>
|
|
280
280
|
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
281
281
|
</TouchableOpacity>
|
|
282
282
|
)}
|
|
@@ -284,7 +284,7 @@ export const FlatListBusinessListHeader = (props: any) => {
|
|
|
284
284
|
) : (
|
|
285
285
|
<>
|
|
286
286
|
{!auth && (
|
|
287
|
-
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart:
|
|
287
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 20, paddingVertical: 20 }}>
|
|
288
288
|
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
289
289
|
</TouchableOpacity>
|
|
290
290
|
)}
|
|
@@ -324,12 +324,12 @@ export const FlatListBusinessListHeader = (props: any) => {
|
|
|
324
324
|
{
|
|
325
325
|
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
326
326
|
<FeaturedWrapper>
|
|
327
|
-
<OText size={16} style={{ marginLeft:
|
|
327
|
+
<OText size={16} style={{ marginLeft: 20 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
|
|
328
328
|
<ScrollView
|
|
329
329
|
showsHorizontalScrollIndicator={false}
|
|
330
330
|
nestedScrollEnabled
|
|
331
331
|
horizontal
|
|
332
|
-
contentContainerStyle={{ paddingHorizontal:
|
|
332
|
+
contentContainerStyle={{ paddingHorizontal: 20 }}
|
|
333
333
|
>
|
|
334
334
|
{featuredBusiness.map((bAry: any, idx: number) => (
|
|
335
335
|
<View key={'f-listing_' + idx}>
|
|
@@ -372,7 +372,7 @@ export const FlatListBusinessListHeader = (props: any) => {
|
|
|
372
372
|
<PageBanner position='app_business_listing' navigation={navigation} />
|
|
373
373
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
374
374
|
|
|
375
|
-
<ListWrapper style={{ paddingHorizontal:
|
|
375
|
+
<ListWrapper style={{ paddingHorizontal: 20 }}>
|
|
376
376
|
{!businessId && !isAllCategoriesHidden && (
|
|
377
377
|
<BusinessTypeFilter
|
|
378
378
|
images={props.images}
|
|
@@ -94,7 +94,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
94
94
|
backgroundColor: theme.colors.white,
|
|
95
95
|
borderColor: theme.colors.backgroundGray,
|
|
96
96
|
borderRadius: 8,
|
|
97
|
-
marginHorizontal:
|
|
97
|
+
marginHorizontal: 20,
|
|
98
98
|
minHeight: 45,
|
|
99
99
|
paddingVertical: 5,
|
|
100
100
|
paddingHorizontal: 20,
|
|
@@ -168,7 +168,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
168
168
|
setFeaturedBusinesses(ary);
|
|
169
169
|
}
|
|
170
170
|
resetInactivityTimeout()
|
|
171
|
-
}, [businessesList.loading])
|
|
171
|
+
}, [businessesList.loading, businessesList?.businesses])
|
|
172
172
|
|
|
173
173
|
const handleOnRefresh = () => {
|
|
174
174
|
if (!businessesList.loading) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Cart as CartController,
|
|
4
4
|
useOrder,
|
|
@@ -52,7 +52,11 @@ const CartUI = (props: any) => {
|
|
|
52
52
|
preorderMaximumDays,
|
|
53
53
|
preorderMinimumDays,
|
|
54
54
|
cateringTypes,
|
|
55
|
-
isFromUpselling
|
|
55
|
+
isFromUpselling,
|
|
56
|
+
cartsOpened,
|
|
57
|
+
setCartsOpened,
|
|
58
|
+
changeActiveState,
|
|
59
|
+
isActive
|
|
56
60
|
} = props
|
|
57
61
|
|
|
58
62
|
const theme = useTheme();
|
|
@@ -62,7 +66,7 @@ const CartUI = (props: any) => {
|
|
|
62
66
|
const [{ configs }] = useConfig();
|
|
63
67
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
64
68
|
const [validationFields] = useValidationFields()
|
|
65
|
-
|
|
69
|
+
const commentRef = useRef()
|
|
66
70
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
67
71
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
68
72
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
@@ -109,7 +113,7 @@ const CartUI = (props: any) => {
|
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
|
|
112
|
-
const handleUpsellingPage = (individualCart
|
|
116
|
+
const handleUpsellingPage = (individualCart: any) => {
|
|
113
117
|
const isProductCartParam = !!individualCart?.products?.length
|
|
114
118
|
setOpenUpselling(false)
|
|
115
119
|
setCanOpenUpselling(false)
|
|
@@ -117,7 +121,7 @@ const CartUI = (props: any) => {
|
|
|
117
121
|
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
118
122
|
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
119
123
|
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
|
|
120
|
-
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
124
|
+
if (cartsAvailable.length === 1 || !isMultiCheckout || !cart?.business_id) {
|
|
121
125
|
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
122
126
|
onNavigationRedirect('CheckoutNavigator', {
|
|
123
127
|
screen: 'CheckoutPage',
|
|
@@ -192,6 +196,18 @@ const CartUI = (props: any) => {
|
|
|
192
196
|
return acc = acc
|
|
193
197
|
}, cart?.subtotal)
|
|
194
198
|
|
|
199
|
+
const handleClickCheckout = () => {
|
|
200
|
+
if (cart?.business_id) {
|
|
201
|
+
setOpenUpselling(true)
|
|
202
|
+
} else {
|
|
203
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
204
|
+
screen: 'CheckoutPage',
|
|
205
|
+
cartUuid: cart?.uuid,
|
|
206
|
+
cartTotal: cart?.total
|
|
207
|
+
}, true)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
195
211
|
useEffect(() => {
|
|
196
212
|
const limitDays = parseInt(preorderMaximumDays ?? configs?.max_days_preorder?.value, 10)
|
|
197
213
|
const currentDate = new Date()
|
|
@@ -207,7 +223,7 @@ const CartUI = (props: any) => {
|
|
|
207
223
|
|
|
208
224
|
return (
|
|
209
225
|
<CContainer>
|
|
210
|
-
{openUpselling && (
|
|
226
|
+
{!!openUpselling && (
|
|
211
227
|
<UpsellingProducts
|
|
212
228
|
handleUpsellingPage={handleUpsellingPage}
|
|
213
229
|
openUpselling={openUpselling}
|
|
@@ -228,10 +244,14 @@ const CartUI = (props: any) => {
|
|
|
228
244
|
handleCartOpen={handleCartOpen}
|
|
229
245
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
230
246
|
handleChangeStore={() => setOpenChangeStore(true)}
|
|
231
|
-
handleClickCheckout={() =>
|
|
247
|
+
handleClickCheckout={() => handleClickCheckout()}
|
|
232
248
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
233
249
|
isMultiCheckout={isMultiCheckout}
|
|
234
250
|
isFromUpselling={isFromUpselling}
|
|
251
|
+
cartsOpened={cartsOpened}
|
|
252
|
+
setCartsOpened={setCartsOpened}
|
|
253
|
+
changeActiveState={changeActiveState}
|
|
254
|
+
isActive={isActive}
|
|
235
255
|
isGiftCart={!cart?.business_id}
|
|
236
256
|
>
|
|
237
257
|
{cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
|
|
@@ -491,6 +511,7 @@ const CartUI = (props: any) => {
|
|
|
491
511
|
marginTop: 10,
|
|
492
512
|
borderRadius: 7.6
|
|
493
513
|
}}
|
|
514
|
+
forwardRef={commentRef}
|
|
494
515
|
multiline
|
|
495
516
|
/>
|
|
496
517
|
{commentState?.loading && (
|
|
@@ -523,7 +544,7 @@ const CartUI = (props: any) => {
|
|
|
523
544
|
/>
|
|
524
545
|
</View>
|
|
525
546
|
)}
|
|
526
|
-
{!isMultiCheckout && (
|
|
547
|
+
{(!isMultiCheckout || !cart?.business_id) && (
|
|
527
548
|
<>
|
|
528
549
|
{cart?.valid_products ? (
|
|
529
550
|
<CheckoutAction>
|
|
@@ -540,7 +561,7 @@ const CartUI = (props: any) => {
|
|
|
540
561
|
borderColor={theme.colors.primary}
|
|
541
562
|
imgRightSrc={null}
|
|
542
563
|
textStyle={{ color: '#fff', textAlign: 'center', flex: 1 }}
|
|
543
|
-
onClick={() =>
|
|
564
|
+
onClick={() => handleClickCheckout()}
|
|
544
565
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
545
566
|
/>
|
|
546
567
|
</CheckoutAction>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
|
|
3
|
+
import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
|
|
6
6
|
|
|
@@ -11,10 +11,10 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
11
11
|
|
|
12
12
|
export const CartContent = (props: any) => {
|
|
13
13
|
const {
|
|
14
|
-
carts,
|
|
15
|
-
isOrderStateCarts,
|
|
16
14
|
onNavigationRedirect,
|
|
17
|
-
singleBusiness
|
|
15
|
+
singleBusiness,
|
|
16
|
+
businessSlug,
|
|
17
|
+
navigation
|
|
18
18
|
} = props
|
|
19
19
|
|
|
20
20
|
const theme = useTheme();
|
|
@@ -22,16 +22,22 @@ export const CartContent = (props: any) => {
|
|
|
22
22
|
const [{ configs }] = useConfig()
|
|
23
23
|
const [{ parsePrice }] = useUtils();
|
|
24
24
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
25
|
-
|
|
26
|
-
const
|
|
25
|
+
const [cartsOpened, setCartsOpened] = useState([])
|
|
26
|
+
const [{ carts: cartsContext }, { confirmCart }] = useOrder();
|
|
27
|
+
const cartsList =
|
|
28
|
+
(cartsContext &&
|
|
29
|
+
Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
|
|
30
|
+
[];
|
|
31
|
+
const carts = businessSlug
|
|
32
|
+
? cartsList.filter((cart: any) => cart?.business?.slug === businessSlug || parseInt(businessSlug) === cart?.business_id)
|
|
33
|
+
: cartsList
|
|
34
|
+
const isOrderStateCarts = !!carts
|
|
27
35
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
28
|
-
const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
29
|
-
|
|
36
|
+
const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2 && cart?.business_id)
|
|
30
37
|
const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
|
|
31
38
|
const totalCartsFee = cartsAvailable?.length && cartsAvailable
|
|
32
39
|
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
33
40
|
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
34
|
-
|
|
35
41
|
const handleCheckoutRedirect = () => {
|
|
36
42
|
if (cartsAvailable.length === 1) {
|
|
37
43
|
onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -66,9 +72,35 @@ export const CartContent = (props: any) => {
|
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
|
|
75
|
+
const changeActiveState = useCallback((isClosed: boolean, uuid: string) => {
|
|
76
|
+
const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
|
|
77
|
+
if (isActive || !isClosed) {
|
|
78
|
+
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
79
|
+
} else {
|
|
80
|
+
setCartsOpened([
|
|
81
|
+
...cartsOpened,
|
|
82
|
+
uuid
|
|
83
|
+
])
|
|
84
|
+
}
|
|
85
|
+
}, [cartsOpened])
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const unsuscribe = navigation.addListener('focus', () => {
|
|
89
|
+
const cartsListBlockedByPaypal = carts?.filter((cart: any) => cart?.status === 2 && cart?.paymethod_data?.gateway === 'paypal')
|
|
90
|
+
if (cartsListBlockedByPaypal?.length > 0) {
|
|
91
|
+
cartsListBlockedByPaypal.map(async (cart: any) => {
|
|
92
|
+
await confirmCart(cart?.uuid)
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
return () => {
|
|
97
|
+
return unsuscribe()
|
|
98
|
+
}
|
|
99
|
+
}, [carts, navigation])
|
|
100
|
+
|
|
69
101
|
return (
|
|
70
102
|
<CCContainer
|
|
71
|
-
style={{ paddingHorizontal:
|
|
103
|
+
style={{ paddingHorizontal: 20 }}
|
|
72
104
|
>
|
|
73
105
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
74
106
|
<>
|
|
@@ -88,8 +120,12 @@ export const CartContent = (props: any) => {
|
|
|
88
120
|
hideUpselling
|
|
89
121
|
businessConfigs={cart?.business?.configs}
|
|
90
122
|
hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
|
|
91
|
-
|
|
123
|
+
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
92
124
|
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
125
|
+
cartsOpened={cartsOpened}
|
|
126
|
+
setCartsOpened={setCartsOpened}
|
|
127
|
+
changeActiveState={changeActiveState}
|
|
128
|
+
isActive={cartsOpened?.includes?.(cart?.uuid) || !!singleBusiness}
|
|
93
129
|
/>
|
|
94
130
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
95
131
|
</>
|
|
@@ -99,53 +135,55 @@ export const CartContent = (props: any) => {
|
|
|
99
135
|
{isMultiCheckout && (
|
|
100
136
|
<>
|
|
101
137
|
{!!cartsAvailable.length && (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
<>
|
|
139
|
+
<ChCartsTotal>
|
|
140
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
141
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
142
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
143
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
144
|
+
</OText>
|
|
145
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
146
|
+
{parsePrice(totalCartsFee)}
|
|
147
|
+
</OText>
|
|
148
|
+
</View>
|
|
149
|
+
)}
|
|
150
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
151
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
152
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
153
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
154
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
155
|
+
</OText>
|
|
156
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
157
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
158
|
+
</OText>
|
|
159
|
+
</View>
|
|
160
|
+
)}
|
|
161
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
162
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
163
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
164
|
+
</OText>
|
|
165
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
166
|
+
</View>
|
|
167
|
+
<View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
|
|
168
|
+
<OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
|
|
169
|
+
{t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
|
|
170
|
+
</OText>
|
|
171
|
+
</View>
|
|
172
|
+
</ChCartsTotal>
|
|
173
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
174
|
+
<OButton
|
|
175
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
176
|
+
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
177
|
+
isDisabled={!cartsAvailable.length}
|
|
178
|
+
borderColor={theme.colors.primary}
|
|
179
|
+
imgRightSrc={null}
|
|
180
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
181
|
+
onClick={() => handleCheckoutRedirect()}
|
|
182
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
183
|
+
/>
|
|
184
|
+
</CheckoutAction>
|
|
185
|
+
</>
|
|
136
186
|
)}
|
|
137
|
-
<CheckoutAction style={{ marginTop: 0 }}>
|
|
138
|
-
<OButton
|
|
139
|
-
text={t('CHECKOUT', 'Checkout')}
|
|
140
|
-
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
141
|
-
isDisabled={!cartsAvailable.length}
|
|
142
|
-
borderColor={theme.colors.primary}
|
|
143
|
-
imgRightSrc={null}
|
|
144
|
-
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
145
|
-
onClick={() => handleCheckoutRedirect()}
|
|
146
|
-
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
147
|
-
/>
|
|
148
|
-
</CheckoutAction>
|
|
149
187
|
</>
|
|
150
188
|
)}
|
|
151
189
|
</>
|
|
@@ -9,7 +9,7 @@ export const Container = styled.View`
|
|
|
9
9
|
`
|
|
10
10
|
|
|
11
11
|
export const ItemListing = styled.ScrollView`
|
|
12
|
-
padding: 0
|
|
12
|
+
padding: 0 20px;
|
|
13
13
|
margin: 0 0 140px;
|
|
14
14
|
`
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ export const TopHeader = styled.View`
|
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: space-between;
|
|
21
21
|
z-index: 1;
|
|
22
|
-
padding: 0
|
|
22
|
+
padding: 0 20px;
|
|
23
23
|
`
|
|
24
24
|
|
|
25
25
|
export const HeaderItem = styled.TouchableOpacity`
|