@linktr.ee/messaging-react 3.3.13-rc-1782278257 → 3.4.0-rc-1782373728
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/{Card-p74GBYEd.cjs → Card-B9Z659Y-.cjs} +2 -2
- package/dist/{Card-p74GBYEd.cjs.map → Card-B9Z659Y-.cjs.map} +1 -1
- package/dist/{Card-BSIZi_Cu.cjs → Card-C3icBnXT.cjs} +2 -2
- package/dist/{Card-BSIZi_Cu.cjs.map → Card-C3icBnXT.cjs.map} +1 -1
- package/dist/{Card-CI6Trmpw.js → Card-DGkh6_ti.js} +2 -2
- package/dist/{Card-CI6Trmpw.js.map → Card-DGkh6_ti.js.map} +1 -1
- package/dist/{Card-BCFhuR1g.cjs → Card-DVo2e4rF.cjs} +2 -2
- package/dist/{Card-BCFhuR1g.cjs.map → Card-DVo2e4rF.cjs.map} +1 -1
- package/dist/{Card-jmfDlxVY.js → Card-TNeK_nFK.js} +2 -2
- package/dist/{Card-jmfDlxVY.js.map → Card-TNeK_nFK.js.map} +1 -1
- package/dist/{Card-Bl0tPvn7.js → Card-h43tRi_a.js} +3 -3
- package/dist/{Card-Bl0tPvn7.js.map → Card-h43tRi_a.js.map} +1 -1
- package/dist/{LockedThumbnail-qhUBSijq.js → LockedThumbnail-DE3KLtk1.js} +2 -2
- package/dist/{LockedThumbnail-qhUBSijq.js.map → LockedThumbnail-DE3KLtk1.js.map} +1 -1
- package/dist/{LockedThumbnail-yoFQqnl6.cjs → LockedThumbnail-DjFuOEgv.cjs} +2 -2
- package/dist/{LockedThumbnail-yoFQqnl6.cjs.map → LockedThumbnail-DjFuOEgv.cjs.map} +1 -1
- package/dist/index--bjxhW3D.cjs +2 -0
- package/dist/index--bjxhW3D.cjs.map +1 -0
- package/dist/{index-BHFdqj7Z.js → index-DKq7HA0h.js} +874 -845
- package/dist/index-DKq7HA0h.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/ChannelView.test.tsx +20 -0
- package/src/components/ChannelView.tsx +43 -7
- package/src/types.ts +11 -0
- package/dist/index-BHFdqj7Z.js.map +0 -1
- package/dist/index-D31aF4s2.cjs +0 -2
- package/dist/index-D31aF4s2.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index--bjxhW3D.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -342,6 +342,16 @@ export declare interface ChannelViewProps {
|
|
|
342
342
|
* Use this to render staged paid or media attachments inside the input.
|
|
343
343
|
*/
|
|
344
344
|
attachmentPreviewList?: ComponentType;
|
|
345
|
+
/**
|
|
346
|
+
* Fired when the participant's name in the channel header is clicked. When
|
|
347
|
+
* provided, the name renders as a button with a trailing caret (an affordance
|
|
348
|
+
* for opening participant details / thread content); when omitted, the name
|
|
349
|
+
* renders as plain text.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* onParticipantNameClick={() => openThreadContentDialog()}
|
|
353
|
+
*/
|
|
354
|
+
onParticipantNameClick?: () => void;
|
|
345
355
|
}
|
|
346
356
|
|
|
347
357
|
export declare interface ComposerCardProps extends LockedAttachmentBaseProps {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, b as t, C as i, c as n, d as o, e as m, F as g, f as l, L as r, h as M, M as u, i as L, j as c, k as h, l as d, m as p, n as v, o as A, p as C, q as F, s as k, t as b, u as f, v as x, w as y, x as P, y as S, z as q, B as z, D as B } from "./index-
|
|
1
|
+
import { a as e, b as t, C as i, c as n, d as o, e as m, F as g, f as l, L as r, h as M, M as u, i as L, j as c, k as h, l as d, m as p, n as v, o as A, p as C, q as F, s as k, t as b, u as f, v as x, w as y, x as P, y as S, z as q, B as z, D as B } from "./index-DKq7HA0h.js";
|
|
2
2
|
export {
|
|
3
3
|
e as ActionButton,
|
|
4
4
|
t as Avatar,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/messaging-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0-rc-1782373728",
|
|
4
4
|
"description": "React messaging components built on messaging-core for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@linktr.ee/component-library": "11.8.6",
|
|
41
|
-
"@linktr.ee/messaging-core": "2.3.0-rc-
|
|
41
|
+
"@linktr.ee/messaging-core": "2.3.0-rc-1782373728",
|
|
42
42
|
"@phosphor-icons/react": "^2.1.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -193,6 +193,26 @@ describe('ChannelView', () => {
|
|
|
193
193
|
expect(screen.getAllByText('Linker').length).toBeGreaterThanOrEqual(1)
|
|
194
194
|
})
|
|
195
195
|
|
|
196
|
+
it('renders the participant name as a button that fires onParticipantNameClick', () => {
|
|
197
|
+
const onParticipantNameClick = vi.fn()
|
|
198
|
+
renderWithProviders(
|
|
199
|
+
<ChannelView
|
|
200
|
+
channel={createChannel()}
|
|
201
|
+
onParticipantNameClick={onParticipantNameClick}
|
|
202
|
+
/>
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
// Both the mobile and desktop header layouts render the button (one is
|
|
206
|
+
// hidden via CSS), so there is at least one match.
|
|
207
|
+
const buttons = screen.getAllByRole('button', {
|
|
208
|
+
name: /view details for linker/i,
|
|
209
|
+
})
|
|
210
|
+
expect(buttons.length).toBeGreaterThanOrEqual(1)
|
|
211
|
+
|
|
212
|
+
buttons[0].click()
|
|
213
|
+
expect(onParticipantNameClick).toHaveBeenCalledTimes(1)
|
|
214
|
+
})
|
|
215
|
+
|
|
196
216
|
it('renders the actions menu by default', () => {
|
|
197
217
|
renderWithProviders(<ChannelView channel={createChannel()} />)
|
|
198
218
|
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ArrowLeftIcon,
|
|
3
|
+
CaretRightIcon,
|
|
4
|
+
SparkleIcon,
|
|
5
|
+
StarIcon,
|
|
6
|
+
} from '@phosphor-icons/react'
|
|
2
7
|
import classNames from 'classnames'
|
|
3
8
|
import React, { useCallback, useEffect, useRef } from 'react'
|
|
4
9
|
import { Channel as ChannelType } from 'stream-chat'
|
|
@@ -52,6 +57,7 @@ const CustomChannelHeader: React.FC<{
|
|
|
52
57
|
customChannelActions?: React.ReactNode
|
|
53
58
|
renderChannelActions?: React.ReactNode
|
|
54
59
|
showChannelInfo?: boolean
|
|
60
|
+
onParticipantNameClick?: () => void
|
|
55
61
|
}> = ({
|
|
56
62
|
onBack,
|
|
57
63
|
showBackButton,
|
|
@@ -68,6 +74,7 @@ const CustomChannelHeader: React.FC<{
|
|
|
68
74
|
customChannelActions,
|
|
69
75
|
renderChannelActions,
|
|
70
76
|
showChannelInfo = true,
|
|
77
|
+
onParticipantNameClick,
|
|
71
78
|
}) => {
|
|
72
79
|
const { channel } = useChannelStateContext()
|
|
73
80
|
|
|
@@ -127,9 +134,21 @@ const CustomChannelHeader: React.FC<{
|
|
|
127
134
|
dmAgentEnabled={dmAgentEnabled}
|
|
128
135
|
size={48}
|
|
129
136
|
/>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
137
|
+
{onParticipantNameClick ? (
|
|
138
|
+
<button
|
|
139
|
+
type="button"
|
|
140
|
+
onClick={onParticipantNameClick}
|
|
141
|
+
aria-label={`View details for ${participantName}`}
|
|
142
|
+
className="flex max-w-full items-center gap-0.5 rounded text-center text-xs font-medium text-black/90 transition-opacity hover:opacity-70"
|
|
143
|
+
>
|
|
144
|
+
<span className="truncate">{participantName}</span>
|
|
145
|
+
<CaretRightIcon className="size-3 shrink-0" weight="bold" />
|
|
146
|
+
</button>
|
|
147
|
+
) : (
|
|
148
|
+
<p className="text-center text-xs font-medium text-black/90">
|
|
149
|
+
{participantName}
|
|
150
|
+
</p>
|
|
151
|
+
)}
|
|
133
152
|
{dmAgentEnabled && (
|
|
134
153
|
<div className="flex items-center gap-1 text-[10px] leading-3 text-black/55">
|
|
135
154
|
<SparkleIcon className="size-3 shrink-0 text-black/55" />
|
|
@@ -202,9 +221,21 @@ const CustomChannelHeader: React.FC<{
|
|
|
202
221
|
size={48}
|
|
203
222
|
/>
|
|
204
223
|
<div className="min-w-0">
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
224
|
+
{onParticipantNameClick ? (
|
|
225
|
+
<button
|
|
226
|
+
type="button"
|
|
227
|
+
onClick={onParticipantNameClick}
|
|
228
|
+
aria-label={`View details for ${participantName}`}
|
|
229
|
+
className="flex min-w-0 max-w-full items-center gap-1 rounded font-medium text-black/90 transition-opacity hover:opacity-70"
|
|
230
|
+
>
|
|
231
|
+
<span className="truncate">{participantName}</span>
|
|
232
|
+
<CaretRightIcon className="size-4 shrink-0" weight="bold" />
|
|
233
|
+
</button>
|
|
234
|
+
) : (
|
|
235
|
+
<h1 className="font-medium text-black/90 truncate">
|
|
236
|
+
{participantName}
|
|
237
|
+
</h1>
|
|
238
|
+
)}
|
|
208
239
|
{dmAgentEnabled && (
|
|
209
240
|
<div className="mt-0.5 flex items-center gap-1 text-[10px] leading-3 text-black/55">
|
|
210
241
|
<SparkleIcon className="size-3 shrink-0 text-black/55" />
|
|
@@ -289,6 +320,7 @@ const ChannelViewInner: React.FC<{
|
|
|
289
320
|
dmAgentEnabled?: boolean
|
|
290
321
|
viewerLanguage?: string
|
|
291
322
|
showChannelInfo?: boolean
|
|
323
|
+
onParticipantNameClick?: () => void
|
|
292
324
|
}> = ({
|
|
293
325
|
onBack,
|
|
294
326
|
showBackButton,
|
|
@@ -314,6 +346,7 @@ const ChannelViewInner: React.FC<{
|
|
|
314
346
|
dmAgentEnabled = false,
|
|
315
347
|
viewerLanguage,
|
|
316
348
|
showChannelInfo = true,
|
|
349
|
+
onParticipantNameClick,
|
|
317
350
|
}) => {
|
|
318
351
|
const { channel } = useChannelStateContext()
|
|
319
352
|
|
|
@@ -395,6 +428,7 @@ const ChannelViewInner: React.FC<{
|
|
|
395
428
|
onReportParticipantClick={onReportParticipantClick}
|
|
396
429
|
customChannelActions={customChannelActions}
|
|
397
430
|
renderChannelActions={renderChannelActions}
|
|
431
|
+
onParticipantNameClick={onParticipantNameClick}
|
|
398
432
|
/>
|
|
399
433
|
</div>
|
|
400
434
|
|
|
@@ -472,6 +506,7 @@ export const ChannelView = React.memo<ChannelViewProps>(
|
|
|
472
506
|
attachmentPreviewList,
|
|
473
507
|
viewerLanguage,
|
|
474
508
|
showChannelInfo = true,
|
|
509
|
+
onParticipantNameClick,
|
|
475
510
|
}) => {
|
|
476
511
|
// Custom send message handler that:
|
|
477
512
|
// 1. Applies messageMetadata if provided
|
|
@@ -584,6 +619,7 @@ export const ChannelView = React.memo<ChannelViewProps>(
|
|
|
584
619
|
renderMessage={renderMessage}
|
|
585
620
|
viewerLanguage={viewerLanguage}
|
|
586
621
|
showChannelInfo={showChannelInfo}
|
|
622
|
+
onParticipantNameClick={onParticipantNameClick}
|
|
587
623
|
/>
|
|
588
624
|
</Channel>
|
|
589
625
|
</DmAgentEnabledContext.Provider>
|
package/src/types.ts
CHANGED
|
@@ -313,6 +313,17 @@ export interface ChannelViewProps {
|
|
|
313
313
|
* Use this to render staged paid or media attachments inside the input.
|
|
314
314
|
*/
|
|
315
315
|
attachmentPreviewList?: ComponentType
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Fired when the participant's name in the channel header is clicked. When
|
|
319
|
+
* provided, the name renders as a button with a trailing caret (an affordance
|
|
320
|
+
* for opening participant details / thread content); when omitted, the name
|
|
321
|
+
* renders as plain text.
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* onParticipantNameClick={() => openThreadContentDialog()}
|
|
325
|
+
*/
|
|
326
|
+
onParticipantNameClick?: () => void
|
|
316
327
|
}
|
|
317
328
|
|
|
318
329
|
/**
|