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/browser.js CHANGED
@@ -1340,6 +1340,10 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
1340
1340
  var newParams = [];
1341
1341
 
1342
1342
  for (var k in params) {
1343
+ // Stream backend doesn't treat "undefined" value same as value not being present.
1344
+ // So, we need to skip the undefined values.
1345
+ if (params[k] === undefined) continue;
1346
+
1343
1347
  if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
1344
1348
  newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1345
1349
  } else {
@@ -1381,12 +1385,6 @@ var Channel = /*#__PURE__*/function () {
1381
1385
  * Static state indicates that channel exists on backend, but is not being watched yet.
1382
1386
  */
1383
1387
 
1384
- /**
1385
- * Collects the incoming WS events before the channel is marked as initialized.
1386
- * This prevents executing procedures that depend on channel being initialized.
1387
- * Once the channel is marked as initialized the queue is flushed.
1388
- */
1389
-
1390
1388
  /**
1391
1389
  * constructor - Create a channel
1392
1390
  *
@@ -1430,8 +1428,6 @@ var Channel = /*#__PURE__*/function () {
1430
1428
 
1431
1429
  _defineProperty__default['default'](this, "disconnected", void 0);
1432
1430
 
1433
- _defineProperty__default['default'](this, "wsEventQueue", void 0);
1434
-
1435
1431
  _defineProperty__default['default'](this, "create", /*#__PURE__*/function () {
1436
1432
  var _ref = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(options) {
1437
1433
  var defaultOptions;
@@ -1521,7 +1517,6 @@ var Channel = /*#__PURE__*/function () {
1521
1517
  this.lastTypingEvent = null;
1522
1518
  this.isTyping = false;
1523
1519
  this.disconnected = false;
1524
- this.wsEventQueue = [];
1525
1520
  }
1526
1521
  /**
1527
1522
  * getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
@@ -2925,9 +2920,6 @@ var Channel = /*#__PURE__*/function () {
2925
2920
  case 7:
2926
2921
  state = _context28.sent;
2927
2922
  this.initialized = true;
2928
-
2929
- this._flushWsEventQueue();
2930
-
2931
2923
  this.data = state.channel;
2932
2924
 
2933
2925
  this._client.logger('info', "channel:watch() - started watching channel ".concat(this.cid), {
@@ -2937,7 +2929,7 @@ var Channel = /*#__PURE__*/function () {
2937
2929
 
2938
2930
  return _context28.abrupt("return", state);
2939
2931
 
2940
- case 13:
2932
+ case 12:
2941
2933
  case "end":
2942
2934
  return _context28.stop();
2943
2935
  }
@@ -3660,11 +3652,6 @@ var Channel = /*#__PURE__*/function () {
3660
3652
 
3661
3653
  var channel = this;
3662
3654
 
3663
- if (!this._isInitialized()) {
3664
- this.wsEventQueue.push(event);
3665
- return;
3666
- }
3667
-
3668
3655
  this._client.logger('info', "channel:_handleChannelEvent - Received event of type { ".concat(event.type, " } on ").concat(this.cid), {
3669
3656
  tags: ['event', 'channel'],
3670
3657
  channel: this
@@ -3915,11 +3902,6 @@ var Channel = /*#__PURE__*/function () {
3915
3902
  channel.state.watcher_count = event.watcher_count;
3916
3903
  }
3917
3904
  }
3918
- }, {
3919
- key: "_isInitialized",
3920
- value: function _isInitialized() {
3921
- return this.initialized || this.offlineMode || this.getClient()._isUsingServerAuth();
3922
- }
3923
3905
  }, {
3924
3906
  key: "_checkInitialized",
3925
3907
  value: function _checkInitialized() {
@@ -4081,14 +4063,6 @@ var Channel = /*#__PURE__*/function () {
4081
4063
  this.disconnected = true;
4082
4064
  this.state.setIsUpToDate(false);
4083
4065
  }
4084
- }, {
4085
- key: "_flushWsEventQueue",
4086
- value: function _flushWsEventQueue() {
4087
- while (this.wsEventQueue.length) {
4088
- var event = this.wsEventQueue.shift();
4089
- if (event) this.getClient().dispatchEvent(event);
4090
- }
4091
- }
4092
4066
  }]);
4093
4067
 
4094
4068
  return Channel;
@@ -10182,7 +10156,7 @@ var StreamChat = /*#__PURE__*/function () {
10182
10156
  }, {
10183
10157
  key: "getUserAgent",
10184
10158
  value: function getUserAgent() {
10185
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.13.0");
10159
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.14.0");
10186
10160
  }
10187
10161
  }, {
10188
10162
  key: "setUserAgent",
@@ -11576,30 +11550,6 @@ var EVENT_MAP = {
11576
11550
  'connection.changed': true,
11577
11551
  'connection.recovered': true,
11578
11552
  'transport.changed': true
11579
- }; // events handled by channel._handleChannelEvent
11580
-
11581
- var CHANNEL_HANDLED_EVENTS = {
11582
- 'typing.start': true,
11583
- 'typing.stop': true,
11584
- 'message.read': true,
11585
- 'user.watching.start': true,
11586
- 'user.updated': true,
11587
- 'user.watching.stop': true,
11588
- 'message.deleted': true,
11589
- 'message.new': true,
11590
- 'message.updated': true,
11591
- 'channel.truncated': true,
11592
- 'member.added': true,
11593
- 'member.updated': true,
11594
- 'member.removed': true,
11595
- 'channel.updated': true,
11596
- 'reaction.new': true,
11597
- 'reaction.deleted': true,
11598
- 'reaction.updated': true,
11599
- 'channel.hidden': true,
11600
- 'channel.visible': true,
11601
- 'user.banned': true,
11602
- 'user.unbanned': true
11603
11553
  };
11604
11554
 
11605
11555
  var Allow = 'Allow';
@@ -11682,7 +11632,6 @@ exports.AnyResource = AnyResource;
11682
11632
  exports.AnyRole = AnyRole;
11683
11633
  exports.BuiltinPermissions = BuiltinPermissions;
11684
11634
  exports.BuiltinRoles = BuiltinRoles;
11685
- exports.CHANNEL_HANDLED_EVENTS = CHANNEL_HANDLED_EVENTS;
11686
11635
  exports.Channel = Channel;
11687
11636
  exports.ChannelState = ChannelState;
11688
11637
  exports.CheckSignature = CheckSignature;