ordering-ui-react-native 0.18.2 → 0.18.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 +9 -7
- 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/OrderCreating/index.tsx +0 -20
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- 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 +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- 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 +43 -32
- 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 +21 -29
- 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 +193 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +6 -5
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- 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/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +8 -0
- package/themes/business/src/utils/index.tsx +4 -4
- 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/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
- 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/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- 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 +133 -438
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- 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 +37 -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 +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- 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/DriverTips/index.tsx +6 -3
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- 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 +7 -5
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +14 -5
- 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 +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -10
- 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 +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- 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/NotFoundSource/index.tsx +14 -10
- 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/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- 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/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -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 +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- 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 +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- 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 +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- 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/index.tsx +16 -7
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- 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/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- 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 +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +15 -17
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -13
- 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,8 +1,12 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager,
|
|
1
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard } 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
|
+
|
|
9
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
6
10
|
import {
|
|
7
11
|
Checkout as CheckoutController,
|
|
8
12
|
useOrder,
|
|
@@ -14,9 +18,10 @@ import {
|
|
|
14
18
|
useConfig,
|
|
15
19
|
useToast,
|
|
16
20
|
ToastType,
|
|
21
|
+
useEvent
|
|
17
22
|
} from 'ordering-components/native';
|
|
18
23
|
import { useTheme } from 'styled-components/native';
|
|
19
|
-
import { OText, OIcon, OModal } from '../shared';
|
|
24
|
+
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
20
25
|
|
|
21
26
|
import { AddressDetails } from '../AddressDetails';
|
|
22
27
|
import { PaymentOptions } from '../PaymentOptions';
|
|
@@ -25,6 +30,8 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
25
30
|
import { UserDetails } from '../UserDetails';
|
|
26
31
|
import { PaymentOptionWallet } from '../PaymentOptionWallet';
|
|
27
32
|
import { PlaceSpot } from '../PlaceSpot'
|
|
33
|
+
import { SignupForm } from '../SignupForm'
|
|
34
|
+
import { LoginForm } from '../LoginForm'
|
|
28
35
|
|
|
29
36
|
import {
|
|
30
37
|
ChContainer,
|
|
@@ -41,10 +48,11 @@ import {
|
|
|
41
48
|
DeliveryOptionsContainer,
|
|
42
49
|
DeliveryOptionItem,
|
|
43
50
|
WalletPaymentOptionContainer,
|
|
44
|
-
CartHeader
|
|
51
|
+
CartHeader,
|
|
52
|
+
TopHeader,
|
|
53
|
+
TopActions
|
|
45
54
|
} from './styles';
|
|
46
55
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
47
|
-
|
|
48
56
|
import { FloatingButton } from '../FloatingButton';
|
|
49
57
|
import { Container } from '../../layouts/Container';
|
|
50
58
|
import NavBar from '../NavBar';
|
|
@@ -52,6 +60,8 @@ import { OrderSummary } from '../OrderSummary';
|
|
|
52
60
|
import { getTypesText } from '../../utils';
|
|
53
61
|
import { CartStoresListing } from '../CartStoresListing';
|
|
54
62
|
import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
|
|
63
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
64
|
+
const { useDeviceOrientation } = DeviceOrientationMethods
|
|
55
65
|
|
|
56
66
|
const mapConfigs = {
|
|
57
67
|
mapZoom: 16,
|
|
@@ -78,6 +88,7 @@ const CheckoutUI = (props: any) => {
|
|
|
78
88
|
placing,
|
|
79
89
|
cartState,
|
|
80
90
|
cartUuid,
|
|
91
|
+
loyaltyPlansState,
|
|
81
92
|
businessDetails,
|
|
82
93
|
paymethodSelected,
|
|
83
94
|
handlePaymethodChange,
|
|
@@ -108,7 +119,7 @@ const CheckoutUI = (props: any) => {
|
|
|
108
119
|
padding: 20
|
|
109
120
|
},
|
|
110
121
|
pagePadding: {
|
|
111
|
-
paddingHorizontal:
|
|
122
|
+
paddingHorizontal: 20
|
|
112
123
|
},
|
|
113
124
|
icon: {
|
|
114
125
|
top: 15,
|
|
@@ -117,24 +128,30 @@ const CheckoutUI = (props: any) => {
|
|
|
117
128
|
fontSize: 20
|
|
118
129
|
},
|
|
119
130
|
detailWrapper: {
|
|
120
|
-
paddingHorizontal:
|
|
131
|
+
paddingHorizontal: 20,
|
|
121
132
|
width: '100%'
|
|
122
133
|
},
|
|
123
134
|
wrapperNavbar: {
|
|
124
|
-
paddingVertical:
|
|
125
|
-
paddingHorizontal:
|
|
126
|
-
|
|
135
|
+
paddingVertical: 2,
|
|
136
|
+
paddingHorizontal: 20,
|
|
137
|
+
backgroundColor: theme?.colors?.white,
|
|
138
|
+
borderWidth: 0
|
|
127
139
|
}
|
|
128
140
|
})
|
|
129
141
|
|
|
130
142
|
const [, { showToast }] = useToast();
|
|
131
143
|
const [, t] = useLanguage();
|
|
132
|
-
const [{ user, token }] = useSession();
|
|
144
|
+
const [{ user, token }, { login }] = useSession();
|
|
133
145
|
const [ordering] = useApi()
|
|
134
146
|
const [{ configs }] = useConfig();
|
|
135
147
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
136
148
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
137
149
|
const [validationFields] = useValidationFields();
|
|
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
|
|
138
155
|
|
|
139
156
|
const [errorCash, setErrorCash] = useState(false);
|
|
140
157
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -146,7 +163,16 @@ const CheckoutUI = (props: any) => {
|
|
|
146
163
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
147
164
|
const [isOpen, setIsOpen] = useState(false)
|
|
148
165
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
149
|
-
|
|
166
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
167
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
168
|
+
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
169
|
+
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
170
|
+
const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
|
|
171
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
172
|
+
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
173
|
+
const containerRef = useRef<any>()
|
|
174
|
+
const cardsMethods = ['credomatic']
|
|
175
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
150
176
|
const placeSpotTypes = [3, 4, 5]
|
|
151
177
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
152
178
|
const isGiftCardCart = !cart?.business_id
|
|
@@ -161,18 +187,34 @@ const CheckoutUI = (props: any) => {
|
|
|
161
187
|
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
162
188
|
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
163
189
|
|
|
190
|
+
const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
191
|
+
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
|
|
192
|
+
const methodsPay = ['google_pay', 'apple_pay']
|
|
193
|
+
|
|
164
194
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
165
195
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
166
196
|
if (item?.type === 1)
|
|
167
197
|
return acc = acc + item?.summary?.tax
|
|
168
198
|
return acc = acc
|
|
169
199
|
}, cart?.subtotal)
|
|
200
|
+
|
|
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'
|
|
207
|
+
|
|
170
208
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
171
209
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
210
|
+
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
172
211
|
(options.type === 1 &&
|
|
173
212
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
174
213
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
175
|
-
(Number(cart?.driver_tip) <= 0))
|
|
214
|
+
(Number(cart?.driver_tip) <= 0)) ||
|
|
215
|
+
(validateCommentsCartField) ||
|
|
216
|
+
(validateZipcodeCard)
|
|
217
|
+
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
176
218
|
|
|
177
219
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
178
220
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -182,6 +224,9 @@ const CheckoutUI = (props: any) => {
|
|
|
182
224
|
|
|
183
225
|
const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
|
|
184
226
|
|
|
227
|
+
const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
|
|
228
|
+
const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
|
|
229
|
+
const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
|
|
185
230
|
const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
|
|
186
231
|
return {
|
|
187
232
|
value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
|
|
@@ -194,10 +239,36 @@ const CheckoutUI = (props: any) => {
|
|
|
194
239
|
}
|
|
195
240
|
}
|
|
196
241
|
|
|
242
|
+
const vibrateApp = (impact?: string) => {
|
|
243
|
+
const options = {
|
|
244
|
+
enableVibrateFallback: true,
|
|
245
|
+
ignoreAndroidSystemSettings: false
|
|
246
|
+
};
|
|
247
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const handleSuccessSignup = (user: any) => {
|
|
251
|
+
login({
|
|
252
|
+
user,
|
|
253
|
+
token: user?.session?.access_token
|
|
254
|
+
})
|
|
255
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
256
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const handleSuccessLogin = (user: any) => {
|
|
260
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
261
|
+
}
|
|
262
|
+
|
|
197
263
|
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
|
|
264
|
+
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
265
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
266
|
+
return
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
270
|
+
vibrateApp()
|
|
271
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
|
|
201
272
|
return
|
|
202
273
|
}
|
|
203
274
|
if (requiredFields?.length) {
|
|
@@ -213,9 +284,9 @@ const CheckoutUI = (props: any) => {
|
|
|
213
284
|
}
|
|
214
285
|
|
|
215
286
|
const handlePlaceOrderAsGuest = () => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
287
|
+
setIsOpen(false)
|
|
288
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
289
|
+
}
|
|
219
290
|
|
|
220
291
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
221
292
|
setShowGateway({ closedByUser: false, open: true })
|
|
@@ -235,7 +306,7 @@ const CheckoutUI = (props: any) => {
|
|
|
235
306
|
const checkValidationFields = () => {
|
|
236
307
|
setUserErrors([])
|
|
237
308
|
const errors = []
|
|
238
|
-
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
|
|
309
|
+
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
239
310
|
const _requiredFields: any = []
|
|
240
311
|
|
|
241
312
|
Object.values(validationFields?.fields?.checkout).map((field: any) => {
|
|
@@ -267,6 +338,10 @@ const CheckoutUI = (props: any) => {
|
|
|
267
338
|
setPhoneUpdate(val)
|
|
268
339
|
}
|
|
269
340
|
|
|
341
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
342
|
+
setShowTitle(contentOffset.y > 30)
|
|
343
|
+
}
|
|
344
|
+
|
|
270
345
|
useEffect(() => {
|
|
271
346
|
if (validationFields && validationFields?.fields?.checkout) {
|
|
272
347
|
checkValidationFields()
|
|
@@ -282,8 +357,8 @@ const CheckoutUI = (props: any) => {
|
|
|
282
357
|
|
|
283
358
|
useEffect(() => {
|
|
284
359
|
if (cart?.products?.length === 0) {
|
|
285
|
-
if (cart?.
|
|
286
|
-
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
360
|
+
if (cart?.business_id !== null) {
|
|
361
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
|
|
287
362
|
} else {
|
|
288
363
|
onNavigationRedirect('Wallets')
|
|
289
364
|
}
|
|
@@ -309,18 +384,80 @@ const CheckoutUI = (props: any) => {
|
|
|
309
384
|
)
|
|
310
385
|
}
|
|
311
386
|
|
|
387
|
+
useEffect(() => {
|
|
388
|
+
cart && events.emit('checkout_started', cart)
|
|
389
|
+
}, [])
|
|
390
|
+
|
|
391
|
+
useEffect(() => {
|
|
392
|
+
if (cart?.paymethod_data?.gateway === 'credomatic') {
|
|
393
|
+
if (cart?.paymethod_data?.status === 2) {
|
|
394
|
+
setShowGateway({ ...showGateway, open: true })
|
|
395
|
+
} else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
|
|
396
|
+
setShowGateway({ ...showGateway, open: false })
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}, [cart?.paymethod_data])
|
|
400
|
+
|
|
401
|
+
const onTextLayout = useCallback((e: any) => {
|
|
402
|
+
setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
|
|
403
|
+
}, [])
|
|
404
|
+
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
|
|
407
|
+
const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
|
|
408
|
+
if (error) {
|
|
409
|
+
showToast(ToastType.Error, cartState?.error || cartState.cart)
|
|
410
|
+
navigation.navigate('BusinessList')
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}, [cartState?.error, cartState?.cart, cartState?.loading])
|
|
414
|
+
|
|
415
|
+
useEffect(() => {
|
|
416
|
+
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
417
|
+
containerRef?.current?.scrollToEnd && containerRef.current.scrollToEnd({ animated: true })
|
|
418
|
+
})
|
|
419
|
+
return () => {
|
|
420
|
+
keyboardDidShowListener.remove()
|
|
421
|
+
}
|
|
422
|
+
}, [])
|
|
423
|
+
|
|
312
424
|
return (
|
|
313
425
|
<>
|
|
314
|
-
<
|
|
426
|
+
<View style={styles.wrapperNavbar}>
|
|
427
|
+
<TopHeader>
|
|
428
|
+
<>
|
|
429
|
+
<TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
|
|
430
|
+
<IconAntDesign
|
|
431
|
+
name='arrowleft'
|
|
432
|
+
size={26}
|
|
433
|
+
/>
|
|
434
|
+
</TopActions>
|
|
435
|
+
{showTitle && (
|
|
436
|
+
<OText
|
|
437
|
+
size={16}
|
|
438
|
+
style={{ flex: 1, textAlign: 'center', right: 15 }}
|
|
439
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
440
|
+
numberOfLines={2}
|
|
441
|
+
ellipsizeMode='tail'
|
|
442
|
+
>
|
|
443
|
+
{t('CHECKOUT', 'Checkout')}
|
|
444
|
+
</OText>
|
|
445
|
+
)}
|
|
446
|
+
</>
|
|
447
|
+
</TopHeader>
|
|
448
|
+
</View>
|
|
449
|
+
<Container forwardRef={containerRef} noPadding onScroll={handleScroll}>
|
|
315
450
|
<View style={styles.wrapperNavbar}>
|
|
316
451
|
<NavBar
|
|
452
|
+
hideArrowLeft
|
|
317
453
|
title={t('CHECKOUT', 'Checkout')}
|
|
318
454
|
titleAlign={'center'}
|
|
319
|
-
onActionLeft={() =>
|
|
455
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
320
456
|
showCall={false}
|
|
321
457
|
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
322
458
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
323
459
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
460
|
+
style={{ marginTop: 20 }}
|
|
324
461
|
/>
|
|
325
462
|
</View>
|
|
326
463
|
<ChContainer style={styles.pagePadding}>
|
|
@@ -399,6 +536,25 @@ const CheckoutUI = (props: any) => {
|
|
|
399
536
|
{businessDetails?.business?.address}
|
|
400
537
|
</OText>
|
|
401
538
|
)}
|
|
539
|
+
{businessDetails?.business?.address_notes && (
|
|
540
|
+
<>
|
|
541
|
+
<OText
|
|
542
|
+
size={12}
|
|
543
|
+
lineHeight={18}
|
|
544
|
+
numberOfLines={isReadMore ? 20 : 3}
|
|
545
|
+
onTextLayout={onTextLayout}
|
|
546
|
+
>
|
|
547
|
+
{businessDetails?.business?.address_notes}
|
|
548
|
+
</OText>
|
|
549
|
+
{lengthMore && (
|
|
550
|
+
<TouchableOpacity
|
|
551
|
+
onPress={() => setIsReadMore(!isReadMore)}
|
|
552
|
+
>
|
|
553
|
+
<OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
554
|
+
</TouchableOpacity>
|
|
555
|
+
)}
|
|
556
|
+
</>
|
|
557
|
+
)}
|
|
402
558
|
</View>
|
|
403
559
|
</>
|
|
404
560
|
)}
|
|
@@ -426,18 +582,46 @@ const CheckoutUI = (props: any) => {
|
|
|
426
582
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
427
583
|
</Placeholder>
|
|
428
584
|
) : (
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
585
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
586
|
+
<View>
|
|
587
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
588
|
+
<OButton
|
|
589
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
590
|
+
textStyle={{ color: theme.colors.white }}
|
|
591
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
592
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
593
|
+
/>
|
|
594
|
+
<OButton
|
|
595
|
+
text={t('LOGIN', 'Login')}
|
|
596
|
+
textStyle={{ color: theme.colors.primary }}
|
|
597
|
+
bgColor={theme.colors.white}
|
|
598
|
+
borderColor={theme.colors.primary}
|
|
599
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
600
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
601
|
+
/>
|
|
602
|
+
<OButton
|
|
603
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
604
|
+
textStyle={{ color: theme.colors.black }}
|
|
605
|
+
bgColor={theme.colors.white}
|
|
606
|
+
borderColor={theme.colors.black}
|
|
607
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
608
|
+
onClick={() => setAllowedGuest(true)}
|
|
609
|
+
/>
|
|
610
|
+
</View>
|
|
611
|
+
) : (
|
|
612
|
+
<UserDetails
|
|
613
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
614
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
615
|
+
cartStatus={cart?.status}
|
|
616
|
+
businessId={cart?.business_id}
|
|
617
|
+
useValidationFields
|
|
618
|
+
useDefualtSessionManager
|
|
619
|
+
useSessionUser
|
|
620
|
+
isCheckout
|
|
621
|
+
phoneUpdate={phoneUpdate}
|
|
622
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
623
|
+
/>
|
|
624
|
+
)
|
|
441
625
|
)}
|
|
442
626
|
</ChUserDetails>
|
|
443
627
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -485,7 +669,7 @@ const CheckoutUI = (props: any) => {
|
|
|
485
669
|
data: deliveryOptions || [],
|
|
486
670
|
renderItem: ({ item }: any) => (
|
|
487
671
|
<TouchableOpacity
|
|
488
|
-
onPress={() => changeDeliveryOption(item.value)}
|
|
672
|
+
onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
|
|
489
673
|
disabled={
|
|
490
674
|
deliveryOptionSelected === item.value
|
|
491
675
|
}
|
|
@@ -534,7 +718,7 @@ const CheckoutUI = (props: any) => {
|
|
|
534
718
|
) : (
|
|
535
719
|
<AddressDetails
|
|
536
720
|
navigation={navigation}
|
|
537
|
-
location={
|
|
721
|
+
location={options?.address?.location}
|
|
538
722
|
businessLogo={businessDetails?.business?.logo}
|
|
539
723
|
isCartPending={cart?.status === 2}
|
|
540
724
|
uuid={cartUuid}
|
|
@@ -603,6 +787,16 @@ const CheckoutUI = (props: any) => {
|
|
|
603
787
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
604
788
|
handlePlaceOrder={handlePlaceOrder}
|
|
605
789
|
merchantId={merchantId}
|
|
790
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
791
|
+
methodPaySupported={methodPaySupported}
|
|
792
|
+
placeByMethodPay={placeByMethodPay}
|
|
793
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
794
|
+
cardList={cardList}
|
|
795
|
+
setCardList={setCardList}
|
|
796
|
+
requiredFields={requiredFields}
|
|
797
|
+
openUserModal={setIsOpen}
|
|
798
|
+
paymethodClicked={paymethodClicked}
|
|
799
|
+
setPaymethodClicked={setPaymethodClicked}
|
|
606
800
|
/>
|
|
607
801
|
</ChPaymethods>
|
|
608
802
|
</ChSection>
|
|
@@ -612,6 +806,7 @@ const CheckoutUI = (props: any) => {
|
|
|
612
806
|
<WalletPaymentOptionContainer>
|
|
613
807
|
<PaymentOptionWallet
|
|
614
808
|
cart={cart}
|
|
809
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
615
810
|
businessId={cart?.business_id}
|
|
616
811
|
businessConfigs={businessDetails?.business?.configs}
|
|
617
812
|
/>
|
|
@@ -683,6 +878,10 @@ const CheckoutUI = (props: any) => {
|
|
|
683
878
|
placeSpotTypes={placeSpotTypes}
|
|
684
879
|
businessConfigs={businessConfigs}
|
|
685
880
|
maxDate={maxDate}
|
|
881
|
+
loyaltyRewardRate={
|
|
882
|
+
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
883
|
+
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
884
|
+
}
|
|
686
885
|
/>
|
|
687
886
|
</>
|
|
688
887
|
)}
|
|
@@ -692,7 +891,7 @@ const CheckoutUI = (props: any) => {
|
|
|
692
891
|
|
|
693
892
|
{!cartState.loading && cart && (
|
|
694
893
|
<View>
|
|
695
|
-
<ChErrors style={{ marginBottom: 10 }}>
|
|
894
|
+
<ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
|
|
696
895
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
697
896
|
<OText
|
|
698
897
|
color={theme.colors.error}
|
|
@@ -719,7 +918,7 @@ const CheckoutUI = (props: any) => {
|
|
|
719
918
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
720
919
|
</OText>
|
|
721
920
|
)}
|
|
722
|
-
{!cart?.valid_preorder && (
|
|
921
|
+
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
723
922
|
<OText
|
|
724
923
|
color={theme.colors.error}
|
|
725
924
|
size={12}
|
|
@@ -738,6 +937,24 @@ const CheckoutUI = (props: any) => {
|
|
|
738
937
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
739
938
|
</OText>
|
|
740
939
|
)}
|
|
940
|
+
|
|
941
|
+
{validateCommentsCartField && (
|
|
942
|
+
<OText
|
|
943
|
+
color={theme.colors.error}
|
|
944
|
+
size={12}
|
|
945
|
+
>
|
|
946
|
+
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
947
|
+
</OText>
|
|
948
|
+
)}
|
|
949
|
+
|
|
950
|
+
{validateZipcodeCard && (
|
|
951
|
+
<OText
|
|
952
|
+
color={theme.colors.error}
|
|
953
|
+
size={12}
|
|
954
|
+
>
|
|
955
|
+
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
956
|
+
</OText>
|
|
957
|
+
)}
|
|
741
958
|
</ChErrors>
|
|
742
959
|
</View>
|
|
743
960
|
)}
|
|
@@ -773,16 +990,56 @@ const CheckoutUI = (props: any) => {
|
|
|
773
990
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
774
991
|
onClose={() => {
|
|
775
992
|
setIsOpen(false)
|
|
776
|
-
|
|
993
|
+
if (paymethodClicked) {
|
|
994
|
+
setPaymethodClicked({
|
|
995
|
+
...paymethodClicked,
|
|
996
|
+
confirmed: true
|
|
997
|
+
})
|
|
998
|
+
} else {
|
|
999
|
+
handlePlaceOrder(null, true)
|
|
1000
|
+
}
|
|
777
1001
|
}}
|
|
1002
|
+
setIsOpen={setIsOpen}
|
|
778
1003
|
/>
|
|
779
1004
|
</View>
|
|
780
1005
|
</OModal>
|
|
1006
|
+
<OModal
|
|
1007
|
+
open={openModal.signup}
|
|
1008
|
+
onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
|
|
1009
|
+
>
|
|
1010
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
1011
|
+
<SignupForm
|
|
1012
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
1013
|
+
isGuest
|
|
1014
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
1015
|
+
useSignupByEmail
|
|
1016
|
+
useChekoutFileds
|
|
1017
|
+
/>
|
|
1018
|
+
</ScrollView>
|
|
1019
|
+
</OModal>
|
|
1020
|
+
<OModal
|
|
1021
|
+
open={openModal.login}
|
|
1022
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
1023
|
+
>
|
|
1024
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
1025
|
+
<LoginForm
|
|
1026
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
1027
|
+
isGuest
|
|
1028
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
1029
|
+
loginButtonBackground={theme.colors.primary}
|
|
1030
|
+
/>
|
|
1031
|
+
</ScrollView>
|
|
1032
|
+
</OModal>
|
|
781
1033
|
</ChContainer>
|
|
782
1034
|
</Container>
|
|
783
1035
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
784
1036
|
<FloatingButton
|
|
785
|
-
handleClick={
|
|
1037
|
+
handleClick={
|
|
1038
|
+
isDisabledButtonPlace
|
|
1039
|
+
? () => vibrateApp()
|
|
1040
|
+
: methodsPay.includes(paymethodSelected?.gateway)
|
|
1041
|
+
? () => setPlaceByMethodPay(true)
|
|
1042
|
+
: () => handlePlaceOrder(null)}
|
|
786
1043
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
787
1044
|
disabled={isDisabledButtonPlace}
|
|
788
1045
|
btnText={subtotalWithTaxes >= cart?.minimum
|
|
@@ -825,6 +1082,29 @@ const CheckoutUI = (props: any) => {
|
|
|
825
1082
|
locationId={'L1NGAY5M6KJRX'}
|
|
826
1083
|
/>
|
|
827
1084
|
)}
|
|
1085
|
+
{cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
|
|
1086
|
+
<PaymentOptionsWebView
|
|
1087
|
+
title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
|
|
1088
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
1089
|
+
uri={credomaticUrl}
|
|
1090
|
+
user={user}
|
|
1091
|
+
cart={cart}
|
|
1092
|
+
additionalParams={{
|
|
1093
|
+
type: 'auth',
|
|
1094
|
+
key_id: credomaticKeyId,
|
|
1095
|
+
hash: cart?.paymethod_data?.result?.hash,
|
|
1096
|
+
time: cart?.paymethod_data?.result?.time,
|
|
1097
|
+
amount: cart?.total,
|
|
1098
|
+
orderid: cart?.uuid,
|
|
1099
|
+
ccnumber: cardList?.cards?.[0]?.number,
|
|
1100
|
+
ccexp: cardList?.cards?.[0]?.expiryString,
|
|
1101
|
+
cvv: cardList?.cards?.[0]?.cvc,
|
|
1102
|
+
redirect: credomaticUrl
|
|
1103
|
+
}}
|
|
1104
|
+
webviewPaymethod={webviewPaymethod}
|
|
1105
|
+
setShowGateway={setShowGateway}
|
|
1106
|
+
/>
|
|
1107
|
+
)}
|
|
828
1108
|
</>
|
|
829
1109
|
)
|
|
830
1110
|
}
|
|
@@ -851,7 +1131,8 @@ export const Checkout = (props: any) => {
|
|
|
851
1131
|
const getOrder = async (cartId: any) => {
|
|
852
1132
|
try {
|
|
853
1133
|
let result: any = {}
|
|
854
|
-
const
|
|
1134
|
+
const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
|
|
1135
|
+
const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
|
|
855
1136
|
if (cart) {
|
|
856
1137
|
result = { ...cart }
|
|
857
1138
|
} else {
|
|
@@ -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
|
+
`
|
|
@@ -47,7 +47,7 @@ export const CitiesControl = (props: any) => {
|
|
|
47
47
|
return (
|
|
48
48
|
<Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
|
|
49
49
|
<View>
|
|
50
|
-
{cities?.map((city: any) => (
|
|
50
|
+
{cities?.map((city: any) => city?.enabled && (
|
|
51
51
|
<CityElement
|
|
52
52
|
key={city?.id}
|
|
53
53
|
activeOpacity={1}
|