ordering-ui-react-native 0.16.86-release → 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 +1 -1
- package/themes/business/src/components/LoginForm/index.tsx +3 -0
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -4
- package/themes/original/src/components/Checkout/index.tsx +227 -109
- package/themes/original/src/components/LoginForm/index.tsx +16 -12
- package/themes/original/src/components/MultiCheckout/index.tsx +14 -2
- package/themes/original/src/components/OrderDetails/index.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +50 -15
- package/themes/original/src/components/SignupForm/index.tsx +1 -1
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -1
- package/themes/original/src/types/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -476,6 +476,8 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
476
476
|
borderRadius: 7.6,
|
|
477
477
|
borderColor: theme.colors.inputSignup,
|
|
478
478
|
backgroundColor: theme.colors.transparent,
|
|
479
|
+
minHeight: 50,
|
|
480
|
+
maxHeight : 50
|
|
479
481
|
},
|
|
480
482
|
btn: {
|
|
481
483
|
borderRadius: 7.6,
|
|
@@ -941,3 +943,4 @@ export const LoginForm = (props: any) => {
|
|
|
941
943
|
|
|
942
944
|
return <LoginFormController {...loginProps} />;
|
|
943
945
|
};
|
|
946
|
+
|
|
@@ -44,13 +44,10 @@ export const WrapBusinessInfo = styled.TouchableOpacity`
|
|
|
44
44
|
|
|
45
45
|
export const TitleWrapper = styled.View`
|
|
46
46
|
width: 100%;
|
|
47
|
-
flex-direction:
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: space-between;
|
|
47
|
+
flex-direction: column;
|
|
50
48
|
`
|
|
51
49
|
|
|
52
50
|
export const RibbonBox = styled.View`
|
|
53
|
-
margin-left: 5px;
|
|
54
51
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
55
52
|
padding: 2px 8px;
|
|
56
53
|
max-width: 180px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, Vibration } 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,
|
|
@@ -88,7 +91,8 @@ const CheckoutUI = (props: any) => {
|
|
|
88
91
|
handleChangeDeliveryOption,
|
|
89
92
|
currency,
|
|
90
93
|
merchantId,
|
|
91
|
-
setPlaceSpotNumber
|
|
94
|
+
setPlaceSpotNumber,
|
|
95
|
+
maxDate
|
|
92
96
|
} = props
|
|
93
97
|
|
|
94
98
|
const theme = useTheme();
|
|
@@ -128,7 +132,7 @@ const CheckoutUI = (props: any) => {
|
|
|
128
132
|
|
|
129
133
|
const [, { showToast }] = useToast();
|
|
130
134
|
const [, t] = useLanguage();
|
|
131
|
-
const [{ user, token }] = useSession();
|
|
135
|
+
const [{ user, token }, { login }] = useSession();
|
|
132
136
|
const [ordering] = useApi()
|
|
133
137
|
const [{ configs }] = useConfig();
|
|
134
138
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
@@ -145,15 +149,22 @@ const CheckoutUI = (props: any) => {
|
|
|
145
149
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
146
150
|
const [isOpen, setIsOpen] = useState(false)
|
|
147
151
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
152
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false })
|
|
153
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
148
154
|
|
|
149
155
|
const placeSpotTypes = [3, 4, 5]
|
|
150
156
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
157
|
+
const isGiftCardCart = !cart?.business_id
|
|
151
158
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
152
159
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
153
160
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
154
161
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
155
162
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
156
|
-
|
|
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
|
|
157
168
|
|
|
158
169
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
159
170
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
@@ -188,8 +199,20 @@ const CheckoutUI = (props: any) => {
|
|
|
188
199
|
}
|
|
189
200
|
}
|
|
190
201
|
|
|
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
|
+
|
|
191
214
|
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
192
|
-
if (!userErrors.length && !requiredFields?.length || forcePlace) {
|
|
215
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
193
216
|
Vibration.vibrate()
|
|
194
217
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
195
218
|
return
|
|
@@ -276,7 +299,11 @@ const CheckoutUI = (props: any) => {
|
|
|
276
299
|
|
|
277
300
|
useEffect(() => {
|
|
278
301
|
if (cart?.products?.length === 0) {
|
|
279
|
-
|
|
302
|
+
if (cart?.business?.slug) {
|
|
303
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
304
|
+
} else {
|
|
305
|
+
onNavigationRedirect('Wallets')
|
|
306
|
+
}
|
|
280
307
|
}
|
|
281
308
|
}, [cart?.products])
|
|
282
309
|
|
|
@@ -353,82 +380,116 @@ const CheckoutUI = (props: any) => {
|
|
|
353
380
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
354
381
|
</ChSection>
|
|
355
382
|
|
|
356
|
-
|
|
357
|
-
<
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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 ? (
|
|
362
439
|
<Placeholder Animation={Fade}>
|
|
363
440
|
<PlaceholderLine height={20} />
|
|
364
441
|
<PlaceholderLine height={12} />
|
|
365
442
|
<PlaceholderLine height={12} />
|
|
366
443
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
367
444
|
</Placeholder>
|
|
368
|
-
)
|
|
369
|
-
|
|
370
|
-
!cartState.loading &&
|
|
371
|
-
businessDetails?.business &&
|
|
372
|
-
Object.values(businessDetails?.business).length > 0 &&
|
|
373
|
-
(
|
|
374
|
-
<>
|
|
375
|
-
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
445
|
+
) : (
|
|
446
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
376
447
|
<View>
|
|
377
|
-
<
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
{
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
{
|
|
388
|
-
|
|
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
|
+
/>
|
|
389
471
|
</View>
|
|
390
|
-
|
|
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
|
+
)
|
|
391
486
|
)}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
397
|
-
/>
|
|
398
|
-
</View>
|
|
399
|
-
)}
|
|
400
|
-
</ChBusinessDetails>
|
|
401
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
402
|
-
</ChSection>
|
|
403
|
-
|
|
404
|
-
<ChSection>
|
|
405
|
-
<ChUserDetails>
|
|
406
|
-
{cartState.loading ? (
|
|
407
|
-
<Placeholder Animation={Fade}>
|
|
408
|
-
<PlaceholderLine height={20} />
|
|
409
|
-
<PlaceholderLine height={12} />
|
|
410
|
-
<PlaceholderLine height={12} />
|
|
411
|
-
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
412
|
-
</Placeholder>
|
|
413
|
-
) : (
|
|
414
|
-
<UserDetails
|
|
415
|
-
isUserDetailsEdit={isUserDetailsEdit}
|
|
416
|
-
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
417
|
-
cartStatus={cart?.status}
|
|
418
|
-
businessId={cart?.business_id}
|
|
419
|
-
useValidationFields
|
|
420
|
-
useDefualtSessionManager
|
|
421
|
-
useSessionUser
|
|
422
|
-
isCheckout
|
|
423
|
-
phoneUpdate={phoneUpdate}
|
|
424
|
-
togglePhoneUpdate={togglePhoneUpdate}
|
|
425
|
-
/>
|
|
426
|
-
)}
|
|
427
|
-
</ChUserDetails>
|
|
428
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
429
|
-
</ChSection>
|
|
487
|
+
</ChUserDetails>
|
|
488
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
489
|
+
</ChSection>
|
|
490
|
+
)}
|
|
430
491
|
|
|
431
|
-
{options?.type === 1 && (
|
|
492
|
+
{options?.type === 1 && !isGiftCardCart && (
|
|
432
493
|
<DeliveryOptionsContainer>
|
|
433
494
|
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
434
495
|
<View style={{ height: 110 }}>
|
|
@@ -507,28 +568,30 @@ const CheckoutUI = (props: any) => {
|
|
|
507
568
|
</ChSection>
|
|
508
569
|
)}
|
|
509
570
|
|
|
510
|
-
|
|
511
|
-
<
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
<
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
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
|
+
)}
|
|
532
595
|
|
|
533
596
|
{!cartState.loading &&
|
|
534
597
|
cart &&
|
|
@@ -537,6 +600,7 @@ const CheckoutUI = (props: any) => {
|
|
|
537
600
|
cart?.status !== 2 &&
|
|
538
601
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
539
602
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
603
|
+
!isGiftCardCart &&
|
|
540
604
|
(
|
|
541
605
|
<ChSection>
|
|
542
606
|
<ChDriverTips>
|
|
@@ -573,8 +637,8 @@ const CheckoutUI = (props: any) => {
|
|
|
573
637
|
<PaymentOptions
|
|
574
638
|
cart={cart}
|
|
575
639
|
isDisabled={cart?.status === 2}
|
|
576
|
-
businessId={businessDetails?.business?.id}
|
|
577
|
-
isLoading={businessDetails.loading}
|
|
640
|
+
businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
|
|
641
|
+
isLoading={!isGiftCardCart ? businessDetails.loading : false}
|
|
578
642
|
paymethods={businessDetails?.business?.paymethods}
|
|
579
643
|
onPaymentChange={handlePaymethodChange}
|
|
580
644
|
errorCash={errorCash}
|
|
@@ -593,6 +657,7 @@ const CheckoutUI = (props: any) => {
|
|
|
593
657
|
<WalletPaymentOptionContainer>
|
|
594
658
|
<PaymentOptionWallet
|
|
595
659
|
cart={cart}
|
|
660
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
596
661
|
businessId={cart?.business_id}
|
|
597
662
|
businessConfigs={businessDetails?.business?.configs}
|
|
598
663
|
/>
|
|
@@ -600,7 +665,7 @@ const CheckoutUI = (props: any) => {
|
|
|
600
665
|
)}
|
|
601
666
|
|
|
602
667
|
|
|
603
|
-
{!cartState.loading && placeSpotsEnabled && (
|
|
668
|
+
{!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
|
|
604
669
|
<>
|
|
605
670
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
|
|
606
671
|
<PlaceSpot
|
|
@@ -627,18 +692,20 @@ const CheckoutUI = (props: any) => {
|
|
|
627
692
|
<>
|
|
628
693
|
<CartHeader>
|
|
629
694
|
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
<OText
|
|
634
|
-
size={12}
|
|
635
|
-
lineHeight={15}
|
|
636
|
-
color={theme.colors.primary}
|
|
637
|
-
style={{ textDecorationLine: 'underline' }}
|
|
695
|
+
{!isGiftCardCart && (
|
|
696
|
+
<TouchableOpacity
|
|
697
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
638
698
|
>
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
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
|
+
)}
|
|
642
709
|
</CartHeader>
|
|
643
710
|
{isBusinessChangeEnabled && (
|
|
644
711
|
<TouchableOpacity
|
|
@@ -660,6 +727,9 @@ const CheckoutUI = (props: any) => {
|
|
|
660
727
|
isCartPending={cart?.status === 2}
|
|
661
728
|
onNavigationRedirect={onNavigationRedirect}
|
|
662
729
|
placeSpotTypes={placeSpotTypes}
|
|
730
|
+
businessConfigs={businessConfigs}
|
|
731
|
+
maxDate={maxDate}
|
|
732
|
+
loyaltyRewardRate={loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')?.accumulation_rate ?? 0}
|
|
663
733
|
/>
|
|
664
734
|
</>
|
|
665
735
|
)}
|
|
@@ -696,6 +766,14 @@ const CheckoutUI = (props: any) => {
|
|
|
696
766
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
697
767
|
</OText>
|
|
698
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
|
+
)}
|
|
699
777
|
{options.type === 1 &&
|
|
700
778
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
701
779
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -748,6 +826,33 @@ const CheckoutUI = (props: any) => {
|
|
|
748
826
|
/>
|
|
749
827
|
</View>
|
|
750
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>
|
|
751
856
|
</ChContainer>
|
|
752
857
|
</Container>
|
|
753
858
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
@@ -782,6 +887,19 @@ const CheckoutUI = (props: any) => {
|
|
|
782
887
|
setShowGateway={setShowGateway}
|
|
783
888
|
/>
|
|
784
889
|
)}
|
|
890
|
+
{webviewPaymethod?.gateway === 'square' && showGateway.open && (
|
|
891
|
+
<PaymentOptionsWebView
|
|
892
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
893
|
+
uri={`https://test-square-f50f7.web.app`}
|
|
894
|
+
user={user}
|
|
895
|
+
token={token}
|
|
896
|
+
cart={cart}
|
|
897
|
+
currency={currency}
|
|
898
|
+
webviewPaymethod={webviewPaymethod}
|
|
899
|
+
setShowGateway={setShowGateway}
|
|
900
|
+
locationId={'L1NGAY5M6KJRX'}
|
|
901
|
+
/>
|
|
902
|
+
)}
|
|
785
903
|
</>
|
|
786
904
|
)
|
|
787
905
|
}
|
|
@@ -72,6 +72,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
72
72
|
generateOtpCode,
|
|
73
73
|
useLoginOtpEmail,
|
|
74
74
|
useLoginOtpCellphone,
|
|
75
|
+
isGuest
|
|
75
76
|
} = props;
|
|
76
77
|
|
|
77
78
|
const [, { showToast }] = useToast();
|
|
@@ -221,7 +222,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
221
222
|
};
|
|
222
223
|
|
|
223
224
|
const handleChangeInputEmail = (value: string, onChange: any) => {
|
|
224
|
-
onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
|
|
225
|
+
onChange(value.toLowerCase().trim().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
|
|
225
226
|
};
|
|
226
227
|
|
|
227
228
|
const handleOpenRecaptcha = () => {
|
|
@@ -378,16 +379,19 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
378
379
|
|
|
379
380
|
return (
|
|
380
381
|
<Container>
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
382
|
+
{isGuest ? (
|
|
383
|
+
<OText style={{ textAlign: 'center', marginBottom: 10 }} size={18}>{t('LOGIN', 'Login')}</OText>
|
|
384
|
+
) : (
|
|
385
|
+
<NavBar
|
|
386
|
+
title={t('LOGIN', 'Login')}
|
|
387
|
+
titleAlign={'center'}
|
|
388
|
+
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
389
|
+
showCall={false}
|
|
390
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
391
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
392
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
393
|
+
/>
|
|
394
|
+
)}
|
|
391
395
|
<FormSide>
|
|
392
396
|
{(Number(useLoginByEmail) + Number(useLoginByCellphone) + Number(useLoginOtpEmail) + Number(useLoginOtpCellphone) > 1) && (
|
|
393
397
|
<LoginWith>
|
|
@@ -734,7 +738,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
734
738
|
{configs && Object.keys(configs).length > 0 ? (
|
|
735
739
|
(((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value && facebookLoginEnabled) ||
|
|
736
740
|
((configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled) ||
|
|
737
|
-
((configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled)) &&
|
|
741
|
+
((configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled)) && !isGuest &&
|
|
738
742
|
(
|
|
739
743
|
<>
|
|
740
744
|
<View
|
|
@@ -60,6 +60,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
60
60
|
handleSelectWallet,
|
|
61
61
|
handlePaymethodDataChange,
|
|
62
62
|
cartUuid,
|
|
63
|
+
rewardRate,
|
|
63
64
|
totalCartsFee,
|
|
64
65
|
cartGroup
|
|
65
66
|
} = props
|
|
@@ -90,6 +91,8 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
90
91
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
91
92
|
: configs?.driver_tip_options?.value || []
|
|
92
93
|
|
|
94
|
+
const loyaltyRewardValue = Math.round(openCarts.reduce((sum: any, cart: any) => sum + cart?.subtotal, 0) / rewardRate)
|
|
95
|
+
|
|
93
96
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
94
97
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
95
98
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -307,7 +310,9 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
307
310
|
onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
|
|
308
311
|
businessConfigs={cart?.business?.configs}
|
|
309
312
|
/>
|
|
310
|
-
|
|
313
|
+
{openCarts.length > 1 && (
|
|
314
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
315
|
+
)}
|
|
311
316
|
</React.Fragment>
|
|
312
317
|
))}
|
|
313
318
|
{!cartGroup?.loading && openCarts.length === 0 && (
|
|
@@ -322,7 +327,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
322
327
|
{t('WARNING_PARTIAL_WALLET_CARTS', 'Important: One or more carts can`t be completed due a partial payment with cash/points wallet and requires to be paid individually')}
|
|
323
328
|
</OText>
|
|
324
329
|
)}
|
|
325
|
-
{openCarts.length >
|
|
330
|
+
{openCarts.length > 1 && (
|
|
326
331
|
<ChCartsTotal>
|
|
327
332
|
{totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
328
333
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
@@ -349,6 +354,13 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
349
354
|
</OText>
|
|
350
355
|
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
351
356
|
</View>
|
|
357
|
+
{!!loyaltyRewardValue && isFinite(loyaltyRewardValue) && (
|
|
358
|
+
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'flex-end' }}>
|
|
359
|
+
<OText size={12} color={theme.colors.textNormal}>
|
|
360
|
+
{t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue)}
|
|
361
|
+
</OText>
|
|
362
|
+
</View>
|
|
363
|
+
)}
|
|
352
364
|
<OText size={12} color={theme.colors.mediumGray} mRight={70} style={{ marginTop: 10 }}>
|
|
353
365
|
{t('MULTI_CHECKOUT_DESCRIPTION', 'You will receive a receipt for each business. The payment is not combined between multiple stores. Each payment is processed by the store')}
|
|
354
366
|
</OText>
|
|
@@ -975,7 +975,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
975
975
|
<OText>
|
|
976
976
|
{event?.wallet_event
|
|
977
977
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
978
|
-
: event?.paymethod?.name}
|
|
978
|
+
: t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
|
|
979
979
|
</OText>
|
|
980
980
|
{event?.data?.charge_id && (
|
|
981
981
|
<OText>
|
|
@@ -26,6 +26,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
|
26
26
|
import { TaxInformation } from '../TaxInformation';
|
|
27
27
|
import { TouchableOpacity } from 'react-native';
|
|
28
28
|
import { OAlert } from '../../../../../src/components/shared'
|
|
29
|
+
import { MomentOption } from '../MomentOption';
|
|
29
30
|
|
|
30
31
|
const OrderSummaryUI = (props: any) => {
|
|
31
32
|
const {
|
|
@@ -38,7 +39,15 @@ const OrderSummaryUI = (props: any) => {
|
|
|
38
39
|
commentState,
|
|
39
40
|
handleChangeComment,
|
|
40
41
|
onNavigationRedirect,
|
|
41
|
-
handleRemoveOfferClick
|
|
42
|
+
handleRemoveOfferClick,
|
|
43
|
+
preorderSlotInterval,
|
|
44
|
+
preorderLeadTime,
|
|
45
|
+
preorderTimeRange,
|
|
46
|
+
preorderMaximumDays,
|
|
47
|
+
preorderMinimumDays,
|
|
48
|
+
cateringTypes,
|
|
49
|
+
loyaltyRewardRate,
|
|
50
|
+
maxDate
|
|
42
51
|
} = props;
|
|
43
52
|
|
|
44
53
|
const theme = useTheme()
|
|
@@ -51,6 +60,18 @@ const OrderSummaryUI = (props: any) => {
|
|
|
51
60
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
52
61
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
53
62
|
|
|
63
|
+
const cart = orderState?.carts?.[`businessId:${props.cart.business_id}`]
|
|
64
|
+
const loyaltyRewardValue = Math.round(cart?.subtotal / loyaltyRewardRate)
|
|
65
|
+
|
|
66
|
+
const walletName: any = {
|
|
67
|
+
cash: {
|
|
68
|
+
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
69
|
+
},
|
|
70
|
+
credit_point: {
|
|
71
|
+
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
54
75
|
const handleDeleteClick = (product: any) => {
|
|
55
76
|
removeProduct(product, cart)
|
|
56
77
|
}
|
|
@@ -93,17 +114,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
93
114
|
})
|
|
94
115
|
}
|
|
95
116
|
|
|
96
|
-
const cart = orderState?.carts?.[`businessId:${props.cart.business_id}`]
|
|
97
|
-
|
|
98
|
-
const walletName: any = {
|
|
99
|
-
cash: {
|
|
100
|
-
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
101
|
-
},
|
|
102
|
-
credit_point: {
|
|
103
|
-
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
117
|
return (
|
|
108
118
|
<OSContainer>
|
|
109
119
|
{cart?.products?.length > 0 && (
|
|
@@ -121,6 +131,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
121
131
|
onDeleteProduct={handleDeleteClick}
|
|
122
132
|
onEditProduct={handleEditProduct}
|
|
123
133
|
isFromCheckout={isFromCheckout}
|
|
134
|
+
isDisabledEdit={!cart?.business_id}
|
|
124
135
|
/>
|
|
125
136
|
))}
|
|
126
137
|
</OSProductList>
|
|
@@ -166,7 +177,9 @@ const OrderSummaryUI = (props: any) => {
|
|
|
166
177
|
</OSTable>
|
|
167
178
|
))
|
|
168
179
|
}
|
|
169
|
-
|
|
180
|
+
{cart?.business_id && (
|
|
181
|
+
<Divider />
|
|
182
|
+
)}
|
|
170
183
|
{cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
|
|
171
184
|
<OSTable>
|
|
172
185
|
<OText size={12} numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
@@ -279,7 +292,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
279
292
|
<OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
|
|
280
293
|
</OSTable>
|
|
281
294
|
))}
|
|
282
|
-
{isCouponEnabled && !isCartPending && (
|
|
295
|
+
{isCouponEnabled && !isCartPending && cart?.business_id && (
|
|
283
296
|
<View>
|
|
284
297
|
<View style={{ paddingVertical: 5 }}>
|
|
285
298
|
<CouponControl
|
|
@@ -299,9 +312,16 @@ const OrderSummaryUI = (props: any) => {
|
|
|
299
312
|
{parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
|
|
300
313
|
</OText>
|
|
301
314
|
</OSTable>
|
|
315
|
+
{!!loyaltyRewardValue && isFinite(loyaltyRewardValue) && (
|
|
316
|
+
<OSTable style={{ justifyContent: 'flex-end' }}>
|
|
317
|
+
<OText size={12} color={theme.colors.textNormal}>
|
|
318
|
+
{t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue)}
|
|
319
|
+
</OText>
|
|
320
|
+
</OSTable>
|
|
321
|
+
)}
|
|
302
322
|
</View>
|
|
303
323
|
)}
|
|
304
|
-
{cart?.status !== 2 && (
|
|
324
|
+
{cart?.business_id && cart?.status !== 2 && (
|
|
305
325
|
<OSTable>
|
|
306
326
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
307
327
|
<OText size={12}>{t('COMMENTS', 'Comments')}</OText>
|
|
@@ -336,6 +356,21 @@ const OrderSummaryUI = (props: any) => {
|
|
|
336
356
|
)}
|
|
337
357
|
</OSBill>
|
|
338
358
|
)}
|
|
359
|
+
{cateringTypes.includes(orderState?.options?.type) && maxDate && cart?.business && (
|
|
360
|
+
<View>
|
|
361
|
+
<MomentOption
|
|
362
|
+
maxDate={maxDate}
|
|
363
|
+
cateringPreorder
|
|
364
|
+
isCart
|
|
365
|
+
preorderSlotInterval={preorderSlotInterval}
|
|
366
|
+
preorderLeadTime={preorderLeadTime}
|
|
367
|
+
preorderTimeRange={preorderTimeRange}
|
|
368
|
+
preorderMaximumDays={preorderMaximumDays}
|
|
369
|
+
preorderMinimumDays={preorderMinimumDays}
|
|
370
|
+
business={cart?.business}
|
|
371
|
+
/>
|
|
372
|
+
</View>
|
|
373
|
+
)}
|
|
339
374
|
<OModal
|
|
340
375
|
open={openTaxModal.open}
|
|
341
376
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
@@ -591,7 +591,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
591
591
|
control={control}
|
|
592
592
|
render={({ onChange, value }: any) => (
|
|
593
593
|
<OInput
|
|
594
|
-
placeholder={t(field.name)}
|
|
594
|
+
placeholder={t(field.name?.replace(/\s/g, '_')?.toUpperCase(), field.name)}
|
|
595
595
|
style={style.inputStyle}
|
|
596
596
|
icon={
|
|
597
597
|
field.code === 'email'
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import styled, { useTheme } from 'styled-components/native';
|
|
14
14
|
import { OIcon } from './';
|
|
15
|
+
import { css } from 'styled-components';
|
|
15
16
|
|
|
16
17
|
const StyledButton = styled.View<Props>`
|
|
17
18
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
@@ -26,6 +27,9 @@ const StyledButton = styled.View<Props>`
|
|
|
26
27
|
padding-left: 20px;
|
|
27
28
|
padding-right: 20px;
|
|
28
29
|
position: relative;
|
|
30
|
+
${(props: any) => props?.theme?.general?.components?.buttons?.borderRadius && css`
|
|
31
|
+
border-radius: ${props?.theme?.general?.components?.buttons?.borderRadius}px;
|
|
32
|
+
`}
|
|
29
33
|
`
|
|
30
34
|
const StyledButtonDisabled = styled(StyledButton)`
|
|
31
35
|
background-color: ${(props: any) => props.theme.colors.disabled};
|
|
@@ -115,7 +119,7 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
115
119
|
style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
|
|
116
120
|
disabled={props.isDisabledWithSameStyles}
|
|
117
121
|
>
|
|
118
|
-
<StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor } : props.style}>
|
|
122
|
+
<StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius } : { ...props.style, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius }}>
|
|
119
123
|
{props.icon ? (
|
|
120
124
|
<props.icon {...props.iconProps} />
|
|
121
125
|
) : null}
|