ordering-ui-react-native 0.21.3 → 0.21.4
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/themes/business/src/components/OrderDetails/Delivery.tsx +0 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +48 -24
- package/themes/original/src/components/BusinessInformation/index.tsx +34 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +2 -1
- package/themes/original/src/components/Checkout/index.tsx +30 -1
- package/themes/original/src/components/ProductForm/index.tsx +4 -4
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +9 -9
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -3
package/package.json
CHANGED
|
@@ -37,15 +37,14 @@ interface OrderContent {
|
|
|
37
37
|
order: any,
|
|
38
38
|
logisticOrderStatus?: Array<number>,
|
|
39
39
|
isOrderGroup?: boolean,
|
|
40
|
-
lastOrder?: boolean
|
|
41
|
-
isDelivery?: boolean
|
|
40
|
+
lastOrder?: boolean
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
export const OrderContentComponent = (props: OrderContent) => {
|
|
45
44
|
const [, t] = useLanguage();
|
|
46
45
|
const theme = useTheme()
|
|
47
46
|
const [{ user }] = useSession()
|
|
48
|
-
const { order, logisticOrderStatus, isOrderGroup, lastOrder
|
|
47
|
+
const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
|
|
49
48
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
50
49
|
const [{ configs }] = useConfig();
|
|
51
50
|
const [orientationState] = useDeviceOrientation();
|
|
@@ -55,8 +54,14 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
55
54
|
|
|
56
55
|
const [openReviewModal, setOpenReviewModal] = useState(false)
|
|
57
56
|
|
|
58
|
-
const [isReadMore, setIsReadMore] = useState(
|
|
59
|
-
|
|
57
|
+
const [isReadMore, setIsReadMore] = useState({
|
|
58
|
+
customerAddress: false,
|
|
59
|
+
businessAddressNotes: false
|
|
60
|
+
})
|
|
61
|
+
const [lengthMore, setLengthMore] = useState({
|
|
62
|
+
customerAddress: false,
|
|
63
|
+
businessAddressNotes: false
|
|
64
|
+
})
|
|
60
65
|
|
|
61
66
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
62
67
|
|
|
@@ -109,8 +114,15 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
109
114
|
return /^\d+$/.test(str);
|
|
110
115
|
}
|
|
111
116
|
|
|
112
|
-
const onTextLayout = useCallback((e: any) => {
|
|
113
|
-
|
|
117
|
+
const onTextLayout = useCallback((e: any, item: string) => {
|
|
118
|
+
if (item === 'customerAddress') {
|
|
119
|
+
const customerAddressMore = (e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2
|
|
120
|
+
setLengthMore(prev => ({ ...prev, customerAddress: customerAddressMore }))
|
|
121
|
+
}
|
|
122
|
+
if (item === 'businessAddressNotes') {
|
|
123
|
+
const businessAddressNotesMore = (e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3
|
|
124
|
+
setLengthMore(prev => ({ ...prev, businessAddressNotes: businessAddressNotesMore }))
|
|
125
|
+
}
|
|
114
126
|
}, []);
|
|
115
127
|
|
|
116
128
|
return (
|
|
@@ -210,18 +222,28 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
210
222
|
</OText>
|
|
211
223
|
)}
|
|
212
224
|
{!!order?.business?.address_notes && (
|
|
213
|
-
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
+
<>
|
|
226
|
+
<View style={styles.linkWithIcons}>
|
|
227
|
+
<OLink
|
|
228
|
+
PressStyle={styles.linkWithIcons}
|
|
229
|
+
url={Platform.select({
|
|
230
|
+
ios: `maps:0,0?q=${order?.business?.address_notes}`,
|
|
231
|
+
android: `geo:0,0?q=${order?.business?.address_notes}`,
|
|
232
|
+
})}
|
|
233
|
+
shorcut={order?.business?.address_notes}
|
|
234
|
+
TextStyle={styles.textLink}
|
|
235
|
+
onTextLayout={e => onTextLayout(e, 'businessAddressNotes')}
|
|
236
|
+
numberOfLines={isReadMore.businessAddressNotes ? 20 : 3}
|
|
237
|
+
/>
|
|
238
|
+
</View>
|
|
239
|
+
{lengthMore.businessAddressNotes && (
|
|
240
|
+
<TouchableOpacity
|
|
241
|
+
onPress={() => setIsReadMore({ ...isReadMore, businessAddressNotes: !isReadMore.businessAddressNotes })}
|
|
242
|
+
>
|
|
243
|
+
<OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore.businessAddressNotes ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
244
|
+
</TouchableOpacity>
|
|
245
|
+
)}
|
|
246
|
+
</>
|
|
225
247
|
)}
|
|
226
248
|
</OrderBusiness>
|
|
227
249
|
|
|
@@ -329,15 +351,17 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
329
351
|
ios: `maps:0,0?q=${order?.customer?.address}`,
|
|
330
352
|
android: `geo:0,0?q=${order?.customer?.address}`,
|
|
331
353
|
})}
|
|
332
|
-
onTextLayout={onTextLayout}
|
|
333
|
-
numberOfLines={isReadMore ? 20 : 2}
|
|
354
|
+
onTextLayout={e => onTextLayout(e, 'customerAddress')}
|
|
355
|
+
numberOfLines={isReadMore.customerAddress ? 20 : 2}
|
|
334
356
|
shorcut={order?.customer?.address}
|
|
335
357
|
TextStyle={styles.textLink}
|
|
336
358
|
/>
|
|
337
359
|
</View>
|
|
338
|
-
{lengthMore && (
|
|
339
|
-
<TouchableOpacity
|
|
340
|
-
|
|
360
|
+
{lengthMore.customerAddress && (
|
|
361
|
+
<TouchableOpacity
|
|
362
|
+
onPress={() => setIsReadMore({ ...isReadMore, customerAddress: !isReadMore.customerAddress })}
|
|
363
|
+
>
|
|
364
|
+
<OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore.customerAddress ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
341
365
|
</TouchableOpacity>
|
|
342
366
|
)}
|
|
343
367
|
</>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
BusinessInformation as BusinessInformationController,
|
|
4
4
|
useLanguage, useUtils, useConfig,
|
|
@@ -16,13 +16,16 @@ import {
|
|
|
16
16
|
DivideView,
|
|
17
17
|
MediaWrapper,
|
|
18
18
|
} from './styles';
|
|
19
|
-
import { StyleSheet, View } from 'react-native';
|
|
19
|
+
import { StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
20
20
|
import { BusinessInformationParams } from '../../types';
|
|
21
21
|
import { GoogleMap } from '../GoogleMap';
|
|
22
22
|
import { WebView } from 'react-native-webview';
|
|
23
23
|
import { formatUrlVideo } from '../../utils'
|
|
24
24
|
import { ScheduleAccordion } from '../ScheduleAccordion';
|
|
25
25
|
import moment from 'moment';
|
|
26
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
27
|
+
const { useDeviceOrientation } = DeviceOrientationMethods
|
|
28
|
+
|
|
26
29
|
const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
27
30
|
const { businessState, businessSchedule, businessLocation } = props;
|
|
28
31
|
|
|
@@ -30,6 +33,11 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
30
33
|
const [, t] = useLanguage();
|
|
31
34
|
const [{ optimizeImage }] = useUtils();
|
|
32
35
|
const [{ configs }] = useConfig()
|
|
36
|
+
const [orientationState] = useDeviceOrientation();
|
|
37
|
+
|
|
38
|
+
const [isReadMore, setIsReadMore] = useState(false)
|
|
39
|
+
const [lengthMore, setLengthMore] = useState(false)
|
|
40
|
+
const WIDTH_SCREEN = orientationState?.dimensions?.width
|
|
33
41
|
|
|
34
42
|
const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
|
|
35
43
|
const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
|
|
@@ -73,6 +81,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
73
81
|
return iAry;
|
|
74
82
|
};
|
|
75
83
|
|
|
84
|
+
const onTextLayout = useCallback((e: any) => {
|
|
85
|
+
setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
|
|
86
|
+
}, [])
|
|
87
|
+
|
|
76
88
|
return (
|
|
77
89
|
<BusinessInformationContainer>
|
|
78
90
|
<WrapMainContent contentContainerStyle={{}}>
|
|
@@ -99,10 +111,29 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
99
111
|
</>
|
|
100
112
|
)}
|
|
101
113
|
{!hideAddress && (
|
|
102
|
-
<OText size={12} mBottom={
|
|
114
|
+
<OText size={12} mBottom={10}>
|
|
103
115
|
{businessState?.business?.address}
|
|
104
116
|
</OText>
|
|
105
117
|
)}
|
|
118
|
+
{businessState?.business?.address_notes && (
|
|
119
|
+
<>
|
|
120
|
+
<OText
|
|
121
|
+
size={12}
|
|
122
|
+
mBottom={10}
|
|
123
|
+
numberOfLines={isReadMore ? 20 : 3}
|
|
124
|
+
onTextLayout={onTextLayout}
|
|
125
|
+
>
|
|
126
|
+
{businessState?.business?.address_notes}
|
|
127
|
+
</OText>
|
|
128
|
+
{lengthMore && (
|
|
129
|
+
<TouchableOpacity
|
|
130
|
+
onPress={() => setIsReadMore(!isReadMore)}
|
|
131
|
+
>
|
|
132
|
+
<OText size={12} mBottom={20} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
133
|
+
</TouchableOpacity>
|
|
134
|
+
)}
|
|
135
|
+
</>
|
|
136
|
+
)}
|
|
106
137
|
<DivideView />
|
|
107
138
|
{!hideSchedule && (
|
|
108
139
|
<>
|
|
@@ -163,9 +163,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
163
163
|
if (product.ingredients?.length === 0 && product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
|
|
164
164
|
const isProductAddedToCart = currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)
|
|
165
165
|
const productQuantity = isProductAddedToCart?.quantity
|
|
166
|
+
const minimumPerOrder = product?.minimum_per_order || 1
|
|
166
167
|
const addCurrentProduct = {
|
|
167
168
|
...product,
|
|
168
|
-
quantity:
|
|
169
|
+
quantity: minimumPerOrder
|
|
169
170
|
}
|
|
170
171
|
const updateCurrentProduct = {
|
|
171
172
|
name: product?.name,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
2
|
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
4
|
import Picker from 'react-native-country-picker-modal';
|
|
@@ -56,6 +56,8 @@ import { OrderSummary } from '../OrderSummary';
|
|
|
56
56
|
import { getTypesText } from '../../utils';
|
|
57
57
|
import { CartStoresListing } from '../CartStoresListing';
|
|
58
58
|
import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
|
|
59
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
60
|
+
const { useDeviceOrientation } = DeviceOrientationMethods
|
|
59
61
|
|
|
60
62
|
const mapConfigs = {
|
|
61
63
|
mapZoom: 16,
|
|
@@ -141,6 +143,10 @@ const CheckoutUI = (props: any) => {
|
|
|
141
143
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
142
144
|
const [validationFields] = useValidationFields();
|
|
143
145
|
const [events] = useEvent()
|
|
146
|
+
const [orientationState] = useDeviceOrientation();
|
|
147
|
+
const [isReadMore, setIsReadMore] = useState(false)
|
|
148
|
+
const [lengthMore, setLengthMore] = useState(false)
|
|
149
|
+
const WIDTH_SCREEN = orientationState?.dimensions?.width
|
|
144
150
|
|
|
145
151
|
const [errorCash, setErrorCash] = useState(false);
|
|
146
152
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -367,6 +373,10 @@ const CheckoutUI = (props: any) => {
|
|
|
367
373
|
}
|
|
368
374
|
}, [cart?.paymethod_data])
|
|
369
375
|
|
|
376
|
+
const onTextLayout = useCallback((e: any) => {
|
|
377
|
+
setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
|
|
378
|
+
}, [])
|
|
379
|
+
|
|
370
380
|
return (
|
|
371
381
|
<>
|
|
372
382
|
<Container noPadding>
|
|
@@ -458,6 +468,25 @@ const CheckoutUI = (props: any) => {
|
|
|
458
468
|
{businessDetails?.business?.address}
|
|
459
469
|
</OText>
|
|
460
470
|
)}
|
|
471
|
+
{businessDetails?.business?.address_notes && (
|
|
472
|
+
<>
|
|
473
|
+
<OText
|
|
474
|
+
size={12}
|
|
475
|
+
lineHeight={18}
|
|
476
|
+
numberOfLines={isReadMore ? 20 : 3}
|
|
477
|
+
onTextLayout={onTextLayout}
|
|
478
|
+
>
|
|
479
|
+
{businessDetails?.business?.address_notes}
|
|
480
|
+
</OText>
|
|
481
|
+
{lengthMore && (
|
|
482
|
+
<TouchableOpacity
|
|
483
|
+
onPress={() => setIsReadMore(!isReadMore)}
|
|
484
|
+
>
|
|
485
|
+
<OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
486
|
+
</TouchableOpacity>
|
|
487
|
+
)}
|
|
488
|
+
</>
|
|
489
|
+
)}
|
|
461
490
|
</View>
|
|
462
491
|
</>
|
|
463
492
|
)}
|
|
@@ -176,7 +176,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
176
176
|
marginTop: 10
|
|
177
177
|
},
|
|
178
178
|
wrapperNavbar: {
|
|
179
|
-
paddingHorizontal:
|
|
179
|
+
paddingHorizontal: 30,
|
|
180
180
|
paddingTop: 0,
|
|
181
181
|
}
|
|
182
182
|
});
|
|
@@ -690,7 +690,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
690
690
|
)}
|
|
691
691
|
</WrapHeader>
|
|
692
692
|
<ProductSummary
|
|
693
|
-
ph={isChewLayout ? 20 :
|
|
693
|
+
ph={isChewLayout ? 20 : 30}
|
|
694
694
|
onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
|
|
695
695
|
>
|
|
696
696
|
<ProductTitle>
|
|
@@ -792,7 +792,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
792
792
|
marginBottom: 20,
|
|
793
793
|
borderBottomWidth: 1,
|
|
794
794
|
borderBottomColor: theme.colors.border,
|
|
795
|
-
marginHorizontal:
|
|
795
|
+
marginHorizontal: 20,
|
|
796
796
|
backgroundColor: theme.colors.backgroundPage,
|
|
797
797
|
}}
|
|
798
798
|
>
|
|
@@ -866,7 +866,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
866
866
|
</>
|
|
867
867
|
) : (
|
|
868
868
|
<ProductEditions
|
|
869
|
-
style={{ paddingHorizontal: isChewLayout ? 20 :
|
|
869
|
+
style={{ paddingHorizontal: isChewLayout ? 20 : 30 }}
|
|
870
870
|
onLayout={(event: any) => {
|
|
871
871
|
setEditionsLayoutY(event.nativeEvent.layout?.y)
|
|
872
872
|
}}
|
|
@@ -70,7 +70,7 @@ export const ProductActions = styled.View`
|
|
|
70
70
|
position: absolute;
|
|
71
71
|
bottom: 0px;
|
|
72
72
|
padding-top: ${(props: any) => props.ios ? '20px' : '0'};
|
|
73
|
-
padding-horizontal:
|
|
73
|
+
padding-horizontal: 30px;
|
|
74
74
|
padding-vertical: 20px;
|
|
75
75
|
width: 100%;
|
|
76
76
|
flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};
|
|
@@ -86,8 +86,8 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
86
86
|
{suboption?.name}
|
|
87
87
|
</OText>
|
|
88
88
|
</IconControl>
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
{option?.allow_suboption_quantity && state?.selected && (
|
|
90
|
+
<QuantityControl>
|
|
91
91
|
<>
|
|
92
92
|
<Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
|
|
93
93
|
<IconAntDesign
|
|
@@ -107,10 +107,10 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
107
107
|
/>
|
|
108
108
|
</Checkbox>
|
|
109
109
|
</>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
</QuantityControl>
|
|
111
|
+
)}
|
|
112
|
+
{option?.with_half_option && state?.selected && (
|
|
113
|
+
<PositionControl>
|
|
114
114
|
<>
|
|
115
115
|
<Circle disabled={disabled} onPress={() => changePosition('left')}>
|
|
116
116
|
<OIcon
|
|
@@ -138,10 +138,10 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
138
138
|
/>
|
|
139
139
|
</Circle>
|
|
140
140
|
</>
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
</PositionControl>
|
|
142
|
+
)}
|
|
143
143
|
{price > 0 && (
|
|
144
|
-
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{
|
|
144
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{width: 70, maxWidth: 70}}>
|
|
145
145
|
+ {parsePrice(price)}
|
|
146
146
|
</OText>
|
|
147
147
|
)}
|
|
@@ -18,14 +18,12 @@ export const QuantityControl = styled.View`
|
|
|
18
18
|
flex-direction: row;
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: space-between;
|
|
21
|
-
|
|
22
|
-
width: 55px;
|
|
21
|
+
width: 62px;
|
|
23
22
|
`
|
|
24
23
|
|
|
25
24
|
export const PositionControl = styled.View`
|
|
26
25
|
flex-direction: row;
|
|
27
26
|
align-items: center;
|
|
28
|
-
margin-right: 5px;
|
|
29
27
|
`
|
|
30
28
|
|
|
31
29
|
export const Checkbox = styled.TouchableOpacity`
|