stream-chat-react 11.23.4 → 11.23.6
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/{Window-e020d384.js → Window-24fc8157.js} +5427 -7277
- package/dist/browser.full-bundle.js +5434 -7283
- 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/ChannelList/ChannelList.js +1 -1
- package/dist/components/Chat/hooks/useCreateChatClient.d.ts +4 -2
- package/dist/components/Chat/hooks/useCreateChatClient.d.ts.map +1 -1
- package/dist/components/Chat/hooks/useCreateChatClient.js +5 -4
- package/dist/components/Emojis/index.cjs.js +1 -1
- package/dist/components/Message/renderText/renderText.d.ts +1 -1
- package/dist/components/Message/renderText/renderText.d.ts.map +1 -1
- package/dist/components/Message/renderText/renderText.js +3 -1
- package/dist/components/UtilityComponents/ErrorBoundary.d.ts +17 -0
- package/dist/components/UtilityComponents/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/UtilityComponents/ErrorBoundary.js +24 -0
- package/dist/components/UtilityComponents/index.d.ts +2 -0
- package/dist/components/UtilityComponents/index.d.ts.map +1 -0
- package/dist/components/UtilityComponents/index.js +1 -0
- package/dist/index.cjs.js +6 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -131,7 +131,7 @@ var UnMemoizedChannelList = function (props) {
|
|
|
131
131
|
channel: item,
|
|
132
132
|
// forces the update of preview component on channel update
|
|
133
133
|
channelUpdateCount: channelUpdateCount,
|
|
134
|
-
key: item.
|
|
134
|
+
key: item.cid,
|
|
135
135
|
Preview: Preview,
|
|
136
136
|
setActiveChannel: setActiveChannel,
|
|
137
137
|
watchers: watchers,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StreamChat } from 'stream-chat';
|
|
2
|
+
import type { DefaultGenerics, ExtendableGenerics, OwnUserResponse, StreamChatOptions, TokenOrProvider, UserResponse } from 'stream-chat';
|
|
2
3
|
/**
|
|
3
4
|
* React hook to create, connect and return `StreamChat` client.
|
|
4
5
|
*/
|
|
5
|
-
export declare const useCreateChatClient: <SCG extends ExtendableGenerics = DefaultGenerics>({ apiKey, tokenOrProvider, userData, }: {
|
|
6
|
+
export declare const useCreateChatClient: <SCG extends ExtendableGenerics = DefaultGenerics>({ apiKey, options, tokenOrProvider, userData, }: {
|
|
6
7
|
apiKey: string;
|
|
7
8
|
tokenOrProvider: TokenOrProvider;
|
|
8
9
|
userData: OwnUserResponse<SCG> | UserResponse<SCG>;
|
|
10
|
+
options?: StreamChatOptions | undefined;
|
|
9
11
|
}) => StreamChat<SCG> | null;
|
|
10
12
|
//# sourceMappingURL=useCreateChatClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateChatClient.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/hooks/useCreateChatClient.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"useCreateChatClient.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/hooks/useCreateChatClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,YAAY,EACb,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,eAAO,MAAM,mBAAmB;YAMtB,MAAM;qBACG,eAAe;;;4BAiCjC,CAAC"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { StreamChat
|
|
2
|
+
import { StreamChat } from 'stream-chat';
|
|
3
3
|
/**
|
|
4
4
|
* React hook to create, connect and return `StreamChat` client.
|
|
5
5
|
*/
|
|
6
6
|
export var useCreateChatClient = function (_a) {
|
|
7
|
-
var apiKey = _a.apiKey, tokenOrProvider = _a.tokenOrProvider, userData = _a.userData;
|
|
7
|
+
var apiKey = _a.apiKey, options = _a.options, tokenOrProvider = _a.tokenOrProvider, userData = _a.userData;
|
|
8
8
|
var _b = useState(null), chatClient = _b[0], setChatClient = _b[1];
|
|
9
9
|
var _c = useState(userData), cachedUserData = _c[0], setCachedUserData = _c[1];
|
|
10
10
|
if (userData.id !== cachedUserData.id) {
|
|
11
11
|
setCachedUserData(userData);
|
|
12
12
|
}
|
|
13
|
+
var cachedOptions = useState(options)[0];
|
|
13
14
|
useEffect(function () {
|
|
14
|
-
var client = new StreamChat(apiKey);
|
|
15
|
+
var client = new StreamChat(apiKey, undefined, cachedOptions);
|
|
15
16
|
var didUserConnectInterrupt = false;
|
|
16
17
|
var connectionPromise = client.connectUser(cachedUserData, tokenOrProvider).then(function () {
|
|
17
18
|
if (!didUserConnectInterrupt)
|
|
@@ -26,6 +27,6 @@ export var useCreateChatClient = function (_a) {
|
|
|
26
27
|
console.log("Connection for user \"".concat(cachedUserData.id, "\" has been closed"));
|
|
27
28
|
});
|
|
28
29
|
};
|
|
29
|
-
}, [apiKey, cachedUserData, tokenOrProvider]);
|
|
30
|
+
}, [apiKey, cachedUserData, cachedOptions, tokenOrProvider]);
|
|
30
31
|
return chatClient;
|
|
31
32
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Window = require('../../Window-
|
|
5
|
+
var Window = require('../../Window-24fc8157.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var Picker = require('@emoji-mart/react');
|
|
8
8
|
require('dayjs');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { Options } from 'react-markdown';
|
|
3
|
-
import { MentionProps } from './componentRenderers';
|
|
4
3
|
import type { PluggableList } from 'react-markdown/lib/react-markdown';
|
|
5
4
|
import type { UserResponse } from 'stream-chat';
|
|
5
|
+
import { MentionProps } from './componentRenderers';
|
|
6
6
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
7
7
|
export type RenderTextPluginConfigurator = (defaultPlugins: PluggableList) => PluggableList;
|
|
8
8
|
export declare const defaultAllowedTagNames: Array<keyof JSX.IntrinsicElements | 'emoji' | 'mention'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderText.d.ts","sourceRoot":"","sources":["../../../../src/components/Message/renderText/renderText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAsB,EAAE,OAAO,EAAkB,MAAM,gBAAgB,CAAC;AAKxE,OAAO,
|
|
1
|
+
{"version":3,"file":"renderText.d.ts","sourceRoot":"","sources":["../../../../src/components/Message/renderText/renderText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAsB,EAAE,OAAO,EAAkB,MAAM,gBAAgB,CAAC;AAKxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAA0B,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAM5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,MAAM,4BAA4B,GAAG,CAAC,cAAc,EAAE,aAAa,KAAK,aAAa,CAAC;AAE5F,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,iBAAiB,GAAG,OAAO,GAAG,SAAS,CAkB3F,CAAC;AAsBF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,yBAAyB,CAI1E,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAC3B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IAEF,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,iBAAiB,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;IAC3F,uBAAuB,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC7C,OAAO,CAAC;QACN,KAAK,EAAE,aAAa,CAAC;QACrB,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC;KAC1D,CAAC,CAAC;IACL,gBAAgB,CAAC,EAAE,4BAA4B,CAAC;IAChD,gBAAgB,CAAC,EAAE,4BAA4B,CAAC;CACjD,CAAC;AAEF,eAAO,MAAM,UAAU,4FAGd,MAAM,uJAOV,iBAAiB,6BA0FrB,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { Anchor, Emoji, Mention } from './componentRenderers';
|
|
|
8
8
|
import { detectHttp, escapeRegExp, matchMarkdownLinks, messageCodeBlocks } from './regex';
|
|
9
9
|
import { emojiMarkdownPlugin, mentionsMarkdownPlugin } from './rehypePlugins';
|
|
10
10
|
import { htmlToTextPlugin, keepLineBreaksPlugin } from './remarkPlugins';
|
|
11
|
+
import { ErrorBoundary } from '../../UtilityComponents';
|
|
11
12
|
export var defaultAllowedTagNames = [
|
|
12
13
|
'html',
|
|
13
14
|
'text',
|
|
@@ -109,5 +110,6 @@ export var renderText = function (text, mentionedUsers, _a) {
|
|
|
109
110
|
if (mentionedUsers === null || mentionedUsers === void 0 ? void 0 : mentionedUsers.length) {
|
|
110
111
|
rehypePlugins.push(mentionsMarkdownPlugin(mentionedUsers));
|
|
111
112
|
}
|
|
112
|
-
return (React.createElement(
|
|
113
|
+
return (React.createElement(ErrorBoundary, { fallback: React.createElement(React.Fragment, null, text) },
|
|
114
|
+
React.createElement(ReactMarkdown, { allowedElements: allowedTagNames, components: __assign(__assign({}, markDownRenderers), customMarkDownRenderers), rehypePlugins: getRehypePlugins(rehypePlugins), remarkPlugins: getRemarkPlugins(remarkPlugins), skipHtml: true, transformLinkUri: urlTransform, unwrapDisallowed: true }, newText)));
|
|
113
115
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import type { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
+
type ErrorBoundaryProps = PropsWithChildren<{
|
|
4
|
+
fallback?: ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
}> {
|
|
9
|
+
constructor(props: ErrorBoundaryProps);
|
|
10
|
+
static getDerivedStateFromError(): {
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
};
|
|
13
|
+
componentDidCatch(error: unknown, information: unknown): void;
|
|
14
|
+
render(): ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=ErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/UtilityComponents/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,KAAK,kBAAkB,GAAG,iBAAiB,CAAC;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAEtE,qBAAa,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;gBACzE,KAAK,EAAE,kBAAkB;IAKrC,MAAM,CAAC,wBAAwB;;;IAI/B,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO;IAItD,MAAM;CAOP"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
var ErrorBoundary = /** @class */ (function (_super) {
|
|
4
|
+
__extends(ErrorBoundary, _super);
|
|
5
|
+
function ErrorBoundary(props) {
|
|
6
|
+
var _this = _super.call(this, props) || this;
|
|
7
|
+
_this.state = { hasError: false };
|
|
8
|
+
return _this;
|
|
9
|
+
}
|
|
10
|
+
ErrorBoundary.getDerivedStateFromError = function () {
|
|
11
|
+
return { hasError: true };
|
|
12
|
+
};
|
|
13
|
+
ErrorBoundary.prototype.componentDidCatch = function (error, information) {
|
|
14
|
+
console.error(error, information);
|
|
15
|
+
};
|
|
16
|
+
ErrorBoundary.prototype.render = function () {
|
|
17
|
+
if (this.state.hasError) {
|
|
18
|
+
return this.props.fallback;
|
|
19
|
+
}
|
|
20
|
+
return this.props.children;
|
|
21
|
+
};
|
|
22
|
+
return ErrorBoundary;
|
|
23
|
+
}(Component));
|
|
24
|
+
export { ErrorBoundary };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/UtilityComponents/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorBoundary';
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Window = require('./Window-
|
|
5
|
+
var Window = require('./Window-24fc8157.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var streamChat = require('stream-chat');
|
|
8
8
|
var throttle = require('lodash.throttle');
|
|
@@ -1362,7 +1362,7 @@ function VirtualizedMessageList(props) {
|
|
|
1362
1362
|
return (React__default["default"].createElement(VirtualizedMessageListWithContext, Window.__assign({ channel: channel, channelUnreadUiState: channelUnreadUiState, hasMore: !!hasMore, hasMoreNewer: !!hasMoreNewer, highlightedMessageId: highlightedMessageId, jumpToLatestMessage: jumpToLatestMessage, loadingMore: !!loadingMore, loadingMoreNewer: !!loadingMoreNewer, loadMore: loadMore, loadMoreNewer: loadMoreNewer, messages: messages, notifications: notifications, read: read, suppressAutoscroll: suppressAutoscroll }, props)));
|
|
1363
1363
|
}
|
|
1364
1364
|
|
|
1365
|
-
var version = '11.23.
|
|
1365
|
+
var version = '11.23.6';
|
|
1366
1366
|
|
|
1367
1367
|
var useChat = function (_a) {
|
|
1368
1368
|
var _b, _c;
|
|
@@ -1585,14 +1585,15 @@ var Chat = function (props) {
|
|
|
1585
1585
|
* React hook to create, connect and return `StreamChat` client.
|
|
1586
1586
|
*/
|
|
1587
1587
|
var useCreateChatClient = function (_a) {
|
|
1588
|
-
var apiKey = _a.apiKey, tokenOrProvider = _a.tokenOrProvider, userData = _a.userData;
|
|
1588
|
+
var apiKey = _a.apiKey, options = _a.options, tokenOrProvider = _a.tokenOrProvider, userData = _a.userData;
|
|
1589
1589
|
var _b = React.useState(null), chatClient = _b[0], setChatClient = _b[1];
|
|
1590
1590
|
var _c = React.useState(userData), cachedUserData = _c[0], setCachedUserData = _c[1];
|
|
1591
1591
|
if (userData.id !== cachedUserData.id) {
|
|
1592
1592
|
setCachedUserData(userData);
|
|
1593
1593
|
}
|
|
1594
|
+
var cachedOptions = React.useState(options)[0];
|
|
1594
1595
|
React.useEffect(function () {
|
|
1595
|
-
var client = new streamChat.StreamChat(apiKey);
|
|
1596
|
+
var client = new streamChat.StreamChat(apiKey, undefined, cachedOptions);
|
|
1596
1597
|
var didUserConnectInterrupt = false;
|
|
1597
1598
|
var connectionPromise = client.connectUser(cachedUserData, tokenOrProvider).then(function () {
|
|
1598
1599
|
if (!didUserConnectInterrupt)
|
|
@@ -1607,7 +1608,7 @@ var useCreateChatClient = function (_a) {
|
|
|
1607
1608
|
console.log("Connection for user \"".concat(cachedUserData.id, "\" has been closed"));
|
|
1608
1609
|
});
|
|
1609
1610
|
};
|
|
1610
|
-
}, [apiKey, cachedUserData, tokenOrProvider]);
|
|
1611
|
+
}, [apiKey, cachedUserData, cachedOptions, tokenOrProvider]);
|
|
1611
1612
|
return chatClient;
|
|
1612
1613
|
};
|
|
1613
1614
|
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "11.23.
|
|
1
|
+
export declare const version = "11.23.6";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '11.23.
|
|
1
|
+
export var version = '11.23.6';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react",
|
|
3
|
-
"version": "11.23.
|
|
3
|
+
"version": "11.23.6",
|
|
4
4
|
"description": "React components to create chat conversations or livestream style chat",
|
|
5
5
|
"author": "GetStream",
|
|
6
6
|
"homepage": "https://getstream.io/chat/",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"react-popper": "^2.3.0",
|
|
89
89
|
"react-textarea-autosize": "^8.3.0",
|
|
90
90
|
"react-virtuoso": "^2.16.5",
|
|
91
|
-
"remark-gfm": "^
|
|
91
|
+
"remark-gfm": "^3.0.1",
|
|
92
92
|
"textarea-caret": "^3.1.0",
|
|
93
93
|
"tslib": "^2.6.2",
|
|
94
94
|
"unist-builder": "^3.0.0",
|