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.
@@ -1315,6 +1315,10 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
1315
1315
  var newParams = [];
1316
1316
 
1317
1317
  for (var k in params) {
1318
+ // Stream backend doesn't treat "undefined" value same as value not being present.
1319
+ // So, we need to skip the undefined values.
1320
+ if (params[k] === undefined) continue;
1321
+
1318
1322
  if (Array.isArray(params[k]) || _typeof(params[k]) === 'object') {
1319
1323
  newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1320
1324
  } else {
@@ -1356,12 +1360,6 @@ var Channel = /*#__PURE__*/function () {
1356
1360
  * Static state indicates that channel exists on backend, but is not being watched yet.
1357
1361
  */
1358
1362
 
1359
- /**
1360
- * Collects the incoming WS events before the channel is marked as initialized.
1361
- * This prevents executing procedures that depend on channel being initialized.
1362
- * Once the channel is marked as initialized the queue is flushed.
1363
- */
1364
-
1365
1363
  /**
1366
1364
  * constructor - Create a channel
1367
1365
  *
@@ -1405,8 +1403,6 @@ var Channel = /*#__PURE__*/function () {
1405
1403
 
1406
1404
  _defineProperty(this, "disconnected", void 0);
1407
1405
 
1408
- _defineProperty(this, "wsEventQueue", void 0);
1409
-
1410
1406
  _defineProperty(this, "create", /*#__PURE__*/function () {
1411
1407
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
1412
1408
  var defaultOptions;
@@ -1496,7 +1492,6 @@ var Channel = /*#__PURE__*/function () {
1496
1492
  this.lastTypingEvent = null;
1497
1493
  this.isTyping = false;
1498
1494
  this.disconnected = false;
1499
- this.wsEventQueue = [];
1500
1495
  }
1501
1496
  /**
1502
1497
  * getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
@@ -2900,9 +2895,6 @@ var Channel = /*#__PURE__*/function () {
2900
2895
  case 7:
2901
2896
  state = _context28.sent;
2902
2897
  this.initialized = true;
2903
-
2904
- this._flushWsEventQueue();
2905
-
2906
2898
  this.data = state.channel;
2907
2899
 
2908
2900
  this._client.logger('info', "channel:watch() - started watching channel ".concat(this.cid), {
@@ -2912,7 +2904,7 @@ var Channel = /*#__PURE__*/function () {
2912
2904
 
2913
2905
  return _context28.abrupt("return", state);
2914
2906
 
2915
- case 13:
2907
+ case 12:
2916
2908
  case "end":
2917
2909
  return _context28.stop();
2918
2910
  }
@@ -3635,11 +3627,6 @@ var Channel = /*#__PURE__*/function () {
3635
3627
 
3636
3628
  var channel = this;
3637
3629
 
3638
- if (!this._isInitialized()) {
3639
- this.wsEventQueue.push(event);
3640
- return;
3641
- }
3642
-
3643
3630
  this._client.logger('info', "channel:_handleChannelEvent - Received event of type { ".concat(event.type, " } on ").concat(this.cid), {
3644
3631
  tags: ['event', 'channel'],
3645
3632
  channel: this
@@ -3890,11 +3877,6 @@ var Channel = /*#__PURE__*/function () {
3890
3877
  channel.state.watcher_count = event.watcher_count;
3891
3878
  }
3892
3879
  }
3893
- }, {
3894
- key: "_isInitialized",
3895
- value: function _isInitialized() {
3896
- return this.initialized || this.offlineMode || this.getClient()._isUsingServerAuth();
3897
- }
3898
3880
  }, {
3899
3881
  key: "_checkInitialized",
3900
3882
  value: function _checkInitialized() {
@@ -4056,14 +4038,6 @@ var Channel = /*#__PURE__*/function () {
4056
4038
  this.disconnected = true;
4057
4039
  this.state.setIsUpToDate(false);
4058
4040
  }
4059
- }, {
4060
- key: "_flushWsEventQueue",
4061
- value: function _flushWsEventQueue() {
4062
- while (this.wsEventQueue.length) {
4063
- var event = this.wsEventQueue.shift();
4064
- if (event) this.getClient().dispatchEvent(event);
4065
- }
4066
- }
4067
4041
  }]);
4068
4042
 
4069
4043
  return Channel;
@@ -10157,7 +10131,7 @@ var StreamChat = /*#__PURE__*/function () {
10157
10131
  }, {
10158
10132
  key: "getUserAgent",
10159
10133
  value: function getUserAgent() {
10160
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.13.0");
10134
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.14.0");
10161
10135
  }
10162
10136
  }, {
10163
10137
  key: "setUserAgent",
@@ -11551,30 +11525,6 @@ var EVENT_MAP = {
11551
11525
  'connection.changed': true,
11552
11526
  'connection.recovered': true,
11553
11527
  'transport.changed': true
11554
- }; // events handled by channel._handleChannelEvent
11555
-
11556
- var CHANNEL_HANDLED_EVENTS = {
11557
- 'typing.start': true,
11558
- 'typing.stop': true,
11559
- 'message.read': true,
11560
- 'user.watching.start': true,
11561
- 'user.updated': true,
11562
- 'user.watching.stop': true,
11563
- 'message.deleted': true,
11564
- 'message.new': true,
11565
- 'message.updated': true,
11566
- 'channel.truncated': true,
11567
- 'member.added': true,
11568
- 'member.updated': true,
11569
- 'member.removed': true,
11570
- 'channel.updated': true,
11571
- 'reaction.new': true,
11572
- 'reaction.deleted': true,
11573
- 'reaction.updated': true,
11574
- 'channel.hidden': true,
11575
- 'channel.visible': true,
11576
- 'user.banned': true,
11577
- 'user.unbanned': true
11578
11528
  };
11579
11529
 
11580
11530
  var Allow = 'Allow';
@@ -11651,5 +11601,5 @@ var BuiltinPermissions = {
11651
11601
  UseFrozenChannel: 'Send messages and reactions to frozen channels'
11652
11602
  };
11653
11603
 
11654
- export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, CHANNEL_HANDLED_EVENTS, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
11604
+ export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
11655
11605
  //# sourceMappingURL=browser.es.js.map