stream-chat-react 9.3.0 → 9.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE/D,eAAO,MAAM,YAAY,wCAOxB,CAAC;AAoBF,eAAO,MAAM,kBAAkB,YAAa,MAAM,sBAajD,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAa,MAAM,qBAIhD,CAAC;AAyBF,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,CAAA;CAwBtE,CAAC;AAEF,eAAO,MAAM,mBAAmB,gDAe/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,2LAmClC,CAAC;AAEF,oBAAY,YAAY,CACtB,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,cAAc,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;CAClD,CAAC;AAMF,oBAAY,iBAAiB,GAAG;IAC9B,uBAAuB,CAAC,EAAE;QACxB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC;KACvC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,UAAU,4LAKZ,iBAAiB,uBAiE3B,CAAC;AAEF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAAS,CAAC;AAGvC,eAAO,MAAM,YAAY,QAAS,MAAM,KAAK,MAAM,WAgClD,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE/D,eAAO,MAAM,YAAY,wCAOxB,CAAC;AAoBF,eAAO,MAAM,kBAAkB,YAAa,MAAM,sBAajD,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAa,MAAM,qBAIhD,CAAC;AAyBF,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,CAAA;CAwBtE,CAAC;AAEF,eAAO,MAAM,mBAAmB,gDAe/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,2LAmClC,CAAC;AAEF,oBAAY,YAAY,CACtB,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,cAAc,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;CAClD,CAAC;AAMF,oBAAY,iBAAiB,GAAG;IAC9B,uBAAuB,CAAC,EAAE;QACxB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC;KACvC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,UAAU,4LAKZ,iBAAiB,uBAmF3B,CAAC;AAEF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAAS,CAAC;AAGvC,eAAO,MAAM,YAAY,QAAS,MAAM,KAAK,MAAM,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
- //@ts-expect-error
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.3.0";
1
+ export declare const version = "9.4.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '9.3.0';
1
+ export var version = '9.4.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-react",
3
- "version": "9.3.0",
3
+ "version": "9.4.0",
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": "1.1.1",
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",
@@ -208,7 +209,8 @@
208
209
  "e2e-container": "./e2e/scripts/run_in_container.sh"
209
210
  },
210
211
  "resolutions": {
211
- "ast-types": "^0.14.0"
212
+ "ast-types": "^0.14.0",
213
+ "@types/unist": "^2.0.6"
212
214
  },
213
215
  "browserslist": [
214
216
  ">0.2%",