ordering-ui-react-native 0.15.20 → 0.15.21-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/LanguageSelector/index.tsx +1 -0
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +1 -9
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +22 -13
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +53 -49
- package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
- package/themes/business/src/types/index.tsx +2 -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/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
- package/themes/kiosk/src/components/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- 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/OrderDetails/index.tsx +136 -41
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +178 -1
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +48 -57
- package/themes/original/src/components/Cart/index.tsx +18 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +42 -27
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/index.tsx +73 -2
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +34 -25
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +83 -42
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +25 -33
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +40 -33
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
- package/themes/original/src/components/UserProfile/index.tsx +62 -14
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +75 -8
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +70 -25
- package/themes/original/src/utils/index.tsx +12 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useLanguage,
|
|
6
6
|
OrderDetails as OrderDetailsConTableoller,
|
|
7
7
|
useUtils,
|
|
8
|
-
useConfig
|
|
8
|
+
useConfig
|
|
9
9
|
} from 'ordering-components/native';
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
11
|
import {
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
OrderDriver,
|
|
29
29
|
Map,
|
|
30
30
|
Divider,
|
|
31
|
+
OrderAction
|
|
31
32
|
} from './styles';
|
|
32
33
|
import { OButton, OIcon, OModal, OText } from '../shared';
|
|
33
34
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
@@ -39,7 +40,7 @@ import { OSRow } from '../OrderSummary/styles';
|
|
|
39
40
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
40
41
|
import { TaxInformation } from '../TaxInformation';
|
|
41
42
|
import { Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
42
|
-
|
|
43
|
+
import NavBar from '../NavBar'
|
|
43
44
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
44
45
|
const {
|
|
45
46
|
navigation,
|
|
@@ -48,6 +49,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
48
49
|
readMessages,
|
|
49
50
|
isFromCheckout,
|
|
50
51
|
driverLocation,
|
|
52
|
+
onNavigationRedirect,
|
|
53
|
+
reorderState,
|
|
54
|
+
handleReorder
|
|
51
55
|
} = props;
|
|
52
56
|
|
|
53
57
|
const theme = useTheme();
|
|
@@ -76,18 +80,19 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
76
80
|
justifyContent: 'flex-start',
|
|
77
81
|
paddingLeft: 0,
|
|
78
82
|
height: 30,
|
|
79
|
-
width:
|
|
83
|
+
width: 30,
|
|
84
|
+
marginTop: Platform.OS === 'ios' ? 0 : 30
|
|
80
85
|
},
|
|
81
86
|
});
|
|
82
87
|
|
|
83
88
|
const [, t] = useLanguage();
|
|
84
89
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
85
90
|
const [{ configs }] = useConfig();
|
|
86
|
-
|
|
87
91
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
88
92
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
89
93
|
|
|
90
|
-
const { order } = props.order;
|
|
94
|
+
const { order, businessData } = props.order;
|
|
95
|
+
const mapValidStatuses = [9, 19, 23]
|
|
91
96
|
|
|
92
97
|
const walletName: any = {
|
|
93
98
|
cash: {
|
|
@@ -310,8 +315,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
310
315
|
business: type === 'business',
|
|
311
316
|
driver: type === 'driver',
|
|
312
317
|
onClose: () => navigation?.canGoBack()
|
|
313
|
-
|
|
314
|
-
|
|
318
|
+
? navigation.goBack()
|
|
319
|
+
: navigation.navigate('BottomTab', { screen: 'MyOrders' }),
|
|
315
320
|
}
|
|
316
321
|
)
|
|
317
322
|
}
|
|
@@ -356,6 +361,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
356
361
|
)
|
|
357
362
|
}
|
|
358
363
|
|
|
364
|
+
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
if (reorderState?.error) {
|
|
367
|
+
navigation.navigate('Business', { store: businessData?.slug })
|
|
368
|
+
}
|
|
369
|
+
if (!reorderState?.error && reorderState?.result?.uuid) {
|
|
370
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
371
|
+
}
|
|
372
|
+
}, [reorderState])
|
|
373
|
+
|
|
359
374
|
useEffect(() => {
|
|
360
375
|
BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
|
|
361
376
|
return () => {
|
|
@@ -384,6 +399,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
384
399
|
'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
|
|
385
400
|
},
|
|
386
401
|
];
|
|
402
|
+
const driverLocationString = typeof order?.driver?.location?.location === 'string' && order?.driver?.location?.location?.split(',').map((l: string) => l.replace(/[^-.0-9]/g, ''))
|
|
403
|
+
const parsedLocations = locations.map(location => typeof location?.location === 'string' ? {
|
|
404
|
+
...location,
|
|
405
|
+
lat: parseFloat(location?.location?.split(',')[0].replace(/[^-.0-9]/g, '')),
|
|
406
|
+
lng: parseFloat(location?.location?.split(',')[1].replace(/[^-.0-9]/g, ''))
|
|
407
|
+
} : location)
|
|
387
408
|
|
|
388
409
|
useEffect(() => {
|
|
389
410
|
if (driverLocation) {
|
|
@@ -448,27 +469,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
448
469
|
{order && Object.keys(order).length > 0 && (
|
|
449
470
|
<>
|
|
450
471
|
<Header>
|
|
451
|
-
<
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
472
|
+
<NavBar
|
|
473
|
+
title={`${t('ORDER', 'Order')} #${order?.id}`}
|
|
474
|
+
titleAlign={'center'}
|
|
475
|
+
onActionLeft={handleArrowBack}
|
|
476
|
+
showCall={false}
|
|
477
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
478
|
+
style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
|
|
479
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
480
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
481
|
+
subTitle={<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
482
|
+
{order?.delivery_datetime_utc
|
|
483
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
484
|
+
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
485
|
+
</OText>}
|
|
457
486
|
/>
|
|
458
487
|
<OrderInfo>
|
|
459
488
|
<OrderData>
|
|
460
|
-
<OText
|
|
461
|
-
size={20}
|
|
462
|
-
lineHeight={30}
|
|
463
|
-
weight={'600'}
|
|
464
|
-
color={theme.colors.textNormal}>
|
|
465
|
-
{t('ORDER', 'Order')} #{order?.id}
|
|
466
|
-
</OText>
|
|
467
|
-
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
468
|
-
{order?.delivery_datetime_utc
|
|
469
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
470
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
471
|
-
</OText>
|
|
472
489
|
{
|
|
473
490
|
(
|
|
474
491
|
parseInt(order?.status) === 1 ||
|
|
@@ -659,11 +676,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
659
676
|
)}
|
|
660
677
|
{order?.driver && (
|
|
661
678
|
<>
|
|
662
|
-
{order?.driver?.location && parseInt(order?.status)
|
|
679
|
+
{order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
|
|
663
680
|
<Map>
|
|
664
|
-
|
|
665
|
-
location={order?.driver?.location
|
|
666
|
-
|
|
681
|
+
<GoogleMap
|
|
682
|
+
location={typeof order?.driver?.location?.location === 'string'
|
|
683
|
+
? {
|
|
684
|
+
lat: parseFloat(driverLocationString[0]),
|
|
685
|
+
lng: parseFloat(driverLocationString[1]),
|
|
686
|
+
} : driverLocation ?? order?.driver?.location
|
|
687
|
+
}
|
|
688
|
+
locations={parsedLocations}
|
|
667
689
|
readOnly
|
|
668
690
|
/>
|
|
669
691
|
</Map>
|
|
@@ -737,16 +759,37 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
737
759
|
'Once business accepts your order, we will send you an email, thank you!',
|
|
738
760
|
)}
|
|
739
761
|
</OText>
|
|
740
|
-
<
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
762
|
+
<OrderAction>
|
|
763
|
+
<OButton
|
|
764
|
+
text={t('YOUR_ORDERS', 'Your Orders')}
|
|
765
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
766
|
+
imgRightSrc={null}
|
|
767
|
+
borderColor={theme.colors.primary}
|
|
768
|
+
bgColor={theme.colors.clear}
|
|
769
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
|
|
770
|
+
parentStyle={{ marginTop: 29, marginEnd: 15 }}
|
|
771
|
+
onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
|
|
772
|
+
/>
|
|
773
|
+
{(
|
|
774
|
+
parseInt(order?.status) === 1 ||
|
|
775
|
+
parseInt(order?.status) === 2 ||
|
|
776
|
+
parseInt(order?.status) === 5 ||
|
|
777
|
+
parseInt(order?.status) === 6 ||
|
|
778
|
+
parseInt(order?.status) === 10 ||
|
|
779
|
+
parseInt(order?.status) === 11 ||
|
|
780
|
+
parseInt(order?.status) === 12
|
|
781
|
+
) && (
|
|
782
|
+
<OButton
|
|
783
|
+
text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
|
|
784
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
785
|
+
imgRightSrc={null}
|
|
786
|
+
borderColor='transparent'
|
|
787
|
+
bgColor={theme.colors.primary + 10}
|
|
788
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
789
|
+
onClick={() => handleReorder && handleReorder(order.id)}
|
|
790
|
+
/>
|
|
791
|
+
)}
|
|
792
|
+
</OrderAction>
|
|
750
793
|
</HeaderInfo>
|
|
751
794
|
<OrderProducts>
|
|
752
795
|
{order?.products?.length &&
|
|
@@ -856,7 +899,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
856
899
|
<OSRow>
|
|
857
900
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
|
|
858
901
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
859
|
-
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}
|
|
902
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
860
903
|
</OText>
|
|
861
904
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
|
|
862
905
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -983,8 +1026,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
983
1026
|
open={openTaxModal.open}
|
|
984
1027
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
985
1028
|
entireModal
|
|
986
|
-
title={`${openTaxModal.data?.name ||
|
|
987
|
-
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
|
|
988
1029
|
>
|
|
989
1030
|
<TaxInformation
|
|
990
1031
|
type={openTaxModal.type}
|
|
@@ -5,7 +5,6 @@ export const OrderDetailsContainer = styled.ScrollView`
|
|
|
5
5
|
`
|
|
6
6
|
|
|
7
7
|
export const NavBack = styled.TouchableOpacity`
|
|
8
|
-
|
|
9
8
|
`
|
|
10
9
|
|
|
11
10
|
|
|
@@ -125,3 +124,6 @@ export const Divider = styled.View`
|
|
|
125
124
|
margin-top: 5px;
|
|
126
125
|
margin-bottom: 5px;
|
|
127
126
|
`
|
|
127
|
+
export const OrderAction = styled.View`
|
|
128
|
+
flex-direction: row;
|
|
129
|
+
`
|
|
@@ -98,7 +98,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
98
98
|
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
|
|
99
99
|
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
|
|
100
100
|
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
|
|
101
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY
|
|
101
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
|
|
102
102
|
]
|
|
103
103
|
|
|
104
104
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -131,7 +131,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
131
131
|
|
|
132
132
|
useEffect(() => {
|
|
133
133
|
if (isFocused) {
|
|
134
|
-
loadOrders()
|
|
134
|
+
loadOrders(false, false, false, true)
|
|
135
135
|
}
|
|
136
136
|
}, [isFocused])
|
|
137
137
|
|
|
@@ -188,7 +188,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
188
188
|
<ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
|
|
189
189
|
</ProgressContentWrapper>
|
|
190
190
|
<ProgressTextWrapper>
|
|
191
|
-
<OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
|
|
191
|
+
<OText size={12} style={{ width: '50%' }}>{getOrderStatus(lastOrder.status)?.value}</OText>
|
|
192
192
|
<TimeWrapper>
|
|
193
193
|
<OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
|
|
194
194
|
<OText size={11}>
|
|
@@ -218,7 +218,7 @@ export const OrderProgress = (props: any) => {
|
|
|
218
218
|
const orderProgressProps = {
|
|
219
219
|
...props,
|
|
220
220
|
UIComponent: OrderProgressUI,
|
|
221
|
-
orderStatus: [0, 3, 4, 7, 8, 9, 13, 14,
|
|
221
|
+
orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
|
|
222
222
|
useDefualtSessionManager: true,
|
|
223
223
|
paginationSettings: {
|
|
224
224
|
initialPage: 1,
|
|
@@ -112,7 +112,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
112
112
|
{cart?.products?.length > 0 && (
|
|
113
113
|
<>
|
|
114
114
|
<OSProductList>
|
|
115
|
-
{cart?.products
|
|
115
|
+
{cart?.products?.map((product: any) => (
|
|
116
116
|
<ProductItemAccordion
|
|
117
117
|
key={product.code}
|
|
118
118
|
product={product}
|
|
@@ -202,7 +202,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
202
202
|
<OSRow>
|
|
203
203
|
<OText size={12} numberOfLines={1}>
|
|
204
204
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
205
|
-
({parsePrice(fee?.fixed)} + {fee
|
|
205
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
206
206
|
</OText>
|
|
207
207
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
|
|
208
208
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -19,7 +19,8 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
19
19
|
typeSelected,
|
|
20
20
|
defaultValue,
|
|
21
21
|
configTypes,
|
|
22
|
-
orderTypes
|
|
22
|
+
orderTypes,
|
|
23
|
+
setOrderTypeValue
|
|
23
24
|
} = props
|
|
24
25
|
|
|
25
26
|
const theme = useTheme();
|
|
@@ -39,6 +40,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
39
40
|
|
|
40
41
|
const handleChangeOrderTypeCallback = (orderType: number) => {
|
|
41
42
|
if (!orderState.loading) {
|
|
43
|
+
setOrderTypeValue && setOrderTypeValue(orderType)
|
|
42
44
|
handleChangeOrderType(orderType)
|
|
43
45
|
goToBack();
|
|
44
46
|
}
|
|
@@ -51,7 +53,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
51
53
|
btnStyle={{ paddingLeft: 0 }}
|
|
52
54
|
paddingTop={0}
|
|
53
55
|
style={{ paddingBottom: 0 }}
|
|
54
|
-
title={t('
|
|
56
|
+
title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
|
|
55
57
|
titleAlign={'center'}
|
|
56
58
|
titleStyle={{ fontSize: 14 }}
|
|
57
59
|
/>
|
|
@@ -2,12 +2,12 @@ import React, { useState, useEffect } from 'react'
|
|
|
2
2
|
import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-components/native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import { useFocusEffect } from '@react-navigation/native'
|
|
5
|
-
import { OText
|
|
5
|
+
import { OText } from '../shared'
|
|
6
6
|
import { NotFoundSource } from '../NotFoundSource'
|
|
7
7
|
import { ActiveOrders } from '../ActiveOrders'
|
|
8
8
|
import { PreviousOrders } from '../PreviousOrders'
|
|
9
9
|
|
|
10
|
-
import { OptionTitle
|
|
10
|
+
import { OptionTitle } from './styles'
|
|
11
11
|
import { OrdersOptionParams } from '../../types'
|
|
12
12
|
|
|
13
13
|
import {
|
|
@@ -33,7 +33,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
33
33
|
loadMoreOrders,
|
|
34
34
|
loadOrders,
|
|
35
35
|
setOrdersLength,
|
|
36
|
-
ordersLength
|
|
36
|
+
ordersLength,
|
|
37
|
+
refreshOrders,
|
|
38
|
+
setRefreshOrders
|
|
37
39
|
} = props
|
|
38
40
|
|
|
39
41
|
const theme = useTheme();
|
|
@@ -95,7 +97,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
95
97
|
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
|
|
96
98
|
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
|
|
97
99
|
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
|
|
98
|
-
|
|
100
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
|
|
99
101
|
]
|
|
100
102
|
|
|
101
103
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -105,9 +107,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
105
107
|
|
|
106
108
|
useFocusEffect(
|
|
107
109
|
React.useCallback(() => {
|
|
108
|
-
loadOrders()
|
|
110
|
+
loadOrders(false, false, false, true)
|
|
109
111
|
}, [navigation])
|
|
110
|
-
|
|
112
|
+
)
|
|
111
113
|
|
|
112
114
|
useEffect(() => {
|
|
113
115
|
const hasMore = pagination?.totalPages && pagination?.currentPage !== pagination?.totalPages
|
|
@@ -128,23 +130,16 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
128
130
|
}
|
|
129
131
|
}, [orders, activeOrders])
|
|
130
132
|
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if(refreshOrders){
|
|
135
|
+
loadOrders(false, false, false, true)
|
|
136
|
+
setRefreshOrders && setRefreshOrders(false)
|
|
137
|
+
}
|
|
138
|
+
}, [refreshOrders])
|
|
139
|
+
|
|
131
140
|
return (
|
|
132
141
|
<>
|
|
133
|
-
{
|
|
134
|
-
<NoOrdersWrapper>
|
|
135
|
-
<OText size={14} numberOfLines={1}>
|
|
136
|
-
{t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
|
|
137
|
-
</OText>
|
|
138
|
-
<OButton
|
|
139
|
-
text={t('ORDER_NOW', 'Order now')}
|
|
140
|
-
onClick={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
|
|
141
|
-
textStyle={{ color: 'white', fontSize: 14 }}
|
|
142
|
-
style={{ borderRadius: 7.6, marginBottom: 10, marginTop: 10, height: 44, paddingLeft: 10, paddingRight: 10 }}
|
|
143
|
-
/>
|
|
144
|
-
|
|
145
|
-
</NoOrdersWrapper>
|
|
146
|
-
)}
|
|
147
|
-
{(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
|
|
142
|
+
{(orders.length > 0) && (
|
|
148
143
|
<>
|
|
149
144
|
<OptionTitle>
|
|
150
145
|
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
|
|
@@ -155,18 +150,15 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
155
150
|
: t('PAST', 'Past'))}
|
|
156
151
|
</OText>
|
|
157
152
|
</OptionTitle>
|
|
158
|
-
{!(ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) &&
|
|
159
|
-
!loading &&
|
|
160
|
-
orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
|
|
161
|
-
(
|
|
162
|
-
<NotFoundSource
|
|
163
|
-
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
164
|
-
image={imageFails}
|
|
165
|
-
conditioned
|
|
166
|
-
/>
|
|
167
|
-
)}
|
|
168
153
|
</>
|
|
169
154
|
)}
|
|
155
|
+
{!loading && orders.length === 0 && (
|
|
156
|
+
<NotFoundSource
|
|
157
|
+
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
158
|
+
image={imageFails}
|
|
159
|
+
conditioned
|
|
160
|
+
/>
|
|
161
|
+
)}
|
|
170
162
|
{loading && (
|
|
171
163
|
<>
|
|
172
164
|
{!activeOrders ? (
|
|
@@ -239,8 +231,8 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
239
231
|
...props,
|
|
240
232
|
UIComponent: OrdersOptionUI,
|
|
241
233
|
orderStatus: props.preOrders ? [13] : props.activeOrders
|
|
242
|
-
? [0, 3, 4, 7, 8, 9, 14,
|
|
243
|
-
: [1, 2, 5, 6, 10, 11, 12, 16, 17],
|
|
234
|
+
? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
235
|
+
: [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
|
|
244
236
|
useDefualtSessionManager: true,
|
|
245
237
|
}
|
|
246
238
|
|
|
@@ -20,6 +20,7 @@ import { OText } from '../shared'
|
|
|
20
20
|
|
|
21
21
|
const PaymentOptionWalletUI = (props: any) => {
|
|
22
22
|
const {
|
|
23
|
+
businessConfigs,
|
|
23
24
|
businessId,
|
|
24
25
|
walletsState,
|
|
25
26
|
selectWallet,
|
|
@@ -37,6 +38,9 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
37
38
|
const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
|
|
38
39
|
const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
|
|
39
40
|
|
|
41
|
+
const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
42
|
+
const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
43
|
+
|
|
40
44
|
const styles = StyleSheet.create({
|
|
41
45
|
checkBoxStyle: {
|
|
42
46
|
width: 25,
|
|
@@ -53,11 +57,11 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
53
57
|
const walletName: any = {
|
|
54
58
|
cash: {
|
|
55
59
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
56
|
-
isActive: isWalletCashEnabled
|
|
60
|
+
isActive: isWalletCashEnabled && isBusinessWalletCashEnabled
|
|
57
61
|
},
|
|
58
62
|
credit_point: {
|
|
59
63
|
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
60
|
-
isActive: isWalletPointsEnabled
|
|
64
|
+
isActive: isWalletPointsEnabled && isBusinessWalletPointsEnabled
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
|
|
@@ -96,17 +100,19 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
96
100
|
<Container
|
|
97
101
|
key={wallet.id}
|
|
98
102
|
isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
|
|
103
|
+
onPress={() => handleOnChange(idx, wallet)}
|
|
104
|
+
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
|
|
99
105
|
>
|
|
100
106
|
<SectionLeft>
|
|
101
107
|
<CheckBox
|
|
102
108
|
value={checkedState[idx]}
|
|
103
|
-
|
|
104
|
-
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0 }
|
|
109
|
+
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
|
|
105
110
|
boxType={'square'}
|
|
106
111
|
tintColors={{
|
|
107
112
|
true: theme.colors.primary,
|
|
108
113
|
false: theme.colors.disabled
|
|
109
114
|
}}
|
|
115
|
+
onChange={() => handleOnChange(idx, wallet)}
|
|
110
116
|
tintColor={theme.colors.disabled}
|
|
111
117
|
onCheckColor={theme.colors.primary}
|
|
112
118
|
onTintColor={theme.colors.primary}
|
|
@@ -32,8 +32,6 @@ import {
|
|
|
32
32
|
import { getIconCard, flatArray } from '../../utils';
|
|
33
33
|
|
|
34
34
|
const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
|
|
35
|
-
const methodsPay = ['google_pay', 'apple_pay']
|
|
36
|
-
const stripeDirectMethods = ['stripe_direct', ...methodsPay]
|
|
37
35
|
// const stripeRedirectOptions = [
|
|
38
36
|
// { name: 'Bancontact', value: 'bancontact' },
|
|
39
37
|
// { name: 'Alipay', value: 'alipay' },
|
|
@@ -56,8 +54,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
56
54
|
handlePaymethodClick,
|
|
57
55
|
handlePaymethodDataChange,
|
|
58
56
|
isOpenMethod,
|
|
59
|
-
handlePaymentMethodClickCustom
|
|
60
|
-
handlePlaceOrder
|
|
57
|
+
handlePaymentMethodClickCustom
|
|
61
58
|
} = props
|
|
62
59
|
|
|
63
60
|
const theme = useTheme();
|
|
@@ -125,16 +122,12 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
125
122
|
|
|
126
123
|
useEffect(() => {
|
|
127
124
|
if (props.paySelected && props.paySelected?.data) {
|
|
128
|
-
|
|
125
|
+
requestAnimationFrame(() => {
|
|
126
|
+
setPaymethodData && setPaymethodData(props.paySelected?.data)
|
|
127
|
+
})
|
|
129
128
|
}
|
|
130
129
|
}, [props.paySelected])
|
|
131
130
|
|
|
132
|
-
useEffect(() => {
|
|
133
|
-
if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
|
|
134
|
-
handlePlaceOrder()
|
|
135
|
-
}
|
|
136
|
-
}, [paymethodData, paymethodSelected])
|
|
137
|
-
|
|
138
131
|
const renderPaymethods = ({ item }: any) => {
|
|
139
132
|
return (
|
|
140
133
|
<TouchableOpacity
|
|
@@ -163,7 +156,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
163
156
|
)
|
|
164
157
|
}
|
|
165
158
|
|
|
166
|
-
const excludeIds: any = [32]; //exclude paypal & connect & redirect
|
|
159
|
+
const excludeIds: any = [32, 66]; //exclude paypal & connect & redirect
|
|
167
160
|
|
|
168
161
|
return (
|
|
169
162
|
<PMContainer>
|
|
@@ -296,11 +289,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
296
289
|
</KeyboardAvoidingView>
|
|
297
290
|
</OModal>
|
|
298
291
|
|
|
299
|
-
{/* Stripe direct
|
|
292
|
+
{/* Stripe direct */}
|
|
300
293
|
<OModal
|
|
301
294
|
entireModal
|
|
302
295
|
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
303
|
-
open={
|
|
296
|
+
open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
|
|
304
297
|
onClose={() => handlePaymethodClick(null)}
|
|
305
298
|
>
|
|
306
299
|
<KeyboardAvoidingView
|
|
@@ -309,13 +302,10 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
309
302
|
enabled={Platform.OS === 'ios' ? true : false}
|
|
310
303
|
>
|
|
311
304
|
<StripeElementsForm
|
|
312
|
-
cart={cart}
|
|
313
|
-
paymethod={isOpenMethod?.paymethod?.gateway}
|
|
314
|
-
methodsPay={methodsPay}
|
|
315
305
|
businessId={props.businessId}
|
|
316
|
-
publicKey={isOpenMethod?.paymethod?.credentials?.publishable
|
|
306
|
+
publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
|
|
317
307
|
handleSource={handlePaymethodDataChange}
|
|
318
|
-
onCancel={() => handlePaymethodClick(
|
|
308
|
+
onCancel={() => handlePaymethodClick(false)}
|
|
319
309
|
/>
|
|
320
310
|
</KeyboardAvoidingView>
|
|
321
311
|
</OModal>
|
|
@@ -85,7 +85,11 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
85
85
|
order: {
|
|
86
86
|
id: order?.id,
|
|
87
87
|
business_id: order?.business_id,
|
|
88
|
-
logo: order
|
|
88
|
+
logo: order?.business?.logo,
|
|
89
|
+
driver: order?.driver,
|
|
90
|
+
products: order?.products,
|
|
91
|
+
review: order?.review,
|
|
92
|
+
user_review: order?.user_review
|
|
89
93
|
},
|
|
90
94
|
});
|
|
91
95
|
};
|
|
@@ -139,18 +143,20 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
139
143
|
</OText>
|
|
140
144
|
</Information>
|
|
141
145
|
<Status>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
{order.cart && (
|
|
147
|
+
<OButton
|
|
148
|
+
text={t('REORDER', 'Reorder')}
|
|
149
|
+
imgRightSrc={''}
|
|
150
|
+
textStyle={styles.buttonText}
|
|
151
|
+
style={
|
|
152
|
+
reorderLoading && order.id === reorderSelected
|
|
153
|
+
? styles.reorderLoading
|
|
154
|
+
: styles.reorderbutton
|
|
155
|
+
}
|
|
156
|
+
onClick={() => handleReorderClick(order.id)}
|
|
157
|
+
isLoading={reorderLoading && order.id === reorderSelected}
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
154
160
|
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
155
161
|
!order.review && (
|
|
156
162
|
<TouchableOpacity
|