@linktr.ee/messaging-react 1.38.0 → 1.39.0

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 CHANGED
@@ -58,9 +58,6 @@ export declare const ChannelList: default_2.NamedExoticComponent<ChannelListProp
58
58
  export declare interface ChannelListProps {
59
59
  onChannelSelect: (channel: Channel) => void;
60
60
  selectedChannel?: Channel;
61
- showStartConversation?: boolean;
62
- onStartConversation?: () => void;
63
- participantLabel?: string;
64
61
  className?: string;
65
62
  filters: ChannelFilters;
66
63
  /**
@@ -363,9 +360,6 @@ declare interface MessageVoteButtonsProps {
363
360
  * Messaging capabilities configuration
364
361
  */
365
362
  export declare interface MessagingCapabilities {
366
- showStartConversation?: boolean;
367
- participantSource?: ParticipantSource;
368
- participantLabel?: string;
369
363
  /**
370
364
  * Show the "Delete Conversation" button in channel info dialog.
371
365
  * Defaults to true for backward compatibility.
@@ -416,7 +410,6 @@ export declare interface MessagingShellProps extends ChannelViewPassthroughProps
416
410
  capabilities?: MessagingCapabilities;
417
411
  className?: string;
418
412
  onChannelSelect?: (channel: Channel) => void;
419
- onParticipantSelect?: (participant: Participant) => void;
420
413
  /**
421
414
  * Auto-select a conversation with this participant on mount.
422
415
  * Useful for deep-linking to a specific conversation (e.g., /messages/[accountUuid])
@@ -480,41 +473,6 @@ export declare interface Participant {
480
473
  metadata?: Record<string, unknown>;
481
474
  }
482
475
 
483
- /**
484
- * Generic participant picker component for starting conversations
485
- */
486
- export declare const ParticipantPicker: default_2.FC<ParticipantPickerProps>;
487
-
488
- /**
489
- * ParticipantPicker component props
490
- */
491
- export declare interface ParticipantPickerProps {
492
- participantSource: ParticipantSource;
493
- onSelectParticipant: (participant: Participant) => void;
494
- onClose: () => void;
495
- existingParticipantIds?: Set<string>;
496
- participantLabel?: string;
497
- searchPlaceholder?: string;
498
- className?: string;
499
- }
500
-
501
- /**
502
- * Source for loading participants (followers, team members, etc.)
503
- */
504
- export declare interface ParticipantSource {
505
- loadParticipants: (options?: {
506
- search?: string;
507
- limit?: number;
508
- cursor?: string;
509
- }) => Promise<{
510
- participants: Participant[];
511
- hasMore: boolean;
512
- nextCursor?: string;
513
- }>;
514
- totalCount?: number;
515
- loading?: boolean;
516
- }
517
-
518
476
  /**
519
477
  * Message metadata for paid messaging and chatbot flows.
520
478
  * Used to identify message types and payment status.
@@ -548,24 +506,6 @@ declare interface UseMessageVoteResult {
548
506
  */
549
507
  export declare const useMessaging: () => MessagingContextValue;
550
508
 
551
- /**
552
- * Hook for managing participant loading with search and pagination
553
- */
554
- export declare const useParticipants: (participantSource: ParticipantSource, options?: {
555
- initialSearch?: string;
556
- pageSize?: number;
557
- }) => {
558
- participants: Participant[];
559
- loading: boolean;
560
- error: string | null;
561
- searchQuery: string;
562
- hasMore: boolean;
563
- totalCount: number | undefined;
564
- loadMore: () => void;
565
- search: (query: string) => void;
566
- refresh: () => void;
567
- };
568
-
569
509
  export declare interface VisitorCardProps extends LockedAttachmentBaseProps {
570
510
  /**
571
511
  * Called when the visitor clicks Unlock on an unpaid attachment.
package/dist/index.js CHANGED
@@ -1,25 +1,23 @@
1
- import { b as e, c as t, C as i, d as n, e as o, f as r, F as g, g as M, L as m, M as l, h as u, i as c, j as h, P as d, k as v, r as C, l as L, u as P, m as k, n as p, o as A } from "./index-B_4pciGp.js";
1
+ import { b as a, c as t, C as i, d as n, e as o, f as g, F as r, g as M, L as m, M as l, h as u, i as h, j as d, k as v, r as C, l as L, u as c, m as A, n as F } from "./index-j4j9UfK1.js";
2
2
  export {
3
- e as ActionButton,
3
+ a as ActionButton,
4
4
  t as Avatar,
5
5
  i as ChannelEmptyState,
6
6
  n as ChannelList,
7
7
  o as ChannelView,
8
- r as CustomMessageProvider,
9
- g as FaqList,
8
+ g as CustomMessageProvider,
9
+ r as FaqList,
10
10
  M as FaqListItem,
11
11
  m as LockedAttachment,
12
12
  l as MediaMessage,
13
13
  u as MessageVoteButtons,
14
- c as MessagingProvider,
15
- h as MessagingShell,
16
- d as ParticipantPicker,
14
+ h as MessagingProvider,
15
+ d as MessagingShell,
17
16
  v as formatRelativeTime,
18
17
  C as resolveLinkAttachment,
19
18
  L as resolveMediaFromMessage,
20
- P as useCustomMessage,
21
- k as useMessageVote,
22
- p as useMessaging,
23
- A as useParticipants
19
+ c as useCustomMessage,
20
+ A as useMessageVote,
21
+ F as useMessaging
24
22
  };
25
23
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "1.38.0",
3
+ "version": "1.39.0",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,16 +35,11 @@ const Template: StoryFn<ComponentProps> = (args) => {
35
35
  export const Default: StoryFn<ComponentProps> = Template.bind({})
36
36
  Default.args = {
37
37
  onChannelSelect: (channel) => console.log('Channel selected:', channel.id),
38
- participantLabel: 'participants',
39
38
  }
40
39
 
41
- export const WithStartConversation: StoryFn<ComponentProps> = Template.bind({})
42
- WithStartConversation.args = {
40
+ export const WithSelection: StoryFn<ComponentProps> = Template.bind({})
41
+ WithSelection.args = {
43
42
  onChannelSelect: (channel) => console.log('Channel selected:', channel.id),
44
- showStartConversation: true,
45
- onStartConversation: () => console.log('Start conversation clicked'),
46
- participantLabel: 'followers',
47
43
  }
48
44
 
49
45
 
50
-
@@ -3,10 +3,9 @@ import React, { useState, useCallback, useRef, useEffect } from 'react'
3
3
  import type { Channel } from 'stream-chat'
4
4
 
5
5
  import { useMessaging } from '../../hooks/useMessaging'
6
- import type { MessagingShellProps, Participant } from '../../types'
6
+ import type { MessagingShellProps } from '../../types'
7
7
  import { ChannelList } from '../ChannelList'
8
8
  import { ChannelView } from '../ChannelView'
9
- import { ParticipantPicker } from '../ParticipantPicker'
10
9
 
11
10
  import { EmptyState } from './EmptyState'
12
11
  import { ErrorState } from './ErrorState'
@@ -21,7 +20,6 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
21
20
  renderMessageInputActions,
22
21
  renderConversationFooter,
23
22
  onChannelSelect,
24
- onParticipantSelect,
25
23
  initialParticipantFilter,
26
24
  initialParticipantData,
27
25
  CustomChannelEmptyState,
@@ -57,21 +55,12 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
57
55
  const [selectedChannel, setSelectedChannel] = useState<Channel | null>(null)
58
56
  const [hasChannels, setHasChannels] = useState(false)
59
57
  const [channelsLoaded, setChannelsLoaded] = useState(false)
60
- const [_showParticipantPicker, setShowParticipantPicker] = useState(false)
61
- const [existingParticipantIds, setExistingParticipantIds] = useState<
62
- Set<string>
63
- >(new Set())
64
- const [pickerKey, _setPickerKey] = useState(0) // Key to force remount of ParticipantPicker
65
58
  const [directConversationMode, setDirectConversationMode] = useState(false)
66
59
  const [directConversationError, setDirectConversationError] = useState<
67
60
  string | null
68
61
  >(null)
69
62
 
70
- const participantPickerRef = useRef<HTMLDialogElement>(null)
71
-
72
63
  const {
73
- participantSource,
74
- participantLabel = 'participants',
75
64
  showDeleteConversation = true,
76
65
  } = capabilities
77
66
 
@@ -121,27 +110,6 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
121
110
  { limit: 100 }
122
111
  )
123
112
 
124
- const memberIds = new Set<string>()
125
- channels.forEach((channel: Channel) => {
126
- const members = channel.state.members
127
- Object.values(members).forEach((member) => {
128
- const memberId = member.user?.id
129
- if (memberId && memberId !== userId) {
130
- memberIds.add(memberId)
131
- }
132
- })
133
- })
134
-
135
- // Only update if the set contents have changed to prevent re-renders
136
- setExistingParticipantIds((prev) => {
137
- if (
138
- prev.size === memberIds.size &&
139
- [...prev].every((id) => memberIds.has(id))
140
- ) {
141
- return prev
142
- }
143
- return memberIds
144
- })
145
113
  setHasChannels(channels.length > 0)
146
114
  setChannelsLoaded(true)
147
115
  syncedRef.current = userId // Mark as synced for this user
@@ -149,7 +117,6 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
149
117
  if (debug) {
150
118
  console.log('[MessagingShell] Channels synced successfully:', {
151
119
  channelCount: channels.length,
152
- memberCount: memberIds.size,
153
120
  })
154
121
  }
155
122
  } catch (error) {
@@ -158,7 +125,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
158
125
  }
159
126
  }, [client, isConnected, debug])
160
127
 
161
- // Sync existing channels to track which participants we can already message
128
+ // Sync existing channels to drive empty-state behavior.
162
129
  useEffect(() => {
163
130
  if (!client || !isConnected) return
164
131
 
@@ -303,58 +270,6 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
303
270
  setSelectedChannel(null)
304
271
  }, [directConversationMode])
305
272
 
306
- const handleSelectParticipant = useCallback(
307
- async (participant: Participant) => {
308
- if (!service) return
309
-
310
- try {
311
- if (debug) {
312
- console.log(
313
- '[MessagingShell] Starting conversation with:',
314
- participant.id
315
- )
316
- }
317
-
318
- const channel = await service.startChannelWithParticipant({
319
- id: participant.id,
320
- name: participant.name,
321
- email: participant.email,
322
- phone: participant.phone,
323
- })
324
-
325
- // Show the channel
326
- try {
327
- await channel.show()
328
- } catch (error) {
329
- console.warn('[MessagingShell] Failed to unhide channel:', error)
330
- }
331
-
332
- setSelectedChannel(channel)
333
- setShowParticipantPicker(false)
334
- participantPickerRef.current?.close()
335
-
336
- onParticipantSelect?.(participant)
337
- } catch (error) {
338
- console.error('[MessagingShell] Failed to start conversation:', error)
339
- }
340
- },
341
- [service, onParticipantSelect, debug]
342
- )
343
-
344
- const handleCloseParticipantPicker = useCallback(() => {
345
- setShowParticipantPicker(false)
346
- participantPickerRef.current?.close()
347
- }, [])
348
-
349
- const handleDialogBackdropClick = useCallback(
350
- (e: React.MouseEvent<HTMLDialogElement>) => {
351
- if (e.target === participantPickerRef.current) {
352
- handleCloseParticipantPicker()
353
- }
354
- },
355
- [handleCloseParticipantPicker]
356
- )
357
-
358
273
  const handleLeaveConversation = useCallback(
359
274
  async (channel: Channel) => {
360
275
  if (debug) {
@@ -520,29 +435,6 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
520
435
  )}
521
436
  </div>
522
437
  </div>
523
-
524
- {/* Participant Picker Dialog */}
525
- {participantSource && (
526
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
527
- <dialog
528
- ref={participantPickerRef}
529
- className="mes-dialog"
530
- onClick={handleDialogBackdropClick}
531
- onClose={handleCloseParticipantPicker}
532
- >
533
- <div className="h-full w-full bg-white shadow-max-elevation-light">
534
- <ParticipantPicker
535
- key={pickerKey}
536
- participantSource={participantSource}
537
- onSelectParticipant={handleSelectParticipant}
538
- onClose={handleCloseParticipantPicker}
539
- existingParticipantIds={existingParticipantIds}
540
- participantLabel={participantLabel}
541
- searchPlaceholder={`Search ${participantLabel}...`}
542
- />
543
- </div>
544
- </dialog>
545
- )}
546
438
  </div>
547
439
  )
548
440
  }
package/src/index.ts CHANGED
@@ -7,7 +7,6 @@ export { ChannelList } from './components/ChannelList'
7
7
  export { ChannelView } from './components/ChannelView'
8
8
  export { default as ActionButton } from './components/ActionButton'
9
9
  export { default as LockedAttachment } from './components/LockedAttachment'
10
- export { ParticipantPicker } from './components/ParticipantPicker'
11
10
  export { Avatar } from './components/Avatar'
12
11
  export { FaqList } from './components/FaqList'
13
12
  export { FaqListItem } from './components/FaqList/FaqListItem'
@@ -26,7 +25,6 @@ export { CustomMessageProvider } from './components/CustomMessage/context'
26
25
 
27
26
  // Hooks
28
27
  export { useMessaging } from './hooks/useMessaging'
29
- export { useParticipants } from './hooks/useParticipants'
30
28
  export { useMessageVote } from './hooks/useMessageVote'
31
29
  export { useCustomMessage } from './components/CustomMessage/context'
32
30
 
@@ -38,10 +36,8 @@ export type {
38
36
  MessagingShellProps,
39
37
  ChannelListProps,
40
38
  ChannelViewProps,
41
- ParticipantPickerProps,
42
39
  MessagingProviderProps,
43
40
  MessagingCapabilities,
44
- ParticipantSource,
45
41
  Participant,
46
42
  LockedAttachmentSource,
47
43
  } from './types'
package/src/types.ts CHANGED
@@ -32,30 +32,10 @@ export interface Participant {
32
32
  metadata?: Record<string, unknown>
33
33
  }
34
34
 
35
- /**
36
- * Source for loading participants (followers, team members, etc.)
37
- */
38
- export interface ParticipantSource {
39
- loadParticipants: (options?: {
40
- search?: string
41
- limit?: number
42
- cursor?: string
43
- }) => Promise<{
44
- participants: Participant[]
45
- hasMore: boolean
46
- nextCursor?: string
47
- }>
48
- totalCount?: number
49
- loading?: boolean
50
- }
51
-
52
35
  /**
53
36
  * Messaging capabilities configuration
54
37
  */
55
38
  export interface MessagingCapabilities {
56
- showStartConversation?: boolean
57
- participantSource?: ParticipantSource
58
- participantLabel?: string // e.g., "followers", "team members"
59
39
  /**
60
40
  * Show the "Delete Conversation" button in channel info dialog.
61
41
  * Defaults to true for backward compatibility.
@@ -69,9 +49,6 @@ export interface MessagingCapabilities {
69
49
  export interface ChannelListProps {
70
50
  onChannelSelect: (channel: Channel) => void
71
51
  selectedChannel?: Channel
72
- showStartConversation?: boolean
73
- onStartConversation?: () => void
74
- participantLabel?: string
75
52
  className?: string
76
53
  filters: ChannelFilters
77
54
  /**
@@ -281,7 +258,6 @@ export interface MessagingShellProps extends ChannelViewPassthroughProps {
281
258
  capabilities?: MessagingCapabilities
282
259
  className?: string
283
260
  onChannelSelect?: (channel: Channel) => void
284
- onParticipantSelect?: (participant: Participant) => void
285
261
 
286
262
  /**
287
263
  * Auto-select a conversation with this participant on mount.
@@ -342,19 +318,6 @@ export interface MessagingShellProps extends ChannelViewPassthroughProps {
342
318
  ) => React.ReactNode
343
319
  }
344
320
 
345
- /**
346
- * ParticipantPicker component props
347
- */
348
- export interface ParticipantPickerProps {
349
- participantSource: ParticipantSource
350
- onSelectParticipant: (participant: Participant) => void
351
- onClose: () => void
352
- existingParticipantIds?: Set<string>
353
- participantLabel?: string
354
- searchPlaceholder?: string
355
- className?: string
356
- }
357
-
358
321
  /**
359
322
  * MessagingProvider component props
360
323
  */