ordering-ui-react-native 0.21.28 → 0.21.30
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/OrderDetails/OrderHeaderComponent.tsx +9 -7
- package/themes/original/src/components/Checkout/index.tsx +17 -5
- package/themes/original/src/components/OrderDetails/index.tsx +17 -22
- package/themes/original/src/components/OrderProgress/index.tsx +5 -3
- package/themes/original/src/components/PaymentOptions/index.tsx +21 -2
- package/themes/original/src/components/ProductForm/index.tsx +1 -1
- package/themes/original/src/utils/index.tsx +113 -0
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
package/package.json
CHANGED
|
@@ -275,12 +275,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
275
275
|
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
276
276
|
</OText>
|
|
277
277
|
)}
|
|
278
|
-
|
|
279
|
-
<
|
|
278
|
+
<OText>
|
|
279
|
+
<OText size={13} weight='bold'>
|
|
280
|
+
{`${t('PAYMENT_METHODS', 'Payment methods')}: `}
|
|
281
|
+
</OText>
|
|
282
|
+
{order?.payment_events?.length > 0 ? (
|
|
280
283
|
<OText size={13}>
|
|
281
|
-
<OText size={13} weight='bold'>
|
|
282
|
-
{`${t('PAYMENT_METHODS', 'Payment methods')}: `}
|
|
283
|
-
</OText>
|
|
284
284
|
{order?.payment_events?.map((event: any, idx: number) => {
|
|
285
285
|
return event?.wallet_event
|
|
286
286
|
? idx < order?.payment_events?.length - 1
|
|
@@ -291,8 +291,10 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
291
291
|
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
|
|
292
292
|
})}
|
|
293
293
|
</OText>
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
) : (
|
|
295
|
+
<OText size={13}>{t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}</OText>
|
|
296
|
+
)}
|
|
297
|
+
</OText>
|
|
296
298
|
</>
|
|
297
299
|
)}
|
|
298
300
|
</OrderHeader>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
2
|
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
|
+
import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
|
|
4
5
|
import Picker from 'react-native-country-picker-modal';
|
|
5
6
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
6
7
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
@@ -48,7 +49,6 @@ import {
|
|
|
48
49
|
CartHeader
|
|
49
50
|
} from './styles';
|
|
50
51
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
51
|
-
|
|
52
52
|
import { FloatingButton } from '../FloatingButton';
|
|
53
53
|
import { Container } from '../../layouts/Container';
|
|
54
54
|
import NavBar from '../NavBar';
|
|
@@ -162,9 +162,10 @@ const CheckoutUI = (props: any) => {
|
|
|
162
162
|
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
163
163
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
164
164
|
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
165
|
+
const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
|
|
165
166
|
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
166
167
|
const cardsMethods = ['credomatic']
|
|
167
|
-
|
|
168
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
168
169
|
const placeSpotTypes = [3, 4, 5]
|
|
169
170
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
170
171
|
const isGiftCardCart = !cart?.business_id
|
|
@@ -239,7 +240,7 @@ const CheckoutUI = (props: any) => {
|
|
|
239
240
|
token: user?.session?.access_token
|
|
240
241
|
})
|
|
241
242
|
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
242
|
-
|
|
243
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
const handleSuccessLogin = (user: any) => {
|
|
@@ -254,7 +255,7 @@ const CheckoutUI = (props: any) => {
|
|
|
254
255
|
|
|
255
256
|
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
256
257
|
vibrateApp()
|
|
257
|
-
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment)
|
|
258
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
|
|
258
259
|
return
|
|
259
260
|
}
|
|
260
261
|
if (requiredFields?.length) {
|
|
@@ -742,6 +743,10 @@ const CheckoutUI = (props: any) => {
|
|
|
742
743
|
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
743
744
|
cardList={cardList}
|
|
744
745
|
setCardList={setCardList}
|
|
746
|
+
requiredFields={requiredFields}
|
|
747
|
+
openUserModal={setIsOpen}
|
|
748
|
+
paymethodClicked={paymethodClicked}
|
|
749
|
+
setPaymethodClicked={setPaymethodClicked}
|
|
745
750
|
/>
|
|
746
751
|
</ChPaymethods>
|
|
747
752
|
</ChSection>
|
|
@@ -926,7 +931,14 @@ const CheckoutUI = (props: any) => {
|
|
|
926
931
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
927
932
|
onClose={() => {
|
|
928
933
|
setIsOpen(false)
|
|
929
|
-
|
|
934
|
+
if (paymethodClicked) {
|
|
935
|
+
setPaymethodClicked({
|
|
936
|
+
...paymethodClicked,
|
|
937
|
+
confirmed: true
|
|
938
|
+
})
|
|
939
|
+
} else {
|
|
940
|
+
handlePlaceOrder(null, true)
|
|
941
|
+
}
|
|
930
942
|
}}
|
|
931
943
|
setIsOpen={setIsOpen}
|
|
932
944
|
/>
|
|
@@ -42,7 +42,7 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
|
42
42
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
43
43
|
import { OrderDetailsParams } from '../../types';
|
|
44
44
|
import { GoogleMap } from '../GoogleMap';
|
|
45
|
-
import { verifyDecimals, getOrderStatus } from '../../utils';
|
|
45
|
+
import { verifyDecimals, getOrderStatus, getOrderStatuPickUp } from '../../utils';
|
|
46
46
|
import { OSRow } from '../OrderSummary/styles';
|
|
47
47
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
48
48
|
import { TaxInformation } from '../TaxInformation';
|
|
@@ -124,6 +124,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
124
124
|
const placeSpotTypes = [3, 4, 5]
|
|
125
125
|
const directionTypes = [2, 3, 4, 5]
|
|
126
126
|
const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
127
|
+
const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
|
|
127
128
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
128
129
|
const isGiftCardOrder = !order?.business_id
|
|
129
130
|
const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
|
|
@@ -345,6 +346,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
345
346
|
}
|
|
346
347
|
}, [props?.order?.error, props?.order?.loading])
|
|
347
348
|
|
|
349
|
+
const progressBarObjt = order?.delivery_type && props.order?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
|
|
350
|
+
|
|
348
351
|
return (
|
|
349
352
|
<OrderDetailsContainer
|
|
350
353
|
keyboardShouldPersistTaps="handled"
|
|
@@ -480,7 +483,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
480
483
|
<LinearGradient
|
|
481
484
|
start={{ x: 0.0, y: 0.0 }}
|
|
482
485
|
end={{
|
|
483
|
-
x:
|
|
486
|
+
x: progressBarObjt(order?.status)?.percentage || 0,
|
|
484
487
|
y: 0,
|
|
485
488
|
}}
|
|
486
489
|
locations={[0.9999, 0.9999]}
|
|
@@ -493,7 +496,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
493
496
|
lineHeight={24}
|
|
494
497
|
weight={'600'}
|
|
495
498
|
color={theme.colors.textNormal}>
|
|
496
|
-
{
|
|
499
|
+
{progressBarObjt(order?.status)?.value}
|
|
497
500
|
</OText>
|
|
498
501
|
</>
|
|
499
502
|
)}
|
|
@@ -791,25 +794,17 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
791
794
|
parentStyle={{ marginTop: 29, marginEnd: 15 }}
|
|
792
795
|
onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
|
|
793
796
|
/>
|
|
794
|
-
{(
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
806
|
-
imgRightSrc={null}
|
|
807
|
-
borderColor='transparent'
|
|
808
|
-
bgColor={theme.colors.primary + 10}
|
|
809
|
-
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
810
|
-
onClick={() => handleReorder && handleReorder(order.id)}
|
|
811
|
-
/>
|
|
812
|
-
)}
|
|
797
|
+
{(reorderStatus?.includes(parseInt(order?.status)) && order?.cart) && (
|
|
798
|
+
<OButton
|
|
799
|
+
text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
|
|
800
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
801
|
+
imgRightSrc={null}
|
|
802
|
+
borderColor='transparent'
|
|
803
|
+
bgColor={theme.colors.primary + 10}
|
|
804
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
805
|
+
onClick={() => handleReorder && handleReorder(order.id)}
|
|
806
|
+
/>
|
|
807
|
+
)}
|
|
813
808
|
</OrderAction>
|
|
814
809
|
</HeaderInfo>
|
|
815
810
|
<OrderProducts>
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
OrderInfoWrapper,
|
|
23
23
|
OrderProgressWrapper
|
|
24
24
|
} from './styles'
|
|
25
|
-
import { getOrderStatus } from '../../utils'
|
|
25
|
+
import { getOrderStatuPickUp, getOrderStatus } from '../../utils'
|
|
26
26
|
|
|
27
27
|
const OrderProgressUI = (props: any) => {
|
|
28
28
|
const {
|
|
@@ -110,6 +110,8 @@ const OrderProgressUI = (props: any) => {
|
|
|
110
110
|
setInitialLoaded(true)
|
|
111
111
|
}, [orderList.loading, initialLoaded])
|
|
112
112
|
|
|
113
|
+
const progressBarObjt = lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
|
|
114
|
+
|
|
113
115
|
return (
|
|
114
116
|
<>
|
|
115
117
|
{(orderList?.loading && !initialLoaded) && (
|
|
@@ -162,10 +164,10 @@ const OrderProgressUI = (props: any) => {
|
|
|
162
164
|
</OrderInfoWrapper>
|
|
163
165
|
<View style={{ flex: 1 }}>
|
|
164
166
|
<ProgressContentWrapper>
|
|
165
|
-
<ProgressBar style={{ width:
|
|
167
|
+
<ProgressBar style={{ width: progressBarObjt(lastOrder.status)?.percentage ? `${(progressBarObjt(lastOrder.status) as any).percentage * 100}%` : '0%' }} />
|
|
166
168
|
</ProgressContentWrapper>
|
|
167
169
|
<ProgressTextWrapper>
|
|
168
|
-
<OText size={12} style={{ width: '50%' }}>{
|
|
170
|
+
<OText size={12} style={{ width: '50%' }}>{progressBarObjt(lastOrder.status)?.value}</OText>
|
|
169
171
|
<TimeWrapper>
|
|
170
172
|
<OText size={11}>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}</OText>
|
|
171
173
|
<OText size={11}>
|
|
@@ -69,7 +69,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
69
69
|
methodPaySupported,
|
|
70
70
|
setPlaceByMethodPay,
|
|
71
71
|
setCardList,
|
|
72
|
-
onPaymentChange
|
|
72
|
+
onPaymentChange,
|
|
73
|
+
requiredFields,
|
|
74
|
+
openUserModal,
|
|
75
|
+
paymethodClicked,
|
|
76
|
+
setPaymethodClicked
|
|
73
77
|
} = props
|
|
74
78
|
|
|
75
79
|
const theme = useTheme();
|
|
@@ -115,6 +119,14 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
115
119
|
|
|
116
120
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
117
121
|
if (cart?.balance > 0) {
|
|
122
|
+
if (paymethod?.gateway === 'paypal' && requiredFields.length > 0) {
|
|
123
|
+
openUserModal && openUserModal(true)
|
|
124
|
+
setPaymethodClicked({
|
|
125
|
+
confirmed: false,
|
|
126
|
+
paymethod
|
|
127
|
+
})
|
|
128
|
+
return
|
|
129
|
+
}
|
|
118
130
|
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
119
131
|
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
120
132
|
handlePaymentMethodClickCustom(paymethod)
|
|
@@ -159,7 +171,14 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
159
171
|
handlePlaceOrder(confirmApplePayPayment)
|
|
160
172
|
}
|
|
161
173
|
}, [paymethodData, paymethodSelected])
|
|
162
|
-
|
|
174
|
+
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if (paymethodClicked?.confirmed) {
|
|
177
|
+
handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
|
|
178
|
+
}
|
|
179
|
+
}, [paymethodClicked?.confirmed])
|
|
180
|
+
|
|
181
|
+
|
|
163
182
|
const renderPaymethods = ({ item }: any) => {
|
|
164
183
|
return (
|
|
165
184
|
<>
|
|
@@ -575,6 +575,119 @@ export const getOrderStatus = (s: string) => {
|
|
|
575
575
|
return objectStatus && objectStatus;
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
+
export const getOrderStatuPickUp = (s: any) => {
|
|
579
|
+
const status = parseInt(s);
|
|
580
|
+
const orderStatus = [
|
|
581
|
+
{
|
|
582
|
+
key: 0,
|
|
583
|
+
value: t('PENDING', 'Pending'),
|
|
584
|
+
slug: 'PENDING',
|
|
585
|
+
percentage: 0.1,
|
|
586
|
+
image: theme.images.order.status0,
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
key: 1,
|
|
590
|
+
value: t('COMPLETED', 'Completed'),
|
|
591
|
+
slug: 'COMPLETED',
|
|
592
|
+
percentage: 1,
|
|
593
|
+
image: theme.images.order.status1,
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
key: 2,
|
|
597
|
+
value: t('REJECTED', 'Rejected'),
|
|
598
|
+
slug: 'REJECTED',
|
|
599
|
+
percentage: 0,
|
|
600
|
+
image: theme.images.order.status2,
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
key: 4,
|
|
604
|
+
value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
|
|
605
|
+
slug: 'PREPARATION_COMPLETED',
|
|
606
|
+
percentage: 0.5,
|
|
607
|
+
image: theme.images.order.status4,
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
key: 5,
|
|
611
|
+
value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
|
|
612
|
+
slug: 'REJECTED_BY_BUSINESS',
|
|
613
|
+
percentage: 0,
|
|
614
|
+
image: theme.images.order.status5,
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
key: 7,
|
|
618
|
+
value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
|
|
619
|
+
slug: 'ACCEPTED_BY_BUSINESS',
|
|
620
|
+
percentage: 0.3,
|
|
621
|
+
image: theme.images.order.status7,
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
key: 13,
|
|
625
|
+
value: t('PREORDER', 'PreOrder'),
|
|
626
|
+
slug: 'PREORDER',
|
|
627
|
+
percentage: 0,
|
|
628
|
+
image: theme.images.order.status13,
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
key: 14,
|
|
632
|
+
value: t('ORDER_NOT_READY', 'Order not ready'),
|
|
633
|
+
slug: 'ORDER_NOT_READY',
|
|
634
|
+
percentage: 0.3,
|
|
635
|
+
image: theme.images.order.status13,
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
key: 15,
|
|
639
|
+
value: t(
|
|
640
|
+
'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
641
|
+
'Order picked up completed by customer',
|
|
642
|
+
),
|
|
643
|
+
slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
644
|
+
percentage: 1,
|
|
645
|
+
image: theme.images.order.status1,
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
key: 16,
|
|
649
|
+
value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
|
|
650
|
+
slug: 'CANCELLED_BY_CUSTOMER',
|
|
651
|
+
percentage: 0,
|
|
652
|
+
image: theme.images.order.status2,
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
key: 17,
|
|
656
|
+
value: t(
|
|
657
|
+
'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
658
|
+
'Order not picked up by customer',
|
|
659
|
+
),
|
|
660
|
+
slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
661
|
+
percentage: 0,
|
|
662
|
+
image: theme.images.order.status2,
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
key: 20,
|
|
666
|
+
value: t(
|
|
667
|
+
'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
668
|
+
'Customer almost arrived to business',
|
|
669
|
+
),
|
|
670
|
+
slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
671
|
+
percentage: 0.7,
|
|
672
|
+
image: theme.images.order.status7,
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
key: 21,
|
|
676
|
+
value: t(
|
|
677
|
+
'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
678
|
+
'Customer arrived to business',
|
|
679
|
+
),
|
|
680
|
+
slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
681
|
+
percentage: 0.9,
|
|
682
|
+
image: theme.images.order.status7,
|
|
683
|
+
}
|
|
684
|
+
];
|
|
685
|
+
|
|
686
|
+
const objectStatus = orderStatus.find((o) => o.key === status);
|
|
687
|
+
|
|
688
|
+
return objectStatus && objectStatus;
|
|
689
|
+
}
|
|
690
|
+
|
|
578
691
|
/**
|
|
579
692
|
* Function to get brightness of color.
|
|
580
693
|
*/
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Platform, PlatformIOSStatic } from 'react-native'
|
|
3
|
-
import { useOrder } from 'ordering-components/native'
|
|
4
|
-
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs'
|
|
5
|
-
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
|
-
import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
|
|
7
|
-
import styled from 'styled-components/native'
|
|
8
|
-
|
|
9
|
-
import { OText } from '../components/shared'
|
|
10
|
-
import BusinessList from '../pages/BusinessesListing'
|
|
11
|
-
import MyOrders from '../pages/MyOrders'
|
|
12
|
-
import CartList from '../pages/CartList'
|
|
13
|
-
import Profile from '../pages/Profile'
|
|
14
|
-
import { useTheme } from 'styled-components/native'
|
|
15
|
-
|
|
16
|
-
const CartsLenght = styled.View`
|
|
17
|
-
width: 25px;
|
|
18
|
-
height: 25px;
|
|
19
|
-
background-color: ${(props: any) => props.theme.colors.primary};
|
|
20
|
-
display: flex;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
align-items: center;
|
|
23
|
-
position: absolute;
|
|
24
|
-
right: 0;
|
|
25
|
-
`
|
|
26
|
-
|
|
27
|
-
const Tab = createMaterialBottomTabNavigator();
|
|
28
|
-
|
|
29
|
-
const BottomNavigator = () => {
|
|
30
|
-
const theme = useTheme()
|
|
31
|
-
const [{ carts }] = useOrder()
|
|
32
|
-
const cartsList = (carts && Object.values(carts).filter((cart: any) => cart.products.length > 0)) || []
|
|
33
|
-
const isIos = Platform.OS === 'ios'
|
|
34
|
-
const platformIOS = Platform as PlatformIOSStatic
|
|
35
|
-
const androidStyles = isIos
|
|
36
|
-
? platformIOS.isPad
|
|
37
|
-
? { paddingBottom: 30 }
|
|
38
|
-
: {}
|
|
39
|
-
: {height: 40, position: 'relative', bottom: 15}
|
|
40
|
-
return (
|
|
41
|
-
<Tab.Navigator
|
|
42
|
-
initialRouteName="BusinessList"
|
|
43
|
-
activeColor={theme.colors.primary}
|
|
44
|
-
barStyle={{ backgroundColor: theme.colors.white, ...androidStyles }}
|
|
45
|
-
labeled={false}
|
|
46
|
-
inactiveColor={theme.colors.disabled}
|
|
47
|
-
>
|
|
48
|
-
<Tab.Screen
|
|
49
|
-
name="BusinessList"
|
|
50
|
-
component={BusinessList}
|
|
51
|
-
options={{
|
|
52
|
-
tabBarIcon:
|
|
53
|
-
({ color }: any) => (
|
|
54
|
-
<View style={{ width: 50, height: 50, justifyContent: !isIos ? 'flex-start' : 'space-evenly', position: 'relative', bottom: !isIos ? 10 : 0 }}>
|
|
55
|
-
<MaterialCommunityIcon name='home' size={46} color={color} />
|
|
56
|
-
</View>
|
|
57
|
-
)
|
|
58
|
-
}}
|
|
59
|
-
/>
|
|
60
|
-
<Tab.Screen
|
|
61
|
-
name="MyOrders"
|
|
62
|
-
component={MyOrders}
|
|
63
|
-
options={
|
|
64
|
-
{
|
|
65
|
-
tabBarIcon:
|
|
66
|
-
({ color }: any) => (
|
|
67
|
-
<View style={{ width: 50, height: 50, justifyContent: !isIos ? 'flex-start' : 'space-evenly', position: 'relative', bottom: !isIos ? 10 : 0 }}>
|
|
68
|
-
<MaterialIcon name='format-list-bulleted' size={46} color={color} />
|
|
69
|
-
</View>
|
|
70
|
-
),
|
|
71
|
-
}}
|
|
72
|
-
/>
|
|
73
|
-
<Tab.Screen
|
|
74
|
-
name="Cart"
|
|
75
|
-
component={CartList}
|
|
76
|
-
options={{
|
|
77
|
-
tabBarIcon:
|
|
78
|
-
({ color }: any) => (
|
|
79
|
-
<View style={{
|
|
80
|
-
width: 50,
|
|
81
|
-
height: 50,
|
|
82
|
-
justifyContent: !isIos ? 'flex-start' : 'space-evenly',
|
|
83
|
-
position: 'relative',
|
|
84
|
-
bottom: !isIos ? 10 : 0
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
<MaterialIcon name='shopping-basket' size={46} color={color} />
|
|
88
|
-
{cartsList.length > 0 && (
|
|
89
|
-
<CartsLenght style={{ borderRadius: 100 / 2 }}>
|
|
90
|
-
<OText
|
|
91
|
-
color={theme.colors.white}
|
|
92
|
-
>
|
|
93
|
-
{cartsList.length}
|
|
94
|
-
</OText>
|
|
95
|
-
</CartsLenght>
|
|
96
|
-
)}
|
|
97
|
-
</View>
|
|
98
|
-
)
|
|
99
|
-
}}
|
|
100
|
-
/>
|
|
101
|
-
<Tab.Screen
|
|
102
|
-
name="Profile"
|
|
103
|
-
component={Profile}
|
|
104
|
-
options={{
|
|
105
|
-
tabBarIcon:
|
|
106
|
-
({ color }: any) => (
|
|
107
|
-
<View style={{ width: 50, height: 50, justifyContent: !isIos ? 'flex-start' : 'space-evenly', position: 'relative', bottom: !isIos ? 10 : 0 }}>
|
|
108
|
-
<MaterialIcon name='person' size={46} color={color} />
|
|
109
|
-
</View>
|
|
110
|
-
)
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
</Tab.Navigator>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default BottomNavigator
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createStackNavigator } from "@react-navigation/stack";
|
|
3
|
-
|
|
4
|
-
import AddressList from '../pages/AddressList'
|
|
5
|
-
import AddressForm from '../pages/AddressForm'
|
|
6
|
-
import CartList from '../pages/CartList'
|
|
7
|
-
import CheckoutPage from '../pages/Checkout';
|
|
8
|
-
import BusinessProductsList from '../pages/BusinessProductsList';
|
|
9
|
-
import MultiCheckout from '../pages/MultiCheckout';
|
|
10
|
-
|
|
11
|
-
const Stack = createStackNavigator();
|
|
12
|
-
|
|
13
|
-
const CheckoutNavigator = (props: any) => {
|
|
14
|
-
const {
|
|
15
|
-
navigation,
|
|
16
|
-
route
|
|
17
|
-
} = props;
|
|
18
|
-
|
|
19
|
-
const cartUuid = route?.params?.cartUuid
|
|
20
|
-
|
|
21
|
-
const checkoutProps = {
|
|
22
|
-
navigation,
|
|
23
|
-
route,
|
|
24
|
-
cartUuid: route?.params?.cartUuid
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Stack.Navigator>
|
|
29
|
-
{!cartUuid && (
|
|
30
|
-
<Stack.Screen
|
|
31
|
-
name="Cart"
|
|
32
|
-
component={CartList}
|
|
33
|
-
options={{ headerShown: false }}
|
|
34
|
-
/>
|
|
35
|
-
)}
|
|
36
|
-
<Stack.Screen
|
|
37
|
-
name="CheckoutPage"
|
|
38
|
-
children={() => <CheckoutPage {...checkoutProps} />}
|
|
39
|
-
options={{ headerShown: false }}
|
|
40
|
-
/>
|
|
41
|
-
<Stack.Screen
|
|
42
|
-
name="Business"
|
|
43
|
-
component={BusinessProductsList}
|
|
44
|
-
options={{ headerShown: false }}
|
|
45
|
-
/>
|
|
46
|
-
<Stack.Screen
|
|
47
|
-
name="AddressList"
|
|
48
|
-
component={AddressList}
|
|
49
|
-
options={{ headerShown: false }}
|
|
50
|
-
initialParams={{isFromCheckout: true}}
|
|
51
|
-
/>
|
|
52
|
-
<Stack.Screen
|
|
53
|
-
name="AddressForm"
|
|
54
|
-
component={AddressForm}
|
|
55
|
-
options={{ headerShown: false }}
|
|
56
|
-
/>
|
|
57
|
-
<Stack.Screen
|
|
58
|
-
name="MultiCheckout"
|
|
59
|
-
children={() => <MultiCheckout {...checkoutProps} />}
|
|
60
|
-
options={{ headerShown: false }}
|
|
61
|
-
/>
|
|
62
|
-
</Stack.Navigator>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default CheckoutNavigator;
|