@linktr.ee/messaging-react 3.12.1 → 3.12.2-rc-1784000578

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/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CxYkk8Bd.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.MessageBubble=e.MessageBubble;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.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;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-gl5pV2zJ.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.MessageBubble=e.MessageBubble;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.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;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 o, d as n, e as m, F as r, f as g, L as l, h as M, M as u, i as c, j as L, k as h, l as d, m as p, n as v, o as C, p as A, q as k, s as F, t as b, u as P, v as f, w as x, x as y, y as B, z as S, B as q, D as z, E as D, G as E, H as V } from "./index-thS5zrVb.js";
1
+ import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as u, i as c, j as L, k as h, l as d, m as p, n as v, o as C, p as A, q as k, s as F, t as b, u as P, v as f, w as x, x as y, y as B, z as S, B as q, D as z, E as D, G as E, H as V } from "./index-KfZ2Wx3D.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.12.1",
3
+ "version": "3.12.2-rc-1784000578",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@linktr.ee/component-library": "11.8.6",
53
- "@linktr.ee/messaging-core": "^2.2.0",
53
+ "@linktr.ee/messaging-core": "2.3.0-rc-1784000578",
54
54
  "@phosphor-icons/react": "^2.1.10"
55
55
  },
56
56
  "devDependencies": {
@@ -8,6 +8,7 @@ import { ChannelView } from './ChannelView'
8
8
 
9
9
  let activeChannel: unknown
10
10
  let activeChannelProps: Record<string, unknown> = {}
11
+ let activeComponentOverrides: Record<string, unknown> = {}
11
12
 
12
13
  vi.mock('stream-chat-react', () => ({
13
14
  Channel: (props: {
@@ -25,9 +26,16 @@ vi.mock('stream-chat-react', () => ({
25
26
  MessageList: ({ head }: { head?: React.ReactElement }) => (
26
27
  <div data-testid="message-list">{head}</div>
27
28
  ),
28
- WithComponents: ({ children }: { children: React.ReactNode }) => (
29
- <>{children}</>
30
- ),
29
+ WithComponents: ({
30
+ children,
31
+ overrides,
32
+ }: {
33
+ children: React.ReactNode
34
+ overrides?: Record<string, unknown>
35
+ }) => {
36
+ activeComponentOverrides = overrides ?? {}
37
+ return <>{children}</>
38
+ },
31
39
  useMessageContext: () => ({ message: { id: 'message-1', text: 'hello' } }),
32
40
  useChannelStateContext: () => ({ channel: activeChannel }),
33
41
  useChatContext: () => ({
@@ -137,8 +145,7 @@ const createChannel = ({
137
145
  id:
138
146
  otherUser.id ??
139
147
  (currentUserId === 'visitor-1' ? 'linker-1' : 'visitor-1'),
140
- is_account:
141
- otherUser.is_account ?? currentUserId === 'visitor-1',
148
+ is_account: otherUser.is_account ?? currentUserId === 'visitor-1',
142
149
  },
143
150
  customerTag: otherMemberCustomerTag,
144
151
  role: currentUserRole === 'owner' ? 'member' : 'owner',
@@ -159,6 +166,7 @@ describe('ChannelView', () => {
159
166
  beforeEach(() => {
160
167
  activeChannel = undefined
161
168
  activeChannelProps = {}
169
+ activeComponentOverrides = {}
162
170
  avatarRenderCalls.length = 0
163
171
  channelActionsMenuProps.length = 0
164
172
  messageInputProps.length = 0
@@ -167,8 +175,7 @@ describe('ChannelView', () => {
167
175
 
168
176
  const lastActionsMenuProps = () =>
169
177
  channelActionsMenuProps[channelActionsMenuProps.length - 1]
170
- const lastInputProps = () =>
171
- messageInputProps[messageInputProps.length - 1]
178
+ const lastInputProps = () => messageInputProps[messageInputProps.length - 1]
172
179
 
173
180
  it('keeps block and report visible by default in the actions menu', () => {
174
181
  renderWithProviders(<ChannelView channel={createChannel()} />)
@@ -284,6 +291,17 @@ describe('ChannelView', () => {
284
291
  ).toBeGreaterThan(0)
285
292
  })
286
293
 
294
+ it('suppresses stream unread message UI overrides', () => {
295
+ renderWithProviders(<ChannelView channel={createChannel()} />)
296
+
297
+ expect(activeComponentOverrides.UnreadMessagesSeparator).toBeTypeOf(
298
+ 'function'
299
+ )
300
+ expect(activeComponentOverrides.UnreadMessagesNotification).toBeTypeOf(
301
+ 'function'
302
+ )
303
+ })
304
+
287
305
  it('hides the actions menu (both desktop and mobile) when showChannelInfo is false', () => {
288
306
  renderWithProviders(
289
307
  <ChannelView channel={createChannel()} showChannelInfo={false} />
@@ -316,9 +334,7 @@ describe('ChannelView', () => {
316
334
  it('renders conversation footer between message list and message input', () => {
317
335
  const channel = createChannel()
318
336
  const renderConversationFooter = vi.fn((currentChannel: Channel) => (
319
- <div data-testid="conversation-footer">
320
- footer-{currentChannel.id}
321
- </div>
337
+ <div data-testid="conversation-footer">footer-{currentChannel.id}</div>
322
338
  ))
323
339
 
324
340
  renderWithProviders(
@@ -366,9 +382,7 @@ describe('ChannelView', () => {
366
382
  mockIsStarred = true
367
383
  const channel = createChannel()
368
384
 
369
- renderWithProviders(
370
- <ChannelView channel={channel} showStarButton={true} />
371
- )
385
+ renderWithProviders(<ChannelView channel={channel} showStarButton={true} />)
372
386
 
373
387
  expect(avatarRenderCalls.length).toBeGreaterThan(0)
374
388
  expect(avatarRenderCalls.every((call) => call.starred === true)).toBe(true)
@@ -390,16 +404,12 @@ describe('ChannelView', () => {
390
404
  currentUserRole: 'owner',
391
405
  })
392
406
 
393
- renderWithProviders(
394
- <ChannelView channel={channel} dmAgentEnabled={true} />
395
- )
407
+ renderWithProviders(<ChannelView channel={channel} dmAgentEnabled={true} />)
396
408
 
397
409
  expect(avatarRenderCalls.length).toBeGreaterThan(0)
398
410
  expect(
399
411
  avatarRenderCalls.every((call) => call.dmAgentEnabled === true)
400
- ).toBe(
401
- true
402
- )
412
+ ).toBe(true)
403
413
  })
404
414
 
405
415
  it('renders dm agent helper text when dmAgentEnabled is true for visitor view', () => {
@@ -408,9 +418,7 @@ describe('ChannelView', () => {
408
418
  currentUserRole: 'owner',
409
419
  })
410
420
 
411
- renderWithProviders(
412
- <ChannelView channel={channel} dmAgentEnabled={true} />
413
- )
421
+ renderWithProviders(<ChannelView channel={channel} dmAgentEnabled={true} />)
414
422
 
415
423
  expect(
416
424
  screen.getAllByText('Replies instantly with AI assistant').length
@@ -423,9 +431,7 @@ describe('ChannelView', () => {
423
431
  currentUserRole: 'member',
424
432
  })
425
433
 
426
- renderWithProviders(
427
- <ChannelView channel={channel} dmAgentEnabled={true} />
428
- )
434
+ renderWithProviders(<ChannelView channel={channel} dmAgentEnabled={true} />)
429
435
 
430
436
  expect(
431
437
  screen.queryByText('Replies instantly with AI assistant')
@@ -478,7 +484,11 @@ describe('ChannelView', () => {
478
484
 
479
485
  it('renders stable classes for channel header back buttons when enabled', () => {
480
486
  renderWithProviders(
481
- <ChannelView channel={createChannel()} showBackButton={true} onBack={vi.fn()} />
487
+ <ChannelView
488
+ channel={createChannel()}
489
+ showBackButton={true}
490
+ onBack={vi.fn()}
491
+ />
482
492
  )
483
493
 
484
494
  expect(
@@ -491,7 +501,11 @@ describe('ChannelView', () => {
491
501
 
492
502
  it('does not render channel header back button classes when disabled', () => {
493
503
  renderWithProviders(
494
- <ChannelView channel={createChannel()} showBackButton={false} onBack={vi.fn()} />
504
+ <ChannelView
505
+ channel={createChannel()}
506
+ showBackButton={false}
507
+ onBack={vi.fn()}
508
+ />
495
509
  )
496
510
 
497
511
  expect(
@@ -547,9 +561,7 @@ describe('ChannelView', () => {
547
561
  const anchor = document.createElement('a')
548
562
  anchor.href = 'https://example.com/clicked'
549
563
  anchor.addEventListener('click', (e) => e.preventDefault())
550
- container
551
- .querySelector('.messaging-channel-view')
552
- ?.appendChild(anchor)
564
+ container.querySelector('.messaging-channel-view')?.appendChild(anchor)
553
565
  anchor.click()
554
566
 
555
567
  expect(handler).toHaveBeenCalledOnce()
@@ -565,13 +577,11 @@ describe('ChannelView', () => {
565
577
  id: 'message-42',
566
578
  text: 'check this out https://example.com/clicked',
567
579
  metadata: { custom_type: 'MESSAGE_CHATBOT' },
568
- } as unknown as ReturnType<
569
- Channel['state']['formatMessage']
570
- >
580
+ } as unknown as ReturnType<Channel['state']['formatMessage']>
571
581
  const channel = createChannel()
572
- ;(
573
- channel.state as unknown as { messages: typeof message[] }
574
- ).messages = [message]
582
+ ;(channel.state as unknown as { messages: (typeof message)[] }).messages = [
583
+ message,
584
+ ]
575
585
 
576
586
  const { container } = renderWithProviders(
577
587
  <ChannelView channel={channel} onMessageLinkClick={handler} />
@@ -620,9 +630,7 @@ describe('ChannelView', () => {
620
630
  const anchor = document.createElement('a')
621
631
  anchor.href = 'https://example.com'
622
632
  anchor.addEventListener('click', (e) => e.preventDefault())
623
- container
624
- .querySelector('.messaging-channel-view')
625
- ?.appendChild(anchor)
633
+ container.querySelector('.messaging-channel-view')?.appendChild(anchor)
626
634
  expect(() => anchor.click()).not.toThrow()
627
635
  })
628
636
  })
@@ -523,6 +523,7 @@ const ChannelViewInner: React.FC<{
523
523
  overrides={{
524
524
  Message: MessageOverride,
525
525
  MessageActions: CustomMessageActions,
526
+ UnreadMessagesNotification: () => null,
526
527
  UnreadMessagesSeparator: () => null,
527
528
  }}
528
529
  >