@linktr.ee/messaging-react 3.3.13 → 3.3.14-rc-1782376133
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-BSIZi_Cu.cjs → Card-Bfigt254.cjs} +2 -2
- package/dist/{Card-BSIZi_Cu.cjs.map → Card-Bfigt254.cjs.map} +1 -1
- package/dist/{Card-BCFhuR1g.cjs → Card-C_dE3Qu1.cjs} +2 -2
- package/dist/{Card-BCFhuR1g.cjs.map → Card-C_dE3Qu1.cjs.map} +1 -1
- package/dist/{Card-jmfDlxVY.js → Card-Ch_mEI0W.js} +2 -2
- package/dist/{Card-jmfDlxVY.js.map → Card-Ch_mEI0W.js.map} +1 -1
- package/dist/{Card-CI6Trmpw.js → Card-Cj77HUEV.js} +2 -2
- package/dist/{Card-CI6Trmpw.js.map → Card-Cj77HUEV.js.map} +1 -1
- package/dist/{Card-Bl0tPvn7.js → Card-QGq8FOuB.js} +3 -3
- package/dist/{Card-Bl0tPvn7.js.map → Card-QGq8FOuB.js.map} +1 -1
- package/dist/{Card-p74GBYEd.cjs → Card-UNYUEkhB.cjs} +2 -2
- package/dist/{Card-p74GBYEd.cjs.map → Card-UNYUEkhB.cjs.map} +1 -1
- package/dist/{LockedThumbnail-yoFQqnl6.cjs → LockedThumbnail-BhRg8vCA.cjs} +2 -2
- package/dist/{LockedThumbnail-yoFQqnl6.cjs.map → LockedThumbnail-BhRg8vCA.cjs.map} +1 -1
- package/dist/{LockedThumbnail-qhUBSijq.js → LockedThumbnail-DpBD4eNW.js} +2 -2
- package/dist/{LockedThumbnail-qhUBSijq.js.map → LockedThumbnail-DpBD4eNW.js.map} +1 -1
- package/dist/{index-BHFdqj7Z.js → index-BS5mKzxR.js} +645 -629
- package/dist/index-BS5mKzxR.js.map +1 -0
- package/dist/index-BpVRd7bJ.cjs +2 -0
- package/dist/index-BpVRd7bJ.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/ChannelView.stories.tsx +21 -0
- package/src/components/ChannelView.tsx +25 -4
- package/src/components/MessagingShell/index.tsx +2 -0
- 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-BpVRd7bJ.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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Attachment } from 'stream-chat';
|
|
2
2
|
import { Channel } from 'stream-chat';
|
|
3
3
|
import { ChannelFilters } from 'stream-chat';
|
|
4
|
+
import { ChannelMemberResponse } from 'stream-chat';
|
|
4
5
|
import { ChannelSort } from 'stream-chat';
|
|
5
6
|
import { ComponentType } from 'react';
|
|
6
7
|
import { default as default_2 } from 'react';
|
|
@@ -148,7 +149,7 @@ export declare const ChannelView: default_2.NamedExoticComponent<ChannelViewProp
|
|
|
148
149
|
* Props that MessagingShell passes through to ChannelView.
|
|
149
150
|
* ChannelViewProps is the source of truth for these props.
|
|
150
151
|
*/
|
|
151
|
-
declare type ChannelViewPassthroughProps = Pick<ChannelViewProps, 'renderMessageInputActions' | 'renderConversationFooter' | 'CustomChannelEmptyState' | 'onBlockParticipantClick' | 'onReportParticipantClick' | 'dmAgentEnabled' | 'onMessageSent' | 'chatbotVotingEnabled' | 'viewerLanguage' | 'renderChannelBanner' | 'customChannelActions' | 'renderChannelActions' | 'renderMessage' | 'onMessageLinkClick' | 'showChannelInfo'>;
|
|
152
|
+
declare type ChannelViewPassthroughProps = Pick<ChannelViewProps, 'renderMessageInputActions' | 'renderConversationFooter' | 'CustomChannelEmptyState' | 'onBlockParticipantClick' | 'onReportParticipantClick' | 'dmAgentEnabled' | 'onMessageSent' | 'chatbotVotingEnabled' | 'viewerLanguage' | 'renderHeaderTitleBadges' | 'renderChannelBanner' | 'customChannelActions' | 'renderChannelActions' | 'renderMessage' | 'onMessageLinkClick' | 'showChannelInfo'>;
|
|
152
153
|
|
|
153
154
|
/**
|
|
154
155
|
* ChannelView component props
|
|
@@ -250,6 +251,14 @@ export declare interface ChannelViewProps {
|
|
|
250
251
|
* and filter by starred/pinned status.
|
|
251
252
|
*/
|
|
252
253
|
showStarButton?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Custom badges rendered inline after the participant name in the channel
|
|
256
|
+
* header title.
|
|
257
|
+
*/
|
|
258
|
+
renderHeaderTitleBadges?: (context: {
|
|
259
|
+
channel: Channel;
|
|
260
|
+
participant?: ChannelMemberResponse;
|
|
261
|
+
}) => React.ReactNode;
|
|
253
262
|
/**
|
|
254
263
|
* Show the channel actions menu (the `...` popover) in the header, which
|
|
255
264
|
* exposes the block/report/delete moderation actions. Defaults to true.
|
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-BS5mKzxR.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.
|
|
3
|
+
"version": "3.3.14-rc-1782376133",
|
|
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": "
|
|
41
|
+
"@linktr.ee/messaging-core": "2.3.0-rc-1782376133",
|
|
42
42
|
"@phosphor-icons/react": "^2.1.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -270,6 +270,27 @@ DmAgentHeader.parameters = {
|
|
|
270
270
|
},
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
export const WithHeaderTitleBadges: StoryFn<TemplateProps> = Template.bind({})
|
|
274
|
+
WithHeaderTitleBadges.args = {
|
|
275
|
+
showBackButton: false,
|
|
276
|
+
renderHeaderTitleBadges: ({ participant }) => (
|
|
277
|
+
<span
|
|
278
|
+
aria-label={`${participant?.user?.name ?? 'Participant'} is a customer`}
|
|
279
|
+
className="flex size-4 items-center justify-center rounded-full bg-[#E8F8EF] text-[10px] font-semibold text-[#136C3A]"
|
|
280
|
+
>
|
|
281
|
+
$
|
|
282
|
+
</span>
|
|
283
|
+
),
|
|
284
|
+
}
|
|
285
|
+
WithHeaderTitleBadges.parameters = {
|
|
286
|
+
docs: {
|
|
287
|
+
description: {
|
|
288
|
+
story:
|
|
289
|
+
'Renders custom badges inline after the participant name in the channel header via renderHeaderTitleBadges.',
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
}
|
|
293
|
+
|
|
273
294
|
export const RestrictedOfficialChannel: StoryFn<TemplateProps> = Template.bind(
|
|
274
295
|
{}
|
|
275
296
|
)
|
|
@@ -52,6 +52,7 @@ const CustomChannelHeader: React.FC<{
|
|
|
52
52
|
customChannelActions?: React.ReactNode
|
|
53
53
|
renderChannelActions?: React.ReactNode
|
|
54
54
|
showChannelInfo?: boolean
|
|
55
|
+
renderHeaderTitleBadges?: ChannelViewProps['renderHeaderTitleBadges']
|
|
55
56
|
}> = ({
|
|
56
57
|
onBack,
|
|
57
58
|
showBackButton,
|
|
@@ -68,6 +69,7 @@ const CustomChannelHeader: React.FC<{
|
|
|
68
69
|
customChannelActions,
|
|
69
70
|
renderChannelActions,
|
|
70
71
|
showChannelInfo = true,
|
|
72
|
+
renderHeaderTitleBadges,
|
|
71
73
|
}) => {
|
|
72
74
|
const { channel } = useChannelStateContext()
|
|
73
75
|
|
|
@@ -84,6 +86,10 @@ const CustomChannelHeader: React.FC<{
|
|
|
84
86
|
const participantName = resolveParticipantDisplayName(participant?.user)
|
|
85
87
|
const participantImage = participant?.user?.image
|
|
86
88
|
const isStarred = useChannelStar(channel)
|
|
89
|
+
const headerTitleBadges = renderHeaderTitleBadges?.({
|
|
90
|
+
channel,
|
|
91
|
+
participant,
|
|
92
|
+
})
|
|
87
93
|
|
|
88
94
|
const handleStarClick = async () => {
|
|
89
95
|
try {
|
|
@@ -127,8 +133,13 @@ const CustomChannelHeader: React.FC<{
|
|
|
127
133
|
dmAgentEnabled={dmAgentEnabled}
|
|
128
134
|
size={48}
|
|
129
135
|
/>
|
|
130
|
-
<p className="text-center text-xs font-medium text-black/90">
|
|
131
|
-
{participantName}
|
|
136
|
+
<p className="flex max-w-full items-center justify-center gap-1 text-center text-xs font-medium text-black/90">
|
|
137
|
+
<span className="min-w-0 truncate">{participantName}</span>
|
|
138
|
+
{headerTitleBadges && (
|
|
139
|
+
<span className="flex shrink-0 items-center">
|
|
140
|
+
{headerTitleBadges}
|
|
141
|
+
</span>
|
|
142
|
+
)}
|
|
132
143
|
</p>
|
|
133
144
|
{dmAgentEnabled && (
|
|
134
145
|
<div className="flex items-center gap-1 text-[10px] leading-3 text-black/55">
|
|
@@ -202,8 +213,13 @@ const CustomChannelHeader: React.FC<{
|
|
|
202
213
|
size={48}
|
|
203
214
|
/>
|
|
204
215
|
<div className="min-w-0">
|
|
205
|
-
<h1 className="font-medium text-black/90
|
|
206
|
-
{participantName}
|
|
216
|
+
<h1 className="flex min-w-0 items-center gap-1 font-medium text-black/90">
|
|
217
|
+
<span className="min-w-0 truncate">{participantName}</span>
|
|
218
|
+
{headerTitleBadges && (
|
|
219
|
+
<span className="flex shrink-0 items-center">
|
|
220
|
+
{headerTitleBadges}
|
|
221
|
+
</span>
|
|
222
|
+
)}
|
|
207
223
|
</h1>
|
|
208
224
|
{dmAgentEnabled && (
|
|
209
225
|
<div className="mt-0.5 flex items-center gap-1 text-[10px] leading-3 text-black/55">
|
|
@@ -280,6 +296,7 @@ const ChannelViewInner: React.FC<{
|
|
|
280
296
|
showStarButton?: boolean
|
|
281
297
|
chatbotVotingEnabled?: boolean
|
|
282
298
|
renderChannelBanner?: () => React.ReactNode
|
|
299
|
+
renderHeaderTitleBadges?: ChannelViewProps['renderHeaderTitleBadges']
|
|
283
300
|
customChannelActions?: React.ReactNode
|
|
284
301
|
renderChannelActions?: React.ReactNode
|
|
285
302
|
renderMessage?: (
|
|
@@ -308,6 +325,7 @@ const ChannelViewInner: React.FC<{
|
|
|
308
325
|
showStarButton = false,
|
|
309
326
|
chatbotVotingEnabled = false,
|
|
310
327
|
renderChannelBanner,
|
|
328
|
+
renderHeaderTitleBadges,
|
|
311
329
|
customChannelActions,
|
|
312
330
|
renderChannelActions,
|
|
313
331
|
renderMessage,
|
|
@@ -395,6 +413,7 @@ const ChannelViewInner: React.FC<{
|
|
|
395
413
|
onReportParticipantClick={onReportParticipantClick}
|
|
396
414
|
customChannelActions={customChannelActions}
|
|
397
415
|
renderChannelActions={renderChannelActions}
|
|
416
|
+
renderHeaderTitleBadges={renderHeaderTitleBadges}
|
|
398
417
|
/>
|
|
399
418
|
</div>
|
|
400
419
|
|
|
@@ -464,6 +483,7 @@ export const ChannelView = React.memo<ChannelViewProps>(
|
|
|
464
483
|
showStarButton = false,
|
|
465
484
|
chatbotVotingEnabled = false,
|
|
466
485
|
renderChannelBanner,
|
|
486
|
+
renderHeaderTitleBadges,
|
|
467
487
|
customChannelActions,
|
|
468
488
|
renderChannelActions,
|
|
469
489
|
renderMessage,
|
|
@@ -579,6 +599,7 @@ export const ChannelView = React.memo<ChannelViewProps>(
|
|
|
579
599
|
dmAgentEnabled={dmAgentEnabled}
|
|
580
600
|
chatbotVotingEnabled={chatbotVotingEnabled}
|
|
581
601
|
renderChannelBanner={renderChannelBanner}
|
|
602
|
+
renderHeaderTitleBadges={renderHeaderTitleBadges}
|
|
582
603
|
customChannelActions={customChannelActions}
|
|
583
604
|
renderChannelActions={renderChannelActions}
|
|
584
605
|
renderMessage={renderMessage}
|
|
@@ -31,6 +31,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
31
31
|
onMessageSent,
|
|
32
32
|
chatbotVotingEnabled = false,
|
|
33
33
|
viewerLanguage,
|
|
34
|
+
renderHeaderTitleBadges,
|
|
34
35
|
renderChannelBanner,
|
|
35
36
|
customChannelActions,
|
|
36
37
|
renderChannelActions,
|
|
@@ -255,6 +256,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
255
256
|
onMessageSent={onMessageSent}
|
|
256
257
|
chatbotVotingEnabled={chatbotVotingEnabled}
|
|
257
258
|
viewerLanguage={viewerLanguage}
|
|
259
|
+
renderHeaderTitleBadges={renderHeaderTitleBadges}
|
|
258
260
|
customChannelActions={customChannelActions}
|
|
259
261
|
renderChannelActions={renderChannelActions}
|
|
260
262
|
renderMessage={renderMessage}
|
package/src/types.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { ComponentType } from 'react'
|
|
|
6
6
|
import type {
|
|
7
7
|
Channel,
|
|
8
8
|
ChannelFilters,
|
|
9
|
+
ChannelMemberResponse,
|
|
9
10
|
ChannelSort,
|
|
10
11
|
LocalMessage,
|
|
11
12
|
SendMessageAPIResponse,
|
|
@@ -209,6 +210,15 @@ export interface ChannelViewProps {
|
|
|
209
210
|
*/
|
|
210
211
|
showStarButton?: boolean
|
|
211
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Custom badges rendered inline after the participant name in the channel
|
|
215
|
+
* header title.
|
|
216
|
+
*/
|
|
217
|
+
renderHeaderTitleBadges?: (context: {
|
|
218
|
+
channel: Channel
|
|
219
|
+
participant?: ChannelMemberResponse
|
|
220
|
+
}) => React.ReactNode
|
|
221
|
+
|
|
212
222
|
/**
|
|
213
223
|
* Show the channel actions menu (the `...` popover) in the header, which
|
|
214
224
|
* exposes the block/report/delete moderation actions. Defaults to true.
|
|
@@ -330,6 +340,7 @@ export type ChannelViewPassthroughProps = Pick<
|
|
|
330
340
|
| 'onMessageSent'
|
|
331
341
|
| 'chatbotVotingEnabled'
|
|
332
342
|
| 'viewerLanguage'
|
|
343
|
+
| 'renderHeaderTitleBadges'
|
|
333
344
|
| 'renderChannelBanner'
|
|
334
345
|
| 'customChannelActions'
|
|
335
346
|
| 'renderChannelActions'
|