ordering-ui-external 3.0.0 → 3.0.2

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 (17) hide show
  1. package/_bundles/{7.ordering-ui.5fbb70216ae0e9633027.js → 7.ordering-ui.2b6bfdaa8b236eb288fa.js} +1 -1
  2. package/_bundles/{ordering-ui.5fbb70216ae0e9633027.js → ordering-ui.2b6bfdaa8b236eb288fa.js} +2 -2
  3. package/_modules/themes/five/src/components/Messages/MapMessages.js +80 -0
  4. package/_modules/themes/five/src/components/Messages/index.js +13 -67
  5. package/package.json +2 -2
  6. package/src/themes/five/src/components/Messages/MapMessages.js +173 -0
  7. package/src/themes/five/src/components/Messages/index.js +13 -175
  8. /package/_bundles/{0.ordering-ui.5fbb70216ae0e9633027.js → 0.ordering-ui.2b6bfdaa8b236eb288fa.js} +0 -0
  9. /package/_bundles/{1.ordering-ui.5fbb70216ae0e9633027.js → 1.ordering-ui.2b6bfdaa8b236eb288fa.js} +0 -0
  10. /package/_bundles/{2.ordering-ui.5fbb70216ae0e9633027.js → 2.ordering-ui.2b6bfdaa8b236eb288fa.js} +0 -0
  11. /package/_bundles/{4.ordering-ui.5fbb70216ae0e9633027.js → 4.ordering-ui.2b6bfdaa8b236eb288fa.js} +0 -0
  12. /package/_bundles/{5.ordering-ui.5fbb70216ae0e9633027.js → 5.ordering-ui.2b6bfdaa8b236eb288fa.js} +0 -0
  13. /package/_bundles/{6.ordering-ui.5fbb70216ae0e9633027.js → 6.ordering-ui.2b6bfdaa8b236eb288fa.js} +0 -0
  14. /package/_bundles/{7.ordering-ui.5fbb70216ae0e9633027.js.LICENSE.txt → 7.ordering-ui.2b6bfdaa8b236eb288fa.js.LICENSE.txt} +0 -0
  15. /package/_bundles/{8.ordering-ui.5fbb70216ae0e9633027.js → 8.ordering-ui.2b6bfdaa8b236eb288fa.js} +0 -0
  16. /package/_bundles/{9.ordering-ui.5fbb70216ae0e9633027.js → 9.ordering-ui.2b6bfdaa8b236eb288fa.js} +0 -0
  17. /package/_bundles/{ordering-ui.5fbb70216ae0e9633027.js.LICENSE.txt → ordering-ui.2b6bfdaa8b236eb288fa.js.LICENSE.txt} +0 -0
@@ -4,7 +4,6 @@ import {
4
4
  Messages as MessagesController,
5
5
  useUtils,
6
6
  useLanguage,
7
- useSession,
8
7
  useEvent
9
8
  } from 'ordering-components-external'
10
9
  import { useForm } from 'react-hook-form'
@@ -15,14 +14,10 @@ import {
15
14
  HeaderProfile,
16
15
  Image,
17
16
  Chat,
18
- BubbleCustomer,
19
17
  MessageCustomer,
20
- MyName,
21
18
  MessageBusiness,
22
- BubbleBusines,
23
19
  SkeletonBubbleCustomer,
24
20
  SkeletonBubbleBusiness,
25
- ChatImage,
26
21
  TimeofSent,
27
22
  SendForm,
28
23
  Send,
@@ -43,7 +38,6 @@ import {
43
38
  InputWrapper,
44
39
  MessageContentWrapper,
45
40
  MessageCreatedDate,
46
- TimeofSentByAdmin,
47
41
  NotSendMessage,
48
42
  QuickMessageWrapper,
49
43
  ProfileMessageHeader,
@@ -63,6 +57,7 @@ import MdcCloseOctagonOutline from '@meronex/icons/mdc/MdcCloseOctagonOutline'
63
57
  import { bytesConverter, getTraduction } from '../../../../../utils'
64
58
  import { Alert } from '../Confirm'
65
59
  import { Modal } from '../Modal'
60
+ import { MapMessages } from './MapMessages'
66
61
 
67
62
  const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
68
63
 
@@ -90,7 +85,6 @@ const MessagesUI = (props) => {
90
85
  const [, t] = useLanguage()
91
86
  const { handleSubmit, register, errors, setValue } = useForm()
92
87
  const [alertState, setAlertState] = useState({ open: false, content: [] })
93
- const [{ user }] = useSession()
94
88
  const [events] = useEvent()
95
89
  const [{ parseDate, parseTime }] = useUtils()
96
90
  const buttonRef = useRef(null)
@@ -307,173 +301,6 @@ const MessagesUI = (props) => {
307
301
  events.emit('go_to_page', { page: 'business', params: { business_slug: slug } })
308
302
  }
309
303
 
310
- const MapMessages = ({ messages }) => {
311
- return (
312
- <>
313
- {props.beforeElements?.map((BeforeElement, i) => (
314
- <React.Fragment key={i}>
315
- {BeforeElement}
316
- </React.Fragment>))}
317
- {props.beforeComponents?.map((BeforeComponent, i) => (
318
- <BeforeComponent key={i} {...props} />))}
319
- {messages?.messages.map((message) => (
320
- <React.Fragment key={message.id}>
321
- {message.type === 1 && (
322
- <MessageContentWrapper key={message.id}>
323
- {message.change?.attribute !== 'driver_id' ? (
324
- <>
325
- <MessageCreatedDate>
326
- <span>{parseDate(message.created_at, { outputFormat: 'MMM DD, YYYY' })}</span>
327
- </MessageCreatedDate>
328
- <MessageConsole>
329
- <BubbleConsole>
330
- {t('ORDER', 'Order')} {' '}
331
- <strong>{t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))}</strong> {' '}
332
- {t('CHANGED_FROM', 'Changed from')} {' '}
333
- {filterSpecialStatus.includes(message.change.attribute) ? (
334
- <>
335
- {message.change.old === null ? <strong>0</strong> : (
336
- <>
337
- <strong>{message.change.old}</strong> {' '}
338
- </>
339
- )}
340
- <> {t('TO', 'to')} {' '} <strong>{message.change.new}</strong> {t('MINUTES', 'Minutes')}</>
341
- </>
342
- ) : (
343
- <>
344
- {message.change.old !== null && (
345
- <>
346
- <strong>{message.change?.attribute === 'logistic_status' ? getLogisticTagStatus(parseInt(message.change.old, 10)) : t(getStatus(parseInt(message.change.old, 10)))}</strong> {' '}
347
- </>
348
- )}
349
- <> {t('TO', 'to')} {' '} <strong>{message.change?.attribute === 'logistic_status' ? getLogisticTagStatus(parseInt(message.change.new, 10)) : t(getStatus(parseInt(message.change.new, 10)))}</strong> </>
350
- </>
351
- )}
352
- <TimeofSent>{parseTime(message.created_at)}</TimeofSent>
353
- </BubbleConsole>
354
- </MessageConsole>
355
- </>
356
- ) : (
357
- <>
358
- <MessageCreatedDate>
359
- <span>{parseDate(message.created_at, { outputFormat: 'MMM DD, YYYY' })}</span>
360
- </MessageCreatedDate>
361
- <MessageConsole>
362
- <BubbleConsole>
363
- {message.change.new ? (
364
- <>
365
- <strong>{message.driver?.name} {' '} {message.driver?.lastname && message.driver.lastname} </strong>
366
- {t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')}
367
- {message.comment && (<><br /> {message.comment.length}</>)}
368
- </>
369
- ) : <>{t('DRIVER_UNASSIGNED', 'Driver unassigned')}</>}
370
- <TimeofSent>{parseTime(message.created_at)}</TimeofSent>
371
- </BubbleConsole>
372
- </MessageConsole>
373
- </>
374
- )}
375
- </MessageContentWrapper>
376
-
377
- )}
378
- {(messagesToShow?.messages?.length || (message?.can_see?.includes('2') && business) || (message?.can_see?.includes('4') && driver)) && (
379
- <>
380
- {message.type === 2 && user?.id === message.author_id && (
381
- <MessageContentWrapper>
382
- <MessageCreatedDate>
383
- <span>{parseDate(message.created_at, { outputFormat: 'MMM DD, YYYY' })}</span>
384
- </MessageCreatedDate>
385
- <MessageCustomer>
386
- <BubbleCustomer>
387
- <strong>
388
- <MyName>
389
- {message.author.name} ({order.customer_id === message.author.id ? getLevel(3) : getLevel(message.author.level)})
390
- </MyName>
391
- </strong>
392
- {message.comment}
393
- <TimeofSent>{parseTime(message.created_at)}</TimeofSent>
394
- </BubbleCustomer>
395
- </MessageCustomer>
396
- </MessageContentWrapper>
397
- )}
398
- {message.type === 3 && user.id === message.author_id && (
399
- <MessageContentWrapper>
400
- <MessageCreatedDate>
401
- <span>{parseDate(message.created_at, { outputFormat: 'MMM DD, YYYY' })}</span>
402
- </MessageCreatedDate>
403
- <MessageCustomer>
404
- <BubbleCustomer name='image'>
405
- <strong>
406
- <MyName>
407
- {message.author.name} ({order.customer_id === message.author.id ? getLevel(3) : getLevel(message.author.level)})
408
- </MyName>
409
- </strong>
410
- <ChatImage><img src={message.source} onClick={() => handleModalImage(message.source)} alt='chat-image' width='168px' height='300px' /></ChatImage>
411
- {message.comment && (
412
- <>
413
- {message.comment}
414
- </>
415
- )}
416
- <TimeofSent>{parseTime(message.created_at)}</TimeofSent>
417
- </BubbleCustomer>
418
- </MessageCustomer>
419
- </MessageContentWrapper>
420
-
421
- )}
422
- {message.type === 2 && user?.id !== message.author_id && (
423
- <MessageContentWrapper>
424
- <MessageCreatedDate>
425
- <span>{parseDate(message.created_at, { outputFormat: 'MMM DD, YYYY' })}</span>
426
- </MessageCreatedDate>
427
- <MessageBusiness>
428
- <BubbleBusines>
429
- <strong>
430
- <MyName>
431
- {message.author.name} ({order.customer_id === message.author.id ? getLevel(3) : getLevel(message.author.level)})
432
- </MyName>
433
- </strong>
434
- {message.comment}
435
- <TimeofSentByAdmin>{parseTime(message.created_at)}</TimeofSentByAdmin>
436
- </BubbleBusines>
437
- </MessageBusiness>
438
- </MessageContentWrapper>
439
- )}
440
- {message.type === 3 && user.id !== message.author_id && (
441
- <MessageContentWrapper>
442
- <MessageCreatedDate>
443
- <span>{parseDate(message.created_at, { outputFormat: 'MMM DD, YYYY' })}</span>
444
- </MessageCreatedDate>
445
- <MessageBusiness>
446
- <BubbleBusines name='image'>
447
- <strong>
448
- <MyName>
449
- {message.author.name} ({order.customer_id === message.author.id ? getLevel(3) : getLevel(message.author.level)})
450
- </MyName>
451
- </strong>
452
- <ChatImage><img src={message.source} onClick={() => handleModalImage(message.source)} alt='chat-image' width='168px' height='300px' /></ChatImage>
453
- {message.comment && (
454
- <>
455
- {message.comment}
456
- </>
457
- )}
458
- <TimeofSent>{parseTime(message.created_at)}</TimeofSent>
459
- </BubbleBusines>
460
- </MessageBusiness>
461
- </MessageContentWrapper>
462
- )}
463
- </>
464
- )}
465
- </React.Fragment>
466
- ))}
467
- {props.afterComponents?.map((AfterComponent, i) => (
468
- <AfterComponent key={i} {...props} />))}
469
- {props.afterElements?.map((AfterElement, i) => (
470
- <React.Fragment key={i}>
471
- {AfterElement}
472
- </React.Fragment>))}
473
- </>
474
- )
475
- }
476
-
477
304
  return (
478
305
  <MessagesContainer profileMessages={profileMessages}>
479
306
  <MessagesLayoutWrapper>
@@ -657,7 +484,18 @@ const MessagesUI = (props) => {
657
484
  <TimeofSent>{parseTime(order.created_at)}</TimeofSent>
658
485
  </BubbleConsole>
659
486
  </MessageConsole>
660
- <MapMessages messages={messagesToShow?.messages?.length ? messagesToShow : messages} />
487
+ <MapMessages
488
+ messages={messagesToShow?.messages?.length ? messagesToShow : messages}
489
+ messagesToShow={messagesToShow}
490
+ order={order}
491
+ filterSpecialStatus={filterSpecialStatus}
492
+ handleModalImage={handleModalImage}
493
+ getLevel={getLevel}
494
+ business={business}
495
+ driver={driver}
496
+ getLogisticTagStatus={getLogisticTagStatus}
497
+ getStatus={getStatus}
498
+ />
661
499
  </MessageContentWrapper>
662
500
  )
663
501
  }