@bcc-code/vue-bcc-chat-ui 7.1.15 → 7.1.17
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/index.d.ts +1 -0
- package/dist/vue-bcc-chat-ui.js +20 -15
- package/dist/vue-bcc-chat-ui.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -322,6 +322,7 @@ export declare interface ChatConversationItem {
|
|
|
322
322
|
tags: string[];
|
|
323
323
|
memberCount?: number;
|
|
324
324
|
source?: Conversation | null;
|
|
325
|
+
lastMessage?: ChatMessageItem | null;
|
|
325
326
|
}
|
|
326
327
|
|
|
327
328
|
export declare type ChatDeliveryState = "sent" | "queued" | "sending" | "failed";
|
package/dist/vue-bcc-chat-ui.js
CHANGED
|
@@ -4307,7 +4307,7 @@ function cc({ environment: e }) {
|
|
|
4307
4307
|
let r = new Map(v.value.map((e) => [e.id, e]));
|
|
4308
4308
|
for (let e of t) {
|
|
4309
4309
|
let t = r.get(e.id);
|
|
4310
|
-
t && (e.subtitle === "No messages yet" && t.subtitle && t.subtitle !== "No messages yet" && (e.subtitle = t.subtitle), !e.lastMessageAt && t.lastMessageAt && (e.lastMessageAt = t.lastMessageAt));
|
|
4310
|
+
t && (e.subtitle === "No messages yet" && t.subtitle && t.subtitle !== "No messages yet" && (e.subtitle = t.subtitle), !e.lastMessageAt && t.lastMessageAt && (e.lastMessageAt = t.lastMessageAt), !e.lastMessage && t.lastMessage && (e.lastMessage = t.lastMessage));
|
|
4311
4311
|
}
|
|
4312
4312
|
v.value = bc(await pt(t)), V?.setConversations(v.value), P.value && await nt();
|
|
4313
4313
|
} catch (e) {
|
|
@@ -4707,6 +4707,7 @@ function cc({ environment: e }) {
|
|
|
4707
4707
|
try {
|
|
4708
4708
|
await tt({ reset: !0 }), v.value = v.value.map((t) => t.id === e.id ? {
|
|
4709
4709
|
...t,
|
|
4710
|
+
lastMessage: y.value.at(-1) ?? null,
|
|
4710
4711
|
unreadCount: 0
|
|
4711
4712
|
} : t), V?.setConversations(v.value);
|
|
4712
4713
|
} catch (n) {
|
|
@@ -4904,7 +4905,8 @@ function cc({ environment: e }) {
|
|
|
4904
4905
|
...r,
|
|
4905
4906
|
subtitle: Zs(t),
|
|
4906
4907
|
lastMessageAt: /* @__PURE__ */ new Date((e.getSentAt?.() ?? 0) * 1e3),
|
|
4907
|
-
unreadCount: n === T.value ? 0 : r.unreadCount + 1
|
|
4908
|
+
unreadCount: n === T.value ? 0 : r.unreadCount + 1,
|
|
4909
|
+
lastMessage: t
|
|
4908
4910
|
};
|
|
4909
4911
|
v.value = bc(v.value.map((e) => e.id === n ? i : e)), V?.setConversations(v.value);
|
|
4910
4912
|
}
|
|
@@ -5013,7 +5015,8 @@ function cc({ environment: e }) {
|
|
|
5013
5015
|
v.value = bc(v.value.map((e) => e.id === t ? o ? {
|
|
5014
5016
|
...e,
|
|
5015
5017
|
subtitle: Oc(o),
|
|
5016
|
-
lastMessageAt: o.sentAt
|
|
5018
|
+
lastMessageAt: o.sentAt,
|
|
5019
|
+
lastMessage: o
|
|
5017
5020
|
} : a ? {
|
|
5018
5021
|
...e,
|
|
5019
5022
|
subtitle: "No messages yet",
|
|
@@ -5025,7 +5028,8 @@ function cc({ environment: e }) {
|
|
|
5025
5028
|
v.value = bc(v.value.map((t) => t.id === e ? {
|
|
5026
5029
|
...t,
|
|
5027
5030
|
subtitle: r ? Oc(r) : "No messages yet",
|
|
5028
|
-
lastMessageAt: r?.sentAt
|
|
5031
|
+
lastMessageAt: r?.sentAt,
|
|
5032
|
+
lastMessage: r
|
|
5029
5033
|
} : t)), V?.setConversations(v.value);
|
|
5030
5034
|
}
|
|
5031
5035
|
function Mt(e) {
|
|
@@ -5033,6 +5037,7 @@ function cc({ environment: e }) {
|
|
|
5033
5037
|
...t,
|
|
5034
5038
|
subtitle: Oc(e),
|
|
5035
5039
|
lastMessageAt: e.sentAt,
|
|
5040
|
+
lastMessage: e,
|
|
5036
5041
|
unreadCount: 0
|
|
5037
5042
|
} : t)), V?.setConversations(v.value);
|
|
5038
5043
|
}
|
|
@@ -6044,18 +6049,18 @@ async function Wl(e) {
|
|
|
6044
6049
|
}
|
|
6045
6050
|
}
|
|
6046
6051
|
async function Gl(e, t) {
|
|
6047
|
-
let n = e.source?.getLastMessage?.();
|
|
6048
|
-
if (!n) return;
|
|
6049
|
-
let
|
|
6050
|
-
return
|
|
6052
|
+
let n = e.lastMessage, r = n ? void 0 : e.source?.getLastMessage?.();
|
|
6053
|
+
if (!(r || n)) return;
|
|
6054
|
+
let i = n?.senderId ?? r?.getSender?.()?.getUid?.() ?? "", a = String(n?.id ?? r?.getId?.() ?? ""), o = !!(t && i && t === i && a);
|
|
6055
|
+
return o && a && Il.value[a] === void 0 && !Ll.has(a) && await Wl(a), {
|
|
6051
6056
|
text: e.subtitle,
|
|
6052
|
-
type: n
|
|
6053
|
-
senderUid:
|
|
6054
|
-
senderName: n
|
|
6055
|
-
sentAt: /* @__PURE__ */ new Date((
|
|
6056
|
-
sentByCurrentUser:
|
|
6057
|
-
readAt:
|
|
6058
|
-
messageReceipts:
|
|
6057
|
+
type: n?.type ?? r?.getType?.() ?? "text",
|
|
6058
|
+
senderUid: i,
|
|
6059
|
+
senderName: n?.senderName ?? r?.getSender?.()?.getName?.() ?? "System",
|
|
6060
|
+
sentAt: n?.sentAt ?? /* @__PURE__ */ new Date((r?.getSentAt?.() ?? 0) * 1e3),
|
|
6061
|
+
sentByCurrentUser: o,
|
|
6062
|
+
readAt: r?.getReadAt?.() ? /* @__PURE__ */ new Date(r.getReadAt() * 1e3) : void 0,
|
|
6063
|
+
messageReceipts: o ? Il.value[a] : void 0
|
|
6059
6064
|
};
|
|
6060
6065
|
}
|
|
6061
6066
|
var Kl = n(() => Q.value?.connected.value ?? !1), ql = n(() => kl.value && !Kl.value), Jl = n(() => Q.value?.loggedIn.value ?? !1), Yl = {
|