ordering-ui-react-native 0.16.95-release → 0.16.96-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/original/src/components/BusinessFeaturedController/index.tsx +17 -52
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +1 -18
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/Cart/index.tsx +2 -8
- package/themes/original/src/components/MultiCheckout/index.tsx +18 -4
- package/themes/original/src/components/OrderSummary/index.tsx +15 -13
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
2
3
|
import {
|
|
3
4
|
BusinessController as BusinessSingleCard,
|
|
4
5
|
useUtils,
|
|
@@ -6,33 +7,29 @@ import {
|
|
|
6
7
|
useLanguage,
|
|
7
8
|
} from 'ordering-components/native';
|
|
8
9
|
import { useTheme } from 'styled-components/native';
|
|
9
|
-
import
|
|
10
|
-
|
|
10
|
+
import FastImage from 'react-native-fast-image'
|
|
11
|
+
|
|
12
|
+
import { OText } from '../shared';
|
|
11
13
|
import { BusinessControllerParams } from '../../types';
|
|
12
14
|
import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
|
|
13
15
|
import {
|
|
14
16
|
Card,
|
|
15
17
|
BusinessHero,
|
|
16
18
|
BusinessContent,
|
|
17
|
-
BusinessCategory,
|
|
18
19
|
BusinessInfo,
|
|
19
20
|
Metadata,
|
|
20
|
-
BusinessState,
|
|
21
21
|
BusinessLogo,
|
|
22
|
-
Reviews,
|
|
23
22
|
RibbonBox
|
|
24
23
|
} from './styles';
|
|
25
24
|
|
|
26
25
|
export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
27
26
|
const { business, handleClick, isBusinessOpen } = props;
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
|
|
28
|
+
const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
|
|
30
29
|
const [orderState] = useOrder();
|
|
31
30
|
const [, t] = useLanguage();
|
|
32
|
-
|
|
33
31
|
const theme = useTheme();
|
|
34
32
|
|
|
35
|
-
|
|
36
33
|
const styles = StyleSheet.create({
|
|
37
34
|
headerStyle: {
|
|
38
35
|
borderTopLeftRadius: 25,
|
|
@@ -79,23 +76,14 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
79
76
|
justifyContent: 'flex-start',
|
|
80
77
|
width: '100%',
|
|
81
78
|
},
|
|
79
|
+
productStyle: {
|
|
80
|
+
height: 40,
|
|
81
|
+
width: 40
|
|
82
|
+
}
|
|
82
83
|
});
|
|
83
84
|
|
|
84
|
-
const types = ['food', 'laundry', 'alcohol', 'groceries'];
|
|
85
|
-
|
|
86
85
|
const { width } = useWindowDimensions();
|
|
87
86
|
|
|
88
|
-
const getBusinessType = () => {
|
|
89
|
-
if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
|
|
90
|
-
const _types: any = [];
|
|
91
|
-
types.forEach((type) => {
|
|
92
|
-
if (business[type]) {
|
|
93
|
-
_types.push(t(type.toUpperCase(), type));
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return _types.join(', ');
|
|
97
|
-
};
|
|
98
|
-
|
|
99
87
|
return (
|
|
100
88
|
<Card activeOpacity={1} onPress={() => handleClick(business)}>
|
|
101
89
|
{business?.ribbon?.enabled && (
|
|
@@ -120,10 +108,13 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
120
108
|
)}
|
|
121
109
|
<BusinessHero>
|
|
122
110
|
<BusinessLogo>
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
111
|
+
<FastImage
|
|
112
|
+
style={styles.productStyle}
|
|
113
|
+
source={{
|
|
114
|
+
uri: optimizeImage(business?.logo, 'h_100,c_limit'),
|
|
115
|
+
priority: FastImage.priority.normal,
|
|
116
|
+
}}
|
|
117
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
127
118
|
/>
|
|
128
119
|
</BusinessLogo>
|
|
129
120
|
<BusinessContent style={{ width: width * 0.6 }}>
|
|
@@ -131,23 +122,7 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
131
122
|
<OText size={12} ellipsizeMode={'tail'} numberOfLines={2}>
|
|
132
123
|
{business?.name}
|
|
133
124
|
</OText>
|
|
134
|
-
{/* {business?.reviews?.total > 0 && (
|
|
135
|
-
<Reviews>
|
|
136
|
-
<IconAntDesign
|
|
137
|
-
name="star"
|
|
138
|
-
color={theme.colors.primary}
|
|
139
|
-
size={16}
|
|
140
|
-
style={styles.starIcon}
|
|
141
|
-
/>
|
|
142
|
-
<OText>
|
|
143
|
-
{parseNumber(business?.reviews?.total, { separator: '.' })}
|
|
144
|
-
</OText>
|
|
145
|
-
</Reviews>
|
|
146
|
-
)} */}
|
|
147
125
|
</BusinessInfo>
|
|
148
|
-
{/* <BusinessCategory>
|
|
149
|
-
<OText>{getBusinessType()}</OText>
|
|
150
|
-
</BusinessCategory> */}
|
|
151
126
|
<Metadata>
|
|
152
127
|
{!isBusinessOpen ? (
|
|
153
128
|
<View style={styles.closed}>
|
|
@@ -157,7 +132,6 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
157
132
|
</View>
|
|
158
133
|
) : (
|
|
159
134
|
<View style={styles.bullet}>
|
|
160
|
-
{/* <MaterialComIcon name="alarm" size={16} /> */}
|
|
161
135
|
<OText size={10} color={theme.colors.textSecondary}>
|
|
162
136
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
163
137
|
</OText>
|
|
@@ -186,15 +160,6 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
186
160
|
)}
|
|
187
161
|
</Metadata>
|
|
188
162
|
</BusinessContent>
|
|
189
|
-
{/* <BusinessState>
|
|
190
|
-
{!business?.open && (
|
|
191
|
-
<View style={styles.businessStateView}>
|
|
192
|
-
<OText color={theme.colors.white} size={20} style={styles.businessStateText}>
|
|
193
|
-
{t('PREORDER', 'PREORDER')}
|
|
194
|
-
</OText>
|
|
195
|
-
</View>
|
|
196
|
-
)}
|
|
197
|
-
</BusinessState> */}
|
|
198
163
|
</BusinessHero>
|
|
199
164
|
</Card>
|
|
200
165
|
);
|
|
@@ -74,23 +74,6 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
74
74
|
<BIInfo>
|
|
75
75
|
<BIContentInfo>
|
|
76
76
|
<OText size={16} lineHeight={24} weight={'600'}>{cart?.business?.name}</OText>
|
|
77
|
-
{/* {orderState?.options?.type === 1 ? (
|
|
78
|
-
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
|
|
79
|
-
<MaterialCommunityIcon
|
|
80
|
-
name='clock-outline'
|
|
81
|
-
size={24}
|
|
82
|
-
/>
|
|
83
|
-
<OText>{convertHoursToMinutes(cart?.business?.delivery_time)}</OText>
|
|
84
|
-
</View>
|
|
85
|
-
) : (
|
|
86
|
-
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
|
|
87
|
-
<MaterialCommunityIcon
|
|
88
|
-
name='clock-outline'
|
|
89
|
-
size={24}
|
|
90
|
-
/>
|
|
91
|
-
<OText>{convertHoursToMinutes(cart?.business?.pickup_time)}</OText>
|
|
92
|
-
</View>
|
|
93
|
-
)} */}
|
|
94
77
|
<View style={{ flexDirection: 'row' }}>
|
|
95
78
|
{props.onNavigationRedirect && !isClosed && (
|
|
96
79
|
<>
|
|
@@ -99,7 +82,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
99
82
|
</TouchableOpacity>
|
|
100
83
|
</>
|
|
101
84
|
)}
|
|
102
|
-
{!isCartPending &&
|
|
85
|
+
{!isCartPending && (
|
|
103
86
|
<>
|
|
104
87
|
<OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
105
88
|
<OAlert
|
|
@@ -224,7 +224,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
224
224
|
|
|
225
225
|
useEffect(() => {
|
|
226
226
|
if (!businessesList?.loading) {
|
|
227
|
-
const fb = businessesList.businesses.filter((b) => b?.featured
|
|
227
|
+
const fb = businessesList.businesses.filter((b) => b?.featured && b?.open);
|
|
228
228
|
const ary = [];
|
|
229
229
|
while (fb.length > 0) {
|
|
230
230
|
ary.push(fb.splice(0, 2));
|
|
@@ -343,10 +343,10 @@ const CartUI = (props: any) => {
|
|
|
343
343
|
</OSTable>
|
|
344
344
|
))
|
|
345
345
|
}
|
|
346
|
-
{orderState?.options?.type === 1 && cart?.
|
|
346
|
+
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
347
347
|
<OSTable>
|
|
348
348
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
349
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount
|
|
349
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
350
350
|
</OSTable>
|
|
351
351
|
)}
|
|
352
352
|
{
|
|
@@ -370,12 +370,6 @@ const CartUI = (props: any) => {
|
|
|
370
370
|
</OSTable>
|
|
371
371
|
))
|
|
372
372
|
}
|
|
373
|
-
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && cart?.delivery_price_with_discount >= 0 && !hideDeliveryFee && isChewLayout && (
|
|
374
|
-
<OSTable>
|
|
375
|
-
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')}</OText>
|
|
376
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
377
|
-
</OSTable>
|
|
378
|
-
)}
|
|
379
373
|
{cart?.driver_tip > 0 && !hideDriverTip && (
|
|
380
374
|
<OSTable>
|
|
381
375
|
<OText size={12} lineHeight={18}>
|
|
@@ -98,15 +98,29 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
98
98
|
|
|
99
99
|
const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
100
100
|
const businessIds = openCarts.map((cart: any) => cart.business_id)
|
|
101
|
-
const loyalBusinessIds = creditPointPlan?.businesses?.filter((b: any) => b.accumulates).map((item: any) => item.business_id)
|
|
101
|
+
const loyalBusinessIds = creditPointPlan?.businesses?.filter((b: any) => b.accumulates).map((item: any) => item.business_id) ?? []
|
|
102
102
|
const creditPointPlanOnBusiness = businessIds.every((bid: any) => loyalBusinessIds.includes(bid)) && creditPointPlan
|
|
103
103
|
|
|
104
|
-
const loyaltyRewardValue = creditPointPlanOnBusiness?.accumulation_rate
|
|
105
|
-
? Math.round(openCarts.reduce((sum: any, cart: any) => sum + cart?.subtotal, 0) / creditPointPlanOnBusiness?.accumulation_rate) : 0
|
|
106
|
-
|
|
107
104
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
108
105
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
109
106
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
107
|
+
|
|
108
|
+
const getIncludedTaxes = (cart: any) => {
|
|
109
|
+
if (cart?.taxes === null || !cart?.taxes) {
|
|
110
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
111
|
+
} else {
|
|
112
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
113
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
114
|
+
}, 0)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const loyaltyRewardValue = creditPointPlanOnBusiness?.accumulation_rate
|
|
119
|
+
? Math.round(
|
|
120
|
+
openCarts.reduce((sum: any, cart: any) => sum + cart?.subtotal + getIncludedTaxes(cart), 0) /
|
|
121
|
+
creditPointPlanOnBusiness?.accumulation_rate
|
|
122
|
+
) : 0
|
|
123
|
+
|
|
110
124
|
const handleMomentClick = () => {
|
|
111
125
|
if (isPreOrder) {
|
|
112
126
|
navigation.navigate('MomentOption')
|
|
@@ -46,6 +46,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
46
46
|
preorderMaximumDays,
|
|
47
47
|
preorderMinimumDays,
|
|
48
48
|
cateringTypes,
|
|
49
|
+
hideDeliveryFee,
|
|
49
50
|
loyaltyRewardRate,
|
|
50
51
|
maxDate
|
|
51
52
|
} = props;
|
|
@@ -61,7 +62,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
61
62
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
62
63
|
|
|
63
64
|
const cart = orderState?.carts?.[`businessId:${props.cart.business_id}`]
|
|
64
|
-
const loyaltyRewardValue = Math.round(cart?.subtotal / loyaltyRewardRate)
|
|
65
65
|
|
|
66
66
|
const walletName: any = {
|
|
67
67
|
cash: {
|
|
@@ -72,6 +72,18 @@ const OrderSummaryUI = (props: any) => {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
const getIncludedTaxes = () => {
|
|
76
|
+
if (cart?.taxes === null || !cart?.taxes) {
|
|
77
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
78
|
+
} else {
|
|
79
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
80
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
81
|
+
}, 0)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const loyaltyRewardValue = Math.round((cart?.subtotal + getIncludedTaxes()) / loyaltyRewardRate)
|
|
86
|
+
|
|
75
87
|
const handleDeleteClick = (product: any) => {
|
|
76
88
|
removeProduct(product, cart)
|
|
77
89
|
}
|
|
@@ -88,16 +100,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
88
100
|
})
|
|
89
101
|
}
|
|
90
102
|
|
|
91
|
-
const getIncludedTaxes = () => {
|
|
92
|
-
if (cart?.taxes === null || !cart?.taxes) {
|
|
93
|
-
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
94
|
-
} else {
|
|
95
|
-
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
96
|
-
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
97
|
-
}, 0)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
103
|
const getIncludedTaxesDiscounts = () => {
|
|
102
104
|
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
103
105
|
}
|
|
@@ -243,10 +245,10 @@ const OrderSummaryUI = (props: any) => {
|
|
|
243
245
|
</OSTable>
|
|
244
246
|
))
|
|
245
247
|
}
|
|
246
|
-
{orderState?.options?.type === 1 && cart?.
|
|
248
|
+
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
247
249
|
<OSTable>
|
|
248
250
|
<OText size={12}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
249
|
-
<OText size={12}>{parsePrice(cart?.
|
|
251
|
+
<OText size={12}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
250
252
|
</OSTable>
|
|
251
253
|
)}
|
|
252
254
|
{
|