ordering-ui-react-native 0.14.48 → 0.14.51
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/OrderDetails/index.tsx +1 -1
- package/themes/kiosk/src/components/CustomerName/index.tsx +87 -83
- package/themes/kiosk/src/components/Intro/index.tsx +78 -76
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/ProductForm/index.tsx +39 -42
- package/themes/kiosk/src/components/shared/OButton.tsx +18 -5
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -11
package/package.json
CHANGED
|
@@ -453,7 +453,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
453
453
|
{order?.offer_type === 1 ? (
|
|
454
454
|
<OText>
|
|
455
455
|
{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}{' '}
|
|
456
|
-
<
|
|
456
|
+
<OText>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
|
|
457
457
|
</OText>
|
|
458
458
|
) : (
|
|
459
459
|
<OText>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
|
|
@@ -24,7 +24,7 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
24
24
|
const [orientationState] = useDeviceOrientation();
|
|
25
25
|
|
|
26
26
|
const onSubmit = (values: any) => {
|
|
27
|
-
_setStoreData('customer_name', {customerName: values.name});
|
|
27
|
+
_setStoreData('customer_name', { customerName: values.name });
|
|
28
28
|
onProceedToPay()
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -52,27 +52,31 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
52
52
|
|
|
53
53
|
const goToBack = () => navigation?.goBack();
|
|
54
54
|
|
|
55
|
-
const submitButton
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
const submitButton = (
|
|
56
|
+
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
57
|
+
<OButton
|
|
58
|
+
text={t('PROCEED_TO_PAY', 'Proceed to Pay')}
|
|
59
|
+
onClick={handleSubmit(onSubmit)}
|
|
60
|
+
textStyle={{ color: theme.colors.primaryContrast, fontSize: 20 }}
|
|
61
|
+
parentStyle={{
|
|
62
|
+
height: orientationState?.orientation === PORTRAIT
|
|
63
|
+
? 50 : 100
|
|
64
|
+
}}
|
|
65
|
+
style={{
|
|
66
|
+
width: orientationState?.orientation === PORTRAIT
|
|
67
|
+
? orientationState?.dimensions.width * 0.5
|
|
68
|
+
: orientationState?.dimensions.width * 0.5
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
);
|
|
69
73
|
|
|
70
|
-
const skipButton
|
|
71
|
-
<View style={{flex:1,
|
|
74
|
+
const skipButton = (
|
|
75
|
+
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
72
76
|
<OButton
|
|
73
77
|
text={t('SKIP', 'Skip')}
|
|
74
78
|
onClick={onProceedToPay}
|
|
75
|
-
textStyle={{color: theme.colors.primary, fontSize: 20}}
|
|
79
|
+
textStyle={{ color: theme.colors.primary, fontSize: 20 }}
|
|
76
80
|
parentStyle={{
|
|
77
81
|
height: orientationState?.orientation === PORTRAIT
|
|
78
82
|
? 50 : 100
|
|
@@ -80,7 +84,7 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
80
84
|
style={{
|
|
81
85
|
backgroundColor: theme.colors.white,
|
|
82
86
|
width: orientationState?.orientation === PORTRAIT
|
|
83
|
-
? orientationState?.dimensions.width
|
|
87
|
+
? orientationState?.dimensions.width * 0.2
|
|
84
88
|
: orientationState?.dimensions.width * 0.1,
|
|
85
89
|
}}
|
|
86
90
|
/>
|
|
@@ -89,78 +93,78 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
89
93
|
|
|
90
94
|
return (
|
|
91
95
|
<>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
<Container>
|
|
97
|
+
<NavBar
|
|
98
|
+
title={t('YOUR_NAME', 'Your name')}
|
|
99
|
+
onActionLeft={goToBack}
|
|
100
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
101
|
+
/>
|
|
102
|
+
<View style={{
|
|
103
|
+
marginVertical: orientationState?.dimensions?.height * 0.08,
|
|
104
|
+
alignItems: 'center'
|
|
105
|
+
}}>
|
|
106
|
+
<OText
|
|
107
|
+
size={orientationState?.dimensions?.width * 0.05}
|
|
108
|
+
style={{ bottom: 20 }}
|
|
109
|
+
>
|
|
110
|
+
{t('WHATS_YOUR_NAME', "What's your name?")}
|
|
111
|
+
{/* <OText
|
|
108
112
|
size={orientationState?.dimensions?.width * 0.05}
|
|
109
113
|
weight={'700'}
|
|
110
114
|
>
|
|
111
115
|
{`${t('ORDER_BE_FOR', 'order be for?')}`}
|
|
112
116
|
</OText> */}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}}
|
|
125
|
-
value={value}
|
|
126
|
-
autoCapitalize="words"
|
|
127
|
-
autoCorrect={false}
|
|
128
|
-
onChange={(val: any) => onChange(val)}
|
|
129
|
-
onSubmitEditing={handleSubmit(onSubmit)}
|
|
130
|
-
/>
|
|
131
|
-
)}
|
|
132
|
-
name="name"
|
|
133
|
-
rules={{
|
|
134
|
-
required: t(
|
|
135
|
-
'VALIDATION_ERROR_REQUIRED',
|
|
136
|
-
'The field Customer Name is required',
|
|
137
|
-
).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
|
|
138
|
-
pattern: {
|
|
139
|
-
value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
|
|
140
|
-
message: t(
|
|
141
|
-
'INVALID_ERROR',
|
|
142
|
-
'Invalid name',
|
|
143
|
-
).replace('_attribute_', t('NAME', 'Name')),
|
|
144
|
-
}
|
|
117
|
+
</OText>
|
|
118
|
+
<Controller
|
|
119
|
+
control={control}
|
|
120
|
+
render={({ onChange, value }: any) => (
|
|
121
|
+
<OInput
|
|
122
|
+
placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
|
|
123
|
+
style={{
|
|
124
|
+
...styles.inputStyle,
|
|
125
|
+
width: orientationState?.orientation === PORTRAIT
|
|
126
|
+
? orientationState?.dimensions.width * 0.5
|
|
127
|
+
: orientationState?.dimensions.width * 0.5,
|
|
145
128
|
}}
|
|
146
|
-
|
|
129
|
+
value={value}
|
|
130
|
+
autoCapitalize="words"
|
|
131
|
+
autoCorrect={false}
|
|
132
|
+
onChange={(val: any) => onChange(val)}
|
|
133
|
+
onSubmitEditing={handleSubmit(onSubmit)}
|
|
147
134
|
/>
|
|
135
|
+
)}
|
|
136
|
+
name="name"
|
|
137
|
+
rules={{
|
|
138
|
+
required: t(
|
|
139
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
140
|
+
'The field Customer Name is required',
|
|
141
|
+
).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
|
|
142
|
+
pattern: {
|
|
143
|
+
value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
|
|
144
|
+
message: t(
|
|
145
|
+
'INVALID_ERROR',
|
|
146
|
+
'Invalid name',
|
|
147
|
+
).replace('_attribute_', t('NAME', 'Name')),
|
|
148
|
+
}
|
|
149
|
+
}}
|
|
150
|
+
defaultValue=""
|
|
151
|
+
/>
|
|
148
152
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
{orientationState?.orientation === LANDSCAPE && submitButton}
|
|
154
|
+
{orientationState?.orientation === LANDSCAPE && skipButton}
|
|
155
|
+
{(orientationState?.orientation === PORTRAIT) && (
|
|
156
|
+
<OSActions>
|
|
157
|
+
{submitButton}
|
|
158
|
+
</OSActions>
|
|
159
|
+
)}
|
|
160
|
+
{(orientationState?.orientation === PORTRAIT) && (
|
|
161
|
+
<OSActions>
|
|
162
|
+
{skipButton}
|
|
163
|
+
</OSActions>
|
|
164
|
+
)}
|
|
165
|
+
</View>
|
|
166
|
+
</Container>
|
|
167
|
+
</>
|
|
164
168
|
);
|
|
165
169
|
};
|
|
166
170
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { StyleSheet, View, RefreshControl, ScrollView } from 'react-native';
|
|
2
|
+
import { StyleSheet, View, RefreshControl, ScrollView, Pressable } from 'react-native';
|
|
3
3
|
import { useLanguage } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
|
|
@@ -41,64 +41,15 @@ const Intro = (props: any): React.ReactElement => {
|
|
|
41
41
|
/>
|
|
42
42
|
}
|
|
43
43
|
>
|
|
44
|
-
<
|
|
45
|
-
{orientationState.orientation ===
|
|
46
|
-
|
|
47
|
-
style={{
|
|
48
|
-
height: orientationState?.dimensions?.height - _offset,
|
|
49
|
-
padding: 4,
|
|
50
|
-
justifyContent: 'space-around',
|
|
51
|
-
alignItems: 'center'
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
<OImage
|
|
55
|
-
source={theme.images.logos.logotype}
|
|
56
|
-
width={(orientationState?.dimensions?.width * 0.4) - _offset}
|
|
57
|
-
height={orientationState?.dimensions?.height * 0.1}
|
|
58
|
-
/>
|
|
59
|
-
|
|
60
|
-
<OImage
|
|
61
|
-
source={theme.images.general.homeHero}
|
|
62
|
-
width={orientationState?.dimensions?.width}
|
|
63
|
-
height={orientationState?.dimensions?.height * 0.6}
|
|
64
|
-
/>
|
|
65
|
-
|
|
66
|
-
<OButton
|
|
67
|
-
text={t('TOUCH_TO_ORDER', 'Touch to order')}
|
|
68
|
-
parentStyle={{
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
width: orientationState?.dimensions?.width - _offset
|
|
71
|
-
}}
|
|
72
|
-
onClick={goBusiness}
|
|
73
|
-
/>
|
|
74
|
-
<LanguageSelector />
|
|
75
|
-
</View>
|
|
76
|
-
) : (
|
|
77
|
-
<View
|
|
78
|
-
style={{
|
|
79
|
-
flexDirection: 'row',
|
|
80
|
-
justifyContent: 'flex-start',
|
|
81
|
-
alignItems: 'center',
|
|
82
|
-
padding: 0,
|
|
83
|
-
margin: 0
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<OImage
|
|
87
|
-
source={theme.images.general.homeHeroLandscape}
|
|
88
|
-
width={orientationState?.dimensions?.width * 0.40}
|
|
89
|
-
height={orientationState?.dimensions?.height * 1.1}
|
|
90
|
-
style={{ bottom: 100, right: 100 }}
|
|
91
|
-
resizeMode='cover'
|
|
92
|
-
/>
|
|
93
|
-
|
|
44
|
+
<Pressable onPress={goBusiness}>
|
|
45
|
+
<Container nopadding={orientationState.orientation === LANDSCAPE}>
|
|
46
|
+
{orientationState.orientation === PORTRAIT ? (
|
|
94
47
|
<View
|
|
95
48
|
style={{
|
|
96
|
-
height: orientationState?.dimensions?.height,
|
|
97
|
-
|
|
49
|
+
height: orientationState?.dimensions?.height - _offset,
|
|
50
|
+
padding: 4,
|
|
98
51
|
justifyContent: 'space-around',
|
|
99
|
-
alignItems: 'center'
|
|
100
|
-
paddingBottom: '5%',
|
|
101
|
-
paddingTop: '10%',
|
|
52
|
+
alignItems: 'center'
|
|
102
53
|
}}
|
|
103
54
|
>
|
|
104
55
|
<OImage
|
|
@@ -107,31 +58,82 @@ const Intro = (props: any): React.ReactElement => {
|
|
|
107
58
|
height={orientationState?.dimensions?.height * 0.1}
|
|
108
59
|
/>
|
|
109
60
|
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
61
|
+
<OImage
|
|
62
|
+
source={theme.images.general.homeHero}
|
|
63
|
+
width={orientationState?.dimensions?.width}
|
|
64
|
+
height={orientationState?.dimensions?.height * 0.6}
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
<OButton
|
|
68
|
+
text={t('TOUCH_ANYWHERE_TO_ORDER', 'Touch anywhere to order')}
|
|
69
|
+
parentStyle={{
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
width: orientationState?.dimensions?.width - _offset
|
|
72
|
+
}}
|
|
73
|
+
onClick={goBusiness}
|
|
74
|
+
/>
|
|
75
|
+
<LanguageSelector />
|
|
76
|
+
</View>
|
|
77
|
+
) : (
|
|
78
|
+
<View
|
|
79
|
+
style={{
|
|
80
|
+
flexDirection: 'row',
|
|
81
|
+
justifyContent: 'flex-start',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
padding: 0,
|
|
84
|
+
margin: 0
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<OImage
|
|
88
|
+
source={theme.images.general.homeHeroLandscape}
|
|
89
|
+
width={orientationState?.dimensions?.width * 0.40}
|
|
90
|
+
height={orientationState?.dimensions?.height * 1.1}
|
|
91
|
+
style={{ bottom: 100, right: 100 }}
|
|
92
|
+
resizeMode='cover'
|
|
93
|
+
/>
|
|
114
94
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
95
|
+
<View
|
|
96
|
+
style={{
|
|
97
|
+
height: orientationState?.dimensions?.height,
|
|
98
|
+
width: '50%',
|
|
99
|
+
justifyContent: 'space-around',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
paddingBottom: '5%',
|
|
102
|
+
paddingTop: '10%',
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
<OImage
|
|
106
|
+
source={theme.images.logos.logotype}
|
|
107
|
+
width={(orientationState?.dimensions?.width * 0.4) - _offset}
|
|
108
|
+
height={orientationState?.dimensions?.height * 0.1}
|
|
123
109
|
/>
|
|
124
|
-
|
|
110
|
+
|
|
111
|
+
<View style={{
|
|
112
|
+
justifyContent: 'space-around',
|
|
113
|
+
alignItems: 'center'
|
|
114
|
+
}}>
|
|
115
|
+
|
|
116
|
+
<OButton
|
|
117
|
+
style={styles.buttonLandStyle}
|
|
118
|
+
text={t('TOUCH_ANYWHERE_TO_ORDER', 'Touch anywhere to order')}
|
|
119
|
+
parentStyle={{
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
width: orientationState?.dimensions?.width - _offset
|
|
122
|
+
}}
|
|
123
|
+
onClick={goBusiness}
|
|
124
|
+
/>
|
|
125
|
+
<LanguageSelector />
|
|
126
|
+
</View>
|
|
125
127
|
</View>
|
|
126
128
|
</View>
|
|
127
|
-
|
|
128
|
-
)}
|
|
129
|
+
)}
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
<LogoutPopup
|
|
132
|
+
open={showLogoutPopup}
|
|
133
|
+
onClose={() => setShowLogoutPopup(false)}
|
|
134
|
+
/>
|
|
135
|
+
</Container>
|
|
136
|
+
</Pressable>
|
|
135
137
|
</ScrollView>
|
|
136
138
|
);
|
|
137
139
|
};
|
|
@@ -5,7 +5,6 @@ import { ImageStyle, TextStyle, View, Platform } from 'react-native'
|
|
|
5
5
|
import { OrderTypeSelector } from '../OrderTypeSelector'
|
|
6
6
|
import { useConfig, useLanguage } from 'ordering-components/native'
|
|
7
7
|
import { useTheme } from 'styled-components/native'
|
|
8
|
-
|
|
9
8
|
const Wrapper = styled.View`
|
|
10
9
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
11
10
|
padding: 10px 0px 20px 0px;
|
|
@@ -65,27 +64,28 @@ const NavBar = (props: Props) => {
|
|
|
65
64
|
|
|
66
65
|
return (
|
|
67
66
|
<Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
|
|
68
|
-
{(props?.onActionLeft
|
|
67
|
+
{(props?.onActionLeft) && (
|
|
69
68
|
<OButton
|
|
70
|
-
imgLeftSrc={props.leftImg
|
|
69
|
+
imgLeftSrc={props.leftImg}
|
|
71
70
|
imgRightSrc={null}
|
|
72
71
|
style={{ ...btnBackArrow, ...props.btnStyle }}
|
|
73
72
|
onClick={props.onActionLeft}
|
|
74
|
-
imgLeftStyle=
|
|
73
|
+
imgLeftStyle={props.imgLeftStyle}
|
|
74
|
+
{...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
|
|
75
75
|
/>)
|
|
76
76
|
}
|
|
77
77
|
<TitleTopWrapper>
|
|
78
78
|
{props.withIcon
|
|
79
79
|
? (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
<OIcon
|
|
81
|
+
url={props.icon}
|
|
82
|
+
style={{
|
|
83
|
+
borderColor: theme.colors.lightGray,
|
|
84
|
+
borderRadius: 20,
|
|
85
|
+
}}
|
|
86
|
+
width={60}
|
|
87
|
+
height={60}
|
|
88
|
+
/>
|
|
89
89
|
)
|
|
90
90
|
: null
|
|
91
91
|
}
|
|
@@ -125,7 +125,7 @@ const NavBar = (props: Props) => {
|
|
|
125
125
|
</View>
|
|
126
126
|
)}
|
|
127
127
|
|
|
128
|
-
{
|
|
128
|
+
{props.rightComponent}
|
|
129
129
|
</Wrapper>
|
|
130
130
|
)
|
|
131
131
|
}
|
|
@@ -69,7 +69,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
69
69
|
|
|
70
70
|
const { product, loading, error } = productObject;
|
|
71
71
|
|
|
72
|
-
const HEADER_EXPANDED_HEIGHT =
|
|
72
|
+
const HEADER_EXPANDED_HEIGHT = Platform.OS === 'ios' ? orientationState?.dimensions?.height * 0.65 : orientationState?.dimensions?.height * 0.4;
|
|
73
73
|
const HEADER_COLLAPSED_HEIGHT = orientationState?.dimensions?.height * 0.2;
|
|
74
74
|
|
|
75
75
|
const isError = (id: number) => {
|
|
@@ -100,35 +100,35 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
100
100
|
const saveErrors = orderState.loading || maxProductQuantity === 0 || Object.keys(errors)?.length > 0
|
|
101
101
|
|
|
102
102
|
const [scrollY] = useState(new Animated.Value(0));
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
const headerHeight = scrollY.interpolate({
|
|
105
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
105
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
106
106
|
outputRange: [HEADER_EXPANDED_HEIGHT, HEADER_COLLAPSED_HEIGHT],
|
|
107
107
|
extrapolate: 'clamp'
|
|
108
108
|
});
|
|
109
109
|
const heroContainerOpacity = scrollY.interpolate({
|
|
110
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
110
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
111
111
|
outputRange: [1, 0],
|
|
112
112
|
extrapolate: 'clamp'
|
|
113
113
|
});
|
|
114
114
|
const heroTranslateY = scrollY.interpolate({
|
|
115
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
116
|
-
outputRange: [0, -(HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT)],
|
|
115
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
116
|
+
outputRange: [0, -(HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT)],
|
|
117
117
|
extrapolate: 'clamp'
|
|
118
118
|
});
|
|
119
119
|
const navBar1ContainerOpacity = scrollY.interpolate({
|
|
120
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
120
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
121
121
|
outputRange: [1, 0],
|
|
122
122
|
extrapolate: 'clamp'
|
|
123
123
|
});
|
|
124
124
|
const navBar2ContainerOpacity = scrollY.interpolate({
|
|
125
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
125
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
126
126
|
outputRange: [0, 1],
|
|
127
127
|
extrapolate: 'clamp'
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
const collapsedBarContainerOpacity = scrollY.interpolate({
|
|
131
|
-
inputRange: [HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT - ((HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT) * 0.08), HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
131
|
+
inputRange: [HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT - ((HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT) * 0.08), HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
132
132
|
outputRange: [0, 1],
|
|
133
133
|
extrapolate: 'clamp'
|
|
134
134
|
});
|
|
@@ -223,7 +223,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
223
223
|
shadow: {
|
|
224
224
|
shadowColor: '#000',
|
|
225
225
|
shadowOffset: { width: 1, height: 1 },
|
|
226
|
-
shadowOpacity:
|
|
226
|
+
shadowOpacity: 0.4,
|
|
227
227
|
shadowRadius: 3,
|
|
228
228
|
elevation: 5,
|
|
229
229
|
}
|
|
@@ -235,33 +235,31 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
235
235
|
style={styles.mainContainer}
|
|
236
236
|
contentContainerStyle={styles.scrollContainer}
|
|
237
237
|
onScroll={Animated.event(
|
|
238
|
-
[{ nativeEvent: { contentOffset: { y: scrollY }} }],
|
|
239
|
-
{useNativeDriver: false})
|
|
238
|
+
[{ nativeEvent: { contentOffset: { y: scrollY } } }],
|
|
239
|
+
{ useNativeDriver: false })
|
|
240
240
|
}
|
|
241
241
|
scrollEventThrottle={16}
|
|
242
242
|
>
|
|
243
243
|
<Animated.View style={[styles.header, { height: headerHeight }]}>
|
|
244
244
|
{!isDrawer && (<Animated.View style={{ opacity: navBar1ContainerOpacity }}>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
</Animated.View>
|
|
245
|
+
<NavBar
|
|
246
|
+
{...navBarProps}
|
|
247
|
+
titleColor={theme.colors.white}
|
|
248
|
+
btnStyle={{
|
|
249
|
+
width: 66,
|
|
250
|
+
height: 66,
|
|
251
|
+
backgroundColor: 'black',
|
|
252
|
+
borderRadius: 100,
|
|
253
|
+
color: 'white',
|
|
254
|
+
opacity: 0.8,
|
|
255
|
+
left: 20,
|
|
256
|
+
}}
|
|
257
|
+
/>
|
|
258
|
+
</Animated.View>
|
|
260
259
|
)}
|
|
261
260
|
<Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
|
|
262
261
|
<NavBar
|
|
263
262
|
{...navBarProps}
|
|
264
|
-
{...((navigation || onClose) && { leftImg: theme.images.general.arrow_left })}
|
|
265
263
|
btnStyle={{
|
|
266
264
|
width: 55,
|
|
267
265
|
height: 55,
|
|
@@ -269,7 +267,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
269
267
|
borderRadius: 100,
|
|
270
268
|
left: 20,
|
|
271
269
|
}}
|
|
272
|
-
imgLeftStyle={{ width: 27, height: 27 }}
|
|
273
270
|
/>
|
|
274
271
|
</Animated.View>
|
|
275
272
|
|
|
@@ -288,7 +285,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
288
285
|
}}
|
|
289
286
|
>
|
|
290
287
|
<OImage
|
|
291
|
-
source={{uri: product?.images}}
|
|
288
|
+
source={{ uri: product?.images }}
|
|
292
289
|
width={70}
|
|
293
290
|
height={70}
|
|
294
291
|
resizeMode="cover"
|
|
@@ -319,7 +316,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
319
316
|
opacity: heroContainerOpacity,
|
|
320
317
|
position: 'absolute',
|
|
321
318
|
zIndex: -100,
|
|
322
|
-
transform: [{translateY: heroTranslateY }],
|
|
319
|
+
transform: [{ translateY: heroTranslateY }],
|
|
323
320
|
}}>
|
|
324
321
|
<View
|
|
325
322
|
style={{
|
|
@@ -330,13 +327,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
330
327
|
backgroundColor: 'rgba(24, 28, 50, 0.4)',
|
|
331
328
|
}}
|
|
332
329
|
>
|
|
333
|
-
<ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex:1, justifyContent: 'center' }} />
|
|
330
|
+
<ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex: 1, justifyContent: 'center' }} />
|
|
334
331
|
|
|
335
332
|
</View>
|
|
336
333
|
|
|
337
334
|
<Animated.View
|
|
338
335
|
style={{
|
|
339
|
-
transform: [{translateY: heroTranslateY }],
|
|
336
|
+
transform: [{ translateY: heroTranslateY }],
|
|
340
337
|
width: orientationState?.dimensions?.width * 0.75,
|
|
341
338
|
height: HEADER_EXPANDED_HEIGHT / 2,
|
|
342
339
|
position: 'relative',
|
|
@@ -347,7 +344,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
347
344
|
>
|
|
348
345
|
<OText
|
|
349
346
|
color={theme.colors.white}
|
|
350
|
-
size={orientationState?.dimensions?.width * 0.
|
|
347
|
+
size={orientationState?.dimensions?.width * 0.038}
|
|
351
348
|
weight="bold"
|
|
352
349
|
mBottom={10}
|
|
353
350
|
numberOfLines={2}
|
|
@@ -369,18 +366,18 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
369
366
|
<Spinner visible={loading} />
|
|
370
367
|
)} */}
|
|
371
368
|
{!loading && !error && product && (
|
|
372
|
-
<View style={{ paddingTop: isDrawer ? 10 : 20, paddingBottom: 80 }}>
|
|
369
|
+
<View style={{ paddingTop: isDrawer ? 10 : 20, paddingBottom: 80 }}>
|
|
373
370
|
<WrapContent isDrawer={isDrawer}>
|
|
374
371
|
<ProductDescription>
|
|
375
372
|
{(
|
|
376
373
|
(product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
|
|
377
374
|
(productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1')
|
|
378
|
-
) &&(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
375
|
+
) && (
|
|
376
|
+
<>
|
|
377
|
+
<OText size={20}>{t('SKU', 'Sku')}</OText>
|
|
378
|
+
<OText>{product?.sku || productCart?.sku}</OText>
|
|
379
|
+
</>
|
|
380
|
+
)}
|
|
384
381
|
</ProductDescription>
|
|
385
382
|
<ProductEditions>
|
|
386
383
|
{product?.ingredients.length > 0 && (
|
|
@@ -504,7 +501,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
504
501
|
</TouchableOpacity>
|
|
505
502
|
</View>
|
|
506
503
|
)}
|
|
507
|
-
<View style={{ width: isSoldOut || maxProductQuantity <= 0 ? '100%' : isDrawer ? '70%':'80%' }}>
|
|
504
|
+
<View style={{ width: isSoldOut || maxProductQuantity <= 0 ? '100%' : isDrawer ? '70%' : '80%' }}>
|
|
508
505
|
{productCart && !isSoldOut && maxProductQuantity > 0 && auth && orderState.options?.address_id && (
|
|
509
506
|
<OButton
|
|
510
507
|
onClick={() => handleSaveProduct()}
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import styled from 'styled-components/native';
|
|
13
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
14
|
+
import { Icon, IconProps } from 'react-native-vector-icons/Icon';
|
|
13
15
|
|
|
14
16
|
const StyledButton = styled.View<Props>`
|
|
15
17
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
@@ -77,17 +79,19 @@ interface Props {
|
|
|
77
79
|
isCircle?: boolean;
|
|
78
80
|
bgColor?: string;
|
|
79
81
|
borderColor?: string;
|
|
82
|
+
iconProps?: IconProps;
|
|
83
|
+
IconCustom?: React.FunctionComponent
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
const OButton = (props: Props): React.ReactElement => {
|
|
83
87
|
if (props.isDisabled) {
|
|
84
88
|
return (
|
|
85
89
|
<View style={props.parentStyle}>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
<StyledButtonDisabled style={props.style}>
|
|
91
|
+
<StyledTextDisabled style={props.disabledTextStyle ? props.disabledTextStyle : props.textStyle}>
|
|
92
|
+
{props.text}
|
|
93
|
+
</StyledTextDisabled>
|
|
94
|
+
</StyledButtonDisabled>
|
|
91
95
|
</View>
|
|
92
96
|
);
|
|
93
97
|
}
|
|
@@ -111,6 +115,15 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
111
115
|
{props.imgLeftSrc ? (
|
|
112
116
|
<StyledImage style={props.imgLeftStyle} source={props.imgLeftSrc} />
|
|
113
117
|
) : null}
|
|
118
|
+
{props.iconProps ? (
|
|
119
|
+
<>
|
|
120
|
+
{props?.IconCustom ? (
|
|
121
|
+
<props.IconCustom {...props.iconProps} />
|
|
122
|
+
) : (
|
|
123
|
+
<AntDesignIcon {...props.iconProps} />
|
|
124
|
+
)}
|
|
125
|
+
</>
|
|
126
|
+
) : null}
|
|
114
127
|
{props.text ? (
|
|
115
128
|
<StyledText style={props.textStyle}>{props.text}</StyledText>
|
|
116
129
|
) : null}
|
|
@@ -33,8 +33,8 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
33
33
|
canOpenUpselling,
|
|
34
34
|
setCanOpenUpselling,
|
|
35
35
|
isFromCart,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
onNavigationRedirect,
|
|
37
|
+
onGoBack
|
|
38
38
|
} = props
|
|
39
39
|
|
|
40
40
|
const theme = useTheme();
|
|
@@ -71,16 +71,16 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
71
71
|
const [, t] = useLanguage()
|
|
72
72
|
const { bottom } = useSafeAreaInsets()
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
const cart = carts?.[`businessId:${props.businessId}`] ?? {}
|
|
75
|
+
const cartProducts = cart?.products?.length
|
|
76
|
+
? cart?.products.map((product: any) => product.id)
|
|
77
|
+
: []
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
const productsList = !upsellingProducts.loading && !upsellingProducts.error
|
|
80
|
+
? upsellingProducts?.products?.length
|
|
81
|
+
? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
|
|
82
|
+
: (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
|
|
83
|
+
: []
|
|
84
84
|
|
|
85
85
|
useEffect(() => {
|
|
86
86
|
if (!isCustomMode && !props.products) {
|
|
@@ -94,6 +94,10 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
94
94
|
}
|
|
95
95
|
}, [upsellingProducts.loading, upsellingProducts?.products.length])
|
|
96
96
|
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
Object.keys(cart).length === 0 && onNavigationRedirect && onNavigationRedirect('MyOrders')
|
|
99
|
+
}, [cart])
|
|
100
|
+
|
|
97
101
|
const handleFormProduct = (product: any) => {
|
|
98
102
|
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
99
103
|
product: product,
|