ordering-ui-react-native 0.17.97 → 0.17.98-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 +0 -1
- 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 +209 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- 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 +60 -47
- 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 +198 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- 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 +24 -10
- package/themes/business/src/utils/index.tsx +29 -2
- 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/AddressList/index.tsx +5 -8
- 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 +72 -36
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- 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/BusinessItemAccordion/index.tsx +21 -23
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- 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 +137 -32
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- 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 +36 -403
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +44 -81
- package/themes/original/src/components/CartContent/index.tsx +70 -30
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/Checkout/index.tsx +262 -35
- package/themes/original/src/components/CitiesControl/index.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 +12 -4
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- 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 +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- 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/Home/index.tsx +13 -4
- 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/MomentOption/index.tsx +41 -36
- package/themes/original/src/components/MomentOption/styles.tsx +0 -15
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +347 -69
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +12 -1
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
- package/themes/original/src/components/OrderDetails/index.tsx +50 -38
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- 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/OrderSummary/index.tsx +59 -56
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/index.tsx +43 -20
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- 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/index.tsx +65 -34
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -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/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +2 -2
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +40 -20
- 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/index.tsx +3 -8
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +84 -19
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +7 -25
- 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/Wallets/index.tsx +51 -61
- package/themes/original/src/components/Wallets/styles.tsx +2 -4
- 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 +3 -3
- package/themes/original/src/config/constants.tsx +0 -10
- package/themes/original/src/types/index.tsx +31 -15
- 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,10 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager,
|
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } 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 ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
6
8
|
import {
|
|
7
9
|
Checkout as CheckoutController,
|
|
8
10
|
useOrder,
|
|
@@ -14,9 +16,10 @@ import {
|
|
|
14
16
|
useConfig,
|
|
15
17
|
useToast,
|
|
16
18
|
ToastType,
|
|
19
|
+
useEvent
|
|
17
20
|
} from 'ordering-components/native';
|
|
18
21
|
import { useTheme } from 'styled-components/native';
|
|
19
|
-
import { OText, OIcon, OModal } from '../shared';
|
|
22
|
+
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
20
23
|
|
|
21
24
|
import { AddressDetails } from '../AddressDetails';
|
|
22
25
|
import { PaymentOptions } from '../PaymentOptions';
|
|
@@ -25,6 +28,8 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
25
28
|
import { UserDetails } from '../UserDetails';
|
|
26
29
|
import { PaymentOptionWallet } from '../PaymentOptionWallet';
|
|
27
30
|
import { PlaceSpot } from '../PlaceSpot'
|
|
31
|
+
import { SignupForm } from '../SignupForm'
|
|
32
|
+
import { LoginForm } from '../LoginForm'
|
|
28
33
|
|
|
29
34
|
import {
|
|
30
35
|
ChContainer,
|
|
@@ -44,7 +49,6 @@ import {
|
|
|
44
49
|
CartHeader
|
|
45
50
|
} from './styles';
|
|
46
51
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
47
|
-
|
|
48
52
|
import { FloatingButton } from '../FloatingButton';
|
|
49
53
|
import { Container } from '../../layouts/Container';
|
|
50
54
|
import NavBar from '../NavBar';
|
|
@@ -52,6 +56,8 @@ import { OrderSummary } from '../OrderSummary';
|
|
|
52
56
|
import { getTypesText } from '../../utils';
|
|
53
57
|
import { CartStoresListing } from '../CartStoresListing';
|
|
54
58
|
import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
|
|
59
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
60
|
+
const { useDeviceOrientation } = DeviceOrientationMethods
|
|
55
61
|
|
|
56
62
|
const mapConfigs = {
|
|
57
63
|
mapZoom: 16,
|
|
@@ -78,6 +84,7 @@ const CheckoutUI = (props: any) => {
|
|
|
78
84
|
placing,
|
|
79
85
|
cartState,
|
|
80
86
|
cartUuid,
|
|
87
|
+
loyaltyPlansState,
|
|
81
88
|
businessDetails,
|
|
82
89
|
paymethodSelected,
|
|
83
90
|
handlePaymethodChange,
|
|
@@ -129,12 +136,17 @@ const CheckoutUI = (props: any) => {
|
|
|
129
136
|
|
|
130
137
|
const [, { showToast }] = useToast();
|
|
131
138
|
const [, t] = useLanguage();
|
|
132
|
-
const [{ user, token }] = useSession();
|
|
139
|
+
const [{ user, token }, { login }] = useSession();
|
|
133
140
|
const [ordering] = useApi()
|
|
134
141
|
const [{ configs }] = useConfig();
|
|
135
142
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
136
143
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
137
144
|
const [validationFields] = useValidationFields();
|
|
145
|
+
const [events] = useEvent()
|
|
146
|
+
const [orientationState] = useDeviceOrientation();
|
|
147
|
+
const [isReadMore, setIsReadMore] = useState(false)
|
|
148
|
+
const [lengthMore, setLengthMore] = useState(false)
|
|
149
|
+
const WIDTH_SCREEN = orientationState?.dimensions?.width
|
|
138
150
|
|
|
139
151
|
const [errorCash, setErrorCash] = useState(false);
|
|
140
152
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -146,7 +158,14 @@ const CheckoutUI = (props: any) => {
|
|
|
146
158
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
147
159
|
const [isOpen, setIsOpen] = useState(false)
|
|
148
160
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
149
|
-
|
|
161
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
162
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
163
|
+
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
164
|
+
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
165
|
+
const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
|
|
166
|
+
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
167
|
+
const cardsMethods = ['credomatic']
|
|
168
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
150
169
|
const placeSpotTypes = [3, 4, 5]
|
|
151
170
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
152
171
|
const isGiftCardCart = !cart?.business_id
|
|
@@ -161,18 +180,34 @@ const CheckoutUI = (props: any) => {
|
|
|
161
180
|
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
162
181
|
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
163
182
|
|
|
183
|
+
const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
184
|
+
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
|
|
185
|
+
const methodsPay = ['google_pay', 'apple_pay']
|
|
186
|
+
|
|
164
187
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
165
188
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
166
189
|
if (item?.type === 1)
|
|
167
190
|
return acc = acc + item?.summary?.tax
|
|
168
191
|
return acc = acc
|
|
169
192
|
}, cart?.subtotal)
|
|
193
|
+
|
|
194
|
+
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
195
|
+
const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
|
|
196
|
+
validationFields?.fields?.card?.zipcode?.required &&
|
|
197
|
+
paymethodSelected?.data?.card &&
|
|
198
|
+
!paymethodSelected?.data?.card?.zipcode &&
|
|
199
|
+
paymethodSelected?.gateway === 'stripe'
|
|
200
|
+
|
|
170
201
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
171
202
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
203
|
+
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
172
204
|
(options.type === 1 &&
|
|
173
205
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
174
206
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
175
|
-
(Number(cart?.driver_tip) <= 0))
|
|
207
|
+
(Number(cart?.driver_tip) <= 0)) ||
|
|
208
|
+
(validateCommentsCartField) ||
|
|
209
|
+
(validateZipcodeCard)
|
|
210
|
+
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
176
211
|
|
|
177
212
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
178
213
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -182,6 +217,9 @@ const CheckoutUI = (props: any) => {
|
|
|
182
217
|
|
|
183
218
|
const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
|
|
184
219
|
|
|
220
|
+
const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
|
|
221
|
+
const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
|
|
222
|
+
const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
|
|
185
223
|
const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
|
|
186
224
|
return {
|
|
187
225
|
value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
|
|
@@ -194,10 +232,36 @@ const CheckoutUI = (props: any) => {
|
|
|
194
232
|
}
|
|
195
233
|
}
|
|
196
234
|
|
|
235
|
+
const vibrateApp = (impact?: string) => {
|
|
236
|
+
const options = {
|
|
237
|
+
enableVibrateFallback: true,
|
|
238
|
+
ignoreAndroidSystemSettings: false
|
|
239
|
+
};
|
|
240
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const handleSuccessSignup = (user: any) => {
|
|
244
|
+
login({
|
|
245
|
+
user,
|
|
246
|
+
token: user?.session?.access_token
|
|
247
|
+
})
|
|
248
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
249
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const handleSuccessLogin = (user: any) => {
|
|
253
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
254
|
+
}
|
|
255
|
+
|
|
197
256
|
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
|
|
257
|
+
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
258
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
263
|
+
vibrateApp()
|
|
264
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
|
|
201
265
|
return
|
|
202
266
|
}
|
|
203
267
|
if (requiredFields?.length) {
|
|
@@ -213,9 +277,9 @@ const CheckoutUI = (props: any) => {
|
|
|
213
277
|
}
|
|
214
278
|
|
|
215
279
|
const handlePlaceOrderAsGuest = () => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
280
|
+
setIsOpen(false)
|
|
281
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
282
|
+
}
|
|
219
283
|
|
|
220
284
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
221
285
|
setShowGateway({ closedByUser: false, open: true })
|
|
@@ -235,7 +299,7 @@ const CheckoutUI = (props: any) => {
|
|
|
235
299
|
const checkValidationFields = () => {
|
|
236
300
|
setUserErrors([])
|
|
237
301
|
const errors = []
|
|
238
|
-
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
|
|
302
|
+
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
239
303
|
const _requiredFields: any = []
|
|
240
304
|
|
|
241
305
|
Object.values(validationFields?.fields?.checkout).map((field: any) => {
|
|
@@ -283,7 +347,7 @@ const CheckoutUI = (props: any) => {
|
|
|
283
347
|
useEffect(() => {
|
|
284
348
|
if (cart?.products?.length === 0) {
|
|
285
349
|
if (cart?.business?.slug) {
|
|
286
|
-
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
350
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
|
|
287
351
|
} else {
|
|
288
352
|
onNavigationRedirect('Wallets')
|
|
289
353
|
}
|
|
@@ -309,6 +373,24 @@ const CheckoutUI = (props: any) => {
|
|
|
309
373
|
)
|
|
310
374
|
}
|
|
311
375
|
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
cart && events.emit('checkout_started', cart)
|
|
378
|
+
}, [])
|
|
379
|
+
|
|
380
|
+
useEffect(() => {
|
|
381
|
+
if (cart?.paymethod_data?.gateway === 'credomatic') {
|
|
382
|
+
if (cart?.paymethod_data?.status === 2) {
|
|
383
|
+
setShowGateway({ ...showGateway, open: true })
|
|
384
|
+
} else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
|
|
385
|
+
setShowGateway({ ...showGateway, open: false })
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}, [cart?.paymethod_data])
|
|
389
|
+
|
|
390
|
+
const onTextLayout = useCallback((e: any) => {
|
|
391
|
+
setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
|
|
392
|
+
}, [])
|
|
393
|
+
|
|
312
394
|
return (
|
|
313
395
|
<>
|
|
314
396
|
<Container noPadding>
|
|
@@ -316,11 +398,12 @@ const CheckoutUI = (props: any) => {
|
|
|
316
398
|
<NavBar
|
|
317
399
|
title={t('CHECKOUT', 'Checkout')}
|
|
318
400
|
titleAlign={'center'}
|
|
319
|
-
onActionLeft={() =>
|
|
401
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
320
402
|
showCall={false}
|
|
321
403
|
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
322
404
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
323
405
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
406
|
+
style={{ marginTop: 20 }}
|
|
324
407
|
/>
|
|
325
408
|
</View>
|
|
326
409
|
<ChContainer style={styles.pagePadding}>
|
|
@@ -399,6 +482,25 @@ const CheckoutUI = (props: any) => {
|
|
|
399
482
|
{businessDetails?.business?.address}
|
|
400
483
|
</OText>
|
|
401
484
|
)}
|
|
485
|
+
{businessDetails?.business?.address_notes && (
|
|
486
|
+
<>
|
|
487
|
+
<OText
|
|
488
|
+
size={12}
|
|
489
|
+
lineHeight={18}
|
|
490
|
+
numberOfLines={isReadMore ? 20 : 3}
|
|
491
|
+
onTextLayout={onTextLayout}
|
|
492
|
+
>
|
|
493
|
+
{businessDetails?.business?.address_notes}
|
|
494
|
+
</OText>
|
|
495
|
+
{lengthMore && (
|
|
496
|
+
<TouchableOpacity
|
|
497
|
+
onPress={() => setIsReadMore(!isReadMore)}
|
|
498
|
+
>
|
|
499
|
+
<OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
500
|
+
</TouchableOpacity>
|
|
501
|
+
)}
|
|
502
|
+
</>
|
|
503
|
+
)}
|
|
402
504
|
</View>
|
|
403
505
|
</>
|
|
404
506
|
)}
|
|
@@ -426,18 +528,46 @@ const CheckoutUI = (props: any) => {
|
|
|
426
528
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
427
529
|
</Placeholder>
|
|
428
530
|
) : (
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
531
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
532
|
+
<View>
|
|
533
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
534
|
+
<OButton
|
|
535
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
536
|
+
textStyle={{ color: theme.colors.white }}
|
|
537
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
538
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
539
|
+
/>
|
|
540
|
+
<OButton
|
|
541
|
+
text={t('LOGIN', 'Login')}
|
|
542
|
+
textStyle={{ color: theme.colors.primary }}
|
|
543
|
+
bgColor={theme.colors.white}
|
|
544
|
+
borderColor={theme.colors.primary}
|
|
545
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
546
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
547
|
+
/>
|
|
548
|
+
<OButton
|
|
549
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
550
|
+
textStyle={{ color: theme.colors.black }}
|
|
551
|
+
bgColor={theme.colors.white}
|
|
552
|
+
borderColor={theme.colors.black}
|
|
553
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
554
|
+
onClick={() => setAllowedGuest(true)}
|
|
555
|
+
/>
|
|
556
|
+
</View>
|
|
557
|
+
) : (
|
|
558
|
+
<UserDetails
|
|
559
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
560
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
561
|
+
cartStatus={cart?.status}
|
|
562
|
+
businessId={cart?.business_id}
|
|
563
|
+
useValidationFields
|
|
564
|
+
useDefualtSessionManager
|
|
565
|
+
useSessionUser
|
|
566
|
+
isCheckout
|
|
567
|
+
phoneUpdate={phoneUpdate}
|
|
568
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
569
|
+
/>
|
|
570
|
+
)
|
|
441
571
|
)}
|
|
442
572
|
</ChUserDetails>
|
|
443
573
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -485,7 +615,7 @@ const CheckoutUI = (props: any) => {
|
|
|
485
615
|
data: deliveryOptions || [],
|
|
486
616
|
renderItem: ({ item }: any) => (
|
|
487
617
|
<TouchableOpacity
|
|
488
|
-
onPress={() => changeDeliveryOption(item.value)}
|
|
618
|
+
onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
|
|
489
619
|
disabled={
|
|
490
620
|
deliveryOptionSelected === item.value
|
|
491
621
|
}
|
|
@@ -534,7 +664,7 @@ const CheckoutUI = (props: any) => {
|
|
|
534
664
|
) : (
|
|
535
665
|
<AddressDetails
|
|
536
666
|
navigation={navigation}
|
|
537
|
-
location={
|
|
667
|
+
location={options?.address?.location}
|
|
538
668
|
businessLogo={businessDetails?.business?.logo}
|
|
539
669
|
isCartPending={cart?.status === 2}
|
|
540
670
|
uuid={cartUuid}
|
|
@@ -603,6 +733,16 @@ const CheckoutUI = (props: any) => {
|
|
|
603
733
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
604
734
|
handlePlaceOrder={handlePlaceOrder}
|
|
605
735
|
merchantId={merchantId}
|
|
736
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
737
|
+
methodPaySupported={methodPaySupported}
|
|
738
|
+
placeByMethodPay={placeByMethodPay}
|
|
739
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
740
|
+
cardList={cardList}
|
|
741
|
+
setCardList={setCardList}
|
|
742
|
+
requiredFields={requiredFields}
|
|
743
|
+
openUserModal={setIsOpen}
|
|
744
|
+
paymethodClicked={paymethodClicked}
|
|
745
|
+
setPaymethodClicked={setPaymethodClicked}
|
|
606
746
|
/>
|
|
607
747
|
</ChPaymethods>
|
|
608
748
|
</ChSection>
|
|
@@ -612,6 +752,7 @@ const CheckoutUI = (props: any) => {
|
|
|
612
752
|
<WalletPaymentOptionContainer>
|
|
613
753
|
<PaymentOptionWallet
|
|
614
754
|
cart={cart}
|
|
755
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
615
756
|
businessId={cart?.business_id}
|
|
616
757
|
businessConfigs={businessDetails?.business?.configs}
|
|
617
758
|
/>
|
|
@@ -683,6 +824,10 @@ const CheckoutUI = (props: any) => {
|
|
|
683
824
|
placeSpotTypes={placeSpotTypes}
|
|
684
825
|
businessConfigs={businessConfigs}
|
|
685
826
|
maxDate={maxDate}
|
|
827
|
+
loyaltyRewardRate={
|
|
828
|
+
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
829
|
+
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
830
|
+
}
|
|
686
831
|
/>
|
|
687
832
|
</>
|
|
688
833
|
)}
|
|
@@ -692,7 +837,7 @@ const CheckoutUI = (props: any) => {
|
|
|
692
837
|
|
|
693
838
|
{!cartState.loading && cart && (
|
|
694
839
|
<View>
|
|
695
|
-
<ChErrors style={{ marginBottom: 10 }}>
|
|
840
|
+
<ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
|
|
696
841
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
697
842
|
<OText
|
|
698
843
|
color={theme.colors.error}
|
|
@@ -719,7 +864,7 @@ const CheckoutUI = (props: any) => {
|
|
|
719
864
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
720
865
|
</OText>
|
|
721
866
|
)}
|
|
722
|
-
{!cart?.valid_preorder && (
|
|
867
|
+
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
723
868
|
<OText
|
|
724
869
|
color={theme.colors.error}
|
|
725
870
|
size={12}
|
|
@@ -738,6 +883,24 @@ const CheckoutUI = (props: any) => {
|
|
|
738
883
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
739
884
|
</OText>
|
|
740
885
|
)}
|
|
886
|
+
|
|
887
|
+
{validateCommentsCartField && (
|
|
888
|
+
<OText
|
|
889
|
+
color={theme.colors.error}
|
|
890
|
+
size={12}
|
|
891
|
+
>
|
|
892
|
+
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
893
|
+
</OText>
|
|
894
|
+
)}
|
|
895
|
+
|
|
896
|
+
{validateZipcodeCard && (
|
|
897
|
+
<OText
|
|
898
|
+
color={theme.colors.error}
|
|
899
|
+
size={12}
|
|
900
|
+
>
|
|
901
|
+
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
902
|
+
</OText>
|
|
903
|
+
)}
|
|
741
904
|
</ChErrors>
|
|
742
905
|
</View>
|
|
743
906
|
)}
|
|
@@ -773,16 +936,56 @@ const CheckoutUI = (props: any) => {
|
|
|
773
936
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
774
937
|
onClose={() => {
|
|
775
938
|
setIsOpen(false)
|
|
776
|
-
|
|
939
|
+
if (paymethodClicked) {
|
|
940
|
+
setPaymethodClicked({
|
|
941
|
+
...paymethodClicked,
|
|
942
|
+
confirmed: true
|
|
943
|
+
})
|
|
944
|
+
} else {
|
|
945
|
+
handlePlaceOrder(null, true)
|
|
946
|
+
}
|
|
777
947
|
}}
|
|
948
|
+
setIsOpen={setIsOpen}
|
|
778
949
|
/>
|
|
779
950
|
</View>
|
|
780
951
|
</OModal>
|
|
952
|
+
<OModal
|
|
953
|
+
open={openModal.signup}
|
|
954
|
+
onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
|
|
955
|
+
>
|
|
956
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
957
|
+
<SignupForm
|
|
958
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
959
|
+
isGuest
|
|
960
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
961
|
+
useSignupByEmail
|
|
962
|
+
useChekoutFileds
|
|
963
|
+
/>
|
|
964
|
+
</ScrollView>
|
|
965
|
+
</OModal>
|
|
966
|
+
<OModal
|
|
967
|
+
open={openModal.login}
|
|
968
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
969
|
+
>
|
|
970
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
971
|
+
<LoginForm
|
|
972
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
973
|
+
isGuest
|
|
974
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
975
|
+
loginButtonBackground={theme.colors.primary}
|
|
976
|
+
/>
|
|
977
|
+
</ScrollView>
|
|
978
|
+
</OModal>
|
|
781
979
|
</ChContainer>
|
|
782
980
|
</Container>
|
|
783
981
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
784
982
|
<FloatingButton
|
|
785
|
-
handleClick={
|
|
983
|
+
handleClick={
|
|
984
|
+
isDisabledButtonPlace
|
|
985
|
+
? () => vibrateApp()
|
|
986
|
+
: methodsPay.includes(paymethodSelected?.gateway)
|
|
987
|
+
? () => setPlaceByMethodPay(true)
|
|
988
|
+
: () => handlePlaceOrder(null)}
|
|
786
989
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
787
990
|
disabled={isDisabledButtonPlace}
|
|
788
991
|
btnText={subtotalWithTaxes >= cart?.minimum
|
|
@@ -825,6 +1028,29 @@ const CheckoutUI = (props: any) => {
|
|
|
825
1028
|
locationId={'L1NGAY5M6KJRX'}
|
|
826
1029
|
/>
|
|
827
1030
|
)}
|
|
1031
|
+
{cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
|
|
1032
|
+
<PaymentOptionsWebView
|
|
1033
|
+
title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
|
|
1034
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
1035
|
+
uri={credomaticUrl}
|
|
1036
|
+
user={user}
|
|
1037
|
+
cart={cart}
|
|
1038
|
+
additionalParams={{
|
|
1039
|
+
type: 'auth',
|
|
1040
|
+
key_id: credomaticKeyId,
|
|
1041
|
+
hash: cart?.paymethod_data?.result?.hash,
|
|
1042
|
+
time: cart?.paymethod_data?.result?.time,
|
|
1043
|
+
amount: cart?.total,
|
|
1044
|
+
orderid: cart?.uuid,
|
|
1045
|
+
ccnumber: cardList?.cards?.[0]?.number,
|
|
1046
|
+
ccexp: cardList?.cards?.[0]?.expiryString,
|
|
1047
|
+
cvv: cardList?.cards?.[0]?.cvc,
|
|
1048
|
+
redirect: credomaticUrl
|
|
1049
|
+
}}
|
|
1050
|
+
webviewPaymethod={webviewPaymethod}
|
|
1051
|
+
setShowGateway={setShowGateway}
|
|
1052
|
+
/>
|
|
1053
|
+
)}
|
|
828
1054
|
</>
|
|
829
1055
|
)
|
|
830
1056
|
}
|
|
@@ -851,7 +1077,8 @@ export const Checkout = (props: any) => {
|
|
|
851
1077
|
const getOrder = async (cartId: any) => {
|
|
852
1078
|
try {
|
|
853
1079
|
let result: any = {}
|
|
854
|
-
const
|
|
1080
|
+
const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
|
|
1081
|
+
const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
|
|
855
1082
|
if (cart) {
|
|
856
1083
|
result = { ...cart }
|
|
857
1084
|
} else {
|
|
@@ -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}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, Alert, Text } from 'react-native';
|
|
3
|
-
import { CouponControl as CouponController, useLanguage } from 'ordering-components/native';
|
|
3
|
+
import { CouponControl as CouponController, useLanguage, useEvent } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import {
|
|
6
6
|
CContainer,
|
|
@@ -18,11 +18,13 @@ const CouponControlUI = (props: any) => {
|
|
|
18
18
|
handleRemoveCouponClick,
|
|
19
19
|
onChangeInputCoupon,
|
|
20
20
|
confirm,
|
|
21
|
-
setConfirm
|
|
21
|
+
setConfirm,
|
|
22
|
+
cart
|
|
22
23
|
} = props
|
|
23
24
|
|
|
24
25
|
const [, t] = useLanguage()
|
|
25
26
|
const theme = useTheme();
|
|
27
|
+
const [events] = useEvent()
|
|
26
28
|
|
|
27
29
|
const styles = StyleSheet.create({
|
|
28
30
|
inputsStyle: {
|
|
@@ -45,6 +47,11 @@ const CouponControlUI = (props: any) => {
|
|
|
45
47
|
setConfirm({ ...confirm, open: false, error: false })
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
const onButtonApplyClick = () => {
|
|
51
|
+
events.emit('coupon_entered', { ...cart, coupon: couponInput })
|
|
52
|
+
handleButtonApplyClick()
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
useEffect(() => {
|
|
49
56
|
if (confirm.content) {
|
|
50
57
|
Alert.alert(
|
|
@@ -94,7 +101,7 @@ const CouponControlUI = (props: any) => {
|
|
|
94
101
|
inputStyle={{ fontSize: 12 }}
|
|
95
102
|
/>
|
|
96
103
|
<OButton
|
|
97
|
-
onClick={() =>
|
|
104
|
+
onClick={() => onButtonApplyClick()}
|
|
98
105
|
bgColor={theme.colors.primary}
|
|
99
106
|
borderColor={theme.colors.primary}
|
|
100
107
|
textStyle={{ color: 'white', fontSize: 12 }}
|
|
@@ -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
|
+
`
|
|
@@ -23,7 +23,9 @@ const DriverTipsUI = (props: any) => {
|
|
|
23
23
|
driverTip,
|
|
24
24
|
driverTipsOptions,
|
|
25
25
|
isMulti,
|
|
26
|
+
isLoading,
|
|
26
27
|
cart,
|
|
28
|
+
carts,
|
|
27
29
|
isDriverTipUseCustom,
|
|
28
30
|
handlerChangeOption,
|
|
29
31
|
isFixedPrice
|
|
@@ -64,6 +66,10 @@ const DriverTipsUI = (props: any) => {
|
|
|
64
66
|
setvalue(val)
|
|
65
67
|
}
|
|
66
68
|
|
|
69
|
+
const multiCartTipsAmmout = carts?.reduce((total: any, cart: any) => {
|
|
70
|
+
return total + parseFloat(cart?.driver_tip || 0)
|
|
71
|
+
}, 0)
|
|
72
|
+
|
|
67
73
|
return (
|
|
68
74
|
<DTContainer>
|
|
69
75
|
<DTLabel>
|
|
@@ -74,8 +80,10 @@ const DriverTipsUI = (props: any) => {
|
|
|
74
80
|
<TouchableOpacity
|
|
75
81
|
key={i}
|
|
76
82
|
onPress={() => {
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
if (!isLoading) {
|
|
84
|
+
handlerChangeOption(option)
|
|
85
|
+
setCustomTip(false)
|
|
86
|
+
}
|
|
79
87
|
}}
|
|
80
88
|
>
|
|
81
89
|
<DTCard
|
|
@@ -90,7 +98,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
90
98
|
))}
|
|
91
99
|
{isDriverTipUseCustom && (
|
|
92
100
|
<TouchableOpacity
|
|
93
|
-
onPress={() => setCustomTip(true)}
|
|
101
|
+
onPress={() => { !isLoading && setCustomTip(true) }}
|
|
94
102
|
>
|
|
95
103
|
<DTCard
|
|
96
104
|
style={style.semicircle}
|
|
@@ -138,7 +146,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
138
146
|
style={{ marginTop: 10, textAlign: 'center' }}
|
|
139
147
|
>
|
|
140
148
|
{t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPrice &&
|
|
141
|
-
` (${driverTip}%)`}: {isFixedPrice ? parsePrice(driverTip) : parsePrice(cart?.driver_tip)}
|
|
149
|
+
` (${driverTip}%)`}: {isFixedPrice ? parsePrice(multiCartTipsAmmout ?? driverTip) : parsePrice(multiCartTipsAmmout ?? cart?.driver_tip)}
|
|
142
150
|
</OText>
|
|
143
151
|
)}
|
|
144
152
|
</DTContainer>
|