stream-chat-react 12.15.0 → 12.15.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.
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/MessageInput/hooks/useSubmitHandler.js +12 -6
- package/dist/components/Poll/PollActions/PollResults/PollResults.js +1 -1
- package/dist/index.browser.cjs +13 -12
- package/dist/index.browser.cjs.map +2 -2
- package/dist/index.node.cjs +13 -12
- package/dist/index.node.cjs.map +2 -2
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ export const useChat = ({ client, defaultLanguage = 'en', i18nInstance, initialN
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (!client)
|
|
26
26
|
return;
|
|
27
|
-
const version = "12.15.
|
|
27
|
+
const version = "12.15.1";
|
|
28
28
|
const userAgent = client.getUserAgent();
|
|
29
29
|
if (!userAgent.includes('stream-chat-react')) {
|
|
30
30
|
// result looks like: 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
|
|
@@ -38,9 +38,13 @@ export const useSubmitHandler = (props, state, dispatch, numberOfUploads, enrich
|
|
|
38
38
|
if (someAttachmentsUploading) {
|
|
39
39
|
return addNotification(t('Wait until all attachments have uploaded'), 'error');
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
.filter((att) =>
|
|
43
|
-
|
|
41
|
+
const attachmentsWithoutLinkPreviews = attachments
|
|
42
|
+
.filter((att) => {
|
|
43
|
+
const isSuccessfulUpload = att.localMetadata?.uploadState === 'finished';
|
|
44
|
+
const isNotUpload = !att.localMetadata?.uploadState;
|
|
45
|
+
const isNotLinkPreview = !att.og_scrape_url;
|
|
46
|
+
return isNotLinkPreview && (isSuccessfulUpload || isNotUpload);
|
|
47
|
+
})
|
|
44
48
|
.map((localAttachment) => {
|
|
45
49
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46
50
|
const { localMetadata: _, ...attachment } = localAttachment;
|
|
@@ -56,8 +60,7 @@ export const useSubmitHandler = (props, state, dispatch, numberOfUploads, enrich
|
|
|
56
60
|
attachmentsFromLinkPreviews = someLinkPreviewsLoading
|
|
57
61
|
? []
|
|
58
62
|
: Array.from(linkPreviews.values())
|
|
59
|
-
.filter((linkPreview) => linkPreview.state === LinkPreviewState.LOADED
|
|
60
|
-
!attachmentsFromUploads.find((attFromUpload) => attFromUpload.og_scrape_url === linkPreview.og_scrape_url))
|
|
63
|
+
.filter((linkPreview) => linkPreview.state === LinkPreviewState.LOADED)
|
|
61
64
|
.map(
|
|
62
65
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
63
66
|
({ state: linkPreviewState, ...ogAttachment }) => ogAttachment);
|
|
@@ -66,7 +69,10 @@ export const useSubmitHandler = (props, state, dispatch, numberOfUploads, enrich
|
|
|
66
69
|
(!someLinkPreviewsLoading && attachmentsFromLinkPreviews.length > 0) ||
|
|
67
70
|
someLinkPreviewsDismissed;
|
|
68
71
|
}
|
|
69
|
-
const newAttachments = [
|
|
72
|
+
const newAttachments = [
|
|
73
|
+
...attachmentsWithoutLinkPreviews,
|
|
74
|
+
...attachmentsFromLinkPreviews,
|
|
75
|
+
];
|
|
70
76
|
// Instead of checking if a user is still mentioned every time the text changes,
|
|
71
77
|
// just filter out non-mentioned users before submit, which is cheaper
|
|
72
78
|
// and allows users to easily undo any accidental deletion
|
|
@@ -7,7 +7,7 @@ import { useStateStore } from '../../../../store';
|
|
|
7
7
|
import { usePollContext, useTranslationContext } from '../../../../context';
|
|
8
8
|
const pollStateSelector = (nextValue) => ({
|
|
9
9
|
name: nextValue.name,
|
|
10
|
-
options: nextValue.options,
|
|
10
|
+
options: [...nextValue.options],
|
|
11
11
|
vote_counts_by_option: nextValue.vote_counts_by_option,
|
|
12
12
|
});
|
|
13
13
|
export const PollResults = ({ close, }) => {
|
package/dist/index.browser.cjs
CHANGED
|
@@ -39726,10 +39726,12 @@ var useSubmitHandler = (props, state, dispatch, numberOfUploads, enrichURLsContr
|
|
|
39726
39726
|
if (someAttachmentsUploading) {
|
|
39727
39727
|
return addNotification(t2("Wait until all attachments have uploaded"), "error");
|
|
39728
39728
|
}
|
|
39729
|
-
const
|
|
39730
|
-
|
|
39731
|
-
|
|
39732
|
-
|
|
39729
|
+
const attachmentsWithoutLinkPreviews = attachments.filter((att) => {
|
|
39730
|
+
const isSuccessfulUpload = att.localMetadata?.uploadState === "finished";
|
|
39731
|
+
const isNotUpload = !att.localMetadata?.uploadState;
|
|
39732
|
+
const isNotLinkPreview = !att.og_scrape_url;
|
|
39733
|
+
return isNotLinkPreview && (isSuccessfulUpload || isNotUpload);
|
|
39734
|
+
}).map((localAttachment) => {
|
|
39733
39735
|
const { localMetadata: _, ...attachment } = localAttachment;
|
|
39734
39736
|
return attachment;
|
|
39735
39737
|
});
|
|
@@ -39743,17 +39745,16 @@ var useSubmitHandler = (props, state, dispatch, numberOfUploads, enrichURLsContr
|
|
|
39743
39745
|
const someLinkPreviewsDismissed = Array.from(linkPreviews.values()).some(
|
|
39744
39746
|
(linkPreview) => linkPreview.state === "dismissed" /* DISMISSED */
|
|
39745
39747
|
);
|
|
39746
|
-
attachmentsFromLinkPreviews = someLinkPreviewsLoading ? [] : Array.from(linkPreviews.values()).filter(
|
|
39747
|
-
(linkPreview) => linkPreview.state === "loaded" /* LOADED */ && !attachmentsFromUploads.find(
|
|
39748
|
-
(attFromUpload) => attFromUpload.og_scrape_url === linkPreview.og_scrape_url
|
|
39749
|
-
)
|
|
39750
|
-
).map(
|
|
39748
|
+
attachmentsFromLinkPreviews = someLinkPreviewsLoading ? [] : Array.from(linkPreviews.values()).filter((linkPreview) => linkPreview.state === "loaded" /* LOADED */).map(
|
|
39751
39749
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39752
39750
|
({ state: linkPreviewState, ...ogAttachment }) => ogAttachment
|
|
39753
39751
|
);
|
|
39754
39752
|
sendOptions.skip_enrich_url = !someLinkPreviewsLoading && attachmentsFromLinkPreviews.length > 0 || someLinkPreviewsDismissed;
|
|
39755
39753
|
}
|
|
39756
|
-
const newAttachments = [
|
|
39754
|
+
const newAttachments = [
|
|
39755
|
+
...attachmentsWithoutLinkPreviews,
|
|
39756
|
+
...attachmentsFromLinkPreviews
|
|
39757
|
+
];
|
|
39757
39758
|
const actualMentionedUsers = Array.from(
|
|
39758
39759
|
new Set(
|
|
39759
39760
|
mentioned_users.filter(
|
|
@@ -46387,7 +46388,7 @@ var PollOptionWithLatestVotes = ({
|
|
|
46387
46388
|
// src/components/Poll/PollActions/PollResults/PollResults.tsx
|
|
46388
46389
|
var pollStateSelector10 = (nextValue) => ({
|
|
46389
46390
|
name: nextValue.name,
|
|
46390
|
-
options: nextValue.options,
|
|
46391
|
+
options: [...nextValue.options],
|
|
46391
46392
|
vote_counts_by_option: nextValue.vote_counts_by_option
|
|
46392
46393
|
});
|
|
46393
46394
|
var PollResults = ({
|
|
@@ -53103,7 +53104,7 @@ var useChat = ({
|
|
|
53103
53104
|
};
|
|
53104
53105
|
(0, import_react262.useEffect)(() => {
|
|
53105
53106
|
if (!client) return;
|
|
53106
|
-
const version = "12.15.
|
|
53107
|
+
const version = "12.15.1";
|
|
53107
53108
|
const userAgent = client.getUserAgent();
|
|
53108
53109
|
if (!userAgent.includes("stream-chat-react")) {
|
|
53109
53110
|
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|