@medipha/chat 1.0.55 → 1.0.57

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.
@@ -1,4 +1,4 @@
1
- import { ChatUser, Conversation, ConversationMember, MessageContent, MessageRemovalType } from './chat';
1
+ import { ChatUser, Conversation, ConversationMember, MediaKind, MessageContent, MessageRemovalType } from './chat';
2
2
  export declare const getMemberUser: (member: ConversationMember) => ChatUser;
3
3
  export declare const getMemberUserId: (member: ConversationMember) => string | null;
4
4
  export declare const getMemberRole: (member: ConversationMember | null | undefined) => string;
@@ -45,12 +45,29 @@ type ReplyPreviewTarget = {
45
45
  type: string;
46
46
  content: MessageContent | null;
47
47
  attachmentName?: string | null;
48
+ attachmentUrl?: string | null;
49
+ attachmentKind?: MediaKind | null;
50
+ attachmentThumbnailUrl?: string | null;
48
51
  removedAt?: string | null;
49
52
  };
50
53
  /** Splits the reply preview into a plain label and the file name worth emphasizing (if
51
54
  * any), so JSX callers (the pin notice) can bold just the name while plain-text callers
52
55
  * (composer banner, detail dialog) still get the same combined string via
53
56
  * `getReplyPreviewText`. */
57
+ interface AttachmentLabelTarget {
58
+ type?: string;
59
+ attachmentName?: string | null;
60
+ attachmentKind?: MediaKind | null;
61
+ attachmentDurationMs?: number | null;
62
+ attachments?: Array<{
63
+ durationMs?: number | null;
64
+ }>;
65
+ }
66
+ export declare const getAttachmentLabel: (target: AttachmentLabelTarget) => string | null;
67
+ export declare const getAttachmentPreviewText: (target: AttachmentLabelTarget & {
68
+ content?: MessageContent | null;
69
+ }, fallback?: string) => string;
70
+ export declare const getReplyPreviewThumbnailUrl: (replyTo: ReplyPreviewTarget) => string | null;
54
71
  export declare const getReplyPreviewParts: (replyTo: ReplyPreviewTarget) => {
55
72
  label: string;
56
73
  name?: string;
@@ -105,17 +105,28 @@ export interface MessageReplyPreview {
105
105
  content: MessageContent | null;
106
106
  attachmentName: string | null;
107
107
  attachmentUrl?: string | null;
108
+ attachmentKind?: MediaKind | null;
109
+ attachmentThumbnailUrl?: string | null;
108
110
  createdAt?: string | null;
109
111
  removedAt?: string | null;
110
112
  removedById?: string | null;
111
113
  }
114
+ export type MediaKind = 'IMAGE' | 'VIDEO' | 'AUDIO' | 'DOCUMENT';
112
115
  export interface ChatMessageAttachment {
113
116
  id: string;
114
117
  url: string;
115
118
  name: string | null;
116
119
  mimeType: string | null;
117
120
  sizeBytes: number | null;
121
+ kind?: MediaKind | null;
122
+ thumbnailUrl?: string | null;
123
+ durationMs?: number | null;
124
+ width?: number | null;
125
+ height?: number | null;
118
126
  }
127
+ export declare const isInlineVideoAttachment: (attachment: ChatMessageAttachment) => boolean;
128
+ export declare const isAudioAttachment: (attachment: ChatMessageAttachment) => boolean;
129
+ export declare const formatMediaDuration: (durationSeconds: number | null | undefined) => string;
119
130
  export interface ChatMessage {
120
131
  id?: string;
121
132
  sourceMessageId?: string;
@@ -147,6 +158,7 @@ export interface ChatMessage {
147
158
  attachmentId?: string | null;
148
159
  attachmentName?: string | null;
149
160
  attachmentMimeType?: string | null;
161
+ attachmentKind?: MediaKind | null;
150
162
  attachmentUrl?: string | null;
151
163
  attachmentSizeBytes?: number | null;
152
164
  attachments?: ChatMessageAttachment[];
@@ -212,6 +224,8 @@ export interface ConversationLastMessage {
212
224
  senderName?: string;
213
225
  type?: string;
214
226
  attachmentName?: string;
227
+ attachmentKind?: MediaKind;
228
+ attachmentDurationMs?: number;
215
229
  removedAt?: string | null;
216
230
  removedById?: string | null;
217
231
  [key: string]: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipha/chat",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "Embeddable Medic-ERP chat module for React applications.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -59,7 +59,7 @@
59
59
  "uuid": "^11.0.5",
60
60
  "yet-another-react-lightbox": "^3.32.2",
61
61
  "zustand": "^5.0.8",
62
- "@medipha/chat-core": "1.0.24"
62
+ "@medipha/chat-core": "1.0.25"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@eslint/js": "^10.0.1",