@bcc-code/vue-bcc-chat-ui 1.2.10 → 1.2.12

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.
@@ -5,6 +5,7 @@ export interface UserChatInfo {
5
5
  name: string;
6
6
  unreadMessageCount: number;
7
7
  lastMessage: MessageInfo;
8
+ membersCount: number;
8
9
  tags: string[];
9
10
  }
10
11
  export interface MessageInfo {
@@ -16,11 +17,13 @@ export interface MessageInfo {
16
17
  export declare const userChats: Ref<UserChatInfo[]>;
17
18
  export declare const getGroup: (groupUid: string) => Promise<Group>;
18
19
  export declare const clearGroupChatCount: (groupUid: string) => Promise<void>;
20
+ export declare const getGroupOnlineCount: (groupUid: string) => Promise<Object | 0>;
19
21
  export declare const getUserChats: () => Promise<Ref<UserChatInfo[]>> | undefined;
20
22
  declare const _default: {
21
23
  getGroup: (groupUid: string) => Promise<Group>;
22
24
  userChats: Ref<UserChatInfo[]>;
23
25
  getUserChats: () => Promise<Ref<UserChatInfo[]>> | undefined;
24
26
  clearGroupChatCount: (groupUid: string) => Promise<void>;
27
+ getGroupOnlineCount: (groupUid: string) => Promise<Object | 0>;
25
28
  };
26
29
  export default _default;
@@ -42,6 +42,7 @@ declare const _default: {
42
42
  userChats: Ref<import("./data").UserChatInfo[]>;
43
43
  getUserChats: () => Promise<Ref<import("./data").UserChatInfo[]>> | undefined;
44
44
  clearGroupChatCount: (groupUid: string) => Promise<void>;
45
+ getGroupOnlineCount: (groupUid: string) => Promise<Object | 0>;
45
46
  };
46
47
  };
47
48
  export default _default;
@@ -70584,36 +70584,44 @@ let _u = {};
70584
70584
  const wi = ae([]), j$e = async (e) => (_u[e] || (_u[e] = await X.CometChat.getGroup(e)), _u[e]), z$e = async (e) => {
70585
70585
  const t = wi.value.find((n) => n.chatUid === e);
70586
70586
  t && (t.unreadMessageCount = 0, Dve(wi));
70587
+ }, P$e = async (e) => {
70588
+ try {
70589
+ return await X.CometChat.getOnlineGroupMemberCount([e]);
70590
+ } catch (t) {
70591
+ return console.log("Online group member count fetching failed with error:", t), 0;
70592
+ }
70587
70593
  };
70588
70594
  let _T;
70589
- const P$e = U$e(() => {
70590
- _T = Y$e();
70595
+ const B$e = U$e(() => {
70596
+ _T = F$e();
70591
70597
  }, 1e3, {
70592
70598
  leading: !0,
70593
70599
  trailing: !0
70594
- }), B$e = () => (P$e(), _T), G$e = {
70600
+ }), G$e = () => (B$e(), _T), Y$e = {
70595
70601
  getGroup: j$e,
70596
70602
  userChats: wi,
70597
- getUserChats: B$e,
70598
- clearGroupChatCount: z$e
70603
+ getUserChats: G$e,
70604
+ clearGroupChatCount: z$e,
70605
+ getGroupOnlineCount: P$e
70599
70606
  };
70600
- async function Y$e() {
70607
+ async function F$e() {
70601
70608
  try {
70602
- let t = new X.CometChat.ConversationsRequestBuilder().setLimit(100).withTags(!0).setConversationType("group").build(), n = [], o = [];
70609
+ let t = new X.CometChat.ConversationsRequestBuilder().setLimit(50).withTags(!0).setConversationType("group").build(), n = [], o = [];
70603
70610
  do
70604
70611
  o = await t.fetchNext(), n = n.concat(o);
70605
- while (o.length == 100);
70612
+ while (o.length == 50);
70606
70613
  const a = n.map((s) => {
70607
- const i = s.getLastMessage(), d = s.getUnreadMessageCount(), u = i.getType();
70614
+ const i = s.getLastMessage(), d = s.getUnreadMessageCount(), u = i.getType(), l = s.getConversationWith();
70608
70615
  return {
70609
70616
  chatUid: s.getConversationId().split("_")[1],
70610
- name: s.getConversationWith().getName(),
70617
+ name: l.getName(),
70611
70618
  lastMessage: {
70612
70619
  text: u === X.CometChat.MESSAGE_TYPE.TEXT ? i.getText() : u === X.CometChat.MESSAGE_TYPE.IMAGE || u === X.CometChat.MESSAGE_TYPE.VIDEO || u === X.CometChat.MESSAGE_TYPE.AUDIO || u === X.CometChat.MESSAGE_TYPE.FILE ? i.getAttachment().getName() : "",
70613
70620
  type: i ? i.getType() : "",
70614
70621
  senderName: i ? i.getSender().getName() : "",
70615
70622
  sentAt: new Date(i ? i.getSentAt() * 1e3 : 0)
70616
70623
  },
70624
+ membersCount: l.getMembersCount(),
70617
70625
  tags: s.getTags(),
70618
70626
  unreadMessageCount: isNaN(d) ? 0 : d
70619
70627
  };
@@ -70695,26 +70703,26 @@ const Ri = ae(new c.CometChatTheme({
70695
70703
  Ri.value.palette.setMode(e);
70696
70704
  }, LT = () => {
70697
70705
  Ri.value.palette.mode == "dark" ? Ri.value.palette.setMode("light") : Ri.value.palette.setMode("dark");
70698
- }, F$e = (e, t) => {
70706
+ }, $$e = (e, t) => {
70699
70707
  OT(t.mode), e.provide("theme", { theme: Ri, switchThemeMode: LT });
70700
70708
  }, fT = {
70701
- install: F$e,
70709
+ install: $$e,
70702
70710
  switchThemeMode: LT,
70703
70711
  setThemeMode: OT,
70704
70712
  theme: Ri
70705
- }, $$e = async (e, t) => {
70713
+ }, V$e = async (e, t) => {
70706
70714
  e.use(Fp, t.environment), await u$e.init(), e.use(Gp), e.use(fT, { mode: t.themeMode }), t.accessToken && (typeof t.accessToken == "string" ? oh.accessToken.value = t.accessToken : t.accessToken.value && (oh.accessToken = t.accessToken));
70707
70715
  }, Ya = {
70708
- install: $$e,
70716
+ install: V$e,
70709
70717
  environment: Fp,
70710
70718
  theme: fT,
70711
70719
  mobileView: Gp,
70712
70720
  connection: oh,
70713
- data: G$e
70714
- }, V$e = {
70721
+ data: Y$e
70722
+ }, H$e = {
70715
70723
  key: 0,
70716
70724
  class: "bcc-chat-message-list"
70717
- }, nHe = /* @__PURE__ */ Ht({
70725
+ }, oHe = /* @__PURE__ */ Ht({
70718
70726
  __name: "BccChatMessageList",
70719
70727
  props: {
70720
70728
  chatUid: { type: String, required: !0 }
@@ -70764,7 +70772,7 @@ const Ri = ae(new c.CometChatTheme({
70764
70772
  templates: g
70765
70773
  });
70766
70774
  }
70767
- return (g, M) => o.value ? (w(), B("div", V$e, [
70775
+ return (g, M) => o.value ? (w(), B("div", H$e, [
70768
70776
  o.value ? (w(), gt(NC(Bl), {
70769
70777
  key: 0,
70770
70778
  hideMessageHeader: !0,
@@ -70779,6 +70787,6 @@ const Ri = ae(new c.CometChatTheme({
70779
70787
  }
70780
70788
  });
70781
70789
  export {
70782
- nHe as BccChatMessageList,
70790
+ oHe as BccChatMessageList,
70783
70791
  Ya as chat
70784
70792
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@bcc-code/vue-bcc-chat-ui",
3
3
  "author": "bcc-code",
4
4
  "license": "Apache-2.0",
5
- "version": "1.2.10",
5
+ "version": "1.2.12",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [