stream-chat 8.45.3 → 8.46.1

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