ordering-ui-react-native 0.21.78 → 0.21.79-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 +6 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +3 -1
- package/themes/business/src/components/DriverMap/index.tsx +44 -27
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +74 -24
- package/themes/business/src/components/OrderDetails/Business.tsx +65 -7
- package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -20
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +110 -40
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -35
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +222 -72
- package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
- package/themes/business/src/components/OrdersOption/index.tsx +247 -159
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +25 -15
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +84 -47
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +23 -5
- package/themes/business/src/utils/index.tsx +19 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- 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/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +13 -1
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
- package/themes/original/src/components/BusinessController/index.tsx +12 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +38 -11
- package/themes/original/src/components/CartContent/index.tsx +21 -8
- package/themes/original/src/components/Checkout/index.tsx +108 -60
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +2 -10
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +139 -87
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -1
- package/themes/original/src/components/MyOrders/index.tsx +21 -26
- package/themes/original/src/components/NavBar/index.tsx +4 -2
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +1 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
- package/themes/original/src/components/OrderDetails/index.tsx +27 -10
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderSummary/index.tsx +28 -9
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +2 -4
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +17 -9
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +8 -1
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +86 -78
- package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +77 -60
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +3 -2
- package/themes/original/src/components/UserFormDetails/index.tsx +155 -131
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -19,7 +19,7 @@ import { CouponControl } from '../CouponControl';
|
|
|
19
19
|
import { OButton, OInput, OModal, OText } from '../shared';
|
|
20
20
|
import { UpsellingProducts } from '../UpsellingProducts';
|
|
21
21
|
import { verifyDecimals } from '../../utils';
|
|
22
|
-
import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
|
|
22
|
+
import { ActivityIndicator, TouchableOpacity, View, Vibration } from 'react-native';
|
|
23
23
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
24
24
|
import { TaxInformation } from '../TaxInformation';
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
@@ -114,6 +114,7 @@ const CartUI = (props: any) => {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
const handleUpsellingPage = (individualCart: any) => {
|
|
117
|
+
Vibration.vibrate(100)
|
|
117
118
|
const isProductCartParam = !!individualCart?.products?.length
|
|
118
119
|
setOpenUpselling(false)
|
|
119
120
|
setCanOpenUpselling(false)
|
|
@@ -155,18 +156,20 @@ const CartUI = (props: any) => {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
const getIncludedTaxes = () => {
|
|
159
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
159
160
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
160
|
-
return cart
|
|
161
|
+
return cart?.business.tax_type === 1 ? cart?.tax : 0
|
|
161
162
|
} else {
|
|
162
163
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
163
|
-
return taxIncluded +
|
|
164
|
+
return taxIncluded +
|
|
165
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
166
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
164
167
|
}, 0)
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
const getIncludedTaxesDiscounts = () => {
|
|
169
|
-
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
172
|
+
return cart?.taxes?.filter((tax: any) => (tax?.type === 1 && tax?.target === 'product'))?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
const OfferAlert = ({ offerId }: any) => {
|
|
@@ -197,10 +200,15 @@ const CartUI = (props: any) => {
|
|
|
197
200
|
}, cart?.subtotal)
|
|
198
201
|
|
|
199
202
|
const handleClickCheckout = () => {
|
|
203
|
+
Vibration.vibrate(100)
|
|
200
204
|
if (cart?.business_id) {
|
|
201
205
|
setOpenUpselling(true)
|
|
202
206
|
} else {
|
|
203
|
-
|
|
207
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
208
|
+
screen: 'CheckoutPage',
|
|
209
|
+
cartUuid: cart?.uuid,
|
|
210
|
+
cartTotal: cart?.total
|
|
211
|
+
}, true)
|
|
204
212
|
}
|
|
205
213
|
}
|
|
206
214
|
|
|
@@ -239,7 +247,10 @@ const CartUI = (props: any) => {
|
|
|
239
247
|
handleClearProducts={handleClearProducts}
|
|
240
248
|
handleCartOpen={handleCartOpen}
|
|
241
249
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
242
|
-
handleChangeStore={() =>
|
|
250
|
+
handleChangeStore={() => {
|
|
251
|
+
Vibration.vibrate(100)
|
|
252
|
+
setOpenChangeStore(true)
|
|
253
|
+
}}
|
|
243
254
|
handleClickCheckout={() => handleClickCheckout()}
|
|
244
255
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
245
256
|
isMultiCheckout={isMultiCheckout}
|
|
@@ -320,7 +331,7 @@ const CartUI = (props: any) => {
|
|
|
320
331
|
</OSTable>
|
|
321
332
|
)}
|
|
322
333
|
{
|
|
323
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
|
|
334
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any, i: number) => (
|
|
324
335
|
<OSTable key={`${tax.id}_${i}`}>
|
|
325
336
|
<OSRow>
|
|
326
337
|
<OText size={12} lineHeight={18} numberOfLines={1} >
|
|
@@ -375,9 +386,25 @@ const CartUI = (props: any) => {
|
|
|
375
386
|
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
376
387
|
<OSTable>
|
|
377
388
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
378
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
389
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount + getIncludedTaxes(true))}</OText>
|
|
379
390
|
</OSTable>
|
|
380
391
|
)}
|
|
392
|
+
{
|
|
393
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
394
|
+
<OSTable key={`${tax.description}_${i}`}>
|
|
395
|
+
<OSRow>
|
|
396
|
+
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
397
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
398
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
399
|
+
</OText>
|
|
400
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
401
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
402
|
+
</TouchableOpacity>
|
|
403
|
+
</OSRow>
|
|
404
|
+
<OText size={12} lineHeight={18}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
405
|
+
</OSTable>
|
|
406
|
+
))
|
|
407
|
+
}
|
|
381
408
|
{
|
|
382
409
|
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
|
|
383
410
|
<OSTable key={`${offer.id}_${i}`}>
|
|
@@ -553,10 +580,10 @@ const CartUI = (props: any) => {
|
|
|
553
580
|
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
554
581
|
)}
|
|
555
582
|
bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
583
|
+
borderColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
556
584
|
isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
557
|
-
borderColor={theme.colors.primary}
|
|
558
585
|
imgRightSrc={null}
|
|
559
|
-
textStyle={{
|
|
586
|
+
textStyle={{ textAlign: 'center', flex: 1 }}
|
|
560
587
|
onClick={() => handleClickCheckout()}
|
|
561
588
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
562
589
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { Vibration, View } from 'react-native';
|
|
3
3
|
import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
|
|
@@ -13,7 +13,8 @@ export const CartContent = (props: any) => {
|
|
|
13
13
|
const {
|
|
14
14
|
onNavigationRedirect,
|
|
15
15
|
singleBusiness,
|
|
16
|
-
businessSlug
|
|
16
|
+
businessSlug,
|
|
17
|
+
navigation
|
|
17
18
|
} = props
|
|
18
19
|
|
|
19
20
|
const theme = useTheme();
|
|
@@ -22,7 +23,7 @@ export const CartContent = (props: any) => {
|
|
|
22
23
|
const [{ parsePrice }] = useUtils();
|
|
23
24
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
24
25
|
const [cartsOpened, setCartsOpened] = useState([])
|
|
25
|
-
const [{ carts: cartsContext }] = useOrder();
|
|
26
|
+
const [{ carts: cartsContext }, { confirmCart }] = useOrder();
|
|
26
27
|
const cartsList =
|
|
27
28
|
(cartsContext &&
|
|
28
29
|
Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
|
|
@@ -38,6 +39,7 @@ export const CartContent = (props: any) => {
|
|
|
38
39
|
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
39
40
|
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
40
41
|
const handleCheckoutRedirect = () => {
|
|
42
|
+
Vibration.vibrate(100)
|
|
41
43
|
if (cartsAvailable.length === 1) {
|
|
42
44
|
onNavigationRedirect('CheckoutNavigator', {
|
|
43
45
|
screen: 'CheckoutPage',
|
|
@@ -71,7 +73,7 @@ export const CartContent = (props: any) => {
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
const changeActiveState = useCallback((isClosed
|
|
76
|
+
const changeActiveState = useCallback((isClosed: boolean, uuid: string) => {
|
|
75
77
|
const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
|
|
76
78
|
if (isActive || !isClosed) {
|
|
77
79
|
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
@@ -83,6 +85,20 @@ export const CartContent = (props: any) => {
|
|
|
83
85
|
}
|
|
84
86
|
}, [cartsOpened])
|
|
85
87
|
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const unsuscribe = navigation.addListener('focus', () => {
|
|
90
|
+
const cartsListBlockedByPaypal = carts?.filter((cart: any) => cart?.status === 2 && cart?.paymethod_data?.gateway === 'paypal')
|
|
91
|
+
if (cartsListBlockedByPaypal?.length > 0) {
|
|
92
|
+
cartsListBlockedByPaypal.map(async (cart: any) => {
|
|
93
|
+
await confirmCart(cart?.uuid)
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
return () => {
|
|
98
|
+
return unsuscribe()
|
|
99
|
+
}
|
|
100
|
+
}, [carts, navigation])
|
|
101
|
+
|
|
86
102
|
return (
|
|
87
103
|
<CCContainer
|
|
88
104
|
style={{ paddingHorizontal: 20 }}
|
|
@@ -158,11 +174,8 @@ export const CartContent = (props: any) => {
|
|
|
158
174
|
<CheckoutAction style={{ marginTop: 0 }}>
|
|
159
175
|
<OButton
|
|
160
176
|
text={t('CHECKOUT', 'Checkout')}
|
|
161
|
-
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
162
177
|
isDisabled={!cartsAvailable.length}
|
|
163
|
-
borderColor={theme.colors.primary}
|
|
164
178
|
imgRightSrc={null}
|
|
165
|
-
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
166
179
|
onClick={() => handleCheckoutRedirect()}
|
|
167
180
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
168
181
|
/>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
2
2
|
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler, SafeAreaView } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
4
|
import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
|
|
5
5
|
import Picker from 'react-native-country-picker-modal';
|
|
6
6
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
7
7
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
8
9
|
|
|
9
|
-
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
10
|
+
import ReactNativeHapticFeedback, { HapticFeedbackTypes } from "react-native-haptic-feedback";
|
|
10
11
|
import {
|
|
11
12
|
Checkout as CheckoutController,
|
|
12
13
|
useOrder,
|
|
@@ -14,7 +15,6 @@ import {
|
|
|
14
15
|
useApi,
|
|
15
16
|
useLanguage,
|
|
16
17
|
useUtils,
|
|
17
|
-
useValidationFields,
|
|
18
18
|
useConfig,
|
|
19
19
|
useToast,
|
|
20
20
|
ToastType,
|
|
@@ -100,10 +100,14 @@ const CheckoutUI = (props: any) => {
|
|
|
100
100
|
currency,
|
|
101
101
|
merchantId,
|
|
102
102
|
setPlaceSpotNumber,
|
|
103
|
-
maxDate
|
|
103
|
+
maxDate,
|
|
104
|
+
androidAppId,
|
|
105
|
+
urlscheme,
|
|
106
|
+
checkoutFieldsState
|
|
104
107
|
} = props
|
|
105
108
|
|
|
106
109
|
const theme = useTheme();
|
|
110
|
+
const isFocused = useIsFocused();
|
|
107
111
|
|
|
108
112
|
const styles = StyleSheet.create({
|
|
109
113
|
btnBackArrow: {
|
|
@@ -141,12 +145,11 @@ const CheckoutUI = (props: any) => {
|
|
|
141
145
|
|
|
142
146
|
const [, { showToast }] = useToast();
|
|
143
147
|
const [, t] = useLanguage();
|
|
144
|
-
const [{ user, token }, { login }] = useSession();
|
|
148
|
+
const [{ user, token, loading: userLoading }, { login }] = useSession();
|
|
145
149
|
const [ordering] = useApi()
|
|
146
150
|
const [{ configs }] = useConfig();
|
|
147
151
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
148
152
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
149
|
-
const [validationFields] = useValidationFields();
|
|
150
153
|
const [events] = useEvent()
|
|
151
154
|
const [orientationState] = useDeviceOrientation();
|
|
152
155
|
const [isReadMore, setIsReadMore] = useState(false)
|
|
@@ -163,6 +166,7 @@ const CheckoutUI = (props: any) => {
|
|
|
163
166
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
164
167
|
const [isOpen, setIsOpen] = useState(false)
|
|
165
168
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
169
|
+
const [orderTypeValidationFields, setOrderTypeValidationFields] = useState<any>([])
|
|
166
170
|
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
167
171
|
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
168
172
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
@@ -174,6 +178,14 @@ const CheckoutUI = (props: any) => {
|
|
|
174
178
|
const containerRef = useRef<any>()
|
|
175
179
|
const cardsMethods = ['credomatic']
|
|
176
180
|
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
181
|
+
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
182
|
+
|
|
183
|
+
const checkoutFields = useMemo(() => checkoutFieldsState?.fields?.filter((field : any) => field.order_type_id === options?.type), [checkoutFieldsState, options])
|
|
184
|
+
const guestCheckoutDriveTip = useMemo(() => checkoutFields?.find((field : any) => field.order_type_id === 1 && field?.validation_field?.code === 'driver_tip'), [JSON.stringify(checkoutFields), options])
|
|
185
|
+
const guestCheckoutComment = useMemo(() => checkoutFields?.find((field : any) => field.order_type_id === options?.type && field?.validation_field?.code === 'comments'), [JSON.stringify(checkoutFields), options])
|
|
186
|
+
const guestCheckoutCoupon = useMemo(() => checkoutFields?.find((field : any) => field.order_type_id === options?.type && field?.validation_field?.code === 'coupon'), [JSON.stringify(checkoutFields), options])
|
|
187
|
+
const guestCheckoutZipcode = useMemo(() => checkoutFields?.find((field : any) => field.order_type_id === options?.type && field?.validation_field?.code === 'zipcode'), [JSON.stringify(checkoutFields), options])
|
|
188
|
+
|
|
177
189
|
const placeSpotTypes = [3, 4, 5]
|
|
178
190
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
179
191
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
@@ -198,27 +210,28 @@ const CheckoutUI = (props: any) => {
|
|
|
198
210
|
return acc = acc
|
|
199
211
|
}, cart?.subtotal)
|
|
200
212
|
|
|
201
|
-
const validateCommentsCartField =
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
!paymethodSelected?.data?.card?.zipcode &&
|
|
206
|
-
paymethodSelected?.gateway === 'stripe'
|
|
213
|
+
const validateCommentsCartField = (guestCheckoutComment?.enabled && (user?.guest_id ? guestCheckoutComment?.required_with_guest : guestCheckoutComment?.required)) && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
214
|
+
const validateDriverTipField = options.type === 1 && (guestCheckoutDriveTip?.enabled && (user?.guest_id ? guestCheckoutDriveTip?.required_with_guest : guestCheckoutDriveTip?.required)) && (Number(cart?.driver_tip) <= 0)
|
|
215
|
+
const validateCouponField = (guestCheckoutCoupon?.enabled && (user?.guest_id ? guestCheckoutCoupon?.required_with_guest : guestCheckoutCoupon?.required)) && !cart?.offers?.some((offer : any) => offer?.type === 2)
|
|
216
|
+
const validateZipcodeCard = (guestCheckoutZipcode?.enabled && (user?.guest_id ? guestCheckoutZipcode?.required_with_guest : guestCheckoutZipcode?.required)) && paymethodSelected?.gateway === 'stripe' && paymethodSelected?.data?.card && !paymethodSelected?.data?.card?.zipcode
|
|
207
217
|
|
|
208
218
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
209
219
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
210
220
|
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
211
|
-
(options.type === 1 &&
|
|
212
|
-
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
213
|
-
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
214
|
-
(Number(cart?.driver_tip) <= 0)) ||
|
|
215
221
|
(validateCommentsCartField) ||
|
|
216
|
-
(
|
|
217
|
-
|
|
222
|
+
(validateDriverTipField && !isGiftCardCart) ||
|
|
223
|
+
(validateZipcodeCard) ||
|
|
224
|
+
(methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading)) ||
|
|
225
|
+
validateCommentsCartField ||
|
|
226
|
+
validateDriverTipField ||
|
|
227
|
+
validateCouponField ||
|
|
228
|
+
validateZipcodeCard
|
|
229
|
+
|
|
218
230
|
|
|
219
231
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
220
232
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
221
233
|
: configs?.driver_tip_options?.value || []
|
|
234
|
+
const driverTipsField = !cartState.loading && cart && cart?.business_id && options.type === 1 && cart?.status !== 2 && (guestCheckoutDriveTip?.enabled) && driverTipsOptions.length > 0
|
|
222
235
|
|
|
223
236
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
224
237
|
|
|
@@ -239,7 +252,7 @@ const CheckoutUI = (props: any) => {
|
|
|
239
252
|
}
|
|
240
253
|
}
|
|
241
254
|
|
|
242
|
-
const vibrateApp = (impact?:
|
|
255
|
+
const vibrateApp = (impact?: HapticFeedbackTypes) => {
|
|
243
256
|
const options = {
|
|
244
257
|
enableVibrateFallback: true,
|
|
245
258
|
ignoreAndroidSystemSettings: false
|
|
@@ -266,7 +279,7 @@ const CheckoutUI = (props: any) => {
|
|
|
266
279
|
return
|
|
267
280
|
}
|
|
268
281
|
|
|
269
|
-
if (!userErrors.length && (!requiredFields?.length
|
|
282
|
+
if (!userErrors.length && (!requiredFields?.length) || forcePlace) {
|
|
270
283
|
vibrateApp()
|
|
271
284
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
|
|
272
285
|
return
|
|
@@ -305,35 +318,55 @@ const CheckoutUI = (props: any) => {
|
|
|
305
318
|
|
|
306
319
|
const checkValidationFields = () => {
|
|
307
320
|
setUserErrors([])
|
|
308
|
-
const errors = []
|
|
309
|
-
const
|
|
310
|
-
const _requiredFields:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
321
|
+
const errors: Array<string> = []
|
|
322
|
+
const userSelected = user
|
|
323
|
+
const _requiredFields: Array<string> = []
|
|
324
|
+
Object.values(checkoutFieldsState?.fields).map((field: any) => {
|
|
325
|
+
if (options?.type === field?.order_type_id &&
|
|
326
|
+
field?.enabled &&
|
|
327
|
+
field?.required &&
|
|
328
|
+
!notFields.includes(field?.validation_field?.code)
|
|
329
|
+
) {
|
|
330
|
+
if (userSelected && !userSelected[field?.validation_field?.code]) {
|
|
331
|
+
_requiredFields.push(field?.validation_field?.code)
|
|
316
332
|
}
|
|
317
333
|
}
|
|
318
334
|
})
|
|
319
|
-
|
|
335
|
+
const mobilePhoneField: any = Object.values(checkoutFieldsState?.fields)?.find((field: any) => field?.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
|
|
320
336
|
if (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
337
|
+
userSelected &&
|
|
338
|
+
!userSelected?.cellphone &&
|
|
339
|
+
((mobilePhoneField?.enabled &&
|
|
340
|
+
mobilePhoneField?.required) ||
|
|
324
341
|
configs?.verification_phone_required?.value === '1')
|
|
325
342
|
) {
|
|
326
343
|
_requiredFields.push('cellphone')
|
|
327
344
|
}
|
|
328
345
|
setRequiredFields(_requiredFields)
|
|
329
346
|
|
|
330
|
-
if (phoneUpdate) {
|
|
331
|
-
errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
|
|
332
|
-
}
|
|
333
|
-
|
|
334
347
|
setUserErrors(errors)
|
|
335
348
|
}
|
|
336
349
|
|
|
350
|
+
const checkGuestValidationFields = () => {
|
|
351
|
+
const userSelected = user
|
|
352
|
+
const _requiredFields = checkoutFieldsState?.fields
|
|
353
|
+
.filter((field) => (field?.order_type_id === options?.type) && field?.enabled && field?.required_with_guest &&
|
|
354
|
+
!notFields.includes(field?.validation_field?.code) &&
|
|
355
|
+
userSelected && !userSelected[field?.validation_field?.code])
|
|
356
|
+
const requiredFieldsCode = _requiredFields.map((item) => item?.validation_field?.code)
|
|
357
|
+
const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
|
|
358
|
+
if (
|
|
359
|
+
userSelected &&
|
|
360
|
+
!userSelected?.cellphone &&
|
|
361
|
+
((guestCheckoutCellPhone?.enabled &&
|
|
362
|
+
guestCheckoutCellPhone?.required_with_guest) ||
|
|
363
|
+
configs?.verification_phone_required?.value === '1')
|
|
364
|
+
) {
|
|
365
|
+
requiredFieldsCode.push('cellphone')
|
|
366
|
+
}
|
|
367
|
+
setRequiredFields(requiredFieldsCode)
|
|
368
|
+
}
|
|
369
|
+
|
|
337
370
|
const togglePhoneUpdate = (val: boolean) => {
|
|
338
371
|
setPhoneUpdate(val)
|
|
339
372
|
}
|
|
@@ -342,11 +375,20 @@ const CheckoutUI = (props: any) => {
|
|
|
342
375
|
setShowTitle(contentOffset.y > 30)
|
|
343
376
|
}
|
|
344
377
|
|
|
378
|
+
const handleRedirect = () => {
|
|
379
|
+
props.fromProductsList
|
|
380
|
+
? navigation?.goBack()
|
|
381
|
+
: onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)
|
|
382
|
+
}
|
|
383
|
+
|
|
345
384
|
useEffect(() => {
|
|
346
|
-
if (
|
|
385
|
+
if (checkoutFieldsState?.loading || userLoading) return
|
|
386
|
+
if (user?.guest_id) {
|
|
387
|
+
checkGuestValidationFields()
|
|
388
|
+
} else {
|
|
347
389
|
checkValidationFields()
|
|
348
390
|
}
|
|
349
|
-
}, [
|
|
391
|
+
}, [checkoutFieldsState, user, options?.type])
|
|
350
392
|
|
|
351
393
|
useEffect(() => {
|
|
352
394
|
if (errors) {
|
|
@@ -413,6 +455,7 @@ const CheckoutUI = (props: any) => {
|
|
|
413
455
|
}, [])
|
|
414
456
|
|
|
415
457
|
useEffect(() => {
|
|
458
|
+
if (!isFocused) return
|
|
416
459
|
if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
|
|
417
460
|
const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
|
|
418
461
|
if (error) {
|
|
@@ -420,7 +463,7 @@ const CheckoutUI = (props: any) => {
|
|
|
420
463
|
navigation.navigate('BusinessList')
|
|
421
464
|
}
|
|
422
465
|
}
|
|
423
|
-
}, [cartState?.error, cartState?.cart, cartState?.loading])
|
|
466
|
+
}, [cartState?.error, cartState?.cart, cartState?.loading, isFocused])
|
|
424
467
|
|
|
425
468
|
useEffect(() => {
|
|
426
469
|
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
@@ -451,7 +494,7 @@ const CheckoutUI = (props: any) => {
|
|
|
451
494
|
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
452
495
|
<View style={styles.wrapperNavbar}>
|
|
453
496
|
<TopHeader>
|
|
454
|
-
<TopActions onPress={() =>
|
|
497
|
+
<TopActions onPress={() => handleRedirect()}>
|
|
455
498
|
<IconAntDesign
|
|
456
499
|
name='arrowleft'
|
|
457
500
|
size={26}
|
|
@@ -471,13 +514,13 @@ const CheckoutUI = (props: any) => {
|
|
|
471
514
|
</TopHeader>
|
|
472
515
|
</View>
|
|
473
516
|
</SafeAreaView>
|
|
474
|
-
<Container pt={0} forwardRef={containerRef} noPadding onScroll={handleScroll}>
|
|
517
|
+
<Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
|
|
475
518
|
<View style={styles.wrapperNavbar}>
|
|
476
519
|
<NavBar
|
|
477
520
|
hideArrowLeft
|
|
478
521
|
title={t('CHECKOUT', 'Checkout')}
|
|
479
522
|
titleAlign={'center'}
|
|
480
|
-
onActionLeft={() =>
|
|
523
|
+
onActionLeft={() => handleRedirect()}
|
|
481
524
|
showCall={false}
|
|
482
525
|
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
483
526
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
@@ -614,15 +657,11 @@ const CheckoutUI = (props: any) => {
|
|
|
614
657
|
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
615
658
|
<OButton
|
|
616
659
|
text={t('SIGN_UP', 'Sign up')}
|
|
617
|
-
textStyle={{ color: theme.colors.white }}
|
|
618
660
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
619
661
|
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
620
662
|
/>
|
|
621
663
|
<OButton
|
|
622
664
|
text={t('LOGIN', 'Login')}
|
|
623
|
-
textStyle={{ color: theme.colors.primary }}
|
|
624
|
-
bgColor={theme.colors.white}
|
|
625
|
-
borderColor={theme.colors.primary}
|
|
626
665
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
627
666
|
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
628
667
|
/>
|
|
@@ -647,6 +686,9 @@ const CheckoutUI = (props: any) => {
|
|
|
647
686
|
isCheckout
|
|
648
687
|
phoneUpdate={phoneUpdate}
|
|
649
688
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
689
|
+
isOrderTypeValidationField
|
|
690
|
+
requiredFields={requiredFields}
|
|
691
|
+
checkoutFields={checkoutFields}
|
|
650
692
|
/>
|
|
651
693
|
)
|
|
652
694
|
)}
|
|
@@ -744,6 +786,7 @@ const CheckoutUI = (props: any) => {
|
|
|
744
786
|
</Placeholder>
|
|
745
787
|
) : (
|
|
746
788
|
<AddressDetails
|
|
789
|
+
cart={cart}
|
|
747
790
|
navigation={navigation}
|
|
748
791
|
location={options?.address?.location}
|
|
749
792
|
businessLogo={businessDetails?.business?.logo}
|
|
@@ -759,14 +802,7 @@ const CheckoutUI = (props: any) => {
|
|
|
759
802
|
</ChSection>
|
|
760
803
|
)}
|
|
761
804
|
|
|
762
|
-
{
|
|
763
|
-
cart &&
|
|
764
|
-
cart?.valid &&
|
|
765
|
-
options.type === 1 &&
|
|
766
|
-
cart?.status !== 2 &&
|
|
767
|
-
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
768
|
-
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
769
|
-
!isGiftCardCart &&
|
|
805
|
+
{driverTipsField &&
|
|
770
806
|
(
|
|
771
807
|
<ChSection>
|
|
772
808
|
<ChDriverTips>
|
|
@@ -814,6 +850,8 @@ const CheckoutUI = (props: any) => {
|
|
|
814
850
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
815
851
|
handlePlaceOrder={handlePlaceOrder}
|
|
816
852
|
merchantId={merchantId}
|
|
853
|
+
urlscheme={urlscheme}
|
|
854
|
+
androidAppId={androidAppId}
|
|
817
855
|
setMethodPaySupported={setMethodPaySupported}
|
|
818
856
|
methodPaySupported={methodPaySupported}
|
|
819
857
|
placeByMethodPay={placeByMethodPay}
|
|
@@ -909,6 +947,8 @@ const CheckoutUI = (props: any) => {
|
|
|
909
947
|
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
910
948
|
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
911
949
|
}
|
|
950
|
+
hideCommentsByValidationCheckout={!guestCheckoutComment?.enabled}
|
|
951
|
+
hideCouponByValidationCheckout={!guestCheckoutCoupon?.enabled}
|
|
912
952
|
/>
|
|
913
953
|
</>
|
|
914
954
|
)}
|
|
@@ -955,10 +995,8 @@ const CheckoutUI = (props: any) => {
|
|
|
955
995
|
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
956
996
|
</OText>
|
|
957
997
|
)}
|
|
958
|
-
{
|
|
959
|
-
|
|
960
|
-
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
961
|
-
(Number(cart?.driver_tip) <= 0) && (
|
|
998
|
+
{validateDriverTipField && !isGiftCardCart &&
|
|
999
|
+
(
|
|
962
1000
|
<OText
|
|
963
1001
|
color={theme.colors.error}
|
|
964
1002
|
size={12}
|
|
@@ -966,7 +1004,6 @@ const CheckoutUI = (props: any) => {
|
|
|
966
1004
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
967
1005
|
</OText>
|
|
968
1006
|
)}
|
|
969
|
-
|
|
970
1007
|
{validateCommentsCartField && (
|
|
971
1008
|
<OText
|
|
972
1009
|
color={theme.colors.error}
|
|
@@ -984,6 +1021,15 @@ const CheckoutUI = (props: any) => {
|
|
|
984
1021
|
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
985
1022
|
</OText>
|
|
986
1023
|
)}
|
|
1024
|
+
{validateCouponField &&
|
|
1025
|
+
(
|
|
1026
|
+
<OText
|
|
1027
|
+
color={theme.colors.error}
|
|
1028
|
+
size={12}
|
|
1029
|
+
>
|
|
1030
|
+
{t('WARNING_INVALID_COUPON_FIELD', 'Coupon is required.')}
|
|
1031
|
+
</OText>
|
|
1032
|
+
)}
|
|
987
1033
|
</ChErrors>
|
|
988
1034
|
</View>
|
|
989
1035
|
)}
|
|
@@ -1007,14 +1053,16 @@ const CheckoutUI = (props: any) => {
|
|
|
1007
1053
|
isUserDetailsEdit
|
|
1008
1054
|
cartStatus={cart?.status}
|
|
1009
1055
|
businessId={cart?.business_id}
|
|
1010
|
-
useValidationFields
|
|
1011
1056
|
useDefualtSessionManager
|
|
1012
1057
|
useSessionUser
|
|
1013
1058
|
isCheckout
|
|
1014
1059
|
isEdit
|
|
1015
1060
|
phoneUpdate={phoneUpdate}
|
|
1016
1061
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
1062
|
+
isOrderTypeValidationField
|
|
1017
1063
|
requiredFields={requiredFields}
|
|
1064
|
+
checkoutFields={checkoutFields}
|
|
1065
|
+
isCheckoutPlace
|
|
1018
1066
|
hideUpdateButton
|
|
1019
1067
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
1020
1068
|
onClose={() => {
|
|
@@ -69,10 +69,7 @@ export const CitiesControl = (props: any) => {
|
|
|
69
69
|
</View>
|
|
70
70
|
<OButton
|
|
71
71
|
text={t('CONTINUE', 'Continue')}
|
|
72
|
-
bgColor={theme.colors.primary}
|
|
73
|
-
borderColor={theme.colors.primary}
|
|
74
72
|
style={styles.btnStyle}
|
|
75
|
-
textStyle={{ color: 'white' }}
|
|
76
73
|
onClick={() => handleClick()}
|
|
77
74
|
/>
|
|
78
75
|
</Container>
|
|
@@ -102,9 +102,7 @@ const CouponControlUI = (props: any) => {
|
|
|
102
102
|
/>
|
|
103
103
|
<OButton
|
|
104
104
|
onClick={() => onButtonApplyClick()}
|
|
105
|
-
|
|
106
|
-
borderColor={theme.colors.primary}
|
|
107
|
-
textStyle={{ color: 'white', fontSize: 12 }}
|
|
105
|
+
textStyle={{ fontSize: 12 }}
|
|
108
106
|
imgRightSrc={null}
|
|
109
107
|
text={t('APPLY', 'Apply')}
|
|
110
108
|
isDisabled={!couponInput}
|
|
@@ -125,9 +125,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
125
125
|
/>
|
|
126
126
|
<OButton
|
|
127
127
|
text={t('APPLY_TIP', 'Apply Tip')}
|
|
128
|
-
|
|
129
|
-
borderColor={theme.colors.primary}
|
|
130
|
-
textStyle={{ color: 'white', fontSize: 14 }}
|
|
128
|
+
textStyle={{ fontSize: 14 }}
|
|
131
129
|
imgRightSrc={null}
|
|
132
130
|
style={{ borderRadius: 5, height: 44 }}
|
|
133
131
|
isDisabled={parseFloat(value || '0') < 0 || parseFloat(value || '0') === driverTip || value === ''}
|
|
@@ -14,8 +14,7 @@ import {
|
|
|
14
14
|
|
|
15
15
|
export const Favorite = (props: any) => {
|
|
16
16
|
const {
|
|
17
|
-
navigation
|
|
18
|
-
franchiseId
|
|
17
|
+
navigation
|
|
19
18
|
} = props
|
|
20
19
|
const [, t] = useLanguage()
|
|
21
20
|
const theme = useTheme()
|
|
@@ -72,7 +71,6 @@ export const Favorite = (props: any) => {
|
|
|
72
71
|
originalURL='business'
|
|
73
72
|
location={`${orderState.options?.address?.location?.lat},${orderState.options?.address?.location?.lng}`}
|
|
74
73
|
propsToFetch={['id', 'name', 'header', 'logo', 'location', 'address', 'ribbon', 'timezone', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug']}
|
|
75
|
-
franchiseId={franchiseId}
|
|
76
74
|
/>
|
|
77
75
|
)}
|
|
78
76
|
{tabSelected === 'products' && (
|
|
@@ -81,7 +79,6 @@ export const Favorite = (props: any) => {
|
|
|
81
79
|
originalURL='products'
|
|
82
80
|
onNavigationRedirect={onRedirect}
|
|
83
81
|
isProduct
|
|
84
|
-
franchiseId={franchiseId}
|
|
85
82
|
/>
|
|
86
83
|
)}
|
|
87
84
|
{tabSelected === 'orders' && (
|
|
@@ -90,7 +87,6 @@ export const Favorite = (props: any) => {
|
|
|
90
87
|
favoriteURL='favorite_orders'
|
|
91
88
|
originalURL='orders'
|
|
92
89
|
isOrder
|
|
93
|
-
franchiseId={franchiseId}
|
|
94
90
|
/>
|
|
95
91
|
)}
|
|
96
92
|
</Container>
|
|
@@ -270,7 +270,6 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
270
270
|
onClick={() => getFavoriteList(pagination?.currentPage + 1)}
|
|
271
271
|
text={t('LOAD_MORE_ITEMS', 'Load more items')}
|
|
272
272
|
imgRightSrc={null}
|
|
273
|
-
textStyle={{ color: theme.colors.white }}
|
|
274
273
|
style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
|
|
275
274
|
/>
|
|
276
275
|
</WrappButton>
|