stream-chat-react 13.2.1 → 13.2.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.
- package/dist/components/Channel/Channel.js +3 -1
- package/dist/components/ChannelList/ChannelList.d.ts +2 -1
- package/dist/components/ChannelList/ChannelListMessenger.d.ts +2 -1
- package/dist/components/ChannelList/ChannelListMessenger.js +1 -1
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/Dialog/FormDialog.js +1 -1
- package/dist/components/Loading/LoadingErrorIndicator.d.ts +1 -1
- package/dist/components/Message/renderText/renderText.d.ts +1 -1
- package/dist/components/Message/renderText/renderText.js +25 -16
- package/dist/components/MessageInput/EditMessageForm.js +2 -2
- package/dist/components/MessageInput/MessageInput.js +4 -1
- package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.js +1 -1
- package/dist/components/Poll/PollCreationDialog/OptionFieldSet.js +2 -1
- package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.js +1 -1
- package/dist/components/ReactFileUtilities/UploadButton.js +3 -2
- package/dist/components/TextareaComposer/TextareaComposer.js +29 -2
- package/dist/index.browser.cjs +83 -62
- package/dist/index.browser.cjs.map +3 -3
- package/dist/index.node.cjs +83 -62
- package/dist/index.node.cjs.map +3 -3
- package/package.json +3 -3
package/dist/index.node.cjs
CHANGED
|
@@ -4249,7 +4249,7 @@ var ChannelListMessenger = (props) => {
|
|
|
4249
4249
|
} = props;
|
|
4250
4250
|
const { t } = useTranslationContext("ChannelListMessenger");
|
|
4251
4251
|
if (error) {
|
|
4252
|
-
return /* @__PURE__ */ import_react47.default.createElement(LoadingErrorIndicator2,
|
|
4252
|
+
return /* @__PURE__ */ import_react47.default.createElement(LoadingErrorIndicator2, { error });
|
|
4253
4253
|
}
|
|
4254
4254
|
if (loading) {
|
|
4255
4255
|
return /* @__PURE__ */ import_react47.default.createElement(LoadingIndicator2, null);
|
|
@@ -19814,7 +19814,6 @@ var keepLineBreaksPlugin = () => transform2;
|
|
|
19814
19814
|
// src/components/Message/renderText/renderText.tsx
|
|
19815
19815
|
var import_react110 = __toESM(require("react"));
|
|
19816
19816
|
var import_linkifyjs = require("linkifyjs");
|
|
19817
|
-
var import_lodash13 = __toESM(require("lodash.uniqby"));
|
|
19818
19817
|
|
|
19819
19818
|
// node_modules/ccount/index.js
|
|
19820
19819
|
function ccount(value, character) {
|
|
@@ -22951,39 +22950,31 @@ var renderText = (text7, mentionedUsers, {
|
|
|
22951
22950
|
let newText = text7;
|
|
22952
22951
|
const markdownLinks = matchMarkdownLinks(newText);
|
|
22953
22952
|
const codeBlocks = messageCodeBlocks(newText);
|
|
22954
|
-
|
|
22955
|
-
|
|
22956
|
-
|
|
22957
|
-
|
|
22958
|
-
|
|
22959
|
-
|
|
22960
|
-
|
|
22961
|
-
|
|
22962
|
-
|
|
22963
|
-
|
|
22964
|
-
|
|
22965
|
-
|
|
22966
|
-
|
|
22967
|
-
|
|
22968
|
-
|
|
22969
|
-
|
|
22970
|
-
|
|
22971
|
-
const isMention = newText.charAt(position3 - 1) === "@";
|
|
22972
|
-
return isMention ? match : `[${match}](${encodeDecode(href)})`;
|
|
22973
|
-
}
|
|
22974
|
-
);
|
|
22975
|
-
return;
|
|
22976
|
-
}
|
|
22953
|
+
const links = [...(0, import_linkifyjs.find)(newText, "email"), ...(0, import_linkifyjs.find)(newText, "url")];
|
|
22954
|
+
for (let i = links.length - 1; i >= 0; i--) {
|
|
22955
|
+
const { end, href, start: start2, type, value } = links[i];
|
|
22956
|
+
const linkIsInBlock = codeBlocks.some((block) => block?.includes(value));
|
|
22957
|
+
const noParsingNeeded = markdownLinks && markdownLinks.filter((text8) => {
|
|
22958
|
+
const strippedHref = href?.replace(detectHttp, "");
|
|
22959
|
+
const strippedText = text8?.replace(detectHttp, "");
|
|
22960
|
+
if (!strippedHref || !strippedText) return false;
|
|
22961
|
+
return strippedHref.includes(strippedText) || strippedText.includes(strippedHref);
|
|
22962
|
+
});
|
|
22963
|
+
if (noParsingNeeded.length > 0 || linkIsInBlock) return;
|
|
22964
|
+
try {
|
|
22965
|
+
if (type === "email" && mentionedUsers) {
|
|
22966
|
+
const emailMatchesWithName = mentionedUsers.find((u2) => u2.name === value);
|
|
22967
|
+
if (emailMatchesWithName) {
|
|
22968
|
+
const isMention = newText.charAt(start2 - 1) === "@";
|
|
22969
|
+
newText = newText.slice(0, start2) + (isMention ? value : `[${value}](${encodeDecode(href)})`) + newText.slice(end);
|
|
22977
22970
|
}
|
|
22971
|
+
} else {
|
|
22978
22972
|
const displayLink = type === "email" ? value : formatUrlForDisplay(href);
|
|
22979
|
-
newText = newText.
|
|
22980
|
-
new RegExp(escapeRegExp(value), "g"),
|
|
22981
|
-
`[${displayLink}](${encodeDecode(href)})`
|
|
22982
|
-
);
|
|
22983
|
-
} catch (e) {
|
|
22973
|
+
newText = newText.slice(0, start2) + `[${displayLink}](${encodeDecode(href)})` + newText.slice(end);
|
|
22984
22974
|
}
|
|
22975
|
+
} catch (e) {
|
|
22985
22976
|
}
|
|
22986
|
-
|
|
22977
|
+
}
|
|
22987
22978
|
const remarkPlugins = [
|
|
22988
22979
|
htmlToTextPlugin,
|
|
22989
22980
|
keepLineBreaksPlugin,
|
|
@@ -23850,7 +23841,8 @@ var FormDialog = ({
|
|
|
23850
23841
|
"button",
|
|
23851
23842
|
{
|
|
23852
23843
|
className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
|
|
23853
|
-
onClick: close
|
|
23844
|
+
onClick: close,
|
|
23845
|
+
type: "button"
|
|
23854
23846
|
},
|
|
23855
23847
|
t("Cancel")
|
|
23856
23848
|
), /* @__PURE__ */ import_react127.default.createElement(
|
|
@@ -24137,7 +24129,7 @@ function useManagePollVotesRealtime(managedVoteType, cursorPaginatorState, optio
|
|
|
24137
24129
|
}
|
|
24138
24130
|
|
|
24139
24131
|
// src/components/InfiniteScrollPaginator/hooks/useCursorPaginator.ts
|
|
24140
|
-
var
|
|
24132
|
+
var import_lodash13 = __toESM(require("lodash.uniqby"));
|
|
24141
24133
|
var import_react136 = require("react");
|
|
24142
24134
|
var import_stream_chat3 = require("stream-chat");
|
|
24143
24135
|
var useCursorPaginator = (paginationFn, loadFirstPage) => {
|
|
@@ -24159,7 +24151,7 @@ var useCursorPaginator = (paginationFn, loadFirstPage) => {
|
|
|
24159
24151
|
cursorPaginatorState.next((prev) => ({
|
|
24160
24152
|
...prev,
|
|
24161
24153
|
hasNextPage: !!next,
|
|
24162
|
-
items: (0,
|
|
24154
|
+
items: (0, import_lodash13.default)(prev.items.concat(items), "id"),
|
|
24163
24155
|
latestPageItems: items,
|
|
24164
24156
|
next: next || null
|
|
24165
24157
|
}));
|
|
@@ -24258,7 +24250,7 @@ var usePollOptionVotesPagination = ({
|
|
|
24258
24250
|
|
|
24259
24251
|
// src/components/InfiniteScrollPaginator/InfiniteScrollPaginator.tsx
|
|
24260
24252
|
var import_clsx31 = __toESM(require("clsx"));
|
|
24261
|
-
var
|
|
24253
|
+
var import_lodash14 = __toESM(require("lodash.debounce"));
|
|
24262
24254
|
var import_react139 = __toESM(require("react"));
|
|
24263
24255
|
var mousewheelListener = (event) => {
|
|
24264
24256
|
if (event instanceof WheelEvent && event.deltaY === 1) {
|
|
@@ -24280,7 +24272,7 @@ var InfiniteScrollPaginator = (props) => {
|
|
|
24280
24272
|
const rootRef = (0, import_react139.useRef)(null);
|
|
24281
24273
|
const childRef = (0, import_react139.useRef)(null);
|
|
24282
24274
|
const scrollListener = (0, import_react139.useMemo)(
|
|
24283
|
-
() => (0,
|
|
24275
|
+
() => (0, import_lodash14.default)(() => {
|
|
24284
24276
|
const root4 = rootRef.current;
|
|
24285
24277
|
const child = childRef.current;
|
|
24286
24278
|
if (!root4 || root4.offsetParent === null || !child) {
|
|
@@ -24370,7 +24362,7 @@ var import_react142 = __toESM(require("react"));
|
|
|
24370
24362
|
|
|
24371
24363
|
// src/components/Poll/PollOptionSelector.tsx
|
|
24372
24364
|
var import_clsx32 = __toESM(require("clsx"));
|
|
24373
|
-
var
|
|
24365
|
+
var import_lodash15 = __toESM(require("lodash.debounce"));
|
|
24374
24366
|
var import_react141 = __toESM(require("react"));
|
|
24375
24367
|
var import_stream_chat4 = require("stream-chat");
|
|
24376
24368
|
var AmountBar = ({ amount, className }) => /* @__PURE__ */ import_react141.default.createElement(
|
|
@@ -24418,7 +24410,7 @@ var PollOptionSelector = ({
|
|
|
24418
24410
|
const canCastVote = channelCapabilities["cast-poll-vote"] && !is_closed;
|
|
24419
24411
|
const winningOptionCount = maxVotedOptionIds[0] ? vote_counts_by_option[maxVotedOptionIds[0]] : 0;
|
|
24420
24412
|
const toggleVote = (0, import_react141.useMemo)(
|
|
24421
|
-
() => (0,
|
|
24413
|
+
() => (0, import_lodash15.default)(() => {
|
|
24422
24414
|
if (!canCastVote) return;
|
|
24423
24415
|
const haveVotedForTheOption = !!ownVotesByOptionId[option.id];
|
|
24424
24416
|
return haveVotedForTheOption ? poll.removeVote(ownVotesByOptionId[option.id].id, message.id) : poll.castVote(option.id, message.id);
|
|
@@ -24842,7 +24834,7 @@ var MultipleAnswersField = () => {
|
|
|
24842
24834
|
);
|
|
24843
24835
|
},
|
|
24844
24836
|
placeholder: t("Maximum number of votes (from 2 to 10)"),
|
|
24845
|
-
type: "
|
|
24837
|
+
type: "text",
|
|
24846
24838
|
value: max_votes_allowed
|
|
24847
24839
|
}
|
|
24848
24840
|
))
|
|
@@ -25075,7 +25067,8 @@ var OptionFieldSet = () => {
|
|
|
25075
25067
|
});
|
|
25076
25068
|
},
|
|
25077
25069
|
onKeyUp: (event) => {
|
|
25078
|
-
|
|
25070
|
+
const isFocusedLastOptionField = i === options.length - 1;
|
|
25071
|
+
if (event.key === "Enter" && !isFocusedLastOptionField) {
|
|
25079
25072
|
const nextInputId = options[i + 1].id;
|
|
25080
25073
|
document.getElementById(nextInputId)?.focus();
|
|
25081
25074
|
}
|
|
@@ -25107,7 +25100,8 @@ var PollCreationDialogControls = ({
|
|
|
25107
25100
|
onClick: () => {
|
|
25108
25101
|
messageComposer.pollComposer.initState();
|
|
25109
25102
|
close();
|
|
25110
|
-
}
|
|
25103
|
+
},
|
|
25104
|
+
type: "button"
|
|
25111
25105
|
},
|
|
25112
25106
|
t("Cancel")
|
|
25113
25107
|
), /* @__PURE__ */ import_react157.default.createElement(
|
|
@@ -30459,7 +30453,7 @@ var useUnreadMessagesNotificationVirtualized = ({
|
|
|
30459
30453
|
|
|
30460
30454
|
// src/components/MessageList/VirtualizedMessageListComponents.tsx
|
|
30461
30455
|
var import_clsx48 = __toESM(require("clsx"));
|
|
30462
|
-
var
|
|
30456
|
+
var import_lodash16 = __toESM(require("lodash.throttle"));
|
|
30463
30457
|
var import_react194 = __toESM(require("react"));
|
|
30464
30458
|
var PREPEND_OFFSET = 10 ** 7;
|
|
30465
30459
|
function calculateItemIndex(virtuosoIndex, numItemsPrepended) {
|
|
@@ -30468,7 +30462,7 @@ function calculateItemIndex(virtuosoIndex, numItemsPrepended) {
|
|
|
30468
30462
|
function calculateFirstItemIndex(numItemsPrepended) {
|
|
30469
30463
|
return PREPEND_OFFSET - numItemsPrepended;
|
|
30470
30464
|
}
|
|
30471
|
-
var makeItemsRenderedHandler = (renderedItemsActions, processedMessages) => (0,
|
|
30465
|
+
var makeItemsRenderedHandler = (renderedItemsActions, processedMessages) => (0, import_lodash16.default)((items) => {
|
|
30472
30466
|
const renderedMessages = items.map((item) => {
|
|
30473
30467
|
if (!item.originalIndex) return void 0;
|
|
30474
30468
|
return processedMessages[calculateItemIndex(item.originalIndex, PREPEND_OFFSET)];
|
|
@@ -32705,9 +32699,9 @@ var import_fix_webm_duration = __toESM(require("fix-webm-duration"));
|
|
|
32705
32699
|
var import_nanoid5 = require("nanoid");
|
|
32706
32700
|
|
|
32707
32701
|
// src/utils/mergeDeep.ts
|
|
32708
|
-
var
|
|
32702
|
+
var import_lodash17 = __toESM(require("lodash.mergewith"));
|
|
32709
32703
|
var overrideUndefinedOnly = (object, source) => object ?? source;
|
|
32710
|
-
var mergeDeepUndefined = (target, source) => (0,
|
|
32704
|
+
var mergeDeepUndefined = (target, source) => (0, import_lodash17.default)(target, source, overrideUndefinedOnly);
|
|
32711
32705
|
|
|
32712
32706
|
// src/components/MediaRecorder/classes/AmplitudeRecorder.ts
|
|
32713
32707
|
var MAX_FREQUENCY_AMPLITUDE = 255;
|
|
@@ -34188,6 +34182,12 @@ var searchSourceStateSelector2 = (state) => ({
|
|
|
34188
34182
|
var configStateSelector = (state) => ({
|
|
34189
34183
|
enabled: state.text.enabled
|
|
34190
34184
|
});
|
|
34185
|
+
var messageComposerStateSelector2 = (state) => ({
|
|
34186
|
+
quotedMessage: state.quotedMessage
|
|
34187
|
+
});
|
|
34188
|
+
var attachmentManagerStateSelector = (state) => ({
|
|
34189
|
+
attachments: state.attachments
|
|
34190
|
+
});
|
|
34191
34191
|
var defaultShouldSubmit = (event) => event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing;
|
|
34192
34192
|
var TextareaComposer = ({
|
|
34193
34193
|
className,
|
|
@@ -34210,6 +34210,7 @@ var TextareaComposer = ({
|
|
|
34210
34210
|
const {
|
|
34211
34211
|
additionalTextareaProps,
|
|
34212
34212
|
cooldownRemaining,
|
|
34213
|
+
focus,
|
|
34213
34214
|
handleSubmit,
|
|
34214
34215
|
maxRows: maxRowsContext,
|
|
34215
34216
|
minRows: minRowsContext,
|
|
@@ -34228,6 +34229,14 @@ var TextareaComposer = ({
|
|
|
34228
34229
|
textComposerStateSelector2
|
|
34229
34230
|
);
|
|
34230
34231
|
const { enabled } = useStateStore(messageComposer.configState, configStateSelector);
|
|
34232
|
+
const { quotedMessage } = useStateStore(
|
|
34233
|
+
messageComposer.state,
|
|
34234
|
+
messageComposerStateSelector2
|
|
34235
|
+
);
|
|
34236
|
+
const { attachments } = useStateStore(
|
|
34237
|
+
messageComposer.attachmentManager.state,
|
|
34238
|
+
attachmentManagerStateSelector
|
|
34239
|
+
);
|
|
34231
34240
|
const { isLoadingItems } = useStateStore(suggestions?.searchSource.state, searchSourceStateSelector2) ?? {};
|
|
34232
34241
|
const containerRef = (0, import_react246.useRef)(null);
|
|
34233
34242
|
const [focusedItemIndex, setFocusedItemIndex] = (0, import_react246.useState)(0);
|
|
@@ -34341,6 +34350,16 @@ var TextareaComposer = ({
|
|
|
34341
34350
|
setFocusedItemIndex(0);
|
|
34342
34351
|
}
|
|
34343
34352
|
}, [textComposer.suggestions]);
|
|
34353
|
+
(0, import_react246.useEffect)(() => {
|
|
34354
|
+
const textareaIsFocused = textareaRef.current?.matches(":focus");
|
|
34355
|
+
if (!textareaRef.current || textareaIsFocused || !focus) return;
|
|
34356
|
+
textareaRef.current.focus();
|
|
34357
|
+
}, [attachments, focus, quotedMessage, textareaRef]);
|
|
34358
|
+
(0, import_react246.useEffect)(() => {
|
|
34359
|
+
const textarea = textareaRef.current;
|
|
34360
|
+
if (!textarea) return;
|
|
34361
|
+
textarea.value = text7;
|
|
34362
|
+
}, [textareaRef, text7]);
|
|
34344
34363
|
return /* @__PURE__ */ import_react246.default.createElement(
|
|
34345
34364
|
"div",
|
|
34346
34365
|
{
|
|
@@ -34379,8 +34398,7 @@ var TextareaComposer = ({
|
|
|
34379
34398
|
placeholder: placeholder || t("Type your message"),
|
|
34380
34399
|
ref: (ref) => {
|
|
34381
34400
|
textareaRef.current = ref;
|
|
34382
|
-
}
|
|
34383
|
-
value: text7
|
|
34401
|
+
}
|
|
34384
34402
|
}
|
|
34385
34403
|
),
|
|
34386
34404
|
!isComposing && /* @__PURE__ */ import_react246.default.createElement(
|
|
@@ -34687,7 +34705,7 @@ var MessageInputProvider = (props) => {
|
|
|
34687
34705
|
);
|
|
34688
34706
|
(0, import_react252.useEffect)(() => {
|
|
34689
34707
|
const threadId = messageComposer.threadId;
|
|
34690
|
-
if (!threadId || !messageComposer.channel || !messageComposer.compositionIsEmpty)
|
|
34708
|
+
if (!threadId || !messageComposer.channel || !messageComposer.compositionIsEmpty || !messageComposer.config.drafts.enabled)
|
|
34691
34709
|
return;
|
|
34692
34710
|
messageComposer.channel.getDraft({ parent_id: threadId }).then(({ draft }) => {
|
|
34693
34711
|
if (draft) {
|
|
@@ -34753,7 +34771,8 @@ var EditMessageForm = () => {
|
|
|
34753
34771
|
{
|
|
34754
34772
|
className: "str-chat__edit-message-cancel",
|
|
34755
34773
|
"data-testid": "cancel-button",
|
|
34756
|
-
onClick: cancel
|
|
34774
|
+
onClick: cancel,
|
|
34775
|
+
type: "button"
|
|
34757
34776
|
},
|
|
34758
34777
|
t("Cancel")
|
|
34759
34778
|
), /* @__PURE__ */ import_react253.default.createElement(EditMessageFormSendButton, null))
|
|
@@ -34780,6 +34799,7 @@ var EditMessageModal = ({
|
|
|
34780
34799
|
MessageInput,
|
|
34781
34800
|
{
|
|
34782
34801
|
clearEditingState,
|
|
34802
|
+
focus: true,
|
|
34783
34803
|
hideSendButton: true,
|
|
34784
34804
|
Input: EditMessageInput,
|
|
34785
34805
|
...additionalMessageInputProps
|
|
@@ -34804,7 +34824,7 @@ var UploadFileInput = (0, import_react254.forwardRef)(function UploadFileInput2(
|
|
|
34804
34824
|
...props
|
|
34805
34825
|
}, ref) {
|
|
34806
34826
|
const { t } = useTranslationContext("UploadFileInput");
|
|
34807
|
-
const { cooldownRemaining } = useMessageInputContext();
|
|
34827
|
+
const { cooldownRemaining, textareaRef } = useMessageInputContext();
|
|
34808
34828
|
const messageComposer = useMessageComposer();
|
|
34809
34829
|
const { attachmentManager } = messageComposer;
|
|
34810
34830
|
const { isUploadEnabled } = useAttachmentManagerState();
|
|
@@ -34816,9 +34836,10 @@ var UploadFileInput = (0, import_react254.forwardRef)(function UploadFileInput2(
|
|
|
34816
34836
|
const onFileChange = (0, import_react254.useCallback)(
|
|
34817
34837
|
(files) => {
|
|
34818
34838
|
attachmentManager.uploadFiles(files);
|
|
34839
|
+
textareaRef.current?.focus();
|
|
34819
34840
|
onFileChangeCustom?.(files);
|
|
34820
34841
|
},
|
|
34821
|
-
[onFileChangeCustom, attachmentManager]
|
|
34842
|
+
[onFileChangeCustom, attachmentManager, textareaRef]
|
|
34822
34843
|
);
|
|
34823
34844
|
return /* @__PURE__ */ import_react254.default.createElement(
|
|
34824
34845
|
FileInput,
|
|
@@ -35343,9 +35364,9 @@ var getAttachmentType = (attachment) => {
|
|
|
35343
35364
|
// src/components/Channel/Channel.tsx
|
|
35344
35365
|
var import_react266 = __toESM(require("react"));
|
|
35345
35366
|
var import_clsx67 = __toESM(require("clsx"));
|
|
35346
|
-
var
|
|
35347
|
-
var
|
|
35348
|
-
var
|
|
35367
|
+
var import_lodash18 = __toESM(require("lodash.debounce"));
|
|
35368
|
+
var import_lodash19 = __toESM(require("lodash.defaultsdeep"));
|
|
35369
|
+
var import_lodash20 = __toESM(require("lodash.throttle"));
|
|
35349
35370
|
var import_stream_chat13 = require("stream-chat");
|
|
35350
35371
|
|
|
35351
35372
|
// src/components/Channel/channelState.ts
|
|
@@ -35943,7 +35964,7 @@ var ChannelInner = (props) => {
|
|
|
35943
35964
|
skipMessageDataMemoization
|
|
35944
35965
|
} = props;
|
|
35945
35966
|
const channelQueryOptions = (0, import_react266.useMemo)(
|
|
35946
|
-
() => (0,
|
|
35967
|
+
() => (0, import_lodash19.default)(propChannelQueryOptions, {
|
|
35947
35968
|
messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE }
|
|
35948
35969
|
}),
|
|
35949
35970
|
[propChannelQueryOptions]
|
|
@@ -35978,7 +35999,7 @@ var ChannelInner = (props) => {
|
|
|
35978
35999
|
null
|
|
35979
36000
|
);
|
|
35980
36001
|
const channelCapabilitiesArray = channel.data?.own_capabilities;
|
|
35981
|
-
const throttledCopyStateFromChannel = (0,
|
|
36002
|
+
const throttledCopyStateFromChannel = (0, import_lodash20.default)(
|
|
35982
36003
|
() => dispatch({ channel, type: "copyStateFromChannelOnEvent" }),
|
|
35983
36004
|
500,
|
|
35984
36005
|
{
|
|
@@ -35987,14 +36008,14 @@ var ChannelInner = (props) => {
|
|
|
35987
36008
|
}
|
|
35988
36009
|
);
|
|
35989
36010
|
const setChannelUnreadUiState = (0, import_react266.useMemo)(
|
|
35990
|
-
() => (0,
|
|
36011
|
+
() => (0, import_lodash20.default)(_setChannelUnreadUiState, 200, {
|
|
35991
36012
|
leading: true,
|
|
35992
36013
|
trailing: false
|
|
35993
36014
|
}),
|
|
35994
36015
|
[]
|
|
35995
36016
|
);
|
|
35996
36017
|
const markRead = (0, import_react266.useMemo)(
|
|
35997
|
-
() => (0,
|
|
36018
|
+
() => (0, import_lodash20.default)(
|
|
35998
36019
|
async (options) => {
|
|
35999
36020
|
const { updateChannelUiUnreadState = true } = options ?? {};
|
|
36000
36021
|
if (channel.disconnected || !channelConfig?.read_events) {
|
|
@@ -36009,7 +36030,7 @@ var ChannelInner = (props) => {
|
|
|
36009
36030
|
);
|
|
36010
36031
|
} else {
|
|
36011
36032
|
const markReadResponse = await channel.markRead();
|
|
36012
|
-
if (updateChannelUiUnreadState && markReadResponse) {
|
|
36033
|
+
if (updateChannelUiUnreadState && markReadResponse?.event) {
|
|
36013
36034
|
_setChannelUnreadUiState({
|
|
36014
36035
|
last_read: lastRead.current,
|
|
36015
36036
|
last_read_message_id: markReadResponse.event.last_read_message_id,
|
|
@@ -36199,7 +36220,7 @@ var ChannelInner = (props) => {
|
|
|
36199
36220
|
[]
|
|
36200
36221
|
);
|
|
36201
36222
|
const loadMoreFinished = (0, import_react266.useCallback)(
|
|
36202
|
-
(0,
|
|
36223
|
+
(0, import_lodash18.default)(
|
|
36203
36224
|
(hasMore, messages) => {
|
|
36204
36225
|
if (!isMounted.current) return;
|
|
36205
36226
|
dispatch({ hasMore, messages, type: "loadMoreFinished" });
|
|
@@ -36520,7 +36541,7 @@ var ChannelInner = (props) => {
|
|
|
36520
36541
|
dispatch({ type: "closeThread" });
|
|
36521
36542
|
};
|
|
36522
36543
|
const loadMoreThreadFinished = (0, import_react266.useCallback)(
|
|
36523
|
-
(0,
|
|
36544
|
+
(0, import_lodash18.default)(
|
|
36524
36545
|
(threadHasMore, threadMessages) => {
|
|
36525
36546
|
dispatch({
|
|
36526
36547
|
threadHasMore,
|
|
@@ -36850,7 +36871,7 @@ var useChat = ({
|
|
|
36850
36871
|
};
|
|
36851
36872
|
(0, import_react269.useEffect)(() => {
|
|
36852
36873
|
if (!client) return;
|
|
36853
|
-
const version = "13.2.
|
|
36874
|
+
const version = "13.2.2";
|
|
36854
36875
|
const userAgent = client.getUserAgent();
|
|
36855
36876
|
if (!userAgent.includes("stream-chat-react")) {
|
|
36856
36877
|
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|