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.
Files changed (91) hide show
  1. package/package.json +1 -1
  2. package/src/config.json +2 -2
  3. package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
  4. package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
  5. package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
  6. package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
  7. package/themes/business/src/components 2/Chat/index.tsx +0 -1152
  8. package/themes/business/src/components 2/Chat/styles.tsx +0 -12
  9. package/themes/business/src/components 2/Contacts/index.tsx +0 -299
  10. package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
  11. package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
  12. package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
  13. package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
  14. package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
  15. package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
  16. package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
  17. package/themes/business/src/components 2/Home/index.tsx +0 -111
  18. package/themes/business/src/components 2/Home/styles.tsx +0 -27
  19. package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
  20. package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
  21. package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
  22. package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
  23. package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
  24. package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
  25. package/themes/business/src/components 2/MapView/index.tsx +0 -317
  26. package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
  27. package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
  28. package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
  29. package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
  30. package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
  31. package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
  32. package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
  33. package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
  34. package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
  35. package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
  36. package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
  37. package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
  38. package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
  39. package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
  40. package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
  41. package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
  42. package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
  43. package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
  44. package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
  45. package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
  46. package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
  47. package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
  48. package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
  49. package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
  50. package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
  51. package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
  52. package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
  53. package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
  54. package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
  55. package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
  56. package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
  57. package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
  58. package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
  59. package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
  60. package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
  61. package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
  62. package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
  63. package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
  64. package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
  65. package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
  66. package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
  67. package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
  68. package/themes/business/src/components 2/StoresList/index.tsx +0 -208
  69. package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
  70. package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
  71. package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
  72. package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
  73. package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
  74. package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
  75. package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
  76. package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
  77. package/themes/business/src/components 2/shared/OButton.tsx +0 -149
  78. package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
  79. package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
  80. package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
  81. package/themes/business/src/components 2/shared/OFab.tsx +0 -54
  82. package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
  83. package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
  84. package/themes/business/src/components 2/shared/OInput.tsx +0 -144
  85. package/themes/business/src/components 2/shared/OLink.tsx +0 -76
  86. package/themes/business/src/components 2/shared/OModal.tsx +0 -275
  87. package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
  88. package/themes/business/src/components 2/shared/OText.tsx +0 -55
  89. package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
  90. package/themes/business/src/components 2/shared/OToast.tsx +0 -92
  91. package/themes/business/src/components 2/shared/index.tsx +0 -27
@@ -1,454 +0,0 @@
1
- //React & React Native
2
- import React, { useState, useEffect } from 'react';
3
- import { StyleSheet, View, Platform } from 'react-native';
4
-
5
- // Thirds
6
- import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
7
-
8
- //OrderingComponent
9
- import {
10
- useLanguage,
11
- OrderDetails as OrderDetailsConTableoller,
12
- useToast,
13
- useSession,
14
- ToastType,
15
- } from 'ordering-components/native';
16
-
17
- //Components
18
- import Alert from '../../providers/AlertProvider';
19
- import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
20
- import { Chat } from '../Chat';
21
- import { FloatingButton } from '../FloatingButton';
22
- import { DriverMap } from '../DriverMap';
23
- import { OButton } from '../shared';
24
- import { OModal } from '../shared';
25
- import { OrderDetailsParams } from '../../types';
26
- import { USER_TYPE } from '../../config/constants';
27
- import { useTheme } from 'styled-components/native';
28
- import { NotFoundSource } from '../NotFoundSource';
29
- import { getOrderStatus } from '../../utils';
30
- import { OrderHeaderComponent } from './OrderHeaderComponent';
31
- import { OrderContentComponent } from './OrderContentComponent';
32
-
33
- //Styles
34
- import { OrderDetailsContainer, Pickup } from './styles';
35
-
36
- export const OrderDetailsUI = (props: OrderDetailsParams) => {
37
- const {
38
- navigation,
39
- messages,
40
- setMessages,
41
- readMessages,
42
- messagesReadList,
43
- handleChangeOrderStatus,
44
- permissions,
45
- askLocationPermission,
46
- driverLocation,
47
- actions,
48
- updateDriverPosition,
49
- driverUpdateLocation,
50
- setDriverUpdateLocation,
51
- titleAccept,
52
- titleReject,
53
- appTitle,
54
- } = props;
55
-
56
- const [, { showToast }] = useToast();
57
- const { order, loading, error } = props.order;
58
- const theme = useTheme();
59
- const [, t] = useLanguage();
60
- const [session] = useSession();
61
- const [actionOrder, setActionOrder] = useState('');
62
- const [unreadAlert, setUnreadAlert] = useState({
63
- business: false,
64
- driver: false,
65
- });
66
- const [openModalForMapView, setOpenModalForMapView] = useState(false);
67
- const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
68
- const [openModalForAccept, setOpenModalForAccept] = useState(false);
69
- const [alertState, setAlertState] = useState<{
70
- open: boolean;
71
- content: Array<string>;
72
- key?: string | null;
73
- }>({ open: false, content: [], key: null });
74
-
75
- const showFloatButtonsPickUp: any = {
76
- 8: true,
77
- 3: true,
78
- 18: true,
79
- };
80
-
81
- const showFloatButtonsAcceptOrReject: any = {
82
- 0: true,
83
- 4: true,
84
- 7: true,
85
- 14: true
86
- };
87
-
88
- const marginContainer: any = {
89
- 0: true,
90
- 3: true,
91
- 7: true,
92
- 8: true,
93
- 9: true,
94
- };
95
-
96
- const handleOpenMessagesForBusiness = () => {
97
- setOpenModalForBusiness(true);
98
- readMessages && readMessages();
99
- };
100
-
101
- const handleOpenMapView = async () => {
102
- if (permissions.locationStatus === 'granted') {
103
- setOpenModalForMapView(!openModalForMapView);
104
- } else if (permissions.locationStatus === 'blocked') {
105
- // redirectToSettings();
106
- showToast(
107
- ToastType.Error,
108
- t(
109
- 'GEOLOCATION_SERVICE_PERMISSION_BLOCKED',
110
- 'Geolocation service permissions blocked.',
111
- ),
112
- );
113
- } else {
114
- const response = await askLocationPermission();
115
- if (response === 'granted') {
116
- setOpenModalForMapView(!openModalForMapView);
117
- }
118
- }
119
- };
120
-
121
- const handleViewActionOrder = (action: string) => {
122
- if (openModalForMapView) {
123
- setOpenModalForMapView(false);
124
- }
125
- setActionOrder(action);
126
- setOpenModalForAccept(true);
127
- };
128
-
129
- useEffect(() => {
130
- if (permissions.locationStatus !== 'granted' && openModalForMapView) {
131
- setOpenModalForMapView(false);
132
- }
133
- }, [permissions.locationStatus]);
134
-
135
- useEffect(() => {
136
- if (openModalForAccept) {
137
- setOpenModalForAccept(false);
138
- }
139
-
140
- if (openModalForBusiness) {
141
- setOpenModalForBusiness(false);
142
- }
143
-
144
- if (openModalForMapView) {
145
- setOpenModalForMapView(false);
146
- }
147
- }, [loading]);
148
-
149
- const handleCloseModal = () => {
150
- setOpenModalForBusiness(false);
151
- };
152
-
153
- const handleArrowBack: any = () => {
154
- navigation?.canGoBack() && navigation.goBack();
155
- };
156
-
157
- useEffect(() => {
158
- if (order?.driver === null && session?.user?.level === 4) {
159
- setAlertState({
160
- open: true,
161
- content: [
162
- t(
163
- 'YOU_HAVE_BEEN_REMOVED_FROM_THE_ORDER',
164
- 'You have been removed from the order',
165
- ),
166
- ],
167
- key: null,
168
- });
169
- }
170
- }, [order?.driver]);
171
-
172
- const locations = [
173
- {
174
- ...order?.business?.location,
175
- title: order?.business?.name,
176
- icon: order?.business?.logo || theme.images.dummies.businessLogo,
177
- type: 'Business',
178
- },
179
- {
180
- ...order?.customer?.location,
181
- title: order?.customer?.name,
182
- icon:
183
- order?.customer?.photo ||
184
- 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
185
- type: 'Customer',
186
- },
187
- ];
188
-
189
- useEffect(() => {
190
- if (driverLocation) {
191
- locations[0] = driverLocation;
192
- }
193
- }, [driverLocation]);
194
-
195
- useEffect(() => {
196
- if (messagesReadList?.length) {
197
- openModalForBusiness
198
- ? setUnreadAlert({ ...unreadAlert, business: false })
199
- : setUnreadAlert({ ...unreadAlert, driver: false });
200
- }
201
- }, [messagesReadList]);
202
-
203
- const styles = StyleSheet.create({
204
- btnPickUp: {
205
- borderWidth: 0,
206
- backgroundColor: theme.colors.btnBGWhite,
207
- borderRadius: 8,
208
- },
209
- });
210
-
211
- let locationMarker;
212
- let isToFollow = false;
213
- let isBusinessMarker = false;
214
-
215
- if (order?.status === 7 || order?.status === 8) {
216
- const markerBusiness = 'Business';
217
- isBusinessMarker = true;
218
- locationMarker = locations.find(
219
- (location: any) => location.type === markerBusiness,
220
- );
221
-
222
- if (order?.status === 8) {
223
- isToFollow = true;
224
- }
225
- } else if (order?.status === 3 || order?.status === 9) {
226
- const markerCustomer = 'Customer';
227
- isToFollow = true;
228
- isBusinessMarker = false;
229
- locationMarker = locations.find(
230
- (location: any) => location.type === markerCustomer,
231
- );
232
- } else {
233
- const markerBusiness = 'Business';
234
- locationMarker = locations.find(
235
- (location: any) => location.type === markerBusiness,
236
- );
237
- }
238
-
239
- return (
240
- <>
241
- {(!order || Object.keys(order).length === 0) &&
242
- (error?.length < 1 || !error) && (
243
- <View style={{ flex: 1 }}>
244
- {[...Array(6)].map((item, i) => (
245
- <Placeholder key={i} Animation={Fade}>
246
- <View style={{ flexDirection: 'row', paddingVertical: 20 }}>
247
- <Placeholder>
248
- <PlaceholderLine width={100} />
249
- <PlaceholderLine width={70} />
250
- <PlaceholderLine width={30} />
251
- <PlaceholderLine width={20} />
252
- </Placeholder>
253
- </View>
254
- </Placeholder>
255
- ))}
256
- </View>
257
- )}
258
-
259
- {(!!error || error) && (
260
- <NotFoundSource
261
- btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
262
- content={
263
- props.order.error[0] ||
264
- props.order.error ||
265
- t('NETWORK_ERROR', 'Network Error')
266
- }
267
- onClickButton={() => navigation.navigate('Orders')}
268
- />
269
- )}
270
- {order && Object.keys(order).length > 0 && (error?.length < 1 || !error) && (
271
- <View style={{ flex: 1 }}>
272
- <OrderHeaderComponent
273
- order={order}
274
- handleOpenMapView={handleOpenMapView}
275
- handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
276
- getOrderStatus={getOrderStatus}
277
- handleArrowBack={handleArrowBack}
278
- />
279
- <OrderDetailsContainer
280
- keyboardShouldPersistTaps="handled"
281
- showsVerticalScrollIndicator={false}
282
- >
283
- <>
284
- <OrderContentComponent order={order} />
285
- {(order?.status === 8 || order?.status === 18) && order?.delivery_type === 1 && (
286
- <Pickup>
287
- <OButton
288
- style={styles.btnPickUp}
289
- textStyle={{ color: theme.colors.primary }}
290
- text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
291
- onClick={() =>
292
- handleChangeOrderStatus && handleChangeOrderStatus(3)
293
- }
294
- imgLeftStyle={{ tintColor: theme.colors.backArrow }}
295
- />
296
- </Pickup>
297
- )}
298
- {(order?.status === 3) && order?.delivery_type === 1 && (
299
- <View style={{ paddingVertical: 20, marginBottom: 20 }}>
300
- <OButton
301
- style={styles.btnPickUp}
302
- textStyle={{ color: theme.colors.white }}
303
- text={t('ORDER_NOT_READY', 'Order not ready')}
304
- onClick={() =>
305
- handleChangeOrderStatus && handleChangeOrderStatus(14)
306
- }
307
- imgLeftStyle={{ tintColor: theme.colors.backArrow }}
308
- bgColor={theme.colors.red}
309
- />
310
- </View>
311
- )}
312
- </>
313
-
314
- <OModal
315
- open={openModalForBusiness}
316
- order={order}
317
- title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
318
- entireModal
319
- onClose={() => handleCloseModal()}>
320
- <Chat
321
- type={
322
- openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
323
- }
324
- orderId={order?.id}
325
- messages={messages}
326
- order={order}
327
- setMessages={setMessages}
328
- />
329
- </OModal>
330
-
331
- <OModal
332
- open={openModalForAccept}
333
- onClose={() => setOpenModalForAccept(false)}
334
- entireModal
335
- customClose>
336
- <AcceptOrRejectOrder
337
- handleUpdateOrder={handleChangeOrderStatus}
338
- closeModal={setOpenModalForAccept}
339
- customerCellphone={order?.customer?.cellphone}
340
- loading={loading}
341
- action={actionOrder}
342
- orderId={order?.id}
343
- notShowCustomerPhone
344
- actions={actions}
345
- titleAccept={titleAccept}
346
- titleReject={titleReject}
347
- appTitle={appTitle}
348
- />
349
- </OModal>
350
-
351
- <OModal
352
- open={openModalForMapView}
353
- onClose={() => handleOpenMapView()}
354
- entireModal
355
- customClose>
356
- <DriverMap
357
- navigation={navigation}
358
- order={order}
359
- orderStatus={getOrderStatus(order?.status, t)?.value || ''}
360
- location={locationMarker}
361
- readOnly
362
- updateDriverPosition={updateDriverPosition}
363
- driverUpdateLocation={driverUpdateLocation}
364
- setDriverUpdateLocation={setDriverUpdateLocation}
365
- handleViewActionOrder={handleViewActionOrder}
366
- isBusinessMarker={isBusinessMarker}
367
- isToFollow={isToFollow}
368
- showAcceptOrReject={
369
- showFloatButtonsAcceptOrReject[order?.status]
370
- }
371
- handleOpenMapView={handleOpenMapView}
372
- />
373
- </OModal>
374
-
375
- <View
376
- style={{
377
- height:
378
- order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
379
- }}
380
- />
381
- </OrderDetailsContainer>
382
-
383
- {showFloatButtonsPickUp[order?.status] && (
384
- <FloatingButton
385
- disabled={loading}
386
- btnText={t('PICKUP_FAILED', 'Pickup failed')}
387
- isSecondaryBtn={false}
388
- secondButtonClick={() =>
389
- handleChangeOrderStatus && handleChangeOrderStatus(9)
390
- }
391
- firstButtonClick={() =>
392
- handleViewActionOrder && handleViewActionOrder('failed')
393
- }
394
- secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
395
- secondButton={true}
396
- firstColorCustom={theme.colors.red}
397
- secondColorCustom={theme.colors.green}
398
- widthButton={'45%'}
399
- />
400
- )}
401
- {(order?.status === 9 || order?.status === 19) && (
402
- <>
403
- <FloatingButton
404
- disabled={loading}
405
- btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
406
- isSecondaryBtn={false}
407
- secondButtonClick={() =>
408
- handleChangeOrderStatus && handleChangeOrderStatus(11)
409
- }
410
- firstButtonClick={() =>
411
- handleViewActionOrder && handleViewActionOrder('failed')
412
- }
413
- secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
414
- secondButton={true}
415
- firstColorCustom={theme.colors.red}
416
- secondColorCustom={theme.colors.green}
417
- widthButton={'45%'}
418
- />
419
- </>
420
- )}
421
- {showFloatButtonsAcceptOrReject[order?.status] && (
422
- <FloatingButton
423
- btnText={t('REJECT', 'Reject')}
424
- isSecondaryBtn={false}
425
- secondButtonClick={() => handleViewActionOrder('accept')}
426
- firstButtonClick={() => handleViewActionOrder('reject')}
427
- secondBtnText={t('ACCEPT', 'Accept')}
428
- secondButton={true}
429
- firstColorCustom={theme.colors.red}
430
- secondColorCustom={theme.colors.green}
431
- widthButton={'45%'}
432
- />
433
- )}
434
-
435
- <Alert
436
- open={alertState.open}
437
- onAccept={handleArrowBack}
438
- onClose={handleArrowBack}
439
- content={alertState.content}
440
- title={t('WARNING', 'Warning')}
441
- />
442
- </View>
443
- )}
444
- </>
445
- );
446
- };
447
-
448
- export const OrderDetailsDelivery = (props: OrderDetailsParams) => {
449
- const orderDetailsProps = {
450
- ...props,
451
- UIComponent: OrderDetailsUI,
452
- };
453
- return <OrderDetailsConTableoller {...orderDetailsProps} />;
454
- };