isometrik-plugin-chat-sdk 2.0.19 → 2.0.21

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 (138) hide show
  1. package/dist/cjs/{app-globals-170f9e71.js → app-globals-2824b330.js} +3 -3
  2. package/dist/cjs/{app-globals-170f9e71.js.map → app-globals-2824b330.js.map} +1 -1
  3. package/dist/cjs/attachment-preview_22.cjs.entry.js +114 -141
  4. package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
  5. package/dist/cjs/audio-bubble_4.cjs.entry.js +1 -1
  6. package/dist/cjs/{chat-assets-686620e7.js → chat-assets-8c4dc04f.js} +22 -3
  7. package/dist/cjs/chat-assets-8c4dc04f.js.map +1 -0
  8. package/dist/cjs/chat-tile_3.cjs.entry.js +1 -1
  9. package/dist/cjs/forward-memebers.cjs.entry.js +1 -1
  10. package/dist/cjs/{groupcast-4239cbfc.js → groupcast-8441b4df.js} +2 -2
  11. package/dist/cjs/{groupcast-4239cbfc.js.map → groupcast-8441b4df.js.map} +1 -1
  12. package/dist/cjs/{groupcast-3cb44a25.js → groupcast-f24da720.js} +14 -4
  13. package/dist/cjs/groupcast-f24da720.js.map +1 -0
  14. package/dist/cjs/index.cjs.js +4 -4
  15. package/dist/cjs/isometrik-webchat.cjs.js +6 -6
  16. package/dist/cjs/loader.cjs.js +6 -6
  17. package/dist/cjs/login-page_3.cjs.entry.js +7 -7
  18. package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
  19. package/dist/cjs/member-add.cjs.entry.js +2 -2
  20. package/dist/cjs/new-chat-sidebar.cjs.entry.js +1 -1
  21. package/dist/cjs/{runtime-controls-99f378d4.js → runtime-controls-cfc8fc31.js} +3 -3
  22. package/dist/cjs/{runtime-controls-99f378d4.js.map → runtime-controls-cfc8fc31.js.map} +1 -1
  23. package/dist/cjs/send-media-4ee967d4.js +1194 -0
  24. package/dist/cjs/send-media-4ee967d4.js.map +1 -0
  25. package/dist/collection/api/groupcast.js +13 -3
  26. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js +102 -100
  27. package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js.map +1 -1
  28. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +25 -47
  29. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
  30. package/dist/collection/components/ChatUIComponent/shared/GroupCast/GroupCast.js +3 -16
  31. package/dist/collection/components/ChatUIComponent/shared/GroupCast/GroupCast.js.map +1 -1
  32. package/dist/collection/components/ChatUIComponent/shared/message-info/message-info.js +10 -4
  33. package/dist/collection/components/ChatUIComponent/shared/message-info/message-info.js.map +1 -1
  34. package/dist/collection/components/my-component/web-chat/public-send.js +4 -4
  35. package/dist/collection/components/my-component/web-chat/public-send.js.map +1 -1
  36. package/dist/collection/constants/chat-assets.js +21 -2
  37. package/dist/collection/lib/chat/document-thumbnail.js +433 -0
  38. package/dist/collection/lib/chat/document-thumbnail.js.map +1 -0
  39. package/dist/collection/lib/chat/index.js +1 -1
  40. package/dist/collection/lib/chat/index.js.map +1 -1
  41. package/dist/collection/lib/chat/send-media.js +348 -25
  42. package/dist/collection/lib/chat/send-media.js.map +1 -1
  43. package/dist/components/ChatFooter.js +25 -47
  44. package/dist/components/ChatFooter.js.map +1 -1
  45. package/dist/components/ChatSidebar.js +78 -73
  46. package/dist/components/ChatSidebar.js.map +1 -1
  47. package/dist/components/GroupCast2.js +3 -16
  48. package/dist/components/GroupCast2.js.map +1 -1
  49. package/dist/components/WebChat.js +4 -4
  50. package/dist/components/WebChat.js.map +1 -1
  51. package/dist/components/WebChatBody.js +1 -1
  52. package/dist/components/chat-assets.js +21 -2
  53. package/dist/components/chat-assets.js.map +1 -1
  54. package/dist/components/groupcast.js +13 -3
  55. package/dist/components/groupcast.js.map +1 -1
  56. package/dist/components/message-info2.js +10 -4
  57. package/dist/components/message-info2.js.map +1 -1
  58. package/dist/components/send-media.js +780 -26
  59. package/dist/components/send-media.js.map +1 -1
  60. package/dist/esm/{app-globals-15a6ef50.js → app-globals-e3f4717b.js} +3 -3
  61. package/dist/esm/{app-globals-15a6ef50.js.map → app-globals-e3f4717b.js.map} +1 -1
  62. package/dist/esm/attachment-preview_22.entry.js +114 -141
  63. package/dist/esm/attachment-preview_22.entry.js.map +1 -1
  64. package/dist/esm/audio-bubble_4.entry.js +1 -1
  65. package/dist/esm/{chat-assets-bb056958.js → chat-assets-27beb552.js} +22 -3
  66. package/dist/esm/chat-assets-27beb552.js.map +1 -0
  67. package/dist/esm/chat-tile_3.entry.js +1 -1
  68. package/dist/esm/forward-memebers.entry.js +1 -1
  69. package/dist/esm/{groupcast-ea2466c8.js → groupcast-5fb19ec3.js} +2 -2
  70. package/dist/esm/{groupcast-ea2466c8.js.map → groupcast-5fb19ec3.js.map} +1 -1
  71. package/dist/esm/{groupcast-cc10c6a4.js → groupcast-f96c1d9e.js} +14 -4
  72. package/dist/esm/groupcast-f96c1d9e.js.map +1 -0
  73. package/dist/esm/index.js +5 -5
  74. package/dist/esm/isometrik-webchat.js +6 -6
  75. package/dist/esm/loader.js +6 -6
  76. package/dist/esm/login-page_3.entry.js +7 -7
  77. package/dist/esm/login-page_3.entry.js.map +1 -1
  78. package/dist/esm/member-add.entry.js +2 -2
  79. package/dist/esm/new-chat-sidebar.entry.js +1 -1
  80. package/dist/esm/{runtime-controls-8a22625e.js → runtime-controls-ff81e90a.js} +3 -3
  81. package/dist/esm/{runtime-controls-8a22625e.js.map → runtime-controls-ff81e90a.js.map} +1 -1
  82. package/dist/esm/send-media-58e7145b.js +1166 -0
  83. package/dist/esm/send-media-58e7145b.js.map +1 -0
  84. package/dist/isometrik-webchat/index.esm.js +1 -1
  85. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  86. package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
  87. package/dist/isometrik-webchat/{p-fd6ce589.entry.js → p-09980c53.entry.js} +2 -2
  88. package/dist/isometrik-webchat/p-352b589e.entry.js +2 -0
  89. package/dist/isometrik-webchat/p-352b589e.entry.js.map +1 -0
  90. package/dist/isometrik-webchat/p-3b3dc33e.js +2 -0
  91. package/dist/isometrik-webchat/p-3b3dc33e.js.map +1 -0
  92. package/dist/isometrik-webchat/{p-ffbbe278.entry.js → p-44da28d3.entry.js} +2 -2
  93. package/dist/isometrik-webchat/p-6f5037b2.js +2 -0
  94. package/dist/isometrik-webchat/p-6f5037b2.js.map +1 -0
  95. package/dist/isometrik-webchat/{p-6fc95e0e.js → p-78fb47c4.js} +2 -2
  96. package/dist/isometrik-webchat/{p-3120b9d3.entry.js → p-a9efcf1c.entry.js} +2 -2
  97. package/dist/isometrik-webchat/p-b0baa9ad.entry.js +2 -0
  98. package/dist/isometrik-webchat/p-b0baa9ad.entry.js.map +1 -0
  99. package/dist/isometrik-webchat/{p-c08055fe.js → p-b385ac4b.js} +2 -2
  100. package/dist/isometrik-webchat/p-c06ad586.js +2 -0
  101. package/dist/isometrik-webchat/p-c06ad586.js.map +1 -0
  102. package/dist/isometrik-webchat/p-d758e431.js +2 -0
  103. package/dist/isometrik-webchat/{p-c49de274.entry.js → p-d864bb9f.entry.js} +2 -2
  104. package/dist/isometrik-webchat/{p-39b626ed.entry.js → p-f7d05551.entry.js} +2 -2
  105. package/dist/types/components/ChatUIComponent/ChatSidebar/ChatSidebar.d.ts +3 -2
  106. package/dist/types/components.d.ts +17 -17
  107. package/dist/types/js.d.ts +3 -0
  108. package/dist/types/lib/chat/document-thumbnail.d.ts +38 -0
  109. package/dist/types/lib/chat/index.d.ts +1 -1
  110. package/dist/types/lib/chat/send-media.d.ts +58 -1
  111. package/package.json +1 -1
  112. package/dist/cjs/chat-assets-686620e7.js.map +0 -1
  113. package/dist/cjs/groupcast-3cb44a25.js.map +0 -1
  114. package/dist/cjs/send-media-7c865c19.js +0 -438
  115. package/dist/cjs/send-media-7c865c19.js.map +0 -1
  116. package/dist/esm/chat-assets-bb056958.js.map +0 -1
  117. package/dist/esm/groupcast-cc10c6a4.js.map +0 -1
  118. package/dist/esm/send-media-5527ee9f.js +0 -412
  119. package/dist/esm/send-media-5527ee9f.js.map +0 -1
  120. package/dist/isometrik-webchat/p-1db79cfb.js +0 -2
  121. package/dist/isometrik-webchat/p-4671fe73.js +0 -2
  122. package/dist/isometrik-webchat/p-4671fe73.js.map +0 -1
  123. package/dist/isometrik-webchat/p-643457b8.js +0 -2
  124. package/dist/isometrik-webchat/p-643457b8.js.map +0 -1
  125. package/dist/isometrik-webchat/p-a5707f12.js +0 -2
  126. package/dist/isometrik-webchat/p-a5707f12.js.map +0 -1
  127. package/dist/isometrik-webchat/p-a9380fb3.entry.js +0 -2
  128. package/dist/isometrik-webchat/p-a9380fb3.entry.js.map +0 -1
  129. package/dist/isometrik-webchat/p-fc3fd090.entry.js +0 -2
  130. package/dist/isometrik-webchat/p-fc3fd090.entry.js.map +0 -1
  131. /package/dist/isometrik-webchat/{p-fd6ce589.entry.js.map → p-09980c53.entry.js.map} +0 -0
  132. /package/dist/isometrik-webchat/{p-ffbbe278.entry.js.map → p-44da28d3.entry.js.map} +0 -0
  133. /package/dist/isometrik-webchat/{p-6fc95e0e.js.map → p-78fb47c4.js.map} +0 -0
  134. /package/dist/isometrik-webchat/{p-3120b9d3.entry.js.map → p-a9efcf1c.entry.js.map} +0 -0
  135. /package/dist/isometrik-webchat/{p-c08055fe.js.map → p-b385ac4b.js.map} +0 -0
  136. /package/dist/isometrik-webchat/{p-1db79cfb.js.map → p-d758e431.js.map} +0 -0
  137. /package/dist/isometrik-webchat/{p-c49de274.entry.js.map → p-d864bb9f.entry.js.map} +0 -0
  138. /package/dist/isometrik-webchat/{p-39b626ed.entry.js.map → p-f7d05551.entry.js.map} +0 -0
@@ -1,14 +1,14 @@
1
1
  import { r as registerInstance, a as createEvent, h, g as getElement, F as Fragment, f as Host } from './index-bc463197.js';
2
- import { N as New_Group, c as Group_cast, d as Left_Arrow, e as New_Chat, T as Three_Dots, f as Logout, a as Search, A as Add_User, I as Info, g as CloseButton, h as Clear_Chat, D as Delete, B as Block_User, i as Icon_Doc, j as Icon_Excel, k as Icon_Rtf, l as Icon_Txt, m as Smile, S as Send, n as Attachment, M as Microphone, o as Camera_Add, E as Edit, p as Dark_Theme, q as Message, R as Reply, F as Forward } from './chat-assets-bb056958.js';
2
+ import { N as New_Group, c as Group_cast, d as Left_Arrow, e as New_Chat, T as Three_Dots, f as Logout, a as Search, A as Add_User, I as Info, g as CloseButton, h as Clear_Chat, D as Delete, B as Block_User, i as Icon_Doc, j as Icon_Excel, k as Icon_Rtf, l as Icon_Txt, m as Smile, S as Send, n as Attachment, M as Microphone, o as Camera_Add, E as Edit, p as Dark_Theme, q as Message, R as Reply, F as Forward } from './chat-assets-27beb552.js';
3
3
  import { C as CancelIcon } from './cancel-4f6541af.js';
4
- import { M as MAX_MEDIA_PER_MESSAGE, t as takeMediaFiles, l as mediaLimitToastMessage, A as ATTACHMENT_BODY_PLACEHOLDER, j as attachmentBodyForApi, i as buildReplyMetaData, o as uploadPresignedMediaAttachment, q as mediaPreviewUrls, r as docIconKind, v as splitSharedMessages, w as attachmentCaption } from './send-media-5527ee9f.js';
4
+ import { A as ATTACHMENT_BODY_PLACEHOLDER, M as MAX_MEDIA_PER_MESSAGE, t as takeMediaFiles, l as mediaLimitToastMessage, p as prepareMediaAttachments, r as resolveCustomTypeForUpload, o as attachmentBodyForOutgoing, i as buildReplyMetaData, q as uploadPresignedMediaAttachment, v as mediaPreviewUrls, w as docIconKind, x as splitSharedMessages, y as attachmentCaption } from './send-media-58e7145b.js';
5
5
  import { i as isPdfAttachment, D as DoubleCheck } from './doublecheck-261763ef.js';
6
6
  import { M, s as showToast } from './toast-a1531088.js';
7
7
  import { d as drawerDialogService } from './drawer-7de04622.js';
8
8
  import { c as clearAll, d as debounce, e as getFormattedTime, a as getDeviceID, b as getGroupcastUrlQuery, g as generateProfileImageByInitials, f as getFormattedDeliveryTime } from './helpers-f33b895c.js';
9
9
  import { b as getCustomPartTag, f as findWebChatHost, h as hasNamedSlot } from './index-142896ce.js';
10
10
  import { m as messagePushContextFrom, w as withHostMessagePushFields } from './local-notification-4c1e166d.js';
11
- import { p as postGroupCast, f as getPresignedUrlForGroupcastMedia, h as postGroupCastMessage, i as getGroupcastMessageReadStatus, j as getGroupcastMessageDeliveryStatus, k as deleteGroupcastMessageSelf, l as deleteGroupcastMessageEveryone } from './groupcast-cc10c6a4.js';
11
+ import { p as postGroupCast, f as getPresignedUrlForGroupcastMedia, h as postGroupCastMessage, i as getGroupcastMessageReadStatus, j as getGroupcastMessageDeliveryStatus, k as deleteGroupcastMessageSelf, l as deleteGroupcastMessageEveryone } from './groupcast-f96c1d9e.js';
12
12
  import { i as isometrikLogo } from './IsometrikLogo-36cb0542.js';
13
13
  import { c as createStore, g as groupMembersStore, u as updateConversationNotifications, w as withConversationPushFlag } from './group-members-7909941c.js';
14
14
  import { n as needsAdminTransferBeforeLeave, b as adminTransferCandidates, m as memberDisplayName, a as memberUserId } from './group-admin-leave-a60b9b1a.js';
@@ -384,7 +384,7 @@ const ChatSidebar = class {
384
384
  const mediaExtension = file.name.split('.').pop();
385
385
  const res = await M.getInstance().user.getPresignedurlCreate({
386
386
  userIdentifier: this.userMetaData.userIdentifier,
387
- mediaExtension,
387
+ mediaExtension: mediaExtension || '',
388
388
  });
389
389
  // Upload file to presigned URL
390
390
  await fetch(res.presignedUrl, {
@@ -502,10 +502,10 @@ const ChatSidebar = class {
502
502
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
503
503
  if ((((_a = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _a === void 0 ? void 0 : _a.action) == 'chatMessageSent' || ((_b = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _b === void 0 ? void 0 : _b.action) == 'forward') &&
504
504
  (((_c = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _c === void 0 ? void 0 : _c.body) === '' || ((_d = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _d === void 0 ? void 0 : _d.action) === 'clearConversation'))
505
- return;
505
+ return 0;
506
506
  if ((((_e = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _e === void 0 ? void 0 : _e.action) == 'chatMessageSent' || ((_f = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _f === void 0 ? void 0 : _f.action) == 'forward') &&
507
507
  (((_g = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _g === void 0 ? void 0 : _g.body) === '' || ((_h = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _h === void 0 ? void 0 : _h.action) === 'clearConversation'))
508
- return;
508
+ return 0;
509
509
  const timeA = ((_j = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _j === void 0 ? void 0 : _j.action) === 'membersAdd' ? (_k = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _k === void 0 ? void 0 : _k.sentAt : ((_l = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _l === void 0 ? void 0 : _l.updatedAt) || ((_m = a === null || a === void 0 ? void 0 : a.lastMessageDetails) === null || _m === void 0 ? void 0 : _m.sentAt) || (a === null || a === void 0 ? void 0 : a.updatedAt) || 0;
510
510
  const timeB = ((_o = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _o === void 0 ? void 0 : _o.action) === 'membersAdd' ? (_p = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _p === void 0 ? void 0 : _p.sentAt : ((_q = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _q === void 0 ? void 0 : _q.updatedAt) || ((_r = b === null || b === void 0 ? void 0 : b.lastMessageDetails) === null || _r === void 0 ? void 0 : _r.sentAt) || (b === null || b === void 0 ? void 0 : b.updatedAt) || 0;
511
511
  return timeB - timeA;
@@ -557,7 +557,7 @@ const ChatSidebar = class {
557
557
  const currentCount = this.unreadCounts[conversationId] || 0;
558
558
  this.unreadCounts = Object.assign(Object.assign({}, this.unreadCounts), { [conversationId]: currentCount + count });
559
559
  // Update the conversation list to reflect the new message
560
- this.conversationList = this.conversationList.map(conversation => {
560
+ this.conversationList = this.conversationList.map((conversation) => {
561
561
  if (conversation.conversationId === conversationId) {
562
562
  return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: currentCount + count, lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { updatedAt: Date.now() }) });
563
563
  }
@@ -570,7 +570,7 @@ const ChatSidebar = class {
570
570
  const selectedConversation = event.detail;
571
571
  const selectedConvoId = selectedConversation.conversationId;
572
572
  this.selectedConversationID = selectedConvoId;
573
- this.conversationList = this.sortedConversationList.map(conversation => {
573
+ this.conversationList = this.sortedConversationList.map((conversation) => {
574
574
  if (conversation.conversationId === selectedConvoId) {
575
575
  return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: 0 });
576
576
  }
@@ -609,19 +609,32 @@ const ChatSidebar = class {
609
609
  }));
610
610
  }
611
611
  }
612
+ attachmentLooksLikeDocument(att) {
613
+ if (!att)
614
+ return false;
615
+ if (att.mediaType === 3)
616
+ return true;
617
+ if (isPdfAttachment({ mimeType: att.mimeType, name: att.name || att.nameWithExtension }))
618
+ return true;
619
+ const mime = String(att.mimeType || '').toLowerCase();
620
+ return mime.startsWith('application/') || mime.startsWith('text/');
621
+ }
612
622
  getMediaType(tile) {
613
- var _a;
614
623
  const details = tile === null || tile === void 0 ? void 0 : tile.lastMessageDetails;
615
624
  const attachments = details === null || details === void 0 ? void 0 : details.attachments;
616
625
  if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
617
- const mimeType = ((_a = attachments[attachments.length - 1]) === null || _a === void 0 ? void 0 : _a.mimeType) || '';
618
- if (mimeType.includes('video'))
626
+ const last = attachments[attachments.length - 1];
627
+ const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
628
+ if (mimeType.startsWith('video/') || mimeType.includes('video'))
619
629
  return 2;
620
- if (mimeType.includes('image'))
630
+ if (this.attachmentLooksLikeDocument(last))
631
+ return 3;
632
+ if (mimeType.startsWith('image/'))
621
633
  return 1;
622
- if (mimeType.includes('audio'))
634
+ if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
623
635
  return 4;
624
- // pdf / files → Document
636
+ if ((last === null || last === void 0 ? void 0 : last.mediaType) === 3)
637
+ return 3;
625
638
  return 3;
626
639
  }
627
640
  const body = (details === null || details === void 0 ? void 0 : details.body) || '';
@@ -645,14 +658,18 @@ const ChatSidebar = class {
645
658
  return (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
646
659
  }
647
660
  getMessageBody(tile, userMetaData) {
648
- var _a, _b, _c;
661
+ var _a, _b;
649
662
  const details = tile === null || tile === void 0 ? void 0 : tile.lastMessageDetails;
650
663
  if (!(details === null || details === void 0 ? void 0 : details.body))
651
664
  return '';
652
665
  const { senderId, senderName, body, attachments, metaData } = details;
653
666
  const sender = senderId === (userMetaData === null || userMetaData === void 0 ? void 0 : userMetaData.userId) ? 'You' : senderName || '';
654
667
  const caption = String((_b = (_a = metaData === null || metaData === void 0 ? void 0 : metaData.caption) !== null && _a !== void 0 ? _a : metaData === null || metaData === void 0 ? void 0 : metaData.captionMessage) !== null && _b !== void 0 ? _b : '').trim();
655
- let messageContent = caption || body;
668
+ const bodyStr = String(body || '');
669
+ const isMultipleAttachment = bodyStr === ATTACHMENT_BODY_PLACEHOLDER ||
670
+ String((details === null || details === void 0 ? void 0 : details.customType) || '') === ATTACHMENT_BODY_PLACEHOLDER;
671
+ // Multiple: show caption from meta only; body is API placeholder or non-caption payload
672
+ let messageContent = isMultipleAttachment ? caption || '' : caption || bodyStr;
656
673
  // Body placeholder (API non-empty) — never show AttachmentMessage:* as preview text
657
674
  if (!caption && String(body || '').startsWith('AttachmentMessage:')) {
658
675
  if (body === 'AttachmentMessage:Image')
@@ -662,13 +679,39 @@ const ChatSidebar = class {
662
679
  else if (body === 'AttachmentMessage:File' || body === 'AttachmentMessage:Audio' || body === 'AttachmentMessage:Doc') {
663
680
  messageContent = 'Document';
664
681
  }
682
+ else if (body === 'AttachmentMessage:Multiple') {
683
+ if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
684
+ const last = attachments[attachments.length - 1];
685
+ if (this.attachmentLooksLikeDocument(last)) {
686
+ messageContent = (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
687
+ }
688
+ else {
689
+ const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
690
+ if (mimeType.startsWith('video/') || mimeType.includes('video'))
691
+ messageContent = 'Video';
692
+ else if (mimeType.startsWith('image/'))
693
+ messageContent = 'Image';
694
+ else if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
695
+ messageContent = 'Audio';
696
+ else
697
+ messageContent = 'Attachment';
698
+ }
699
+ }
700
+ else {
701
+ messageContent = 'Attachment';
702
+ }
703
+ }
665
704
  else if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
666
- const mimeType = ((_c = attachments[attachments.length - 1]) === null || _c === void 0 ? void 0 : _c.mimeType) || '';
667
- if (mimeType.includes('video'))
705
+ const last = attachments[attachments.length - 1];
706
+ const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
707
+ if (this.attachmentLooksLikeDocument(last)) {
708
+ messageContent = (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
709
+ }
710
+ else if (mimeType.startsWith('video/') || mimeType.includes('video'))
668
711
  messageContent = 'Video';
669
- else if (mimeType.includes('image'))
712
+ else if (mimeType.startsWith('image/'))
670
713
  messageContent = 'Image';
671
- else if (mimeType.includes('audio'))
714
+ else if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
672
715
  messageContent = 'Audio';
673
716
  else
674
717
  messageContent = 'Document';
@@ -740,7 +783,7 @@ const ChatSidebar = class {
740
783
  const previewText = this.getLastMessageText(tile, this.userMetaData) || '';
741
784
  const unreadCount = (_a = this.unreadCounts[conversationId]) !== null && _a !== void 0 ? _a : ((tile === null || tile === void 0 ? void 0 : tile.unreadMessagesCount) > 0 ? tile.unreadMessagesCount : 0);
742
785
  const isTyping = !!(this.isTyping && this.typingConversationId === conversationId);
743
- const typingUserName = tile.isGroup ? this.typingUserName : null;
786
+ const typingUserName = tile.isGroup ? this.typingUserName : undefined;
744
787
  const customTag = (_b = this.customParts) === null || _b === void 0 ? void 0 : _b.chatTile;
745
788
  if (customTag) {
746
789
  return h(customTag, {
@@ -936,29 +979,14 @@ const ChatSidebar = class {
936
979
  }
937
980
  async createGroupConversation() {
938
981
  try {
939
- const paramsForCreateConversation = {
940
- typingEvents: true,
941
- readEvents: true,
942
- pushNotifications: true,
943
- members: this.selectedGroupUserIds,
944
- isGroup: true,
945
- conversationType: 0,
946
- conversationTitle: this.groupInfo.title,
947
- conversationImageUrl: this.groupInfo.imageUrl,
948
- };
982
+ const imageUrl = (this.groupInfo.imageUrl || '').trim();
983
+ const paramsForCreateConversation = Object.assign({ typingEvents: true, readEvents: true, pushNotifications: true, members: this.selectedGroupUserIds, isGroup: true, conversationType: 0, conversationTitle: this.groupInfo.title }, (imageUrl ? { conversationImageUrl: imageUrl } : {}));
949
984
  const res = await M.getInstance().Conversation.postConversation(paramsForCreateConversation);
950
985
  // Add the new group conversation to the list
951
- const newConversation = {
952
- conversationId: res.conversationId,
953
- lastMessageDetails: {
986
+ const newConversation = Object.assign({ conversationId: res.conversationId, lastMessageDetails: {
954
987
  updatedAt: Date.now(),
955
988
  body: '',
956
- },
957
- unreadMessagesCount: 0,
958
- isGroup: true,
959
- conversationTitle: this.groupInfo.title,
960
- conversationImageUrl: this.groupInfo.imageUrl,
961
- };
989
+ }, unreadMessagesCount: 0, isGroup: true, conversationTitle: this.groupInfo.title }, (imageUrl ? { conversationImageUrl: imageUrl } : {}));
962
990
  this.conversationList = [newConversation, ...this.conversationList];
963
991
  // this.sortConversations();
964
992
  this.selectedConversationID = res.conversationId;
@@ -976,7 +1004,6 @@ const ChatSidebar = class {
976
1004
  const { conversationTitle, imageFile, selectedUserIds, isGroupCast, selectedUsers } = event.detail;
977
1005
  try {
978
1006
  this.isGroupCreationLoading = true;
979
- // Empty → profile-avatar group fallback (avoid broken X placeholder CDN asset).
980
1007
  let conversationImageUrl = '';
981
1008
  if (imageFile) {
982
1009
  try {
@@ -1000,18 +1027,9 @@ const ChatSidebar = class {
1000
1027
  return;
1001
1028
  }
1002
1029
  }
1003
- const paramsForCreateConversation = {
1004
- typingEvents: true,
1005
- readEvents: true,
1006
- pushNotifications: true,
1007
- members: selectedUserIds,
1008
- isGroup: true,
1009
- conversationType: 1,
1010
- conversationTitle,
1011
- conversationImageUrl,
1012
- searchableTags: [conversationTitle],
1013
- };
1014
- const members = selectedUserIds.map(id => {
1030
+ const trimmedImageUrl = conversationImageUrl.trim();
1031
+ const paramsForCreateConversation = Object.assign(Object.assign({ typingEvents: true, readEvents: true, pushNotifications: true, members: selectedUserIds, isGroup: true, conversationType: 1, conversationTitle }, (trimmedImageUrl ? { conversationImageUrl: trimmedImageUrl } : {})), { searchableTags: [conversationTitle] });
1032
+ const members = selectedUserIds.map((id) => {
1015
1033
  const user = selectedUsers === null || selectedUsers === void 0 ? void 0 : selectedUsers.find((u) => (u === null || u === void 0 ? void 0 : u.userId) === id);
1016
1034
  return {
1017
1035
  newConversationTypingEvents: true,
@@ -1023,16 +1041,9 @@ const ChatSidebar = class {
1023
1041
  userName: (user === null || user === void 0 ? void 0 : user.userName) || id,
1024
1042
  };
1025
1043
  });
1026
- const paramsForCreateGroupCastConversation = {
1027
- groupcastTitle: conversationTitle,
1028
- groupcastImageUrl: conversationImageUrl,
1029
- searchableTags: [conversationTitle],
1030
- metaData: { description: 'groupcast created',
1044
+ const paramsForCreateGroupCastConversation = Object.assign(Object.assign({ groupcastTitle: conversationTitle }, (trimmedImageUrl ? { groupcastImageUrl: trimmedImageUrl } : {})), { searchableTags: [conversationTitle], metaData: { description: 'groupcast created',
1031
1045
  members: selectedUsers
1032
- },
1033
- customType: 'groupcast',
1034
- members,
1035
- };
1046
+ }, customType: 'groupcast', members });
1036
1047
  if (isGroupCast) {
1037
1048
  const res = await postGroupCast(paramsForCreateGroupCastConversation);
1038
1049
  this.selectedConversationID = res.groupcastId;
@@ -1048,25 +1059,17 @@ const ChatSidebar = class {
1048
1059
  }
1049
1060
  else {
1050
1061
  const res = await M.getInstance().Conversation.postConversation(paramsForCreateConversation);
1051
- const newConversation = {
1052
- conversationId: res.conversationId,
1053
- lastMessageDetails: {
1062
+ const newConversation = Object.assign(Object.assign({ conversationId: res.conversationId, lastMessageDetails: {
1054
1063
  updatedAt: Date.now(),
1055
1064
  body: '',
1056
- },
1057
- unreadMessagesCount: 0,
1058
- isGroup: true,
1059
- conversationTitle,
1060
- conversationImageUrl,
1061
- members: selectedUserIds,
1062
- };
1065
+ }, unreadMessagesCount: 0, isGroup: true, conversationTitle }, (trimmedImageUrl ? { conversationImageUrl: trimmedImageUrl } : {})), { members: selectedUserIds });
1063
1066
  this.conversationList = [newConversation, ...this.conversationList];
1064
1067
  this.selectedConversationID = res.conversationId;
1065
1068
  // Keep header avatar in sync immediately (details fetch can lag / omit image).
1066
1069
  conversationStore.updateConversationDetails({
1067
1070
  conversationId: res.conversationId,
1068
1071
  conversationTitle,
1069
- conversationImageUrl: conversationImageUrl || '',
1072
+ conversationImageUrl: trimmedImageUrl || '',
1070
1073
  isGroup: true,
1071
1074
  });
1072
1075
  const url = new URL(window.location.href);
@@ -1138,7 +1141,7 @@ const ChatSidebar = class {
1138
1141
  try {
1139
1142
  this.isLoading = true;
1140
1143
  await M.getInstance().Conversation.deleteConversationLeave({ conversationId });
1141
- this.conversationList = this.conversationList.filter(conversation => conversation.conversationId !== conversationId);
1144
+ this.conversationList = this.conversationList.filter((conversation) => conversation.conversationId !== conversationId);
1142
1145
  // this.sortConversations();
1143
1146
  const url = new URL(window.location.href);
1144
1147
  url.searchParams.delete('conversation');
@@ -1166,7 +1169,7 @@ const ChatSidebar = class {
1166
1169
  handleMessageReadStatusUpdate(event) {
1167
1170
  const { conversationId, isRead, isDelivered } = event.detail;
1168
1171
  // Update the conversation list to reflect new read status
1169
- this.conversationList = this.conversationList.map(conversation => {
1172
+ this.conversationList = this.conversationList.map((conversation) => {
1170
1173
  if (conversation.conversationId === conversationId) {
1171
1174
  return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { readByAll: isRead, deliveredToAll: isDelivered }) });
1172
1175
  }
@@ -1427,24 +1430,11 @@ const GroupCast = class {
1427
1430
  userName: (user === null || user === void 0 ? void 0 : user.userName) || id,
1428
1431
  };
1429
1432
  });
1430
- const res = await postGroupCast({
1431
- groupcastTitle: conversationTitle,
1432
- groupcastImageUrl,
1433
- searchableTags: [conversationTitle],
1434
- metaData: { description: 'groupcast created', members: selectedUsers },
1435
- customType: 'groupcast',
1436
- members,
1437
- });
1433
+ const trimmedGroupcastImage = (groupcastImageUrl || '').trim();
1434
+ const res = await postGroupCast(Object.assign(Object.assign({ groupcastTitle: conversationTitle }, (trimmedGroupcastImage ? { groupcastImageUrl: trimmedGroupcastImage } : {})), { searchableTags: [conversationTitle], metaData: { description: 'groupcast created', members: selectedUsers }, customType: 'groupcast', members }));
1438
1435
  this.closeCreate();
1439
1436
  const groupcastId = res.groupcastId;
1440
- const created = {
1441
- groupcastId,
1442
- groupcastTitle: conversationTitle,
1443
- groupcastImageUrl,
1444
- membersCount: members.length,
1445
- createdAt: Date.now(),
1446
- metaData: { description: 'groupcast created' },
1447
- };
1437
+ const created = Object.assign(Object.assign({ groupcastId, groupcastTitle: conversationTitle }, (trimmedGroupcastImage ? { groupcastImageUrl: trimmedGroupcastImage } : {})), { membersCount: members.length, createdAt: Date.now(), metaData: { description: 'groupcast created' } });
1448
1438
  (_a = this.onCreated) === null || _a === void 0 ? void 0 : _a.call(this, created);
1449
1439
  const url = new URL(window.location.href);
1450
1440
  url.search = '';
@@ -5519,6 +5509,8 @@ const ChatFooter = class {
5519
5509
  // Prepare the message details
5520
5510
  const messageDetails = {
5521
5511
  body: localMessage.body,
5512
+ customType: localMessage.customType,
5513
+ metaData: localMessage.metaData,
5522
5514
  updatedAt: localMessage.sentAt || Date.now(),
5523
5515
  userName: (_a = this.userMetaData) === null || _a === void 0 ? void 0 : _a.userName,
5524
5516
  userProfileImageUrl: ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userProfileImageUrl) || '',
@@ -5672,35 +5664,24 @@ const ChatFooter = class {
5672
5664
  this.changeMessageSendingState(false);
5673
5665
  return;
5674
5666
  }
5675
- const attachments = files.map(file => ({
5676
- nameWithExtension: file.name,
5677
- mediaType: file.type.startsWith('image/') ? 0 : file.type.startsWith('video/') ? 1 : file.type.startsWith('audio/') ? 2 : 3,
5678
- mediaId: String(file.lastModified || Date.now()) + Math.random().toString(36).slice(2, 6),
5679
- mimeType: file.type,
5680
- size: file.size,
5681
- file,
5682
- }));
5667
+ const attachments = prepareMediaAttachments(files);
5683
5668
  const localAttachments = this.mediaPreviews
5684
5669
  .filter(p => files.includes(p.file))
5685
5670
  .slice(0, MAX_MEDIA_PER_MESSAGE)
5686
- .map(preview => ({
5687
- name: preview.file.name,
5688
- size: preview.file.size,
5689
- type: preview.type,
5690
- mediaUrl: preview.src,
5691
- mimeType: preview.file.type,
5692
- }));
5693
- const customType = files.length === 1
5694
- ? files[0].type.startsWith('image/')
5695
- ? 'AttachmentMessage:Image'
5696
- : files[0].type.startsWith('video/')
5697
- ? 'AttachmentMessage:Video'
5698
- : files[0].type.startsWith('audio/')
5699
- ? 'AttachmentMessage:Audio'
5700
- : 'AttachmentMessage:File'
5701
- : ATTACHMENT_BODY_PLACEHOLDER;
5671
+ .map(preview => {
5672
+ const prepared = attachments.find(a => a.file === preview.file);
5673
+ return {
5674
+ name: preview.file.name,
5675
+ size: preview.file.size,
5676
+ type: preview.type,
5677
+ mediaUrl: preview.src,
5678
+ mimeType: (prepared === null || prepared === void 0 ? void 0 : prepared.mimeType) || preview.file.type,
5679
+ mediaType: prepared === null || prepared === void 0 ? void 0 : prepared.mediaType,
5680
+ };
5681
+ });
5702
5682
  const caption = ((_a = this.messageBody) === null || _a === void 0 ? void 0 : _a.trim()) || '';
5703
- const localMessage = Object.assign(Object.assign({}, this.createLocalMessage(attachmentBodyForApi(caption), localAttachments, messageId)), { customType, metaData: buildReplyMetaData(this.replyMessage, caption) });
5683
+ const customType = resolveCustomTypeForUpload(attachments);
5684
+ const localMessage = Object.assign(Object.assign({}, this.createLocalMessage(attachmentBodyForOutgoing(caption, attachments), localAttachments, messageId)), { customType, metaData: buildReplyMetaData(this.replyMessage, caption) });
5704
5685
  try {
5705
5686
  await this.updateConversationListOnMessageSend(localMessage);
5706
5687
  }
@@ -5742,7 +5723,7 @@ const ChatFooter = class {
5742
5723
  }
5743
5724
  }
5744
5725
  async uploadAndSendMedia(presignedUrls, attachments, conversationId, oldMessageId) {
5745
- var _a, _b, _c;
5726
+ var _a, _b;
5746
5727
  const allPayloads = [];
5747
5728
  const uploadPromises = presignedUrls.map(async (urlDetails, index) => {
5748
5729
  const attachmentPayload = attachments[index];
@@ -5754,28 +5735,15 @@ const ChatFooter = class {
5754
5735
  const payload = await uploadPresignedMediaAttachment({
5755
5736
  urlDetails: normalized,
5756
5737
  attachment: attachmentPayload,
5738
+ // Groupcast uses a different presign API; the image fallback is conversation-only.
5739
+ conversationId: this.isGroupcast ? undefined : conversationId,
5757
5740
  });
5758
5741
  if (payload)
5759
5742
  allPayloads.push(payload);
5760
5743
  });
5761
5744
  await Promise.all(uploadPromises);
5762
- // One attachment → typed; 2–5 together → Multiple (same message)
5763
- let customType = ATTACHMENT_BODY_PLACEHOLDER;
5764
- if ((attachments === null || attachments === void 0 ? void 0 : attachments.length) === 1 && ((_a = attachments[0]) === null || _a === void 0 ? void 0 : _a.mimeType)) {
5765
- if (attachments[0].mimeType.startsWith('image/')) {
5766
- customType = 'AttachmentMessage:Image';
5767
- }
5768
- else if (attachments[0].mimeType.startsWith('video/')) {
5769
- customType = 'AttachmentMessage:Video';
5770
- }
5771
- else if (attachments[0].mimeType.startsWith('audio/')) {
5772
- customType = 'AttachmentMessage:Audio';
5773
- }
5774
- else if (attachments[0].mimeType.startsWith('application/')) {
5775
- customType = 'AttachmentMessage:Doc';
5776
- }
5777
- }
5778
- const caption = ((_b = this.messageBody) === null || _b === void 0 ? void 0 : _b.trim()) || '';
5745
+ const customType = resolveCustomTypeForUpload(attachments);
5746
+ const caption = ((_a = this.messageBody) === null || _a === void 0 ? void 0 : _a.trim()) || '';
5779
5747
  const pushContext = messagePushContextFrom({
5780
5748
  userMetaData: this.userMetaData,
5781
5749
  conversation: this.conversationDetails,
@@ -5783,11 +5751,11 @@ const ChatFooter = class {
5783
5751
  let payload = withHostMessagePushFields({
5784
5752
  showInConversation: true,
5785
5753
  messageType: this.replyMessage ? 2 : 0,
5786
- parentMessageId: (_c = this.replyMessage) === null || _c === void 0 ? void 0 : _c.messageId,
5754
+ parentMessageId: (_b = this.replyMessage) === null || _b === void 0 ? void 0 : _b.messageId,
5787
5755
  encrypted: false,
5788
5756
  conversationId,
5789
5757
  // API rejects empty body; caption text or placeholder. Real caption also in metaData.caption
5790
- body: attachmentBodyForApi(caption),
5758
+ body: attachmentBodyForOutgoing(caption, attachments),
5791
5759
  customType: customType,
5792
5760
  attachments: allPayloads,
5793
5761
  deviceId: this.deviceId,
@@ -5859,7 +5827,7 @@ const ChatFooter = class {
5859
5827
  const webChat = findWebChatHost(this.el);
5860
5828
  const hasCustomReply = (webChat ? hasNamedSlot(webChat, 'reply-preview') : false) || hasNamedSlot(this.el, 'reply-preview');
5861
5829
  const showAttachment = this.attachmentDetails || this.showCamera;
5862
- return (h(Host, { key: 'e57fe153877d8709705ae44a4f408a31733c54c4', class: { 'attachment-open': !!showAttachment } }, h("div", { key: '118eaeb4e5d00cc01f56e56a78415bf29473bf78', class: "chat-footer-container" }, showAttachment ? (h("slot", { name: "attachment-preview" }, h("attachment-preview", { showCamera: this.showCamera, onClose: this.handleClearAttachment, width: "150px", height: "150px", bgColor: "var(--bg-primary-light)", padding: "3px", margin: "10px 0 0 0", contentType: contentType, content: this.mediaPreviews, onSend: this.handleSendMessage, "onfile-uploaded": this.handleFileUpload, "onattachment-removed": this.handleRemoveAttachment, "oncamera-retake": this.handleCameraRetake, key: this.inputKey, inputValue: this.messageBody, "oninput-change": this.handleInputChange, backgroundColor: "var(--bg-primary-color)", containerBoxShadow: "none", inputFontColor: "var(--text-primary-color)", inputBorderRadius: "10px", conversationDetails: this.conversationDetails, userMetaData: this.userMetaData }))) : (h(Fragment, null, hasCustomReply ? h("slot", { name: "reply-preview" }) : null, h("slot", { name: "composer-input" }, !hasCustomReply && this.replyMessage ? (h("reply-block", { messageBody: (_a = this.replyMessage) === null || _a === void 0 ? void 0 : _a.body, messageInfo: this.replyMessage, senderName: ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userId) === ((_d = (_c = this.replyMessage) === null || _c === void 0 ? void 0 : _c.senderInfo) === null || _d === void 0 ? void 0 : _d.userId)
5830
+ return (h(Host, { key: '6f5ee0cb4fa473754a4aec4c2bdbd25d81901b57', class: { 'attachment-open': !!showAttachment } }, h("div", { key: '822b4da560d9db469a068419bb4b30e47eb6241e', class: "chat-footer-container" }, showAttachment ? (h("slot", { name: "attachment-preview" }, h("attachment-preview", { showCamera: this.showCamera, onClose: this.handleClearAttachment, width: "150px", height: "150px", bgColor: "var(--bg-primary-light)", padding: "3px", margin: "10px 0 0 0", contentType: contentType, content: this.mediaPreviews, onSend: this.handleSendMessage, "onfile-uploaded": this.handleFileUpload, "onattachment-removed": this.handleRemoveAttachment, "oncamera-retake": this.handleCameraRetake, key: this.inputKey, inputValue: this.messageBody, "oninput-change": this.handleInputChange, backgroundColor: "var(--bg-primary-color)", containerBoxShadow: "none", inputFontColor: "var(--text-primary-color)", inputBorderRadius: "10px", conversationDetails: this.conversationDetails, userMetaData: this.userMetaData }))) : (h(Fragment, null, hasCustomReply ? h("slot", { name: "reply-preview" }) : null, h("slot", { name: "composer-input" }, !hasCustomReply && this.replyMessage ? (h("reply-block", { messageBody: (_a = this.replyMessage) === null || _a === void 0 ? void 0 : _a.body, messageInfo: this.replyMessage, senderName: ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userId) === ((_d = (_c = this.replyMessage) === null || _c === void 0 ? void 0 : _c.senderInfo) === null || _d === void 0 ? void 0 : _d.userId)
5863
5831
  ? 'You'
5864
5832
  : (_f = (_e = this.replyMessage) === null || _e === void 0 ? void 0 : _e.senderInfo) === null || _f === void 0 ? void 0 : _f.userName, onIconClick: this.handleremoveReplyMessage })) : null, h("div", { class: "composer-wrap", key: this.inputKey, ref: el => (this.composerWrapRef = el) }, this.showEmojiPicker ? (h("div", { class: "emoji-panel", style: this.emojiPanelStyle }, h("div", { class: "emoji-panel-header" }, h("span", null, "Emoji"), h("button", { class: "emoji-panel-close", type: "button", "aria-label": "Close", onClick: this.handleEmojiToggle }, "\u00D7")), h("emoji-picker", { class: "emoji-picker light", ref: this.bindEmojiPicker }))) : null, h("div", { class: { composer: true, recording: this.isRecording } }, this.isRecording ? (h("div", { class: "rec-body" }, h("div", { class: "rec-left" }, h("button", { class: "rec-icon-btn danger", type: "button", title: "Delete recording", "aria-label": "Delete recording", onClick: this.handleRecDelete }, h("img", { class: "theme-icon", src: Delete, alt: "" })), h("div", { class: "rec-timer-wrap" }, h("span", { class: { 'rec-dot': true, live: !this.isPaused } }), h("span", { class: "rec-timer" }, this.formatRecTime(this.recordingSeconds)))), h("div", { class: "rec-wave" }, h("audio-bubble", { liveRecord: true, audioProgressColor: "#2563eb", audioWaveColor: "#2563eb", ref: el => (this.recBubble = el), onRecordingProgress: this.onRecordingProgress, onRecordingError: this.onRecordingError })), h("button", { class: { 'rec-icon-btn': true, 'rec-toggle': true, pause: !this.isPaused }, type: "button", title: this.isPaused ? 'Resume recording' : 'Pause recording', "aria-label": this.isPaused ? 'Resume recording' : 'Pause recording', onClick: this.handleRecPauseToggle }, h("img", { class: "theme-icon", src: this.isPaused ? PlayIcon : PauseIcon, alt: "" })), h("button", { class: "rec-send", type: "button", title: "Send voice note", "aria-label": "Send voice note", onClick: this.handleRecSend }, h("img", { src: Send, alt: "" })))) : (h(Fragment, null, h("div", { class: "attach-wrap" }, h("button", { class: "icon-btn", type: "button", title: "Attach file", "aria-label": "Attach", onClick: this.handleAttachClick }, h("img", { src: Attachment, alt: "" })), this.showAttachMenu ? (h("div", { class: "attach-menu", style: this.attachMenuStyle }, h("button", { class: "attach-opt", type: "button", onClick: this.pickDocument }, h("span", { class: "attach-opt-icon attach-opt-icon--doc" }, h("img", { src: DocumentsIcon, alt: "" })), h("span", null, "Document")), h("button", { class: "attach-opt", type: "button", onClick: this.pickPhotos }, h("span", { class: "attach-opt-icon attach-opt-icon--photos" }, h("img", { class: "theme-icon", src: PhotosIcon, alt: "" })), h("span", null, "Photos & videos")), h("button", { class: "attach-opt", type: "button", onClick: this.pickCamera }, h("span", { class: "attach-opt-icon attach-opt-icon--camera" }, h("img", { class: "theme-icon", src: CameraIcon, alt: "" })), h("span", null, "Camera")))) : null), h("button", { class: "icon-btn", type: "button", title: "Emojis", "aria-label": "Emojis", onClick: this.handleEmojiToggle }, h("img", { src: Smile, alt: "" })), h("input", { class: "file-input", type: "file", multiple: true, accept: ".jpg,.jpeg,.png,.gif,.webp,.bmp,.heic,.mp4,.mov,.webm,.mkv,.mp3,.wav,.m4a,.aac,.ogg", ref: el => (this.mediaInputRef = el), onChange: this.handleNativeFileChange }), h("input", { class: "file-input", type: "file", multiple: true, accept: ".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.rtf,application/*", ref: el => (this.docInputRef = el), onChange: this.handleNativeFileChange }), h("textarea", { class: "composer-input", rows: 1, placeholder: "Type a message", value: this.messageBody, ref: el => (this.inputRef = el), onInput: this.handleComposerInput, onKeyDown: this.handleComposerKeyDown }), this.messageBody.trim() ? (h("button", { class: "icon-btn", type: "button", title: "Send", "aria-label": "Send", onClick: this.handleSendMessage }, h("img", { src: Send, alt: "" }))) : (h("button", { class: "icon-btn", type: "button", title: "Voice note", "aria-label": "Voice note", onClick: this.handleMicClick }, h("img", { src: Microphone, alt: "" })))))))))))));
5865
5833
  }
@@ -7154,7 +7122,7 @@ const MessageInfo = class {
7154
7122
  this.closePopup();
7155
7123
  }
7156
7124
  previewText() {
7157
- var _a, _b, _c, _d;
7125
+ var _a, _b, _c, _d, _e, _f;
7158
7126
  if (this.messagePreviewText)
7159
7127
  return this.messagePreviewText;
7160
7128
  const msg = this.selectedMessage;
@@ -7169,9 +7137,14 @@ const MessageInfo = class {
7169
7137
  const caption = String((_d = (_b = (_a = msg === null || msg === void 0 ? void 0 : msg.metaData) === null || _a === void 0 ? void 0 : _a.caption) !== null && _b !== void 0 ? _b : (_c = msg === null || msg === void 0 ? void 0 : msg.metaData) === null || _c === void 0 ? void 0 : _c.captionMessage) !== null && _d !== void 0 ? _d : '').trim();
7170
7138
  if (caption)
7171
7139
  return caption;
7172
- const body = (msg === null || msg === void 0 ? void 0 : msg.body) || '';
7140
+ const body = String((_e = msg === null || msg === void 0 ? void 0 : msg.body) !== null && _e !== void 0 ? _e : '').trim();
7141
+ const customType = String((_f = msg === null || msg === void 0 ? void 0 : msg.customType) !== null && _f !== void 0 ? _f : '').trim();
7142
+ // Multiple: caption lives in metaData only; do not use body text
7143
+ if (body === ATTACHMENT_BODY_PLACEHOLDER || customType === ATTACHMENT_BODY_PLACEHOLDER) {
7144
+ return (atts === null || atts === void 0 ? void 0 : atts.length) ? 'Attachment' : '';
7145
+ }
7173
7146
  // API stores placeholder in body for media; never show AttachmentMessage:* as caption
7174
- if (String(body).startsWith('AttachmentMessage:'))
7147
+ if (body.startsWith('AttachmentMessage:'))
7175
7148
  return (atts === null || atts === void 0 ? void 0 : atts.length) ? 'Attachment' : '';
7176
7149
  return body || '';
7177
7150
  }
@@ -7196,7 +7169,7 @@ const MessageInfo = class {
7196
7169
  render() {
7197
7170
  const delivery = this.deliveryUserList || [];
7198
7171
  const read = this.readUserList || [];
7199
- return (h("div", { key: '8cbb260b458f09271cd6b1675b65d25b518a5b62', class: "panel" }, h("div", { key: '5a985b94d89e5a4197cb62e11cdf18f1bdc1871d', class: "header" }, h("button", { key: 'db8c9ed3526898872e1f368c7ec5ba09addb5cad', class: "close-btn", type: "button", "aria-label": "Close", title: "Close", onClick: () => this.close() }, h("img", { key: '083f8274705e283259aae905deaa436e5f4b245f', class: "theme-icon", src: CancelIcon, alt: "" })), h("h2", { key: 'a058a67fdacca067d745bdb50cbd7b8a816fa29e' }, "Message info")), h("div", { key: '55b49021b93e4083a2fda96a185ebd5c42d95025', class: "body" }, h("div", { key: '6c1d2b82c79b070909448af67538582e9f8d378b', class: "preview-wrap" }, h("div", { key: '1515cfcb240da83d3c7f190e2dcf9d082e9add0d', class: "preview-bubble" }, h("p", { key: '70df9dd2a094607d3d19eff09559ab8a5199cf1a', class: "preview-text" }, this.previewText()), h("div", { key: 'c85a9579c7071ccb31b92752cf1f5d5cae2be107', class: "preview-meta" }, h("span", { key: 'da4b0fb14e4704778ee2dae312418bdb5d3f7bd7' }, this.bubbleTime())))), h("div", { key: '1413b77d30d10cdce084d6ea98e4bfd5c5b97aac', class: "status-list" }, h("div", { key: '66f72522b946e8331c18dcbb17252b205ac4c962', class: "status-row" }, this.ticksIcon('read'), h("div", { key: '389e7a90d1c4b68641ed70b09f0780e4e74cc041', class: "status-content" }, h("div", { key: 'ee49e7669508a13c75672148127d691a0019a192', class: "status-title" }, "Read"), h("p", { key: '500268878c0716daea5124d781b26a4861fed4d4', class: "status-time" }, this.formatTime(this.messageReadTime)), read.map(u => (h("div", { class: "user-row" }, h("profile-avatar", { src: u.userProfileImageUrl || '', name: u.userName || '', size: "2rem" }), h("span", { class: "user-name" }, u.userName)))))), h("div", { key: 'faddbe446898e96d1d8b7d37a44d019ed7ccd30e', class: "status-row" }, this.ticksIcon('delivered'), h("div", { key: '72953384928b55b8d6c6864b26250b2d4c2f7aa0', class: "status-content" }, h("div", { key: '8bb0a893faa9bef1c99c4eef221446044193d02c', class: "status-title" }, "Delivered"), h("p", { key: '8baa9cf3f7e8973c03a5526371dab136e8895659', class: "status-time" }, this.formatTime(this.messageDeliveryTime)), delivery.map(u => (h("div", { class: "user-row" }, h("profile-avatar", { src: u.userProfileImageUrl || '', name: u.userName || '', size: "2rem" }), h("span", { class: "user-name" }, u.userName))))))))));
7172
+ return (h("div", { key: 'fa2d0af32f2e8952250088796c79693f3ea16ee6', class: "panel" }, h("div", { key: '8920c819325fd9381d2cf8d32cd31984e2cafa05', class: "header" }, h("button", { key: 'da8db38ca8877a81f3575e28b4d6e36f47cb3524', class: "close-btn", type: "button", "aria-label": "Close", title: "Close", onClick: () => this.close() }, h("img", { key: '09c4ea9c4dab2b6b3513d66f28de8c15dd46c0fe', class: "theme-icon", src: CancelIcon, alt: "" })), h("h2", { key: 'a28b63038d6128c8c0031ffea17eaba0239e4f35' }, "Message info")), h("div", { key: 'fbe813bdadbfd7a85ac5c5bb4ea85fa43e9dd14e', class: "body" }, h("div", { key: 'e54922efa31352278b9a7cd529ef31467236a7d9', class: "preview-wrap" }, h("div", { key: '250bfb17a2106625fb8d164432e210e74194eae7', class: "preview-bubble" }, h("p", { key: '18c4d3e092d0dd3c6b1466965702f13e252e757a', class: "preview-text" }, this.previewText()), h("div", { key: '8f7c698b9ccc05a9503fe716df7de58e2f6212f3', class: "preview-meta" }, h("span", { key: '3cab794059faf27589faa12e414a1498ec28b4eb' }, this.bubbleTime())))), h("div", { key: '8d302fce732c358a4a48881526d4418040b7b075', class: "status-list" }, h("div", { key: 'bea8d64d0edd7b239b02403e64d1c971b0609e9a', class: "status-row" }, this.ticksIcon('read'), h("div", { key: '616cb6f9828076b07d6b7e136c31d734612a659a', class: "status-content" }, h("div", { key: '0020ec78e4dd0594ef00f41b05dbbf26c665812e', class: "status-title" }, "Read"), h("p", { key: '0e2ec57061db6c14bef07ccbaab01f7d4549bc85', class: "status-time" }, this.formatTime(this.messageReadTime)), read.map(u => (h("div", { class: "user-row" }, h("profile-avatar", { src: u.userProfileImageUrl || '', name: u.userName || '', size: "2rem" }), h("span", { class: "user-name" }, u.userName)))))), h("div", { key: '05c3fa8775ba465bc9c93dc119b38235c064ffe3', class: "status-row" }, this.ticksIcon('delivered'), h("div", { key: '983c73f19af4ad033bba1871033a8d6ea9b661e6', class: "status-content" }, h("div", { key: '188c573a98a4ee7b1b8271cf34d74e8f34f00a8e', class: "status-title" }, "Delivered"), h("p", { key: 'a57785ac963f72523b14b3ecfc1cbfd32e410d91', class: "status-time" }, this.formatTime(this.messageDeliveryTime)), delivery.map(u => (h("div", { class: "user-row" }, h("profile-avatar", { src: u.userProfileImageUrl || '', name: u.userName || '', size: "2rem" }), h("span", { class: "user-name" }, u.userName))))))))));
7200
7173
  }
7201
7174
  };
7202
7175
  MessageInfo.style = ":host {\n display: block;\n height: var(--h-full);\n width: var(--w-full);\n font-family: var(--font-primary);\n color: var(--text-primary);\n }\n .panel {\n display: flex;\n flex-direction: column;\n height: var(--h-full);\n background: var(--bg-primary);\n }\n .header {\n height: var(--rail-width);\n padding: 0 var(--space-16);\n background: var(--bg-primary);\n border-bottom: 1px solid var(--border);\n display: flex;\n align-items: center;\n gap: var(--gap-16);\n flex-shrink: 0;\n box-sizing: border-box;\n }\n .header h2 {\n margin: 0;\n font-size: var(--text-16);\n font-weight: var(--fw-600);\n color: var(--text-primary);\n }\n .close-btn {\n border: none;\n background: transparent;\n cursor: pointer;\n width: var(--icon-lg);\n height: var(--icon-lg);\n border-radius: var(--rounded-full);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon);\n padding: 0;\n }\n .close-btn:hover {\n background: var(--hover-overlay);\n color: var(--text-primary);\n }\n .close-btn img {\n width: var(--icon-sm);\n height: var(--icon-sm);\n display: block;\n }\n .body {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n background: var(--bg-tertiary);\n display: flex;\n flex-direction: column;\n }\n .preview-wrap {\n padding: var(--space-16);\n background: var(--bg-secondary);\n border-bottom: 1px solid var(--border);\n display: flex;\n justify-content: flex-end;\n box-sizing: border-box;\n }\n .preview-bubble {\n background: var(--brand);\n color: var(--text-on-brand);\n border-radius: var(--rounded-12) var(--rounded-12) var(--rounded-2) var(--rounded-12);\n padding: var(--gap-10) var(--space-16);\n max-width: 20rem;\n box-shadow: 0 1px 2px var(--overlay);\n box-sizing: border-box;\n }\n .preview-text {\n margin: 0;\n font-size: var(--text-14);\n line-height: 1.5;\n word-break: break-word;\n white-space: pre-wrap;\n }\n .preview-meta {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n margin-top: var(--gap-4);\n font-size: var(--text-10);\n color: var(--text-on-brand);\n opacity: 0.85;\n }\n .status-list {\n background: var(--bg-primary);\n box-shadow: 0 1px 2px var(--overlay);\n }\n .status-row {\n display: flex;\n align-items: flex-start;\n gap: var(--space-16);\n padding: var(--space-16);\n border-bottom: 1px solid var(--border-subtle);\n box-sizing: border-box;\n }\n .status-row:last-child {\n border-bottom: none;\n }\n .status-row:hover {\n background: var(--hover-overlay);\n }\n .status-icon {\n flex-shrink: 0;\n margin-top: var(--gap-2);\n width: var(--icon-md);\n height: var(--icon-md);\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--text-tertiary);\n -webkit-mask: var(--tick-mask) center / contain no-repeat;\n mask: var(--tick-mask) center / contain no-repeat;\n }\n .status-icon.read {\n background-color: var(--brand);\n }\n .status-icon.delivered {\n background-color: var(--text-tertiary);\n }\n .status-content {\n flex: 1;\n min-width: 0;\n }\n .status-title {\n font-size: var(--text-14);\n font-weight: var(--fw-600);\n color: var(--text-primary);\n }\n .status-time {\n margin: var(--gap-2) 0 0;\n font-size: var(--text-12);\n color: var(--text-tertiary);\n }\n .user-row {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n margin-top: var(--space-8);\n }\n .user-name {\n font-size: var(--text-14);\n color: var(--text-primary);\n }\n .theme-icon { filter: var(--svg-icon-filter); }";