@linktr.ee/messaging-react 1.12.0 → 1.12.1
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/dist/index.d.ts +315 -18
- package/package.json +1 -1
- package/dist/.tsbuildinfo +0 -1
- package/dist/components/ActionButton/ActionButton.test.d.ts +0 -2
- package/dist/components/ActionButton/ActionButton.test.d.ts.map +0 -1
- package/dist/components/ActionButton/index.d.ts +0 -7
- package/dist/components/ActionButton/index.d.ts.map +0 -1
- package/dist/components/Avatar/getAvatarEmoji.d.ts +0 -7
- package/dist/components/Avatar/getAvatarEmoji.d.ts.map +0 -1
- package/dist/components/Avatar/index.d.ts +0 -14
- package/dist/components/Avatar/index.d.ts.map +0 -1
- package/dist/components/ChannelList/CustomChannelPreview.d.ts +0 -14
- package/dist/components/ChannelList/CustomChannelPreview.d.ts.map +0 -1
- package/dist/components/ChannelList/index.d.ts +0 -7
- package/dist/components/ChannelList/index.d.ts.map +0 -1
- package/dist/components/ChannelView.d.ts +0 -7
- package/dist/components/ChannelView.d.ts.map +0 -1
- package/dist/components/CloseButton/index.d.ts +0 -6
- package/dist/components/CloseButton/index.d.ts.map +0 -1
- package/dist/components/CustomLinkPreviewList/index.d.ts +0 -2
- package/dist/components/CustomLinkPreviewList/index.d.ts.map +0 -1
- package/dist/components/CustomMessageInput/index.d.ts +0 -6
- package/dist/components/CustomMessageInput/index.d.ts.map +0 -1
- package/dist/components/CustomSystemMessage/index.d.ts +0 -3
- package/dist/components/CustomSystemMessage/index.d.ts.map +0 -1
- package/dist/components/FaqList/FaqListItem.d.ts +0 -9
- package/dist/components/FaqList/FaqListItem.d.ts.map +0 -1
- package/dist/components/FaqList/index.d.ts +0 -19
- package/dist/components/FaqList/index.d.ts.map +0 -1
- package/dist/components/IconButton/index.d.ts +0 -9
- package/dist/components/IconButton/index.d.ts.map +0 -1
- package/dist/components/Loading/index.d.ts +0 -7
- package/dist/components/Loading/index.d.ts.map +0 -1
- package/dist/components/MessagingShell/ChannelEmptyState.d.ts +0 -6
- package/dist/components/MessagingShell/ChannelEmptyState.d.ts.map +0 -1
- package/dist/components/MessagingShell/EmptyState.d.ts +0 -9
- package/dist/components/MessagingShell/EmptyState.d.ts.map +0 -1
- package/dist/components/MessagingShell/ErrorState.d.ts +0 -11
- package/dist/components/MessagingShell/ErrorState.d.ts.map +0 -1
- package/dist/components/MessagingShell/LoadingState.d.ts +0 -6
- package/dist/components/MessagingShell/LoadingState.d.ts.map +0 -1
- package/dist/components/MessagingShell/index.d.ts +0 -7
- package/dist/components/MessagingShell/index.d.ts.map +0 -1
- package/dist/components/ParticipantPicker/ParticipantItem.d.ts +0 -13
- package/dist/components/ParticipantPicker/ParticipantItem.d.ts.map +0 -1
- package/dist/components/ParticipantPicker/ParticipantPicker.d.ts +0 -7
- package/dist/components/ParticipantPicker/ParticipantPicker.d.ts.map +0 -1
- package/dist/components/ParticipantPicker/index.d.ts +0 -7
- package/dist/components/ParticipantPicker/index.d.ts.map +0 -1
- package/dist/components/SearchInput/SearchInput.test.d.ts +0 -2
- package/dist/components/SearchInput/SearchInput.test.d.ts.map +0 -1
- package/dist/components/SearchInput/index.d.ts +0 -8
- package/dist/components/SearchInput/index.d.ts.map +0 -1
- package/dist/hooks/useMessaging.d.ts +0 -6
- package/dist/hooks/useMessaging.d.ts.map +0 -1
- package/dist/hooks/useParticipants.d.ts +0 -19
- package/dist/hooks/useParticipants.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/providers/MessagingProvider.d.ts +0 -26
- package/dist/providers/MessagingProvider.d.ts.map +0 -1
- package/dist/stories/mocks.d.ts +0 -29
- package/dist/stories/mocks.d.ts.map +0 -1
- package/dist/stream-custom-data.d.ts +0 -25
- package/dist/stream-custom-data.d.ts.map +0 -1
- package/dist/test/setup.d.ts +0 -2
- package/dist/test/setup.d.ts.map +0 -1
- package/dist/test/utils.d.ts +0 -12
- package/dist/test/utils.d.ts.map +0 -1
- package/dist/types.d.ts +0 -174
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/formatRelativeTime.d.ts +0 -6
- package/dist/utils/formatRelativeTime.d.ts.map +0 -1
- package/dist/utils/formatRelativeTime.test.d.ts +0 -2
- package/dist/utils/formatRelativeTime.test.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,315 @@
|
|
|
1
|
-
import '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { Channel } from 'stream-chat';
|
|
2
|
+
import { ChannelFilters } from 'stream-chat';
|
|
3
|
+
import { default as default_2 } from 'react';
|
|
4
|
+
import { EmptyStateIndicatorProps } from 'stream-chat-react';
|
|
5
|
+
import { MessagingUser } from '@linktr.ee/messaging-core';
|
|
6
|
+
import { StreamChat } from 'stream-chat';
|
|
7
|
+
import { StreamChatService } from '@linktr.ee/messaging-core';
|
|
8
|
+
import { StreamChatServiceConfig } from '@linktr.ee/messaging-core';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Avatar component that displays a user image or colored initial fallback
|
|
12
|
+
*/
|
|
13
|
+
export declare const Avatar: default_2.FC<AvatarProps>;
|
|
14
|
+
|
|
15
|
+
export declare interface AvatarProps {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
image?: string;
|
|
19
|
+
size?: number;
|
|
20
|
+
className?: string;
|
|
21
|
+
shape?: 'squircle' | 'circle';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Empty state component shown when a channel has no messages
|
|
26
|
+
*/
|
|
27
|
+
export declare const ChannelEmptyState: default_2.FC;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Channel list component with customizable header and actions
|
|
31
|
+
*/
|
|
32
|
+
export declare const ChannelList: default_2.NamedExoticComponent<ChannelListProps>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* ChannelList component props
|
|
36
|
+
*/
|
|
37
|
+
export declare interface ChannelListProps {
|
|
38
|
+
onChannelSelect: (channel: Channel) => void;
|
|
39
|
+
selectedChannel?: Channel;
|
|
40
|
+
showStartConversation?: boolean;
|
|
41
|
+
onStartConversation?: () => void;
|
|
42
|
+
participantLabel?: string;
|
|
43
|
+
className?: string;
|
|
44
|
+
filters: ChannelFilters;
|
|
45
|
+
customEmptyStateIndicator?: React.ComponentType<EmptyStateIndicatorProps>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Channel view component with message list and input
|
|
50
|
+
*/
|
|
51
|
+
export declare const ChannelView: default_2.NamedExoticComponent<ChannelViewProps>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* ChannelView component props
|
|
55
|
+
*/
|
|
56
|
+
export declare interface ChannelViewProps {
|
|
57
|
+
channel: Channel;
|
|
58
|
+
onBack?: () => void;
|
|
59
|
+
showBackButton?: boolean;
|
|
60
|
+
renderMessageInputActions?: (channel: Channel) => React.ReactNode;
|
|
61
|
+
onLeaveConversation?: (channel: Channel) => void;
|
|
62
|
+
onBlockParticipant?: (participantId?: string) => void;
|
|
63
|
+
className?: string;
|
|
64
|
+
CustomChannelEmptyState?: React.ComponentType;
|
|
65
|
+
/**
|
|
66
|
+
* Show the "Delete Conversation" button in channel info dialog.
|
|
67
|
+
* Defaults to true for backward compatibility.
|
|
68
|
+
*/
|
|
69
|
+
showDeleteConversation?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Analytics callback fired when "Delete Conversation" is clicked.
|
|
72
|
+
*/
|
|
73
|
+
onDeleteConversationClick?: () => void;
|
|
74
|
+
/**
|
|
75
|
+
* Analytics callback fired when "Block" or "Unblock" is clicked.
|
|
76
|
+
*/
|
|
77
|
+
onBlockParticipantClick?: () => void;
|
|
78
|
+
/**
|
|
79
|
+
* Analytics callback fired when "Report" is clicked.
|
|
80
|
+
*/
|
|
81
|
+
onReportParticipantClick?: () => void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export declare interface Faq {
|
|
85
|
+
id: string;
|
|
86
|
+
question: string;
|
|
87
|
+
answer: string;
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
order?: number | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare const FaqList: default_2.FC<FaqListProps>;
|
|
93
|
+
|
|
94
|
+
export declare const FaqListItem: default_2.FC<FaqListItemProps>;
|
|
95
|
+
|
|
96
|
+
export declare interface FaqListItemProps {
|
|
97
|
+
question: string;
|
|
98
|
+
onClick: () => void;
|
|
99
|
+
loading?: boolean;
|
|
100
|
+
className?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export declare interface FaqListProps {
|
|
104
|
+
faqs: Faq[];
|
|
105
|
+
onFaqClick: (faqId: string) => void;
|
|
106
|
+
loadingFaqId?: string | null;
|
|
107
|
+
headerText?: string;
|
|
108
|
+
className?: string;
|
|
109
|
+
avatarImage?: string;
|
|
110
|
+
avatarName?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Format a date - shows time for today, relative time for older messages
|
|
115
|
+
* (e.g., "Just now", "2:08 PM" for today, "Yesterday" for yesterday, "2d" for 2 days ago)
|
|
116
|
+
*/
|
|
117
|
+
export declare const formatRelativeTime: (date: Date) => string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Messaging capabilities configuration
|
|
121
|
+
*/
|
|
122
|
+
export declare interface MessagingCapabilities {
|
|
123
|
+
showStartConversation?: boolean;
|
|
124
|
+
participantSource?: ParticipantSource;
|
|
125
|
+
participantLabel?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Show the "Delete Conversation" button in channel info dialog.
|
|
128
|
+
* Defaults to true for backward compatibility.
|
|
129
|
+
*/
|
|
130
|
+
showDeleteConversation?: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Context value for messaging state and service
|
|
135
|
+
*/
|
|
136
|
+
declare interface MessagingContextValue {
|
|
137
|
+
service: StreamChatService | null;
|
|
138
|
+
client: StreamChat | null;
|
|
139
|
+
isConnected: boolean;
|
|
140
|
+
isLoading: boolean;
|
|
141
|
+
error: string | null;
|
|
142
|
+
capabilities: MessagingCapabilities;
|
|
143
|
+
refreshConnection: () => Promise<void>;
|
|
144
|
+
debug: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Provider component that wraps messaging-core with React state management
|
|
149
|
+
*/
|
|
150
|
+
export declare const MessagingProvider: default_2.FC<MessagingProviderProps>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* MessagingProvider component props
|
|
154
|
+
*/
|
|
155
|
+
export declare interface MessagingProviderProps {
|
|
156
|
+
children: React.ReactNode;
|
|
157
|
+
user: MessagingUser | null;
|
|
158
|
+
serviceConfig: Omit<StreamChatServiceConfig, 'apiKey'>;
|
|
159
|
+
apiKey: string;
|
|
160
|
+
capabilities?: MessagingCapabilities;
|
|
161
|
+
debug?: boolean;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Main messaging interface component that combines channel list and channel view
|
|
166
|
+
*/
|
|
167
|
+
export declare const MessagingShell: default_2.FC<MessagingShellProps>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Main MessagingShell component props
|
|
171
|
+
*/
|
|
172
|
+
export declare interface MessagingShellProps {
|
|
173
|
+
capabilities?: MessagingCapabilities;
|
|
174
|
+
className?: string;
|
|
175
|
+
renderMessageInputActions?: (channel: Channel) => React.ReactNode;
|
|
176
|
+
onChannelSelect?: (channel: Channel) => void;
|
|
177
|
+
onParticipantSelect?: (participant: Participant) => void;
|
|
178
|
+
/**
|
|
179
|
+
* Auto-select a conversation with this participant on mount.
|
|
180
|
+
* Useful for deep-linking to a specific conversation (e.g., /messages/[accountUuid])
|
|
181
|
+
*
|
|
182
|
+
* If a channel with this participant exists, it will be auto-selected.
|
|
183
|
+
* If no channel exists, you can provide initialParticipantData to automatically
|
|
184
|
+
* create the channel using the existing ChannelCreator.
|
|
185
|
+
*/
|
|
186
|
+
initialParticipantFilter?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Participant data for auto-creating a channel when initialParticipantFilter
|
|
189
|
+
* is provided but no channel exists. If this is provided, MessagingShell will
|
|
190
|
+
* automatically call service.startChannelWithParticipant() to create the channel.
|
|
191
|
+
*
|
|
192
|
+
* This reuses the existing ChannelCreator from StreamChatServiceConfig.
|
|
193
|
+
*/
|
|
194
|
+
initialParticipantData?: Participant;
|
|
195
|
+
/**
|
|
196
|
+
* Custom empty state component to render when a channel has no messages.
|
|
197
|
+
* Useful for showing FAQs or other contextual information in empty channels.
|
|
198
|
+
*/
|
|
199
|
+
CustomChannelEmptyState?: React.ComponentType;
|
|
200
|
+
/**
|
|
201
|
+
* Controls whether the channel list is shown. When false, the channel list
|
|
202
|
+
* is immediately hidden. Useful for direct conversation mode where you want
|
|
203
|
+
* to show only the channel view without the list.
|
|
204
|
+
*/
|
|
205
|
+
showChannelList?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Filters for channel list. Passed through to StreamChat ChannelList.
|
|
208
|
+
*/
|
|
209
|
+
filters?: ChannelFilters;
|
|
210
|
+
/**
|
|
211
|
+
* Custom empty state indicator component to render when the channel list is empty.
|
|
212
|
+
* Useful for showing a custom empty state indicator when the channel list is empty.
|
|
213
|
+
*/
|
|
214
|
+
channelListCustomEmptyStateIndicator?: React.ComponentType<EmptyStateIndicatorProps>;
|
|
215
|
+
/**
|
|
216
|
+
* Analytics callback fired when "Delete Conversation" is clicked.
|
|
217
|
+
* Called before the action is performed.
|
|
218
|
+
*/
|
|
219
|
+
onDeleteConversationClick?: () => void;
|
|
220
|
+
/**
|
|
221
|
+
* Analytics callback fired when "Block" or "Unblock" is clicked.
|
|
222
|
+
* Called before the action is performed.
|
|
223
|
+
*/
|
|
224
|
+
onBlockParticipantClick?: () => void;
|
|
225
|
+
/**
|
|
226
|
+
* Analytics callback fired when "Report" is clicked.
|
|
227
|
+
* Called before the action is performed.
|
|
228
|
+
*/
|
|
229
|
+
onReportParticipantClick?: () => void;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Generic participant interface for different host environments
|
|
234
|
+
*/
|
|
235
|
+
export declare interface Participant {
|
|
236
|
+
id: string;
|
|
237
|
+
name: string;
|
|
238
|
+
email?: string;
|
|
239
|
+
image?: string;
|
|
240
|
+
username?: string;
|
|
241
|
+
phone?: string;
|
|
242
|
+
metadata?: Record<string, unknown>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Generic participant picker component for starting conversations
|
|
247
|
+
*/
|
|
248
|
+
export declare const ParticipantPicker: default_2.FC<ParticipantPickerProps>;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* ParticipantPicker component props
|
|
252
|
+
*/
|
|
253
|
+
export declare interface ParticipantPickerProps {
|
|
254
|
+
participantSource: ParticipantSource;
|
|
255
|
+
onSelectParticipant: (participant: Participant) => void;
|
|
256
|
+
onClose: () => void;
|
|
257
|
+
existingParticipantIds?: Set<string>;
|
|
258
|
+
participantLabel?: string;
|
|
259
|
+
searchPlaceholder?: string;
|
|
260
|
+
className?: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Source for loading participants (followers, team members, etc.)
|
|
265
|
+
*/
|
|
266
|
+
export declare interface ParticipantSource {
|
|
267
|
+
loadParticipants: (options?: {
|
|
268
|
+
search?: string;
|
|
269
|
+
limit?: number;
|
|
270
|
+
cursor?: string;
|
|
271
|
+
}) => Promise<{
|
|
272
|
+
participants: Participant[];
|
|
273
|
+
hasMore: boolean;
|
|
274
|
+
nextCursor?: string;
|
|
275
|
+
}>;
|
|
276
|
+
totalCount?: number;
|
|
277
|
+
loading?: boolean;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Hook to access messaging service and state
|
|
282
|
+
*/
|
|
283
|
+
export declare const useMessaging: () => MessagingContextValue;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Hook for managing participant loading with search and pagination
|
|
287
|
+
*/
|
|
288
|
+
export declare const useParticipants: (participantSource: ParticipantSource, options?: {
|
|
289
|
+
initialSearch?: string;
|
|
290
|
+
pageSize?: number;
|
|
291
|
+
}) => {
|
|
292
|
+
participants: Participant[];
|
|
293
|
+
loading: boolean;
|
|
294
|
+
error: string | null;
|
|
295
|
+
searchQuery: string;
|
|
296
|
+
hasMore: boolean;
|
|
297
|
+
totalCount: number | undefined;
|
|
298
|
+
loadMore: () => void;
|
|
299
|
+
search: (query: string) => void;
|
|
300
|
+
refresh: () => void;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export { }
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
declare module 'stream-chat' {
|
|
307
|
+
interface CustomMessageData {
|
|
308
|
+
/**
|
|
309
|
+
* When true, hides the date timestamp in system messages.
|
|
310
|
+
* Used by CustomSystemMessage component.
|
|
311
|
+
*/
|
|
312
|
+
hide_date?: boolean;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|