@linktr.ee/messaging-react 1.8.0 → 1.8.1-rc-1763343277

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 (64) hide show
  1. package/dist/assets/index.css +1 -1
  2. package/dist/index.d.ts +263 -17
  3. package/package.json +1 -1
  4. package/src/styles.css +11 -0
  5. package/dist/.tsbuildinfo +0 -1
  6. package/dist/components/ActionButton/ActionButton.test.d.ts +0 -2
  7. package/dist/components/ActionButton/ActionButton.test.d.ts.map +0 -1
  8. package/dist/components/ActionButton/index.d.ts +0 -7
  9. package/dist/components/ActionButton/index.d.ts.map +0 -1
  10. package/dist/components/Avatar/getAvatarEmoji.d.ts +0 -7
  11. package/dist/components/Avatar/getAvatarEmoji.d.ts.map +0 -1
  12. package/dist/components/Avatar/index.d.ts +0 -13
  13. package/dist/components/Avatar/index.d.ts.map +0 -1
  14. package/dist/components/ChannelList/CustomChannelPreview.d.ts +0 -13
  15. package/dist/components/ChannelList/CustomChannelPreview.d.ts.map +0 -1
  16. package/dist/components/ChannelList/index.d.ts +0 -7
  17. package/dist/components/ChannelList/index.d.ts.map +0 -1
  18. package/dist/components/ChannelView.d.ts +0 -7
  19. package/dist/components/ChannelView.d.ts.map +0 -1
  20. package/dist/components/CloseButton/index.d.ts +0 -6
  21. package/dist/components/CloseButton/index.d.ts.map +0 -1
  22. package/dist/components/FaqList/FaqListItem.d.ts +0 -9
  23. package/dist/components/FaqList/FaqListItem.d.ts.map +0 -1
  24. package/dist/components/FaqList/index.d.ts +0 -19
  25. package/dist/components/FaqList/index.d.ts.map +0 -1
  26. package/dist/components/IconButton/index.d.ts +0 -9
  27. package/dist/components/IconButton/index.d.ts.map +0 -1
  28. package/dist/components/Loading/index.d.ts +0 -7
  29. package/dist/components/Loading/index.d.ts.map +0 -1
  30. package/dist/components/MessagingShell/ChannelEmptyState.d.ts +0 -6
  31. package/dist/components/MessagingShell/ChannelEmptyState.d.ts.map +0 -1
  32. package/dist/components/MessagingShell/EmptyState.d.ts +0 -10
  33. package/dist/components/MessagingShell/EmptyState.d.ts.map +0 -1
  34. package/dist/components/MessagingShell/ErrorState.d.ts +0 -9
  35. package/dist/components/MessagingShell/ErrorState.d.ts.map +0 -1
  36. package/dist/components/MessagingShell/LoadingState.d.ts +0 -5
  37. package/dist/components/MessagingShell/LoadingState.d.ts.map +0 -1
  38. package/dist/components/MessagingShell/index.d.ts +0 -7
  39. package/dist/components/MessagingShell/index.d.ts.map +0 -1
  40. package/dist/components/ParticipantPicker/ParticipantItem.d.ts +0 -13
  41. package/dist/components/ParticipantPicker/ParticipantItem.d.ts.map +0 -1
  42. package/dist/components/ParticipantPicker/ParticipantPicker.d.ts +0 -7
  43. package/dist/components/ParticipantPicker/ParticipantPicker.d.ts.map +0 -1
  44. package/dist/components/ParticipantPicker/index.d.ts +0 -7
  45. package/dist/components/ParticipantPicker/index.d.ts.map +0 -1
  46. package/dist/components/SearchInput/SearchInput.test.d.ts +0 -2
  47. package/dist/components/SearchInput/SearchInput.test.d.ts.map +0 -1
  48. package/dist/components/SearchInput/index.d.ts +0 -8
  49. package/dist/components/SearchInput/index.d.ts.map +0 -1
  50. package/dist/hooks/useMessaging.d.ts +0 -6
  51. package/dist/hooks/useMessaging.d.ts.map +0 -1
  52. package/dist/hooks/useParticipants.d.ts +0 -19
  53. package/dist/hooks/useParticipants.d.ts.map +0 -1
  54. package/dist/index.d.ts.map +0 -1
  55. package/dist/providers/MessagingProvider.d.ts +0 -27
  56. package/dist/providers/MessagingProvider.d.ts.map +0 -1
  57. package/dist/stories/mocks.d.ts +0 -29
  58. package/dist/stories/mocks.d.ts.map +0 -1
  59. package/dist/test/setup.d.ts +0 -2
  60. package/dist/test/setup.d.ts.map +0 -1
  61. package/dist/test/utils.d.ts +0 -12
  62. package/dist/test/utils.d.ts.map +0 -1
  63. package/dist/types.d.ts +0 -138
  64. package/dist/types.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,17 +1,263 @@
1
- import './styles.css';
2
- export { MessagingShell } from './components/MessagingShell';
3
- export { ChannelList } from './components/ChannelList';
4
- export { ChannelView } from './components/ChannelView';
5
- export { ParticipantPicker } from './components/ParticipantPicker';
6
- export { Avatar } from './components/Avatar';
7
- export { FaqList } from './components/FaqList';
8
- export { FaqListItem } from './components/FaqList/FaqListItem';
9
- export { ChannelEmptyState } from './components/MessagingShell/ChannelEmptyState';
10
- export { MessagingProvider } from './providers/MessagingProvider';
11
- export { useMessaging } from './hooks/useMessaging';
12
- export { useParticipants } from './hooks/useParticipants';
13
- export type { MessagingShellProps, ChannelListProps, ChannelViewProps, ParticipantPickerProps, MessagingProviderProps, MessagingCapabilities, ParticipantSource, Participant, } from './types';
14
- export type { AvatarProps } from './components/Avatar';
15
- export type { Faq, FaqListProps } from './components/FaqList';
16
- export type { FaqListItemProps } from './components/FaqList/FaqListItem';
17
- //# sourceMappingURL=index.d.ts.map
1
+ import { Channel } from 'stream-chat';
2
+ import { ChannelFilters } from 'stream-chat';
3
+ import { default as default_2 } from 'react';
4
+ import { MessagingUser } from '@linktr.ee/messaging-core';
5
+ import { StreamChat } from 'stream-chat';
6
+ import { StreamChatService } from '@linktr.ee/messaging-core';
7
+ import { StreamChatServiceConfig } from '@linktr.ee/messaging-core';
8
+
9
+ /**
10
+ * Avatar component that displays a user image or colored initial fallback
11
+ */
12
+ export declare const Avatar: default_2.FC<AvatarProps>;
13
+
14
+ export declare interface AvatarProps {
15
+ id: string;
16
+ name: string;
17
+ image?: string;
18
+ size?: number;
19
+ className?: string;
20
+ }
21
+
22
+ /**
23
+ * Empty state component shown when a channel has no messages
24
+ */
25
+ export declare const ChannelEmptyState: default_2.FC;
26
+
27
+ /**
28
+ * Channel list component with customizable header and actions
29
+ */
30
+ export declare const ChannelList: default_2.FC<ChannelListProps>;
31
+
32
+ /**
33
+ * ChannelList component props
34
+ */
35
+ export declare interface ChannelListProps {
36
+ onChannelSelect: (channel: Channel) => void;
37
+ selectedChannel?: Channel;
38
+ showStartConversation?: boolean;
39
+ onStartConversation?: () => void;
40
+ participantLabel?: string;
41
+ className?: string;
42
+ filters: ChannelFilters;
43
+ }
44
+
45
+ /**
46
+ * Channel view component with message list and input
47
+ */
48
+ export declare const ChannelView: default_2.FC<ChannelViewProps>;
49
+
50
+ /**
51
+ * ChannelView component props
52
+ */
53
+ export declare interface ChannelViewProps {
54
+ channel: Channel;
55
+ onBack?: () => void;
56
+ showBackButton?: boolean;
57
+ renderMessageInputActions?: (channel: Channel) => React.ReactNode;
58
+ onLeaveConversation?: (channel: Channel) => void;
59
+ onBlockParticipant?: (participantId?: string) => void;
60
+ className?: string;
61
+ CustomChannelEmptyState?: React.ComponentType;
62
+ }
63
+
64
+ export declare interface Faq {
65
+ id: string;
66
+ question: string;
67
+ answer: string;
68
+ enabled: boolean;
69
+ order?: number | null;
70
+ }
71
+
72
+ export declare const FaqList: default_2.FC<FaqListProps>;
73
+
74
+ export declare const FaqListItem: default_2.FC<FaqListItemProps>;
75
+
76
+ export declare interface FaqListItemProps {
77
+ question: string;
78
+ onClick: () => void;
79
+ loading?: boolean;
80
+ className?: string;
81
+ }
82
+
83
+ export declare interface FaqListProps {
84
+ faqs: Faq[];
85
+ onFaqClick: (faqId: string) => void;
86
+ loadingFaqId?: string | null;
87
+ headerText?: string;
88
+ className?: string;
89
+ avatarImage?: string;
90
+ avatarName?: string;
91
+ }
92
+
93
+ /**
94
+ * Messaging capabilities configuration
95
+ */
96
+ export declare interface MessagingCapabilities {
97
+ showStartConversation?: boolean;
98
+ participantSource?: ParticipantSource;
99
+ participantLabel?: string;
100
+ }
101
+
102
+ /**
103
+ * Context value for messaging state and service
104
+ */
105
+ declare interface MessagingContextValue {
106
+ service: StreamChatService | null;
107
+ client: StreamChat | null;
108
+ isConnected: boolean;
109
+ isLoading: boolean;
110
+ error: string | null;
111
+ capabilities: MessagingCapabilities;
112
+ customization: MessagingCustomization;
113
+ refreshConnection: () => Promise<void>;
114
+ debug: boolean;
115
+ }
116
+
117
+ /**
118
+ * Customization options
119
+ */
120
+ declare interface MessagingCustomization {
121
+ theme?: 'light' | 'dark' | 'auto';
122
+ accentColor?: string;
123
+ }
124
+
125
+ /**
126
+ * Provider component that wraps messaging-core with React state management
127
+ */
128
+ export declare const MessagingProvider: default_2.FC<MessagingProviderProps>;
129
+
130
+ /**
131
+ * MessagingProvider component props
132
+ */
133
+ export declare interface MessagingProviderProps {
134
+ children: React.ReactNode;
135
+ user: MessagingUser | null;
136
+ serviceConfig: Omit<StreamChatServiceConfig, 'apiKey'>;
137
+ apiKey: string;
138
+ capabilities?: MessagingCapabilities;
139
+ customization?: MessagingCustomization;
140
+ debug?: boolean;
141
+ }
142
+
143
+ /**
144
+ * Main messaging interface component that combines channel list and channel view
145
+ */
146
+ export declare const MessagingShell: default_2.FC<MessagingShellProps>;
147
+
148
+ /**
149
+ * Main MessagingShell component props
150
+ */
151
+ export declare interface MessagingShellProps {
152
+ capabilities?: MessagingCapabilities;
153
+ customization?: MessagingCustomization;
154
+ className?: string;
155
+ renderMessageInputActions?: (channel: Channel) => React.ReactNode;
156
+ onChannelSelect?: (channel: Channel) => void;
157
+ onParticipantSelect?: (participant: Participant) => void;
158
+ /**
159
+ * Auto-select a conversation with this participant on mount.
160
+ * Useful for deep-linking to a specific conversation (e.g., /messages/[accountUuid])
161
+ *
162
+ * If a channel with this participant exists, it will be auto-selected.
163
+ * If no channel exists, you can provide initialParticipantData to automatically
164
+ * create the channel using the existing ChannelCreator.
165
+ */
166
+ initialParticipantFilter?: string;
167
+ /**
168
+ * Participant data for auto-creating a channel when initialParticipantFilter
169
+ * is provided but no channel exists. If this is provided, MessagingShell will
170
+ * automatically call service.startChannelWithParticipant() to create the channel.
171
+ *
172
+ * This reuses the existing ChannelCreator from StreamChatServiceConfig.
173
+ */
174
+ initialParticipantData?: Participant;
175
+ /**
176
+ * Custom empty state component to render when a channel has no messages.
177
+ * Useful for showing FAQs or other contextual information in empty channels.
178
+ */
179
+ CustomChannelEmptyState?: React.ComponentType;
180
+ /**
181
+ * Controls whether the channel list is shown. When false, the channel list
182
+ * is immediately hidden. Useful for direct conversation mode where you want
183
+ * to show only the channel view without the list.
184
+ */
185
+ showChannelList?: boolean;
186
+ /**
187
+ * Filters for channel list. Passed through to StreamChat ChannelList.
188
+ */
189
+ filters?: ChannelFilters;
190
+ }
191
+
192
+ /**
193
+ * Generic participant interface for different host environments
194
+ */
195
+ export declare interface Participant {
196
+ id: string;
197
+ name: string;
198
+ email?: string;
199
+ image?: string;
200
+ username?: string;
201
+ phone?: string;
202
+ metadata?: Record<string, unknown>;
203
+ }
204
+
205
+ /**
206
+ * Generic participant picker component for starting conversations
207
+ */
208
+ export declare const ParticipantPicker: default_2.FC<ParticipantPickerProps>;
209
+
210
+ /**
211
+ * ParticipantPicker component props
212
+ */
213
+ export declare interface ParticipantPickerProps {
214
+ participantSource: ParticipantSource;
215
+ onSelectParticipant: (participant: Participant) => void;
216
+ onClose: () => void;
217
+ existingParticipantIds?: Set<string>;
218
+ participantLabel?: string;
219
+ searchPlaceholder?: string;
220
+ className?: string;
221
+ }
222
+
223
+ /**
224
+ * Source for loading participants (followers, team members, etc.)
225
+ */
226
+ export declare interface ParticipantSource {
227
+ loadParticipants: (options?: {
228
+ search?: string;
229
+ limit?: number;
230
+ cursor?: string;
231
+ }) => Promise<{
232
+ participants: Participant[];
233
+ hasMore: boolean;
234
+ nextCursor?: string;
235
+ }>;
236
+ totalCount?: number;
237
+ loading?: boolean;
238
+ }
239
+
240
+ /**
241
+ * Hook to access messaging service and state
242
+ */
243
+ export declare const useMessaging: () => MessagingContextValue;
244
+
245
+ /**
246
+ * Hook for managing participant loading with search and pagination
247
+ */
248
+ export declare const useParticipants: (participantSource: ParticipantSource, options?: {
249
+ initialSearch?: string;
250
+ pageSize?: number;
251
+ }) => {
252
+ participants: Participant[];
253
+ loading: boolean;
254
+ error: string | null;
255
+ searchQuery: string;
256
+ hasMore: boolean;
257
+ totalCount: number | undefined;
258
+ loadMore: () => void;
259
+ search: (query: string) => void;
260
+ refresh: () => void;
261
+ };
262
+
263
+ export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "1.8.0",
3
+ "version": "1.8.1-rc-1763343277",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/styles.css CHANGED
@@ -72,3 +72,14 @@
72
72
  outline: none;
73
73
  }
74
74
  }
75
+
76
+ /* Custom Stream Chat message bubble styles */
77
+ .str-chat {
78
+ /* Incoming messages - light grey bg with dark text */
79
+ --str-chat__message-bubble-background-color: #F1F0EE;
80
+ --str-chat__message-bubble-color: color-mix(in srgb, #000000 90%, transparent);
81
+
82
+ /* Own messages - dark bg with white text */
83
+ --str-chat__own-message-bubble-background-color: #121110;
84
+ --str-chat__own-message-bubble-color: #fff;
85
+ }