@linktr.ee/messaging-react 3.3.13 → 3.3.14-rc-1782375842
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-BCFhuR1g.cjs → Card-1QppH8w_.cjs} +2 -2
- package/dist/{Card-BCFhuR1g.cjs.map → Card-1QppH8w_.cjs.map} +1 -1
- package/dist/{Card-p74GBYEd.cjs → Card-BcBtFG_o.cjs} +2 -2
- package/dist/{Card-p74GBYEd.cjs.map → Card-BcBtFG_o.cjs.map} +1 -1
- package/dist/{Card-CI6Trmpw.js → Card-BqJJWgZ1.js} +2 -2
- package/dist/{Card-CI6Trmpw.js.map → Card-BqJJWgZ1.js.map} +1 -1
- package/dist/{Card-BSIZi_Cu.cjs → Card-C6VWx8vH.cjs} +2 -2
- package/dist/{Card-BSIZi_Cu.cjs.map → Card-C6VWx8vH.cjs.map} +1 -1
- package/dist/{Card-jmfDlxVY.js → Card-CW8Pt1vX.js} +2 -2
- package/dist/{Card-jmfDlxVY.js.map → Card-CW8Pt1vX.js.map} +1 -1
- package/dist/{Card-Bl0tPvn7.js → Card-Dxu3t-B5.js} +3 -3
- package/dist/{Card-Bl0tPvn7.js.map → Card-Dxu3t-B5.js.map} +1 -1
- package/dist/{LockedThumbnail-yoFQqnl6.cjs → LockedThumbnail-DA6yXD4N.cjs} +2 -2
- package/dist/{LockedThumbnail-yoFQqnl6.cjs.map → LockedThumbnail-DA6yXD4N.cjs.map} +1 -1
- package/dist/{LockedThumbnail-qhUBSijq.js → LockedThumbnail-j9aOV8z7.js} +2 -2
- package/dist/{LockedThumbnail-qhUBSijq.js.map → LockedThumbnail-j9aOV8z7.js.map} +1 -1
- package/dist/index-BjCg538O.cjs +2 -0
- package/dist/index-BjCg538O.cjs.map +1 -0
- package/dist/{index-BHFdqj7Z.js → index-Y0Zo_toW.js} +645 -629
- package/dist/index-Y0Zo_toW.js.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 +21 -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-BjCg538O.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-Y0Zo_toW.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-1782375842",
|
|
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-1782375842",
|
|
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,11 @@ 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="truncate">{participantName}</span>
|
|
138
|
+
{headerTitleBadges && (
|
|
139
|
+
<span className="shrink-0">{headerTitleBadges}</span>
|
|
140
|
+
)}
|
|
132
141
|
</p>
|
|
133
142
|
{dmAgentEnabled && (
|
|
134
143
|
<div className="flex items-center gap-1 text-[10px] leading-3 text-black/55">
|
|
@@ -202,8 +211,11 @@ const CustomChannelHeader: React.FC<{
|
|
|
202
211
|
size={48}
|
|
203
212
|
/>
|
|
204
213
|
<div className="min-w-0">
|
|
205
|
-
<h1 className="font-medium text-black/90
|
|
206
|
-
{participantName}
|
|
214
|
+
<h1 className="flex min-w-0 items-center gap-1 font-medium text-black/90">
|
|
215
|
+
<span className="truncate">{participantName}</span>
|
|
216
|
+
{headerTitleBadges && (
|
|
217
|
+
<span className="shrink-0">{headerTitleBadges}</span>
|
|
218
|
+
)}
|
|
207
219
|
</h1>
|
|
208
220
|
{dmAgentEnabled && (
|
|
209
221
|
<div className="mt-0.5 flex items-center gap-1 text-[10px] leading-3 text-black/55">
|
|
@@ -280,6 +292,7 @@ const ChannelViewInner: React.FC<{
|
|
|
280
292
|
showStarButton?: boolean
|
|
281
293
|
chatbotVotingEnabled?: boolean
|
|
282
294
|
renderChannelBanner?: () => React.ReactNode
|
|
295
|
+
renderHeaderTitleBadges?: ChannelViewProps['renderHeaderTitleBadges']
|
|
283
296
|
customChannelActions?: React.ReactNode
|
|
284
297
|
renderChannelActions?: React.ReactNode
|
|
285
298
|
renderMessage?: (
|
|
@@ -308,6 +321,7 @@ const ChannelViewInner: React.FC<{
|
|
|
308
321
|
showStarButton = false,
|
|
309
322
|
chatbotVotingEnabled = false,
|
|
310
323
|
renderChannelBanner,
|
|
324
|
+
renderHeaderTitleBadges,
|
|
311
325
|
customChannelActions,
|
|
312
326
|
renderChannelActions,
|
|
313
327
|
renderMessage,
|
|
@@ -395,6 +409,7 @@ const ChannelViewInner: React.FC<{
|
|
|
395
409
|
onReportParticipantClick={onReportParticipantClick}
|
|
396
410
|
customChannelActions={customChannelActions}
|
|
397
411
|
renderChannelActions={renderChannelActions}
|
|
412
|
+
renderHeaderTitleBadges={renderHeaderTitleBadges}
|
|
398
413
|
/>
|
|
399
414
|
</div>
|
|
400
415
|
|
|
@@ -464,6 +479,7 @@ export const ChannelView = React.memo<ChannelViewProps>(
|
|
|
464
479
|
showStarButton = false,
|
|
465
480
|
chatbotVotingEnabled = false,
|
|
466
481
|
renderChannelBanner,
|
|
482
|
+
renderHeaderTitleBadges,
|
|
467
483
|
customChannelActions,
|
|
468
484
|
renderChannelActions,
|
|
469
485
|
renderMessage,
|
|
@@ -579,6 +595,7 @@ export const ChannelView = React.memo<ChannelViewProps>(
|
|
|
579
595
|
dmAgentEnabled={dmAgentEnabled}
|
|
580
596
|
chatbotVotingEnabled={chatbotVotingEnabled}
|
|
581
597
|
renderChannelBanner={renderChannelBanner}
|
|
598
|
+
renderHeaderTitleBadges={renderHeaderTitleBadges}
|
|
582
599
|
customChannelActions={customChannelActions}
|
|
583
600
|
renderChannelActions={renderChannelActions}
|
|
584
601
|
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'
|