ordering-ui-react-native 0.17.89 → 0.17.90
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/original/src/components/BusinessListingSearch/index.tsx +12 -7
- package/themes/original/src/components/Cart/index.tsx +3 -2
- package/themes/original/src/components/Checkout/index.tsx +3 -2
- package/themes/original/src/components/DriverTips/index.tsx +43 -33
- package/themes/original/src/components/MyOrders/index.tsx +10 -12
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +17 -29
- package/themes/original/src/components/Sessions/styles.tsx +1 -0
package/package.json
CHANGED
|
@@ -240,13 +240,16 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
240
240
|
<SearchBar
|
|
241
241
|
lazyLoad
|
|
242
242
|
{...(isChewLayout && { height: 55 })}
|
|
243
|
-
inputStyle={{ ...styles.searchInput
|
|
244
|
-
placeholder={
|
|
243
|
+
inputStyle={{ ...styles.searchInput }}
|
|
244
|
+
placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
|
|
245
245
|
onSearch={(val: string) => handleChangeTermValue(val)}
|
|
246
246
|
value={termValue}
|
|
247
247
|
iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
|
|
248
248
|
/>
|
|
249
249
|
</SearchWrapper>
|
|
250
|
+
<OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
|
|
251
|
+
{t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
|
|
252
|
+
</OText>
|
|
250
253
|
{
|
|
251
254
|
noResults && (
|
|
252
255
|
<View>
|
|
@@ -273,11 +276,13 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
273
276
|
/>
|
|
274
277
|
)}
|
|
275
278
|
|
|
276
|
-
|
|
277
|
-
<
|
|
278
|
-
{
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
{businessesSearchList.businesses?.length > 0 && (
|
|
280
|
+
<OptionTitle isBusinessesSearchList={!!businessesSearchList}>
|
|
281
|
+
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
|
|
282
|
+
{t('BUSINESSES', 'Businesses')}
|
|
283
|
+
</OText>
|
|
284
|
+
</OptionTitle>
|
|
285
|
+
)}
|
|
281
286
|
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
|
282
287
|
{businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
|
|
283
288
|
<View
|
|
@@ -401,12 +401,13 @@ const CartUI = (props: any) => {
|
|
|
401
401
|
uuid={cart?.uuid}
|
|
402
402
|
businessId={cart?.business_id}
|
|
403
403
|
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
404
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
404
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
405
405
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
406
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
406
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
407
407
|
? cart?.driver_tip
|
|
408
408
|
: cart?.driver_tip_rate}
|
|
409
409
|
useOrderContext
|
|
410
|
+
cart={cart}
|
|
410
411
|
/>
|
|
411
412
|
</DriverTipsContainer>
|
|
412
413
|
)}
|
|
@@ -558,12 +558,13 @@ const CheckoutUI = (props: any) => {
|
|
|
558
558
|
uuid={cartUuid}
|
|
559
559
|
businessId={cart?.business_id}
|
|
560
560
|
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
561
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
561
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
562
562
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
563
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
563
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
564
564
|
? cart?.driver_tip
|
|
565
565
|
: cart?.driver_tip_rate}
|
|
566
566
|
useOrderContext
|
|
567
|
+
cart={cart}
|
|
567
568
|
/>
|
|
568
569
|
</ChDriverTips>
|
|
569
570
|
</ChSection>
|
|
@@ -23,16 +23,19 @@ const DriverTipsUI = (props: any) => {
|
|
|
23
23
|
driverTip,
|
|
24
24
|
driverTipsOptions,
|
|
25
25
|
optionSelected,
|
|
26
|
-
|
|
26
|
+
cart,
|
|
27
27
|
isDriverTipUseCustom,
|
|
28
|
-
handlerChangeOption
|
|
28
|
+
handlerChangeOption,
|
|
29
|
+
isFixedPrice
|
|
29
30
|
} = props;
|
|
30
31
|
|
|
31
32
|
const [{ parsePrice }] = useUtils();
|
|
33
|
+
const theme = useTheme();
|
|
32
34
|
const [, t] = useLanguage();
|
|
33
35
|
const [{ configs }] = useConfig();
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
+
const [customTip, setCustomTip] = useState((isDriverTipUseCustom && !driverTipsOptions.includes(driverTip)) ?? false)
|
|
37
|
+
const currentTip = customTip ? parseFloat(driverTip || 0) > 0 : (!customTip && !driverTipsOptions.includes(driverTip) && parseFloat(driverTip || 0)) > 0
|
|
38
|
+
const [value, setvalue] = useState('');
|
|
36
39
|
|
|
37
40
|
const style = StyleSheet.create({
|
|
38
41
|
semicircle: {
|
|
@@ -48,53 +51,59 @@ const DriverTipsUI = (props: any) => {
|
|
|
48
51
|
}
|
|
49
52
|
})
|
|
50
53
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
const placeholderCurrency = (configs?.currency_position?.value || 'left') === 'left'
|
|
54
|
+
const placeholderCurrency = !isFixedPrice ? `0%` : (configs?.currency_position?.value || 'left') === 'left'
|
|
54
55
|
? `${configs?.format_number_currency?.value}0`
|
|
55
56
|
: `0${configs?.format_number_currency?.value}`
|
|
56
57
|
|
|
57
58
|
const handleChangeDriverTip = (val: any) => {
|
|
58
59
|
const tip = Number(val)
|
|
59
60
|
if ((isNaN(tip) || tip < 0)) {
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
setvalue(value)
|
|
62
|
+
return
|
|
62
63
|
}
|
|
63
64
|
setvalue(val)
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
|
|
66
67
|
return (
|
|
67
68
|
<DTContainer>
|
|
68
69
|
<DTLabel>
|
|
69
70
|
{t('CUSTOM_DRIVER_TIP_MESSAGE', '100% of these tips go directly to your driver')}
|
|
70
71
|
</DTLabel>
|
|
71
72
|
<DTWrapperTips>
|
|
72
|
-
{
|
|
73
|
+
{driverTipsOptions.map((option: any, i: number) => (
|
|
73
74
|
<TouchableOpacity
|
|
74
75
|
key={i}
|
|
75
|
-
onPress={() =>
|
|
76
|
+
onPress={() => {
|
|
77
|
+
handlerChangeOption(option)
|
|
78
|
+
setCustomTip(false)
|
|
79
|
+
}}
|
|
76
80
|
>
|
|
77
81
|
<DTCard
|
|
78
82
|
style={style.semicircle}
|
|
79
|
-
isActive={option ===
|
|
83
|
+
isActive={(option === driverTip && !customTip)}
|
|
80
84
|
>
|
|
81
|
-
<OText size={12} numberOfLines={2} color={option ===
|
|
85
|
+
<OText size={12} numberOfLines={2} color={(option === driverTip && !customTip) ? '#FFF' : theme.colors.textSecondary}>
|
|
82
86
|
{`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
|
|
83
87
|
</OText>
|
|
84
88
|
</DTCard>
|
|
85
89
|
</TouchableOpacity>
|
|
86
90
|
))}
|
|
91
|
+
{isDriverTipUseCustom && (
|
|
92
|
+
<TouchableOpacity
|
|
93
|
+
onPress={() => setCustomTip(true)}
|
|
94
|
+
>
|
|
95
|
+
<DTCard
|
|
96
|
+
style={style.semicircle}
|
|
97
|
+
isActive={customTip}
|
|
98
|
+
>
|
|
99
|
+
<OText size={12} numberOfLines={2} color={customTip ? '#FFF' : theme.colors.textSecondary}>
|
|
100
|
+
{t('CUSTOM_TIP', 'Custom')}
|
|
101
|
+
</OText>
|
|
102
|
+
</DTCard>
|
|
103
|
+
</TouchableOpacity>
|
|
104
|
+
)}
|
|
87
105
|
</DTWrapperTips>
|
|
88
|
-
{
|
|
89
|
-
<OText
|
|
90
|
-
color={theme.colors.error}
|
|
91
|
-
size={16}
|
|
92
|
-
style={{ marginTop: 10, textAlign: 'center' }}
|
|
93
|
-
>
|
|
94
|
-
{t('CUSTOM_DRIVER_TIP_AMOUNT', 'The driver\'s current tip comes from a custom option')}
|
|
95
|
-
</OText>
|
|
96
|
-
)}
|
|
97
|
-
{isDriverTipUseCustom && (
|
|
106
|
+
{customTip && (
|
|
98
107
|
<DTForm>
|
|
99
108
|
<DTWrapperInput>
|
|
100
109
|
<OInput
|
|
@@ -120,17 +129,18 @@ const DriverTipsUI = (props: any) => {
|
|
|
120
129
|
}}
|
|
121
130
|
/>
|
|
122
131
|
</DTWrapperInput>
|
|
123
|
-
{parseFloat(driverTip || 0) > 0 && (
|
|
124
|
-
<OText
|
|
125
|
-
color={theme.colors.error}
|
|
126
|
-
size={16}
|
|
127
|
-
style={{ marginTop: 10, textAlign: 'center' }}
|
|
128
|
-
>
|
|
129
|
-
{t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}: {parsePrice(driverTip)}
|
|
130
|
-
</OText>
|
|
131
|
-
)}
|
|
132
132
|
</DTForm>
|
|
133
133
|
)}
|
|
134
|
+
{currentTip && (
|
|
135
|
+
<OText
|
|
136
|
+
color={theme.colors.primary}
|
|
137
|
+
size={16}
|
|
138
|
+
style={{ marginTop: 10, textAlign: 'center' }}
|
|
139
|
+
>
|
|
140
|
+
{t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPrice &&
|
|
141
|
+
` (${driverTip}%)`}: {isFixedPrice ? parsePrice(driverTip) : parsePrice(cart?.driver_tip)}
|
|
142
|
+
</OText>
|
|
143
|
+
)}
|
|
134
144
|
</DTContainer>
|
|
135
145
|
)
|
|
136
146
|
}
|
|
@@ -147,18 +147,16 @@ export const MyOrders = (props: any) => {
|
|
|
147
147
|
)}
|
|
148
148
|
{selectedOption === 'orders' && (
|
|
149
149
|
<>
|
|
150
|
-
{
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
</View>
|
|
161
|
-
)}
|
|
150
|
+
<View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
151
|
+
<OrdersOption
|
|
152
|
+
{...props}
|
|
153
|
+
activeOrders
|
|
154
|
+
ordersLength={ordersLength}
|
|
155
|
+
setOrdersLength={setOrdersLength}
|
|
156
|
+
setRefreshOrders={setRefreshOrders}
|
|
157
|
+
refreshOrders={refreshOrders}
|
|
158
|
+
/>
|
|
159
|
+
</View>
|
|
162
160
|
<View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
163
161
|
<OrdersOption
|
|
164
162
|
{...props}
|
|
@@ -26,7 +26,7 @@ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) =>
|
|
|
26
26
|
const ProductList = ({ style }: any) => {
|
|
27
27
|
return (
|
|
28
28
|
<>
|
|
29
|
-
{products?.map((product: any) => (
|
|
29
|
+
{products?.filter((product : any) => product?.business?.available)?.map((product: any) => (
|
|
30
30
|
<SingleProductCard
|
|
31
31
|
key={product?.id}
|
|
32
32
|
isProductId
|
|
@@ -3,7 +3,6 @@ import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-
|
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import { useFocusEffect } from '@react-navigation/native'
|
|
5
5
|
import { OText, OButton } from '../shared'
|
|
6
|
-
import { NotFoundSource } from '../NotFoundSource'
|
|
7
6
|
import { ActiveOrders } from '../ActiveOrders'
|
|
8
7
|
import { PreviousOrders } from '../PreviousOrders'
|
|
9
8
|
import { PreviousBusinessOrdered } from './PreviousBusinessOrdered'
|
|
@@ -73,22 +72,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
73
72
|
useEffect(() => {
|
|
74
73
|
if (loading || error) return
|
|
75
74
|
const ordersReduced = _orders.map((order: any) => order?.cart_group_id
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
75
|
+
? _orders
|
|
76
|
+
.filter((_order: any) => _order?.cart_group_id === order?.cart_group_id)
|
|
77
|
+
.map((_o: any, _: any, _ordersList: any) => {
|
|
78
|
+
const obj = {
|
|
79
|
+
..._o,
|
|
80
|
+
id: _ordersList.map(o => o.id),
|
|
81
|
+
review: _o.review,
|
|
82
|
+
user_review: _o.user_review,
|
|
83
|
+
total: _ordersList.reduce((acc: any, o: any) => acc + o.summary.total, 0),
|
|
84
|
+
business: _ordersList.map((o: any) => o.business),
|
|
85
|
+
business_id: _ordersList.map((o: any) => o.business_id),
|
|
86
|
+
products: _ordersList.map((o: any) => o.products)
|
|
87
|
+
}
|
|
88
|
+
return obj
|
|
89
|
+
}).find((o: any) => o)
|
|
90
|
+
: order)
|
|
92
91
|
const orders = ordersReduced?.filter((order: any) => {
|
|
93
92
|
if (!order?.cart_group_id) return true
|
|
94
93
|
const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
|
|
@@ -193,7 +192,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
193
192
|
|
|
194
193
|
</NoOrdersWrapper>
|
|
195
194
|
)}
|
|
196
|
-
{(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
|
|
195
|
+
{((ordersLength?.activeOrdersLength > 0 && activeOrders) || (ordersLength?.previousOrdersLength > 0 && !activeOrders)) && (
|
|
197
196
|
<>
|
|
198
197
|
{((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
|
|
199
198
|
<OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
|
|
@@ -206,17 +205,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
206
205
|
</OText>
|
|
207
206
|
</OptionTitle>
|
|
208
207
|
)}
|
|
209
|
-
|
|
210
|
-
{!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
|
|
211
|
-
!loading &&
|
|
212
|
-
orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
|
|
213
|
-
(
|
|
214
|
-
<NotFoundSource
|
|
215
|
-
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
216
|
-
image={imageFails}
|
|
217
|
-
conditioned
|
|
218
|
-
/>
|
|
219
|
-
)}
|
|
220
208
|
</>
|
|
221
209
|
)}
|
|
222
210
|
{isBusiness && !!businessesSearchList && businesses?.loading && (
|