ordering-ui-react-native 0.14.1 → 0.14.5
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/AppleLogin/index.tsx +11 -5
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/VerifyPhone/index.tsx +1 -1
- package/themes/doordash/src/components/BusinessProductsListing/index.tsx +50 -15
- package/themes/doordash/src/components/FloatingButton/index.tsx +3 -2
- package/themes/doordash/src/components/Messages/index.tsx +2 -1
- package/themes/doordash/src/components/OrderSummary/index.tsx +3 -1
- package/themes/doordash/src/components/ProductForm/index.tsx +18 -6
- package/themes/doordash/src/components/shared/OInput.tsx +1 -0
- package/themes/doordash/src/types/index.tsx +1 -0
- package/themes/original/src/components/Checkout/index.tsx +101 -29
- package/themes/original/src/components/Checkout/styles.tsx +13 -0
- package/themes/original/src/components/OrderDetails/index.tsx +16 -8
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -1
- package/themes/uber-eats/src/components/ProductForm/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import { appleAuthAndroid, appleAuth } from '@invertase/react-native-apple-authentication';
|
|
4
4
|
import { useConfig, useApi, useLanguage } from 'ordering-components/native'
|
|
@@ -22,7 +22,7 @@ export const AppleLogin = (props: AppleLoginParams) => {
|
|
|
22
22
|
const [ordering] = useApi()
|
|
23
23
|
const [, t] = useLanguage()
|
|
24
24
|
const theme = useTheme()
|
|
25
|
-
|
|
25
|
+
const [errors, setError] = useState<any>({type: '', message: ''})
|
|
26
26
|
const buttonText = t('LOGIN_WITH_APPLE', 'Login with Apple');
|
|
27
27
|
|
|
28
28
|
const onAppleButtonPress = async () => {
|
|
@@ -45,16 +45,16 @@ export const AppleLogin = (props: AppleLoginParams) => {
|
|
|
45
45
|
identityToken,
|
|
46
46
|
authorizationCode,
|
|
47
47
|
} = appleAuthRequestResponse
|
|
48
|
-
|
|
49
|
-
if (identityToken && authorizationCode) {
|
|
48
|
+
if (identityToken) {
|
|
50
49
|
console.log('auth code: ', authorizationCode)
|
|
51
|
-
handleLoginApple(
|
|
50
|
+
handleLoginApple(identityToken)
|
|
52
51
|
console.warn(`Apple Authentication Completed, ${user}, ${email}`);
|
|
53
52
|
} else {
|
|
54
53
|
handleErrors && handleErrors(t('ERROR_LOGIN_APPLE', 'Error login with apple'))
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
} catch (error: any) {
|
|
57
|
+
setError({ type: 'FROM_APPLE', message: error?.message })
|
|
58
58
|
handleErrors && handleErrors(error.message)
|
|
59
59
|
}
|
|
60
60
|
} else {
|
|
@@ -106,6 +106,7 @@ export const AppleLogin = (props: AppleLoginParams) => {
|
|
|
106
106
|
handleErrors && handleErrors(result || t('ERROR_LOGIN_AUTH_APPLE', 'Error login auth with apple'))
|
|
107
107
|
}
|
|
108
108
|
} catch (error: any) {
|
|
109
|
+
setError({ type: 'FROM_API', message: error?.message })
|
|
109
110
|
handleLoading && handleLoading(false)
|
|
110
111
|
handleErrors && handleErrors(error?.message)
|
|
111
112
|
}
|
|
@@ -120,6 +121,11 @@ export const AppleLogin = (props: AppleLoginParams) => {
|
|
|
120
121
|
|
|
121
122
|
return (
|
|
122
123
|
<Container>
|
|
124
|
+
{!!errors?.message && !!errors?.type && (
|
|
125
|
+
<OText>
|
|
126
|
+
{errors?.type} {errors?.message}
|
|
127
|
+
</OText>
|
|
128
|
+
)}
|
|
123
129
|
<AppleButton
|
|
124
130
|
onPress={onAppleButtonPress}
|
|
125
131
|
>
|
|
@@ -55,7 +55,6 @@ import { ActivityIndicator } from 'react-native-paper';
|
|
|
55
55
|
import WebView from 'react-native-webview';
|
|
56
56
|
import Icon from 'react-native-vector-icons/Feather';
|
|
57
57
|
import { OrderCreating } from '../OrderCreating';
|
|
58
|
-
import { Item } from '../../../themes/uber-eats/src/components/UpsellingProducts/styles';
|
|
59
58
|
|
|
60
59
|
const mapConfigs = {
|
|
61
60
|
mapZoom: 16,
|
|
@@ -196,7 +196,7 @@ export const VerifyPhone = (props: any) => {
|
|
|
196
196
|
<WrappCountdown>
|
|
197
197
|
<CountDownContainer color={timer === '00:00' ? theme.colors.error: theme.colors.success}>
|
|
198
198
|
<OText
|
|
199
|
-
size={
|
|
199
|
+
size={28}
|
|
200
200
|
color={timer === '00:00' ? theme.colors.error: theme.colors.success}
|
|
201
201
|
>
|
|
202
202
|
{timer}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useRef, useCallback } from 'react'
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet, TextStyle, ScrollView, I18nManager, Platform } from 'react-native'
|
|
1
|
+
import React, { useState, useRef, useCallback, useEffect } from 'react'
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, TextStyle, ScrollView, I18nManager, Platform, KeyboardAvoidingView, Keyboard } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
BusinessAndProductList,
|
|
5
5
|
useLanguage,
|
|
@@ -36,7 +36,7 @@ import { Cart } from '../Cart'
|
|
|
36
36
|
import { OrderSummary } from '../OrderSummary'
|
|
37
37
|
import NavBar from '../NavBar'
|
|
38
38
|
import SocialShareFav from '../SocialShare'
|
|
39
|
-
|
|
39
|
+
import { SafeAreaContainer } from '../../layouts/SafeAreaContainer'
|
|
40
40
|
const PIXELS_TO_SCROLL = 1000
|
|
41
41
|
|
|
42
42
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
@@ -112,6 +112,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
112
112
|
const [categoriesLayout, setCategoriesLayout] = useState<any>({})
|
|
113
113
|
const [productListLayout, setProductListLayout] = useState<any>(null)
|
|
114
114
|
const [selectedCategoryId, setSelectedCategoryId] = useState<any>('cat_all')
|
|
115
|
+
const [isKeyboardOpen, setIsKeyBoardOpen] = useState(false)
|
|
116
|
+
const cartRef = useRef<any>()
|
|
115
117
|
|
|
116
118
|
const scrollViewRef = useRef<any>(null)
|
|
117
119
|
|
|
@@ -187,6 +189,21 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
187
189
|
setCategoryClicked(false);
|
|
188
190
|
}, []);
|
|
189
191
|
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
Keyboard.addListener('keyboardDidShow', () => {
|
|
194
|
+
setIsKeyBoardOpen(true)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
Keyboard.addListener('keyboardDidHide', () => [
|
|
198
|
+
setIsKeyBoardOpen(false)
|
|
199
|
+
])
|
|
200
|
+
|
|
201
|
+
return () => {
|
|
202
|
+
Keyboard.removeAllListeners('keyboardDidShow')
|
|
203
|
+
Keyboard.removeAllListeners('keyboardDidHide')
|
|
204
|
+
}
|
|
205
|
+
}, [])
|
|
206
|
+
|
|
190
207
|
return (
|
|
191
208
|
<>
|
|
192
209
|
<Animated.View style={{ flex: 1, backgroundColor: theme.colors.white, position: 'absolute', width: '100%', top: top, zIndex: 1 }}>
|
|
@@ -358,18 +375,36 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
358
375
|
entireModal
|
|
359
376
|
customClose
|
|
360
377
|
>
|
|
361
|
-
<
|
|
362
|
-
<
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
378
|
+
<SafeAreaContainer>
|
|
379
|
+
<KeyboardAvoidingView
|
|
380
|
+
style={{ flex: 1 }}
|
|
381
|
+
behavior={Platform.OS === 'ios' ? 'height' : 'padding'}
|
|
382
|
+
enabled={Platform.OS === 'ios'}
|
|
383
|
+
>
|
|
384
|
+
<ScrollView
|
|
385
|
+
stickyHeaderIndices={[0]}
|
|
386
|
+
style={{ backgroundColor: 'white' }}
|
|
387
|
+
contentContainerStyle={{ paddingBottom: 100 }}
|
|
388
|
+
ref={(ref : any) => cartRef.current = ref}
|
|
389
|
+
>
|
|
390
|
+
<NavBar title={t('CART', 'Cart')} onActionLeft={handleCloseCartModal} leftImg={theme.images.general.close} noBorder btnStyle={{ paddingLeft: 0 }} />
|
|
391
|
+
<OrderSummary
|
|
392
|
+
cart={currentCart}
|
|
393
|
+
isCartPending={currentCart?.status === 2}
|
|
394
|
+
hasUpSelling={true}
|
|
395
|
+
isFromCheckout
|
|
396
|
+
title={t('ITEMS', 'Items')}
|
|
397
|
+
paddingH={40}
|
|
398
|
+
cartRef={cartRef}
|
|
399
|
+
/>
|
|
400
|
+
</ScrollView>
|
|
401
|
+
<FloatingButton
|
|
402
|
+
style={{bottom: isKeyboardOpen && Platform.OS === 'ios' ? 30 : 0}}
|
|
403
|
+
btnText={t('CHECKOUT', 'Checkout')}
|
|
404
|
+
handleClick={() => handleUpsellingPage()}
|
|
405
|
+
/>
|
|
406
|
+
</KeyboardAvoidingView>
|
|
407
|
+
</SafeAreaContainer>
|
|
373
408
|
</OModal>
|
|
374
409
|
</>
|
|
375
410
|
)
|
|
@@ -19,7 +19,8 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
|
|
|
19
19
|
btnText,
|
|
20
20
|
handleButtonClick,
|
|
21
21
|
disabled,
|
|
22
|
-
isSecondaryBtn
|
|
22
|
+
isSecondaryBtn,
|
|
23
|
+
style
|
|
23
24
|
} = props
|
|
24
25
|
|
|
25
26
|
const theme = useTheme();
|
|
@@ -39,7 +40,7 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
|
|
|
39
40
|
const { bottom } = useSafeAreaInsets();
|
|
40
41
|
|
|
41
42
|
return (
|
|
42
|
-
<Container isIos={Platform.OS === 'ios'} style={{ paddingBottom: bottom + 10 }}>
|
|
43
|
+
<Container isIos={Platform.OS === 'ios'} style={{ ...style, paddingBottom: bottom + 10 }}>
|
|
43
44
|
<Button
|
|
44
45
|
style={[isSecondaryBtn ? styles.secodaryBtn : styles.primaryBtn]}
|
|
45
46
|
onPress={handleButtonClick}
|
|
@@ -272,7 +272,8 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
272
272
|
{...props}
|
|
273
273
|
containerStyle={{
|
|
274
274
|
padding: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
|
|
275
|
-
flexDirection: 'column-reverse'
|
|
275
|
+
flexDirection: 'column-reverse',
|
|
276
|
+
marginBottom: Platform.OS === 'ios' && isKeyboardShow ? 500 : 0
|
|
276
277
|
}}
|
|
277
278
|
primaryStyle={{ alignItems: 'center', justifyContent: 'flex-start' }}
|
|
278
279
|
renderAccessory={() => renderAccessory()}
|
|
@@ -41,7 +41,8 @@ const OrderSummaryUI = (props: any) => {
|
|
|
41
41
|
paddingH,
|
|
42
42
|
isMini,
|
|
43
43
|
commentState,
|
|
44
|
-
handleChangeComment
|
|
44
|
+
handleChangeComment,
|
|
45
|
+
cartRef
|
|
45
46
|
} = props;
|
|
46
47
|
|
|
47
48
|
const theme = useTheme();
|
|
@@ -256,6 +257,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
256
257
|
}}
|
|
257
258
|
multiline
|
|
258
259
|
inputStyle={{color: theme.colors.textPrimary}}
|
|
260
|
+
onFocus={() => cartRef?.current?.scrollToEnd?.()}
|
|
259
261
|
/>
|
|
260
262
|
{commentState?.loading && (
|
|
261
263
|
<View style={{ position: 'absolute', right: 20 }}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
ProductForm as ProductOptions,
|
|
4
4
|
useSession,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from 'ordering-components/native'
|
|
9
9
|
import { ProductIngredient } from '../ProductIngredient'
|
|
10
10
|
import { ProductOption } from '../ProductOption'
|
|
11
|
-
import { View, TouchableOpacity, StyleSheet, Dimensions, ScrollView, I18nManager, TextStyle, Platform, KeyboardAvoidingView } from 'react-native'
|
|
11
|
+
import { View, TouchableOpacity, StyleSheet, Dimensions, ScrollView, I18nManager, TextStyle, Platform, KeyboardAvoidingView, Keyboard } from 'react-native'
|
|
12
12
|
import {
|
|
13
13
|
ProductHeader,
|
|
14
14
|
WrapHeader,
|
|
@@ -107,9 +107,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
107
107
|
const [orderState] = useOrder()
|
|
108
108
|
const [{ auth }] = useSession()
|
|
109
109
|
const { product, loading, error } = productObject
|
|
110
|
-
|
|
111
110
|
const { bottom } = useSafeAreaInsets();
|
|
112
|
-
|
|
111
|
+
const [commentY, setCommentY] = useState(0)
|
|
112
|
+
const productFormRef = useRef<any>()
|
|
113
113
|
const isError = (id: number) => {
|
|
114
114
|
let bgColor = theme.colors.white
|
|
115
115
|
if (errors[`id:${id}`]) {
|
|
@@ -136,13 +136,25 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
136
136
|
|
|
137
137
|
const saveErrors = orderState.loading || maxProductQuantity === 0 || Object.keys(errors).length > 0
|
|
138
138
|
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
Keyboard.addListener('keyboardDidShow', () => {
|
|
141
|
+
if (commentY > 100) {
|
|
142
|
+
productFormRef?.current?.scrollTo?.({ x: 0, y: commentY + 300, animated: true })
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
return () => {
|
|
147
|
+
Keyboard.removeAllListeners('keyboardDidShow')
|
|
148
|
+
}
|
|
149
|
+
}, [productFormRef?.current, commentY])
|
|
150
|
+
|
|
139
151
|
return (
|
|
140
152
|
<KeyboardAvoidingView
|
|
141
153
|
style={{ flex: 1 }}
|
|
142
154
|
behavior={Platform.OS ? 'padding' : 'height'}
|
|
143
155
|
enabled={Platform.OS === 'ios'}
|
|
144
156
|
>
|
|
145
|
-
<ScrollView style={styles.mainContainer}>
|
|
157
|
+
<ScrollView style={styles.mainContainer} ref={(ref) => productFormRef.current = ref}>
|
|
146
158
|
{!error && (
|
|
147
159
|
<View style={{ paddingBottom: 80 }}>
|
|
148
160
|
<WrapHeader>
|
|
@@ -275,7 +287,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
275
287
|
</React.Fragment>
|
|
276
288
|
)
|
|
277
289
|
}))}
|
|
278
|
-
<ProductComment>
|
|
290
|
+
<ProductComment onLayout={(e: any) => setCommentY(e.nativeEvent.layout.y + e.nativeEvent.layout.height)}>
|
|
279
291
|
<SectionTitle>
|
|
280
292
|
<OText style={theme.labels.middle as TextStyle}>{t('SPECIAL_COMMENT', 'Special comment')}</OText>
|
|
281
293
|
</SectionTitle>
|
|
@@ -99,6 +99,7 @@ const OInput = (props: Props): React.ReactElement => {
|
|
|
99
99
|
returnKeyType={props.returnKeyType}
|
|
100
100
|
onSubmitEditing={props.onSubmitEditing}
|
|
101
101
|
blurOnSubmit={props.blurOnSubmit}
|
|
102
|
+
onFocus={props.onFocus}
|
|
102
103
|
ref={props.forwardRef}
|
|
103
104
|
style={{padding: 0, ...props.inputStyle}}
|
|
104
105
|
/>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet,
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
|
-
|
|
4
|
+
import Picker from 'react-native-country-picker-modal';
|
|
5
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
5
6
|
import {
|
|
6
7
|
Checkout as CheckoutController,
|
|
7
8
|
useOrder,
|
|
@@ -22,7 +23,6 @@ import { PaymentOptions } from '../PaymentOptions';
|
|
|
22
23
|
import { DriverTips } from '../DriverTips';
|
|
23
24
|
import { NotFoundSource } from '../NotFoundSource';
|
|
24
25
|
import { UserDetails } from '../UserDetails';
|
|
25
|
-
import { OrderTypeSelector } from '../OrderTypeSelector'
|
|
26
26
|
|
|
27
27
|
import {
|
|
28
28
|
ChContainer,
|
|
@@ -35,7 +35,9 @@ import {
|
|
|
35
35
|
ChErrors,
|
|
36
36
|
ChBusinessDetails,
|
|
37
37
|
ChUserDetails,
|
|
38
|
-
ChCart
|
|
38
|
+
ChCart,
|
|
39
|
+
DeliveryOptionsContainer,
|
|
40
|
+
DeliveryOptionItem
|
|
39
41
|
} from './styles';
|
|
40
42
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
41
43
|
|
|
@@ -74,9 +76,9 @@ const CheckoutUI = (props: any) => {
|
|
|
74
76
|
handlePaymethodChange,
|
|
75
77
|
handlerClickPlaceOrder,
|
|
76
78
|
onNavigationRedirect,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
deliveryOptionSelected,
|
|
80
|
+
instructionsOptions,
|
|
81
|
+
handleChangeDeliveryOption,
|
|
80
82
|
} = props
|
|
81
83
|
|
|
82
84
|
const theme = useTheme();
|
|
@@ -91,9 +93,18 @@ const CheckoutUI = (props: any) => {
|
|
|
91
93
|
justifyContent: 'flex-start',
|
|
92
94
|
paddingLeft: 0,
|
|
93
95
|
},
|
|
96
|
+
paddSection: {
|
|
97
|
+
padding: 20
|
|
98
|
+
},
|
|
94
99
|
pagePadding: {
|
|
95
100
|
paddingLeft: 40,
|
|
96
101
|
paddingRight: 40
|
|
102
|
+
},
|
|
103
|
+
icon: {
|
|
104
|
+
top: 15,
|
|
105
|
+
right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
fontSize: 20
|
|
97
108
|
}
|
|
98
109
|
})
|
|
99
110
|
|
|
@@ -109,6 +120,7 @@ const CheckoutUI = (props: any) => {
|
|
|
109
120
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
110
121
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
111
122
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
123
|
+
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
112
124
|
|
|
113
125
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
114
126
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -118,6 +130,12 @@ const CheckoutUI = (props: any) => {
|
|
|
118
130
|
|
|
119
131
|
const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
|
|
120
132
|
|
|
133
|
+
const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
|
|
134
|
+
return {
|
|
135
|
+
value: option?.id, key: option?.id, label: option?.name
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
|
|
121
139
|
const handlePlaceOrder = () => {
|
|
122
140
|
if (!userErrors.length) {
|
|
123
141
|
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
@@ -131,6 +149,11 @@ const CheckoutUI = (props: any) => {
|
|
|
131
149
|
setIsUserDetailsEdit(true)
|
|
132
150
|
}
|
|
133
151
|
|
|
152
|
+
const changeDeliveryOption = (option: any) => {
|
|
153
|
+
handleChangeDeliveryOption(option)
|
|
154
|
+
setIsDeliveryOptionModalVisible(false)
|
|
155
|
+
}
|
|
156
|
+
|
|
134
157
|
const checkValidationFields = () => {
|
|
135
158
|
setUserErrors([])
|
|
136
159
|
const errors = []
|
|
@@ -307,7 +330,56 @@ const CheckoutUI = (props: any) => {
|
|
|
307
330
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
308
331
|
</ChSection>
|
|
309
332
|
|
|
310
|
-
|
|
333
|
+
{!cartState.loading && deliveryOptionSelected !== undefined && options?.type === 1 && (
|
|
334
|
+
<DeliveryOptionsContainer>
|
|
335
|
+
<OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
|
|
336
|
+
<View
|
|
337
|
+
style={{
|
|
338
|
+
backgroundColor: theme.colors.inputDisabled,
|
|
339
|
+
borderRadius: 7.5,
|
|
340
|
+
marginBottom: 20,
|
|
341
|
+
flex: 1
|
|
342
|
+
}}>
|
|
343
|
+
<Picker
|
|
344
|
+
countryCode={undefined}
|
|
345
|
+
visible={isDeliveryOptionModalVisible}
|
|
346
|
+
onClose={() => setIsDeliveryOptionModalVisible(false)}
|
|
347
|
+
withCountryNameButton
|
|
348
|
+
renderFlagButton={() => (
|
|
349
|
+
<TouchableOpacity onPress={() => setIsDeliveryOptionModalVisible(true)}>
|
|
350
|
+
<DeliveryOptionItem backgroundColor={theme?.colors?.inputDisabled}>
|
|
351
|
+
<OText
|
|
352
|
+
size={14}
|
|
353
|
+
>
|
|
354
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
|
|
355
|
+
</OText>
|
|
356
|
+
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
357
|
+
</DeliveryOptionItem>
|
|
358
|
+
</TouchableOpacity>
|
|
359
|
+
)}
|
|
360
|
+
flatListProps={{
|
|
361
|
+
keyExtractor: (item: any) => item.value,
|
|
362
|
+
data: deliveryOptions || [],
|
|
363
|
+
renderItem: ({ item }: any) => (
|
|
364
|
+
<TouchableOpacity
|
|
365
|
+
onPress={() => changeDeliveryOption(item.value)}
|
|
366
|
+
disabled={
|
|
367
|
+
deliveryOptionSelected === item.value
|
|
368
|
+
}
|
|
369
|
+
>
|
|
370
|
+
<DeliveryOptionItem backgroundColor={deliveryOptionSelected === item.value ? theme.colors.inputDisabled : 'white'}>
|
|
371
|
+
<OText>
|
|
372
|
+
{item.label}
|
|
373
|
+
</OText>
|
|
374
|
+
</DeliveryOptionItem>
|
|
375
|
+
</TouchableOpacity>
|
|
376
|
+
)
|
|
377
|
+
}}
|
|
378
|
+
/>
|
|
379
|
+
</View>
|
|
380
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
381
|
+
</DeliveryOptionsContainer>
|
|
382
|
+
)}
|
|
311
383
|
|
|
312
384
|
{!cartState.loading && (cart?.status === 2 || cart?.status === 4) && (
|
|
313
385
|
<ChSection style={{ paddingBottom: 20 }}>
|
|
@@ -429,27 +501,27 @@ const CheckoutUI = (props: any) => {
|
|
|
429
501
|
)}
|
|
430
502
|
|
|
431
503
|
{!cartState.loading && cart && (
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
504
|
+
<ChSection>
|
|
505
|
+
<ChCart>
|
|
506
|
+
{cartsWithProducts && cart?.products?.length === 0 ? (
|
|
507
|
+
<NotFoundSource
|
|
508
|
+
content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
|
|
509
|
+
btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
|
|
510
|
+
/>
|
|
511
|
+
) : (
|
|
512
|
+
<>
|
|
513
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal}>
|
|
514
|
+
{t('ORDER_SUMMARY', 'Order Summary')}
|
|
515
|
+
</OText>
|
|
516
|
+
<OrderSummary
|
|
517
|
+
cart={cart}
|
|
518
|
+
isCartPending={cart?.status === 2}
|
|
519
|
+
/>
|
|
520
|
+
</>
|
|
521
|
+
)}
|
|
522
|
+
</ChCart>
|
|
523
|
+
</ChSection>
|
|
524
|
+
)}
|
|
453
525
|
|
|
454
526
|
{!cartState.loading && cart && (
|
|
455
527
|
<ChSection style={{ paddingTop: 0, paddingBottom: 20, paddingHorizontal: 20 }}>
|
|
@@ -87,3 +87,16 @@ export const ChErrors = styled.View`
|
|
|
87
87
|
align-items: center;
|
|
88
88
|
margin-bottom: 20px;
|
|
89
89
|
`
|
|
90
|
+
|
|
91
|
+
export const DeliveryOptionsContainer = styled.View`
|
|
92
|
+
flex: 1;
|
|
93
|
+
margin-top: 10px;
|
|
94
|
+
`
|
|
95
|
+
|
|
96
|
+
export const DeliveryOptionItem = styled.View`
|
|
97
|
+
padding: 15px;
|
|
98
|
+
justify-content: ${(props : any) => props.center ? 'center' : 'space-between'};
|
|
99
|
+
align-items: center;
|
|
100
|
+
flex-direction: row;
|
|
101
|
+
background-color: ${(props : any) => props?.backgroundColor ?? '#fff'};
|
|
102
|
+
`;
|
|
@@ -597,6 +597,22 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
597
597
|
</OText>
|
|
598
598
|
</InfoBlock>
|
|
599
599
|
</Customer>
|
|
600
|
+
{order?.delivery_option !== undefined && order?.delivery_type === 1 && (
|
|
601
|
+
<View style={{ marginTop: 15 }}>
|
|
602
|
+
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
603
|
+
{t('DELIVERY_PREFERENCE', 'Delivery Preference')}
|
|
604
|
+
</OText>
|
|
605
|
+
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.delivery_option?.name ?? t('EITHER_WAY', 'Either way')}</OText>
|
|
606
|
+
</View>
|
|
607
|
+
)}
|
|
608
|
+
{order?.comment && (
|
|
609
|
+
<View style={{ marginTop: 15 }}>
|
|
610
|
+
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
611
|
+
{t('COMMENT', 'Comment')}
|
|
612
|
+
</OText>
|
|
613
|
+
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.comment}</OText>
|
|
614
|
+
</View>
|
|
615
|
+
)}
|
|
600
616
|
{order?.driver && (
|
|
601
617
|
<>
|
|
602
618
|
{order?.driver?.location && parseInt(order?.status) === 9 && (
|
|
@@ -810,14 +826,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
810
826
|
</OText>
|
|
811
827
|
</Table>
|
|
812
828
|
</Total>
|
|
813
|
-
{order?.comment && (
|
|
814
|
-
<Table>
|
|
815
|
-
<OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
|
|
816
|
-
<OText style={{ maxWidth: '70%' }}>
|
|
817
|
-
{order?.comment}
|
|
818
|
-
</OText>
|
|
819
|
-
</Table>
|
|
820
|
-
)}
|
|
821
829
|
</OrderBill>
|
|
822
830
|
</OrderContent>
|
|
823
831
|
</>
|
|
@@ -109,7 +109,7 @@ export const OrderBill = styled.View`
|
|
|
109
109
|
export const Total = styled.View`
|
|
110
110
|
border-top-width: 1px;
|
|
111
111
|
border-top-color: ${(props: any) => props.theme.colors.border};
|
|
112
|
-
padding-vertical: 10px
|
|
112
|
+
padding-vertical: 10px;
|
|
113
113
|
`
|
|
114
114
|
|
|
115
115
|
export const Map = styled.View`
|