stream-chat-react 13.13.2 → 13.13.4

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.
@@ -729,6 +729,7 @@ var AIStates = {
729
729
  ExternalSources: "AI_STATE_EXTERNAL_SOURCES",
730
730
  Generating: "AI_STATE_GENERATING",
731
731
  Idle: "AI_STATE_IDLE",
732
+ Stop: "AI_STATE_STOP",
732
733
  Thinking: "AI_STATE_THINKING"
733
734
  };
734
735
  var useAIState = (channel) => {
@@ -750,9 +751,16 @@ var useAIState = (channel) => {
750
751
  setAiState(AIStates.Idle);
751
752
  }
752
753
  });
754
+ const indicatorStoppedListener = channel.on("ai_indicator.stop", (event) => {
755
+ const { cid } = event;
756
+ if (channel.cid === cid) {
757
+ setAiState(AIStates.Stop);
758
+ }
759
+ });
753
760
  return () => {
754
761
  indicatorChangedListener.unsubscribe();
755
762
  indicatorClearedListener.unsubscribe();
763
+ indicatorStoppedListener.unsubscribe();
756
764
  };
757
765
  }, [channel]);
758
766
  return { aiState };
@@ -18797,6 +18805,7 @@ var useMessageTextStreaming = ({
18797
18805
  const interval = setInterval(() => {
18798
18806
  if (!text8 || textCursor.current >= textLength) {
18799
18807
  clearInterval(interval);
18808
+ return;
18800
18809
  }
18801
18810
  const newCursorValue = textCursor.current + renderingLetterCount;
18802
18811
  const newText = text8.substring(0, newCursorValue);
@@ -18807,7 +18816,11 @@ var useMessageTextStreaming = ({
18807
18816
  clearInterval(interval);
18808
18817
  };
18809
18818
  }, [streamingLetterIntervalMs, renderingLetterCount, text8]);
18810
- return { streamedMessageText };
18819
+ const skipAnimation = useStableCallback(() => {
18820
+ textCursor.current = text8.length;
18821
+ setStreamedMessageText(text8);
18822
+ });
18823
+ return { skipAnimation, streamedMessageText };
18811
18824
  };
18812
18825
 
18813
18826
  // src/components/Message/hooks/useMessageReminder.ts
@@ -25947,13 +25960,19 @@ var StreamedMessageText = (props) => {
25947
25960
  streamingLetterIntervalMs
25948
25961
  } = props;
25949
25962
  const { message: messageFromContext } = useMessageContext("StreamedMessageText");
25963
+ const { channel } = useChannelStateContext();
25950
25964
  const message = messageFromProps || messageFromContext;
25951
25965
  const { text: text8 = "" } = message;
25952
- const { streamedMessageText } = useMessageTextStreaming({
25966
+ const { skipAnimation, streamedMessageText } = useMessageTextStreaming({
25953
25967
  renderingLetterCount,
25954
25968
  streamingLetterIntervalMs,
25955
25969
  text: text8
25956
25970
  });
25971
+ (0, import_react160.useEffect)(() => {
25972
+ channel?.on("ai_indicator.stop", () => {
25973
+ skipAnimation();
25974
+ });
25975
+ }, [channel, skipAnimation]);
25957
25976
  return /* @__PURE__ */ import_react160.default.createElement(
25958
25977
  MessageText,
25959
25978
  {
@@ -39269,7 +39288,7 @@ var useChat = ({
39269
39288
  };
39270
39289
  (0, import_react289.useEffect)(() => {
39271
39290
  if (!client) return;
39272
- const version = "13.13.2";
39291
+ const version = "13.13.4";
39273
39292
  const userAgent = client.getUserAgent();
39274
39293
  if (!userAgent.includes("stream-chat-react")) {
39275
39294
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);