ordering-ui-react-native 0.16.43-release → 0.16.44-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 +1 -1
- package/src/components/shared/OToast.tsx +3 -3
- package/themes/original/src/components/BusinessController/index.tsx +16 -2
- package/themes/original/src/components/BusinessController/styles.tsx +13 -1
- package/themes/original/src/components/FavoriteList/index.tsx +50 -45
- package/themes/original/src/components/Messages/index.tsx +15 -0
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewProducts/index.tsx +7 -4
- package/themes/original/src/types/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { useTheme } from 'styled-components/native';
|
|
|
5
5
|
import { getTraduction } from '../../utils'
|
|
6
6
|
|
|
7
7
|
const fadeDuration = 300;
|
|
8
|
-
const
|
|
8
|
+
const topPosition = 20;
|
|
9
9
|
|
|
10
10
|
export const Toast = (props: any) => {
|
|
11
11
|
const [toastConfig, { hideToast }] = useToast();
|
|
@@ -54,7 +54,7 @@ export const Toast = (props: any) => {
|
|
|
54
54
|
backgroundColor = theme.colors.toastInfo || '#6BA4FF';
|
|
55
55
|
break;
|
|
56
56
|
case ToastType.Error:
|
|
57
|
-
backgroundColor = theme.colors.toastError || '#D83520'
|
|
57
|
+
backgroundColor = theme.colors.toastError || '#D83520';
|
|
58
58
|
break;
|
|
59
59
|
case ToastType.Success:
|
|
60
60
|
backgroundColor = theme.colors.toastSuccess || '#90C68E';
|
|
@@ -65,7 +65,7 @@ export const Toast = (props: any) => {
|
|
|
65
65
|
<Animated.View
|
|
66
66
|
style={[
|
|
67
67
|
styles.container,
|
|
68
|
-
{
|
|
68
|
+
{ top: topPosition, opacity },
|
|
69
69
|
]}
|
|
70
70
|
>
|
|
71
71
|
<View style={[styles.toast, { backgroundColor }]}>
|
|
@@ -25,7 +25,8 @@ import {
|
|
|
25
25
|
BusinessLogo,
|
|
26
26
|
Reviews,
|
|
27
27
|
RibbonBox,
|
|
28
|
-
ReviewAndFavorite
|
|
28
|
+
ReviewAndFavorite,
|
|
29
|
+
OfferBox
|
|
29
30
|
} from './styles';
|
|
30
31
|
import { useTheme } from 'styled-components/native';
|
|
31
32
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
|
|
@@ -50,7 +51,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
50
51
|
businessPickupTime,
|
|
51
52
|
businessDistance,
|
|
52
53
|
handleFavoriteBusiness,
|
|
53
|
-
enableIntersection
|
|
54
|
+
enableIntersection,
|
|
55
|
+
getBusinessOffer
|
|
54
56
|
} = props;
|
|
55
57
|
|
|
56
58
|
const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
|
|
@@ -201,6 +203,18 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
201
203
|
<FontAwesomeIcon name="crown" size={26} color="gold" />
|
|
202
204
|
</View>
|
|
203
205
|
)}
|
|
206
|
+
{(!isCustomLayout) && (
|
|
207
|
+
getBusinessOffer((business?.offers)) &&
|
|
208
|
+
<OfferBox>
|
|
209
|
+
<OText
|
|
210
|
+
size={10}
|
|
211
|
+
weight={'400'}
|
|
212
|
+
numberOfLines={2}
|
|
213
|
+
ellipsizeMode='tail'
|
|
214
|
+
lineHeight={13}
|
|
215
|
+
>{getBusinessOffer((business?.offers)) || parsePrice(0)}</OText>
|
|
216
|
+
</OfferBox>
|
|
217
|
+
)}
|
|
204
218
|
<BusinessState>
|
|
205
219
|
{!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
|
|
206
220
|
<View style={styles.businessStateView}>
|
|
@@ -39,7 +39,7 @@ export const BusinessState = styled.View`
|
|
|
39
39
|
`
|
|
40
40
|
|
|
41
41
|
export const BusinessLogo = styled.View`
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
`
|
|
44
44
|
|
|
45
45
|
export const ReviewAndFavorite = styled.View`
|
|
@@ -73,3 +73,15 @@ export const RibbonBox = styled.View`
|
|
|
73
73
|
border-radius: 50px;
|
|
74
74
|
`}
|
|
75
75
|
`
|
|
76
|
+
|
|
77
|
+
export const OfferBox = styled.View`
|
|
78
|
+
position: absolute;
|
|
79
|
+
z-index: 1;
|
|
80
|
+
top: 20px;
|
|
81
|
+
right: 10px;
|
|
82
|
+
border-radius: 50px;
|
|
83
|
+
color: ${(props: any) => props.theme.colors.textThird};
|
|
84
|
+
background: ${(props: any) => props.theme.colors.inputBorderColor};
|
|
85
|
+
padding: 3px 8px;
|
|
86
|
+
max-width: 180px;
|
|
87
|
+
`
|
|
@@ -4,8 +4,8 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
|
4
4
|
import { FavoriteParams } from '../../types';
|
|
5
5
|
import { SingleOrderCard } from '../SingleOrderCard';
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
FavoriteList as FavoriteListController,
|
|
8
|
+
useOrder,
|
|
9
9
|
useLanguage
|
|
10
10
|
} from 'ordering-components/native';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
@@ -19,7 +19,7 @@ import moment from 'moment';
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
const FavoriteListUI = (props: FavoriteParams) => {
|
|
22
|
-
|
|
22
|
+
const {
|
|
23
23
|
favoriteList,
|
|
24
24
|
handleUpdateFavoriteList,
|
|
25
25
|
pagination,
|
|
@@ -31,9 +31,9 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
31
31
|
isBusiness,
|
|
32
32
|
isOrder,
|
|
33
33
|
isProduct
|
|
34
|
-
|
|
34
|
+
} = props
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
const theme = useTheme();
|
|
37
37
|
const [, t] = useLanguage()
|
|
38
38
|
const [orderState] = useOrder();
|
|
39
39
|
const [{ carts }] = useOrder()
|
|
@@ -79,34 +79,39 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
79
79
|
const businessId = product?.category?.business?.id
|
|
80
80
|
if (!categoryId || !businessId) return
|
|
81
81
|
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
isRedirect: 'business',
|
|
83
|
+
productId: product?.id,
|
|
84
|
+
businessId: businessId,
|
|
85
|
+
categoryId: categoryId,
|
|
86
|
+
business: {
|
|
87
|
+
store: product?.category?.business.slug,
|
|
88
|
+
header: product?.category?.header,
|
|
89
|
+
}
|
|
90
|
+
})
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
useEffect(() => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
95
|
+
if (reorderState?.error) {
|
|
96
|
+
if (reorderState?.result?.business_id) {
|
|
97
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
98
|
+
onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
|
|
102
|
+
const cartProducts = carts?.[_businessId]?.products
|
|
103
|
+
const available = cartProducts.every((product: any) => product.valid === true)
|
|
104
|
+
const orderProducts = favoriteList?.favorites.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
|
|
100
105
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
|
|
107
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
108
|
+
} else {
|
|
109
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
110
|
+
cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
|
|
111
|
+
onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, [reorderState])
|
|
110
115
|
|
|
111
116
|
const handleBusinessClick = (business: any) => {
|
|
112
117
|
onNavigationRedirect && onNavigationRedirect('Business', {
|
|
@@ -195,12 +200,12 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
195
200
|
)
|
|
196
201
|
}
|
|
197
202
|
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
return (
|
|
204
|
+
<Container>
|
|
200
205
|
{isBusiness && (
|
|
201
206
|
<>
|
|
202
207
|
{favoriteList?.favorites?.length > 0 && (
|
|
203
|
-
favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((business: any, i:number) => (
|
|
208
|
+
favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((business: any, i: number) => (
|
|
204
209
|
<BusinessController
|
|
205
210
|
key={`${business.id}_` + i}
|
|
206
211
|
business={business}
|
|
@@ -237,7 +242,7 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
237
242
|
{isOrder && (
|
|
238
243
|
<>
|
|
239
244
|
{favoriteList?.favorites?.length > 0 && (
|
|
240
|
-
favoriteList.favorites?.sort((a: any, b:any) => moment(a?.delivery_datetime_utc).valueOf() - moment(b?.delivery_datetime_utc).valueOf())
|
|
245
|
+
favoriteList.favorites?.sort((a: any, b: any) => moment(a?.delivery_datetime_utc).valueOf() - moment(b?.delivery_datetime_utc).valueOf())
|
|
241
246
|
.map((order: any, i: number) => (
|
|
242
247
|
<SingleOrderCard
|
|
243
248
|
key={`${order?.id}_${i}`}
|
|
@@ -250,7 +255,7 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
250
255
|
handleReorder={handleReorder}
|
|
251
256
|
reorderLoading={reorderState?.loading}
|
|
252
257
|
/>
|
|
253
|
-
|
|
258
|
+
))
|
|
254
259
|
)}
|
|
255
260
|
{favoriteList?.loading && (
|
|
256
261
|
[...Array(5).keys()].map(i => (
|
|
@@ -294,18 +299,18 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
294
299
|
)}
|
|
295
300
|
|
|
296
301
|
{!favoriteList?.loading && pagination.totalPages && pagination.currentPage < pagination.totalPages && (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
<WrappButton>
|
|
303
|
+
<OButton
|
|
304
|
+
onClick={() => getFavoriteList(pagination?.currentPage + 1)}
|
|
305
|
+
text={t('LOAD_MORE_ITEMS', 'Load more items')}
|
|
306
|
+
imgRightSrc={null}
|
|
307
|
+
textStyle={{ color: theme.colors.white }}
|
|
308
|
+
style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
|
|
309
|
+
/>
|
|
310
|
+
</WrappButton>
|
|
311
|
+
)}
|
|
307
312
|
</Container>
|
|
308
|
-
|
|
313
|
+
)
|
|
309
314
|
}
|
|
310
315
|
|
|
311
316
|
export const FavoriteList = (props: any) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import Clipboard from '@react-native-clipboard/clipboard';
|
|
2
3
|
import { Messages as MessagesController, useSession, useUtils, useLanguage, ToastType, useToast } from 'ordering-components/native'
|
|
3
4
|
import { useTheme } from 'styled-components/native';
|
|
4
5
|
import { launchImageLibrary } from 'react-native-image-picker'
|
|
@@ -397,6 +398,19 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
397
398
|
}
|
|
398
399
|
}
|
|
399
400
|
|
|
401
|
+
const onLongPress = (context: any, message: any) => {
|
|
402
|
+
const options = [
|
|
403
|
+
t('COPY_TEXT', 'Copy text'),
|
|
404
|
+
t('CANCEL', 'Cancel'),
|
|
405
|
+
];
|
|
406
|
+
const cancelButtonIndex = options.length - 1;
|
|
407
|
+
context.actionSheet().showActionSheetWithOptions({
|
|
408
|
+
options,
|
|
409
|
+
cancelButtonIndex
|
|
410
|
+
}, (buttonIndex: any) => buttonIndex === 0 && Clipboard.setString(message.text)
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
|
|
400
414
|
return (
|
|
401
415
|
<View style={{ height: getViewHeight(), width: '100%', paddingTop: 12, backgroundColor: 'white' }}>
|
|
402
416
|
<Wrapper>
|
|
@@ -473,6 +487,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
473
487
|
onSend={onSubmit}
|
|
474
488
|
onInputTextChanged={onChangeMessage}
|
|
475
489
|
alignTop
|
|
490
|
+
onLongPress={(context: any, message: any) => onLongPress(context, message)}
|
|
476
491
|
scrollToBottom
|
|
477
492
|
renderAvatarOnTop
|
|
478
493
|
renderUsernameOnMessage
|
|
@@ -131,7 +131,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
|
|
|
131
131
|
if (!order?.user_review && !isDriverReviewed) {
|
|
132
132
|
onSubmit()
|
|
133
133
|
} else {
|
|
134
|
-
onNavigationRedirect
|
|
134
|
+
onNavigationRedirect('BottomTab', { screen: 'MyOrders' })
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -145,7 +145,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
|
|
|
145
145
|
}
|
|
146
146
|
if (!formState.loading && !formState.result?.error && alertState.success) {
|
|
147
147
|
setIsDriverReviewed && setIsDriverReviewed(true)
|
|
148
|
-
onNavigationRedirect('MyOrders')
|
|
148
|
+
onNavigationRedirect('BottomTab', { screen: 'MyOrders' })
|
|
149
149
|
}
|
|
150
150
|
}, [formState])
|
|
151
151
|
|
|
@@ -186,7 +186,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
|
|
|
186
186
|
<NavBar
|
|
187
187
|
title={t('REVIEW_DRIVER', 'Review driver')}
|
|
188
188
|
titleAlign={'center'}
|
|
189
|
-
onActionLeft={() => onNavigationRedirect('BottomTab')}
|
|
189
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'MyOrders' })}
|
|
190
190
|
showCall={false}
|
|
191
191
|
btnStyle={{ paddingLeft: 0 }}
|
|
192
192
|
style={{ flexDirection: 'column', alignItems: 'flex-start' }}
|
|
@@ -56,7 +56,7 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
|
56
56
|
if (order?.driver && !order?.user_review) {
|
|
57
57
|
onNavigationRedirect('ReviewDriver', { order: order })
|
|
58
58
|
} else {
|
|
59
|
-
onNavigationRedirect('MyOrders')
|
|
59
|
+
onNavigationRedirect('BottomTab', { screen: 'MyOrders' })
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}, [formState])
|
|
@@ -67,7 +67,7 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
|
67
67
|
<NavBar
|
|
68
68
|
title={t('REVIEW_PRODUCT', 'Review product')}
|
|
69
69
|
titleAlign={'center'}
|
|
70
|
-
onActionLeft={() => onNavigationRedirect('BottomTab')}
|
|
70
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'MyOrders' })}
|
|
71
71
|
showCall={false}
|
|
72
72
|
btnStyle={{ paddingLeft: 0 }}
|
|
73
73
|
style={{ flexDirection: 'column', alignItems: 'flex-start' }}
|
|
@@ -87,7 +87,10 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
|
87
87
|
<FloatingBottomContainer>
|
|
88
88
|
<ActionContainer>
|
|
89
89
|
<SkipButton
|
|
90
|
-
onPress={() => (order?.driver && !order?.user_review) ?
|
|
90
|
+
onPress={() => (order?.driver && !order?.user_review) ?
|
|
91
|
+
onNavigationRedirect('ReviewDriver', { order: order }) :
|
|
92
|
+
onNavigationRedirect('BottomTab', { screen: 'MyOrders' })
|
|
93
|
+
}
|
|
91
94
|
>
|
|
92
95
|
<OText weight={700} size={18} color={theme.colors.textNormal}>{t('FRONT_VISUALS_SKIP', 'Skip')}</OText>
|
|
93
96
|
</SkipButton>
|
|
@@ -95,7 +98,7 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
|
95
98
|
textStyle={{ color: theme.colors.white, paddingRight: 10 }}
|
|
96
99
|
text={order?.driver && !order?.user_review ? t('CONTINUE', 'Continue') : t('SEND_REVIEW', 'Send Review')}
|
|
97
100
|
style={{ borderRadius: 8 }}
|
|
98
|
-
|
|
101
|
+
imgRightSrc={theme.images.general.arrow_right}
|
|
99
102
|
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
100
103
|
isDisabled={formState.loading || formState?.changes?.length === 0}
|
|
101
104
|
onClick={() => handleContinueClick()}
|
|
@@ -222,6 +222,7 @@ export interface BusinessControllerParams {
|
|
|
222
222
|
handleUpdateBusinessList?: any;
|
|
223
223
|
enableIntersection?: boolean;
|
|
224
224
|
isCustomLayout?: boolean;
|
|
225
|
+
getBusinessOffer?: any;
|
|
225
226
|
handleCustomUpdate?: (businessId: number, changes: any) => {};
|
|
226
227
|
}
|
|
227
228
|
export interface BusinessProductsListingParams {
|