ordering-ui-react-native 0.21.29 → 0.21.30-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 -6
- 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/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +23 -14
- package/themes/business/src/components/DriverMap/index.tsx +36 -23
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- 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/MapView/index.tsx +11 -7
- package/themes/business/src/components/MessagesOption/index.tsx +2 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +143 -101
- package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +61 -54
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +52 -20
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
- package/themes/business/src/components/OrderSummary/index.tsx +240 -76
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +125 -130
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +36 -38
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
- package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +17 -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 +107 -53
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +15 -2
- 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/LoginForm/index.tsx +7 -4
- 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 +9 -4
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +27 -12
- 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 +11 -7
- 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/MaxSectionItem/index.tsx +1 -1
- 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 +2 -3
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- 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 +35 -19
- 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 +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
- 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 +32 -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 +173 -64
- 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 +33 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- 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/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
- 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 +6 -5
- 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 +2 -1
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
- package/themes/original/src/components/LoginForm/index.tsx +8 -3
- package/themes/original/src/components/MessageListing/index.tsx +6 -0
- package/themes/original/src/components/Messages/index.tsx +9 -7
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -3
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +1 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
- 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 -1
- 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 +709 -665
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderProgress/index.tsx +24 -4
- 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/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
- 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 +67 -155
- package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +105 -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 +2 -2
- 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 +66 -59
- package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
- package/themes/original/src/components/StripeElementsForm/index.tsx +74 -59
- package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -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 +123 -75
- 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 +8 -4
- package/themes/original/src/components/Wallets/styles.tsx +1 -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 +1 -0
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -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`
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } from 'react-native';
|
|
1
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler, SafeAreaView } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
4
|
import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
|
|
5
5
|
import Picker from 'react-native-country-picker-modal';
|
|
6
6
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
7
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
9
|
+
|
|
7
10
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
8
11
|
import {
|
|
9
12
|
Checkout as CheckoutController,
|
|
@@ -46,7 +49,9 @@ import {
|
|
|
46
49
|
DeliveryOptionsContainer,
|
|
47
50
|
DeliveryOptionItem,
|
|
48
51
|
WalletPaymentOptionContainer,
|
|
49
|
-
CartHeader
|
|
52
|
+
CartHeader,
|
|
53
|
+
TopHeader,
|
|
54
|
+
TopActions
|
|
50
55
|
} from './styles';
|
|
51
56
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
52
57
|
import { FloatingButton } from '../FloatingButton';
|
|
@@ -96,10 +101,13 @@ const CheckoutUI = (props: any) => {
|
|
|
96
101
|
currency,
|
|
97
102
|
merchantId,
|
|
98
103
|
setPlaceSpotNumber,
|
|
99
|
-
maxDate
|
|
104
|
+
maxDate,
|
|
105
|
+
androidAppId,
|
|
106
|
+
urlscheme
|
|
100
107
|
} = props
|
|
101
108
|
|
|
102
109
|
const theme = useTheme();
|
|
110
|
+
const isFocused = useIsFocused();
|
|
103
111
|
|
|
104
112
|
const styles = StyleSheet.create({
|
|
105
113
|
btnBackArrow: {
|
|
@@ -115,7 +123,7 @@ const CheckoutUI = (props: any) => {
|
|
|
115
123
|
padding: 20
|
|
116
124
|
},
|
|
117
125
|
pagePadding: {
|
|
118
|
-
paddingHorizontal:
|
|
126
|
+
paddingHorizontal: 20
|
|
119
127
|
},
|
|
120
128
|
icon: {
|
|
121
129
|
top: 15,
|
|
@@ -124,13 +132,14 @@ const CheckoutUI = (props: any) => {
|
|
|
124
132
|
fontSize: 20
|
|
125
133
|
},
|
|
126
134
|
detailWrapper: {
|
|
127
|
-
paddingHorizontal:
|
|
135
|
+
paddingHorizontal: 20,
|
|
128
136
|
width: '100%'
|
|
129
137
|
},
|
|
130
138
|
wrapperNavbar: {
|
|
131
|
-
paddingVertical:
|
|
132
|
-
paddingHorizontal:
|
|
133
|
-
|
|
139
|
+
paddingVertical: 2,
|
|
140
|
+
paddingHorizontal: 20,
|
|
141
|
+
backgroundColor: theme?.colors?.white,
|
|
142
|
+
borderWidth: 0
|
|
134
143
|
}
|
|
135
144
|
})
|
|
136
145
|
|
|
@@ -154,7 +163,7 @@ const CheckoutUI = (props: any) => {
|
|
|
154
163
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
155
164
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
156
165
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
157
|
-
const [showGateway, setShowGateway] = useState<any>({
|
|
166
|
+
const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
|
|
158
167
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
159
168
|
const [isOpen, setIsOpen] = useState(false)
|
|
160
169
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
@@ -162,12 +171,15 @@ const CheckoutUI = (props: any) => {
|
|
|
162
171
|
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
163
172
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
164
173
|
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
174
|
+
const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
|
|
175
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
165
176
|
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
177
|
+
const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
|
|
178
|
+
const containerRef = useRef<any>()
|
|
166
179
|
const cardsMethods = ['credomatic']
|
|
167
180
|
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
168
181
|
const placeSpotTypes = [3, 4, 5]
|
|
169
182
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
170
|
-
const isGiftCardCart = !cart?.business_id
|
|
171
183
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
172
184
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
173
185
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
@@ -191,15 +203,21 @@ const CheckoutUI = (props: any) => {
|
|
|
191
203
|
}, cart?.subtotal)
|
|
192
204
|
|
|
193
205
|
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
206
|
+
const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
|
|
207
|
+
validationFields?.fields?.card?.zipcode?.required &&
|
|
208
|
+
paymethodSelected?.data?.card &&
|
|
209
|
+
!paymethodSelected?.data?.card?.zipcode &&
|
|
210
|
+
paymethodSelected?.gateway === 'stripe'
|
|
194
211
|
|
|
195
212
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
196
213
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
197
214
|
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
198
|
-
(options.type === 1 &&
|
|
215
|
+
(options.type === 1 && !isGiftCardCart &&
|
|
199
216
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
200
217
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
201
218
|
(Number(cart?.driver_tip) <= 0)) ||
|
|
202
|
-
(validateCommentsCartField)
|
|
219
|
+
(validateCommentsCartField) ||
|
|
220
|
+
(validateZipcodeCard)
|
|
203
221
|
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
204
222
|
|
|
205
223
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
@@ -324,6 +342,10 @@ const CheckoutUI = (props: any) => {
|
|
|
324
342
|
setPhoneUpdate(val)
|
|
325
343
|
}
|
|
326
344
|
|
|
345
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
346
|
+
setShowTitle(contentOffset.y > 30)
|
|
347
|
+
}
|
|
348
|
+
|
|
327
349
|
useEffect(() => {
|
|
328
350
|
if (validationFields && validationFields?.fields?.checkout) {
|
|
329
351
|
checkValidationFields()
|
|
@@ -339,13 +361,23 @@ const CheckoutUI = (props: any) => {
|
|
|
339
361
|
|
|
340
362
|
useEffect(() => {
|
|
341
363
|
if (cart?.products?.length === 0) {
|
|
342
|
-
if (cart?.
|
|
364
|
+
if (cart?.business_id !== null) {
|
|
343
365
|
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
|
|
344
|
-
} else {
|
|
366
|
+
} else if (isGiftCardCart) {
|
|
345
367
|
onNavigationRedirect('Wallets')
|
|
346
368
|
}
|
|
347
369
|
}
|
|
348
|
-
}, [cart?.products])
|
|
370
|
+
}, [cart?.products?.length])
|
|
371
|
+
|
|
372
|
+
useEffect(() => {
|
|
373
|
+
if (cart?.products?.length > 0) {
|
|
374
|
+
if (cart?.uuid && cart?.business_id === null) {
|
|
375
|
+
setIsGiftCardCart(true)
|
|
376
|
+
} else {
|
|
377
|
+
setIsGiftCardCart(false)
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}, [cart?.uuid, cart?.products?.length])
|
|
349
381
|
|
|
350
382
|
useEffect(() => {
|
|
351
383
|
onFailPaypal()
|
|
@@ -385,6 +417,7 @@ const CheckoutUI = (props: any) => {
|
|
|
385
417
|
}, [])
|
|
386
418
|
|
|
387
419
|
useEffect(() => {
|
|
420
|
+
if (!isFocused) return
|
|
388
421
|
if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
|
|
389
422
|
const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
|
|
390
423
|
if (error) {
|
|
@@ -392,13 +425,61 @@ const CheckoutUI = (props: any) => {
|
|
|
392
425
|
navigation.navigate('BusinessList')
|
|
393
426
|
}
|
|
394
427
|
}
|
|
395
|
-
}, [cartState?.error, cartState?.cart, cartState?.loading])
|
|
428
|
+
}, [cartState?.error, cartState?.cart, cartState?.loading, isFocused])
|
|
429
|
+
|
|
430
|
+
useEffect(() => {
|
|
431
|
+
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
432
|
+
containerRef?.current?.scrollToEnd && containerRef.current.scrollToEnd({ animated: true })
|
|
433
|
+
})
|
|
434
|
+
return () => {
|
|
435
|
+
keyboardDidShowListener.remove()
|
|
436
|
+
}
|
|
437
|
+
}, [])
|
|
438
|
+
|
|
439
|
+
useEffect(() => {
|
|
440
|
+
const onBackFunction = () => {
|
|
441
|
+
if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
|
|
442
|
+
setShowGateway({ open: false, closedByUser: true })
|
|
443
|
+
return true
|
|
444
|
+
} else {
|
|
445
|
+
return false
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
BackHandler.addEventListener('hardwareBackPress', onBackFunction)
|
|
449
|
+
return () => {
|
|
450
|
+
BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
|
|
451
|
+
}
|
|
452
|
+
}, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
|
|
396
453
|
|
|
397
454
|
return (
|
|
398
455
|
<>
|
|
399
|
-
<
|
|
456
|
+
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
457
|
+
<View style={styles.wrapperNavbar}>
|
|
458
|
+
<TopHeader>
|
|
459
|
+
<TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
|
|
460
|
+
<IconAntDesign
|
|
461
|
+
name='arrowleft'
|
|
462
|
+
size={26}
|
|
463
|
+
/>
|
|
464
|
+
</TopActions>
|
|
465
|
+
{showTitle && (
|
|
466
|
+
<OText
|
|
467
|
+
size={16}
|
|
468
|
+
style={{ flex: 1, textAlign: 'center', right: 15 }}
|
|
469
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
470
|
+
numberOfLines={2}
|
|
471
|
+
ellipsizeMode='tail'
|
|
472
|
+
>
|
|
473
|
+
{t('CHECKOUT', 'Checkout')}
|
|
474
|
+
</OText>
|
|
475
|
+
)}
|
|
476
|
+
</TopHeader>
|
|
477
|
+
</View>
|
|
478
|
+
</SafeAreaView>
|
|
479
|
+
<Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
|
|
400
480
|
<View style={styles.wrapperNavbar}>
|
|
401
481
|
<NavBar
|
|
482
|
+
hideArrowLeft
|
|
402
483
|
title={t('CHECKOUT', 'Checkout')}
|
|
403
484
|
titleAlign={'center'}
|
|
404
485
|
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
@@ -410,44 +491,46 @@ const CheckoutUI = (props: any) => {
|
|
|
410
491
|
/>
|
|
411
492
|
</View>
|
|
412
493
|
<ChContainer style={styles.pagePadding}>
|
|
413
|
-
|
|
414
|
-
<
|
|
415
|
-
<
|
|
416
|
-
<
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
src={theme.images.general.arrow_down}
|
|
426
|
-
width={10}
|
|
427
|
-
style={{ marginStart: 8 }}
|
|
428
|
-
{...(isChewLayout && { color: 'white' })}
|
|
429
|
-
/>
|
|
430
|
-
</CHMomentWrapper>
|
|
431
|
-
<CHMomentWrapper
|
|
432
|
-
onPress={() => handleMomentClick()}
|
|
433
|
-
disabled={loading}
|
|
434
|
-
>
|
|
435
|
-
<OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
|
|
436
|
-
{options?.moment
|
|
437
|
-
? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
438
|
-
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
439
|
-
</OText>
|
|
440
|
-
{isPreOrder && (
|
|
494
|
+
{!isGiftCardCart && (
|
|
495
|
+
<ChSection style={{ paddingTop: 0 }}>
|
|
496
|
+
<ChHeader>
|
|
497
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
498
|
+
<OText
|
|
499
|
+
size={12}
|
|
500
|
+
numberOfLines={1}
|
|
501
|
+
ellipsizeMode={'tail'}
|
|
502
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
503
|
+
>
|
|
504
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
505
|
+
</OText>
|
|
441
506
|
<OIcon
|
|
442
507
|
src={theme.images.general.arrow_down}
|
|
443
508
|
width={10}
|
|
444
509
|
style={{ marginStart: 8 }}
|
|
510
|
+
{...(isChewLayout && { color: 'white' })}
|
|
445
511
|
/>
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
512
|
+
</CHMomentWrapper>
|
|
513
|
+
<CHMomentWrapper
|
|
514
|
+
onPress={() => handleMomentClick()}
|
|
515
|
+
disabled={loading}
|
|
516
|
+
>
|
|
517
|
+
<OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
|
|
518
|
+
{options?.moment
|
|
519
|
+
? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
520
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
521
|
+
</OText>
|
|
522
|
+
{isPreOrder && (
|
|
523
|
+
<OIcon
|
|
524
|
+
src={theme.images.general.arrow_down}
|
|
525
|
+
width={10}
|
|
526
|
+
style={{ marginStart: 8 }}
|
|
527
|
+
/>
|
|
528
|
+
)}
|
|
529
|
+
</CHMomentWrapper>
|
|
530
|
+
</ChHeader>
|
|
531
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
532
|
+
</ChSection>
|
|
533
|
+
)}
|
|
451
534
|
|
|
452
535
|
{!isGiftCardCart && !hideBusinessDetails && (
|
|
453
536
|
<ChSection>
|
|
@@ -537,13 +620,15 @@ const CheckoutUI = (props: any) => {
|
|
|
537
620
|
<OButton
|
|
538
621
|
text={t('SIGN_UP', 'Sign up')}
|
|
539
622
|
textStyle={{ color: theme.colors.white }}
|
|
623
|
+
bgColor={theme.colors.primary}
|
|
624
|
+
borderColor={theme.colors.primary}
|
|
540
625
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
541
626
|
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
542
627
|
/>
|
|
543
628
|
<OButton
|
|
544
629
|
text={t('LOGIN', 'Login')}
|
|
545
|
-
textStyle={{ color: theme.colors.
|
|
546
|
-
bgColor={theme.colors.
|
|
630
|
+
textStyle={{ color: theme.colors.white }}
|
|
631
|
+
bgColor={theme.colors.primary}
|
|
547
632
|
borderColor={theme.colors.primary}
|
|
548
633
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
549
634
|
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
@@ -688,7 +773,7 @@ const CheckoutUI = (props: any) => {
|
|
|
688
773
|
cart?.status !== 2 &&
|
|
689
774
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
690
775
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
691
|
-
|
|
776
|
+
cart?.business_id &&
|
|
692
777
|
(
|
|
693
778
|
<ChSection>
|
|
694
779
|
<ChDriverTips>
|
|
@@ -736,12 +821,18 @@ const CheckoutUI = (props: any) => {
|
|
|
736
821
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
737
822
|
handlePlaceOrder={handlePlaceOrder}
|
|
738
823
|
merchantId={merchantId}
|
|
824
|
+
urlscheme={urlscheme}
|
|
825
|
+
androidAppId={androidAppId}
|
|
739
826
|
setMethodPaySupported={setMethodPaySupported}
|
|
740
827
|
methodPaySupported={methodPaySupported}
|
|
741
828
|
placeByMethodPay={placeByMethodPay}
|
|
742
829
|
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
743
830
|
cardList={cardList}
|
|
744
831
|
setCardList={setCardList}
|
|
832
|
+
requiredFields={requiredFields}
|
|
833
|
+
openUserModal={setIsOpen}
|
|
834
|
+
paymethodClicked={paymethodClicked}
|
|
835
|
+
setPaymethodClicked={setPaymethodClicked}
|
|
745
836
|
/>
|
|
746
837
|
</ChPaymethods>
|
|
747
838
|
</ChSection>
|
|
@@ -777,7 +868,7 @@ const CheckoutUI = (props: any) => {
|
|
|
777
868
|
{!cartState.loading && cart && (
|
|
778
869
|
<ChSection>
|
|
779
870
|
<ChCart>
|
|
780
|
-
{cartsWithProducts && cart?.products?.length === 0 ? (
|
|
871
|
+
{cartsWithProducts?.length > 0 && cart?.products?.length === 0 ? (
|
|
781
872
|
<NotFoundSource
|
|
782
873
|
content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
|
|
783
874
|
btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
|
|
@@ -855,13 +946,15 @@ const CheckoutUI = (props: any) => {
|
|
|
855
946
|
</OText>
|
|
856
947
|
)}
|
|
857
948
|
|
|
858
|
-
{!cart?.valid_products && cart?.status !== 2 && (
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
949
|
+
{!cart?.valid_products && cart?.status !== 2 && cart?.total !== 0 && (
|
|
950
|
+
<>
|
|
951
|
+
<OText
|
|
952
|
+
color={theme.colors.error}
|
|
953
|
+
size={12}
|
|
954
|
+
>
|
|
955
|
+
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
956
|
+
</OText>
|
|
957
|
+
</>
|
|
865
958
|
)}
|
|
866
959
|
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
867
960
|
<OText
|
|
@@ -871,7 +964,7 @@ const CheckoutUI = (props: any) => {
|
|
|
871
964
|
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
872
965
|
</OText>
|
|
873
966
|
)}
|
|
874
|
-
{options.type === 1 &&
|
|
967
|
+
{options.type === 1 && !isGiftCardCart &&
|
|
875
968
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
876
969
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
877
970
|
(Number(cart?.driver_tip) <= 0) && (
|
|
@@ -891,6 +984,15 @@ const CheckoutUI = (props: any) => {
|
|
|
891
984
|
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
892
985
|
</OText>
|
|
893
986
|
)}
|
|
987
|
+
|
|
988
|
+
{validateZipcodeCard && (
|
|
989
|
+
<OText
|
|
990
|
+
color={theme.colors.error}
|
|
991
|
+
size={12}
|
|
992
|
+
>
|
|
993
|
+
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
994
|
+
</OText>
|
|
995
|
+
)}
|
|
894
996
|
</ChErrors>
|
|
895
997
|
</View>
|
|
896
998
|
)}
|
|
@@ -926,7 +1028,14 @@ const CheckoutUI = (props: any) => {
|
|
|
926
1028
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
927
1029
|
onClose={() => {
|
|
928
1030
|
setIsOpen(false)
|
|
929
|
-
|
|
1031
|
+
if (paymethodClicked) {
|
|
1032
|
+
setPaymethodClicked({
|
|
1033
|
+
...paymethodClicked,
|
|
1034
|
+
confirmed: true
|
|
1035
|
+
})
|
|
1036
|
+
} else {
|
|
1037
|
+
handlePlaceOrder(null, true)
|
|
1038
|
+
}
|
|
930
1039
|
}}
|
|
931
1040
|
setIsOpen={setIsOpen}
|
|
932
1041
|
/>
|
|
@@ -113,3 +113,20 @@ export const CartHeader = styled.View`
|
|
|
113
113
|
justify-content: space-between;
|
|
114
114
|
margin-bottom: 10px;
|
|
115
115
|
`
|
|
116
|
+
|
|
117
|
+
export const TopActions = styled.TouchableOpacity`
|
|
118
|
+
height: 60px;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
min-width: 30px;
|
|
121
|
+
padding-right: 15px;
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
export const TopHeader = styled.View`
|
|
125
|
+
width: 100%;
|
|
126
|
+
flex-direction: row;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: space-between;
|
|
129
|
+
z-index: 1;
|
|
130
|
+
height: 60px;
|
|
131
|
+
min-height: 60px;
|
|
132
|
+
`
|