ordering-ui-react-native 0.17.55 → 0.17.56-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/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 +4 -4
- 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 +265 -240
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +125 -113
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +42 -5
- 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/NewOrderNotification/index.tsx +35 -21
- 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 +93 -50
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +64 -63
- 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 +113 -121
- package/themes/business/src/components/OrdersOption/index.tsx +32 -75
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +249 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- package/themes/business/src/components/ReviewCustomer/index.tsx +30 -15
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
- package/themes/business/src/components/shared/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +28 -12
- 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 +4 -0
- package/themes/original/src/components/AddressDetails/index.tsx +28 -10
- package/themes/original/src/components/AddressForm/index.tsx +68 -40
- package/themes/original/src/components/AddressList/index.tsx +27 -22
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- 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 +122 -68
- package/themes/original/src/components/BusinessController/styles.tsx +23 -4
- 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 +110 -108
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +352 -326
- 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 +25 -15
- 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 +683 -535
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +96 -91
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -4
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +77 -50
- package/themes/original/src/components/CartContent/index.tsx +117 -20
- package/themes/original/src/components/CartContent/styles.tsx +17 -7
- package/themes/original/src/components/Checkout/index.tsx +359 -171
- package/themes/original/src/components/Checkout/styles.tsx +4 -2
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- 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 +8 -9
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +51 -80
- package/themes/original/src/components/FloatingButton/index.tsx +1 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +15 -4
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
- package/themes/original/src/components/HelpGuide/index.tsx +6 -6
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +6 -15
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- 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 +55 -13
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +64 -26
- package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
- package/themes/original/src/components/MessageListing/index.tsx +16 -42
- package/themes/original/src/components/Messages/index.tsx +32 -10
- package/themes/original/src/components/MomentOption/index.tsx +194 -89
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +151 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
- 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 +68 -21
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +65 -52
- package/themes/original/src/components/NavBar/index.tsx +18 -18
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +46 -50
- package/themes/original/src/components/Notifications/styles.tsx +6 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
- package/themes/original/src/components/OrderDetails/index.tsx +190 -358
- 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 -59
- package/themes/original/src/components/OrderSummary/index.tsx +85 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +78 -67
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +106 -31
- package/themes/original/src/components/PageBanner/styles.tsx +4 -4
- 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 +64 -7
- package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
- package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
- package/themes/original/src/components/ProductForm/index.tsx +109 -33
- package/themes/original/src/components/ProductForm/styles.tsx +5 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +22 -19
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +24 -14
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +3 -4
- 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 +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +10 -3
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +66 -17
- 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 -20
- package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
- package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +71 -34
- package/themes/original/src/components/SingleProductCard/styles.tsx +21 -4
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- 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 +8 -4
- package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +88 -79
- package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- 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 +67 -24
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- 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/layouts/Container.tsx +1 -1
- package/themes/original/src/types/index.tsx +41 -11
- package/themes/original/src/utils/index.tsx +273 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager } from 'react-native';
|
|
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,
|
|
@@ -49,7 +53,7 @@ import { FloatingButton } from '../FloatingButton';
|
|
|
49
53
|
import { Container } from '../../layouts/Container';
|
|
50
54
|
import NavBar from '../NavBar';
|
|
51
55
|
import { OrderSummary } from '../OrderSummary';
|
|
52
|
-
import { getTypesText } from '../../utils';
|
|
56
|
+
import { getTypesText, vibrateApp } from '../../utils';
|
|
53
57
|
import { CartStoresListing } from '../CartStoresListing';
|
|
54
58
|
import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
|
|
55
59
|
|
|
@@ -78,6 +82,7 @@ const CheckoutUI = (props: any) => {
|
|
|
78
82
|
placing,
|
|
79
83
|
cartState,
|
|
80
84
|
cartUuid,
|
|
85
|
+
loyaltyPlansState,
|
|
81
86
|
businessDetails,
|
|
82
87
|
paymethodSelected,
|
|
83
88
|
handlePaymethodChange,
|
|
@@ -87,7 +92,9 @@ const CheckoutUI = (props: any) => {
|
|
|
87
92
|
instructionsOptions,
|
|
88
93
|
handleChangeDeliveryOption,
|
|
89
94
|
currency,
|
|
90
|
-
merchantId
|
|
95
|
+
merchantId,
|
|
96
|
+
setPlaceSpotNumber,
|
|
97
|
+
maxDate
|
|
91
98
|
} = props
|
|
92
99
|
|
|
93
100
|
const theme = useTheme();
|
|
@@ -127,12 +134,13 @@ const CheckoutUI = (props: any) => {
|
|
|
127
134
|
|
|
128
135
|
const [, { showToast }] = useToast();
|
|
129
136
|
const [, t] = useLanguage();
|
|
130
|
-
const [{ user, token }] = useSession();
|
|
137
|
+
const [{ user, token }, { login }] = useSession();
|
|
131
138
|
const [ordering] = useApi()
|
|
132
139
|
const [{ configs }] = useConfig();
|
|
133
140
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
134
141
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
135
142
|
const [validationFields] = useValidationFields();
|
|
143
|
+
const [events] = useEvent()
|
|
136
144
|
|
|
137
145
|
const [errorCash, setErrorCash] = useState(false);
|
|
138
146
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -144,14 +152,29 @@ const CheckoutUI = (props: any) => {
|
|
|
144
152
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
145
153
|
const [isOpen, setIsOpen] = useState(false)
|
|
146
154
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
147
|
-
|
|
155
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false })
|
|
156
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
157
|
+
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
158
|
+
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
159
|
+
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
160
|
+
const cardsMethods = ['credomatic']
|
|
148
161
|
const placeSpotTypes = [3, 4, 5]
|
|
149
162
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
163
|
+
const isGiftCardCart = !cart?.business_id
|
|
150
164
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
151
165
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
152
166
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
153
167
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
154
168
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
169
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
170
|
+
const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
|
|
171
|
+
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
172
|
+
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
173
|
+
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
174
|
+
|
|
175
|
+
const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
176
|
+
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
|
|
177
|
+
const methodsPay = ['google_pay', 'apple_pay']
|
|
155
178
|
|
|
156
179
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
157
180
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
@@ -159,13 +182,18 @@ const CheckoutUI = (props: any) => {
|
|
|
159
182
|
return acc = acc + item?.summary?.tax
|
|
160
183
|
return acc = acc
|
|
161
184
|
}, cart?.subtotal)
|
|
185
|
+
|
|
186
|
+
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
187
|
+
|
|
162
188
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
163
189
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
164
|
-
|
|
190
|
+
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
165
191
|
(options.type === 1 &&
|
|
166
192
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
167
193
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
168
|
-
(Number(cart?.driver_tip) <= 0))
|
|
194
|
+
(Number(cart?.driver_tip) <= 0)) ||
|
|
195
|
+
(validateCommentsCartField)
|
|
196
|
+
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
169
197
|
|
|
170
198
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
171
199
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -175,6 +203,9 @@ const CheckoutUI = (props: any) => {
|
|
|
175
203
|
|
|
176
204
|
const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
|
|
177
205
|
|
|
206
|
+
const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
|
|
207
|
+
const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
|
|
208
|
+
const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
|
|
178
209
|
const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
|
|
179
210
|
return {
|
|
180
211
|
value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
|
|
@@ -187,9 +218,30 @@ const CheckoutUI = (props: any) => {
|
|
|
187
218
|
}
|
|
188
219
|
}
|
|
189
220
|
|
|
221
|
+
const vibrateApp = (impact?: string) => {
|
|
222
|
+
const options = {
|
|
223
|
+
enableVibrateFallback: true,
|
|
224
|
+
ignoreAndroidSystemSettings: false
|
|
225
|
+
};
|
|
226
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const handleSuccessSignup = (user: any) => {
|
|
230
|
+
login({
|
|
231
|
+
user,
|
|
232
|
+
token: user?.session?.access_token
|
|
233
|
+
})
|
|
234
|
+
setOpenModal({ ...openModal, signup: false })
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const handleSuccessLogin = (user: any) => {
|
|
238
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
239
|
+
}
|
|
240
|
+
|
|
190
241
|
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
191
|
-
if (!userErrors.length && !requiredFields?.length || forcePlace) {
|
|
192
|
-
|
|
242
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
243
|
+
vibrateApp()
|
|
244
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment)
|
|
193
245
|
return
|
|
194
246
|
}
|
|
195
247
|
if (requiredFields?.length) {
|
|
@@ -204,6 +256,11 @@ const CheckoutUI = (props: any) => {
|
|
|
204
256
|
setIsUserDetailsEdit(true)
|
|
205
257
|
}
|
|
206
258
|
|
|
259
|
+
const handlePlaceOrderAsGuest = () => {
|
|
260
|
+
setIsOpen(false)
|
|
261
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
262
|
+
}
|
|
263
|
+
|
|
207
264
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
208
265
|
setShowGateway({ closedByUser: false, open: true })
|
|
209
266
|
setWebviewPaymethod(paymethod)
|
|
@@ -267,13 +324,13 @@ const CheckoutUI = (props: any) => {
|
|
|
267
324
|
}
|
|
268
325
|
}, [errors])
|
|
269
326
|
|
|
270
|
-
// useEffect(() => {
|
|
271
|
-
// handlePaymethodChange(null)
|
|
272
|
-
// }, [cart?.total])
|
|
273
|
-
|
|
274
327
|
useEffect(() => {
|
|
275
328
|
if (cart?.products?.length === 0) {
|
|
276
|
-
|
|
329
|
+
if (cart?.business?.slug) {
|
|
330
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
331
|
+
} else {
|
|
332
|
+
onNavigationRedirect('Wallets')
|
|
333
|
+
}
|
|
277
334
|
}
|
|
278
335
|
}, [cart?.products])
|
|
279
336
|
|
|
@@ -281,6 +338,35 @@ const CheckoutUI = (props: any) => {
|
|
|
281
338
|
onFailPaypal()
|
|
282
339
|
}, [showGateway.closedByUser])
|
|
283
340
|
|
|
341
|
+
const HeaderTitle = (props: any) => {
|
|
342
|
+
const { text } = props
|
|
343
|
+
return (
|
|
344
|
+
<OText
|
|
345
|
+
size={16}
|
|
346
|
+
lineHeight={24}
|
|
347
|
+
weight={'500'}
|
|
348
|
+
mBottom={props.mb ?? 10}
|
|
349
|
+
color={theme.colors.textNormal}
|
|
350
|
+
>
|
|
351
|
+
{text}
|
|
352
|
+
</OText>
|
|
353
|
+
)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
useEffect(() => {
|
|
357
|
+
cart && events.emit('checkout_started', cart)
|
|
358
|
+
}, [])
|
|
359
|
+
|
|
360
|
+
useEffect(() => {
|
|
361
|
+
if (cart?.paymethod_data?.gateway === 'credomatic') {
|
|
362
|
+
if (cart?.paymethod_data?.status === 2) {
|
|
363
|
+
setShowGateway({ ...showGateway, open: true })
|
|
364
|
+
} else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
|
|
365
|
+
setShowGateway({ ...showGateway, open: false })
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}, [cart?.paymethod_data])
|
|
369
|
+
|
|
284
370
|
return (
|
|
285
371
|
<>
|
|
286
372
|
<Container noPadding>
|
|
@@ -288,23 +374,31 @@ const CheckoutUI = (props: any) => {
|
|
|
288
374
|
<NavBar
|
|
289
375
|
title={t('CHECKOUT', 'Checkout')}
|
|
290
376
|
titleAlign={'center'}
|
|
291
|
-
onActionLeft={() =>
|
|
377
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
292
378
|
showCall={false}
|
|
293
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
379
|
+
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
294
380
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
295
381
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
382
|
+
style={{ marginTop: 20 }}
|
|
296
383
|
/>
|
|
297
384
|
</View>
|
|
298
385
|
<ChContainer style={styles.pagePadding}>
|
|
299
386
|
<ChSection style={{ paddingTop: 0 }}>
|
|
300
387
|
<ChHeader>
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
388
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
389
|
+
<OText
|
|
390
|
+
size={12}
|
|
391
|
+
numberOfLines={1}
|
|
392
|
+
ellipsizeMode={'tail'}
|
|
393
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
394
|
+
>
|
|
395
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
396
|
+
</OText>
|
|
304
397
|
<OIcon
|
|
305
398
|
src={theme.images.general.arrow_down}
|
|
306
399
|
width={10}
|
|
307
400
|
style={{ marginStart: 8 }}
|
|
401
|
+
{...(isChewLayout && { color: 'white' })}
|
|
308
402
|
/>
|
|
309
403
|
</CHMomentWrapper>
|
|
310
404
|
<CHMomentWrapper
|
|
@@ -328,85 +422,116 @@ const CheckoutUI = (props: any) => {
|
|
|
328
422
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
329
423
|
</ChSection>
|
|
330
424
|
|
|
331
|
-
|
|
332
|
-
<
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
425
|
+
{!isGiftCardCart && !hideBusinessDetails && (
|
|
426
|
+
<ChSection>
|
|
427
|
+
<ChBusinessDetails>
|
|
428
|
+
{
|
|
429
|
+
(businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
|
|
430
|
+
!businessDetails?.error &&
|
|
431
|
+
(
|
|
432
|
+
<Placeholder Animation={Fade}>
|
|
433
|
+
<PlaceholderLine height={20} />
|
|
434
|
+
<PlaceholderLine height={12} />
|
|
435
|
+
<PlaceholderLine height={12} />
|
|
436
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
437
|
+
</Placeholder>
|
|
438
|
+
)}
|
|
439
|
+
{
|
|
440
|
+
!cartState.loading &&
|
|
441
|
+
businessDetails?.business &&
|
|
442
|
+
Object.values(businessDetails?.business).length > 0 &&
|
|
443
|
+
(
|
|
444
|
+
<>
|
|
445
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
446
|
+
<View>
|
|
447
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
448
|
+
{businessDetails?.business?.name}
|
|
449
|
+
</OText>
|
|
450
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
451
|
+
{businessDetails?.business?.email}
|
|
452
|
+
</OText>
|
|
453
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
454
|
+
{businessDetails?.business?.cellphone}
|
|
455
|
+
</OText>
|
|
456
|
+
{!hideBusinessAddress && (
|
|
457
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
458
|
+
{businessDetails?.business?.address}
|
|
459
|
+
</OText>
|
|
460
|
+
)}
|
|
461
|
+
</View>
|
|
462
|
+
</>
|
|
463
|
+
)}
|
|
464
|
+
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
465
|
+
<View>
|
|
466
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
467
|
+
<NotFoundSource
|
|
468
|
+
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
469
|
+
/>
|
|
470
|
+
</View>
|
|
471
|
+
)}
|
|
472
|
+
</ChBusinessDetails>
|
|
473
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
474
|
+
</ChSection>
|
|
475
|
+
)}
|
|
476
|
+
{!hideCustomerDetails && (
|
|
477
|
+
|
|
478
|
+
<ChSection>
|
|
479
|
+
<ChUserDetails>
|
|
480
|
+
{cartState.loading ? (
|
|
337
481
|
<Placeholder Animation={Fade}>
|
|
338
482
|
<PlaceholderLine height={20} />
|
|
339
483
|
<PlaceholderLine height={12} />
|
|
340
484
|
<PlaceholderLine height={12} />
|
|
341
485
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
342
486
|
</Placeholder>
|
|
343
|
-
)
|
|
344
|
-
|
|
345
|
-
!cartState.loading &&
|
|
346
|
-
businessDetails?.business &&
|
|
347
|
-
Object.values(businessDetails?.business).length > 0 &&
|
|
348
|
-
(
|
|
349
|
-
<>
|
|
350
|
-
<OText size={16} lineHeight={24} weight={'500'} mBottom={10} color={theme.colors.textNormal}>
|
|
351
|
-
{t('BUSINESS_DETAILS', 'Business Details')}
|
|
352
|
-
</OText>
|
|
487
|
+
) : (
|
|
488
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
353
489
|
<View>
|
|
354
|
-
<
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
{
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
{
|
|
365
|
-
|
|
490
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
491
|
+
<OButton
|
|
492
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
493
|
+
textStyle={{ color: theme.colors.white }}
|
|
494
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
495
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
496
|
+
/>
|
|
497
|
+
<OButton
|
|
498
|
+
text={t('LOGIN', 'Login')}
|
|
499
|
+
textStyle={{ color: theme.colors.primary }}
|
|
500
|
+
bgColor={theme.colors.white}
|
|
501
|
+
borderColor={theme.colors.primary}
|
|
502
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
503
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
504
|
+
/>
|
|
505
|
+
<OButton
|
|
506
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
507
|
+
textStyle={{ color: theme.colors.black }}
|
|
508
|
+
bgColor={theme.colors.white}
|
|
509
|
+
borderColor={theme.colors.black}
|
|
510
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
511
|
+
onClick={() => setAllowedGuest(true)}
|
|
512
|
+
/>
|
|
366
513
|
</View>
|
|
367
|
-
|
|
514
|
+
) : (
|
|
515
|
+
<UserDetails
|
|
516
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
517
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
518
|
+
cartStatus={cart?.status}
|
|
519
|
+
businessId={cart?.business_id}
|
|
520
|
+
useValidationFields
|
|
521
|
+
useDefualtSessionManager
|
|
522
|
+
useSessionUser
|
|
523
|
+
isCheckout
|
|
524
|
+
phoneUpdate={phoneUpdate}
|
|
525
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
526
|
+
/>
|
|
527
|
+
)
|
|
368
528
|
)}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
</OText>
|
|
374
|
-
<NotFoundSource
|
|
375
|
-
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
376
|
-
/>
|
|
377
|
-
</View>
|
|
378
|
-
)}
|
|
379
|
-
</ChBusinessDetails>
|
|
380
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
381
|
-
</ChSection>
|
|
382
|
-
|
|
383
|
-
<ChSection>
|
|
384
|
-
<ChUserDetails>
|
|
385
|
-
{cartState.loading ? (
|
|
386
|
-
<Placeholder Animation={Fade}>
|
|
387
|
-
<PlaceholderLine height={20} />
|
|
388
|
-
<PlaceholderLine height={12} />
|
|
389
|
-
<PlaceholderLine height={12} />
|
|
390
|
-
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
391
|
-
</Placeholder>
|
|
392
|
-
) : (
|
|
393
|
-
<UserDetails
|
|
394
|
-
isUserDetailsEdit={isUserDetailsEdit}
|
|
395
|
-
cartStatus={cart?.status}
|
|
396
|
-
businessId={cart?.business_id}
|
|
397
|
-
useValidationFields
|
|
398
|
-
useDefualtSessionManager
|
|
399
|
-
useSessionUser
|
|
400
|
-
isCheckout
|
|
401
|
-
phoneUpdate={phoneUpdate}
|
|
402
|
-
togglePhoneUpdate={togglePhoneUpdate}
|
|
403
|
-
/>
|
|
404
|
-
)}
|
|
405
|
-
</ChUserDetails>
|
|
406
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
407
|
-
</ChSection>
|
|
529
|
+
</ChUserDetails>
|
|
530
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
531
|
+
</ChSection>
|
|
532
|
+
)}
|
|
408
533
|
|
|
409
|
-
{options?.type === 1 && (
|
|
534
|
+
{options?.type === 1 && !isGiftCardCart && (
|
|
410
535
|
<DeliveryOptionsContainer>
|
|
411
536
|
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
412
537
|
<View style={{ height: 110 }}>
|
|
@@ -416,8 +541,8 @@ const CheckoutUI = (props: any) => {
|
|
|
416
541
|
</Placeholder>
|
|
417
542
|
</View>
|
|
418
543
|
) : (
|
|
419
|
-
|
|
420
|
-
<
|
|
544
|
+
<ChSection>
|
|
545
|
+
<HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
|
|
421
546
|
<View
|
|
422
547
|
style={{
|
|
423
548
|
backgroundColor: theme.colors.inputDisabled,
|
|
@@ -436,7 +561,7 @@ const CheckoutUI = (props: any) => {
|
|
|
436
561
|
<OText
|
|
437
562
|
size={14}
|
|
438
563
|
>
|
|
439
|
-
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)
|
|
564
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
|
|
440
565
|
</OText>
|
|
441
566
|
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
442
567
|
</DeliveryOptionItem>
|
|
@@ -447,7 +572,7 @@ const CheckoutUI = (props: any) => {
|
|
|
447
572
|
data: deliveryOptions || [],
|
|
448
573
|
renderItem: ({ item }: any) => (
|
|
449
574
|
<TouchableOpacity
|
|
450
|
-
onPress={() => changeDeliveryOption(item.value)}
|
|
575
|
+
onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
|
|
451
576
|
disabled={
|
|
452
577
|
deliveryOptionSelected === item.value
|
|
453
578
|
}
|
|
@@ -463,7 +588,7 @@ const CheckoutUI = (props: any) => {
|
|
|
463
588
|
/>
|
|
464
589
|
</View>
|
|
465
590
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
466
|
-
|
|
591
|
+
</ChSection>
|
|
467
592
|
)}
|
|
468
593
|
|
|
469
594
|
</DeliveryOptionsContainer>
|
|
@@ -485,50 +610,30 @@ const CheckoutUI = (props: any) => {
|
|
|
485
610
|
</ChSection>
|
|
486
611
|
)}
|
|
487
612
|
|
|
488
|
-
{
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
<ChAddress>
|
|
513
|
-
{(businessDetails?.loading || cartState.loading) ? (
|
|
514
|
-
<Placeholder Animation={Fade}>
|
|
515
|
-
<PlaceholderLine height={20} style={{ marginBottom: 50 }} />
|
|
516
|
-
<PlaceholderLine height={100} />
|
|
517
|
-
</Placeholder>
|
|
518
|
-
) : (
|
|
519
|
-
<AddressDetails
|
|
520
|
-
navigation={navigation}
|
|
521
|
-
location={businessDetails?.business?.location}
|
|
522
|
-
businessLogo={businessDetails?.business?.logo}
|
|
523
|
-
isCartPending={cart?.status === 2}
|
|
524
|
-
uuid={cartUuid}
|
|
525
|
-
apiKey={configs?.google_maps_api_key?.value}
|
|
526
|
-
mapConfigs={mapConfigs}
|
|
527
|
-
/>
|
|
528
|
-
)}
|
|
529
|
-
</ChAddress>
|
|
530
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
531
|
-
</ChSection>
|
|
613
|
+
{!isGiftCardCart && !hideBusinessMap && (
|
|
614
|
+
<ChSection>
|
|
615
|
+
<ChAddress>
|
|
616
|
+
{(businessDetails?.loading || cartState.loading) ? (
|
|
617
|
+
<Placeholder Animation={Fade}>
|
|
618
|
+
<PlaceholderLine height={20} style={{ marginBottom: 50 }} />
|
|
619
|
+
<PlaceholderLine height={100} />
|
|
620
|
+
</Placeholder>
|
|
621
|
+
) : (
|
|
622
|
+
<AddressDetails
|
|
623
|
+
navigation={navigation}
|
|
624
|
+
location={options?.address?.location}
|
|
625
|
+
businessLogo={businessDetails?.business?.logo}
|
|
626
|
+
isCartPending={cart?.status === 2}
|
|
627
|
+
uuid={cartUuid}
|
|
628
|
+
apiKey={configs?.google_maps_api_key?.value}
|
|
629
|
+
mapConfigs={mapConfigs}
|
|
630
|
+
HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
|
|
631
|
+
/>
|
|
632
|
+
)}
|
|
633
|
+
</ChAddress>
|
|
634
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
635
|
+
</ChSection>
|
|
636
|
+
)}
|
|
532
637
|
|
|
533
638
|
{!cartState.loading &&
|
|
534
639
|
cart &&
|
|
@@ -537,22 +642,22 @@ const CheckoutUI = (props: any) => {
|
|
|
537
642
|
cart?.status !== 2 &&
|
|
538
643
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
539
644
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
645
|
+
!isGiftCardCart &&
|
|
540
646
|
(
|
|
541
647
|
<ChSection>
|
|
542
648
|
<ChDriverTips>
|
|
543
|
-
<
|
|
544
|
-
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
545
|
-
</OText>
|
|
649
|
+
<HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
|
|
546
650
|
<DriverTips
|
|
547
651
|
uuid={cartUuid}
|
|
548
652
|
businessId={cart?.business_id}
|
|
549
|
-
driverTipsOptions={driverTipsOptions}
|
|
550
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
653
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
654
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
551
655
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
552
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
656
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
553
657
|
? cart?.driver_tip
|
|
554
658
|
: cart?.driver_tip_rate}
|
|
555
659
|
useOrderContext
|
|
660
|
+
cart={cart}
|
|
556
661
|
/>
|
|
557
662
|
</ChDriverTips>
|
|
558
663
|
</ChSection>
|
|
@@ -561,9 +666,7 @@ const CheckoutUI = (props: any) => {
|
|
|
561
666
|
{!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
|
|
562
667
|
<ChSection>
|
|
563
668
|
<ChPaymethods>
|
|
564
|
-
<
|
|
565
|
-
{t('PAYMENT_METHOD', 'Payment Method')}
|
|
566
|
-
</OText>
|
|
669
|
+
<HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
|
|
567
670
|
{!cartState.loading && cart?.status === 4 && (
|
|
568
671
|
<OText
|
|
569
672
|
style={{ textAlign: 'center', marginTop: 20 }}
|
|
@@ -576,8 +679,8 @@ const CheckoutUI = (props: any) => {
|
|
|
576
679
|
<PaymentOptions
|
|
577
680
|
cart={cart}
|
|
578
681
|
isDisabled={cart?.status === 2}
|
|
579
|
-
businessId={businessDetails?.business?.id}
|
|
580
|
-
isLoading={businessDetails.loading}
|
|
682
|
+
businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
|
|
683
|
+
isLoading={!isGiftCardCart ? businessDetails.loading : false}
|
|
581
684
|
paymethods={businessDetails?.business?.paymethods}
|
|
582
685
|
onPaymentChange={handlePaymethodChange}
|
|
583
686
|
errorCash={errorCash}
|
|
@@ -587,6 +690,12 @@ const CheckoutUI = (props: any) => {
|
|
|
587
690
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
588
691
|
handlePlaceOrder={handlePlaceOrder}
|
|
589
692
|
merchantId={merchantId}
|
|
693
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
694
|
+
methodPaySupported={methodPaySupported}
|
|
695
|
+
placeByMethodPay={placeByMethodPay}
|
|
696
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
697
|
+
cardList={cardList}
|
|
698
|
+
setCardList={setCardList}
|
|
590
699
|
/>
|
|
591
700
|
</ChPaymethods>
|
|
592
701
|
</ChSection>
|
|
@@ -596,6 +705,7 @@ const CheckoutUI = (props: any) => {
|
|
|
596
705
|
<WalletPaymentOptionContainer>
|
|
597
706
|
<PaymentOptionWallet
|
|
598
707
|
cart={cart}
|
|
708
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
599
709
|
businessId={cart?.business_id}
|
|
600
710
|
businessConfigs={businessDetails?.business?.configs}
|
|
601
711
|
/>
|
|
@@ -603,7 +713,7 @@ const CheckoutUI = (props: any) => {
|
|
|
603
713
|
)}
|
|
604
714
|
|
|
605
715
|
|
|
606
|
-
{!cartState.loading && placeSpotsEnabled && (
|
|
716
|
+
{!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
|
|
607
717
|
<>
|
|
608
718
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
|
|
609
719
|
<PlaceSpot
|
|
@@ -611,6 +721,7 @@ const CheckoutUI = (props: any) => {
|
|
|
611
721
|
isInputMode
|
|
612
722
|
cart={cart}
|
|
613
723
|
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
724
|
+
setPlaceSpotNumber={setPlaceSpotNumber}
|
|
614
725
|
vehicleDefault={cart?.vehicle}
|
|
615
726
|
/>
|
|
616
727
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -628,25 +739,21 @@ const CheckoutUI = (props: any) => {
|
|
|
628
739
|
) : (
|
|
629
740
|
<>
|
|
630
741
|
<CartHeader>
|
|
631
|
-
<
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
>
|
|
636
|
-
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
637
|
-
</OText>
|
|
638
|
-
<TouchableOpacity
|
|
639
|
-
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
640
|
-
>
|
|
641
|
-
<OText
|
|
642
|
-
size={12}
|
|
643
|
-
lineHeight={15}
|
|
644
|
-
color={theme.colors.primary}
|
|
645
|
-
style={{ textDecorationLine: 'underline' }}
|
|
742
|
+
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
743
|
+
{!isGiftCardCart && (
|
|
744
|
+
<TouchableOpacity
|
|
745
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
646
746
|
>
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
747
|
+
<OText
|
|
748
|
+
size={12}
|
|
749
|
+
lineHeight={15}
|
|
750
|
+
color={theme.colors.primary}
|
|
751
|
+
style={{ textDecorationLine: 'underline' }}
|
|
752
|
+
>
|
|
753
|
+
{t('ADD_PRODUCTS', 'Add products')}
|
|
754
|
+
</OText>
|
|
755
|
+
</TouchableOpacity>
|
|
756
|
+
)}
|
|
650
757
|
</CartHeader>
|
|
651
758
|
{isBusinessChangeEnabled && (
|
|
652
759
|
<TouchableOpacity
|
|
@@ -668,6 +775,12 @@ const CheckoutUI = (props: any) => {
|
|
|
668
775
|
isCartPending={cart?.status === 2}
|
|
669
776
|
onNavigationRedirect={onNavigationRedirect}
|
|
670
777
|
placeSpotTypes={placeSpotTypes}
|
|
778
|
+
businessConfigs={businessConfigs}
|
|
779
|
+
maxDate={maxDate}
|
|
780
|
+
loyaltyRewardRate={
|
|
781
|
+
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
782
|
+
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
783
|
+
}
|
|
671
784
|
/>
|
|
672
785
|
</>
|
|
673
786
|
)}
|
|
@@ -677,7 +790,7 @@ const CheckoutUI = (props: any) => {
|
|
|
677
790
|
|
|
678
791
|
{!cartState.loading && cart && (
|
|
679
792
|
<View>
|
|
680
|
-
<ChErrors style={{ marginBottom: 10 }}>
|
|
793
|
+
<ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
|
|
681
794
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
682
795
|
<OText
|
|
683
796
|
color={theme.colors.error}
|
|
@@ -704,6 +817,14 @@ const CheckoutUI = (props: any) => {
|
|
|
704
817
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
705
818
|
</OText>
|
|
706
819
|
)}
|
|
820
|
+
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
821
|
+
<OText
|
|
822
|
+
color={theme.colors.error}
|
|
823
|
+
size={12}
|
|
824
|
+
>
|
|
825
|
+
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
826
|
+
</OText>
|
|
827
|
+
)}
|
|
707
828
|
{options.type === 1 &&
|
|
708
829
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
709
830
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -715,6 +836,15 @@ const CheckoutUI = (props: any) => {
|
|
|
715
836
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
716
837
|
</OText>
|
|
717
838
|
)}
|
|
839
|
+
|
|
840
|
+
{validateCommentsCartField && (
|
|
841
|
+
<OText
|
|
842
|
+
color={theme.colors.error}
|
|
843
|
+
size={12}
|
|
844
|
+
>
|
|
845
|
+
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
846
|
+
</OText>
|
|
847
|
+
)}
|
|
718
848
|
</ChErrors>
|
|
719
849
|
</View>
|
|
720
850
|
)}
|
|
@@ -747,18 +877,52 @@ const CheckoutUI = (props: any) => {
|
|
|
747
877
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
748
878
|
requiredFields={requiredFields}
|
|
749
879
|
hideUpdateButton
|
|
880
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
750
881
|
onClose={() => {
|
|
751
882
|
setIsOpen(false)
|
|
752
883
|
handlePlaceOrder(null, true)
|
|
753
884
|
}}
|
|
885
|
+
setIsOpen={setIsOpen}
|
|
754
886
|
/>
|
|
755
887
|
</View>
|
|
756
888
|
</OModal>
|
|
889
|
+
<OModal
|
|
890
|
+
open={openModal.signup}
|
|
891
|
+
onClose={() => setOpenModal({ ...openModal, signup: false })}
|
|
892
|
+
>
|
|
893
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
894
|
+
<SignupForm
|
|
895
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
896
|
+
isGuest
|
|
897
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
898
|
+
useSignupByEmail
|
|
899
|
+
useChekoutFileds
|
|
900
|
+
/>
|
|
901
|
+
</ScrollView>
|
|
902
|
+
</OModal>
|
|
903
|
+
<OModal
|
|
904
|
+
open={openModal.login}
|
|
905
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
906
|
+
>
|
|
907
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
908
|
+
<LoginForm
|
|
909
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
910
|
+
isGuest
|
|
911
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
912
|
+
loginButtonBackground={theme.colors.primary}
|
|
913
|
+
/>
|
|
914
|
+
</ScrollView>
|
|
915
|
+
</OModal>
|
|
757
916
|
</ChContainer>
|
|
758
917
|
</Container>
|
|
759
918
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
760
919
|
<FloatingButton
|
|
761
|
-
handleClick={
|
|
920
|
+
handleClick={
|
|
921
|
+
isDisabledButtonPlace
|
|
922
|
+
? () => vibrateApp()
|
|
923
|
+
: methodsPay.includes(paymethodSelected?.gateway)
|
|
924
|
+
? () => setPlaceByMethodPay(true)
|
|
925
|
+
: () => handlePlaceOrder(null)}
|
|
762
926
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
763
927
|
disabled={isDisabledButtonPlace}
|
|
764
928
|
btnText={subtotalWithTaxes >= cart?.minimum
|
|
@@ -801,6 +965,29 @@ const CheckoutUI = (props: any) => {
|
|
|
801
965
|
locationId={'L1NGAY5M6KJRX'}
|
|
802
966
|
/>
|
|
803
967
|
)}
|
|
968
|
+
{cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
|
|
969
|
+
<PaymentOptionsWebView
|
|
970
|
+
title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
|
|
971
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
972
|
+
uri={credomaticUrl}
|
|
973
|
+
user={user}
|
|
974
|
+
cart={cart}
|
|
975
|
+
additionalParams={{
|
|
976
|
+
type: 'auth',
|
|
977
|
+
key_id: credomaticKeyId,
|
|
978
|
+
hash: cart?.paymethod_data?.result?.hash,
|
|
979
|
+
time: cart?.paymethod_data?.result?.time,
|
|
980
|
+
amount: cart?.total,
|
|
981
|
+
orderid: cart?.uuid,
|
|
982
|
+
ccnumber: cardList?.cards?.[0]?.number,
|
|
983
|
+
ccexp: cardList?.cards?.[0]?.expiryString,
|
|
984
|
+
cvv: cardList?.cards?.[0]?.cvc,
|
|
985
|
+
redirect: credomaticUrl
|
|
986
|
+
}}
|
|
987
|
+
webviewPaymethod={webviewPaymethod}
|
|
988
|
+
setShowGateway={setShowGateway}
|
|
989
|
+
/>
|
|
990
|
+
)}
|
|
804
991
|
</>
|
|
805
992
|
)
|
|
806
993
|
}
|
|
@@ -827,7 +1014,8 @@ export const Checkout = (props: any) => {
|
|
|
827
1014
|
const getOrder = async (cartId: any) => {
|
|
828
1015
|
try {
|
|
829
1016
|
let result: any = {}
|
|
830
|
-
const
|
|
1017
|
+
const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
|
|
1018
|
+
const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
|
|
831
1019
|
if (cart) {
|
|
832
1020
|
result = { ...cart }
|
|
833
1021
|
} else {
|