isometrik-plugin-chat-sdk 2.0.19 → 2.0.20
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/cjs/{app-globals-170f9e71.js → app-globals-2824b330.js} +3 -3
- package/dist/cjs/{app-globals-170f9e71.js.map → app-globals-2824b330.js.map} +1 -1
- package/dist/cjs/attachment-preview_22.cjs.entry.js +114 -141
- package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
- package/dist/cjs/audio-bubble_4.cjs.entry.js +1 -1
- package/dist/cjs/{chat-assets-686620e7.js → chat-assets-8c4dc04f.js} +22 -3
- package/dist/cjs/chat-assets-8c4dc04f.js.map +1 -0
- package/dist/cjs/chat-tile_3.cjs.entry.js +1 -1
- package/dist/cjs/forward-memebers.cjs.entry.js +1 -1
- package/dist/cjs/{groupcast-4239cbfc.js → groupcast-8441b4df.js} +2 -2
- package/dist/cjs/{groupcast-4239cbfc.js.map → groupcast-8441b4df.js.map} +1 -1
- package/dist/cjs/{groupcast-3cb44a25.js → groupcast-f24da720.js} +14 -4
- package/dist/cjs/groupcast-f24da720.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/isometrik-webchat.cjs.js +6 -6
- package/dist/cjs/loader.cjs.js +6 -6
- package/dist/cjs/login-page_3.cjs.entry.js +7 -7
- package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
- package/dist/cjs/member-add.cjs.entry.js +2 -2
- package/dist/cjs/new-chat-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/{runtime-controls-99f378d4.js → runtime-controls-cfc8fc31.js} +3 -3
- package/dist/cjs/{runtime-controls-99f378d4.js.map → runtime-controls-cfc8fc31.js.map} +1 -1
- package/dist/cjs/send-media-4ee967d4.js +1194 -0
- package/dist/cjs/send-media-4ee967d4.js.map +1 -0
- package/dist/collection/api/groupcast.js +13 -3
- package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js +102 -100
- package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +25 -47
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/GroupCast/GroupCast.js +3 -16
- package/dist/collection/components/ChatUIComponent/shared/GroupCast/GroupCast.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/message-info/message-info.js +10 -4
- package/dist/collection/components/ChatUIComponent/shared/message-info/message-info.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/public-send.js +4 -4
- package/dist/collection/components/my-component/web-chat/public-send.js.map +1 -1
- package/dist/collection/constants/chat-assets.js +21 -2
- package/dist/collection/lib/chat/document-thumbnail.js +433 -0
- package/dist/collection/lib/chat/document-thumbnail.js.map +1 -0
- package/dist/collection/lib/chat/index.js +1 -1
- package/dist/collection/lib/chat/index.js.map +1 -1
- package/dist/collection/lib/chat/send-media.js +348 -25
- package/dist/collection/lib/chat/send-media.js.map +1 -1
- package/dist/components/ChatFooter.js +25 -47
- package/dist/components/ChatFooter.js.map +1 -1
- package/dist/components/ChatSidebar.js +78 -73
- package/dist/components/ChatSidebar.js.map +1 -1
- package/dist/components/GroupCast2.js +3 -16
- package/dist/components/GroupCast2.js.map +1 -1
- package/dist/components/WebChat.js +4 -4
- package/dist/components/WebChat.js.map +1 -1
- package/dist/components/WebChatBody.js +1 -1
- package/dist/components/chat-assets.js +21 -2
- package/dist/components/chat-assets.js.map +1 -1
- package/dist/components/groupcast.js +13 -3
- package/dist/components/groupcast.js.map +1 -1
- package/dist/components/message-info2.js +10 -4
- package/dist/components/message-info2.js.map +1 -1
- package/dist/components/send-media.js +780 -26
- package/dist/components/send-media.js.map +1 -1
- package/dist/esm/{app-globals-15a6ef50.js → app-globals-e3f4717b.js} +3 -3
- package/dist/esm/{app-globals-15a6ef50.js.map → app-globals-e3f4717b.js.map} +1 -1
- package/dist/esm/attachment-preview_22.entry.js +114 -141
- package/dist/esm/attachment-preview_22.entry.js.map +1 -1
- package/dist/esm/audio-bubble_4.entry.js +1 -1
- package/dist/esm/{chat-assets-bb056958.js → chat-assets-27beb552.js} +22 -3
- package/dist/esm/chat-assets-27beb552.js.map +1 -0
- package/dist/esm/chat-tile_3.entry.js +1 -1
- package/dist/esm/forward-memebers.entry.js +1 -1
- package/dist/esm/{groupcast-ea2466c8.js → groupcast-5fb19ec3.js} +2 -2
- package/dist/esm/{groupcast-ea2466c8.js.map → groupcast-5fb19ec3.js.map} +1 -1
- package/dist/esm/{groupcast-cc10c6a4.js → groupcast-f96c1d9e.js} +14 -4
- package/dist/esm/groupcast-f96c1d9e.js.map +1 -0
- package/dist/esm/index.js +5 -5
- package/dist/esm/isometrik-webchat.js +6 -6
- package/dist/esm/loader.js +6 -6
- package/dist/esm/login-page_3.entry.js +7 -7
- package/dist/esm/login-page_3.entry.js.map +1 -1
- package/dist/esm/member-add.entry.js +2 -2
- package/dist/esm/new-chat-sidebar.entry.js +1 -1
- package/dist/esm/{runtime-controls-8a22625e.js → runtime-controls-ff81e90a.js} +3 -3
- package/dist/esm/{runtime-controls-8a22625e.js.map → runtime-controls-ff81e90a.js.map} +1 -1
- package/dist/esm/send-media-58e7145b.js +1166 -0
- package/dist/esm/send-media-58e7145b.js.map +1 -0
- package/dist/isometrik-webchat/index.esm.js +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
- package/dist/isometrik-webchat/{p-fd6ce589.entry.js → p-09980c53.entry.js} +2 -2
- package/dist/isometrik-webchat/p-352b589e.entry.js +2 -0
- package/dist/isometrik-webchat/p-352b589e.entry.js.map +1 -0
- package/dist/isometrik-webchat/p-3b3dc33e.js +2 -0
- package/dist/isometrik-webchat/p-3b3dc33e.js.map +1 -0
- package/dist/isometrik-webchat/{p-ffbbe278.entry.js → p-44da28d3.entry.js} +2 -2
- package/dist/isometrik-webchat/p-6f5037b2.js +2 -0
- package/dist/isometrik-webchat/p-6f5037b2.js.map +1 -0
- package/dist/isometrik-webchat/{p-6fc95e0e.js → p-78fb47c4.js} +2 -2
- package/dist/isometrik-webchat/{p-3120b9d3.entry.js → p-a9efcf1c.entry.js} +2 -2
- package/dist/isometrik-webchat/p-b0baa9ad.entry.js +2 -0
- package/dist/isometrik-webchat/p-b0baa9ad.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-c08055fe.js → p-b385ac4b.js} +2 -2
- package/dist/isometrik-webchat/p-c06ad586.js +2 -0
- package/dist/isometrik-webchat/p-c06ad586.js.map +1 -0
- package/dist/isometrik-webchat/p-d758e431.js +2 -0
- package/dist/isometrik-webchat/{p-c49de274.entry.js → p-d864bb9f.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-39b626ed.entry.js → p-f7d05551.entry.js} +2 -2
- package/dist/types/components/ChatUIComponent/ChatSidebar/ChatSidebar.d.ts +3 -2
- package/dist/types/components.d.ts +17 -17
- package/dist/types/js.d.ts +3 -0
- package/dist/types/lib/chat/document-thumbnail.d.ts +38 -0
- package/dist/types/lib/chat/index.d.ts +1 -1
- package/dist/types/lib/chat/send-media.d.ts +58 -1
- package/package.json +1 -1
- package/dist/cjs/chat-assets-686620e7.js.map +0 -1
- package/dist/cjs/groupcast-3cb44a25.js.map +0 -1
- package/dist/cjs/send-media-7c865c19.js +0 -438
- package/dist/cjs/send-media-7c865c19.js.map +0 -1
- package/dist/esm/chat-assets-bb056958.js.map +0 -1
- package/dist/esm/groupcast-cc10c6a4.js.map +0 -1
- package/dist/esm/send-media-5527ee9f.js +0 -412
- package/dist/esm/send-media-5527ee9f.js.map +0 -1
- package/dist/isometrik-webchat/p-1db79cfb.js +0 -2
- package/dist/isometrik-webchat/p-4671fe73.js +0 -2
- package/dist/isometrik-webchat/p-4671fe73.js.map +0 -1
- package/dist/isometrik-webchat/p-643457b8.js +0 -2
- package/dist/isometrik-webchat/p-643457b8.js.map +0 -1
- package/dist/isometrik-webchat/p-a5707f12.js +0 -2
- package/dist/isometrik-webchat/p-a5707f12.js.map +0 -1
- package/dist/isometrik-webchat/p-a9380fb3.entry.js +0 -2
- package/dist/isometrik-webchat/p-a9380fb3.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-fc3fd090.entry.js +0 -2
- package/dist/isometrik-webchat/p-fc3fd090.entry.js.map +0 -1
- /package/dist/isometrik-webchat/{p-fd6ce589.entry.js.map → p-09980c53.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-ffbbe278.entry.js.map → p-44da28d3.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-6fc95e0e.js.map → p-78fb47c4.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-3120b9d3.entry.js.map → p-a9efcf1c.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-c08055fe.js.map → p-b385ac4b.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-1db79cfb.js.map → p-d758e431.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-c49de274.entry.js.map → p-d864bb9f.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-39b626ed.entry.js.map → p-f7d05551.entry.js.map} +0 -0
|
@@ -13,6 +13,8 @@ import { d as drawerDialogService } from './drawer.js';
|
|
|
13
13
|
import { e as postGroupCast } from './groupcast.js';
|
|
14
14
|
import { f as formatUnixTimestamp } from './unixTimeConverter.js';
|
|
15
15
|
import { b as clearAll, d as debounce } from './helpers.js';
|
|
16
|
+
import { i as isPdfAttachment } from './preview-kind.js';
|
|
17
|
+
import { A as ATTACHMENT_BODY_PLACEHOLDER } from './send-media.js';
|
|
16
18
|
import { L as Left_Arrow, N as New_Chat, T as Three_Dots, f as New_Group, g as Logout } from './chat-assets.js';
|
|
17
19
|
import { d as defineCustomElement$3 } from './profile-avatar2.js';
|
|
18
20
|
|
|
@@ -186,7 +188,7 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
186
188
|
const mediaExtension = file.name.split('.').pop();
|
|
187
189
|
const res = await M.getInstance().user.getPresignedurlCreate({
|
|
188
190
|
userIdentifier: this.userMetaData.userIdentifier,
|
|
189
|
-
mediaExtension,
|
|
191
|
+
mediaExtension: mediaExtension || '',
|
|
190
192
|
});
|
|
191
193
|
// Upload file to presigned URL
|
|
192
194
|
await fetch(res.presignedUrl, {
|
|
@@ -304,10 +306,10 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
304
306
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
305
307
|
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') &&
|
|
306
308
|
(((_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'))
|
|
307
|
-
return;
|
|
309
|
+
return 0;
|
|
308
310
|
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') &&
|
|
309
311
|
(((_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'))
|
|
310
|
-
return;
|
|
312
|
+
return 0;
|
|
311
313
|
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;
|
|
312
314
|
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;
|
|
313
315
|
return timeB - timeA;
|
|
@@ -359,7 +361,7 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
359
361
|
const currentCount = this.unreadCounts[conversationId] || 0;
|
|
360
362
|
this.unreadCounts = Object.assign(Object.assign({}, this.unreadCounts), { [conversationId]: currentCount + count });
|
|
361
363
|
// Update the conversation list to reflect the new message
|
|
362
|
-
this.conversationList = this.conversationList.map(conversation => {
|
|
364
|
+
this.conversationList = this.conversationList.map((conversation) => {
|
|
363
365
|
if (conversation.conversationId === conversationId) {
|
|
364
366
|
return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: currentCount + count, lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { updatedAt: Date.now() }) });
|
|
365
367
|
}
|
|
@@ -372,7 +374,7 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
372
374
|
const selectedConversation = event.detail;
|
|
373
375
|
const selectedConvoId = selectedConversation.conversationId;
|
|
374
376
|
this.selectedConversationID = selectedConvoId;
|
|
375
|
-
this.conversationList = this.sortedConversationList.map(conversation => {
|
|
377
|
+
this.conversationList = this.sortedConversationList.map((conversation) => {
|
|
376
378
|
if (conversation.conversationId === selectedConvoId) {
|
|
377
379
|
return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: 0 });
|
|
378
380
|
}
|
|
@@ -411,19 +413,32 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
411
413
|
}));
|
|
412
414
|
}
|
|
413
415
|
}
|
|
416
|
+
attachmentLooksLikeDocument(att) {
|
|
417
|
+
if (!att)
|
|
418
|
+
return false;
|
|
419
|
+
if (att.mediaType === 3)
|
|
420
|
+
return true;
|
|
421
|
+
if (isPdfAttachment({ mimeType: att.mimeType, name: att.name || att.nameWithExtension }))
|
|
422
|
+
return true;
|
|
423
|
+
const mime = String(att.mimeType || '').toLowerCase();
|
|
424
|
+
return mime.startsWith('application/') || mime.startsWith('text/');
|
|
425
|
+
}
|
|
414
426
|
getMediaType(tile) {
|
|
415
|
-
var _a;
|
|
416
427
|
const details = tile === null || tile === void 0 ? void 0 : tile.lastMessageDetails;
|
|
417
428
|
const attachments = details === null || details === void 0 ? void 0 : details.attachments;
|
|
418
429
|
if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
|
|
419
|
-
const
|
|
420
|
-
|
|
430
|
+
const last = attachments[attachments.length - 1];
|
|
431
|
+
const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
|
|
432
|
+
if (mimeType.startsWith('video/') || mimeType.includes('video'))
|
|
421
433
|
return 2;
|
|
422
|
-
if (
|
|
434
|
+
if (this.attachmentLooksLikeDocument(last))
|
|
435
|
+
return 3;
|
|
436
|
+
if (mimeType.startsWith('image/'))
|
|
423
437
|
return 1;
|
|
424
|
-
if (mimeType.includes('audio'))
|
|
438
|
+
if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
|
|
425
439
|
return 4;
|
|
426
|
-
|
|
440
|
+
if ((last === null || last === void 0 ? void 0 : last.mediaType) === 3)
|
|
441
|
+
return 3;
|
|
427
442
|
return 3;
|
|
428
443
|
}
|
|
429
444
|
const body = (details === null || details === void 0 ? void 0 : details.body) || '';
|
|
@@ -447,14 +462,18 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
447
462
|
return (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
|
|
448
463
|
}
|
|
449
464
|
getMessageBody(tile, userMetaData) {
|
|
450
|
-
var _a, _b
|
|
465
|
+
var _a, _b;
|
|
451
466
|
const details = tile === null || tile === void 0 ? void 0 : tile.lastMessageDetails;
|
|
452
467
|
if (!(details === null || details === void 0 ? void 0 : details.body))
|
|
453
468
|
return '';
|
|
454
469
|
const { senderId, senderName, body, attachments, metaData } = details;
|
|
455
470
|
const sender = senderId === (userMetaData === null || userMetaData === void 0 ? void 0 : userMetaData.userId) ? 'You' : senderName || '';
|
|
456
471
|
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();
|
|
457
|
-
|
|
472
|
+
const bodyStr = String(body || '');
|
|
473
|
+
const isMultipleAttachment = bodyStr === ATTACHMENT_BODY_PLACEHOLDER ||
|
|
474
|
+
String((details === null || details === void 0 ? void 0 : details.customType) || '') === ATTACHMENT_BODY_PLACEHOLDER;
|
|
475
|
+
// Multiple: show caption from meta only; body is API placeholder or non-caption payload
|
|
476
|
+
let messageContent = isMultipleAttachment ? caption || '' : caption || bodyStr;
|
|
458
477
|
// Body placeholder (API non-empty) — never show AttachmentMessage:* as preview text
|
|
459
478
|
if (!caption && String(body || '').startsWith('AttachmentMessage:')) {
|
|
460
479
|
if (body === 'AttachmentMessage:Image')
|
|
@@ -464,13 +483,39 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
464
483
|
else if (body === 'AttachmentMessage:File' || body === 'AttachmentMessage:Audio' || body === 'AttachmentMessage:Doc') {
|
|
465
484
|
messageContent = 'Document';
|
|
466
485
|
}
|
|
486
|
+
else if (body === 'AttachmentMessage:Multiple') {
|
|
487
|
+
if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
|
|
488
|
+
const last = attachments[attachments.length - 1];
|
|
489
|
+
if (this.attachmentLooksLikeDocument(last)) {
|
|
490
|
+
messageContent = (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
|
|
494
|
+
if (mimeType.startsWith('video/') || mimeType.includes('video'))
|
|
495
|
+
messageContent = 'Video';
|
|
496
|
+
else if (mimeType.startsWith('image/'))
|
|
497
|
+
messageContent = 'Image';
|
|
498
|
+
else if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
|
|
499
|
+
messageContent = 'Audio';
|
|
500
|
+
else
|
|
501
|
+
messageContent = 'Attachment';
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
messageContent = 'Attachment';
|
|
506
|
+
}
|
|
507
|
+
}
|
|
467
508
|
else if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
|
|
468
|
-
const
|
|
469
|
-
|
|
509
|
+
const last = attachments[attachments.length - 1];
|
|
510
|
+
const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
|
|
511
|
+
if (this.attachmentLooksLikeDocument(last)) {
|
|
512
|
+
messageContent = (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
|
|
513
|
+
}
|
|
514
|
+
else if (mimeType.startsWith('video/') || mimeType.includes('video'))
|
|
470
515
|
messageContent = 'Video';
|
|
471
|
-
else if (mimeType.
|
|
516
|
+
else if (mimeType.startsWith('image/'))
|
|
472
517
|
messageContent = 'Image';
|
|
473
|
-
else if (mimeType.includes('audio'))
|
|
518
|
+
else if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
|
|
474
519
|
messageContent = 'Audio';
|
|
475
520
|
else
|
|
476
521
|
messageContent = 'Document';
|
|
@@ -542,7 +587,7 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
542
587
|
const previewText = this.getLastMessageText(tile, this.userMetaData) || '';
|
|
543
588
|
const unreadCount = (_a = this.unreadCounts[conversationId]) !== null && _a !== void 0 ? _a : ((tile === null || tile === void 0 ? void 0 : tile.unreadMessagesCount) > 0 ? tile.unreadMessagesCount : 0);
|
|
544
589
|
const isTyping = !!(this.isTyping && this.typingConversationId === conversationId);
|
|
545
|
-
const typingUserName = tile.isGroup ? this.typingUserName :
|
|
590
|
+
const typingUserName = tile.isGroup ? this.typingUserName : undefined;
|
|
546
591
|
const customTag = (_b = this.customParts) === null || _b === void 0 ? void 0 : _b.chatTile;
|
|
547
592
|
if (customTag) {
|
|
548
593
|
return h(customTag, {
|
|
@@ -738,29 +783,14 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
738
783
|
}
|
|
739
784
|
async createGroupConversation() {
|
|
740
785
|
try {
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
readEvents: true,
|
|
744
|
-
pushNotifications: true,
|
|
745
|
-
members: this.selectedGroupUserIds,
|
|
746
|
-
isGroup: true,
|
|
747
|
-
conversationType: 0,
|
|
748
|
-
conversationTitle: this.groupInfo.title,
|
|
749
|
-
conversationImageUrl: this.groupInfo.imageUrl,
|
|
750
|
-
};
|
|
786
|
+
const imageUrl = (this.groupInfo.imageUrl || '').trim();
|
|
787
|
+
const paramsForCreateConversation = Object.assign({ typingEvents: true, readEvents: true, pushNotifications: true, members: this.selectedGroupUserIds, isGroup: true, conversationType: 0, conversationTitle: this.groupInfo.title }, (imageUrl ? { conversationImageUrl: imageUrl } : {}));
|
|
751
788
|
const res = await M.getInstance().Conversation.postConversation(paramsForCreateConversation);
|
|
752
789
|
// Add the new group conversation to the list
|
|
753
|
-
const newConversation = {
|
|
754
|
-
conversationId: res.conversationId,
|
|
755
|
-
lastMessageDetails: {
|
|
790
|
+
const newConversation = Object.assign({ conversationId: res.conversationId, lastMessageDetails: {
|
|
756
791
|
updatedAt: Date.now(),
|
|
757
792
|
body: '',
|
|
758
|
-
},
|
|
759
|
-
unreadMessagesCount: 0,
|
|
760
|
-
isGroup: true,
|
|
761
|
-
conversationTitle: this.groupInfo.title,
|
|
762
|
-
conversationImageUrl: this.groupInfo.imageUrl,
|
|
763
|
-
};
|
|
793
|
+
}, unreadMessagesCount: 0, isGroup: true, conversationTitle: this.groupInfo.title }, (imageUrl ? { conversationImageUrl: imageUrl } : {}));
|
|
764
794
|
this.conversationList = [newConversation, ...this.conversationList];
|
|
765
795
|
// this.sortConversations();
|
|
766
796
|
this.selectedConversationID = res.conversationId;
|
|
@@ -778,7 +808,6 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
778
808
|
const { conversationTitle, imageFile, selectedUserIds, isGroupCast, selectedUsers } = event.detail;
|
|
779
809
|
try {
|
|
780
810
|
this.isGroupCreationLoading = true;
|
|
781
|
-
// Empty → profile-avatar group fallback (avoid broken X placeholder CDN asset).
|
|
782
811
|
let conversationImageUrl = '';
|
|
783
812
|
if (imageFile) {
|
|
784
813
|
try {
|
|
@@ -802,18 +831,9 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
802
831
|
return;
|
|
803
832
|
}
|
|
804
833
|
}
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
pushNotifications: true,
|
|
809
|
-
members: selectedUserIds,
|
|
810
|
-
isGroup: true,
|
|
811
|
-
conversationType: 1,
|
|
812
|
-
conversationTitle,
|
|
813
|
-
conversationImageUrl,
|
|
814
|
-
searchableTags: [conversationTitle],
|
|
815
|
-
};
|
|
816
|
-
const members = selectedUserIds.map(id => {
|
|
834
|
+
const trimmedImageUrl = conversationImageUrl.trim();
|
|
835
|
+
const paramsForCreateConversation = Object.assign(Object.assign({ typingEvents: true, readEvents: true, pushNotifications: true, members: selectedUserIds, isGroup: true, conversationType: 1, conversationTitle }, (trimmedImageUrl ? { conversationImageUrl: trimmedImageUrl } : {})), { searchableTags: [conversationTitle] });
|
|
836
|
+
const members = selectedUserIds.map((id) => {
|
|
817
837
|
const user = selectedUsers === null || selectedUsers === void 0 ? void 0 : selectedUsers.find((u) => (u === null || u === void 0 ? void 0 : u.userId) === id);
|
|
818
838
|
return {
|
|
819
839
|
newConversationTypingEvents: true,
|
|
@@ -825,16 +845,9 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
825
845
|
userName: (user === null || user === void 0 ? void 0 : user.userName) || id,
|
|
826
846
|
};
|
|
827
847
|
});
|
|
828
|
-
const paramsForCreateGroupCastConversation = {
|
|
829
|
-
groupcastTitle: conversationTitle,
|
|
830
|
-
groupcastImageUrl: conversationImageUrl,
|
|
831
|
-
searchableTags: [conversationTitle],
|
|
832
|
-
metaData: { description: 'groupcast created',
|
|
848
|
+
const paramsForCreateGroupCastConversation = Object.assign(Object.assign({ groupcastTitle: conversationTitle }, (trimmedImageUrl ? { groupcastImageUrl: trimmedImageUrl } : {})), { searchableTags: [conversationTitle], metaData: { description: 'groupcast created',
|
|
833
849
|
members: selectedUsers
|
|
834
|
-
},
|
|
835
|
-
customType: 'groupcast',
|
|
836
|
-
members,
|
|
837
|
-
};
|
|
850
|
+
}, customType: 'groupcast', members });
|
|
838
851
|
if (isGroupCast) {
|
|
839
852
|
const res = await postGroupCast(paramsForCreateGroupCastConversation);
|
|
840
853
|
this.selectedConversationID = res.groupcastId;
|
|
@@ -850,25 +863,17 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
850
863
|
}
|
|
851
864
|
else {
|
|
852
865
|
const res = await M.getInstance().Conversation.postConversation(paramsForCreateConversation);
|
|
853
|
-
const newConversation = {
|
|
854
|
-
conversationId: res.conversationId,
|
|
855
|
-
lastMessageDetails: {
|
|
866
|
+
const newConversation = Object.assign(Object.assign({ conversationId: res.conversationId, lastMessageDetails: {
|
|
856
867
|
updatedAt: Date.now(),
|
|
857
868
|
body: '',
|
|
858
|
-
},
|
|
859
|
-
unreadMessagesCount: 0,
|
|
860
|
-
isGroup: true,
|
|
861
|
-
conversationTitle,
|
|
862
|
-
conversationImageUrl,
|
|
863
|
-
members: selectedUserIds,
|
|
864
|
-
};
|
|
869
|
+
}, unreadMessagesCount: 0, isGroup: true, conversationTitle }, (trimmedImageUrl ? { conversationImageUrl: trimmedImageUrl } : {})), { members: selectedUserIds });
|
|
865
870
|
this.conversationList = [newConversation, ...this.conversationList];
|
|
866
871
|
this.selectedConversationID = res.conversationId;
|
|
867
872
|
// Keep header avatar in sync immediately (details fetch can lag / omit image).
|
|
868
873
|
conversationStore.updateConversationDetails({
|
|
869
874
|
conversationId: res.conversationId,
|
|
870
875
|
conversationTitle,
|
|
871
|
-
conversationImageUrl:
|
|
876
|
+
conversationImageUrl: trimmedImageUrl || '',
|
|
872
877
|
isGroup: true,
|
|
873
878
|
});
|
|
874
879
|
const url = new URL(window.location.href);
|
|
@@ -940,7 +945,7 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
940
945
|
try {
|
|
941
946
|
this.isLoading = true;
|
|
942
947
|
await M.getInstance().Conversation.deleteConversationLeave({ conversationId });
|
|
943
|
-
this.conversationList = this.conversationList.filter(conversation => conversation.conversationId !== conversationId);
|
|
948
|
+
this.conversationList = this.conversationList.filter((conversation) => conversation.conversationId !== conversationId);
|
|
944
949
|
// this.sortConversations();
|
|
945
950
|
const url = new URL(window.location.href);
|
|
946
951
|
url.searchParams.delete('conversation');
|
|
@@ -968,7 +973,7 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
968
973
|
handleMessageReadStatusUpdate(event) {
|
|
969
974
|
const { conversationId, isRead, isDelivered } = event.detail;
|
|
970
975
|
// Update the conversation list to reflect new read status
|
|
971
|
-
this.conversationList = this.conversationList.map(conversation => {
|
|
976
|
+
this.conversationList = this.conversationList.map((conversation) => {
|
|
972
977
|
if (conversation.conversationId === conversationId) {
|
|
973
978
|
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { readByAll: isRead, deliveredToAll: isDelivered }) });
|
|
974
979
|
}
|
|
@@ -1018,7 +1023,7 @@ const ChatSidebar = /*@__PURE__*/ proxyCustomElement(class ChatSidebar extends H
|
|
|
1018
1023
|
"typingUserName": [1, "typing-user-name"],
|
|
1019
1024
|
"typingConversationId": [1, "typing-conversation-id"],
|
|
1020
1025
|
"allMessages": [8, "all-messages"],
|
|
1021
|
-
"isConversationLoading": [
|
|
1026
|
+
"isConversationLoading": [4, "is-conversation-loading"],
|
|
1022
1027
|
"hasMoreConversations": [4, "has-more-conversations"],
|
|
1023
1028
|
"unreadConversationsCount": [2, "unread-conversations-count"],
|
|
1024
1029
|
"customParts": [1040],
|