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.js CHANGED
@@ -190,6 +190,7 @@ function isOwnUserBaseProperty(property) {
190
190
  unread_count: true,
191
191
  unread_threads: true,
192
192
  invisible: true,
193
+ privacy_settings: true,
193
194
  roles: true
194
195
  };
195
196
  return ownUserBaseProperties[property];
@@ -2827,14 +2828,12 @@ var Channel = /*#__PURE__*/function () {
2827
2828
  key: "keystroke",
2828
2829
  value: function () {
2829
2830
  var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id, options) {
2830
- var _this$getConfig;
2831
-
2832
2831
  var now, diff;
2833
2832
  return _regeneratorRuntime__default['default'].wrap(function _callee24$(_context24) {
2834
2833
  while (1) {
2835
2834
  switch (_context24.prev = _context24.next) {
2836
2835
  case 0:
2837
- if ((_this$getConfig = this.getConfig()) !== null && _this$getConfig !== void 0 && _this$getConfig.typing_events) {
2836
+ if (this._isTypingIndicatorsEnabled()) {
2838
2837
  _context24.next = 2;
2839
2838
  break;
2840
2839
  }
@@ -2883,13 +2882,11 @@ var Channel = /*#__PURE__*/function () {
2883
2882
  key: "stopTyping",
2884
2883
  value: function () {
2885
2884
  var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id, options) {
2886
- var _this$getConfig2;
2887
-
2888
2885
  return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
2889
2886
  while (1) {
2890
2887
  switch (_context25.prev = _context25.next) {
2891
2888
  case 0:
2892
- if ((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.typing_events) {
2889
+ if (this._isTypingIndicatorsEnabled()) {
2893
2890
  _context25.next = 2;
2894
2891
  break;
2895
2892
  }
@@ -2919,6 +2916,17 @@ var Channel = /*#__PURE__*/function () {
2919
2916
 
2920
2917
  return stopTyping;
2921
2918
  }()
2919
+ }, {
2920
+ key: "_isTypingIndicatorsEnabled",
2921
+ value: function _isTypingIndicatorsEnabled() {
2922
+ var _this$getConfig, _this$getClient$user$, _this$getClient$user, _this$getClient$user$2, _this$getClient$user$3;
2923
+
2924
+ if (!((_this$getConfig = this.getConfig()) !== null && _this$getConfig !== void 0 && _this$getConfig.typing_events)) {
2925
+ return false;
2926
+ }
2927
+
2928
+ 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;
2929
+ }
2922
2930
  /**
2923
2931
  * lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted
2924
2932
  *
@@ -2955,7 +2963,7 @@ var Channel = /*#__PURE__*/function () {
2955
2963
  key: "markRead",
2956
2964
  value: function () {
2957
2965
  var _markRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee26() {
2958
- var _this$getConfig3;
2966
+ var _this$getConfig2;
2959
2967
 
2960
2968
  var data,
2961
2969
  _args26 = arguments;
@@ -2967,7 +2975,7 @@ var Channel = /*#__PURE__*/function () {
2967
2975
 
2968
2976
  this._checkInitialized();
2969
2977
 
2970
- if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2978
+ if (!(!((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.read_events) && !this.getClient()._isUsingServerAuth())) {
2971
2979
  _context26.next = 4;
2972
2980
  break;
2973
2981
  }
@@ -3006,7 +3014,7 @@ var Channel = /*#__PURE__*/function () {
3006
3014
  key: "markUnread",
3007
3015
  value: function () {
3008
3016
  var _markUnread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee27(data) {
3009
- var _this$getConfig4;
3017
+ var _this$getConfig3;
3010
3018
 
3011
3019
  return _regeneratorRuntime__default['default'].wrap(function _callee27$(_context27) {
3012
3020
  while (1) {
@@ -3014,7 +3022,7 @@ var Channel = /*#__PURE__*/function () {
3014
3022
  case 0:
3015
3023
  this._checkInitialized();
3016
3024
 
3017
- if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
3025
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
3018
3026
  _context27.next = 3;
3019
3027
  break;
3020
3028
  }
@@ -3934,7 +3942,7 @@ var Channel = /*#__PURE__*/function () {
3934
3942
 
3935
3943
  case 'message.read':
3936
3944
  if ((_event$user3 = event.user) !== null && _event$user3 !== void 0 && _event$user3.id && event.created_at) {
3937
- var _event$user4, _this$getClient$user;
3945
+ var _event$user4, _this$getClient$user2;
3938
3946
 
3939
3947
  channelState.read[event.user.id] = {
3940
3948
  last_read: new Date(event.created_at),
@@ -3943,7 +3951,7 @@ var Channel = /*#__PURE__*/function () {
3943
3951
  unread_messages: 0
3944
3952
  };
3945
3953
 
3946
- 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)) {
3954
+ 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)) {
3947
3955
  channelState.unreadCount = 0;
3948
3956
  }
3949
3957
  }
@@ -3981,10 +3989,10 @@ var Channel = /*#__PURE__*/function () {
3981
3989
 
3982
3990
  case 'message.new':
3983
3991
  if (event.message) {
3984
- var _event$user7, _this$getClient$user2, _event$user8;
3992
+ var _event$user7, _this$getClient$user3, _event$user8;
3985
3993
 
3986
3994
  /* if message belongs to current user, always assume timestamp is changed to filter it out and add again to avoid duplication */
3987
- 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);
3995
+ 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);
3988
3996
  var isThreadMessage = event.message.parent_id && !event.message.show_in_channel;
3989
3997
 
3990
3998
  if (this.state.isUpToDate || isThreadMessage) {
@@ -4091,9 +4099,9 @@ var Channel = /*#__PURE__*/function () {
4091
4099
 
4092
4100
  case 'notification.mark_unread':
4093
4101
  {
4094
- var _event$user10, _this$getClient$user3, _event$unread_message;
4102
+ var _event$user10, _this$getClient$user4, _event$unread_message;
4095
4103
 
4096
- 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);
4104
+ 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);
4097
4105
 
4098
4106
  if (!(_ownMessage && event.user)) break;
4099
4107
  var unreadCount = (_event$unread_message = event.unread_messages) !== null && _event$unread_message !== void 0 ? _event$unread_message : 0;
@@ -11449,7 +11457,7 @@ var StreamChat = /*#__PURE__*/function () {
11449
11457
  }, {
11450
11458
  key: "getUserAgent",
11451
11459
  value: function getUserAgent() {
11452
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.29.0");
11460
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.31.0");
11453
11461
  }
11454
11462
  }, {
11455
11463
  key: "setUserAgent",