stream-chat 8.29.0 → 8.31.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/index.es.js CHANGED
@@ -162,6 +162,7 @@ function isOwnUserBaseProperty(property) {
162
162
  unread_count: true,
163
163
  unread_threads: true,
164
164
  invisible: true,
165
+ privacy_settings: true,
165
166
  roles: true
166
167
  };
167
168
  return ownUserBaseProperties[property];
@@ -2799,14 +2800,12 @@ var Channel = /*#__PURE__*/function () {
2799
2800
  key: "keystroke",
2800
2801
  value: function () {
2801
2802
  var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id, options) {
2802
- var _this$getConfig;
2803
-
2804
2803
  var now, diff;
2805
2804
  return _regeneratorRuntime.wrap(function _callee24$(_context24) {
2806
2805
  while (1) {
2807
2806
  switch (_context24.prev = _context24.next) {
2808
2807
  case 0:
2809
- if ((_this$getConfig = this.getConfig()) !== null && _this$getConfig !== void 0 && _this$getConfig.typing_events) {
2808
+ if (this._isTypingIndicatorsEnabled()) {
2810
2809
  _context24.next = 2;
2811
2810
  break;
2812
2811
  }
@@ -2855,13 +2854,11 @@ var Channel = /*#__PURE__*/function () {
2855
2854
  key: "stopTyping",
2856
2855
  value: function () {
2857
2856
  var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id, options) {
2858
- var _this$getConfig2;
2859
-
2860
2857
  return _regeneratorRuntime.wrap(function _callee25$(_context25) {
2861
2858
  while (1) {
2862
2859
  switch (_context25.prev = _context25.next) {
2863
2860
  case 0:
2864
- if ((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.typing_events) {
2861
+ if (this._isTypingIndicatorsEnabled()) {
2865
2862
  _context25.next = 2;
2866
2863
  break;
2867
2864
  }
@@ -2891,6 +2888,17 @@ var Channel = /*#__PURE__*/function () {
2891
2888
 
2892
2889
  return stopTyping;
2893
2890
  }()
2891
+ }, {
2892
+ key: "_isTypingIndicatorsEnabled",
2893
+ value: function _isTypingIndicatorsEnabled() {
2894
+ var _this$getConfig, _this$getClient$user$, _this$getClient$user, _this$getClient$user$2, _this$getClient$user$3;
2895
+
2896
+ if (!((_this$getConfig = this.getConfig()) !== null && _this$getConfig !== void 0 && _this$getConfig.typing_events)) {
2897
+ return false;
2898
+ }
2899
+
2900
+ return (_this$getClient$user$ = (_this$getClient$user = this.getClient().user) === null || _this$getClient$user === void 0 ? void 0 : (_this$getClient$user$2 = _this$getClient$user.privacy_settings) === null || _this$getClient$user$2 === void 0 ? void 0 : (_this$getClient$user$3 = _this$getClient$user$2.typing_indicators) === null || _this$getClient$user$3 === void 0 ? void 0 : _this$getClient$user$3.enabled) !== null && _this$getClient$user$ !== void 0 ? _this$getClient$user$ : true;
2901
+ }
2894
2902
  /**
2895
2903
  * lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted
2896
2904
  *
@@ -2927,7 +2935,7 @@ var Channel = /*#__PURE__*/function () {
2927
2935
  key: "markRead",
2928
2936
  value: function () {
2929
2937
  var _markRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
2930
- var _this$getConfig3;
2938
+ var _this$getConfig2;
2931
2939
 
2932
2940
  var data,
2933
2941
  _args26 = arguments;
@@ -2939,7 +2947,7 @@ var Channel = /*#__PURE__*/function () {
2939
2947
 
2940
2948
  this._checkInitialized();
2941
2949
 
2942
- if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2950
+ if (!(!((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.read_events) && !this.getClient()._isUsingServerAuth())) {
2943
2951
  _context26.next = 4;
2944
2952
  break;
2945
2953
  }
@@ -2978,7 +2986,7 @@ var Channel = /*#__PURE__*/function () {
2978
2986
  key: "markUnread",
2979
2987
  value: function () {
2980
2988
  var _markUnread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(data) {
2981
- var _this$getConfig4;
2989
+ var _this$getConfig3;
2982
2990
 
2983
2991
  return _regeneratorRuntime.wrap(function _callee27$(_context27) {
2984
2992
  while (1) {
@@ -2986,7 +2994,7 @@ var Channel = /*#__PURE__*/function () {
2986
2994
  case 0:
2987
2995
  this._checkInitialized();
2988
2996
 
2989
- if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
2997
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2990
2998
  _context27.next = 3;
2991
2999
  break;
2992
3000
  }
@@ -3906,7 +3914,7 @@ var Channel = /*#__PURE__*/function () {
3906
3914
 
3907
3915
  case 'message.read':
3908
3916
  if ((_event$user3 = event.user) !== null && _event$user3 !== void 0 && _event$user3.id && event.created_at) {
3909
- var _event$user4, _this$getClient$user;
3917
+ var _event$user4, _this$getClient$user2;
3910
3918
 
3911
3919
  channelState.read[event.user.id] = {
3912
3920
  last_read: new Date(event.created_at),
@@ -3915,7 +3923,7 @@ var Channel = /*#__PURE__*/function () {
3915
3923
  unread_messages: 0
3916
3924
  };
3917
3925
 
3918
- if (((_event$user4 = event.user) === null || _event$user4 === void 0 ? void 0 : _event$user4.id) === ((_this$getClient$user = this.getClient().user) === null || _this$getClient$user === void 0 ? void 0 : _this$getClient$user.id)) {
3926
+ if (((_event$user4 = event.user) === null || _event$user4 === void 0 ? void 0 : _event$user4.id) === ((_this$getClient$user2 = this.getClient().user) === null || _this$getClient$user2 === void 0 ? void 0 : _this$getClient$user2.id)) {
3919
3927
  channelState.unreadCount = 0;
3920
3928
  }
3921
3929
  }
@@ -3953,10 +3961,10 @@ var Channel = /*#__PURE__*/function () {
3953
3961
 
3954
3962
  case 'message.new':
3955
3963
  if (event.message) {
3956
- var _event$user7, _this$getClient$user2, _event$user8;
3964
+ var _event$user7, _this$getClient$user3, _event$user8;
3957
3965
 
3958
3966
  /* if message belongs to current user, always assume timestamp is changed to filter it out and add again to avoid duplication */
3959
- var ownMessage = ((_event$user7 = event.user) === null || _event$user7 === void 0 ? void 0 : _event$user7.id) === ((_this$getClient$user2 = this.getClient().user) === null || _this$getClient$user2 === void 0 ? void 0 : _this$getClient$user2.id);
3967
+ var ownMessage = ((_event$user7 = event.user) === null || _event$user7 === void 0 ? void 0 : _event$user7.id) === ((_this$getClient$user3 = this.getClient().user) === null || _this$getClient$user3 === void 0 ? void 0 : _this$getClient$user3.id);
3960
3968
  var isThreadMessage = event.message.parent_id && !event.message.show_in_channel;
3961
3969
 
3962
3970
  if (this.state.isUpToDate || isThreadMessage) {
@@ -4063,9 +4071,9 @@ var Channel = /*#__PURE__*/function () {
4063
4071
 
4064
4072
  case 'notification.mark_unread':
4065
4073
  {
4066
- var _event$user10, _this$getClient$user3, _event$unread_message;
4074
+ var _event$user10, _this$getClient$user4, _event$unread_message;
4067
4075
 
4068
- var _ownMessage = ((_event$user10 = event.user) === null || _event$user10 === void 0 ? void 0 : _event$user10.id) === ((_this$getClient$user3 = this.getClient().user) === null || _this$getClient$user3 === void 0 ? void 0 : _this$getClient$user3.id);
4076
+ var _ownMessage = ((_event$user10 = event.user) === null || _event$user10 === void 0 ? void 0 : _event$user10.id) === ((_this$getClient$user4 = this.getClient().user) === null || _this$getClient$user4 === void 0 ? void 0 : _this$getClient$user4.id);
4069
4077
 
4070
4078
  if (!(_ownMessage && event.user)) break;
4071
4079
  var unreadCount = (_event$unread_message = event.unread_messages) !== null && _event$unread_message !== void 0 ? _event$unread_message : 0;
@@ -11421,7 +11429,7 @@ var StreamChat = /*#__PURE__*/function () {
11421
11429
  }, {
11422
11430
  key: "getUserAgent",
11423
11431
  value: function getUserAgent() {
11424
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.29.0");
11432
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.31.0");
11425
11433
  }
11426
11434
  }, {
11427
11435
  key: "setUserAgent",