ordering-ui-react-native 0.14.34 → 0.14.35-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/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 +6 -8
- package/src/components/SingleProductCard/index.tsx +1 -1
- package/src/components/StripeElementsForm/index.tsx +28 -13
- 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/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 -35
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +35 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +22 -49
- package/themes/original/src/components/BusinessesListing/index.tsx +100 -75
- 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/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/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 +6 -2
- package/themes/original/src/components/ProductForm/index.tsx +67 -77
- package/themes/original/src/components/ProductForm/styles.tsx +9 -2
- 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/StripeElementsForm/index.tsx +28 -13
- package/themes/original/src/components/UpsellingProducts/index.tsx +85 -83
- package/themes/original/src/types/index.tsx +6 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import { ImageSourcePropType, ImageStyle, TextStyle, ViewStyle, ActivityIndicator } from 'react-native';
|
|
3
3
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
@@ -28,11 +28,15 @@ const OptionCard = (props: Props) => {
|
|
|
28
28
|
<ActivityIndicator size='large' color='#ffffff' />
|
|
29
29
|
</ActivityIndicatorContainer>
|
|
30
30
|
)}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
{props.icon && (
|
|
32
|
+
<OIcon
|
|
33
|
+
src={props.icon}
|
|
34
|
+
style={{ marginBottom: 10, ...props?.iconStyle }}
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
37
|
+
{props.VectorIcon && (
|
|
38
|
+
<props.VectorIcon />
|
|
39
|
+
)}
|
|
36
40
|
<OText
|
|
37
41
|
weight="700"
|
|
38
42
|
color="white"
|
|
@@ -97,6 +101,7 @@ interface Props {
|
|
|
97
101
|
callToActionTextStyle?: TextStyle;
|
|
98
102
|
callToActionIcon?: ImageSourcePropType;
|
|
99
103
|
callToActionIconStyle?: ImageStyle;
|
|
104
|
+
VectorIcon?: FunctionComponent;
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
export default OptionCard;
|
|
@@ -19,6 +19,8 @@ import Spinner from 'react-native-loading-spinner-overlay';
|
|
|
19
19
|
import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
20
20
|
import GridContainer from '../../layouts/GridContainer';
|
|
21
21
|
import { OModal, PaymentOptionStripe } from '../../../../../src';
|
|
22
|
+
import AntIconDesign from 'react-native-vector-icons/AntDesign'
|
|
23
|
+
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
22
24
|
|
|
23
25
|
const PaymentOptionsUI = (props: any) => {
|
|
24
26
|
const {
|
|
@@ -41,7 +43,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
41
43
|
} = props;
|
|
42
44
|
|
|
43
45
|
const theme = useTheme();
|
|
44
|
-
const [, {showToast}] = useToast();
|
|
46
|
+
const [, { showToast }] = useToast();
|
|
45
47
|
const [, t] = useLanguage();
|
|
46
48
|
const [orientationState] = useDeviceOrientation();
|
|
47
49
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -134,52 +136,52 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
134
136
|
CASH_ID:
|
|
135
137
|
cashIndex !== -1
|
|
136
138
|
? {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
style: cardStyle,
|
|
140
|
+
title: t('CASH', 'Cash'),
|
|
141
|
+
description: t(
|
|
142
|
+
'GO_FOR_YOR_RECEIPT_AND_GO_TO_THE_FRONT_COUNTER',
|
|
143
|
+
'Pay with cash in the front counter',
|
|
144
|
+
),
|
|
145
|
+
bgImage: theme.images.general.cash,
|
|
146
|
+
callToActionText: t('LETS_GO', 'LETS_GO'),
|
|
147
|
+
VectorIcon: () => <AntIconDesign name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
148
|
+
onClick: () =>
|
|
149
|
+
onSelectPaymethod(supportedMethods[cashIndex], false),
|
|
150
|
+
...supportedMethods[cashIndex],
|
|
151
|
+
}
|
|
150
152
|
: null,
|
|
151
153
|
|
|
152
154
|
CARD_ON_DELIVERY_ID:
|
|
153
155
|
cardOnDeliveryIndex !== -1
|
|
154
156
|
? {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
157
|
+
style: cardStyle,
|
|
158
|
+
title: t('CARD', supportedMethods[cardOnDeliveryIndex]?.name),
|
|
159
|
+
description: t(
|
|
160
|
+
'WE_ACCEPT_EVERY_DEBIT_OR_CREDIT_CARD',
|
|
161
|
+
'We accept every debit or credit card',
|
|
162
|
+
),
|
|
163
|
+
bgImage: theme.images.general.carddelivery,
|
|
164
|
+
callToActionText: t("LETS_GO", "Let's go"),
|
|
165
|
+
VectorIcon: () => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
166
|
+
onClick: () => onSelectPaymethod(supportedMethods[cardOnDeliveryIndex], false),
|
|
167
|
+
...supportedMethods[cardOnDeliveryIndex],
|
|
168
|
+
}
|
|
167
169
|
: null,
|
|
168
170
|
STRIPE:
|
|
169
171
|
stripeIndex !== -1
|
|
170
172
|
? {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
173
|
+
style: cardStyle,
|
|
174
|
+
title: t('STRIPE', supportedMethods[stripeIndex]?.name),
|
|
175
|
+
description: t('STRIPE', 'Stripe'),
|
|
176
|
+
bgImage: theme.images.general.carddelivery,
|
|
177
|
+
callToActionText: t('INSERT_INFO', 'Test info'),
|
|
178
|
+
VectorIcon: () => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
179
|
+
onClick: () => {
|
|
180
|
+
onSelectPaymethod(supportedMethods[stripeIndex], false);
|
|
181
|
+
setIsOpenModal(true)
|
|
182
|
+
},
|
|
183
|
+
...supportedMethods[stripeIndex],
|
|
184
|
+
}
|
|
183
185
|
: null,
|
|
184
186
|
};
|
|
185
187
|
|
|
@@ -193,11 +195,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
193
195
|
<NavBar
|
|
194
196
|
title={t('PAYMENT_METHODS', 'Payment methods')}
|
|
195
197
|
onActionLeft={goToBack}
|
|
196
|
-
btnStyle={{paddingLeft: 0}}
|
|
198
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
197
199
|
/>
|
|
198
200
|
|
|
199
201
|
<View
|
|
200
|
-
style={{marginVertical: orientationState?.dimensions?.height * 0.03}}>
|
|
202
|
+
style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
|
|
201
203
|
<OText size={orientationState?.dimensions?.width * 0.048}>
|
|
202
204
|
{t('HOW_WOULD_YOU', 'How would you')} {'\n'}
|
|
203
205
|
<OText
|
|
@@ -209,10 +211,10 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
209
211
|
</View>
|
|
210
212
|
|
|
211
213
|
{supportedMethods?.length > 0 && (
|
|
212
|
-
<GridContainer style={{justifyContent: 'space-between'}}>
|
|
214
|
+
<GridContainer style={{ justifyContent: 'space-between' }}>
|
|
213
215
|
{propsOfItems.CARD_ON_DELIVERY_ID && (
|
|
214
|
-
<View style={{marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0}}>
|
|
215
|
-
<OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke/>
|
|
216
|
+
<View style={{ marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0 }}>
|
|
217
|
+
<OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke />
|
|
216
218
|
</View>
|
|
217
219
|
)}
|
|
218
220
|
|
|
@@ -249,7 +251,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
249
251
|
)}
|
|
250
252
|
</GridContainer>
|
|
251
253
|
)}
|
|
252
|
-
<View style={{height: orientationState?.dimensions?.height * 0.05}} />
|
|
254
|
+
<View style={{ height: orientationState?.dimensions?.height * 0.05 }} />
|
|
253
255
|
<OModal
|
|
254
256
|
open={isOpenModal}
|
|
255
257
|
onClose={() => setIsOpenModal(false)}
|
|
@@ -30,6 +30,8 @@ import { NotFoundSource } from './src/components/NotFoundSource';
|
|
|
30
30
|
import { OrderTypeSelector } from './src/components/OrderTypeSelector';
|
|
31
31
|
import { Wallets } from './src/components/Wallets';
|
|
32
32
|
import { PaymentOptionWallet } from './src/components/PaymentOptionWallet';
|
|
33
|
+
import { ProductForm } from './src/components/ProductForm';
|
|
34
|
+
import { UpsellingProducts } from './src/components/UpsellingProducts';
|
|
33
35
|
|
|
34
36
|
import { Toast } from './src/components/shared/OToast';
|
|
35
37
|
import {
|
|
@@ -90,6 +92,8 @@ export {
|
|
|
90
92
|
OrderTypeSelector,
|
|
91
93
|
Wallets,
|
|
92
94
|
PaymentOptionWallet,
|
|
95
|
+
ProductForm,
|
|
96
|
+
UpsellingProducts,
|
|
93
97
|
|
|
94
98
|
// OComponents
|
|
95
99
|
Toast,
|
|
@@ -139,17 +139,20 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
139
139
|
)}
|
|
140
140
|
</BIActions>
|
|
141
141
|
</BIHeader>
|
|
142
|
-
{!isActive && !isClosed && !!isProducts &&
|
|
142
|
+
{!isActive && !isClosed && !!isProducts && (
|
|
143
143
|
<PriceContainer>
|
|
144
144
|
<OText>{parsePrice(cart?.total)}</OText>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
{cart?.valid_products && (
|
|
146
|
+
<OButton
|
|
147
|
+
onClick={handleClickCheckout}
|
|
148
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
149
|
+
style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
150
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
151
|
+
bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
152
|
+
borderColor={theme.colors.primary}
|
|
153
|
+
isDisabled={checkoutButtonDisabled}
|
|
154
|
+
/>
|
|
155
|
+
)}
|
|
153
156
|
</PriceContainer>
|
|
154
157
|
)}
|
|
155
158
|
|
|
@@ -46,7 +46,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
46
46
|
const [menu, setMenu] = useState({})
|
|
47
47
|
const [timeList, setTimeList] = useState<any>([])
|
|
48
48
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
49
|
-
const [datesWhitelist, setDateWhitelist] = useState<any>([{start: null, end: null}])
|
|
49
|
+
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
50
50
|
|
|
51
51
|
const styles = StyleSheet.create({
|
|
52
52
|
container: {
|
|
@@ -54,19 +54,19 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
54
54
|
paddingVertical: 30,
|
|
55
55
|
paddingHorizontal: 40
|
|
56
56
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
businessLogo: {
|
|
58
|
+
backgroundColor: 'white',
|
|
59
|
+
width: 60,
|
|
60
|
+
height: 60,
|
|
61
|
+
borderRadius: 7.6,
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
shadowColor: '#000000',
|
|
65
|
+
shadowOffset: { width: 0, height: 1 },
|
|
66
|
+
shadowOpacity: 0.1,
|
|
67
|
+
shadowRadius: 1,
|
|
68
|
+
elevation: 2
|
|
69
|
+
},
|
|
70
70
|
selectOption: {
|
|
71
71
|
backgroundColor: theme.colors.backgroundGray100,
|
|
72
72
|
borderRadius: 7.6,
|
|
@@ -82,7 +82,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
82
82
|
paddingBottom: 15,
|
|
83
83
|
borderBottomWidth: 1,
|
|
84
84
|
borderColor: theme.colors.backgroundGray200,
|
|
85
|
-
height: 100
|
|
85
|
+
height: 100,
|
|
86
86
|
},
|
|
87
87
|
calendarHeaderContainer: {
|
|
88
88
|
flex: 1,
|
|
@@ -101,35 +101,36 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
101
101
|
dateNumber: {
|
|
102
102
|
color: '#B1BCCC',
|
|
103
103
|
fontSize: 16,
|
|
104
|
-
fontWeight: '500'
|
|
104
|
+
fontWeight: '500',
|
|
105
105
|
},
|
|
106
106
|
dateName: {
|
|
107
107
|
color: '#B1BCCC',
|
|
108
108
|
fontSize: 12,
|
|
109
|
-
textTransform: 'capitalize'
|
|
109
|
+
textTransform: 'capitalize',
|
|
110
110
|
},
|
|
111
111
|
highlightDateName: {
|
|
112
112
|
color: '#344050',
|
|
113
113
|
fontSize: 12,
|
|
114
|
-
textTransform: 'capitalize'
|
|
114
|
+
textTransform: 'capitalize',
|
|
115
115
|
},
|
|
116
116
|
highlightDateNumber: {
|
|
117
117
|
color: '#344050',
|
|
118
118
|
fontSize: 16,
|
|
119
|
-
textTransform: 'capitalize'
|
|
119
|
+
textTransform: 'capitalize',
|
|
120
120
|
},
|
|
121
121
|
disabledDateName: {
|
|
122
122
|
color: '#B1BCCC',
|
|
123
123
|
fontSize: 10,
|
|
124
124
|
textTransform: 'capitalize',
|
|
125
|
-
opacity: 1
|
|
125
|
+
opacity: 1,
|
|
126
126
|
},
|
|
127
127
|
disabledDateNumber: {
|
|
128
128
|
color: '#B1BCCC',
|
|
129
129
|
fontSize: 14,
|
|
130
|
-
fontWeight: '500'
|
|
130
|
+
fontWeight: '500',
|
|
131
|
+
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
+
})
|
|
133
134
|
|
|
134
135
|
const preorderTypeList = [
|
|
135
136
|
{ key: 'business_hours', name: t('BUSINESS_HOURS', 'Business hours') },
|
|
@@ -191,7 +192,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
191
192
|
|
|
192
193
|
const LeftSelector = () => {
|
|
193
194
|
return (
|
|
194
|
-
<View style={{height: '100%', justifyContent: 'flex-end'}}>
|
|
195
|
+
<View style={{ height: '100%', justifyContent: 'flex-end' }}>
|
|
195
196
|
<IconAntDesign
|
|
196
197
|
name='caretleft'
|
|
197
198
|
color={theme.colors.textNormal}
|
|
@@ -203,7 +204,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
203
204
|
|
|
204
205
|
const RightSelector = () => {
|
|
205
206
|
return (
|
|
206
|
-
<View style={{height: '100%', justifyContent: 'flex-end'}}>
|
|
207
|
+
<View style={{ height: '100%', justifyContent: 'flex-end' }}>
|
|
207
208
|
<IconAntDesign
|
|
208
209
|
name='caretright'
|
|
209
210
|
color={theme.colors.textNormal}
|
|
@@ -280,7 +281,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
280
281
|
name='close'
|
|
281
282
|
color={theme.colors.textThird}
|
|
282
283
|
size={24}
|
|
283
|
-
style={{ marginLeft: -4}}
|
|
284
|
+
style={{ marginLeft: -4 }}
|
|
284
285
|
/>
|
|
285
286
|
</TouchableOpacity>
|
|
286
287
|
<BusinessInfoWrapper>
|
|
@@ -294,8 +295,8 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
294
295
|
<FastImage
|
|
295
296
|
style={{ width: 59, height: 59 }}
|
|
296
297
|
source={{
|
|
297
|
-
|
|
298
|
-
|
|
298
|
+
uri: optimizeImage(business?.logo, 'h_60,c_limit'),
|
|
299
|
+
priority: FastImage.priority.normal,
|
|
299
300
|
}}
|
|
300
301
|
resizeMode={FastImage.resizeMode.cover}
|
|
301
302
|
/>
|
|
@@ -372,7 +373,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
372
373
|
setMenu={setMenu}
|
|
373
374
|
menu={menu}
|
|
374
375
|
/>
|
|
375
|
-
</MenuWrapper>
|
|
376
|
+
</MenuWrapper>
|
|
376
377
|
)}
|
|
377
378
|
<OrderTimeWrapper>
|
|
378
379
|
<OText
|
|
@@ -393,14 +394,15 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
393
394
|
calendarHeaderStyle={styles.calendarHeader}
|
|
394
395
|
dateNumberStyle={styles.dateNumber}
|
|
395
396
|
dateNameStyle={styles.dateName}
|
|
396
|
-
iconContainer={{flex: 0.1}}
|
|
397
|
+
iconContainer={{ flex: 0.1 }}
|
|
397
398
|
highlightDateNameStyle={styles.highlightDateName}
|
|
398
399
|
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
400
|
+
dayContainerStyle={{ height: '100%' }}
|
|
401
|
+
highlightDateContainerStyle={{ height: '100%' }}
|
|
399
402
|
calendarHeaderFormat='MMMM, YYYY'
|
|
400
|
-
iconStyle={{borderWidth: 1}}
|
|
403
|
+
iconStyle={{ borderWidth: 1 }}
|
|
401
404
|
selectedDate={selectDate}
|
|
402
405
|
datesWhitelist={datesWhitelist}
|
|
403
|
-
dayContainerStyle={{height: 40}}
|
|
404
406
|
disabledDateNameStyle={styles.disabledDateName}
|
|
405
407
|
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
406
408
|
disabledDateOpacity={0.6}
|
|
@@ -417,7 +419,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
417
419
|
<TimeItem active={timeSelected === time.value}>
|
|
418
420
|
<OText
|
|
419
421
|
size={14}
|
|
420
|
-
color={timeSelected === time.value ? theme.colors.primary: theme.colors.textNormal}
|
|
422
|
+
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
421
423
|
style={{
|
|
422
424
|
lineHeight: 24
|
|
423
425
|
}}
|
|
@@ -426,15 +428,15 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
426
428
|
</TouchableOpacity>
|
|
427
429
|
))}
|
|
428
430
|
{timeList.length % 3 === 2 && (
|
|
429
|
-
<TimeItem style={{backgroundColor: 'transparent'}}/>
|
|
431
|
+
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
430
432
|
)}
|
|
431
433
|
</TimeContentWrapper>
|
|
432
434
|
</TimeListWrapper>
|
|
433
435
|
</OrderTimeWrapper>
|
|
434
436
|
<OButton
|
|
435
437
|
text={t('GO_TO_MENU', 'Go to menu')}
|
|
436
|
-
textStyle={{color: 'white'}}
|
|
437
|
-
style={{borderRadius: 7.6, marginBottom: 20, marginTop: 30}}
|
|
438
|
+
textStyle={{ color: 'white' }}
|
|
439
|
+
style={{ borderRadius: 7.6, marginBottom: 20, marginTop: 30 }}
|
|
438
440
|
onClick={() => handleClickBusiness()}
|
|
439
441
|
/>
|
|
440
442
|
</PreOrderContainer>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { UpsellingPage as UpsellingPageController } from 'ordering-components/native'
|
|
3
|
+
|
|
4
|
+
const UpsellingRedirectUI = (props: any) => {
|
|
5
|
+
const {
|
|
6
|
+
setOpenUpselling,
|
|
7
|
+
upsellingProducts,
|
|
8
|
+
handleUpsellingPage,
|
|
9
|
+
onRedirect,
|
|
10
|
+
} = props
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!upsellingProducts.loading) {
|
|
14
|
+
if (upsellingProducts?.products?.length) {
|
|
15
|
+
onRedirect &&
|
|
16
|
+
onRedirect('UpsellingPage', props)
|
|
17
|
+
} else {
|
|
18
|
+
handleUpsellingPage && handleUpsellingPage()
|
|
19
|
+
}
|
|
20
|
+
setOpenUpselling(false)
|
|
21
|
+
}
|
|
22
|
+
}, [upsellingProducts.loading, upsellingProducts?.products.length])
|
|
23
|
+
|
|
24
|
+
return (<>{null}</>)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const UpsellingRedirect = (props: any) => {
|
|
28
|
+
const upsellingProps = {
|
|
29
|
+
...props,
|
|
30
|
+
UIComponent: UpsellingRedirectUI
|
|
31
|
+
}
|
|
32
|
+
return (
|
|
33
|
+
<UpsellingPageController {...upsellingProps} />
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet, SafeAreaView
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, SafeAreaView } from 'react-native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import {
|
|
5
5
|
BusinessAndProductList,
|
|
@@ -17,17 +17,13 @@ import { BusinessProductsCategories } from '../BusinessProductsCategories'
|
|
|
17
17
|
import { BusinessProductsList } from '../BusinessProductsList'
|
|
18
18
|
import { BusinessProductsListingParams } from '../../types'
|
|
19
19
|
import {
|
|
20
|
-
WrapHeader,
|
|
21
20
|
TopHeader,
|
|
22
|
-
AddressInput,
|
|
23
21
|
WrapSearchBar,
|
|
24
22
|
WrapContent,
|
|
25
23
|
BusinessProductsListingContainer
|
|
26
24
|
} from './styles'
|
|
27
25
|
import { FloatingButton } from '../FloatingButton'
|
|
28
|
-
import {
|
|
29
|
-
import { UpsellingProducts } from '../UpsellingProducts'
|
|
30
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
26
|
+
import { UpsellingRedirect } from './UpsellingRedirect'
|
|
31
27
|
import Animated from 'react-native-reanimated'
|
|
32
28
|
|
|
33
29
|
const PIXELS_TO_SCROLL = 1000
|
|
@@ -47,7 +43,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
47
43
|
errorQuantityProducts,
|
|
48
44
|
header,
|
|
49
45
|
logo,
|
|
50
|
-
getNextProducts
|
|
46
|
+
getNextProducts,
|
|
51
47
|
} = props
|
|
52
48
|
|
|
53
49
|
const theme = useTheme();
|
|
@@ -56,7 +52,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
56
52
|
const [orderState] = useOrder()
|
|
57
53
|
const [{ parsePrice }] = useUtils()
|
|
58
54
|
const [, { showToast }] = useToast()
|
|
59
|
-
const { top } = useSafeAreaInsets();
|
|
60
55
|
|
|
61
56
|
const styles = StyleSheet.create({
|
|
62
57
|
mainContainer: {
|
|
@@ -87,7 +82,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
87
82
|
const { business, loading, error } = businessState
|
|
88
83
|
const [openBusinessInformation, setOpenBusinessInformation] = useState(false)
|
|
89
84
|
const [isOpenSearchBar, setIsOpenSearchBar] = useState(false)
|
|
90
|
-
const [curProduct, setCurProduct] = useState(null)
|
|
91
85
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
92
86
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
93
87
|
const scrollViewRef = useRef<any>(null)
|
|
@@ -102,7 +96,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
const onProductClick = (product: any) => {
|
|
105
|
-
|
|
99
|
+
onRedirect('ProductDetails', {
|
|
100
|
+
product: product,
|
|
101
|
+
businessSlug: business.slug,
|
|
102
|
+
businessId: business.id,
|
|
103
|
+
})
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
const handleCancel = () => {
|
|
@@ -110,14 +108,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
110
108
|
handleChangeSearch('')
|
|
111
109
|
}
|
|
112
110
|
|
|
113
|
-
const handleCloseProductModal = () => {
|
|
114
|
-
setCurProduct(null)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const handlerProductAction = () => {
|
|
118
|
-
handleCloseProductModal()
|
|
119
|
-
}
|
|
120
|
-
|
|
121
111
|
const handleUpsellingPage = () => {
|
|
122
112
|
onRedirect('CheckoutNavigator', {
|
|
123
113
|
screen: 'CheckoutPage',
|
|
@@ -165,13 +155,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
165
155
|
const handleTouchDrag = useCallback(() => {
|
|
166
156
|
setCategoryClicked(false);
|
|
167
157
|
}, []);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
handleCloseProductModal()
|
|
173
|
-
}
|
|
174
|
-
}, [orderState.loading])
|
|
158
|
+
|
|
159
|
+
const handleBackNavigation = () => {
|
|
160
|
+
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
161
|
+
}
|
|
175
162
|
|
|
176
163
|
return (
|
|
177
164
|
<SafeAreaView
|
|
@@ -186,7 +173,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
186
173
|
imgLeftSrc={theme.images.general.arrow_left}
|
|
187
174
|
imgRightSrc={null}
|
|
188
175
|
style={styles.btnBackArrow}
|
|
189
|
-
onClick={() =>
|
|
176
|
+
onClick={() => handleBackNavigation()}
|
|
190
177
|
imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
|
|
191
178
|
/>
|
|
192
179
|
</View>
|
|
@@ -248,7 +235,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
248
235
|
selectedCategoryId={selectedCategoryId}
|
|
249
236
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
250
237
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
251
|
-
|
|
238
|
+
setCategoryClicked={setCategoryClicked}
|
|
252
239
|
/>
|
|
253
240
|
)}
|
|
254
241
|
</>
|
|
@@ -304,49 +291,35 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
304
291
|
</>
|
|
305
292
|
)}
|
|
306
293
|
</BusinessProductsListingContainer>
|
|
307
|
-
{!loading && auth &&
|
|
294
|
+
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
308
295
|
<FloatingButton
|
|
309
296
|
btnText={
|
|
310
297
|
currentCart?.subtotal >= currentCart?.minimum
|
|
311
|
-
?
|
|
298
|
+
? t('VIEW_ORDER', 'View Order')
|
|
312
299
|
: `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
|
|
313
300
|
}
|
|
314
301
|
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
|
|
315
|
-
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum &&
|
|
316
|
-
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum &&
|
|
302
|
+
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
303
|
+
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
317
304
|
btnLeftValue={currentCart?.products?.length}
|
|
318
305
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
319
|
-
disabled={
|
|
306
|
+
disabled={currentCart?.subtotal < currentCart?.minimum}
|
|
320
307
|
handleClick={() => setOpenUpselling(true)}
|
|
321
308
|
/>
|
|
322
309
|
)}
|
|
323
|
-
<OModal
|
|
324
|
-
open={!!curProduct}
|
|
325
|
-
onClose={handleCloseProductModal}
|
|
326
|
-
entireModal
|
|
327
|
-
customClose
|
|
328
|
-
isAvoidKeyBoardView
|
|
329
|
-
>
|
|
330
|
-
<ProductForm
|
|
331
|
-
product={curProduct}
|
|
332
|
-
businessSlug={business.slug}
|
|
333
|
-
businessId={business.id}
|
|
334
|
-
onClose={handleCloseProductModal}
|
|
335
|
-
navigation={navigation}
|
|
336
|
-
onSave={handlerProductAction}
|
|
337
|
-
/>
|
|
338
|
-
</OModal>
|
|
339
310
|
{openUpselling && (
|
|
340
|
-
<
|
|
311
|
+
<UpsellingRedirect
|
|
341
312
|
businessId={currentCart?.business_id}
|
|
342
313
|
business={currentCart?.business}
|
|
343
314
|
cartProducts={currentCart?.products}
|
|
344
315
|
cart={currentCart}
|
|
316
|
+
setOpenUpselling={setOpenUpselling}
|
|
345
317
|
handleUpsellingPage={handleUpsellingPage}
|
|
346
318
|
handleCloseUpsellingPage={handleCloseUpsellingPage}
|
|
347
319
|
openUpselling={openUpselling}
|
|
348
320
|
canOpenUpselling={canOpenUpselling}
|
|
349
321
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
322
|
+
onRedirect={onRedirect}
|
|
350
323
|
/>
|
|
351
324
|
)}
|
|
352
325
|
</SafeAreaView>
|