stream-chat-react 10.1.2 → 10.2.0
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 +166 -44
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +5 -5
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Attachment/AttachmentContainer.d.ts.map +1 -1
- package/dist/components/Attachment/AttachmentContainer.js +67 -15
- package/dist/components/Attachment/attachment-sizing.d.ts +9 -0
- package/dist/components/Attachment/attachment-sizing.d.ts.map +1 -0
- package/dist/components/Attachment/attachment-sizing.js +72 -0
- package/dist/components/Channel/Channel.d.ts +7 -1
- package/dist/components/Channel/Channel.d.ts.map +1 -1
- package/dist/components/Channel/Channel.js +2 -1
- package/dist/components/Channel/hooks/useCreateChannelStateContext.d.ts.map +1 -1
- package/dist/components/Channel/hooks/useCreateChannelStateContext.js +5 -1
- package/dist/components/Gallery/Gallery.d.ts +7 -2
- package/dist/components/Gallery/Gallery.d.ts.map +1 -1
- package/dist/components/Gallery/Gallery.js +16 -5
- package/dist/components/Gallery/Image.d.ts +4 -0
- package/dist/components/Gallery/Image.d.ts.map +1 -1
- package/dist/components/Gallery/Image.js +3 -3
- package/dist/components/MessageInput/hooks/useFileUploads.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useFileUploads.js +1 -0
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts +2 -0
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useMessageInputState.js +2 -1
- package/dist/components/MessageInput/hooks/useSubmitHandler.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useSubmitHandler.js +1 -0
- package/dist/components/MessageList/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList/MessageList.js +1 -2
- package/dist/components/MessageList/VirtualizedMessageList.d.ts.map +1 -1
- package/dist/components/MessageList/VirtualizedMessageList.js +0 -1
- package/dist/components/MessageList/hooks/useMessageListElements.d.ts +0 -1
- package/dist/components/MessageList/hooks/useMessageListElements.d.ts.map +1 -1
- package/dist/components/MessageList/hooks/useMessageListElements.js +2 -3
- package/dist/components/MessageList/hooks/useScrollLocationLogic.d.ts +0 -1
- package/dist/components/MessageList/hooks/useScrollLocationLogic.d.ts.map +1 -1
- package/dist/components/MessageList/hooks/useScrollLocationLogic.js +0 -10
- package/dist/components/Thread/Thread.d.ts.map +1 -1
- package/dist/components/Thread/Thread.js +7 -2
- package/dist/context/ChannelStateContext.d.ts +5 -2
- package/dist/context/ChannelStateContext.d.ts.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.css.map +1 -1
- package/dist/css/v2/index.css +1 -1
- package/dist/css/v2/index.css.map +1 -1
- package/dist/css/v2/index.layout.css +1 -1
- package/dist/css/v2/index.layout.css.map +1 -1
- package/dist/index.cjs.js +166 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/scss/Attachment.scss +44 -17
- package/dist/scss/Audio.scss +1 -0
- package/dist/scss/Message.scss +28 -11
- package/dist/scss/v2/AttachmentList/AttachmentList-layout.scss +33 -19
- package/dist/scss/v2/Message/Message-layout.scss +12 -0
- package/dist/scss/v2/Message/Message-theme.scss +20 -0
- package/dist/scss/v2/MessageList/MessageList-layout.scss +1 -4
- package/dist/scss/v2/MessageList/VirtualizedMessageList-layout.scss +21 -0
- package/dist/scss/v2/MessageList/VirtualizedMessageList-theme.scss +9 -0
- package/dist/scss/v2/Notification/NotificationList-theme.scss +2 -2
- package/dist/scss/v2/_utils.scss +8 -0
- package/dist/stories/attachment-sizing.stories.d.ts +2 -0
- package/dist/stories/attachment-sizing.stories.d.ts.map +1 -0
- package/dist/stories/attachment-sizing.stories.js +179 -0
- package/dist/types/types.d.ts +9 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -10643,7 +10643,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
10643
10643
|
};
|
|
10644
10644
|
|
|
10645
10645
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var UnMemoizedGallery = function (props) {
|
|
10646
|
-
var images = props.images;
|
|
10646
|
+
var images = props.images, innerRefs = props.innerRefs;
|
|
10647
10647
|
var _a = React.useState(0), index = _a[0], setIndex = _a[1];
|
|
10648
10648
|
var _b = React.useState(false), modalOpen = _b[0], setModalOpen = _b[1];
|
|
10649
10649
|
var _c = useComponentContext('Gallery').ModalGallery, ModalGallery$1 = _c === void 0 ? ModalGallery : _c;
|
|
@@ -10660,13 +10660,13 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
10660
10660
|
}
|
|
10661
10661
|
};
|
|
10662
10662
|
var renderImages = images.slice(0, countImagesDisplayedInPreview).map(function (image, i) {
|
|
10663
|
-
return i === lastImageIndexInPreview && images.length > countImagesDisplayedInPreview ? (React__default["default"].createElement("button", { className: 'str-chat__gallery-placeholder', key: "gallery-image-".concat(i), onClick: function () { return toggleModal(i); }, style: {
|
|
10664
|
-
|
|
10665
|
-
|
|
10663
|
+
return i === lastImageIndexInPreview && images.length > countImagesDisplayedInPreview ? (React__default["default"].createElement("button", __assign$8({ className: 'str-chat__gallery-placeholder', "data-testid": 'gallery-image-last', key: "gallery-image-".concat(i), onClick: function () { return toggleModal(i); }, style: __assign$8({ backgroundImage: "url(".concat(images[lastImageIndexInPreview].previewUrl ||
|
|
10664
|
+
images[lastImageIndexInPreview].image_url ||
|
|
10665
|
+
images[lastImageIndexInPreview].thumb_url, ")") }, image.style) }, ((innerRefs === null || innerRefs === void 0 ? void 0 : innerRefs.current) && { ref: function (r) { return (innerRefs.current[i] = r); } })),
|
|
10666
10666
|
React__default["default"].createElement("p", null, t('{{ imageCount }} more', {
|
|
10667
10667
|
imageCount: images.length - countImagesDisplayedInPreview,
|
|
10668
10668
|
})))) : (React__default["default"].createElement("button", { className: 'str-chat__gallery-image', "data-testid": 'gallery-image', key: "gallery-image-".concat(i), onClick: function () { return toggleModal(i); } },
|
|
10669
|
-
React__default["default"].createElement("img", { alt: 'User uploaded content', src: image.image_url || image.thumb_url })));
|
|
10669
|
+
React__default["default"].createElement("img", __assign$8({ alt: 'User uploaded content', src: image.previewUrl || image.image_url || image.thumb_url, style: image.style }, ((innerRefs === null || innerRefs === void 0 ? void 0 : innerRefs.current) && { ref: function (r) { return (innerRefs.current[i] = r); } })))));
|
|
10670
10670
|
});
|
|
10671
10671
|
var className = clsx('str-chat__gallery', {
|
|
10672
10672
|
'str-chat__gallery--square': images.length > lastImageIndexInPreview,
|
|
@@ -10686,13 +10686,13 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
10686
10686
|
* A simple component that displays an image.
|
|
10687
10687
|
*/
|
|
10688
10688
|
var ImageComponent = function (props) {
|
|
10689
|
-
var _a = props.dimensions, dimensions = _a === void 0 ? {} : _a, fallback = props.fallback, image_url = props.image_url, thumb_url = props.thumb_url;
|
|
10689
|
+
var _a = props.dimensions, dimensions = _a === void 0 ? {} : _a, fallback = props.fallback, image_url = props.image_url, thumb_url = props.thumb_url, innerRef = props.innerRef, previewUrl = props.previewUrl, style = props.style;
|
|
10690
10690
|
var _b = React.useState(false), modalIsOpen = _b[0], setModalIsOpen = _b[1];
|
|
10691
10691
|
var _c = useComponentContext('ImageComponent').ModalGallery, ModalGallery$1 = _c === void 0 ? ModalGallery : _c;
|
|
10692
|
-
var imageSrc = dist_1(image_url || thumb_url);
|
|
10692
|
+
var imageSrc = dist_1(previewUrl || image_url || thumb_url);
|
|
10693
10693
|
var toggleModal = function () { return setModalIsOpen(function (modalIsOpen) { return !modalIsOpen; }); };
|
|
10694
10694
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
10695
|
-
React__default["default"].createElement("img", __assign$8({ alt: fallback, className: 'str-chat__message-attachment--img', "data-testid": 'image-test', onClick: toggleModal, src: imageSrc, tabIndex: 0 }, dimensions)),
|
|
10695
|
+
React__default["default"].createElement("img", __assign$8({ alt: fallback, className: 'str-chat__message-attachment--img', "data-testid": 'image-test', onClick: toggleModal, src: imageSrc, style: style, tabIndex: 0 }, dimensions, (innerRef && { ref: innerRef }))),
|
|
10696
10696
|
React__default["default"].createElement(Modal, { onClose: toggleModal, open: modalIsOpen },
|
|
10697
10697
|
React__default["default"].createElement(ModalGallery$1, { images: [props], index: 0 }))));
|
|
10698
10698
|
};
|
|
@@ -13516,7 +13516,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
13516
13516
|
? 'actions'
|
|
13517
13517
|
: '';
|
|
13518
13518
|
}
|
|
13519
|
-
var classNames = clsx('str-chat__message-attachment', (_b = {},
|
|
13519
|
+
var classNames = clsx('str-chat__message-attachment str-chat__message-attachment-dynamic-size', (_b = {},
|
|
13520
13520
|
_b["str-chat__message-attachment--".concat(componentType)] = componentType,
|
|
13521
13521
|
_b["str-chat__message-attachment--".concat(attachment === null || attachment === void 0 ? void 0 : attachment.type)] = attachment === null || attachment === void 0 ? void 0 : attachment.type,
|
|
13522
13522
|
_b["str-chat__message-attachment--".concat(componentType, "--").concat(extra)] = componentType && extra,
|
|
@@ -13532,22 +13532,68 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
13532
13532
|
return null;
|
|
13533
13533
|
return (React__default["default"].createElement(AttachmentActions$1, __assign$8({}, attachment, { actionHandler: actionHandler, actions: attachment.actions, id: attachment.id || '', text: attachment.text || '' })));
|
|
13534
13534
|
};
|
|
13535
|
+
function getCssDimensionsVariables(url) {
|
|
13536
|
+
var _a;
|
|
13537
|
+
var cssVars = (_a = {},
|
|
13538
|
+
_a['--original-height'] = 1000000,
|
|
13539
|
+
_a['--original-width'] = 1000000,
|
|
13540
|
+
_a);
|
|
13541
|
+
if (url) {
|
|
13542
|
+
var urlParams = new URL(url).searchParams;
|
|
13543
|
+
var oh = Number(urlParams.get('oh'));
|
|
13544
|
+
var ow = Number(urlParams.get('ow'));
|
|
13545
|
+
var originalHeight = oh > 1 ? oh : 1000000;
|
|
13546
|
+
var originalWidth = ow > 1 ? ow : 1000000;
|
|
13547
|
+
cssVars['--original-width'] = originalWidth;
|
|
13548
|
+
cssVars['--original-height'] = originalHeight;
|
|
13549
|
+
}
|
|
13550
|
+
return cssVars;
|
|
13551
|
+
}
|
|
13535
13552
|
var GalleryContainer = function (_a) {
|
|
13536
13553
|
var attachment = _a.attachment, _b = _a.Gallery, Gallery$1 = _b === void 0 ? Gallery : _b;
|
|
13554
|
+
var imageElements = React.useRef([]);
|
|
13555
|
+
var imageAttachmentSizeHandler = useChannelStateContext().imageAttachmentSizeHandler;
|
|
13556
|
+
var _c = React.useState([]), attachmentConfigurations = _c[0], setAttachmentConfigurations = _c[1];
|
|
13557
|
+
React.useLayoutEffect(function () {
|
|
13558
|
+
if (imageElements.current &&
|
|
13559
|
+
imageElements.current.every(function (element) { return !!element; }) &&
|
|
13560
|
+
imageAttachmentSizeHandler) {
|
|
13561
|
+
var newConfigurations_1 = [];
|
|
13562
|
+
imageElements.current.forEach(function (element, i) {
|
|
13563
|
+
var config = imageAttachmentSizeHandler(attachment.images[i], element);
|
|
13564
|
+
newConfigurations_1.push(config);
|
|
13565
|
+
});
|
|
13566
|
+
setAttachmentConfigurations(newConfigurations_1);
|
|
13567
|
+
}
|
|
13568
|
+
}, [imageElements, imageAttachmentSizeHandler, attachment]);
|
|
13569
|
+
var images = attachment.images.map(function (image, i) {
|
|
13570
|
+
var _a, _b, _c;
|
|
13571
|
+
return (__assign$8(__assign$8({}, image), { previewUrl: ((_a = attachmentConfigurations[i]) === null || _a === void 0 ? void 0 : _a.url) || 'about:blank', style: getCssDimensionsVariables(((_b = attachment.images[i]) === null || _b === void 0 ? void 0 : _b.image_url) || ((_c = attachment.images[i]) === null || _c === void 0 ? void 0 : _c.thumb_url) || '') }));
|
|
13572
|
+
});
|
|
13537
13573
|
return (React__default["default"].createElement(AttachmentWithinContainer, { attachment: attachment, componentType: 'gallery' },
|
|
13538
|
-
React__default["default"].createElement(Gallery$1, { images:
|
|
13574
|
+
React__default["default"].createElement(Gallery$1, { images: images || [], innerRefs: imageElements, key: 'gallery' })));
|
|
13539
13575
|
};
|
|
13540
13576
|
var ImageContainer = function (props) {
|
|
13541
13577
|
var attachment = props.attachment, _a = props.Image, Image = _a === void 0 ? ImageComponent : _a;
|
|
13542
13578
|
var componentType = 'image';
|
|
13579
|
+
var imageElement = React.useRef(null);
|
|
13580
|
+
var imageAttachmentSizeHandler = useChannelStateContext().imageAttachmentSizeHandler;
|
|
13581
|
+
var _b = React.useState(undefined), attachmentConfiguration = _b[0], setAttachmentConfiguration = _b[1];
|
|
13582
|
+
React.useLayoutEffect(function () {
|
|
13583
|
+
if (imageElement.current && imageAttachmentSizeHandler) {
|
|
13584
|
+
var config = imageAttachmentSizeHandler(attachment, imageElement.current);
|
|
13585
|
+
setAttachmentConfiguration(config);
|
|
13586
|
+
}
|
|
13587
|
+
}, [imageElement, imageAttachmentSizeHandler, attachment]);
|
|
13588
|
+
var imageConfig = __assign$8(__assign$8({}, attachment), { previewUrl: (attachmentConfiguration === null || attachmentConfiguration === void 0 ? void 0 : attachmentConfiguration.url) || 'about:blank', style: getCssDimensionsVariables(attachment.image_url || attachment.thumb_url || '') });
|
|
13543
13589
|
if (attachment.actions && attachment.actions.length) {
|
|
13544
13590
|
return (React__default["default"].createElement(AttachmentWithinContainer, { attachment: attachment, componentType: componentType },
|
|
13545
13591
|
React__default["default"].createElement("div", { className: 'str-chat__attachment' },
|
|
13546
|
-
React__default["default"].createElement(Image, __assign$8({},
|
|
13592
|
+
React__default["default"].createElement(Image, __assign$8({}, imageConfig, { innerRef: imageElement })),
|
|
13547
13593
|
React__default["default"].createElement(AttachmentActionsContainer, __assign$8({}, props)))));
|
|
13548
13594
|
}
|
|
13549
13595
|
return (React__default["default"].createElement(AttachmentWithinContainer, { attachment: attachment, componentType: componentType },
|
|
13550
|
-
React__default["default"].createElement(Image, __assign$8({},
|
|
13596
|
+
React__default["default"].createElement(Image, __assign$8({}, imageConfig, { innerRef: imageElement }))));
|
|
13551
13597
|
};
|
|
13552
13598
|
var CardContainer = function (props) {
|
|
13553
13599
|
var attachment = props.attachment, _a = props.Card, Card = _a === void 0 ? Card$1 : _a;
|
|
@@ -13578,16 +13624,21 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
13578
13624
|
var _a;
|
|
13579
13625
|
var attachment = props.attachment, _b = props.Media, Media = _b === void 0 ? ReactPlayer : _b;
|
|
13580
13626
|
var componentType = 'media';
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13627
|
+
var _c = useChannelStateContext(), shouldGenerateVideoThumbnail = _c.shouldGenerateVideoThumbnail, videoAttachmentSizeHandler = _c.videoAttachmentSizeHandler;
|
|
13628
|
+
var videoElement = React.useRef(null);
|
|
13629
|
+
var _d = React.useState(), attachmentConfiguration = _d[0], setAttachmentConfiguration = _d[1];
|
|
13630
|
+
React.useLayoutEffect(function () {
|
|
13631
|
+
if (videoElement.current && videoAttachmentSizeHandler) {
|
|
13632
|
+
var config = videoAttachmentSizeHandler(attachment, videoElement.current, shouldGenerateVideoThumbnail);
|
|
13633
|
+
setAttachmentConfiguration(config);
|
|
13634
|
+
}
|
|
13635
|
+
}, [videoElement, videoAttachmentSizeHandler, attachment]);
|
|
13636
|
+
var content = (React__default["default"].createElement("div", { className: 'str-chat__player-wrapper', "data-testid": 'video-wrapper', ref: videoElement, style: getCssDimensionsVariables(attachment.thumb_url || '') },
|
|
13637
|
+
React__default["default"].createElement(Media, { className: 'react-player', config: { file: { attributes: { poster: attachmentConfiguration === null || attachmentConfiguration === void 0 ? void 0 : attachmentConfiguration.thumbUrl } } }, controls: true, height: '100%', url: attachmentConfiguration === null || attachmentConfiguration === void 0 ? void 0 : attachmentConfiguration.url, width: '100%' })));
|
|
13638
|
+
return ((_a = attachment.actions) === null || _a === void 0 ? void 0 : _a.length) ? (React__default["default"].createElement(AttachmentWithinContainer, { attachment: attachment, componentType: componentType },
|
|
13639
|
+
React__default["default"].createElement("div", { className: 'str-chat__attachment str-chat__attachment-media' },
|
|
13640
|
+
content,
|
|
13641
|
+
React__default["default"].createElement(AttachmentActionsContainer, __assign$8({}, props))))) : (React__default["default"].createElement(AttachmentWithinContainer, { attachment: attachment, componentType: componentType }, content));
|
|
13591
13642
|
};
|
|
13592
13643
|
|
|
13593
13644
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var CONTAINER_MAP = {
|
|
@@ -40285,7 +40336,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
40285
40336
|
|
|
40286
40337
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useCreateChannelStateContext = function (value) {
|
|
40287
40338
|
var _a;
|
|
40288
|
-
var acceptedFiles = value.acceptedFiles, channel = value.channel, _b = value.channelCapabilitiesArray, channelCapabilitiesArray = _b === void 0 ? [] : _b, channelConfig = value.channelConfig, dragAndDropWindow = value.dragAndDropWindow, giphyVersion = value.giphyVersion, error = value.error, hasMore = value.hasMore, hasMoreNewer = value.hasMoreNewer, suppressAutoscroll = value.suppressAutoscroll, highlightedMessageId = value.highlightedMessageId, loading = value.loading, loadingMore = value.loadingMore, maxNumberOfFiles = value.maxNumberOfFiles, members = value.members, _c = value.messages, messages = _c === void 0 ? [] : _c, multipleUploads = value.multipleUploads, mutes = value.mutes, notifications = value.notifications, pinnedMessages = value.pinnedMessages, quotedMessage = value.quotedMessage, _d = value.read, read = _d === void 0 ? {} : _d, skipMessageDataMemoization = value.skipMessageDataMemoization, thread = value.thread, threadHasMore = value.threadHasMore, threadLoadingMore = value.threadLoadingMore, _e = value.threadMessages, threadMessages = _e === void 0 ? [] : _e, watcherCount = value.watcherCount, watcher_count = value.watcher_count, watchers = value.watchers;
|
|
40339
|
+
var acceptedFiles = value.acceptedFiles, channel = value.channel, _b = value.channelCapabilitiesArray, channelCapabilitiesArray = _b === void 0 ? [] : _b, channelConfig = value.channelConfig, dragAndDropWindow = value.dragAndDropWindow, giphyVersion = value.giphyVersion, error = value.error, hasMore = value.hasMore, hasMoreNewer = value.hasMoreNewer, imageAttachmentSizeHandler = value.imageAttachmentSizeHandler, suppressAutoscroll = value.suppressAutoscroll, highlightedMessageId = value.highlightedMessageId, loading = value.loading, loadingMore = value.loadingMore, maxNumberOfFiles = value.maxNumberOfFiles, members = value.members, _c = value.messages, messages = _c === void 0 ? [] : _c, multipleUploads = value.multipleUploads, mutes = value.mutes, notifications = value.notifications, pinnedMessages = value.pinnedMessages, quotedMessage = value.quotedMessage, _d = value.read, read = _d === void 0 ? {} : _d, shouldGenerateVideoThumbnail = value.shouldGenerateVideoThumbnail, skipMessageDataMemoization = value.skipMessageDataMemoization, thread = value.thread, threadHasMore = value.threadHasMore, threadLoadingMore = value.threadLoadingMore, _e = value.threadMessages, threadMessages = _e === void 0 ? [] : _e, videoAttachmentSizeHandler = value.videoAttachmentSizeHandler, watcherCount = value.watcherCount, watcher_count = value.watcher_count, watchers = value.watchers;
|
|
40289
40340
|
var channelId = channel.cid;
|
|
40290
40341
|
var lastRead = channel.initialized && ((_a = channel.lastRead()) === null || _a === void 0 ? void 0 : _a.getTime());
|
|
40291
40342
|
var membersLength = Object.keys(members || []).length;
|
|
@@ -40336,6 +40387,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
40336
40387
|
hasMore: hasMore,
|
|
40337
40388
|
hasMoreNewer: hasMoreNewer,
|
|
40338
40389
|
highlightedMessageId: highlightedMessageId,
|
|
40390
|
+
imageAttachmentSizeHandler: imageAttachmentSizeHandler,
|
|
40339
40391
|
loading: loading,
|
|
40340
40392
|
loadingMore: loadingMore,
|
|
40341
40393
|
maxNumberOfFiles: maxNumberOfFiles,
|
|
@@ -40347,11 +40399,13 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
40347
40399
|
pinnedMessages: pinnedMessages,
|
|
40348
40400
|
quotedMessage: quotedMessage,
|
|
40349
40401
|
read: read,
|
|
40402
|
+
shouldGenerateVideoThumbnail: shouldGenerateVideoThumbnail,
|
|
40350
40403
|
suppressAutoscroll: suppressAutoscroll,
|
|
40351
40404
|
thread: thread,
|
|
40352
40405
|
threadHasMore: threadHasMore,
|
|
40353
40406
|
threadLoadingMore: threadLoadingMore,
|
|
40354
40407
|
threadMessages: threadMessages,
|
|
40408
|
+
videoAttachmentSizeHandler: videoAttachmentSizeHandler,
|
|
40355
40409
|
watcher_count: watcher_count,
|
|
40356
40410
|
watcherCount: watcherCount,
|
|
40357
40411
|
watchers: watchers,
|
|
@@ -40371,6 +40425,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
40371
40425
|
quotedMessage,
|
|
40372
40426
|
readUsersLength,
|
|
40373
40427
|
readUsersLastReads,
|
|
40428
|
+
shouldGenerateVideoThumbnail,
|
|
40374
40429
|
skipMessageDataMemoization,
|
|
40375
40430
|
suppressAutoscroll,
|
|
40376
40431
|
thread,
|
|
@@ -45865,6 +45920,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
45865
45920
|
dispatch({
|
|
45866
45921
|
id: id,
|
|
45867
45922
|
state: 'finished',
|
|
45923
|
+
thumb_url: response.thumb_url,
|
|
45868
45924
|
type: 'setFileUpload',
|
|
45869
45925
|
url: response.file,
|
|
45870
45926
|
});
|
|
@@ -46129,6 +46185,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
46129
46185
|
asset_url: upload.url,
|
|
46130
46186
|
file_size: upload.file.size,
|
|
46131
46187
|
mime_type: upload.file.type,
|
|
46188
|
+
thumb_url: upload.thumb_url,
|
|
46132
46189
|
title: upload.file.name,
|
|
46133
46190
|
type: getAttachmentTypeFromMime(upload.file.type || ''),
|
|
46134
46191
|
}); });
|
|
@@ -46315,7 +46372,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
46315
46372
|
var type = _a.type;
|
|
46316
46373
|
return type === 'file';
|
|
46317
46374
|
}).reduce(function (acc, _a) {
|
|
46318
|
-
var asset_url = _a.asset_url, file_size = _a.file_size, mime_type = _a.mime_type, _b = _a.title, title = _b === void 0 ? '' : _b;
|
|
46375
|
+
var asset_url = _a.asset_url, file_size = _a.file_size, mime_type = _a.mime_type, thumb_url = _a.thumb_url, _b = _a.title, title = _b === void 0 ? '' : _b;
|
|
46319
46376
|
var id = nanoid();
|
|
46320
46377
|
acc[id] = {
|
|
46321
46378
|
file: {
|
|
@@ -46325,6 +46382,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
46325
46382
|
},
|
|
46326
46383
|
id: id,
|
|
46327
46384
|
state: 'finished',
|
|
46385
|
+
thumb_url: thumb_url,
|
|
46328
46386
|
url: asset_url,
|
|
46329
46387
|
};
|
|
46330
46388
|
return acc;
|
|
@@ -47237,6 +47295,79 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
47237
47295
|
};
|
|
47238
47296
|
};
|
|
47239
47297
|
|
|
47298
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var getImageAttachmentConfiguration = function (attachment, element) {
|
|
47299
|
+
var url = new URL((attachment.image_url || attachment.thumb_url || ''));
|
|
47300
|
+
var resizeDimensions = getSizingRestrictions(url, element);
|
|
47301
|
+
if (resizeDimensions) {
|
|
47302
|
+
// Apply 2x for retina displays
|
|
47303
|
+
resizeDimensions.height *= 2;
|
|
47304
|
+
resizeDimensions.width *= 2;
|
|
47305
|
+
addResizingParamsToUrl(resizeDimensions, url);
|
|
47306
|
+
}
|
|
47307
|
+
return {
|
|
47308
|
+
url: url.href,
|
|
47309
|
+
};
|
|
47310
|
+
};
|
|
47311
|
+
var getVideoAttachmentConfiguration = function (attachment, element, shouldGenerateVideoThumbnail) {
|
|
47312
|
+
var thumbUrl = undefined;
|
|
47313
|
+
if (attachment.thumb_url && shouldGenerateVideoThumbnail) {
|
|
47314
|
+
var url = new URL(attachment.thumb_url);
|
|
47315
|
+
var resizeDimensions = getSizingRestrictions(url, element);
|
|
47316
|
+
if (resizeDimensions) {
|
|
47317
|
+
// Apply 2x for retina displays
|
|
47318
|
+
resizeDimensions.height *= 2;
|
|
47319
|
+
resizeDimensions.width *= 2;
|
|
47320
|
+
addResizingParamsToUrl(resizeDimensions, url);
|
|
47321
|
+
}
|
|
47322
|
+
thumbUrl = url.href;
|
|
47323
|
+
}
|
|
47324
|
+
return {
|
|
47325
|
+
thumbUrl: thumbUrl,
|
|
47326
|
+
url: attachment.asset_url || '',
|
|
47327
|
+
};
|
|
47328
|
+
};
|
|
47329
|
+
var getSizingRestrictions = function (url, htmlElement) {
|
|
47330
|
+
var urlParams = url.searchParams;
|
|
47331
|
+
var originalHeight = Number(urlParams.get('oh')) || 1;
|
|
47332
|
+
var originalWidth = Number(urlParams.get('ow')) || 1;
|
|
47333
|
+
var cssSizeRestriction = getCSSSizeRestrictions(htmlElement);
|
|
47334
|
+
var resizeDimensions;
|
|
47335
|
+
if ((cssSizeRestriction.maxHeight || cssSizeRestriction.height) && cssSizeRestriction.maxWidth) {
|
|
47336
|
+
resizeDimensions = getResizeDimensions(originalHeight, originalWidth,
|
|
47337
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
47338
|
+
cssSizeRestriction.maxHeight || cssSizeRestriction.height, cssSizeRestriction.maxWidth);
|
|
47339
|
+
}
|
|
47340
|
+
else {
|
|
47341
|
+
resizeDimensions = undefined;
|
|
47342
|
+
}
|
|
47343
|
+
return resizeDimensions;
|
|
47344
|
+
};
|
|
47345
|
+
var getResizeDimensions = function (originalHeight, originalWidth, maxHeight, maxWidth) { return ({
|
|
47346
|
+
height: Math.round(Math.max(maxHeight, (maxWidth / originalWidth) * originalHeight)),
|
|
47347
|
+
width: Math.round(Math.max(maxHeight, (maxWidth / originalHeight) * originalWidth)),
|
|
47348
|
+
}); };
|
|
47349
|
+
var getCSSSizeRestrictions = function (htmlElement) {
|
|
47350
|
+
var computedStylesheet = getComputedStyle(htmlElement);
|
|
47351
|
+
var height = getValueRepresentationOfCSSProperty(computedStylesheet.getPropertyValue('height'));
|
|
47352
|
+
var maxHeight = getValueRepresentationOfCSSProperty(computedStylesheet.getPropertyValue('max-height'));
|
|
47353
|
+
var maxWidth = getValueRepresentationOfCSSProperty(computedStylesheet.getPropertyValue('max-width'));
|
|
47354
|
+
if (!((height || maxHeight) && maxWidth)) {
|
|
47355
|
+
console.warn("Invalid value set for height/max-height and/or max-width for HTML element, this can cause scrolling issues inside the message list, more info https://getstream.io/chat/docs/sdk/react/message-components/attachment/#image-and-video-sizing");
|
|
47356
|
+
}
|
|
47357
|
+
return { height: height, maxHeight: maxHeight, maxWidth: maxWidth };
|
|
47358
|
+
};
|
|
47359
|
+
var getValueRepresentationOfCSSProperty = function (property) {
|
|
47360
|
+
if (!property.endsWith('px')) {
|
|
47361
|
+
return undefined;
|
|
47362
|
+
}
|
|
47363
|
+
var number = parseFloat(property);
|
|
47364
|
+
return isNaN(number) ? undefined : number;
|
|
47365
|
+
};
|
|
47366
|
+
var addResizingParamsToUrl = function (resizeDimensions, url) {
|
|
47367
|
+
url.searchParams.set('h', resizeDimensions.height.toString());
|
|
47368
|
+
url.searchParams.set('w', resizeDimensions.width.toString());
|
|
47369
|
+
};
|
|
47370
|
+
|
|
47240
47371
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=streamChat.logChatPromiseExecution;window.StreamChat.Channel=Channel$1;window.ICAL=window.ICAL||{};var UnMemoizedChannel = function (props) {
|
|
47241
47372
|
var propsChannel = props.channel, _a = props.EmptyPlaceholder, EmptyPlaceholder = _a === void 0 ? null : _a, LoadingErrorIndicator = props.LoadingErrorIndicator, _b = props.LoadingIndicator, LoadingIndicator = _b === void 0 ? LoadingChannel : _b;
|
|
47242
47373
|
var _c = useChatContext('Channel'), contextChannel = _c.channel, channelsQueryState = _c.channelsQueryState, customClasses = _c.customClasses, theme = _c.theme;
|
|
@@ -47723,7 +47854,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
47723
47854
|
var onMentionsHoverOrClick = useMentionsHandlers(onMentionsHover, onMentionsClick);
|
|
47724
47855
|
var editMessage = useEditMessageHandler(doUpdateMessageRequest);
|
|
47725
47856
|
var typing = state.typing, restState = __rest$4(state, ["typing"]);
|
|
47726
|
-
var channelStateContextValue = useCreateChannelStateContext(__assign$8(__assign$8({}, restState), { acceptedFiles: acceptedFiles, channel: channel, channelCapabilitiesArray: channelCapabilitiesArray, channelConfig: channelConfig, dragAndDropWindow: dragAndDropWindow, giphyVersion: props.giphyVersion || 'fixed_height', maxNumberOfFiles: maxNumberOfFiles, multipleUploads: multipleUploads, mutes: mutes, notifications: notifications, quotedMessage: quotedMessage, watcher_count: state.watcherCount }));
|
|
47857
|
+
var channelStateContextValue = useCreateChannelStateContext(__assign$8(__assign$8({}, restState), { acceptedFiles: acceptedFiles, channel: channel, channelCapabilitiesArray: channelCapabilitiesArray, channelConfig: channelConfig, dragAndDropWindow: dragAndDropWindow, giphyVersion: props.giphyVersion || 'fixed_height', imageAttachmentSizeHandler: props.imageAttachmentSizeHandler || getImageAttachmentConfiguration, maxNumberOfFiles: maxNumberOfFiles, multipleUploads: multipleUploads, mutes: mutes, notifications: notifications, quotedMessage: quotedMessage, shouldGenerateVideoThumbnail: props.shouldGenerateVideoThumbnail || true, videoAttachmentSizeHandler: props.videoAttachmentSizeHandler || getVideoAttachmentConfiguration, watcher_count: state.watcherCount }));
|
|
47727
47858
|
var channelActionContextValue = React.useMemo(function () { return ({
|
|
47728
47859
|
addNotification: addNotification,
|
|
47729
47860
|
closeThread: closeThread,
|
|
@@ -48985,7 +49116,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
48985
49116
|
|
|
48986
49117
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
48987
49118
|
|
|
48988
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version = '10.
|
|
49119
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version = '10.2.0';
|
|
48989
49120
|
|
|
48990
49121
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
|
|
48991
49122
|
var _b, _c;
|
|
@@ -50062,7 +50193,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
50062
50193
|
};
|
|
50063
50194
|
|
|
50064
50195
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useMessageListElements = function (props) {
|
|
50065
|
-
var enrichedMessages = props.enrichedMessages, internalMessageProps = props.internalMessageProps, messageGroupStyles = props.messageGroupStyles,
|
|
50196
|
+
var enrichedMessages = props.enrichedMessages, internalMessageProps = props.internalMessageProps, messageGroupStyles = props.messageGroupStyles, read = props.read, returnAllReadData = props.returnAllReadData, threadList = props.threadList;
|
|
50066
50197
|
var _a = useChatContext('useMessageListElements'), client = _a.client, customClasses = _a.customClasses;
|
|
50067
50198
|
var _b = useComponentContext('useMessageListElements'), _c = _b.DateSeparator, DateSeparator$1 = _c === void 0 ? DateSeparator : _c, HeaderComponent = _b.HeaderComponent, _d = _b.MessageSystem, MessageSystem = _d === void 0 ? EventComponent : _d;
|
|
50068
50199
|
// get the readData, but only for messages submitted by the user themselves
|
|
@@ -50094,7 +50225,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
50094
50225
|
}
|
|
50095
50226
|
var groupStyles = messageGroupStyles[message.id] || '';
|
|
50096
50227
|
var messageClass = (customClasses === null || customClasses === void 0 ? void 0 : customClasses.message) || "str-chat__li str-chat__li--".concat(groupStyles);
|
|
50097
|
-
return (React__default["default"].createElement("li", { className: messageClass, "data-message-id": message.id, "data-testid": messageClass, key: message.id || message.created_at
|
|
50228
|
+
return (React__default["default"].createElement("li", { className: messageClass, "data-message-id": message.id, "data-testid": messageClass, key: message.id || message.created_at },
|
|
50098
50229
|
React__default["default"].createElement(Message, __assign$8({ groupStyles: [groupStyles], lastReceivedId: lastReceivedId, message: message, readBy: readData[message.id] || [], threadList: threadList }, internalMessageProps))));
|
|
50099
50230
|
});
|
|
50100
50231
|
}, [
|
|
@@ -50102,7 +50233,6 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
50102
50233
|
internalMessageProps,
|
|
50103
50234
|
lastReceivedId,
|
|
50104
50235
|
messageGroupStyles,
|
|
50105
|
-
onMessageLoadCaptured,
|
|
50106
50236
|
readData,
|
|
50107
50237
|
threadList,
|
|
50108
50238
|
]);
|
|
@@ -50221,19 +50351,9 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
50221
50351
|
setIsMessageListScrolledToBottom(true);
|
|
50222
50352
|
}
|
|
50223
50353
|
}, [updateScrollTop, closeToTop, closeToBottom, scrolledUpThreshold]);
|
|
50224
|
-
var onMessageLoadCaptured = React.useCallback(function () {
|
|
50225
|
-
/**
|
|
50226
|
-
* A load event (emitted by e.g. an <img>) was captured on a message.
|
|
50227
|
-
* In some cases, the loaded asset is larger than the placeholder, which means we have to scroll down.
|
|
50228
|
-
*/
|
|
50229
|
-
if (closeToBottom.current) {
|
|
50230
|
-
scrollToBottom();
|
|
50231
|
-
}
|
|
50232
|
-
}, [closeToTop, closeToBottom, scrollToBottom]);
|
|
50233
50354
|
return {
|
|
50234
50355
|
hasNewMessages: hasNewMessages,
|
|
50235
50356
|
isMessageListScrolledToBottom: isMessageListScrolledToBottom,
|
|
50236
|
-
onMessageLoadCaptured: onMessageLoadCaptured,
|
|
50237
50357
|
onScroll: onScroll,
|
|
50238
50358
|
scrollToBottom: scrollToBottom,
|
|
50239
50359
|
wrapperRect: wrapperRect,
|
|
@@ -50363,7 +50483,7 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
50363
50483
|
messages: messages,
|
|
50364
50484
|
scrolledUpThreshold: props.scrolledUpThreshold,
|
|
50365
50485
|
suppressAutoscroll: suppressAutoscroll,
|
|
50366
|
-
}), hasNewMessages = _x.hasNewMessages, isMessageListScrolledToBottom = _x.isMessageListScrolledToBottom,
|
|
50486
|
+
}), hasNewMessages = _x.hasNewMessages, isMessageListScrolledToBottom = _x.isMessageListScrolledToBottom, onScroll = _x.onScroll, scrollToBottom = _x.scrollToBottom, wrapperRect = _x.wrapperRect;
|
|
50367
50487
|
var _y = useEnrichedMessages({
|
|
50368
50488
|
channel: channel,
|
|
50369
50489
|
disableDateSeparator: disableDateSeparator,
|
|
@@ -50403,7 +50523,6 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
50403
50523
|
unsafeHTML: unsafeHTML,
|
|
50404
50524
|
},
|
|
50405
50525
|
messageGroupStyles: messageGroupStyles,
|
|
50406
|
-
onMessageLoadCaptured: onMessageLoadCaptured,
|
|
50407
50526
|
read: read,
|
|
50408
50527
|
returnAllReadData: returnAllReadData,
|
|
50409
50528
|
threadList: threadList,
|
|
@@ -52056,7 +52175,6 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
52056
52175
|
return Item;
|
|
52057
52176
|
}, [
|
|
52058
52177
|
customClasses === null || customClasses === void 0 ? void 0 : customClasses.virtualMessage,
|
|
52059
|
-
messageGroupStyles,
|
|
52060
52178
|
numItemsPrepended,
|
|
52061
52179
|
// processedMessages were incorrectly rebuilt with a new object identity at some point, hence the .length usage
|
|
52062
52180
|
processedMessages.length,
|
|
@@ -52198,9 +52316,13 @@ var StreamChatReact = (function (exports, React, streamChat, ReactDOM) {
|
|
|
52198
52316
|
}, []);
|
|
52199
52317
|
if (!thread)
|
|
52200
52318
|
return null;
|
|
52201
|
-
var threadClass = (customClasses === null || customClasses === void 0 ? void 0 : customClasses.thread) ||
|
|
52319
|
+
var threadClass = (customClasses === null || customClasses === void 0 ? void 0 : customClasses.thread) ||
|
|
52320
|
+
clsx('str-chat__thread-container str-chat__thread', {
|
|
52321
|
+
'str-chat__thread--full': fullWidth,
|
|
52322
|
+
'str-chat__thread--virtualized': virtualized,
|
|
52323
|
+
});
|
|
52202
52324
|
var head = (React__default["default"].createElement(ThreadHead$1, __assign$8({ key: thread.id, message: thread, Message: MessageUIComponent }, additionalParentMessageProps)));
|
|
52203
|
-
return (React__default["default"].createElement("div", { className:
|
|
52325
|
+
return (React__default["default"].createElement("div", { className: threadClass },
|
|
52204
52326
|
React__default["default"].createElement(ThreadHeader$1, { closeThread: closeThread, thread: thread }),
|
|
52205
52327
|
React__default["default"].createElement(ThreadMessageList, __assign$8({ disableDateSeparator: !enableDateSeparator, hasMore: threadHasMore, head: head, loadingMore: threadLoadingMore, loadMore: loadMoreThread, Message: MessageUIComponent, messageActions: messageActions, messages: threadMessages || [], suppressAutoscroll: threadSuppressAutoscroll, threadList: true }, (virtualized ? additionalVirtualizedMessageListProps : additionalMessageListProps))),
|
|
52206
52328
|
React__default["default"].createElement(MessageInput, __assign$8({ focus: autoFocus, Input: ThreadInput, parent: thread, publishTypingEvent: false }, additionalMessageInputProps))));
|