ordering-ui-react-native 0.14.30 → 0.14.31-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 +2 -2
- package/src/components/BusinessItemAccordion/index.tsx +2 -2
- package/src/components/BusinessProductsListing/index.tsx +10 -26
- package/src/components/Cart/index.tsx +136 -62
- package/src/components/Cart/styles.tsx +7 -0
- package/src/components/Checkout/index.tsx +10 -6
- package/src/components/LogoutButton/index.tsx +14 -0
- package/src/components/OrderDetails/index.tsx +102 -34
- package/src/components/OrderDetails/styles.tsx +7 -0
- package/src/components/OrderSummary/index.tsx +142 -58
- package/src/components/OrderSummary/styles.tsx +10 -2
- package/src/components/ProductForm/index.tsx +47 -10
- package/src/components/ProductForm/styles.tsx +1 -1
- package/src/components/SingleProductCard/index.tsx +1 -1
- package/src/components/TaxInformation/index.tsx +58 -26
- package/src/components/UpsellingProducts/index.tsx +13 -31
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/ProductDetails.tsx +55 -0
- package/src/types/index.tsx +2 -0
- package/src/types/react-native-color-matrix-image-filters/index.d.ts +1 -0
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/doordash/src/components/ProductForm/index.tsx +41 -2
- package/themes/doordash/src/components/ProductForm/styles.tsx +1 -1
- package/themes/instacart/src/components/ProductForm/index.tsx +40 -1
- package/themes/instacart/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/Cart/index.tsx +14 -21
- package/themes/kiosk/src/components/CartItem/index.tsx +9 -7
- package/themes/kiosk/src/components/CustomerName/index.tsx +2 -1
- package/themes/kiosk/src/components/Intro/index.tsx +4 -4
- package/themes/kiosk/src/components/OptionCard/index.tsx +11 -6
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +46 -44
- package/themes/original/index.tsx +4 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +37 -34
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +35 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +16 -47
- package/themes/original/src/components/Cart/index.tsx +10 -31
- package/themes/original/src/components/Checkout/index.tsx +2 -0
- package/themes/original/src/components/Checkout/styles.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +3 -3
- package/themes/original/src/components/DriverTips/styles.tsx +5 -5
- package/themes/original/src/components/FacebookLogin/index.tsx +20 -5
- package/themes/original/src/components/Help/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +5 -3
- package/themes/original/src/components/LoginForm/index.tsx +50 -49
- package/themes/original/src/components/MessageListing/index.tsx +4 -2
- package/themes/original/src/components/OrderDetails/index.tsx +3 -1
- package/themes/original/src/components/OrderSummary/index.tsx +11 -30
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -6
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -0
- package/themes/original/src/components/ProductForm/index.tsx +113 -88
- package/themes/original/src/components/ProductForm/styles.tsx +10 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +22 -13
- package/themes/original/src/components/SingleProductCard/styles.tsx +6 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +84 -86
- package/themes/original/src/types/index.tsx +7 -1
- package/themes/uber-eats/src/components/ProductForm/index.tsx +43 -2
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
ProductComment,
|
|
28
28
|
ProductActions
|
|
29
29
|
} from './styles'
|
|
30
|
-
import { OButton, OInput, OText } from '../shared'
|
|
30
|
+
import { OButton, OIcon, OInput, OText } from '../shared'
|
|
31
31
|
import { ProductOptionSubOption } from '../ProductOptionSubOption'
|
|
32
32
|
import { NotFoundSource } from '../NotFoundSource'
|
|
33
33
|
import { Placeholder,PlaceholderLine,Fade } from 'rn-placeholder'
|
|
@@ -52,13 +52,12 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
52
52
|
handleChangeSuboptionState,
|
|
53
53
|
handleChangeCommentState,
|
|
54
54
|
productObject,
|
|
55
|
-
onClose,
|
|
56
55
|
businessSlug
|
|
57
56
|
} = props
|
|
58
57
|
|
|
59
58
|
const theme = useTheme();
|
|
60
59
|
|
|
61
|
-
const [{ parsePrice }] = useUtils()
|
|
60
|
+
const [{ optimizeImage, parsePrice }] = useUtils()
|
|
62
61
|
const [, t] = useLanguage()
|
|
63
62
|
const [orderState] = useOrder()
|
|
64
63
|
const [{ auth }] = useSession()
|
|
@@ -84,7 +83,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
const handleRedirectLogin = (product : any) => {
|
|
87
|
-
onClose()
|
|
88
86
|
navigation.navigate('Login', {product: {businessId: product?.businessId, id: product?.id, categoryId: product?.categoryId, slug: businessSlug} })
|
|
89
87
|
}
|
|
90
88
|
|
|
@@ -110,7 +108,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
110
108
|
name="x"
|
|
111
109
|
size={35}
|
|
112
110
|
style={{ color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)' }}
|
|
113
|
-
onPress={
|
|
111
|
+
onPress={props.handleGoBack}
|
|
114
112
|
/>
|
|
115
113
|
</View>
|
|
116
114
|
</TopHeader>
|
|
@@ -134,26 +132,26 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
134
132
|
<View style={{ flexDirection: 'column', width: '100%' }}>
|
|
135
133
|
<View style={{ flexDirection: 'row', marginTop: 15 }}>
|
|
136
134
|
<OText size={20} style={{ flex: I18nManager.isRTL ? 0 : 1, marginBottom: 10 }}>{product?.name || productCart.name}{' '}</OText>
|
|
137
|
-
{product?.calories && (
|
|
135
|
+
{!!product?.calories && (
|
|
138
136
|
<OText size={16} style={styles.caloriesStyle}>{product?.calories} cal</OText>
|
|
139
137
|
)}
|
|
140
138
|
</View>
|
|
141
139
|
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
142
140
|
<OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
|
|
143
|
-
{product?.offer_price && (
|
|
141
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
144
142
|
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
145
143
|
)}
|
|
146
144
|
</View>
|
|
147
|
-
{(product?.estimated_person || (product?.sku && product?.sku !== '-1' && product?.sku !== '1')) && (
|
|
145
|
+
{(!!product?.estimated_person || (!!product?.sku && product?.sku !== '-1' && product?.sku !== '1')) && (
|
|
148
146
|
<OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0, marginBottom: 10 }} color={'#909BA9'}>
|
|
149
147
|
{
|
|
150
148
|
((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
|
|
151
149
|
&& <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
|
|
152
150
|
}
|
|
153
|
-
{product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
|
|
151
|
+
{!!product?.sku && product?.sku !== '-1' && product?.sku !== '1' && !!product?.estimated_person && (
|
|
154
152
|
<> · </>
|
|
155
153
|
)}
|
|
156
|
-
{product?.estimated_person
|
|
154
|
+
{!!product?.estimated_person
|
|
157
155
|
&& <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
|
|
158
156
|
}
|
|
159
157
|
</OText>
|
|
@@ -165,6 +163,31 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
165
163
|
<ProductDescription>
|
|
166
164
|
<OText>{product?.description || productCart?.description}</OText>
|
|
167
165
|
</ProductDescription>
|
|
166
|
+
<ScrollView
|
|
167
|
+
horizontal
|
|
168
|
+
showsHorizontalScrollIndicator={false}
|
|
169
|
+
contentContainerStyle={{ paddingBottom: 20 }}
|
|
170
|
+
>
|
|
171
|
+
{product?.tags?.map((tag: any) => (
|
|
172
|
+
<View
|
|
173
|
+
key={tag.id}
|
|
174
|
+
style={styles.productTagWrapper}
|
|
175
|
+
>
|
|
176
|
+
{tag?.image ? (
|
|
177
|
+
<OIcon
|
|
178
|
+
url={optimizeImage(tag?.image, 'h_40,c_limit')}
|
|
179
|
+
style={styles.productTagImageStyle}
|
|
180
|
+
/>
|
|
181
|
+
) : (
|
|
182
|
+
<OIcon
|
|
183
|
+
src={theme.images?.dummies?.product}
|
|
184
|
+
style={styles.productTagImageStyle}
|
|
185
|
+
/>
|
|
186
|
+
)}
|
|
187
|
+
<OText size={14} style={styles.productTagNameStyle}>{tag.name}</OText>
|
|
188
|
+
</View>
|
|
189
|
+
))}
|
|
190
|
+
</ScrollView>
|
|
168
191
|
{loading && !product ? (
|
|
169
192
|
<>
|
|
170
193
|
{[...Array(2)].map((item, i) => (
|
|
@@ -391,6 +414,20 @@ const styles = StyleSheet.create({
|
|
|
391
414
|
},
|
|
392
415
|
caloriesStyle: {
|
|
393
416
|
color: '#808080'
|
|
417
|
+
},
|
|
418
|
+
productTagWrapper: {
|
|
419
|
+
flexDirection: 'row',
|
|
420
|
+
alignItems: 'center'
|
|
421
|
+
},
|
|
422
|
+
productTagImageStyle: {
|
|
423
|
+
width: 32,
|
|
424
|
+
height: 32,
|
|
425
|
+
borderRadius: 8,
|
|
426
|
+
resizeMode: 'cover'
|
|
427
|
+
},
|
|
428
|
+
productTagNameStyle: {
|
|
429
|
+
paddingHorizontal: 6,
|
|
430
|
+
marginRight: 5
|
|
394
431
|
}
|
|
395
432
|
})
|
|
396
433
|
|
|
@@ -86,7 +86,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
86
86
|
<OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
|
|
87
87
|
<PricesContainer>
|
|
88
88
|
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
89
|
-
{product?.offer_price && (
|
|
89
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
90
90
|
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
91
91
|
)}
|
|
92
92
|
</PricesContainer>
|
|
@@ -1,51 +1,83 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { useLanguage
|
|
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
|
+
},
|
|
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
|
}
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
AddButton,
|
|
17
17
|
CloseUpselling
|
|
18
18
|
} from './styles'
|
|
19
|
-
import { ProductForm } from '../ProductForm';
|
|
20
19
|
import { useTheme } from 'styled-components/native'
|
|
21
20
|
|
|
22
21
|
const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
@@ -27,7 +26,9 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
27
26
|
handleUpsellingPage,
|
|
28
27
|
openUpselling,
|
|
29
28
|
canOpenUpselling,
|
|
30
|
-
setCanOpenUpselling
|
|
29
|
+
setCanOpenUpselling,
|
|
30
|
+
onRedirect,
|
|
31
|
+
setOpenUpselling
|
|
31
32
|
} = props
|
|
32
33
|
|
|
33
34
|
const theme = useTheme();
|
|
@@ -53,8 +54,6 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
53
54
|
}
|
|
54
55
|
})
|
|
55
56
|
|
|
56
|
-
const [actualProduct, setActualProduct] = useState<any>(null)
|
|
57
|
-
const [modalIsOpen, setModalIsOpen] = useState(false)
|
|
58
57
|
const [{ parsePrice }] = useUtils()
|
|
59
58
|
const [, t] = useLanguage()
|
|
60
59
|
|
|
@@ -71,13 +70,15 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
71
70
|
}, [upsellingProducts.loading, upsellingProducts?.products.length])
|
|
72
71
|
|
|
73
72
|
const handleFormProduct = (product: any) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
setOpenUpselling && setOpenUpselling(false)
|
|
74
|
+
onRedirect && onRedirect('ProductDetails', {
|
|
75
|
+
product: product,
|
|
76
|
+
businessId: product?.api?.businessId,
|
|
77
|
+
businessSlug: business.slug,
|
|
78
|
+
onAction: () => {
|
|
79
|
+
setOpenUpselling && setOpenUpselling(true)
|
|
80
|
+
}
|
|
81
|
+
})
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
const UpsellingLayout = () => {
|
|
@@ -132,13 +133,12 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
132
133
|
<>
|
|
133
134
|
{!canOpenUpselling || upsellingProducts?.products?.length === 0 ? null : (
|
|
134
135
|
<>
|
|
135
|
-
{!modalIsOpen && (
|
|
136
136
|
<OBottomPopup
|
|
137
137
|
title={t('WANT_SOMETHING_ELSE', 'Do you want something else?')}
|
|
138
138
|
open={openUpselling}
|
|
139
139
|
onClose={() => handleUpsellingPage()}
|
|
140
140
|
>
|
|
141
|
-
|
|
141
|
+
<UpsellingLayout />
|
|
142
142
|
<CloseUpselling>
|
|
143
143
|
<OButton
|
|
144
144
|
imgRightSrc=''
|
|
@@ -148,28 +148,10 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
148
148
|
/>
|
|
149
149
|
</CloseUpselling>
|
|
150
150
|
</OBottomPopup>
|
|
151
|
-
)}
|
|
152
151
|
</>
|
|
153
152
|
)}
|
|
154
153
|
</>
|
|
155
154
|
)}
|
|
156
|
-
<OModal
|
|
157
|
-
open={modalIsOpen}
|
|
158
|
-
onClose={() => setModalIsOpen(false)}
|
|
159
|
-
entireModal
|
|
160
|
-
customClose
|
|
161
|
-
isAvoidKeyBoardView
|
|
162
|
-
>
|
|
163
|
-
{actualProduct && (
|
|
164
|
-
<ProductForm
|
|
165
|
-
product={actualProduct}
|
|
166
|
-
businessId={actualProduct?.api?.businessId}
|
|
167
|
-
businessSlug={business.slug}
|
|
168
|
-
onSave={() => handleSaveProduct()}
|
|
169
|
-
onClose={() => setModalIsOpen(false)}
|
|
170
|
-
/>
|
|
171
|
-
)}
|
|
172
|
-
</OModal>
|
|
173
155
|
</>
|
|
174
156
|
)
|
|
175
157
|
}
|
|
@@ -2,7 +2,7 @@ import styled from 'styled-components/native';
|
|
|
2
2
|
|
|
3
3
|
export const Container = styled.View`
|
|
4
4
|
width: 100%;
|
|
5
|
-
padding: 0
|
|
5
|
+
padding: 0 30px;
|
|
6
6
|
`
|
|
7
7
|
|
|
8
8
|
export const CountDownContainer = styled.View`
|
|
@@ -20,7 +20,6 @@ export const ResendSection = styled.View`
|
|
|
20
20
|
display: flex;
|
|
21
21
|
flex-direction: row;
|
|
22
22
|
justify-content: center;
|
|
23
|
-
flex-wrap: wrap;
|
|
24
23
|
`
|
|
25
24
|
|
|
26
25
|
export const WrappCountdown = styled.View`
|
|
@@ -21,6 +21,7 @@ import HelpOrder from '../pages/HelpOrder'
|
|
|
21
21
|
import HelpGuide from '../pages/HelpGuide'
|
|
22
22
|
import HelpAccountAndPayment from '../pages/HelpAccountAndPayment'
|
|
23
23
|
import Splash from '../pages/Splash';
|
|
24
|
+
import ProductDetails from '../pages/ProductDetails';
|
|
24
25
|
const Stack = createStackNavigator();
|
|
25
26
|
|
|
26
27
|
const HomeNavigator = (e : any) => {
|
|
@@ -101,6 +102,11 @@ const HomeNavigator = (e : any) => {
|
|
|
101
102
|
component={BusinessProductsList}
|
|
102
103
|
options={{ headerShown: false }}
|
|
103
104
|
/>
|
|
105
|
+
<Stack.Screen
|
|
106
|
+
name="ProductDetails"
|
|
107
|
+
component={ProductDetails}
|
|
108
|
+
options={{ headerShown: false }}
|
|
109
|
+
/>
|
|
104
110
|
<Stack.Screen
|
|
105
111
|
name="ReviewOrder"
|
|
106
112
|
component={ReviewOrder}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled, { useTheme } from 'styled-components/native';
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { ProductForm as ProductFormController } from '../components/ProductForm';
|
|
5
|
+
interface Props {
|
|
6
|
+
navigation: any;
|
|
7
|
+
route: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ProductDetails = (props: Props) => {
|
|
11
|
+
const theme = useTheme()
|
|
12
|
+
|
|
13
|
+
const productProps = {
|
|
14
|
+
...props,
|
|
15
|
+
isCartProduct: props.route.params?.isCartProduct,
|
|
16
|
+
isFromCheckout: props.route.params?.isFromCheckout,
|
|
17
|
+
productCart: props.route.params?.productCart,
|
|
18
|
+
product: props.route.params?.product,
|
|
19
|
+
businessSlug: props.route.params?.businessSlug,
|
|
20
|
+
businessId: props.route.params?.businessId,
|
|
21
|
+
categoryId: props.route.params?.categoryId,
|
|
22
|
+
productId: props.route.params?.productId,
|
|
23
|
+
onSave: props?.navigation?.canGoBack()
|
|
24
|
+
? () => { props.route.params?.onAction && props.route.params?.onAction(); props?.navigation?.goBack(); }
|
|
25
|
+
: () => { props.route.params?.onAction && props.route.params?.onAction(); props?.navigation?.navigate('BottomTab') }
|
|
26
|
+
,
|
|
27
|
+
handleGoBack: props?.navigation?.canGoBack()
|
|
28
|
+
? () => {
|
|
29
|
+
props.route.params?.onAction &&
|
|
30
|
+
props.route.params?.onAction();
|
|
31
|
+
props?.navigation?.goBack();
|
|
32
|
+
}
|
|
33
|
+
: (businessSlug: any) => {
|
|
34
|
+
props.route.params?.onAction &&
|
|
35
|
+
props.route.params?.onAction();
|
|
36
|
+
businessSlug
|
|
37
|
+
? props?.navigation.navigate('Business', { store: businessSlug })
|
|
38
|
+
: props?.navigation.navigate('BottomTab')
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const BusinessProductsListView = styled.SafeAreaView`
|
|
43
|
+
flex: 1;
|
|
44
|
+
background-color: ${theme.colors.backgroundPage};
|
|
45
|
+
padding-top: ${Platform.OS === 'ios' ? '0px' : '20px'};
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<BusinessProductsListView>
|
|
50
|
+
<ProductFormController {...productProps} />
|
|
51
|
+
</BusinessProductsListView>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default ProductDetails;
|
package/src/types/index.tsx
CHANGED
|
@@ -408,6 +408,8 @@ export interface UpsellingProductsParams {
|
|
|
408
408
|
isCustomMode?: boolean;
|
|
409
409
|
upsellingProducts?: any;
|
|
410
410
|
business?: any;
|
|
411
|
+
setOpenUpselling?: any;
|
|
412
|
+
onRedirect?: any;
|
|
411
413
|
businessId?: number;
|
|
412
414
|
cartProducts?: Array<any>;
|
|
413
415
|
handleUpsellingPage: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'react-native-color-matrix-image-filters'
|
|
@@ -410,8 +410,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
410
410
|
textInputProps={{
|
|
411
411
|
returnKeyType: 'next',
|
|
412
412
|
onSubmitEditing: () => inputRef?.current?.focus?.(),
|
|
413
|
-
style: { borderWidth: 0, fontSize: 12 }
|
|
414
|
-
maxLength: 10
|
|
413
|
+
style: { borderWidth: 0, fontSize: 12 }
|
|
415
414
|
}}
|
|
416
415
|
textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
|
|
417
416
|
/>
|
|
@@ -100,9 +100,23 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
100
100
|
zIndex: 0
|
|
101
101
|
},
|
|
102
102
|
closeButton: { width: 11, height: 32, backgroundColor: theme.colors.white, alignItems: 'center', justifyContent: 'center' },
|
|
103
|
-
quantityWrap: { width: 40, height: 24, alignItems: 'center', justifyContent: 'center', borderRadius: 7.6, backgroundColor: theme.colors.inputDisabled }
|
|
103
|
+
quantityWrap: { width: 40, height: 24, alignItems: 'center', justifyContent: 'center', borderRadius: 7.6, backgroundColor: theme.colors.inputDisabled },
|
|
104
|
+
productTagWrapper: {
|
|
105
|
+
flexDirection: 'row',
|
|
106
|
+
alignItems: 'center'
|
|
107
|
+
},
|
|
108
|
+
productTagImageStyle: {
|
|
109
|
+
width: 32,
|
|
110
|
+
height: 32,
|
|
111
|
+
borderRadius: 8,
|
|
112
|
+
resizeMode: 'cover'
|
|
113
|
+
},
|
|
114
|
+
productTagNameStyle: {
|
|
115
|
+
paddingHorizontal: 6,
|
|
116
|
+
marginRight: 5
|
|
117
|
+
}
|
|
104
118
|
})
|
|
105
|
-
const [{ parsePrice }] = useUtils()
|
|
119
|
+
const [{ optimizeImage, parsePrice }] = useUtils()
|
|
106
120
|
const [, t] = useLanguage()
|
|
107
121
|
const [orderState] = useOrder()
|
|
108
122
|
const [{ auth }] = useSession()
|
|
@@ -215,6 +229,31 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
215
229
|
<OText color={theme.colors.textSecondary}>{product?.description || productCart?.description}</OText>
|
|
216
230
|
</ProductDescription>
|
|
217
231
|
)}
|
|
232
|
+
<ScrollView
|
|
233
|
+
horizontal
|
|
234
|
+
showsHorizontalScrollIndicator={false}
|
|
235
|
+
contentContainerStyle={{ paddingBottom: 20 }}
|
|
236
|
+
>
|
|
237
|
+
{product?.tags?.map((tag: any) => (
|
|
238
|
+
<View
|
|
239
|
+
key={tag.id}
|
|
240
|
+
style={styles.productTagWrapper}
|
|
241
|
+
>
|
|
242
|
+
{tag?.image ? (
|
|
243
|
+
<OIcon
|
|
244
|
+
url={optimizeImage(tag?.image, 'h_40,c_limit')}
|
|
245
|
+
style={styles.productTagImageStyle}
|
|
246
|
+
/>
|
|
247
|
+
) : (
|
|
248
|
+
<OIcon
|
|
249
|
+
src={theme.images?.dummies?.product}
|
|
250
|
+
style={styles.productTagImageStyle}
|
|
251
|
+
/>
|
|
252
|
+
)}
|
|
253
|
+
<OText color={theme.colors.textSecondary} style={styles.productTagNameStyle}>{tag.name}</OText>
|
|
254
|
+
</View>
|
|
255
|
+
))}
|
|
256
|
+
</ScrollView>
|
|
218
257
|
{loading && !product ? (
|
|
219
258
|
<>
|
|
220
259
|
{[...Array(2)].map((item, i) => (
|
|
@@ -59,7 +59,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
59
59
|
|
|
60
60
|
const theme = useTheme();
|
|
61
61
|
|
|
62
|
-
const [{ parsePrice }] = useUtils()
|
|
62
|
+
const [{ optimizeImage, parsePrice }] = useUtils()
|
|
63
63
|
const [, t] = useLanguage()
|
|
64
64
|
const [orderState] = useOrder()
|
|
65
65
|
const [{ auth }] = useSession()
|
|
@@ -162,6 +162,31 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
162
162
|
<OText mBottom={7} style={{ ...theme.labels.small }} color={theme.colors.textSecondary}>{product?.description?.trim() || productCart?.description?.trim()}</OText>
|
|
163
163
|
</ProductDescription>
|
|
164
164
|
)}
|
|
165
|
+
<ScrollView
|
|
166
|
+
horizontal
|
|
167
|
+
showsHorizontalScrollIndicator={false}
|
|
168
|
+
contentContainerStyle={{ paddingBottom: 20 }}
|
|
169
|
+
>
|
|
170
|
+
{product?.tags?.map((tag: any) => (
|
|
171
|
+
<View
|
|
172
|
+
key={tag.id}
|
|
173
|
+
style={styles.productTagWrapper}
|
|
174
|
+
>
|
|
175
|
+
{tag?.image ? (
|
|
176
|
+
<OIcon
|
|
177
|
+
url={optimizeImage(tag?.image, 'h_40,c_limit')}
|
|
178
|
+
style={styles.productTagImageStyle}
|
|
179
|
+
/>
|
|
180
|
+
) : (
|
|
181
|
+
<OIcon
|
|
182
|
+
src={theme.images?.dummies?.product}
|
|
183
|
+
style={styles.productTagImageStyle}
|
|
184
|
+
/>
|
|
185
|
+
)}
|
|
186
|
+
<OText color={theme.colors.textSecondary} style={{ ...styles.productTagNameStyle, ...theme.labels.small}}>{tag.name}</OText>
|
|
187
|
+
</View>
|
|
188
|
+
))}
|
|
189
|
+
</ScrollView>
|
|
165
190
|
<View style={{ height: 16, backgroundColor: theme.colors.secundary, marginHorizontal: -40, marginBottom: 20 }} />
|
|
166
191
|
{loading && !product ? (
|
|
167
192
|
<>
|
|
@@ -392,6 +417,20 @@ const styles = StyleSheet.create({
|
|
|
392
417
|
paddingStart: 4,
|
|
393
418
|
paddingEnd: 4,
|
|
394
419
|
borderWidth: 1
|
|
420
|
+
},
|
|
421
|
+
productTagWrapper: {
|
|
422
|
+
flexDirection: 'row',
|
|
423
|
+
alignItems: 'center'
|
|
424
|
+
},
|
|
425
|
+
productTagImageStyle: {
|
|
426
|
+
width: 32,
|
|
427
|
+
height: 32,
|
|
428
|
+
borderRadius: 8,
|
|
429
|
+
resizeMode: 'cover'
|
|
430
|
+
},
|
|
431
|
+
productTagNameStyle: {
|
|
432
|
+
paddingHorizontal: 6,
|
|
433
|
+
marginRight: 5
|
|
395
434
|
}
|
|
396
435
|
})
|
|
397
436
|
|