ordering-ui-react-native 0.16.59 → 0.16.62
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/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/original/src/components/BusinessController/index.tsx +7 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +5 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +4 -1
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +1 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +14 -4
- package/themes/original/src/components/BusinessesListing/index.tsx +3 -2
- package/themes/original/src/components/Checkout/index.tsx +7 -6
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +77 -35
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/ProductForm/index.tsx +175 -154
- package/themes/original/src/components/ProductForm/styles.tsx +3 -5
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/SingleOrderCard/index.tsx +156 -121
- package/themes/original/src/components/SingleProductCard/index.tsx +11 -4
- package/themes/original/src/components/shared/OBottomPopup.tsx +5 -3
- package/themes/original/src/types/index.tsx +10 -3
|
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
SingleOrderCard as SingleOrderCardController,
|
|
4
4
|
useUtils,
|
|
5
|
+
useOrder,
|
|
5
6
|
useLanguage
|
|
6
7
|
} from 'ordering-components/native';
|
|
7
8
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
@@ -9,6 +10,7 @@ import { useTheme } from 'styled-components/native';
|
|
|
9
10
|
import { OIcon, OText, OButton } from '../shared';
|
|
10
11
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
11
12
|
import { SingleOrderCardParams } from '../../types';
|
|
13
|
+
import { OAlert } from '../../../../../src/components/shared'
|
|
12
14
|
|
|
13
15
|
import {
|
|
14
16
|
Container,
|
|
@@ -32,14 +34,18 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
32
34
|
onNavigationRedirect,
|
|
33
35
|
pastOrders,
|
|
34
36
|
isMessageView,
|
|
35
|
-
handleClickOrder
|
|
37
|
+
handleClickOrder,
|
|
38
|
+
handleRemoveCart,
|
|
39
|
+
cartState
|
|
36
40
|
} = props;
|
|
37
41
|
|
|
38
42
|
const [{ parsePrice, optimizeImage, parseDate }] = useUtils();
|
|
39
43
|
const [, t] = useLanguage();
|
|
44
|
+
const [{ carts }] = useOrder()
|
|
40
45
|
const theme = useTheme();
|
|
41
46
|
|
|
42
47
|
const [reorderSelected, setReorderSelected] = useState<number | null>(null);
|
|
48
|
+
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
43
49
|
|
|
44
50
|
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
|
|
45
51
|
|
|
@@ -97,9 +103,21 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
97
103
|
}
|
|
98
104
|
});
|
|
99
105
|
|
|
100
|
-
const handleReorderClick = (
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
const handleReorderClick = (order: any) => {
|
|
107
|
+
if (carts[`businessId:${order?.business_id}`] && carts[`businessId:${order?.business_id}`]?.products?.length > 0) {
|
|
108
|
+
setConfirm({
|
|
109
|
+
open: true,
|
|
110
|
+
content: [t('QUESTION_DELETE_PRODUCTS_FROM_CART', 'Are you sure that you want to delete all products from cart?')],
|
|
111
|
+
title: t('ORDER', 'Order'),
|
|
112
|
+
handleOnAccept: async () => {
|
|
113
|
+
handleRemoveCart()
|
|
114
|
+
setConfirm({ ...confirm, open: false })
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
} else {
|
|
118
|
+
setReorderSelected(order?.id);
|
|
119
|
+
handleReorder && handleReorder(order?.id);
|
|
120
|
+
}
|
|
103
121
|
};
|
|
104
122
|
|
|
105
123
|
const handleClickOrderReview = (order: any) => {
|
|
@@ -135,134 +153,151 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
135
153
|
handleFavoriteOrder && handleFavoriteOrder(!order?.favorite)
|
|
136
154
|
};
|
|
137
155
|
|
|
156
|
+
const handleOriginalReorder = () => {
|
|
157
|
+
setConfirm({ ...confirm, open: false, title: null })
|
|
158
|
+
setReorderSelected(order?.id);
|
|
159
|
+
handleReorder && handleReorder(order?.id);
|
|
160
|
+
}
|
|
161
|
+
|
|
138
162
|
return (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
<
|
|
154
|
-
<
|
|
155
|
-
<
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
{
|
|
163
|
+
<>
|
|
164
|
+
<Container
|
|
165
|
+
onPress={() => handleClickViewOrder(order?.uuid)}
|
|
166
|
+
activeOpacity={0.7}
|
|
167
|
+
>
|
|
168
|
+
<InnerContainer>
|
|
169
|
+
{!!order.business?.logo && (
|
|
170
|
+
<Logo style={styles.logoWrapper}>
|
|
171
|
+
<OIcon
|
|
172
|
+
url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
|
|
173
|
+
style={styles.logo}
|
|
174
|
+
/>
|
|
175
|
+
</Logo>
|
|
176
|
+
)}
|
|
177
|
+
<CardInfoWrapper>
|
|
178
|
+
<ContentHeader>
|
|
179
|
+
<View style={{ flex: 1 }}>
|
|
180
|
+
<OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
|
|
181
|
+
{order.business?.name}
|
|
182
|
+
</OText>
|
|
183
|
+
</View>
|
|
184
|
+
{!!!pastOrders && (
|
|
185
|
+
<>
|
|
186
|
+
{isMessageView ? (
|
|
187
|
+
<>
|
|
188
|
+
{order?.unread_count > 0 && (
|
|
189
|
+
<UnreadMessageCounter>
|
|
190
|
+
<OText size={12} color={theme.colors.primary} lineHeight={18} >
|
|
191
|
+
{order?.unread_count}
|
|
192
|
+
</OText>
|
|
193
|
+
</UnreadMessageCounter>
|
|
194
|
+
)}
|
|
195
|
+
</>
|
|
196
|
+
) : (
|
|
197
|
+
<Price>
|
|
198
|
+
<OText size={12} lineHeight={18}>
|
|
199
|
+
{parsePrice(order?.summary?.total || order?.total)}
|
|
200
|
+
</OText>
|
|
201
|
+
</Price>
|
|
202
|
+
)}
|
|
203
|
+
</>
|
|
204
|
+
)}
|
|
205
|
+
{!!pastOrders && (
|
|
206
|
+
<ButtonWrapper>
|
|
207
|
+
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
208
|
+
!order.review && (
|
|
209
|
+
<TouchableOpacity
|
|
210
|
+
onPress={() => handleClickOrderReview(order)}
|
|
211
|
+
style={styles.reviewButton}>
|
|
212
|
+
<OText size={10} color={theme.colors.primary} numberOfLines={1}>
|
|
213
|
+
{t('REVIEW', 'Review')}
|
|
167
214
|
</OText>
|
|
168
|
-
</
|
|
215
|
+
</TouchableOpacity>
|
|
169
216
|
)}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
217
|
+
{order.cart && (
|
|
218
|
+
<OButton
|
|
219
|
+
text={t('REORDER', 'Reorder')}
|
|
220
|
+
imgRightSrc={''}
|
|
221
|
+
textStyle={styles.buttonText}
|
|
222
|
+
style={
|
|
223
|
+
((reorderLoading && order.id === reorderSelected) || cartState?.loading)
|
|
224
|
+
? styles.reorderLoading
|
|
225
|
+
: styles.reorderbutton
|
|
226
|
+
}
|
|
227
|
+
onClick={() => handleReorderClick(order)}
|
|
228
|
+
isLoading={(reorderLoading && order.id === reorderSelected) || cartState?.loading}
|
|
229
|
+
/>
|
|
230
|
+
)}
|
|
231
|
+
</ButtonWrapper>
|
|
232
|
+
)}
|
|
233
|
+
</ContentHeader>
|
|
234
|
+
<ContentFooter>
|
|
235
|
+
<View style={{ flex: 1 }}>
|
|
236
|
+
<View style={styles.infoText}>
|
|
237
|
+
{!!!pastOrders && (
|
|
238
|
+
<>
|
|
239
|
+
<OText
|
|
240
|
+
size={10}
|
|
241
|
+
space
|
|
242
|
+
color={theme.colors.textSecondary}
|
|
243
|
+
style={{ marginVertical: 3 }}
|
|
244
|
+
lineHeight={15}
|
|
245
|
+
numberOfLines={1}
|
|
246
|
+
>
|
|
247
|
+
{t('ORDER_NO', 'Order No') + '.'}
|
|
189
248
|
</OText>
|
|
190
|
-
|
|
249
|
+
<OText
|
|
250
|
+
size={10}
|
|
251
|
+
color={theme.colors.textSecondary}
|
|
252
|
+
style={{ marginVertical: 3 }}
|
|
253
|
+
lineHeight={15}
|
|
254
|
+
numberOfLines={1}
|
|
255
|
+
>
|
|
256
|
+
{order.id + ` \u2022 `}
|
|
257
|
+
</OText>
|
|
258
|
+
</>
|
|
191
259
|
)}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
onClick={() => handleReorderClick(order.id)}
|
|
203
|
-
isLoading={reorderLoading && order.id === reorderSelected}
|
|
204
|
-
/>
|
|
205
|
-
)}
|
|
206
|
-
</ButtonWrapper>
|
|
207
|
-
)}
|
|
208
|
-
</ContentHeader>
|
|
209
|
-
<ContentFooter>
|
|
210
|
-
<View style={{ flex: 1 }}>
|
|
211
|
-
<View style={styles.infoText}>
|
|
212
|
-
{!!!pastOrders && (
|
|
213
|
-
<>
|
|
214
|
-
<OText
|
|
215
|
-
size={10}
|
|
216
|
-
space
|
|
217
|
-
color={theme.colors.textSecondary}
|
|
218
|
-
style={{ marginVertical: 3 }}
|
|
219
|
-
lineHeight={15}
|
|
220
|
-
numberOfLines={1}
|
|
221
|
-
>
|
|
222
|
-
{t('ORDER_NO', 'Order No') + '.'}
|
|
223
|
-
</OText>
|
|
224
|
-
<OText
|
|
225
|
-
size={10}
|
|
226
|
-
color={theme.colors.textSecondary}
|
|
227
|
-
style={{ marginVertical: 3 }}
|
|
228
|
-
lineHeight={15}
|
|
229
|
-
numberOfLines={1}
|
|
230
|
-
>
|
|
231
|
-
{order.id + ` \u2022 `}
|
|
232
|
-
</OText>
|
|
233
|
-
</>
|
|
234
|
-
)}
|
|
260
|
+
<OText
|
|
261
|
+
size={10}
|
|
262
|
+
lineHeight={15}
|
|
263
|
+
color={theme.colors.textSecondary}
|
|
264
|
+
style={{ marginVertical: 3 }}
|
|
265
|
+
numberOfLines={1}>
|
|
266
|
+
{order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })}
|
|
267
|
+
</OText>
|
|
268
|
+
</View>
|
|
235
269
|
<OText
|
|
270
|
+
color={theme.colors.primary}
|
|
236
271
|
size={10}
|
|
237
272
|
lineHeight={15}
|
|
238
|
-
color={theme.colors.textSecondary}
|
|
239
|
-
style={{ marginVertical: 3 }}
|
|
240
273
|
numberOfLines={1}>
|
|
241
|
-
{
|
|
274
|
+
{getOrderStatus(order.status)?.value}
|
|
242
275
|
</OText>
|
|
243
276
|
</View>
|
|
244
|
-
<
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
277
|
+
<TouchableOpacity
|
|
278
|
+
onPress={handleChangeFavorite}
|
|
279
|
+
style={{ marginTop: 5 }}
|
|
280
|
+
>
|
|
281
|
+
<IconAntDesign
|
|
282
|
+
name={order?.favorite ? 'heart' : 'hearto'}
|
|
283
|
+
color={theme.colors.danger5}
|
|
284
|
+
size={16}
|
|
285
|
+
/>
|
|
286
|
+
</TouchableOpacity>
|
|
287
|
+
</ContentFooter>
|
|
288
|
+
</CardInfoWrapper>
|
|
289
|
+
</InnerContainer>
|
|
290
|
+
</Container>
|
|
291
|
+
<OAlert
|
|
292
|
+
open={confirm.open}
|
|
293
|
+
title={confirm.title}
|
|
294
|
+
content={confirm.content}
|
|
295
|
+
onAccept={confirm.handleOnAccept}
|
|
296
|
+
onCancel={() => handleOriginalReorder()}
|
|
297
|
+
onClose={() => handleOriginalReorder()}
|
|
298
|
+
/>
|
|
299
|
+
</>
|
|
300
|
+
|
|
266
301
|
)
|
|
267
302
|
}
|
|
268
303
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
useConfig,
|
|
5
5
|
useOrder,
|
|
6
6
|
useUtils,
|
|
7
|
+
useSession,
|
|
7
8
|
SingleProductCard as SingleProductCardController
|
|
8
9
|
} from 'ordering-components/native';
|
|
9
10
|
import { useTheme } from 'styled-components/native';
|
|
@@ -32,7 +33,9 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
32
33
|
productAddedToCartLength,
|
|
33
34
|
style,
|
|
34
35
|
handleFavoriteProduct,
|
|
35
|
-
enableIntersection
|
|
36
|
+
enableIntersection,
|
|
37
|
+
navigation,
|
|
38
|
+
businessId
|
|
36
39
|
} = props;
|
|
37
40
|
|
|
38
41
|
const theme = useTheme();
|
|
@@ -86,9 +89,9 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
86
89
|
}
|
|
87
90
|
});
|
|
88
91
|
|
|
89
|
-
|
|
90
92
|
const [, t] = useLanguage();
|
|
91
93
|
const [stateConfig] = useConfig();
|
|
94
|
+
const [{ auth }] = useSession()
|
|
92
95
|
const [{ parsePrice, optimizeImage }] = useUtils();
|
|
93
96
|
const [orderState] = useOrder()
|
|
94
97
|
const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
|
|
@@ -118,7 +121,11 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
118
121
|
);
|
|
119
122
|
|
|
120
123
|
const handleChangeFavorite = () => {
|
|
121
|
-
|
|
124
|
+
if (auth) {
|
|
125
|
+
handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
|
|
126
|
+
} else {
|
|
127
|
+
navigation && navigation.navigate('Login');
|
|
128
|
+
}
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
return (
|
|
@@ -148,7 +155,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
148
155
|
weight={'500'}
|
|
149
156
|
numberOfLines={1}
|
|
150
157
|
ellipsizeMode="tail"
|
|
151
|
-
style={styles.line18}>
|
|
158
|
+
style={{ ...styles.line18, flex: 1 }}>
|
|
152
159
|
{product?.name}
|
|
153
160
|
</OText>
|
|
154
161
|
<TouchableOpacity
|
|
@@ -49,10 +49,11 @@ const OBottomPopup = (props: Props) => {
|
|
|
49
49
|
<View style={{ paddingTop: top, paddingBottom: bottom }}>
|
|
50
50
|
<View style={styles.modalTitleStyle}>
|
|
51
51
|
{closeIcon && (
|
|
52
|
-
<TouchableOpacity onPress={onClose} style={styles.closeIconStyle}>
|
|
52
|
+
<TouchableOpacity onPress={() => onClose()} style={styles.closeIconStyle}>
|
|
53
53
|
<OIcon
|
|
54
54
|
src={closeIcon}
|
|
55
|
-
width={
|
|
55
|
+
width={20}
|
|
56
|
+
height={20}
|
|
56
57
|
/>
|
|
57
58
|
</TouchableOpacity>
|
|
58
59
|
)}
|
|
@@ -93,7 +94,8 @@ const styles = StyleSheet.create({
|
|
|
93
94
|
closeIconStyle: {
|
|
94
95
|
position: 'absolute',
|
|
95
96
|
left: 25,
|
|
96
|
-
top:
|
|
97
|
+
top: 25,
|
|
98
|
+
zIndex: 100
|
|
97
99
|
},
|
|
98
100
|
modalTitleStyle: {
|
|
99
101
|
position: 'relative',
|
|
@@ -169,6 +169,7 @@ export interface BusinessesListingParams {
|
|
|
169
169
|
priceLevelSelected?: any;
|
|
170
170
|
handleChangePriceLevel?: any;
|
|
171
171
|
businessTypeSelected?: any;
|
|
172
|
+
logosLayout?: boolean;
|
|
172
173
|
}
|
|
173
174
|
export interface HighestRatedBusinessesParams {
|
|
174
175
|
businessesList: { businesses: Array<any>, loading: boolean, error: null | string };
|
|
@@ -287,7 +288,8 @@ export interface BusinessProductsListParams {
|
|
|
287
288
|
onClickCategory?: any,
|
|
288
289
|
lazyLoadProductsRecommended?: boolean,
|
|
289
290
|
isFiltMode?: boolean,
|
|
290
|
-
handleUpdateProducts?: any
|
|
291
|
+
handleUpdateProducts?: any,
|
|
292
|
+
navigation?: any;
|
|
291
293
|
}
|
|
292
294
|
export interface SingleProductCardParams {
|
|
293
295
|
businessId: any;
|
|
@@ -300,6 +302,7 @@ export interface SingleProductCardParams {
|
|
|
300
302
|
handleFavoriteProduct?: any;
|
|
301
303
|
handleUpdateProducts?: any;
|
|
302
304
|
enableIntersection?: boolean;
|
|
305
|
+
navigation?: any;
|
|
303
306
|
}
|
|
304
307
|
export interface BusinessInformationParams {
|
|
305
308
|
navigation?: any,
|
|
@@ -549,7 +552,9 @@ export interface OrderTypeSelectParams {
|
|
|
549
552
|
defaultValue?: number;
|
|
550
553
|
configTypes?: Array<any>;
|
|
551
554
|
orderTypes: Array<any>;
|
|
552
|
-
setOrderTypeValue?: (value: number) => any
|
|
555
|
+
setOrderTypeValue?: (value: number) => any,
|
|
556
|
+
isChewLayout?: boolean;
|
|
557
|
+
chewOrderTypes?: any;
|
|
553
558
|
}
|
|
554
559
|
export interface UpsellingProductsParams {
|
|
555
560
|
isCustomMode?: boolean;
|
|
@@ -692,7 +697,9 @@ export interface SingleOrderCardParams {
|
|
|
692
697
|
onNavigationRedirect?: (route: string, params?: any) => {},
|
|
693
698
|
pastOrders: any,
|
|
694
699
|
isMessageView?: any,
|
|
695
|
-
handleClickOrder: (value: any) => {}
|
|
700
|
+
handleClickOrder: (value: any) => {},
|
|
701
|
+
handleRemoveCart: () => {},
|
|
702
|
+
cartState: any
|
|
696
703
|
}
|
|
697
704
|
|
|
698
705
|
export interface PreviousBusinessOrderedParams {
|