stream-chat-react 13.1.0 → 13.1.1

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.
@@ -20880,6 +20880,7 @@ __export(src_exports, {
20880
20880
  MicIcon: () => MicIcon,
20881
20881
  Modal: () => Modal,
20882
20882
  ModalGallery: () => ModalGallery,
20883
+ NotificationTranslationTopic: () => NotificationTranslationTopic,
20883
20884
  PauseIcon: () => PauseIcon2,
20884
20885
  PinIcon: () => PinIcon,
20885
20886
  PinIndicator: () => PinIndicator,
@@ -48820,18 +48821,33 @@ var TranslationBuilder = class {
48820
48821
  constructor(i18next) {
48821
48822
  this.i18next = i18next;
48822
48823
  this.topics = /* @__PURE__ */ new Map();
48824
+ // need to keep a registration buffer so that translators can be registered once a topic is registered
48825
+ // what does not happen when Streami18n is instantiated but rather once Streami18n.init() is invoked
48826
+ this.translatorRegistrationsBuffer = {};
48823
48827
  this.registerTopic = (name2, Topic) => {
48824
- const topic = new Topic({ i18next: this.i18next });
48825
- this.topics.set(name2, topic);
48826
- this.i18next.use({
48827
- name: name2,
48828
- process: (value, key, options) => {
48829
- const topic2 = this.topics.get(name2);
48830
- if (!topic2) return value;
48831
- return topic2.translate(value, key, options);
48832
- },
48833
- type: "postProcessor"
48834
- });
48828
+ let topic = this.topics.get(name2);
48829
+ if (!topic) {
48830
+ topic = new Topic({ i18next: this.i18next });
48831
+ this.topics.set(name2, topic);
48832
+ this.i18next.use({
48833
+ name: name2,
48834
+ process: (value, key, options) => {
48835
+ const topic2 = this.topics.get(name2);
48836
+ if (!topic2) return value;
48837
+ return topic2.translate(value, key, options);
48838
+ },
48839
+ type: "postProcessor"
48840
+ });
48841
+ }
48842
+ const additionalTranslatorsToRegister = this.translatorRegistrationsBuffer[name2];
48843
+ if (additionalTranslatorsToRegister) {
48844
+ Object.entries(additionalTranslatorsToRegister).forEach(
48845
+ ([translatorName, translator]) => {
48846
+ topic.setTranslator(translatorName, translator);
48847
+ }
48848
+ );
48849
+ delete this.translatorRegistrationsBuffer[name2];
48850
+ }
48835
48851
  return topic;
48836
48852
  };
48837
48853
  this.disableTopic = (topicName) => {
@@ -48848,13 +48864,25 @@ var TranslationBuilder = class {
48848
48864
  }
48849
48865
  registerTranslators(topicName, translators) {
48850
48866
  const topic = this.getTopic(topicName);
48851
- if (!topic) return;
48867
+ if (!topic) {
48868
+ if (!this.translatorRegistrationsBuffer[topicName])
48869
+ this.translatorRegistrationsBuffer[topicName] = {};
48870
+ Object.entries(translators).forEach(([translatorName, translator]) => {
48871
+ this.translatorRegistrationsBuffer[topicName][translatorName] = translator;
48872
+ });
48873
+ return;
48874
+ }
48852
48875
  Object.entries(translators).forEach(([name2, translator]) => {
48853
48876
  topic.setTranslator(name2, translator);
48854
48877
  });
48855
48878
  }
48856
48879
  removeTranslators(topicName, translators) {
48857
48880
  const topic = this.getTopic(topicName);
48881
+ if (this.translatorRegistrationsBuffer[topicName]) {
48882
+ translators.forEach((translatorName) => {
48883
+ delete this.translatorRegistrationsBuffer[topicName][translatorName];
48884
+ });
48885
+ }
48858
48886
  if (!topic) return;
48859
48887
  translators.forEach((name2) => {
48860
48888
  topic.removeTranslator(name2);
@@ -51471,10 +51499,10 @@ function VirtualizedMessageList(props) {
51471
51499
  );
51472
51500
  }
51473
51501
 
51474
- // src/components/Message/MessageThreadReplyInChannelButtonIndicator.tsx
51502
+ // src/components/Message/MessageIsThreadReplyInChannelButtonIndicator.tsx
51475
51503
  var import_react198 = __toESM(require("react"));
51476
51504
  var import_stream_chat6 = require("stream-chat");
51477
- var MessageThreadReplyInChannelButtonIndicator = () => {
51505
+ var MessageIsThreadReplyInChannelButtonIndicator = () => {
51478
51506
  const { client } = useChatContext();
51479
51507
  const { t } = useTranslationContext();
51480
51508
  const { channel } = useChannelStateContext();
@@ -51495,7 +51523,7 @@ var MessageThreadReplyInChannelButtonIndicator = () => {
51495
51523
  },
51496
51524
  origin: {
51497
51525
  context: { threadReply: message },
51498
- emitter: "MessageThreadReplyInChannelButtonIndicator"
51526
+ emitter: "MessageIsThreadReplyInChannelButtonIndicator"
51499
51527
  }
51500
51528
  });
51501
51529
  });
@@ -51995,7 +52023,7 @@ var MessageSimpleWithContext = (props) => {
51995
52023
  MessageBlocked: MessageBlocked2 = MessageBlocked,
51996
52024
  MessageBouncePrompt: MessageBouncePrompt2 = MessageBouncePrompt,
51997
52025
  MessageDeleted: MessageDeleted2 = MessageDeleted,
51998
- MessageIsThreadReplyInChannelButtonIndicator = MessageThreadReplyInChannelButtonIndicator,
52026
+ MessageIsThreadReplyInChannelButtonIndicator: MessageIsThreadReplyInChannelButtonIndicator2 = MessageIsThreadReplyInChannelButtonIndicator,
51999
52027
  MessageRepliesCountButton: MessageRepliesCountButton2 = MessageRepliesCountButton,
52000
52028
  MessageStatus: MessageStatus2 = MessageStatus,
52001
52029
  MessageTimestamp: MessageTimestamp2 = MessageTimestamp,
@@ -52100,7 +52128,7 @@ var MessageSimpleWithContext = (props) => {
52100
52128
  onClick: handleOpenThread,
52101
52129
  reply_count: message.reply_count
52102
52130
  }
52103
- ), showIsReplyInChannel && /* @__PURE__ */ import_react206.default.createElement(MessageIsThreadReplyInChannelButtonIndicator, null), showMetadata && /* @__PURE__ */ import_react206.default.createElement("div", { className: "str-chat__message-metadata" }, /* @__PURE__ */ import_react206.default.createElement(MessageStatus2, null), !isMyMessage() && !!message.user && /* @__PURE__ */ import_react206.default.createElement("span", { className: "str-chat__message-simple-name" }, message.user.name || message.user.id), /* @__PURE__ */ import_react206.default.createElement(MessageTimestamp2, { customClass: "str-chat__message-simple-timestamp" }), isEdited && /* @__PURE__ */ import_react206.default.createElement("span", { className: "str-chat__mesage-simple-edited" }, t("Edited")), isEdited && /* @__PURE__ */ import_react206.default.createElement(MessageEditedTimestamp, { calendar: true, open: isEditedTimestampOpen }))));
52131
+ ), showIsReplyInChannel && /* @__PURE__ */ import_react206.default.createElement(MessageIsThreadReplyInChannelButtonIndicator2, null), showMetadata && /* @__PURE__ */ import_react206.default.createElement("div", { className: "str-chat__message-metadata" }, /* @__PURE__ */ import_react206.default.createElement(MessageStatus2, null), !isMyMessage() && !!message.user && /* @__PURE__ */ import_react206.default.createElement("span", { className: "str-chat__message-simple-name" }, message.user.name || message.user.id), /* @__PURE__ */ import_react206.default.createElement(MessageTimestamp2, { customClass: "str-chat__message-simple-timestamp" }), isEdited && /* @__PURE__ */ import_react206.default.createElement("span", { className: "str-chat__mesage-simple-edited" }, t("Edited")), isEdited && /* @__PURE__ */ import_react206.default.createElement(MessageEditedTimestamp, { calendar: true, open: isEditedTimestampOpen }))));
52104
52132
  };
52105
52133
  var MemoizedMessageSimple = import_react206.default.memo(
52106
52134
  MessageSimpleWithContext,
@@ -57356,7 +57384,7 @@ var useChat = ({
57356
57384
  };
57357
57385
  (0, import_react271.useEffect)(() => {
57358
57386
  if (!client) return;
57359
- const version = "13.1.0";
57387
+ const version = "13.1.1";
57360
57388
  const userAgent = client.getUserAgent();
57361
57389
  if (!userAgent.includes("stream-chat-react")) {
57362
57390
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
@@ -57726,6 +57754,7 @@ var Window = import_react276.default.memo(UnMemoizedWindow);
57726
57754
  MicIcon,
57727
57755
  Modal,
57728
57756
  ModalGallery,
57757
+ NotificationTranslationTopic,
57729
57758
  PauseIcon,
57730
57759
  PinIcon,
57731
57760
  PinIndicator,