ordering-ui-react-native 0.16.97 → 0.16.98-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 +11 -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 +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 +2 -3
- package/themes/business/src/components/Chat/index.tsx +146 -135
- 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 +33 -43
- 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 +42 -25
- 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 +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 +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 +152 -117
- 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 +24 -23
- package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
- package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
- 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 -490
- 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 +87 -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 +294 -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/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 +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/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/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 +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 +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 +117 -96
- package/themes/original/src/components/MultiCheckout/index.tsx +247 -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/NotFoundSource/index.tsx +1 -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 +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 +66 -29
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
- 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 +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 +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 -261
- package/themes/original/src/components/ProductForm/styles.tsx +4 -7
- 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 +10 -3
- 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 +111 -49
- 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 +1 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
- 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 +20 -19
- 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 +45 -7
- package/themes/original/src/utils/index.tsx +359 -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'
|
|
@@ -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,
|
|
@@ -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,19 +151,34 @@ 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>([])
|
|
154
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false })
|
|
155
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
145
156
|
|
|
146
157
|
const placeSpotTypes = [3, 4, 5]
|
|
147
158
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
159
|
+
const isGiftCardCart = !cart?.business_id
|
|
148
160
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
149
161
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
150
162
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
151
163
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
152
164
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
165
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
166
|
+
const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
|
|
167
|
+
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
168
|
+
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
169
|
+
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
170
|
+
|
|
171
|
+
const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
172
|
+
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
|
|
153
173
|
|
|
154
174
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
175
|
+
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
176
|
+
if (item?.type === 1)
|
|
177
|
+
return acc = acc + item?.summary?.tax
|
|
178
|
+
return acc = acc
|
|
179
|
+
}, cart?.subtotal)
|
|
155
180
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
156
|
-
placing || errorCash ||
|
|
157
|
-
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
181
|
+
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
158
182
|
(options.type === 1 &&
|
|
159
183
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
160
184
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -180,8 +204,21 @@ const CheckoutUI = (props: any) => {
|
|
|
180
204
|
}
|
|
181
205
|
}
|
|
182
206
|
|
|
183
|
-
const
|
|
184
|
-
|
|
207
|
+
const handleSuccessSignup = (user: any) => {
|
|
208
|
+
login({
|
|
209
|
+
user,
|
|
210
|
+
token: user?.session?.access_token
|
|
211
|
+
})
|
|
212
|
+
setOpenModal({ ...openModal, signup: false })
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const handleSuccessLogin = (user: any) => {
|
|
216
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
220
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
221
|
+
Vibration.vibrate()
|
|
185
222
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
186
223
|
return
|
|
187
224
|
}
|
|
@@ -197,6 +234,11 @@ const CheckoutUI = (props: any) => {
|
|
|
197
234
|
setIsUserDetailsEdit(true)
|
|
198
235
|
}
|
|
199
236
|
|
|
237
|
+
const handlePlaceOrderAsGuest = () => {
|
|
238
|
+
setIsOpen(false)
|
|
239
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
240
|
+
}
|
|
241
|
+
|
|
200
242
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
201
243
|
setShowGateway({ closedByUser: false, open: true })
|
|
202
244
|
setWebviewPaymethod(paymethod)
|
|
@@ -260,13 +302,13 @@ const CheckoutUI = (props: any) => {
|
|
|
260
302
|
}
|
|
261
303
|
}, [errors])
|
|
262
304
|
|
|
263
|
-
// useEffect(() => {
|
|
264
|
-
// handlePaymethodChange(null)
|
|
265
|
-
// }, [cart?.total])
|
|
266
|
-
|
|
267
305
|
useEffect(() => {
|
|
268
306
|
if (cart?.products?.length === 0) {
|
|
269
|
-
|
|
307
|
+
if (cart?.business?.slug) {
|
|
308
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
309
|
+
} else {
|
|
310
|
+
onNavigationRedirect('Wallets')
|
|
311
|
+
}
|
|
270
312
|
}
|
|
271
313
|
}, [cart?.products])
|
|
272
314
|
|
|
@@ -274,6 +316,25 @@ const CheckoutUI = (props: any) => {
|
|
|
274
316
|
onFailPaypal()
|
|
275
317
|
}, [showGateway.closedByUser])
|
|
276
318
|
|
|
319
|
+
const HeaderTitle = (props: any) => {
|
|
320
|
+
const { text } = props
|
|
321
|
+
return (
|
|
322
|
+
<OText
|
|
323
|
+
size={16}
|
|
324
|
+
lineHeight={24}
|
|
325
|
+
weight={'500'}
|
|
326
|
+
mBottom={props.mb ?? 10}
|
|
327
|
+
color={theme.colors.textNormal}
|
|
328
|
+
>
|
|
329
|
+
{text}
|
|
330
|
+
</OText>
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
useEffect(() => {
|
|
335
|
+
cart && events.emit('checkout_started', cart)
|
|
336
|
+
}, [])
|
|
337
|
+
|
|
277
338
|
return (
|
|
278
339
|
<>
|
|
279
340
|
<Container noPadding>
|
|
@@ -281,10 +342,9 @@ const CheckoutUI = (props: any) => {
|
|
|
281
342
|
<NavBar
|
|
282
343
|
title={t('CHECKOUT', 'Checkout')}
|
|
283
344
|
titleAlign={'center'}
|
|
284
|
-
onActionLeft={() =>
|
|
345
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
285
346
|
showCall={false}
|
|
286
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
287
|
-
style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
347
|
+
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
288
348
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
289
349
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
290
350
|
/>
|
|
@@ -292,13 +352,20 @@ const CheckoutUI = (props: any) => {
|
|
|
292
352
|
<ChContainer style={styles.pagePadding}>
|
|
293
353
|
<ChSection style={{ paddingTop: 0 }}>
|
|
294
354
|
<ChHeader>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
355
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
356
|
+
<OText
|
|
357
|
+
size={12}
|
|
358
|
+
numberOfLines={1}
|
|
359
|
+
ellipsizeMode={'tail'}
|
|
360
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
361
|
+
>
|
|
362
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
363
|
+
</OText>
|
|
298
364
|
<OIcon
|
|
299
365
|
src={theme.images.general.arrow_down}
|
|
300
366
|
width={10}
|
|
301
367
|
style={{ marginStart: 8 }}
|
|
368
|
+
{...(isChewLayout && { color: 'white' })}
|
|
302
369
|
/>
|
|
303
370
|
</CHMomentWrapper>
|
|
304
371
|
<CHMomentWrapper
|
|
@@ -322,85 +389,116 @@ const CheckoutUI = (props: any) => {
|
|
|
322
389
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
323
390
|
</ChSection>
|
|
324
391
|
|
|
325
|
-
|
|
326
|
-
<
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
392
|
+
{!isGiftCardCart && !hideBusinessDetails && (
|
|
393
|
+
<ChSection>
|
|
394
|
+
<ChBusinessDetails>
|
|
395
|
+
{
|
|
396
|
+
(businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
|
|
397
|
+
!businessDetails?.error &&
|
|
398
|
+
(
|
|
399
|
+
<Placeholder Animation={Fade}>
|
|
400
|
+
<PlaceholderLine height={20} />
|
|
401
|
+
<PlaceholderLine height={12} />
|
|
402
|
+
<PlaceholderLine height={12} />
|
|
403
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
404
|
+
</Placeholder>
|
|
405
|
+
)}
|
|
406
|
+
{
|
|
407
|
+
!cartState.loading &&
|
|
408
|
+
businessDetails?.business &&
|
|
409
|
+
Object.values(businessDetails?.business).length > 0 &&
|
|
410
|
+
(
|
|
411
|
+
<>
|
|
412
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
413
|
+
<View>
|
|
414
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
415
|
+
{businessDetails?.business?.name}
|
|
416
|
+
</OText>
|
|
417
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
418
|
+
{businessDetails?.business?.email}
|
|
419
|
+
</OText>
|
|
420
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
421
|
+
{businessDetails?.business?.cellphone}
|
|
422
|
+
</OText>
|
|
423
|
+
{!hideBusinessAddress && (
|
|
424
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
425
|
+
{businessDetails?.business?.address}
|
|
426
|
+
</OText>
|
|
427
|
+
)}
|
|
428
|
+
</View>
|
|
429
|
+
</>
|
|
430
|
+
)}
|
|
431
|
+
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
432
|
+
<View>
|
|
433
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
434
|
+
<NotFoundSource
|
|
435
|
+
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
436
|
+
/>
|
|
437
|
+
</View>
|
|
438
|
+
)}
|
|
439
|
+
</ChBusinessDetails>
|
|
440
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
441
|
+
</ChSection>
|
|
442
|
+
)}
|
|
443
|
+
{!hideCustomerDetails && (
|
|
444
|
+
|
|
445
|
+
<ChSection>
|
|
446
|
+
<ChUserDetails>
|
|
447
|
+
{cartState.loading ? (
|
|
331
448
|
<Placeholder Animation={Fade}>
|
|
332
449
|
<PlaceholderLine height={20} />
|
|
333
450
|
<PlaceholderLine height={12} />
|
|
334
451
|
<PlaceholderLine height={12} />
|
|
335
452
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
336
453
|
</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>
|
|
454
|
+
) : (
|
|
455
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
347
456
|
<View>
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
{
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
{
|
|
359
|
-
|
|
457
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
458
|
+
<OButton
|
|
459
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
460
|
+
textStyle={{ color: theme.colors.white }}
|
|
461
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
462
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
463
|
+
/>
|
|
464
|
+
<OButton
|
|
465
|
+
text={t('LOGIN', 'Login')}
|
|
466
|
+
textStyle={{ color: theme.colors.primary }}
|
|
467
|
+
bgColor={theme.colors.white}
|
|
468
|
+
borderColor={theme.colors.primary}
|
|
469
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
470
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
471
|
+
/>
|
|
472
|
+
<OButton
|
|
473
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
474
|
+
textStyle={{ color: theme.colors.black }}
|
|
475
|
+
bgColor={theme.colors.white}
|
|
476
|
+
borderColor={theme.colors.black}
|
|
477
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
478
|
+
onClick={() => setAllowedGuest(true)}
|
|
479
|
+
/>
|
|
360
480
|
</View>
|
|
361
|
-
|
|
481
|
+
) : (
|
|
482
|
+
<UserDetails
|
|
483
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
484
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
485
|
+
cartStatus={cart?.status}
|
|
486
|
+
businessId={cart?.business_id}
|
|
487
|
+
useValidationFields
|
|
488
|
+
useDefualtSessionManager
|
|
489
|
+
useSessionUser
|
|
490
|
+
isCheckout
|
|
491
|
+
phoneUpdate={phoneUpdate}
|
|
492
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
493
|
+
/>
|
|
494
|
+
)
|
|
362
495
|
)}
|
|
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>
|
|
496
|
+
</ChUserDetails>
|
|
497
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
498
|
+
</ChSection>
|
|
499
|
+
)}
|
|
402
500
|
|
|
403
|
-
{options?.type === 1 && (
|
|
501
|
+
{options?.type === 1 && !isGiftCardCart && (
|
|
404
502
|
<DeliveryOptionsContainer>
|
|
405
503
|
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
406
504
|
<View style={{ height: 110 }}>
|
|
@@ -410,8 +508,8 @@ const CheckoutUI = (props: any) => {
|
|
|
410
508
|
</Placeholder>
|
|
411
509
|
</View>
|
|
412
510
|
) : (
|
|
413
|
-
|
|
414
|
-
<
|
|
511
|
+
<ChSection>
|
|
512
|
+
<HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
|
|
415
513
|
<View
|
|
416
514
|
style={{
|
|
417
515
|
backgroundColor: theme.colors.inputDisabled,
|
|
@@ -430,7 +528,7 @@ const CheckoutUI = (props: any) => {
|
|
|
430
528
|
<OText
|
|
431
529
|
size={14}
|
|
432
530
|
>
|
|
433
|
-
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)
|
|
531
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
|
|
434
532
|
</OText>
|
|
435
533
|
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
436
534
|
</DeliveryOptionItem>
|
|
@@ -457,7 +555,7 @@ const CheckoutUI = (props: any) => {
|
|
|
457
555
|
/>
|
|
458
556
|
</View>
|
|
459
557
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
460
|
-
|
|
558
|
+
</ChSection>
|
|
461
559
|
)}
|
|
462
560
|
|
|
463
561
|
</DeliveryOptionsContainer>
|
|
@@ -479,50 +577,30 @@ const CheckoutUI = (props: any) => {
|
|
|
479
577
|
</ChSection>
|
|
480
578
|
)}
|
|
481
579
|
|
|
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>
|
|
580
|
+
{!isGiftCardCart && !hideBusinessMap && (
|
|
581
|
+
<ChSection>
|
|
582
|
+
<ChAddress>
|
|
583
|
+
{(businessDetails?.loading || cartState.loading) ? (
|
|
584
|
+
<Placeholder Animation={Fade}>
|
|
585
|
+
<PlaceholderLine height={20} style={{ marginBottom: 50 }} />
|
|
586
|
+
<PlaceholderLine height={100} />
|
|
587
|
+
</Placeholder>
|
|
588
|
+
) : (
|
|
589
|
+
<AddressDetails
|
|
590
|
+
navigation={navigation}
|
|
591
|
+
location={options?.address?.location}
|
|
592
|
+
businessLogo={businessDetails?.business?.logo}
|
|
593
|
+
isCartPending={cart?.status === 2}
|
|
594
|
+
uuid={cartUuid}
|
|
595
|
+
apiKey={configs?.google_maps_api_key?.value}
|
|
596
|
+
mapConfigs={mapConfigs}
|
|
597
|
+
HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
|
|
598
|
+
/>
|
|
599
|
+
)}
|
|
600
|
+
</ChAddress>
|
|
601
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
602
|
+
</ChSection>
|
|
603
|
+
)}
|
|
526
604
|
|
|
527
605
|
{!cartState.loading &&
|
|
528
606
|
cart &&
|
|
@@ -531,22 +609,22 @@ const CheckoutUI = (props: any) => {
|
|
|
531
609
|
cart?.status !== 2 &&
|
|
532
610
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
533
611
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
612
|
+
!isGiftCardCart &&
|
|
534
613
|
(
|
|
535
614
|
<ChSection>
|
|
536
615
|
<ChDriverTips>
|
|
537
|
-
<
|
|
538
|
-
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
539
|
-
</OText>
|
|
616
|
+
<HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
|
|
540
617
|
<DriverTips
|
|
541
618
|
uuid={cartUuid}
|
|
542
619
|
businessId={cart?.business_id}
|
|
543
|
-
driverTipsOptions={driverTipsOptions}
|
|
544
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
620
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
621
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
545
622
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
546
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
623
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
547
624
|
? cart?.driver_tip
|
|
548
625
|
: cart?.driver_tip_rate}
|
|
549
626
|
useOrderContext
|
|
627
|
+
cart={cart}
|
|
550
628
|
/>
|
|
551
629
|
</ChDriverTips>
|
|
552
630
|
</ChSection>
|
|
@@ -555,9 +633,7 @@ const CheckoutUI = (props: any) => {
|
|
|
555
633
|
{!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
|
|
556
634
|
<ChSection>
|
|
557
635
|
<ChPaymethods>
|
|
558
|
-
<
|
|
559
|
-
{t('PAYMENT_METHOD', 'Payment Method')}
|
|
560
|
-
</OText>
|
|
636
|
+
<HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
|
|
561
637
|
{!cartState.loading && cart?.status === 4 && (
|
|
562
638
|
<OText
|
|
563
639
|
style={{ textAlign: 'center', marginTop: 20 }}
|
|
@@ -570,8 +646,8 @@ const CheckoutUI = (props: any) => {
|
|
|
570
646
|
<PaymentOptions
|
|
571
647
|
cart={cart}
|
|
572
648
|
isDisabled={cart?.status === 2}
|
|
573
|
-
businessId={businessDetails?.business?.id}
|
|
574
|
-
isLoading={businessDetails.loading}
|
|
649
|
+
businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
|
|
650
|
+
isLoading={!isGiftCardCart ? businessDetails.loading : false}
|
|
575
651
|
paymethods={businessDetails?.business?.paymethods}
|
|
576
652
|
onPaymentChange={handlePaymethodChange}
|
|
577
653
|
errorCash={errorCash}
|
|
@@ -590,6 +666,7 @@ const CheckoutUI = (props: any) => {
|
|
|
590
666
|
<WalletPaymentOptionContainer>
|
|
591
667
|
<PaymentOptionWallet
|
|
592
668
|
cart={cart}
|
|
669
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
593
670
|
businessId={cart?.business_id}
|
|
594
671
|
businessConfigs={businessDetails?.business?.configs}
|
|
595
672
|
/>
|
|
@@ -597,7 +674,7 @@ const CheckoutUI = (props: any) => {
|
|
|
597
674
|
)}
|
|
598
675
|
|
|
599
676
|
|
|
600
|
-
{!cartState.loading && placeSpotsEnabled && (
|
|
677
|
+
{!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
|
|
601
678
|
<>
|
|
602
679
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
|
|
603
680
|
<PlaceSpot
|
|
@@ -605,6 +682,7 @@ const CheckoutUI = (props: any) => {
|
|
|
605
682
|
isInputMode
|
|
606
683
|
cart={cart}
|
|
607
684
|
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
685
|
+
setPlaceSpotNumber={setPlaceSpotNumber}
|
|
608
686
|
vehicleDefault={cart?.vehicle}
|
|
609
687
|
/>
|
|
610
688
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -622,26 +700,21 @@ const CheckoutUI = (props: any) => {
|
|
|
622
700
|
) : (
|
|
623
701
|
<>
|
|
624
702
|
<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' }}
|
|
703
|
+
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
704
|
+
{!isGiftCardCart && (
|
|
705
|
+
<TouchableOpacity
|
|
706
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
641
707
|
>
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
708
|
+
<OText
|
|
709
|
+
size={12}
|
|
710
|
+
lineHeight={15}
|
|
711
|
+
color={theme.colors.primary}
|
|
712
|
+
style={{ textDecorationLine: 'underline' }}
|
|
713
|
+
>
|
|
714
|
+
{t('ADD_PRODUCTS', 'Add products')}
|
|
715
|
+
</OText>
|
|
716
|
+
</TouchableOpacity>
|
|
717
|
+
)}
|
|
645
718
|
</CartHeader>
|
|
646
719
|
{isBusinessChangeEnabled && (
|
|
647
720
|
<TouchableOpacity
|
|
@@ -651,7 +724,7 @@ const CheckoutUI = (props: any) => {
|
|
|
651
724
|
<OText
|
|
652
725
|
size={12}
|
|
653
726
|
lineHeight={18}
|
|
654
|
-
color={theme.colors.
|
|
727
|
+
color={theme.colors.primary}
|
|
655
728
|
style={{ textDecorationLine: 'underline' }}
|
|
656
729
|
>
|
|
657
730
|
{t('CHANGE_STORE', 'Change store')}
|
|
@@ -663,6 +736,12 @@ const CheckoutUI = (props: any) => {
|
|
|
663
736
|
isCartPending={cart?.status === 2}
|
|
664
737
|
onNavigationRedirect={onNavigationRedirect}
|
|
665
738
|
placeSpotTypes={placeSpotTypes}
|
|
739
|
+
businessConfigs={businessConfigs}
|
|
740
|
+
maxDate={maxDate}
|
|
741
|
+
loyaltyRewardRate={
|
|
742
|
+
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
743
|
+
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
744
|
+
}
|
|
666
745
|
/>
|
|
667
746
|
</>
|
|
668
747
|
)}
|
|
@@ -672,7 +751,7 @@ const CheckoutUI = (props: any) => {
|
|
|
672
751
|
|
|
673
752
|
{!cartState.loading && cart && (
|
|
674
753
|
<View>
|
|
675
|
-
<ChErrors style={{ marginBottom:
|
|
754
|
+
<ChErrors style={{ marginBottom: 30 }}>
|
|
676
755
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
677
756
|
<OText
|
|
678
757
|
color={theme.colors.error}
|
|
@@ -699,6 +778,14 @@ const CheckoutUI = (props: any) => {
|
|
|
699
778
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
700
779
|
</OText>
|
|
701
780
|
)}
|
|
781
|
+
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
782
|
+
<OText
|
|
783
|
+
color={theme.colors.error}
|
|
784
|
+
size={12}
|
|
785
|
+
>
|
|
786
|
+
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
787
|
+
</OText>
|
|
788
|
+
)}
|
|
702
789
|
{options.type === 1 &&
|
|
703
790
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
704
791
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -742,18 +829,50 @@ const CheckoutUI = (props: any) => {
|
|
|
742
829
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
743
830
|
requiredFields={requiredFields}
|
|
744
831
|
hideUpdateButton
|
|
745
|
-
|
|
832
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
833
|
+
onClose={() => {
|
|
834
|
+
setIsOpen(false)
|
|
835
|
+
handlePlaceOrder(null, true)
|
|
836
|
+
}}
|
|
837
|
+
setIsOpen={setIsOpen}
|
|
746
838
|
/>
|
|
747
839
|
</View>
|
|
748
840
|
</OModal>
|
|
841
|
+
<OModal
|
|
842
|
+
open={openModal.signup}
|
|
843
|
+
onClose={() => setOpenModal({ ...openModal, signup: false })}
|
|
844
|
+
>
|
|
845
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
|
|
846
|
+
<SignupForm
|
|
847
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
848
|
+
isGuest
|
|
849
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
850
|
+
useSignupByEmail
|
|
851
|
+
useChekoutFileds
|
|
852
|
+
/>
|
|
853
|
+
</ScrollView>
|
|
854
|
+
</OModal>
|
|
855
|
+
<OModal
|
|
856
|
+
open={openModal.login}
|
|
857
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
858
|
+
>
|
|
859
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
|
|
860
|
+
<LoginForm
|
|
861
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
862
|
+
isGuest
|
|
863
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
864
|
+
loginButtonBackground={theme.colors.primary}
|
|
865
|
+
/>
|
|
866
|
+
</ScrollView>
|
|
867
|
+
</OModal>
|
|
749
868
|
</ChContainer>
|
|
750
869
|
</Container>
|
|
751
870
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
752
871
|
<FloatingButton
|
|
753
|
-
handleClick={() => handlePlaceOrder(null)}
|
|
872
|
+
handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
|
|
754
873
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
755
874
|
disabled={isDisabledButtonPlace}
|
|
756
|
-
btnText={
|
|
875
|
+
btnText={subtotalWithTaxes >= cart?.minimum
|
|
757
876
|
? (
|
|
758
877
|
placing
|
|
759
878
|
? t('PLACING', 'Placing')
|