stream-chat-react 10.7.5 → 10.8.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.
@@ -12345,7 +12345,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
12345
12345
  return v instanceof DOMException && (v.name === "SecurityError" || v.code === v.SECURITY_ERR);
12346
12346
  }
12347
12347
 
12348
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var _excluded$2 = ["children"],
12348
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var _excluded$3 = ["children"],
12349
12349
  _excluded2$1 = ["open"],
12350
12350
  _excluded3$1 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
12351
12351
  _excluded4$1 = ["refKey", "onChange", "onClick"];
@@ -12376,7 +12376,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
12376
12376
 
12377
12377
  function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12378
12378
 
12379
- function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$3(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12379
+ function _objectWithoutProperties$2(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$3(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12380
12380
 
12381
12381
  function _objectWithoutPropertiesLoose$3(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12382
12382
  /**
@@ -12396,11 +12396,11 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
12396
12396
 
12397
12397
  var Dropzone$1 = /*#__PURE__*/React$2.forwardRef(function (_ref, ref) {
12398
12398
  var children = _ref.children,
12399
- params = _objectWithoutProperties$1(_ref, _excluded$2);
12399
+ params = _objectWithoutProperties$2(_ref, _excluded$3);
12400
12400
 
12401
12401
  var _useDropzone = useDropzone$1(params),
12402
12402
  open = _useDropzone.open,
12403
- props = _objectWithoutProperties$1(_useDropzone, _excluded2$1);
12403
+ props = _objectWithoutProperties$2(_useDropzone, _excluded2$1);
12404
12404
 
12405
12405
  React$2.useImperativeHandle(ref, function () {
12406
12406
  return {
@@ -13139,7 +13139,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
13139
13139
  onDragOver = _ref2.onDragOver,
13140
13140
  onDragLeave = _ref2.onDragLeave,
13141
13141
  onDrop = _ref2.onDrop,
13142
- rest = _objectWithoutProperties$1(_ref2, _excluded3$1);
13142
+ rest = _objectWithoutProperties$2(_ref2, _excluded3$1);
13143
13143
 
13144
13144
  return _objectSpread$4(_objectSpread$4(_defineProperty$2({
13145
13145
  onKeyDown: composeKeyboardHandler(composeEventHandlers$1(onKeyDown, onKeyDownCb)),
@@ -13166,7 +13166,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
13166
13166
  refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey,
13167
13167
  onChange = _ref3.onChange,
13168
13168
  onClick = _ref3.onClick,
13169
- rest = _objectWithoutProperties$1(_ref3, _excluded4$1);
13169
+ rest = _objectWithoutProperties$2(_ref3, _excluded4$1);
13170
13170
 
13171
13171
  var inputProps = _defineProperty$2({
13172
13172
  accept: accept,
@@ -37104,7 +37104,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
37104
37104
  return (React__default["default"].createElement(ReactMarkdown$1, { allowedElements: allowedMarkups$1, components: rehypeComponents, rehypePlugins: rehypePlugins, remarkPlugins: [[remarkGfm, { singleTilde: false }]], skipHtml: true, transformLinkUri: function (uri) { return (uri.startsWith('app://') ? uri : uriTransformer$2(uri)); }, unwrapDisallowed: true }, newText));
37105
37105
  };
37106
37106
  function escapeRegExp(text) {
37107
- return text.replace(/[-[\]{}()*+?.,\\^$|#]/g, '\\$&');
37107
+ return text.replace(/[-[\]{}()*+?.,/\\^$|#]/g, '\\$&');
37108
37108
  }
37109
37109
  /**
37110
37110
  * @deprecated will be removed in the next major release
@@ -37299,6 +37299,58 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
37299
37299
  }));
37300
37300
  };
37301
37301
 
37302
+ var objectWithoutProperties = {exports: {}};
37303
+
37304
+ var objectWithoutPropertiesLoose = {exports: {}};
37305
+
37306
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
37307
+ (function (module) {
37308
+ function _objectWithoutPropertiesLoose(source, excluded) {
37309
+ if (source == null) return {};
37310
+ var target = {};
37311
+ var sourceKeys = Object.keys(source);
37312
+ var key, i;
37313
+
37314
+ for (i = 0; i < sourceKeys.length; i++) {
37315
+ key = sourceKeys[i];
37316
+ if (excluded.indexOf(key) >= 0) continue;
37317
+ target[key] = source[key];
37318
+ }
37319
+
37320
+ return target;
37321
+ }
37322
+
37323
+ module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
37324
+ } (objectWithoutPropertiesLoose));
37325
+
37326
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
37327
+ (function (module) {
37328
+ var objectWithoutPropertiesLoose$1 = objectWithoutPropertiesLoose.exports;
37329
+
37330
+ function _objectWithoutProperties(source, excluded) {
37331
+ if (source == null) return {};
37332
+ var target = objectWithoutPropertiesLoose$1(source, excluded);
37333
+ var key, i;
37334
+
37335
+ if (Object.getOwnPropertySymbols) {
37336
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
37337
+
37338
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
37339
+ key = sourceSymbolKeys[i];
37340
+ if (excluded.indexOf(key) >= 0) continue;
37341
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
37342
+ target[key] = source[key];
37343
+ }
37344
+ }
37345
+
37346
+ return target;
37347
+ }
37348
+
37349
+ module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
37350
+ } (objectWithoutProperties));
37351
+
37352
+ var _objectWithoutProperties$1 = /*@__PURE__*/getDefaultExportFromCjs(objectWithoutProperties.exports);
37353
+
37302
37354
  var _extends$2 = {exports: {}};
37303
37355
 
37304
37356
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
@@ -37980,6 +38032,8 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
37980
38032
  };
37981
38033
  var CommandItem = React__default["default"].memo(UnMemoizedCommandItem);
37982
38034
 
38035
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
38036
+
37983
38037
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};/**
37984
38038
  * A round avatar image with fallback to username's first letter
37985
38039
  */
@@ -38035,7 +38089,10 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
38035
38089
  };
38036
38090
  var UserItem = React__default["default"].memo(UnMemoizedUserItem);
38037
38091
 
38038
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
38092
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
38093
+
38094
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var _excluded$2 = ["onBlur", "onChange", "onClick", "onFocus", "onKeyDown", "onScroll", "onSelect"];
38095
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
38039
38096
  function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { definePropertyExports(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
38040
38097
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOfExports(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOfExports(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturnExports(this, result); }; }
38041
38098
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -38543,6 +38600,15 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
38543
38600
  containerClassName = _this$props8.containerClassName,
38544
38601
  containerStyle = _this$props8.containerStyle,
38545
38602
  style = _this$props8.style;
38603
+ var _ref = this.props.additionalTextareaProps || {},
38604
+ _onBlur = _ref.onBlur,
38605
+ _onChange = _ref.onChange,
38606
+ _onClick = _ref.onClick,
38607
+ _onFocus = _ref.onFocus,
38608
+ _onKeyDown = _ref.onKeyDown,
38609
+ _onScroll = _ref.onScroll,
38610
+ _onSelect = _ref.onSelect,
38611
+ restAdditionalTextareaProps = _objectWithoutProperties$1(_ref, _excluded$2);
38546
38612
  var maxRows = this.props.maxRows;
38547
38613
  var _this$state7 = this.state,
38548
38614
  dataLoading = _this$state7.dataLoading,
@@ -38563,21 +38629,43 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
38563
38629
  }, this._cleanUpProps(), {
38564
38630
  className: clsx('rta__textarea', className),
38565
38631
  maxRows: maxRows,
38566
- onBlur: this._onClickAndBlurHandler,
38567
- onChange: this._changeHandler,
38568
- onClick: this._onClickAndBlurHandler,
38569
- onFocus: this.props.onFocus,
38570
- onKeyDown: this._handleKeyDown,
38571
- onScroll: this._onScrollHandler,
38572
- onSelect: this._selectHandler,
38573
- ref: function ref(_ref) {
38574
- var _this2$props;
38575
- (_this2$props = _this2.props) === null || _this2$props === void 0 ? void 0 : _this2$props.innerRef(_ref);
38576
- _this2.textareaRef = _ref;
38632
+ onBlur: function onBlur(e) {
38633
+ _this2._onClickAndBlurHandler(e);
38634
+ _onBlur === null || _onBlur === void 0 ? void 0 : _onBlur(e);
38635
+ },
38636
+ onChange: function onChange(e) {
38637
+ _this2._changeHandler(e);
38638
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(e);
38639
+ },
38640
+ onClick: function onClick(e) {
38641
+ _this2._onClickAndBlurHandler(e);
38642
+ _onClick === null || _onClick === void 0 ? void 0 : _onClick(e);
38643
+ },
38644
+ onFocus: function onFocus(e) {
38645
+ var _this2$props$onFocus, _this2$props;
38646
+ (_this2$props$onFocus = (_this2$props = _this2.props).onFocus) === null || _this2$props$onFocus === void 0 ? void 0 : _this2$props$onFocus.call(_this2$props, e);
38647
+ _onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(e);
38648
+ },
38649
+ onKeyDown: function onKeyDown(e) {
38650
+ _this2._handleKeyDown(e);
38651
+ _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
38652
+ },
38653
+ onScroll: function onScroll(e) {
38654
+ _this2._onScrollHandler(e);
38655
+ _onScroll === null || _onScroll === void 0 ? void 0 : _onScroll(e);
38656
+ },
38657
+ onSelect: function onSelect(e) {
38658
+ _this2._selectHandler(e);
38659
+ _onSelect === null || _onSelect === void 0 ? void 0 : _onSelect(e);
38660
+ },
38661
+ ref: function ref(_ref2) {
38662
+ var _this2$props2;
38663
+ (_this2$props2 = _this2.props) === null || _this2$props2 === void 0 ? void 0 : _this2$props2.innerRef(_ref2);
38664
+ _this2.textareaRef = _ref2;
38577
38665
  },
38578
38666
  style: style,
38579
38667
  value: value
38580
- }, this.props.additionalTextareaProps, {
38668
+ }, restAdditionalTextareaProps, {
38581
38669
  defaultValue: undefined
38582
38670
  })));
38583
38671
  }
@@ -45651,9 +45739,9 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
45651
45739
  * hook for MessageInput state
45652
45740
  */
45653
45741
  var useMessageInputState = function (props) {
45654
- var additionalTextareaProps = props.additionalTextareaProps, closeEmojiPickerOnClick = props.closeEmojiPickerOnClick, message = props.message;
45742
+ var additionalTextareaProps = props.additionalTextareaProps, closeEmojiPickerOnClick = props.closeEmojiPickerOnClick, getDefaultValue = props.getDefaultValue, message = props.message;
45655
45743
  var _a = useChannelStateContext('useMessageInputState'), _b = _a.channelCapabilities, channelCapabilities = _b === void 0 ? {} : _b, channelConfig = _a.channelConfig;
45656
- var defaultValue = additionalTextareaProps === null || additionalTextareaProps === void 0 ? void 0 : additionalTextareaProps.defaultValue;
45744
+ var defaultValue = (getDefaultValue === null || getDefaultValue === void 0 ? void 0 : getDefaultValue()) || (additionalTextareaProps === null || additionalTextareaProps === void 0 ? void 0 : additionalTextareaProps.defaultValue);
45657
45745
  var initialStateValue = message ||
45658
45746
  (Array.isArray(defaultValue)
45659
45747
  ? { text: defaultValue.join('') }
@@ -47471,16 +47559,37 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
47471
47559
  }, [customHandler]);
47472
47560
  };
47473
47561
 
47474
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var getChannel = function (client, type, id) { return __awaiter$1(void 0, void 0, void 0, function () {
47475
- var channel;
47562
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};/**
47563
+ * prevent from duplicate invocation of channel.watch()
47564
+ * when events 'notification.message_new' and 'notification.added_to_channel' arrive at the same time
47565
+ */
47566
+ var WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL = {};
47567
+ /**
47568
+ * Calls channel.watch() if it was not already recently called. Waits for watch promise to resolve even if it was invoked previously.
47569
+ * @param client
47570
+ * @param type
47571
+ * @param id
47572
+ */
47573
+ var getChannel = function (client, type, id) { return __awaiter$1(void 0, void 0, void 0, function () {
47574
+ var channel, queryPromise;
47476
47575
  return __generator$1(this, function (_a) {
47477
47576
  switch (_a.label) {
47478
47577
  case 0:
47479
47578
  channel = client.channel(type, id);
47480
- return [4 /*yield*/, channel.watch()];
47579
+ queryPromise = WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[channel.cid];
47580
+ if (!queryPromise) return [3 /*break*/, 2];
47581
+ return [4 /*yield*/, queryPromise];
47481
47582
  case 1:
47482
47583
  _a.sent();
47483
- return [2 /*return*/, channel];
47584
+ return [3 /*break*/, 4];
47585
+ case 2:
47586
+ WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[channel.cid] = channel.watch();
47587
+ return [4 /*yield*/, WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[channel.cid]];
47588
+ case 3:
47589
+ _a.sent();
47590
+ WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[channel.cid] = undefined;
47591
+ _a.label = 4;
47592
+ case 4: return [2 /*return*/, channel];
47484
47593
  }
47485
47594
  });
47486
47595
  }); };
@@ -48394,7 +48503,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
48394
48503
 
48395
48504
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
48396
48505
 
48397
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.7.5';
48506
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.8.0';
48398
48507
 
48399
48508
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
48400
48509
  var _b, _c;
@@ -48615,8 +48724,6 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
48615
48724
 
48616
48725
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
48617
48726
 
48618
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
48619
-
48620
48727
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var UnMemoizedDateSeparator = function (props) {
48621
48728
  var messageCreatedAt = props.date, formatDate = props.formatDate, _a = props.position, position = _a === void 0 ? 'right' : _a, unread = props.unread;
48622
48729
  var _b = useTranslationContext('DateSeparator'), t = _b.t, tDateTimeParser = _b.tDateTimeParser;
@@ -51653,8 +51760,6 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
51653
51760
 
51654
51761
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
51655
51762
 
51656
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
51657
-
51658
51763
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var UnMemoizedWindow = function (props) {
51659
51764
  var children = props.children, _a = props.hideOnThread, hideOnThread = _a === void 0 ? false : _a, propThread = props.thread;
51660
51765
  var contextThread = useChannelStateContext('Window').thread;