stream-chat 8.45.2 → 8.46.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
@@ -3538,6 +3538,111 @@ var Channel = /*#__PURE__*/function () {
3538
3538
 
3539
3539
  return keystroke;
3540
3540
  }()
3541
+ /**
3542
+ * Sends an event to update the AI state for a specific message.
3543
+ * Typically used by the server connected to the AI service to notify clients of state changes.
3544
+ *
3545
+ * @param messageId - The ID of the message associated with the AI state.
3546
+ * @param state - The new state of the AI process (e.g., thinking, generating).
3547
+ * @param options - Optional parameters, such as `ai_message`, to include additional details in the event.
3548
+ */
3549
+
3550
+ }, {
3551
+ key: "updateAIState",
3552
+ value: function () {
3553
+ var _updateAIState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(messageId, state) {
3554
+ var options,
3555
+ _args30 = arguments;
3556
+ return _regeneratorRuntime.wrap(function _callee30$(_context30) {
3557
+ while (1) {
3558
+ switch (_context30.prev = _context30.next) {
3559
+ case 0:
3560
+ options = _args30.length > 2 && _args30[2] !== undefined ? _args30[2] : {};
3561
+ _context30.next = 3;
3562
+ return this.sendEvent(_objectSpread$a(_objectSpread$a({}, options), {}, {
3563
+ type: 'ai_indicator.update',
3564
+ message_id: messageId,
3565
+ ai_state: state
3566
+ }));
3567
+
3568
+ case 3:
3569
+ case "end":
3570
+ return _context30.stop();
3571
+ }
3572
+ }
3573
+ }, _callee30, this);
3574
+ }));
3575
+
3576
+ function updateAIState(_x29, _x30) {
3577
+ return _updateAIState.apply(this, arguments);
3578
+ }
3579
+
3580
+ return updateAIState;
3581
+ }()
3582
+ /**
3583
+ * Sends an event to notify watchers to clear the typing/thinking UI when the AI response starts streaming.
3584
+ * Typically used by the server connected to the AI service to inform clients that the AI response has started.
3585
+ */
3586
+
3587
+ }, {
3588
+ key: "clearAIIndicator",
3589
+ value: function () {
3590
+ var _clearAIIndicator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
3591
+ return _regeneratorRuntime.wrap(function _callee31$(_context31) {
3592
+ while (1) {
3593
+ switch (_context31.prev = _context31.next) {
3594
+ case 0:
3595
+ _context31.next = 2;
3596
+ return this.sendEvent({
3597
+ type: 'ai_indicator.clear'
3598
+ });
3599
+
3600
+ case 2:
3601
+ case "end":
3602
+ return _context31.stop();
3603
+ }
3604
+ }
3605
+ }, _callee31, this);
3606
+ }));
3607
+
3608
+ function clearAIIndicator() {
3609
+ return _clearAIIndicator.apply(this, arguments);
3610
+ }
3611
+
3612
+ return clearAIIndicator;
3613
+ }()
3614
+ /**
3615
+ * Sends an event to stop AI response generation, leaving the message in its current state.
3616
+ * Triggered by the user to halt the AI response process.
3617
+ */
3618
+
3619
+ }, {
3620
+ key: "stopAIResponse",
3621
+ value: function () {
3622
+ var _stopAIResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32() {
3623
+ return _regeneratorRuntime.wrap(function _callee32$(_context32) {
3624
+ while (1) {
3625
+ switch (_context32.prev = _context32.next) {
3626
+ case 0:
3627
+ _context32.next = 2;
3628
+ return this.sendEvent({
3629
+ type: 'ai_indicator.stop'
3630
+ });
3631
+
3632
+ case 2:
3633
+ case "end":
3634
+ return _context32.stop();
3635
+ }
3636
+ }
3637
+ }, _callee32, this);
3638
+ }));
3639
+
3640
+ function stopAIResponse() {
3641
+ return _stopAIResponse.apply(this, arguments);
3642
+ }
3643
+
3644
+ return stopAIResponse;
3645
+ }()
3541
3646
  /**
3542
3647
  * stopTyping - Sets last typing to null and sends the typing.stop event
3543
3648
  * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
@@ -3547,22 +3652,22 @@ var Channel = /*#__PURE__*/function () {
3547
3652
  }, {
3548
3653
  key: "stopTyping",
3549
3654
  value: function () {
3550
- var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(parent_id, options) {
3551
- return _regeneratorRuntime.wrap(function _callee30$(_context30) {
3655
+ var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(parent_id, options) {
3656
+ return _regeneratorRuntime.wrap(function _callee33$(_context33) {
3552
3657
  while (1) {
3553
- switch (_context30.prev = _context30.next) {
3658
+ switch (_context33.prev = _context33.next) {
3554
3659
  case 0:
3555
3660
  if (this._isTypingIndicatorsEnabled()) {
3556
- _context30.next = 2;
3661
+ _context33.next = 2;
3557
3662
  break;
3558
3663
  }
3559
3664
 
3560
- return _context30.abrupt("return");
3665
+ return _context33.abrupt("return");
3561
3666
 
3562
3667
  case 2:
3563
3668
  this.lastTypingEvent = null;
3564
3669
  this.isTyping = false;
3565
- _context30.next = 6;
3670
+ _context33.next = 6;
3566
3671
  return this.sendEvent(_objectSpread$a({
3567
3672
  type: 'typing.stop',
3568
3673
  parent_id: parent_id
@@ -3570,13 +3675,13 @@ var Channel = /*#__PURE__*/function () {
3570
3675
 
3571
3676
  case 6:
3572
3677
  case "end":
3573
- return _context30.stop();
3678
+ return _context33.stop();
3574
3679
  }
3575
3680
  }
3576
- }, _callee30, this);
3681
+ }, _callee33, this);
3577
3682
  }));
3578
3683
 
3579
- function stopTyping(_x29, _x30) {
3684
+ function stopTyping(_x31, _x32) {
3580
3685
  return _stopTyping.apply(this, arguments);
3581
3686
  }
3582
3687
 
@@ -3628,39 +3733,39 @@ var Channel = /*#__PURE__*/function () {
3628
3733
  }, {
3629
3734
  key: "markRead",
3630
3735
  value: function () {
3631
- var _markRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
3736
+ var _markRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34() {
3632
3737
  var _this$getConfig2;
3633
3738
 
3634
3739
  var data,
3635
- _args31 = arguments;
3636
- return _regeneratorRuntime.wrap(function _callee31$(_context31) {
3740
+ _args34 = arguments;
3741
+ return _regeneratorRuntime.wrap(function _callee34$(_context34) {
3637
3742
  while (1) {
3638
- switch (_context31.prev = _context31.next) {
3743
+ switch (_context34.prev = _context34.next) {
3639
3744
  case 0:
3640
- data = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
3745
+ data = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
3641
3746
 
3642
3747
  this._checkInitialized();
3643
3748
 
3644
3749
  if (!(!((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.read_events) && !this.getClient()._isUsingServerAuth())) {
3645
- _context31.next = 4;
3750
+ _context34.next = 4;
3646
3751
  break;
3647
3752
  }
3648
3753
 
3649
- return _context31.abrupt("return", Promise.resolve(null));
3754
+ return _context34.abrupt("return", Promise.resolve(null));
3650
3755
 
3651
3756
  case 4:
3652
- _context31.next = 6;
3757
+ _context34.next = 6;
3653
3758
  return this.getClient().post(this._channelURL() + '/read', _objectSpread$a({}, data));
3654
3759
 
3655
3760
  case 6:
3656
- return _context31.abrupt("return", _context31.sent);
3761
+ return _context34.abrupt("return", _context34.sent);
3657
3762
 
3658
3763
  case 7:
3659
3764
  case "end":
3660
- return _context31.stop();
3765
+ return _context34.stop();
3661
3766
  }
3662
3767
  }
3663
- }, _callee31, this);
3768
+ }, _callee34, this);
3664
3769
  }));
3665
3770
 
3666
3771
  function markRead() {
@@ -3679,38 +3784,38 @@ var Channel = /*#__PURE__*/function () {
3679
3784
  }, {
3680
3785
  key: "markUnread",
3681
3786
  value: function () {
3682
- var _markUnread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(data) {
3787
+ var _markUnread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(data) {
3683
3788
  var _this$getConfig3;
3684
3789
 
3685
- return _regeneratorRuntime.wrap(function _callee32$(_context32) {
3790
+ return _regeneratorRuntime.wrap(function _callee35$(_context35) {
3686
3791
  while (1) {
3687
- switch (_context32.prev = _context32.next) {
3792
+ switch (_context35.prev = _context35.next) {
3688
3793
  case 0:
3689
3794
  this._checkInitialized();
3690
3795
 
3691
3796
  if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
3692
- _context32.next = 3;
3797
+ _context35.next = 3;
3693
3798
  break;
3694
3799
  }
3695
3800
 
3696
- return _context32.abrupt("return", Promise.resolve(null));
3801
+ return _context35.abrupt("return", Promise.resolve(null));
3697
3802
 
3698
3803
  case 3:
3699
- _context32.next = 5;
3804
+ _context35.next = 5;
3700
3805
  return this.getClient().post(this._channelURL() + '/unread', _objectSpread$a({}, data));
3701
3806
 
3702
3807
  case 5:
3703
- return _context32.abrupt("return", _context32.sent);
3808
+ return _context35.abrupt("return", _context35.sent);
3704
3809
 
3705
3810
  case 6:
3706
3811
  case "end":
3707
- return _context32.stop();
3812
+ return _context35.stop();
3708
3813
  }
3709
3814
  }
3710
- }, _callee32, this);
3815
+ }, _callee35, this);
3711
3816
  }));
3712
3817
 
3713
- function markUnread(_x31) {
3818
+ function markUnread(_x33) {
3714
3819
  return _markUnread.apply(this, arguments);
3715
3820
  }
3716
3821
 
@@ -3745,11 +3850,11 @@ var Channel = /*#__PURE__*/function () {
3745
3850
  }, {
3746
3851
  key: "watch",
3747
3852
  value: function () {
3748
- var _watch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(options) {
3853
+ var _watch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(options) {
3749
3854
  var defaultOptions, combined, state;
3750
- return _regeneratorRuntime.wrap(function _callee33$(_context33) {
3855
+ return _regeneratorRuntime.wrap(function _callee36$(_context36) {
3751
3856
  while (1) {
3752
- switch (_context33.prev = _context33.next) {
3857
+ switch (_context36.prev = _context36.next) {
3753
3858
  case 0:
3754
3859
  defaultOptions = {
3755
3860
  state: true,
@@ -3757,7 +3862,7 @@ var Channel = /*#__PURE__*/function () {
3757
3862
  presence: false
3758
3863
  }; // Make sure we wait for the connect promise if there is a pending one
3759
3864
 
3760
- _context33.next = 3;
3865
+ _context36.next = 3;
3761
3866
  return this.getClient().wsPromise;
3762
3867
 
3763
3868
  case 3:
@@ -3766,11 +3871,11 @@ var Channel = /*#__PURE__*/function () {
3766
3871
  }
3767
3872
 
3768
3873
  combined = _objectSpread$a(_objectSpread$a({}, defaultOptions), options);
3769
- _context33.next = 7;
3874
+ _context36.next = 7;
3770
3875
  return this.query(combined, 'latest');
3771
3876
 
3772
3877
  case 7:
3773
- state = _context33.sent;
3878
+ state = _context36.sent;
3774
3879
  this.initialized = true;
3775
3880
  this.data = state.channel;
3776
3881
 
@@ -3779,17 +3884,17 @@ var Channel = /*#__PURE__*/function () {
3779
3884
  channel: this
3780
3885
  });
3781
3886
 
3782
- return _context33.abrupt("return", state);
3887
+ return _context36.abrupt("return", state);
3783
3888
 
3784
3889
  case 12:
3785
3890
  case "end":
3786
- return _context33.stop();
3891
+ return _context36.stop();
3787
3892
  }
3788
3893
  }
3789
- }, _callee33, this);
3894
+ }, _callee36, this);
3790
3895
  }));
3791
3896
 
3792
- function watch(_x32) {
3897
+ function watch(_x34) {
3793
3898
  return _watch.apply(this, arguments);
3794
3899
  }
3795
3900
 
@@ -3804,31 +3909,31 @@ var Channel = /*#__PURE__*/function () {
3804
3909
  }, {
3805
3910
  key: "stopWatching",
3806
3911
  value: function () {
3807
- var _stopWatching = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34() {
3912
+ var _stopWatching = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37() {
3808
3913
  var response;
3809
- return _regeneratorRuntime.wrap(function _callee34$(_context34) {
3914
+ return _regeneratorRuntime.wrap(function _callee37$(_context37) {
3810
3915
  while (1) {
3811
- switch (_context34.prev = _context34.next) {
3916
+ switch (_context37.prev = _context37.next) {
3812
3917
  case 0:
3813
- _context34.next = 2;
3918
+ _context37.next = 2;
3814
3919
  return this.getClient().post(this._channelURL() + '/stop-watching', {});
3815
3920
 
3816
3921
  case 2:
3817
- response = _context34.sent;
3922
+ response = _context37.sent;
3818
3923
 
3819
3924
  this._client.logger('info', "channel:watch() - stopped watching channel ".concat(this.cid), {
3820
3925
  tags: ['channel'],
3821
3926
  channel: this
3822
3927
  });
3823
3928
 
3824
- return _context34.abrupt("return", response);
3929
+ return _context37.abrupt("return", response);
3825
3930
 
3826
3931
  case 5:
3827
3932
  case "end":
3828
- return _context34.stop();
3933
+ return _context37.stop();
3829
3934
  }
3830
3935
  }
3831
- }, _callee34, this);
3936
+ }, _callee37, this);
3832
3937
  }));
3833
3938
 
3834
3939
  function stopWatching() {
@@ -3851,37 +3956,37 @@ var Channel = /*#__PURE__*/function () {
3851
3956
  }, {
3852
3957
  key: "getReplies",
3853
3958
  value: function () {
3854
- var _getReplies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(parent_id, options, sort) {
3959
+ var _getReplies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(parent_id, options, sort) {
3855
3960
  var normalizedSort, data;
3856
- return _regeneratorRuntime.wrap(function _callee35$(_context35) {
3961
+ return _regeneratorRuntime.wrap(function _callee38$(_context38) {
3857
3962
  while (1) {
3858
- switch (_context35.prev = _context35.next) {
3963
+ switch (_context38.prev = _context38.next) {
3859
3964
  case 0:
3860
3965
  normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
3861
- _context35.next = 3;
3966
+ _context38.next = 3;
3862
3967
  return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$a({
3863
3968
  sort: normalizedSort
3864
3969
  }, options));
3865
3970
 
3866
3971
  case 3:
3867
- data = _context35.sent;
3972
+ data = _context38.sent;
3868
3973
 
3869
3974
  // add any messages to our thread state
3870
3975
  if (data.messages) {
3871
3976
  this.state.addMessagesSorted(data.messages);
3872
3977
  }
3873
3978
 
3874
- return _context35.abrupt("return", data);
3979
+ return _context38.abrupt("return", data);
3875
3980
 
3876
3981
  case 6:
3877
3982
  case "end":
3878
- return _context35.stop();
3983
+ return _context38.stop();
3879
3984
  }
3880
3985
  }
3881
- }, _callee35, this);
3986
+ }, _callee38, this);
3882
3987
  }));
3883
3988
 
3884
- function getReplies(_x33, _x34, _x35) {
3989
+ function getReplies(_x35, _x36, _x37) {
3885
3990
  return _getReplies.apply(this, arguments);
3886
3991
  }
3887
3992
 
@@ -3899,15 +4004,15 @@ var Channel = /*#__PURE__*/function () {
3899
4004
  }, {
3900
4005
  key: "getPinnedMessages",
3901
4006
  value: function () {
3902
- var _getPinnedMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(options) {
4007
+ var _getPinnedMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(options) {
3903
4008
  var sort,
3904
- _args36 = arguments;
3905
- return _regeneratorRuntime.wrap(function _callee36$(_context36) {
4009
+ _args39 = arguments;
4010
+ return _regeneratorRuntime.wrap(function _callee39$(_context39) {
3906
4011
  while (1) {
3907
- switch (_context36.prev = _context36.next) {
4012
+ switch (_context39.prev = _context39.next) {
3908
4013
  case 0:
3909
- sort = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : [];
3910
- _context36.next = 3;
4014
+ sort = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : [];
4015
+ _context39.next = 3;
3911
4016
  return this.getClient().get(this._channelURL() + '/pinned_messages', {
3912
4017
  payload: _objectSpread$a(_objectSpread$a({}, options), {}, {
3913
4018
  sort: normalizeQuerySort(sort)
@@ -3915,17 +4020,17 @@ var Channel = /*#__PURE__*/function () {
3915
4020
  });
3916
4021
 
3917
4022
  case 3:
3918
- return _context36.abrupt("return", _context36.sent);
4023
+ return _context39.abrupt("return", _context39.sent);
3919
4024
 
3920
4025
  case 4:
3921
4026
  case "end":
3922
- return _context36.stop();
4027
+ return _context39.stop();
3923
4028
  }
3924
4029
  }
3925
- }, _callee36, this);
4030
+ }, _callee39, this);
3926
4031
  }));
3927
4032
 
3928
- function getPinnedMessages(_x36) {
4033
+ function getPinnedMessages(_x38) {
3929
4034
  return _getPinnedMessages.apply(this, arguments);
3930
4035
  }
3931
4036
 
@@ -4061,7 +4166,7 @@ var Channel = /*#__PURE__*/function () {
4061
4166
  * @return {Promise<QueryChannelAPIResponse<StreamChatGenerics>>} Returns a query response
4062
4167
  */
4063
4168
  function () {
4064
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(options) {
4169
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(options) {
4065
4170
  var _options$messages$lim, _options$messages, _this$data6, _this$data7;
4066
4171
 
4067
4172
  var messageSetToAddToIfDoesNotExist,
@@ -4072,14 +4177,14 @@ var Channel = /*#__PURE__*/function () {
4072
4177
  _this$_initializeStat,
4073
4178
  messageSet,
4074
4179
  areCapabilitiesChanged,
4075
- _args37 = arguments;
4180
+ _args40 = arguments;
4076
4181
 
4077
- return _regeneratorRuntime.wrap(function _callee37$(_context37) {
4182
+ return _regeneratorRuntime.wrap(function _callee40$(_context40) {
4078
4183
  while (1) {
4079
- switch (_context37.prev = _context37.next) {
4184
+ switch (_context40.prev = _context40.next) {
4080
4185
  case 0:
4081
- messageSetToAddToIfDoesNotExist = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : 'current';
4082
- _context37.next = 3;
4186
+ messageSetToAddToIfDoesNotExist = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : 'current';
4187
+ _context40.next = 3;
4083
4188
  return this.getClient().wsPromise;
4084
4189
 
4085
4190
  case 3:
@@ -4089,14 +4194,14 @@ var Channel = /*#__PURE__*/function () {
4089
4194
  queryURL += "/".concat(encodeURIComponent(this.id));
4090
4195
  }
4091
4196
 
4092
- _context37.next = 7;
4197
+ _context40.next = 7;
4093
4198
  return this.getClient().post(queryURL + '/query', _objectSpread$a({
4094
4199
  data: this._data,
4095
4200
  state: true
4096
4201
  }, options));
4097
4202
 
4098
4203
  case 7:
4099
- state = _context37.sent;
4204
+ state = _context40.sent;
4100
4205
 
4101
4206
  // update the channel id if it was missing
4102
4207
  if (!this.id) {
@@ -4152,17 +4257,17 @@ var Channel = /*#__PURE__*/function () {
4152
4257
  isLatestMessageSet: messageSet.isLatest
4153
4258
  }
4154
4259
  });
4155
- return _context37.abrupt("return", state);
4260
+ return _context40.abrupt("return", state);
4156
4261
 
4157
4262
  case 19:
4158
4263
  case "end":
4159
- return _context37.stop();
4264
+ return _context40.stop();
4160
4265
  }
4161
4266
  }
4162
- }, _callee37, this);
4267
+ }, _callee40, this);
4163
4268
  }));
4164
4269
 
4165
- function query(_x37) {
4270
+ function query(_x39) {
4166
4271
  return _query.apply(this, arguments);
4167
4272
  }
4168
4273
 
@@ -4179,31 +4284,31 @@ var Channel = /*#__PURE__*/function () {
4179
4284
  }, {
4180
4285
  key: "banUser",
4181
4286
  value: function () {
4182
- var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetUserID, options) {
4183
- return _regeneratorRuntime.wrap(function _callee38$(_context38) {
4287
+ var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetUserID, options) {
4288
+ return _regeneratorRuntime.wrap(function _callee41$(_context41) {
4184
4289
  while (1) {
4185
- switch (_context38.prev = _context38.next) {
4290
+ switch (_context41.prev = _context41.next) {
4186
4291
  case 0:
4187
4292
  this._checkInitialized();
4188
4293
 
4189
- _context38.next = 3;
4294
+ _context41.next = 3;
4190
4295
  return this.getClient().banUser(targetUserID, _objectSpread$a(_objectSpread$a({}, options), {}, {
4191
4296
  type: this.type,
4192
4297
  id: this.id
4193
4298
  }));
4194
4299
 
4195
4300
  case 3:
4196
- return _context38.abrupt("return", _context38.sent);
4301
+ return _context41.abrupt("return", _context41.sent);
4197
4302
 
4198
4303
  case 4:
4199
4304
  case "end":
4200
- return _context38.stop();
4305
+ return _context41.stop();
4201
4306
  }
4202
4307
  }
4203
- }, _callee38, this);
4308
+ }, _callee41, this);
4204
4309
  }));
4205
4310
 
4206
- function banUser(_x38, _x39) {
4311
+ function banUser(_x40, _x41) {
4207
4312
  return _banUser.apply(this, arguments);
4208
4313
  }
4209
4314
 
@@ -4221,34 +4326,34 @@ var Channel = /*#__PURE__*/function () {
4221
4326
  }, {
4222
4327
  key: "hide",
4223
4328
  value: function () {
4224
- var _hide = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39() {
4329
+ var _hide = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42() {
4225
4330
  var userId,
4226
4331
  clearHistory,
4227
- _args39 = arguments;
4228
- return _regeneratorRuntime.wrap(function _callee39$(_context39) {
4332
+ _args42 = arguments;
4333
+ return _regeneratorRuntime.wrap(function _callee42$(_context42) {
4229
4334
  while (1) {
4230
- switch (_context39.prev = _context39.next) {
4335
+ switch (_context42.prev = _context42.next) {
4231
4336
  case 0:
4232
- userId = _args39.length > 0 && _args39[0] !== undefined ? _args39[0] : null;
4233
- clearHistory = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : false;
4337
+ userId = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : null;
4338
+ clearHistory = _args42.length > 1 && _args42[1] !== undefined ? _args42[1] : false;
4234
4339
 
4235
4340
  this._checkInitialized();
4236
4341
 
4237
- _context39.next = 5;
4342
+ _context42.next = 5;
4238
4343
  return this.getClient().post("".concat(this._channelURL(), "/hide"), {
4239
4344
  user_id: userId,
4240
4345
  clear_history: clearHistory
4241
4346
  });
4242
4347
 
4243
4348
  case 5:
4244
- return _context39.abrupt("return", _context39.sent);
4349
+ return _context42.abrupt("return", _context42.sent);
4245
4350
 
4246
4351
  case 6:
4247
4352
  case "end":
4248
- return _context39.stop();
4353
+ return _context42.stop();
4249
4354
  }
4250
4355
  }
4251
- }, _callee39, this);
4356
+ }, _callee42, this);
4252
4357
  }));
4253
4358
 
4254
4359
  function hide() {
@@ -4267,31 +4372,31 @@ var Channel = /*#__PURE__*/function () {
4267
4372
  }, {
4268
4373
  key: "show",
4269
4374
  value: function () {
4270
- var _show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40() {
4375
+ var _show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43() {
4271
4376
  var userId,
4272
- _args40 = arguments;
4273
- return _regeneratorRuntime.wrap(function _callee40$(_context40) {
4377
+ _args43 = arguments;
4378
+ return _regeneratorRuntime.wrap(function _callee43$(_context43) {
4274
4379
  while (1) {
4275
- switch (_context40.prev = _context40.next) {
4380
+ switch (_context43.prev = _context43.next) {
4276
4381
  case 0:
4277
- userId = _args40.length > 0 && _args40[0] !== undefined ? _args40[0] : null;
4382
+ userId = _args43.length > 0 && _args43[0] !== undefined ? _args43[0] : null;
4278
4383
 
4279
4384
  this._checkInitialized();
4280
4385
 
4281
- _context40.next = 4;
4386
+ _context43.next = 4;
4282
4387
  return this.getClient().post("".concat(this._channelURL(), "/show"), {
4283
4388
  user_id: userId
4284
4389
  });
4285
4390
 
4286
4391
  case 4:
4287
- return _context40.abrupt("return", _context40.sent);
4392
+ return _context43.abrupt("return", _context43.sent);
4288
4393
 
4289
4394
  case 5:
4290
4395
  case "end":
4291
- return _context40.stop();
4396
+ return _context43.stop();
4292
4397
  }
4293
4398
  }
4294
- }, _callee40, this);
4399
+ }, _callee43, this);
4295
4400
  }));
4296
4401
 
4297
4402
  function show() {
@@ -4310,31 +4415,31 @@ var Channel = /*#__PURE__*/function () {
4310
4415
  }, {
4311
4416
  key: "unbanUser",
4312
4417
  value: function () {
4313
- var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetUserID) {
4314
- return _regeneratorRuntime.wrap(function _callee41$(_context41) {
4418
+ var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(targetUserID) {
4419
+ return _regeneratorRuntime.wrap(function _callee44$(_context44) {
4315
4420
  while (1) {
4316
- switch (_context41.prev = _context41.next) {
4421
+ switch (_context44.prev = _context44.next) {
4317
4422
  case 0:
4318
4423
  this._checkInitialized();
4319
4424
 
4320
- _context41.next = 3;
4425
+ _context44.next = 3;
4321
4426
  return this.getClient().unbanUser(targetUserID, {
4322
4427
  type: this.type,
4323
4428
  id: this.id
4324
4429
  });
4325
4430
 
4326
4431
  case 3:
4327
- return _context41.abrupt("return", _context41.sent);
4432
+ return _context44.abrupt("return", _context44.sent);
4328
4433
 
4329
4434
  case 4:
4330
4435
  case "end":
4331
- return _context41.stop();
4436
+ return _context44.stop();
4332
4437
  }
4333
4438
  }
4334
- }, _callee41, this);
4439
+ }, _callee44, this);
4335
4440
  }));
4336
4441
 
4337
- function unbanUser(_x40) {
4442
+ function unbanUser(_x42) {
4338
4443
  return _unbanUser.apply(this, arguments);
4339
4444
  }
4340
4445
 
@@ -4351,31 +4456,31 @@ var Channel = /*#__PURE__*/function () {
4351
4456
  }, {
4352
4457
  key: "shadowBan",
4353
4458
  value: function () {
4354
- var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(targetUserID, options) {
4355
- return _regeneratorRuntime.wrap(function _callee42$(_context42) {
4459
+ var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(targetUserID, options) {
4460
+ return _regeneratorRuntime.wrap(function _callee45$(_context45) {
4356
4461
  while (1) {
4357
- switch (_context42.prev = _context42.next) {
4462
+ switch (_context45.prev = _context45.next) {
4358
4463
  case 0:
4359
4464
  this._checkInitialized();
4360
4465
 
4361
- _context42.next = 3;
4466
+ _context45.next = 3;
4362
4467
  return this.getClient().shadowBan(targetUserID, _objectSpread$a(_objectSpread$a({}, options), {}, {
4363
4468
  type: this.type,
4364
4469
  id: this.id
4365
4470
  }));
4366
4471
 
4367
4472
  case 3:
4368
- return _context42.abrupt("return", _context42.sent);
4473
+ return _context45.abrupt("return", _context45.sent);
4369
4474
 
4370
4475
  case 4:
4371
4476
  case "end":
4372
- return _context42.stop();
4477
+ return _context45.stop();
4373
4478
  }
4374
4479
  }
4375
- }, _callee42, this);
4480
+ }, _callee45, this);
4376
4481
  }));
4377
4482
 
4378
- function shadowBan(_x41, _x42) {
4483
+ function shadowBan(_x43, _x44) {
4379
4484
  return _shadowBan.apply(this, arguments);
4380
4485
  }
4381
4486
 
@@ -4391,31 +4496,31 @@ var Channel = /*#__PURE__*/function () {
4391
4496
  }, {
4392
4497
  key: "removeShadowBan",
4393
4498
  value: function () {
4394
- var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(targetUserID) {
4395
- return _regeneratorRuntime.wrap(function _callee43$(_context43) {
4499
+ var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(targetUserID) {
4500
+ return _regeneratorRuntime.wrap(function _callee46$(_context46) {
4396
4501
  while (1) {
4397
- switch (_context43.prev = _context43.next) {
4502
+ switch (_context46.prev = _context46.next) {
4398
4503
  case 0:
4399
4504
  this._checkInitialized();
4400
4505
 
4401
- _context43.next = 3;
4506
+ _context46.next = 3;
4402
4507
  return this.getClient().removeShadowBan(targetUserID, {
4403
4508
  type: this.type,
4404
4509
  id: this.id
4405
4510
  });
4406
4511
 
4407
4512
  case 3:
4408
- return _context43.abrupt("return", _context43.sent);
4513
+ return _context46.abrupt("return", _context46.sent);
4409
4514
 
4410
4515
  case 4:
4411
4516
  case "end":
4412
- return _context43.stop();
4517
+ return _context46.stop();
4413
4518
  }
4414
4519
  }
4415
- }, _callee43, this);
4520
+ }, _callee46, this);
4416
4521
  }));
4417
4522
 
4418
- function removeShadowBan(_x43) {
4523
+ function removeShadowBan(_x45) {
4419
4524
  return _removeShadowBan.apply(this, arguments);
4420
4525
  }
4421
4526
 
@@ -4431,26 +4536,26 @@ var Channel = /*#__PURE__*/function () {
4431
4536
  }, {
4432
4537
  key: "createCall",
4433
4538
  value: function () {
4434
- var _createCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(options) {
4435
- return _regeneratorRuntime.wrap(function _callee44$(_context44) {
4539
+ var _createCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(options) {
4540
+ return _regeneratorRuntime.wrap(function _callee47$(_context47) {
4436
4541
  while (1) {
4437
- switch (_context44.prev = _context44.next) {
4542
+ switch (_context47.prev = _context47.next) {
4438
4543
  case 0:
4439
- _context44.next = 2;
4544
+ _context47.next = 2;
4440
4545
  return this.getClient().post(this._channelURL() + '/call', options);
4441
4546
 
4442
4547
  case 2:
4443
- return _context44.abrupt("return", _context44.sent);
4548
+ return _context47.abrupt("return", _context47.sent);
4444
4549
 
4445
4550
  case 3:
4446
4551
  case "end":
4447
- return _context44.stop();
4552
+ return _context47.stop();
4448
4553
  }
4449
4554
  }
4450
- }, _callee44, this);
4555
+ }, _callee47, this);
4451
4556
  }));
4452
4557
 
4453
- function createCall(_x44) {
4558
+ function createCall(_x46) {
4454
4559
  return _createCall.apply(this, arguments);
4455
4560
  }
4456
4561
 
@@ -4466,26 +4571,26 @@ var Channel = /*#__PURE__*/function () {
4466
4571
  }, {
4467
4572
  key: "vote",
4468
4573
  value: function () {
4469
- var _vote2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(messageId, pollId, _vote) {
4470
- return _regeneratorRuntime.wrap(function _callee45$(_context45) {
4574
+ var _vote2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(messageId, pollId, _vote) {
4575
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
4471
4576
  while (1) {
4472
- switch (_context45.prev = _context45.next) {
4577
+ switch (_context48.prev = _context48.next) {
4473
4578
  case 0:
4474
- _context45.next = 2;
4579
+ _context48.next = 2;
4475
4580
  return this.getClient().castPollVote(messageId, pollId, _vote);
4476
4581
 
4477
4582
  case 2:
4478
- return _context45.abrupt("return", _context45.sent);
4583
+ return _context48.abrupt("return", _context48.sent);
4479
4584
 
4480
4585
  case 3:
4481
4586
  case "end":
4482
- return _context45.stop();
4587
+ return _context48.stop();
4483
4588
  }
4484
4589
  }
4485
- }, _callee45, this);
4590
+ }, _callee48, this);
4486
4591
  }));
4487
4592
 
4488
- function vote(_x45, _x46, _x47) {
4593
+ function vote(_x47, _x48, _x49) {
4489
4594
  return _vote2.apply(this, arguments);
4490
4595
  }
4491
4596
 
@@ -4494,26 +4599,26 @@ var Channel = /*#__PURE__*/function () {
4494
4599
  }, {
4495
4600
  key: "removeVote",
4496
4601
  value: function () {
4497
- var _removeVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageId, pollId, voteId) {
4498
- return _regeneratorRuntime.wrap(function _callee46$(_context46) {
4602
+ var _removeVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(messageId, pollId, voteId) {
4603
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
4499
4604
  while (1) {
4500
- switch (_context46.prev = _context46.next) {
4605
+ switch (_context49.prev = _context49.next) {
4501
4606
  case 0:
4502
- _context46.next = 2;
4607
+ _context49.next = 2;
4503
4608
  return this.getClient().removePollVote(messageId, pollId, voteId);
4504
4609
 
4505
4610
  case 2:
4506
- return _context46.abrupt("return", _context46.sent);
4611
+ return _context49.abrupt("return", _context49.sent);
4507
4612
 
4508
4613
  case 3:
4509
4614
  case "end":
4510
- return _context46.stop();
4615
+ return _context49.stop();
4511
4616
  }
4512
4617
  }
4513
- }, _callee46, this);
4618
+ }, _callee49, this);
4514
4619
  }));
4515
4620
 
4516
- function removeVote(_x48, _x49, _x50) {
4621
+ function removeVote(_x50, _x51, _x52) {
4517
4622
  return _removeVote.apply(this, arguments);
4518
4623
  }
4519
4624
 
@@ -4903,10 +5008,14 @@ var Channel = /*#__PURE__*/function () {
4903
5008
  var _this$getClient2 = this.getClient(),
4904
5009
  clientState = _this$getClient2.state,
4905
5010
  user = _this$getClient2.user,
4906
- userID = _this$getClient2.userID; // add the Users
5011
+ userID = _this$getClient2.userID; // add the members and users
4907
5012
 
4908
5013
 
4909
5014
  if (state.members) {
5015
+ this._hydrateMembers({
5016
+ members: state.members
5017
+ });
5018
+
4910
5019
  var _iterator = _createForOfIteratorHelper$4(state.members),
4911
5020
  _step;
4912
5021
 
@@ -5013,10 +5122,6 @@ var Channel = /*#__PURE__*/function () {
5013
5122
  }
5014
5123
  }
5015
5124
 
5016
- if (state.members) {
5017
- this._hydrateMembers(state.members);
5018
- }
5019
-
5020
5125
  return {
5021
5126
  messageSet: messageSet
5022
5127
  };
@@ -5036,14 +5141,23 @@ var Channel = /*#__PURE__*/function () {
5036
5141
  }
5037
5142
  }, {
5038
5143
  key: "_hydrateMembers",
5039
- value: function _hydrateMembers(members) {
5040
- this.state.members = members.reduce(function (acc, member) {
5144
+ value: function _hydrateMembers(_ref4) {
5145
+ var members = _ref4.members,
5146
+ _ref4$overrideCurrent = _ref4.overrideCurrentState,
5147
+ overrideCurrentState = _ref4$overrideCurrent === void 0 ? true : _ref4$overrideCurrent;
5148
+ var newMembersById = members.reduce(function (membersById, member) {
5041
5149
  if (member.user) {
5042
- acc[member.user.id] = member;
5150
+ membersById[member.user.id] = member;
5043
5151
  }
5044
5152
 
5045
- return acc;
5153
+ return membersById;
5046
5154
  }, {});
5155
+
5156
+ if (overrideCurrentState) {
5157
+ this.state.members = newMembersById;
5158
+ } else if (!overrideCurrentState && members.length) {
5159
+ this.state.members = _objectSpread$a(_objectSpread$a({}, this.state.members), newMembersById);
5160
+ }
5047
5161
  }
5048
5162
  }, {
5049
5163
  key: "_disconnect",
@@ -8018,7 +8132,10 @@ var Thread = /*#__PURE__*/function () {
8018
8132
  name: threadData.channel.name
8019
8133
  });
8020
8134
 
8021
- _channel._hydrateMembers((_threadData$channel$m = threadData.channel.members) !== null && _threadData$channel$m !== void 0 ? _threadData$channel$m : []); // For when read object is undefined and due to that unreadMessageCount for
8135
+ _channel._hydrateMembers({
8136
+ members: (_threadData$channel$m = threadData.channel.members) !== null && _threadData$channel$m !== void 0 ? _threadData$channel$m : [],
8137
+ overrideCurrentState: false
8138
+ }); // For when read object is undefined and due to that unreadMessageCount for
8022
8139
  // the current user isn't being incremented on message.new
8023
8140
 
8024
8141
 
@@ -14620,7 +14737,7 @@ var StreamChat = /*#__PURE__*/function () {
14620
14737
  }, {
14621
14738
  key: "getUserAgent",
14622
14739
  value: function getUserAgent() {
14623
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.45.2");
14740
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.46.0");
14624
14741
  }
14625
14742
  }, {
14626
14743
  key: "setUserAgent",
@@ -16857,6 +16974,10 @@ var EVENT_MAP = {
16857
16974
  'user.updated': true,
16858
16975
  'user.watching.start': true,
16859
16976
  'user.watching.stop': true,
16977
+ // AI events
16978
+ 'ai_indicator.update': true,
16979
+ 'ai_indicator.stop': true,
16980
+ 'ai_indicator.clear': true,
16860
16981
  // local events
16861
16982
  'channels.queried': true,
16862
16983
  'connection.changed': true,