ordering-ui-react-native 0.12.18 → 0.12.19
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/config.json +2 -2
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
- package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
- package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
- package/themes/business/src/components 2/Chat/index.tsx +0 -1152
- package/themes/business/src/components 2/Chat/styles.tsx +0 -12
- package/themes/business/src/components 2/Contacts/index.tsx +0 -299
- package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
- package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
- package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
- package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
- package/themes/business/src/components 2/Home/index.tsx +0 -111
- package/themes/business/src/components 2/Home/styles.tsx +0 -27
- package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
- package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
- package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
- package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
- package/themes/business/src/components 2/MapView/index.tsx +0 -317
- package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
- package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
- package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
- package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
- package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
- package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
- package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
- package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
- package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
- package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
- package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
- package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
- package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
- package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
- package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
- package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
- package/themes/business/src/components 2/StoresList/index.tsx +0 -208
- package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
- package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
- package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
- package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
- package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
- package/themes/business/src/components 2/shared/OButton.tsx +0 -149
- package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
- package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
- package/themes/business/src/components 2/shared/OFab.tsx +0 -54
- package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
- package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
- package/themes/business/src/components 2/shared/OInput.tsx +0 -144
- package/themes/business/src/components 2/shared/OLink.tsx +0 -76
- package/themes/business/src/components 2/shared/OModal.tsx +0 -275
- package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
- package/themes/business/src/components 2/shared/OText.tsx +0 -55
- package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
- package/themes/business/src/components 2/shared/OToast.tsx +0 -92
- package/themes/business/src/components 2/shared/index.tsx +0 -27
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
3
|
-
import { Chat } from '../Chat';
|
|
4
|
-
import { StyleSheet, View, BackHandler } from 'react-native';
|
|
5
|
-
import {
|
|
6
|
-
useLanguage,
|
|
7
|
-
OrderDetails as OrderDetailsController,
|
|
8
|
-
useSession,
|
|
9
|
-
} from 'ordering-components/native';
|
|
10
|
-
import { useUtils } from 'ordering-components/native';
|
|
11
|
-
|
|
12
|
-
import { OIcon, OIconButton, OText } from '../shared';
|
|
13
|
-
import { OrderDetailsParams } from '../../types';
|
|
14
|
-
import { USER_TYPE } from '../../config/constants';
|
|
15
|
-
import { useTheme } from 'styled-components/native';
|
|
16
|
-
import Alert from '../../providers/AlertProvider';
|
|
17
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
18
|
-
|
|
19
|
-
export const OrderMessageUI = (props: OrderDetailsParams) => {
|
|
20
|
-
const {
|
|
21
|
-
navigation,
|
|
22
|
-
messages,
|
|
23
|
-
setMessages,
|
|
24
|
-
readMessages,
|
|
25
|
-
messagesReadList,
|
|
26
|
-
setOrders,
|
|
27
|
-
} = props;
|
|
28
|
-
|
|
29
|
-
const [{ optimizeImage }] = useUtils();
|
|
30
|
-
const theme = useTheme();
|
|
31
|
-
const [, t] = useLanguage();
|
|
32
|
-
const [openModalForBusiness, setOpenModalForBusiness] = useState(true);
|
|
33
|
-
const [unreadAlert, setUnreadAlert] = useState({
|
|
34
|
-
business: false,
|
|
35
|
-
driver: false,
|
|
36
|
-
});
|
|
37
|
-
const { top } = useSafeAreaInsets();
|
|
38
|
-
const [{ user }] = useSession();
|
|
39
|
-
const { order, loading } = props.order;
|
|
40
|
-
const [alertState, setAlertState] = useState<{
|
|
41
|
-
open: boolean;
|
|
42
|
-
content: Array<string>;
|
|
43
|
-
key?: string | null;
|
|
44
|
-
}>({ open: false, content: [], key: null });
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (order?.driver === null && user.level === 4) {
|
|
48
|
-
setAlertState({
|
|
49
|
-
open: true,
|
|
50
|
-
content: [
|
|
51
|
-
t(
|
|
52
|
-
'YOU_HAVE_BEEN_REMOVED_FROM_THE_ORDER',
|
|
53
|
-
'You have been removed from the order',
|
|
54
|
-
),
|
|
55
|
-
],
|
|
56
|
-
key: null,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}, [order?.driver]);
|
|
60
|
-
|
|
61
|
-
const handleArrowBack = (): boolean => {
|
|
62
|
-
if (order?.unread_count !== undefined) {
|
|
63
|
-
setOrders?.((prevOrders: any) => {
|
|
64
|
-
const { data } = prevOrders;
|
|
65
|
-
|
|
66
|
-
const updateOrder = data?.find((_order: any, index: number) => {
|
|
67
|
-
if (_order.id === order?.id) {
|
|
68
|
-
_order.unread_count = 0;
|
|
69
|
-
data.splice(index, 1, _order);
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return false;
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
if (updateOrder) {
|
|
77
|
-
return { ...prevOrders, data };
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return prevOrders;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
readMessages?.();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
navigation?.canGoBack() && navigation.goBack();
|
|
87
|
-
|
|
88
|
-
return true;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
|
|
93
|
-
|
|
94
|
-
return () =>
|
|
95
|
-
BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
|
|
96
|
-
}, [order?.unread_count, messages?.messages]);
|
|
97
|
-
|
|
98
|
-
const backIfDriverDoesntExist = () => {
|
|
99
|
-
navigation?.canGoBack() && navigation.goBack();
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
if (messagesReadList?.length) {
|
|
104
|
-
openModalForBusiness
|
|
105
|
-
? setUnreadAlert({ ...unreadAlert, business: false })
|
|
106
|
-
: setUnreadAlert({ ...unreadAlert, driver: false });
|
|
107
|
-
}
|
|
108
|
-
}, [messagesReadList]);
|
|
109
|
-
|
|
110
|
-
const styles = StyleSheet.create({
|
|
111
|
-
titleSection: {
|
|
112
|
-
flexDirection: 'row',
|
|
113
|
-
justifyContent: 'space-between',
|
|
114
|
-
alignItems: 'center',
|
|
115
|
-
paddingHorizontal: 30,
|
|
116
|
-
paddingTop: 30,
|
|
117
|
-
paddingBottom: 25,
|
|
118
|
-
borderBottomWidth: 2,
|
|
119
|
-
borderBottomColor: '#e6e6e6',
|
|
120
|
-
},
|
|
121
|
-
titleGroups: {
|
|
122
|
-
alignItems: 'center',
|
|
123
|
-
flexDirection: 'row',
|
|
124
|
-
},
|
|
125
|
-
titleIcons: {
|
|
126
|
-
height: 33,
|
|
127
|
-
width: 33,
|
|
128
|
-
borderRadius: 7.6,
|
|
129
|
-
resizeMode: 'stretch',
|
|
130
|
-
},
|
|
131
|
-
shadow: {
|
|
132
|
-
height: 34,
|
|
133
|
-
width: 34,
|
|
134
|
-
alignItems: 'center',
|
|
135
|
-
justifyContent: 'center',
|
|
136
|
-
marginLeft: 15,
|
|
137
|
-
backgroundColor: theme.colors.clear,
|
|
138
|
-
paddingHorizontal: 3,
|
|
139
|
-
borderRadius: 7.6,
|
|
140
|
-
shadowColor: '#000',
|
|
141
|
-
shadowOffset: {
|
|
142
|
-
width: 0,
|
|
143
|
-
height: 2,
|
|
144
|
-
},
|
|
145
|
-
shadowOpacity: 0.25,
|
|
146
|
-
shadowRadius: 3.84,
|
|
147
|
-
elevation: 3,
|
|
148
|
-
},
|
|
149
|
-
cancelBtn: {
|
|
150
|
-
marginRight: 5,
|
|
151
|
-
zIndex: 10000,
|
|
152
|
-
height: 30,
|
|
153
|
-
width: 20,
|
|
154
|
-
justifyContent: 'flex-end',
|
|
155
|
-
},
|
|
156
|
-
modalText: {
|
|
157
|
-
fontFamily: 'Poppins',
|
|
158
|
-
fontStyle: 'normal',
|
|
159
|
-
fontWeight: '600',
|
|
160
|
-
color: theme.colors.textGray,
|
|
161
|
-
textAlign: 'center',
|
|
162
|
-
zIndex: 10,
|
|
163
|
-
},
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
return (
|
|
167
|
-
<>
|
|
168
|
-
{(!order || Object.keys(order).length === 0 || loading) && (
|
|
169
|
-
<View
|
|
170
|
-
style={{
|
|
171
|
-
padding: 40,
|
|
172
|
-
flex: 1,
|
|
173
|
-
backgroundColor: theme.colors.backgroundLight,
|
|
174
|
-
justifyContent: 'space-between',
|
|
175
|
-
}}>
|
|
176
|
-
<Placeholder>
|
|
177
|
-
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
178
|
-
<PlaceholderLine width={40} />
|
|
179
|
-
<PlaceholderLine
|
|
180
|
-
width={20}
|
|
181
|
-
style={{
|
|
182
|
-
marginLeft: 20,
|
|
183
|
-
borderRadius: 50,
|
|
184
|
-
width: 40,
|
|
185
|
-
height: 40,
|
|
186
|
-
}}
|
|
187
|
-
/>
|
|
188
|
-
<PlaceholderLine
|
|
189
|
-
width={20}
|
|
190
|
-
style={{
|
|
191
|
-
marginLeft: 10,
|
|
192
|
-
borderRadius: 50,
|
|
193
|
-
width: 40,
|
|
194
|
-
height: 40,
|
|
195
|
-
}}
|
|
196
|
-
/>
|
|
197
|
-
<PlaceholderLine
|
|
198
|
-
width={20}
|
|
199
|
-
style={{
|
|
200
|
-
marginLeft: 10,
|
|
201
|
-
borderRadius: 50,
|
|
202
|
-
width: 40,
|
|
203
|
-
height: 40,
|
|
204
|
-
}}
|
|
205
|
-
/>
|
|
206
|
-
</View>
|
|
207
|
-
</Placeholder>
|
|
208
|
-
|
|
209
|
-
<Placeholder>
|
|
210
|
-
<View style={{ flexDirection: 'column' }}>
|
|
211
|
-
<PlaceholderLine width={60} />
|
|
212
|
-
<PlaceholderLine width={40} />
|
|
213
|
-
<PlaceholderLine width={20} />
|
|
214
|
-
<PlaceholderLine width={20} />
|
|
215
|
-
</View>
|
|
216
|
-
<View
|
|
217
|
-
style={{
|
|
218
|
-
flexDirection: 'column',
|
|
219
|
-
justifyContent: 'flex-end',
|
|
220
|
-
alignItems: 'flex-end',
|
|
221
|
-
}}>
|
|
222
|
-
<PlaceholderLine width={60} />
|
|
223
|
-
<PlaceholderLine width={40} />
|
|
224
|
-
</View>
|
|
225
|
-
<View
|
|
226
|
-
style={{
|
|
227
|
-
flexDirection: 'row',
|
|
228
|
-
alignItems: 'center',
|
|
229
|
-
justifyContent: 'center',
|
|
230
|
-
}}>
|
|
231
|
-
<PlaceholderLine
|
|
232
|
-
width={20}
|
|
233
|
-
style={{
|
|
234
|
-
marginLeft: 20,
|
|
235
|
-
borderRadius: 50,
|
|
236
|
-
width: 50,
|
|
237
|
-
height: 50,
|
|
238
|
-
}}
|
|
239
|
-
/>
|
|
240
|
-
<PlaceholderLine
|
|
241
|
-
width={20}
|
|
242
|
-
style={{
|
|
243
|
-
marginLeft: 20,
|
|
244
|
-
borderRadius: 50,
|
|
245
|
-
width: 50,
|
|
246
|
-
height: 50,
|
|
247
|
-
}}
|
|
248
|
-
/>
|
|
249
|
-
</View>
|
|
250
|
-
<PlaceholderLine width={100} />
|
|
251
|
-
<PlaceholderLine
|
|
252
|
-
width={100}
|
|
253
|
-
style={{ borderRadius: 50, width: '100%', height: 30 }}
|
|
254
|
-
/>
|
|
255
|
-
</Placeholder>
|
|
256
|
-
</View>
|
|
257
|
-
)}
|
|
258
|
-
|
|
259
|
-
{order && Object.keys(order).length > 0 && !loading && (
|
|
260
|
-
<>
|
|
261
|
-
<View style={styles.titleSection}>
|
|
262
|
-
<View style={styles.titleGroups}>
|
|
263
|
-
<OIconButton
|
|
264
|
-
icon={theme.images.general.arrow_left}
|
|
265
|
-
iconStyle={{ width: 23, height: 23 }}
|
|
266
|
-
borderColor={theme.colors.clear}
|
|
267
|
-
style={styles.cancelBtn}
|
|
268
|
-
onClick={handleArrowBack}
|
|
269
|
-
/>
|
|
270
|
-
|
|
271
|
-
<OText size={16} style={styles.modalText} adjustsFontSizeToFit>
|
|
272
|
-
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id}`}
|
|
273
|
-
</OText>
|
|
274
|
-
</View>
|
|
275
|
-
|
|
276
|
-
<View style={styles.titleGroups}>
|
|
277
|
-
<View style={styles.shadow}>
|
|
278
|
-
{order?.business?.logo ? (
|
|
279
|
-
<OIcon
|
|
280
|
-
url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
|
|
281
|
-
style={styles.titleIcons}
|
|
282
|
-
/>
|
|
283
|
-
) : (
|
|
284
|
-
<OIcon
|
|
285
|
-
src={theme.images.dummies.businessLogo}
|
|
286
|
-
style={styles.titleIcons}
|
|
287
|
-
/>
|
|
288
|
-
)}
|
|
289
|
-
</View>
|
|
290
|
-
|
|
291
|
-
<View style={styles.shadow}>
|
|
292
|
-
<OIcon
|
|
293
|
-
url={optimizeImage(
|
|
294
|
-
order?.customer?.photo ||
|
|
295
|
-
theme?.images?.dummies?.customerPhoto,
|
|
296
|
-
'h_300,c_limit',
|
|
297
|
-
)}
|
|
298
|
-
style={styles.titleIcons}
|
|
299
|
-
/>
|
|
300
|
-
</View>
|
|
301
|
-
|
|
302
|
-
{order?.driver && (
|
|
303
|
-
<View style={styles.shadow}>
|
|
304
|
-
<OIcon
|
|
305
|
-
url={
|
|
306
|
-
optimizeImage(order?.driver?.photo, 'h_300,c_limit') ||
|
|
307
|
-
theme?.images?.dummies?.driverPhoto
|
|
308
|
-
}
|
|
309
|
-
style={styles.titleIcons}
|
|
310
|
-
/>
|
|
311
|
-
</View>
|
|
312
|
-
)}
|
|
313
|
-
</View>
|
|
314
|
-
</View>
|
|
315
|
-
|
|
316
|
-
<Chat
|
|
317
|
-
type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
|
|
318
|
-
orderId={order?.id}
|
|
319
|
-
messages={messages}
|
|
320
|
-
order={order}
|
|
321
|
-
setMessages={setMessages}
|
|
322
|
-
/>
|
|
323
|
-
|
|
324
|
-
<Alert
|
|
325
|
-
open={alertState.open}
|
|
326
|
-
onAccept={backIfDriverDoesntExist}
|
|
327
|
-
onClose={backIfDriverDoesntExist}
|
|
328
|
-
content={alertState.content}
|
|
329
|
-
title={t('ERROR', 'Error')}
|
|
330
|
-
/>
|
|
331
|
-
</>
|
|
332
|
-
)}
|
|
333
|
-
</>
|
|
334
|
-
);
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
export const OrderMessage = (props: OrderDetailsParams) => {
|
|
338
|
-
const orderDetailsProps = {
|
|
339
|
-
...props,
|
|
340
|
-
driverAndBusinessId: true,
|
|
341
|
-
UIComponent: OrderMessageUI,
|
|
342
|
-
};
|
|
343
|
-
return <OrderDetailsController {...orderDetailsProps} />;
|
|
344
|
-
};
|