@linktr.ee/messaging-react 3.4.2-rc-1782453771 → 3.4.2-rc-1782454787

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.
Files changed (30) hide show
  1. package/dist/{Card-ql9pImRa.js → Card-BQZcPeQn.js} +2 -2
  2. package/dist/{Card-ql9pImRa.js.map → Card-BQZcPeQn.js.map} +1 -1
  3. package/dist/{Card-BIa-47Ne.cjs → Card-CSqZXHCM.cjs} +2 -2
  4. package/dist/{Card-BIa-47Ne.cjs.map → Card-CSqZXHCM.cjs.map} +1 -1
  5. package/dist/{Card-BkVj6kGN.cjs → Card-Cp0Ioui8.cjs} +2 -2
  6. package/dist/{Card-BkVj6kGN.cjs.map → Card-Cp0Ioui8.cjs.map} +1 -1
  7. package/dist/{Card-52LnCirC.js → Card-DFaRAFV1.js} +3 -3
  8. package/dist/{Card-52LnCirC.js.map → Card-DFaRAFV1.js.map} +1 -1
  9. package/dist/{Card-CcTyYY9N.cjs → Card-DWmbH7oz.cjs} +2 -2
  10. package/dist/{Card-CcTyYY9N.cjs.map → Card-DWmbH7oz.cjs.map} +1 -1
  11. package/dist/{Card-BaXLsSK2.js → Card-U9LAeCEA.js} +2 -2
  12. package/dist/{Card-BaXLsSK2.js.map → Card-U9LAeCEA.js.map} +1 -1
  13. package/dist/{LockedThumbnail-C3YOnS-o.js → LockedThumbnail-JOZFwdjw.js} +2 -2
  14. package/dist/{LockedThumbnail-C3YOnS-o.js.map → LockedThumbnail-JOZFwdjw.js.map} +1 -1
  15. package/dist/{LockedThumbnail-D0ASm7LP.cjs → LockedThumbnail-nLWi4Kxt.cjs} +2 -2
  16. package/dist/{LockedThumbnail-D0ASm7LP.cjs.map → LockedThumbnail-nLWi4Kxt.cjs.map} +1 -1
  17. package/dist/index-BSQPos2Q.cjs +2 -0
  18. package/dist/index-BSQPos2Q.cjs.map +1 -0
  19. package/dist/{index-CbWEp3Zs.js → index-DyG_ZuPp.js} +386 -386
  20. package/dist/index-DyG_ZuPp.js.map +1 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +1 -1
  23. package/package.json +2 -2
  24. package/src/components/ChannelList/CustomChannelPreview.tsx +1 -3
  25. package/src/components/ChannelView.test.tsx +16 -13
  26. package/src/components/ChannelView.tsx +4 -4
  27. package/src/components/ParticipantBadges.tsx +6 -3
  28. package/dist/index-CbWEp3Zs.js.map +0 -1
  29. package/dist/index-DkqM2z_j.cjs +0 -2
  30. package/dist/index-DkqM2z_j.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-DkqM2z_j.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BSQPos2Q.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.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-CbWEp3Zs.js";
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-DyG_ZuPp.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.4.2-rc-1782453771",
3
+ "version": "3.4.2-rc-1782454787",
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-1782453771",
41
+ "@linktr.ee/messaging-core": "2.3.0-rc-1782454787",
42
42
  "@phosphor-icons/react": "^2.1.10"
43
43
  },
44
44
  "devDependencies": {
@@ -2,7 +2,6 @@ import classNames from 'classnames'
2
2
  import React from 'react'
3
3
  import { ChannelPreviewUIComponentProps } from 'stream-chat-react'
4
4
 
5
- import { useChannelStar } from '../../hooks/useChannelStar'
6
5
  import { formatRelativeTime } from '../../utils/formatRelativeTime'
7
6
  import { getMessageDisplayText } from '../../utils/getMessageDisplayText'
8
7
  import { resolveParticipantDisplayName } from '../../utils/resolveParticipantDisplayName'
@@ -104,7 +103,6 @@ const CustomChannelPreview = React.memo<ChannelPreviewUIComponentProps>(
104
103
  const messagePreview = renderMessagePreview
105
104
  ? renderMessagePreview(lastMessage, lastMessageText)
106
105
  : `${isLastMessageFromChatbot ? '✨ ' : ''}${lastMessageText}`
107
- const isChannelStarred = useChannelStar(channel)
108
106
 
109
107
  // Use the unread prop passed by Stream Chat (reactive and updates automatically)
110
108
  const unreadCount = unread ?? 0
@@ -149,8 +147,8 @@ const CustomChannelPreview = React.memo<ChannelPreviewUIComponentProps>(
149
147
  <h3 className="flex min-w-0 items-center gap-1 text-sm font-medium text-[#191918]">
150
148
  <span className="min-w-0 truncate">{participantName}</span>
151
149
  <ParticipantBadges
150
+ channel={channel}
152
151
  participant={participant}
153
- isStarred={isChannelStarred}
154
152
  />
155
153
  </h3>
156
154
  {lastMessageTime && (
@@ -84,13 +84,9 @@ vi.mock('./Avatar', () => ({
84
84
  },
85
85
  }))
86
86
 
87
- let mockIsStarred = false
88
- vi.mock('../hooks/useChannelStar', () => ({
89
- useChannelStar: () => mockIsStarred,
90
- }))
91
-
92
87
  const createChannel = ({
93
88
  currentUserId = 'visitor-1',
89
+ currentUserPinnedAt,
94
90
  currentUserRole = 'owner',
95
91
  otherUser = {
96
92
  id: 'linker-1' as const,
@@ -101,6 +97,7 @@ const createChannel = ({
101
97
  otherMemberCustomer = false,
102
98
  }: {
103
99
  currentUserId?: 'visitor-1' | 'linker-1'
100
+ currentUserPinnedAt?: string
104
101
  currentUserRole?: 'owner' | 'member'
105
102
  otherMemberCustomer?: boolean
106
103
  otherUser?: {
@@ -138,10 +135,12 @@ const createChannel = ({
138
135
  customer: otherMemberCustomer,
139
136
  },
140
137
  },
141
- membership: {},
138
+ membership: {
139
+ pinned_at: currentUserPinnedAt,
140
+ },
142
141
  messages: [],
143
142
  },
144
- on: vi.fn(),
143
+ on: vi.fn(() => ({ unsubscribe: vi.fn() })),
145
144
  off: vi.fn(),
146
145
  sendMessage: vi.fn(),
147
146
  hide: vi.fn(),
@@ -156,7 +155,6 @@ describe('ChannelView', () => {
156
155
  avatarRenderCalls.length = 0
157
156
  channelActionsMenuProps.length = 0
158
157
  messageInputProps.length = 0
159
- mockIsStarred = false
160
158
  })
161
159
 
162
160
  const lastActionsMenuProps = () =>
@@ -291,8 +289,9 @@ describe('ChannelView', () => {
291
289
  })
292
290
 
293
291
  it('does not pass starred to avatar when channel is starred', () => {
294
- mockIsStarred = true
295
- const channel = createChannel()
292
+ const channel = createChannel({
293
+ currentUserPinnedAt: '2026-01-01T00:00:00.000Z',
294
+ })
296
295
 
297
296
  renderWithProviders(
298
297
  <ChannelView channel={channel} showStarButton={true} />
@@ -326,9 +325,13 @@ describe('ChannelView', () => {
326
325
  })
327
326
 
328
327
  it('renders built-in starred badges from channel star state', () => {
329
- mockIsStarred = true
330
-
331
- renderWithProviders(<ChannelView channel={createChannel()} />)
328
+ renderWithProviders(
329
+ <ChannelView
330
+ channel={createChannel({
331
+ currentUserPinnedAt: '2026-01-01T00:00:00.000Z',
332
+ })}
333
+ />
334
+ )
332
335
 
333
336
  expect(
334
337
  screen.getAllByRole('img', { name: 'Starred conversation' }).length
@@ -149,8 +149,8 @@ const CustomChannelHeader: React.FC<{
149
149
  >
150
150
  <span className="min-w-0 truncate">{participantName}</span>
151
151
  <ParticipantBadges
152
+ channel={channel}
152
153
  participant={participant}
153
- isStarred={isStarred}
154
154
  />
155
155
  {headerTitleBadges && (
156
156
  <span className="shrink-0">{headerTitleBadges}</span>
@@ -161,8 +161,8 @@ const CustomChannelHeader: React.FC<{
161
161
  <p className="flex max-w-full items-center justify-center gap-1 text-center text-xs font-medium text-black/90">
162
162
  <span className="min-w-0 truncate">{participantName}</span>
163
163
  <ParticipantBadges
164
+ channel={channel}
164
165
  participant={participant}
165
- isStarred={isStarred}
166
166
  />
167
167
  {headerTitleBadges && (
168
168
  <span className="shrink-0">{headerTitleBadges}</span>
@@ -249,8 +249,8 @@ const CustomChannelHeader: React.FC<{
249
249
  >
250
250
  <span className="min-w-0 truncate">{participantName}</span>
251
251
  <ParticipantBadges
252
+ channel={channel}
252
253
  participant={participant}
253
- isStarred={isStarred}
254
254
  />
255
255
  {headerTitleBadges && (
256
256
  <span className="shrink-0">{headerTitleBadges}</span>
@@ -261,8 +261,8 @@ const CustomChannelHeader: React.FC<{
261
261
  <h1 className="flex min-w-0 items-center gap-1 font-medium text-black/90">
262
262
  <span className="min-w-0 truncate">{participantName}</span>
263
263
  <ParticipantBadges
264
+ channel={channel}
264
265
  participant={participant}
265
- isStarred={isStarred}
266
266
  />
267
267
  {headerTitleBadges && (
268
268
  <span className="shrink-0">{headerTitleBadges}</span>
@@ -1,12 +1,15 @@
1
1
  import { CurrencyDollarIcon, StarIcon } from '@phosphor-icons/react'
2
2
  import React from 'react'
3
- import type { ChannelMemberResponse } from 'stream-chat'
3
+ import type { Channel, ChannelMemberResponse } from 'stream-chat'
4
+
5
+ import { useChannelStar } from '../hooks/useChannelStar'
4
6
 
5
7
  export const ParticipantBadges: React.FC<{
8
+ channel?: Channel
6
9
  participant?: ChannelMemberResponse
7
- isStarred?: boolean
8
- }> = ({ participant, isStarred = false }) => {
10
+ }> = ({ channel, participant }) => {
9
11
  const isCustomer = participant?.customer === true
12
+ const isStarred = useChannelStar(channel)
10
13
 
11
14
  if (!isCustomer && !isStarred) return null
12
15