@linktr.ee/messaging-react 1.11.5 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "1.11.5",
3
+ "version": "1.12.1",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -147,6 +147,10 @@ const ChannelInfoDialog: React.FC<{
147
147
  followerStatusLabel?: string
148
148
  onLeaveConversation?: (channel: ChannelType) => void
149
149
  onBlockParticipant?: (participantId?: string) => void
150
+ showDeleteConversation?: boolean
151
+ onDeleteConversationClick?: () => void
152
+ onBlockParticipantClick?: () => void
153
+ onReportParticipantClick?: () => void
150
154
  }> = ({
151
155
  dialogRef,
152
156
  onClose,
@@ -155,6 +159,10 @@ const ChannelInfoDialog: React.FC<{
155
159
  followerStatusLabel,
156
160
  onLeaveConversation,
157
161
  onBlockParticipant,
162
+ showDeleteConversation = true,
163
+ onDeleteConversationClick,
164
+ onBlockParticipantClick,
165
+ onReportParticipantClick,
158
166
  }) => {
159
167
  const { service, debug } = useMessagingContext()
160
168
  const [isParticipantBlocked, setIsParticipantBlocked] = useState(false)
@@ -186,6 +194,9 @@ const ChannelInfoDialog: React.FC<{
186
194
  const handleLeaveConversation = async () => {
187
195
  if (isLeaving) return
188
196
 
197
+ // Fire analytics callback before action
198
+ onDeleteConversationClick?.()
199
+
189
200
  if (debug) {
190
201
  console.log('[ChannelInfoDialog] Leave conversation', channel.cid)
191
202
  }
@@ -210,6 +221,9 @@ const ChannelInfoDialog: React.FC<{
210
221
  const handleBlockUser = async () => {
211
222
  if (isUpdatingBlockStatus || !service) return
212
223
 
224
+ // Fire analytics callback before action
225
+ onBlockParticipantClick?.()
226
+
213
227
  if (debug) {
214
228
  console.log('[ChannelInfoDialog] Block member', participant?.user?.id)
215
229
  }
@@ -233,6 +247,9 @@ const ChannelInfoDialog: React.FC<{
233
247
  const handleUnblockUser = async () => {
234
248
  if (isUpdatingBlockStatus || !service) return
235
249
 
250
+ // Fire analytics callback before action
251
+ onBlockParticipantClick?.()
252
+
236
253
  if (debug) {
237
254
  console.log('[ChannelInfoDialog] Unblock member', participant?.user?.id)
238
255
  }
@@ -254,6 +271,9 @@ const ChannelInfoDialog: React.FC<{
254
271
  }
255
272
 
256
273
  const handleReportUser = () => {
274
+ // Fire analytics callback before action
275
+ onReportParticipantClick?.()
276
+
257
277
  onClose()
258
278
  window.open(
259
279
  'https://linktr.ee/s/about/trust-center/report',
@@ -341,20 +361,22 @@ const ChannelInfoDialog: React.FC<{
341
361
  </div>
342
362
 
343
363
  <ul className="flex flex-col gap-2 mt-2">
344
- <li>
345
- <ActionButton
346
- onClick={handleLeaveConversation}
347
- disabled={isLeaving}
348
- aria-busy={isLeaving}
349
- >
350
- {isLeaving ? (
351
- <SpinnerGapIcon className="h-5 w-5 animate-spin" />
352
- ) : (
353
- <SignOutIcon className="h-5 w-5" />
354
- )}
355
- <span>Delete Conversation</span>
356
- </ActionButton>
357
- </li>
364
+ {showDeleteConversation && (
365
+ <li>
366
+ <ActionButton
367
+ onClick={handleLeaveConversation}
368
+ disabled={isLeaving}
369
+ aria-busy={isLeaving}
370
+ >
371
+ {isLeaving ? (
372
+ <SpinnerGapIcon className="h-5 w-5 animate-spin" />
373
+ ) : (
374
+ <SignOutIcon className="h-5 w-5" />
375
+ )}
376
+ <span>Delete Conversation</span>
377
+ </ActionButton>
378
+ </li>
379
+ )}
358
380
  <li>
359
381
  {isParticipantBlocked ? (
360
382
  <ActionButton
@@ -407,12 +429,20 @@ const ChannelViewInner: React.FC<{
407
429
  onLeaveConversation?: (channel: ChannelType) => void
408
430
  onBlockParticipant?: (participantId?: string) => void
409
431
  CustomChannelEmptyState?: React.ComponentType
432
+ showDeleteConversation?: boolean
433
+ onDeleteConversationClick?: () => void
434
+ onBlockParticipantClick?: () => void
435
+ onReportParticipantClick?: () => void
410
436
  }> = ({
411
437
  onBack,
412
438
  showBackButton,
413
439
  renderMessageInputActions,
414
440
  onLeaveConversation,
415
441
  onBlockParticipant,
442
+ showDeleteConversation = true,
443
+ onDeleteConversationClick,
444
+ onBlockParticipantClick,
445
+ onReportParticipantClick,
416
446
  }) => {
417
447
  const { channel } = useChannelStateContext()
418
448
  const infoDialogRef = useRef<HTMLDialogElement>(null)
@@ -491,6 +521,10 @@ const ChannelViewInner: React.FC<{
491
521
  followerStatusLabel={followerStatusLabel}
492
522
  onLeaveConversation={onLeaveConversation}
493
523
  onBlockParticipant={onBlockParticipant}
524
+ showDeleteConversation={showDeleteConversation}
525
+ onDeleteConversationClick={onDeleteConversationClick}
526
+ onBlockParticipantClick={onBlockParticipantClick}
527
+ onReportParticipantClick={onReportParticipantClick}
494
528
  />
495
529
  </>
496
530
  )
@@ -509,6 +543,10 @@ export const ChannelView = React.memo<ChannelViewProps>(
509
543
  onBlockParticipant,
510
544
  className,
511
545
  CustomChannelEmptyState = ChannelEmptyState,
546
+ showDeleteConversation = true,
547
+ onDeleteConversationClick,
548
+ onBlockParticipantClick,
549
+ onReportParticipantClick,
512
550
  }) => {
513
551
  return (
514
552
  <div
@@ -529,6 +567,10 @@ export const ChannelView = React.memo<ChannelViewProps>(
529
567
  onLeaveConversation={onLeaveConversation}
530
568
  onBlockParticipant={onBlockParticipant}
531
569
  CustomChannelEmptyState={CustomChannelEmptyState}
570
+ showDeleteConversation={showDeleteConversation}
571
+ onDeleteConversationClick={onDeleteConversationClick}
572
+ onBlockParticipantClick={onBlockParticipantClick}
573
+ onReportParticipantClick={onReportParticipantClick}
532
574
  />
533
575
  </Channel>
534
576
  </div>
@@ -27,6 +27,9 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
27
27
  showChannelList = true,
28
28
  filters,
29
29
  channelListCustomEmptyStateIndicator,
30
+ onDeleteConversationClick,
31
+ onBlockParticipantClick,
32
+ onReportParticipantClick,
30
33
  }) => {
31
34
  const {
32
35
  service,
@@ -53,7 +56,11 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
53
56
 
54
57
  const participantPickerRef = useRef<HTMLDialogElement>(null)
55
58
 
56
- const { participantSource, participantLabel = 'participants' } = capabilities
59
+ const {
60
+ participantSource,
61
+ participantLabel = 'participants',
62
+ showDeleteConversation = true,
63
+ } = capabilities
57
64
 
58
65
  // Create default filters and merge with provided filters
59
66
  const channelFilters = React.useMemo(() => {
@@ -465,6 +472,10 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
465
472
  onLeaveConversation={handleLeaveConversation}
466
473
  onBlockParticipant={handleBlockParticipant}
467
474
  CustomChannelEmptyState={CustomChannelEmptyState}
475
+ showDeleteConversation={showDeleteConversation}
476
+ onDeleteConversationClick={onDeleteConversationClick}
477
+ onBlockParticipantClick={onBlockParticipantClick}
478
+ onReportParticipantClick={onReportParticipantClick}
468
479
  />
469
480
  </div>
470
481
  ) : (
package/src/types.ts CHANGED
@@ -44,6 +44,11 @@ export interface MessagingCapabilities {
44
44
  showStartConversation?: boolean
45
45
  participantSource?: ParticipantSource
46
46
  participantLabel?: string // e.g., "followers", "team members"
47
+ /**
48
+ * Show the "Delete Conversation" button in channel info dialog.
49
+ * Defaults to true for backward compatibility.
50
+ */
51
+ showDeleteConversation?: boolean
47
52
  }
48
53
 
49
54
  /**
@@ -98,6 +103,24 @@ export interface MessagingShellProps {
98
103
  * Useful for showing a custom empty state indicator when the channel list is empty.
99
104
  */
100
105
  channelListCustomEmptyStateIndicator?: React.ComponentType<EmptyStateIndicatorProps>
106
+
107
+ /**
108
+ * Analytics callback fired when "Delete Conversation" is clicked.
109
+ * Called before the action is performed.
110
+ */
111
+ onDeleteConversationClick?: () => void
112
+
113
+ /**
114
+ * Analytics callback fired when "Block" or "Unblock" is clicked.
115
+ * Called before the action is performed.
116
+ */
117
+ onBlockParticipantClick?: () => void
118
+
119
+ /**
120
+ * Analytics callback fired when "Report" is clicked.
121
+ * Called before the action is performed.
122
+ */
123
+ onReportParticipantClick?: () => void
101
124
  }
102
125
 
103
126
  /**
@@ -126,6 +149,23 @@ export interface ChannelViewProps {
126
149
  onBlockParticipant?: (participantId?: string) => void
127
150
  className?: string
128
151
  CustomChannelEmptyState?: React.ComponentType
152
+ /**
153
+ * Show the "Delete Conversation" button in channel info dialog.
154
+ * Defaults to true for backward compatibility.
155
+ */
156
+ showDeleteConversation?: boolean
157
+ /**
158
+ * Analytics callback fired when "Delete Conversation" is clicked.
159
+ */
160
+ onDeleteConversationClick?: () => void
161
+ /**
162
+ * Analytics callback fired when "Block" or "Unblock" is clicked.
163
+ */
164
+ onBlockParticipantClick?: () => void
165
+ /**
166
+ * Analytics callback fired when "Report" is clicked.
167
+ */
168
+ onReportParticipantClick?: () => void
129
169
  }
130
170
 
131
171
  /**