@ethora/chat-component 26.9.8 → 26.10.3

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 (140) hide show
  1. package/README.md +2 -1
  2. package/dist/{ChatProfileModal-3UH0H5Ec.js → ChatProfileModal-D73ioMj9.js} +44 -44
  3. package/dist/FilePreviewModal-BeGa8s4u.js +1763 -0
  4. package/dist/{ManageDataModal-BblTuE9g.js → ManageDataModal-DxhvKwLo.js} +17 -17
  5. package/dist/{MarkdownBody-RMEx8yW2.js → MarkdownBody-fzjy9KUP.js} +1 -1
  6. package/dist/{MessageSearchModal-CrYR2EH8.js → MessageSearchModal-3I0b3Nut.js} +40 -40
  7. package/dist/{PublicChatsModal-Bi5r4mrV.js → PublicChatsModal-Dzwl63q-.js} +19 -19
  8. package/dist/{SideDrawer-CDAoobvX.js → SideDrawer-BPebE2tZ.js} +37 -37
  9. package/dist/{UserProfileModal-4Frgvam-.js → UserProfileModal-BS5FZdJb.js} +10 -10
  10. package/dist/{UserSettingsModal-C-mb-9cb.js → UserSettingsModal-pBqmF_r2.js} +5 -5
  11. package/dist/{VideoCallOverlay-92dFLb9U.js → VideoCallOverlay-PIg8Z5Xr.js} +3824 -3708
  12. package/dist/{VisibilityModal-zIAV6dAP.js → VisibilityModal-CnBRSRQ9.js} +11 -11
  13. package/dist/api.config.d.ts +0 -23
  14. package/dist/assets/icons.d.ts +2 -3
  15. package/dist/components/ContextMenu/ContextMenuComponents.d.ts +24 -8
  16. package/dist/components/ExampleComponents/CustomMessage.d.ts +27 -9
  17. package/dist/components/Files/fileCategory.d.ts +4 -2
  18. package/dist/components/MainComponents/AlbumGrid.d.ts +22 -0
  19. package/dist/components/MainComponents/AttachmentList.d.ts +6 -6
  20. package/dist/components/MainComponents/ChooseChatMessage.d.ts +12 -4
  21. package/dist/components/MainComponents/EditWrapper.d.ts +12 -4
  22. package/dist/components/MainComponents/ImageUnavailable.d.ts +21 -0
  23. package/dist/components/MainComponents/MediaUploadOverlay.d.ts +31 -0
  24. package/dist/components/MainComponents/MessageContainer.d.ts +3 -0
  25. package/dist/components/MainComponents/MessageList.d.ts +2 -1
  26. package/dist/components/MainComponents/SystemMessage.d.ts +3 -1
  27. package/dist/components/MessageBubble/CustomDivider.d.ts +3 -1
  28. package/dist/components/MessageBubble/MediaCaption.d.ts +9 -0
  29. package/dist/components/MessageBubble/MessageAvatarPhoto.d.ts +17 -0
  30. package/dist/components/MessageBubble/MessageReaction.d.ts +6 -0
  31. package/dist/components/MessageBubble/MessageReply.d.ts +3 -1
  32. package/dist/components/MessageBubble/QuickReplies.d.ts +2 -0
  33. package/dist/components/Modals/FilePreviewModal/FilePreviewModal.d.ts +8 -10
  34. package/dist/components/Modals/FilePreviewModal/ImageLightbox.d.ts +4 -0
  35. package/dist/components/Modals/FilePreviewModal/PdfView.d.ts +4 -0
  36. package/dist/components/Modals/FilePreviewModal/ViewerChrome.d.ts +100 -0
  37. package/dist/components/Modals/MessageSearchModal/MessageHitResults.d.ts +3 -1
  38. package/dist/components/Modals/ModalReportChat/ModalReportChat.d.ts +3 -1
  39. package/dist/components/Modals/NewChatModal/styledNewChatComponents.d.ts +15 -5
  40. package/dist/components/Modals/SettingsModals/SharedStyledComponents.d.ts +27 -15
  41. package/dist/components/Modals/SettingsModals/Visibility/StyledComponents.d.ts +18 -6
  42. package/dist/components/Modals/SideDrawer/DrawerProfileParts.d.ts +27 -9
  43. package/dist/components/Modals/SideDrawer/SideDrawer.d.ts +39 -13
  44. package/dist/components/Modals/motionVariants.d.ts +8 -10
  45. package/dist/components/Modals/styledModalComponents.d.ts +53 -25
  46. package/dist/components/Notification/index.d.ts +3 -1
  47. package/dist/components/RoomComponents/LastMessageItem.d.ts +2 -0
  48. package/dist/components/RoomComponents/styled/LastMessageMedia.d.ts +19 -0
  49. package/dist/components/RoomComponents/styled/LastTextMessage.d.ts +2 -2
  50. package/dist/components/RoomComponents/styled/StyledRoomComponents.d.ts +29 -8
  51. package/dist/components/UsersList/StyledComponents.d.ts +18 -6
  52. package/dist/components/VideoCalls/VideoCallSession.d.ts +13 -0
  53. package/dist/components/styled/ChatWrapperBox.d.ts +9 -2
  54. package/dist/components/styled/DateLabel.d.ts +3 -1
  55. package/dist/components/styled/FileCard.d.ts +20 -0
  56. package/dist/components/styled/Loader.d.ts +3 -1
  57. package/dist/components/styled/MediaModal.d.ts +6 -2
  58. package/dist/components/styled/MediaSurface.d.ts +56 -0
  59. package/dist/components/styled/MessageImage.d.ts +9 -10
  60. package/dist/components/styled/NewMessageLabel.d.ts +3 -1
  61. package/dist/components/styled/RoomListComponents/index.d.ts +66 -22
  62. package/dist/components/styled/SendInput.d.ts +12 -2
  63. package/dist/components/styled/StyledComponents.d.ts +199 -41
  64. package/dist/components/styled/StyledInputComponents/MediaComponents.d.ts +78 -24
  65. package/dist/components/styled/StyledInputComponents/StyledInputComponents.d.ts +60 -22
  66. package/dist/components/styled/StyledInputComponents/VideoComponents.d.ts +18 -6
  67. package/dist/components/styled/TreadLabel.d.ts +3 -1
  68. package/dist/components/styled/UnsupportedType.d.ts +1 -0
  69. package/dist/components/styled/VideoMessage.d.ts +13 -6
  70. package/dist/e2ee/callKey.d.ts +32 -0
  71. package/dist/e2ee/fileEnvelope.d.ts +16 -5
  72. package/dist/e2ee/omemo.d.ts +18 -0
  73. package/dist/firebase-messaging-sw.js +20 -3
  74. package/dist/{handleCopyClick-BtXos0AJ.js → handleCopyClick-vPvh9hOU.js} +1 -1
  75. package/dist/helpers/albumLayout.d.ts +53 -0
  76. package/dist/helpers/attachments.d.ts +22 -1
  77. package/dist/helpers/avatarImageCache.d.ts +9 -0
  78. package/dist/helpers/caption.d.ts +63 -0
  79. package/dist/helpers/composerFocus.d.ts +22 -0
  80. package/dist/helpers/createMainMessageForThread.d.ts +1 -1
  81. package/dist/helpers/downloadFile.d.ts +19 -0
  82. package/dist/helpers/fileKind.d.ts +17 -0
  83. package/dist/helpers/lastMessagePreview.d.ts +55 -0
  84. package/dist/helpers/mapWithConcurrency.d.ts +8 -0
  85. package/dist/helpers/mediaBox.d.ts +110 -0
  86. package/dist/helpers/mediaBubble.d.ts +67 -0
  87. package/dist/helpers/mediaLabel.d.ts +10 -0
  88. package/dist/helpers/mediaSendRetry.d.ts +25 -0
  89. package/dist/helpers/messageRuns.d.ts +10 -0
  90. package/dist/helpers/receiptState.d.ts +48 -0
  91. package/dist/helpers/repairFilenameEncoding.d.ts +11 -0
  92. package/dist/helpers/roomImageGallery.d.ts +34 -0
  93. package/dist/helpers/safeUrl.d.ts +15 -0
  94. package/dist/helpers/secureFileUrl.d.ts +4 -1
  95. package/dist/helpers/textareaFit.d.ts +31 -0
  96. package/dist/helpers/timestamp.d.ts +7 -0
  97. package/dist/helpers/userEntry.d.ts +14 -0
  98. package/dist/helpers/viewerSender.d.ts +47 -0
  99. package/dist/hooks/useAvatarImage.d.ts +21 -0
  100. package/dist/hooks/useIsMobileViewport.d.ts +5 -0
  101. package/dist/hooks/useMediaProbe.d.ts +41 -0
  102. package/dist/hooks/usePaneWidthVar.d.ts +11 -0
  103. package/dist/hooks/usePdfThumbnail.d.ts +0 -1
  104. package/dist/hooks/usePrefersReducedMotion.d.ts +2 -0
  105. package/dist/hooks/useRoomInitialization.d.ts +2 -2
  106. package/dist/hooks/useRoomUrl.d.ts +2 -2
  107. package/dist/hooks/useSendMessage.d.ts +4 -1
  108. package/dist/{main-BnLtessp.js → main-CghdNDlB.js} +20803 -16260
  109. package/dist/main.js +10 -10
  110. package/dist/networking/api-requests/auth.api.d.ts +13 -5
  111. package/dist/networking/api-requests/user.api.d.ts +4 -4
  112. package/dist/networking/callKeyStanza.d.ts +7 -0
  113. package/dist/networking/deliveryReceiptBatcher.d.ts +53 -0
  114. package/dist/networking/displayedMarkerThrottle.d.ts +29 -0
  115. package/dist/networking/receiptsPolicy.d.ts +32 -0
  116. package/dist/networking/stanzaHandlers.d.ts +4 -2
  117. package/dist/networking/xmpp/sendDisplayedMarker.xmpp.d.ts +2 -0
  118. package/dist/networking/xmpp/sendMediaMessage.xmpp.d.ts +8 -0
  119. package/dist/networking/xmpp/sendReceivedReceipt.xmpp.d.ts +2 -0
  120. package/dist/networking/xmppClient.d.ts +5 -0
  121. package/dist/roomStore/callSlice.d.ts +6 -1
  122. package/dist/roomStore/index.d.ts +10 -0
  123. package/dist/roomStore/roomsSlice.d.ts +22 -3
  124. package/dist/styles/motion.d.ts +22 -2
  125. package/dist/types/models/attachment.model.d.ts +19 -0
  126. package/dist/types/models/config.model.d.ts +56 -2
  127. package/dist/types/models/customComponents.model.d.ts +2 -0
  128. package/dist/types/models/message.model.d.ts +9 -0
  129. package/dist/types/models/modal.model.d.ts +19 -0
  130. package/dist/types/models/room.model.d.ts +17 -0
  131. package/dist/types/models/xmpp.model.d.ts +3 -0
  132. package/dist/utils/messageNotificationContent.d.ts +34 -0
  133. package/dist/version.d.ts +1 -1
  134. package/package.json +8 -7
  135. package/public/firebase-messaging-sw.js +20 -3
  136. package/dist/FilePreviewModal-Cgj1iHry.js +0 -743
  137. package/dist/components/RoomComponents/styled/LastAudioMessage.d.ts +0 -6
  138. package/dist/components/RoomComponents/styled/LastMessageFile.d.ts +0 -6
  139. package/dist/components/RoomComponents/styled/LastMessagePhoto.d.ts +0 -6
  140. package/dist/components/RoomComponents/styled/LastMessageVideo.d.ts +0 -6
@@ -0,0 +1,47 @@
1
+ /** What the media viewer knows about a sender, however thin. */
2
+ export interface ViewerSenderInput {
3
+ id?: string;
4
+ username?: string;
5
+ /** `message.user.name`, which carries the display name for many senders. */
6
+ name?: string;
7
+ firstName?: string;
8
+ lastName?: string;
9
+ photo?: string;
10
+ }
11
+ interface DirectoryEntry {
12
+ firstName?: string;
13
+ lastName?: string;
14
+ profileImage?: string;
15
+ }
16
+ interface OwnProfile extends DirectoryEntry {
17
+ xmppUsername?: string;
18
+ name?: string;
19
+ }
20
+ export interface ResolveViewerSenderOptions {
21
+ sender?: ViewerSenderInput | null;
22
+ /** `rooms.usersSet`, keyed by the xmpp username. */
23
+ usersSet?: Record<string, DirectoryEntry | undefined>;
24
+ /** The signed-in user, for their own messages. */
25
+ me?: OwnProfile | null;
26
+ /** Only used for a 1:1 room, where the room is named after the peer. */
27
+ peerRoomName?: string;
28
+ }
29
+ export interface ResolvedViewerSender {
30
+ /** Empty when nobody could be named. The header then omits the name line. */
31
+ name: string;
32
+ photo?: string;
33
+ }
34
+ /**
35
+ * Resolves the sender shown in the viewer header. The order is the one the
36
+ * message bubble uses, with the signed-in user's own profile as the answer for
37
+ * their own messages (an own optimistic message often has no name on it):
38
+ *
39
+ * first + last on the message, the message's own `name`, the profile in
40
+ * `usersSet`, the signed-in user's profile (own messages), the username
41
+ * before the `@`, and for a 1:1 room the room's name.
42
+ *
43
+ * Never returns a placeholder: when nothing is known `name` is '' and the
44
+ * caller draws a neutral glyph rather than initials.
45
+ */
46
+ export declare const resolveViewerSender: ({ sender, usersSet, me, peerRoomName, }: ResolveViewerSenderOptions) => ResolvedViewerSender;
47
+ export {};
@@ -0,0 +1,21 @@
1
+ export type AvatarImageStatus = 'none' | 'loading' | 'loaded' | 'failed';
2
+ /**
3
+ * Resolves an avatar URL for rendering. Never waits on the network: the
4
+ * caller shows initials immediately and fades the <img> in once `status` is
5
+ * `loaded`.
6
+ *
7
+ * - appends the viewer's `?ft=` token for secure-files URLs synchronously
8
+ * from the store (no token round trip before the request starts);
9
+ * - reuses a URL that already loaded for the same file (see
10
+ * avatarImageCache) so a token rotation or a second component showing the
11
+ * same person does not trigger another download;
12
+ * - skips URLs that just failed (no repeated failing requests);
13
+ * - on a secure-file failure kicks the throttled fileToken recovery, whose
14
+ * refreshed token yields a new URL and therefore a new attempt.
15
+ */
16
+ export declare const useAvatarImage: (rawSrc: string | null | undefined) => {
17
+ src: string;
18
+ status: AvatarImageStatus;
19
+ onLoad: () => void;
20
+ onError: () => void;
21
+ };
@@ -1 +1,6 @@
1
1
  export declare const useIsMobileViewport: (breakpoint?: number) => boolean;
2
+ /**
3
+ * Non-hook form of the same check, for event handlers that need the answer
4
+ * at the moment of the event rather than as render state.
5
+ */
6
+ export declare const isMobileViewportNow: (breakpoint?: number) => boolean;
@@ -0,0 +1,41 @@
1
+ export type MediaProbeStatus = 'idle' | 'loading' | 'recovering' | 'loaded' | 'error';
2
+ export interface MediaProbe {
3
+ status: MediaProbeStatus;
4
+ /**
5
+ * Natural size. Known once `status` is 'loaded', and usually sooner: it is
6
+ * read from the first decoded header while the bytes are still arriving.
7
+ */
8
+ width: number;
9
+ height: number;
10
+ /**
11
+ * The URL whose bytes are on screen. While a picture is shown, a rotated
12
+ * `?ft=` token does not swap it for a fresh request: the URL that loaded
13
+ * stays, so a token refresh never blanks or re-downloads what is visible.
14
+ */
15
+ url: string;
16
+ }
17
+ /**
18
+ * No byte of the file (not even its header) arrived in this long: stop
19
+ * waiting and show the unavailable state with a manual retry. Once the size
20
+ * is known the file is on its way and is never cut off by this timer.
21
+ */
22
+ export declare const MEDIA_STALL_MS = 8000;
23
+ export declare const resetMediaProbeCaches: () => void;
24
+ /**
25
+ * Preloads one image off-DOM so the visible <img> only mounts once its bytes
26
+ * are cached.
27
+ *
28
+ * A failure never says anything about the file being deleted: a 404 from the
29
+ * storage host, an expired token, a CORS or DNS hiccup and a dead CDN edge all
30
+ * fail an <img> the same way, and the server's answer cannot be read across
31
+ * origins anyway. So the only outcome is the 'error' state, which the surface
32
+ * offers to `retry`. Deleting a message is driven by the server (a delete
33
+ * stanza) or by the sender's own Files panel action, never inferred here.
34
+ *
35
+ * A secure URL that fails gets at most one shared token refresh per token
36
+ * (see `requestFileTokenRecovery`); the refreshed URL re-runs this effect.
37
+ */
38
+ export declare const useMediaProbe: (url: string | undefined) => MediaProbe & {
39
+ retry: () => void;
40
+ fail: () => void;
41
+ };
@@ -0,0 +1,11 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Publishes the width of an element as the `--ethora-pane-w` custom property
4
+ * on that element, so message media can size itself to the chat pane (which
5
+ * may be a narrow host) instead of the viewport. Updated on every resize.
6
+ *
7
+ * The element may mount after the first render (the list shows a loader
8
+ * first), so every commit checks whether the ref points at a new element
9
+ * and re-attaches the observer if so.
10
+ */
11
+ export declare const usePaneWidthVar: (ref: RefObject<HTMLElement | null>) => void;
@@ -15,7 +15,6 @@ interface UsePdfThumbnailResult {
15
15
  status: PdfThumbnailStatus;
16
16
  /** Object URL - owned by this hook, revoked on unmount/url change. */
17
17
  thumbnailUrl?: string;
18
- pageCount?: number;
19
18
  /** Re-runs a render that failed or was skipped for being too big. */
20
19
  retry: () => void;
21
20
  }
@@ -0,0 +1,2 @@
1
+ /** True while the user asks the OS for reduced motion; follows live changes. */
2
+ export declare const usePrefersReducedMotion: () => boolean;
@@ -1,2 +1,2 @@
1
- import { IConfig, IRoom } from '../types/types';
2
- export declare const useRoomInitialization: (activeRoomJID: string, roomsList: Record<string, IRoom>, config: IConfig, messageLength: number) => void;
1
+ import { IConfig } from '../types/types';
2
+ export declare const useRoomInitialization: (activeRoomJID: string, config: IConfig, messageLength: number) => void;
@@ -1,2 +1,2 @@
1
- import { IConfig, IRoom } from '../types/types';
2
- export declare const useRoomUrl: (activeRoomJID: string, roomsList: Record<string, IRoom>, config: IConfig) => void;
1
+ import { IConfig } from '../types/types';
2
+ export declare const useRoomUrl: (activeRoomJID: string, config: IConfig) => void;
@@ -1,8 +1,11 @@
1
1
  import { IMentionSpan } from '../types/types';
2
+ import { CaptionInput } from '../helpers/caption';
3
+ /** Files of one message uploaded at the same time. */
4
+ export declare const MEDIA_UPLOAD_CONCURRENCY = 4;
2
5
  export { shouldTagOutgoingTranslateSource } from '../utils/translateModePolicy';
3
6
  export declare const useSendMessage: () => {
4
7
  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>;
8
+ sendMedia: (data: File | File[] | Blob, type: string, activeRoomJID: string, isReply?: boolean, isChecked?: boolean, mainMessage?: string, caption?: CaptionInput) => Promise<boolean>;
6
9
  sendEditMessage: (message: string) => Promise<void>;
7
10
  isLastMessageFromUserAndProcessing: (roomJID: string) => boolean;
8
11
  };