ordering-ui-react-native 0.19.2-testing → 0.19.3-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 +6 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +2 -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 +41 -13
- package/themes/business/src/components/DriverMap/index.tsx +4 -2
- package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/MapView/index.tsx +11 -7
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +121 -103
- package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +26 -6
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
- package/themes/business/src/components/OrderSummary/index.tsx +27 -13
- 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 +83 -37
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +24 -31
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- 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/StoresList/index.tsx +5 -3
- package/themes/business/src/components/UserProfileForm/index.tsx +27 -10
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/types/index.tsx +10 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
- 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 +7 -3
- package/themes/original/src/components/AddressForm/index.tsx +2 -2
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +4 -7
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +9 -6
- package/themes/original/src/components/BusinessController/styles.tsx +8 -7
- package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
- 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 +56 -361
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +43 -19
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
- 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 +29 -402
- 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 +27 -8
- package/themes/original/src/components/CartContent/index.tsx +61 -39
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +199 -55
- 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 +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/Favorite/index.tsx +4 -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/GPSButton/index.tsx +1 -1
- 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/GoogleMap/index.tsx +50 -5
- 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 +1 -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 +53 -47
- package/themes/original/src/components/LoginForm/index.tsx +6 -1
- package/themes/original/src/components/Messages/index.tsx +9 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +4 -4
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
- package/themes/original/src/components/MultiCheckout/index.tsx +184 -51
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +5 -5
- package/themes/original/src/components/NavBar/index.tsx +3 -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 +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
- package/themes/original/src/components/OrderDetails/index.tsx +716 -667
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderProgress/index.tsx +7 -7
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +5 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -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 +4 -3
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +3 -0
- 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 +41 -32
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +81 -167
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +4 -4
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- 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/SingleOrderCard/index.tsx +4 -3
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +53 -7
- package/themes/original/src/components/StripeElementsForm/index.tsx +1 -1
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- 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 +53 -7
- package/themes/original/src/components/UserProfile/index.tsx +1 -1
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +8 -9
- package/themes/original/src/components/Wallets/styles.tsx +1 -1
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- 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 +10 -2
- package/themes/original/src/utils/index.tsx +124 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useCallback, 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,9 +11,9 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
11
11
|
|
|
12
12
|
export const CartContent = (props: any) => {
|
|
13
13
|
const {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
onNavigationRedirect,
|
|
15
|
+
singleBusiness,
|
|
16
|
+
businessSlug
|
|
17
17
|
} = props
|
|
18
18
|
|
|
19
19
|
const theme = useTheme();
|
|
@@ -21,16 +21,22 @@ export const CartContent = (props: any) => {
|
|
|
21
21
|
const [{ configs }] = useConfig()
|
|
22
22
|
const [{ parsePrice }] = useUtils();
|
|
23
23
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
24
|
-
|
|
25
|
-
const
|
|
24
|
+
const [cartsOpened, setCartsOpened] = useState([])
|
|
25
|
+
const [{ carts: cartsContext }] = useOrder();
|
|
26
|
+
const cartsList =
|
|
27
|
+
(cartsContext &&
|
|
28
|
+
Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
|
|
29
|
+
[];
|
|
30
|
+
const carts = businessSlug
|
|
31
|
+
? cartsList.filter((cart: any) => cart?.business?.slug === businessSlug || parseInt(businessSlug) === cart?.business_id)
|
|
32
|
+
: cartsList
|
|
33
|
+
const isOrderStateCarts = !!carts
|
|
26
34
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
27
|
-
const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
28
|
-
|
|
35
|
+
const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2 && cart?.business_id)
|
|
29
36
|
const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
|
|
30
37
|
const totalCartsFee = cartsAvailable?.length && cartsAvailable
|
|
31
38
|
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
32
39
|
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
33
|
-
|
|
34
40
|
const handleCheckoutRedirect = () => {
|
|
35
41
|
if (cartsAvailable.length === 1) {
|
|
36
42
|
onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -65,9 +71,21 @@ export const CartContent = (props: any) => {
|
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
|
|
74
|
+
const changeActiveState = useCallback((isClosed : boolean, uuid : string) => {
|
|
75
|
+
const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
|
|
76
|
+
if (isActive || !isClosed) {
|
|
77
|
+
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
78
|
+
} else {
|
|
79
|
+
setCartsOpened([
|
|
80
|
+
...cartsOpened,
|
|
81
|
+
uuid
|
|
82
|
+
])
|
|
83
|
+
}
|
|
84
|
+
}, [cartsOpened])
|
|
85
|
+
|
|
68
86
|
return (
|
|
69
87
|
<CCContainer
|
|
70
|
-
style={{ paddingHorizontal:
|
|
88
|
+
style={{ paddingHorizontal: 20 }}
|
|
71
89
|
>
|
|
72
90
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
73
91
|
<>
|
|
@@ -87,8 +105,12 @@ export const CartContent = (props: any) => {
|
|
|
87
105
|
hideUpselling
|
|
88
106
|
businessConfigs={cart?.business?.configs}
|
|
89
107
|
hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
|
|
90
|
-
|
|
108
|
+
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
91
109
|
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
110
|
+
cartsOpened={cartsOpened}
|
|
111
|
+
setCartsOpened={setCartsOpened}
|
|
112
|
+
changeActiveState={changeActiveState}
|
|
113
|
+
isActive={cartsOpened?.includes?.(cart?.uuid) || !!singleBusiness}
|
|
92
114
|
/>
|
|
93
115
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
94
116
|
</>
|
|
@@ -100,32 +122,32 @@ export const CartContent = (props: any) => {
|
|
|
100
122
|
{!!cartsAvailable.length && (
|
|
101
123
|
<ChCartsTotal>
|
|
102
124
|
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
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
|
-
|
|
125
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
126
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
127
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
128
|
+
</OText>
|
|
129
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
130
|
+
{parsePrice(totalCartsFee)}
|
|
131
|
+
</OText>
|
|
132
|
+
</View>
|
|
133
|
+
)}
|
|
134
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
135
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
136
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
137
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
138
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
139
|
+
</OText>
|
|
140
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
141
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
142
|
+
</OText>
|
|
143
|
+
</View>
|
|
144
|
+
)}
|
|
145
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
146
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
147
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
148
|
+
</OText>
|
|
149
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
150
|
+
</View>
|
|
129
151
|
<View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
|
|
130
152
|
<OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
|
|
131
153
|
{t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
|
|
@@ -156,7 +178,7 @@ export const CartContent = (props: any) => {
|
|
|
156
178
|
btnStyle={{ borderRadius: 8 }}
|
|
157
179
|
content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
158
180
|
btnTitle={t('START_SHOPPING', 'Start shopping')}
|
|
159
|
-
onClickButton={() => onNavigationRedirect('BusinessList')}
|
|
181
|
+
onClickButton={() => singleBusiness ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList')}
|
|
160
182
|
/>
|
|
161
183
|
</CCNotCarts>
|
|
162
184
|
)}
|
|
@@ -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,8 +1,11 @@
|
|
|
1
|
-
import React, { useState, useEffect } 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 } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
|
+
import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
|
|
4
5
|
import Picker from 'react-native-country-picker-modal';
|
|
5
6
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
7
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
|
+
|
|
6
9
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
7
10
|
import {
|
|
8
11
|
Checkout as CheckoutController,
|
|
@@ -45,10 +48,11 @@ import {
|
|
|
45
48
|
DeliveryOptionsContainer,
|
|
46
49
|
DeliveryOptionItem,
|
|
47
50
|
WalletPaymentOptionContainer,
|
|
48
|
-
CartHeader
|
|
51
|
+
CartHeader,
|
|
52
|
+
TopHeader,
|
|
53
|
+
TopActions
|
|
49
54
|
} from './styles';
|
|
50
55
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
51
|
-
|
|
52
56
|
import { FloatingButton } from '../FloatingButton';
|
|
53
57
|
import { Container } from '../../layouts/Container';
|
|
54
58
|
import NavBar from '../NavBar';
|
|
@@ -56,6 +60,8 @@ import { OrderSummary } from '../OrderSummary';
|
|
|
56
60
|
import { getTypesText } from '../../utils';
|
|
57
61
|
import { CartStoresListing } from '../CartStoresListing';
|
|
58
62
|
import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
|
|
63
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
64
|
+
const { useDeviceOrientation } = DeviceOrientationMethods
|
|
59
65
|
|
|
60
66
|
const mapConfigs = {
|
|
61
67
|
mapZoom: 16,
|
|
@@ -113,7 +119,7 @@ const CheckoutUI = (props: any) => {
|
|
|
113
119
|
padding: 20
|
|
114
120
|
},
|
|
115
121
|
pagePadding: {
|
|
116
|
-
paddingHorizontal:
|
|
122
|
+
paddingHorizontal: 20
|
|
117
123
|
},
|
|
118
124
|
icon: {
|
|
119
125
|
top: 15,
|
|
@@ -122,13 +128,14 @@ const CheckoutUI = (props: any) => {
|
|
|
122
128
|
fontSize: 20
|
|
123
129
|
},
|
|
124
130
|
detailWrapper: {
|
|
125
|
-
paddingHorizontal:
|
|
131
|
+
paddingHorizontal: 20,
|
|
126
132
|
width: '100%'
|
|
127
133
|
},
|
|
128
134
|
wrapperNavbar: {
|
|
129
|
-
paddingVertical:
|
|
130
|
-
paddingHorizontal:
|
|
131
|
-
|
|
135
|
+
paddingVertical: 2,
|
|
136
|
+
paddingHorizontal: 20,
|
|
137
|
+
backgroundColor: theme?.colors?.white,
|
|
138
|
+
borderWidth: 0
|
|
132
139
|
}
|
|
133
140
|
})
|
|
134
141
|
|
|
@@ -141,6 +148,10 @@ const CheckoutUI = (props: any) => {
|
|
|
141
148
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
142
149
|
const [validationFields] = useValidationFields();
|
|
143
150
|
const [events] = useEvent()
|
|
151
|
+
const [orientationState] = useDeviceOrientation();
|
|
152
|
+
const [isReadMore, setIsReadMore] = useState(false)
|
|
153
|
+
const [lengthMore, setLengthMore] = useState(false)
|
|
154
|
+
const WIDTH_SCREEN = orientationState?.dimensions?.width
|
|
144
155
|
|
|
145
156
|
const [errorCash, setErrorCash] = useState(false);
|
|
146
157
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -148,19 +159,23 @@ const CheckoutUI = (props: any) => {
|
|
|
148
159
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
149
160
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
150
161
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
151
|
-
const [showGateway, setShowGateway] = useState<any>({
|
|
162
|
+
const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
|
|
152
163
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
153
164
|
const [isOpen, setIsOpen] = useState(false)
|
|
154
165
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
155
|
-
const [openModal, setOpenModal] = useState({ login: false, signup: false })
|
|
166
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
156
167
|
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
157
168
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
158
169
|
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
170
|
+
const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
|
|
171
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
159
172
|
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
173
|
+
const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
|
|
174
|
+
const containerRef = useRef<any>()
|
|
160
175
|
const cardsMethods = ['credomatic']
|
|
176
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
161
177
|
const placeSpotTypes = [3, 4, 5]
|
|
162
178
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
163
|
-
const isGiftCardCart = !cart?.business_id
|
|
164
179
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
165
180
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
166
181
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
@@ -184,6 +199,11 @@ const CheckoutUI = (props: any) => {
|
|
|
184
199
|
}, cart?.subtotal)
|
|
185
200
|
|
|
186
201
|
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
202
|
+
const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
|
|
203
|
+
validationFields?.fields?.card?.zipcode?.required &&
|
|
204
|
+
paymethodSelected?.data?.card &&
|
|
205
|
+
!paymethodSelected?.data?.card?.zipcode &&
|
|
206
|
+
paymethodSelected?.gateway === 'stripe'
|
|
187
207
|
|
|
188
208
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
189
209
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
@@ -192,7 +212,8 @@ const CheckoutUI = (props: any) => {
|
|
|
192
212
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
193
213
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
194
214
|
(Number(cart?.driver_tip) <= 0)) ||
|
|
195
|
-
(validateCommentsCartField)
|
|
215
|
+
(validateCommentsCartField) ||
|
|
216
|
+
(validateZipcodeCard)
|
|
196
217
|
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
197
218
|
|
|
198
219
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
@@ -231,7 +252,8 @@ const CheckoutUI = (props: any) => {
|
|
|
231
252
|
user,
|
|
232
253
|
token: user?.session?.access_token
|
|
233
254
|
})
|
|
234
|
-
|
|
255
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
256
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
235
257
|
}
|
|
236
258
|
|
|
237
259
|
const handleSuccessLogin = (user: any) => {
|
|
@@ -239,9 +261,14 @@ const CheckoutUI = (props: any) => {
|
|
|
239
261
|
}
|
|
240
262
|
|
|
241
263
|
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
264
|
+
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
265
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
266
|
+
return
|
|
267
|
+
}
|
|
268
|
+
|
|
242
269
|
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
243
270
|
vibrateApp()
|
|
244
|
-
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment)
|
|
271
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
|
|
245
272
|
return
|
|
246
273
|
}
|
|
247
274
|
if (requiredFields?.length) {
|
|
@@ -311,6 +338,10 @@ const CheckoutUI = (props: any) => {
|
|
|
311
338
|
setPhoneUpdate(val)
|
|
312
339
|
}
|
|
313
340
|
|
|
341
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
342
|
+
setShowTitle(contentOffset.y > 30)
|
|
343
|
+
}
|
|
344
|
+
|
|
314
345
|
useEffect(() => {
|
|
315
346
|
if (validationFields && validationFields?.fields?.checkout) {
|
|
316
347
|
checkValidationFields()
|
|
@@ -326,13 +357,23 @@ const CheckoutUI = (props: any) => {
|
|
|
326
357
|
|
|
327
358
|
useEffect(() => {
|
|
328
359
|
if (cart?.products?.length === 0) {
|
|
329
|
-
if (cart?.
|
|
330
|
-
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
331
|
-
} else {
|
|
360
|
+
if (cart?.business_id !== null) {
|
|
361
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
|
|
362
|
+
} else if (isGiftCardCart) {
|
|
332
363
|
onNavigationRedirect('Wallets')
|
|
333
364
|
}
|
|
334
365
|
}
|
|
335
|
-
}, [cart?.products])
|
|
366
|
+
}, [cart?.products?.length])
|
|
367
|
+
|
|
368
|
+
useEffect(() => {
|
|
369
|
+
if (cart?.products?.length > 0) {
|
|
370
|
+
if (cart?.uuid && cart?.business_id === null) {
|
|
371
|
+
setIsGiftCardCart(true)
|
|
372
|
+
} else {
|
|
373
|
+
setIsGiftCardCart(false)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}, [cart?.uuid, cart?.products?.length])
|
|
336
377
|
|
|
337
378
|
useEffect(() => {
|
|
338
379
|
onFailPaypal()
|
|
@@ -367,11 +408,73 @@ const CheckoutUI = (props: any) => {
|
|
|
367
408
|
}
|
|
368
409
|
}, [cart?.paymethod_data])
|
|
369
410
|
|
|
411
|
+
const onTextLayout = useCallback((e: any) => {
|
|
412
|
+
setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
|
|
413
|
+
}, [])
|
|
414
|
+
|
|
415
|
+
useEffect(() => {
|
|
416
|
+
if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
|
|
417
|
+
const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
|
|
418
|
+
if (error) {
|
|
419
|
+
showToast(ToastType.Error, cartState?.error || cartState.cart)
|
|
420
|
+
navigation.navigate('BusinessList')
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}, [cartState?.error, cartState?.cart, cartState?.loading])
|
|
424
|
+
|
|
425
|
+
useEffect(() => {
|
|
426
|
+
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
427
|
+
containerRef?.current?.scrollToEnd && containerRef.current.scrollToEnd({ animated: true })
|
|
428
|
+
})
|
|
429
|
+
return () => {
|
|
430
|
+
keyboardDidShowListener.remove()
|
|
431
|
+
}
|
|
432
|
+
}, [])
|
|
433
|
+
|
|
434
|
+
useEffect(() => {
|
|
435
|
+
const onBackFunction = () => {
|
|
436
|
+
if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
|
|
437
|
+
setShowGateway({ open: false, closedByUser: true })
|
|
438
|
+
return true
|
|
439
|
+
} else {
|
|
440
|
+
return false
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
BackHandler.addEventListener('hardwareBackPress', onBackFunction)
|
|
444
|
+
return () => {
|
|
445
|
+
BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
|
|
446
|
+
}
|
|
447
|
+
}, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
|
|
448
|
+
|
|
370
449
|
return (
|
|
371
450
|
<>
|
|
372
|
-
<
|
|
451
|
+
<View style={styles.wrapperNavbar}>
|
|
452
|
+
<TopHeader>
|
|
453
|
+
<>
|
|
454
|
+
<TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
|
|
455
|
+
<IconAntDesign
|
|
456
|
+
name='arrowleft'
|
|
457
|
+
size={26}
|
|
458
|
+
/>
|
|
459
|
+
</TopActions>
|
|
460
|
+
{showTitle && (
|
|
461
|
+
<OText
|
|
462
|
+
size={16}
|
|
463
|
+
style={{ flex: 1, textAlign: 'center', right: 15 }}
|
|
464
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
465
|
+
numberOfLines={2}
|
|
466
|
+
ellipsizeMode='tail'
|
|
467
|
+
>
|
|
468
|
+
{t('CHECKOUT', 'Checkout')}
|
|
469
|
+
</OText>
|
|
470
|
+
)}
|
|
471
|
+
</>
|
|
472
|
+
</TopHeader>
|
|
473
|
+
</View>
|
|
474
|
+
<Container forwardRef={containerRef} noPadding onScroll={handleScroll}>
|
|
373
475
|
<View style={styles.wrapperNavbar}>
|
|
374
476
|
<NavBar
|
|
477
|
+
hideArrowLeft
|
|
375
478
|
title={t('CHECKOUT', 'Checkout')}
|
|
376
479
|
titleAlign={'center'}
|
|
377
480
|
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
@@ -383,44 +486,46 @@ const CheckoutUI = (props: any) => {
|
|
|
383
486
|
/>
|
|
384
487
|
</View>
|
|
385
488
|
<ChContainer style={styles.pagePadding}>
|
|
386
|
-
|
|
387
|
-
<
|
|
388
|
-
<
|
|
389
|
-
<
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
src={theme.images.general.arrow_down}
|
|
399
|
-
width={10}
|
|
400
|
-
style={{ marginStart: 8 }}
|
|
401
|
-
{...(isChewLayout && { color: 'white' })}
|
|
402
|
-
/>
|
|
403
|
-
</CHMomentWrapper>
|
|
404
|
-
<CHMomentWrapper
|
|
405
|
-
onPress={() => handleMomentClick()}
|
|
406
|
-
disabled={loading}
|
|
407
|
-
>
|
|
408
|
-
<OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
|
|
409
|
-
{options?.moment
|
|
410
|
-
? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
411
|
-
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
412
|
-
</OText>
|
|
413
|
-
{isPreOrder && (
|
|
489
|
+
{!isGiftCardCart && (
|
|
490
|
+
<ChSection style={{ paddingTop: 0 }}>
|
|
491
|
+
<ChHeader>
|
|
492
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
493
|
+
<OText
|
|
494
|
+
size={12}
|
|
495
|
+
numberOfLines={1}
|
|
496
|
+
ellipsizeMode={'tail'}
|
|
497
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
498
|
+
>
|
|
499
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
500
|
+
</OText>
|
|
414
501
|
<OIcon
|
|
415
502
|
src={theme.images.general.arrow_down}
|
|
416
503
|
width={10}
|
|
417
504
|
style={{ marginStart: 8 }}
|
|
505
|
+
{...(isChewLayout && { color: 'white' })}
|
|
418
506
|
/>
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
507
|
+
</CHMomentWrapper>
|
|
508
|
+
<CHMomentWrapper
|
|
509
|
+
onPress={() => handleMomentClick()}
|
|
510
|
+
disabled={loading}
|
|
511
|
+
>
|
|
512
|
+
<OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
|
|
513
|
+
{options?.moment
|
|
514
|
+
? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
515
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
516
|
+
</OText>
|
|
517
|
+
{isPreOrder && (
|
|
518
|
+
<OIcon
|
|
519
|
+
src={theme.images.general.arrow_down}
|
|
520
|
+
width={10}
|
|
521
|
+
style={{ marginStart: 8 }}
|
|
522
|
+
/>
|
|
523
|
+
)}
|
|
524
|
+
</CHMomentWrapper>
|
|
525
|
+
</ChHeader>
|
|
526
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
527
|
+
</ChSection>
|
|
528
|
+
)}
|
|
424
529
|
|
|
425
530
|
{!isGiftCardCart && !hideBusinessDetails && (
|
|
426
531
|
<ChSection>
|
|
@@ -458,6 +563,25 @@ const CheckoutUI = (props: any) => {
|
|
|
458
563
|
{businessDetails?.business?.address}
|
|
459
564
|
</OText>
|
|
460
565
|
)}
|
|
566
|
+
{businessDetails?.business?.address_notes && (
|
|
567
|
+
<>
|
|
568
|
+
<OText
|
|
569
|
+
size={12}
|
|
570
|
+
lineHeight={18}
|
|
571
|
+
numberOfLines={isReadMore ? 20 : 3}
|
|
572
|
+
onTextLayout={onTextLayout}
|
|
573
|
+
>
|
|
574
|
+
{businessDetails?.business?.address_notes}
|
|
575
|
+
</OText>
|
|
576
|
+
{lengthMore && (
|
|
577
|
+
<TouchableOpacity
|
|
578
|
+
onPress={() => setIsReadMore(!isReadMore)}
|
|
579
|
+
>
|
|
580
|
+
<OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
581
|
+
</TouchableOpacity>
|
|
582
|
+
)}
|
|
583
|
+
</>
|
|
584
|
+
)}
|
|
461
585
|
</View>
|
|
462
586
|
</>
|
|
463
587
|
)}
|
|
@@ -696,6 +820,10 @@ const CheckoutUI = (props: any) => {
|
|
|
696
820
|
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
697
821
|
cardList={cardList}
|
|
698
822
|
setCardList={setCardList}
|
|
823
|
+
requiredFields={requiredFields}
|
|
824
|
+
openUserModal={setIsOpen}
|
|
825
|
+
paymethodClicked={paymethodClicked}
|
|
826
|
+
setPaymethodClicked={setPaymethodClicked}
|
|
699
827
|
/>
|
|
700
828
|
</ChPaymethods>
|
|
701
829
|
</ChSection>
|
|
@@ -845,6 +973,15 @@ const CheckoutUI = (props: any) => {
|
|
|
845
973
|
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
846
974
|
</OText>
|
|
847
975
|
)}
|
|
976
|
+
|
|
977
|
+
{validateZipcodeCard && (
|
|
978
|
+
<OText
|
|
979
|
+
color={theme.colors.error}
|
|
980
|
+
size={12}
|
|
981
|
+
>
|
|
982
|
+
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
983
|
+
</OText>
|
|
984
|
+
)}
|
|
848
985
|
</ChErrors>
|
|
849
986
|
</View>
|
|
850
987
|
)}
|
|
@@ -880,7 +1017,14 @@ const CheckoutUI = (props: any) => {
|
|
|
880
1017
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
881
1018
|
onClose={() => {
|
|
882
1019
|
setIsOpen(false)
|
|
883
|
-
|
|
1020
|
+
if (paymethodClicked) {
|
|
1021
|
+
setPaymethodClicked({
|
|
1022
|
+
...paymethodClicked,
|
|
1023
|
+
confirmed: true
|
|
1024
|
+
})
|
|
1025
|
+
} else {
|
|
1026
|
+
handlePlaceOrder(null, true)
|
|
1027
|
+
}
|
|
884
1028
|
}}
|
|
885
1029
|
setIsOpen={setIsOpen}
|
|
886
1030
|
/>
|
|
@@ -888,7 +1032,7 @@ const CheckoutUI = (props: any) => {
|
|
|
888
1032
|
</OModal>
|
|
889
1033
|
<OModal
|
|
890
1034
|
open={openModal.signup}
|
|
891
|
-
onClose={() => setOpenModal({ ...openModal, signup: false })}
|
|
1035
|
+
onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
|
|
892
1036
|
>
|
|
893
1037
|
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
894
1038
|
<SignupForm
|
|
@@ -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
|
+
`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DatePicker from 'react-native-date-picker'
|
|
3
|
+
import { DateContainer } from './styles';
|
|
4
|
+
|
|
5
|
+
export const DatePickerUI = (props: any) => {
|
|
6
|
+
const {
|
|
7
|
+
birthdate,
|
|
8
|
+
handleChangeDate
|
|
9
|
+
} = props;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<DateContainer>
|
|
13
|
+
<DatePicker mode="date" date={birthdate ? new Date(birthdate) : new Date()} onDateChange={handleChangeDate} />
|
|
14
|
+
</DateContainer>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const DateContainer = styled.View`
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin-bottom: 20px;
|
|
7
|
+
|
|
8
|
+
input {
|
|
9
|
+
border-radius: 20px;
|
|
10
|
+
width: 140px;
|
|
11
|
+
outline: none;
|
|
12
|
+
padding: 10px 15px;
|
|
13
|
+
border: 1px solid #E9ECEF;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.react-datepicker__triangle {
|
|
17
|
+
transform: translate(40px, 0px) !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
`
|