@ethora/chat-component 26.7.4 → 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 (152) 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-BUfKp87t.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 +19 -0
  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/quickReplies.d.ts +31 -0
  79. package/dist/helpers/remarkLineBreaks.d.ts +42 -0
  80. package/dist/helpers/resolveMessageTranslation.d.ts +34 -0
  81. package/dist/helpers/roomImageGallery.d.ts +53 -0
  82. package/dist/helpers/secureFileUrl.d.ts +8 -0
  83. package/dist/helpers/sendFailureWatchdog.d.ts +62 -0
  84. package/dist/helpers/transformTranslatations.d.ts +1 -2
  85. package/dist/hooks/pushSubscriptionSweep.d.ts +41 -0
  86. package/dist/hooks/useChatWrapperInit.d.ts +1 -0
  87. package/dist/hooks/useFilesEndpointSupport.d.ts +9 -0
  88. package/dist/hooks/useInView.d.ts +17 -0
  89. package/dist/hooks/useMentionComposer.d.ts +45 -0
  90. package/dist/hooks/useMessageHeapState.d.ts +1 -1
  91. package/dist/hooks/useMessageTranslation.d.ts +4 -3
  92. package/dist/hooks/useModalDismiss.d.ts +27 -0
  93. package/dist/hooks/useMyFiles.d.ts +16 -0
  94. package/dist/hooks/usePdfThumbnail.d.ts +22 -0
  95. package/dist/hooks/useRoomMute.d.ts +19 -0
  96. package/dist/hooks/useRoomState.d.ts +1 -1
  97. package/dist/hooks/useSendMessage.d.ts +4 -3
  98. package/dist/hooks/useTypography.d.ts +1 -1
  99. package/dist/hooks/useUnreadMessagesCounter.d.ts +11 -2
  100. package/dist/index.esm-B-3fyDHY.js +28 -0
  101. package/dist/index.esm-CRM4VCRa.js +943 -0
  102. package/dist/index.esm-msbp26WN.js +3352 -0
  103. package/dist/index.esm2017-CL0mvq6y.js +1578 -0
  104. package/dist/main-B-8IhwaP.js +31837 -0
  105. package/dist/main.css +1 -1
  106. package/dist/main.d.ts +16 -0
  107. package/dist/main.js +19 -18
  108. package/dist/module-DGXkb0R_.js +2960 -0
  109. package/dist/native-CDi4YD_s.js +13 -0
  110. package/dist/networking/api-requests/files.api.d.ts +19 -0
  111. package/dist/networking/api-requests/rooms.api.d.ts +10 -2
  112. package/dist/networking/api-requests/translate.api.d.ts +15 -0
  113. package/dist/networking/api-requests/user.api.d.ts +2 -0
  114. package/dist/networking/sharedRequest.d.ts +4 -0
  115. package/dist/networking/xmpp/allRoomPresences.xmpp.d.ts +3 -1
  116. package/dist/networking/xmpp/createTimeoutPromise.xmpp.d.ts +14 -0
  117. package/dist/networking/xmpp/sendTextMessage.xmpp.d.ts +2 -1
  118. package/dist/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts +2 -1
  119. package/dist/networking/xmppClient.d.ts +12 -3
  120. package/dist/pdf-B5b7qHu6.js +17130 -0
  121. package/dist/pdf.worker.min-COYn-gId.js +24385 -0
  122. package/dist/roomStore/index.d.ts +20 -0
  123. package/dist/roomStore/persistEncryption.d.ts +51 -0
  124. package/dist/roomStore/roomsSlice.d.ts +49 -6
  125. package/dist/styles/classNames.d.ts +35 -0
  126. package/dist/styles/motion.d.ts +44 -0
  127. package/dist/styles/tokens.d.ts +27 -0
  128. package/dist/testIds.d.ts +1 -1
  129. package/dist/types/models/attachment.model.d.ts +33 -0
  130. package/dist/types/models/config.model.d.ts +179 -19
  131. package/dist/types/models/file.model.d.ts +20 -0
  132. package/dist/types/models/message.model.d.ts +16 -6
  133. package/dist/types/models/room.model.d.ts +12 -2
  134. package/dist/types/types.d.ts +3 -1
  135. package/dist/utils/resendMessage.d.ts +22 -1
  136. package/dist/utils/translateModePolicy.d.ts +1 -0
  137. package/dist/wavesurfer.esm-D_a19qBW.js +952 -0
  138. package/package.json +22 -2
  139. package/dist/VideoCallOverlay-BUfKp87t.js.map +0 -1
  140. package/dist/components/MainComponents/VirtualList.d.ts +0 -10
  141. package/dist/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.d.ts +0 -6
  142. package/dist/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.d.ts +0 -6
  143. package/dist/components/Modals/SettingsModals/ManageDataModal/StyledComponents.d.ts +0 -0
  144. package/dist/components/Modals/SettingsModals/ProfileShares/ProfileShares.d.ts +0 -6
  145. package/dist/components/Modals/SettingsModals/Referrals/Referrals.d.ts +0 -6
  146. package/dist/hooks/useMessageQueue.d.ts +0 -4
  147. package/dist/main-DFqqDiy-.js +0 -55707
  148. package/dist/main-DFqqDiy-.js.map +0 -1
  149. package/dist/main.js.map +0 -1
  150. package/dist/networking/xmpp/getHistory.xmpp.d.ts +0 -3
  151. package/dist/networking/xmpp/listenerManager.d.ts +0 -17
  152. package/dist/utils/xmppMemoryMonitor.d.ts +0 -16
@@ -0,0 +1,19 @@
1
+ import { ApiFile } from '../../types/types';
2
+ export interface GetMyFilesResult {
3
+ items: ApiFile[];
4
+ total: number;
5
+ limit: number;
6
+ offset: number;
7
+ }
8
+ interface GetMyFilesOptions {
9
+ limit: number;
10
+ offset: number;
11
+ signal?: AbortSignal;
12
+ }
13
+ export type FilesEndpointSupport = 'unknown' | 'supported' | 'unsupported';
14
+ export declare function getFilesEndpointSupport(token: string): FilesEndpointSupport;
15
+ export declare function subscribeFilesEndpointSupport(listener: () => void): () => void;
16
+ export declare function __resetFilesEndpointSupportForTests(): void;
17
+ export declare function getMyFiles(options: GetMyFilesOptions): Promise<GetMyFilesResult>;
18
+ export declare function deleteMyFile(id: string): Promise<void>;
19
+ export {};
@@ -1,9 +1,17 @@
1
1
  import { ApiRoom, DeleteRoomMember, PostAddRoomMember, PostReportRoom, PostRoom, RoomMember } from '../../types/types';
2
2
  export declare function invalidateRoomsCache(): void;
3
- export declare function getRooms(): Promise<{
3
+ export declare function getRooms(signal?: AbortSignal): Promise<{
4
4
  items: ApiRoom[];
5
5
  }>;
6
- export declare function getRoomByName(chatName: string): Promise<ApiRoom>;
6
+ export declare function getRoomByName(chatName: string, signal?: AbortSignal): Promise<ApiRoom>;
7
+ export declare function muteRoom(chatName: string): Promise<{
8
+ chatName: string;
9
+ muted: boolean;
10
+ } | undefined>;
11
+ export declare function unmuteRoom(chatName: string): Promise<{
12
+ chatName: string;
13
+ muted: boolean;
14
+ } | undefined>;
7
15
  export declare function postRoom(data: PostRoom): Promise<any>;
8
16
  export declare function postPrivateRoom(username: string, title?: string): Promise<ApiRoom>;
9
17
  export declare function postReportRoom(data: PostReportRoom): Promise<any>;
@@ -0,0 +1,15 @@
1
+ import { Translation } from '../../helpers/transformTranslatations';
2
+ /** Test-only escape hatch for the module-level 404 negative-cache. */
3
+ export declare const resetTranslateEndpointAvailabilityForTests: () => void;
4
+ /**
5
+ * Fetch a translation of `text` (written in `source`) from the translate
6
+ * service at `endpoint`, returning the entry matching `readerLocale`, or
7
+ * undefined when there's genuinely nothing to show (no source language, no
8
+ * usable endpoint, the request failed, or the service simply doesn't cover
9
+ * that locale).
10
+ *
11
+ * Best-effort by design and never throws: a manual "Translate" click should
12
+ * end in either a translation or the existing `translation.failed` retry
13
+ * link, never an unhandled rejection.
14
+ */
15
+ export declare const fetchTranslation: (text: string, source: string | undefined, readerLocale: string, endpoint: string | undefined) => Promise<Translation | undefined>;
@@ -2,6 +2,7 @@ import { User } from '../../types/types';
2
2
  interface GetMyUserOptions {
3
3
  token?: string;
4
4
  endpoint?: string;
5
+ signal?: AbortSignal;
5
6
  }
6
7
  export declare function getDocuments(walletAddress: string): Promise<import('axios').AxiosResponse<any, any, {}>>;
7
8
  export declare function getExportMyData(): Promise<import('axios').AxiosResponse<any, any, {}>>;
@@ -10,5 +11,6 @@ export declare function updateMe(data: any): Promise<import('axios').AxiosRespon
10
11
  export declare function updateProfile(fd: FormData): Promise<{
11
12
  user: User;
12
13
  }>;
14
+ export declare function invalidateMyUserCache(): void;
13
15
  export declare function getMyUser(options?: GetMyUserOptions): Promise<User>;
14
16
  export {};
@@ -0,0 +1,4 @@
1
+ export interface SharedRequest<T> {
2
+ join(signal?: AbortSignal): Promise<T>;
3
+ }
4
+ export declare const createSharedRequest: <T>(start: (signal: AbortSignal) => Promise<T>) => SharedRequest<T>;
@@ -4,9 +4,11 @@ export interface AllRoomPresenceSummary {
4
4
  success: number;
5
5
  failed: number;
6
6
  failedRooms: string[];
7
+ sweptRooms: string[];
7
8
  failures?: Array<{
8
9
  roomJid: string;
9
10
  reason: string;
10
11
  }>;
11
12
  }
12
- export declare function allRoomPresences(client: Client): Promise<AllRoomPresenceSummary>;
13
+ export type RoomJoiner = (roomJid: string) => Promise<boolean>;
14
+ export declare function allRoomPresences(client: Client, join?: RoomJoiner): Promise<AllRoomPresenceSummary>;
@@ -1 +1,15 @@
1
1
  export declare function createTimeoutPromise(ms: number | undefined, unsubscribe?: () => void): Promise<unknown>;
2
+ /**
3
+ * Same timeout-that-rejects behavior as createTimeoutPromise, but also
4
+ * hands back a cancel handle. createTimeoutPromise's timer keeps running
5
+ * (and holds its closure alive) even after the caller's Promise.race
6
+ * already settled via the "real" branch winning - it only stops once it
7
+ * fires and rejects into a race branch nobody is listening to anymore.
8
+ * Callers that care about that (they clear the handle in a finally) should
9
+ * use this instead; createTimeoutPromise itself is left untouched so
10
+ * existing call sites keep working unchanged.
11
+ */
12
+ export declare function createCancelableTimeoutPromise(ms: number | undefined, unsubscribe?: () => void): {
13
+ promise: Promise<never>;
14
+ cancel: () => void;
15
+ };
@@ -1,2 +1,3 @@
1
1
  import { Client } from '@xmpp/client';
2
- export declare const sendTextMessage: (client: Client, roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, devServer?: string, customId?: string) => boolean;
2
+ import { IMentionSpan } from '../../types/types';
3
+ export declare const sendTextMessage: (client: Client, roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, devServer?: string, customId?: string, mentions?: IMentionSpan[]) => boolean;
@@ -1,5 +1,5 @@
1
1
  import { Client } from '@xmpp/client';
2
- import { Iso639_1Codes } from '../../types/types';
2
+ import { Iso639_1Codes, IMentionSpan } from '../../types/types';
3
3
  export declare const sendTextMessageWithTranslateTag: (client: Client, stanzaMessage: {
4
4
  roomJID: string;
5
5
  firstName: string;
@@ -12,4 +12,5 @@ export declare const sendTextMessageWithTranslateTag: (client: Client, stanzaMes
12
12
  showInChannel?: boolean;
13
13
  mainMessage?: string;
14
14
  devServer?: string;
15
+ mentions?: IMentionSpan[];
15
16
  }, source: Iso639_1Codes, customId?: string) => boolean;
@@ -1,5 +1,5 @@
1
1
  import { Client } from '@xmpp/client';
2
- import { Iso639_1Codes, XmppClientInterface, xmppSettingsInterface, IMessage } from '../types/types';
2
+ import { Iso639_1Codes, XmppClientInterface, xmppSettingsInterface, IMessage, IMentionSpan } from '../types/types';
3
3
  import { AllRoomPresenceSummary } from './xmpp/allRoomPresences.xmpp';
4
4
  type HistorySource = 'active' | 'send_ack' | 'background' | 'default';
5
5
  export type XmppCredentialsProvider = () => Promise<{
@@ -213,8 +213,8 @@ export declare class XmppClient implements XmppClientInterface {
213
213
  getRoomMembersStanza: (roomJID: string) => void;
214
214
  setVCardStanza(xmppUsername: string): void;
215
215
  sendMessageWithPingCheck(sendFn: () => Promise<boolean>): Promise<boolean>;
216
- sendMessage: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, customId?: string) => Promise<boolean>;
217
- sendTextMessageWithTranslateTagStanza: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, langSource?: Iso639_1Codes, customId?: string) => Promise<boolean>;
216
+ sendMessage: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, customId?: string, mentions?: IMentionSpan[]) => Promise<boolean>;
217
+ sendTextMessageWithTranslateTagStanza: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, langSource?: Iso639_1Codes, customId?: string, mentions?: IMentionSpan[]) => Promise<boolean>;
218
218
  deleteMessageStanza(room: string, msgId: string): void;
219
219
  editMessageStanza(room: string, msgId: string, text: string): void;
220
220
  sendMessageReactionStanza(messageId: string, roomJid: string, reactionsList: string[], reactionSymbol?: any): void;
@@ -227,6 +227,15 @@ export declare class XmppClient implements XmppClientInterface {
227
227
  sendPingStanza(): void;
228
228
  handlePong(): void;
229
229
  handlePingTimeout(): void;
230
+ /**
231
+ * Is this message id already owned by another outbound path?
232
+ *
233
+ * The reconnect drain, the send queue and the manual retry can all reach
234
+ * for the same message. Only one of them may put it on the wire, or the
235
+ * ROOM (not just our local list) ends up with two copies - the duplicate
236
+ * half of React Native defect #31.
237
+ */
238
+ isSendPending(messageId?: string): boolean;
230
239
  private drainHeap;
231
240
  private isBrowserOnline;
232
241
  private scheduleReconnect;