ordering-ui-react-native 0.12.14 → 0.12.18
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/AddressList/index.tsx +3 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
- package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
- package/themes/business/src/components/OrdersOption/index.tsx +19 -15
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
- package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
- package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
- package/themes/business/src/components 2/Chat/index.tsx +1152 -0
- package/themes/business/src/components 2/Chat/styles.tsx +12 -0
- package/themes/business/src/components 2/Contacts/index.tsx +299 -0
- package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
- package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
- package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
- package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
- package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
- package/themes/business/src/components 2/Home/index.tsx +111 -0
- package/themes/business/src/components 2/Home/styles.tsx +27 -0
- package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
- package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
- package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
- package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
- package/themes/business/src/components 2/MapView/index.tsx +317 -0
- package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
- package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
- package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
- package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
- package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
- package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
- package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
- package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
- package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
- package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
- package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
- package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
- package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
- package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
- package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
- package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
- package/themes/business/src/components 2/StoresList/index.tsx +208 -0
- package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
- package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
- package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
- package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
- package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
- package/themes/business/src/components 2/shared/OButton.tsx +149 -0
- package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
- package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
- package/themes/business/src/components 2/shared/OFab.tsx +54 -0
- package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
- package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
- package/themes/business/src/components 2/shared/OInput.tsx +144 -0
- package/themes/business/src/components 2/shared/OLink.tsx +76 -0
- package/themes/business/src/components 2/shared/OModal.tsx +275 -0
- package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
- package/themes/business/src/components 2/shared/OText.tsx +55 -0
- package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
- package/themes/business/src/components 2/shared/OToast.tsx +92 -0
- package/themes/business/src/components 2/shared/index.tsx +27 -0
- package/themes/business/src/types/index.tsx +4 -1
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
- package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
- package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
- package/themes/original/src/components/OrderProgress/index.tsx +32 -18
|
@@ -0,0 +1,344 @@
|
|
|
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
|
+
};
|