ordering-ui-react-native 0.16.91 → 0.16.92-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/ActiveOrders/styles.tsx +8 -14
- package/src/components/BusinessInformation/index.tsx +19 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptionsWebView/index.tsx +119 -120
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/utils/index.tsx +2 -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 +2 -2
- package/themes/business/src/components/Chat/index.tsx +30 -30
- package/themes/business/src/components/DriverMap/index.tsx +22 -9
- 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 +239 -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 +31 -41
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -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/OrdersOption/index.tsx +33 -75
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +1 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +16 -18
- 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 +447 -247
- 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 +54 -27
- 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 +53 -0
- 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 +1 -0
- 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 +10 -8
- package/themes/original/src/components/AddressForm/index.tsx +155 -139
- package/themes/original/src/components/AddressList/index.tsx +27 -22
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +118 -76
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -4
- package/themes/original/src/components/BusinessController/index.tsx +100 -47
- package/themes/original/src/components/BusinessController/styles.tsx +14 -9
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +9 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +86 -33
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +6 -0
- package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
- package/themes/original/src/components/BusinessProductsList/index.tsx +10 -8
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +566 -490
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +6 -12
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +115 -82
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
- package/themes/original/src/components/Cart/index.tsx +90 -43
- package/themes/original/src/components/CartContent/index.tsx +77 -15
- package/themes/original/src/components/CartContent/styles.tsx +11 -1
- package/themes/original/src/components/Checkout/index.tsx +288 -175
- 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/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 +70 -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 +20 -19
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GoogleMap/index.tsx +10 -1
- 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/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 +43 -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 +31 -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 +92 -93
- package/themes/original/src/components/MultiCheckout/index.tsx +210 -79
- 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/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- 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 +59 -0
- package/themes/original/src/components/OrderDetails/index.tsx +110 -221
- package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +44 -42
- 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 +52 -17
- package/themes/original/src/components/OrderTypeSelector/index.tsx +9 -3
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +29 -20
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +76 -83
- package/themes/original/src/components/PageBanner/index.tsx +146 -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 +2 -2
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- 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 +240 -256
- package/themes/original/src/components/ProductForm/styles.tsx +5 -8
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- 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 -49
- package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
- package/themes/original/src/components/Promotions/index.tsx +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +7 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
- 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 +377 -270
- 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 +79 -66
- package/themes/original/src/components/SingleOrderCard/index.tsx +126 -57
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
- package/themes/original/src/components/SingleProductCard/index.tsx +104 -45
- package/themes/original/src/components/SingleProductCard/styles.tsx +14 -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 +1 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +237 -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 +20 -21
- 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 +37 -5
- package/themes/original/src/utils/index.tsx +321 -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, Vibration, 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'
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
ToastType,
|
|
17
17
|
} from 'ordering-components/native';
|
|
18
18
|
import { useTheme } from 'styled-components/native';
|
|
19
|
-
import { OText, OIcon, OModal } from '../shared';
|
|
19
|
+
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
20
20
|
|
|
21
21
|
import { AddressDetails } from '../AddressDetails';
|
|
22
22
|
import { PaymentOptions } from '../PaymentOptions';
|
|
@@ -25,6 +25,8 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
25
25
|
import { UserDetails } from '../UserDetails';
|
|
26
26
|
import { PaymentOptionWallet } from '../PaymentOptionWallet';
|
|
27
27
|
import { PlaceSpot } from '../PlaceSpot'
|
|
28
|
+
import { SignupForm } from '../SignupForm'
|
|
29
|
+
import { LoginForm } from '../LoginForm'
|
|
28
30
|
|
|
29
31
|
import {
|
|
30
32
|
ChContainer,
|
|
@@ -78,6 +80,7 @@ const CheckoutUI = (props: any) => {
|
|
|
78
80
|
placing,
|
|
79
81
|
cartState,
|
|
80
82
|
cartUuid,
|
|
83
|
+
loyaltyPlansState,
|
|
81
84
|
businessDetails,
|
|
82
85
|
paymethodSelected,
|
|
83
86
|
handlePaymethodChange,
|
|
@@ -87,7 +90,9 @@ const CheckoutUI = (props: any) => {
|
|
|
87
90
|
instructionsOptions,
|
|
88
91
|
handleChangeDeliveryOption,
|
|
89
92
|
currency,
|
|
90
|
-
merchantId
|
|
93
|
+
merchantId,
|
|
94
|
+
setPlaceSpotNumber,
|
|
95
|
+
maxDate
|
|
91
96
|
} = props
|
|
92
97
|
|
|
93
98
|
const theme = useTheme();
|
|
@@ -118,14 +123,16 @@ const CheckoutUI = (props: any) => {
|
|
|
118
123
|
paddingHorizontal: 40,
|
|
119
124
|
width: '100%'
|
|
120
125
|
},
|
|
121
|
-
wrapperNavbar:
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
wrapperNavbar: {
|
|
127
|
+
paddingVertical: 0,
|
|
128
|
+
paddingHorizontal: 40,
|
|
129
|
+
marginVertical: 2
|
|
130
|
+
}
|
|
124
131
|
})
|
|
125
132
|
|
|
126
133
|
const [, { showToast }] = useToast();
|
|
127
134
|
const [, t] = useLanguage();
|
|
128
|
-
const [{ user, token }] = useSession();
|
|
135
|
+
const [{ user, token }, { login }] = useSession();
|
|
129
136
|
const [ordering] = useApi()
|
|
130
137
|
const [{ configs }] = useConfig();
|
|
131
138
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
@@ -142,19 +149,34 @@ const CheckoutUI = (props: any) => {
|
|
|
142
149
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
143
150
|
const [isOpen, setIsOpen] = useState(false)
|
|
144
151
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
152
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false })
|
|
153
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
145
154
|
|
|
146
155
|
const placeSpotTypes = [3, 4, 5]
|
|
147
156
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
157
|
+
const isGiftCardCart = !cart?.business_id
|
|
148
158
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
149
159
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
150
160
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
151
161
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
152
162
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
163
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
164
|
+
const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
|
|
165
|
+
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
166
|
+
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
167
|
+
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
168
|
+
|
|
169
|
+
const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
170
|
+
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
|
|
153
171
|
|
|
154
172
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
173
|
+
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
174
|
+
if (item?.type === 1)
|
|
175
|
+
return acc = acc + item?.summary?.tax
|
|
176
|
+
return acc = acc
|
|
177
|
+
}, cart?.subtotal)
|
|
155
178
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
156
|
-
placing || errorCash ||
|
|
157
|
-
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
179
|
+
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
158
180
|
(options.type === 1 &&
|
|
159
181
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
160
182
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -180,8 +202,21 @@ const CheckoutUI = (props: any) => {
|
|
|
180
202
|
}
|
|
181
203
|
}
|
|
182
204
|
|
|
183
|
-
const
|
|
184
|
-
|
|
205
|
+
const handleSuccessSignup = (user: any) => {
|
|
206
|
+
login({
|
|
207
|
+
user,
|
|
208
|
+
token: user?.session?.access_token
|
|
209
|
+
})
|
|
210
|
+
setOpenModal({ ...openModal, signup: false })
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const handleSuccessLogin = (user: any) => {
|
|
214
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
218
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
219
|
+
Vibration.vibrate()
|
|
185
220
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
186
221
|
return
|
|
187
222
|
}
|
|
@@ -197,6 +232,11 @@ const CheckoutUI = (props: any) => {
|
|
|
197
232
|
setIsUserDetailsEdit(true)
|
|
198
233
|
}
|
|
199
234
|
|
|
235
|
+
const handlePlaceOrderAsGuest = () => {
|
|
236
|
+
setIsOpen(false)
|
|
237
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
238
|
+
}
|
|
239
|
+
|
|
200
240
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
201
241
|
setShowGateway({ closedByUser: false, open: true })
|
|
202
242
|
setWebviewPaymethod(paymethod)
|
|
@@ -260,13 +300,13 @@ const CheckoutUI = (props: any) => {
|
|
|
260
300
|
}
|
|
261
301
|
}, [errors])
|
|
262
302
|
|
|
263
|
-
// useEffect(() => {
|
|
264
|
-
// handlePaymethodChange(null)
|
|
265
|
-
// }, [cart?.total])
|
|
266
|
-
|
|
267
303
|
useEffect(() => {
|
|
268
304
|
if (cart?.products?.length === 0) {
|
|
269
|
-
|
|
305
|
+
if (cart?.business?.slug) {
|
|
306
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
307
|
+
} else {
|
|
308
|
+
onNavigationRedirect('Wallets')
|
|
309
|
+
}
|
|
270
310
|
}
|
|
271
311
|
}, [cart?.products])
|
|
272
312
|
|
|
@@ -274,6 +314,21 @@ const CheckoutUI = (props: any) => {
|
|
|
274
314
|
onFailPaypal()
|
|
275
315
|
}, [showGateway.closedByUser])
|
|
276
316
|
|
|
317
|
+
const HeaderTitle = (props: any) => {
|
|
318
|
+
const { text } = props
|
|
319
|
+
return (
|
|
320
|
+
<OText
|
|
321
|
+
size={16}
|
|
322
|
+
lineHeight={24}
|
|
323
|
+
weight={'500'}
|
|
324
|
+
mBottom={props.mb ?? 10}
|
|
325
|
+
color={theme.colors.textNormal}
|
|
326
|
+
>
|
|
327
|
+
{text}
|
|
328
|
+
</OText>
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
|
|
277
332
|
return (
|
|
278
333
|
<>
|
|
279
334
|
<Container noPadding>
|
|
@@ -281,10 +336,9 @@ const CheckoutUI = (props: any) => {
|
|
|
281
336
|
<NavBar
|
|
282
337
|
title={t('CHECKOUT', 'Checkout')}
|
|
283
338
|
titleAlign={'center'}
|
|
284
|
-
onActionLeft={() =>
|
|
339
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
285
340
|
showCall={false}
|
|
286
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
287
|
-
style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
341
|
+
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
288
342
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
289
343
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
290
344
|
/>
|
|
@@ -292,13 +346,20 @@ const CheckoutUI = (props: any) => {
|
|
|
292
346
|
<ChContainer style={styles.pagePadding}>
|
|
293
347
|
<ChSection style={{ paddingTop: 0 }}>
|
|
294
348
|
<ChHeader>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
349
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
350
|
+
<OText
|
|
351
|
+
size={12}
|
|
352
|
+
numberOfLines={1}
|
|
353
|
+
ellipsizeMode={'tail'}
|
|
354
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
355
|
+
>
|
|
356
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
357
|
+
</OText>
|
|
298
358
|
<OIcon
|
|
299
359
|
src={theme.images.general.arrow_down}
|
|
300
360
|
width={10}
|
|
301
361
|
style={{ marginStart: 8 }}
|
|
362
|
+
{...(isChewLayout && { color: 'white' })}
|
|
302
363
|
/>
|
|
303
364
|
</CHMomentWrapper>
|
|
304
365
|
<CHMomentWrapper
|
|
@@ -322,85 +383,116 @@ const CheckoutUI = (props: any) => {
|
|
|
322
383
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
323
384
|
</ChSection>
|
|
324
385
|
|
|
325
|
-
|
|
326
|
-
<
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
386
|
+
{!isGiftCardCart && !hideBusinessDetails && (
|
|
387
|
+
<ChSection>
|
|
388
|
+
<ChBusinessDetails>
|
|
389
|
+
{
|
|
390
|
+
(businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
|
|
391
|
+
!businessDetails?.error &&
|
|
392
|
+
(
|
|
393
|
+
<Placeholder Animation={Fade}>
|
|
394
|
+
<PlaceholderLine height={20} />
|
|
395
|
+
<PlaceholderLine height={12} />
|
|
396
|
+
<PlaceholderLine height={12} />
|
|
397
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
398
|
+
</Placeholder>
|
|
399
|
+
)}
|
|
400
|
+
{
|
|
401
|
+
!cartState.loading &&
|
|
402
|
+
businessDetails?.business &&
|
|
403
|
+
Object.values(businessDetails?.business).length > 0 &&
|
|
404
|
+
(
|
|
405
|
+
<>
|
|
406
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
407
|
+
<View>
|
|
408
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
409
|
+
{businessDetails?.business?.name}
|
|
410
|
+
</OText>
|
|
411
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
412
|
+
{businessDetails?.business?.email}
|
|
413
|
+
</OText>
|
|
414
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
415
|
+
{businessDetails?.business?.cellphone}
|
|
416
|
+
</OText>
|
|
417
|
+
{!hideBusinessAddress && (
|
|
418
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
419
|
+
{businessDetails?.business?.address}
|
|
420
|
+
</OText>
|
|
421
|
+
)}
|
|
422
|
+
</View>
|
|
423
|
+
</>
|
|
424
|
+
)}
|
|
425
|
+
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
426
|
+
<View>
|
|
427
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
428
|
+
<NotFoundSource
|
|
429
|
+
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
430
|
+
/>
|
|
431
|
+
</View>
|
|
432
|
+
)}
|
|
433
|
+
</ChBusinessDetails>
|
|
434
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
435
|
+
</ChSection>
|
|
436
|
+
)}
|
|
437
|
+
{!hideCustomerDetails && (
|
|
438
|
+
|
|
439
|
+
<ChSection>
|
|
440
|
+
<ChUserDetails>
|
|
441
|
+
{cartState.loading ? (
|
|
331
442
|
<Placeholder Animation={Fade}>
|
|
332
443
|
<PlaceholderLine height={20} />
|
|
333
444
|
<PlaceholderLine height={12} />
|
|
334
445
|
<PlaceholderLine height={12} />
|
|
335
446
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
336
447
|
</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>
|
|
448
|
+
) : (
|
|
449
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
347
450
|
<View>
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
{
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
{
|
|
359
|
-
|
|
451
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
452
|
+
<OButton
|
|
453
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
454
|
+
textStyle={{ color: theme.colors.white }}
|
|
455
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
456
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
457
|
+
/>
|
|
458
|
+
<OButton
|
|
459
|
+
text={t('LOGIN', 'Login')}
|
|
460
|
+
textStyle={{ color: theme.colors.primary }}
|
|
461
|
+
bgColor={theme.colors.white}
|
|
462
|
+
borderColor={theme.colors.primary}
|
|
463
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
464
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
465
|
+
/>
|
|
466
|
+
<OButton
|
|
467
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
468
|
+
textStyle={{ color: theme.colors.black }}
|
|
469
|
+
bgColor={theme.colors.white}
|
|
470
|
+
borderColor={theme.colors.black}
|
|
471
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
472
|
+
onClick={() => setAllowedGuest(true)}
|
|
473
|
+
/>
|
|
360
474
|
</View>
|
|
361
|
-
|
|
475
|
+
) : (
|
|
476
|
+
<UserDetails
|
|
477
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
478
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
479
|
+
cartStatus={cart?.status}
|
|
480
|
+
businessId={cart?.business_id}
|
|
481
|
+
useValidationFields
|
|
482
|
+
useDefualtSessionManager
|
|
483
|
+
useSessionUser
|
|
484
|
+
isCheckout
|
|
485
|
+
phoneUpdate={phoneUpdate}
|
|
486
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
487
|
+
/>
|
|
488
|
+
)
|
|
362
489
|
)}
|
|
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>
|
|
490
|
+
</ChUserDetails>
|
|
491
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
492
|
+
</ChSection>
|
|
493
|
+
)}
|
|
402
494
|
|
|
403
|
-
{options?.type === 1 && (
|
|
495
|
+
{options?.type === 1 && !isGiftCardCart && (
|
|
404
496
|
<DeliveryOptionsContainer>
|
|
405
497
|
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
406
498
|
<View style={{ height: 110 }}>
|
|
@@ -410,8 +502,8 @@ const CheckoutUI = (props: any) => {
|
|
|
410
502
|
</Placeholder>
|
|
411
503
|
</View>
|
|
412
504
|
) : (
|
|
413
|
-
|
|
414
|
-
<
|
|
505
|
+
<ChSection>
|
|
506
|
+
<HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
|
|
415
507
|
<View
|
|
416
508
|
style={{
|
|
417
509
|
backgroundColor: theme.colors.inputDisabled,
|
|
@@ -430,7 +522,7 @@ const CheckoutUI = (props: any) => {
|
|
|
430
522
|
<OText
|
|
431
523
|
size={14}
|
|
432
524
|
>
|
|
433
|
-
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)
|
|
525
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
|
|
434
526
|
</OText>
|
|
435
527
|
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
436
528
|
</DeliveryOptionItem>
|
|
@@ -457,7 +549,7 @@ const CheckoutUI = (props: any) => {
|
|
|
457
549
|
/>
|
|
458
550
|
</View>
|
|
459
551
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
460
|
-
|
|
552
|
+
</ChSection>
|
|
461
553
|
)}
|
|
462
554
|
|
|
463
555
|
</DeliveryOptionsContainer>
|
|
@@ -479,50 +571,30 @@ const CheckoutUI = (props: any) => {
|
|
|
479
571
|
</ChSection>
|
|
480
572
|
)}
|
|
481
573
|
|
|
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>
|
|
574
|
+
{!isGiftCardCart && !hideBusinessMap && (
|
|
575
|
+
<ChSection>
|
|
576
|
+
<ChAddress>
|
|
577
|
+
{(businessDetails?.loading || cartState.loading) ? (
|
|
578
|
+
<Placeholder Animation={Fade}>
|
|
579
|
+
<PlaceholderLine height={20} style={{ marginBottom: 50 }} />
|
|
580
|
+
<PlaceholderLine height={100} />
|
|
581
|
+
</Placeholder>
|
|
582
|
+
) : (
|
|
583
|
+
<AddressDetails
|
|
584
|
+
navigation={navigation}
|
|
585
|
+
location={businessDetails?.business?.location}
|
|
586
|
+
businessLogo={businessDetails?.business?.logo}
|
|
587
|
+
isCartPending={cart?.status === 2}
|
|
588
|
+
uuid={cartUuid}
|
|
589
|
+
apiKey={configs?.google_maps_api_key?.value}
|
|
590
|
+
mapConfigs={mapConfigs}
|
|
591
|
+
HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
|
|
592
|
+
/>
|
|
593
|
+
)}
|
|
594
|
+
</ChAddress>
|
|
595
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
596
|
+
</ChSection>
|
|
597
|
+
)}
|
|
526
598
|
|
|
527
599
|
{!cartState.loading &&
|
|
528
600
|
cart &&
|
|
@@ -531,22 +603,22 @@ const CheckoutUI = (props: any) => {
|
|
|
531
603
|
cart?.status !== 2 &&
|
|
532
604
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
533
605
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
606
|
+
!isGiftCardCart &&
|
|
534
607
|
(
|
|
535
608
|
<ChSection>
|
|
536
609
|
<ChDriverTips>
|
|
537
|
-
<
|
|
538
|
-
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
539
|
-
</OText>
|
|
610
|
+
<HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
|
|
540
611
|
<DriverTips
|
|
541
612
|
uuid={cartUuid}
|
|
542
613
|
businessId={cart?.business_id}
|
|
543
|
-
driverTipsOptions={driverTipsOptions}
|
|
544
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
614
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
615
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
545
616
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
546
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
617
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
547
618
|
? cart?.driver_tip
|
|
548
619
|
: cart?.driver_tip_rate}
|
|
549
620
|
useOrderContext
|
|
621
|
+
cart={cart}
|
|
550
622
|
/>
|
|
551
623
|
</ChDriverTips>
|
|
552
624
|
</ChSection>
|
|
@@ -555,9 +627,7 @@ const CheckoutUI = (props: any) => {
|
|
|
555
627
|
{!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
|
|
556
628
|
<ChSection>
|
|
557
629
|
<ChPaymethods>
|
|
558
|
-
<
|
|
559
|
-
{t('PAYMENT_METHOD', 'Payment Method')}
|
|
560
|
-
</OText>
|
|
630
|
+
<HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
|
|
561
631
|
{!cartState.loading && cart?.status === 4 && (
|
|
562
632
|
<OText
|
|
563
633
|
style={{ textAlign: 'center', marginTop: 20 }}
|
|
@@ -570,8 +640,8 @@ const CheckoutUI = (props: any) => {
|
|
|
570
640
|
<PaymentOptions
|
|
571
641
|
cart={cart}
|
|
572
642
|
isDisabled={cart?.status === 2}
|
|
573
|
-
businessId={businessDetails?.business?.id}
|
|
574
|
-
isLoading={businessDetails.loading}
|
|
643
|
+
businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
|
|
644
|
+
isLoading={!isGiftCardCart ? businessDetails.loading : false}
|
|
575
645
|
paymethods={businessDetails?.business?.paymethods}
|
|
576
646
|
onPaymentChange={handlePaymethodChange}
|
|
577
647
|
errorCash={errorCash}
|
|
@@ -590,6 +660,7 @@ const CheckoutUI = (props: any) => {
|
|
|
590
660
|
<WalletPaymentOptionContainer>
|
|
591
661
|
<PaymentOptionWallet
|
|
592
662
|
cart={cart}
|
|
663
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
593
664
|
businessId={cart?.business_id}
|
|
594
665
|
businessConfigs={businessDetails?.business?.configs}
|
|
595
666
|
/>
|
|
@@ -597,7 +668,7 @@ const CheckoutUI = (props: any) => {
|
|
|
597
668
|
)}
|
|
598
669
|
|
|
599
670
|
|
|
600
|
-
{!cartState.loading && placeSpotsEnabled && (
|
|
671
|
+
{!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
|
|
601
672
|
<>
|
|
602
673
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
|
|
603
674
|
<PlaceSpot
|
|
@@ -605,6 +676,7 @@ const CheckoutUI = (props: any) => {
|
|
|
605
676
|
isInputMode
|
|
606
677
|
cart={cart}
|
|
607
678
|
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
679
|
+
setPlaceSpotNumber={setPlaceSpotNumber}
|
|
608
680
|
vehicleDefault={cart?.vehicle}
|
|
609
681
|
/>
|
|
610
682
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -622,26 +694,21 @@ const CheckoutUI = (props: any) => {
|
|
|
622
694
|
) : (
|
|
623
695
|
<>
|
|
624
696
|
<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' }}
|
|
697
|
+
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
698
|
+
{!isGiftCardCart && (
|
|
699
|
+
<TouchableOpacity
|
|
700
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
641
701
|
>
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
702
|
+
<OText
|
|
703
|
+
size={12}
|
|
704
|
+
lineHeight={15}
|
|
705
|
+
color={theme.colors.primary}
|
|
706
|
+
style={{ textDecorationLine: 'underline' }}
|
|
707
|
+
>
|
|
708
|
+
{t('ADD_PRODUCTS', 'Add products')}
|
|
709
|
+
</OText>
|
|
710
|
+
</TouchableOpacity>
|
|
711
|
+
)}
|
|
645
712
|
</CartHeader>
|
|
646
713
|
{isBusinessChangeEnabled && (
|
|
647
714
|
<TouchableOpacity
|
|
@@ -651,7 +718,7 @@ const CheckoutUI = (props: any) => {
|
|
|
651
718
|
<OText
|
|
652
719
|
size={12}
|
|
653
720
|
lineHeight={18}
|
|
654
|
-
color={theme.colors.
|
|
721
|
+
color={theme.colors.primary}
|
|
655
722
|
style={{ textDecorationLine: 'underline' }}
|
|
656
723
|
>
|
|
657
724
|
{t('CHANGE_STORE', 'Change store')}
|
|
@@ -663,6 +730,12 @@ const CheckoutUI = (props: any) => {
|
|
|
663
730
|
isCartPending={cart?.status === 2}
|
|
664
731
|
onNavigationRedirect={onNavigationRedirect}
|
|
665
732
|
placeSpotTypes={placeSpotTypes}
|
|
733
|
+
businessConfigs={businessConfigs}
|
|
734
|
+
maxDate={maxDate}
|
|
735
|
+
loyaltyRewardRate={
|
|
736
|
+
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
737
|
+
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
738
|
+
}
|
|
666
739
|
/>
|
|
667
740
|
</>
|
|
668
741
|
)}
|
|
@@ -672,7 +745,7 @@ const CheckoutUI = (props: any) => {
|
|
|
672
745
|
|
|
673
746
|
{!cartState.loading && cart && (
|
|
674
747
|
<View>
|
|
675
|
-
<ChErrors style={{ marginBottom:
|
|
748
|
+
<ChErrors style={{ marginBottom: 30 }}>
|
|
676
749
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
677
750
|
<OText
|
|
678
751
|
color={theme.colors.error}
|
|
@@ -699,6 +772,14 @@ const CheckoutUI = (props: any) => {
|
|
|
699
772
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
700
773
|
</OText>
|
|
701
774
|
)}
|
|
775
|
+
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
776
|
+
<OText
|
|
777
|
+
color={theme.colors.error}
|
|
778
|
+
size={12}
|
|
779
|
+
>
|
|
780
|
+
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
781
|
+
</OText>
|
|
782
|
+
)}
|
|
702
783
|
{options.type === 1 &&
|
|
703
784
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
704
785
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -742,18 +823,50 @@ const CheckoutUI = (props: any) => {
|
|
|
742
823
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
743
824
|
requiredFields={requiredFields}
|
|
744
825
|
hideUpdateButton
|
|
745
|
-
|
|
826
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
827
|
+
onClose={() => {
|
|
828
|
+
setIsOpen(false)
|
|
829
|
+
handlePlaceOrder(null, true)
|
|
830
|
+
}}
|
|
831
|
+
setIsOpen={setIsOpen}
|
|
746
832
|
/>
|
|
747
833
|
</View>
|
|
748
834
|
</OModal>
|
|
835
|
+
<OModal
|
|
836
|
+
open={openModal.signup}
|
|
837
|
+
onClose={() => setOpenModal({ ...openModal, signup: false })}
|
|
838
|
+
>
|
|
839
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
|
|
840
|
+
<SignupForm
|
|
841
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
842
|
+
isGuest
|
|
843
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
844
|
+
useSignupByEmail
|
|
845
|
+
useChekoutFileds
|
|
846
|
+
/>
|
|
847
|
+
</ScrollView>
|
|
848
|
+
</OModal>
|
|
849
|
+
<OModal
|
|
850
|
+
open={openModal.login}
|
|
851
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
852
|
+
>
|
|
853
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
|
|
854
|
+
<LoginForm
|
|
855
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
856
|
+
isGuest
|
|
857
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
858
|
+
loginButtonBackground={theme.colors.primary}
|
|
859
|
+
/>
|
|
860
|
+
</ScrollView>
|
|
861
|
+
</OModal>
|
|
749
862
|
</ChContainer>
|
|
750
863
|
</Container>
|
|
751
864
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
752
865
|
<FloatingButton
|
|
753
|
-
handleClick={() => handlePlaceOrder(null)}
|
|
866
|
+
handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
|
|
754
867
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
755
868
|
disabled={isDisabledButtonPlace}
|
|
756
|
-
btnText={
|
|
869
|
+
btnText={subtotalWithTaxes >= cart?.minimum
|
|
757
870
|
? (
|
|
758
871
|
placing
|
|
759
872
|
? t('PLACING', 'Placing')
|