@bcc-code/vue-bcc-chat-ui 7.1.21 → 7.1.22

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 CHANGED
@@ -525,7 +525,7 @@ declare function getChatOnlineCount(chatUid: string): Promise<number>;
525
525
 
526
526
  declare function getCurrentEnvironment(): ChatEnvironmentConfig;
527
527
 
528
- declare function getGroup(groupUid: string): Promise<unknown | null | undefined>;
528
+ declare function getGroup(groupUid: string): Promise<Group | null | undefined>;
529
529
 
530
530
  declare function getMessageTextPreview(message?: any, showEmoji?: boolean, showAttachmentName?: boolean): string;
531
531
 
@@ -9774,7 +9774,7 @@ var uf = { class: "w-full" }, df = {
9774
9774
  try {
9775
9775
  e.conversations.value.length === 0 && await e.fetchConversations();
9776
9776
  let t = e.conversations.value.find((e) => e.targetId === p.chatUid || e.id === p.chatUid) ?? null;
9777
- if (!t) {
9777
+ if (t ||= await V(p.chatUid, e), !t) {
9778
9778
  x.value = !0, m("chatMembersFetched", []);
9779
9779
  return;
9780
9780
  }
@@ -9784,23 +9784,41 @@ var uf = { class: "w-full" }, df = {
9784
9784
  }
9785
9785
  }
9786
9786
  }
9787
- function V(e, t) {
9787
+ async function V(e, t) {
9788
+ let n = await gu.getGroup(e);
9789
+ if (!n || typeof n != "object") return null;
9790
+ let r = String(n.getGuid());
9791
+ if (!r) return null;
9792
+ let i = {
9793
+ id: `group_${r}`,
9794
+ targetId: r,
9795
+ type: "group",
9796
+ title: String(n.getName() ?? r),
9797
+ subtitle: "No messages yet",
9798
+ unreadCount: 0,
9799
+ tags: (n.getTags() ?? []).map((e) => String(e)),
9800
+ memberCount: Math.max((Number(n.getMembersCount()) || 1) - 1, 0),
9801
+ source: { getConversationWith: () => n }
9802
+ };
9803
+ return t.conversations.value = [i, ...t.conversations.value.filter((e) => e.id !== i.id && e.targetId !== r)], i;
9804
+ }
9805
+ function se(e, t) {
9788
9806
  m("linkClicked", e, t);
9789
9807
  }
9790
- let se = w(!1);
9808
+ let H = w(!1);
9791
9809
  b(() => {
9792
9810
  setTimeout(() => {
9793
- se.value = !0;
9811
+ H.value = !0;
9794
9812
  }, 200);
9795
9813
  }), y(() => {
9796
9814
  let e = T.value;
9797
9815
  e && e.activeConversation.value === O.value && e.selectConversation(null);
9798
9816
  });
9799
- async function H(e) {
9800
- return await new Promise((e) => setTimeout(e, 100)), se.value ? ie(e) : (await new Promise((e) => setTimeout(e, 110)), H(e));
9817
+ async function ce(e) {
9818
+ return await new Promise((e) => setTimeout(e, 100)), H.value ? ie(e) : (await new Promise((e) => setTimeout(e, 110)), ce(e));
9801
9819
  }
9802
9820
  return o({
9803
- scrollToMessage: H,
9821
+ scrollToMessage: ce,
9804
9822
  groupMembers: n(() => A.value)
9805
9823
  }), (n, o) => (S(), a("div", {
9806
9824
  ref_key: "chatRootRef",
@@ -9824,7 +9842,7 @@ var uf = { class: "w-full" }, df = {
9824
9842
  "show-header": L.value,
9825
9843
  "action-message-class": t.actionMessageClass,
9826
9844
  "action-message-row-class": t.actionMessageRowClass,
9827
- onAnchorclick: V
9845
+ onAnchorclick: se
9828
9846
  }, s({
9829
9847
  composer: I(() => [l(Zd, {
9830
9848
  ref_key: "mainComposerRef",