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