@linktr.ee/messaging-react 4.1.2 → 4.1.3

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-yg1xEb2Y.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.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.RichCard=e.RichCard;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.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;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.useMessaging=e.useMessaging;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Bq5DM1Lm.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.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.RichCard=e.RichCard;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.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;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.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 r, f as l, L as g, h as c, M, i as h, j as L, k as u, l as d, R as p, m as C, n as v, p as A, q as k, s as F, t as b, u as P, v as f, w as x, o as y, x as z, y as S, z as q, B, D, E, G as R } from "./index-C1cbPKI7.js";
1
+ import { a as e, b as t, C as i, c as n, d as o, e as m, F as r, f as l, L as g, h as c, M, i as h, j as L, k as u, l as d, R as p, m as C, n as v, p as A, q as k, s as F, t as b, u as P, v as f, w as x, o as y, x as z, y as S, z as q, B, D, E, G as R } from "./index-DFykbijs.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": "4.1.2",
3
+ "version": "4.1.3",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -195,62 +195,13 @@ function messageAttachmentNamespaceForKind(kind: StreamMediaKind) {
195
195
  }
196
196
  }
197
197
 
198
- function buildMediaClusterRenderProps(
198
+ // Per-attachment render props for a single media kind. Both the single-item and
199
+ // multi-item (cluster) paths shape each attachment the same way, so they share
200
+ // this builder.
201
+ function mediaItemForKind(
199
202
  kind: StreamMediaKind,
200
- attachments: Attachment[]
203
+ attachment: Attachment
201
204
  ): Record<string, unknown> {
202
- if (attachments.length > 1) {
203
- switch (kind) {
204
- case 'image':
205
- return {
206
- items: attachments.map((attachment) => ({
207
- src: imageSrcFromAttachment(attachment),
208
- alt: trimToUndefined((attachment as { title?: string }).title),
209
- })),
210
- }
211
- case 'video':
212
- return {
213
- items: attachments.map((attachment) => ({
214
- src: trimToUndefined(attachment.asset_url) ?? '',
215
- poster: trimToUndefined(
216
- (attachment as { thumb_url?: string }).thumb_url
217
- ),
218
- mimeType: trimToUndefined(attachment.mime_type),
219
- })),
220
- }
221
- case 'audio':
222
- return {
223
- items: attachments.map((attachment) => ({
224
- src: trimToUndefined(attachment.asset_url) ?? '',
225
- mimeType: trimToUndefined(attachment.mime_type) ?? 'audio/mpeg',
226
- filename: trimToUndefined((attachment as { title?: string }).title),
227
- })),
228
- }
229
- case 'pdf':
230
- return {
231
- items: attachments.map((attachment) => ({
232
- src: trimToUndefined(attachment.asset_url) ?? '',
233
- filename: trimToUndefined((attachment as { title?: string }).title),
234
- fileSize: (attachment as { file_size?: number }).file_size,
235
- })),
236
- }
237
- case 'file':
238
- return {
239
- items: attachments.map((attachment) => ({
240
- src: trimToUndefined(attachment.asset_url) ?? '',
241
- filename: trimToUndefined((attachment as { title?: string }).title),
242
- fileSize: (attachment as { file_size?: number }).file_size,
243
- mimeType:
244
- trimToUndefined(attachment.mime_type) ??
245
- 'application/octet-stream',
246
- })),
247
- }
248
- }
249
- }
250
-
251
- const attachment = attachments[0]
252
- if (!attachment) return {}
253
-
254
205
  switch (kind) {
255
206
  case 'image':
256
207
  return {
@@ -288,6 +239,22 @@ function buildMediaClusterRenderProps(
288
239
  }
289
240
  }
290
241
 
242
+ function buildMediaClusterRenderProps(
243
+ kind: StreamMediaKind,
244
+ attachments: Attachment[]
245
+ ): Record<string, unknown> {
246
+ if (attachments.length > 1) {
247
+ return {
248
+ items: attachments.map((attachment) => mediaItemForKind(kind, attachment)),
249
+ }
250
+ }
251
+
252
+ const attachment = attachments[0]
253
+ if (!attachment) return {}
254
+
255
+ return mediaItemForKind(kind, attachment)
256
+ }
257
+
291
258
  function MediaClusterBubble({
292
259
  groupPosition,
293
260
  isMyMessage,