stream-chat-react 9.5.0 → 9.5.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Attachment.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/Attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAEjF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,oBAAY,eAAe,CACzB,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,oJAAoJ;IACpJ,WAAW,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACpD,wJAAwJ;IACxJ,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,oOAAoO;IACpO,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpF,kNAAkN;IAClN,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC5D,8MAA8M;IAC9M,IAAI,CAAC,EA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;IACpJ,WAAW,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACpD,wJAAwJ;IACxJ,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,oOAAoO;IACpO,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpF,kNAAkN;IAClN,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC5D,8MAA8M;IAC9M,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACtC,wNAAwN;IACxN,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpE,8NAA8N;IAC9N,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAChE,+MAA+M;IAC/M,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACxC,gHAAgH;IAChH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,+IA2DtB,CAAC"}
@@ -44,7 +44,7 @@ export var Attachment = function (props) {
44
44
  })), [
45
45
  gallery,
46
46
  ]) : attachments;
47
- return (React.createElement(React.Fragment, null, newAttachments.map(function (attachment) {
47
+ var getContent = function (attachment) {
48
48
  if (isGalleryAttachmentType(attachment)) {
49
49
  return renderGallery(__assign(__assign({}, rest), { attachment: attachment }));
50
50
  }
@@ -61,5 +61,6 @@ export var Attachment = function (props) {
61
61
  return renderMedia(__assign(__assign({}, rest), { attachment: attachment }));
62
62
  }
63
63
  return renderCard(__assign(__assign({}, rest), { attachment: attachment }));
64
- })));
64
+ };
65
+ return (React.createElement(React.Fragment, null, newAttachments.map(function (attachment, i) { return (React.createElement(React.Fragment, { key: i }, getContent(attachment))); })));
65
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Attachment/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,eAAO,MAAM,uBAAuB,UAA8D,CAAC;AAEnG,oBAAY,iBAAiB,CAC3B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,MAAM,EAAE,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,wBAAwB,CAClC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACnF,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,oBAAY,qBAAqB,CAC/B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC,GAAG;IAC7D,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF,oBAAY,kBAAkB,CAC5B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC,GAAG;IAC7D,UAAU,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,uBAA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AAY,qBAAqB,CAC/B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC,GAAG;IAC7D,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF,oBAAY,kBAAkB,CAC5B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC,GAAG;IAC7D,UAAU,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,uBAAuB,uNAK8B,CAAC;AAEnE,eAAO,MAAM,iBAAiB,2IAIE,CAAC;AAEjC,eAAO,MAAM,gBAAgB,4JAQG,CAAC;AAEjC,eAAO,MAAM,iBAAiB,2IAIyD,CAAC;AAExF,eAAO,MAAM,iBAAiB,2IAMD,CAAC;AAE9B,eAAO,MAAM,+BAA+B,iLA2B3C,CAAC;AAEF,eAAO,MAAM,uBAAuB,4JAkBnC,CAAC;AAEF,eAAO,MAAM,aAAa,kJAYzB,CAAC;AAEF,eAAO,MAAM,WAAW,qJAyBvB,CAAC;AAEF,eAAO,MAAM,UAAU,qJAyBtB,CAAC;AAEF,eAAO,MAAM,UAAU,4JActB,CAAC;AAEF,eAAO,MAAM,WAAW,qJAgBvB,CAAC;AAEF,eAAO,MAAM,WAAW,qJA2CvB,CAAC"}
@@ -11,7 +11,6 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import React from 'react';
13
13
  import ReactPlayer from 'react-player';
14
- import { nanoid } from 'nanoid';
15
14
  import { AttachmentActions as DefaultAttachmentActions } from './AttachmentActions';
16
15
  import { Audio as DefaultAudio } from './Audio';
17
16
  import { Card as DefaultCard } from './Card';
@@ -44,20 +43,20 @@ export var renderAttachmentWithinContainer = function (props) {
44
43
  ? 'actions'
45
44
  : '';
46
45
  }
47
- return (React.createElement("div", { className: "str-chat__message-attachment str-chat__message-attachment--" + componentType + " str-chat__message-attachment--" + ((attachment === null || attachment === void 0 ? void 0 : attachment.type) || '') + " str-chat__message-attachment--" + componentType + "--" + extra, key: (isGalleryAttachmentType(attachment) ? '' : (attachment === null || attachment === void 0 ? void 0 : attachment.id) || nanoid()) + "-" + ((attachment === null || attachment === void 0 ? void 0 : attachment.type) || 'none') + " " }, children));
46
+ return (React.createElement("div", { className: "str-chat__message-attachment str-chat__message-attachment--" + componentType + " str-chat__message-attachment--" + ((attachment === null || attachment === void 0 ? void 0 : attachment.type) || '') + " str-chat__message-attachment--" + componentType + "--" + extra }, children));
48
47
  };
49
48
  export var renderAttachmentActions = function (props) {
50
49
  var _a;
51
50
  var actionHandler = props.actionHandler, attachment = props.attachment, _b = props.AttachmentActions, AttachmentActions = _b === void 0 ? DefaultAttachmentActions : _b;
52
51
  if (!((_a = attachment.actions) === null || _a === void 0 ? void 0 : _a.length))
53
52
  return null;
54
- return (React.createElement(AttachmentActions, __assign({}, attachment, { actionHandler: function (event, name, value) { return actionHandler === null || actionHandler === void 0 ? void 0 : actionHandler(event, name, value); }, actions: attachment.actions, id: attachment.id || '', key: "key-actions-" + attachment.id, text: attachment.text || '' })));
53
+ return (React.createElement(AttachmentActions, __assign({}, attachment, { actionHandler: function (event, name, value) { return actionHandler === null || actionHandler === void 0 ? void 0 : actionHandler(event, name, value); }, actions: attachment.actions, id: attachment.id || '', text: attachment.text || '' })));
55
54
  };
56
55
  export var renderGallery = function (props) {
57
56
  var attachment = props.attachment, _a = props.Gallery, Gallery = _a === void 0 ? DefaultGallery : _a;
58
57
  return renderAttachmentWithinContainer({
59
58
  attachment: attachment,
60
- children: React.createElement(Gallery, { images: attachment.images || [], key: 'gallery' }),
59
+ children: React.createElement(Gallery, { images: attachment.images || [] }),
61
60
  componentType: 'gallery',
62
61
  });
63
62
  };
@@ -66,7 +65,7 @@ export var renderImage = function (props) {
66
65
  if (attachment.actions && attachment.actions.length) {
67
66
  return renderAttachmentWithinContainer({
68
67
  attachment: attachment,
69
- children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-image-" + attachment.id },
68
+ children: (React.createElement("div", { className: 'str-chat__attachment' },
70
69
  React.createElement(Image, __assign({}, attachment)),
71
70
  renderAttachmentActions(props))),
72
71
  componentType: 'image',
@@ -74,7 +73,7 @@ export var renderImage = function (props) {
74
73
  }
75
74
  return renderAttachmentWithinContainer({
76
75
  attachment: attachment,
77
- children: React.createElement(Image, __assign({}, attachment, { key: "key-image-" + attachment.id })),
76
+ children: React.createElement(Image, __assign({}, attachment)),
78
77
  componentType: 'image',
79
78
  });
80
79
  };
@@ -83,15 +82,15 @@ export var renderCard = function (props) {
83
82
  if (attachment.actions && attachment.actions.length) {
84
83
  return renderAttachmentWithinContainer({
85
84
  attachment: attachment,
86
- children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-image-" + attachment.id },
87
- React.createElement(Card, __assign({}, attachment, { key: "key-card-" + attachment.id })),
85
+ children: (React.createElement("div", { className: 'str-chat__attachment' },
86
+ React.createElement(Card, __assign({}, attachment)),
88
87
  renderAttachmentActions(props))),
89
88
  componentType: 'card',
90
89
  });
91
90
  }
92
91
  return renderAttachmentWithinContainer({
93
92
  attachment: attachment,
94
- children: React.createElement(Card, __assign({}, attachment, { key: "key-card-" + attachment.id })),
93
+ children: React.createElement(Card, __assign({}, attachment)),
95
94
  componentType: 'card',
96
95
  });
97
96
  };
@@ -101,7 +100,7 @@ export var renderFile = function (props) {
101
100
  return null;
102
101
  return renderAttachmentWithinContainer({
103
102
  attachment: attachment,
104
- children: React.createElement(File, { attachment: attachment, key: "key-file-" + attachment.id }),
103
+ children: React.createElement(File, { attachment: attachment }),
105
104
  componentType: 'file',
106
105
  });
107
106
  };
@@ -109,7 +108,7 @@ export var renderAudio = function (props) {
109
108
  var attachment = props.attachment, _a = props.Audio, Audio = _a === void 0 ? DefaultAudio : _a;
110
109
  return renderAttachmentWithinContainer({
111
110
  attachment: attachment,
112
- children: (React.createElement("div", { className: 'str-chat__attachment', key: "key-video-" + attachment.id },
111
+ children: (React.createElement("div", { className: 'str-chat__attachment' },
113
112
  React.createElement(Audio, { og: attachment }))),
114
113
  componentType: 'audio',
115
114
  });
@@ -120,7 +119,7 @@ export var renderMedia = function (props) {
120
119
  if ((_a = attachment.actions) === null || _a === void 0 ? void 0 : _a.length) {
121
120
  return renderAttachmentWithinContainer({
122
121
  attachment: attachment,
123
- children: (React.createElement("div", { className: 'str-chat__attachment str-chat__attachment-media', key: "key-video-" + attachment.id },
122
+ children: (React.createElement("div", { className: 'str-chat__attachment str-chat__attachment-media' },
124
123
  React.createElement("div", { className: 'str-chat__player-wrapper' },
125
124
  React.createElement(Media, { className: 'react-player', controls: true, height: '100%', url: attachment.asset_url, width: '100%' })),
126
125
  renderAttachmentActions(props))),
@@ -129,7 +128,7 @@ export var renderMedia = function (props) {
129
128
  }
130
129
  return renderAttachmentWithinContainer({
131
130
  attachment: attachment,
132
- children: (React.createElement("div", { className: 'str-chat__player-wrapper', key: "key-video-" + attachment.id },
131
+ children: (React.createElement("div", { className: 'str-chat__player-wrapper' },
133
132
  React.createElement(Media, { className: 'react-player', controls: true, height: '100%', url: attachment.asset_url, width: '100%' }))),
134
133
  componentType: 'media',
135
134
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Channel.d.ts","sourceRoot":"","sources":["../../../src/components/Channel/Channel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAKL,OAAO,EACP,eAAe,EAEf,OAAO,IAAI,aAAa,EACxB,UAAU,EACV,cAAc,EAEf,MAAM,aAAa,CAAC;AASrB,OAAO,EAAE,eAAe,EAAuB,MAAM,6BAA6B,CAAC;AAGnF,OAAO,EAGL,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAcpB,OAAO,EAAE,qBAAqB,EAAqB,MAAM,gCAAgC,CAAC;AAE1F,OAAO,EAAe,iB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AC,kBAAkB,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAC/E,sPAAsP;IACtP,cAAc,CAAC,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAC9E,CAAC;AAmtBF;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,wNAA4D,CAAC"}
@@ -350,6 +350,7 @@ var ChannelInner = function (props) {
350
350
  });
351
351
  });
352
352
  };
353
+ var clearHighlightedMessageTimeoutId = useRef(null);
353
354
  var jumpToMessage = function (messageId, messageLimit) {
354
355
  if (messageLimit === void 0) { messageLimit = 100; }
355
356
  return __awaiter(void 0, void 0, void 0, function () {
@@ -369,7 +370,11 @@ var ChannelInner = function (props) {
369
370
  highlightedMessageId: messageId,
370
371
  type: 'jumpToMessageFinished',
371
372
  });
372
- setTimeout(function () {
373
+ if (clearHighlightedMessageTimeoutId.current) {
374
+ clearTimeout(clearHighlightedMessageTimeoutId.current);
375
+ }
376
+ clearHighlightedMessageTimeoutId.current = setTimeout(function () {
377
+ clearHighlightedMessageTimeoutId.current = null;
373
378
  dispatch({ type: 'clearHighlightedMessage' });
374
379
  }, 500);
375
380
  return [2 /*return*/];
@@ -1 +1 @@
1
- {"version":3,"file":"usePrependMessagesCount.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageList/hooks/usePrependMessagesCount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,wBAAgB,yBAAyB,CACvC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,EAChF,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,UAsCzE"}
1
+ {"version":3,"file":"usePrependMessagesCount.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageList/hooks/usePrependMessagesCount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,wBAAgB,yBAAyB,CACvC,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,EAChF,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,UAwCzE"}
@@ -1,15 +1,16 @@
1
1
  import { useMemo, useRef } from 'react';
2
2
  export function usePrependedMessagesCount(messages, hasDateSeparator) {
3
- var _a;
4
3
  var firstRealMessageIndex = hasDateSeparator ? 1 : 0;
5
- var currentFirstMessageId = (_a = messages === null || messages === void 0 ? void 0 : messages[firstRealMessageIndex]) === null || _a === void 0 ? void 0 : _a.id;
6
- var firstMessageId = useRef(currentFirstMessageId);
7
- var earliestMessageId = useRef(currentFirstMessageId);
4
+ var firstMessageId = useRef();
5
+ var earliestMessageId = useRef();
8
6
  var previousNumItemsPrepended = useRef(0);
9
7
  var numItemsPrepended = useMemo(function () {
8
+ var _a;
10
9
  if (!messages || !messages.length) {
10
+ previousNumItemsPrepended.current = 0;
11
11
  return 0;
12
12
  }
13
+ var currentFirstMessageId = (_a = messages === null || messages === void 0 ? void 0 : messages[firstRealMessageIndex]) === null || _a === void 0 ? void 0 : _a.id;
13
14
  // if no new messages were prepended, return early (same amount as before)
14
15
  if (currentFirstMessageId === earliestMessageId.current) {
15
16
  return previousNumItemsPrepended.current;
@@ -26,8 +27,9 @@ export function usePrependedMessagesCount(messages, hasDateSeparator) {
26
27
  return i;
27
28
  }
28
29
  }
29
- // if no match has found, we have jumped
30
+ // if no match has found, we have jumped - reset the prepend item count.
30
31
  firstMessageId.current = currentFirstMessageId;
32
+ previousNumItemsPrepended.current = 0;
31
33
  return 0;
32
34
  // TODO: there's a bug here, the messages prop is the same array instance (something mutates it)
33
35
  // that's why the second dependency is necessary
@@ -53,7 +53,7 @@ export declare const useChannelStateContext: <StreamChatGenerics extends Default
53
53
  * wrapped component must be provided as the first generic.
54
54
  */
55
55
  export declare const withChannelStateContext: <P extends UnknownType, StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(Component: React.ComponentType<P>) => {
56
- (props: Omit<P, "notifications" | "error" | "loading" | "mutes" | "channel" | "members" | "read" | "watchers" | "suppressAutoscroll" | "hasMore" | "hasMoreNewer" | "highlightedMessageId" | "loadingMore" | "loadingMoreNewer" | "messages" | "pinnedMessages" | "quotedMessage" | "thread" | "threadHasMore" | "threadLoadingMore" | "threadMessages" | "watcherCount" | "channelCapabilities" | "channelConfig" | "multipleUploads" | "acceptedFiles" | "dragAndDropWindow" | "giphyVersion" | "maxNumberOfFiles" | "watcher_count">): JSX.Element;
56
+ (props: Omit<P, "notifications" | "error" | "loading" | "channel" | "members" | "messages" | "read" | "watcher_count" | "watchers" | "mutes" | "suppressAutoscroll" | "hasMore" | "hasMoreNewer" | "highlightedMessageId" | "loadingMore" | "loadingMoreNewer" | "pinnedMessages" | "quotedMessage" | "thread" | "threadHasMore" | "threadLoadingMore" | "threadMessages" | "watcherCount" | "channelCapabilities" | "channelConfig" | "multipleUploads" | "acceptedFiles" | "dragAndDropWindow" | "giphyVersion" | "maxNumberOfFiles">): JSX.Element;
57
57
  displayName: string;
58
58
  };
59
59
  //# sourceMappingURL=ChannelStateContext.d.ts.map
package/dist/index.cjs.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var ReactPlayer = require('react-player');
7
- var nanoid = require('nanoid');
8
7
  var sanitizeUrl = require('@braintree/sanitize-url');
9
8
  var Dayjs = require('dayjs');
10
9
  var calendar = require('dayjs/plugin/calendar');
@@ -32,6 +31,7 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
32
31
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
33
32
  var emojiRegex = require('emoji-regex');
34
33
  var linkify = require('linkifyjs');
34
+ var nanoid = require('nanoid');
35
35
  var RootReactMarkdown = require('react-markdown');
36
36
  var ReactMarkdown = require('react-markdown/with-html');
37
37
  var uniqBy = require('lodash.uniqby');
@@ -1148,20 +1148,20 @@ var renderAttachmentWithinContainer = function (props) {
1148
1148
  ? 'actions'
1149
1149
  : '';
1150
1150
  }
1151
- return (React__default['default'].createElement("div", { className: "str-chat__message-attachment str-chat__message-attachment--" + componentType + " str-chat__message-attachment--" + ((attachment === null || attachment === void 0 ? void 0 : attachment.type) || '') + " str-chat__message-attachment--" + componentType + "--" + extra, key: (isGalleryAttachmentType(attachment) ? '' : (attachment === null || attachment === void 0 ? void 0 : attachment.id) || nanoid.nanoid()) + "-" + ((attachment === null || attachment === void 0 ? void 0 : attachment.type) || 'none') + " " }, children));
1151
+ return (React__default['default'].createElement("div", { className: "str-chat__message-attachment str-chat__message-attachment--" + componentType + " str-chat__message-attachment--" + ((attachment === null || attachment === void 0 ? void 0 : attachment.type) || '') + " str-chat__message-attachment--" + componentType + "--" + extra }, children));
1152
1152
  };
1153
1153
  var renderAttachmentActions = function (props) {
1154
1154
  var _a;
1155
1155
  var actionHandler = props.actionHandler, attachment = props.attachment, _b = props.AttachmentActions, AttachmentActions$1 = _b === void 0 ? AttachmentActions : _b;
1156
1156
  if (!((_a = attachment.actions) === null || _a === void 0 ? void 0 : _a.length))
1157
1157
  return null;
1158
- return (React__default['default'].createElement(AttachmentActions$1, __assign({}, attachment, { actionHandler: function (event, name, value) { return actionHandler === null || actionHandler === void 0 ? void 0 : actionHandler(event, name, value); }, actions: attachment.actions, id: attachment.id || '', key: "key-actions-" + attachment.id, text: attachment.text || '' })));
1158
+ return (React__default['default'].createElement(AttachmentActions$1, __assign({}, attachment, { actionHandler: function (event, name, value) { return actionHandler === null || actionHandler === void 0 ? void 0 : actionHandler(event, name, value); }, actions: attachment.actions, id: attachment.id || '', text: attachment.text || '' })));
1159
1159
  };
1160
1160
  var renderGallery = function (props) {
1161
1161
  var attachment = props.attachment, _a = props.Gallery, Gallery$1 = _a === void 0 ? Gallery : _a;
1162
1162
  return renderAttachmentWithinContainer({
1163
1163
  attachment: attachment,
1164
- children: React__default['default'].createElement(Gallery$1, { images: attachment.images || [], key: 'gallery' }),
1164
+ children: React__default['default'].createElement(Gallery$1, { images: attachment.images || [] }),
1165
1165
  componentType: 'gallery',
1166
1166
  });
1167
1167
  };
@@ -1170,7 +1170,7 @@ var renderImage = function (props) {
1170
1170
  if (attachment.actions && attachment.actions.length) {
1171
1171
  return renderAttachmentWithinContainer({
1172
1172
  attachment: attachment,
1173
- children: (React__default['default'].createElement("div", { className: 'str-chat__attachment', key: "key-image-" + attachment.id },
1173
+ children: (React__default['default'].createElement("div", { className: 'str-chat__attachment' },
1174
1174
  React__default['default'].createElement(Image, __assign({}, attachment)),
1175
1175
  renderAttachmentActions(props))),
1176
1176
  componentType: 'image',
@@ -1178,7 +1178,7 @@ var renderImage = function (props) {
1178
1178
  }
1179
1179
  return renderAttachmentWithinContainer({
1180
1180
  attachment: attachment,
1181
- children: React__default['default'].createElement(Image, __assign({}, attachment, { key: "key-image-" + attachment.id })),
1181
+ children: React__default['default'].createElement(Image, __assign({}, attachment)),
1182
1182
  componentType: 'image',
1183
1183
  });
1184
1184
  };
@@ -1187,15 +1187,15 @@ var renderCard = function (props) {
1187
1187
  if (attachment.actions && attachment.actions.length) {
1188
1188
  return renderAttachmentWithinContainer({
1189
1189
  attachment: attachment,
1190
- children: (React__default['default'].createElement("div", { className: 'str-chat__attachment', key: "key-image-" + attachment.id },
1191
- React__default['default'].createElement(Card$1, __assign({}, attachment, { key: "key-card-" + attachment.id })),
1190
+ children: (React__default['default'].createElement("div", { className: 'str-chat__attachment' },
1191
+ React__default['default'].createElement(Card$1, __assign({}, attachment)),
1192
1192
  renderAttachmentActions(props))),
1193
1193
  componentType: 'card',
1194
1194
  });
1195
1195
  }
1196
1196
  return renderAttachmentWithinContainer({
1197
1197
  attachment: attachment,
1198
- children: React__default['default'].createElement(Card$1, __assign({}, attachment, { key: "key-card-" + attachment.id })),
1198
+ children: React__default['default'].createElement(Card$1, __assign({}, attachment)),
1199
1199
  componentType: 'card',
1200
1200
  });
1201
1201
  };
@@ -1205,7 +1205,7 @@ var renderFile = function (props) {
1205
1205
  return null;
1206
1206
  return renderAttachmentWithinContainer({
1207
1207
  attachment: attachment,
1208
- children: React__default['default'].createElement(File, { attachment: attachment, key: "key-file-" + attachment.id }),
1208
+ children: React__default['default'].createElement(File, { attachment: attachment }),
1209
1209
  componentType: 'file',
1210
1210
  });
1211
1211
  };
@@ -1213,7 +1213,7 @@ var renderAudio = function (props) {
1213
1213
  var attachment = props.attachment, _a = props.Audio, Audio$1 = _a === void 0 ? Audio : _a;
1214
1214
  return renderAttachmentWithinContainer({
1215
1215
  attachment: attachment,
1216
- children: (React__default['default'].createElement("div", { className: 'str-chat__attachment', key: "key-video-" + attachment.id },
1216
+ children: (React__default['default'].createElement("div", { className: 'str-chat__attachment' },
1217
1217
  React__default['default'].createElement(Audio$1, { og: attachment }))),
1218
1218
  componentType: 'audio',
1219
1219
  });
@@ -1224,7 +1224,7 @@ var renderMedia = function (props) {
1224
1224
  if ((_a = attachment.actions) === null || _a === void 0 ? void 0 : _a.length) {
1225
1225
  return renderAttachmentWithinContainer({
1226
1226
  attachment: attachment,
1227
- children: (React__default['default'].createElement("div", { className: 'str-chat__attachment str-chat__attachment-media', key: "key-video-" + attachment.id },
1227
+ children: (React__default['default'].createElement("div", { className: 'str-chat__attachment str-chat__attachment-media' },
1228
1228
  React__default['default'].createElement("div", { className: 'str-chat__player-wrapper' },
1229
1229
  React__default['default'].createElement(Media, { className: 'react-player', controls: true, height: '100%', url: attachment.asset_url, width: '100%' })),
1230
1230
  renderAttachmentActions(props))),
@@ -1233,7 +1233,7 @@ var renderMedia = function (props) {
1233
1233
  }
1234
1234
  return renderAttachmentWithinContainer({
1235
1235
  attachment: attachment,
1236
- children: (React__default['default'].createElement("div", { className: 'str-chat__player-wrapper', key: "key-video-" + attachment.id },
1236
+ children: (React__default['default'].createElement("div", { className: 'str-chat__player-wrapper' },
1237
1237
  React__default['default'].createElement(Media, { className: 'react-player', controls: true, height: '100%', url: attachment.asset_url, width: '100%' }))),
1238
1238
  componentType: 'media',
1239
1239
  });
@@ -1256,7 +1256,7 @@ var Attachment = function (props) {
1256
1256
  })), [
1257
1257
  gallery,
1258
1258
  ]) : attachments;
1259
- return (React__default['default'].createElement(React__default['default'].Fragment, null, newAttachments.map(function (attachment) {
1259
+ var getContent = function (attachment) {
1260
1260
  if (isGalleryAttachmentType(attachment)) {
1261
1261
  return renderGallery(__assign(__assign({}, rest), { attachment: attachment }));
1262
1262
  }
@@ -1273,7 +1273,8 @@ var Attachment = function (props) {
1273
1273
  return renderMedia(__assign(__assign({}, rest), { attachment: attachment }));
1274
1274
  }
1275
1275
  return renderCard(__assign(__assign({}, rest), { attachment: attachment }));
1276
- })));
1276
+ };
1277
+ return (React__default['default'].createElement(React__default['default'].Fragment, null, newAttachments.map(function (attachment, i) { return (React__default['default'].createElement(React__default['default'].Fragment, { key: i }, getContent(attachment))); })));
1277
1278
  };
1278
1279
 
1279
1280
  var Item = /*#__PURE__*/React__default['default'].forwardRef(function Item(props, innerRef) {
@@ -7151,6 +7152,7 @@ var ChannelInner = function (props) {
7151
7152
  });
7152
7153
  });
7153
7154
  };
7155
+ var clearHighlightedMessageTimeoutId = React.useRef(null);
7154
7156
  var jumpToMessage = function (messageId, messageLimit) {
7155
7157
  if (messageLimit === void 0) { messageLimit = 100; }
7156
7158
  return __awaiter(void 0, void 0, void 0, function () {
@@ -7170,7 +7172,11 @@ var ChannelInner = function (props) {
7170
7172
  highlightedMessageId: messageId,
7171
7173
  type: 'jumpToMessageFinished',
7172
7174
  });
7173
- setTimeout(function () {
7175
+ if (clearHighlightedMessageTimeoutId.current) {
7176
+ clearTimeout(clearHighlightedMessageTimeoutId.current);
7177
+ }
7178
+ clearHighlightedMessageTimeoutId.current = setTimeout(function () {
7179
+ clearHighlightedMessageTimeoutId.current = null;
7174
7180
  dispatch({ type: 'clearHighlightedMessage' });
7175
7181
  }, 500);
7176
7182
  return [2 /*return*/];
@@ -8391,7 +8397,7 @@ var UnMemoizedChannelList = function (props) {
8391
8397
  */
8392
8398
  var ChannelList = React__default['default'].memo(UnMemoizedChannelList);
8393
8399
 
8394
- var version = '9.5.0';
8400
+ var version = '9.5.2';
8395
8401
 
8396
8402
  var useChat = function (_a) {
8397
8403
  var _b, _c;
@@ -9811,16 +9817,17 @@ function useNewMessageNotification(messages, currentUserId, hasMoreNewer) {
9811
9817
  }
9812
9818
 
9813
9819
  function usePrependedMessagesCount(messages, hasDateSeparator) {
9814
- var _a;
9815
9820
  var firstRealMessageIndex = hasDateSeparator ? 1 : 0;
9816
- var currentFirstMessageId = (_a = messages === null || messages === void 0 ? void 0 : messages[firstRealMessageIndex]) === null || _a === void 0 ? void 0 : _a.id;
9817
- var firstMessageId = React.useRef(currentFirstMessageId);
9818
- var earliestMessageId = React.useRef(currentFirstMessageId);
9821
+ var firstMessageId = React.useRef();
9822
+ var earliestMessageId = React.useRef();
9819
9823
  var previousNumItemsPrepended = React.useRef(0);
9820
9824
  var numItemsPrepended = React.useMemo(function () {
9825
+ var _a;
9821
9826
  if (!messages || !messages.length) {
9827
+ previousNumItemsPrepended.current = 0;
9822
9828
  return 0;
9823
9829
  }
9830
+ var currentFirstMessageId = (_a = messages === null || messages === void 0 ? void 0 : messages[firstRealMessageIndex]) === null || _a === void 0 ? void 0 : _a.id;
9824
9831
  // if no new messages were prepended, return early (same amount as before)
9825
9832
  if (currentFirstMessageId === earliestMessageId.current) {
9826
9833
  return previousNumItemsPrepended.current;
@@ -9837,8 +9844,9 @@ function usePrependedMessagesCount(messages, hasDateSeparator) {
9837
9844
  return i;
9838
9845
  }
9839
9846
  }
9840
- // if no match has found, we have jumped
9847
+ // if no match has found, we have jumped - reset the prepend item count.
9841
9848
  firstMessageId.current = currentFirstMessageId;
9849
+ previousNumItemsPrepended.current = 0;
9842
9850
  return 0;
9843
9851
  // TODO: there's a bug here, the messages prop is the same array instance (something mutates it)
9844
9852
  // that's why the second dependency is necessary