stream-chat-react 13.0.0 → 13.0.2

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.
@@ -20390,6 +20390,7 @@ __export(src_exports, {
20390
20390
  useActionHandler: () => useActionHandler,
20391
20391
  useActiveThread: () => useActiveThread,
20392
20392
  useAttachmentManagerState: () => useAttachmentManagerState,
20393
+ useAudioController: () => useAudioController,
20393
20394
  useCanCreatePoll: () => useCanCreatePoll,
20394
20395
  useChannelActionContext: () => useChannelActionContext,
20395
20396
  useChannelDeletedListener: () => useChannelDeletedListener,
@@ -20474,7 +20475,7 @@ module.exports = __toCommonJS(src_exports);
20474
20475
 
20475
20476
  // src/components/Attachment/Attachment.tsx
20476
20477
  var import_react254 = __toESM(require("react"));
20477
- var import_stream_chat10 = require("stream-chat");
20478
+ var import_stream_chat11 = require("stream-chat");
20478
20479
 
20479
20480
  // src/components/Attachment/AttachmentContainer.tsx
20480
20481
  var import_react253 = __toESM(require("react"));
@@ -43357,12 +43358,13 @@ var PollHeader = () => {
43357
43358
  const { enforce_unique_vote, is_closed, max_votes_allowed, name: name2, options } = useStateStore(poll.state, pollStateSelector);
43358
43359
  const selectionInstructions = (0, import_react122.useMemo)(() => {
43359
43360
  if (is_closed) return t("Vote ended");
43360
- if (enforce_unique_vote) return t("Select one");
43361
+ if (enforce_unique_vote || options.length === 1) return t("Select one");
43361
43362
  if (max_votes_allowed)
43362
43363
  return t("Select up to {{count}}", {
43363
43364
  count: max_votes_allowed > options.length ? options.length : max_votes_allowed
43364
43365
  });
43365
- return t("Select one or more");
43366
+ if (options.length > 1) return t("Select one or more");
43367
+ return "";
43366
43368
  }, [is_closed, enforce_unique_vote, max_votes_allowed, options.length, t]);
43367
43369
  if (!name2) return;
43368
43370
  return /* @__PURE__ */ import_react122.default.createElement("div", { className: "str-chat__poll-header" }, /* @__PURE__ */ import_react122.default.createElement("div", { className: "str-chat__poll-title" }, name2), /* @__PURE__ */ import_react122.default.createElement("div", { className: "str-chat__poll-subtitle" }, selectionInstructions));
@@ -43442,36 +43444,46 @@ var FormDialog = ({
43442
43444
  await onSubmit(value);
43443
43445
  close();
43444
43446
  };
43445
- return /* @__PURE__ */ import_react124.default.createElement("div", { className: (0, import_clsx27.default)("str-chat__dialog str-chat__dialog--form", className) }, /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__body" }, title && /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__title" }, title), /* @__PURE__ */ import_react124.default.createElement("form", { autoComplete: "off" }, Object.entries(fields).map(([id, fieldConfig]) => /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__field", key: `dialog-field-${id}` }, fieldConfig.label && /* @__PURE__ */ import_react124.default.createElement(
43446
- "label",
43447
- {
43448
- className: (0, import_clsx27.default)(
43449
- `str-chat__dialog__title str-chat__dialog__title--${id}`
43450
- ),
43451
- htmlFor: id
43452
- },
43453
- fieldConfig.label
43454
- ), import_react124.default.createElement(fieldConfig.element, {
43455
- id,
43456
- ...fieldConfig.props,
43457
- onChange: handleChange,
43458
- value: value[id]
43459
- }), /* @__PURE__ */ import_react124.default.createElement(FieldError, { text: fieldErrors[id]?.message }))))), /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react124.default.createElement(
43460
- "button",
43461
- {
43462
- className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
43463
- onClick: close
43464
- },
43465
- t("Cancel")
43466
- ), /* @__PURE__ */ import_react124.default.createElement(
43467
- "button",
43447
+ return /* @__PURE__ */ import_react124.default.createElement("div", { className: (0, import_clsx27.default)("str-chat__dialog str-chat__dialog--form", className) }, /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__body" }, title && /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__title" }, title), /* @__PURE__ */ import_react124.default.createElement(
43448
+ "form",
43468
43449
  {
43469
- className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
43470
- disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
43471
- onClick: handleSubmit,
43472
- type: "submit"
43450
+ autoComplete: "off",
43451
+ onSubmit: (e) => {
43452
+ e.preventDefault();
43453
+ handleSubmit();
43454
+ }
43473
43455
  },
43474
- t("Send")
43456
+ Object.entries(fields).map(([id, fieldConfig]) => /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__field", key: `dialog-field-${id}` }, fieldConfig.label && /* @__PURE__ */ import_react124.default.createElement(
43457
+ "label",
43458
+ {
43459
+ className: (0, import_clsx27.default)(
43460
+ `str-chat__dialog__title str-chat__dialog__title--${id}`
43461
+ ),
43462
+ htmlFor: id
43463
+ },
43464
+ fieldConfig.label
43465
+ ), import_react124.default.createElement(fieldConfig.element, {
43466
+ id,
43467
+ ...fieldConfig.props,
43468
+ onChange: handleChange,
43469
+ value: value[id]
43470
+ }), /* @__PURE__ */ import_react124.default.createElement(FieldError, { text: fieldErrors[id]?.message }))),
43471
+ /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react124.default.createElement(
43472
+ "button",
43473
+ {
43474
+ className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
43475
+ onClick: close
43476
+ },
43477
+ t("Cancel")
43478
+ ), /* @__PURE__ */ import_react124.default.createElement(
43479
+ "button",
43480
+ {
43481
+ className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
43482
+ disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
43483
+ type: "submit"
43484
+ },
43485
+ t("Send")
43486
+ ))
43475
43487
  )));
43476
43488
  };
43477
43489
 
@@ -44172,7 +44184,7 @@ var PollOptionWithLatestVotes = ({
44172
44184
  // src/components/Poll/PollActions/PollResults/PollResults.tsx
44173
44185
  var pollStateSelector10 = (nextValue) => ({
44174
44186
  name: nextValue.name,
44175
- options: nextValue.options,
44187
+ options: [...nextValue.options],
44176
44188
  vote_counts_by_option: nextValue.vote_counts_by_option
44177
44189
  });
44178
44190
  var PollResults = ({ close }) => {
@@ -44441,9 +44453,15 @@ var MultipleAnswersField = () => {
44441
44453
  pollComposer.handleFieldBlur("max_votes_allowed");
44442
44454
  },
44443
44455
  onChange: (e) => {
44444
- pollComposer.updateFields({
44445
- max_votes_allowed: e.target.value
44446
- });
44456
+ const nativeFieldValidation = !e.target.validity.valid ? {
44457
+ max_votes_allowed: t("Only numbers are allowed")
44458
+ } : void 0;
44459
+ pollComposer.updateFields(
44460
+ {
44461
+ max_votes_allowed: !nativeFieldValidation ? e.target.value : pollComposer.max_votes_allowed
44462
+ },
44463
+ nativeFieldValidation
44464
+ );
44447
44465
  },
44448
44466
  placeholder: t("Maximum number of votes (from 2 to 10)"),
44449
44467
  type: "number",
@@ -45510,6 +45528,7 @@ var de_default = {
45510
45528
  "Nobody will be able to vote in this poll anymore.": "Niemand kann mehr in dieser Umfrage abstimmen.",
45511
45529
  "Nothing yet...": "Noch nichts...",
45512
45530
  Ok: "Ok",
45531
+ "Only numbers are allowed": "Nur Zahlen sind erlaubt",
45513
45532
  "Open emoji picker": "Emoji-Auswahl \xF6ffnen",
45514
45533
  "Option already exists": "Option existiert bereits",
45515
45534
  Options: "Optionen",
@@ -45722,6 +45741,7 @@ var en_default = {
45722
45741
  "Nobody will be able to vote in this poll anymore.": "Nobody will be able to vote in this poll anymore.",
45723
45742
  "Nothing yet...": "Nothing yet...",
45724
45743
  Ok: "Ok",
45744
+ "Only numbers are allowed": "Only numbers are allowed",
45725
45745
  "Open emoji picker": "Open emoji picker",
45726
45746
  "Option already exists": "Option already exists",
45727
45747
  Options: "Options",
@@ -45924,6 +45944,7 @@ var es_default = {
45924
45944
  "Nobody will be able to vote in this poll anymore.": "Nadie podr\xE1 votar en esta encuesta.",
45925
45945
  "Nothing yet...": "Nada a\xFAn...",
45926
45946
  Ok: "Ok",
45947
+ "Only numbers are allowed": "Solo se permiten n\xFAmeros",
45927
45948
  "Open emoji picker": "Abrir el selector de emojis",
45928
45949
  "Option already exists": "La opci\xF3n ya existe",
45929
45950
  Options: "Opciones",
@@ -46144,6 +46165,7 @@ var fr_default = {
46144
46165
  "Nobody will be able to vote in this poll anymore.": "Personne ne pourra plus voter dans ce sondage.",
46145
46166
  "Nothing yet...": "Rien pour l'instant...",
46146
46167
  Ok: "D'accord",
46168
+ "Only numbers are allowed": "Seuls les chiffres sont autoris\xE9s",
46147
46169
  "Open emoji picker": "Ouvrir le s\xE9lecteur d'\xE9mojis",
46148
46170
  "Option already exists": "L'option existe d\xE9j\xE0",
46149
46171
  Options: "Options",
@@ -46365,6 +46387,7 @@ var hi_default = {
46365
46387
  "Nobody will be able to vote in this poll anymore.": "\u0905\u092C \u0915\u094B\u0908 \u092D\u0940 \u0907\u0938 \u092E\u0924\u0926\u093E\u0928 \u092E\u0947\u0902 \u092E\u0924\u0926\u093E\u0928 \u0928\u0939\u0940\u0902 \u0915\u0930 \u0938\u0915\u0947\u0917\u093E\u0964",
46366
46388
  "Nothing yet...": "\u0915\u094B\u0908 \u092E\u0948\u0938\u0947\u091C \u0928\u0939\u0940\u0902 \u0939\u0948",
46367
46389
  Ok: "\u0920\u0940\u0915 \u0939\u0948",
46390
+ "Only numbers are allowed": "\u0915\u0947\u0935\u0932 \u0938\u0902\u0916\u094D\u092F\u093E\u090F\u0901 \u0905\u0928\u0941\u092E\u0924 \u0939\u0948\u0902",
46368
46391
  "Open emoji picker": "\u0907\u092E\u094B\u091C\u0940 \u092A\u093F\u0915\u0930 \u0916\u094B\u0932\u093F\u092F\u0947",
46369
46392
  "Option already exists": "\u0935\u093F\u0915\u0932\u094D\u092A \u092A\u0939\u0932\u0947 \u0938\u0947 \u092E\u094C\u091C\u0942\u0926 \u0939\u0948",
46370
46393
  Options: "\u0935\u093F\u0915\u0932\u094D\u092A",
@@ -46577,6 +46600,7 @@ var it_default = {
46577
46600
  "Nobody will be able to vote in this poll anymore.": "Nessuno potr\xE0 pi\xF9 votare in questo sondaggio.",
46578
46601
  "Nothing yet...": "Ancora niente...",
46579
46602
  Ok: "Ok",
46603
+ "Only numbers are allowed": "Sono consentiti solo numeri",
46580
46604
  "Open emoji picker": "Apri il selettore di emoji",
46581
46605
  "Option already exists": "L'opzione esiste gi\xE0",
46582
46606
  Options: "Opzioni",
@@ -46797,6 +46821,7 @@ var ja_default = {
46797
46821
  "Nobody will be able to vote in this poll anymore.": "\u3053\u306E\u6295\u7968\u3067\u306F\u3001\u8AB0\u3082\u6295\u7968\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",
46798
46822
  "Nothing yet...": "\u307E\u3060\u4F55\u3082\u3042\u308A\u307E\u305B\u3093...",
46799
46823
  Ok: "OK",
46824
+ "Only numbers are allowed": "\u6570\u5B57\u306E\u307F\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u3059",
46800
46825
  "Open emoji picker": "\u7D75\u6587\u5B57\u30D4\u30C3\u30AB\u30FC\u3092\u958B\u304F",
46801
46826
  "Option already exists": "\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059",
46802
46827
  Options: "\u30AA\u30D7\u30B7\u30E7\u30F3",
@@ -47003,7 +47028,8 @@ var ko_default = {
47003
47028
  "Nobody will be able to vote in this poll anymore.": "\uC774 \uD22C\uD45C\uC5D0 \uB354 \uC774\uC0C1 \uC544\uBB34\uB3C4 \uD22C\uD45C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
47004
47029
  "Nothing yet...": "\uC544\uC9C1 \uC544\uBB34\uAC83\uB3C4...",
47005
47030
  Ok: "\uD655\uC778",
47006
- "Open emoji picker": "\uC774\uBAA8\uD2F0\uCF58 \uC120\uD0DD\uAE30 \uC5F4\uAE30",
47031
+ "Only numbers are allowed": "\uC22B\uC790\uB9CC \uC785\uB825 \uAC00\uB2A5\uD569\uB2C8\uB2E4",
47032
+ "Open emoji picker": "\uC774\uBAA8\uC9C0 \uC120\uD0DD\uAE30 \uC5F4\uAE30",
47007
47033
  "Option already exists": "\uC635\uC158\uC774 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4",
47008
47034
  Options: "\uC635\uC158",
47009
47035
  "People matching": "\uC77C\uCE58\uD558\uB294 \uC0AC\uB78C",
@@ -47209,7 +47235,8 @@ var nl_default = {
47209
47235
  "Nobody will be able to vote in this poll anymore.": "Niemand kan meer stemmen in deze peiling.",
47210
47236
  "Nothing yet...": "Nog niets ...",
47211
47237
  Ok: "Ok\xE9",
47212
- "Open emoji picker": "Open emojipicker",
47238
+ "Only numbers are allowed": "Alleen nummers zijn toegestaan",
47239
+ "Open emoji picker": "Emoji-kiezer openen",
47213
47240
  "Option already exists": "Optie bestaat al",
47214
47241
  Options: "Opties",
47215
47242
  "People matching": "Mensen die matchen",
@@ -47421,6 +47448,7 @@ var pt_default = {
47421
47448
  "Nobody will be able to vote in this poll anymore.": "Ningu\xE9m mais poder\xE1 votar nesta pesquisa.",
47422
47449
  "Nothing yet...": "Nada ainda...",
47423
47450
  Ok: "Ok",
47451
+ "Only numbers are allowed": "Apenas n\xFAmeros s\xE3o permitidos",
47424
47452
  "Open emoji picker": "Abrir seletor de emoji",
47425
47453
  "Option already exists": "Op\xE7\xE3o j\xE1 existe",
47426
47454
  Options: "Op\xE7\xF5es",
@@ -47641,6 +47669,7 @@ var ru_default = {
47641
47669
  "Nobody will be able to vote in this poll anymore.": "\u041D\u0438\u043A\u0442\u043E \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u043C\u043E\u0436\u0435\u0442 \u0433\u043E\u043B\u043E\u0441\u043E\u0432\u0430\u0442\u044C \u0432 \u044D\u0442\u043E\u043C \u043E\u043F\u0440\u043E\u0441\u0435.",
47642
47670
  "Nothing yet...": "\u041F\u043E\u043A\u0430 \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435\u0442...",
47643
47671
  Ok: "\u041E\u043A",
47672
+ "Only numbers are allowed": "\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u044B \u0442\u043E\u043B\u044C\u043A\u043E \u0446\u0438\u0444\u0440\u044B",
47644
47673
  "Open emoji picker": "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0432\u044B\u0431\u043E\u0440 \u0441\u043C\u0430\u0439\u043B\u043E\u0432",
47645
47674
  "Option already exists": "\u0412\u0430\u0440\u0438\u0430\u043D\u0442 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442",
47646
47675
  Options: "\u0412\u0430\u0440\u0438\u0430\u043D\u0442\u044B",
@@ -47869,6 +47898,7 @@ var tr_default = {
47869
47898
  "Nobody will be able to vote in this poll anymore.": "Art\u0131k bu ankette kimse oy kullanamayacak.",
47870
47899
  "Nothing yet...": "\u015Eimdilik hi\xE7bir \u015Fey...",
47871
47900
  Ok: "Tamam",
47901
+ "Only numbers are allowed": "Sadece say\u0131lar kullan\u0131labilir",
47872
47902
  "Open emoji picker": "Emoji klavyesini a\xE7",
47873
47903
  "Option already exists": "Se\xE7enek zaten mevcut",
47874
47904
  Options: "Se\xE7enekler",
@@ -51331,7 +51361,7 @@ var AttachmentSelector = ({
51331
51361
 
51332
51362
  // src/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.tsx
51333
51363
  var import_react227 = __toESM(require("react"));
51334
- var import_stream_chat8 = require("stream-chat");
51364
+ var import_stream_chat9 = require("stream-chat");
51335
51365
 
51336
51366
  // src/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.tsx
51337
51367
  var import_react210 = __toESM(require("react"));
@@ -52490,6 +52520,23 @@ var useTextareaRef = (props) => {
52490
52520
 
52491
52521
  // src/components/MessageInput/hooks/useSubmitHandler.ts
52492
52522
  var import_react224 = require("react");
52523
+ var import_stream_chat8 = require("stream-chat");
52524
+ var takeStateSnapshot = (messageComposer) => {
52525
+ const textComposerState = messageComposer.textComposer.state.getLatestValue();
52526
+ const attachmentManagerState = messageComposer.attachmentManager.state.getLatestValue();
52527
+ const linkPreviewsManagerState = messageComposer.linkPreviewsManager.state.getLatestValue();
52528
+ const pollComposerState = messageComposer.pollComposer.state.getLatestValue();
52529
+ const customDataManagerState = messageComposer.customDataManager.state.getLatestValue();
52530
+ const state = messageComposer.state.getLatestValue();
52531
+ return () => {
52532
+ messageComposer.state.next(state);
52533
+ messageComposer.textComposer.state.next(textComposerState);
52534
+ messageComposer.attachmentManager.state.next(attachmentManagerState);
52535
+ messageComposer.linkPreviewsManager.state.next(linkPreviewsManagerState);
52536
+ messageComposer.pollComposer.state.next(pollComposerState);
52537
+ messageComposer.customDataManager.state.next(customDataManagerState);
52538
+ };
52539
+ };
52493
52540
  var useSubmitHandler = (props) => {
52494
52541
  const { clearEditingState, overrideSubmitHandler } = props;
52495
52542
  const { addNotification, editMessage, sendMessage } = useChannelActionContext("useSubmitHandler");
@@ -52509,7 +52556,17 @@ var useSubmitHandler = (props) => {
52509
52556
  addNotification(t("Edit message request failed"), "error");
52510
52557
  }
52511
52558
  } else {
52559
+ const restoreComposerStateSnapshot = takeStateSnapshot(messageComposer);
52512
52560
  try {
52561
+ const sentPollMessage = !!message.poll_id;
52562
+ if (sentPollMessage) {
52563
+ messageComposer.state.partialNext({
52564
+ id: import_stream_chat8.MessageComposer.generateId(),
52565
+ pollId: null
52566
+ });
52567
+ } else {
52568
+ messageComposer.clear();
52569
+ }
52513
52570
  if (overrideSubmitHandler) {
52514
52571
  await overrideSubmitHandler({
52515
52572
  cid: messageComposer.channel.cid,
@@ -52520,10 +52577,10 @@ var useSubmitHandler = (props) => {
52520
52577
  } else {
52521
52578
  await sendMessage({ localMessage, message, options: sendOptions });
52522
52579
  }
52523
- messageComposer.clear();
52524
52580
  if (messageComposer.config.text.publishTypingEvents)
52525
52581
  await messageComposer.channel.stopTyping();
52526
52582
  } catch (err) {
52583
+ restoreComposerStateSnapshot();
52527
52584
  addNotification(t("Send message request failed"), "error");
52528
52585
  }
52529
52586
  }
@@ -52684,8 +52741,8 @@ var AttachmentPreviewList = ({
52684
52741
  "data-testid": "attachment-list-scroll-container"
52685
52742
  },
52686
52743
  attachments.map((attachment) => {
52687
- if ((0, import_stream_chat8.isScrapedContent)(attachment)) return null;
52688
- if ((0, import_stream_chat8.isLocalVoiceRecordingAttachment)(attachment)) {
52744
+ if ((0, import_stream_chat9.isScrapedContent)(attachment)) return null;
52745
+ if ((0, import_stream_chat9.isLocalVoiceRecordingAttachment)(attachment)) {
52689
52746
  return /* @__PURE__ */ import_react227.default.createElement(
52690
52747
  VoiceRecordingPreview2,
52691
52748
  {
@@ -52695,7 +52752,7 @@ var AttachmentPreviewList = ({
52695
52752
  removeAttachments: messageComposer.attachmentManager.removeAttachments
52696
52753
  }
52697
52754
  );
52698
- } else if ((0, import_stream_chat8.isLocalAudioAttachment)(attachment)) {
52755
+ } else if ((0, import_stream_chat9.isLocalAudioAttachment)(attachment)) {
52699
52756
  return /* @__PURE__ */ import_react227.default.createElement(
52700
52757
  AudioAttachmentPreview,
52701
52758
  {
@@ -52705,7 +52762,7 @@ var AttachmentPreviewList = ({
52705
52762
  removeAttachments: messageComposer.attachmentManager.removeAttachments
52706
52763
  }
52707
52764
  );
52708
- } else if ((0, import_stream_chat8.isLocalVideoAttachment)(attachment)) {
52765
+ } else if ((0, import_stream_chat9.isLocalVideoAttachment)(attachment)) {
52709
52766
  return /* @__PURE__ */ import_react227.default.createElement(
52710
52767
  VideoAttachmentPreview,
52711
52768
  {
@@ -52715,7 +52772,7 @@ var AttachmentPreviewList = ({
52715
52772
  removeAttachments: messageComposer.attachmentManager.removeAttachments
52716
52773
  }
52717
52774
  );
52718
- } else if ((0, import_stream_chat8.isLocalImageAttachment)(attachment)) {
52775
+ } else if ((0, import_stream_chat9.isLocalImageAttachment)(attachment)) {
52719
52776
  return /* @__PURE__ */ import_react227.default.createElement(
52720
52777
  ImageAttachmentPreview2,
52721
52778
  {
@@ -52725,7 +52782,7 @@ var AttachmentPreviewList = ({
52725
52782
  removeAttachments: messageComposer.attachmentManager.removeAttachments
52726
52783
  }
52727
52784
  );
52728
- } else if ((0, import_stream_chat8.isLocalFileAttachment)(attachment)) {
52785
+ } else if ((0, import_stream_chat9.isLocalFileAttachment)(attachment)) {
52729
52786
  return /* @__PURE__ */ import_react227.default.createElement(
52730
52787
  FileAttachmentPreview2,
52731
52788
  {
@@ -52735,7 +52792,7 @@ var AttachmentPreviewList = ({
52735
52792
  removeAttachments: messageComposer.attachmentManager.removeAttachments
52736
52793
  }
52737
52794
  );
52738
- } else if ((0, import_stream_chat8.isLocalAttachment)(attachment)) {
52795
+ } else if ((0, import_stream_chat9.isLocalAttachment)(attachment)) {
52739
52796
  return /* @__PURE__ */ import_react227.default.createElement(
52740
52797
  UnsupportedAttachmentPreview2,
52741
52798
  {
@@ -52905,10 +52962,10 @@ var QuotedMessagePreview = ({
52905
52962
  // src/components/MessageInput/LinkPreviewList.tsx
52906
52963
  var import_clsx57 = __toESM(require("clsx"));
52907
52964
  var import_react233 = __toESM(require("react"));
52908
- var import_stream_chat9 = require("stream-chat");
52965
+ var import_stream_chat10 = require("stream-chat");
52909
52966
  var linkPreviewsManagerStateSelector = (state) => ({
52910
52967
  linkPreviews: Array.from(state.previews.values()).filter(
52911
- (preview) => import_stream_chat9.LinkPreviewsManager.previewIsLoaded(preview) || import_stream_chat9.LinkPreviewsManager.previewIsLoading(preview)
52968
+ (preview) => import_stream_chat10.LinkPreviewsManager.previewIsLoaded(preview) || import_stream_chat10.LinkPreviewsManager.previewIsLoading(preview)
52912
52969
  )
52913
52970
  });
52914
52971
  var messageComposerStateSelector = (state) => ({
@@ -52933,13 +52990,13 @@ var LinkPreviewCard = ({ linkPreview }) => {
52933
52990
  const { linkPreviewsManager } = useMessageComposer();
52934
52991
  const { handleEnter, handleLeave, tooltipVisible } = useEnterLeaveHandlers();
52935
52992
  const [referenceElement, setReferenceElement] = (0, import_react233.useState)(null);
52936
- if (!import_stream_chat9.LinkPreviewsManager.previewIsLoaded(linkPreview) && !import_stream_chat9.LinkPreviewsManager.previewIsLoading(linkPreview))
52993
+ if (!import_stream_chat10.LinkPreviewsManager.previewIsLoaded(linkPreview) && !import_stream_chat10.LinkPreviewsManager.previewIsLoading(linkPreview))
52937
52994
  return null;
52938
52995
  return /* @__PURE__ */ import_react233.default.createElement(
52939
52996
  "div",
52940
52997
  {
52941
52998
  className: (0, import_clsx57.default)("str-chat__link-preview-card", {
52942
- "str-chat__link-preview-card--loading": import_stream_chat9.LinkPreviewsManager.previewIsLoading(linkPreview)
52999
+ "str-chat__link-preview-card--loading": import_stream_chat10.LinkPreviewsManager.previewIsLoading(linkPreview)
52943
53000
  }),
52944
53001
  "data-testid": "link-preview-card"
52945
53002
  },
@@ -53168,7 +53225,7 @@ var TextareaComposer = ({
53168
53225
  closeSuggestionsOnClickOutside,
53169
53226
  containerClassName,
53170
53227
  listClassName,
53171
- maxRows: maxRowsProp = 1,
53228
+ maxRows: maxRowsProp,
53172
53229
  minRows: minRowsProp,
53173
53230
  onBlur,
53174
53231
  onChange,
@@ -53191,7 +53248,7 @@ var TextareaComposer = ({
53191
53248
  shouldSubmit: shouldSubmitContext,
53192
53249
  textareaRef
53193
53250
  } = useMessageInputContext();
53194
- const maxRows = maxRowsProp ?? maxRowsContext;
53251
+ const maxRows = maxRowsProp ?? maxRowsContext ?? 1;
53195
53252
  const minRows = minRowsProp ?? minRowsContext;
53196
53253
  const placeholder = placeholderProp ?? additionalTextareaProps?.placeholder;
53197
53254
  const shouldSubmit = shouldSubmitProp ?? shouldSubmitContext ?? defaultShouldSubmit;
@@ -53235,13 +53292,11 @@ var TextareaComposer = ({
53235
53292
  onKeyDown(event);
53236
53293
  return;
53237
53294
  }
53238
- if (event.key === "Enter") {
53239
- event.preventDefault();
53240
- }
53241
53295
  if (textComposer.suggestions && textComposer.suggestions.searchSource.items?.length) {
53242
53296
  if (event.key === "Escape") return textComposer.closeSuggestions();
53243
53297
  const loadedItems = textComposer.suggestions.searchSource.items;
53244
53298
  if (event.key === "Enter") {
53299
+ event.preventDefault();
53245
53300
  textComposer.handleSelect(loadedItems[focusedItemIndex]);
53246
53301
  }
53247
53302
  if (event.key === "ArrowUp") {
@@ -54247,9 +54302,9 @@ var renderGroupedAttachments = ({
54247
54302
  ...rest
54248
54303
  }) => {
54249
54304
  const uploadedImages = attachments.filter(
54250
- (attachment) => (0, import_stream_chat10.isImageAttachment)(attachment)
54305
+ (attachment) => (0, import_stream_chat11.isImageAttachment)(attachment)
54251
54306
  );
54252
- const containers = attachments.filter((attachment) => !(0, import_stream_chat10.isImageAttachment)(attachment)).reduce(
54307
+ const containers = attachments.filter((attachment) => !(0, import_stream_chat11.isImageAttachment)(attachment)).reduce(
54253
54308
  (typeMap, attachment) => {
54254
54309
  const attachmentType = getAttachmentType(attachment);
54255
54310
  const Container = CONTAINER_MAP[attachmentType];
@@ -54301,15 +54356,15 @@ var renderGroupedAttachments = ({
54301
54356
  return containers;
54302
54357
  };
54303
54358
  var getAttachmentType = (attachment) => {
54304
- if ((0, import_stream_chat10.isScrapedContent)(attachment)) {
54359
+ if ((0, import_stream_chat11.isScrapedContent)(attachment)) {
54305
54360
  return "card";
54306
- } else if ((0, import_stream_chat10.isVideoAttachment)(attachment, SUPPORTED_VIDEO_FORMATS)) {
54361
+ } else if ((0, import_stream_chat11.isVideoAttachment)(attachment, SUPPORTED_VIDEO_FORMATS)) {
54307
54362
  return "media";
54308
- } else if ((0, import_stream_chat10.isAudioAttachment)(attachment)) {
54363
+ } else if ((0, import_stream_chat11.isAudioAttachment)(attachment)) {
54309
54364
  return "audio";
54310
- } else if ((0, import_stream_chat10.isVoiceRecordingAttachment)(attachment)) {
54365
+ } else if ((0, import_stream_chat11.isVoiceRecordingAttachment)(attachment)) {
54311
54366
  return "voiceRecording";
54312
- } else if ((0, import_stream_chat10.isFileAttachment)(attachment, SUPPORTED_VIDEO_FORMATS)) {
54367
+ } else if ((0, import_stream_chat11.isFileAttachment)(attachment, SUPPORTED_VIDEO_FORMATS)) {
54313
54368
  return "file";
54314
54369
  }
54315
54370
  return "unsupported";
@@ -54321,7 +54376,7 @@ var import_clsx66 = __toESM(require("clsx"));
54321
54376
  var import_lodash20 = __toESM(require("lodash.debounce"));
54322
54377
  var import_lodash21 = __toESM(require("lodash.defaultsdeep"));
54323
54378
  var import_lodash22 = __toESM(require("lodash.throttle"));
54324
- var import_stream_chat11 = require("stream-chat");
54379
+ var import_stream_chat12 = require("stream-chat");
54325
54380
 
54326
54381
  // src/components/Channel/channelState.ts
54327
54382
  var makeChannelReducer = () => (state, action) => {
@@ -55474,7 +55529,7 @@ var ChannelInner = (props) => {
55474
55529
  });
55475
55530
  await doSendMessage({
55476
55531
  localMessage,
55477
- message: (0, import_stream_chat11.localMessageToNewMessagePayload)(localMessage)
55532
+ message: (0, import_stream_chat12.localMessageToNewMessagePayload)(localMessage)
55478
55533
  });
55479
55534
  };
55480
55535
  const removeMessage = (message) => {
@@ -55786,7 +55841,7 @@ var ChannelHeader = (props) => {
55786
55841
 
55787
55842
  // src/components/Chat/Chat.tsx
55788
55843
  var import_react266 = __toESM(require("react"));
55789
- var import_stream_chat12 = require("stream-chat");
55844
+ var import_stream_chat13 = require("stream-chat");
55790
55845
 
55791
55846
  // src/components/Chat/hooks/useChat.ts
55792
55847
  var import_react263 = require("react");
@@ -55818,7 +55873,7 @@ var useChat = ({
55818
55873
  };
55819
55874
  (0, import_react263.useEffect)(() => {
55820
55875
  if (!client) return;
55821
- const version = "13.0.0";
55876
+ const version = "13.0.2";
55822
55877
  const userAgent = client.getUserAgent();
55823
55878
  if (!userAgent.includes("stream-chat-react")) {
55824
55879
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
@@ -55982,11 +56037,11 @@ var Chat = (props) => {
55982
56037
  } = useChat({ client, defaultLanguage, i18nInstance, initialNavOpen });
55983
56038
  const channelsQueryState = useChannelsQueryState();
55984
56039
  const searchController = (0, import_react266.useMemo)(
55985
- () => customChannelSearchController ?? new import_stream_chat12.SearchController({
56040
+ () => customChannelSearchController ?? new import_stream_chat13.SearchController({
55986
56041
  sources: [
55987
- new import_stream_chat12.ChannelSearchSource(client),
55988
- new import_stream_chat12.UserSearchSource(client),
55989
- new import_stream_chat12.MessageSearchSource(client)
56042
+ new import_stream_chat13.ChannelSearchSource(client),
56043
+ new import_stream_chat13.UserSearchSource(client),
56044
+ new import_stream_chat13.MessageSearchSource(client)
55990
56045
  ]
55991
56046
  }),
55992
56047
  [client, customChannelSearchController]
@@ -56014,7 +56069,7 @@ var Chat = (props) => {
56014
56069
 
56015
56070
  // src/components/Chat/hooks/useCreateChatClient.ts
56016
56071
  var import_react267 = require("react");
56017
- var import_stream_chat13 = require("stream-chat");
56072
+ var import_stream_chat14 = require("stream-chat");
56018
56073
  var useCreateChatClient = ({
56019
56074
  apiKey,
56020
56075
  options,
@@ -56028,7 +56083,7 @@ var useCreateChatClient = ({
56028
56083
  }
56029
56084
  const [cachedOptions] = (0, import_react267.useState)(options);
56030
56085
  (0, import_react267.useEffect)(() => {
56031
- const client = new import_stream_chat13.StreamChat(apiKey, void 0, cachedOptions);
56086
+ const client = new import_stream_chat14.StreamChat(apiKey, void 0, cachedOptions);
56032
56087
  let didUserConnectInterrupt = false;
56033
56088
  const connectionPromise = client.connectUser(cachedUserData, tokenOrProvider).then(() => {
56034
56089
  if (!didUserConnectInterrupt) setChatClient(client);
@@ -56360,6 +56415,7 @@ var Window = import_react268.default.memo(UnMemoizedWindow);
56360
56415
  useActionHandler,
56361
56416
  useActiveThread,
56362
56417
  useAttachmentManagerState,
56418
+ useAudioController,
56363
56419
  useCanCreatePoll,
56364
56420
  useChannelActionContext,
56365
56421
  useChannelDeletedListener,