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/browser.js CHANGED
@@ -186,6 +186,7 @@ function isOwnUserBaseProperty(property) {
186
186
  unread_count: true,
187
187
  unread_threads: true,
188
188
  invisible: true,
189
+ privacy_settings: true,
189
190
  roles: true
190
191
  };
191
192
  return ownUserBaseProperties[property];
@@ -2823,14 +2824,12 @@ var Channel = /*#__PURE__*/function () {
2823
2824
  key: "keystroke",
2824
2825
  value: function () {
2825
2826
  var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id, options) {
2826
- var _this$getConfig;
2827
-
2828
2827
  var now, diff;
2829
2828
  return _regeneratorRuntime__default['default'].wrap(function _callee24$(_context24) {
2830
2829
  while (1) {
2831
2830
  switch (_context24.prev = _context24.next) {
2832
2831
  case 0:
2833
- if ((_this$getConfig = this.getConfig()) !== null && _this$getConfig !== void 0 && _this$getConfig.typing_events) {
2832
+ if (this._isTypingIndicatorsEnabled()) {
2834
2833
  _context24.next = 2;
2835
2834
  break;
2836
2835
  }
@@ -2879,13 +2878,11 @@ var Channel = /*#__PURE__*/function () {
2879
2878
  key: "stopTyping",
2880
2879
  value: function () {
2881
2880
  var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id, options) {
2882
- var _this$getConfig2;
2883
-
2884
2881
  return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
2885
2882
  while (1) {
2886
2883
  switch (_context25.prev = _context25.next) {
2887
2884
  case 0:
2888
- if ((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.typing_events) {
2885
+ if (this._isTypingIndicatorsEnabled()) {
2889
2886
  _context25.next = 2;
2890
2887
  break;
2891
2888
  }
@@ -2915,6 +2912,17 @@ var Channel = /*#__PURE__*/function () {
2915
2912
 
2916
2913
  return stopTyping;
2917
2914
  }()
2915
+ }, {
2916
+ key: "_isTypingIndicatorsEnabled",
2917
+ value: function _isTypingIndicatorsEnabled() {
2918
+ var _this$getConfig, _this$getClient$user$, _this$getClient$user, _this$getClient$user$2, _this$getClient$user$3;
2919
+
2920
+ if (!((_this$getConfig = this.getConfig()) !== null && _this$getConfig !== void 0 && _this$getConfig.typing_events)) {
2921
+ return false;
2922
+ }
2923
+
2924
+ 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;
2925
+ }
2918
2926
  /**
2919
2927
  * lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted
2920
2928
  *
@@ -2951,7 +2959,7 @@ var Channel = /*#__PURE__*/function () {
2951
2959
  key: "markRead",
2952
2960
  value: function () {
2953
2961
  var _markRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee26() {
2954
- var _this$getConfig3;
2962
+ var _this$getConfig2;
2955
2963
 
2956
2964
  var data,
2957
2965
  _args26 = arguments;
@@ -2963,7 +2971,7 @@ var Channel = /*#__PURE__*/function () {
2963
2971
 
2964
2972
  this._checkInitialized();
2965
2973
 
2966
- if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2974
+ if (!(!((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.read_events) && !this.getClient()._isUsingServerAuth())) {
2967
2975
  _context26.next = 4;
2968
2976
  break;
2969
2977
  }
@@ -3002,7 +3010,7 @@ var Channel = /*#__PURE__*/function () {
3002
3010
  key: "markUnread",
3003
3011
  value: function () {
3004
3012
  var _markUnread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee27(data) {
3005
- var _this$getConfig4;
3013
+ var _this$getConfig3;
3006
3014
 
3007
3015
  return _regeneratorRuntime__default['default'].wrap(function _callee27$(_context27) {
3008
3016
  while (1) {
@@ -3010,7 +3018,7 @@ var Channel = /*#__PURE__*/function () {
3010
3018
  case 0:
3011
3019
  this._checkInitialized();
3012
3020
 
3013
- if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
3021
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
3014
3022
  _context27.next = 3;
3015
3023
  break;
3016
3024
  }
@@ -3930,7 +3938,7 @@ var Channel = /*#__PURE__*/function () {
3930
3938
 
3931
3939
  case 'message.read':
3932
3940
  if ((_event$user3 = event.user) !== null && _event$user3 !== void 0 && _event$user3.id && event.created_at) {
3933
- var _event$user4, _this$getClient$user;
3941
+ var _event$user4, _this$getClient$user2;
3934
3942
 
3935
3943
  channelState.read[event.user.id] = {
3936
3944
  last_read: new Date(event.created_at),
@@ -3939,7 +3947,7 @@ var Channel = /*#__PURE__*/function () {
3939
3947
  unread_messages: 0
3940
3948
  };
3941
3949
 
3942
- 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)) {
3950
+ 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)) {
3943
3951
  channelState.unreadCount = 0;
3944
3952
  }
3945
3953
  }
@@ -3977,10 +3985,10 @@ var Channel = /*#__PURE__*/function () {
3977
3985
 
3978
3986
  case 'message.new':
3979
3987
  if (event.message) {
3980
- var _event$user7, _this$getClient$user2, _event$user8;
3988
+ var _event$user7, _this$getClient$user3, _event$user8;
3981
3989
 
3982
3990
  /* if message belongs to current user, always assume timestamp is changed to filter it out and add again to avoid duplication */
3983
- 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);
3991
+ 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);
3984
3992
  var isThreadMessage = event.message.parent_id && !event.message.show_in_channel;
3985
3993
 
3986
3994
  if (this.state.isUpToDate || isThreadMessage) {
@@ -4087,9 +4095,9 @@ var Channel = /*#__PURE__*/function () {
4087
4095
 
4088
4096
  case 'notification.mark_unread':
4089
4097
  {
4090
- var _event$user10, _this$getClient$user3, _event$unread_message;
4098
+ var _event$user10, _this$getClient$user4, _event$unread_message;
4091
4099
 
4092
- 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);
4100
+ 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);
4093
4101
 
4094
4102
  if (!(_ownMessage && event.user)) break;
4095
4103
  var unreadCount = (_event$unread_message = event.unread_messages) !== null && _event$unread_message !== void 0 ? _event$unread_message : 0;
@@ -11443,7 +11451,7 @@ var StreamChat = /*#__PURE__*/function () {
11443
11451
  }, {
11444
11452
  key: "getUserAgent",
11445
11453
  value: function getUserAgent() {
11446
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.29.0");
11454
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.31.0");
11447
11455
  }
11448
11456
  }, {
11449
11457
  key: "setUserAgent",