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