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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const runtimeControls = require('./runtime-controls-
|
|
4
|
-
const groupcast = require('./groupcast-
|
|
3
|
+
const runtimeControls = require('./runtime-controls-cfc8fc31.js');
|
|
4
|
+
const groupcast = require('./groupcast-8441b4df.js');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Expose public SDK helpers on window for www demos / script-tag hosts.
|
|
@@ -35,4 +35,4 @@ const globalScripts = appGlobalScript;
|
|
|
35
35
|
|
|
36
36
|
exports.globalScripts = globalScripts;
|
|
37
37
|
|
|
38
|
-
//# sourceMappingURL=app-globals-
|
|
38
|
+
//# sourceMappingURL=app-globals-2824b330.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"app-globals-
|
|
1
|
+
{"file":"app-globals-2824b330.js","mappings":";;;;;AAAA;;;;;IAwBE,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,MAAM,CAAC,GAAG,MAAa,CAAC;IACxB,CAAC,CAAC,0BAA0B,GAAGA,0CAA0B,CAAC;IAC1D,CAAC,CAAC,uBAAuB,GAAGC,uCAAuB,CAAC;IACpD,CAAC,CAAC,sBAAsB,GAAGC,sCAAsB,CAAC;IAClD,CAAC,CAAC,sBAAsB,GAAGC,sCAAsB,CAAC;IAClD,CAAC,CAAC,uBAAuB,GAAGC,uCAAuB,CAAC;IACpD,CAAC,CAAC,cAAc,GAAGJ,0CAA0B,CAAC;IAC9C,CAAC,CAAC,WAAW,GAAGC,uCAAuB,CAAC;IACxC,CAAC,CAAC,mBAAmB,GAAGI,mCAAmB,CAAC;IAC5C,CAAC,CAAC,gBAAgB,GAAGC,gCAAgB,CAAC;IACtC,CAAC,CAAC,iBAAiB,GAAGC,2BAAiB,CAAC;IACxC,CAAC,CAAC,gBAAgB,GAAGC,gCAAgB,CAAC;IACtC,CAAC,CAAC,qBAAqB,GAAGC,qCAAqB,CAAC;IAChD,CAAC,CAAC,gBAAgB,GAAGC,gCAAgB,CAAC;IACtC,CAAC,CAAC,eAAe,GAAGC,+BAAe,CAAC;IACpC,CAAC,CAAC,gBAAgB,GAAGC,gCAAgB,CAAC;IACtC,CAAC,CAAC,WAAW,GAAGC,2BAAW,CAAC;IAC5B,CAAC,CAAC,oBAAoB,GAAGC,oCAAoB,CAAC;IAC9C,CAAC,CAAC,cAAc,GAAGC,8BAAc,CAAC;AACpC;;AC3CY,MAAC,aAAa,GAAG;;;;","names":["initializeIsometrikWebchat","destroyIsometrikWebchat","ensureIsometrikWebchat","retainIsometrikWebchat","releaseIsometrikWebchat","isometrikWebchatApi","createWebChatApi","THEME_TOKEN_NAMES","mountReactInSlot","defineReactCustomPart","unmountReactSlot","switchChatTheme","applyCustomTheme","toggleTheme","resolveThemeProvider","resolveWebChat"],"sources":["src/global/expose-sdk.ts","@stencil/core/internal/app-globals"],"sourcesContent":["/**\n * Expose public SDK helpers on window for www demos / script-tag hosts.\n * Bundlers should prefer named ESM imports from the package entry.\n */\nimport {\n initializeIsometrikWebchat,\n destroyIsometrikWebchat,\n ensureIsometrikWebchat,\n retainIsometrikWebchat,\n releaseIsometrikWebchat,\n mountReactInSlot,\n defineReactCustomPart,\n unmountReactSlot,\n createWebChatApi,\n isometrikWebchatApi,\n THEME_TOKEN_NAMES,\n switchChatTheme,\n applyCustomTheme,\n toggleTheme,\n resolveThemeProvider,\n resolveWebChat,\n} from '../sdk';\n\nexport default function () {\n if (typeof window === 'undefined') return;\n const w = window as any;\n w.initializeIsometrikWebchat = initializeIsometrikWebchat;\n w.destroyIsometrikWebchat = destroyIsometrikWebchat;\n w.ensureIsometrikWebchat = ensureIsometrikWebchat;\n w.retainIsometrikWebchat = retainIsometrikWebchat;\n w.releaseIsometrikWebchat = releaseIsometrikWebchat;\n w.initializeChat = initializeIsometrikWebchat;\n w.destroyChat = destroyIsometrikWebchat;\n w.isometrikWebchatApi = isometrikWebchatApi;\n w.createWebChatApi = createWebChatApi;\n w.THEME_TOKEN_NAMES = THEME_TOKEN_NAMES;\n w.mountReactInSlot = mountReactInSlot;\n w.defineReactCustomPart = defineReactCustomPart;\n w.unmountReactSlot = unmountReactSlot;\n w.switchChatTheme = switchChatTheme;\n w.applyCustomTheme = applyCustomTheme;\n w.toggleTheme = toggleTheme;\n w.resolveThemeProvider = resolveThemeProvider;\n w.resolveWebChat = resolveWebChat;\n}\n","import appGlobalScript from '/Users/3embed/Desktop/isometrik-webchat/src/global/expose-sdk.ts';\nexport const globalScripts = appGlobalScript;\n"],"version":3}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f624fc47.js');
|
|
6
|
-
const chatAssets = require('./chat-assets-
|
|
6
|
+
const chatAssets = require('./chat-assets-8c4dc04f.js');
|
|
7
7
|
const cancel = require('./cancel-1ffd86d3.js');
|
|
8
|
-
const sendMedia = require('./send-media-
|
|
8
|
+
const sendMedia = require('./send-media-4ee967d4.js');
|
|
9
9
|
const doublecheck = require('./doublecheck-c2461adc.js');
|
|
10
10
|
const toast = require('./toast-91093c84.js');
|
|
11
11
|
const drawer = require('./drawer-00a2323a.js');
|
|
12
12
|
const helpers = require('./helpers-154861e9.js');
|
|
13
13
|
const index$1 = require('./index-3411923c.js');
|
|
14
14
|
const localNotification = require('./local-notification-bdd04d7a.js');
|
|
15
|
-
const groupcast = require('./groupcast-
|
|
15
|
+
const groupcast = require('./groupcast-f24da720.js');
|
|
16
16
|
const IsometrikLogo = require('./IsometrikLogo-9e642f65.js');
|
|
17
17
|
const groupMembers = require('./group-members-cef1198e.js');
|
|
18
18
|
const groupAdminLeave = require('./group-admin-leave-b5cfdb33.js');
|
|
@@ -388,7 +388,7 @@ const ChatSidebar = class {
|
|
|
388
388
|
const mediaExtension = file.name.split('.').pop();
|
|
389
389
|
const res = await toast.M.getInstance().user.getPresignedurlCreate({
|
|
390
390
|
userIdentifier: this.userMetaData.userIdentifier,
|
|
391
|
-
mediaExtension,
|
|
391
|
+
mediaExtension: mediaExtension || '',
|
|
392
392
|
});
|
|
393
393
|
// Upload file to presigned URL
|
|
394
394
|
await fetch(res.presignedUrl, {
|
|
@@ -506,10 +506,10 @@ const ChatSidebar = class {
|
|
|
506
506
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
507
507
|
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') &&
|
|
508
508
|
(((_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'))
|
|
509
|
-
return;
|
|
509
|
+
return 0;
|
|
510
510
|
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') &&
|
|
511
511
|
(((_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'))
|
|
512
|
-
return;
|
|
512
|
+
return 0;
|
|
513
513
|
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;
|
|
514
514
|
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;
|
|
515
515
|
return timeB - timeA;
|
|
@@ -561,7 +561,7 @@ const ChatSidebar = class {
|
|
|
561
561
|
const currentCount = this.unreadCounts[conversationId] || 0;
|
|
562
562
|
this.unreadCounts = Object.assign(Object.assign({}, this.unreadCounts), { [conversationId]: currentCount + count });
|
|
563
563
|
// Update the conversation list to reflect the new message
|
|
564
|
-
this.conversationList = this.conversationList.map(conversation => {
|
|
564
|
+
this.conversationList = this.conversationList.map((conversation) => {
|
|
565
565
|
if (conversation.conversationId === conversationId) {
|
|
566
566
|
return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: currentCount + count, lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { updatedAt: Date.now() }) });
|
|
567
567
|
}
|
|
@@ -574,7 +574,7 @@ const ChatSidebar = class {
|
|
|
574
574
|
const selectedConversation = event.detail;
|
|
575
575
|
const selectedConvoId = selectedConversation.conversationId;
|
|
576
576
|
this.selectedConversationID = selectedConvoId;
|
|
577
|
-
this.conversationList = this.sortedConversationList.map(conversation => {
|
|
577
|
+
this.conversationList = this.sortedConversationList.map((conversation) => {
|
|
578
578
|
if (conversation.conversationId === selectedConvoId) {
|
|
579
579
|
return Object.assign(Object.assign({}, conversation), { unreadMessagesCount: 0 });
|
|
580
580
|
}
|
|
@@ -613,19 +613,32 @@ const ChatSidebar = class {
|
|
|
613
613
|
}));
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
+
attachmentLooksLikeDocument(att) {
|
|
617
|
+
if (!att)
|
|
618
|
+
return false;
|
|
619
|
+
if (att.mediaType === 3)
|
|
620
|
+
return true;
|
|
621
|
+
if (doublecheck.isPdfAttachment({ mimeType: att.mimeType, name: att.name || att.nameWithExtension }))
|
|
622
|
+
return true;
|
|
623
|
+
const mime = String(att.mimeType || '').toLowerCase();
|
|
624
|
+
return mime.startsWith('application/') || mime.startsWith('text/');
|
|
625
|
+
}
|
|
616
626
|
getMediaType(tile) {
|
|
617
|
-
var _a;
|
|
618
627
|
const details = tile === null || tile === void 0 ? void 0 : tile.lastMessageDetails;
|
|
619
628
|
const attachments = details === null || details === void 0 ? void 0 : details.attachments;
|
|
620
629
|
if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
|
|
621
|
-
const
|
|
622
|
-
|
|
630
|
+
const last = attachments[attachments.length - 1];
|
|
631
|
+
const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
|
|
632
|
+
if (mimeType.startsWith('video/') || mimeType.includes('video'))
|
|
623
633
|
return 2;
|
|
624
|
-
if (
|
|
634
|
+
if (this.attachmentLooksLikeDocument(last))
|
|
635
|
+
return 3;
|
|
636
|
+
if (mimeType.startsWith('image/'))
|
|
625
637
|
return 1;
|
|
626
|
-
if (mimeType.includes('audio'))
|
|
638
|
+
if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
|
|
627
639
|
return 4;
|
|
628
|
-
|
|
640
|
+
if ((last === null || last === void 0 ? void 0 : last.mediaType) === 3)
|
|
641
|
+
return 3;
|
|
629
642
|
return 3;
|
|
630
643
|
}
|
|
631
644
|
const body = (details === null || details === void 0 ? void 0 : details.body) || '';
|
|
@@ -649,14 +662,18 @@ const ChatSidebar = class {
|
|
|
649
662
|
return (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
|
|
650
663
|
}
|
|
651
664
|
getMessageBody(tile, userMetaData) {
|
|
652
|
-
var _a, _b
|
|
665
|
+
var _a, _b;
|
|
653
666
|
const details = tile === null || tile === void 0 ? void 0 : tile.lastMessageDetails;
|
|
654
667
|
if (!(details === null || details === void 0 ? void 0 : details.body))
|
|
655
668
|
return '';
|
|
656
669
|
const { senderId, senderName, body, attachments, metaData } = details;
|
|
657
670
|
const sender = senderId === (userMetaData === null || userMetaData === void 0 ? void 0 : userMetaData.userId) ? 'You' : senderName || '';
|
|
658
671
|
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();
|
|
659
|
-
|
|
672
|
+
const bodyStr = String(body || '');
|
|
673
|
+
const isMultipleAttachment = bodyStr === sendMedia.ATTACHMENT_BODY_PLACEHOLDER ||
|
|
674
|
+
String((details === null || details === void 0 ? void 0 : details.customType) || '') === sendMedia.ATTACHMENT_BODY_PLACEHOLDER;
|
|
675
|
+
// Multiple: show caption from meta only; body is API placeholder or non-caption payload
|
|
676
|
+
let messageContent = isMultipleAttachment ? caption || '' : caption || bodyStr;
|
|
660
677
|
// Body placeholder (API non-empty) — never show AttachmentMessage:* as preview text
|
|
661
678
|
if (!caption && String(body || '').startsWith('AttachmentMessage:')) {
|
|
662
679
|
if (body === 'AttachmentMessage:Image')
|
|
@@ -666,13 +683,39 @@ const ChatSidebar = class {
|
|
|
666
683
|
else if (body === 'AttachmentMessage:File' || body === 'AttachmentMessage:Audio' || body === 'AttachmentMessage:Doc') {
|
|
667
684
|
messageContent = 'Document';
|
|
668
685
|
}
|
|
686
|
+
else if (body === 'AttachmentMessage:Multiple') {
|
|
687
|
+
if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
|
|
688
|
+
const last = attachments[attachments.length - 1];
|
|
689
|
+
if (this.attachmentLooksLikeDocument(last)) {
|
|
690
|
+
messageContent = (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
|
|
694
|
+
if (mimeType.startsWith('video/') || mimeType.includes('video'))
|
|
695
|
+
messageContent = 'Video';
|
|
696
|
+
else if (mimeType.startsWith('image/'))
|
|
697
|
+
messageContent = 'Image';
|
|
698
|
+
else if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
|
|
699
|
+
messageContent = 'Audio';
|
|
700
|
+
else
|
|
701
|
+
messageContent = 'Attachment';
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
messageContent = 'Attachment';
|
|
706
|
+
}
|
|
707
|
+
}
|
|
669
708
|
else if (attachments === null || attachments === void 0 ? void 0 : attachments.length) {
|
|
670
|
-
const
|
|
671
|
-
|
|
709
|
+
const last = attachments[attachments.length - 1];
|
|
710
|
+
const mimeType = String((last === null || last === void 0 ? void 0 : last.mimeType) || '').toLowerCase();
|
|
711
|
+
if (this.attachmentLooksLikeDocument(last)) {
|
|
712
|
+
messageContent = (last === null || last === void 0 ? void 0 : last.name) || (last === null || last === void 0 ? void 0 : last.nameWithExtension) || 'Document';
|
|
713
|
+
}
|
|
714
|
+
else if (mimeType.startsWith('video/') || mimeType.includes('video'))
|
|
672
715
|
messageContent = 'Video';
|
|
673
|
-
else if (mimeType.
|
|
716
|
+
else if (mimeType.startsWith('image/'))
|
|
674
717
|
messageContent = 'Image';
|
|
675
|
-
else if (mimeType.includes('audio'))
|
|
718
|
+
else if (mimeType.startsWith('audio/') || mimeType.includes('audio'))
|
|
676
719
|
messageContent = 'Audio';
|
|
677
720
|
else
|
|
678
721
|
messageContent = 'Document';
|
|
@@ -744,7 +787,7 @@ const ChatSidebar = class {
|
|
|
744
787
|
const previewText = this.getLastMessageText(tile, this.userMetaData) || '';
|
|
745
788
|
const unreadCount = (_a = this.unreadCounts[conversationId]) !== null && _a !== void 0 ? _a : ((tile === null || tile === void 0 ? void 0 : tile.unreadMessagesCount) > 0 ? tile.unreadMessagesCount : 0);
|
|
746
789
|
const isTyping = !!(this.isTyping && this.typingConversationId === conversationId);
|
|
747
|
-
const typingUserName = tile.isGroup ? this.typingUserName :
|
|
790
|
+
const typingUserName = tile.isGroup ? this.typingUserName : undefined;
|
|
748
791
|
const customTag = (_b = this.customParts) === null || _b === void 0 ? void 0 : _b.chatTile;
|
|
749
792
|
if (customTag) {
|
|
750
793
|
return index.h(customTag, {
|
|
@@ -940,29 +983,14 @@ const ChatSidebar = class {
|
|
|
940
983
|
}
|
|
941
984
|
async createGroupConversation() {
|
|
942
985
|
try {
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
-
readEvents: true,
|
|
946
|
-
pushNotifications: true,
|
|
947
|
-
members: this.selectedGroupUserIds,
|
|
948
|
-
isGroup: true,
|
|
949
|
-
conversationType: 0,
|
|
950
|
-
conversationTitle: this.groupInfo.title,
|
|
951
|
-
conversationImageUrl: this.groupInfo.imageUrl,
|
|
952
|
-
};
|
|
986
|
+
const imageUrl = (this.groupInfo.imageUrl || '').trim();
|
|
987
|
+
const paramsForCreateConversation = Object.assign({ typingEvents: true, readEvents: true, pushNotifications: true, members: this.selectedGroupUserIds, isGroup: true, conversationType: 0, conversationTitle: this.groupInfo.title }, (imageUrl ? { conversationImageUrl: imageUrl } : {}));
|
|
953
988
|
const res = await toast.M.getInstance().Conversation.postConversation(paramsForCreateConversation);
|
|
954
989
|
// Add the new group conversation to the list
|
|
955
|
-
const newConversation = {
|
|
956
|
-
conversationId: res.conversationId,
|
|
957
|
-
lastMessageDetails: {
|
|
990
|
+
const newConversation = Object.assign({ conversationId: res.conversationId, lastMessageDetails: {
|
|
958
991
|
updatedAt: Date.now(),
|
|
959
992
|
body: '',
|
|
960
|
-
},
|
|
961
|
-
unreadMessagesCount: 0,
|
|
962
|
-
isGroup: true,
|
|
963
|
-
conversationTitle: this.groupInfo.title,
|
|
964
|
-
conversationImageUrl: this.groupInfo.imageUrl,
|
|
965
|
-
};
|
|
993
|
+
}, unreadMessagesCount: 0, isGroup: true, conversationTitle: this.groupInfo.title }, (imageUrl ? { conversationImageUrl: imageUrl } : {}));
|
|
966
994
|
this.conversationList = [newConversation, ...this.conversationList];
|
|
967
995
|
// this.sortConversations();
|
|
968
996
|
this.selectedConversationID = res.conversationId;
|
|
@@ -980,7 +1008,6 @@ const ChatSidebar = class {
|
|
|
980
1008
|
const { conversationTitle, imageFile, selectedUserIds, isGroupCast, selectedUsers } = event.detail;
|
|
981
1009
|
try {
|
|
982
1010
|
this.isGroupCreationLoading = true;
|
|
983
|
-
// Empty → profile-avatar group fallback (avoid broken X placeholder CDN asset).
|
|
984
1011
|
let conversationImageUrl = '';
|
|
985
1012
|
if (imageFile) {
|
|
986
1013
|
try {
|
|
@@ -1004,18 +1031,9 @@ const ChatSidebar = class {
|
|
|
1004
1031
|
return;
|
|
1005
1032
|
}
|
|
1006
1033
|
}
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
pushNotifications: true,
|
|
1011
|
-
members: selectedUserIds,
|
|
1012
|
-
isGroup: true,
|
|
1013
|
-
conversationType: 1,
|
|
1014
|
-
conversationTitle,
|
|
1015
|
-
conversationImageUrl,
|
|
1016
|
-
searchableTags: [conversationTitle],
|
|
1017
|
-
};
|
|
1018
|
-
const members = selectedUserIds.map(id => {
|
|
1034
|
+
const trimmedImageUrl = conversationImageUrl.trim();
|
|
1035
|
+
const paramsForCreateConversation = Object.assign(Object.assign({ typingEvents: true, readEvents: true, pushNotifications: true, members: selectedUserIds, isGroup: true, conversationType: 1, conversationTitle }, (trimmedImageUrl ? { conversationImageUrl: trimmedImageUrl } : {})), { searchableTags: [conversationTitle] });
|
|
1036
|
+
const members = selectedUserIds.map((id) => {
|
|
1019
1037
|
const user = selectedUsers === null || selectedUsers === void 0 ? void 0 : selectedUsers.find((u) => (u === null || u === void 0 ? void 0 : u.userId) === id);
|
|
1020
1038
|
return {
|
|
1021
1039
|
newConversationTypingEvents: true,
|
|
@@ -1027,16 +1045,9 @@ const ChatSidebar = class {
|
|
|
1027
1045
|
userName: (user === null || user === void 0 ? void 0 : user.userName) || id,
|
|
1028
1046
|
};
|
|
1029
1047
|
});
|
|
1030
|
-
const paramsForCreateGroupCastConversation = {
|
|
1031
|
-
groupcastTitle: conversationTitle,
|
|
1032
|
-
groupcastImageUrl: conversationImageUrl,
|
|
1033
|
-
searchableTags: [conversationTitle],
|
|
1034
|
-
metaData: { description: 'groupcast created',
|
|
1048
|
+
const paramsForCreateGroupCastConversation = Object.assign(Object.assign({ groupcastTitle: conversationTitle }, (trimmedImageUrl ? { groupcastImageUrl: trimmedImageUrl } : {})), { searchableTags: [conversationTitle], metaData: { description: 'groupcast created',
|
|
1035
1049
|
members: selectedUsers
|
|
1036
|
-
},
|
|
1037
|
-
customType: 'groupcast',
|
|
1038
|
-
members,
|
|
1039
|
-
};
|
|
1050
|
+
}, customType: 'groupcast', members });
|
|
1040
1051
|
if (isGroupCast) {
|
|
1041
1052
|
const res = await groupcast.postGroupCast(paramsForCreateGroupCastConversation);
|
|
1042
1053
|
this.selectedConversationID = res.groupcastId;
|
|
@@ -1052,25 +1063,17 @@ const ChatSidebar = class {
|
|
|
1052
1063
|
}
|
|
1053
1064
|
else {
|
|
1054
1065
|
const res = await toast.M.getInstance().Conversation.postConversation(paramsForCreateConversation);
|
|
1055
|
-
const newConversation = {
|
|
1056
|
-
conversationId: res.conversationId,
|
|
1057
|
-
lastMessageDetails: {
|
|
1066
|
+
const newConversation = Object.assign(Object.assign({ conversationId: res.conversationId, lastMessageDetails: {
|
|
1058
1067
|
updatedAt: Date.now(),
|
|
1059
1068
|
body: '',
|
|
1060
|
-
},
|
|
1061
|
-
unreadMessagesCount: 0,
|
|
1062
|
-
isGroup: true,
|
|
1063
|
-
conversationTitle,
|
|
1064
|
-
conversationImageUrl,
|
|
1065
|
-
members: selectedUserIds,
|
|
1066
|
-
};
|
|
1069
|
+
}, unreadMessagesCount: 0, isGroup: true, conversationTitle }, (trimmedImageUrl ? { conversationImageUrl: trimmedImageUrl } : {})), { members: selectedUserIds });
|
|
1067
1070
|
this.conversationList = [newConversation, ...this.conversationList];
|
|
1068
1071
|
this.selectedConversationID = res.conversationId;
|
|
1069
1072
|
// Keep header avatar in sync immediately (details fetch can lag / omit image).
|
|
1070
1073
|
conversationStore.updateConversationDetails({
|
|
1071
1074
|
conversationId: res.conversationId,
|
|
1072
1075
|
conversationTitle,
|
|
1073
|
-
conversationImageUrl:
|
|
1076
|
+
conversationImageUrl: trimmedImageUrl || '',
|
|
1074
1077
|
isGroup: true,
|
|
1075
1078
|
});
|
|
1076
1079
|
const url = new URL(window.location.href);
|
|
@@ -1142,7 +1145,7 @@ const ChatSidebar = class {
|
|
|
1142
1145
|
try {
|
|
1143
1146
|
this.isLoading = true;
|
|
1144
1147
|
await toast.M.getInstance().Conversation.deleteConversationLeave({ conversationId });
|
|
1145
|
-
this.conversationList = this.conversationList.filter(conversation => conversation.conversationId !== conversationId);
|
|
1148
|
+
this.conversationList = this.conversationList.filter((conversation) => conversation.conversationId !== conversationId);
|
|
1146
1149
|
// this.sortConversations();
|
|
1147
1150
|
const url = new URL(window.location.href);
|
|
1148
1151
|
url.searchParams.delete('conversation');
|
|
@@ -1170,7 +1173,7 @@ const ChatSidebar = class {
|
|
|
1170
1173
|
handleMessageReadStatusUpdate(event) {
|
|
1171
1174
|
const { conversationId, isRead, isDelivered } = event.detail;
|
|
1172
1175
|
// Update the conversation list to reflect new read status
|
|
1173
|
-
this.conversationList = this.conversationList.map(conversation => {
|
|
1176
|
+
this.conversationList = this.conversationList.map((conversation) => {
|
|
1174
1177
|
if (conversation.conversationId === conversationId) {
|
|
1175
1178
|
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { readByAll: isRead, deliveredToAll: isDelivered }) });
|
|
1176
1179
|
}
|
|
@@ -1431,24 +1434,11 @@ const GroupCast = class {
|
|
|
1431
1434
|
userName: (user === null || user === void 0 ? void 0 : user.userName) || id,
|
|
1432
1435
|
};
|
|
1433
1436
|
});
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1436
|
-
groupcastImageUrl,
|
|
1437
|
-
searchableTags: [conversationTitle],
|
|
1438
|
-
metaData: { description: 'groupcast created', members: selectedUsers },
|
|
1439
|
-
customType: 'groupcast',
|
|
1440
|
-
members,
|
|
1441
|
-
});
|
|
1437
|
+
const trimmedGroupcastImage = (groupcastImageUrl || '').trim();
|
|
1438
|
+
const res = await groupcast.postGroupCast(Object.assign(Object.assign({ groupcastTitle: conversationTitle }, (trimmedGroupcastImage ? { groupcastImageUrl: trimmedGroupcastImage } : {})), { searchableTags: [conversationTitle], metaData: { description: 'groupcast created', members: selectedUsers }, customType: 'groupcast', members }));
|
|
1442
1439
|
this.closeCreate();
|
|
1443
1440
|
const groupcastId = res.groupcastId;
|
|
1444
|
-
const created = {
|
|
1445
|
-
groupcastId,
|
|
1446
|
-
groupcastTitle: conversationTitle,
|
|
1447
|
-
groupcastImageUrl,
|
|
1448
|
-
membersCount: members.length,
|
|
1449
|
-
createdAt: Date.now(),
|
|
1450
|
-
metaData: { description: 'groupcast created' },
|
|
1451
|
-
};
|
|
1441
|
+
const created = Object.assign(Object.assign({ groupcastId, groupcastTitle: conversationTitle }, (trimmedGroupcastImage ? { groupcastImageUrl: trimmedGroupcastImage } : {})), { membersCount: members.length, createdAt: Date.now(), metaData: { description: 'groupcast created' } });
|
|
1452
1442
|
(_a = this.onCreated) === null || _a === void 0 ? void 0 : _a.call(this, created);
|
|
1453
1443
|
const url = new URL(window.location.href);
|
|
1454
1444
|
url.search = '';
|
|
@@ -5523,6 +5513,8 @@ const ChatFooter = class {
|
|
|
5523
5513
|
// Prepare the message details
|
|
5524
5514
|
const messageDetails = {
|
|
5525
5515
|
body: localMessage.body,
|
|
5516
|
+
customType: localMessage.customType,
|
|
5517
|
+
metaData: localMessage.metaData,
|
|
5526
5518
|
updatedAt: localMessage.sentAt || Date.now(),
|
|
5527
5519
|
userName: (_a = this.userMetaData) === null || _a === void 0 ? void 0 : _a.userName,
|
|
5528
5520
|
userProfileImageUrl: ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userProfileImageUrl) || '',
|
|
@@ -5676,35 +5668,24 @@ const ChatFooter = class {
|
|
|
5676
5668
|
this.changeMessageSendingState(false);
|
|
5677
5669
|
return;
|
|
5678
5670
|
}
|
|
5679
|
-
const attachments =
|
|
5680
|
-
nameWithExtension: file.name,
|
|
5681
|
-
mediaType: file.type.startsWith('image/') ? 0 : file.type.startsWith('video/') ? 1 : file.type.startsWith('audio/') ? 2 : 3,
|
|
5682
|
-
mediaId: String(file.lastModified || Date.now()) + Math.random().toString(36).slice(2, 6),
|
|
5683
|
-
mimeType: file.type,
|
|
5684
|
-
size: file.size,
|
|
5685
|
-
file,
|
|
5686
|
-
}));
|
|
5671
|
+
const attachments = sendMedia.prepareMediaAttachments(files);
|
|
5687
5672
|
const localAttachments = this.mediaPreviews
|
|
5688
5673
|
.filter(p => files.includes(p.file))
|
|
5689
5674
|
.slice(0, sendMedia.MAX_MEDIA_PER_MESSAGE)
|
|
5690
|
-
.map(preview =>
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
? 'AttachmentMessage:Video'
|
|
5702
|
-
: files[0].type.startsWith('audio/')
|
|
5703
|
-
? 'AttachmentMessage:Audio'
|
|
5704
|
-
: 'AttachmentMessage:File'
|
|
5705
|
-
: sendMedia.ATTACHMENT_BODY_PLACEHOLDER;
|
|
5675
|
+
.map(preview => {
|
|
5676
|
+
const prepared = attachments.find(a => a.file === preview.file);
|
|
5677
|
+
return {
|
|
5678
|
+
name: preview.file.name,
|
|
5679
|
+
size: preview.file.size,
|
|
5680
|
+
type: preview.type,
|
|
5681
|
+
mediaUrl: preview.src,
|
|
5682
|
+
mimeType: (prepared === null || prepared === void 0 ? void 0 : prepared.mimeType) || preview.file.type,
|
|
5683
|
+
mediaType: prepared === null || prepared === void 0 ? void 0 : prepared.mediaType,
|
|
5684
|
+
};
|
|
5685
|
+
});
|
|
5706
5686
|
const caption = ((_a = this.messageBody) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
5707
|
-
const
|
|
5687
|
+
const customType = sendMedia.resolveCustomTypeForUpload(attachments);
|
|
5688
|
+
const localMessage = Object.assign(Object.assign({}, this.createLocalMessage(sendMedia.attachmentBodyForOutgoing(caption, attachments), localAttachments, messageId)), { customType, metaData: sendMedia.buildReplyMetaData(this.replyMessage, caption) });
|
|
5708
5689
|
try {
|
|
5709
5690
|
await this.updateConversationListOnMessageSend(localMessage);
|
|
5710
5691
|
}
|
|
@@ -5746,7 +5727,7 @@ const ChatFooter = class {
|
|
|
5746
5727
|
}
|
|
5747
5728
|
}
|
|
5748
5729
|
async uploadAndSendMedia(presignedUrls, attachments, conversationId, oldMessageId) {
|
|
5749
|
-
var _a, _b
|
|
5730
|
+
var _a, _b;
|
|
5750
5731
|
const allPayloads = [];
|
|
5751
5732
|
const uploadPromises = presignedUrls.map(async (urlDetails, index) => {
|
|
5752
5733
|
const attachmentPayload = attachments[index];
|
|
@@ -5758,28 +5739,15 @@ const ChatFooter = class {
|
|
|
5758
5739
|
const payload = await sendMedia.uploadPresignedMediaAttachment({
|
|
5759
5740
|
urlDetails: normalized,
|
|
5760
5741
|
attachment: attachmentPayload,
|
|
5742
|
+
// Groupcast uses a different presign API; the image fallback is conversation-only.
|
|
5743
|
+
conversationId: this.isGroupcast ? undefined : conversationId,
|
|
5761
5744
|
});
|
|
5762
5745
|
if (payload)
|
|
5763
5746
|
allPayloads.push(payload);
|
|
5764
5747
|
});
|
|
5765
5748
|
await Promise.all(uploadPromises);
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
if ((attachments === null || attachments === void 0 ? void 0 : attachments.length) === 1 && ((_a = attachments[0]) === null || _a === void 0 ? void 0 : _a.mimeType)) {
|
|
5769
|
-
if (attachments[0].mimeType.startsWith('image/')) {
|
|
5770
|
-
customType = 'AttachmentMessage:Image';
|
|
5771
|
-
}
|
|
5772
|
-
else if (attachments[0].mimeType.startsWith('video/')) {
|
|
5773
|
-
customType = 'AttachmentMessage:Video';
|
|
5774
|
-
}
|
|
5775
|
-
else if (attachments[0].mimeType.startsWith('audio/')) {
|
|
5776
|
-
customType = 'AttachmentMessage:Audio';
|
|
5777
|
-
}
|
|
5778
|
-
else if (attachments[0].mimeType.startsWith('application/')) {
|
|
5779
|
-
customType = 'AttachmentMessage:Doc';
|
|
5780
|
-
}
|
|
5781
|
-
}
|
|
5782
|
-
const caption = ((_b = this.messageBody) === null || _b === void 0 ? void 0 : _b.trim()) || '';
|
|
5749
|
+
const customType = sendMedia.resolveCustomTypeForUpload(attachments);
|
|
5750
|
+
const caption = ((_a = this.messageBody) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
5783
5751
|
const pushContext = localNotification.messagePushContextFrom({
|
|
5784
5752
|
userMetaData: this.userMetaData,
|
|
5785
5753
|
conversation: this.conversationDetails,
|
|
@@ -5787,11 +5755,11 @@ const ChatFooter = class {
|
|
|
5787
5755
|
let payload = localNotification.withHostMessagePushFields({
|
|
5788
5756
|
showInConversation: true,
|
|
5789
5757
|
messageType: this.replyMessage ? 2 : 0,
|
|
5790
|
-
parentMessageId: (
|
|
5758
|
+
parentMessageId: (_b = this.replyMessage) === null || _b === void 0 ? void 0 : _b.messageId,
|
|
5791
5759
|
encrypted: false,
|
|
5792
5760
|
conversationId,
|
|
5793
5761
|
// API rejects empty body; caption text or placeholder. Real caption also in metaData.caption
|
|
5794
|
-
body: sendMedia.
|
|
5762
|
+
body: sendMedia.attachmentBodyForOutgoing(caption, attachments),
|
|
5795
5763
|
customType: customType,
|
|
5796
5764
|
attachments: allPayloads,
|
|
5797
5765
|
deviceId: this.deviceId,
|
|
@@ -5863,7 +5831,7 @@ const ChatFooter = class {
|
|
|
5863
5831
|
const webChat = index$1.findWebChatHost(this.el);
|
|
5864
5832
|
const hasCustomReply = (webChat ? index$1.hasNamedSlot(webChat, 'reply-preview') : false) || index$1.hasNamedSlot(this.el, 'reply-preview');
|
|
5865
5833
|
const showAttachment = this.attachmentDetails || this.showCamera;
|
|
5866
|
-
return (index.h(index.Host, { key: '
|
|
5834
|
+
return (index.h(index.Host, { key: '6f5ee0cb4fa473754a4aec4c2bdbd25d81901b57', class: { 'attachment-open': !!showAttachment } }, index.h("div", { key: '822b4da560d9db469a068419bb4b30e47eb6241e', class: "chat-footer-container" }, showAttachment ? (index.h("slot", { name: "attachment-preview" }, index.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 }))) : (index.h(index.Fragment, null, hasCustomReply ? index.h("slot", { name: "reply-preview" }) : null, index.h("slot", { name: "composer-input" }, !hasCustomReply && this.replyMessage ? (index.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)
|
|
5867
5835
|
? 'You'
|
|
5868
5836
|
: (_f = (_e = this.replyMessage) === null || _e === void 0 ? void 0 : _e.senderInfo) === null || _f === void 0 ? void 0 : _f.userName, onIconClick: this.handleremoveReplyMessage })) : null, index.h("div", { class: "composer-wrap", key: this.inputKey, ref: el => (this.composerWrapRef = el) }, this.showEmojiPicker ? (index.h("div", { class: "emoji-panel", style: this.emojiPanelStyle }, index.h("div", { class: "emoji-panel-header" }, index.h("span", null, "Emoji"), index.h("button", { class: "emoji-panel-close", type: "button", "aria-label": "Close", onClick: this.handleEmojiToggle }, "\u00D7")), index.h("emoji-picker", { class: "emoji-picker light", ref: this.bindEmojiPicker }))) : null, index.h("div", { class: { composer: true, recording: this.isRecording } }, this.isRecording ? (index.h("div", { class: "rec-body" }, index.h("div", { class: "rec-left" }, index.h("button", { class: "rec-icon-btn danger", type: "button", title: "Delete recording", "aria-label": "Delete recording", onClick: this.handleRecDelete }, index.h("img", { class: "theme-icon", src: chatAssets.Delete, alt: "" })), index.h("div", { class: "rec-timer-wrap" }, index.h("span", { class: { 'rec-dot': true, live: !this.isPaused } }), index.h("span", { class: "rec-timer" }, this.formatRecTime(this.recordingSeconds)))), index.h("div", { class: "rec-wave" }, index.h("audio-bubble", { liveRecord: true, audioProgressColor: "#2563eb", audioWaveColor: "#2563eb", ref: el => (this.recBubble = el), onRecordingProgress: this.onRecordingProgress, onRecordingError: this.onRecordingError })), index.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 }, index.h("img", { class: "theme-icon", src: this.isPaused ? PlayIcon : PauseIcon, alt: "" })), index.h("button", { class: "rec-send", type: "button", title: "Send voice note", "aria-label": "Send voice note", onClick: this.handleRecSend }, index.h("img", { src: chatAssets.Send, alt: "" })))) : (index.h(index.Fragment, null, index.h("div", { class: "attach-wrap" }, index.h("button", { class: "icon-btn", type: "button", title: "Attach file", "aria-label": "Attach", onClick: this.handleAttachClick }, index.h("img", { src: chatAssets.Attachment, alt: "" })), this.showAttachMenu ? (index.h("div", { class: "attach-menu", style: this.attachMenuStyle }, index.h("button", { class: "attach-opt", type: "button", onClick: this.pickDocument }, index.h("span", { class: "attach-opt-icon attach-opt-icon--doc" }, index.h("img", { src: DocumentsIcon, alt: "" })), index.h("span", null, "Document")), index.h("button", { class: "attach-opt", type: "button", onClick: this.pickPhotos }, index.h("span", { class: "attach-opt-icon attach-opt-icon--photos" }, index.h("img", { class: "theme-icon", src: PhotosIcon, alt: "" })), index.h("span", null, "Photos & videos")), index.h("button", { class: "attach-opt", type: "button", onClick: this.pickCamera }, index.h("span", { class: "attach-opt-icon attach-opt-icon--camera" }, index.h("img", { class: "theme-icon", src: CameraIcon, alt: "" })), index.h("span", null, "Camera")))) : null), index.h("button", { class: "icon-btn", type: "button", title: "Emojis", "aria-label": "Emojis", onClick: this.handleEmojiToggle }, index.h("img", { src: chatAssets.Smile, alt: "" })), index.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 }), index.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 }), index.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() ? (index.h("button", { class: "icon-btn", type: "button", title: "Send", "aria-label": "Send", onClick: this.handleSendMessage }, index.h("img", { src: chatAssets.Send, alt: "" }))) : (index.h("button", { class: "icon-btn", type: "button", title: "Voice note", "aria-label": "Voice note", onClick: this.handleMicClick }, index.h("img", { src: chatAssets.Microphone, alt: "" })))))))))))));
|
|
5869
5837
|
}
|
|
@@ -7158,7 +7126,7 @@ const MessageInfo = class {
|
|
|
7158
7126
|
this.closePopup();
|
|
7159
7127
|
}
|
|
7160
7128
|
previewText() {
|
|
7161
|
-
var _a, _b, _c, _d;
|
|
7129
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7162
7130
|
if (this.messagePreviewText)
|
|
7163
7131
|
return this.messagePreviewText;
|
|
7164
7132
|
const msg = this.selectedMessage;
|
|
@@ -7173,9 +7141,14 @@ const MessageInfo = class {
|
|
|
7173
7141
|
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();
|
|
7174
7142
|
if (caption)
|
|
7175
7143
|
return caption;
|
|
7176
|
-
const body = (msg === null || msg === void 0 ? void 0 : msg.body)
|
|
7144
|
+
const body = String((_e = msg === null || msg === void 0 ? void 0 : msg.body) !== null && _e !== void 0 ? _e : '').trim();
|
|
7145
|
+
const customType = String((_f = msg === null || msg === void 0 ? void 0 : msg.customType) !== null && _f !== void 0 ? _f : '').trim();
|
|
7146
|
+
// Multiple: caption lives in metaData only; do not use body text
|
|
7147
|
+
if (body === sendMedia.ATTACHMENT_BODY_PLACEHOLDER || customType === sendMedia.ATTACHMENT_BODY_PLACEHOLDER) {
|
|
7148
|
+
return (atts === null || atts === void 0 ? void 0 : atts.length) ? 'Attachment' : '';
|
|
7149
|
+
}
|
|
7177
7150
|
// API stores placeholder in body for media; never show AttachmentMessage:* as caption
|
|
7178
|
-
if (
|
|
7151
|
+
if (body.startsWith('AttachmentMessage:'))
|
|
7179
7152
|
return (atts === null || atts === void 0 ? void 0 : atts.length) ? 'Attachment' : '';
|
|
7180
7153
|
return body || '';
|
|
7181
7154
|
}
|
|
@@ -7200,7 +7173,7 @@ const MessageInfo = class {
|
|
|
7200
7173
|
render() {
|
|
7201
7174
|
const delivery = this.deliveryUserList || [];
|
|
7202
7175
|
const read = this.readUserList || [];
|
|
7203
|
-
return (index.h("div", { key: '
|
|
7176
|
+
return (index.h("div", { key: 'fa2d0af32f2e8952250088796c79693f3ea16ee6', class: "panel" }, index.h("div", { key: '8920c819325fd9381d2cf8d32cd31984e2cafa05', class: "header" }, index.h("button", { key: 'da8db38ca8877a81f3575e28b4d6e36f47cb3524', class: "close-btn", type: "button", "aria-label": "Close", title: "Close", onClick: () => this.close() }, index.h("img", { key: '09c4ea9c4dab2b6b3513d66f28de8c15dd46c0fe', class: "theme-icon", src: cancel.CancelIcon, alt: "" })), index.h("h2", { key: 'a28b63038d6128c8c0031ffea17eaba0239e4f35' }, "Message info")), index.h("div", { key: 'fbe813bdadbfd7a85ac5c5bb4ea85fa43e9dd14e', class: "body" }, index.h("div", { key: 'e54922efa31352278b9a7cd529ef31467236a7d9', class: "preview-wrap" }, index.h("div", { key: '250bfb17a2106625fb8d164432e210e74194eae7', class: "preview-bubble" }, index.h("p", { key: '18c4d3e092d0dd3c6b1466965702f13e252e757a', class: "preview-text" }, this.previewText()), index.h("div", { key: '8f7c698b9ccc05a9503fe716df7de58e2f6212f3', class: "preview-meta" }, index.h("span", { key: '3cab794059faf27589faa12e414a1498ec28b4eb' }, this.bubbleTime())))), index.h("div", { key: '8d302fce732c358a4a48881526d4418040b7b075', class: "status-list" }, index.h("div", { key: 'bea8d64d0edd7b239b02403e64d1c971b0609e9a', class: "status-row" }, this.ticksIcon('read'), index.h("div", { key: '616cb6f9828076b07d6b7e136c31d734612a659a', class: "status-content" }, index.h("div", { key: '0020ec78e4dd0594ef00f41b05dbbf26c665812e', class: "status-title" }, "Read"), index.h("p", { key: '0e2ec57061db6c14bef07ccbaab01f7d4549bc85', class: "status-time" }, this.formatTime(this.messageReadTime)), read.map(u => (index.h("div", { class: "user-row" }, index.h("profile-avatar", { src: u.userProfileImageUrl || '', name: u.userName || '', size: "2rem" }), index.h("span", { class: "user-name" }, u.userName)))))), index.h("div", { key: '05c3fa8775ba465bc9c93dc119b38235c064ffe3', class: "status-row" }, this.ticksIcon('delivered'), index.h("div", { key: '983c73f19af4ad033bba1871033a8d6ea9b661e6', class: "status-content" }, index.h("div", { key: '188c573a98a4ee7b1b8271cf34d74e8f34f00a8e', class: "status-title" }, "Delivered"), index.h("p", { key: 'a57785ac963f72523b14b3ecfc1cbfd32e410d91', class: "status-time" }, this.formatTime(this.messageDeliveryTime)), delivery.map(u => (index.h("div", { class: "user-row" }, index.h("profile-avatar", { src: u.userProfileImageUrl || '', name: u.userName || '', size: "2rem" }), index.h("span", { class: "user-name" }, u.userName))))))))));
|
|
7204
7177
|
}
|
|
7205
7178
|
};
|
|
7206
7179
|
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); }";
|