stream-chat 8.37.0 → 8.38.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.js CHANGED
@@ -122,9 +122,9 @@ var decodeBase64 = function decodeBase64(s) {
122
122
  return r;
123
123
  };
124
124
 
125
- function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
125
+ function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
126
126
 
127
- function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
127
+ function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$9(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
128
128
 
129
129
  function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
130
130
 
@@ -386,7 +386,7 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
386
386
  */
387
387
 
388
388
  function formatMessage(message) {
389
- return _objectSpread$8(_objectSpread$8({}, message), {}, {
389
+ return _objectSpread$9(_objectSpread$9({}, message), {}, {
390
390
  /**
391
391
  * @deprecated please use `html`
392
392
  */
@@ -485,9 +485,9 @@ function maybeGetReactionGroupsFallback(groups, counts, scores) {
485
485
  return null;
486
486
  }
487
487
 
488
- function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
488
+ function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
489
489
 
490
- function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
490
+ function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
491
491
 
492
492
  /**
493
493
  * ChannelState - A container class for the channel state.
@@ -564,7 +564,7 @@ var ChannelState = /*#__PURE__*/function () {
564
564
  if (!message) return;
565
565
  if (message.poll_id !== pollVote.poll_id) return;
566
566
 
567
- var updatedPoll = _objectSpread$7({}, poll);
567
+ var updatedPoll = _objectSpread$8({}, poll);
568
568
 
569
569
  var ownVotes = _toConsumableArray__default['default'](((_message$poll = message.poll) === null || _message$poll === void 0 ? void 0 : _message$poll.own_votes) || []);
570
570
 
@@ -586,7 +586,7 @@ var ChannelState = /*#__PURE__*/function () {
586
586
 
587
587
  updatedPoll.own_votes = ownVotes;
588
588
 
589
- var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
589
+ var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
590
590
  poll: updatedPoll
591
591
  });
592
592
 
@@ -601,7 +601,7 @@ var ChannelState = /*#__PURE__*/function () {
601
601
  if (!message) return;
602
602
  if (message.poll_id !== pollVote.poll_id) return;
603
603
 
604
- var updatedPoll = _objectSpread$7({}, poll);
604
+ var updatedPoll = _objectSpread$8({}, poll);
605
605
 
606
606
  var ownVotes = _toConsumableArray__default['default'](((_message$poll2 = message.poll) === null || _message$poll2 === void 0 ? void 0 : _message$poll2.own_votes) || []);
607
607
 
@@ -611,7 +611,7 @@ var ChannelState = /*#__PURE__*/function () {
611
611
 
612
612
  updatedPoll.own_votes = ownVotes;
613
613
 
614
- var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
614
+ var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
615
615
  poll: updatedPoll
616
616
  });
617
617
 
@@ -626,7 +626,7 @@ var ChannelState = /*#__PURE__*/function () {
626
626
  if (!message) return;
627
627
  if (message.poll_id !== pollVote.poll_id) return;
628
628
 
629
- var updatedPoll = _objectSpread$7({}, poll);
629
+ var updatedPoll = _objectSpread$8({}, poll);
630
630
 
631
631
  var ownVotes = _toConsumableArray__default['default'](((_message$poll3 = message.poll) === null || _message$poll3 === void 0 ? void 0 : _message$poll3.own_votes) || []);
632
632
 
@@ -642,7 +642,7 @@ var ChannelState = /*#__PURE__*/function () {
642
642
 
643
643
  updatedPoll.own_votes = ownVotes;
644
644
 
645
- var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
645
+ var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
646
646
  poll: updatedPoll
647
647
  });
648
648
 
@@ -656,11 +656,11 @@ var ChannelState = /*#__PURE__*/function () {
656
656
 
657
657
  if (!message) return;
658
658
 
659
- var updatedPoll = _objectSpread$7(_objectSpread$7({}, poll), {}, {
659
+ var updatedPoll = _objectSpread$8(_objectSpread$8({}, poll), {}, {
660
660
  own_votes: _toConsumableArray__default['default'](((_message$poll4 = message.poll) === null || _message$poll4 === void 0 ? void 0 : _message$poll4.own_votes) || [])
661
661
  });
662
662
 
663
- var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
663
+ var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
664
664
  poll: updatedPoll
665
665
  });
666
666
 
@@ -675,7 +675,7 @@ var ChannelState = /*#__PURE__*/function () {
675
675
  var m = messages[i];
676
676
 
677
677
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
678
- messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
678
+ messages[i] = _objectSpread$8(_objectSpread$8({}, m), {}, {
679
679
  user: user
680
680
  });
681
681
  }
@@ -730,7 +730,7 @@ var ChannelState = /*#__PURE__*/function () {
730
730
  user: m.user
731
731
  };
732
732
  } else {
733
- messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
733
+ messages[i] = _objectSpread$8(_objectSpread$8({}, m), {}, {
734
734
  type: 'deleted',
735
735
  deleted_at: user.deleted_at
736
736
  });
@@ -837,7 +837,7 @@ var ChannelState = /*#__PURE__*/function () {
837
837
  }, {
838
838
  key: "formatMessage",
839
839
  value: function formatMessage(message) {
840
- return _objectSpread$7(_objectSpread$7({}, message), {}, {
840
+ return _objectSpread$8(_objectSpread$8({}, message), {}, {
841
841
  /**
842
842
  * @deprecated please use `html`
843
843
  */
@@ -1055,7 +1055,7 @@ var ChannelState = /*#__PURE__*/function () {
1055
1055
  var parseMessage = function parseMessage(m) {
1056
1056
  var _m$pinned_at, _m$updated_at;
1057
1057
 
1058
- return _objectSpread$7(_objectSpread$7({}, m), {}, {
1058
+ return _objectSpread$8(_objectSpread$8({}, m), {}, {
1059
1059
  created_at: m.created_at.toISOString(),
1060
1060
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
1061
1061
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
@@ -1065,8 +1065,8 @@ var ChannelState = /*#__PURE__*/function () {
1065
1065
  var update = function update(messages) {
1066
1066
  var updatedMessages = messages.reduce(function (acc, msg) {
1067
1067
  if (msg.quoted_message_id === message.id) {
1068
- acc.push(_objectSpread$7(_objectSpread$7({}, parseMessage(msg)), {}, {
1069
- quoted_message: remove ? _objectSpread$7(_objectSpread$7({}, message), {}, {
1068
+ acc.push(_objectSpread$8(_objectSpread$8({}, parseMessage(msg)), {}, {
1069
+ quoted_message: remove ? _objectSpread$8(_objectSpread$8({}, message), {}, {
1070
1070
  attachments: []
1071
1071
  }) : message
1072
1072
  }));
@@ -1550,9 +1550,9 @@ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o
1550
1550
 
1551
1551
  function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1552
1552
 
1553
- function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1553
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1554
1554
 
1555
- function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1555
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1556
1556
 
1557
1557
  /**
1558
1558
  * Channel - The Channel class manages it's own state.
@@ -1625,7 +1625,7 @@ var Channel = /*#__PURE__*/function () {
1625
1625
  while (1) {
1626
1626
  switch (_context.prev = _context.next) {
1627
1627
  case 0:
1628
- defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
1628
+ defaultOptions = _objectSpread$7(_objectSpread$7({}, options), {}, {
1629
1629
  watch: false,
1630
1630
  state: false,
1631
1631
  presence: false
@@ -1697,7 +1697,7 @@ var Channel = /*#__PURE__*/function () {
1697
1697
 
1698
1698
  this.data = data; // this._data is used for the requests...
1699
1699
 
1700
- this._data = _objectSpread$6({}, data);
1700
+ this._data = _objectSpread$7({}, data);
1701
1701
  this.cid = "".concat(type, ":").concat(id);
1702
1702
  this.listeners = {}; // perhaps the state variable should be private
1703
1703
 
@@ -1759,7 +1759,7 @@ var Channel = /*#__PURE__*/function () {
1759
1759
  switch (_context2.prev = _context2.next) {
1760
1760
  case 0:
1761
1761
  _context2.next = 2;
1762
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
1762
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$7({
1763
1763
  message: message
1764
1764
  }, options));
1765
1765
 
@@ -1875,7 +1875,7 @@ var Channel = /*#__PURE__*/function () {
1875
1875
 
1876
1876
  case 3:
1877
1877
  // Return a list of channels
1878
- payload = _objectSpread$6(_objectSpread$6({
1878
+ payload = _objectSpread$7(_objectSpread$7({
1879
1879
  filter_conditions: {
1880
1880
  cid: this.cid
1881
1881
  }
@@ -1972,7 +1972,7 @@ var Channel = /*#__PURE__*/function () {
1972
1972
 
1973
1973
  _context5.next = 6;
1974
1974
  return this.getClient().get(this.getClient().baseURL + '/members', {
1975
- payload: _objectSpread$6({
1975
+ payload: _objectSpread$7({
1976
1976
  type: type,
1977
1977
  id: id,
1978
1978
  members: members,
@@ -2033,7 +2033,7 @@ var Channel = /*#__PURE__*/function () {
2033
2033
 
2034
2034
  case 4:
2035
2035
  _context6.next = 6;
2036
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
2036
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$7({
2037
2037
  reaction: reaction
2038
2038
  }, options));
2039
2039
 
@@ -2114,7 +2114,7 @@ var Channel = /*#__PURE__*/function () {
2114
2114
  delete channelData[key];
2115
2115
  });
2116
2116
  _context7.next = 7;
2117
- return this._update(_objectSpread$6({
2117
+ return this._update(_objectSpread$7({
2118
2118
  message: updateMessage,
2119
2119
  data: channelData
2120
2120
  }, options));
@@ -2286,7 +2286,7 @@ var Channel = /*#__PURE__*/function () {
2286
2286
  case 0:
2287
2287
  options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
2288
2288
  _context11.next = 3;
2289
- return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
2289
+ return this.getClient().delete(this._channelURL(), _objectSpread$7({}, options));
2290
2290
 
2291
2291
  case 3:
2292
2292
  return _context11.abrupt("return", _context11.sent);
@@ -2362,7 +2362,7 @@ var Channel = /*#__PURE__*/function () {
2362
2362
  case 0:
2363
2363
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
2364
2364
  _context13.next = 3;
2365
- return this._update(_objectSpread$6({
2365
+ return this._update(_objectSpread$7({
2366
2366
  accept_invite: true
2367
2367
  }, options));
2368
2368
 
@@ -2403,7 +2403,7 @@ var Channel = /*#__PURE__*/function () {
2403
2403
  case 0:
2404
2404
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2405
2405
  _context14.next = 3;
2406
- return this._update(_objectSpread$6({
2406
+ return this._update(_objectSpread$7({
2407
2407
  reject_invite: true
2408
2408
  }, options));
2409
2409
 
@@ -2445,7 +2445,7 @@ var Channel = /*#__PURE__*/function () {
2445
2445
  case 0:
2446
2446
  options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
2447
2447
  _context15.next = 3;
2448
- return this._update(_objectSpread$6({
2448
+ return this._update(_objectSpread$7({
2449
2449
  add_members: members,
2450
2450
  message: message
2451
2451
  }, options));
@@ -2488,7 +2488,7 @@ var Channel = /*#__PURE__*/function () {
2488
2488
  case 0:
2489
2489
  options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
2490
2490
  _context16.next = 3;
2491
- return this._update(_objectSpread$6({
2491
+ return this._update(_objectSpread$7({
2492
2492
  add_moderators: members,
2493
2493
  message: message
2494
2494
  }, options));
@@ -2531,7 +2531,7 @@ var Channel = /*#__PURE__*/function () {
2531
2531
  case 0:
2532
2532
  options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
2533
2533
  _context17.next = 3;
2534
- return this._update(_objectSpread$6({
2534
+ return this._update(_objectSpread$7({
2535
2535
  assign_roles: roles,
2536
2536
  message: message
2537
2537
  }, options));
@@ -2574,7 +2574,7 @@ var Channel = /*#__PURE__*/function () {
2574
2574
  case 0:
2575
2575
  options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
2576
2576
  _context18.next = 3;
2577
- return this._update(_objectSpread$6({
2577
+ return this._update(_objectSpread$7({
2578
2578
  invites: members,
2579
2579
  message: message
2580
2580
  }, options));
@@ -2617,7 +2617,7 @@ var Channel = /*#__PURE__*/function () {
2617
2617
  case 0:
2618
2618
  options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
2619
2619
  _context19.next = 3;
2620
- return this._update(_objectSpread$6({
2620
+ return this._update(_objectSpread$7({
2621
2621
  remove_members: members,
2622
2622
  message: message
2623
2623
  }, options));
@@ -2660,7 +2660,7 @@ var Channel = /*#__PURE__*/function () {
2660
2660
  case 0:
2661
2661
  options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
2662
2662
  _context20.next = 3;
2663
- return this._update(_objectSpread$6({
2663
+ return this._update(_objectSpread$7({
2664
2664
  demote_moderators: members,
2665
2665
  message: message
2666
2666
  }, options));
@@ -2745,7 +2745,7 @@ var Channel = /*#__PURE__*/function () {
2745
2745
  case 0:
2746
2746
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2747
2747
  _context22.next = 3;
2748
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
2748
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$7({
2749
2749
  channel_cid: this.cid
2750
2750
  }, opts));
2751
2751
 
@@ -2787,7 +2787,7 @@ var Channel = /*#__PURE__*/function () {
2787
2787
  case 0:
2788
2788
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2789
2789
  _context23.next = 3;
2790
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
2790
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$7({
2791
2791
  channel_cid: this.cid
2792
2792
  }, opts));
2793
2793
 
@@ -2872,7 +2872,7 @@ var Channel = /*#__PURE__*/function () {
2872
2872
 
2873
2873
  this.lastTypingEvent = new Date();
2874
2874
  _context24.next = 10;
2875
- return this.sendEvent(_objectSpread$6({
2875
+ return this.sendEvent(_objectSpread$7({
2876
2876
  type: 'typing.start',
2877
2877
  parent_id: parent_id
2878
2878
  }, options || {}));
@@ -2916,7 +2916,7 @@ var Channel = /*#__PURE__*/function () {
2916
2916
  this.lastTypingEvent = null;
2917
2917
  this.isTyping = false;
2918
2918
  _context25.next = 6;
2919
- return this.sendEvent(_objectSpread$6({
2919
+ return this.sendEvent(_objectSpread$7({
2920
2920
  type: 'typing.stop',
2921
2921
  parent_id: parent_id
2922
2922
  }, options || {}));
@@ -3003,7 +3003,7 @@ var Channel = /*#__PURE__*/function () {
3003
3003
 
3004
3004
  case 4:
3005
3005
  _context26.next = 6;
3006
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
3006
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$7({}, data));
3007
3007
 
3008
3008
  case 6:
3009
3009
  return _context26.abrupt("return", _context26.sent);
@@ -3050,7 +3050,7 @@ var Channel = /*#__PURE__*/function () {
3050
3050
 
3051
3051
  case 3:
3052
3052
  _context27.next = 5;
3053
- return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
3053
+ return this.getClient().post(this._channelURL() + '/unread', _objectSpread$7({}, data));
3054
3054
 
3055
3055
  case 5:
3056
3056
  return _context27.abrupt("return", _context27.sent);
@@ -3118,7 +3118,7 @@ var Channel = /*#__PURE__*/function () {
3118
3118
  defaultOptions.watch = false;
3119
3119
  }
3120
3120
 
3121
- combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
3121
+ combined = _objectSpread$7(_objectSpread$7({}, defaultOptions), options);
3122
3122
  _context28.next = 7;
3123
3123
  return this.query(combined, 'latest');
3124
3124
 
@@ -3210,7 +3210,7 @@ var Channel = /*#__PURE__*/function () {
3210
3210
  case 0:
3211
3211
  normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
3212
3212
  _context30.next = 3;
3213
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({
3213
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$7({
3214
3214
  sort: normalizedSort
3215
3215
  }, options));
3216
3216
 
@@ -3260,7 +3260,7 @@ var Channel = /*#__PURE__*/function () {
3260
3260
  sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
3261
3261
  _context31.next = 3;
3262
3262
  return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
3263
- payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
3263
+ payload: _objectSpread$7(_objectSpread$7({}, options), {}, {
3264
3264
  sort: normalizeQuerySort(sort)
3265
3265
  })
3266
3266
  });
@@ -3294,7 +3294,7 @@ var Channel = /*#__PURE__*/function () {
3294
3294
  }, {
3295
3295
  key: "getReactions",
3296
3296
  value: function getReactions(message_id, options) {
3297
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
3297
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$7({}, options));
3298
3298
  }
3299
3299
  /**
3300
3300
  * getMessagesById - Retrieves a list of messages by ID
@@ -3442,7 +3442,7 @@ var Channel = /*#__PURE__*/function () {
3442
3442
  }
3443
3443
 
3444
3444
  _context32.next = 7;
3445
- return this.getClient().post(queryURL + '/query', _objectSpread$6({
3445
+ return this.getClient().post(queryURL + '/query', _objectSpread$7({
3446
3446
  data: this._data,
3447
3447
  state: true
3448
3448
  }, options));
@@ -3531,7 +3531,7 @@ var Channel = /*#__PURE__*/function () {
3531
3531
  this._checkInitialized();
3532
3532
 
3533
3533
  _context33.next = 3;
3534
- return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3534
+ return this.getClient().banUser(targetUserID, _objectSpread$7(_objectSpread$7({}, options), {}, {
3535
3535
  type: this.type,
3536
3536
  id: this.id
3537
3537
  }));
@@ -3703,7 +3703,7 @@ var Channel = /*#__PURE__*/function () {
3703
3703
  this._checkInitialized();
3704
3704
 
3705
3705
  _context37.next = 3;
3706
- return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3706
+ return this.getClient().shadowBan(targetUserID, _objectSpread$7(_objectSpread$7({}, options), {}, {
3707
3707
  type: this.type,
3708
3708
  id: this.id
3709
3709
  }));
@@ -4157,7 +4157,7 @@ var Channel = /*#__PURE__*/function () {
4157
4157
  });
4158
4158
  }
4159
4159
 
4160
- channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
4160
+ channel.data = _objectSpread$7(_objectSpread$7({}, event.channel), {}, {
4161
4161
  hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
4162
4162
  own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
4163
4163
  });
@@ -4231,7 +4231,7 @@ var Channel = /*#__PURE__*/function () {
4231
4231
  break;
4232
4232
 
4233
4233
  case 'channel.hidden':
4234
- channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
4234
+ channel.data = _objectSpread$7(_objectSpread$7({}, channel.data), {}, {
4235
4235
  hidden: true
4236
4236
  });
4237
4237
 
@@ -4242,26 +4242,26 @@ var Channel = /*#__PURE__*/function () {
4242
4242
  break;
4243
4243
 
4244
4244
  case 'channel.visible':
4245
- channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
4245
+ channel.data = _objectSpread$7(_objectSpread$7({}, channel.data), {}, {
4246
4246
  hidden: false
4247
4247
  });
4248
4248
  break;
4249
4249
 
4250
4250
  case 'user.banned':
4251
4251
  if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
4252
- channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
4252
+ channelState.members[event.user.id] = _objectSpread$7(_objectSpread$7({}, channelState.members[event.user.id] || {}), {}, {
4253
4253
  shadow_banned: !!event.shadow,
4254
4254
  banned: !event.shadow,
4255
- user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
4255
+ user: _objectSpread$7(_objectSpread$7({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
4256
4256
  });
4257
4257
  break;
4258
4258
 
4259
4259
  case 'user.unbanned':
4260
4260
  if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
4261
- channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
4261
+ channelState.members[event.user.id] = _objectSpread$7(_objectSpread$7({}, channelState.members[event.user.id] || {}), {}, {
4262
4262
  shadow_banned: false,
4263
4263
  banned: false,
4264
- user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
4264
+ user: _objectSpread$7(_objectSpread$7({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
4265
4265
  });
4266
4266
  break;
4267
4267
  } // any event can send over the online count
@@ -4515,9 +4515,9 @@ var ClientState = /*#__PURE__*/function () {
4515
4515
  return ClientState;
4516
4516
  }();
4517
4517
 
4518
- function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4518
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4519
4519
 
4520
- function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4520
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4521
4521
  var InsightMetrics = function InsightMetrics() {
4522
4522
  _classCallCheck__default['default'](this, InsightMetrics);
4523
4523
 
@@ -4596,7 +4596,7 @@ var postInsights = /*#__PURE__*/function () {
4596
4596
  };
4597
4597
  }();
4598
4598
  function buildWsFatalInsight(connection, event) {
4599
- return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
4599
+ return _objectSpread$6(_objectSpread$6({}, event), buildWsBaseInsight(connection));
4600
4600
  }
4601
4601
 
4602
4602
  function buildWsBaseInsight(connection) {
@@ -4629,9 +4629,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
4629
4629
  return buildWsBaseInsight(connection);
4630
4630
  }
4631
4631
 
4632
- function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4632
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4633
4633
 
4634
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4634
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4635
4635
 
4636
4636
  // Type guards to check WebSocket error type
4637
4637
  var isCloseEvent = function isCloseEvent(res) {
@@ -4995,7 +4995,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4995
4995
  value: function _log(msg) {
4996
4996
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4997
4997
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
4998
- this.client.logger(level, 'connection:' + msg, _objectSpread$4({
4998
+ this.client.logger(level, 'connection:' + msg, _objectSpread$5({
4999
4999
  tags: ['connection']
5000
5000
  }, extra));
5001
5001
  }
@@ -5586,9 +5586,9 @@ var StableWSConnection = /*#__PURE__*/function () {
5586
5586
  return StableWSConnection;
5587
5587
  }();
5588
5588
 
5589
- function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5589
+ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5590
5590
 
5591
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5591
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5592
5592
 
5593
5593
  /**
5594
5594
  * Creates the JWT token that can be used for a UserSession
@@ -5609,7 +5609,7 @@ function JWTUserToken(apiSecret, userId) {
5609
5609
  throw new TypeError('userId should be a string');
5610
5610
  }
5611
5611
 
5612
- var payload = _objectSpread$3({
5612
+ var payload = _objectSpread$4({
5613
5613
  user_id: userId
5614
5614
  }, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
5615
5615
 
@@ -6019,9 +6019,9 @@ function isErrorResponse(res) {
6019
6019
  return !res.status || res.status < 200 || 300 <= res.status;
6020
6020
  }
6021
6021
 
6022
- function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6022
+ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6023
6023
 
6024
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6024
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6025
6025
  var ConnectionState;
6026
6026
 
6027
6027
  (function (ConnectionState) {
@@ -6084,7 +6084,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6084
6084
  _context.next = 4;
6085
6085
  return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
6086
6086
  undefined, {
6087
- config: _objectSpread$2(_objectSpread$2({}, config), {}, {
6087
+ config: _objectSpread$3(_objectSpread$3({}, config), {}, {
6088
6088
  cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
6089
6089
  }),
6090
6090
  params: params
@@ -6362,7 +6362,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6362
6362
  value: function _log(msg) {
6363
6363
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6364
6364
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
6365
- this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
6365
+ this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$3({
6366
6366
  tags: ['connection_fallback', 'connection']
6367
6367
  }, extra));
6368
6368
  }
@@ -6944,9 +6944,9 @@ exports.VotingVisibility = void 0;
6944
6944
 
6945
6945
  var _excluded$1 = ["parent_message_id", "parent_message", "latest_replies", "thread_participants", "reply_count", "channel", "read"];
6946
6946
 
6947
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6947
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6948
6948
 
6949
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6949
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6950
6950
 
6951
6951
  function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6952
6952
 
@@ -7003,7 +7003,7 @@ var Thread = /*#__PURE__*/function () {
7003
7003
  try {
7004
7004
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
7005
7005
  var r = _step.value;
7006
- this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
7006
+ this.read[r.user.id] = _objectSpread$2(_objectSpread$2({}, r), {}, {
7007
7007
  last_read: new Date(r.last_read)
7008
7008
  });
7009
7009
  }
@@ -7101,6 +7101,424 @@ var Thread = /*#__PURE__*/function () {
7101
7101
  return Thread;
7102
7102
  }();
7103
7103
 
7104
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7105
+
7106
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7107
+ var MODERATION_ENTITY_TYPES = {
7108
+ user: 'stream:user',
7109
+ message: 'stream:chat:v1:message'
7110
+ }; // Moderation class provides all the endpoints related to moderation v2.
7111
+
7112
+ var Moderation = /*#__PURE__*/function () {
7113
+ function Moderation(client) {
7114
+ _classCallCheck__default['default'](this, Moderation);
7115
+
7116
+ _defineProperty__default['default'](this, "client", void 0);
7117
+
7118
+ this.client = client;
7119
+ }
7120
+ /**
7121
+ * Flag a user
7122
+ *
7123
+ * @param {string} flaggedUserID User ID to be flagged
7124
+ * @param {string} reason Reason for flagging the user
7125
+ * @param {Object} options Additional options for flagging the user
7126
+ * @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target user
7127
+ * @param {Object} options.custom Additional data to be stored with the flag
7128
+ * @returns
7129
+ */
7130
+
7131
+
7132
+ _createClass__default['default'](Moderation, [{
7133
+ key: "flagUser",
7134
+ value: function () {
7135
+ var _flagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(flaggedUserID, reason) {
7136
+ var options,
7137
+ _args = arguments;
7138
+ return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
7139
+ while (1) {
7140
+ switch (_context.prev = _context.next) {
7141
+ case 0:
7142
+ options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
7143
+ return _context.abrupt("return", this.flag(MODERATION_ENTITY_TYPES.user, flaggedUserID, '', reason, options));
7144
+
7145
+ case 2:
7146
+ case "end":
7147
+ return _context.stop();
7148
+ }
7149
+ }
7150
+ }, _callee, this);
7151
+ }));
7152
+
7153
+ function flagUser(_x, _x2) {
7154
+ return _flagUser.apply(this, arguments);
7155
+ }
7156
+
7157
+ return flagUser;
7158
+ }()
7159
+ /**
7160
+ * Flag a message
7161
+ *
7162
+ * @param {string} messageID Message ID to be flagged
7163
+ * @param {string} reason Reason for flagging the message
7164
+ * @param {Object} options Additional options for flagging the message
7165
+ * @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target message
7166
+ * @param {Object} options.custom Additional data to be stored with the flag
7167
+ * @returns
7168
+ */
7169
+
7170
+ }, {
7171
+ key: "flagMessage",
7172
+ value: function () {
7173
+ var _flagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(messageID, reason) {
7174
+ var options,
7175
+ _args2 = arguments;
7176
+ return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
7177
+ while (1) {
7178
+ switch (_context2.prev = _context2.next) {
7179
+ case 0:
7180
+ options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
7181
+ return _context2.abrupt("return", this.flag(MODERATION_ENTITY_TYPES.message, messageID, '', reason, options));
7182
+
7183
+ case 2:
7184
+ case "end":
7185
+ return _context2.stop();
7186
+ }
7187
+ }
7188
+ }, _callee2, this);
7189
+ }));
7190
+
7191
+ function flagMessage(_x3, _x4) {
7192
+ return _flagMessage.apply(this, arguments);
7193
+ }
7194
+
7195
+ return flagMessage;
7196
+ }()
7197
+ /**
7198
+ * Flag a user
7199
+ *
7200
+ * @param {string} entityType Entity type to be flagged
7201
+ * @param {string} entityId Entity ID to be flagged
7202
+ * @param {string} entityCreatorID User ID of the entity creator
7203
+ * @param {string} reason Reason for flagging the entity
7204
+ * @param {Object} options Additional options for flagging the entity
7205
+ * @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target entity
7206
+ * @param {Object} options.moderation_payload Content to be flagged e.g., { texts: ['text1', 'text2'], images: ['image1', 'image2']}
7207
+ * @param {Object} options.custom Additional data to be stored with the flag
7208
+ * @returns
7209
+ */
7210
+
7211
+ }, {
7212
+ key: "flag",
7213
+ value: function () {
7214
+ var _flag = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(entityType, entityId, entityCreatorID, reason) {
7215
+ var options,
7216
+ _args3 = arguments;
7217
+ return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
7218
+ while (1) {
7219
+ switch (_context3.prev = _context3.next) {
7220
+ case 0:
7221
+ options = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : {};
7222
+ _context3.next = 3;
7223
+ return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$1({
7224
+ entity_type: entityType,
7225
+ entity_id: entityId,
7226
+ entity_creator_id: entityCreatorID,
7227
+ reason: reason
7228
+ }, options));
7229
+
7230
+ case 3:
7231
+ return _context3.abrupt("return", _context3.sent);
7232
+
7233
+ case 4:
7234
+ case "end":
7235
+ return _context3.stop();
7236
+ }
7237
+ }
7238
+ }, _callee3, this);
7239
+ }));
7240
+
7241
+ function flag(_x5, _x6, _x7, _x8) {
7242
+ return _flag.apply(this, arguments);
7243
+ }
7244
+
7245
+ return flag;
7246
+ }()
7247
+ /**
7248
+ * Mute a user
7249
+ * @param {string} targetID User ID to be muted
7250
+ * @param {Object} options Additional options for muting the user
7251
+ * @param {string} options.user_id (For server side usage) User ID of the user who is muting the target user
7252
+ * @param {number} options.timeout Timeout for the mute in minutes
7253
+ * @returns
7254
+ */
7255
+
7256
+ }, {
7257
+ key: "muteUser",
7258
+ value: function () {
7259
+ var _muteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(targetID) {
7260
+ var options,
7261
+ _args4 = arguments;
7262
+ return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
7263
+ while (1) {
7264
+ switch (_context4.prev = _context4.next) {
7265
+ case 0:
7266
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
7267
+ _context4.next = 3;
7268
+ return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$1({
7269
+ target_ids: [targetID]
7270
+ }, options));
7271
+
7272
+ case 3:
7273
+ return _context4.abrupt("return", _context4.sent);
7274
+
7275
+ case 4:
7276
+ case "end":
7277
+ return _context4.stop();
7278
+ }
7279
+ }
7280
+ }, _callee4, this);
7281
+ }));
7282
+
7283
+ function muteUser(_x9) {
7284
+ return _muteUser.apply(this, arguments);
7285
+ }
7286
+
7287
+ return muteUser;
7288
+ }()
7289
+ /**
7290
+ * Unmute a user
7291
+ * @param {string} targetID User ID to be unmuted
7292
+ * @param {Object} options Additional options for unmuting the user
7293
+ * @param {string} options.user_id (For server side usage) User ID of the user who is unmuting the target user
7294
+ * @returns
7295
+ */
7296
+
7297
+ }, {
7298
+ key: "unmuteUser",
7299
+ value: function () {
7300
+ var _unmuteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(targetID, options) {
7301
+ return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
7302
+ while (1) {
7303
+ switch (_context5.prev = _context5.next) {
7304
+ case 0:
7305
+ _context5.next = 2;
7306
+ return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$1({
7307
+ target_ids: [targetID]
7308
+ }, options));
7309
+
7310
+ case 2:
7311
+ return _context5.abrupt("return", _context5.sent);
7312
+
7313
+ case 3:
7314
+ case "end":
7315
+ return _context5.stop();
7316
+ }
7317
+ }
7318
+ }, _callee5, this);
7319
+ }));
7320
+
7321
+ function unmuteUser(_x10, _x11) {
7322
+ return _unmuteUser.apply(this, arguments);
7323
+ }
7324
+
7325
+ return unmuteUser;
7326
+ }()
7327
+ /**
7328
+ * Get moderation report for a user
7329
+ * @param {string} userID User ID for which moderation report is to be fetched
7330
+ * @param {Object} options Additional options for fetching the moderation report
7331
+ * @param {boolean} options.create_user_if_not_exists Create user if not exists
7332
+ * @param {boolean} options.include_user_blocks Include user blocks
7333
+ * @param {boolean} options.include_user_mutes Include user mutes
7334
+ */
7335
+
7336
+ }, {
7337
+ key: "getUserModerationReport",
7338
+ value: function () {
7339
+ var _getUserModerationReport = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee6(userID) {
7340
+ var options,
7341
+ _args6 = arguments;
7342
+ return _regeneratorRuntime__default['default'].wrap(function _callee6$(_context6) {
7343
+ while (1) {
7344
+ switch (_context6.prev = _context6.next) {
7345
+ case 0:
7346
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
7347
+ _context6.next = 3;
7348
+ return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$1({
7349
+ user_id: userID
7350
+ }, options));
7351
+
7352
+ case 3:
7353
+ return _context6.abrupt("return", _context6.sent);
7354
+
7355
+ case 4:
7356
+ case "end":
7357
+ return _context6.stop();
7358
+ }
7359
+ }
7360
+ }, _callee6, this);
7361
+ }));
7362
+
7363
+ function getUserModerationReport(_x12) {
7364
+ return _getUserModerationReport.apply(this, arguments);
7365
+ }
7366
+
7367
+ return getUserModerationReport;
7368
+ }()
7369
+ /**
7370
+ * Query review queue
7371
+ * @param {Object} filterConditions Filter conditions for querying review queue
7372
+ * @param {Object} sort Sort conditions for querying review queue
7373
+ * @param {Object} options Pagination options for querying review queue
7374
+ */
7375
+
7376
+ }, {
7377
+ key: "queryReviewQueue",
7378
+ value: function () {
7379
+ var _queryReviewQueue = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7() {
7380
+ var filterConditions,
7381
+ sort,
7382
+ options,
7383
+ _args7 = arguments;
7384
+ return _regeneratorRuntime__default['default'].wrap(function _callee7$(_context7) {
7385
+ while (1) {
7386
+ switch (_context7.prev = _context7.next) {
7387
+ case 0:
7388
+ filterConditions = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
7389
+ sort = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : [];
7390
+ options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
7391
+ _context7.next = 5;
7392
+ return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$1({
7393
+ filter: filterConditions,
7394
+ sort: normalizeQuerySort(sort)
7395
+ }, options));
7396
+
7397
+ case 5:
7398
+ return _context7.abrupt("return", _context7.sent);
7399
+
7400
+ case 6:
7401
+ case "end":
7402
+ return _context7.stop();
7403
+ }
7404
+ }
7405
+ }, _callee7, this);
7406
+ }));
7407
+
7408
+ function queryReviewQueue() {
7409
+ return _queryReviewQueue.apply(this, arguments);
7410
+ }
7411
+
7412
+ return queryReviewQueue;
7413
+ }()
7414
+ /**
7415
+ * Upsert moderation config
7416
+ * @param {Object} config Moderation config to be upserted
7417
+ */
7418
+
7419
+ }, {
7420
+ key: "upsertConfig",
7421
+ value: function () {
7422
+ var _upsertConfig = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8() {
7423
+ var config,
7424
+ _args8 = arguments;
7425
+ return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
7426
+ while (1) {
7427
+ switch (_context8.prev = _context8.next) {
7428
+ case 0:
7429
+ config = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
7430
+ _context8.next = 3;
7431
+ return this.client.post(this.client.baseURL + '/api/v2/moderation/config', config);
7432
+
7433
+ case 3:
7434
+ return _context8.abrupt("return", _context8.sent);
7435
+
7436
+ case 4:
7437
+ case "end":
7438
+ return _context8.stop();
7439
+ }
7440
+ }
7441
+ }, _callee8, this);
7442
+ }));
7443
+
7444
+ function upsertConfig() {
7445
+ return _upsertConfig.apply(this, arguments);
7446
+ }
7447
+
7448
+ return upsertConfig;
7449
+ }()
7450
+ /**
7451
+ * Get moderation config
7452
+ * @param {string} key Key for which moderation config is to be fetched
7453
+ */
7454
+
7455
+ }, {
7456
+ key: "getConfig",
7457
+ value: function () {
7458
+ var _getConfig = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee9(key) {
7459
+ return _regeneratorRuntime__default['default'].wrap(function _callee9$(_context9) {
7460
+ while (1) {
7461
+ switch (_context9.prev = _context9.next) {
7462
+ case 0:
7463
+ _context9.next = 2;
7464
+ return this.client.get(this.client.baseURL + '/api/v2/moderation/config/' + key);
7465
+
7466
+ case 2:
7467
+ return _context9.abrupt("return", _context9.sent);
7468
+
7469
+ case 3:
7470
+ case "end":
7471
+ return _context9.stop();
7472
+ }
7473
+ }
7474
+ }, _callee9, this);
7475
+ }));
7476
+
7477
+ function getConfig(_x13) {
7478
+ return _getConfig.apply(this, arguments);
7479
+ }
7480
+
7481
+ return getConfig;
7482
+ }()
7483
+ }, {
7484
+ key: "submitAction",
7485
+ value: function () {
7486
+ var _submitAction = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee10(actionType, itemID) {
7487
+ var options,
7488
+ _args10 = arguments;
7489
+ return _regeneratorRuntime__default['default'].wrap(function _callee10$(_context10) {
7490
+ while (1) {
7491
+ switch (_context10.prev = _context10.next) {
7492
+ case 0:
7493
+ options = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : {};
7494
+ _context10.next = 3;
7495
+ return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$1({
7496
+ action_type: actionType,
7497
+ item_id: itemID
7498
+ }, options));
7499
+
7500
+ case 3:
7501
+ return _context10.abrupt("return", _context10.sent);
7502
+
7503
+ case 4:
7504
+ case "end":
7505
+ return _context10.stop();
7506
+ }
7507
+ }
7508
+ }, _callee10, this);
7509
+ }));
7510
+
7511
+ function submitAction(_x14, _x15) {
7512
+ return _submitAction.apply(this, arguments);
7513
+ }
7514
+
7515
+ return submitAction;
7516
+ }()
7517
+ }]);
7518
+
7519
+ return Moderation;
7520
+ }();
7521
+
7104
7522
  var _excluded = ["created_at", "updated_at", "last_active", "online"],
7105
7523
  _excluded2 = ["params", "headers"];
7106
7524
 
@@ -7153,6 +7571,8 @@ var StreamChat = /*#__PURE__*/function () {
7153
7571
 
7154
7572
  _defineProperty__default['default'](this, "recoverStateOnReconnect", void 0);
7155
7573
 
7574
+ _defineProperty__default['default'](this, "moderation", void 0);
7575
+
7156
7576
  _defineProperty__default['default'](this, "mutedChannels", void 0);
7157
7577
 
7158
7578
  _defineProperty__default['default'](this, "mutedUsers", void 0);
@@ -7914,7 +8334,8 @@ var StreamChat = /*#__PURE__*/function () {
7914
8334
  this.state = new ClientState(); // a list of channels to hide ws events from
7915
8335
 
7916
8336
  this.mutedChannels = [];
7917
- this.mutedUsers = []; // set the secret
8337
+ this.mutedUsers = [];
8338
+ this.moderation = new Moderation(this); // set the secret
7918
8339
 
7919
8340
  if (secretOrOptions && isString(secretOrOptions)) {
7920
8341
  this.secret = secretOrOptions;
@@ -7942,11 +8363,11 @@ var StreamChat = /*#__PURE__*/function () {
7942
8363
  this.axiosInstance = axios__default['default'].create(this.options);
7943
8364
  this.setBaseURL(this.options.baseURL || 'https://chat.stream-io-api.com');
7944
8365
 
7945
- if (typeof process !== 'undefined' && process.env.STREAM_LOCAL_TEST_RUN) {
8366
+ if (typeof process !== 'undefined' && 'env' in process && process.env.STREAM_LOCAL_TEST_RUN) {
7946
8367
  this.setBaseURL('http://localhost:3030');
7947
8368
  }
7948
8369
 
7949
- if (typeof process !== 'undefined' && process.env.STREAM_LOCAL_TEST_HOST) {
8370
+ if (typeof process !== 'undefined' && 'env' in process && process.env.STREAM_LOCAL_TEST_HOST) {
7950
8371
  this.setBaseURL('http://' + process.env.STREAM_LOCAL_TEST_HOST);
7951
8372
  } // WS connection is initialized when setUser is called
7952
8373
 
@@ -11578,7 +11999,7 @@ var StreamChat = /*#__PURE__*/function () {
11578
11999
  }, {
11579
12000
  key: "getUserAgent",
11580
12001
  value: function getUserAgent() {
11581
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.37.0");
12002
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.38.0");
11582
12003
  }
11583
12004
  }, {
11584
12005
  key: "setUserAgent",
@@ -13023,19 +13444,22 @@ var StreamChat = /*#__PURE__*/function () {
13023
13444
  /**
13024
13445
  * Creates a poll
13025
13446
  * @param params PollData The poll that will be created
13447
+ * @param userId string The user id (only serverside)
13026
13448
  * @returns {APIResponse & CreatePollAPIResponse} The poll
13027
13449
  */
13028
13450
 
13029
13451
  }, {
13030
13452
  key: "createPoll",
13031
13453
  value: function () {
13032
- var _createPoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee98(poll) {
13454
+ var _createPoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee98(poll, userId) {
13033
13455
  return _regeneratorRuntime__default['default'].wrap(function _callee98$(_context98) {
13034
13456
  while (1) {
13035
13457
  switch (_context98.prev = _context98.next) {
13036
13458
  case 0:
13037
13459
  _context98.next = 2;
13038
- return this.post(this.baseURL + "/polls", poll);
13460
+ return this.post(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
13461
+ user_id: userId
13462
+ } : {}));
13039
13463
 
13040
13464
  case 2:
13041
13465
  return _context98.abrupt("return", _context98.sent);
@@ -13048,7 +13472,7 @@ var StreamChat = /*#__PURE__*/function () {
13048
13472
  }, _callee98, this);
13049
13473
  }));
13050
13474
 
13051
- function createPoll(_x136) {
13475
+ function createPoll(_x136, _x137) {
13052
13476
  return _createPoll.apply(this, arguments);
13053
13477
  }
13054
13478
 
@@ -13057,6 +13481,7 @@ var StreamChat = /*#__PURE__*/function () {
13057
13481
  /**
13058
13482
  * Retrieves a poll
13059
13483
  * @param id string The poll id
13484
+ * @param userId string The user id (only serverside)
13060
13485
  * @returns {APIResponse & GetPollAPIResponse} The poll
13061
13486
  */
13062
13487
 
@@ -13069,9 +13494,9 @@ var StreamChat = /*#__PURE__*/function () {
13069
13494
  switch (_context99.prev = _context99.next) {
13070
13495
  case 0:
13071
13496
  _context99.next = 2;
13072
- return this.get(this.baseURL + "/polls/".concat(id), _objectSpread({}, userId ? {
13497
+ return this.get(this.baseURL + "/polls/".concat(id), userId ? {
13073
13498
  user_id: userId
13074
- } : {}));
13499
+ } : {});
13075
13500
 
13076
13501
  case 2:
13077
13502
  return _context99.abrupt("return", _context99.sent);
@@ -13084,7 +13509,7 @@ var StreamChat = /*#__PURE__*/function () {
13084
13509
  }, _callee99, this);
13085
13510
  }));
13086
13511
 
13087
- function getPoll(_x137, _x138) {
13512
+ function getPoll(_x138, _x139) {
13088
13513
  return _getPoll.apply(this, arguments);
13089
13514
  }
13090
13515
 
@@ -13093,19 +13518,22 @@ var StreamChat = /*#__PURE__*/function () {
13093
13518
  /**
13094
13519
  * Updates a poll
13095
13520
  * @param poll PollData The poll that will be updated
13521
+ * @param userId string The user id (only serverside)
13096
13522
  * @returns {APIResponse & PollResponse} The poll
13097
13523
  */
13098
13524
 
13099
13525
  }, {
13100
13526
  key: "updatePoll",
13101
13527
  value: function () {
13102
- var _updatePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee100(poll) {
13528
+ var _updatePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee100(poll, userId) {
13103
13529
  return _regeneratorRuntime__default['default'].wrap(function _callee100$(_context100) {
13104
13530
  while (1) {
13105
13531
  switch (_context100.prev = _context100.next) {
13106
13532
  case 0:
13107
13533
  _context100.next = 2;
13108
- return this.put(this.baseURL + "/polls", poll);
13534
+ return this.put(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
13535
+ user_id: userId
13536
+ } : {}));
13109
13537
 
13110
13538
  case 2:
13111
13539
  return _context100.abrupt("return", _context100.sent);
@@ -13118,7 +13546,7 @@ var StreamChat = /*#__PURE__*/function () {
13118
13546
  }, _callee100, this);
13119
13547
  }));
13120
13548
 
13121
- function updatePoll(_x139) {
13549
+ function updatePoll(_x140, _x141) {
13122
13550
  return _updatePoll.apply(this, arguments);
13123
13551
  }
13124
13552
 
@@ -13128,6 +13556,7 @@ var StreamChat = /*#__PURE__*/function () {
13128
13556
  * Partially updates a poll
13129
13557
  * @param id string The poll id
13130
13558
  * @param {PartialPollUpdate<StreamChatGenerics>} partialPollObject which should contain id and any of "set" or "unset" params;
13559
+ * @param userId string The user id (only serverside)
13131
13560
  * example: {id: "44f26af5-f2be-4fa7-9dac-71cf893781de", set:{field: value}, unset:["field2"]}
13132
13561
  * @returns {APIResponse & UpdatePollAPIResponse} The poll
13133
13562
  */
@@ -13135,13 +13564,15 @@ var StreamChat = /*#__PURE__*/function () {
13135
13564
  }, {
13136
13565
  key: "partialUpdatePoll",
13137
13566
  value: function () {
13138
- var _partialUpdatePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee101(id, partialPollObject) {
13567
+ var _partialUpdatePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee101(id, partialPollObject, userId) {
13139
13568
  return _regeneratorRuntime__default['default'].wrap(function _callee101$(_context101) {
13140
13569
  while (1) {
13141
13570
  switch (_context101.prev = _context101.next) {
13142
13571
  case 0:
13143
13572
  _context101.next = 2;
13144
- return this.patch(this.baseURL + "/polls/".concat(id), partialPollObject);
13573
+ return this.patch(this.baseURL + "/polls/".concat(id), _objectSpread(_objectSpread({}, partialPollObject), userId ? {
13574
+ user_id: userId
13575
+ } : {}));
13145
13576
 
13146
13577
  case 2:
13147
13578
  return _context101.abrupt("return", _context101.sent);
@@ -13154,7 +13585,7 @@ var StreamChat = /*#__PURE__*/function () {
13154
13585
  }, _callee101, this);
13155
13586
  }));
13156
13587
 
13157
- function partialUpdatePoll(_x140, _x141) {
13588
+ function partialUpdatePoll(_x142, _x143, _x144) {
13158
13589
  return _partialUpdatePoll.apply(this, arguments);
13159
13590
  }
13160
13591
 
@@ -13191,7 +13622,7 @@ var StreamChat = /*#__PURE__*/function () {
13191
13622
  }, _callee102, this);
13192
13623
  }));
13193
13624
 
13194
- function deletePoll(_x142, _x143) {
13625
+ function deletePoll(_x145, _x146) {
13195
13626
  return _deletePoll.apply(this, arguments);
13196
13627
  }
13197
13628
 
@@ -13200,22 +13631,25 @@ var StreamChat = /*#__PURE__*/function () {
13200
13631
  /**
13201
13632
  * Close a poll
13202
13633
  * @param id string The poll id
13634
+ * @param userId string The user id (only serverside)
13203
13635
  * @returns {APIResponse & UpdatePollAPIResponse} The poll
13204
13636
  */
13205
13637
 
13206
13638
  }, {
13207
13639
  key: "closePoll",
13208
13640
  value: function () {
13209
- var _closePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee103(id) {
13641
+ var _closePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee103(id, userId) {
13210
13642
  return _regeneratorRuntime__default['default'].wrap(function _callee103$(_context103) {
13211
13643
  while (1) {
13212
13644
  switch (_context103.prev = _context103.next) {
13213
13645
  case 0:
13214
- return _context103.abrupt("return", this.partialUpdatePoll(id, {
13646
+ return _context103.abrupt("return", this.partialUpdatePoll(id, _objectSpread({
13215
13647
  set: {
13216
13648
  is_closed: true
13217
13649
  }
13218
- }));
13650
+ }, userId ? {
13651
+ user_id: userId
13652
+ } : {})));
13219
13653
 
13220
13654
  case 1:
13221
13655
  case "end":
@@ -13225,7 +13659,7 @@ var StreamChat = /*#__PURE__*/function () {
13225
13659
  }, _callee103, this);
13226
13660
  }));
13227
13661
 
13228
- function closePoll(_x144) {
13662
+ function closePoll(_x147, _x148) {
13229
13663
  return _closePoll.apply(this, arguments);
13230
13664
  }
13231
13665
 
@@ -13235,19 +13669,22 @@ var StreamChat = /*#__PURE__*/function () {
13235
13669
  * Creates a poll option
13236
13670
  * @param pollId string The poll id
13237
13671
  * @param option PollOptionData The poll option that will be created
13672
+ * @param userId string The user id (only serverside)
13238
13673
  * @returns {APIResponse & PollOptionResponse} The poll option
13239
13674
  */
13240
13675
 
13241
13676
  }, {
13242
13677
  key: "createPollOption",
13243
13678
  value: function () {
13244
- var _createPollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee104(pollId, option) {
13679
+ var _createPollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee104(pollId, option, userId) {
13245
13680
  return _regeneratorRuntime__default['default'].wrap(function _callee104$(_context104) {
13246
13681
  while (1) {
13247
13682
  switch (_context104.prev = _context104.next) {
13248
13683
  case 0:
13249
13684
  _context104.next = 2;
13250
- return this.post(this.baseURL + "/polls/".concat(pollId, "/options"), option);
13685
+ return this.post(this.baseURL + "/polls/".concat(pollId, "/options"), _objectSpread(_objectSpread({}, option), userId ? {
13686
+ user_id: userId
13687
+ } : {}));
13251
13688
 
13252
13689
  case 2:
13253
13690
  return _context104.abrupt("return", _context104.sent);
@@ -13260,7 +13697,7 @@ var StreamChat = /*#__PURE__*/function () {
13260
13697
  }, _callee104, this);
13261
13698
  }));
13262
13699
 
13263
- function createPollOption(_x145, _x146) {
13700
+ function createPollOption(_x149, _x150, _x151) {
13264
13701
  return _createPollOption.apply(this, arguments);
13265
13702
  }
13266
13703
 
@@ -13270,19 +13707,22 @@ var StreamChat = /*#__PURE__*/function () {
13270
13707
  * Retrieves a poll option
13271
13708
  * @param pollId string The poll id
13272
13709
  * @param optionId string The poll option id
13710
+ * @param userId string The user id (only serverside)
13273
13711
  * @returns {APIResponse & PollOptionResponse} The poll option
13274
13712
  */
13275
13713
 
13276
13714
  }, {
13277
13715
  key: "getPollOption",
13278
13716
  value: function () {
13279
- var _getPollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee105(pollId, optionId) {
13717
+ var _getPollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee105(pollId, optionId, userId) {
13280
13718
  return _regeneratorRuntime__default['default'].wrap(function _callee105$(_context105) {
13281
13719
  while (1) {
13282
13720
  switch (_context105.prev = _context105.next) {
13283
13721
  case 0:
13284
13722
  _context105.next = 2;
13285
- return this.get(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId));
13723
+ return this.get(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId), userId ? {
13724
+ user_id: userId
13725
+ } : {});
13286
13726
 
13287
13727
  case 2:
13288
13728
  return _context105.abrupt("return", _context105.sent);
@@ -13295,7 +13735,7 @@ var StreamChat = /*#__PURE__*/function () {
13295
13735
  }, _callee105, this);
13296
13736
  }));
13297
13737
 
13298
- function getPollOption(_x147, _x148) {
13738
+ function getPollOption(_x152, _x153, _x154) {
13299
13739
  return _getPollOption.apply(this, arguments);
13300
13740
  }
13301
13741
 
@@ -13305,19 +13745,22 @@ var StreamChat = /*#__PURE__*/function () {
13305
13745
  * Updates a poll option
13306
13746
  * @param pollId string The poll id
13307
13747
  * @param option PollOptionData The poll option that will be updated
13748
+ * @param userId string The user id (only serverside)
13308
13749
  * @returns
13309
13750
  */
13310
13751
 
13311
13752
  }, {
13312
13753
  key: "updatePollOption",
13313
13754
  value: function () {
13314
- var _updatePollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee106(pollId, option) {
13755
+ var _updatePollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee106(pollId, option, userId) {
13315
13756
  return _regeneratorRuntime__default['default'].wrap(function _callee106$(_context106) {
13316
13757
  while (1) {
13317
13758
  switch (_context106.prev = _context106.next) {
13318
13759
  case 0:
13319
13760
  _context106.next = 2;
13320
- return this.put(this.baseURL + "/polls/".concat(pollId, "/options"), option);
13761
+ return this.put(this.baseURL + "/polls/".concat(pollId, "/options"), _objectSpread(_objectSpread({}, option), userId ? {
13762
+ user_id: userId
13763
+ } : {}));
13321
13764
 
13322
13765
  case 2:
13323
13766
  return _context106.abrupt("return", _context106.sent);
@@ -13330,7 +13773,7 @@ var StreamChat = /*#__PURE__*/function () {
13330
13773
  }, _callee106, this);
13331
13774
  }));
13332
13775
 
13333
- function updatePollOption(_x149, _x150) {
13776
+ function updatePollOption(_x155, _x156, _x157) {
13334
13777
  return _updatePollOption.apply(this, arguments);
13335
13778
  }
13336
13779
 
@@ -13340,19 +13783,22 @@ var StreamChat = /*#__PURE__*/function () {
13340
13783
  * Delete a poll option
13341
13784
  * @param pollId string The poll id
13342
13785
  * @param optionId string The poll option id
13786
+ * @param userId string The user id (only serverside)
13343
13787
  * @returns {APIResponse} The poll option
13344
13788
  */
13345
13789
 
13346
13790
  }, {
13347
13791
  key: "deletePollOption",
13348
13792
  value: function () {
13349
- var _deletePollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee107(pollId, optionId) {
13793
+ var _deletePollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee107(pollId, optionId, userId) {
13350
13794
  return _regeneratorRuntime__default['default'].wrap(function _callee107$(_context107) {
13351
13795
  while (1) {
13352
13796
  switch (_context107.prev = _context107.next) {
13353
13797
  case 0:
13354
13798
  _context107.next = 2;
13355
- return this.delete(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId));
13799
+ return this.delete(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId), userId ? {
13800
+ user_id: userId
13801
+ } : {});
13356
13802
 
13357
13803
  case 2:
13358
13804
  return _context107.abrupt("return", _context107.sent);
@@ -13365,7 +13811,7 @@ var StreamChat = /*#__PURE__*/function () {
13365
13811
  }, _callee107, this);
13366
13812
  }));
13367
13813
 
13368
- function deletePollOption(_x151, _x152) {
13814
+ function deletePollOption(_x158, _x159, _x160) {
13369
13815
  return _deletePollOption.apply(this, arguments);
13370
13816
  }
13371
13817
 
@@ -13376,29 +13822,29 @@ var StreamChat = /*#__PURE__*/function () {
13376
13822
  * @param messageId string The message id
13377
13823
  * @param pollId string The poll id
13378
13824
  * @param vote PollVoteData The vote that will be casted
13825
+ * @param userId string The user id (only serverside)
13379
13826
  * @returns {APIResponse & CastVoteAPIResponse} The poll vote
13380
13827
  */
13381
13828
 
13382
13829
  }, {
13383
13830
  key: "castPollVote",
13384
13831
  value: function () {
13385
- var _castPollVote = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee108(messageId, pollId, vote) {
13386
- var options,
13387
- _args108 = arguments;
13832
+ var _castPollVote = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee108(messageId, pollId, vote, userId) {
13388
13833
  return _regeneratorRuntime__default['default'].wrap(function _callee108$(_context108) {
13389
13834
  while (1) {
13390
13835
  switch (_context108.prev = _context108.next) {
13391
13836
  case 0:
13392
- options = _args108.length > 3 && _args108[3] !== undefined ? _args108[3] : {};
13393
- _context108.next = 3;
13837
+ _context108.next = 2;
13394
13838
  return this.post(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote"), _objectSpread({
13395
13839
  vote: vote
13396
- }, options));
13840
+ }, userId ? {
13841
+ user_id: userId
13842
+ } : {}));
13397
13843
 
13398
- case 3:
13844
+ case 2:
13399
13845
  return _context108.abrupt("return", _context108.sent);
13400
13846
 
13401
- case 4:
13847
+ case 3:
13402
13848
  case "end":
13403
13849
  return _context108.stop();
13404
13850
  }
@@ -13406,7 +13852,7 @@ var StreamChat = /*#__PURE__*/function () {
13406
13852
  }, _callee108, this);
13407
13853
  }));
13408
13854
 
13409
- function castPollVote(_x153, _x154, _x155) {
13855
+ function castPollVote(_x161, _x162, _x163, _x164) {
13410
13856
  return _castPollVote.apply(this, arguments);
13411
13857
  }
13412
13858
 
@@ -13417,19 +13863,20 @@ var StreamChat = /*#__PURE__*/function () {
13417
13863
  * @param messageId string The message id
13418
13864
  * @param pollId string The poll id
13419
13865
  * @param answerText string The answer text
13866
+ * @param userId string The user id (only serverside)
13420
13867
  */
13421
13868
 
13422
13869
  }, {
13423
13870
  key: "addPollAnswer",
13424
13871
  value: function () {
13425
- var _addPollAnswer = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee109(messageId, pollId, answerText) {
13872
+ var _addPollAnswer = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee109(messageId, pollId, answerText, userId) {
13426
13873
  return _regeneratorRuntime__default['default'].wrap(function _callee109$(_context109) {
13427
13874
  while (1) {
13428
13875
  switch (_context109.prev = _context109.next) {
13429
13876
  case 0:
13430
13877
  return _context109.abrupt("return", this.castPollVote(messageId, pollId, {
13431
13878
  answer_text: answerText
13432
- }));
13879
+ }, userId));
13433
13880
 
13434
13881
  case 1:
13435
13882
  case "end":
@@ -13439,7 +13886,7 @@ var StreamChat = /*#__PURE__*/function () {
13439
13886
  }, _callee109, this);
13440
13887
  }));
13441
13888
 
13442
- function addPollAnswer(_x156, _x157, _x158) {
13889
+ function addPollAnswer(_x165, _x166, _x167, _x168) {
13443
13890
  return _addPollAnswer.apply(this, arguments);
13444
13891
  }
13445
13892
 
@@ -13448,13 +13895,15 @@ var StreamChat = /*#__PURE__*/function () {
13448
13895
  }, {
13449
13896
  key: "removePollVote",
13450
13897
  value: function () {
13451
- var _removePollVote = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee110(messageId, pollId, voteId) {
13898
+ var _removePollVote = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee110(messageId, pollId, voteId, userId) {
13452
13899
  return _regeneratorRuntime__default['default'].wrap(function _callee110$(_context110) {
13453
13900
  while (1) {
13454
13901
  switch (_context110.prev = _context110.next) {
13455
13902
  case 0:
13456
13903
  _context110.next = 2;
13457
- return this.delete(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote/").concat(voteId));
13904
+ return this.delete(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote/").concat(voteId), _objectSpread({}, userId ? {
13905
+ user_id: userId
13906
+ } : {}));
13458
13907
 
13459
13908
  case 2:
13460
13909
  return _context110.abrupt("return", _context110.sent);
@@ -13467,7 +13916,7 @@ var StreamChat = /*#__PURE__*/function () {
13467
13916
  }, _callee110, this);
13468
13917
  }));
13469
13918
 
13470
- function removePollVote(_x159, _x160, _x161) {
13919
+ function removePollVote(_x169, _x170, _x171, _x172) {
13471
13920
  return _removePollVote.apply(this, arguments);
13472
13921
  }
13473
13922
 
@@ -13478,6 +13927,7 @@ var StreamChat = /*#__PURE__*/function () {
13478
13927
  * @param filter
13479
13928
  * @param sort
13480
13929
  * @param options Option object, {limit: 10, offset:0}
13930
+ * @param userId string The user id (only serverside)
13481
13931
  * @returns {APIResponse & QueryPollsResponse} The polls
13482
13932
  */
13483
13933
 
@@ -13488,6 +13938,8 @@ var StreamChat = /*#__PURE__*/function () {
13488
13938
  var filter,
13489
13939
  sort,
13490
13940
  options,
13941
+ userId,
13942
+ q,
13491
13943
  _args111 = arguments;
13492
13944
  return _regeneratorRuntime__default['default'].wrap(function _callee111$(_context111) {
13493
13945
  while (1) {
@@ -13496,16 +13948,18 @@ var StreamChat = /*#__PURE__*/function () {
13496
13948
  filter = _args111.length > 0 && _args111[0] !== undefined ? _args111[0] : {};
13497
13949
  sort = _args111.length > 1 && _args111[1] !== undefined ? _args111[1] : [];
13498
13950
  options = _args111.length > 2 && _args111[2] !== undefined ? _args111[2] : {};
13499
- _context111.next = 5;
13500
- return this.post(this.baseURL + '/polls/query', _objectSpread({
13951
+ userId = _args111.length > 3 ? _args111[3] : undefined;
13952
+ q = userId ? "?user_id=".concat(userId) : '';
13953
+ _context111.next = 7;
13954
+ return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread({
13501
13955
  filter: filter,
13502
13956
  sort: normalizeQuerySort(sort)
13503
13957
  }, options));
13504
13958
 
13505
- case 5:
13959
+ case 7:
13506
13960
  return _context111.abrupt("return", _context111.sent);
13507
13961
 
13508
- case 6:
13962
+ case 8:
13509
13963
  case "end":
13510
13964
  return _context111.stop();
13511
13965
  }
@@ -13525,7 +13979,8 @@ var StreamChat = /*#__PURE__*/function () {
13525
13979
  * @param filter
13526
13980
  * @param sort
13527
13981
  * @param options Option object, {limit: 10, offset:0}
13528
- * @returns {APIResponse & PollVotesAPIResponse} The poll votes
13982
+ * @param userId string The user id (only serverside)
13983
+ * @returns {APIResponse & PollVotesAPIResponse} The poll votes
13529
13984
  */
13530
13985
 
13531
13986
  }, {
@@ -13535,6 +13990,8 @@ var StreamChat = /*#__PURE__*/function () {
13535
13990
  var filter,
13536
13991
  sort,
13537
13992
  options,
13993
+ userId,
13994
+ q,
13538
13995
  _args112 = arguments;
13539
13996
  return _regeneratorRuntime__default['default'].wrap(function _callee112$(_context112) {
13540
13997
  while (1) {
@@ -13543,16 +14000,18 @@ var StreamChat = /*#__PURE__*/function () {
13543
14000
  filter = _args112.length > 1 && _args112[1] !== undefined ? _args112[1] : {};
13544
14001
  sort = _args112.length > 2 && _args112[2] !== undefined ? _args112[2] : [];
13545
14002
  options = _args112.length > 3 && _args112[3] !== undefined ? _args112[3] : {};
13546
- _context112.next = 5;
13547
- return this.post(this.baseURL + "/polls/".concat(pollId, "/votes"), _objectSpread({
14003
+ userId = _args112.length > 4 ? _args112[4] : undefined;
14004
+ q = userId ? "?user_id=".concat(userId) : '';
14005
+ _context112.next = 7;
14006
+ return this.post(this.baseURL + "/polls/".concat(pollId, "/votes").concat(q), _objectSpread({
13548
14007
  filter: filter,
13549
14008
  sort: normalizeQuerySort(sort)
13550
14009
  }, options));
13551
14010
 
13552
- case 5:
14011
+ case 7:
13553
14012
  return _context112.abrupt("return", _context112.sent);
13554
14013
 
13555
- case 6:
14014
+ case 8:
13556
14015
  case "end":
13557
14016
  return _context112.stop();
13558
14017
  }
@@ -13560,14 +14019,14 @@ var StreamChat = /*#__PURE__*/function () {
13560
14019
  }, _callee112, this);
13561
14020
  }));
13562
14021
 
13563
- function queryPollVotes(_x162) {
14022
+ function queryPollVotes(_x173) {
13564
14023
  return _queryPollVotes.apply(this, arguments);
13565
14024
  }
13566
14025
 
13567
14026
  return queryPollVotes;
13568
14027
  }()
13569
14028
  /**
13570
- * Queries message histories
14029
+ * Query message history
13571
14030
  * @param filter
13572
14031
  * @param sort
13573
14032
  * @param options Option object, {limit: 10}
@@ -13649,7 +14108,7 @@ var StreamChat = /*#__PURE__*/function () {
13649
14108
  }, _callee114, this);
13650
14109
  }));
13651
14110
 
13652
- function updateFlags(_x163, _x164) {
14111
+ function updateFlags(_x174, _x175) {
13653
14112
  return _updateFlags.apply(this, arguments);
13654
14113
  }
13655
14114
 
@@ -13826,8 +14285,10 @@ exports.ErrorFromResponse = ErrorFromResponse;
13826
14285
  exports.InsightMetrics = InsightMetrics;
13827
14286
  exports.JWTServerToken = JWTServerToken;
13828
14287
  exports.JWTUserToken = JWTUserToken;
14288
+ exports.MODERATION_ENTITY_TYPES = MODERATION_ENTITY_TYPES;
13829
14289
  exports.MaxPriority = MaxPriority;
13830
14290
  exports.MinPriority = MinPriority;
14291
+ exports.Moderation = Moderation;
13831
14292
  exports.Permission = Permission;
13832
14293
  exports.Segment = Segment;
13833
14294
  exports.StableWSConnection = StableWSConnection;