@linktr.ee/messaging-react 3.6.0 → 3.6.1-rc-1783229373
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-J8f28GLS.js → Card-B0lzpuYf.js} +3 -3
- package/dist/{Card-J8f28GLS.js.map → Card-B0lzpuYf.js.map} +1 -1
- package/dist/{Card-ra-g17Ur.js → Card-BrC7mKtr.js} +2 -2
- package/dist/{Card-ra-g17Ur.js.map → Card-BrC7mKtr.js.map} +1 -1
- package/dist/{Card-DzT94KFC.cjs → Card-BuR6mbUu.cjs} +2 -2
- package/dist/{Card-DzT94KFC.cjs.map → Card-BuR6mbUu.cjs.map} +1 -1
- package/dist/{Card-COTwOzVb.js → Card-CxS7GNqp.js} +2 -2
- package/dist/{Card-COTwOzVb.js.map → Card-CxS7GNqp.js.map} +1 -1
- package/dist/{Card-DmjLrV64.cjs → Card-DcUPqd79.cjs} +2 -2
- package/dist/{Card-DmjLrV64.cjs.map → Card-DcUPqd79.cjs.map} +1 -1
- package/dist/{Card-Cb4yfxFK.cjs → Card-d0_xEfdM.cjs} +2 -2
- package/dist/{Card-Cb4yfxFK.cjs.map → Card-d0_xEfdM.cjs.map} +1 -1
- package/dist/{LockedThumbnail-Ds_vBmYm.cjs → LockedThumbnail-BDtKMJjz.cjs} +2 -2
- package/dist/{LockedThumbnail-Ds_vBmYm.cjs.map → LockedThumbnail-BDtKMJjz.cjs.map} +1 -1
- package/dist/{LockedThumbnail-CVq5LPXE.js → LockedThumbnail-BaDgF8qJ.js} +2 -2
- package/dist/{LockedThumbnail-CVq5LPXE.js.map → LockedThumbnail-BaDgF8qJ.js.map} +1 -1
- package/dist/{index-D1XVCH1o.js → index-BPfehHDD.js} +192 -192
- package/dist/index-BPfehHDD.js.map +1 -0
- package/dist/{index-hvrSZScU.cjs → index-G4pnfm4m.cjs} +2 -2
- package/dist/{index-hvrSZScU.cjs.map → index-G4pnfm4m.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/CustomMessage/StreamAttachmentMessage.test.tsx +33 -0
- package/src/components/CustomMessage/StreamAttachmentMessage.tsx +9 -3
- package/src/components/CustomMessage/index.tsx +6 -4
- package/dist/index-D1XVCH1o.js.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-G4pnfm4m.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.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 c, i as u, 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 P, u as b, v as f, w as x, x as y, y as S, z as q, B as z, D as B, E as D, G as E } from "./index-
|
|
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 c, i as u, 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 P, u as b, v as f, w as x, x as y, y as S, z as q, B as z, D as B, E as D, G as E } from "./index-BPfehHDD.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.6.
|
|
3
|
+
"version": "3.6.1-rc-1783229373",
|
|
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-1783229373",
|
|
42
42
|
"@phosphor-icons/react": "^2.1.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -5,8 +5,41 @@ import { renderWithProviders, screen } from '../../test/utils'
|
|
|
5
5
|
|
|
6
6
|
import StreamAttachmentMessage, {
|
|
7
7
|
linkCaptionDuplicatesAttachmentUrl,
|
|
8
|
+
linkCardPropsFromStreamAttachment,
|
|
8
9
|
} from './StreamAttachmentMessage'
|
|
9
10
|
|
|
11
|
+
describe('linkCardPropsFromStreamAttachment', () => {
|
|
12
|
+
it('uses the featured layout when a thumbnail is present', () => {
|
|
13
|
+
expect(
|
|
14
|
+
linkCardPropsFromStreamAttachment({
|
|
15
|
+
type: 'link',
|
|
16
|
+
og_scrape_url: 'https://linktr.ee/someone',
|
|
17
|
+
image_url: 'https://cdn.example.com/thumb.jpg',
|
|
18
|
+
}).layout
|
|
19
|
+
).toBe('featured')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('uses the classic layout for a plain link with no thumbnail', () => {
|
|
23
|
+
expect(
|
|
24
|
+
linkCardPropsFromStreamAttachment({
|
|
25
|
+
type: 'link',
|
|
26
|
+
og_scrape_url: 'https://linktr.ee/someone',
|
|
27
|
+
}).layout
|
|
28
|
+
).toBe('classic')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('keeps the featured layout for a playable clip with no thumbnail so the player renders', () => {
|
|
32
|
+
expect(
|
|
33
|
+
linkCardPropsFromStreamAttachment({
|
|
34
|
+
type: 'link',
|
|
35
|
+
og_scrape_url: 'https://linktr.ee/someone',
|
|
36
|
+
asset_url: 'https://cdn.example.com/clip.mp3',
|
|
37
|
+
mime_type: 'audio/mpeg',
|
|
38
|
+
}).layout
|
|
39
|
+
).toBe('featured')
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
10
43
|
describe('linkCaptionDuplicatesAttachmentUrl', () => {
|
|
11
44
|
it('suppresses captions that are just the link plus punctuation', () => {
|
|
12
45
|
expect(
|
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import type { Attachment } from 'stream-chat'
|
|
3
3
|
|
|
4
4
|
import LinkAttachment from '../LinkAttachment'
|
|
5
|
+
import { isPlayableMedia } from '../LinkAttachment/components/_shared/CardThumbnail'
|
|
5
6
|
import MessageAttachment from '../MessageAttachment'
|
|
6
7
|
import type { BubbleGroupPosition } from '../MessageAttachment/types'
|
|
7
8
|
|
|
@@ -62,6 +63,8 @@ export function linkCardPropsFromStreamAttachment(a: Attachment) {
|
|
|
62
63
|
const thumbnailUrl =
|
|
63
64
|
trimToUndefined((a as { image_url?: string }).image_url) ??
|
|
64
65
|
trimToUndefined((a as { thumb_url?: string }).thumb_url)
|
|
66
|
+
const sourceUrl = trimToUndefined(a.asset_url)
|
|
67
|
+
const mimeType = trimToUndefined(a.mime_type)
|
|
65
68
|
|
|
66
69
|
return {
|
|
67
70
|
title: trimToUndefined((a as { title?: string }).title),
|
|
@@ -70,9 +73,12 @@ export function linkCardPropsFromStreamAttachment(a: Attachment) {
|
|
|
70
73
|
thumbnailUrl,
|
|
71
74
|
// Playable clip embedded in a link preview — lets LinkAttachment render its
|
|
72
75
|
// native video/audio player in the hero instead of a static thumbnail.
|
|
73
|
-
sourceUrl
|
|
74
|
-
layout:
|
|
75
|
-
|
|
76
|
+
sourceUrl,
|
|
77
|
+
layout:
|
|
78
|
+
thumbnailUrl || isPlayableMedia(mimeType, sourceUrl)
|
|
79
|
+
? 'featured'
|
|
80
|
+
: 'classic',
|
|
81
|
+
mimeType,
|
|
76
82
|
} as const
|
|
77
83
|
}
|
|
78
84
|
|
|
@@ -213,15 +213,17 @@ const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
|
|
|
213
213
|
isChatbot && isMine && hasRenderableAttachments
|
|
214
214
|
// Route generic Stream attachments through the toolkit renderer only when it
|
|
215
215
|
// can faithfully own the whole message. Quoted replies (attachments are
|
|
216
|
-
// suppressed there), polls,
|
|
217
|
-
// default branch so their Poll / StreamedMessageText / message-text
|
|
218
|
-
// is preserved — the accompanying
|
|
216
|
+
// suppressed there), polls, AI-streamed, and chatbot messages fall through to
|
|
217
|
+
// the default branch so their Poll / StreamedMessageText / message-text and
|
|
218
|
+
// chatbot attribution (MessageTag) handling is preserved — the accompanying
|
|
219
|
+
// message text and attribution must never be dropped.
|
|
219
220
|
const canRenderAttachmentsInToolkit =
|
|
220
221
|
hasAttachmentSegments &&
|
|
221
222
|
allAttachmentsRepresented &&
|
|
222
223
|
!message.quoted_message &&
|
|
223
224
|
!poll &&
|
|
224
|
-
!isAIGenerated
|
|
225
|
+
!isAIGenerated &&
|
|
226
|
+
!isChatbot
|
|
225
227
|
|
|
226
228
|
return (
|
|
227
229
|
<>
|