stream-chat 8.8.0 → 8.10.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.
@@ -553,9 +553,9 @@ var ChannelState = /*#__PURE__*/function () {
553
553
  var _m$pinned_at, _m$updated_at;
554
554
 
555
555
  return _objectSpread$6(_objectSpread$6({}, m), {}, {
556
- created_at: m.created_at.toString(),
557
- pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toString(),
558
- updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toString()
556
+ created_at: m.created_at.toISOString(),
557
+ pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
558
+ updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
559
559
  });
560
560
  };
561
561
 
@@ -1510,7 +1510,8 @@ var Channel = /*#__PURE__*/function () {
1510
1510
  * @param {Message<StreamChatGenerics>} message The Message object
1511
1511
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1512
1512
  * @param {boolean} [options.skip_push] Skip sending push notifications
1513
- * @param {boolean} [options.is_pending_message] Make this message pending
1513
+ * @param {boolean} [options.is_pending_message] DEPRECATED, please use `pending` instead.
1514
+ * @param {boolean} [options.pending] Make this message pending
1514
1515
  * @param {Record<string,string>} [options.pending_message_metadata] Metadata for the pending message
1515
1516
  * @param {boolean} [options.force_moderation] Apply force moderation for server-side requests
1516
1517
  *
@@ -1526,26 +1527,18 @@ var Channel = /*#__PURE__*/function () {
1526
1527
  while (1) {
1527
1528
  switch (_context2.prev = _context2.next) {
1528
1529
  case 0:
1529
- if (!((options === null || options === void 0 ? void 0 : options.is_pending_message) !== undefined && !this._client._isUsingServerAuth())) {
1530
- _context2.next = 2;
1531
- break;
1532
- }
1533
-
1534
- throw new Error('Setting is_pending_message on client side is not supported');
1535
-
1536
- case 2:
1537
- _context2.next = 4;
1530
+ _context2.next = 2;
1538
1531
  return this.getClient().post(this._channelURL() + '/message', _objectSpread$5({
1539
1532
  message: message
1540
1533
  }, options));
1541
1534
 
1542
- case 4:
1535
+ case 2:
1543
1536
  sendMessageResponse = _context2.sent;
1544
1537
  // Reset unreadCount to 0.
1545
1538
  this.state.unreadCount = 0;
1546
1539
  return _context2.abrupt("return", sendMessageResponse);
1547
1540
 
1548
- case 7:
1541
+ case 5:
1549
1542
  case "end":
1550
1543
  return _context2.stop();
1551
1544
  }
@@ -3615,7 +3608,7 @@ var Channel = /*#__PURE__*/function () {
3615
3608
  }, {
3616
3609
  key: "_handleChannelEvent",
3617
3610
  value: function _handleChannelEvent(event) {
3618
- var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9;
3611
+ var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9, _event$user10, _channelState$members, _event$user11, _channelState$members2;
3619
3612
 
3620
3613
  var channel = this;
3621
3614
 
@@ -3828,11 +3821,39 @@ var Channel = /*#__PURE__*/function () {
3828
3821
  break;
3829
3822
 
3830
3823
  case 'channel.hidden':
3824
+ channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3825
+ hidden: true
3826
+ });
3827
+
3831
3828
  if (event.clear_history) {
3832
3829
  channelState.clearMessages();
3833
3830
  }
3834
3831
 
3835
3832
  break;
3833
+
3834
+ case 'channel.visible':
3835
+ channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3836
+ hidden: false
3837
+ });
3838
+ break;
3839
+
3840
+ case 'user.banned':
3841
+ if (!((_event$user10 = event.user) !== null && _event$user10 !== void 0 && _event$user10.id)) break;
3842
+ channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3843
+ shadow_banned: !!event.shadow,
3844
+ banned: !event.shadow,
3845
+ user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3846
+ });
3847
+ break;
3848
+
3849
+ case 'user.unbanned':
3850
+ if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3851
+ channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3852
+ shadow_banned: false,
3853
+ banned: false,
3854
+ user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3855
+ });
3856
+ break;
3836
3857
  } // any event can send over the online count
3837
3858
 
3838
3859
 
@@ -10054,7 +10075,7 @@ var StreamChat = /*#__PURE__*/function () {
10054
10075
  }, {
10055
10076
  key: "getUserAgent",
10056
10077
  value: function getUserAgent() {
10057
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.8.0");
10078
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.10.0");
10058
10079
  }
10059
10080
  }, {
10060
10081
  key: "setUserAgent",