ordering-ui-react-native 0.17.1-release → 0.17.2-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/NewOrderNotification/index.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/CartContent/index.tsx +57 -14
- package/themes/original/src/components/CartContent/styles.tsx +4 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +6 -5
- package/themes/original/src/components/OrderSummary/index.tsx +4 -2
package/package.json
CHANGED
|
@@ -81,7 +81,7 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
81
81
|
} catch { }
|
|
82
82
|
const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
|
|
83
83
|
const assignedSecondsDiff = duration.asSeconds()
|
|
84
|
-
if (assignedSecondsDiff < 5 && !isBusinessApp) {
|
|
84
|
+
if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status) {
|
|
85
85
|
handlePlayNotificationSound({ evt: 2, orderId: value?.id })
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -170,7 +170,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
170
170
|
if (date.getDate() !== dateSeleted.getDate() || i >= date.getHours()) {
|
|
171
171
|
let hour = ''
|
|
172
172
|
let meridian = ''
|
|
173
|
-
if (
|
|
173
|
+
if (is12hours) {
|
|
174
174
|
if (i === 0) {
|
|
175
175
|
hour = '12'
|
|
176
176
|
meridian = ' ' + t('AM', 'AM')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useLanguage, useConfig } from 'ordering-components/native';
|
|
3
|
+
import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
|
-
import { CCContainer, CCNotCarts, CCList, CheckoutAction } from './styles';
|
|
5
|
+
import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
|
|
6
6
|
|
|
7
7
|
import { Cart } from '../Cart';
|
|
8
8
|
import { OButton, OText } from '../shared';
|
|
@@ -18,12 +18,18 @@ export const CartContent = (props: any) => {
|
|
|
18
18
|
const theme = useTheme();
|
|
19
19
|
const [, t] = useLanguage()
|
|
20
20
|
const [{ configs }] = useConfig()
|
|
21
|
+
const [{ parsePrice }] = useUtils();
|
|
21
22
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
22
23
|
|
|
23
24
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
24
25
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
25
26
|
const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
26
27
|
|
|
28
|
+
const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
|
|
29
|
+
const totalCartsFee = cartsAvailable?.length && cartsAvailable
|
|
30
|
+
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
31
|
+
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
32
|
+
|
|
27
33
|
const handleCheckoutRedirect = () => {
|
|
28
34
|
if (cartsAvailable.length === 1) {
|
|
29
35
|
onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -78,6 +84,10 @@ export const CartContent = (props: any) => {
|
|
|
78
84
|
setIsCartsLoading={setIsCartsLoading}
|
|
79
85
|
isMultiCheckout={isMultiCheckout}
|
|
80
86
|
hideUpselling
|
|
87
|
+
businessConfigs={cart?.business?.configs}
|
|
88
|
+
hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
|
|
89
|
+
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
90
|
+
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
81
91
|
/>
|
|
82
92
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
83
93
|
</>
|
|
@@ -85,18 +95,51 @@ export const CartContent = (props: any) => {
|
|
|
85
95
|
</CCList>
|
|
86
96
|
))}
|
|
87
97
|
{isMultiCheckout && (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
<>
|
|
99
|
+
{!!cartsAvailable.length && (
|
|
100
|
+
<ChCartsTotal>
|
|
101
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
102
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
103
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
104
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
105
|
+
</OText>
|
|
106
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
107
|
+
{parsePrice(totalCartsFee)}
|
|
108
|
+
</OText>
|
|
109
|
+
</View>
|
|
110
|
+
)}
|
|
111
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
112
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
113
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
114
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
115
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
116
|
+
</OText>
|
|
117
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
118
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
119
|
+
</OText>
|
|
120
|
+
</View>
|
|
121
|
+
)}
|
|
122
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
123
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
124
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
125
|
+
</OText>
|
|
126
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
127
|
+
</View>
|
|
128
|
+
</ChCartsTotal>
|
|
129
|
+
)}
|
|
130
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
131
|
+
<OButton
|
|
132
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
133
|
+
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
134
|
+
isDisabled={!cartsAvailable.length}
|
|
135
|
+
borderColor={theme.colors.primary}
|
|
136
|
+
imgRightSrc={null}
|
|
137
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
138
|
+
onClick={() => handleCheckoutRedirect()}
|
|
139
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
140
|
+
/>
|
|
141
|
+
</CheckoutAction>
|
|
142
|
+
</>
|
|
100
143
|
)}
|
|
101
144
|
</>
|
|
102
145
|
)}
|
|
@@ -115,11 +115,12 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
)
|
|
118
|
+
const subtotalAmount = openCarts.reduce((sum: any, cart: any) => sum + (cart?.subtotal + getIncludedTaxes(cart)), 0) *
|
|
119
|
+
creditPointPlanOnBusiness?.accumulation_rate
|
|
120
|
+
|
|
121
|
+
const loyaltyRewardValue = (creditPointPlanOnBusiness?.accumulation_rate
|
|
122
|
+
? (Math.trunc(subtotalAmount * 100) / 100).toFixed(configs.format_number_decimal_length?.value ?? 2)
|
|
123
|
+
: 0)
|
|
123
124
|
|
|
124
125
|
const handleMomentClick = () => {
|
|
125
126
|
if (isPreOrder) {
|
|
@@ -74,7 +74,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
74
74
|
|
|
75
75
|
const getIncludedTaxes = () => {
|
|
76
76
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
77
|
-
return cart
|
|
77
|
+
return cart?.business?.tax_type === 1 ? cart?.tax : 0
|
|
78
78
|
} else {
|
|
79
79
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
80
80
|
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
@@ -82,7 +82,9 @@ const OrderSummaryUI = (props: any) => {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const loyaltyRewardValue =
|
|
85
|
+
const loyaltyRewardValue = ((
|
|
86
|
+
Math.trunc(((cart?.subtotal + getIncludedTaxes()) * loyaltyRewardRate) * 100) / 100
|
|
87
|
+
).toFixed(configs.format_number_decimal_length?.value ?? 2), 10)
|
|
86
88
|
|
|
87
89
|
const handleDeleteClick = (product: any) => {
|
|
88
90
|
removeProduct(product, cart)
|