stream-chat-react 9.2.0 → 9.4.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/browser.full-bundle.js +1180 -2912
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +4 -4
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Channel/channelState.d.ts.map +1 -1
- package/dist/components/Channel/channelState.js +2 -2
- package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts +12 -1
- package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts.map +1 -1
- package/dist/components/Message/MessageStatus.d.ts +2 -0
- package/dist/components/Message/MessageStatus.d.ts.map +1 -1
- package/dist/components/Message/MessageStatus.js +4 -4
- package/dist/components/Message/utils.d.ts +10 -1
- package/dist/components/Message/utils.d.ts.map +1 -1
- package/dist/components/Message/utils.js +13 -4
- package/dist/components/MessageInput/hooks/useSubmitHandler.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useSubmitHandler.js +1 -1
- package/dist/index.cjs.js +751 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/stories/message-status-readby-tooltip.stories.d.ts +4 -0
- package/dist/stories/message-status-readby-tooltip.stories.d.ts.map +1 -0
- package/dist/stories/message-status-readby-tooltip.stories.js +58 -0
- package/dist/stories/navigate-long-message-lists.stories.d.ts.map +1 -1
- package/dist/stories/navigate-long-message-lists.stories.js +22 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +17 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-status-readby-tooltip.stories.d.ts","sourceRoot":"","sources":["../../src/stories/message-status-readby-tooltip.stories.tsx"],"names":[],"mappings":"AACA,OAAO,+CAA+C,CAAC;AA4CvD,eAAO,MAAM,KAAK,mBAUjB,CAAC;AAEF,eAAO,MAAM,KAAK,mBAUjB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
13
|
+
import '@stream-io/stream-chat-css/dist/css/index.css';
|
|
14
|
+
import React, { useCallback } from 'react';
|
|
15
|
+
import { Channel, ChannelHeader, ChannelList, MessageList, MessageStatus, Thread, Window, } from '../index';
|
|
16
|
+
import { ConnectedUser } from './utils';
|
|
17
|
+
var channelId = import.meta.env.E2E_ADD_MESSAGE_CHANNEL;
|
|
18
|
+
if (!channelId || typeof channelId !== 'string') {
|
|
19
|
+
throw new Error('expected ADD_MESSAGE_CHANNEL');
|
|
20
|
+
}
|
|
21
|
+
var CustomMessageStatus = function (props) {
|
|
22
|
+
var allCapsUserName = useCallback(function (user) { return (user.name || user.id).toUpperCase(); }, []);
|
|
23
|
+
return React.createElement(MessageStatus, __assign({}, props, { tooltipUserNameMapper: allCapsUserName }));
|
|
24
|
+
};
|
|
25
|
+
// Sort in reverse order to avoid auto-selecting unread channel
|
|
26
|
+
var sort = { last_updated: 1 };
|
|
27
|
+
var WrappedConnectedUser = function (_a) {
|
|
28
|
+
var token = _a.token, userId = _a.userId;
|
|
29
|
+
return (React.createElement(ConnectedUser, { token: token, userId: userId },
|
|
30
|
+
React.createElement(ChannelList, { filters: { id: { $eq: 'add-message' }, members: { $in: [userId] } }, sort: sort }),
|
|
31
|
+
React.createElement(Channel, { MessageStatus: CustomMessageStatus },
|
|
32
|
+
React.createElement(Window, null,
|
|
33
|
+
React.createElement(ChannelHeader, null),
|
|
34
|
+
React.createElement(MessageList, null)),
|
|
35
|
+
React.createElement(Thread, null))));
|
|
36
|
+
};
|
|
37
|
+
export var User1 = function () {
|
|
38
|
+
var userId = import.meta.env.E2E_TEST_USER_1;
|
|
39
|
+
var token = import.meta.env.E2E_TEST_USER_1_TOKEN;
|
|
40
|
+
if (!userId || typeof userId !== 'string') {
|
|
41
|
+
throw new Error('expected TEST_USER_1');
|
|
42
|
+
}
|
|
43
|
+
if (!token || typeof token !== 'string') {
|
|
44
|
+
throw new Error('expected TEST_USER_1_TOKEN');
|
|
45
|
+
}
|
|
46
|
+
return React.createElement(WrappedConnectedUser, { token: token, userId: userId });
|
|
47
|
+
};
|
|
48
|
+
export var User2 = function () {
|
|
49
|
+
var userId = import.meta.env.E2E_TEST_USER_2;
|
|
50
|
+
var token = import.meta.env.E2E_TEST_USER_2_TOKEN;
|
|
51
|
+
if (!userId || typeof userId !== 'string') {
|
|
52
|
+
throw new Error('expected TEST_USER_2');
|
|
53
|
+
}
|
|
54
|
+
if (!token || typeof token !== 'string') {
|
|
55
|
+
throw new Error('expected TEST_USER_2_TOKEN');
|
|
56
|
+
}
|
|
57
|
+
return React.createElement(WrappedConnectedUser, { token: token, userId: userId });
|
|
58
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigate-long-message-lists.stories.d.ts","sourceRoot":"","sources":["../../src/stories/navigate-long-message-lists.stories.tsx"],"names":[],"mappings":"AACA,OAAO,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"navigate-long-message-lists.stories.d.ts","sourceRoot":"","sources":["../../src/stories/navigate-long-message-lists.stories.tsx"],"names":[],"mappings":"AACA,OAAO,+CAA+C,CAAC;AA2LvD,eAAO,MAAM,KAAK,mBAQjB,CAAC;AAEF,eAAO,MAAM,KAAK,mBAQjB,CAAC"}
|
|
@@ -60,7 +60,7 @@ if (!channelId || typeof channelId !== 'string') {
|
|
|
60
60
|
}
|
|
61
61
|
var OtherUserControlButtons = function () {
|
|
62
62
|
var client = useChatContext().client;
|
|
63
|
-
var _a = useChannelStateContext(), channel = _a.channel, threadMessages = _a.threadMessages;
|
|
63
|
+
var _a = useChannelStateContext(), channel = _a.channel, messages = _a.messages, threadMessages = _a.threadMessages;
|
|
64
64
|
var lastMessage = channel.state.messages.slice(-1)[0];
|
|
65
65
|
return (React.createElement(React.Fragment, null,
|
|
66
66
|
React.createElement("button", { "data-testid": 'receive-reply', onClick: function () {
|
|
@@ -83,7 +83,27 @@ var OtherUserControlButtons = function () {
|
|
|
83
83
|
case 2: return [2 /*return*/];
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
}); } }, "Delete other user's last reply")
|
|
86
|
+
}); } }, "Delete other user's last reply"),
|
|
87
|
+
React.createElement("button", { "data-testid": 'add-other-user-message', onClick: function () {
|
|
88
|
+
return channel.sendMessage({
|
|
89
|
+
text: "Other user's message",
|
|
90
|
+
});
|
|
91
|
+
} }, "Receive a message"),
|
|
92
|
+
React.createElement("button", { "data-testid": 'delete-other-last-message', onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
+
var lastMessage;
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (_a.label) {
|
|
96
|
+
case 0:
|
|
97
|
+
lastMessage = messages === null || messages === void 0 ? void 0 : messages.slice(-1)[0];
|
|
98
|
+
if (!lastMessage) return [3 /*break*/, 2];
|
|
99
|
+
return [4 /*yield*/, client.deleteMessage(lastMessage.id, true)];
|
|
100
|
+
case 1:
|
|
101
|
+
_a.sent();
|
|
102
|
+
_a.label = 2;
|
|
103
|
+
case 2: return [2 /*return*/];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}); } }, "Delete other user's last message")));
|
|
87
107
|
};
|
|
88
108
|
// Sort in reverse order to avoid auto-selecting unread channel
|
|
89
109
|
var sort = { last_updated: 1 };
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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M,WAgClD,CAAC"}
|
package/dist/utils.js
CHANGED
|
@@ -13,8 +13,7 @@ import React from 'react';
|
|
|
13
13
|
import emojiRegex from 'emoji-regex';
|
|
14
14
|
import * as linkify from 'linkifyjs';
|
|
15
15
|
import { nanoid } from 'nanoid';
|
|
16
|
-
|
|
17
|
-
import findAndReplace from 'mdast-util-find-and-replace';
|
|
16
|
+
import { findAndReplace } from 'mdast-util-find-and-replace';
|
|
18
17
|
import RootReactMarkdown from 'react-markdown';
|
|
19
18
|
import ReactMarkdown from 'react-markdown/with-html';
|
|
20
19
|
import uniqBy from 'lodash.uniqby';
|
|
@@ -156,6 +155,22 @@ export var renderText = function (text, mentioned_users, options) {
|
|
|
156
155
|
if (noParsingNeeded.length > 0 || linkIsInBlock)
|
|
157
156
|
return;
|
|
158
157
|
try {
|
|
158
|
+
// special case for mentions:
|
|
159
|
+
// it could happen that a user's name matches with an e-mail format pattern.
|
|
160
|
+
// in that case, we check whether the found e-mail is actually a mention
|
|
161
|
+
// by naively checking for an existence of @ sign in front of it.
|
|
162
|
+
if (type === 'email' && mentioned_users) {
|
|
163
|
+
var emailMatchesWithName = mentioned_users.some(function (u) { return u.name === value; });
|
|
164
|
+
if (emailMatchesWithName) {
|
|
165
|
+
newText = newText.replace(new RegExp(escapeRegExp(value), 'g'), function (match, position) {
|
|
166
|
+
var isMention = newText.charAt(position - 1) === '@';
|
|
167
|
+
// in case of mention, we leave the match in its original form,
|
|
168
|
+
// and we let `mentionsMarkdownPlugin` to do its job
|
|
169
|
+
return isMention ? match : "[" + match + "](" + encodeDecode(href) + ")";
|
|
170
|
+
});
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
159
174
|
var displayLink = type === 'email' ? value : formatUrlForDisplay(href);
|
|
160
175
|
newText = newText.replace(new RegExp(escapeRegExp(value), 'g'), "[" + displayLink + "](" + encodeDecode(href) + ")");
|
|
161
176
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "9.
|
|
1
|
+
export declare const version = "9.4.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '9.
|
|
1
|
+
export var version = '9.4.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.1",
|
|
4
4
|
"description": "React components to create chat conversations or livestream style chat",
|
|
5
5
|
"author": "GetStream",
|
|
6
6
|
"homepage": "https://getstream.io/chat/",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"lodash.isequal": "^4.5.0",
|
|
42
42
|
"lodash.throttle": "^4.1.1",
|
|
43
43
|
"lodash.uniqby": "^4.7.0",
|
|
44
|
-
"mdast-util-find-and-replace": "
|
|
44
|
+
"mdast-util-find-and-replace": "^2.2.1",
|
|
45
45
|
"nanoid": "^3.3.4",
|
|
46
46
|
"pretty-bytes": "^5.4.1",
|
|
47
47
|
"prop-types": "^15.7.2",
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"@types/lodash.isequal": "^4.5.5",
|
|
104
104
|
"@types/lodash.throttle": "^4.1.6",
|
|
105
105
|
"@types/lodash.uniqby": "^4.7.6",
|
|
106
|
+
"@types/mdast": "^3.0.10",
|
|
106
107
|
"@types/moment": "^2.13.0",
|
|
107
108
|
"@types/react": "^18.0.8",
|
|
108
109
|
"@types/react-dom": "^18.0.3",
|
|
@@ -201,6 +202,7 @@
|
|
|
201
202
|
"test": "jest",
|
|
202
203
|
"types": "tsc --strict",
|
|
203
204
|
"validate-translations": "node scripts/validate-translations.js",
|
|
205
|
+
"validate-cjs": "node scripts/validate-cjs-bundle.cjs",
|
|
204
206
|
"semantic-release": "semantic-release",
|
|
205
207
|
"browse-examples": "ladle serve",
|
|
206
208
|
"e2e": "playwright test",
|
|
@@ -208,7 +210,8 @@
|
|
|
208
210
|
"e2e-container": "./e2e/scripts/run_in_container.sh"
|
|
209
211
|
},
|
|
210
212
|
"resolutions": {
|
|
211
|
-
"ast-types": "^0.14.0"
|
|
213
|
+
"ast-types": "^0.14.0",
|
|
214
|
+
"@types/unist": "^2.0.6"
|
|
212
215
|
},
|
|
213
216
|
"browserslist": [
|
|
214
217
|
">0.2%",
|