@linktr.ee/messaging-react 1.24.4-rc-1773546789 → 1.24.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "1.24.4-rc-1773546789",
3
+ "version": "1.24.4",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -54,4 +54,26 @@ describe('ChannelList', () => {
54
54
  allowNewMessagesFromUnfilteredChannels: true,
55
55
  })
56
56
  })
57
+
58
+ it('passes new-channel event handlers through to Stream ChannelList', () => {
59
+ const onMessageNew = vi.fn()
60
+ const onAddedToChannel = vi.fn()
61
+
62
+ renderWithProviders(
63
+ React.createElement(ChannelList, {
64
+ ...defaultProps,
65
+ onMessageNew,
66
+ onAddedToChannel,
67
+ })
68
+ )
69
+
70
+ expect(streamChannelListMock).toHaveBeenCalledOnce()
71
+ const streamProps = streamChannelListMock.mock.calls[0][0] as {
72
+ onMessageNew?: unknown
73
+ onAddedToChannel?: unknown
74
+ }
75
+
76
+ expect(streamProps.onMessageNew).toBe(onMessageNew)
77
+ expect(streamProps.onAddedToChannel).toBe(onAddedToChannel)
78
+ })
57
79
  })
@@ -19,6 +19,8 @@ export const ChannelList = React.memo<ChannelListProps>(
19
19
  selectedChannel,
20
20
  filters,
21
21
  allowNewMessagesFromUnfilteredChannels = false,
22
+ onMessageNew,
23
+ onAddedToChannel,
22
24
  sort = DEFAULT_SORT,
23
25
  className,
24
26
  customEmptyStateIndicator,
@@ -67,6 +69,8 @@ export const ChannelList = React.memo<ChannelListProps>(
67
69
  allowNewMessagesFromUnfilteredChannels={
68
70
  allowNewMessagesFromUnfilteredChannels
69
71
  }
72
+ onMessageNew={onMessageNew}
73
+ onAddedToChannel={onAddedToChannel}
70
74
  Preview={CustomChannelPreview}
71
75
  EmptyStateIndicator={customEmptyStateIndicator}
72
76
  />
package/src/types.ts CHANGED
@@ -9,7 +9,10 @@ import type {
9
9
  LocalMessage,
10
10
  SendMessageAPIResponse,
11
11
  } from 'stream-chat'
12
- import { EmptyStateIndicatorProps } from 'stream-chat-react'
12
+ import type {
13
+ ChannelListProps as StreamChannelListProps,
14
+ EmptyStateIndicatorProps,
15
+ } from 'stream-chat-react'
13
16
 
14
17
  import type { MessageMetadata } from './stream-custom-data'
15
18
 
@@ -76,6 +79,18 @@ export interface ChannelListProps {
76
79
  * ChannelList consumers.
77
80
  */
78
81
  allowNewMessagesFromUnfilteredChannels?: boolean
82
+ /**
83
+ * Advanced override for handling `notification.message_new` events.
84
+ * Use for filtered/product-defined views that need to verify whether a
85
+ * channel belongs in the current list before inserting it.
86
+ */
87
+ onMessageNew?: StreamChannelListProps['onMessageNew']
88
+ /**
89
+ * Advanced override for handling `notification.added_to_channel` events.
90
+ * Use for filtered/product-defined views that need to verify whether a
91
+ * channel belongs in the current list before inserting it.
92
+ */
93
+ onAddedToChannel?: StreamChannelListProps['onAddedToChannel']
79
94
  /**
80
95
  * Sort order for the channel list query.
81
96
  * Defaults to `{ last_message_at: -1 }` (most recent first).