@ethora/chat-component 26.7.5 → 26.7.6

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.
Files changed (151) hide show
  1. package/README.md +72 -16
  2. package/dist/ChatProfileModal-hxsWI8cx.js +2139 -0
  3. package/dist/FilePreviewModal-CwWnHsB1.js +736 -0
  4. package/dist/ManageDataModal-CDPXcC93.js +159 -0
  5. package/dist/MarkdownBody-DBJGraWM.js +16874 -0
  6. package/dist/SideDrawer-Dr_lkaOW.js +226 -0
  7. package/dist/UserProfileModal-Q_jhXpsX.js +568 -0
  8. package/dist/UserSettingsModal-OcAJao-d.js +50 -0
  9. package/dist/{VideoCallOverlay-C4M2I9oV.js → VideoCallOverlay-CC4sShdK.js} +9 -10
  10. package/dist/VisibilityModal-DkMhx_2k.js +132 -0
  11. package/dist/assets/icons.d.ts +30 -0
  12. package/dist/components/ContextMenu/ContextMenuComponents.d.ts +1 -3
  13. package/dist/components/EmojiPicker/LazyEmojiPicker.d.ts +3 -0
  14. package/dist/components/ExampleComponents/CustomMessage.d.ts +3 -3
  15. package/dist/components/Files/FilesList.d.ts +12 -0
  16. package/dist/components/Files/FilesPanel.d.ts +3 -0
  17. package/dist/components/Files/fileCategory.d.ts +13 -0
  18. package/dist/components/InputComponents/AttachmentPreview.d.ts +17 -0
  19. package/dist/components/InputComponents/MentionDropdown.d.ts +13 -0
  20. package/dist/components/InputComponents/MentionPickerModal.d.ts +19 -0
  21. package/dist/components/MainComponents/AttachmentList.d.ts +7 -0
  22. package/dist/components/MainComponents/ChatErrorBoundary.d.ts +53 -0
  23. package/dist/components/MainComponents/ChatErrorScreen.d.ts +24 -0
  24. package/dist/components/MainComponents/HeaderLogo.d.ts +18 -0
  25. package/dist/components/MainComponents/MediaMessage.d.ts +5 -0
  26. package/dist/components/MainComponents/MessageContainer.d.ts +2 -2
  27. package/dist/components/MainComponents/ReduxWrapper.d.ts +1 -2
  28. package/dist/components/MainComponents/SystemMessage.d.ts +1 -2
  29. package/dist/components/MenuRoom/MenuRoom.d.ts +1 -0
  30. package/dist/components/MessageBubble/CustomDivider.d.ts +3 -3
  31. package/dist/components/MessageBubble/Message.d.ts +2 -2
  32. package/dist/components/MessageBubble/MessageTranslate.d.ts +28 -10
  33. package/dist/components/MessageBubble/QuickReplies.d.ts +6 -5
  34. package/dist/components/Modals/ChatProfileModal/ChatProfileMemberRow.d.ts +18 -0
  35. package/dist/components/Modals/FilePreviewModal/FilePreviewModal.d.ts +17 -0
  36. package/dist/components/Modals/FilePreviewModal/ImageLightbox.d.ts +35 -0
  37. package/dist/components/Modals/FilePreviewModal/PdfView.d.ts +14 -3
  38. package/dist/components/Modals/NewChatModal/styledNewChatComponents.d.ts +12 -0
  39. package/dist/components/Modals/SettingsModals/Visibility/StyledComponents.d.ts +1 -1
  40. package/dist/components/Modals/SideDrawer/DrawerProfileParts.d.ts +13 -0
  41. package/dist/components/Modals/SideDrawer/SideDrawer.d.ts +44 -0
  42. package/dist/components/Modals/modalComponents.d.ts +6 -0
  43. package/dist/components/Modals/styledModalComponents.d.ts +14 -3
  44. package/dist/components/RoomComponents/ChatRoomItem.d.ts +0 -1
  45. package/dist/components/RoomComponents/OnlineUsersPopover.d.ts +0 -1
  46. package/dist/components/UsersList/StyledComponents.d.ts +5 -1
  47. package/dist/components/UsersList/UsersList.d.ts +23 -0
  48. package/dist/components/styled/Button.d.ts +11 -1
  49. package/dist/components/styled/ChatWrapperBox.d.ts +3 -1
  50. package/dist/components/styled/PdfMessage.d.ts +13 -0
  51. package/dist/components/styled/RoomListComponents/index.d.ts +22 -1
  52. package/dist/components/styled/SendInput.d.ts +19 -5
  53. package/dist/components/styled/StyledComponents.d.ts +1 -1
  54. package/dist/components/styled/StyledInputComponents/MediaComponents.d.ts +18 -0
  55. package/dist/components/styled/StyledInputComponents/StyledInputComponents.d.ts +21 -0
  56. package/dist/components/styled/TreadLabel.d.ts +2 -2
  57. package/dist/components/styled/UnsupportedType.d.ts +1 -1
  58. package/dist/examples/quiz/QuizDemo.d.ts +3 -0
  59. package/dist/examples/quiz/quizScript.d.ts +38 -0
  60. package/dist/examples/quiz/useDemoSession.d.ts +42 -0
  61. package/dist/examples/quiz/useQuizFlow.d.ts +47 -0
  62. package/dist/firebase-config.d.ts +2 -4
  63. package/dist/handleCopyClick-CpmPa6VI.js +32 -0
  64. package/dist/helpers/MarkdownBody.d.ts +7 -0
  65. package/dist/helpers/attachments.d.ts +33 -0
  66. package/dist/helpers/botMarkup.d.ts +30 -0
  67. package/dist/helpers/constants/MODAL_TYPES.d.ts +11 -7
  68. package/dist/helpers/ethoraLogger.d.ts +8 -0
  69. package/dist/helpers/fileKind.d.ts +17 -0
  70. package/dist/helpers/hiddenRooms.d.ts +1 -1
  71. package/dist/helpers/historyPreloadScheduler.d.ts +1 -0
  72. package/dist/helpers/lazyEmoji.d.ts +3 -0
  73. package/dist/helpers/localStorageUser.d.ts +1 -1
  74. package/dist/helpers/markdownSanitizeSchema.d.ts +3 -0
  75. package/dist/helpers/mentions.d.ts +63 -0
  76. package/dist/helpers/parseMessageBody.d.ts +12 -2
  77. package/dist/helpers/pdf/loadPdfjs.d.ts +64 -0
  78. package/dist/helpers/remarkLineBreaks.d.ts +42 -0
  79. package/dist/helpers/resolveMessageTranslation.d.ts +34 -0
  80. package/dist/helpers/roomImageGallery.d.ts +53 -0
  81. package/dist/helpers/secureFileUrl.d.ts +8 -0
  82. package/dist/helpers/sendFailureWatchdog.d.ts +62 -0
  83. package/dist/helpers/transformTranslatations.d.ts +1 -2
  84. package/dist/hooks/pushSubscriptionSweep.d.ts +41 -0
  85. package/dist/hooks/useChatWrapperInit.d.ts +1 -0
  86. package/dist/hooks/useFilesEndpointSupport.d.ts +9 -0
  87. package/dist/hooks/useInView.d.ts +17 -0
  88. package/dist/hooks/useMentionComposer.d.ts +45 -0
  89. package/dist/hooks/useMessageHeapState.d.ts +1 -1
  90. package/dist/hooks/useMessageTranslation.d.ts +4 -3
  91. package/dist/hooks/useModalDismiss.d.ts +27 -0
  92. package/dist/hooks/useMyFiles.d.ts +16 -0
  93. package/dist/hooks/usePdfThumbnail.d.ts +22 -0
  94. package/dist/hooks/useRoomMute.d.ts +19 -0
  95. package/dist/hooks/useRoomState.d.ts +1 -1
  96. package/dist/hooks/useSendMessage.d.ts +4 -3
  97. package/dist/hooks/useTypography.d.ts +1 -1
  98. package/dist/hooks/useUnreadMessagesCounter.d.ts +11 -2
  99. package/dist/index.esm-B-3fyDHY.js +28 -0
  100. package/dist/index.esm-CRM4VCRa.js +943 -0
  101. package/dist/index.esm-msbp26WN.js +3352 -0
  102. package/dist/index.esm2017-CL0mvq6y.js +1578 -0
  103. package/dist/main-B-8IhwaP.js +31837 -0
  104. package/dist/main.css +1 -1
  105. package/dist/main.d.ts +14 -0
  106. package/dist/main.js +21 -21
  107. package/dist/module-DGXkb0R_.js +2960 -0
  108. package/dist/native-CDi4YD_s.js +13 -0
  109. package/dist/networking/api-requests/files.api.d.ts +19 -0
  110. package/dist/networking/api-requests/rooms.api.d.ts +10 -2
  111. package/dist/networking/api-requests/translate.api.d.ts +15 -0
  112. package/dist/networking/api-requests/user.api.d.ts +2 -0
  113. package/dist/networking/sharedRequest.d.ts +4 -0
  114. package/dist/networking/xmpp/allRoomPresences.xmpp.d.ts +3 -1
  115. package/dist/networking/xmpp/createTimeoutPromise.xmpp.d.ts +14 -0
  116. package/dist/networking/xmpp/sendTextMessage.xmpp.d.ts +2 -1
  117. package/dist/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts +2 -1
  118. package/dist/networking/xmppClient.d.ts +12 -3
  119. package/dist/pdf-B5b7qHu6.js +17130 -0
  120. package/dist/pdf.worker.min-COYn-gId.js +24385 -0
  121. package/dist/roomStore/index.d.ts +20 -0
  122. package/dist/roomStore/persistEncryption.d.ts +51 -0
  123. package/dist/roomStore/roomsSlice.d.ts +49 -6
  124. package/dist/styles/classNames.d.ts +35 -0
  125. package/dist/styles/motion.d.ts +44 -0
  126. package/dist/styles/tokens.d.ts +27 -0
  127. package/dist/testIds.d.ts +1 -1
  128. package/dist/types/models/attachment.model.d.ts +33 -0
  129. package/dist/types/models/config.model.d.ts +160 -19
  130. package/dist/types/models/file.model.d.ts +20 -0
  131. package/dist/types/models/message.model.d.ts +15 -6
  132. package/dist/types/models/room.model.d.ts +12 -2
  133. package/dist/types/types.d.ts +3 -1
  134. package/dist/utils/resendMessage.d.ts +22 -1
  135. package/dist/utils/translateModePolicy.d.ts +1 -0
  136. package/dist/wavesurfer.esm-D_a19qBW.js +952 -0
  137. package/package.json +22 -2
  138. package/dist/VideoCallOverlay-C4M2I9oV.js.map +0 -1
  139. package/dist/components/MainComponents/VirtualList.d.ts +0 -10
  140. package/dist/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.d.ts +0 -6
  141. package/dist/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.d.ts +0 -6
  142. package/dist/components/Modals/SettingsModals/ManageDataModal/StyledComponents.d.ts +0 -0
  143. package/dist/components/Modals/SettingsModals/ProfileShares/ProfileShares.d.ts +0 -6
  144. package/dist/components/Modals/SettingsModals/Referrals/Referrals.d.ts +0 -6
  145. package/dist/hooks/useMessageQueue.d.ts +0 -4
  146. package/dist/main-DeiuFYsl.js +0 -55812
  147. package/dist/main-DeiuFYsl.js.map +0 -1
  148. package/dist/main.js.map +0 -1
  149. package/dist/networking/xmpp/getHistory.xmpp.d.ts +0 -3
  150. package/dist/networking/xmpp/listenerManager.d.ts +0 -17
  151. package/dist/utils/xmppMemoryMonitor.d.ts +0 -16
@@ -0,0 +1,45 @@
1
+ import { IMentionSpan, RoomMember } from '../types/types';
2
+ import { MentionCandidate } from '../helpers/mentions';
3
+ export declare const MENTION_INLINE_LIMIT = 5;
4
+ interface UseMentionComposerParams {
5
+ roomMembers: RoomMember[];
6
+ selfId?: string;
7
+ }
8
+ interface DropdownState {
9
+ start: number;
10
+ query: string;
11
+ }
12
+ /**
13
+ * Tracks @-mention spans and the inline autocomplete dropdown for a plain
14
+ * <input>/<textarea> based message composer (see SendInput.tsx). Text
15
+ * editing and caret placement stay owned by the caller (a controlled React
16
+ * input) - this hook only computes the *derived* state: which mention spans
17
+ * still hold after an edit, and what the dropdown should show.
18
+ */
19
+ export declare const useMentionComposer: ({ roomMembers, selfId, }: UseMentionComposerParams) => {
20
+ mentionSpans: IMentionSpan[];
21
+ setMentionSpans: import('react').Dispatch<import('react').SetStateAction<IMentionSpan[]>>;
22
+ dropdown: DropdownState;
23
+ isDropdownOpen: boolean;
24
+ candidates: MentionCandidate[];
25
+ visibleCandidates: MentionCandidate[];
26
+ hasOverflow: boolean;
27
+ highlightedIndex: number;
28
+ setHighlightedIndex: import('react').Dispatch<import('react').SetStateAction<number>>;
29
+ moveHighlight: (delta: number) => void;
30
+ overflowOpen: boolean;
31
+ setOverflowOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
32
+ resetMentions: () => void;
33
+ closeDropdown: () => void;
34
+ handleTextChange: (oldText: string, newText: string, caret: number) => void;
35
+ selectCandidate: (candidate: MentionCandidate, text: string, caretAtSelection: number) => {
36
+ text: string;
37
+ caret: number;
38
+ } | null;
39
+ handleBackspace: (text: string, selectionStart: number, selectionEnd: number) => {
40
+ text: string;
41
+ caret: number;
42
+ } | null;
43
+ };
44
+ export type UseMentionComposerReturn = ReturnType<typeof useMentionComposer>;
45
+ export {};
@@ -1,4 +1,4 @@
1
1
  export declare const useMessageHeapState: () => {
2
- queue: import('../types/types').IMessage[];
2
+ queue: import('../main').IMessage[];
3
3
  idSet: Set<string>;
4
4
  };
@@ -16,9 +16,10 @@ export interface MessageTranslationState {
16
16
  * `<translate source="xx"/>` (see sendTextMessageWithTranslateTag) and
17
17
  * whatever process attaches actual translations does so server-side,
18
18
  * landing on `message.translations` when the stanza is parsed (see
19
- * getDataFromXml). This function only ever reads that - it never calls a
20
- * translation service itself, so there's nothing to fail when one isn't
21
- * reachable, and nothing to await.
19
+ * getDataFromXml). This hook is a thin wrapper around
20
+ * `resolveMessageTranslation` (the shared lookup manual mode also uses) - it
21
+ * never calls a translation service itself, so there's nothing to fail when
22
+ * one isn't reachable, and nothing to await.
22
23
  *
23
24
  * A message sent before the sender had translate-sending turned on simply
24
25
  * never got tagged, so it has no translation to show - not an error, just
@@ -0,0 +1,27 @@
1
+ type DismissLayerKind = 'modal' | 'menu';
2
+ export declare const FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
3
+ export interface UseModalDismissOptions {
4
+ onClose?: () => void;
5
+ enabled?: boolean;
6
+ /** Ref to the dialog/menu container; used for initial focus. */
7
+ containerRef?: React.RefObject<HTMLElement | null>;
8
+ /**
9
+ * 'modal' (default) stacks; 'menu' is exclusive, see the note above.
10
+ */
11
+ kind?: DismissLayerKind;
12
+ /**
13
+ * Close when a press lands outside the layer. Off by default: modals own
14
+ * a full-screen overlay that already handles this.
15
+ */
16
+ closeOnOutsidePress?: boolean;
17
+ /**
18
+ * Extra elements counted as "inside" for outside-press dismissal, on top
19
+ * of `containerRef`. A menu passes its trigger here: the trigger's own
20
+ * click is the toggle's business, and letting the document listener close
21
+ * the menu first would make the trigger look like it never closes (the
22
+ * toggle would immediately re-open what the listener just shut).
23
+ */
24
+ insideRefs?: React.RefObject<HTMLElement | null>[];
25
+ }
26
+ export declare const useModalDismiss: ({ onClose, enabled, containerRef, kind, closeOnOutsidePress, insideRefs, }: UseModalDismissOptions) => void;
27
+ export default useModalDismiss;
@@ -0,0 +1,16 @@
1
+ import { ApiFile } from '../types/types';
2
+ export interface UseMyFilesOptions {
3
+ roomName?: string;
4
+ }
5
+ export interface UseMyFilesResult {
6
+ items: ApiFile[];
7
+ total: number;
8
+ loading: boolean;
9
+ loadingMore: boolean;
10
+ error: string | null;
11
+ hasMore: boolean;
12
+ loadMore: () => void;
13
+ refresh: () => void;
14
+ remove: (id: string) => Promise<void>;
15
+ }
16
+ export declare function useMyFiles(options?: UseMyFilesOptions): UseMyFilesResult;
@@ -0,0 +1,22 @@
1
+ export type PdfThumbnailStatus = 'idle' | 'loading' | 'ready' | 'error' | 'skipped';
2
+ interface UsePdfThumbnailParams {
3
+ url?: string;
4
+ /** Gate: keep false until the bubble is on screen. */
5
+ enabled: boolean;
6
+ /** CSS pixels of the rendered bitmap's long edge. */
7
+ width?: number;
8
+ /** Files above this never auto-render; the card stays static. */
9
+ maxBytes?: number;
10
+ sizeInBytes?: number;
11
+ workerSrc?: string;
12
+ }
13
+ interface UsePdfThumbnailResult {
14
+ status: PdfThumbnailStatus;
15
+ /** Object URL - owned by this hook, revoked on unmount/url change. */
16
+ thumbnailUrl?: string;
17
+ pageCount?: number;
18
+ /** Re-runs a render that failed or was skipped for being too big. */
19
+ retry: () => void;
20
+ }
21
+ export declare const usePdfThumbnail: ({ url, enabled, width, maxBytes, sizeInBytes, workerSrc, }: UsePdfThumbnailParams) => UsePdfThumbnailResult;
22
+ export {};
@@ -0,0 +1,19 @@
1
+ export interface UseRoomMuteResult {
2
+ /** Current muted state for this room. `false` whenever the backend hasn't reported the field - see `isSupported`. */
3
+ muted: boolean;
4
+ /**
5
+ * True only once this room has an actual `muted` boolean - either fetched
6
+ * from a backend that supports per-chat mute (`/v1/chats/my` or
7
+ * `/v1/chats/my/{chatName}`), or because this client already toggled it
8
+ * successfully. Prod doesn't send `muted` yet, so UI should hide the mute
9
+ * control unless this is true - otherwise it offers a toggle that 404s.
10
+ */
11
+ isSupported: boolean;
12
+ /** True while a toggle request is in flight. Disable the control to avoid a double submit. */
13
+ isPending: boolean;
14
+ /** Flips the current muted state - optimistic, with rollback + an error toast on failure. */
15
+ toggleMute: () => Promise<void>;
16
+ /** Sets the muted state directly - for controls with an explicit on/off state (e.g. a switch). */
17
+ setMuted: (nextMuted: boolean) => Promise<void>;
18
+ }
19
+ export declare const useRoomMute: (roomJid: string | undefined) => UseRoomMuteResult;
@@ -7,5 +7,5 @@ export declare const useRoomState: (roomJID?: string) => {
7
7
  loadingText: any;
8
8
  loading: any;
9
9
  roomMessages: any;
10
- usersSet: any;
11
10
  };
11
+ export declare const useUsersSet: () => any;
@@ -1,7 +1,8 @@
1
- export declare const shouldTagOutgoingTranslateSource: (translatesEnabled: boolean | undefined, translateSendEnabled: boolean | undefined) => boolean;
1
+ import { IMentionSpan } from '../types/types';
2
+ export { shouldTagOutgoingTranslateSource } from '../utils/translateModePolicy';
2
3
  export declare const useSendMessage: () => {
3
- sendMessage: (message: string, activeRoomJID: string, isReply?: boolean, isChecked?: boolean, mainMessage?: string) => Promise<void>;
4
- sendMedia: (data: File, type: string, activeRoomJID: string, isReply?: boolean, isChecked?: boolean, mainMessage?: string) => Promise<void>;
4
+ sendMessage: (message: string, activeRoomJID: string, isReply?: boolean, isChecked?: boolean, mainMessage?: string, mentions?: IMentionSpan[]) => Promise<void>;
5
+ sendMedia: (data: File | File[] | Blob, type: string, activeRoomJID: string, isReply?: boolean, isChecked?: boolean, mainMessage?: string) => Promise<void>;
5
6
  sendEditMessage: (message: string) => Promise<void>;
6
7
  isLastMessageFromUserAndProcessing: (roomJID: string) => boolean;
7
8
  };
@@ -2,7 +2,7 @@ import { TypographyConfig } from '../types/models/config.model';
2
2
  /**
3
3
  * Loads and applies the host-provided font configuration whenever it changes.
4
4
  * Wired into the chat root (ReduxWrapper) so the font is in place before the
5
- * UI paints. No-op when `typography` is undefined — the default system font
5
+ * UI paints. No-op when `typography` is undefined - the default system font
6
6
  * stack is kept, so existing integrations are unaffected.
7
7
  */
8
8
  export declare function useTypography(typography?: TypographyConfig): void;
@@ -5,8 +5,17 @@ interface UnreadMessagesDisplayMap {
5
5
  [roomJid: string]: string;
6
6
  }
7
7
  interface UnreadMessagesStats {
8
+ /** True when `totalCount > 0` - already excludes muted rooms, see `totalCount`. */
8
9
  hasUnread: boolean;
10
+ /**
11
+ * Sum of unread counts across visible rooms, EXCLUDING any room the caller
12
+ * has muted (a muted room still counts its own unread - see
13
+ * `unreadByRoom` - it just doesn't inflate this aggregate, so a global
14
+ * unread badge/favicon built from this number doesn't light up for a
15
+ * muted chat).
16
+ */
9
17
  totalCount: number;
18
+ /** Per-room unread counts, including muted rooms - the room-list badge always shows its own count regardless of mute. */
10
19
  unreadByRoom: UnreadMessagesMap;
11
20
  displayTotal: string;
12
21
  displayByRoom: UnreadMessagesDisplayMap;
@@ -16,10 +25,10 @@ interface UnreadMessagesStats {
16
25
  * hook keeps `loading` true until the per-room counts have stopped changing
17
26
  * for a short window, then latches it to false. After that first settle,
18
27
  * live message increments update the counts immediately and never flip
19
- * `loading` back on — it's a first-load indicator, not a per-update one.
28
+ * `loading` back on, it's a first-load indicator, not a per-update one.
20
29
  */
21
30
  loading: boolean;
22
- /** Alias of `loading` — matches the React Native SDK field name. */
31
+ /** Alias of `loading`, matches the React Native SDK field name. */
23
32
  isLoading: boolean;
24
33
  }
25
34
  export declare const useUnreadMessagesCounter: () => UnreadMessagesStats;
@@ -0,0 +1,28 @@
1
+ import { B as p, D as o, r as e } from "./index.esm2017-CL0mvq6y.js";
2
+ import { F as n, S as _, G as v, H as m, I as A, J as g, K as d, M as S, a as b, N as l, e as E, _ as F, O as c, P as C, Q as L, b as N, R as O, T as f, U as D } from "./index.esm2017-CL0mvq6y.js";
3
+ var s = "firebase", a = "11.9.1";
4
+ e(s, a, "app");
5
+ export {
6
+ n as FirebaseError,
7
+ _ as SDK_VERSION,
8
+ v as _DEFAULT_ENTRY_NAME,
9
+ m as _addComponent,
10
+ A as _addOrOverwriteComponent,
11
+ g as _apps,
12
+ d as _clearComponents,
13
+ S as _components,
14
+ b as _getProvider,
15
+ l as _isFirebaseApp,
16
+ E as _isFirebaseServerApp,
17
+ F as _registerComponent,
18
+ c as _removeServiceInstance,
19
+ C as _serverApps,
20
+ L as deleteApp,
21
+ N as getApp,
22
+ o as getApps,
23
+ p as initializeApp,
24
+ O as initializeServerApp,
25
+ f as onLog,
26
+ e as registerVersion,
27
+ D as setLogLevel
28
+ };