ordering-ui-react-native 0.16.86 → 0.16.87-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 +31 -31
- 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 +19 -8
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- 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 +79 -87
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -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/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- 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 +35 -3
- 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 +18 -18
- 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 +87 -34
- 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 +564 -495
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
- 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 +83 -42
- 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 +280 -173
- 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 +7 -40
- package/themes/original/src/components/Messages/index.tsx +26 -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 +193 -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/index.tsx +109 -219
- 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 -104
- 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 -67
- package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
- 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 +243 -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 +96 -93
- 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/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,31 @@ 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
|
|
153
168
|
|
|
154
169
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
170
|
+
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
171
|
+
if (item?.type === 1)
|
|
172
|
+
return acc = acc + item?.summary?.tax
|
|
173
|
+
return acc = acc
|
|
174
|
+
}, cart?.subtotal)
|
|
155
175
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
156
|
-
placing || errorCash ||
|
|
157
|
-
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
176
|
+
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
158
177
|
(options.type === 1 &&
|
|
159
178
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
160
179
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -180,8 +199,21 @@ const CheckoutUI = (props: any) => {
|
|
|
180
199
|
}
|
|
181
200
|
}
|
|
182
201
|
|
|
183
|
-
const
|
|
184
|
-
|
|
202
|
+
const handleSuccessSignup = (user: any) => {
|
|
203
|
+
login({
|
|
204
|
+
user,
|
|
205
|
+
token: user?.session?.access_token
|
|
206
|
+
})
|
|
207
|
+
setOpenModal({ ...openModal, signup: false })
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const handleSuccessLogin = (user: any) => {
|
|
211
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
215
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
216
|
+
Vibration.vibrate()
|
|
185
217
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
186
218
|
return
|
|
187
219
|
}
|
|
@@ -197,6 +229,11 @@ const CheckoutUI = (props: any) => {
|
|
|
197
229
|
setIsUserDetailsEdit(true)
|
|
198
230
|
}
|
|
199
231
|
|
|
232
|
+
const handlePlaceOrderAsGuest = () => {
|
|
233
|
+
setIsOpen(false)
|
|
234
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
235
|
+
}
|
|
236
|
+
|
|
200
237
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
201
238
|
setShowGateway({ closedByUser: false, open: true })
|
|
202
239
|
setWebviewPaymethod(paymethod)
|
|
@@ -260,13 +297,13 @@ const CheckoutUI = (props: any) => {
|
|
|
260
297
|
}
|
|
261
298
|
}, [errors])
|
|
262
299
|
|
|
263
|
-
// useEffect(() => {
|
|
264
|
-
// handlePaymethodChange(null)
|
|
265
|
-
// }, [cart?.total])
|
|
266
|
-
|
|
267
300
|
useEffect(() => {
|
|
268
301
|
if (cart?.products?.length === 0) {
|
|
269
|
-
|
|
302
|
+
if (cart?.business?.slug) {
|
|
303
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
304
|
+
} else {
|
|
305
|
+
onNavigationRedirect('Wallets')
|
|
306
|
+
}
|
|
270
307
|
}
|
|
271
308
|
}, [cart?.products])
|
|
272
309
|
|
|
@@ -274,6 +311,21 @@ const CheckoutUI = (props: any) => {
|
|
|
274
311
|
onFailPaypal()
|
|
275
312
|
}, [showGateway.closedByUser])
|
|
276
313
|
|
|
314
|
+
const HeaderTitle = (props: any) => {
|
|
315
|
+
const { text } = props
|
|
316
|
+
return (
|
|
317
|
+
<OText
|
|
318
|
+
size={16}
|
|
319
|
+
lineHeight={24}
|
|
320
|
+
weight={'500'}
|
|
321
|
+
mBottom={props.mb ?? 10}
|
|
322
|
+
color={theme.colors.textNormal}
|
|
323
|
+
>
|
|
324
|
+
{text}
|
|
325
|
+
</OText>
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
|
|
277
329
|
return (
|
|
278
330
|
<>
|
|
279
331
|
<Container noPadding>
|
|
@@ -283,8 +335,7 @@ const CheckoutUI = (props: any) => {
|
|
|
283
335
|
titleAlign={'center'}
|
|
284
336
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
285
337
|
showCall={false}
|
|
286
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
287
|
-
style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
338
|
+
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
288
339
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
289
340
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
290
341
|
/>
|
|
@@ -292,13 +343,20 @@ const CheckoutUI = (props: any) => {
|
|
|
292
343
|
<ChContainer style={styles.pagePadding}>
|
|
293
344
|
<ChSection style={{ paddingTop: 0 }}>
|
|
294
345
|
<ChHeader>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
346
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
347
|
+
<OText
|
|
348
|
+
size={12}
|
|
349
|
+
numberOfLines={1}
|
|
350
|
+
ellipsizeMode={'tail'}
|
|
351
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
352
|
+
>
|
|
353
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
354
|
+
</OText>
|
|
298
355
|
<OIcon
|
|
299
356
|
src={theme.images.general.arrow_down}
|
|
300
357
|
width={10}
|
|
301
358
|
style={{ marginStart: 8 }}
|
|
359
|
+
{...(isChewLayout && { color: 'white' })}
|
|
302
360
|
/>
|
|
303
361
|
</CHMomentWrapper>
|
|
304
362
|
<CHMomentWrapper
|
|
@@ -322,85 +380,116 @@ const CheckoutUI = (props: any) => {
|
|
|
322
380
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
323
381
|
</ChSection>
|
|
324
382
|
|
|
325
|
-
|
|
326
|
-
<
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
383
|
+
{!isGiftCardCart && !hideBusinessDetails && (
|
|
384
|
+
<ChSection>
|
|
385
|
+
<ChBusinessDetails>
|
|
386
|
+
{
|
|
387
|
+
(businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
|
|
388
|
+
!businessDetails?.error &&
|
|
389
|
+
(
|
|
390
|
+
<Placeholder Animation={Fade}>
|
|
391
|
+
<PlaceholderLine height={20} />
|
|
392
|
+
<PlaceholderLine height={12} />
|
|
393
|
+
<PlaceholderLine height={12} />
|
|
394
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
395
|
+
</Placeholder>
|
|
396
|
+
)}
|
|
397
|
+
{
|
|
398
|
+
!cartState.loading &&
|
|
399
|
+
businessDetails?.business &&
|
|
400
|
+
Object.values(businessDetails?.business).length > 0 &&
|
|
401
|
+
(
|
|
402
|
+
<>
|
|
403
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
404
|
+
<View>
|
|
405
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
406
|
+
{businessDetails?.business?.name}
|
|
407
|
+
</OText>
|
|
408
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
409
|
+
{businessDetails?.business?.email}
|
|
410
|
+
</OText>
|
|
411
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
412
|
+
{businessDetails?.business?.cellphone}
|
|
413
|
+
</OText>
|
|
414
|
+
{!hideBusinessAddress && (
|
|
415
|
+
<OText size={12} lineHeight={18} weight={'400'}>
|
|
416
|
+
{businessDetails?.business?.address}
|
|
417
|
+
</OText>
|
|
418
|
+
)}
|
|
419
|
+
</View>
|
|
420
|
+
</>
|
|
421
|
+
)}
|
|
422
|
+
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
423
|
+
<View>
|
|
424
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
425
|
+
<NotFoundSource
|
|
426
|
+
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
427
|
+
/>
|
|
428
|
+
</View>
|
|
429
|
+
)}
|
|
430
|
+
</ChBusinessDetails>
|
|
431
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
432
|
+
</ChSection>
|
|
433
|
+
)}
|
|
434
|
+
{!hideCustomerDetails && (
|
|
435
|
+
|
|
436
|
+
<ChSection>
|
|
437
|
+
<ChUserDetails>
|
|
438
|
+
{cartState.loading ? (
|
|
331
439
|
<Placeholder Animation={Fade}>
|
|
332
440
|
<PlaceholderLine height={20} />
|
|
333
441
|
<PlaceholderLine height={12} />
|
|
334
442
|
<PlaceholderLine height={12} />
|
|
335
443
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
336
444
|
</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>
|
|
445
|
+
) : (
|
|
446
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
347
447
|
<View>
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
{
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
{
|
|
359
|
-
|
|
448
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
449
|
+
<OButton
|
|
450
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
451
|
+
textStyle={{ color: theme.colors.white }}
|
|
452
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
453
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
454
|
+
/>
|
|
455
|
+
<OButton
|
|
456
|
+
text={t('LOGIN', 'Login')}
|
|
457
|
+
textStyle={{ color: theme.colors.primary }}
|
|
458
|
+
bgColor={theme.colors.white}
|
|
459
|
+
borderColor={theme.colors.primary}
|
|
460
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
461
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
462
|
+
/>
|
|
463
|
+
<OButton
|
|
464
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
465
|
+
textStyle={{ color: theme.colors.black }}
|
|
466
|
+
bgColor={theme.colors.white}
|
|
467
|
+
borderColor={theme.colors.black}
|
|
468
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
469
|
+
onClick={() => setAllowedGuest(true)}
|
|
470
|
+
/>
|
|
360
471
|
</View>
|
|
361
|
-
|
|
472
|
+
) : (
|
|
473
|
+
<UserDetails
|
|
474
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
475
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
476
|
+
cartStatus={cart?.status}
|
|
477
|
+
businessId={cart?.business_id}
|
|
478
|
+
useValidationFields
|
|
479
|
+
useDefualtSessionManager
|
|
480
|
+
useSessionUser
|
|
481
|
+
isCheckout
|
|
482
|
+
phoneUpdate={phoneUpdate}
|
|
483
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
484
|
+
/>
|
|
485
|
+
)
|
|
362
486
|
)}
|
|
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>
|
|
487
|
+
</ChUserDetails>
|
|
488
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
489
|
+
</ChSection>
|
|
490
|
+
)}
|
|
402
491
|
|
|
403
|
-
{options?.type === 1 && (
|
|
492
|
+
{options?.type === 1 && !isGiftCardCart && (
|
|
404
493
|
<DeliveryOptionsContainer>
|
|
405
494
|
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
406
495
|
<View style={{ height: 110 }}>
|
|
@@ -410,8 +499,8 @@ const CheckoutUI = (props: any) => {
|
|
|
410
499
|
</Placeholder>
|
|
411
500
|
</View>
|
|
412
501
|
) : (
|
|
413
|
-
|
|
414
|
-
<
|
|
502
|
+
<ChSection>
|
|
503
|
+
<HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
|
|
415
504
|
<View
|
|
416
505
|
style={{
|
|
417
506
|
backgroundColor: theme.colors.inputDisabled,
|
|
@@ -430,7 +519,7 @@ const CheckoutUI = (props: any) => {
|
|
|
430
519
|
<OText
|
|
431
520
|
size={14}
|
|
432
521
|
>
|
|
433
|
-
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)
|
|
522
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
|
|
434
523
|
</OText>
|
|
435
524
|
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
436
525
|
</DeliveryOptionItem>
|
|
@@ -457,7 +546,7 @@ const CheckoutUI = (props: any) => {
|
|
|
457
546
|
/>
|
|
458
547
|
</View>
|
|
459
548
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
460
|
-
|
|
549
|
+
</ChSection>
|
|
461
550
|
)}
|
|
462
551
|
|
|
463
552
|
</DeliveryOptionsContainer>
|
|
@@ -479,50 +568,30 @@ const CheckoutUI = (props: any) => {
|
|
|
479
568
|
</ChSection>
|
|
480
569
|
)}
|
|
481
570
|
|
|
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>
|
|
571
|
+
{!isGiftCardCart && !hideBusinessMap && (
|
|
572
|
+
<ChSection>
|
|
573
|
+
<ChAddress>
|
|
574
|
+
{(businessDetails?.loading || cartState.loading) ? (
|
|
575
|
+
<Placeholder Animation={Fade}>
|
|
576
|
+
<PlaceholderLine height={20} style={{ marginBottom: 50 }} />
|
|
577
|
+
<PlaceholderLine height={100} />
|
|
578
|
+
</Placeholder>
|
|
579
|
+
) : (
|
|
580
|
+
<AddressDetails
|
|
581
|
+
navigation={navigation}
|
|
582
|
+
location={businessDetails?.business?.location}
|
|
583
|
+
businessLogo={businessDetails?.business?.logo}
|
|
584
|
+
isCartPending={cart?.status === 2}
|
|
585
|
+
uuid={cartUuid}
|
|
586
|
+
apiKey={configs?.google_maps_api_key?.value}
|
|
587
|
+
mapConfigs={mapConfigs}
|
|
588
|
+
HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
|
|
589
|
+
/>
|
|
590
|
+
)}
|
|
591
|
+
</ChAddress>
|
|
592
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
593
|
+
</ChSection>
|
|
594
|
+
)}
|
|
526
595
|
|
|
527
596
|
{!cartState.loading &&
|
|
528
597
|
cart &&
|
|
@@ -531,22 +600,22 @@ const CheckoutUI = (props: any) => {
|
|
|
531
600
|
cart?.status !== 2 &&
|
|
532
601
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
533
602
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
603
|
+
!isGiftCardCart &&
|
|
534
604
|
(
|
|
535
605
|
<ChSection>
|
|
536
606
|
<ChDriverTips>
|
|
537
|
-
<
|
|
538
|
-
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
539
|
-
</OText>
|
|
607
|
+
<HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
|
|
540
608
|
<DriverTips
|
|
541
609
|
uuid={cartUuid}
|
|
542
610
|
businessId={cart?.business_id}
|
|
543
|
-
driverTipsOptions={driverTipsOptions}
|
|
544
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
611
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
612
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
545
613
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
546
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
614
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
547
615
|
? cart?.driver_tip
|
|
548
616
|
: cart?.driver_tip_rate}
|
|
549
617
|
useOrderContext
|
|
618
|
+
cart={cart}
|
|
550
619
|
/>
|
|
551
620
|
</ChDriverTips>
|
|
552
621
|
</ChSection>
|
|
@@ -555,9 +624,7 @@ const CheckoutUI = (props: any) => {
|
|
|
555
624
|
{!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
|
|
556
625
|
<ChSection>
|
|
557
626
|
<ChPaymethods>
|
|
558
|
-
<
|
|
559
|
-
{t('PAYMENT_METHOD', 'Payment Method')}
|
|
560
|
-
</OText>
|
|
627
|
+
<HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
|
|
561
628
|
{!cartState.loading && cart?.status === 4 && (
|
|
562
629
|
<OText
|
|
563
630
|
style={{ textAlign: 'center', marginTop: 20 }}
|
|
@@ -570,8 +637,8 @@ const CheckoutUI = (props: any) => {
|
|
|
570
637
|
<PaymentOptions
|
|
571
638
|
cart={cart}
|
|
572
639
|
isDisabled={cart?.status === 2}
|
|
573
|
-
businessId={businessDetails?.business?.id}
|
|
574
|
-
isLoading={businessDetails.loading}
|
|
640
|
+
businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
|
|
641
|
+
isLoading={!isGiftCardCart ? businessDetails.loading : false}
|
|
575
642
|
paymethods={businessDetails?.business?.paymethods}
|
|
576
643
|
onPaymentChange={handlePaymethodChange}
|
|
577
644
|
errorCash={errorCash}
|
|
@@ -590,6 +657,7 @@ const CheckoutUI = (props: any) => {
|
|
|
590
657
|
<WalletPaymentOptionContainer>
|
|
591
658
|
<PaymentOptionWallet
|
|
592
659
|
cart={cart}
|
|
660
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
593
661
|
businessId={cart?.business_id}
|
|
594
662
|
businessConfigs={businessDetails?.business?.configs}
|
|
595
663
|
/>
|
|
@@ -597,7 +665,7 @@ const CheckoutUI = (props: any) => {
|
|
|
597
665
|
)}
|
|
598
666
|
|
|
599
667
|
|
|
600
|
-
{!cartState.loading && placeSpotsEnabled && (
|
|
668
|
+
{!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
|
|
601
669
|
<>
|
|
602
670
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
|
|
603
671
|
<PlaceSpot
|
|
@@ -605,6 +673,7 @@ const CheckoutUI = (props: any) => {
|
|
|
605
673
|
isInputMode
|
|
606
674
|
cart={cart}
|
|
607
675
|
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
676
|
+
setPlaceSpotNumber={setPlaceSpotNumber}
|
|
608
677
|
vehicleDefault={cart?.vehicle}
|
|
609
678
|
/>
|
|
610
679
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -622,26 +691,21 @@ const CheckoutUI = (props: any) => {
|
|
|
622
691
|
) : (
|
|
623
692
|
<>
|
|
624
693
|
<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' }}
|
|
694
|
+
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
695
|
+
{!isGiftCardCart && (
|
|
696
|
+
<TouchableOpacity
|
|
697
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
641
698
|
>
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
699
|
+
<OText
|
|
700
|
+
size={12}
|
|
701
|
+
lineHeight={15}
|
|
702
|
+
color={theme.colors.primary}
|
|
703
|
+
style={{ textDecorationLine: 'underline' }}
|
|
704
|
+
>
|
|
705
|
+
{t('ADD_PRODUCTS', 'Add products')}
|
|
706
|
+
</OText>
|
|
707
|
+
</TouchableOpacity>
|
|
708
|
+
)}
|
|
645
709
|
</CartHeader>
|
|
646
710
|
{isBusinessChangeEnabled && (
|
|
647
711
|
<TouchableOpacity
|
|
@@ -651,7 +715,7 @@ const CheckoutUI = (props: any) => {
|
|
|
651
715
|
<OText
|
|
652
716
|
size={12}
|
|
653
717
|
lineHeight={18}
|
|
654
|
-
color={theme.colors.
|
|
718
|
+
color={theme.colors.primary}
|
|
655
719
|
style={{ textDecorationLine: 'underline' }}
|
|
656
720
|
>
|
|
657
721
|
{t('CHANGE_STORE', 'Change store')}
|
|
@@ -663,6 +727,9 @@ const CheckoutUI = (props: any) => {
|
|
|
663
727
|
isCartPending={cart?.status === 2}
|
|
664
728
|
onNavigationRedirect={onNavigationRedirect}
|
|
665
729
|
placeSpotTypes={placeSpotTypes}
|
|
730
|
+
businessConfigs={businessConfigs}
|
|
731
|
+
maxDate={maxDate}
|
|
732
|
+
loyaltyRewardRate={loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')?.accumulation_rate ?? 0}
|
|
666
733
|
/>
|
|
667
734
|
</>
|
|
668
735
|
)}
|
|
@@ -699,6 +766,14 @@ const CheckoutUI = (props: any) => {
|
|
|
699
766
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
700
767
|
</OText>
|
|
701
768
|
)}
|
|
769
|
+
{!cart?.valid_preorder && (
|
|
770
|
+
<OText
|
|
771
|
+
color={theme.colors.error}
|
|
772
|
+
size={12}
|
|
773
|
+
>
|
|
774
|
+
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
775
|
+
</OText>
|
|
776
|
+
)}
|
|
702
777
|
{options.type === 1 &&
|
|
703
778
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
704
779
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -742,18 +817,50 @@ const CheckoutUI = (props: any) => {
|
|
|
742
817
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
743
818
|
requiredFields={requiredFields}
|
|
744
819
|
hideUpdateButton
|
|
745
|
-
|
|
820
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
821
|
+
onClose={() => {
|
|
822
|
+
setIsOpen(false)
|
|
823
|
+
handlePlaceOrder(null, true)
|
|
824
|
+
}}
|
|
825
|
+
setIsOpen={setIsOpen}
|
|
746
826
|
/>
|
|
747
827
|
</View>
|
|
748
828
|
</OModal>
|
|
829
|
+
<OModal
|
|
830
|
+
open={openModal.signup}
|
|
831
|
+
onClose={() => setOpenModal({ ...openModal, signup: false })}
|
|
832
|
+
>
|
|
833
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
|
|
834
|
+
<SignupForm
|
|
835
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
836
|
+
isGuest
|
|
837
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
838
|
+
useSignupByEmail
|
|
839
|
+
useChekoutFileds
|
|
840
|
+
/>
|
|
841
|
+
</ScrollView>
|
|
842
|
+
</OModal>
|
|
843
|
+
<OModal
|
|
844
|
+
open={openModal.login}
|
|
845
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
846
|
+
>
|
|
847
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
|
|
848
|
+
<LoginForm
|
|
849
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
850
|
+
isGuest
|
|
851
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
852
|
+
loginButtonBackground={theme.colors.primary}
|
|
853
|
+
/>
|
|
854
|
+
</ScrollView>
|
|
855
|
+
</OModal>
|
|
749
856
|
</ChContainer>
|
|
750
857
|
</Container>
|
|
751
858
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
752
859
|
<FloatingButton
|
|
753
|
-
handleClick={() => handlePlaceOrder(null)}
|
|
860
|
+
handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
|
|
754
861
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
755
862
|
disabled={isDisabledButtonPlace}
|
|
756
|
-
btnText={
|
|
863
|
+
btnText={subtotalWithTaxes >= cart?.minimum
|
|
757
864
|
? (
|
|
758
865
|
placing
|
|
759
866
|
? t('PLACING', 'Placing')
|