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/browser.js CHANGED
@@ -578,9 +578,9 @@ var ChannelState = /*#__PURE__*/function () {
578
578
  var _m$pinned_at, _m$updated_at;
579
579
 
580
580
  return _objectSpread$6(_objectSpread$6({}, m), {}, {
581
- created_at: m.created_at.toString(),
582
- pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toString(),
583
- updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toString()
581
+ created_at: m.created_at.toISOString(),
582
+ pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
583
+ updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
584
584
  });
585
585
  };
586
586
 
@@ -1535,7 +1535,8 @@ var Channel = /*#__PURE__*/function () {
1535
1535
  * @param {Message<StreamChatGenerics>} message The Message object
1536
1536
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1537
1537
  * @param {boolean} [options.skip_push] Skip sending push notifications
1538
- * @param {boolean} [options.is_pending_message] Make this message pending
1538
+ * @param {boolean} [options.is_pending_message] DEPRECATED, please use `pending` instead.
1539
+ * @param {boolean} [options.pending] Make this message pending
1539
1540
  * @param {Record<string,string>} [options.pending_message_metadata] Metadata for the pending message
1540
1541
  * @param {boolean} [options.force_moderation] Apply force moderation for server-side requests
1541
1542
  *
@@ -1551,26 +1552,18 @@ var Channel = /*#__PURE__*/function () {
1551
1552
  while (1) {
1552
1553
  switch (_context2.prev = _context2.next) {
1553
1554
  case 0:
1554
- if (!((options === null || options === void 0 ? void 0 : options.is_pending_message) !== undefined && !this._client._isUsingServerAuth())) {
1555
- _context2.next = 2;
1556
- break;
1557
- }
1558
-
1559
- throw new Error('Setting is_pending_message on client side is not supported');
1560
-
1561
- case 2:
1562
- _context2.next = 4;
1555
+ _context2.next = 2;
1563
1556
  return this.getClient().post(this._channelURL() + '/message', _objectSpread$5({
1564
1557
  message: message
1565
1558
  }, options));
1566
1559
 
1567
- case 4:
1560
+ case 2:
1568
1561
  sendMessageResponse = _context2.sent;
1569
1562
  // Reset unreadCount to 0.
1570
1563
  this.state.unreadCount = 0;
1571
1564
  return _context2.abrupt("return", sendMessageResponse);
1572
1565
 
1573
- case 7:
1566
+ case 5:
1574
1567
  case "end":
1575
1568
  return _context2.stop();
1576
1569
  }
@@ -3640,7 +3633,7 @@ var Channel = /*#__PURE__*/function () {
3640
3633
  }, {
3641
3634
  key: "_handleChannelEvent",
3642
3635
  value: function _handleChannelEvent(event) {
3643
- var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9;
3636
+ 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;
3644
3637
 
3645
3638
  var channel = this;
3646
3639
 
@@ -3853,11 +3846,39 @@ var Channel = /*#__PURE__*/function () {
3853
3846
  break;
3854
3847
 
3855
3848
  case 'channel.hidden':
3849
+ channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3850
+ hidden: true
3851
+ });
3852
+
3856
3853
  if (event.clear_history) {
3857
3854
  channelState.clearMessages();
3858
3855
  }
3859
3856
 
3860
3857
  break;
3858
+
3859
+ case 'channel.visible':
3860
+ channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3861
+ hidden: false
3862
+ });
3863
+ break;
3864
+
3865
+ case 'user.banned':
3866
+ if (!((_event$user10 = event.user) !== null && _event$user10 !== void 0 && _event$user10.id)) break;
3867
+ channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3868
+ shadow_banned: !!event.shadow,
3869
+ banned: !event.shadow,
3870
+ user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3871
+ });
3872
+ break;
3873
+
3874
+ case 'user.unbanned':
3875
+ if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3876
+ channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3877
+ shadow_banned: false,
3878
+ banned: false,
3879
+ user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3880
+ });
3881
+ break;
3861
3882
  } // any event can send over the online count
3862
3883
 
3863
3884
 
@@ -10079,7 +10100,7 @@ var StreamChat = /*#__PURE__*/function () {
10079
10100
  }, {
10080
10101
  key: "getUserAgent",
10081
10102
  value: function getUserAgent() {
10082
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.8.0");
10103
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.10.0");
10083
10104
  }
10084
10105
  }, {
10085
10106
  key: "setUserAgent",