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