@bcc-code/vue-bcc-chat-ui 7.1.20 → 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
@@ -14,6 +14,12 @@ import { WritableComputedRef } from 'vue';
14
14
 
15
15
  declare const __VLS_base: DefineComponent<__VLS_Props, {
16
16
  scrollToMessage: typeof scrollToMessage_2;
17
+ groupMembers: ComputedRef<{
18
+ uid: string;
19
+ displayName: string;
20
+ avatar: string;
21
+ role: string;
22
+ }[]>;
17
23
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
18
24
  chatMembersFetched: (members: ParticipantInfo[]) => any;
19
25
  chatEmpty: () => any;
@@ -519,7 +525,7 @@ declare function getChatOnlineCount(chatUid: string): Promise<number>;
519
525
 
520
526
  declare function getCurrentEnvironment(): ChatEnvironmentConfig;
521
527
 
522
- declare function getGroup(groupUid: string): Promise<unknown | null | undefined>;
528
+ declare function getGroup(groupUid: string): Promise<Group | null | undefined>;
523
529
 
524
530
  declare function getMessageTextPreview(message?: any, showEmoji?: boolean, showAttachmentName?: boolean): string;
525
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,22 +9784,43 @@ 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
- return o({ scrollToMessage: H }), (n, o) => (S(), a("div", {
9820
+ return o({
9821
+ scrollToMessage: ce,
9822
+ groupMembers: n(() => A.value)
9823
+ }), (n, o) => (S(), a("div", {
9803
9824
  ref_key: "chatRootRef",
9804
9825
  ref: v,
9805
9826
  class: "text-default relative h-full min-h-104"
@@ -9821,7 +9842,7 @@ var uf = { class: "w-full" }, df = {
9821
9842
  "show-header": L.value,
9822
9843
  "action-message-class": t.actionMessageClass,
9823
9844
  "action-message-row-class": t.actionMessageRowClass,
9824
- onAnchorclick: V
9845
+ onAnchorclick: se
9825
9846
  }, s({
9826
9847
  composer: I(() => [l(Zd, {
9827
9848
  ref_key: "mainComposerRef",