stream-chat-react 10.14.1 → 10.16.0

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 (127) hide show
  1. package/dist/browser.full-bundle.js +6587 -6455
  2. package/dist/browser.full-bundle.js.map +1 -1
  3. package/dist/browser.full-bundle.min.js +5 -5
  4. package/dist/browser.full-bundle.min.js.map +1 -1
  5. package/dist/components/AutoCompleteTextarea/List.js +1 -1
  6. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  7. package/dist/components/Avatar/Avatar.js +1 -1
  8. package/dist/components/ChannelList/ChannelList.d.ts.map +1 -1
  9. package/dist/components/ChannelList/ChannelList.js +2 -1
  10. package/dist/components/Chat/hooks/useChannelsQueryState.d.ts +3 -3
  11. package/dist/components/Chat/hooks/useChannelsQueryState.d.ts.map +1 -1
  12. package/dist/components/Chat/hooks/useChannelsQueryState.js +1 -1
  13. package/dist/components/DateSeparator/DateSeparator.js +1 -1
  14. package/dist/components/EventComponent/EventComponent.js +1 -1
  15. package/dist/components/Message/FixedHeightMessage.js +1 -1
  16. package/dist/components/Message/MessageText.js +2 -2
  17. package/dist/components/Message/index.d.ts +1 -0
  18. package/dist/components/Message/index.d.ts.map +1 -1
  19. package/dist/components/Message/index.js +1 -0
  20. package/dist/components/Message/renderText/Anchor.d.ts +4 -0
  21. package/dist/components/Message/renderText/Anchor.d.ts.map +1 -0
  22. package/dist/components/Message/renderText/Anchor.js +10 -0
  23. package/dist/components/Message/renderText/Emoji.d.ts +3 -0
  24. package/dist/components/Message/renderText/Emoji.d.ts.map +1 -0
  25. package/dist/components/Message/renderText/Emoji.js +5 -0
  26. package/dist/components/Message/renderText/Mention.d.ts +18 -0
  27. package/dist/components/Message/renderText/Mention.d.ts.map +1 -0
  28. package/dist/components/Message/renderText/Mention.js +5 -0
  29. package/dist/components/Message/renderText/index.d.ts +5 -0
  30. package/dist/components/Message/renderText/index.d.ts.map +1 -0
  31. package/dist/components/Message/renderText/index.js +3 -0
  32. package/dist/components/Message/renderText/regex.d.ts +5 -0
  33. package/dist/components/Message/renderText/regex.d.ts.map +1 -0
  34. package/dist/components/Message/renderText/regex.js +21 -0
  35. package/dist/components/Message/renderText/rehypePlugins.d.ts +7 -0
  36. package/dist/components/Message/renderText/rehypePlugins.d.ts.map +1 -0
  37. package/dist/components/Message/renderText/rehypePlugins.js +60 -0
  38. package/dist/components/Message/renderText/renderText.d.ts +21 -0
  39. package/dist/components/Message/renderText/renderText.d.ts.map +1 -0
  40. package/dist/components/Message/renderText/renderText.js +126 -0
  41. package/dist/components/Message/types.d.ts +1 -1
  42. package/dist/components/Message/types.d.ts.map +1 -1
  43. package/dist/components/Message/utils.d.ts +1 -0
  44. package/dist/components/Message/utils.d.ts.map +1 -1
  45. package/dist/components/Message/utils.js +8 -0
  46. package/dist/components/MessageInput/hooks/useCommandTrigger.d.ts.map +1 -1
  47. package/dist/components/MessageInput/hooks/useCommandTrigger.js +21 -2
  48. package/dist/components/MessageList/MessageList.d.ts.map +1 -1
  49. package/dist/components/MessageList/MessageList.js +1 -3
  50. package/dist/components/MessageList/VirtualizedMessageList.d.ts +36 -6
  51. package/dist/components/MessageList/VirtualizedMessageList.d.ts.map +1 -1
  52. package/dist/components/MessageList/VirtualizedMessageList.js +39 -122
  53. package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts +23 -0
  54. package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts.map +1 -0
  55. package/dist/components/MessageList/VirtualizedMessageListComponents.js +70 -0
  56. package/dist/components/MessageList/hooks/MessageList/index.d.ts +5 -0
  57. package/dist/components/MessageList/hooks/MessageList/index.d.ts.map +1 -0
  58. package/dist/components/MessageList/hooks/MessageList/index.js +4 -0
  59. package/dist/components/MessageList/hooks/{useEnrichedMessages.d.ts → MessageList/useEnrichedMessages.d.ts} +3 -3
  60. package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts.map +1 -0
  61. package/dist/components/MessageList/hooks/{useEnrichedMessages.js → MessageList/useEnrichedMessages.js} +3 -3
  62. package/dist/components/MessageList/hooks/{useMessageListElements.d.ts → MessageList/useMessageListElements.d.ts} +4 -4
  63. package/dist/components/MessageList/hooks/MessageList/useMessageListElements.d.ts.map +1 -0
  64. package/dist/components/MessageList/hooks/{useMessageListElements.js → MessageList/useMessageListElements.js} +9 -9
  65. package/dist/components/MessageList/hooks/{useMessageListScrollManager.d.ts → MessageList/useMessageListScrollManager.d.ts} +2 -2
  66. package/dist/components/MessageList/hooks/MessageList/useMessageListScrollManager.d.ts.map +1 -0
  67. package/dist/components/MessageList/hooks/{useMessageListScrollManager.js → MessageList/useMessageListScrollManager.js} +1 -1
  68. package/dist/components/MessageList/hooks/{useScrollLocationLogic.d.ts → MessageList/useScrollLocationLogic.d.ts} +2 -2
  69. package/dist/components/MessageList/hooks/MessageList/useScrollLocationLogic.d.ts.map +1 -0
  70. package/dist/components/MessageList/hooks/VirtualizedMessageList/index.d.ts +7 -0
  71. package/dist/components/MessageList/hooks/VirtualizedMessageList/index.d.ts.map +1 -0
  72. package/dist/components/MessageList/hooks/VirtualizedMessageList/index.js +6 -0
  73. package/dist/components/MessageList/hooks/{useGiphyPreview.d.ts → VirtualizedMessageList/useGiphyPreview.d.ts} +2 -2
  74. package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.d.ts.map +1 -0
  75. package/dist/components/MessageList/hooks/{useGiphyPreview.js → VirtualizedMessageList/useGiphyPreview.js} +1 -1
  76. package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.d.ts +10 -0
  77. package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.d.ts.map +1 -0
  78. package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.js +20 -0
  79. package/dist/components/MessageList/hooks/{useNewMessageNotification.d.ts → VirtualizedMessageList/useNewMessageNotification.d.ts} +2 -2
  80. package/dist/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.d.ts.map +1 -0
  81. package/dist/components/MessageList/hooks/{usePrependMessagesCount.d.ts → VirtualizedMessageList/usePrependMessagesCount.d.ts} +2 -2
  82. package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.d.ts.map +1 -0
  83. package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts +12 -0
  84. package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts.map +1 -0
  85. package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.js +28 -0
  86. package/dist/components/MessageList/hooks/{useShouldForceScrollToBottom.d.ts → VirtualizedMessageList/useShouldForceScrollToBottom.d.ts} +2 -2
  87. package/dist/components/MessageList/hooks/VirtualizedMessageList/useShouldForceScrollToBottom.d.ts.map +1 -0
  88. package/dist/components/MessageList/hooks/index.d.ts +7 -7
  89. package/dist/components/MessageList/hooks/index.d.ts.map +1 -1
  90. package/dist/components/MessageList/hooks/index.js +7 -7
  91. package/dist/context/MessageContext.d.ts +1 -1
  92. package/dist/context/MessageContext.d.ts.map +1 -1
  93. package/dist/i18n/Streami18n.d.ts +4 -3
  94. package/dist/i18n/Streami18n.d.ts.map +1 -1
  95. package/dist/i18n/Streami18n.js +3 -4
  96. package/dist/index.cjs.js +653 -592
  97. package/dist/index.cjs.js.map +1 -1
  98. package/dist/index.d.ts +0 -1
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +0 -2
  101. package/dist/utils/generateRandomId.d.ts +6 -0
  102. package/dist/utils/generateRandomId.d.ts.map +1 -0
  103. package/dist/utils/generateRandomId.js +5 -0
  104. package/dist/utils/getWholeChar.d.ts +2 -0
  105. package/dist/utils/getWholeChar.d.ts.map +1 -0
  106. package/dist/utils/getWholeChar.js +26 -0
  107. package/dist/utils/index.d.ts +4 -0
  108. package/dist/utils/index.d.ts.map +1 -0
  109. package/dist/utils/index.js +3 -0
  110. package/dist/version.d.ts +1 -1
  111. package/dist/version.js +1 -1
  112. package/package.json +1 -1
  113. package/dist/components/MessageList/hooks/useEnrichedMessages.d.ts.map +0 -1
  114. package/dist/components/MessageList/hooks/useGiphyPreview.d.ts.map +0 -1
  115. package/dist/components/MessageList/hooks/useMessageListElements.d.ts.map +0 -1
  116. package/dist/components/MessageList/hooks/useMessageListScrollManager.d.ts.map +0 -1
  117. package/dist/components/MessageList/hooks/useNewMessageNotification.d.ts.map +0 -1
  118. package/dist/components/MessageList/hooks/usePrependMessagesCount.d.ts.map +0 -1
  119. package/dist/components/MessageList/hooks/useScrollLocationLogic.d.ts.map +0 -1
  120. package/dist/components/MessageList/hooks/useShouldForceScrollToBottom.d.ts.map +0 -1
  121. package/dist/utils.d.ts +0 -42
  122. package/dist/utils.d.ts.map +0 -1
  123. package/dist/utils.js +0 -253
  124. /package/dist/components/MessageList/hooks/{useScrollLocationLogic.js → MessageList/useScrollLocationLogic.js} +0 -0
  125. /package/dist/components/MessageList/hooks/{useNewMessageNotification.js → VirtualizedMessageList/useNewMessageNotification.js} +0 -0
  126. /package/dist/components/MessageList/hooks/{usePrependMessagesCount.js → VirtualizedMessageList/usePrependMessagesCount.js} +0 -0
  127. /package/dist/components/MessageList/hooks/{useShouldForceScrollToBottom.js → VirtualizedMessageList/useShouldForceScrollToBottom.js} +0 -0
@@ -1,5 +1,5 @@
1
- import type { StreamMessage } from '../../../context/ChannelStateContext';
2
- import type { DefaultStreamChatGenerics } from '../../../types/types';
1
+ import type { StreamMessage } from '../../../../context/ChannelStateContext';
2
+ import type { DefaultStreamChatGenerics } from '../../../../types/types';
3
3
  export declare type ContainerMeasures = {
4
4
  offsetHeight: number;
5
5
  scrollHeight: number;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMessageListScrollManager.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/MessageList/useMessageListScrollManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,oBAAY,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,iCAAiC,CAC3C,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,uBAAuB,EAAE,MAAM,CAAC;IAChC,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC9C,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;IACjD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAGF,wBAAgB,2BAA2B,CACzC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,EAChF,MAAM,EAAE,iCAAiC,CAAC,kBAAkB,CAAC,oBAmErC,MAAM,UAG/B"}
@@ -1,5 +1,5 @@
1
1
  import { useLayoutEffect, useRef } from 'react';
2
- import { useChatContext } from '../../../context/ChatContext';
2
+ import { useChatContext } from '../../../../context/ChatContext';
3
3
  // FIXME: change this generic name to something like useAdjustScrollPositionToListSize
4
4
  export function useMessageListScrollManager(params) {
5
5
  var loadMoreScrollThreshold = params.loadMoreScrollThreshold, onScrollBy = params.onScrollBy, scrollContainerMeasures = params.scrollContainerMeasures, scrolledUpThreshold = params.scrolledUpThreshold, scrollToBottom = params.scrollToBottom, showNewMessages = params.showNewMessages;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import type { StreamMessage } from '../../../context/ChannelStateContext';
3
- import type { DefaultStreamChatGenerics } from '../../../types/types';
2
+ import type { StreamMessage } from '../../../../context/ChannelStateContext';
3
+ import type { DefaultStreamChatGenerics } from '../../../../types/types';
4
4
  export declare type UseScrollLocationLogicParams<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
5
5
  hasMoreNewer: boolean;
6
6
  listElement: HTMLDivElement | null;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollLocationLogic.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/MessageList/useScrollLocationLogic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAI9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,oBAAY,4BAA4B,CACtC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,cAAc,GAAG,IAAI,CAAC;IACnC,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC/C,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;sBA0DvB,aAAa,CAAC,cAAc,CAAC;;;CAgCxC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './useGiphyPreview';
2
+ export * from './useMessageSetKey';
3
+ export * from './useNewMessageNotification';
4
+ export * from './usePrependMessagesCount';
5
+ export * from './useScrollToBottomOnNewMessage';
6
+ export * from './useShouldForceScrollToBottom';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/VirtualizedMessageList/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './useGiphyPreview';
2
+ export * from './useMessageSetKey';
3
+ export * from './useNewMessageNotification';
4
+ export * from './usePrependMessagesCount';
5
+ export * from './useScrollToBottomOnNewMessage';
6
+ export * from './useShouldForceScrollToBottom';
@@ -1,5 +1,5 @@
1
- import type { StreamMessage } from '../../../context/ChannelStateContext';
2
- import type { DefaultStreamChatGenerics } from '../../../types/types';
1
+ import type { StreamMessage } from '../../../../context/ChannelStateContext';
2
+ import type { DefaultStreamChatGenerics } from '../../../../types/types';
3
3
  export declare const useGiphyPreview: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(separateGiphyPreview: boolean) => {
4
4
  giphyPreviewMessage: StreamMessage<StreamChatGenerics> | undefined;
5
5
  setGiphyPreviewMessage: import("react").Dispatch<import("react").SetStateAction<StreamMessage<StreamChatGenerics> | undefined>>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGiphyPreview.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,eAAO,MAAM,eAAe,2GAGJ,OAAO;;;CAsB9B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from 'react';
2
- import { useChatContext } from '../../../context/ChatContext';
2
+ import { useChatContext } from '../../../../context/ChatContext';
3
3
  export var useGiphyPreview = function (separateGiphyPreview) {
4
4
  var _a = useState(), giphyPreviewMessage = _a[0], setGiphyPreviewMessage = _a[1];
5
5
  var client = useChatContext('useGiphyPreview').client;
@@ -0,0 +1,10 @@
1
+ import { StreamMessage } from '../../../../context';
2
+ import { DefaultStreamChatGenerics } from '../../../../types/types';
3
+ declare type UseMessageSetKeyParams<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
4
+ messages?: StreamMessage<StreamChatGenerics>[];
5
+ };
6
+ export declare const useMessageSetKey: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ messages, }: UseMessageSetKeyParams<StreamChatGenerics>) => {
7
+ messageSetKey: number;
8
+ };
9
+ export {};
10
+ //# sourceMappingURL=useMessageSetKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMessageSetKey.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,aAAK,sBAAsB,CACzB,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,QAAQ,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,gBAAgB;;CAsB5B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ export var useMessageSetKey = function (_a) {
3
+ var messages = _a.messages;
4
+ /**
5
+ * Logic to update the key of the virtuoso component when the list jumps to a new location.
6
+ */
7
+ var _b = useState(+new Date()), messageSetKey = _b[0], setMessageSetKey = _b[1];
8
+ var firstMessageId = useRef();
9
+ useEffect(function () {
10
+ var _a;
11
+ var continuousSet = messages === null || messages === void 0 ? void 0 : messages.find(function (message) { return message.id === firstMessageId.current; });
12
+ if (!continuousSet) {
13
+ setMessageSetKey(+new Date());
14
+ }
15
+ firstMessageId.current = (_a = messages === null || messages === void 0 ? void 0 : messages[0]) === null || _a === void 0 ? void 0 : _a.id;
16
+ }, [messages]);
17
+ return {
18
+ messageSetKey: messageSetKey,
19
+ };
20
+ };
@@ -1,5 +1,5 @@
1
- import type { StreamMessage } from '../../../context/ChannelStateContext';
2
- import type { DefaultStreamChatGenerics } from '../../../types/types';
1
+ import type { StreamMessage } from '../../../../context/ChannelStateContext';
2
+ import type { DefaultStreamChatGenerics } from '../../../../types/types';
3
3
  export declare function useNewMessageNotification<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(messages: StreamMessage<StreamChatGenerics>[], currentUserId: string | undefined, hasMoreNewer?: boolean): {
4
4
  atBottom: import("react").MutableRefObject<boolean>;
5
5
  isMessageListScrolledToBottom: boolean;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNewMessageNotification.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,wBAAgB,yBAAyB,CACvC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,EAEhF,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,EAC7C,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,YAAY,CAAC,EAAE,OAAO;;;;;;EA6CvB"}
@@ -1,4 +1,4 @@
1
- import type { StreamMessage } from '../../../context/ChannelStateContext';
2
- import type { DefaultStreamChatGenerics } from '../../../types/types';
1
+ import type { StreamMessage } from '../../../../context/ChannelStateContext';
2
+ import type { DefaultStreamChatGenerics } from '../../../../types/types';
3
3
  export declare function usePrependedMessagesCount<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(messages: StreamMessage<StreamChatGenerics>[], hasDateSeparator: boolean): number;
4
4
  //# sourceMappingURL=usePrependMessagesCount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrependMessagesCount.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAIzE,wBAAgB,yBAAyB,CACvC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,EAChF,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,UA2DzE"}
@@ -0,0 +1,12 @@
1
+ import { StreamMessage } from '../../../../context';
2
+ import { DefaultStreamChatGenerics } from '../../../../types/types';
3
+ declare type UseScrollToBottomOnNewMessageParams<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
4
+ /** */
5
+ scrollToBottom: () => void;
6
+ messages?: StreamMessage<StreamChatGenerics>[];
7
+ /** When `true`, the list will scroll to the latest message when the window regains focus */
8
+ scrollToLatestMessageOnFocus?: boolean;
9
+ };
10
+ export declare const useScrollToBottomOnNewMessage: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ messages, scrollToBottom, scrollToLatestMessageOnFocus, }: UseScrollToBottomOnNewMessageParams<StreamChatGenerics>) => void;
11
+ export {};
12
+ //# sourceMappingURL=useScrollToBottomOnNewMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollToBottomOnNewMessage.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,aAAK,mCAAmC,CACtC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,MAAM;IACN,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC/C,4FAA4F;IAC5F,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,6BAA6B,kNA2CzC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import React, { useCallback, useEffect } from 'react';
2
+ export var useScrollToBottomOnNewMessage = function (_a) {
3
+ var messages = _a.messages, scrollToBottom = _a.scrollToBottom, scrollToLatestMessageOnFocus = _a.scrollToLatestMessageOnFocus;
4
+ var _b = React.useState(false), newMessagesReceivedInBackground = _b[0], setNewMessagesReceivedInBackground = _b[1];
5
+ var resetNewMessagesReceivedInBackground = useCallback(function () {
6
+ setNewMessagesReceivedInBackground(false);
7
+ }, []);
8
+ useEffect(function () {
9
+ setNewMessagesReceivedInBackground(true);
10
+ }, [messages]);
11
+ var scrollToBottomIfConfigured = useCallback(function (event) {
12
+ if (!scrollToLatestMessageOnFocus ||
13
+ !newMessagesReceivedInBackground ||
14
+ event.target !== window)
15
+ return;
16
+ setTimeout(scrollToBottom, 100);
17
+ }, [scrollToLatestMessageOnFocus, scrollToBottom, newMessagesReceivedInBackground]);
18
+ useEffect(function () {
19
+ if (typeof window !== 'undefined') {
20
+ window.addEventListener('focus', scrollToBottomIfConfigured);
21
+ window.addEventListener('blur', resetNewMessagesReceivedInBackground);
22
+ }
23
+ return function () {
24
+ window.removeEventListener('focus', scrollToBottomIfConfigured);
25
+ window.removeEventListener('blur', resetNewMessagesReceivedInBackground);
26
+ };
27
+ }, [scrollToBottomIfConfigured]);
28
+ };
@@ -1,4 +1,4 @@
1
- import type { StreamMessage } from '../../../context/ChannelStateContext';
2
- import type { DefaultStreamChatGenerics } from '../../../types/types';
1
+ import type { StreamMessage } from '../../../../context/ChannelStateContext';
2
+ import type { DefaultStreamChatGenerics } from '../../../../types/types';
3
3
  export declare function useShouldForceScrollToBottom<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(messages: StreamMessage<StreamChatGenerics>[], currentUserId?: string): () => boolean;
4
4
  //# sourceMappingURL=useShouldForceScrollToBottom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useShouldForceScrollToBottom.d.ts","sourceRoot":"","sources":["../../../../../src/components/MessageList/hooks/VirtualizedMessageList/useShouldForceScrollToBottom.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,wBAAgB,4BAA4B,CAC1C,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,EAChF,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,EAAE,aAAa,CAAC,EAAE,MAAM,iBA2BtE"}
@@ -1,9 +1,9 @@
1
- export * from './useEnrichedMessages';
1
+ export * from './MessageList/useEnrichedMessages';
2
+ export * from './MessageList/useMessageListElements';
3
+ export * from './MessageList/useMessageListScrollManager';
4
+ export * from './MessageList/useScrollLocationLogic';
2
5
  export * from './useLastReadData';
3
- export * from './useMessageListElements';
4
- export * from './useMessageListScrollManager';
5
- export * from './useNewMessageNotification';
6
- export * from './usePrependMessagesCount';
7
- export * from './useScrollLocationLogic';
8
- export * from './useShouldForceScrollToBottom';
6
+ export * from './VirtualizedMessageList/useNewMessageNotification';
7
+ export * from './VirtualizedMessageList/usePrependMessagesCount';
8
+ export * from './VirtualizedMessageList/useShouldForceScrollToBottom';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageList/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageList/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AACjE,cAAc,uDAAuD,CAAC"}
@@ -1,8 +1,8 @@
1
- export * from './useEnrichedMessages';
1
+ export * from './MessageList/useEnrichedMessages';
2
+ export * from './MessageList/useMessageListElements';
3
+ export * from './MessageList/useMessageListScrollManager';
4
+ export * from './MessageList/useScrollLocationLogic';
2
5
  export * from './useLastReadData';
3
- export * from './useMessageListElements';
4
- export * from './useMessageListScrollManager';
5
- export * from './useNewMessageNotification';
6
- export * from './usePrependMessagesCount';
7
- export * from './useScrollLocationLogic';
8
- export * from './useShouldForceScrollToBottom';
6
+ export * from './VirtualizedMessageList/useNewMessageNotification';
7
+ export * from './VirtualizedMessageList/usePrependMessagesCount';
8
+ export * from './VirtualizedMessageList/useShouldForceScrollToBottom';
@@ -8,7 +8,7 @@ import type { ReactEventHandler } from '../components/Message/types';
8
8
  import type { MessageActionsArray } from '../components/Message/utils';
9
9
  import type { MessageInputProps } from '../components/MessageInput/MessageInput';
10
10
  import type { GroupStyle } from '../components/MessageList/utils';
11
- import type { RenderTextOptions } from '../utils';
11
+ import type { RenderTextOptions } from '../components/Message/renderText';
12
12
  import type { DefaultStreamChatGenerics, UnknownType } from '../types/types';
13
13
  export declare type CustomMessageActions<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
14
14
  [key: string]: (message: StreamMessage<StreamChatGenerics>, event: React.BaseSyntheticEvent) => Promise<void> | void;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageContext.d.ts","sourceRoot":"","sources":["../../src/context/MessageContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAc,M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,EAAE,CACX,IAAI,CAAC,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,EAAE,EACpD,OAAO,CAAC,EAAE,iBAAiB,KACxB,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,gDAAgD;IAChD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gFAAgF;IAChF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,cAAc,2EAAkE,CAAC;AAE9F,eAAO,MAAM,eAAe;;kBAW3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,qGAGZ,MAAM,4CAavB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;CAqB9B,CAAC"}
@@ -26,7 +26,7 @@ declare type CalendarLocaleConfig = {
26
26
  sameElse: string;
27
27
  };
28
28
  declare type DateTimeParserModule = typeof Dayjs | typeof momentTimezone;
29
- declare type Options = {
29
+ export declare type Streami18nOptions = {
30
30
  DateTimeParser?: DateTimeParserModule;
31
31
  dayjsLocaleConfigForLanguage?: Partial<ILocale> & {
32
32
  calendar?: CalendarLocaleConfig;
@@ -35,6 +35,7 @@ declare type Options = {
35
35
  disableDateTimeTranslations?: boolean;
36
36
  language?: TranslationLanguages;
37
37
  logger?: (message?: string) => void;
38
+ parseMissingKeyHandler?: (key: string, defaultValue?: string) => string;
38
39
  timezone?: string;
39
40
  translationsForLanguage?: Partial<typeof enTranslations>;
40
41
  };
@@ -76,7 +77,7 @@ export declare class Streami18n {
76
77
  keySeparator: false;
77
78
  lng: string;
78
79
  nsSeparator: false;
79
- parseMissingKeyHandler: (key: string) => string;
80
+ parseMissingKeyHandler?: (key: string, defaultValue?: string) => string;
80
81
  };
81
82
  /**
82
83
  * A valid TZ identifier string (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
@@ -108,7 +109,7 @@ export declare class Streami18n {
108
109
  *
109
110
  * @param {*} options
110
111
  */
111
- constructor(options?: Options);
112
+ constructor(options?: Streami18nOptions);
112
113
  /**
113
114
  * Initializes the i18next instance with configuration (which enables natural language as default keys)
114
115
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Streami18n.d.ts","sourceRoot":"","sources":["../../src/i18n/Streami18n.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAEL,cAAc,EAWf,MAAM,gBAAgB,CAAC;AAKxB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AAIzB,OAAO,iBAAiB,CAAC;AAEzB,aAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA+KF,aAAK,oBAAoB,GAAG,OAAO,KAAK,GAAG,OAAO,cAAc,CAAC;AAWjE,aAAK,OAAO,GAAG;IACb,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,4BAA4B,CAAC,EAAE,OAAO,C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c,oBAAoB,aAI5C;IAEF,uBAAuB,aAWrB;IAEF,qEAAqE;IACrE,cAAc,+BAA2B;IAEzC,2CAA2C;IAC3C,qBAAqB,iBAAwC;IAE7D,uEAAuE;IACvE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAA2B;IAE1C;;OAEG;IACG,cAAc;;;;IAepB,mBAAmB,CACjB,QAAQ,EAAE,oBAAoB,EAC9B,WAAW,EAAE,OAAO,cAAc,EAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;IA+BtC,iBAAiB,CAAC,GAAG,EAAE,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC;IAS/D,WAAW,CAAC,QAAQ,EAAE,oBAAoB;IAmBhD,2BAA2B,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI;CAG7D"}
@@ -477,11 +477,10 @@ var Streami18n = /** @class */ (function () {
477
477
  keySeparator: false,
478
478
  lng: this.currentLanguage,
479
479
  nsSeparator: false,
480
- parseMissingKeyHandler: function (key) {
481
- _this.logger("Streami18n: Missing translation for key: ".concat(key));
482
- return key;
483
- },
484
480
  };
481
+ if (finalOptions.parseMissingKeyHandler) {
482
+ this.i18nextConfig.parseMissingKeyHandler = finalOptions.parseMissingKeyHandler;
483
+ }
485
484
  this.validateCurrentLanguage();
486
485
  var dayjsLocaleConfigForLanguage = finalOptions.dayjsLocaleConfigForLanguage;
487
486
  if (dayjsLocaleConfigForLanguage) {