stream-chat 8.13.0 → 8.14.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
@@ -1344,6 +1344,10 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
1344
1344
  var newParams = [];
1345
1345
 
1346
1346
  for (var k in params) {
1347
+ // Stream backend doesn't treat "undefined" value same as value not being present.
1348
+ // So, we need to skip the undefined values.
1349
+ if (params[k] === undefined) continue;
1350
+
1347
1351
  if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
1348
1352
  newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1349
1353
  } else {
@@ -1385,12 +1389,6 @@ var Channel = /*#__PURE__*/function () {
1385
1389
  * Static state indicates that channel exists on backend, but is not being watched yet.
1386
1390
  */
1387
1391
 
1388
- /**
1389
- * Collects the incoming WS events before the channel is marked as initialized.
1390
- * This prevents executing procedures that depend on channel being initialized.
1391
- * Once the channel is marked as initialized the queue is flushed.
1392
- */
1393
-
1394
1392
  /**
1395
1393
  * constructor - Create a channel
1396
1394
  *
@@ -1434,8 +1432,6 @@ var Channel = /*#__PURE__*/function () {
1434
1432
 
1435
1433
  _defineProperty__default['default'](this, "disconnected", void 0);
1436
1434
 
1437
- _defineProperty__default['default'](this, "wsEventQueue", void 0);
1438
-
1439
1435
  _defineProperty__default['default'](this, "create", /*#__PURE__*/function () {
1440
1436
  var _ref = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(options) {
1441
1437
  var defaultOptions;
@@ -1525,7 +1521,6 @@ var Channel = /*#__PURE__*/function () {
1525
1521
  this.lastTypingEvent = null;
1526
1522
  this.isTyping = false;
1527
1523
  this.disconnected = false;
1528
- this.wsEventQueue = [];
1529
1524
  }
1530
1525
  /**
1531
1526
  * getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
@@ -2929,9 +2924,6 @@ var Channel = /*#__PURE__*/function () {
2929
2924
  case 7:
2930
2925
  state = _context28.sent;
2931
2926
  this.initialized = true;
2932
-
2933
- this._flushWsEventQueue();
2934
-
2935
2927
  this.data = state.channel;
2936
2928
 
2937
2929
  this._client.logger('info', "channel:watch() - started watching channel ".concat(this.cid), {
@@ -2941,7 +2933,7 @@ var Channel = /*#__PURE__*/function () {
2941
2933
 
2942
2934
  return _context28.abrupt("return", state);
2943
2935
 
2944
- case 13:
2936
+ case 12:
2945
2937
  case "end":
2946
2938
  return _context28.stop();
2947
2939
  }
@@ -3664,11 +3656,6 @@ var Channel = /*#__PURE__*/function () {
3664
3656
 
3665
3657
  var channel = this;
3666
3658
 
3667
- if (!this._isInitialized()) {
3668
- this.wsEventQueue.push(event);
3669
- return;
3670
- }
3671
-
3672
3659
  this._client.logger('info', "channel:_handleChannelEvent - Received event of type { ".concat(event.type, " } on ").concat(this.cid), {
3673
3660
  tags: ['event', 'channel'],
3674
3661
  channel: this
@@ -3919,11 +3906,6 @@ var Channel = /*#__PURE__*/function () {
3919
3906
  channel.state.watcher_count = event.watcher_count;
3920
3907
  }
3921
3908
  }
3922
- }, {
3923
- key: "_isInitialized",
3924
- value: function _isInitialized() {
3925
- return this.initialized || this.offlineMode || this.getClient()._isUsingServerAuth();
3926
- }
3927
3909
  }, {
3928
3910
  key: "_checkInitialized",
3929
3911
  value: function _checkInitialized() {
@@ -4085,14 +4067,6 @@ var Channel = /*#__PURE__*/function () {
4085
4067
  this.disconnected = true;
4086
4068
  this.state.setIsUpToDate(false);
4087
4069
  }
4088
- }, {
4089
- key: "_flushWsEventQueue",
4090
- value: function _flushWsEventQueue() {
4091
- while (this.wsEventQueue.length) {
4092
- var event = this.wsEventQueue.shift();
4093
- if (event) this.getClient().dispatchEvent(event);
4094
- }
4095
- }
4096
4070
  }]);
4097
4071
 
4098
4072
  return Channel;
@@ -10188,7 +10162,7 @@ var StreamChat = /*#__PURE__*/function () {
10188
10162
  }, {
10189
10163
  key: "getUserAgent",
10190
10164
  value: function getUserAgent() {
10191
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.13.0");
10165
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.14.0");
10192
10166
  }
10193
10167
  }, {
10194
10168
  key: "setUserAgent",
@@ -11582,30 +11556,6 @@ var EVENT_MAP = {
11582
11556
  'connection.changed': true,
11583
11557
  'connection.recovered': true,
11584
11558
  'transport.changed': true
11585
- }; // events handled by channel._handleChannelEvent
11586
-
11587
- var CHANNEL_HANDLED_EVENTS = {
11588
- 'typing.start': true,
11589
- 'typing.stop': true,
11590
- 'message.read': true,
11591
- 'user.watching.start': true,
11592
- 'user.updated': true,
11593
- 'user.watching.stop': true,
11594
- 'message.deleted': true,
11595
- 'message.new': true,
11596
- 'message.updated': true,
11597
- 'channel.truncated': true,
11598
- 'member.added': true,
11599
- 'member.updated': true,
11600
- 'member.removed': true,
11601
- 'channel.updated': true,
11602
- 'reaction.new': true,
11603
- 'reaction.deleted': true,
11604
- 'reaction.updated': true,
11605
- 'channel.hidden': true,
11606
- 'channel.visible': true,
11607
- 'user.banned': true,
11608
- 'user.unbanned': true
11609
11559
  };
11610
11560
 
11611
11561
  var Allow = 'Allow';
@@ -11688,7 +11638,6 @@ exports.AnyResource = AnyResource;
11688
11638
  exports.AnyRole = AnyRole;
11689
11639
  exports.BuiltinPermissions = BuiltinPermissions;
11690
11640
  exports.BuiltinRoles = BuiltinRoles;
11691
- exports.CHANNEL_HANDLED_EVENTS = CHANNEL_HANDLED_EVENTS;
11692
11641
  exports.Channel = Channel;
11693
11642
  exports.ChannelState = ChannelState;
11694
11643
  exports.CheckSignature = CheckSignature;