ordering-ui-react-native 0.14.45 → 0.14.48
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/src/components/ProductForm/index.tsx +1 -1
- package/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +100 -75
- package/themes/original/src/components/Cart/index.tsx +122 -24
- package/themes/original/src/components/Cart/styles.tsx +8 -1
- package/themes/original/src/components/OrderDetails/index.tsx +114 -42
- package/themes/original/src/components/OrderDetails/styles.tsx +8 -1
- package/themes/original/src/components/OrderSummary/index.tsx +132 -23
- package/themes/original/src/components/OrderSummary/styles.tsx +7 -0
- package/themes/original/src/components/ProductForm/index.tsx +54 -52
- package/themes/original/src/components/SingleProductCard/index.tsx +21 -11
- package/themes/original/src/components/SingleProductCard/styles.tsx +4 -0
- package/themes/original/src/components/TaxInformation/index.tsx +59 -27
|
@@ -289,16 +289,16 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
289
289
|
</>
|
|
290
290
|
);
|
|
291
291
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
const handleGoBack = navigation?.canGoBack()
|
|
293
|
+
? () => navigation.goBack()
|
|
294
|
+
: () => navigation.navigate('Business', { store: props.businessSlug })
|
|
295
295
|
|
|
296
296
|
return (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
297
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
298
|
+
<TopHeader>
|
|
299
|
+
<TopActions onPress={() => handleGoBack()}>
|
|
300
|
+
<OIcon src={theme.images.general.arrow_left} width={15} />
|
|
301
|
+
</TopActions>
|
|
302
302
|
</TopHeader>
|
|
303
303
|
<ScrollView>
|
|
304
304
|
{!error && (
|
|
@@ -349,13 +349,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
349
349
|
style={styles.slide1}
|
|
350
350
|
key={i}
|
|
351
351
|
>
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
352
|
+
<FastImage
|
|
353
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
|
|
354
|
+
source={{
|
|
355
|
+
uri: optimizeImage(img, 'h_258,c_limit'),
|
|
356
|
+
priority: FastImage.priority.normal,
|
|
357
|
+
}}
|
|
358
|
+
/>
|
|
359
359
|
</View>
|
|
360
360
|
))}
|
|
361
361
|
</Swiper>
|
|
@@ -379,18 +379,18 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
379
379
|
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
380
380
|
}}
|
|
381
381
|
>
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
382
|
+
<OIcon
|
|
383
|
+
url={img}
|
|
384
|
+
style={{
|
|
385
|
+
borderColor: theme.colors.lightGray,
|
|
386
|
+
borderRadius: 8,
|
|
387
|
+
minHeight: '100%',
|
|
388
|
+
opacity: isSoldOut ? 0.5 : 1
|
|
389
|
+
}}
|
|
390
|
+
width={56}
|
|
391
|
+
height={56}
|
|
392
|
+
cover
|
|
393
|
+
/>
|
|
394
394
|
</View>
|
|
395
395
|
</TouchableOpacity>
|
|
396
396
|
|
|
@@ -446,7 +446,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
446
446
|
) : (
|
|
447
447
|
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
448
448
|
<OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
|
|
449
|
-
{
|
|
449
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
450
450
|
<OText style={{
|
|
451
451
|
fontSize: 14,
|
|
452
452
|
color: '#808080',
|
|
@@ -460,7 +460,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
460
460
|
</>
|
|
461
461
|
)}
|
|
462
462
|
</ProductTitle>
|
|
463
|
-
|
|
463
|
+
<ProductDescription>
|
|
464
464
|
<OText color={theme.colors.textSecondary} size={12} lineHeight={18}>
|
|
465
465
|
{product?.description || productCart?.description}
|
|
466
466
|
</OText>
|
|
@@ -785,7 +785,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
785
785
|
<OText
|
|
786
786
|
size={12}
|
|
787
787
|
lineHeight={18}
|
|
788
|
-
style={{ minWidth:
|
|
788
|
+
style={{ minWidth: 40, textAlign: 'center' }}
|
|
789
789
|
>
|
|
790
790
|
{qtyBy?.pieces && productCart.quantity}
|
|
791
791
|
{qtyBy?.weight_unit && productCart.quantity * product?.weight}
|
|
@@ -809,36 +809,38 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
809
809
|
}
|
|
810
810
|
/>
|
|
811
811
|
</TouchableOpacity>
|
|
812
|
-
|
|
813
|
-
<
|
|
814
|
-
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
815
|
-
>
|
|
816
|
-
<WeightUnitItem active={qtyBy?.pieces}>
|
|
817
|
-
<OText
|
|
818
|
-
size={12}
|
|
819
|
-
lineHeight={18}
|
|
820
|
-
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
821
|
-
>
|
|
822
|
-
{t('PIECES', 'pieces')}
|
|
823
|
-
</OText>
|
|
824
|
-
</WeightUnitItem>
|
|
825
|
-
</TouchableOpacity>
|
|
826
|
-
<View style={{ alignItems: 'flex-start' }}>
|
|
812
|
+
{isHaveWeight && (
|
|
813
|
+
<WeightUnitSwitch>
|
|
827
814
|
<TouchableOpacity
|
|
828
|
-
onPress={() => handleSwitchQtyUnit('
|
|
815
|
+
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
829
816
|
>
|
|
830
|
-
<WeightUnitItem active={qtyBy?.
|
|
817
|
+
<WeightUnitItem active={qtyBy?.pieces}>
|
|
831
818
|
<OText
|
|
832
819
|
size={12}
|
|
833
820
|
lineHeight={18}
|
|
834
|
-
color={qtyBy?.
|
|
821
|
+
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
835
822
|
>
|
|
836
|
-
{
|
|
823
|
+
{t('PIECES', 'pcs')}
|
|
837
824
|
</OText>
|
|
838
825
|
</WeightUnitItem>
|
|
839
826
|
</TouchableOpacity>
|
|
840
|
-
|
|
841
|
-
|
|
827
|
+
<View style={{ alignItems: 'flex-start' }}>
|
|
828
|
+
<TouchableOpacity
|
|
829
|
+
onPress={() => handleSwitchQtyUnit('weight_unit')}
|
|
830
|
+
>
|
|
831
|
+
<WeightUnitItem active={qtyBy?.weight_unit}>
|
|
832
|
+
<OText
|
|
833
|
+
size={12}
|
|
834
|
+
lineHeight={18}
|
|
835
|
+
color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
|
|
836
|
+
>
|
|
837
|
+
{product?.weight_unit}
|
|
838
|
+
</OText>
|
|
839
|
+
</WeightUnitItem>
|
|
840
|
+
</TouchableOpacity>
|
|
841
|
+
</View>
|
|
842
|
+
</WeightUnitSwitch>
|
|
843
|
+
)}
|
|
842
844
|
</View>
|
|
843
845
|
)}
|
|
844
846
|
<View
|
|
@@ -907,7 +909,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
907
909
|
</View>
|
|
908
910
|
</ProductActions>
|
|
909
911
|
)}
|
|
910
|
-
|
|
912
|
+
</SafeAreaView>
|
|
911
913
|
);
|
|
912
914
|
};
|
|
913
915
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from 'ordering-components/native';
|
|
8
8
|
import { useTheme } from 'styled-components/native';
|
|
9
9
|
import { SingleProductCardParams } from '../../types';
|
|
10
|
-
import { CardContainer, CardInfo, SoldOut, QuantityContainer } from './styles';
|
|
10
|
+
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer } from './styles';
|
|
11
11
|
import { StyleSheet } from 'react-native';
|
|
12
12
|
import { OText, OIcon } from '../shared';
|
|
13
13
|
import FastImage from 'react-native-fast-image'
|
|
@@ -51,6 +51,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
51
51
|
textAlign: 'center',
|
|
52
52
|
borderRadius: 25,
|
|
53
53
|
alignItems: 'center'
|
|
54
|
+
},
|
|
55
|
+
regularPriceStyle: {
|
|
56
|
+
fontSize: 12,
|
|
57
|
+
color: '#808080',
|
|
58
|
+
textDecorationLine: 'line-through',
|
|
59
|
+
marginLeft: 7,
|
|
60
|
+
marginRight: 7
|
|
54
61
|
}
|
|
55
62
|
});
|
|
56
63
|
|
|
@@ -97,13 +104,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
97
104
|
(isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
|
|
98
105
|
]}
|
|
99
106
|
onPress={() => onProductClick?.(product)}>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
{productAddedToCartLength > 0 && (
|
|
108
|
+
<QuantityContainer style={[styles.quantityContainer, {
|
|
109
|
+
transform: [{ translateX: 10 }, { translateY: -10 }],
|
|
110
|
+
}]}>
|
|
111
|
+
<OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
|
|
112
|
+
</QuantityContainer>
|
|
113
|
+
)}
|
|
107
114
|
<CardInfo>
|
|
108
115
|
<OText
|
|
109
116
|
size={12}
|
|
@@ -113,9 +120,12 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
113
120
|
style={styles.line18}>
|
|
114
121
|
{product?.name}
|
|
115
122
|
</OText>
|
|
116
|
-
<
|
|
117
|
-
{parsePrice(product?.price)}
|
|
118
|
-
|
|
123
|
+
<PricesContainer>
|
|
124
|
+
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
125
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
126
|
+
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
127
|
+
)}
|
|
128
|
+
</PricesContainer>
|
|
119
129
|
<OText
|
|
120
130
|
size={10}
|
|
121
131
|
numberOfLines={2}
|
|
@@ -1,51 +1,83 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useLanguage
|
|
1
|
+
import React, { Mixin } from 'react'
|
|
2
|
+
import { useLanguage } from 'ordering-components/native'
|
|
3
3
|
import { SingleProductCard } from '../SingleProductCard'
|
|
4
4
|
import { TaxInformationContainer, ProductContainer } from './styles'
|
|
5
5
|
import { OText } from '../shared'
|
|
6
6
|
|
|
7
7
|
interface taxInformationParams {
|
|
8
|
-
data: {
|
|
9
|
-
|
|
8
|
+
data: {
|
|
9
|
+
name: string,
|
|
10
|
+
description?: string,
|
|
11
|
+
rate: string | number,
|
|
12
|
+
type: number,
|
|
13
|
+
fixed?: number,
|
|
14
|
+
percentage?: number,
|
|
15
|
+
id: number,
|
|
16
|
+
discounts?: any
|
|
17
|
+
} | null,
|
|
18
|
+
products: Array<any>,
|
|
19
|
+
type: string
|
|
10
20
|
}
|
|
11
21
|
|
|
12
22
|
export const TaxInformation = (props: taxInformationParams) => {
|
|
13
23
|
const {
|
|
14
24
|
data,
|
|
15
|
-
products
|
|
25
|
+
products,
|
|
26
|
+
type
|
|
16
27
|
} = props
|
|
17
28
|
|
|
18
29
|
const [, t] = useLanguage()
|
|
19
|
-
const [{ parsePrice }] = useUtils()
|
|
20
30
|
|
|
21
|
-
const isTax = typeof data?.rate === 'number'
|
|
22
|
-
const TaxFeeString = isTax ? 'tax' : 'fee'
|
|
23
31
|
const includedOnPriceString = data?.type === 1 ? `(${t('INCLUDED_ON_PRICE', 'Included on price')})` : `(${t('NOT_INCLUDED_ON_PRICE', 'Not included on price')})`
|
|
24
32
|
|
|
33
|
+
const getFilterValidation = (product: any) => {
|
|
34
|
+
return (
|
|
35
|
+
type === 'tax'
|
|
36
|
+
? (product.tax?.id ? product.tax?.id === data?.id : product.tax?.id === null && data?.id === null)
|
|
37
|
+
: type === 'fee'
|
|
38
|
+
? (product.fee?.id ? product.fee?.id === data?.id : (product.fee?.id === null && data?.id === null))
|
|
39
|
+
: Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code))
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const getTypeString = () => {
|
|
44
|
+
return (
|
|
45
|
+
type === 'offer_target_1'
|
|
46
|
+
? t('PRODUCT_DISCOUNT', 'Product discount')
|
|
47
|
+
: type === 'tax'
|
|
48
|
+
? t('TAX', 'Tax')
|
|
49
|
+
: t('Fee', 'Fee')
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
25
53
|
return (
|
|
26
54
|
<TaxInformationContainer>
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
t('
|
|
30
|
-
|
|
31
|
-
|
|
55
|
+
{!!data?.description ? (
|
|
56
|
+
<OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
|
|
57
|
+
{t('DESCRIPTION', 'Description')}: {data?.description} {data?.type && !type?.includes('offer') && includedOnPriceString}
|
|
58
|
+
</OText>
|
|
59
|
+
) : (
|
|
32
60
|
<OText mBottom={10} size={18} style={{ alignSelf: 'center', textAlign: 'center' }}>
|
|
33
|
-
{t('
|
|
61
|
+
{t('WITHOUT_DESCRIPTION', 'Without description')}
|
|
34
62
|
</OText>
|
|
35
63
|
)}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
64
|
+
{!(type === 'offer_target_2' || type === 'offer_target_3') && (
|
|
65
|
+
<>
|
|
66
|
+
<OText>{t('OTHER_PRODUCTS_WITH_THIS', 'Other products with this')} {getTypeString()}:</OText>
|
|
67
|
+
<ProductContainer>
|
|
68
|
+
{
|
|
69
|
+
products.filter((product: any) => getFilterValidation(product)).map(product => (
|
|
70
|
+
<SingleProductCard
|
|
71
|
+
key={product.id}
|
|
72
|
+
product={product}
|
|
73
|
+
isSoldOut={false}
|
|
74
|
+
businessId={product?.business_id}
|
|
75
|
+
/>
|
|
76
|
+
))
|
|
77
|
+
}
|
|
78
|
+
</ProductContainer>
|
|
79
|
+
</>
|
|
80
|
+
)}
|
|
49
81
|
</TaxInformationContainer>
|
|
50
82
|
)
|
|
51
83
|
}
|