stream-chat-react 13.2.1 → 13.2.3
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/Attachment/AttachmentContainer.js +14 -10
- 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/index.d.ts +1 -0
- package/dist/components/Message/index.js +1 -0
- 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 +97 -71
- package/dist/index.browser.cjs.map +3 -3
- package/dist/index.node.cjs +98 -71
- package/dist/index.node.cjs.map +3 -3
- package/package.json +3 -3
package/dist/index.browser.cjs
CHANGED
|
@@ -402,6 +402,7 @@ __export(src_exports, {
|
|
|
402
402
|
MessageInputContext: () => MessageInputContext,
|
|
403
403
|
MessageInputContextProvider: () => MessageInputContextProvider,
|
|
404
404
|
MessageInputFlat: () => MessageInputFlat,
|
|
405
|
+
MessageIsThreadReplyInChannelButtonIndicator: () => MessageIsThreadReplyInChannelButtonIndicator,
|
|
405
406
|
MessageList: () => MessageList,
|
|
406
407
|
MessageListContext: () => MessageListContext,
|
|
407
408
|
MessageListContextProvider: () => MessageListContextProvider,
|
|
@@ -4249,7 +4250,7 @@ var ChannelListMessenger = (props) => {
|
|
|
4249
4250
|
} = props;
|
|
4250
4251
|
const { t } = useTranslationContext("ChannelListMessenger");
|
|
4251
4252
|
if (error) {
|
|
4252
|
-
return /* @__PURE__ */ import_react47.default.createElement(LoadingErrorIndicator2,
|
|
4253
|
+
return /* @__PURE__ */ import_react47.default.createElement(LoadingErrorIndicator2, { error });
|
|
4253
4254
|
}
|
|
4254
4255
|
if (loading) {
|
|
4255
4256
|
return /* @__PURE__ */ import_react47.default.createElement(LoadingIndicator2, null);
|
|
@@ -17944,7 +17945,6 @@ var keepLineBreaksPlugin = () => transform2;
|
|
|
17944
17945
|
// src/components/Message/renderText/renderText.tsx
|
|
17945
17946
|
var import_react110 = __toESM(require("react"));
|
|
17946
17947
|
var import_linkifyjs = require("linkifyjs");
|
|
17947
|
-
var import_lodash13 = __toESM(require("lodash.uniqby"));
|
|
17948
17948
|
|
|
17949
17949
|
// node_modules/ccount/index.js
|
|
17950
17950
|
function ccount(value, character) {
|
|
@@ -21081,39 +21081,31 @@ var renderText = (text7, mentionedUsers, {
|
|
|
21081
21081
|
let newText = text7;
|
|
21082
21082
|
const markdownLinks = matchMarkdownLinks(newText);
|
|
21083
21083
|
const codeBlocks = messageCodeBlocks(newText);
|
|
21084
|
-
|
|
21085
|
-
|
|
21086
|
-
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
const isMention = newText.charAt(position3 - 1) === "@";
|
|
21102
|
-
return isMention ? match : `[${match}](${encodeDecode(href)})`;
|
|
21103
|
-
}
|
|
21104
|
-
);
|
|
21105
|
-
return;
|
|
21106
|
-
}
|
|
21084
|
+
const links = [...(0, import_linkifyjs.find)(newText, "email"), ...(0, import_linkifyjs.find)(newText, "url")];
|
|
21085
|
+
for (let i = links.length - 1; i >= 0; i--) {
|
|
21086
|
+
const { end, href, start: start2, type, value } = links[i];
|
|
21087
|
+
const linkIsInBlock = codeBlocks.some((block) => block?.includes(value));
|
|
21088
|
+
const noParsingNeeded = markdownLinks && markdownLinks.filter((text8) => {
|
|
21089
|
+
const strippedHref = href?.replace(detectHttp, "");
|
|
21090
|
+
const strippedText = text8?.replace(detectHttp, "");
|
|
21091
|
+
if (!strippedHref || !strippedText) return false;
|
|
21092
|
+
return strippedHref.includes(strippedText) || strippedText.includes(strippedHref);
|
|
21093
|
+
});
|
|
21094
|
+
if (noParsingNeeded.length > 0 || linkIsInBlock) return;
|
|
21095
|
+
try {
|
|
21096
|
+
if (type === "email" && mentionedUsers) {
|
|
21097
|
+
const emailMatchesWithName = mentionedUsers.find((u2) => u2.name === value);
|
|
21098
|
+
if (emailMatchesWithName) {
|
|
21099
|
+
const isMention = newText.charAt(start2 - 1) === "@";
|
|
21100
|
+
newText = newText.slice(0, start2) + (isMention ? value : `[${value}](${encodeDecode(href)})`) + newText.slice(end);
|
|
21107
21101
|
}
|
|
21102
|
+
} else {
|
|
21108
21103
|
const displayLink = type === "email" ? value : formatUrlForDisplay(href);
|
|
21109
|
-
newText = newText.
|
|
21110
|
-
new RegExp(escapeRegExp(value), "g"),
|
|
21111
|
-
`[${displayLink}](${encodeDecode(href)})`
|
|
21112
|
-
);
|
|
21113
|
-
} catch (e) {
|
|
21104
|
+
newText = newText.slice(0, start2) + `[${displayLink}](${encodeDecode(href)})` + newText.slice(end);
|
|
21114
21105
|
}
|
|
21106
|
+
} catch (e) {
|
|
21115
21107
|
}
|
|
21116
|
-
|
|
21108
|
+
}
|
|
21117
21109
|
const remarkPlugins = [
|
|
21118
21110
|
htmlToTextPlugin,
|
|
21119
21111
|
keepLineBreaksPlugin,
|
|
@@ -21980,7 +21972,8 @@ var FormDialog = ({
|
|
|
21980
21972
|
"button",
|
|
21981
21973
|
{
|
|
21982
21974
|
className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
|
|
21983
|
-
onClick: close
|
|
21975
|
+
onClick: close,
|
|
21976
|
+
type: "button"
|
|
21984
21977
|
},
|
|
21985
21978
|
t("Cancel")
|
|
21986
21979
|
), /* @__PURE__ */ import_react127.default.createElement(
|
|
@@ -22267,7 +22260,7 @@ function useManagePollVotesRealtime(managedVoteType, cursorPaginatorState, optio
|
|
|
22267
22260
|
}
|
|
22268
22261
|
|
|
22269
22262
|
// src/components/InfiniteScrollPaginator/hooks/useCursorPaginator.ts
|
|
22270
|
-
var
|
|
22263
|
+
var import_lodash13 = __toESM(require("lodash.uniqby"));
|
|
22271
22264
|
var import_react136 = require("react");
|
|
22272
22265
|
var import_stream_chat3 = require("stream-chat");
|
|
22273
22266
|
var useCursorPaginator = (paginationFn, loadFirstPage) => {
|
|
@@ -22289,7 +22282,7 @@ var useCursorPaginator = (paginationFn, loadFirstPage) => {
|
|
|
22289
22282
|
cursorPaginatorState.next((prev) => ({
|
|
22290
22283
|
...prev,
|
|
22291
22284
|
hasNextPage: !!next,
|
|
22292
|
-
items: (0,
|
|
22285
|
+
items: (0, import_lodash13.default)(prev.items.concat(items), "id"),
|
|
22293
22286
|
latestPageItems: items,
|
|
22294
22287
|
next: next || null
|
|
22295
22288
|
}));
|
|
@@ -22388,7 +22381,7 @@ var usePollOptionVotesPagination = ({
|
|
|
22388
22381
|
|
|
22389
22382
|
// src/components/InfiniteScrollPaginator/InfiniteScrollPaginator.tsx
|
|
22390
22383
|
var import_clsx31 = __toESM(require("clsx"));
|
|
22391
|
-
var
|
|
22384
|
+
var import_lodash14 = __toESM(require("lodash.debounce"));
|
|
22392
22385
|
var import_react139 = __toESM(require("react"));
|
|
22393
22386
|
var mousewheelListener = (event) => {
|
|
22394
22387
|
if (event instanceof WheelEvent && event.deltaY === 1) {
|
|
@@ -22410,7 +22403,7 @@ var InfiniteScrollPaginator = (props) => {
|
|
|
22410
22403
|
const rootRef = (0, import_react139.useRef)(null);
|
|
22411
22404
|
const childRef = (0, import_react139.useRef)(null);
|
|
22412
22405
|
const scrollListener = (0, import_react139.useMemo)(
|
|
22413
|
-
() => (0,
|
|
22406
|
+
() => (0, import_lodash14.default)(() => {
|
|
22414
22407
|
const root4 = rootRef.current;
|
|
22415
22408
|
const child = childRef.current;
|
|
22416
22409
|
if (!root4 || root4.offsetParent === null || !child) {
|
|
@@ -22500,7 +22493,7 @@ var import_react142 = __toESM(require("react"));
|
|
|
22500
22493
|
|
|
22501
22494
|
// src/components/Poll/PollOptionSelector.tsx
|
|
22502
22495
|
var import_clsx32 = __toESM(require("clsx"));
|
|
22503
|
-
var
|
|
22496
|
+
var import_lodash15 = __toESM(require("lodash.debounce"));
|
|
22504
22497
|
var import_react141 = __toESM(require("react"));
|
|
22505
22498
|
var import_stream_chat4 = require("stream-chat");
|
|
22506
22499
|
var AmountBar = ({ amount, className }) => /* @__PURE__ */ import_react141.default.createElement(
|
|
@@ -22548,7 +22541,7 @@ var PollOptionSelector = ({
|
|
|
22548
22541
|
const canCastVote = channelCapabilities["cast-poll-vote"] && !is_closed;
|
|
22549
22542
|
const winningOptionCount = maxVotedOptionIds[0] ? vote_counts_by_option[maxVotedOptionIds[0]] : 0;
|
|
22550
22543
|
const toggleVote = (0, import_react141.useMemo)(
|
|
22551
|
-
() => (0,
|
|
22544
|
+
() => (0, import_lodash15.default)(() => {
|
|
22552
22545
|
if (!canCastVote) return;
|
|
22553
22546
|
const haveVotedForTheOption = !!ownVotesByOptionId[option.id];
|
|
22554
22547
|
return haveVotedForTheOption ? poll.removeVote(ownVotesByOptionId[option.id].id, message.id) : poll.castVote(option.id, message.id);
|
|
@@ -22972,7 +22965,7 @@ var MultipleAnswersField = () => {
|
|
|
22972
22965
|
);
|
|
22973
22966
|
},
|
|
22974
22967
|
placeholder: t("Maximum number of votes (from 2 to 10)"),
|
|
22975
|
-
type: "
|
|
22968
|
+
type: "text",
|
|
22976
22969
|
value: max_votes_allowed
|
|
22977
22970
|
}
|
|
22978
22971
|
))
|
|
@@ -23205,7 +23198,8 @@ var OptionFieldSet = () => {
|
|
|
23205
23198
|
});
|
|
23206
23199
|
},
|
|
23207
23200
|
onKeyUp: (event) => {
|
|
23208
|
-
|
|
23201
|
+
const isFocusedLastOptionField = i === options.length - 1;
|
|
23202
|
+
if (event.key === "Enter" && !isFocusedLastOptionField) {
|
|
23209
23203
|
const nextInputId = options[i + 1].id;
|
|
23210
23204
|
document.getElementById(nextInputId)?.focus();
|
|
23211
23205
|
}
|
|
@@ -23237,7 +23231,8 @@ var PollCreationDialogControls = ({
|
|
|
23237
23231
|
onClick: () => {
|
|
23238
23232
|
messageComposer.pollComposer.initState();
|
|
23239
23233
|
close();
|
|
23240
|
-
}
|
|
23234
|
+
},
|
|
23235
|
+
type: "button"
|
|
23241
23236
|
},
|
|
23242
23237
|
t("Cancel")
|
|
23243
23238
|
), /* @__PURE__ */ import_react157.default.createElement(
|
|
@@ -28589,7 +28584,7 @@ var useUnreadMessagesNotificationVirtualized = ({
|
|
|
28589
28584
|
|
|
28590
28585
|
// src/components/MessageList/VirtualizedMessageListComponents.tsx
|
|
28591
28586
|
var import_clsx48 = __toESM(require("clsx"));
|
|
28592
|
-
var
|
|
28587
|
+
var import_lodash16 = __toESM(require("lodash.throttle"));
|
|
28593
28588
|
var import_react194 = __toESM(require("react"));
|
|
28594
28589
|
var PREPEND_OFFSET = 10 ** 7;
|
|
28595
28590
|
function calculateItemIndex(virtuosoIndex, numItemsPrepended) {
|
|
@@ -28598,7 +28593,7 @@ function calculateItemIndex(virtuosoIndex, numItemsPrepended) {
|
|
|
28598
28593
|
function calculateFirstItemIndex(numItemsPrepended) {
|
|
28599
28594
|
return PREPEND_OFFSET - numItemsPrepended;
|
|
28600
28595
|
}
|
|
28601
|
-
var makeItemsRenderedHandler = (renderedItemsActions, processedMessages) => (0,
|
|
28596
|
+
var makeItemsRenderedHandler = (renderedItemsActions, processedMessages) => (0, import_lodash16.default)((items) => {
|
|
28602
28597
|
const renderedMessages = items.map((item) => {
|
|
28603
28598
|
if (!item.originalIndex) return void 0;
|
|
28604
28599
|
return processedMessages[calculateItemIndex(item.originalIndex, PREPEND_OFFSET)];
|
|
@@ -30835,9 +30830,9 @@ var import_fix_webm_duration = __toESM(require("fix-webm-duration"));
|
|
|
30835
30830
|
var import_nanoid5 = require("nanoid");
|
|
30836
30831
|
|
|
30837
30832
|
// src/utils/mergeDeep.ts
|
|
30838
|
-
var
|
|
30833
|
+
var import_lodash17 = __toESM(require("lodash.mergewith"));
|
|
30839
30834
|
var overrideUndefinedOnly = (object, source) => object ?? source;
|
|
30840
|
-
var mergeDeepUndefined = (target, source) => (0,
|
|
30835
|
+
var mergeDeepUndefined = (target, source) => (0, import_lodash17.default)(target, source, overrideUndefinedOnly);
|
|
30841
30836
|
|
|
30842
30837
|
// src/components/MediaRecorder/classes/AmplitudeRecorder.ts
|
|
30843
30838
|
var MAX_FREQUENCY_AMPLITUDE = 255;
|
|
@@ -32318,6 +32313,12 @@ var searchSourceStateSelector2 = (state) => ({
|
|
|
32318
32313
|
var configStateSelector = (state) => ({
|
|
32319
32314
|
enabled: state.text.enabled
|
|
32320
32315
|
});
|
|
32316
|
+
var messageComposerStateSelector2 = (state) => ({
|
|
32317
|
+
quotedMessage: state.quotedMessage
|
|
32318
|
+
});
|
|
32319
|
+
var attachmentManagerStateSelector = (state) => ({
|
|
32320
|
+
attachments: state.attachments
|
|
32321
|
+
});
|
|
32321
32322
|
var defaultShouldSubmit = (event) => event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing;
|
|
32322
32323
|
var TextareaComposer = ({
|
|
32323
32324
|
className,
|
|
@@ -32340,6 +32341,7 @@ var TextareaComposer = ({
|
|
|
32340
32341
|
const {
|
|
32341
32342
|
additionalTextareaProps,
|
|
32342
32343
|
cooldownRemaining,
|
|
32344
|
+
focus,
|
|
32343
32345
|
handleSubmit,
|
|
32344
32346
|
maxRows: maxRowsContext,
|
|
32345
32347
|
minRows: minRowsContext,
|
|
@@ -32358,6 +32360,14 @@ var TextareaComposer = ({
|
|
|
32358
32360
|
textComposerStateSelector2
|
|
32359
32361
|
);
|
|
32360
32362
|
const { enabled } = useStateStore(messageComposer.configState, configStateSelector);
|
|
32363
|
+
const { quotedMessage } = useStateStore(
|
|
32364
|
+
messageComposer.state,
|
|
32365
|
+
messageComposerStateSelector2
|
|
32366
|
+
);
|
|
32367
|
+
const { attachments } = useStateStore(
|
|
32368
|
+
messageComposer.attachmentManager.state,
|
|
32369
|
+
attachmentManagerStateSelector
|
|
32370
|
+
);
|
|
32361
32371
|
const { isLoadingItems } = useStateStore(suggestions?.searchSource.state, searchSourceStateSelector2) ?? {};
|
|
32362
32372
|
const containerRef = (0, import_react246.useRef)(null);
|
|
32363
32373
|
const [focusedItemIndex, setFocusedItemIndex] = (0, import_react246.useState)(0);
|
|
@@ -32471,6 +32481,16 @@ var TextareaComposer = ({
|
|
|
32471
32481
|
setFocusedItemIndex(0);
|
|
32472
32482
|
}
|
|
32473
32483
|
}, [textComposer.suggestions]);
|
|
32484
|
+
(0, import_react246.useEffect)(() => {
|
|
32485
|
+
const textareaIsFocused = textareaRef.current?.matches(":focus");
|
|
32486
|
+
if (!textareaRef.current || textareaIsFocused || !focus) return;
|
|
32487
|
+
textareaRef.current.focus();
|
|
32488
|
+
}, [attachments, focus, quotedMessage, textareaRef]);
|
|
32489
|
+
(0, import_react246.useEffect)(() => {
|
|
32490
|
+
const textarea = textareaRef.current;
|
|
32491
|
+
if (!textarea) return;
|
|
32492
|
+
textarea.value = text7;
|
|
32493
|
+
}, [textareaRef, text7]);
|
|
32474
32494
|
return /* @__PURE__ */ import_react246.default.createElement(
|
|
32475
32495
|
"div",
|
|
32476
32496
|
{
|
|
@@ -32509,8 +32529,7 @@ var TextareaComposer = ({
|
|
|
32509
32529
|
placeholder: placeholder || t("Type your message"),
|
|
32510
32530
|
ref: (ref) => {
|
|
32511
32531
|
textareaRef.current = ref;
|
|
32512
|
-
}
|
|
32513
|
-
value: text7
|
|
32532
|
+
}
|
|
32514
32533
|
}
|
|
32515
32534
|
),
|
|
32516
32535
|
!isComposing && /* @__PURE__ */ import_react246.default.createElement(
|
|
@@ -32817,7 +32836,7 @@ var MessageInputProvider = (props) => {
|
|
|
32817
32836
|
);
|
|
32818
32837
|
(0, import_react252.useEffect)(() => {
|
|
32819
32838
|
const threadId = messageComposer.threadId;
|
|
32820
|
-
if (!threadId || !messageComposer.channel || !messageComposer.compositionIsEmpty)
|
|
32839
|
+
if (!threadId || !messageComposer.channel || !messageComposer.compositionIsEmpty || !messageComposer.config.drafts.enabled)
|
|
32821
32840
|
return;
|
|
32822
32841
|
messageComposer.channel.getDraft({ parent_id: threadId }).then(({ draft }) => {
|
|
32823
32842
|
if (draft) {
|
|
@@ -32883,7 +32902,8 @@ var EditMessageForm = () => {
|
|
|
32883
32902
|
{
|
|
32884
32903
|
className: "str-chat__edit-message-cancel",
|
|
32885
32904
|
"data-testid": "cancel-button",
|
|
32886
|
-
onClick: cancel
|
|
32905
|
+
onClick: cancel,
|
|
32906
|
+
type: "button"
|
|
32887
32907
|
},
|
|
32888
32908
|
t("Cancel")
|
|
32889
32909
|
), /* @__PURE__ */ import_react253.default.createElement(EditMessageFormSendButton, null))
|
|
@@ -32910,6 +32930,7 @@ var EditMessageModal = ({
|
|
|
32910
32930
|
MessageInput,
|
|
32911
32931
|
{
|
|
32912
32932
|
clearEditingState,
|
|
32933
|
+
focus: true,
|
|
32913
32934
|
hideSendButton: true,
|
|
32914
32935
|
Input: EditMessageInput,
|
|
32915
32936
|
...additionalMessageInputProps
|
|
@@ -32934,7 +32955,7 @@ var UploadFileInput = (0, import_react254.forwardRef)(function UploadFileInput2(
|
|
|
32934
32955
|
...props
|
|
32935
32956
|
}, ref) {
|
|
32936
32957
|
const { t } = useTranslationContext("UploadFileInput");
|
|
32937
|
-
const { cooldownRemaining } = useMessageInputContext();
|
|
32958
|
+
const { cooldownRemaining, textareaRef } = useMessageInputContext();
|
|
32938
32959
|
const messageComposer = useMessageComposer();
|
|
32939
32960
|
const { attachmentManager } = messageComposer;
|
|
32940
32961
|
const { isUploadEnabled } = useAttachmentManagerState();
|
|
@@ -32946,9 +32967,10 @@ var UploadFileInput = (0, import_react254.forwardRef)(function UploadFileInput2(
|
|
|
32946
32967
|
const onFileChange = (0, import_react254.useCallback)(
|
|
32947
32968
|
(files) => {
|
|
32948
32969
|
attachmentManager.uploadFiles(files);
|
|
32970
|
+
textareaRef.current?.focus();
|
|
32949
32971
|
onFileChangeCustom?.(files);
|
|
32950
32972
|
},
|
|
32951
|
-
[onFileChangeCustom, attachmentManager]
|
|
32973
|
+
[onFileChangeCustom, attachmentManager, textareaRef]
|
|
32952
32974
|
);
|
|
32953
32975
|
return /* @__PURE__ */ import_react254.default.createElement(
|
|
32954
32976
|
FileInput,
|
|
@@ -33259,15 +33281,19 @@ var GalleryContainer = ({
|
|
|
33259
33281
|
const { imageAttachmentSizeHandler } = useChannelStateContext();
|
|
33260
33282
|
const [attachmentConfigurations, setAttachmentConfigurations] = (0, import_react259.useState)([]);
|
|
33261
33283
|
(0, import_react259.useLayoutEffect)(() => {
|
|
33262
|
-
if (imageElements.current
|
|
33263
|
-
|
|
33264
|
-
|
|
33265
|
-
|
|
33266
|
-
|
|
33267
|
-
|
|
33268
|
-
|
|
33269
|
-
|
|
33270
|
-
|
|
33284
|
+
if (!imageElements.current || !imageAttachmentSizeHandler) return;
|
|
33285
|
+
const newConfigurations = [];
|
|
33286
|
+
const nonNullImageElements = imageElements.current.filter((e) => !!e);
|
|
33287
|
+
if (nonNullImageElements.length < imageElements.current.length) {
|
|
33288
|
+
imageElements.current = nonNullImageElements;
|
|
33289
|
+
}
|
|
33290
|
+
imageElements.current.forEach((element4, i) => {
|
|
33291
|
+
if (!element4) return;
|
|
33292
|
+
const config = imageAttachmentSizeHandler(attachment.images[i], element4);
|
|
33293
|
+
newConfigurations.push(config);
|
|
33294
|
+
});
|
|
33295
|
+
setAttachmentConfigurations(newConfigurations);
|
|
33296
|
+
}, [imageAttachmentSizeHandler, attachment]);
|
|
33271
33297
|
const images = attachment.images.map((image3, i) => ({
|
|
33272
33298
|
...image3,
|
|
33273
33299
|
previewUrl: attachmentConfigurations[i]?.url || "about:blank",
|
|
@@ -33473,9 +33499,9 @@ var getAttachmentType = (attachment) => {
|
|
|
33473
33499
|
// src/components/Channel/Channel.tsx
|
|
33474
33500
|
var import_react266 = __toESM(require("react"));
|
|
33475
33501
|
var import_clsx67 = __toESM(require("clsx"));
|
|
33476
|
-
var
|
|
33477
|
-
var
|
|
33478
|
-
var
|
|
33502
|
+
var import_lodash18 = __toESM(require("lodash.debounce"));
|
|
33503
|
+
var import_lodash19 = __toESM(require("lodash.defaultsdeep"));
|
|
33504
|
+
var import_lodash20 = __toESM(require("lodash.throttle"));
|
|
33479
33505
|
var import_stream_chat13 = require("stream-chat");
|
|
33480
33506
|
|
|
33481
33507
|
// src/components/Channel/channelState.ts
|
|
@@ -34073,7 +34099,7 @@ var ChannelInner = (props) => {
|
|
|
34073
34099
|
skipMessageDataMemoization
|
|
34074
34100
|
} = props;
|
|
34075
34101
|
const channelQueryOptions = (0, import_react266.useMemo)(
|
|
34076
|
-
() => (0,
|
|
34102
|
+
() => (0, import_lodash19.default)(propChannelQueryOptions, {
|
|
34077
34103
|
messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE }
|
|
34078
34104
|
}),
|
|
34079
34105
|
[propChannelQueryOptions]
|
|
@@ -34108,7 +34134,7 @@ var ChannelInner = (props) => {
|
|
|
34108
34134
|
null
|
|
34109
34135
|
);
|
|
34110
34136
|
const channelCapabilitiesArray = channel.data?.own_capabilities;
|
|
34111
|
-
const throttledCopyStateFromChannel = (0,
|
|
34137
|
+
const throttledCopyStateFromChannel = (0, import_lodash20.default)(
|
|
34112
34138
|
() => dispatch({ channel, type: "copyStateFromChannelOnEvent" }),
|
|
34113
34139
|
500,
|
|
34114
34140
|
{
|
|
@@ -34117,14 +34143,14 @@ var ChannelInner = (props) => {
|
|
|
34117
34143
|
}
|
|
34118
34144
|
);
|
|
34119
34145
|
const setChannelUnreadUiState = (0, import_react266.useMemo)(
|
|
34120
|
-
() => (0,
|
|
34146
|
+
() => (0, import_lodash20.default)(_setChannelUnreadUiState, 200, {
|
|
34121
34147
|
leading: true,
|
|
34122
34148
|
trailing: false
|
|
34123
34149
|
}),
|
|
34124
34150
|
[]
|
|
34125
34151
|
);
|
|
34126
34152
|
const markRead = (0, import_react266.useMemo)(
|
|
34127
|
-
() => (0,
|
|
34153
|
+
() => (0, import_lodash20.default)(
|
|
34128
34154
|
async (options) => {
|
|
34129
34155
|
const { updateChannelUiUnreadState = true } = options ?? {};
|
|
34130
34156
|
if (channel.disconnected || !channelConfig?.read_events) {
|
|
@@ -34139,7 +34165,7 @@ var ChannelInner = (props) => {
|
|
|
34139
34165
|
);
|
|
34140
34166
|
} else {
|
|
34141
34167
|
const markReadResponse = await channel.markRead();
|
|
34142
|
-
if (updateChannelUiUnreadState && markReadResponse) {
|
|
34168
|
+
if (updateChannelUiUnreadState && markReadResponse?.event) {
|
|
34143
34169
|
_setChannelUnreadUiState({
|
|
34144
34170
|
last_read: lastRead.current,
|
|
34145
34171
|
last_read_message_id: markReadResponse.event.last_read_message_id,
|
|
@@ -34329,7 +34355,7 @@ var ChannelInner = (props) => {
|
|
|
34329
34355
|
[]
|
|
34330
34356
|
);
|
|
34331
34357
|
const loadMoreFinished = (0, import_react266.useCallback)(
|
|
34332
|
-
(0,
|
|
34358
|
+
(0, import_lodash18.default)(
|
|
34333
34359
|
(hasMore, messages) => {
|
|
34334
34360
|
if (!isMounted.current) return;
|
|
34335
34361
|
dispatch({ hasMore, messages, type: "loadMoreFinished" });
|
|
@@ -34650,7 +34676,7 @@ var ChannelInner = (props) => {
|
|
|
34650
34676
|
dispatch({ type: "closeThread" });
|
|
34651
34677
|
};
|
|
34652
34678
|
const loadMoreThreadFinished = (0, import_react266.useCallback)(
|
|
34653
|
-
(0,
|
|
34679
|
+
(0, import_lodash18.default)(
|
|
34654
34680
|
(threadHasMore, threadMessages) => {
|
|
34655
34681
|
dispatch({
|
|
34656
34682
|
threadHasMore,
|
|
@@ -34980,7 +35006,7 @@ var useChat = ({
|
|
|
34980
35006
|
};
|
|
34981
35007
|
(0, import_react269.useEffect)(() => {
|
|
34982
35008
|
if (!client) return;
|
|
34983
|
-
const version = "13.2.
|
|
35009
|
+
const version = "13.2.3";
|
|
34984
35010
|
const userAgent = client.getUserAgent();
|
|
34985
35011
|
if (!userAgent.includes("stream-chat-react")) {
|
|
34986
35012
|
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|