@linktr.ee/messaging-react 3.6.2-rc-1783317817 → 3.6.2-rc-1783332217

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 (34) hide show
  1. package/dist/{Card-Ca5OtJh6.js → Card-0wf8lj5n.js} +2 -2
  2. package/dist/{Card-Ca5OtJh6.js.map → Card-0wf8lj5n.js.map} +1 -1
  3. package/dist/{Card-BYdqLBN3.cjs → Card-4UyBK3XO.cjs} +2 -2
  4. package/dist/{Card-BYdqLBN3.cjs.map → Card-4UyBK3XO.cjs.map} +1 -1
  5. package/dist/{Card-iHrzL32q.cjs → Card-6b4Ws9rn.cjs} +2 -2
  6. package/dist/{Card-iHrzL32q.cjs.map → Card-6b4Ws9rn.cjs.map} +1 -1
  7. package/dist/{Card-DuSTf-S8.cjs → Card-DsQhJjj0.cjs} +2 -2
  8. package/dist/{Card-DuSTf-S8.cjs.map → Card-DsQhJjj0.cjs.map} +1 -1
  9. package/dist/{Card-CZDLISxS.js → Card-RZ6C_IkE.js} +3 -3
  10. package/dist/{Card-CZDLISxS.js.map → Card-RZ6C_IkE.js.map} +1 -1
  11. package/dist/{Card-gjy-ib_1.js → Card-iGNcxybY.js} +2 -2
  12. package/dist/{Card-gjy-ib_1.js.map → Card-iGNcxybY.js.map} +1 -1
  13. package/dist/{LockedThumbnail-COK5XPQ9.js → LockedThumbnail-Do9udNMm.js} +2 -2
  14. package/dist/{LockedThumbnail-COK5XPQ9.js.map → LockedThumbnail-Do9udNMm.js.map} +1 -1
  15. package/dist/{LockedThumbnail-DrWiitE6.cjs → LockedThumbnail-N0pNOO3D.cjs} +2 -2
  16. package/dist/{LockedThumbnail-DrWiitE6.cjs.map → LockedThumbnail-N0pNOO3D.cjs.map} +1 -1
  17. package/dist/assets/index.css +1 -1
  18. package/dist/index-B3ZJaqJY.cjs +2 -0
  19. package/dist/index-B3ZJaqJY.cjs.map +1 -0
  20. package/dist/{index-CnR5N9Co.js → index-wFe1UO9t.js} +1104 -1097
  21. package/dist/index-wFe1UO9t.js.map +1 -0
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.js +1 -1
  24. package/package.json +2 -2
  25. package/src/components/CustomMessage/CustomMessage.stories.tsx +11 -18
  26. package/src/components/CustomMessage/SentMessageDeliveryStatus.test.tsx +107 -0
  27. package/src/components/CustomMessage/SentMessageDeliveryStatus.tsx +86 -0
  28. package/src/components/CustomMessage/index.tsx +2 -3
  29. package/src/styles.css +25 -16
  30. package/dist/index-CnR5N9Co.js.map +0 -1
  31. package/dist/index-pODWIZCi.cjs +0 -2
  32. package/dist/index-pODWIZCi.cjs.map +0 -1
  33. package/src/components/CustomMessage/MessageDeliveryStatus.test.tsx +0 -66
  34. package/src/components/CustomMessage/MessageDeliveryStatus.tsx +0 -53
@@ -1,66 +0,0 @@
1
- import type { LocalMessage } from 'stream-chat'
2
- import { describe, expect, it } from 'vitest'
3
-
4
- import { renderWithProviders, screen } from '../../test/utils'
5
-
6
- import { MessageDeliveryStatus } from './MessageDeliveryStatus'
7
-
8
- const receivedMessage = {
9
- id: 'message-1',
10
- status: 'received',
11
- type: 'regular',
12
- } as unknown as LocalMessage
13
-
14
- const render = (
15
- props: Partial<{ message: LocalMessage; groupStyles: string[] }> = {}
16
- ) =>
17
- renderWithProviders(
18
- <MessageDeliveryStatus
19
- message={props.message ?? receivedMessage}
20
- groupStyles={props.groupStyles ?? ['bottom']}
21
- />
22
- )
23
-
24
- describe('MessageDeliveryStatus', () => {
25
- it.each(['bottom', 'single'] as const)(
26
- 'renders "Delivered" at the end of a group (groupStyle: %s)',
27
- (style) => {
28
- render({ groupStyles: [style] })
29
-
30
- expect(screen.getByTestId('message-delivery-status')).toHaveTextContent(
31
- 'Delivered'
32
- )
33
- }
34
- )
35
-
36
- it.each(['top', 'middle'] as const)(
37
- 'renders nothing for a message that is not the end of its group (groupStyle: %s)',
38
- (style) => {
39
- const { container } = render({ groupStyles: [style] })
40
-
41
- expect(container).toBeEmptyDOMElement()
42
- }
43
- )
44
-
45
- it.each(['sending', 'failed'] as const)(
46
- 'renders nothing while the message status is %s',
47
- (status) => {
48
- const { container } = render({
49
- message: { ...receivedMessage, status } as unknown as LocalMessage,
50
- })
51
-
52
- expect(container).toBeEmptyDOMElement()
53
- }
54
- )
55
-
56
- it('renders nothing for error messages', () => {
57
- const { container } = render({
58
- message: {
59
- ...receivedMessage,
60
- type: 'error',
61
- } as unknown as LocalMessage,
62
- })
63
-
64
- expect(container).toBeEmptyDOMElement()
65
- })
66
- })
@@ -1,53 +0,0 @@
1
- import { ChecksIcon } from '@phosphor-icons/react'
2
- import type { LocalMessage } from 'stream-chat'
3
-
4
- interface MessageDeliveryStatusProps {
5
- message: LocalMessage
6
- /**
7
- * stream's per-message group-position styles (`'top' | 'middle' | 'bottom'
8
- * | 'single'`). We key off this rather than the `endOfGroup` boolean:
9
- * `endOfGroup` is only supplied by the *virtualized* MessageList, whereas
10
- * the standard (non-virtualized) MessageList this package renders through
11
- * passes `groupStyles` only. `getGroupStyles` accounts for author changes
12
- * and time gaps, so it matches the visual grouping (incl. date breaks).
13
- */
14
- groupStyles?: string[]
15
- }
16
-
17
- /** The last bubble of a group is 'bottom' (a run) or 'single' (standalone). */
18
- const isEndOfGroup = (groupStyles?: string[]) =>
19
- !!groupStyles &&
20
- (groupStyles.includes('bottom') || groupStyles.includes('single'))
21
-
22
- /**
23
- * "✓✓ Delivered" status shown beneath the last bubble of every message group,
24
- * on both the sent (right) and received (left) sides (MES-1036). The design
25
- * displays the status per group rather than only on the most recent message.
26
- *
27
- * Renders only once a message is stored (`status === 'received'`, which
28
- * `formatMessage` sets on every persisted message, incoming included) and
29
- * never on errors. Left/right alignment comes from the outer grid (see
30
- * `styles.css`).
31
- */
32
- export const MessageDeliveryStatus = ({
33
- message,
34
- groupStyles,
35
- }: MessageDeliveryStatusProps) => {
36
- if (
37
- !isEndOfGroup(groupStyles) ||
38
- message.type === 'error' ||
39
- message.status !== 'received'
40
- ) {
41
- return null
42
- }
43
-
44
- return (
45
- <div
46
- className="str-chat__message-delivery-status"
47
- data-testid="message-delivery-status"
48
- >
49
- <ChecksIcon size={14} weight="bold" aria-hidden="true" />
50
- <span>Delivered</span>
51
- </div>
52
- )
53
- }