stream-chat 4.3.0 → 4.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -14,7 +14,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
14
14
  import FormData from 'form-data';
15
15
  import WebSocket from 'isomorphic-ws';
16
16
  import jwt from 'jsonwebtoken';
17
- import crypto from 'crypto';
17
+ import crypto$1 from 'crypto';
18
18
 
19
19
  function isString$1(arrayOrString) {
20
20
  return typeof arrayOrString === 'string';
@@ -89,9 +89,9 @@ var decodeBase64 = function decodeBase64(s) {
89
89
  return r;
90
90
  };
91
91
 
92
- 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; }
92
+ 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; }
93
93
 
94
- 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(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; }
94
+ 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(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; }
95
95
 
96
96
  /**
97
97
  * ChannelState - A container class for the channel state.
@@ -159,7 +159,7 @@ var ChannelState = /*#__PURE__*/function () {
159
159
  var m = messages[i];
160
160
 
161
161
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
162
- messages[i] = _objectSpread$4(_objectSpread$4({}, m), {}, {
162
+ messages[i] = _objectSpread$5(_objectSpread$5({}, m), {}, {
163
163
  user: user
164
164
  });
165
165
  }
@@ -212,7 +212,7 @@ var ChannelState = /*#__PURE__*/function () {
212
212
  user: m.user
213
213
  };
214
214
  } else {
215
- messages[i] = _objectSpread$4(_objectSpread$4({}, m), {}, {
215
+ messages[i] = _objectSpread$5(_objectSpread$5({}, m), {}, {
216
216
  type: 'deleted',
217
217
  deleted_at: user.deleted_at
218
218
  });
@@ -280,7 +280,7 @@ var ChannelState = /*#__PURE__*/function () {
280
280
  }, {
281
281
  key: "formatMessage",
282
282
  value: function formatMessage(message) {
283
- return _objectSpread$4(_objectSpread$4({}, message), {}, {
283
+ return _objectSpread$5(_objectSpread$5({}, message), {}, {
284
284
  /**
285
285
  * @deprecated please use `html`
286
286
  */
@@ -470,7 +470,7 @@ var ChannelState = /*#__PURE__*/function () {
470
470
  var parseMessage = function parseMessage(m) {
471
471
  var _m$pinned_at, _m$updated_at;
472
472
 
473
- return _objectSpread$4(_objectSpread$4({}, m), {}, {
473
+ return _objectSpread$5(_objectSpread$5({}, m), {}, {
474
474
  created_at: m.created_at.toString(),
475
475
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toString(),
476
476
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toString()
@@ -480,8 +480,8 @@ var ChannelState = /*#__PURE__*/function () {
480
480
  var updatedMessages = this.messages.filter(function (msg) {
481
481
  return msg.quoted_message_id === message.id;
482
482
  }).map(parseMessage).map(function (msg) {
483
- return _objectSpread$4(_objectSpread$4({}, msg), {}, {
484
- quoted_message: _objectSpread$4(_objectSpread$4({}, message), {}, {
483
+ return _objectSpread$5(_objectSpread$5({}, msg), {}, {
484
+ quoted_message: _objectSpread$5(_objectSpread$5({}, message), {}, {
485
485
  attachments: []
486
486
  })
487
487
  });
@@ -701,9 +701,9 @@ var ChannelState = /*#__PURE__*/function () {
701
701
  return ChannelState;
702
702
  }();
703
703
 
704
- 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; }
704
+ 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; }
705
705
 
706
- 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(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; }
706
+ 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(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; }
707
707
 
708
708
  var EVENT_MAP = {
709
709
  'channel.created': true,
@@ -750,7 +750,7 @@ var EVENT_MAP = {
750
750
  'connection.recovered': true
751
751
  };
752
752
 
753
- var IS_VALID_EVENT_MAP_TYPE = _objectSpread$3(_objectSpread$3({}, EVENT_MAP), {}, {
753
+ var IS_VALID_EVENT_MAP_TYPE = _objectSpread$4(_objectSpread$4({}, EVENT_MAP), {}, {
754
754
  all: true
755
755
  });
756
756
 
@@ -883,17 +883,52 @@ function retryInterval(numberOfFailures) {
883
883
  var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
884
884
  return Math.floor(Math.random() * (max - min) + min);
885
885
  }
886
- /** adopted from https://github.com/ai/nanoid/blob/master/non-secure/index.js */
887
-
888
- var alphabet = 'ModuleSymbhasOwnPr0123456789ABCDEFGHNRVfgctiUvzKqYTJkLxpZXIjQW';
889
886
  function randomId() {
890
- var id = '';
887
+ return generateUUIDv4();
888
+ }
889
+
890
+ function hex(bytes) {
891
+ var s = '';
892
+
893
+ for (var i = 0; i < bytes.length; i++) {
894
+ s += bytes[i].toString(16).padStart(2, '0');
895
+ }
896
+
897
+ return s;
898
+ } // https://tools.ietf.org/html/rfc4122
899
+
900
+
901
+ function generateUUIDv4() {
902
+ var bytes = getRandomBytes(16);
903
+ bytes[6] = bytes[6] & 0x0f | 0x40; // version
904
+
905
+ bytes[8] = bytes[8] & 0xbf | 0x80; // variant
906
+
907
+ return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
908
+ }
909
+
910
+ function getRandomValuesWithMathRandom(bytes) {
911
+ var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
912
+
913
+ for (var i = 0; i < bytes.length; i++) {
914
+ bytes[i] = Math.random() * max;
915
+ }
916
+ }
891
917
 
892
- for (var i = 0; i < 21; i++) {
893
- id += alphabet[Math.random() * 64 | 0];
918
+ var getRandomValues = function () {
919
+ if (typeof crypto !== 'undefined') {
920
+ return crypto.getRandomValues.bind(crypto);
921
+ } else if (typeof msCrypto !== 'undefined') {
922
+ return msCrypto.getRandomValues.bind(msCrypto);
923
+ } else {
924
+ return getRandomValuesWithMathRandom;
894
925
  }
926
+ }();
895
927
 
896
- return id;
928
+ function getRandomBytes(length) {
929
+ var bytes = new Uint8Array(length);
930
+ getRandomValues(bytes);
931
+ return bytes;
897
932
  }
898
933
 
899
934
  function _createForOfIteratorHelper$2(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(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 = o[Symbol.iterator](); }, 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; } } }; }
@@ -902,9 +937,9 @@ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o
902
937
 
903
938
  function _arrayLikeToArray$2(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; }
904
939
 
905
- 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; }
940
+ 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; }
906
941
 
907
- 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(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; }
942
+ 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(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; }
908
943
 
909
944
  /**
910
945
  * Channel - The Channel class manages it's own state.
@@ -1024,7 +1059,7 @@ var Channel = /*#__PURE__*/function () {
1024
1059
 
1025
1060
  this.data = data; // this._data is used for the requests...
1026
1061
 
1027
- this._data = _objectSpread$2({}, data);
1062
+ this._data = _objectSpread$3({}, data);
1028
1063
  this.cid = "".concat(type, ":").concat(id);
1029
1064
  this.listeners = {}; // perhaps the state variable should be private
1030
1065
 
@@ -1082,7 +1117,7 @@ var Channel = /*#__PURE__*/function () {
1082
1117
  switch (_context2.prev = _context2.next) {
1083
1118
  case 0:
1084
1119
  _context2.next = 2;
1085
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$2({
1120
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$3({
1086
1121
  message: message
1087
1122
  }, options));
1088
1123
 
@@ -1201,7 +1236,7 @@ var Channel = /*#__PURE__*/function () {
1201
1236
 
1202
1237
  case 3:
1203
1238
  // Return a list of channels
1204
- payload = _objectSpread$2(_objectSpread$2({
1239
+ payload = _objectSpread$3(_objectSpread$3({
1205
1240
  filter_conditions: {
1206
1241
  cid: this.cid
1207
1242
  }
@@ -1298,7 +1333,7 @@ var Channel = /*#__PURE__*/function () {
1298
1333
 
1299
1334
  _context5.next = 6;
1300
1335
  return this.getClient().get(this.getClient().baseURL + '/members', {
1301
- payload: _objectSpread$2({
1336
+ payload: _objectSpread$3({
1302
1337
  type: type,
1303
1338
  id: id,
1304
1339
  members: members,
@@ -1359,7 +1394,7 @@ var Channel = /*#__PURE__*/function () {
1359
1394
 
1360
1395
  case 4:
1361
1396
  _context6.next = 6;
1362
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$2({
1397
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$3({
1363
1398
  reaction: reaction
1364
1399
  }, options));
1365
1400
 
@@ -1440,7 +1475,7 @@ var Channel = /*#__PURE__*/function () {
1440
1475
  delete channelData[key];
1441
1476
  });
1442
1477
  _context7.next = 7;
1443
- return this._update(_objectSpread$2({
1478
+ return this._update(_objectSpread$3({
1444
1479
  message: updateMessage,
1445
1480
  data: channelData
1446
1481
  }, options));
@@ -1665,7 +1700,7 @@ var Channel = /*#__PURE__*/function () {
1665
1700
  case 0:
1666
1701
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
1667
1702
  _context13.next = 3;
1668
- return this._update(_objectSpread$2({
1703
+ return this._update(_objectSpread$3({
1669
1704
  accept_invite: true
1670
1705
  }, options));
1671
1706
 
@@ -1706,7 +1741,7 @@ var Channel = /*#__PURE__*/function () {
1706
1741
  case 0:
1707
1742
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
1708
1743
  _context14.next = 3;
1709
- return this._update(_objectSpread$2({
1744
+ return this._update(_objectSpread$3({
1710
1745
  reject_invite: true
1711
1746
  }, options));
1712
1747
 
@@ -2024,7 +2059,7 @@ var Channel = /*#__PURE__*/function () {
2024
2059
  case 0:
2025
2060
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2026
2061
  _context22.next = 3;
2027
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$2({
2062
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$3({
2028
2063
  channel_cid: this.cid
2029
2064
  }, opts));
2030
2065
 
@@ -2066,7 +2101,7 @@ var Channel = /*#__PURE__*/function () {
2066
2101
  case 0:
2067
2102
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2068
2103
  _context23.next = 3;
2069
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$2({
2104
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$3({
2070
2105
  channel_cid: this.cid
2071
2106
  }, opts));
2072
2107
 
@@ -2275,7 +2310,7 @@ var Channel = /*#__PURE__*/function () {
2275
2310
 
2276
2311
  case 4:
2277
2312
  _context26.next = 6;
2278
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$2({}, data));
2313
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$3({}, data));
2279
2314
 
2280
2315
  case 6:
2281
2316
  return _context26.abrupt("return", _context26.sent);
@@ -2343,7 +2378,7 @@ var Channel = /*#__PURE__*/function () {
2343
2378
  defaultOptions.watch = false;
2344
2379
  }
2345
2380
 
2346
- combined = _objectSpread$2(_objectSpread$2({}, defaultOptions), options);
2381
+ combined = _objectSpread$3(_objectSpread$3({}, defaultOptions), options);
2347
2382
  _context27.next = 7;
2348
2383
  return this.query(combined);
2349
2384
 
@@ -2434,7 +2469,7 @@ var Channel = /*#__PURE__*/function () {
2434
2469
  switch (_context29.prev = _context29.next) {
2435
2470
  case 0:
2436
2471
  _context29.next = 2;
2437
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$2({}, options));
2472
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$3({}, options));
2438
2473
 
2439
2474
  case 2:
2440
2475
  data = _context29.sent;
@@ -2472,7 +2507,7 @@ var Channel = /*#__PURE__*/function () {
2472
2507
  }, {
2473
2508
  key: "getReactions",
2474
2509
  value: function getReactions(message_id, options) {
2475
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$2({}, options));
2510
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$3({}, options));
2476
2511
  }
2477
2512
  /**
2478
2513
  * getMessagesById - Retrieves a list of messages by ID
@@ -2604,7 +2639,7 @@ var Channel = /*#__PURE__*/function () {
2604
2639
  }
2605
2640
 
2606
2641
  _context30.next = 6;
2607
- return this.getClient().post(queryURL + '/query', _objectSpread$2({
2642
+ return this.getClient().post(queryURL + '/query', _objectSpread$3({
2608
2643
  data: this._data,
2609
2644
  state: true
2610
2645
  }, options));
@@ -2675,7 +2710,7 @@ var Channel = /*#__PURE__*/function () {
2675
2710
  this._checkInitialized();
2676
2711
 
2677
2712
  _context31.next = 3;
2678
- return this.getClient().banUser(targetUserID, _objectSpread$2(_objectSpread$2({}, options), {}, {
2713
+ return this.getClient().banUser(targetUserID, _objectSpread$3(_objectSpread$3({}, options), {}, {
2679
2714
  type: this.type,
2680
2715
  id: this.id
2681
2716
  }));
@@ -2847,7 +2882,7 @@ var Channel = /*#__PURE__*/function () {
2847
2882
  this._checkInitialized();
2848
2883
 
2849
2884
  _context35.next = 3;
2850
- return this.getClient().shadowBan(targetUserID, _objectSpread$2(_objectSpread$2({}, options), {}, {
2885
+ return this.getClient().shadowBan(targetUserID, _objectSpread$3(_objectSpread$3({}, options), {}, {
2851
2886
  type: this.type,
2852
2887
  id: this.id
2853
2888
  }));
@@ -3260,7 +3295,7 @@ var Channel = /*#__PURE__*/function () {
3260
3295
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3261
3296
  var read = _step3.value;
3262
3297
 
3263
- var parsedRead = _objectSpread$2(_objectSpread$2({}, read), {}, {
3298
+ var parsedRead = _objectSpread$3(_objectSpread$3({}, read), {}, {
3264
3299
  last_read: new Date(read.last_read)
3265
3300
  });
3266
3301
 
@@ -3387,6 +3422,64 @@ var ClientState = /*#__PURE__*/function () {
3387
3422
  return ClientState;
3388
3423
  }();
3389
3424
 
3425
+ 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; }
3426
+
3427
+ 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(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; }
3428
+ var InsightMetrics = function InsightMetrics() {
3429
+ _classCallCheck(this, InsightMetrics);
3430
+
3431
+ _defineProperty(this, "connectionStartTimestamp", void 0);
3432
+
3433
+ _defineProperty(this, "wsConsecutiveFailures", void 0);
3434
+
3435
+ _defineProperty(this, "wsTotalFailures", void 0);
3436
+
3437
+ _defineProperty(this, "instanceClientId", void 0);
3438
+
3439
+ this.connectionStartTimestamp = null;
3440
+ this.wsTotalFailures = 0;
3441
+ this.wsConsecutiveFailures = 0;
3442
+ this.instanceClientId = randomId();
3443
+ };
3444
+ function buildWsFatalInsight(connection, event) {
3445
+ return _objectSpread$2({
3446
+ err: {
3447
+ wasClean: event.wasClean,
3448
+ code: event.code,
3449
+ reason: event.reason
3450
+ }
3451
+ }, buildWsBaseInsight(connection));
3452
+ }
3453
+
3454
+ function buildWsBaseInsight(connection) {
3455
+ var _connection$ws, _navigator, _navigator2;
3456
+
3457
+ return {
3458
+ ready_state: (_connection$ws = connection.ws) === null || _connection$ws === void 0 ? void 0 : _connection$ws.readyState,
3459
+ url: connection._buildUrl(connection.requestID),
3460
+ api_key: connection.apiKey,
3461
+ start_ts: connection.insightMetrics.connectionStartTimestamp,
3462
+ end_ts: new Date().getTime(),
3463
+ auth_type: connection.authType,
3464
+ token: connection.tokenManager.token,
3465
+ user_id: connection.userID,
3466
+ user_details: connection.user,
3467
+ device: connection.device,
3468
+ client_id: connection.connectionID,
3469
+ ws_details: connection.ws,
3470
+ ws_consecutive_failures: connection.insightMetrics.wsConsecutiveFailures,
3471
+ ws_total_failures: connection.insightMetrics.wsTotalFailures,
3472
+ request_id: connection.requestID,
3473
+ online: typeof navigator !== 'undefined' ? (_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.onLine : null,
3474
+ user_agent: typeof navigator !== 'undefined' ? (_navigator2 = navigator) === null || _navigator2 === void 0 ? void 0 : _navigator2.userAgent : null,
3475
+ instance_client_id: connection.insightMetrics.instanceClientId
3476
+ };
3477
+ }
3478
+
3479
+ function buildWsSuccessAfterFailureInsight(connection) {
3480
+ return buildWsBaseInsight(connection);
3481
+ }
3482
+
3390
3483
  // Type guards to check WebSocket error type
3391
3484
  var isCloseEvent = function isCloseEvent(res) {
3392
3485
  return res.code !== undefined;
@@ -3429,7 +3522,9 @@ var StableWSConnection = /*#__PURE__*/function () {
3429
3522
  userAgent = _ref.userAgent,
3430
3523
  userID = _ref.userID,
3431
3524
  wsBaseURL = _ref.wsBaseURL,
3432
- device = _ref.device;
3525
+ device = _ref.device,
3526
+ postInsights = _ref.postInsights,
3527
+ insightMetrics = _ref.insightMetrics;
3433
3528
 
3434
3529
  _classCallCheck(this, StableWSConnection);
3435
3530
 
@@ -3483,6 +3578,10 @@ var StableWSConnection = /*#__PURE__*/function () {
3483
3578
 
3484
3579
  _defineProperty(this, "rejectPromise", void 0);
3485
3580
 
3581
+ _defineProperty(this, "requestID", void 0);
3582
+
3583
+ _defineProperty(this, "connectionStartTimestamp", void 0);
3584
+
3486
3585
  _defineProperty(this, "resolvePromise", void 0);
3487
3586
 
3488
3587
  _defineProperty(this, "totalFailures", void 0);
@@ -3491,13 +3590,18 @@ var StableWSConnection = /*#__PURE__*/function () {
3491
3590
 
3492
3591
  _defineProperty(this, "wsID", void 0);
3493
3592
 
3494
- _defineProperty(this, "_buildUrl", function () {
3593
+ _defineProperty(this, "postInsights", void 0);
3594
+
3595
+ _defineProperty(this, "insightMetrics", void 0);
3596
+
3597
+ _defineProperty(this, "_buildUrl", function (reqID) {
3495
3598
  var params = {
3496
3599
  user_id: _this.user.id,
3497
3600
  user_details: _this.user,
3498
3601
  user_token: _this.tokenManager.getToken(),
3499
3602
  server_determines_connection_id: true,
3500
- device: _this.device
3603
+ device: _this.device,
3604
+ request_id: reqID
3501
3605
  };
3502
3606
  var qs = encodeURIComponent(JSON.stringify(params));
3503
3607
 
@@ -3582,6 +3686,14 @@ var StableWSConnection = /*#__PURE__*/function () {
3582
3686
  });
3583
3687
 
3584
3688
  _defineProperty(this, "onclose", function (wsID, event) {
3689
+ if (event.code !== chatCodes.WS_CLOSED_SUCCESS) {
3690
+ var _this$postInsights;
3691
+
3692
+ _this.insightMetrics.wsConsecutiveFailures++;
3693
+ _this.insightMetrics.wsTotalFailures++;
3694
+ (_this$postInsights = _this.postInsights) === null || _this$postInsights === void 0 ? void 0 : _this$postInsights.call(_this, 'ws_fatal', buildWsFatalInsight(_this, event));
3695
+ }
3696
+
3585
3697
  _this.logger('info', 'connection:onclose() - onclose callback - ' + event.code, {
3586
3698
  tags: ['connection'],
3587
3699
  event: event,
@@ -3762,8 +3874,7 @@ var StableWSConnection = /*#__PURE__*/function () {
3762
3874
  // send the healthcheck.., server replies with a health check event
3763
3875
  var data = [{
3764
3876
  type: 'health.check',
3765
- client_id: _this.clientID,
3766
- user_id: _this.userID
3877
+ client_id: _this.clientID
3767
3878
  }]; // try to send on the connection
3768
3879
 
3769
3880
  try {
@@ -3837,6 +3948,9 @@ var StableWSConnection = /*#__PURE__*/function () {
3837
3948
  this.connectionCheckTimeout = this.pingInterval + 10 * 1000;
3838
3949
 
3839
3950
  this._listenForConnectionChanges();
3951
+
3952
+ this.postInsights = postInsights;
3953
+ this.insightMetrics = insightMetrics;
3840
3954
  }
3841
3955
  /**
3842
3956
  * connect - Connect to the WS URL
@@ -4042,6 +4156,12 @@ var StableWSConnection = /*#__PURE__*/function () {
4042
4156
 
4043
4157
  return _waitForHealthy;
4044
4158
  }()
4159
+ /**
4160
+ * Builds and returns the url for websocket.
4161
+ * @param reqID Unique identifier generated on client side, to help tracking apis on backend.
4162
+ * @returns url string
4163
+ */
4164
+
4045
4165
  }, {
4046
4166
  key: "disconnect",
4047
4167
  value:
@@ -4119,7 +4239,8 @@ var StableWSConnection = /*#__PURE__*/function () {
4119
4239
  key: "_connect",
4120
4240
  value: function () {
4121
4241
  var _connect3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
4122
- var wsURL, response;
4242
+ var wsURL, response, _this$postInsights2;
4243
+
4123
4244
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
4124
4245
  while (1) {
4125
4246
  switch (_context5.prev = _context5.next) {
@@ -4134,50 +4255,58 @@ var StableWSConnection = /*#__PURE__*/function () {
4134
4255
  case 2:
4135
4256
  // simply ignore _connect if it's currently trying to connect
4136
4257
  this.isConnecting = true;
4137
- _context5.prev = 3;
4138
- _context5.next = 6;
4258
+ this.requestID = randomId();
4259
+ this.insightMetrics.connectionStartTimestamp = new Date().getTime();
4260
+ _context5.prev = 5;
4261
+ _context5.next = 8;
4139
4262
  return this.tokenManager.tokenReady();
4140
4263
 
4141
- case 6:
4264
+ case 8:
4142
4265
  this._setupConnectionPromise();
4143
4266
 
4144
- wsURL = this._buildUrl();
4267
+ wsURL = this._buildUrl(this.requestID);
4145
4268
  this.ws = new WebSocket(wsURL);
4146
4269
  this.ws.onopen = this.onopen.bind(this, this.wsID);
4147
4270
  this.ws.onclose = this.onclose.bind(this, this.wsID);
4148
4271
  this.ws.onerror = this.onerror.bind(this, this.wsID);
4149
4272
  this.ws.onmessage = this.onmessage.bind(this, this.wsID);
4150
- _context5.next = 15;
4273
+ _context5.next = 17;
4151
4274
  return this.connectionOpen;
4152
4275
 
4153
- case 15:
4276
+ case 17:
4154
4277
  response = _context5.sent;
4155
4278
  this.isConnecting = false;
4156
4279
 
4157
4280
  if (!response) {
4158
- _context5.next = 20;
4281
+ _context5.next = 23;
4159
4282
  break;
4160
4283
  }
4161
4284
 
4162
4285
  this.connectionID = response.connection_id;
4286
+
4287
+ if (this.insightMetrics.wsConsecutiveFailures > 0) {
4288
+ (_this$postInsights2 = this.postInsights) === null || _this$postInsights2 === void 0 ? void 0 : _this$postInsights2.call(this, 'ws_success_after_failure', buildWsSuccessAfterFailureInsight(this));
4289
+ this.insightMetrics.wsConsecutiveFailures = 0;
4290
+ }
4291
+
4163
4292
  return _context5.abrupt("return", response);
4164
4293
 
4165
- case 20:
4166
- _context5.next = 26;
4294
+ case 23:
4295
+ _context5.next = 29;
4167
4296
  break;
4168
4297
 
4169
- case 22:
4170
- _context5.prev = 22;
4171
- _context5.t0 = _context5["catch"](3);
4298
+ case 25:
4299
+ _context5.prev = 25;
4300
+ _context5.t0 = _context5["catch"](5);
4172
4301
  this.isConnecting = false;
4173
4302
  throw _context5.t0;
4174
4303
 
4175
- case 26:
4304
+ case 29:
4176
4305
  case "end":
4177
4306
  return _context5.stop();
4178
4307
  }
4179
4308
  }
4180
- }, _callee5, this, [[3, 22]]);
4309
+ }, _callee5, this, [[5, 25]]);
4181
4310
  }));
4182
4311
 
4183
4312
  function _connect() {
@@ -4469,7 +4598,7 @@ function DevToken(userId) {
4469
4598
 
4470
4599
  function CheckSignature(body, secret, signature) {
4471
4600
  var key = Buffer.from(secret, 'ascii');
4472
- var hash = crypto.createHmac('sha256', key).update(body).digest('hex');
4601
+ var hash = crypto$1.createHmac('sha256', key).update(body).digest('hex');
4473
4602
  return hash === signature;
4474
4603
  }
4475
4604
 
@@ -4739,6 +4868,8 @@ var StreamChat = /*#__PURE__*/function () {
4739
4868
 
4740
4869
  _defineProperty(this, "consecutiveFailures", void 0);
4741
4870
 
4871
+ _defineProperty(this, "insightMetrics", void 0);
4872
+
4742
4873
  _defineProperty(this, "_hasConnectionID", function () {
4743
4874
  var _this$wsConnection;
4744
4875
 
@@ -5391,6 +5522,67 @@ var StreamChat = /*#__PURE__*/function () {
5391
5522
  return !!_this.secret;
5392
5523
  });
5393
5524
 
5525
+ _defineProperty(this, "postInsights", /*#__PURE__*/function () {
5526
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(insightType, insights) {
5527
+ var maxAttempts, i;
5528
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
5529
+ while (1) {
5530
+ switch (_context6.prev = _context6.next) {
5531
+ case 0:
5532
+ maxAttempts = 3;
5533
+ i = 0;
5534
+
5535
+ case 2:
5536
+ if (!(i < maxAttempts)) {
5537
+ _context6.next = 18;
5538
+ break;
5539
+ }
5540
+
5541
+ _context6.prev = 3;
5542
+ _context6.next = 6;
5543
+ return _this.axiosInstance.post("https://insights.stream-io-api.com/insights/".concat(insightType), insights);
5544
+
5545
+ case 6:
5546
+ _context6.next = 14;
5547
+ break;
5548
+
5549
+ case 8:
5550
+ _context6.prev = 8;
5551
+ _context6.t0 = _context6["catch"](3);
5552
+
5553
+ _this.logger('warn', "failed to send insights event ".concat(insightType), {
5554
+ tags: ['insights', 'connection'],
5555
+ error: _context6.t0,
5556
+ insights: insights
5557
+ });
5558
+
5559
+ _context6.next = 13;
5560
+ return sleep((i + 1) * 3000);
5561
+
5562
+ case 13:
5563
+ return _context6.abrupt("continue", 15);
5564
+
5565
+ case 14:
5566
+ return _context6.abrupt("break", 18);
5567
+
5568
+ case 15:
5569
+ i++;
5570
+ _context6.next = 2;
5571
+ break;
5572
+
5573
+ case 18:
5574
+ case "end":
5575
+ return _context6.stop();
5576
+ }
5577
+ }
5578
+ }, _callee6, null, [[3, 8]]);
5579
+ }));
5580
+
5581
+ return function (_x7, _x8) {
5582
+ return _ref6.apply(this, arguments);
5583
+ };
5584
+ }());
5585
+
5394
5586
  // set the key
5395
5587
  this.key = _key;
5396
5588
  this.listeners = {};
@@ -5446,6 +5638,7 @@ var StreamChat = /*#__PURE__*/function () {
5446
5638
 
5447
5639
  this.tokenManager = new TokenManager(this.secret);
5448
5640
  this.consecutiveFailures = 0;
5641
+ this.insightMetrics = new InsightMetrics();
5449
5642
  /**
5450
5643
  * logger function should accept 3 parameters:
5451
5644
  * @param logLevel string
@@ -5594,32 +5787,32 @@ var StreamChat = /*#__PURE__*/function () {
5594
5787
  }
5595
5788
  */
5596
5789
  function () {
5597
- var _updateAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(options) {
5790
+ var _updateAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(options) {
5598
5791
  var _options$apn_config;
5599
5792
 
5600
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
5793
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
5601
5794
  while (1) {
5602
- switch (_context6.prev = _context6.next) {
5795
+ switch (_context7.prev = _context7.next) {
5603
5796
  case 0:
5604
5797
  if ((_options$apn_config = options.apn_config) !== null && _options$apn_config !== void 0 && _options$apn_config.p12_cert) {
5605
5798
  options.apn_config.p12_cert = Buffer.from(options.apn_config.p12_cert).toString('base64');
5606
5799
  }
5607
5800
 
5608
- _context6.next = 3;
5801
+ _context7.next = 3;
5609
5802
  return this.patch(this.baseURL + '/app', options);
5610
5803
 
5611
5804
  case 3:
5612
- return _context6.abrupt("return", _context6.sent);
5805
+ return _context7.abrupt("return", _context7.sent);
5613
5806
 
5614
5807
  case 4:
5615
5808
  case "end":
5616
- return _context6.stop();
5809
+ return _context7.stop();
5617
5810
  }
5618
5811
  }
5619
- }, _callee6, this);
5812
+ }, _callee7, this);
5620
5813
  }));
5621
5814
 
5622
- function updateAppSettings(_x7) {
5815
+ function updateAppSettings(_x9) {
5623
5816
  return _updateAppSettings.apply(this, arguments);
5624
5817
  }
5625
5818
 
@@ -5632,28 +5825,28 @@ var StreamChat = /*#__PURE__*/function () {
5632
5825
  * Revokes all tokens on application level issued before given time
5633
5826
  */
5634
5827
  function () {
5635
- var _revokeTokens = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(before) {
5636
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
5828
+ var _revokeTokens = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(before) {
5829
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
5637
5830
  while (1) {
5638
- switch (_context7.prev = _context7.next) {
5831
+ switch (_context8.prev = _context8.next) {
5639
5832
  case 0:
5640
- _context7.next = 2;
5833
+ _context8.next = 2;
5641
5834
  return this.updateAppSettings({
5642
5835
  revoke_tokens_issued_before: this._normalizeDate(before)
5643
5836
  });
5644
5837
 
5645
5838
  case 2:
5646
- return _context7.abrupt("return", _context7.sent);
5839
+ return _context8.abrupt("return", _context8.sent);
5647
5840
 
5648
5841
  case 3:
5649
5842
  case "end":
5650
- return _context7.stop();
5843
+ return _context8.stop();
5651
5844
  }
5652
5845
  }
5653
- }, _callee7, this);
5846
+ }, _callee8, this);
5654
5847
  }));
5655
5848
 
5656
- function revokeTokens(_x8) {
5849
+ function revokeTokens(_x10) {
5657
5850
  return _revokeTokens.apply(this, arguments);
5658
5851
  }
5659
5852
 
@@ -5666,26 +5859,26 @@ var StreamChat = /*#__PURE__*/function () {
5666
5859
  }, {
5667
5860
  key: "revokeUserToken",
5668
5861
  value: function () {
5669
- var _revokeUserToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(userID, before) {
5670
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
5862
+ var _revokeUserToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(userID, before) {
5863
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
5671
5864
  while (1) {
5672
- switch (_context8.prev = _context8.next) {
5865
+ switch (_context9.prev = _context9.next) {
5673
5866
  case 0:
5674
- _context8.next = 2;
5867
+ _context9.next = 2;
5675
5868
  return this.revokeUsersToken([userID], before);
5676
5869
 
5677
5870
  case 2:
5678
- return _context8.abrupt("return", _context8.sent);
5871
+ return _context9.abrupt("return", _context9.sent);
5679
5872
 
5680
5873
  case 3:
5681
5874
  case "end":
5682
- return _context8.stop();
5875
+ return _context9.stop();
5683
5876
  }
5684
5877
  }
5685
- }, _callee8, this);
5878
+ }, _callee9, this);
5686
5879
  }));
5687
5880
 
5688
- function revokeUserToken(_x9, _x10) {
5881
+ function revokeUserToken(_x11, _x12) {
5689
5882
  return _revokeUserToken.apply(this, arguments);
5690
5883
  }
5691
5884
 
@@ -5698,12 +5891,12 @@ var StreamChat = /*#__PURE__*/function () {
5698
5891
  }, {
5699
5892
  key: "revokeUsersToken",
5700
5893
  value: function () {
5701
- var _revokeUsersToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(userIDs, before) {
5894
+ var _revokeUsersToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(userIDs, before) {
5702
5895
  var users, _iterator, _step, userID;
5703
5896
 
5704
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
5897
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
5705
5898
  while (1) {
5706
- switch (_context9.prev = _context9.next) {
5899
+ switch (_context10.prev = _context10.next) {
5707
5900
  case 0:
5708
5901
  if (before === undefined) {
5709
5902
  before = new Date().toISOString();
@@ -5730,21 +5923,21 @@ var StreamChat = /*#__PURE__*/function () {
5730
5923
  _iterator.f();
5731
5924
  }
5732
5925
 
5733
- _context9.next = 6;
5926
+ _context10.next = 6;
5734
5927
  return this.partialUpdateUsers(users);
5735
5928
 
5736
5929
  case 6:
5737
- return _context9.abrupt("return", _context9.sent);
5930
+ return _context10.abrupt("return", _context10.sent);
5738
5931
 
5739
5932
  case 7:
5740
5933
  case "end":
5741
- return _context9.stop();
5934
+ return _context10.stop();
5742
5935
  }
5743
5936
  }
5744
- }, _callee9, this);
5937
+ }, _callee10, this);
5745
5938
  }));
5746
5939
 
5747
- function revokeUsersToken(_x11, _x12) {
5940
+ function revokeUsersToken(_x13, _x14) {
5748
5941
  return _revokeUsersToken.apply(this, arguments);
5749
5942
  }
5750
5943
 
@@ -5757,23 +5950,23 @@ var StreamChat = /*#__PURE__*/function () {
5757
5950
  }, {
5758
5951
  key: "getAppSettings",
5759
5952
  value: function () {
5760
- var _getAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
5761
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
5953
+ var _getAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
5954
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
5762
5955
  while (1) {
5763
- switch (_context10.prev = _context10.next) {
5956
+ switch (_context11.prev = _context11.next) {
5764
5957
  case 0:
5765
- _context10.next = 2;
5958
+ _context11.next = 2;
5766
5959
  return this.get(this.baseURL + '/app');
5767
5960
 
5768
5961
  case 2:
5769
- return _context10.abrupt("return", _context10.sent);
5962
+ return _context11.abrupt("return", _context11.sent);
5770
5963
 
5771
5964
  case 3:
5772
5965
  case "end":
5773
- return _context10.stop();
5966
+ return _context11.stop();
5774
5967
  }
5775
5968
  }
5776
- }, _callee10, this);
5969
+ }, _callee11, this);
5777
5970
  }));
5778
5971
 
5779
5972
  function getAppSettings() {
@@ -5800,15 +5993,15 @@ var StreamChat = /*#__PURE__*/function () {
5800
5993
  }, {
5801
5994
  key: "testPushSettings",
5802
5995
  value: function () {
5803
- var _testPushSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(userID) {
5996
+ var _testPushSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(userID) {
5804
5997
  var data,
5805
- _args11 = arguments;
5806
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
5998
+ _args12 = arguments;
5999
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
5807
6000
  while (1) {
5808
- switch (_context11.prev = _context11.next) {
6001
+ switch (_context12.prev = _context12.next) {
5809
6002
  case 0:
5810
- data = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
5811
- _context11.next = 3;
6003
+ data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
6004
+ _context12.next = 3;
5812
6005
  return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5813
6006
  user_id: userID
5814
6007
  }, data.messageID ? {
@@ -5826,17 +6019,17 @@ var StreamChat = /*#__PURE__*/function () {
5826
6019
  } : {}));
5827
6020
 
5828
6021
  case 3:
5829
- return _context11.abrupt("return", _context11.sent);
6022
+ return _context12.abrupt("return", _context12.sent);
5830
6023
 
5831
6024
  case 4:
5832
6025
  case "end":
5833
- return _context11.stop();
6026
+ return _context12.stop();
5834
6027
  }
5835
6028
  }
5836
- }, _callee11, this);
6029
+ }, _callee12, this);
5837
6030
  }));
5838
6031
 
5839
- function testPushSettings(_x13) {
6032
+ function testPushSettings(_x15) {
5840
6033
  return _testPushSettings.apply(this, arguments);
5841
6034
  }
5842
6035
 
@@ -5856,26 +6049,26 @@ var StreamChat = /*#__PURE__*/function () {
5856
6049
  }, {
5857
6050
  key: "testSQSSettings",
5858
6051
  value: function () {
5859
- var _testSQSSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
6052
+ var _testSQSSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
5860
6053
  var data,
5861
- _args12 = arguments;
5862
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
6054
+ _args13 = arguments;
6055
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
5863
6056
  while (1) {
5864
- switch (_context12.prev = _context12.next) {
6057
+ switch (_context13.prev = _context13.next) {
5865
6058
  case 0:
5866
- data = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
5867
- _context12.next = 3;
6059
+ data = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
6060
+ _context13.next = 3;
5868
6061
  return this.post(this.baseURL + '/check_sqs', data);
5869
6062
 
5870
6063
  case 3:
5871
- return _context12.abrupt("return", _context12.sent);
6064
+ return _context13.abrupt("return", _context13.sent);
5872
6065
 
5873
6066
  case 4:
5874
6067
  case "end":
5875
- return _context12.stop();
6068
+ return _context13.stop();
5876
6069
  }
5877
6070
  }
5878
- }, _callee12, this);
6071
+ }, _callee13, this);
5879
6072
  }));
5880
6073
 
5881
6074
  function testSQSSettings() {
@@ -5902,50 +6095,50 @@ var StreamChat = /*#__PURE__*/function () {
5902
6095
  * @return {ConnectAPIResponse<ChannelType, CommandType, UserType>} Returns a promise that resolves when the connection is setup
5903
6096
  */
5904
6097
  function () {
5905
- var _setGuestUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(user) {
6098
+ var _setGuestUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(user) {
5906
6099
  var response, _response$user, guestUser;
5907
6100
 
5908
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
6101
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
5909
6102
  while (1) {
5910
- switch (_context13.prev = _context13.next) {
6103
+ switch (_context14.prev = _context14.next) {
5911
6104
  case 0:
5912
6105
  this.anonymous = true;
5913
- _context13.prev = 1;
5914
- _context13.next = 4;
6106
+ _context14.prev = 1;
6107
+ _context14.next = 4;
5915
6108
  return this.post(this.baseURL + '/guest', {
5916
6109
  user: user
5917
6110
  });
5918
6111
 
5919
6112
  case 4:
5920
- response = _context13.sent;
5921
- _context13.next = 11;
6113
+ response = _context14.sent;
6114
+ _context14.next = 11;
5922
6115
  break;
5923
6116
 
5924
6117
  case 7:
5925
- _context13.prev = 7;
5926
- _context13.t0 = _context13["catch"](1);
6118
+ _context14.prev = 7;
6119
+ _context14.t0 = _context14["catch"](1);
5927
6120
  this.anonymous = false;
5928
- throw _context13.t0;
6121
+ throw _context14.t0;
5929
6122
 
5930
6123
  case 11:
5931
6124
  this.anonymous = false; // eslint-disable-next-line @typescript-eslint/no-unused-vars
5932
6125
 
5933
6126
  _response$user = response.user, _response$user.created_at, _response$user.updated_at, _response$user.last_active, _response$user.online, guestUser = _objectWithoutProperties(_response$user, ["created_at", "updated_at", "last_active", "online"]);
5934
- _context13.next = 15;
6127
+ _context14.next = 15;
5935
6128
  return this.connectUser(guestUser, response.access_token);
5936
6129
 
5937
6130
  case 15:
5938
- return _context13.abrupt("return", _context13.sent);
6131
+ return _context14.abrupt("return", _context14.sent);
5939
6132
 
5940
6133
  case 16:
5941
6134
  case "end":
5942
- return _context13.stop();
6135
+ return _context14.stop();
5943
6136
  }
5944
6137
  }
5945
- }, _callee13, this, [[1, 7]]);
6138
+ }, _callee14, this, [[1, 7]]);
5946
6139
  }));
5947
6140
 
5948
- function setGuestUser(_x14) {
6141
+ function setGuestUser(_x16) {
5949
6142
  return _setGuestUser.apply(this, arguments);
5950
6143
  }
5951
6144
 
@@ -6255,17 +6448,17 @@ var StreamChat = /*#__PURE__*/function () {
6255
6448
  * @private
6256
6449
  */
6257
6450
  function () {
6258
- var _connect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
6451
+ var _connect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
6259
6452
  var client, warmUpPromise, handshake;
6260
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
6453
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
6261
6454
  while (1) {
6262
- switch (_context14.prev = _context14.next) {
6455
+ switch (_context15.prev = _context15.next) {
6263
6456
  case 0:
6264
6457
  client = this;
6265
6458
  this.failures = 0;
6266
6459
 
6267
6460
  if (!(client.userID == null || this._user == null)) {
6268
- _context14.next = 4;
6461
+ _context15.next = 4;
6269
6462
  break;
6270
6463
  }
6271
6464
 
@@ -6273,7 +6466,7 @@ var StreamChat = /*#__PURE__*/function () {
6273
6466
 
6274
6467
  case 4:
6275
6468
  if (!(client.wsBaseURL == null)) {
6276
- _context14.next = 6;
6469
+ _context15.next = 6;
6277
6470
  break;
6278
6471
  }
6279
6472
 
@@ -6281,7 +6474,7 @@ var StreamChat = /*#__PURE__*/function () {
6281
6474
 
6282
6475
  case 6:
6283
6476
  if (!(client.clientID == null)) {
6284
- _context14.next = 8;
6477
+ _context15.next = 8;
6285
6478
  break;
6286
6479
  }
6287
6480
 
@@ -6302,42 +6495,44 @@ var StreamChat = /*#__PURE__*/function () {
6302
6495
  messageCallback: this.handleEvent,
6303
6496
  eventCallback: this.dispatchEvent,
6304
6497
  logger: this.logger,
6305
- device: this.options.device
6498
+ device: this.options.device,
6499
+ postInsights: this.options.enableInsights ? this.postInsights : undefined,
6500
+ insightMetrics: this.insightMetrics
6306
6501
  });
6307
6502
 
6308
6503
  if (this.options.warmUp) {
6309
6504
  warmUpPromise = this.doAxiosRequest('options', this.baseURL + '/connect');
6310
6505
  }
6311
6506
 
6312
- _context14.next = 12;
6507
+ _context15.next = 12;
6313
6508
  return this.wsConnection.connect();
6314
6509
 
6315
6510
  case 12:
6316
- handshake = _context14.sent;
6317
- _context14.prev = 13;
6318
- _context14.next = 16;
6511
+ handshake = _context15.sent;
6512
+ _context15.prev = 13;
6513
+ _context15.next = 16;
6319
6514
  return warmUpPromise;
6320
6515
 
6321
6516
  case 16:
6322
- _context14.next = 21;
6517
+ _context15.next = 21;
6323
6518
  break;
6324
6519
 
6325
6520
  case 18:
6326
- _context14.prev = 18;
6327
- _context14.t0 = _context14["catch"](13);
6521
+ _context15.prev = 18;
6522
+ _context15.t0 = _context15["catch"](13);
6328
6523
  this.logger('error', 'Warmup request failed', {
6329
- error: _context14.t0
6524
+ error: _context15.t0
6330
6525
  });
6331
6526
 
6332
6527
  case 21:
6333
- return _context14.abrupt("return", handshake);
6528
+ return _context15.abrupt("return", handshake);
6334
6529
 
6335
6530
  case 22:
6336
6531
  case "end":
6337
- return _context14.stop();
6532
+ return _context15.stop();
6338
6533
  }
6339
6534
  }
6340
- }, _callee14, this, [[13, 18]]);
6535
+ }, _callee15, this, [[13, 18]]);
6341
6536
  }));
6342
6537
 
6343
6538
  function connect() {
@@ -6360,23 +6555,23 @@ var StreamChat = /*#__PURE__*/function () {
6360
6555
  }, {
6361
6556
  key: "queryUsers",
6362
6557
  value: function () {
6363
- var _queryUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(filterConditions) {
6558
+ var _queryUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(filterConditions) {
6364
6559
  var sort,
6365
6560
  options,
6366
6561
  defaultOptions,
6367
6562
  data,
6368
- _args15 = arguments;
6369
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
6563
+ _args16 = arguments;
6564
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
6370
6565
  while (1) {
6371
- switch (_context15.prev = _context15.next) {
6566
+ switch (_context16.prev = _context16.next) {
6372
6567
  case 0:
6373
- sort = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : [];
6374
- options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
6568
+ sort = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : [];
6569
+ options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
6375
6570
  defaultOptions = {
6376
6571
  presence: false
6377
6572
  }; // Make sure we wait for the connect promise if there is a pending one
6378
6573
 
6379
- _context15.next = 5;
6574
+ _context16.next = 5;
6380
6575
  return this.setUserPromise;
6381
6576
 
6382
6577
  case 5:
@@ -6385,7 +6580,7 @@ var StreamChat = /*#__PURE__*/function () {
6385
6580
  } // Return a list of users
6386
6581
 
6387
6582
 
6388
- _context15.next = 8;
6583
+ _context16.next = 8;
6389
6584
  return this.get(this.baseURL + '/users', {
6390
6585
  payload: _objectSpread(_objectSpread({
6391
6586
  filter_conditions: filterConditions,
@@ -6394,19 +6589,19 @@ var StreamChat = /*#__PURE__*/function () {
6394
6589
  });
6395
6590
 
6396
6591
  case 8:
6397
- data = _context15.sent;
6592
+ data = _context16.sent;
6398
6593
  this.state.updateUsers(data.users);
6399
- return _context15.abrupt("return", data);
6594
+ return _context16.abrupt("return", data);
6400
6595
 
6401
6596
  case 11:
6402
6597
  case "end":
6403
- return _context15.stop();
6598
+ return _context16.stop();
6404
6599
  }
6405
6600
  }
6406
- }, _callee15, this);
6601
+ }, _callee16, this);
6407
6602
  }));
6408
6603
 
6409
- function queryUsers(_x15) {
6604
+ function queryUsers(_x17) {
6410
6605
  return _queryUsers.apply(this, arguments);
6411
6606
  }
6412
6607
 
@@ -6425,19 +6620,19 @@ var StreamChat = /*#__PURE__*/function () {
6425
6620
  }, {
6426
6621
  key: "queryBannedUsers",
6427
6622
  value: function () {
6428
- var _queryBannedUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
6623
+ var _queryBannedUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
6429
6624
  var filterConditions,
6430
6625
  sort,
6431
6626
  options,
6432
- _args16 = arguments;
6433
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
6627
+ _args17 = arguments;
6628
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
6434
6629
  while (1) {
6435
- switch (_context16.prev = _context16.next) {
6630
+ switch (_context17.prev = _context17.next) {
6436
6631
  case 0:
6437
- filterConditions = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
6438
- sort = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : [];
6439
- options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
6440
- _context16.next = 5;
6632
+ filterConditions = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
6633
+ sort = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : [];
6634
+ options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
6635
+ _context17.next = 5;
6441
6636
  return this.get(this.baseURL + '/query_banned_users', {
6442
6637
  payload: _objectSpread({
6443
6638
  filter_conditions: filterConditions,
@@ -6446,14 +6641,14 @@ var StreamChat = /*#__PURE__*/function () {
6446
6641
  });
6447
6642
 
6448
6643
  case 5:
6449
- return _context16.abrupt("return", _context16.sent);
6644
+ return _context17.abrupt("return", _context17.sent);
6450
6645
 
6451
6646
  case 6:
6452
6647
  case "end":
6453
- return _context16.stop();
6648
+ return _context17.stop();
6454
6649
  }
6455
6650
  }
6456
- }, _callee16, this);
6651
+ }, _callee17, this);
6457
6652
  }));
6458
6653
 
6459
6654
  function queryBannedUsers() {
@@ -6474,17 +6669,17 @@ var StreamChat = /*#__PURE__*/function () {
6474
6669
  }, {
6475
6670
  key: "queryMessageFlags",
6476
6671
  value: function () {
6477
- var _queryMessageFlags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
6672
+ var _queryMessageFlags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
6478
6673
  var filterConditions,
6479
6674
  options,
6480
- _args17 = arguments;
6481
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
6675
+ _args18 = arguments;
6676
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
6482
6677
  while (1) {
6483
- switch (_context17.prev = _context17.next) {
6678
+ switch (_context18.prev = _context18.next) {
6484
6679
  case 0:
6485
- filterConditions = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
6486
- options = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
6487
- _context17.next = 4;
6680
+ filterConditions = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
6681
+ options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
6682
+ _context18.next = 4;
6488
6683
  return this.get(this.baseURL + '/moderation/flags/message', {
6489
6684
  payload: _objectSpread({
6490
6685
  filter_conditions: filterConditions
@@ -6492,14 +6687,14 @@ var StreamChat = /*#__PURE__*/function () {
6492
6687
  });
6493
6688
 
6494
6689
  case 4:
6495
- return _context17.abrupt("return", _context17.sent);
6690
+ return _context18.abrupt("return", _context18.sent);
6496
6691
 
6497
6692
  case 5:
6498
6693
  case "end":
6499
- return _context17.stop();
6694
+ return _context18.stop();
6500
6695
  }
6501
6696
  }
6502
- }, _callee17, this);
6697
+ }, _callee18, this);
6503
6698
  }));
6504
6699
 
6505
6700
  function queryMessageFlags() {
@@ -6524,7 +6719,7 @@ var StreamChat = /*#__PURE__*/function () {
6524
6719
  }, {
6525
6720
  key: "queryChannels",
6526
6721
  value: function () {
6527
- var _queryChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(filterConditions) {
6722
+ var _queryChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(filterConditions) {
6528
6723
  var sort,
6529
6724
  options,
6530
6725
  stateOptions,
@@ -6540,15 +6735,15 @@ var StreamChat = /*#__PURE__*/function () {
6540
6735
  _step3,
6541
6736
  _channelState,
6542
6737
  c,
6543
- _args18 = arguments;
6738
+ _args19 = arguments;
6544
6739
 
6545
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
6740
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
6546
6741
  while (1) {
6547
- switch (_context18.prev = _context18.next) {
6742
+ switch (_context19.prev = _context19.next) {
6548
6743
  case 0:
6549
- sort = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : [];
6550
- options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
6551
- stateOptions = _args18.length > 3 && _args18[3] !== undefined ? _args18[3] : {};
6744
+ sort = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : [];
6745
+ options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
6746
+ stateOptions = _args19.length > 3 && _args19[3] !== undefined ? _args19[3] : {};
6552
6747
  skipInitialization = stateOptions.skipInitialization;
6553
6748
  defaultOptions = {
6554
6749
  state: true,
@@ -6556,7 +6751,7 @@ var StreamChat = /*#__PURE__*/function () {
6556
6751
  presence: false
6557
6752
  }; // Make sure we wait for the connect promise if there is a pending one
6558
6753
 
6559
- _context18.next = 7;
6754
+ _context19.next = 7;
6560
6755
  return this.setUserPromise;
6561
6756
 
6562
6757
  case 7:
@@ -6569,11 +6764,11 @@ var StreamChat = /*#__PURE__*/function () {
6569
6764
  filter_conditions: filterConditions,
6570
6765
  sort: normalizeQuerySort(sort)
6571
6766
  }, defaultOptions), options);
6572
- _context18.next = 11;
6767
+ _context19.next = 11;
6573
6768
  return this.post(this.baseURL + '/channels', payload);
6574
6769
 
6575
6770
  case 11:
6576
- data = _context18.sent;
6771
+ data = _context19.sent;
6577
6772
  channels = []; // update our cache of the configs
6578
6773
 
6579
6774
  _iterator2 = _createForOfIteratorHelper(data.channels);
@@ -6615,17 +6810,17 @@ var StreamChat = /*#__PURE__*/function () {
6615
6810
  _iterator3.f();
6616
6811
  }
6617
6812
 
6618
- return _context18.abrupt("return", channels);
6813
+ return _context19.abrupt("return", channels);
6619
6814
 
6620
6815
  case 18:
6621
6816
  case "end":
6622
- return _context18.stop();
6817
+ return _context19.stop();
6623
6818
  }
6624
6819
  }
6625
- }, _callee18, this);
6820
+ }, _callee19, this);
6626
6821
  }));
6627
6822
 
6628
- function queryChannels(_x16) {
6823
+ function queryChannels(_x18) {
6629
6824
  return _queryChannels.apply(this, arguments);
6630
6825
  }
6631
6826
 
@@ -6644,18 +6839,18 @@ var StreamChat = /*#__PURE__*/function () {
6644
6839
  }, {
6645
6840
  key: "search",
6646
6841
  value: function () {
6647
- var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(filterConditions, query) {
6842
+ var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(filterConditions, query) {
6648
6843
  var options,
6649
6844
  payload,
6650
- _args19 = arguments;
6651
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
6845
+ _args20 = arguments;
6846
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
6652
6847
  while (1) {
6653
- switch (_context19.prev = _context19.next) {
6848
+ switch (_context20.prev = _context20.next) {
6654
6849
  case 0:
6655
- options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
6850
+ options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
6656
6851
 
6657
6852
  if (!(options.offset && (options.sort || options.next))) {
6658
- _context19.next = 3;
6853
+ _context20.next = 3;
6659
6854
  break;
6660
6855
  }
6661
6856
 
@@ -6669,49 +6864,49 @@ var StreamChat = /*#__PURE__*/function () {
6669
6864
  });
6670
6865
 
6671
6866
  if (!(typeof query === 'string')) {
6672
- _context19.next = 8;
6867
+ _context20.next = 8;
6673
6868
  break;
6674
6869
  }
6675
6870
 
6676
6871
  payload.query = query;
6677
- _context19.next = 13;
6872
+ _context20.next = 13;
6678
6873
  break;
6679
6874
 
6680
6875
  case 8:
6681
6876
  if (!(_typeof(query) === 'object')) {
6682
- _context19.next = 12;
6877
+ _context20.next = 12;
6683
6878
  break;
6684
6879
  }
6685
6880
 
6686
6881
  payload.message_filter_conditions = query;
6687
- _context19.next = 13;
6882
+ _context20.next = 13;
6688
6883
  break;
6689
6884
 
6690
6885
  case 12:
6691
6886
  throw Error("Invalid type ".concat(_typeof(query), " for query parameter"));
6692
6887
 
6693
6888
  case 13:
6694
- _context19.next = 15;
6889
+ _context20.next = 15;
6695
6890
  return this.setUserPromise;
6696
6891
 
6697
6892
  case 15:
6698
- _context19.next = 17;
6893
+ _context20.next = 17;
6699
6894
  return this.get(this.baseURL + '/search', {
6700
6895
  payload: payload
6701
6896
  });
6702
6897
 
6703
6898
  case 17:
6704
- return _context19.abrupt("return", _context19.sent);
6899
+ return _context20.abrupt("return", _context20.sent);
6705
6900
 
6706
6901
  case 18:
6707
6902
  case "end":
6708
- return _context19.stop();
6903
+ return _context20.stop();
6709
6904
  }
6710
6905
  }
6711
- }, _callee19, this);
6906
+ }, _callee20, this);
6712
6907
  }));
6713
6908
 
6714
- function search(_x17, _x18) {
6909
+ function search(_x19, _x20) {
6715
6910
  return _search.apply(this, arguments);
6716
6911
  }
6717
6912
 
@@ -6747,12 +6942,12 @@ var StreamChat = /*#__PURE__*/function () {
6747
6942
  }, {
6748
6943
  key: "addDevice",
6749
6944
  value: function () {
6750
- var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(id, push_provider, userID) {
6751
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
6945
+ var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(id, push_provider, userID) {
6946
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
6752
6947
  while (1) {
6753
- switch (_context20.prev = _context20.next) {
6948
+ switch (_context21.prev = _context21.next) {
6754
6949
  case 0:
6755
- _context20.next = 2;
6950
+ _context21.next = 2;
6756
6951
  return this.post(this.baseURL + '/devices', _objectSpread({
6757
6952
  id: id,
6758
6953
  push_provider: push_provider
@@ -6761,17 +6956,17 @@ var StreamChat = /*#__PURE__*/function () {
6761
6956
  } : {}));
6762
6957
 
6763
6958
  case 2:
6764
- return _context20.abrupt("return", _context20.sent);
6959
+ return _context21.abrupt("return", _context21.sent);
6765
6960
 
6766
6961
  case 3:
6767
6962
  case "end":
6768
- return _context20.stop();
6963
+ return _context21.stop();
6769
6964
  }
6770
6965
  }
6771
- }, _callee20, this);
6966
+ }, _callee21, this);
6772
6967
  }));
6773
6968
 
6774
- function addDevice(_x19, _x20, _x21) {
6969
+ function addDevice(_x21, _x22, _x23) {
6775
6970
  return _addDevice.apply(this, arguments);
6776
6971
  }
6777
6972
 
@@ -6788,28 +6983,28 @@ var StreamChat = /*#__PURE__*/function () {
6788
6983
  }, {
6789
6984
  key: "getDevices",
6790
6985
  value: function () {
6791
- var _getDevices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(userID) {
6792
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
6986
+ var _getDevices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(userID) {
6987
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
6793
6988
  while (1) {
6794
- switch (_context21.prev = _context21.next) {
6989
+ switch (_context22.prev = _context22.next) {
6795
6990
  case 0:
6796
- _context21.next = 2;
6991
+ _context22.next = 2;
6797
6992
  return this.get(this.baseURL + '/devices', userID ? {
6798
6993
  user_id: userID
6799
6994
  } : {});
6800
6995
 
6801
6996
  case 2:
6802
- return _context21.abrupt("return", _context21.sent);
6997
+ return _context22.abrupt("return", _context22.sent);
6803
6998
 
6804
6999
  case 3:
6805
7000
  case "end":
6806
- return _context21.stop();
7001
+ return _context22.stop();
6807
7002
  }
6808
7003
  }
6809
- }, _callee21, this);
7004
+ }, _callee22, this);
6810
7005
  }));
6811
7006
 
6812
- function getDevices(_x22) {
7007
+ function getDevices(_x24) {
6813
7008
  return _getDevices.apply(this, arguments);
6814
7009
  }
6815
7010
 
@@ -6826,12 +7021,12 @@ var StreamChat = /*#__PURE__*/function () {
6826
7021
  }, {
6827
7022
  key: "removeDevice",
6828
7023
  value: function () {
6829
- var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(id, userID) {
6830
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
7024
+ var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(id, userID) {
7025
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
6831
7026
  while (1) {
6832
- switch (_context22.prev = _context22.next) {
7027
+ switch (_context23.prev = _context23.next) {
6833
7028
  case 0:
6834
- _context22.next = 2;
7029
+ _context23.next = 2;
6835
7030
  return this.delete(this.baseURL + '/devices', _objectSpread({
6836
7031
  id: id
6837
7032
  }, userID ? {
@@ -6839,17 +7034,17 @@ var StreamChat = /*#__PURE__*/function () {
6839
7034
  } : {}));
6840
7035
 
6841
7036
  case 2:
6842
- return _context22.abrupt("return", _context22.sent);
7037
+ return _context23.abrupt("return", _context23.sent);
6843
7038
 
6844
7039
  case 3:
6845
7040
  case "end":
6846
- return _context22.stop();
7041
+ return _context23.stop();
6847
7042
  }
6848
7043
  }
6849
- }, _callee22, this);
7044
+ }, _callee23, this);
6850
7045
  }));
6851
7046
 
6852
- function removeDevice(_x23, _x24) {
7047
+ function removeDevice(_x25, _x26) {
6853
7048
  return _removeDevice.apply(this, arguments);
6854
7049
  }
6855
7050
 
@@ -6866,15 +7061,15 @@ var StreamChat = /*#__PURE__*/function () {
6866
7061
  }, {
6867
7062
  key: "getRateLimits",
6868
7063
  value: function () {
6869
- var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(params) {
6870
- var _ref6, serverSide, web, android, ios, endpoints;
7064
+ var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(params) {
7065
+ var _ref7, serverSide, web, android, ios, endpoints;
6871
7066
 
6872
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
7067
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
6873
7068
  while (1) {
6874
- switch (_context23.prev = _context23.next) {
7069
+ switch (_context24.prev = _context24.next) {
6875
7070
  case 0:
6876
- _ref6 = params || {}, serverSide = _ref6.serverSide, web = _ref6.web, android = _ref6.android, ios = _ref6.ios, endpoints = _ref6.endpoints;
6877
- return _context23.abrupt("return", this.get(this.baseURL + '/rate_limits', {
7071
+ _ref7 = params || {}, serverSide = _ref7.serverSide, web = _ref7.web, android = _ref7.android, ios = _ref7.ios, endpoints = _ref7.endpoints;
7072
+ return _context24.abrupt("return", this.get(this.baseURL + '/rate_limits', {
6878
7073
  server_side: serverSide,
6879
7074
  web: web,
6880
7075
  android: android,
@@ -6884,13 +7079,13 @@ var StreamChat = /*#__PURE__*/function () {
6884
7079
 
6885
7080
  case 2:
6886
7081
  case "end":
6887
- return _context23.stop();
7082
+ return _context24.stop();
6888
7083
  }
6889
7084
  }
6890
- }, _callee23, this);
7085
+ }, _callee24, this);
6891
7086
  }));
6892
7087
 
6893
- function getRateLimits(_x25) {
7088
+ function getRateLimits(_x27) {
6894
7089
  return _getRateLimits.apply(this, arguments);
6895
7090
  }
6896
7091
 
@@ -6972,26 +7167,26 @@ var StreamChat = /*#__PURE__*/function () {
6972
7167
  * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>} list of updated users
6973
7168
  */
6974
7169
  function () {
6975
- var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(partialUserObject) {
6976
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
7170
+ var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(partialUserObject) {
7171
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
6977
7172
  while (1) {
6978
- switch (_context24.prev = _context24.next) {
7173
+ switch (_context25.prev = _context25.next) {
6979
7174
  case 0:
6980
- _context24.next = 2;
7175
+ _context25.next = 2;
6981
7176
  return this.partialUpdateUsers([partialUserObject]);
6982
7177
 
6983
7178
  case 2:
6984
- return _context24.abrupt("return", _context24.sent);
7179
+ return _context25.abrupt("return", _context25.sent);
6985
7180
 
6986
7181
  case 3:
6987
7182
  case "end":
6988
- return _context24.stop();
7183
+ return _context25.stop();
6989
7184
  }
6990
7185
  }
6991
- }, _callee24, this);
7186
+ }, _callee25, this);
6992
7187
  }));
6993
7188
 
6994
- function partialUpdateUser(_x26) {
7189
+ function partialUpdateUser(_x28) {
6995
7190
  return _partialUpdateUser.apply(this, arguments);
6996
7191
  }
6997
7192
 
@@ -7008,29 +7203,29 @@ var StreamChat = /*#__PURE__*/function () {
7008
7203
  }, {
7009
7204
  key: "upsertUsers",
7010
7205
  value: function () {
7011
- var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(users) {
7206
+ var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(users) {
7012
7207
  var userMap, _iterator4, _step4, userObject;
7013
7208
 
7014
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
7209
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
7015
7210
  while (1) {
7016
- switch (_context25.prev = _context25.next) {
7211
+ switch (_context26.prev = _context26.next) {
7017
7212
  case 0:
7018
7213
  userMap = {};
7019
7214
  _iterator4 = _createForOfIteratorHelper(users);
7020
- _context25.prev = 2;
7215
+ _context26.prev = 2;
7021
7216
 
7022
7217
  _iterator4.s();
7023
7218
 
7024
7219
  case 4:
7025
7220
  if ((_step4 = _iterator4.n()).done) {
7026
- _context25.next = 11;
7221
+ _context26.next = 11;
7027
7222
  break;
7028
7223
  }
7029
7224
 
7030
7225
  userObject = _step4.value;
7031
7226
 
7032
7227
  if (userObject.id) {
7033
- _context25.next = 8;
7228
+ _context26.next = 8;
7034
7229
  break;
7035
7230
  }
7036
7231
 
@@ -7040,44 +7235,44 @@ var StreamChat = /*#__PURE__*/function () {
7040
7235
  userMap[userObject.id] = userObject;
7041
7236
 
7042
7237
  case 9:
7043
- _context25.next = 4;
7238
+ _context26.next = 4;
7044
7239
  break;
7045
7240
 
7046
7241
  case 11:
7047
- _context25.next = 16;
7242
+ _context26.next = 16;
7048
7243
  break;
7049
7244
 
7050
7245
  case 13:
7051
- _context25.prev = 13;
7052
- _context25.t0 = _context25["catch"](2);
7246
+ _context26.prev = 13;
7247
+ _context26.t0 = _context26["catch"](2);
7053
7248
 
7054
- _iterator4.e(_context25.t0);
7249
+ _iterator4.e(_context26.t0);
7055
7250
 
7056
7251
  case 16:
7057
- _context25.prev = 16;
7252
+ _context26.prev = 16;
7058
7253
 
7059
7254
  _iterator4.f();
7060
7255
 
7061
- return _context25.finish(16);
7256
+ return _context26.finish(16);
7062
7257
 
7063
7258
  case 19:
7064
- _context25.next = 21;
7259
+ _context26.next = 21;
7065
7260
  return this.post(this.baseURL + '/users', {
7066
7261
  users: userMap
7067
7262
  });
7068
7263
 
7069
7264
  case 21:
7070
- return _context25.abrupt("return", _context25.sent);
7265
+ return _context26.abrupt("return", _context26.sent);
7071
7266
 
7072
7267
  case 22:
7073
7268
  case "end":
7074
- return _context25.stop();
7269
+ return _context26.stop();
7075
7270
  }
7076
7271
  }
7077
- }, _callee25, this, [[2, 13, 16, 19]]);
7272
+ }, _callee26, this, [[2, 13, 16, 19]]);
7078
7273
  }));
7079
7274
 
7080
- function upsertUsers(_x27) {
7275
+ function upsertUsers(_x29) {
7081
7276
  return _upsertUsers.apply(this, arguments);
7082
7277
  }
7083
7278
 
@@ -7125,72 +7320,72 @@ var StreamChat = /*#__PURE__*/function () {
7125
7320
  * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
7126
7321
  */
7127
7322
  function () {
7128
- var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(users) {
7323
+ var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(users) {
7129
7324
  var _iterator5, _step5, userObject;
7130
7325
 
7131
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
7326
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
7132
7327
  while (1) {
7133
- switch (_context26.prev = _context26.next) {
7328
+ switch (_context27.prev = _context27.next) {
7134
7329
  case 0:
7135
7330
  _iterator5 = _createForOfIteratorHelper(users);
7136
- _context26.prev = 1;
7331
+ _context27.prev = 1;
7137
7332
 
7138
7333
  _iterator5.s();
7139
7334
 
7140
7335
  case 3:
7141
7336
  if ((_step5 = _iterator5.n()).done) {
7142
- _context26.next = 9;
7337
+ _context27.next = 9;
7143
7338
  break;
7144
7339
  }
7145
7340
 
7146
7341
  userObject = _step5.value;
7147
7342
 
7148
7343
  if (userObject.id) {
7149
- _context26.next = 7;
7344
+ _context27.next = 7;
7150
7345
  break;
7151
7346
  }
7152
7347
 
7153
7348
  throw Error('User ID is required when updating a user');
7154
7349
 
7155
7350
  case 7:
7156
- _context26.next = 3;
7351
+ _context27.next = 3;
7157
7352
  break;
7158
7353
 
7159
7354
  case 9:
7160
- _context26.next = 14;
7355
+ _context27.next = 14;
7161
7356
  break;
7162
7357
 
7163
7358
  case 11:
7164
- _context26.prev = 11;
7165
- _context26.t0 = _context26["catch"](1);
7359
+ _context27.prev = 11;
7360
+ _context27.t0 = _context27["catch"](1);
7166
7361
 
7167
- _iterator5.e(_context26.t0);
7362
+ _iterator5.e(_context27.t0);
7168
7363
 
7169
7364
  case 14:
7170
- _context26.prev = 14;
7365
+ _context27.prev = 14;
7171
7366
 
7172
7367
  _iterator5.f();
7173
7368
 
7174
- return _context26.finish(14);
7369
+ return _context27.finish(14);
7175
7370
 
7176
7371
  case 17:
7177
- _context26.next = 19;
7372
+ _context27.next = 19;
7178
7373
  return this.patch(this.baseURL + '/users', {
7179
7374
  users: users
7180
7375
  });
7181
7376
 
7182
7377
  case 19:
7183
- return _context26.abrupt("return", _context26.sent);
7378
+ return _context27.abrupt("return", _context27.sent);
7184
7379
 
7185
7380
  case 20:
7186
7381
  case "end":
7187
- return _context26.stop();
7382
+ return _context27.stop();
7188
7383
  }
7189
7384
  }
7190
- }, _callee26, this, [[1, 11, 14, 17]]);
7385
+ }, _callee27, this, [[1, 11, 14, 17]]);
7191
7386
  }));
7192
7387
 
7193
- function partialUpdateUsers(_x28) {
7388
+ function partialUpdateUsers(_x30) {
7194
7389
  return _partialUpdateUsers.apply(this, arguments);
7195
7390
  }
7196
7391
 
@@ -7199,26 +7394,26 @@ var StreamChat = /*#__PURE__*/function () {
7199
7394
  }, {
7200
7395
  key: "deleteUser",
7201
7396
  value: function () {
7202
- var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(userID, params) {
7203
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
7397
+ var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(userID, params) {
7398
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
7204
7399
  while (1) {
7205
- switch (_context27.prev = _context27.next) {
7400
+ switch (_context28.prev = _context28.next) {
7206
7401
  case 0:
7207
- _context27.next = 2;
7402
+ _context28.next = 2;
7208
7403
  return this.delete(this.baseURL + "/users/".concat(userID), params);
7209
7404
 
7210
7405
  case 2:
7211
- return _context27.abrupt("return", _context27.sent);
7406
+ return _context28.abrupt("return", _context28.sent);
7212
7407
 
7213
7408
  case 3:
7214
7409
  case "end":
7215
- return _context27.stop();
7410
+ return _context28.stop();
7216
7411
  }
7217
7412
  }
7218
- }, _callee27, this);
7413
+ }, _callee28, this);
7219
7414
  }));
7220
7415
 
7221
- function deleteUser(_x29, _x30) {
7416
+ function deleteUser(_x31, _x32) {
7222
7417
  return _deleteUser.apply(this, arguments);
7223
7418
  }
7224
7419
 
@@ -7227,26 +7422,26 @@ var StreamChat = /*#__PURE__*/function () {
7227
7422
  }, {
7228
7423
  key: "reactivateUser",
7229
7424
  value: function () {
7230
- var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(userID, options) {
7231
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
7425
+ var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(userID, options) {
7426
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
7232
7427
  while (1) {
7233
- switch (_context28.prev = _context28.next) {
7428
+ switch (_context29.prev = _context29.next) {
7234
7429
  case 0:
7235
- _context28.next = 2;
7430
+ _context29.next = 2;
7236
7431
  return this.post(this.baseURL + "/users/".concat(userID, "/reactivate"), _objectSpread({}, options));
7237
7432
 
7238
7433
  case 2:
7239
- return _context28.abrupt("return", _context28.sent);
7434
+ return _context29.abrupt("return", _context29.sent);
7240
7435
 
7241
7436
  case 3:
7242
7437
  case "end":
7243
- return _context28.stop();
7438
+ return _context29.stop();
7244
7439
  }
7245
7440
  }
7246
- }, _callee28, this);
7441
+ }, _callee29, this);
7247
7442
  }));
7248
7443
 
7249
- function reactivateUser(_x31, _x32) {
7444
+ function reactivateUser(_x33, _x34) {
7250
7445
  return _reactivateUser.apply(this, arguments);
7251
7446
  }
7252
7447
 
@@ -7255,26 +7450,26 @@ var StreamChat = /*#__PURE__*/function () {
7255
7450
  }, {
7256
7451
  key: "deactivateUser",
7257
7452
  value: function () {
7258
- var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(userID, options) {
7259
- return _regeneratorRuntime.wrap(function _callee29$(_context29) {
7453
+ var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(userID, options) {
7454
+ return _regeneratorRuntime.wrap(function _callee30$(_context30) {
7260
7455
  while (1) {
7261
- switch (_context29.prev = _context29.next) {
7456
+ switch (_context30.prev = _context30.next) {
7262
7457
  case 0:
7263
- _context29.next = 2;
7458
+ _context30.next = 2;
7264
7459
  return this.post(this.baseURL + "/users/".concat(userID, "/deactivate"), _objectSpread({}, options));
7265
7460
 
7266
7461
  case 2:
7267
- return _context29.abrupt("return", _context29.sent);
7462
+ return _context30.abrupt("return", _context30.sent);
7268
7463
 
7269
7464
  case 3:
7270
7465
  case "end":
7271
- return _context29.stop();
7466
+ return _context30.stop();
7272
7467
  }
7273
7468
  }
7274
- }, _callee29, this);
7469
+ }, _callee30, this);
7275
7470
  }));
7276
7471
 
7277
- function deactivateUser(_x33, _x34) {
7472
+ function deactivateUser(_x35, _x36) {
7278
7473
  return _deactivateUser.apply(this, arguments);
7279
7474
  }
7280
7475
 
@@ -7283,26 +7478,26 @@ var StreamChat = /*#__PURE__*/function () {
7283
7478
  }, {
7284
7479
  key: "exportUser",
7285
7480
  value: function () {
7286
- var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(userID, options) {
7287
- return _regeneratorRuntime.wrap(function _callee30$(_context30) {
7481
+ var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(userID, options) {
7482
+ return _regeneratorRuntime.wrap(function _callee31$(_context31) {
7288
7483
  while (1) {
7289
- switch (_context30.prev = _context30.next) {
7484
+ switch (_context31.prev = _context31.next) {
7290
7485
  case 0:
7291
- _context30.next = 2;
7486
+ _context31.next = 2;
7292
7487
  return this.get(this.baseURL + "/users/".concat(userID, "/export"), _objectSpread({}, options));
7293
7488
 
7294
7489
  case 2:
7295
- return _context30.abrupt("return", _context30.sent);
7490
+ return _context31.abrupt("return", _context31.sent);
7296
7491
 
7297
7492
  case 3:
7298
7493
  case "end":
7299
- return _context30.stop();
7494
+ return _context31.stop();
7300
7495
  }
7301
7496
  }
7302
- }, _callee30, this);
7497
+ }, _callee31, this);
7303
7498
  }));
7304
7499
 
7305
- function exportUser(_x35, _x36) {
7500
+ function exportUser(_x37, _x38) {
7306
7501
  return _exportUser.apply(this, arguments);
7307
7502
  }
7308
7503
 
@@ -7318,10 +7513,10 @@ var StreamChat = /*#__PURE__*/function () {
7318
7513
  }, {
7319
7514
  key: "banUser",
7320
7515
  value: function () {
7321
- var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(targetUserID, options) {
7322
- return _regeneratorRuntime.wrap(function _callee31$(_context31) {
7516
+ var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(targetUserID, options) {
7517
+ return _regeneratorRuntime.wrap(function _callee32$(_context32) {
7323
7518
  while (1) {
7324
- switch (_context31.prev = _context31.next) {
7519
+ switch (_context32.prev = _context32.next) {
7325
7520
  case 0:
7326
7521
  if ((options === null || options === void 0 ? void 0 : options.user_id) !== undefined) {
7327
7522
  options.banned_by_id = options.user_id;
@@ -7335,23 +7530,23 @@ var StreamChat = /*#__PURE__*/function () {
7335
7530
  console.warn("banUser: 'user' is deprecated, please consider switching to 'banned_by'");
7336
7531
  }
7337
7532
 
7338
- _context31.next = 4;
7533
+ _context32.next = 4;
7339
7534
  return this.post(this.baseURL + '/moderation/ban', _objectSpread({
7340
7535
  target_user_id: targetUserID
7341
7536
  }, options));
7342
7537
 
7343
7538
  case 4:
7344
- return _context31.abrupt("return", _context31.sent);
7539
+ return _context32.abrupt("return", _context32.sent);
7345
7540
 
7346
7541
  case 5:
7347
7542
  case "end":
7348
- return _context31.stop();
7543
+ return _context32.stop();
7349
7544
  }
7350
7545
  }
7351
- }, _callee31, this);
7546
+ }, _callee32, this);
7352
7547
  }));
7353
7548
 
7354
- function banUser(_x37, _x38) {
7549
+ function banUser(_x39, _x40) {
7355
7550
  return _banUser.apply(this, arguments);
7356
7551
  }
7357
7552
 
@@ -7367,28 +7562,28 @@ var StreamChat = /*#__PURE__*/function () {
7367
7562
  }, {
7368
7563
  key: "unbanUser",
7369
7564
  value: function () {
7370
- var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(targetUserID, options) {
7371
- return _regeneratorRuntime.wrap(function _callee32$(_context32) {
7565
+ var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(targetUserID, options) {
7566
+ return _regeneratorRuntime.wrap(function _callee33$(_context33) {
7372
7567
  while (1) {
7373
- switch (_context32.prev = _context32.next) {
7568
+ switch (_context33.prev = _context33.next) {
7374
7569
  case 0:
7375
- _context32.next = 2;
7570
+ _context33.next = 2;
7376
7571
  return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
7377
7572
  target_user_id: targetUserID
7378
7573
  }, options));
7379
7574
 
7380
7575
  case 2:
7381
- return _context32.abrupt("return", _context32.sent);
7576
+ return _context33.abrupt("return", _context33.sent);
7382
7577
 
7383
7578
  case 3:
7384
7579
  case "end":
7385
- return _context32.stop();
7580
+ return _context33.stop();
7386
7581
  }
7387
7582
  }
7388
- }, _callee32, this);
7583
+ }, _callee33, this);
7389
7584
  }));
7390
7585
 
7391
- function unbanUser(_x39, _x40) {
7586
+ function unbanUser(_x41, _x42) {
7392
7587
  return _unbanUser.apply(this, arguments);
7393
7588
  }
7394
7589
 
@@ -7404,28 +7599,28 @@ var StreamChat = /*#__PURE__*/function () {
7404
7599
  }, {
7405
7600
  key: "shadowBan",
7406
7601
  value: function () {
7407
- var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(targetUserID, options) {
7408
- return _regeneratorRuntime.wrap(function _callee33$(_context33) {
7602
+ var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(targetUserID, options) {
7603
+ return _regeneratorRuntime.wrap(function _callee34$(_context34) {
7409
7604
  while (1) {
7410
- switch (_context33.prev = _context33.next) {
7605
+ switch (_context34.prev = _context34.next) {
7411
7606
  case 0:
7412
- _context33.next = 2;
7607
+ _context34.next = 2;
7413
7608
  return this.banUser(targetUserID, _objectSpread({
7414
7609
  shadow: true
7415
7610
  }, options));
7416
7611
 
7417
7612
  case 2:
7418
- return _context33.abrupt("return", _context33.sent);
7613
+ return _context34.abrupt("return", _context34.sent);
7419
7614
 
7420
7615
  case 3:
7421
7616
  case "end":
7422
- return _context33.stop();
7617
+ return _context34.stop();
7423
7618
  }
7424
7619
  }
7425
- }, _callee33, this);
7620
+ }, _callee34, this);
7426
7621
  }));
7427
7622
 
7428
- function shadowBan(_x41, _x42) {
7623
+ function shadowBan(_x43, _x44) {
7429
7624
  return _shadowBan.apply(this, arguments);
7430
7625
  }
7431
7626
 
@@ -7441,28 +7636,28 @@ var StreamChat = /*#__PURE__*/function () {
7441
7636
  }, {
7442
7637
  key: "removeShadowBan",
7443
7638
  value: function () {
7444
- var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(targetUserID, options) {
7445
- return _regeneratorRuntime.wrap(function _callee34$(_context34) {
7639
+ var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(targetUserID, options) {
7640
+ return _regeneratorRuntime.wrap(function _callee35$(_context35) {
7446
7641
  while (1) {
7447
- switch (_context34.prev = _context34.next) {
7642
+ switch (_context35.prev = _context35.next) {
7448
7643
  case 0:
7449
- _context34.next = 2;
7644
+ _context35.next = 2;
7450
7645
  return this.unbanUser(targetUserID, _objectSpread({
7451
7646
  shadow: true
7452
7647
  }, options));
7453
7648
 
7454
7649
  case 2:
7455
- return _context34.abrupt("return", _context34.sent);
7650
+ return _context35.abrupt("return", _context35.sent);
7456
7651
 
7457
7652
  case 3:
7458
7653
  case "end":
7459
- return _context34.stop();
7654
+ return _context35.stop();
7460
7655
  }
7461
7656
  }
7462
- }, _callee34, this);
7657
+ }, _callee35, this);
7463
7658
  }));
7464
7659
 
7465
- function removeShadowBan(_x43, _x44) {
7660
+ function removeShadowBan(_x45, _x46) {
7466
7661
  return _removeShadowBan.apply(this, arguments);
7467
7662
  }
7468
7663
 
@@ -7479,15 +7674,15 @@ var StreamChat = /*#__PURE__*/function () {
7479
7674
  }, {
7480
7675
  key: "muteUser",
7481
7676
  value: function () {
7482
- var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(targetID, userID) {
7677
+ var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(targetID, userID) {
7483
7678
  var options,
7484
- _args35 = arguments;
7485
- return _regeneratorRuntime.wrap(function _callee35$(_context35) {
7679
+ _args36 = arguments;
7680
+ return _regeneratorRuntime.wrap(function _callee36$(_context36) {
7486
7681
  while (1) {
7487
- switch (_context35.prev = _context35.next) {
7682
+ switch (_context36.prev = _context36.next) {
7488
7683
  case 0:
7489
- options = _args35.length > 2 && _args35[2] !== undefined ? _args35[2] : {};
7490
- _context35.next = 3;
7684
+ options = _args36.length > 2 && _args36[2] !== undefined ? _args36[2] : {};
7685
+ _context36.next = 3;
7491
7686
  return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
7492
7687
  target_id: targetID
7493
7688
  }, userID ? {
@@ -7495,17 +7690,17 @@ var StreamChat = /*#__PURE__*/function () {
7495
7690
  } : {}), options));
7496
7691
 
7497
7692
  case 3:
7498
- return _context35.abrupt("return", _context35.sent);
7693
+ return _context36.abrupt("return", _context36.sent);
7499
7694
 
7500
7695
  case 4:
7501
7696
  case "end":
7502
- return _context35.stop();
7697
+ return _context36.stop();
7503
7698
  }
7504
7699
  }
7505
- }, _callee35, this);
7700
+ }, _callee36, this);
7506
7701
  }));
7507
7702
 
7508
- function muteUser(_x45, _x46) {
7703
+ function muteUser(_x47, _x48) {
7509
7704
  return _muteUser.apply(this, arguments);
7510
7705
  }
7511
7706
 
@@ -7521,12 +7716,12 @@ var StreamChat = /*#__PURE__*/function () {
7521
7716
  }, {
7522
7717
  key: "unmuteUser",
7523
7718
  value: function () {
7524
- var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(targetID, currentUserID) {
7525
- return _regeneratorRuntime.wrap(function _callee36$(_context36) {
7719
+ var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(targetID, currentUserID) {
7720
+ return _regeneratorRuntime.wrap(function _callee37$(_context37) {
7526
7721
  while (1) {
7527
- switch (_context36.prev = _context36.next) {
7722
+ switch (_context37.prev = _context37.next) {
7528
7723
  case 0:
7529
- _context36.next = 2;
7724
+ _context37.next = 2;
7530
7725
  return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
7531
7726
  target_id: targetID
7532
7727
  }, currentUserID ? {
@@ -7534,17 +7729,17 @@ var StreamChat = /*#__PURE__*/function () {
7534
7729
  } : {}));
7535
7730
 
7536
7731
  case 2:
7537
- return _context36.abrupt("return", _context36.sent);
7732
+ return _context37.abrupt("return", _context37.sent);
7538
7733
 
7539
7734
  case 3:
7540
7735
  case "end":
7541
- return _context36.stop();
7736
+ return _context37.stop();
7542
7737
  }
7543
7738
  }
7544
- }, _callee36, this);
7739
+ }, _callee37, this);
7545
7740
  }));
7546
7741
 
7547
- function unmuteUser(_x47, _x48) {
7742
+ function unmuteUser(_x49, _x50) {
7548
7743
  return _unmuteUser.apply(this, arguments);
7549
7744
  }
7550
7745
 
@@ -7579,31 +7774,31 @@ var StreamChat = /*#__PURE__*/function () {
7579
7774
  }, {
7580
7775
  key: "flagMessage",
7581
7776
  value: function () {
7582
- var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(targetMessageID) {
7777
+ var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetMessageID) {
7583
7778
  var options,
7584
- _args37 = arguments;
7585
- return _regeneratorRuntime.wrap(function _callee37$(_context37) {
7779
+ _args38 = arguments;
7780
+ return _regeneratorRuntime.wrap(function _callee38$(_context38) {
7586
7781
  while (1) {
7587
- switch (_context37.prev = _context37.next) {
7782
+ switch (_context38.prev = _context38.next) {
7588
7783
  case 0:
7589
- options = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : {};
7590
- _context37.next = 3;
7784
+ options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
7785
+ _context38.next = 3;
7591
7786
  return this.post(this.baseURL + '/moderation/flag', _objectSpread({
7592
7787
  target_message_id: targetMessageID
7593
7788
  }, options));
7594
7789
 
7595
7790
  case 3:
7596
- return _context37.abrupt("return", _context37.sent);
7791
+ return _context38.abrupt("return", _context38.sent);
7597
7792
 
7598
7793
  case 4:
7599
7794
  case "end":
7600
- return _context37.stop();
7795
+ return _context38.stop();
7601
7796
  }
7602
7797
  }
7603
- }, _callee37, this);
7798
+ }, _callee38, this);
7604
7799
  }));
7605
7800
 
7606
- function flagMessage(_x49) {
7801
+ function flagMessage(_x51) {
7607
7802
  return _flagMessage.apply(this, arguments);
7608
7803
  }
7609
7804
 
@@ -7619,31 +7814,31 @@ var StreamChat = /*#__PURE__*/function () {
7619
7814
  }, {
7620
7815
  key: "flagUser",
7621
7816
  value: function () {
7622
- var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetID) {
7817
+ var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetID) {
7623
7818
  var options,
7624
- _args38 = arguments;
7625
- return _regeneratorRuntime.wrap(function _callee38$(_context38) {
7819
+ _args39 = arguments;
7820
+ return _regeneratorRuntime.wrap(function _callee39$(_context39) {
7626
7821
  while (1) {
7627
- switch (_context38.prev = _context38.next) {
7822
+ switch (_context39.prev = _context39.next) {
7628
7823
  case 0:
7629
- options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
7630
- _context38.next = 3;
7824
+ options = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {};
7825
+ _context39.next = 3;
7631
7826
  return this.post(this.baseURL + '/moderation/flag', _objectSpread({
7632
7827
  target_user_id: targetID
7633
7828
  }, options));
7634
7829
 
7635
7830
  case 3:
7636
- return _context38.abrupt("return", _context38.sent);
7831
+ return _context39.abrupt("return", _context39.sent);
7637
7832
 
7638
7833
  case 4:
7639
7834
  case "end":
7640
- return _context38.stop();
7835
+ return _context39.stop();
7641
7836
  }
7642
7837
  }
7643
- }, _callee38, this);
7838
+ }, _callee39, this);
7644
7839
  }));
7645
7840
 
7646
- function flagUser(_x50) {
7841
+ function flagUser(_x52) {
7647
7842
  return _flagUser.apply(this, arguments);
7648
7843
  }
7649
7844
 
@@ -7659,31 +7854,31 @@ var StreamChat = /*#__PURE__*/function () {
7659
7854
  }, {
7660
7855
  key: "unflagMessage",
7661
7856
  value: function () {
7662
- var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetMessageID) {
7857
+ var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetMessageID) {
7663
7858
  var options,
7664
- _args39 = arguments;
7665
- return _regeneratorRuntime.wrap(function _callee39$(_context39) {
7859
+ _args40 = arguments;
7860
+ return _regeneratorRuntime.wrap(function _callee40$(_context40) {
7666
7861
  while (1) {
7667
- switch (_context39.prev = _context39.next) {
7862
+ switch (_context40.prev = _context40.next) {
7668
7863
  case 0:
7669
- options = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {};
7670
- _context39.next = 3;
7864
+ options = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
7865
+ _context40.next = 3;
7671
7866
  return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
7672
7867
  target_message_id: targetMessageID
7673
7868
  }, options));
7674
7869
 
7675
7870
  case 3:
7676
- return _context39.abrupt("return", _context39.sent);
7871
+ return _context40.abrupt("return", _context40.sent);
7677
7872
 
7678
7873
  case 4:
7679
7874
  case "end":
7680
- return _context39.stop();
7875
+ return _context40.stop();
7681
7876
  }
7682
7877
  }
7683
- }, _callee39, this);
7878
+ }, _callee40, this);
7684
7879
  }));
7685
7880
 
7686
- function unflagMessage(_x51) {
7881
+ function unflagMessage(_x53) {
7687
7882
  return _unflagMessage.apply(this, arguments);
7688
7883
  }
7689
7884
 
@@ -7699,31 +7894,31 @@ var StreamChat = /*#__PURE__*/function () {
7699
7894
  }, {
7700
7895
  key: "unflagUser",
7701
7896
  value: function () {
7702
- var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetID) {
7897
+ var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetID) {
7703
7898
  var options,
7704
- _args40 = arguments;
7705
- return _regeneratorRuntime.wrap(function _callee40$(_context40) {
7899
+ _args41 = arguments;
7900
+ return _regeneratorRuntime.wrap(function _callee41$(_context41) {
7706
7901
  while (1) {
7707
- switch (_context40.prev = _context40.next) {
7902
+ switch (_context41.prev = _context41.next) {
7708
7903
  case 0:
7709
- options = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
7710
- _context40.next = 3;
7904
+ options = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {};
7905
+ _context41.next = 3;
7711
7906
  return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
7712
7907
  target_user_id: targetID
7713
7908
  }, options));
7714
7909
 
7715
7910
  case 3:
7716
- return _context40.abrupt("return", _context40.sent);
7911
+ return _context41.abrupt("return", _context41.sent);
7717
7912
 
7718
7913
  case 4:
7719
7914
  case "end":
7720
- return _context40.stop();
7915
+ return _context41.stop();
7721
7916
  }
7722
7917
  }
7723
- }, _callee40, this);
7918
+ }, _callee41, this);
7724
7919
  }));
7725
7920
 
7726
- function unflagUser(_x52) {
7921
+ function unflagUser(_x54) {
7727
7922
  return _unflagUser.apply(this, arguments);
7728
7923
  }
7729
7924
 
@@ -7750,23 +7945,23 @@ var StreamChat = /*#__PURE__*/function () {
7750
7945
  * @return {Promise<APIResponse>}
7751
7946
  */
7752
7947
  function () {
7753
- var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
7948
+ var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42() {
7754
7949
  var data,
7755
- _args41 = arguments;
7756
- return _regeneratorRuntime.wrap(function _callee41$(_context41) {
7950
+ _args42 = arguments;
7951
+ return _regeneratorRuntime.wrap(function _callee42$(_context42) {
7757
7952
  while (1) {
7758
- switch (_context41.prev = _context41.next) {
7953
+ switch (_context42.prev = _context42.next) {
7759
7954
  case 0:
7760
- data = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : {};
7761
- _context41.next = 3;
7955
+ data = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
7956
+ _context42.next = 3;
7762
7957
  return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
7763
7958
 
7764
7959
  case 3:
7765
7960
  case "end":
7766
- return _context41.stop();
7961
+ return _context42.stop();
7767
7962
  }
7768
7963
  }
7769
- }, _callee41, this);
7964
+ }, _callee42, this);
7770
7965
  }));
7771
7966
 
7772
7967
  function markChannelsRead() {
@@ -7841,28 +8036,28 @@ var StreamChat = /*#__PURE__*/function () {
7841
8036
  }, {
7842
8037
  key: "translateMessage",
7843
8038
  value: function () {
7844
- var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(messageId, language) {
7845
- return _regeneratorRuntime.wrap(function _callee42$(_context42) {
8039
+ var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(messageId, language) {
8040
+ return _regeneratorRuntime.wrap(function _callee43$(_context43) {
7846
8041
  while (1) {
7847
- switch (_context42.prev = _context42.next) {
8042
+ switch (_context43.prev = _context43.next) {
7848
8043
  case 0:
7849
- _context42.next = 2;
8044
+ _context43.next = 2;
7850
8045
  return this.post(this.baseURL + "/messages/".concat(messageId, "/translate"), {
7851
8046
  language: language
7852
8047
  });
7853
8048
 
7854
8049
  case 2:
7855
- return _context42.abrupt("return", _context42.sent);
8050
+ return _context43.abrupt("return", _context43.sent);
7856
8051
 
7857
8052
  case 3:
7858
8053
  case "end":
7859
- return _context42.stop();
8054
+ return _context43.stop();
7860
8055
  }
7861
8056
  }
7862
- }, _callee42, this);
8057
+ }, _callee43, this);
7863
8058
  }));
7864
8059
 
7865
- function translateMessage(_x53, _x54) {
8060
+ function translateMessage(_x55, _x56) {
7866
8061
  return _translateMessage.apply(this, arguments);
7867
8062
  }
7868
8063
 
@@ -7962,14 +8157,14 @@ var StreamChat = /*#__PURE__*/function () {
7962
8157
  }, {
7963
8158
  key: "updateMessage",
7964
8159
  value: function () {
7965
- var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(message, userId, options) {
8160
+ var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(message, userId, options) {
7966
8161
  var clonedMessage, reservedMessageFields;
7967
- return _regeneratorRuntime.wrap(function _callee43$(_context43) {
8162
+ return _regeneratorRuntime.wrap(function _callee44$(_context44) {
7968
8163
  while (1) {
7969
- switch (_context43.prev = _context43.next) {
8164
+ switch (_context44.prev = _context44.next) {
7970
8165
  case 0:
7971
8166
  if (message.id) {
7972
- _context43.next = 2;
8167
+ _context44.next = 2;
7973
8168
  break;
7974
8169
  }
7975
8170
 
@@ -8006,23 +8201,23 @@ var StreamChat = /*#__PURE__*/function () {
8006
8201
  });
8007
8202
  }
8008
8203
 
8009
- _context43.next = 10;
8204
+ _context44.next = 10;
8010
8205
  return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
8011
8206
  message: clonedMessage
8012
8207
  }, options));
8013
8208
 
8014
8209
  case 10:
8015
- return _context43.abrupt("return", _context43.sent);
8210
+ return _context44.abrupt("return", _context44.sent);
8016
8211
 
8017
8212
  case 11:
8018
8213
  case "end":
8019
- return _context43.stop();
8214
+ return _context44.stop();
8020
8215
  }
8021
8216
  }
8022
- }, _callee43, this);
8217
+ }, _callee44, this);
8023
8218
  }));
8024
8219
 
8025
- function updateMessage(_x55, _x56, _x57) {
8220
+ function updateMessage(_x57, _x58, _x59) {
8026
8221
  return _updateMessage.apply(this, arguments);
8027
8222
  }
8028
8223
 
@@ -8045,14 +8240,14 @@ var StreamChat = /*#__PURE__*/function () {
8045
8240
  }, {
8046
8241
  key: "partialUpdateMessage",
8047
8242
  value: function () {
8048
- var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(id, partialMessageObject, userId, options) {
8243
+ var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(id, partialMessageObject, userId, options) {
8049
8244
  var user;
8050
- return _regeneratorRuntime.wrap(function _callee44$(_context44) {
8245
+ return _regeneratorRuntime.wrap(function _callee45$(_context45) {
8051
8246
  while (1) {
8052
- switch (_context44.prev = _context44.next) {
8247
+ switch (_context45.prev = _context45.next) {
8053
8248
  case 0:
8054
8249
  if (id) {
8055
- _context44.next = 2;
8250
+ _context45.next = 2;
8056
8251
  break;
8057
8252
  }
8058
8253
 
@@ -8067,23 +8262,23 @@ var StreamChat = /*#__PURE__*/function () {
8067
8262
  };
8068
8263
  }
8069
8264
 
8070
- _context44.next = 6;
8265
+ _context45.next = 6;
8071
8266
  return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
8072
8267
  user: user
8073
8268
  }));
8074
8269
 
8075
8270
  case 6:
8076
- return _context44.abrupt("return", _context44.sent);
8271
+ return _context45.abrupt("return", _context45.sent);
8077
8272
 
8078
8273
  case 7:
8079
8274
  case "end":
8080
- return _context44.stop();
8275
+ return _context45.stop();
8081
8276
  }
8082
8277
  }
8083
- }, _callee44, this);
8278
+ }, _callee45, this);
8084
8279
  }));
8085
8280
 
8086
- function partialUpdateMessage(_x58, _x59, _x60, _x61) {
8281
+ function partialUpdateMessage(_x60, _x61, _x62, _x63) {
8087
8282
  return _partialUpdateMessage.apply(this, arguments);
8088
8283
  }
8089
8284
 
@@ -8092,11 +8287,11 @@ var StreamChat = /*#__PURE__*/function () {
8092
8287
  }, {
8093
8288
  key: "deleteMessage",
8094
8289
  value: function () {
8095
- var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(messageID, hardDelete) {
8290
+ var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageID, hardDelete) {
8096
8291
  var params;
8097
- return _regeneratorRuntime.wrap(function _callee45$(_context45) {
8292
+ return _regeneratorRuntime.wrap(function _callee46$(_context46) {
8098
8293
  while (1) {
8099
- switch (_context45.prev = _context45.next) {
8294
+ switch (_context46.prev = _context46.next) {
8100
8295
  case 0:
8101
8296
  params = {};
8102
8297
 
@@ -8106,21 +8301,21 @@ var StreamChat = /*#__PURE__*/function () {
8106
8301
  };
8107
8302
  }
8108
8303
 
8109
- _context45.next = 4;
8304
+ _context46.next = 4;
8110
8305
  return this.delete(this.baseURL + "/messages/".concat(messageID), params);
8111
8306
 
8112
8307
  case 4:
8113
- return _context45.abrupt("return", _context45.sent);
8308
+ return _context46.abrupt("return", _context46.sent);
8114
8309
 
8115
8310
  case 5:
8116
8311
  case "end":
8117
- return _context45.stop();
8312
+ return _context46.stop();
8118
8313
  }
8119
8314
  }
8120
- }, _callee45, this);
8315
+ }, _callee46, this);
8121
8316
  }));
8122
8317
 
8123
- function deleteMessage(_x62, _x63) {
8318
+ function deleteMessage(_x64, _x65) {
8124
8319
  return _deleteMessage.apply(this, arguments);
8125
8320
  }
8126
8321
 
@@ -8129,26 +8324,26 @@ var StreamChat = /*#__PURE__*/function () {
8129
8324
  }, {
8130
8325
  key: "getMessage",
8131
8326
  value: function () {
8132
- var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageID) {
8133
- return _regeneratorRuntime.wrap(function _callee46$(_context46) {
8327
+ var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(messageID) {
8328
+ return _regeneratorRuntime.wrap(function _callee47$(_context47) {
8134
8329
  while (1) {
8135
- switch (_context46.prev = _context46.next) {
8330
+ switch (_context47.prev = _context47.next) {
8136
8331
  case 0:
8137
- _context46.next = 2;
8332
+ _context47.next = 2;
8138
8333
  return this.get(this.baseURL + "/messages/".concat(messageID));
8139
8334
 
8140
8335
  case 2:
8141
- return _context46.abrupt("return", _context46.sent);
8336
+ return _context47.abrupt("return", _context47.sent);
8142
8337
 
8143
8338
  case 3:
8144
8339
  case "end":
8145
- return _context46.stop();
8340
+ return _context47.stop();
8146
8341
  }
8147
8342
  }
8148
- }, _callee46, this);
8343
+ }, _callee47, this);
8149
8344
  }));
8150
8345
 
8151
- function getMessage(_x64) {
8346
+ function getMessage(_x66) {
8152
8347
  return _getMessage.apply(this, arguments);
8153
8348
  }
8154
8349
 
@@ -8157,7 +8352,7 @@ var StreamChat = /*#__PURE__*/function () {
8157
8352
  }, {
8158
8353
  key: "getUserAgent",
8159
8354
  value: function getUserAgent() {
8160
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.3.0");
8355
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.4.2");
8161
8356
  }
8162
8357
  }, {
8163
8358
  key: "setUserAgent",
@@ -8338,28 +8533,28 @@ var StreamChat = /*#__PURE__*/function () {
8338
8533
  }, {
8339
8534
  key: "sendUserCustomEvent",
8340
8535
  value: function () {
8341
- var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(targetUserID, event) {
8342
- return _regeneratorRuntime.wrap(function _callee47$(_context47) {
8536
+ var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(targetUserID, event) {
8537
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
8343
8538
  while (1) {
8344
- switch (_context47.prev = _context47.next) {
8539
+ switch (_context48.prev = _context48.next) {
8345
8540
  case 0:
8346
- _context47.next = 2;
8541
+ _context48.next = 2;
8347
8542
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
8348
8543
  event: event
8349
8544
  });
8350
8545
 
8351
8546
  case 2:
8352
- return _context47.abrupt("return", _context47.sent);
8547
+ return _context48.abrupt("return", _context48.sent);
8353
8548
 
8354
8549
  case 3:
8355
8550
  case "end":
8356
- return _context47.stop();
8551
+ return _context48.stop();
8357
8552
  }
8358
8553
  }
8359
- }, _callee47, this);
8554
+ }, _callee48, this);
8360
8555
  }));
8361
8556
 
8362
- function sendUserCustomEvent(_x65, _x66) {
8557
+ function sendUserCustomEvent(_x67, _x68) {
8363
8558
  return _sendUserCustomEvent.apply(this, arguments);
8364
8559
  }
8365
8560
 
@@ -8422,32 +8617,32 @@ var StreamChat = /*#__PURE__*/function () {
8422
8617
  }, {
8423
8618
  key: "createSegment",
8424
8619
  value: function () {
8425
- var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(params) {
8620
+ var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(params) {
8426
8621
  var _yield$this$post, segment;
8427
8622
 
8428
- return _regeneratorRuntime.wrap(function _callee48$(_context48) {
8623
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
8429
8624
  while (1) {
8430
- switch (_context48.prev = _context48.next) {
8625
+ switch (_context49.prev = _context49.next) {
8431
8626
  case 0:
8432
- _context48.next = 2;
8627
+ _context49.next = 2;
8433
8628
  return this.post(this.baseURL + "/segments", {
8434
8629
  segment: params
8435
8630
  });
8436
8631
 
8437
8632
  case 2:
8438
- _yield$this$post = _context48.sent;
8633
+ _yield$this$post = _context49.sent;
8439
8634
  segment = _yield$this$post.segment;
8440
- return _context48.abrupt("return", segment);
8635
+ return _context49.abrupt("return", segment);
8441
8636
 
8442
8637
  case 5:
8443
8638
  case "end":
8444
- return _context48.stop();
8639
+ return _context49.stop();
8445
8640
  }
8446
8641
  }
8447
- }, _callee48, this);
8642
+ }, _callee49, this);
8448
8643
  }));
8449
8644
 
8450
- function createSegment(_x67) {
8645
+ function createSegment(_x69) {
8451
8646
  return _createSegment.apply(this, arguments);
8452
8647
  }
8453
8648
 
@@ -8464,30 +8659,30 @@ var StreamChat = /*#__PURE__*/function () {
8464
8659
  }, {
8465
8660
  key: "getSegment",
8466
8661
  value: function () {
8467
- var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(id) {
8662
+ var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(id) {
8468
8663
  var _yield$this$get, segment;
8469
8664
 
8470
- return _regeneratorRuntime.wrap(function _callee49$(_context49) {
8665
+ return _regeneratorRuntime.wrap(function _callee50$(_context50) {
8471
8666
  while (1) {
8472
- switch (_context49.prev = _context49.next) {
8667
+ switch (_context50.prev = _context50.next) {
8473
8668
  case 0:
8474
- _context49.next = 2;
8669
+ _context50.next = 2;
8475
8670
  return this.get(this.baseURL + "/segments/".concat(id));
8476
8671
 
8477
8672
  case 2:
8478
- _yield$this$get = _context49.sent;
8673
+ _yield$this$get = _context50.sent;
8479
8674
  segment = _yield$this$get.segment;
8480
- return _context49.abrupt("return", segment);
8675
+ return _context50.abrupt("return", segment);
8481
8676
 
8482
8677
  case 5:
8483
8678
  case "end":
8484
- return _context49.stop();
8679
+ return _context50.stop();
8485
8680
  }
8486
8681
  }
8487
- }, _callee49, this);
8682
+ }, _callee50, this);
8488
8683
  }));
8489
8684
 
8490
- function getSegment(_x68) {
8685
+ function getSegment(_x70) {
8491
8686
  return _getSegment.apply(this, arguments);
8492
8687
  }
8493
8688
 
@@ -8503,30 +8698,30 @@ var StreamChat = /*#__PURE__*/function () {
8503
8698
  }, {
8504
8699
  key: "listSegments",
8505
8700
  value: function () {
8506
- var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(options) {
8701
+ var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(options) {
8507
8702
  var _yield$this$get2, segments;
8508
8703
 
8509
- return _regeneratorRuntime.wrap(function _callee50$(_context50) {
8704
+ return _regeneratorRuntime.wrap(function _callee51$(_context51) {
8510
8705
  while (1) {
8511
- switch (_context50.prev = _context50.next) {
8706
+ switch (_context51.prev = _context51.next) {
8512
8707
  case 0:
8513
- _context50.next = 2;
8708
+ _context51.next = 2;
8514
8709
  return this.get(this.baseURL + "/segments", options);
8515
8710
 
8516
8711
  case 2:
8517
- _yield$this$get2 = _context50.sent;
8712
+ _yield$this$get2 = _context51.sent;
8518
8713
  segments = _yield$this$get2.segments;
8519
- return _context50.abrupt("return", segments);
8714
+ return _context51.abrupt("return", segments);
8520
8715
 
8521
8716
  case 5:
8522
8717
  case "end":
8523
- return _context50.stop();
8718
+ return _context51.stop();
8524
8719
  }
8525
8720
  }
8526
- }, _callee50, this);
8721
+ }, _callee51, this);
8527
8722
  }));
8528
8723
 
8529
- function listSegments(_x69) {
8724
+ function listSegments(_x71) {
8530
8725
  return _listSegments.apply(this, arguments);
8531
8726
  }
8532
8727
 
@@ -8544,32 +8739,32 @@ var StreamChat = /*#__PURE__*/function () {
8544
8739
  }, {
8545
8740
  key: "updateSegment",
8546
8741
  value: function () {
8547
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(id, params) {
8742
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(id, params) {
8548
8743
  var _yield$this$put, segment;
8549
8744
 
8550
- return _regeneratorRuntime.wrap(function _callee51$(_context51) {
8745
+ return _regeneratorRuntime.wrap(function _callee52$(_context52) {
8551
8746
  while (1) {
8552
- switch (_context51.prev = _context51.next) {
8747
+ switch (_context52.prev = _context52.next) {
8553
8748
  case 0:
8554
- _context51.next = 2;
8749
+ _context52.next = 2;
8555
8750
  return this.put(this.baseURL + "/segments/".concat(id), {
8556
8751
  segment: params
8557
8752
  });
8558
8753
 
8559
8754
  case 2:
8560
- _yield$this$put = _context51.sent;
8755
+ _yield$this$put = _context52.sent;
8561
8756
  segment = _yield$this$put.segment;
8562
- return _context51.abrupt("return", segment);
8757
+ return _context52.abrupt("return", segment);
8563
8758
 
8564
8759
  case 5:
8565
8760
  case "end":
8566
- return _context51.stop();
8761
+ return _context52.stop();
8567
8762
  }
8568
8763
  }
8569
- }, _callee51, this);
8764
+ }, _callee52, this);
8570
8765
  }));
8571
8766
 
8572
- function updateSegment(_x70, _x71) {
8767
+ function updateSegment(_x72, _x73) {
8573
8768
  return _updateSegment.apply(this, arguments);
8574
8769
  }
8575
8770
 
@@ -8586,22 +8781,22 @@ var StreamChat = /*#__PURE__*/function () {
8586
8781
  }, {
8587
8782
  key: "deleteSegment",
8588
8783
  value: function () {
8589
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(id) {
8590
- return _regeneratorRuntime.wrap(function _callee52$(_context52) {
8784
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(id) {
8785
+ return _regeneratorRuntime.wrap(function _callee53$(_context53) {
8591
8786
  while (1) {
8592
- switch (_context52.prev = _context52.next) {
8787
+ switch (_context53.prev = _context53.next) {
8593
8788
  case 0:
8594
- return _context52.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
8789
+ return _context53.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
8595
8790
 
8596
8791
  case 1:
8597
8792
  case "end":
8598
- return _context52.stop();
8793
+ return _context53.stop();
8599
8794
  }
8600
8795
  }
8601
- }, _callee52, this);
8796
+ }, _callee53, this);
8602
8797
  }));
8603
8798
 
8604
- function deleteSegment(_x72) {
8799
+ function deleteSegment(_x74) {
8605
8800
  return _deleteSegment.apply(this, arguments);
8606
8801
  }
8607
8802
 
@@ -8618,32 +8813,32 @@ var StreamChat = /*#__PURE__*/function () {
8618
8813
  }, {
8619
8814
  key: "createCampaign",
8620
8815
  value: function () {
8621
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(params) {
8816
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(params) {
8622
8817
  var _yield$this$post2, campaign;
8623
8818
 
8624
- return _regeneratorRuntime.wrap(function _callee53$(_context53) {
8819
+ return _regeneratorRuntime.wrap(function _callee54$(_context54) {
8625
8820
  while (1) {
8626
- switch (_context53.prev = _context53.next) {
8821
+ switch (_context54.prev = _context54.next) {
8627
8822
  case 0:
8628
- _context53.next = 2;
8823
+ _context54.next = 2;
8629
8824
  return this.post(this.baseURL + "/campaigns", {
8630
8825
  campaign: params
8631
8826
  });
8632
8827
 
8633
8828
  case 2:
8634
- _yield$this$post2 = _context53.sent;
8829
+ _yield$this$post2 = _context54.sent;
8635
8830
  campaign = _yield$this$post2.campaign;
8636
- return _context53.abrupt("return", campaign);
8831
+ return _context54.abrupt("return", campaign);
8637
8832
 
8638
8833
  case 5:
8639
8834
  case "end":
8640
- return _context53.stop();
8835
+ return _context54.stop();
8641
8836
  }
8642
8837
  }
8643
- }, _callee53, this);
8838
+ }, _callee54, this);
8644
8839
  }));
8645
8840
 
8646
- function createCampaign(_x73) {
8841
+ function createCampaign(_x75) {
8647
8842
  return _createCampaign.apply(this, arguments);
8648
8843
  }
8649
8844
 
@@ -8660,30 +8855,30 @@ var StreamChat = /*#__PURE__*/function () {
8660
8855
  }, {
8661
8856
  key: "getCampaign",
8662
8857
  value: function () {
8663
- var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(id) {
8858
+ var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(id) {
8664
8859
  var _yield$this$get3, campaign;
8665
8860
 
8666
- return _regeneratorRuntime.wrap(function _callee54$(_context54) {
8861
+ return _regeneratorRuntime.wrap(function _callee55$(_context55) {
8667
8862
  while (1) {
8668
- switch (_context54.prev = _context54.next) {
8863
+ switch (_context55.prev = _context55.next) {
8669
8864
  case 0:
8670
- _context54.next = 2;
8865
+ _context55.next = 2;
8671
8866
  return this.get(this.baseURL + "/campaigns/".concat(id));
8672
8867
 
8673
8868
  case 2:
8674
- _yield$this$get3 = _context54.sent;
8869
+ _yield$this$get3 = _context55.sent;
8675
8870
  campaign = _yield$this$get3.campaign;
8676
- return _context54.abrupt("return", campaign);
8871
+ return _context55.abrupt("return", campaign);
8677
8872
 
8678
8873
  case 5:
8679
8874
  case "end":
8680
- return _context54.stop();
8875
+ return _context55.stop();
8681
8876
  }
8682
8877
  }
8683
- }, _callee54, this);
8878
+ }, _callee55, this);
8684
8879
  }));
8685
8880
 
8686
- function getCampaign(_x74) {
8881
+ function getCampaign(_x76) {
8687
8882
  return _getCampaign.apply(this, arguments);
8688
8883
  }
8689
8884
 
@@ -8699,30 +8894,30 @@ var StreamChat = /*#__PURE__*/function () {
8699
8894
  }, {
8700
8895
  key: "listCampaigns",
8701
8896
  value: function () {
8702
- var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(options) {
8897
+ var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(options) {
8703
8898
  var _yield$this$get4, campaigns;
8704
8899
 
8705
- return _regeneratorRuntime.wrap(function _callee55$(_context55) {
8900
+ return _regeneratorRuntime.wrap(function _callee56$(_context56) {
8706
8901
  while (1) {
8707
- switch (_context55.prev = _context55.next) {
8902
+ switch (_context56.prev = _context56.next) {
8708
8903
  case 0:
8709
- _context55.next = 2;
8904
+ _context56.next = 2;
8710
8905
  return this.get(this.baseURL + "/campaigns", options);
8711
8906
 
8712
8907
  case 2:
8713
- _yield$this$get4 = _context55.sent;
8908
+ _yield$this$get4 = _context56.sent;
8714
8909
  campaigns = _yield$this$get4.campaigns;
8715
- return _context55.abrupt("return", campaigns);
8910
+ return _context56.abrupt("return", campaigns);
8716
8911
 
8717
8912
  case 5:
8718
8913
  case "end":
8719
- return _context55.stop();
8914
+ return _context56.stop();
8720
8915
  }
8721
8916
  }
8722
- }, _callee55, this);
8917
+ }, _callee56, this);
8723
8918
  }));
8724
8919
 
8725
- function listCampaigns(_x75) {
8920
+ function listCampaigns(_x77) {
8726
8921
  return _listCampaigns.apply(this, arguments);
8727
8922
  }
8728
8923
 
@@ -8740,32 +8935,32 @@ var StreamChat = /*#__PURE__*/function () {
8740
8935
  }, {
8741
8936
  key: "updateCampaign",
8742
8937
  value: function () {
8743
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(id, params) {
8938
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id, params) {
8744
8939
  var _yield$this$put2, campaign;
8745
8940
 
8746
- return _regeneratorRuntime.wrap(function _callee56$(_context56) {
8941
+ return _regeneratorRuntime.wrap(function _callee57$(_context57) {
8747
8942
  while (1) {
8748
- switch (_context56.prev = _context56.next) {
8943
+ switch (_context57.prev = _context57.next) {
8749
8944
  case 0:
8750
- _context56.next = 2;
8945
+ _context57.next = 2;
8751
8946
  return this.put(this.baseURL + "/campaigns/".concat(id), {
8752
8947
  campaign: params
8753
8948
  });
8754
8949
 
8755
8950
  case 2:
8756
- _yield$this$put2 = _context56.sent;
8951
+ _yield$this$put2 = _context57.sent;
8757
8952
  campaign = _yield$this$put2.campaign;
8758
- return _context56.abrupt("return", campaign);
8953
+ return _context57.abrupt("return", campaign);
8759
8954
 
8760
8955
  case 5:
8761
8956
  case "end":
8762
- return _context56.stop();
8957
+ return _context57.stop();
8763
8958
  }
8764
8959
  }
8765
- }, _callee56, this);
8960
+ }, _callee57, this);
8766
8961
  }));
8767
8962
 
8768
- function updateCampaign(_x76, _x77) {
8963
+ function updateCampaign(_x78, _x79) {
8769
8964
  return _updateCampaign.apply(this, arguments);
8770
8965
  }
8771
8966
 
@@ -8782,22 +8977,22 @@ var StreamChat = /*#__PURE__*/function () {
8782
8977
  }, {
8783
8978
  key: "deleteCampaign",
8784
8979
  value: function () {
8785
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id) {
8786
- return _regeneratorRuntime.wrap(function _callee57$(_context57) {
8980
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(id) {
8981
+ return _regeneratorRuntime.wrap(function _callee58$(_context58) {
8787
8982
  while (1) {
8788
- switch (_context57.prev = _context57.next) {
8983
+ switch (_context58.prev = _context58.next) {
8789
8984
  case 0:
8790
- return _context57.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
8985
+ return _context58.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
8791
8986
 
8792
8987
  case 1:
8793
8988
  case "end":
8794
- return _context57.stop();
8989
+ return _context58.stop();
8795
8990
  }
8796
8991
  }
8797
- }, _callee57, this);
8992
+ }, _callee58, this);
8798
8993
  }));
8799
8994
 
8800
- function deleteCampaign(_x78) {
8995
+ function deleteCampaign(_x80) {
8801
8996
  return _deleteCampaign.apply(this, arguments);
8802
8997
  }
8803
8998
 
@@ -8815,33 +9010,33 @@ var StreamChat = /*#__PURE__*/function () {
8815
9010
  }, {
8816
9011
  key: "scheduleCampaign",
8817
9012
  value: function () {
8818
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(id, params) {
9013
+ var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(id, params) {
8819
9014
  var sendAt, _yield$this$patch, campaign;
8820
9015
 
8821
- return _regeneratorRuntime.wrap(function _callee58$(_context58) {
9016
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
8822
9017
  while (1) {
8823
- switch (_context58.prev = _context58.next) {
9018
+ switch (_context59.prev = _context59.next) {
8824
9019
  case 0:
8825
9020
  sendAt = params.sendAt;
8826
- _context58.next = 3;
9021
+ _context59.next = 3;
8827
9022
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
8828
9023
  send_at: sendAt
8829
9024
  });
8830
9025
 
8831
9026
  case 3:
8832
- _yield$this$patch = _context58.sent;
9027
+ _yield$this$patch = _context59.sent;
8833
9028
  campaign = _yield$this$patch.campaign;
8834
- return _context58.abrupt("return", campaign);
9029
+ return _context59.abrupt("return", campaign);
8835
9030
 
8836
9031
  case 6:
8837
9032
  case "end":
8838
- return _context58.stop();
9033
+ return _context59.stop();
8839
9034
  }
8840
9035
  }
8841
- }, _callee58, this);
9036
+ }, _callee59, this);
8842
9037
  }));
8843
9038
 
8844
- function scheduleCampaign(_x79, _x80) {
9039
+ function scheduleCampaign(_x81, _x82) {
8845
9040
  return _scheduleCampaign.apply(this, arguments);
8846
9041
  }
8847
9042
 
@@ -8858,30 +9053,30 @@ var StreamChat = /*#__PURE__*/function () {
8858
9053
  }, {
8859
9054
  key: "stopCampaign",
8860
9055
  value: function () {
8861
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(id) {
9056
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id) {
8862
9057
  var _yield$this$patch2, campaign;
8863
9058
 
8864
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
9059
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
8865
9060
  while (1) {
8866
- switch (_context59.prev = _context59.next) {
9061
+ switch (_context60.prev = _context60.next) {
8867
9062
  case 0:
8868
- _context59.next = 2;
9063
+ _context60.next = 2;
8869
9064
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
8870
9065
 
8871
9066
  case 2:
8872
- _yield$this$patch2 = _context59.sent;
9067
+ _yield$this$patch2 = _context60.sent;
8873
9068
  campaign = _yield$this$patch2.campaign;
8874
- return _context59.abrupt("return", campaign);
9069
+ return _context60.abrupt("return", campaign);
8875
9070
 
8876
9071
  case 5:
8877
9072
  case "end":
8878
- return _context59.stop();
9073
+ return _context60.stop();
8879
9074
  }
8880
9075
  }
8881
- }, _callee59, this);
9076
+ }, _callee60, this);
8882
9077
  }));
8883
9078
 
8884
- function stopCampaign(_x81) {
9079
+ function stopCampaign(_x83) {
8885
9080
  return _stopCampaign.apply(this, arguments);
8886
9081
  }
8887
9082
 
@@ -8898,30 +9093,30 @@ var StreamChat = /*#__PURE__*/function () {
8898
9093
  }, {
8899
9094
  key: "resumeCampaign",
8900
9095
  value: function () {
8901
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id) {
9096
+ var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id) {
8902
9097
  var _yield$this$patch3, campaign;
8903
9098
 
8904
- return _regeneratorRuntime.wrap(function _callee60$(_context60) {
9099
+ return _regeneratorRuntime.wrap(function _callee61$(_context61) {
8905
9100
  while (1) {
8906
- switch (_context60.prev = _context60.next) {
9101
+ switch (_context61.prev = _context61.next) {
8907
9102
  case 0:
8908
- _context60.next = 2;
9103
+ _context61.next = 2;
8909
9104
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
8910
9105
 
8911
9106
  case 2:
8912
- _yield$this$patch3 = _context60.sent;
9107
+ _yield$this$patch3 = _context61.sent;
8913
9108
  campaign = _yield$this$patch3.campaign;
8914
- return _context60.abrupt("return", campaign);
9109
+ return _context61.abrupt("return", campaign);
8915
9110
 
8916
9111
  case 5:
8917
9112
  case "end":
8918
- return _context60.stop();
9113
+ return _context61.stop();
8919
9114
  }
8920
9115
  }
8921
- }, _callee60, this);
9116
+ }, _callee61, this);
8922
9117
  }));
8923
9118
 
8924
- function resumeCampaign(_x82) {
9119
+ function resumeCampaign(_x84) {
8925
9120
  return _resumeCampaign.apply(this, arguments);
8926
9121
  }
8927
9122
 
@@ -8938,33 +9133,33 @@ var StreamChat = /*#__PURE__*/function () {
8938
9133
  }, {
8939
9134
  key: "testCampaign",
8940
9135
  value: function () {
8941
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id, params) {
9136
+ var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id, params) {
8942
9137
  var users, _yield$this$post3, campaign;
8943
9138
 
8944
- return _regeneratorRuntime.wrap(function _callee61$(_context61) {
9139
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
8945
9140
  while (1) {
8946
- switch (_context61.prev = _context61.next) {
9141
+ switch (_context62.prev = _context62.next) {
8947
9142
  case 0:
8948
9143
  users = params.users;
8949
- _context61.next = 3;
9144
+ _context62.next = 3;
8950
9145
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
8951
9146
  users: users
8952
9147
  });
8953
9148
 
8954
9149
  case 3:
8955
- _yield$this$post3 = _context61.sent;
9150
+ _yield$this$post3 = _context62.sent;
8956
9151
  campaign = _yield$this$post3.campaign;
8957
- return _context61.abrupt("return", campaign);
9152
+ return _context62.abrupt("return", campaign);
8958
9153
 
8959
9154
  case 6:
8960
9155
  case "end":
8961
- return _context61.stop();
9156
+ return _context62.stop();
8962
9157
  }
8963
9158
  }
8964
- }, _callee61, this);
9159
+ }, _callee62, this);
8965
9160
  }));
8966
9161
 
8967
- function testCampaign(_x83, _x84) {
9162
+ function testCampaign(_x85, _x86) {
8968
9163
  return _testCampaign.apply(this, arguments);
8969
9164
  }
8970
9165
 
@@ -8980,24 +9175,24 @@ var StreamChat = /*#__PURE__*/function () {
8980
9175
  }, {
8981
9176
  key: "enrichURL",
8982
9177
  value: function () {
8983
- var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(url) {
8984
- return _regeneratorRuntime.wrap(function _callee62$(_context62) {
9178
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(url) {
9179
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
8985
9180
  while (1) {
8986
- switch (_context62.prev = _context62.next) {
9181
+ switch (_context63.prev = _context63.next) {
8987
9182
  case 0:
8988
- return _context62.abrupt("return", this.get(this.baseURL + "/og", {
9183
+ return _context63.abrupt("return", this.get(this.baseURL + "/og", {
8989
9184
  url: url
8990
9185
  }));
8991
9186
 
8992
9187
  case 1:
8993
9188
  case "end":
8994
- return _context62.stop();
9189
+ return _context63.stop();
8995
9190
  }
8996
9191
  }
8997
- }, _callee62, this);
9192
+ }, _callee63, this);
8998
9193
  }));
8999
9194
 
9000
- function enrichURL(_x85) {
9195
+ function enrichURL(_x87) {
9001
9196
  return _enrichURL.apply(this, arguments);
9002
9197
  }
9003
9198
 
@@ -9014,22 +9209,22 @@ var StreamChat = /*#__PURE__*/function () {
9014
9209
  }, {
9015
9210
  key: "getTask",
9016
9211
  value: function () {
9017
- var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id) {
9018
- return _regeneratorRuntime.wrap(function _callee63$(_context63) {
9212
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id) {
9213
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
9019
9214
  while (1) {
9020
- switch (_context63.prev = _context63.next) {
9215
+ switch (_context64.prev = _context64.next) {
9021
9216
  case 0:
9022
- return _context63.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9217
+ return _context64.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9023
9218
 
9024
9219
  case 1:
9025
9220
  case "end":
9026
- return _context63.stop();
9221
+ return _context64.stop();
9027
9222
  }
9028
9223
  }
9029
- }, _callee63, this);
9224
+ }, _callee64, this);
9030
9225
  }));
9031
9226
 
9032
- function getTask(_x86) {
9227
+ function getTask(_x88) {
9033
9228
  return _getTask.apply(this, arguments);
9034
9229
  }
9035
9230
 
@@ -9047,36 +9242,39 @@ var StreamChat = /*#__PURE__*/function () {
9047
9242
  }, {
9048
9243
  key: "deleteChannels",
9049
9244
  value: function () {
9050
- var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(cids) {
9245
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(cids) {
9051
9246
  var options,
9052
- _args64 = arguments;
9053
- return _regeneratorRuntime.wrap(function _callee64$(_context64) {
9247
+ _args65 = arguments;
9248
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
9054
9249
  while (1) {
9055
- switch (_context64.prev = _context64.next) {
9250
+ switch (_context65.prev = _context65.next) {
9056
9251
  case 0:
9057
- options = _args64.length > 1 && _args64[1] !== undefined ? _args64[1] : {};
9058
- _context64.next = 3;
9252
+ options = _args65.length > 1 && _args65[1] !== undefined ? _args65[1] : {};
9253
+ _context65.next = 3;
9059
9254
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
9060
9255
  cids: cids
9061
9256
  }, options));
9062
9257
 
9063
9258
  case 3:
9064
- return _context64.abrupt("return", _context64.sent);
9259
+ return _context65.abrupt("return", _context65.sent);
9065
9260
 
9066
9261
  case 4:
9067
9262
  case "end":
9068
- return _context64.stop();
9263
+ return _context65.stop();
9069
9264
  }
9070
9265
  }
9071
- }, _callee64, this);
9266
+ }, _callee65, this);
9072
9267
  }));
9073
9268
 
9074
- function deleteChannels(_x87) {
9269
+ function deleteChannels(_x89) {
9075
9270
  return _deleteChannels.apply(this, arguments);
9076
9271
  }
9077
9272
 
9078
9273
  return deleteChannels;
9079
9274
  }()
9275
+ }, {
9276
+ key: "deleteUsers",
9277
+ value:
9080
9278
  /**
9081
9279
  * deleteUsers - Batch Delete Users
9082
9280
  *
@@ -9085,17 +9283,14 @@ var StreamChat = /*#__PURE__*/function () {
9085
9283
  *
9086
9284
  * @return {APIResponse} A task ID
9087
9285
  */
9088
-
9089
- }, {
9090
- key: "deleteUsers",
9091
- value: function () {
9092
- var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(user_ids, options) {
9093
- return _regeneratorRuntime.wrap(function _callee65$(_context65) {
9286
+ function () {
9287
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(user_ids, options) {
9288
+ return _regeneratorRuntime.wrap(function _callee66$(_context66) {
9094
9289
  while (1) {
9095
- switch (_context65.prev = _context65.next) {
9290
+ switch (_context66.prev = _context66.next) {
9096
9291
  case 0:
9097
9292
  if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
9098
- _context65.next = 2;
9293
+ _context66.next = 2;
9099
9294
  break;
9100
9295
  }
9101
9296
 
@@ -9103,7 +9298,7 @@ var StreamChat = /*#__PURE__*/function () {
9103
9298
 
9104
9299
  case 2:
9105
9300
  if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
9106
- _context65.next = 4;
9301
+ _context66.next = 4;
9107
9302
  break;
9108
9303
  }
9109
9304
 
@@ -9111,30 +9306,30 @@ var StreamChat = /*#__PURE__*/function () {
9111
9306
 
9112
9307
  case 4:
9113
9308
  if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
9114
- _context65.next = 6;
9309
+ _context66.next = 6;
9115
9310
  break;
9116
9311
  }
9117
9312
 
9118
9313
  throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
9119
9314
 
9120
9315
  case 6:
9121
- _context65.next = 8;
9316
+ _context66.next = 8;
9122
9317
  return this.post(this.baseURL + "/users/delete", _objectSpread({
9123
9318
  user_ids: user_ids
9124
9319
  }, options));
9125
9320
 
9126
9321
  case 8:
9127
- return _context65.abrupt("return", _context65.sent);
9322
+ return _context66.abrupt("return", _context66.sent);
9128
9323
 
9129
9324
  case 9:
9130
9325
  case "end":
9131
- return _context65.stop();
9326
+ return _context66.stop();
9132
9327
  }
9133
9328
  }
9134
- }, _callee65, this);
9329
+ }, _callee66, this);
9135
9330
  }));
9136
9331
 
9137
- function deleteUsers(_x88, _x89) {
9332
+ function deleteUsers(_x90, _x91) {
9138
9333
  return _deleteUsers.apply(this, arguments);
9139
9334
  }
9140
9335
 
@@ -9234,5 +9429,5 @@ var BuiltinPermissions = {
9234
9429
  UseFrozenChannel: 'Send messages and reactions to frozen channels'
9235
9430
  };
9236
9431
 
9237
- export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, chatCodes, decodeBase64, encodeBase64, isOwnUser, isValidEventType, logChatPromiseExecution };
9432
+ export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, isValidEventType, logChatPromiseExecution };
9238
9433
  //# sourceMappingURL=index.es.js.map