isometrik-plugin-chat-sdk 1.3.18 → 1.3.19
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/login-page_3.cjs.entry.js +19 -7
- package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/mqtt-host.js +19 -7
- package/dist/collection/components/my-component/web-chat/mqtt-host.js.map +1 -1
- package/dist/components/WebChat.js +19 -7
- package/dist/components/WebChat.js.map +1 -1
- package/dist/esm/login-page_3.entry.js +19 -7
- package/dist/esm/login-page_3.entry.js.map +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
- package/dist/isometrik-webchat/p-0f9c3f95.entry.js +2 -0
- package/dist/isometrik-webchat/p-0f9c3f95.entry.js.map +1 -0
- package/dist/types/components/my-component/web-chat/mqtt-host.d.ts +8 -0
- package/package.json +1 -1
- package/readme.md +3 -3
- package/dist/isometrik-webchat/p-09fc122b.entry.js +0 -2
- package/dist/isometrik-webchat/p-09fc122b.entry.js.map +0 -1
|
@@ -1576,8 +1576,19 @@ function createMqttContext(host) {
|
|
|
1576
1576
|
function hostAppendInboundMessage(host, parsedMessage) {
|
|
1577
1577
|
host.allMessages = appendUniqueById(host.allMessages, parsedMessage);
|
|
1578
1578
|
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Build MQTT dispatch context from the live <web-chat> host.
|
|
1581
|
+
*
|
|
1582
|
+
* Do NOT `{...host}` / `Object.assign({}, host)` — Stencil `@State` (e.g.
|
|
1583
|
+
* `allConversationList`) lives behind prototype getters. A plain snapshot
|
|
1584
|
+
* drops them → `undefined.some` on `chatMessageSent` and realtime dies
|
|
1585
|
+
* even though MQTT is connected.
|
|
1586
|
+
*/
|
|
1579
1587
|
function hostCreateMqttContext(host) {
|
|
1580
|
-
return createMqttContext(Object.assign(
|
|
1588
|
+
return createMqttContext(Object.assign(host, {
|
|
1589
|
+
handleForwardMessage: (msg) => hostHandleForwardMessage(host, msg),
|
|
1590
|
+
appendInboundMessage: (msg) => hostAppendInboundMessage(host, msg),
|
|
1591
|
+
}));
|
|
1581
1592
|
}
|
|
1582
1593
|
async function hostHandleMqttMessage(host, message) {
|
|
1583
1594
|
const parsedMessage = parseMqttPayload(message);
|
|
@@ -1657,9 +1668,10 @@ async function hostSetupMqttClient(host) {
|
|
|
1657
1668
|
});
|
|
1658
1669
|
}
|
|
1659
1670
|
async function hostHandleForwardMessage(host, parsedMessage) {
|
|
1660
|
-
var _a, _b;
|
|
1671
|
+
var _a, _b, _c;
|
|
1661
1672
|
try {
|
|
1662
|
-
const
|
|
1673
|
+
const list = (_a = host.allConversationList) !== null && _a !== void 0 ? _a : [];
|
|
1674
|
+
const conversationExists = list.some((conversation) => conversation.conversationId === parsedMessage.conversationId);
|
|
1663
1675
|
if (!conversationExists) {
|
|
1664
1676
|
const conversationDetails = await host.getUserConversationDetails(parsedMessage.conversationId);
|
|
1665
1677
|
const newConversation = {
|
|
@@ -1667,19 +1679,19 @@ async function hostHandleForwardMessage(host, parsedMessage) {
|
|
|
1667
1679
|
lastMessageDetails: {
|
|
1668
1680
|
body: parsedMessage.body,
|
|
1669
1681
|
updatedAt: parsedMessage.updatedAt || Date.now(),
|
|
1670
|
-
userName: (
|
|
1671
|
-
userProfileImageUrl: (
|
|
1682
|
+
userName: (_b = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.opponentDetails) === null || _b === void 0 ? void 0 : _b.userName,
|
|
1683
|
+
userProfileImageUrl: (_c = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.opponentDetails) === null || _c === void 0 ? void 0 : _c.userProfileImageUrl,
|
|
1672
1684
|
},
|
|
1673
1685
|
unreadMessagesCount: 0,
|
|
1674
1686
|
};
|
|
1675
1687
|
host.allConversationList = host.sortConversationsByLatestMessage([
|
|
1676
1688
|
newConversation,
|
|
1677
|
-
...
|
|
1689
|
+
...list,
|
|
1678
1690
|
]);
|
|
1679
1691
|
await host.getAllAttachments(newConversation.conversationId);
|
|
1680
1692
|
}
|
|
1681
1693
|
else {
|
|
1682
|
-
host.allConversationList = host.sortConversationsByLatestMessage(
|
|
1694
|
+
host.allConversationList = host.sortConversationsByLatestMessage(list.map((conversation) => {
|
|
1683
1695
|
if (conversation.conversationId === parsedMessage.conversationId) {
|
|
1684
1696
|
return Object.assign(Object.assign({}, conversation), { lastMessageDetails: Object.assign(Object.assign({}, conversation.lastMessageDetails), { body: parsedMessage.body, updatedAt: parsedMessage.updatedAt || Date.now() }), isGroup: conversation.isGroup, conversationTitle: conversation.conversationTitle, conversationImageUrl: conversation.conversationImageUrl, opponentDetails: conversation.opponentDetails });
|
|
1685
1697
|
}
|