@medipha/chat 1.0.18 → 1.0.20

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.
@@ -4,10 +4,14 @@ interface UserProfileModalProps {
4
4
  onClose: () => void;
5
5
  /** Opens (or reuses) a direct conversation with this user. */
6
6
  onStartChat?: (userId: string) => void;
7
+ /** Badges the avatar with the owner key — set when this dialog was opened from a group
8
+ * whose owner this user is. It's a per-conversation role, not a property of the account,
9
+ * so it can only come from the caller that knows which group we came from. */
10
+ isGroupOwner?: boolean;
7
11
  }
8
12
  /** Zalo-style "Thông tin tài khoản" dialog, opened from a user avatar click: avatar on
9
13
  * top, then contact details (họ tên, ngày sinh, email, số điện thoại) and a second
10
14
  * group with the directory info (chi nhánh, phòng ban, chức vụ). Portals to body with
11
15
  * the layered mask so it stacks above the member-list modal it may be opened from. */
12
- export declare function UserProfileModal({ userId, fallbackName, onClose, onStartChat }: UserProfileModalProps): import('react').ReactPortal;
16
+ export declare function UserProfileModal({ userId, fallbackName, onClose, onStartChat, isGroupOwner, }: UserProfileModalProps): import('react').ReactPortal;
13
17
  export {};
@@ -2,28 +2,14 @@ import { JSONContent } from '@tiptap/core';
2
2
  type DraftMap = Record<string, JSONContent>;
3
3
  interface DraftState {
4
4
  draftByConversation: DraftMap;
5
- /** Stores (or, with `null`, discards) the unsent composer content for one conversation. */
6
5
  setDraft: (conversationId: string, doc: JSONContent | null) => void;
7
6
  }
8
- /** Flattens a draft doc to the one-line plain text the sidebar row previews. Mention nodes
9
- * carry their display name in attrs rather than as a text child, so they need their own
10
- * branch or an "@ai đó" draft would preview as an empty string. */
7
+ /** Flattens a draft doc to the one-line plain text the sidebar row previews. */
11
8
  export declare function getDraftText(doc: JSONContent | undefined): string;
12
- /** Writes the pending draft snapshot out immediately call before the tab goes away, or
13
- * before handing the store over to a different account. */
9
+ /** Writes the pending snapshot out now, skipping the debounce. */
14
10
  export declare function flushDrafts(): void;
15
- /**
16
- * Points the store at one account's drafts: flushes whatever the previous account still had
17
- * pending, then loads that user's own set. Called once the session's user id is known (see
18
- * ChatBootstrap) — signing in as someone else on the same browser therefore swaps the whole
19
- * map rather than leaking the first account's unsent text into the second's sidebar.
20
- */
11
+ /** Swaps the loaded draft set to another account, flushing the previous one first. */
21
12
  export declare function setDraftUser(userId: string | null): void;
22
- /**
23
- * Unsent composer content, kept per conversation so switching threads (or reloading) and
24
- * coming back restores what was being typed — Zalo/Messenger behaviour. Scoped to the
25
- * signed-in user and mirrored to localStorage; a draft is dropped the moment its message is
26
- * actually sent.
27
- */
13
+ /** Unsent composer content per conversation, scoped to the signed-in user. */
28
14
  export declare const useDraftStore: import('zustand').UseBoundStore<import('zustand').StoreApi<DraftState>>;
29
15
  export {};
@@ -0,0 +1,21 @@
1
+ interface Removal {
2
+ conversationId: string;
3
+ messageId: string;
4
+ /** Monotonic, so re-notifying the same message id still registers as a new event. */
5
+ token: number;
6
+ }
7
+ interface MessageRemovalState {
8
+ lastRemoval: Removal | null;
9
+ noteRemoval: (conversationId: string, messageId: string) => void;
10
+ }
11
+ /**
12
+ * Broadcasts "a message was just removed" to views outside the timeline (the archive, the
13
+ * settings media/file preview) so they can refetch.
14
+ *
15
+ * They can't rely on the `message:removed` socket event alone: a recall is issued over REST
16
+ * and applied locally from that response, so the person doing the recall may never see the
17
+ * broadcast. This store is written from the one place that handles both paths
18
+ * (applyRemovedMessage in conversation-detail).
19
+ */
20
+ export declare const useMessageRemovalStore: import('zustand').UseBoundStore<import('zustand').StoreApi<MessageRemovalState>>;
21
+ export {};
@@ -1,13 +1,10 @@
1
1
  interface TypingState {
2
2
  /** conversationId -> display names currently typing there, most recent first. */
3
3
  namesByConversation: Record<string, string[]>;
4
- /** Replaces the typer list for one conversation; an empty list drops the key entirely. */
5
4
  setTypingNames: (conversationId: string, names: string[]) => void;
6
5
  clearConversation: (conversationId: string) => void;
7
6
  }
8
- /** Mirrors the open conversation's typing state so the sidebar row can show "Đang nhập..."
9
- * the same way Zalo/Messenger do. It is fed by useTypingIndicator (the single owner of the
10
- * typing timers) rather than by its own socket subscription — which also means it only
11
- * ever covers the conversation currently open, since the socket joins that room alone. */
7
+ /** Typing state of the open conversation, mirrored here so its sidebar row can show it.
8
+ * Fed by useTypingIndicator (which owns the typing timers), not its own subscription. */
12
9
  export declare const useTypingStore: import('zustand').UseBoundStore<import('zustand').StoreApi<TypingState>>;
13
10
  export {};