ordering-ui-react-native 0.17.34 → 0.17.35-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 +119 -120
- package/src/components/StripeMethodForm/index.tsx +108 -79
- 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 +7 -1
- 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 +118 -107
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
- package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/business/src/components/LoginForm/index.tsx +238 -80
- package/themes/business/src/components/LoginForm/styles.tsx +10 -0
- package/themes/business/src/components/MapView/index.tsx +10 -10
- package/themes/business/src/components/NewOrderNotification/index.tsx +43 -50
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +90 -47
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
- 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 +18 -17
- 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 +250 -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 +41 -24
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- 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 +32 -2
- package/themes/business/src/utils/index.tsx +44 -1
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
- package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
- package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
- 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 +3 -2
- package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
- package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
- package/themes/kiosk/src/layouts/Container.tsx +7 -1
- package/themes/kiosk/src/types/index.d.ts +13 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/index.tsx +6 -0
- package/themes/original/src/components/AddressDetails/index.tsx +29 -11
- package/themes/original/src/components/AddressForm/index.tsx +85 -49
- package/themes/original/src/components/AddressList/index.tsx +26 -21
- 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/BusinessBasicInformation/index.tsx +159 -90
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
- package/themes/original/src/components/BusinessController/index.tsx +154 -68
- package/themes/original/src/components/BusinessController/styles.tsx +22 -9
- 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 +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
- package/themes/original/src/components/BusinessListingSearch/index.tsx +350 -323
- package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
- package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
- 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 -524
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -6
- 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 +105 -78
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +102 -69
- package/themes/original/src/components/CartContent/index.tsx +115 -19
- package/themes/original/src/components/CartContent/styles.tsx +15 -1
- package/themes/original/src/components/Checkout/index.tsx +331 -177
- 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/Favorite/index.tsx +7 -4
- 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/GoogleMap/index.tsx +15 -4
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
- package/themes/original/src/components/HelpGuide/index.tsx +12 -16
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +12 -25
- 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 +139 -75
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +71 -28
- package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
- 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 +195 -88
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +197 -116
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -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 +53 -51
- package/themes/original/src/components/NavBar/index.tsx +18 -18
- 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 +199 -359
- 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 +93 -114
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +87 -59
- 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/index.tsx +63 -56
- package/themes/original/src/components/PageBanner/index.tsx +171 -0
- package/themes/original/src/components/PageBanner/styles.tsx +11 -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 +34 -6
- 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 +223 -232
- package/themes/original/src/components/ProductForm/styles.tsx +5 -8
- package/themes/original/src/components/ProductItemAccordion/index.tsx +59 -29
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +19 -11
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
- 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 +74 -19
- 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 +42 -19
- package/themes/original/src/components/SingleOrderCard/index.tsx +156 -65
- package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -9
- package/themes/original/src/components/SingleProductCard/index.tsx +100 -56
- package/themes/original/src/components/SingleProductCard/styles.tsx +22 -13
- 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 +28 -15
- 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 +47 -7
- package/themes/original/src/components/UserProfile/index.tsx +5 -7
- package/themes/original/src/components/UserProfileForm/index.tsx +25 -28
- 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 +79 -36
- package/themes/original/src/components/Wallets/styles.tsx +5 -4
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +16 -2
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/types/index.tsx +37 -9
- package/themes/original/src/utils/index.tsx +364 -58
- 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,
|
|
@@ -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();
|
|
@@ -118,19 +125,22 @@ const CheckoutUI = (props: any) => {
|
|
|
118
125
|
paddingHorizontal: 40,
|
|
119
126
|
width: '100%'
|
|
120
127
|
},
|
|
121
|
-
wrapperNavbar:
|
|
122
|
-
|
|
123
|
-
|
|
128
|
+
wrapperNavbar: {
|
|
129
|
+
paddingVertical: 0,
|
|
130
|
+
paddingHorizontal: 40,
|
|
131
|
+
marginVertical: 2
|
|
132
|
+
}
|
|
124
133
|
})
|
|
125
134
|
|
|
126
135
|
const [, { showToast }] = useToast();
|
|
127
136
|
const [, t] = useLanguage();
|
|
128
|
-
const [{ user, token }] = useSession();
|
|
137
|
+
const [{ user, token }, { login }] = useSession();
|
|
129
138
|
const [ordering] = useApi()
|
|
130
139
|
const [{ configs }] = useConfig();
|
|
131
140
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
132
141
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
133
142
|
const [validationFields] = useValidationFields();
|
|
143
|
+
const [events] = useEvent()
|
|
134
144
|
|
|
135
145
|
const [errorCash, setErrorCash] = useState(false);
|
|
136
146
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -142,23 +152,45 @@ const CheckoutUI = (props: any) => {
|
|
|
142
152
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
143
153
|
const [isOpen, setIsOpen] = useState(false)
|
|
144
154
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
145
|
-
|
|
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 })
|
|
146
159
|
const placeSpotTypes = [3, 4, 5]
|
|
147
160
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
161
|
+
const isGiftCardCart = !cart?.business_id
|
|
148
162
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
149
163
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
150
164
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
151
165
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
152
166
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
167
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
168
|
+
const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
|
|
169
|
+
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
170
|
+
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
171
|
+
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
172
|
+
|
|
173
|
+
const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
174
|
+
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
|
|
175
|
+
const methodsPay = ['google_pay', 'apple_pay']
|
|
153
176
|
|
|
154
177
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
178
|
+
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
179
|
+
if (item?.type === 1)
|
|
180
|
+
return acc = acc + item?.summary?.tax
|
|
181
|
+
return acc = acc
|
|
182
|
+
}, cart?.subtotal)
|
|
183
|
+
|
|
184
|
+
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
185
|
+
|
|
155
186
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
156
|
-
placing || errorCash ||
|
|
157
|
-
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
187
|
+
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
158
188
|
(options.type === 1 &&
|
|
159
189
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
160
190
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
161
|
-
(Number(cart?.driver_tip) <= 0))
|
|
191
|
+
(Number(cart?.driver_tip) <= 0)) ||
|
|
192
|
+
(validateCommentsCartField)
|
|
193
|
+
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
162
194
|
|
|
163
195
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
164
196
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -180,8 +212,29 @@ const CheckoutUI = (props: any) => {
|
|
|
180
212
|
}
|
|
181
213
|
}
|
|
182
214
|
|
|
183
|
-
const
|
|
184
|
-
|
|
215
|
+
const vibrateApp = (impact?: string) => {
|
|
216
|
+
const options = {
|
|
217
|
+
enableVibrateFallback: true,
|
|
218
|
+
ignoreAndroidSystemSettings: false
|
|
219
|
+
};
|
|
220
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const handleSuccessSignup = (user: any) => {
|
|
224
|
+
login({
|
|
225
|
+
user,
|
|
226
|
+
token: user?.session?.access_token
|
|
227
|
+
})
|
|
228
|
+
setOpenModal({ ...openModal, signup: false })
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const handleSuccessLogin = (user: any) => {
|
|
232
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
236
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
237
|
+
vibrateApp()
|
|
185
238
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
186
239
|
return
|
|
187
240
|
}
|
|
@@ -197,6 +250,11 @@ const CheckoutUI = (props: any) => {
|
|
|
197
250
|
setIsUserDetailsEdit(true)
|
|
198
251
|
}
|
|
199
252
|
|
|
253
|
+
const handlePlaceOrderAsGuest = () => {
|
|
254
|
+
setIsOpen(false)
|
|
255
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
256
|
+
}
|
|
257
|
+
|
|
200
258
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
201
259
|
setShowGateway({ closedByUser: false, open: true })
|
|
202
260
|
setWebviewPaymethod(paymethod)
|
|
@@ -260,13 +318,13 @@ const CheckoutUI = (props: any) => {
|
|
|
260
318
|
}
|
|
261
319
|
}, [errors])
|
|
262
320
|
|
|
263
|
-
// useEffect(() => {
|
|
264
|
-
// handlePaymethodChange(null)
|
|
265
|
-
// }, [cart?.total])
|
|
266
|
-
|
|
267
321
|
useEffect(() => {
|
|
268
322
|
if (cart?.products?.length === 0) {
|
|
269
|
-
|
|
323
|
+
if (cart?.business?.slug) {
|
|
324
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
325
|
+
} else {
|
|
326
|
+
onNavigationRedirect('Wallets')
|
|
327
|
+
}
|
|
270
328
|
}
|
|
271
329
|
}, [cart?.products])
|
|
272
330
|
|
|
@@ -274,6 +332,25 @@ const CheckoutUI = (props: any) => {
|
|
|
274
332
|
onFailPaypal()
|
|
275
333
|
}, [showGateway.closedByUser])
|
|
276
334
|
|
|
335
|
+
const HeaderTitle = (props: any) => {
|
|
336
|
+
const { text } = props
|
|
337
|
+
return (
|
|
338
|
+
<OText
|
|
339
|
+
size={16}
|
|
340
|
+
lineHeight={24}
|
|
341
|
+
weight={'500'}
|
|
342
|
+
mBottom={props.mb ?? 10}
|
|
343
|
+
color={theme.colors.textNormal}
|
|
344
|
+
>
|
|
345
|
+
{text}
|
|
346
|
+
</OText>
|
|
347
|
+
)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
useEffect(() => {
|
|
351
|
+
cart && events.emit('checkout_started', cart)
|
|
352
|
+
}, [])
|
|
353
|
+
|
|
277
354
|
return (
|
|
278
355
|
<>
|
|
279
356
|
<Container noPadding>
|
|
@@ -281,24 +358,31 @@ const CheckoutUI = (props: any) => {
|
|
|
281
358
|
<NavBar
|
|
282
359
|
title={t('CHECKOUT', 'Checkout')}
|
|
283
360
|
titleAlign={'center'}
|
|
284
|
-
onActionLeft={() =>
|
|
361
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
285
362
|
showCall={false}
|
|
286
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
287
|
-
style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
363
|
+
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
288
364
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
289
365
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
366
|
+
style={{ marginTop: 20 }}
|
|
290
367
|
/>
|
|
291
368
|
</View>
|
|
292
369
|
<ChContainer style={styles.pagePadding}>
|
|
293
370
|
<ChSection style={{ paddingTop: 0 }}>
|
|
294
371
|
<ChHeader>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
372
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
373
|
+
<OText
|
|
374
|
+
size={12}
|
|
375
|
+
numberOfLines={1}
|
|
376
|
+
ellipsizeMode={'tail'}
|
|
377
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
378
|
+
>
|
|
379
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
380
|
+
</OText>
|
|
298
381
|
<OIcon
|
|
299
382
|
src={theme.images.general.arrow_down}
|
|
300
383
|
width={10}
|
|
301
384
|
style={{ marginStart: 8 }}
|
|
385
|
+
{...(isChewLayout && { color: 'white' })}
|
|
302
386
|
/>
|
|
303
387
|
</CHMomentWrapper>
|
|
304
388
|
<CHMomentWrapper
|
|
@@ -322,85 +406,116 @@ const CheckoutUI = (props: any) => {
|
|
|
322
406
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
323
407
|
</ChSection>
|
|
324
408
|
|
|
325
|
-
|
|
326
|
-
<
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
409
|
+
{!isGiftCardCart && !hideBusinessDetails && (
|
|
410
|
+
<ChSection>
|
|
411
|
+
<ChBusinessDetails>
|
|
412
|
+
{
|
|
413
|
+
(businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
|
|
414
|
+
!businessDetails?.error &&
|
|
415
|
+
(
|
|
416
|
+
<Placeholder Animation={Fade}>
|
|
417
|
+
<PlaceholderLine height={20} />
|
|
418
|
+
<PlaceholderLine height={12} />
|
|
419
|
+
<PlaceholderLine height={12} />
|
|
420
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
421
|
+
</Placeholder>
|
|
422
|
+
)}
|
|
423
|
+
{
|
|
424
|
+
!cartState.loading &&
|
|
425
|
+
businessDetails?.business &&
|
|
426
|
+
Object.values(businessDetails?.business).length > 0 &&
|
|
427
|
+
(
|
|
428
|
+
<>
|
|
429
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
430
|
+
<View>
|
|
431
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
432
|
+
{businessDetails?.business?.name}
|
|
433
|
+
</OText>
|
|
434
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
435
|
+
{businessDetails?.business?.email}
|
|
436
|
+
</OText>
|
|
437
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
438
|
+
{businessDetails?.business?.cellphone}
|
|
439
|
+
</OText>
|
|
440
|
+
{!hideBusinessAddress && (
|
|
441
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
442
|
+
{businessDetails?.business?.address}
|
|
443
|
+
</OText>
|
|
444
|
+
)}
|
|
445
|
+
</View>
|
|
446
|
+
</>
|
|
447
|
+
)}
|
|
448
|
+
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
449
|
+
<View>
|
|
450
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
451
|
+
<NotFoundSource
|
|
452
|
+
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
453
|
+
/>
|
|
454
|
+
</View>
|
|
455
|
+
)}
|
|
456
|
+
</ChBusinessDetails>
|
|
457
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
458
|
+
</ChSection>
|
|
459
|
+
)}
|
|
460
|
+
{!hideCustomerDetails && (
|
|
461
|
+
|
|
462
|
+
<ChSection>
|
|
463
|
+
<ChUserDetails>
|
|
464
|
+
{cartState.loading ? (
|
|
331
465
|
<Placeholder Animation={Fade}>
|
|
332
466
|
<PlaceholderLine height={20} />
|
|
333
467
|
<PlaceholderLine height={12} />
|
|
334
468
|
<PlaceholderLine height={12} />
|
|
335
469
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
336
470
|
</Placeholder>
|
|
337
|
-
)
|
|
338
|
-
|
|
339
|
-
!cartState.loading &&
|
|
340
|
-
businessDetails?.business &&
|
|
341
|
-
Object.values(businessDetails?.business).length > 0 &&
|
|
342
|
-
(
|
|
343
|
-
<>
|
|
344
|
-
<OText size={16} lineHeight={24} weight={'500'} mBottom={10}>
|
|
345
|
-
{t('BUSINESS_DETAILS', 'Business Details')}
|
|
346
|
-
</OText>
|
|
471
|
+
) : (
|
|
472
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
347
473
|
<View>
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
{
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
{
|
|
359
|
-
|
|
474
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
475
|
+
<OButton
|
|
476
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
477
|
+
textStyle={{ color: theme.colors.white }}
|
|
478
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
479
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
480
|
+
/>
|
|
481
|
+
<OButton
|
|
482
|
+
text={t('LOGIN', 'Login')}
|
|
483
|
+
textStyle={{ color: theme.colors.primary }}
|
|
484
|
+
bgColor={theme.colors.white}
|
|
485
|
+
borderColor={theme.colors.primary}
|
|
486
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
487
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
488
|
+
/>
|
|
489
|
+
<OButton
|
|
490
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
491
|
+
textStyle={{ color: theme.colors.black }}
|
|
492
|
+
bgColor={theme.colors.white}
|
|
493
|
+
borderColor={theme.colors.black}
|
|
494
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
495
|
+
onClick={() => setAllowedGuest(true)}
|
|
496
|
+
/>
|
|
360
497
|
</View>
|
|
361
|
-
|
|
498
|
+
) : (
|
|
499
|
+
<UserDetails
|
|
500
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
501
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
502
|
+
cartStatus={cart?.status}
|
|
503
|
+
businessId={cart?.business_id}
|
|
504
|
+
useValidationFields
|
|
505
|
+
useDefualtSessionManager
|
|
506
|
+
useSessionUser
|
|
507
|
+
isCheckout
|
|
508
|
+
phoneUpdate={phoneUpdate}
|
|
509
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
510
|
+
/>
|
|
511
|
+
)
|
|
362
512
|
)}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
</OText>
|
|
368
|
-
<NotFoundSource
|
|
369
|
-
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
370
|
-
/>
|
|
371
|
-
</View>
|
|
372
|
-
)}
|
|
373
|
-
</ChBusinessDetails>
|
|
374
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
375
|
-
</ChSection>
|
|
376
|
-
|
|
377
|
-
<ChSection>
|
|
378
|
-
<ChUserDetails>
|
|
379
|
-
{cartState.loading ? (
|
|
380
|
-
<Placeholder Animation={Fade}>
|
|
381
|
-
<PlaceholderLine height={20} />
|
|
382
|
-
<PlaceholderLine height={12} />
|
|
383
|
-
<PlaceholderLine height={12} />
|
|
384
|
-
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
385
|
-
</Placeholder>
|
|
386
|
-
) : (
|
|
387
|
-
<UserDetails
|
|
388
|
-
isUserDetailsEdit={isUserDetailsEdit}
|
|
389
|
-
cartStatus={cart?.status}
|
|
390
|
-
businessId={cart?.business_id}
|
|
391
|
-
useValidationFields
|
|
392
|
-
useDefualtSessionManager
|
|
393
|
-
useSessionUser
|
|
394
|
-
isCheckout
|
|
395
|
-
phoneUpdate={phoneUpdate}
|
|
396
|
-
togglePhoneUpdate={togglePhoneUpdate}
|
|
397
|
-
/>
|
|
398
|
-
)}
|
|
399
|
-
</ChUserDetails>
|
|
400
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
401
|
-
</ChSection>
|
|
513
|
+
</ChUserDetails>
|
|
514
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
515
|
+
</ChSection>
|
|
516
|
+
)}
|
|
402
517
|
|
|
403
|
-
{options?.type === 1 && (
|
|
518
|
+
{options?.type === 1 && !isGiftCardCart && (
|
|
404
519
|
<DeliveryOptionsContainer>
|
|
405
520
|
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
406
521
|
<View style={{ height: 110 }}>
|
|
@@ -410,8 +525,8 @@ const CheckoutUI = (props: any) => {
|
|
|
410
525
|
</Placeholder>
|
|
411
526
|
</View>
|
|
412
527
|
) : (
|
|
413
|
-
|
|
414
|
-
<
|
|
528
|
+
<ChSection>
|
|
529
|
+
<HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
|
|
415
530
|
<View
|
|
416
531
|
style={{
|
|
417
532
|
backgroundColor: theme.colors.inputDisabled,
|
|
@@ -430,7 +545,7 @@ const CheckoutUI = (props: any) => {
|
|
|
430
545
|
<OText
|
|
431
546
|
size={14}
|
|
432
547
|
>
|
|
433
|
-
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)
|
|
548
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
|
|
434
549
|
</OText>
|
|
435
550
|
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
436
551
|
</DeliveryOptionItem>
|
|
@@ -457,7 +572,7 @@ const CheckoutUI = (props: any) => {
|
|
|
457
572
|
/>
|
|
458
573
|
</View>
|
|
459
574
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
460
|
-
|
|
575
|
+
</ChSection>
|
|
461
576
|
)}
|
|
462
577
|
|
|
463
578
|
</DeliveryOptionsContainer>
|
|
@@ -479,50 +594,30 @@ const CheckoutUI = (props: any) => {
|
|
|
479
594
|
</ChSection>
|
|
480
595
|
)}
|
|
481
596
|
|
|
482
|
-
{
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
<ChAddress>
|
|
507
|
-
{(businessDetails?.loading || cartState.loading) ? (
|
|
508
|
-
<Placeholder Animation={Fade}>
|
|
509
|
-
<PlaceholderLine height={20} style={{ marginBottom: 50 }} />
|
|
510
|
-
<PlaceholderLine height={100} />
|
|
511
|
-
</Placeholder>
|
|
512
|
-
) : (
|
|
513
|
-
<AddressDetails
|
|
514
|
-
navigation={navigation}
|
|
515
|
-
location={businessDetails?.business?.location}
|
|
516
|
-
businessLogo={businessDetails?.business?.logo}
|
|
517
|
-
isCartPending={cart?.status === 2}
|
|
518
|
-
uuid={cartUuid}
|
|
519
|
-
apiKey={configs?.google_maps_api_key?.value}
|
|
520
|
-
mapConfigs={mapConfigs}
|
|
521
|
-
/>
|
|
522
|
-
)}
|
|
523
|
-
</ChAddress>
|
|
524
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
525
|
-
</ChSection>
|
|
597
|
+
{!isGiftCardCart && !hideBusinessMap && (
|
|
598
|
+
<ChSection>
|
|
599
|
+
<ChAddress>
|
|
600
|
+
{(businessDetails?.loading || cartState.loading) ? (
|
|
601
|
+
<Placeholder Animation={Fade}>
|
|
602
|
+
<PlaceholderLine height={20} style={{ marginBottom: 50 }} />
|
|
603
|
+
<PlaceholderLine height={100} />
|
|
604
|
+
</Placeholder>
|
|
605
|
+
) : (
|
|
606
|
+
<AddressDetails
|
|
607
|
+
navigation={navigation}
|
|
608
|
+
location={options?.address?.location}
|
|
609
|
+
businessLogo={businessDetails?.business?.logo}
|
|
610
|
+
isCartPending={cart?.status === 2}
|
|
611
|
+
uuid={cartUuid}
|
|
612
|
+
apiKey={configs?.google_maps_api_key?.value}
|
|
613
|
+
mapConfigs={mapConfigs}
|
|
614
|
+
HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
|
|
615
|
+
/>
|
|
616
|
+
)}
|
|
617
|
+
</ChAddress>
|
|
618
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
619
|
+
</ChSection>
|
|
620
|
+
)}
|
|
526
621
|
|
|
527
622
|
{!cartState.loading &&
|
|
528
623
|
cart &&
|
|
@@ -531,22 +626,22 @@ const CheckoutUI = (props: any) => {
|
|
|
531
626
|
cart?.status !== 2 &&
|
|
532
627
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
533
628
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
629
|
+
!isGiftCardCart &&
|
|
534
630
|
(
|
|
535
631
|
<ChSection>
|
|
536
632
|
<ChDriverTips>
|
|
537
|
-
<
|
|
538
|
-
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
539
|
-
</OText>
|
|
633
|
+
<HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
|
|
540
634
|
<DriverTips
|
|
541
635
|
uuid={cartUuid}
|
|
542
636
|
businessId={cart?.business_id}
|
|
543
|
-
driverTipsOptions={driverTipsOptions}
|
|
544
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
637
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
638
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
545
639
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
546
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
640
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
547
641
|
? cart?.driver_tip
|
|
548
642
|
: cart?.driver_tip_rate}
|
|
549
643
|
useOrderContext
|
|
644
|
+
cart={cart}
|
|
550
645
|
/>
|
|
551
646
|
</ChDriverTips>
|
|
552
647
|
</ChSection>
|
|
@@ -555,9 +650,7 @@ const CheckoutUI = (props: any) => {
|
|
|
555
650
|
{!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
|
|
556
651
|
<ChSection>
|
|
557
652
|
<ChPaymethods>
|
|
558
|
-
<
|
|
559
|
-
{t('PAYMENT_METHOD', 'Payment Method')}
|
|
560
|
-
</OText>
|
|
653
|
+
<HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
|
|
561
654
|
{!cartState.loading && cart?.status === 4 && (
|
|
562
655
|
<OText
|
|
563
656
|
style={{ textAlign: 'center', marginTop: 20 }}
|
|
@@ -570,8 +663,8 @@ const CheckoutUI = (props: any) => {
|
|
|
570
663
|
<PaymentOptions
|
|
571
664
|
cart={cart}
|
|
572
665
|
isDisabled={cart?.status === 2}
|
|
573
|
-
businessId={businessDetails?.business?.id}
|
|
574
|
-
isLoading={businessDetails.loading}
|
|
666
|
+
businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
|
|
667
|
+
isLoading={!isGiftCardCart ? businessDetails.loading : false}
|
|
575
668
|
paymethods={businessDetails?.business?.paymethods}
|
|
576
669
|
onPaymentChange={handlePaymethodChange}
|
|
577
670
|
errorCash={errorCash}
|
|
@@ -581,6 +674,10 @@ const CheckoutUI = (props: any) => {
|
|
|
581
674
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
582
675
|
handlePlaceOrder={handlePlaceOrder}
|
|
583
676
|
merchantId={merchantId}
|
|
677
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
678
|
+
methodPaySupported={methodPaySupported}
|
|
679
|
+
placeByMethodPay={placeByMethodPay}
|
|
680
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
584
681
|
/>
|
|
585
682
|
</ChPaymethods>
|
|
586
683
|
</ChSection>
|
|
@@ -590,6 +687,7 @@ const CheckoutUI = (props: any) => {
|
|
|
590
687
|
<WalletPaymentOptionContainer>
|
|
591
688
|
<PaymentOptionWallet
|
|
592
689
|
cart={cart}
|
|
690
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
593
691
|
businessId={cart?.business_id}
|
|
594
692
|
businessConfigs={businessDetails?.business?.configs}
|
|
595
693
|
/>
|
|
@@ -597,7 +695,7 @@ const CheckoutUI = (props: any) => {
|
|
|
597
695
|
)}
|
|
598
696
|
|
|
599
697
|
|
|
600
|
-
{!cartState.loading && placeSpotsEnabled && (
|
|
698
|
+
{!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
|
|
601
699
|
<>
|
|
602
700
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
|
|
603
701
|
<PlaceSpot
|
|
@@ -605,6 +703,7 @@ const CheckoutUI = (props: any) => {
|
|
|
605
703
|
isInputMode
|
|
606
704
|
cart={cart}
|
|
607
705
|
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
706
|
+
setPlaceSpotNumber={setPlaceSpotNumber}
|
|
608
707
|
vehicleDefault={cart?.vehicle}
|
|
609
708
|
/>
|
|
610
709
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -622,26 +721,21 @@ const CheckoutUI = (props: any) => {
|
|
|
622
721
|
) : (
|
|
623
722
|
<>
|
|
624
723
|
<CartHeader>
|
|
625
|
-
<
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
style={{ fontWeight: '500' }}
|
|
630
|
-
>
|
|
631
|
-
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
632
|
-
</OText>
|
|
633
|
-
<TouchableOpacity
|
|
634
|
-
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
635
|
-
>
|
|
636
|
-
<OText
|
|
637
|
-
size={10}
|
|
638
|
-
lineHeight={15}
|
|
639
|
-
color={theme.colors.primary}
|
|
640
|
-
style={{ textDecorationLine: 'underline' }}
|
|
724
|
+
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
725
|
+
{!isGiftCardCart && (
|
|
726
|
+
<TouchableOpacity
|
|
727
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
641
728
|
>
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
729
|
+
<OText
|
|
730
|
+
size={12}
|
|
731
|
+
lineHeight={15}
|
|
732
|
+
color={theme.colors.primary}
|
|
733
|
+
style={{ textDecorationLine: 'underline' }}
|
|
734
|
+
>
|
|
735
|
+
{t('ADD_PRODUCTS', 'Add products')}
|
|
736
|
+
</OText>
|
|
737
|
+
</TouchableOpacity>
|
|
738
|
+
)}
|
|
645
739
|
</CartHeader>
|
|
646
740
|
{isBusinessChangeEnabled && (
|
|
647
741
|
<TouchableOpacity
|
|
@@ -651,7 +745,7 @@ const CheckoutUI = (props: any) => {
|
|
|
651
745
|
<OText
|
|
652
746
|
size={12}
|
|
653
747
|
lineHeight={18}
|
|
654
|
-
color={theme.colors.
|
|
748
|
+
color={theme.colors.primary}
|
|
655
749
|
style={{ textDecorationLine: 'underline' }}
|
|
656
750
|
>
|
|
657
751
|
{t('CHANGE_STORE', 'Change store')}
|
|
@@ -663,6 +757,12 @@ const CheckoutUI = (props: any) => {
|
|
|
663
757
|
isCartPending={cart?.status === 2}
|
|
664
758
|
onNavigationRedirect={onNavigationRedirect}
|
|
665
759
|
placeSpotTypes={placeSpotTypes}
|
|
760
|
+
businessConfigs={businessConfigs}
|
|
761
|
+
maxDate={maxDate}
|
|
762
|
+
loyaltyRewardRate={
|
|
763
|
+
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
764
|
+
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
765
|
+
}
|
|
666
766
|
/>
|
|
667
767
|
</>
|
|
668
768
|
)}
|
|
@@ -672,7 +772,7 @@ const CheckoutUI = (props: any) => {
|
|
|
672
772
|
|
|
673
773
|
{!cartState.loading && cart && (
|
|
674
774
|
<View>
|
|
675
|
-
<ChErrors style={{ marginBottom: 10 }}>
|
|
775
|
+
<ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
|
|
676
776
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
677
777
|
<OText
|
|
678
778
|
color={theme.colors.error}
|
|
@@ -699,6 +799,14 @@ const CheckoutUI = (props: any) => {
|
|
|
699
799
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
700
800
|
</OText>
|
|
701
801
|
)}
|
|
802
|
+
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
803
|
+
<OText
|
|
804
|
+
color={theme.colors.error}
|
|
805
|
+
size={12}
|
|
806
|
+
>
|
|
807
|
+
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
808
|
+
</OText>
|
|
809
|
+
)}
|
|
702
810
|
{options.type === 1 &&
|
|
703
811
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
704
812
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -710,6 +818,15 @@ const CheckoutUI = (props: any) => {
|
|
|
710
818
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
711
819
|
</OText>
|
|
712
820
|
)}
|
|
821
|
+
|
|
822
|
+
{validateCommentsCartField && (
|
|
823
|
+
<OText
|
|
824
|
+
color={theme.colors.error}
|
|
825
|
+
size={12}
|
|
826
|
+
>
|
|
827
|
+
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
828
|
+
</OText>
|
|
829
|
+
)}
|
|
713
830
|
</ChErrors>
|
|
714
831
|
</View>
|
|
715
832
|
)}
|
|
@@ -742,18 +859,55 @@ const CheckoutUI = (props: any) => {
|
|
|
742
859
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
743
860
|
requiredFields={requiredFields}
|
|
744
861
|
hideUpdateButton
|
|
745
|
-
|
|
862
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
863
|
+
onClose={() => {
|
|
864
|
+
setIsOpen(false)
|
|
865
|
+
handlePlaceOrder(null, true)
|
|
866
|
+
}}
|
|
867
|
+
setIsOpen={setIsOpen}
|
|
746
868
|
/>
|
|
747
869
|
</View>
|
|
748
870
|
</OModal>
|
|
871
|
+
<OModal
|
|
872
|
+
open={openModal.signup}
|
|
873
|
+
onClose={() => setOpenModal({ ...openModal, signup: false })}
|
|
874
|
+
>
|
|
875
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
876
|
+
<SignupForm
|
|
877
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
878
|
+
isGuest
|
|
879
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
880
|
+
useSignupByEmail
|
|
881
|
+
useChekoutFileds
|
|
882
|
+
/>
|
|
883
|
+
</ScrollView>
|
|
884
|
+
</OModal>
|
|
885
|
+
<OModal
|
|
886
|
+
open={openModal.login}
|
|
887
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
888
|
+
>
|
|
889
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
890
|
+
<LoginForm
|
|
891
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
892
|
+
isGuest
|
|
893
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
894
|
+
loginButtonBackground={theme.colors.primary}
|
|
895
|
+
/>
|
|
896
|
+
</ScrollView>
|
|
897
|
+
</OModal>
|
|
749
898
|
</ChContainer>
|
|
750
899
|
</Container>
|
|
751
900
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
752
901
|
<FloatingButton
|
|
753
|
-
handleClick={
|
|
902
|
+
handleClick={
|
|
903
|
+
isDisabledButtonPlace
|
|
904
|
+
? () => vibrateApp()
|
|
905
|
+
: methodsPay.includes(paymethodSelected?.gateway)
|
|
906
|
+
? () => setPlaceByMethodPay(true)
|
|
907
|
+
: () => handlePlaceOrder(null)}
|
|
754
908
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
755
909
|
disabled={isDisabledButtonPlace}
|
|
756
|
-
btnText={
|
|
910
|
+
btnText={subtotalWithTaxes >= cart?.minimum
|
|
757
911
|
? (
|
|
758
912
|
placing
|
|
759
913
|
? t('PLACING', 'Placing')
|