ordering-ui-react-native 0.17.76 → 0.17.77-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -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 +1 -21
- 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 +5 -0
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +28 -25
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +149 -118
- 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/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
- package/themes/business/src/components/LoginForm/index.tsx +15 -22
- package/themes/business/src/components/MapView/index.tsx +10 -10
- package/themes/business/src/components/MessagesOption/index.tsx +20 -93
- package/themes/business/src/components/NewOrderNotification/index.tsx +128 -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 +191 -6
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +102 -40
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +70 -67
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -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/OrdersOption/index.tsx +20 -22
- 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 +17 -12
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +139 -174
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- 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/shared/OLink.tsx +9 -2
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +6 -1
- package/themes/business/src/types/index.tsx +25 -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 -9
- 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 +1 -1
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +61 -39
- package/themes/original/src/components/AddressList/index.tsx +11 -6
- 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 +153 -96
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- package/themes/original/src/components/BusinessController/index.tsx +81 -68
- 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 +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +348 -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 +684 -559
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +1 -1
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +70 -39
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +76 -79
- package/themes/original/src/components/CartContent/index.tsx +112 -19
- package/themes/original/src/components/CartContent/styles.tsx +16 -6
- package/themes/original/src/components/Checkout/index.tsx +294 -56
- 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/DriverTips/index.tsx +52 -34
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +2 -6
- package/themes/original/src/components/FavoriteList/index.tsx +1 -35
- package/themes/original/src/components/FloatingButton/index.tsx +10 -13
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +7 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +19 -6
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +60 -5
- package/themes/original/src/components/Help/index.tsx +2 -2
- package/themes/original/src/components/HelpGuide/index.tsx +2 -2
- package/themes/original/src/components/HelpGuide/styles.tsx +1 -0
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- 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 +16 -42
- package/themes/original/src/components/Messages/index.tsx +14 -7
- package/themes/original/src/components/MomentOption/index.tsx +193 -90
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +41 -54
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
- package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +37 -24
- package/themes/original/src/components/NavBar/index.tsx +20 -12
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/styles.tsx +1 -5
- 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 +139 -306
- 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 +33 -57
- package/themes/original/src/components/OrderSummary/index.tsx +83 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +61 -81
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +98 -38
- package/themes/original/src/components/PageBanner/styles.tsx +0 -10
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +95 -33
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/index.tsx +103 -40
- 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 +50 -21
- 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 +63 -20
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +43 -27
- package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
- package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +49 -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 +238 -224
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +87 -76
- package/themes/original/src/components/UserProfileForm/index.tsx +10 -3
- package/themes/original/src/components/UserProfileForm/styles.tsx +1 -1
- 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 +56 -33
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OInput.tsx +6 -1
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/types/index.tsx +39 -10
- package/themes/original/src/utils/index.tsx +386 -1
- 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,9 @@
|
|
|
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
4
|
import Picker from 'react-native-country-picker-modal';
|
|
5
5
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
6
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
6
7
|
import {
|
|
7
8
|
Checkout as CheckoutController,
|
|
8
9
|
useOrder,
|
|
@@ -14,9 +15,10 @@ import {
|
|
|
14
15
|
useConfig,
|
|
15
16
|
useToast,
|
|
16
17
|
ToastType,
|
|
18
|
+
useEvent
|
|
17
19
|
} from 'ordering-components/native';
|
|
18
20
|
import { useTheme } from 'styled-components/native';
|
|
19
|
-
import { OText, OIcon, OModal } from '../shared';
|
|
21
|
+
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
20
22
|
|
|
21
23
|
import { AddressDetails } from '../AddressDetails';
|
|
22
24
|
import { PaymentOptions } from '../PaymentOptions';
|
|
@@ -25,6 +27,8 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
25
27
|
import { UserDetails } from '../UserDetails';
|
|
26
28
|
import { PaymentOptionWallet } from '../PaymentOptionWallet';
|
|
27
29
|
import { PlaceSpot } from '../PlaceSpot'
|
|
30
|
+
import { SignupForm } from '../SignupForm'
|
|
31
|
+
import { LoginForm } from '../LoginForm'
|
|
28
32
|
|
|
29
33
|
import {
|
|
30
34
|
ChContainer,
|
|
@@ -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,
|
|
@@ -88,7 +95,8 @@ const CheckoutUI = (props: any) => {
|
|
|
88
95
|
handleChangeDeliveryOption,
|
|
89
96
|
currency,
|
|
90
97
|
merchantId,
|
|
91
|
-
setPlaceSpotNumber
|
|
98
|
+
setPlaceSpotNumber,
|
|
99
|
+
maxDate
|
|
92
100
|
} = props
|
|
93
101
|
|
|
94
102
|
const theme = useTheme();
|
|
@@ -128,12 +136,17 @@ const CheckoutUI = (props: any) => {
|
|
|
128
136
|
|
|
129
137
|
const [, { showToast }] = useToast();
|
|
130
138
|
const [, t] = useLanguage();
|
|
131
|
-
const [{ user, token }] = useSession();
|
|
139
|
+
const [{ user, token }, { login }] = useSession();
|
|
132
140
|
const [ordering] = useApi()
|
|
133
141
|
const [{ configs }] = useConfig();
|
|
134
142
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
135
143
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
136
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
|
|
137
150
|
|
|
138
151
|
const [errorCash, setErrorCash] = useState(false);
|
|
139
152
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -145,7 +158,14 @@ const CheckoutUI = (props: any) => {
|
|
|
145
158
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
146
159
|
const [isOpen, setIsOpen] = useState(false)
|
|
147
160
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
148
|
-
|
|
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']
|
|
149
169
|
const placeSpotTypes = [3, 4, 5]
|
|
150
170
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
151
171
|
const isGiftCardCart = !cart?.business_id
|
|
@@ -154,7 +174,15 @@ const CheckoutUI = (props: any) => {
|
|
|
154
174
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
155
175
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
156
176
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
157
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
177
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
178
|
+
const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
|
|
179
|
+
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
180
|
+
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
181
|
+
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
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']
|
|
158
186
|
|
|
159
187
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
160
188
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
@@ -162,12 +190,18 @@ const CheckoutUI = (props: any) => {
|
|
|
162
190
|
return acc = acc + item?.summary?.tax
|
|
163
191
|
return acc = acc
|
|
164
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
|
+
|
|
165
196
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
166
197
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
198
|
+
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
167
199
|
(options.type === 1 &&
|
|
168
200
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
169
201
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
170
|
-
(Number(cart?.driver_tip) <= 0))
|
|
202
|
+
(Number(cart?.driver_tip) <= 0)) ||
|
|
203
|
+
(validateCommentsCartField)
|
|
204
|
+
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
171
205
|
|
|
172
206
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
173
207
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -177,6 +211,9 @@ const CheckoutUI = (props: any) => {
|
|
|
177
211
|
|
|
178
212
|
const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
|
|
179
213
|
|
|
214
|
+
const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
|
|
215
|
+
const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
|
|
216
|
+
const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
|
|
180
217
|
const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
|
|
181
218
|
return {
|
|
182
219
|
value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
|
|
@@ -189,10 +226,36 @@ const CheckoutUI = (props: any) => {
|
|
|
189
226
|
}
|
|
190
227
|
}
|
|
191
228
|
|
|
229
|
+
const vibrateApp = (impact?: string) => {
|
|
230
|
+
const options = {
|
|
231
|
+
enableVibrateFallback: true,
|
|
232
|
+
ignoreAndroidSystemSettings: false
|
|
233
|
+
};
|
|
234
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const handleSuccessSignup = (user: any) => {
|
|
238
|
+
login({
|
|
239
|
+
user,
|
|
240
|
+
token: user?.session?.access_token
|
|
241
|
+
})
|
|
242
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
243
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const handleSuccessLogin = (user: any) => {
|
|
247
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
248
|
+
}
|
|
249
|
+
|
|
192
250
|
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
251
|
+
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
252
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
253
|
+
return
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
257
|
+
vibrateApp()
|
|
258
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment)
|
|
196
259
|
return
|
|
197
260
|
}
|
|
198
261
|
if (requiredFields?.length) {
|
|
@@ -207,6 +270,11 @@ const CheckoutUI = (props: any) => {
|
|
|
207
270
|
setIsUserDetailsEdit(true)
|
|
208
271
|
}
|
|
209
272
|
|
|
273
|
+
const handlePlaceOrderAsGuest = () => {
|
|
274
|
+
setIsOpen(false)
|
|
275
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
276
|
+
}
|
|
277
|
+
|
|
210
278
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
211
279
|
setShowGateway({ closedByUser: false, open: true })
|
|
212
280
|
setWebviewPaymethod(paymethod)
|
|
@@ -225,7 +293,7 @@ const CheckoutUI = (props: any) => {
|
|
|
225
293
|
const checkValidationFields = () => {
|
|
226
294
|
setUserErrors([])
|
|
227
295
|
const errors = []
|
|
228
|
-
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
|
|
296
|
+
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
229
297
|
const _requiredFields: any = []
|
|
230
298
|
|
|
231
299
|
Object.values(validationFields?.fields?.checkout).map((field: any) => {
|
|
@@ -273,7 +341,7 @@ const CheckoutUI = (props: any) => {
|
|
|
273
341
|
useEffect(() => {
|
|
274
342
|
if (cart?.products?.length === 0) {
|
|
275
343
|
if (cart?.business?.slug) {
|
|
276
|
-
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
344
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
|
|
277
345
|
} else {
|
|
278
346
|
onNavigationRedirect('Wallets')
|
|
279
347
|
}
|
|
@@ -299,6 +367,24 @@ const CheckoutUI = (props: any) => {
|
|
|
299
367
|
)
|
|
300
368
|
}
|
|
301
369
|
|
|
370
|
+
useEffect(() => {
|
|
371
|
+
cart && events.emit('checkout_started', cart)
|
|
372
|
+
}, [])
|
|
373
|
+
|
|
374
|
+
useEffect(() => {
|
|
375
|
+
if (cart?.paymethod_data?.gateway === 'credomatic') {
|
|
376
|
+
if (cart?.paymethod_data?.status === 2) {
|
|
377
|
+
setShowGateway({ ...showGateway, open: true })
|
|
378
|
+
} else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
|
|
379
|
+
setShowGateway({ ...showGateway, open: false })
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}, [cart?.paymethod_data])
|
|
383
|
+
|
|
384
|
+
const onTextLayout = useCallback((e: any) => {
|
|
385
|
+
setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
|
|
386
|
+
}, [])
|
|
387
|
+
|
|
302
388
|
return (
|
|
303
389
|
<>
|
|
304
390
|
<Container noPadding>
|
|
@@ -306,11 +392,12 @@ const CheckoutUI = (props: any) => {
|
|
|
306
392
|
<NavBar
|
|
307
393
|
title={t('CHECKOUT', 'Checkout')}
|
|
308
394
|
titleAlign={'center'}
|
|
309
|
-
onActionLeft={() =>
|
|
395
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
310
396
|
showCall={false}
|
|
311
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
397
|
+
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
312
398
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
313
399
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
400
|
+
style={{ marginTop: 20 }}
|
|
314
401
|
/>
|
|
315
402
|
</View>
|
|
316
403
|
<ChContainer style={styles.pagePadding}>
|
|
@@ -353,7 +440,7 @@ const CheckoutUI = (props: any) => {
|
|
|
353
440
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
354
441
|
</ChSection>
|
|
355
442
|
|
|
356
|
-
{!isGiftCardCart && (
|
|
443
|
+
{!isGiftCardCart && !hideBusinessDetails && (
|
|
357
444
|
<ChSection>
|
|
358
445
|
<ChBusinessDetails>
|
|
359
446
|
{
|
|
@@ -384,9 +471,30 @@ const CheckoutUI = (props: any) => {
|
|
|
384
471
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
385
472
|
{businessDetails?.business?.cellphone}
|
|
386
473
|
</OText>
|
|
387
|
-
|
|
388
|
-
{
|
|
389
|
-
|
|
474
|
+
{!hideBusinessAddress && (
|
|
475
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
476
|
+
{businessDetails?.business?.address}
|
|
477
|
+
</OText>
|
|
478
|
+
)}
|
|
479
|
+
{businessDetails?.business?.address_notes && (
|
|
480
|
+
<>
|
|
481
|
+
<OText
|
|
482
|
+
size={12}
|
|
483
|
+
lineHeight={18}
|
|
484
|
+
numberOfLines={isReadMore ? 20 : 3}
|
|
485
|
+
onTextLayout={onTextLayout}
|
|
486
|
+
>
|
|
487
|
+
{businessDetails?.business?.address_notes}
|
|
488
|
+
</OText>
|
|
489
|
+
{lengthMore && (
|
|
490
|
+
<TouchableOpacity
|
|
491
|
+
onPress={() => setIsReadMore(!isReadMore)}
|
|
492
|
+
>
|
|
493
|
+
<OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
494
|
+
</TouchableOpacity>
|
|
495
|
+
)}
|
|
496
|
+
</>
|
|
497
|
+
)}
|
|
390
498
|
</View>
|
|
391
499
|
</>
|
|
392
500
|
)}
|
|
@@ -402,33 +510,63 @@ const CheckoutUI = (props: any) => {
|
|
|
402
510
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
403
511
|
</ChSection>
|
|
404
512
|
)}
|
|
513
|
+
{!hideCustomerDetails && (
|
|
405
514
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
515
|
+
<ChSection>
|
|
516
|
+
<ChUserDetails>
|
|
517
|
+
{cartState.loading ? (
|
|
518
|
+
<Placeholder Animation={Fade}>
|
|
519
|
+
<PlaceholderLine height={20} />
|
|
520
|
+
<PlaceholderLine height={12} />
|
|
521
|
+
<PlaceholderLine height={12} />
|
|
522
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
523
|
+
</Placeholder>
|
|
524
|
+
) : (
|
|
525
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
526
|
+
<View>
|
|
527
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
528
|
+
<OButton
|
|
529
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
530
|
+
textStyle={{ color: theme.colors.white }}
|
|
531
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
532
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
533
|
+
/>
|
|
534
|
+
<OButton
|
|
535
|
+
text={t('LOGIN', 'Login')}
|
|
536
|
+
textStyle={{ color: theme.colors.primary }}
|
|
537
|
+
bgColor={theme.colors.white}
|
|
538
|
+
borderColor={theme.colors.primary}
|
|
539
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
540
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
541
|
+
/>
|
|
542
|
+
<OButton
|
|
543
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
544
|
+
textStyle={{ color: theme.colors.black }}
|
|
545
|
+
bgColor={theme.colors.white}
|
|
546
|
+
borderColor={theme.colors.black}
|
|
547
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
548
|
+
onClick={() => setAllowedGuest(true)}
|
|
549
|
+
/>
|
|
550
|
+
</View>
|
|
551
|
+
) : (
|
|
552
|
+
<UserDetails
|
|
553
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
554
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
555
|
+
cartStatus={cart?.status}
|
|
556
|
+
businessId={cart?.business_id}
|
|
557
|
+
useValidationFields
|
|
558
|
+
useDefualtSessionManager
|
|
559
|
+
useSessionUser
|
|
560
|
+
isCheckout
|
|
561
|
+
phoneUpdate={phoneUpdate}
|
|
562
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
563
|
+
/>
|
|
564
|
+
)
|
|
565
|
+
)}
|
|
566
|
+
</ChUserDetails>
|
|
567
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
568
|
+
</ChSection>
|
|
569
|
+
)}
|
|
432
570
|
|
|
433
571
|
{options?.type === 1 && !isGiftCardCart && (
|
|
434
572
|
<DeliveryOptionsContainer>
|
|
@@ -471,7 +609,7 @@ const CheckoutUI = (props: any) => {
|
|
|
471
609
|
data: deliveryOptions || [],
|
|
472
610
|
renderItem: ({ item }: any) => (
|
|
473
611
|
<TouchableOpacity
|
|
474
|
-
onPress={() => changeDeliveryOption(item.value)}
|
|
612
|
+
onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
|
|
475
613
|
disabled={
|
|
476
614
|
deliveryOptionSelected === item.value
|
|
477
615
|
}
|
|
@@ -509,7 +647,7 @@ const CheckoutUI = (props: any) => {
|
|
|
509
647
|
</ChSection>
|
|
510
648
|
)}
|
|
511
649
|
|
|
512
|
-
{!isGiftCardCart && (
|
|
650
|
+
{!isGiftCardCart && !hideBusinessMap && (
|
|
513
651
|
<ChSection>
|
|
514
652
|
<ChAddress>
|
|
515
653
|
{(businessDetails?.loading || cartState.loading) ? (
|
|
@@ -520,7 +658,7 @@ const CheckoutUI = (props: any) => {
|
|
|
520
658
|
) : (
|
|
521
659
|
<AddressDetails
|
|
522
660
|
navigation={navigation}
|
|
523
|
-
location={
|
|
661
|
+
location={options?.address?.location}
|
|
524
662
|
businessLogo={businessDetails?.business?.logo}
|
|
525
663
|
isCartPending={cart?.status === 2}
|
|
526
664
|
uuid={cartUuid}
|
|
@@ -549,13 +687,14 @@ const CheckoutUI = (props: any) => {
|
|
|
549
687
|
<DriverTips
|
|
550
688
|
uuid={cartUuid}
|
|
551
689
|
businessId={cart?.business_id}
|
|
552
|
-
driverTipsOptions={driverTipsOptions}
|
|
553
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
690
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
691
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
554
692
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
555
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
693
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
556
694
|
? cart?.driver_tip
|
|
557
695
|
: cart?.driver_tip_rate}
|
|
558
696
|
useOrderContext
|
|
697
|
+
cart={cart}
|
|
559
698
|
/>
|
|
560
699
|
</ChDriverTips>
|
|
561
700
|
</ChSection>
|
|
@@ -578,7 +717,7 @@ const CheckoutUI = (props: any) => {
|
|
|
578
717
|
cart={cart}
|
|
579
718
|
isDisabled={cart?.status === 2}
|
|
580
719
|
businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
|
|
581
|
-
|
|
720
|
+
isLoading={!isGiftCardCart ? businessDetails.loading : false}
|
|
582
721
|
paymethods={businessDetails?.business?.paymethods}
|
|
583
722
|
onPaymentChange={handlePaymethodChange}
|
|
584
723
|
errorCash={errorCash}
|
|
@@ -588,6 +727,16 @@ const CheckoutUI = (props: any) => {
|
|
|
588
727
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
589
728
|
handlePlaceOrder={handlePlaceOrder}
|
|
590
729
|
merchantId={merchantId}
|
|
730
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
731
|
+
methodPaySupported={methodPaySupported}
|
|
732
|
+
placeByMethodPay={placeByMethodPay}
|
|
733
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
734
|
+
cardList={cardList}
|
|
735
|
+
setCardList={setCardList}
|
|
736
|
+
requiredFields={requiredFields}
|
|
737
|
+
openUserModal={setIsOpen}
|
|
738
|
+
paymethodClicked={paymethodClicked}
|
|
739
|
+
setPaymethodClicked={setPaymethodClicked}
|
|
591
740
|
/>
|
|
592
741
|
</ChPaymethods>
|
|
593
742
|
</ChSection>
|
|
@@ -597,6 +746,7 @@ const CheckoutUI = (props: any) => {
|
|
|
597
746
|
<WalletPaymentOptionContainer>
|
|
598
747
|
<PaymentOptionWallet
|
|
599
748
|
cart={cart}
|
|
749
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
600
750
|
businessId={cart?.business_id}
|
|
601
751
|
businessConfigs={businessDetails?.business?.configs}
|
|
602
752
|
/>
|
|
@@ -666,6 +816,12 @@ const CheckoutUI = (props: any) => {
|
|
|
666
816
|
isCartPending={cart?.status === 2}
|
|
667
817
|
onNavigationRedirect={onNavigationRedirect}
|
|
668
818
|
placeSpotTypes={placeSpotTypes}
|
|
819
|
+
businessConfigs={businessConfigs}
|
|
820
|
+
maxDate={maxDate}
|
|
821
|
+
loyaltyRewardRate={
|
|
822
|
+
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
823
|
+
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
824
|
+
}
|
|
669
825
|
/>
|
|
670
826
|
</>
|
|
671
827
|
)}
|
|
@@ -675,7 +831,7 @@ const CheckoutUI = (props: any) => {
|
|
|
675
831
|
|
|
676
832
|
{!cartState.loading && cart && (
|
|
677
833
|
<View>
|
|
678
|
-
<ChErrors style={{ marginBottom: 10 }}>
|
|
834
|
+
<ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
|
|
679
835
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
680
836
|
<OText
|
|
681
837
|
color={theme.colors.error}
|
|
@@ -702,6 +858,14 @@ const CheckoutUI = (props: any) => {
|
|
|
702
858
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
703
859
|
</OText>
|
|
704
860
|
)}
|
|
861
|
+
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
862
|
+
<OText
|
|
863
|
+
color={theme.colors.error}
|
|
864
|
+
size={12}
|
|
865
|
+
>
|
|
866
|
+
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
867
|
+
</OText>
|
|
868
|
+
)}
|
|
705
869
|
{options.type === 1 &&
|
|
706
870
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
707
871
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -713,6 +877,15 @@ const CheckoutUI = (props: any) => {
|
|
|
713
877
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
714
878
|
</OText>
|
|
715
879
|
)}
|
|
880
|
+
|
|
881
|
+
{validateCommentsCartField && (
|
|
882
|
+
<OText
|
|
883
|
+
color={theme.colors.error}
|
|
884
|
+
size={12}
|
|
885
|
+
>
|
|
886
|
+
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
887
|
+
</OText>
|
|
888
|
+
)}
|
|
716
889
|
</ChErrors>
|
|
717
890
|
</View>
|
|
718
891
|
)}
|
|
@@ -745,18 +918,59 @@ const CheckoutUI = (props: any) => {
|
|
|
745
918
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
746
919
|
requiredFields={requiredFields}
|
|
747
920
|
hideUpdateButton
|
|
921
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
748
922
|
onClose={() => {
|
|
749
923
|
setIsOpen(false)
|
|
750
|
-
|
|
924
|
+
if (paymethodClicked) {
|
|
925
|
+
setPaymethodClicked({
|
|
926
|
+
...paymethodClicked,
|
|
927
|
+
confirmed: true
|
|
928
|
+
})
|
|
929
|
+
} else {
|
|
930
|
+
handlePlaceOrder(null, true)
|
|
931
|
+
}
|
|
751
932
|
}}
|
|
933
|
+
setIsOpen={setIsOpen}
|
|
752
934
|
/>
|
|
753
935
|
</View>
|
|
754
936
|
</OModal>
|
|
937
|
+
<OModal
|
|
938
|
+
open={openModal.signup}
|
|
939
|
+
onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
|
|
940
|
+
>
|
|
941
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
942
|
+
<SignupForm
|
|
943
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
944
|
+
isGuest
|
|
945
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
946
|
+
useSignupByEmail
|
|
947
|
+
useChekoutFileds
|
|
948
|
+
/>
|
|
949
|
+
</ScrollView>
|
|
950
|
+
</OModal>
|
|
951
|
+
<OModal
|
|
952
|
+
open={openModal.login}
|
|
953
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
954
|
+
>
|
|
955
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
956
|
+
<LoginForm
|
|
957
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
958
|
+
isGuest
|
|
959
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
960
|
+
loginButtonBackground={theme.colors.primary}
|
|
961
|
+
/>
|
|
962
|
+
</ScrollView>
|
|
963
|
+
</OModal>
|
|
755
964
|
</ChContainer>
|
|
756
965
|
</Container>
|
|
757
966
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
758
967
|
<FloatingButton
|
|
759
|
-
handleClick={
|
|
968
|
+
handleClick={
|
|
969
|
+
isDisabledButtonPlace
|
|
970
|
+
? () => vibrateApp()
|
|
971
|
+
: methodsPay.includes(paymethodSelected?.gateway)
|
|
972
|
+
? () => setPlaceByMethodPay(true)
|
|
973
|
+
: () => handlePlaceOrder(null)}
|
|
760
974
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
761
975
|
disabled={isDisabledButtonPlace}
|
|
762
976
|
btnText={subtotalWithTaxes >= cart?.minimum
|
|
@@ -799,6 +1013,29 @@ const CheckoutUI = (props: any) => {
|
|
|
799
1013
|
locationId={'L1NGAY5M6KJRX'}
|
|
800
1014
|
/>
|
|
801
1015
|
)}
|
|
1016
|
+
{cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
|
|
1017
|
+
<PaymentOptionsWebView
|
|
1018
|
+
title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
|
|
1019
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
1020
|
+
uri={credomaticUrl}
|
|
1021
|
+
user={user}
|
|
1022
|
+
cart={cart}
|
|
1023
|
+
additionalParams={{
|
|
1024
|
+
type: 'auth',
|
|
1025
|
+
key_id: credomaticKeyId,
|
|
1026
|
+
hash: cart?.paymethod_data?.result?.hash,
|
|
1027
|
+
time: cart?.paymethod_data?.result?.time,
|
|
1028
|
+
amount: cart?.total,
|
|
1029
|
+
orderid: cart?.uuid,
|
|
1030
|
+
ccnumber: cardList?.cards?.[0]?.number,
|
|
1031
|
+
ccexp: cardList?.cards?.[0]?.expiryString,
|
|
1032
|
+
cvv: cardList?.cards?.[0]?.cvc,
|
|
1033
|
+
redirect: credomaticUrl
|
|
1034
|
+
}}
|
|
1035
|
+
webviewPaymethod={webviewPaymethod}
|
|
1036
|
+
setShowGateway={setShowGateway}
|
|
1037
|
+
/>
|
|
1038
|
+
)}
|
|
802
1039
|
</>
|
|
803
1040
|
)
|
|
804
1041
|
}
|
|
@@ -825,7 +1062,8 @@ export const Checkout = (props: any) => {
|
|
|
825
1062
|
const getOrder = async (cartId: any) => {
|
|
826
1063
|
try {
|
|
827
1064
|
let result: any = {}
|
|
828
|
-
const
|
|
1065
|
+
const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
|
|
1066
|
+
const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
|
|
829
1067
|
if (cart) {
|
|
830
1068
|
result = { ...cart }
|
|
831
1069
|
} 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 }}
|